Jump to content
  • 0

Help to fix exploit


DnR

Question

7 answers to this question

Recommended Posts

  • 0

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);

Link to comment
Share on other sites

  • 0

Tote logika de me boi8aei. :S

 

An exeis compiled pack , fisika kai se boithaei.

 

An exeis preconfigured , ontos den mporeis na kaneis tpt.

Link to comment
Share on other sites

  • 0

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?

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.


×
×
  • Create New...