DnR Posted December 25, 2009 Posted December 25, 2009 Paidia sto The Kamael uparxei to exploit pou kaneis 2 chars me to idio name. Ekana search alla de vrika kapoio post na to fixarw. Yparxei kapoio fix?
0 ˚کe®κ Posted December 25, 2009 Posted December 25, 2009 auto einai gia interlude xriazete na to kaneis compile credits:theonegandalf Index: /trunk/L2JHardCode_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java =================================================================== --- /trunk/L2JHardCode_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java (revision 72) +++ /trunk/L2JHardCode_GameServer/java/net/sf/l2j/gameserver/network/clientpackets/CharacterCreate.java (revision 158) @@ -23,4 +23,5 @@ import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; +import java.util.concurrent.locks.ReentrantLock; import net.sf.l2j.Config; @@ -91,21 +92,5 @@ protected void runImpl() { - if (CharNameTable.getInstance().accountCharNumber(getClient().getAccountName()) >= Config.MAX_CHARACTERS_NUMBER_PER_ACCOUNT && Config.MAX_CHARACTERS_NUMBER_PER_ACCOUNT != 0) - { - if (Config.DEBUG) - _log.fine("Max number of characters reached. Creation failed."); - CharCreateFail ccf = new CharCreateFail(CharCreateFail.REASON_TOO_MANY_CHARACTERS); - sendPacket(ccf); - return; - } - else if (CharNameTable.getInstance().doesCharNameExist(_name)) - { - if (Config.DEBUG) - _log.fine("charname: "+ _name + " already exists. creation failed."); - CharCreateFail ccf = new CharCreateFail(CharCreateFail.REASON_NAME_ALREADY_EXISTS); - sendPacket(ccf); - return; - } - else if ((_name.length() < 3) || (_name.length() > 16) || !Util.isAlphaNumeric(_name) || !isValidName(_name)) + if ((_name.length() < 3) || (_name.length() > 16) || !Util.isAlphaNumeric(_name) || !isValidName(_name)) { if (Config.DEBUG) @@ -116,18 +101,47 @@ } - if (Config.DEBUG) - _log.fine("charname: " + _name + " classId: " + _classId); - - L2PcTemplate template = CharTemplateTable.getInstance().getTemplate(_classId); - if(template == null || template.classBaseLevel > 1) - { - CharCreateFail ccf = new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED); - sendPacket(ccf); - return; - } - - int objectId = IdFactory.getInstance().getNextId(); - L2PcInstance newChar = L2PcInstance.create(objectId, template, getClient().getAccountName(), - _name, _hairStyle, _hairColor, _face, _sex!=0); + L2PcInstance newChar = null; + L2PcTemplate template = null; + + /* + * Since checks for duplicate names are done using SQL, + * lock must be held until data is written to DB as well. + */ + synchronized (CharNameTable.getInstance()) + { + if (CharNameTable.getInstance().accountCharNumber(getClient().getAccountName()) >= Config.MAX_CHARACTERS_NUMBER_PER_ACCOUNT + && Config.MAX_CHARACTERS_NUMBER_PER_ACCOUNT != 0) + { + if (Config.DEBUG) + _log.fine("Max number of characters reached. Creation failed."); + CharCreateFail ccf = new CharCreateFail(CharCreateFail.REASON_TOO_MANY_CHARACTERS); + sendPacket(ccf); + return; + } + else if (CharNameTable.getInstance().doesCharNameExist(_name)) + { + if (Config.DEBUG) + _log.fine("charname: " + _name + " already exists. creation failed."); + CharCreateFail ccf = new CharCreateFail(CharCreateFail.REASON_NAME_ALREADY_EXISTS); + sendPacket(ccf); + return; + } + + template = CharTemplateTable.getInstance().getTemplate(_classId); + + if (Config.DEBUG) + _log.fine("charname: " + _name + " classId: " + _classId + " template: " + template); + + if (template == null || template.classBaseLevel > 1) + { + CharCreateFail ccf = new CharCreateFail(CharCreateFail.REASON_CREATION_FAILED); + sendPacket(ccf); + return; + } + + int objectId = IdFactory.getInstance().getNextId(); + newChar = L2PcInstance.create(objectId, template, getClient().getAccountName(), _name, _hairStyle, _hairColor, _face, _sex != 0); + } + newChar.setCurrentHp(template.baseHpMax); newChar.setCurrentCp(template.baseCpMax);
0 Commodus Posted December 25, 2009 Posted December 25, 2009 Tote logika de me boi8aei. :S An exeis compiled pack , fisika kai se boithaei. An exeis preconfigured , ontos den mporeis na kaneis tpt.
0 DnR Posted December 25, 2009 Author Posted December 25, 2009 An exeis compiled pack , fisika kai se boithaei. An exeis preconfigured , ontos den mporeis na kaneis tpt. Compiled exw alla sikwsa ton server prin liges wres kai den kserw polla. Mporeis na m peis pou 8a to kanw paste?
0 Commodus Posted December 25, 2009 Posted December 25, 2009 Psakse sto forum gia to pos na kaneis install ena java mod. Keyword : How to install a java mod
0 DnR Posted December 25, 2009 Author Posted December 25, 2009 Psakse sto forum gia to pos na kaneis install ena java mod. Keyword : How to install a java mod Ok euxaristw
Question
DnR
Paidia sto The Kamael uparxei to exploit pou kaneis 2 chars me to idio name.
Ekana search alla de vrika kapoio post na to fixarw.
Yparxei kapoio fix?
7 answers to this question
Recommended Posts