Guesswho777 Posted December 5, 2013 Posted December 5, 2013 Greetings l2j developers I have got a problem: I am using l2jserver and title color after restart becomes white. Can anyone help me solve this issue?
0 vampir Posted December 5, 2013 Posted December 5, 2013 Use character_variables Sql table: INSERT INTO character_variables VALUES (playerObjectId, "CustomTitle", titleValue);
0 Guesswho777 Posted December 5, 2013 Author Posted December 5, 2013 Thank you, but not working. This table was not used at all and had different column names.
0 vampir Posted December 5, 2013 Posted December 5, 2013 I ment, that's the table where Title Colors can be stored. You can do it in this way: 1. While color is changed, run method(done by you) storeTitleColor(player, newTitle); - player variable should be instance of L2PcInstance class(or however you have it called), newTitle should be String containing new Title(for example "FFFFFF") 2. Create private static void method named storeTitleColor and taking 2 arguments(L2PcInstance and String) 3. Create new Database Connection in the method(look for examples of similar usage in your pack, you can search by key words: "INSERT INTO") 4. Create query, that will insert into character_variables. Also think about the case when title is already stored, then you can delete current record(slower way) or add awesome word to query ON DUPLICATE KEY(look in google to know more, also to use it, you should set charId column and var column as Primary Keys. 5. To complete the query, just add statement.executeUpdate(); like in examples you have found. HF
0 Guesswho777 Posted December 5, 2013 Author Posted December 5, 2013 Thank you. Going to have some fun. lal.
0 xdem Posted December 5, 2013 Posted December 5, 2013 (edited) Connection con = L2DatabaseFactory.getConnection(); Statement st = con.createStatement(); st.executeUpdate("UPDATE characters SET title_color = x WHERE charId = x"); the x are the getters u have to make from the l2PcInstance code handwritten, maybe there are typos Edited December 5, 2013 by xdem
0 Guest Elfocrash Posted December 5, 2013 Posted December 5, 2013 Connection con = L2DatabaseFactory.getConnection(); Statement st = con.createStatement(); st.executeUpdate("UPDATE characters SET title_color = x WHERE charId = x"); the x are the getters u have to make from the l2PcInstance code handwritten, maybe there are typos you obviously need preparedstatement for something like that
0 xdem Posted December 5, 2013 Posted December 5, 2013 (edited) you obviously need preparedstatement for something like that works with statement too, but for this prepared is faster so yes PreparedStatement extends Statement Edited December 5, 2013 by xdem
0 Guest Elfocrash Posted December 5, 2013 Posted December 5, 2013 works with statement too, but for this prepared is faster so yes PreparedStatement extends Statement Statement cannot support the ?
0 xdem Posted December 5, 2013 Posted December 5, 2013 (edited) Statement cannot support the ? where is the ? both x u have the values from L2PcInstance, st.executeUpdate("UPDATE characters SET title_color = "+player.getAppearance().getTitlteColor()+" WHERE charId = "+player.getObjectId()); i was just bored to write the getters into the String Edited December 5, 2013 by xdem
0 Guest Elfocrash Posted December 5, 2013 Posted December 5, 2013 where is the ? both x u have the values from L2PcInstance, st.executeUpdate("UPDATE characters SET title_color = "+player.getAppearance().getTitlteColor()+" WHERE charId = "+player.getObjectId()); i was just bored to write the getters into the String oh i though that you meant that you gonna have ? indicators and statement.setString(1, shit); under the preparedstatement Yeah it can be done as you wrote too, however it is way too unefficient
0 vampir Posted December 5, 2013 Posted December 5, 2013 Connection con = L2DatabaseFactory.getConnection(); Statement st = con.createStatement(); st.executeUpdate("UPDATE characters SET title_color = x WHERE charId = x"); the x are the getters u have to make from the l2PcInstance code handwritten, maybe there are typos you obviously need different query for something like that
0 xdem Posted December 5, 2013 Posted December 5, 2013 you obviously need different query for something like that it works like a charm dude
0 vampir Posted December 5, 2013 Posted December 5, 2013 it works like a charm dude 1. It will change something, only if its previously inserted to character_variables table 2. "title_color" column name is wrong("val" is correct) 3. It will update all values of the character in that table, not only those regarding title.
0 xdem Posted December 5, 2013 Posted December 5, 2013 1. It will change something, only if its previously inserted to character_variables table 2. "title_color" column name is wrong("val" is correct) 3. It will update all values of the character in that table, not only those regarding title. 1. no 2. no 3. Nope
0 vampir Posted December 5, 2013 Posted December 5, 2013 1. no 2. no 3. Nope ah, just noticed you are talking about characters table. You are right, sorry
Question
Guesswho777
Greetings l2j developers
I have got a problem:
I am using l2jserver and title color after restart becomes white.
Can anyone help me solve this issue?
21 answers to this question
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now