Jump to content

Recommended Posts

Posted

I will start from credits: L2Oneo

This checks illegal skills on enter, useful especially on pvp servers you write the skills you allow on configs.

 

Patch:

Index: /trunk/Game/java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java
===================================================================
--- /trunk/Game/java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java (revision 153)
+++ /trunk/Game/java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java (revision 178)
@@ -315,4 +315,8 @@
         TvTEvent.onLogin(activeChar);
         CrownManager.getInstance().checkCrowns(activeChar);
+        if (Config.CHECK_SKILLS_ON_ENTER && !Config.SKILL_LEARN)
+        {
+        	activeChar.checkIlegalSkills();
+        }
	}

Index: /trunk/Game/java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java
===================================================================
--- /trunk/Game/java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java (revision 88)
+++ /trunk/Game/java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java (revision 178)
@@ -71,5 +71,5 @@
     {
         String[] commandStr = command.split(" ");
-        String actualCommand = commandStr[0]; // Get actual command
+        String actualCommand = commandStr[0];

         String cmdParams = "";
@@ -256,4 +256,9 @@
                     content.append("Change Subclass:<br>Which of the following sub classes would you like to change?<br>");
                     int classIndex = 1;
+
+                    if (Config.CHECK_SKILLS_ON_ENTER && !Config.SKILL_LEARN)
+                    {
+                    	player.checkIlegalSkills();
+                    }

                     for (Iterator<SubClass> subList = iterSubClasses(player); subList.hasNext();)
@@ -375,4 +380,9 @@
                         + CharTemplateTable.getClassNameById(player.getActiveClass()) + "</font>.");

+                    if (Config.CHECK_SKILLS_ON_ENTER && !Config.SKILL_LEARN)
+                    {
+                    	player.checkIlegalSkills();
+                    }
+
                     player.sendPacket(new SystemMessage(SystemMessageId.SUBCLASS_TRANSFER_COMPLETED)); // Transfer completed.
                     break;
@@ -410,4 +420,9 @@

                         player.sendPacket(new SystemMessage(SystemMessageId.ADD_NEW_SUBCLASS)); // Subclass added.
+
+                        if (Config.CHECK_SKILLS_ON_ENTER && !Config.SKILL_LEARN)
+                        {
+                        	player.checkIlegalSkills();
+                        }
                     }
                     else
Index: /trunk/Game/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- /trunk/Game/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 161)
+++ /trunk/Game/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 178)
@@ -10163,3 +10163,69 @@
		return _currentSkillWorldPosition;
	}
+
+	public void checkIlegalSkills()
+	{
+		boolean LegalSkill = false;
+
+		if (!isGM())
+		{
+			Collection<L2SkillLearn> skillTree = SkillTreeTable.getInstance().getAllowedSkills(getClassId());
+
+			for (L2Skill skill : getAllSkills())
+			{
+				int skillid = skill.getId();
+
+				LegalSkill = false;
+
+				for (L2SkillLearn temp : skillTree)
+				{
+					if (temp.getId() == skillid)
+						LegalSkill = true;
+				}
+
+				if (isCursedWeaponEquiped() && skillid == CursedWeaponsManager.getInstance().getCursedWeapon(_cursedWeaponEquipedId).getSkillId())
+				{
+					LegalSkill = true;
+				}
+
+				if (getClan() != null && (skillid >= 370 && skillid <= 391))
+				{
+					LegalSkill = true;
+				}
+
+				if (getClan() != null && (skillid == 246 || skillid == 247))
+				{
+					if (getClan().getLeaderId() == getObjectId())
+						LegalSkill = true;
+				}
+
+				if (skillid >= 1312 && skillid <= 1322)
+				{
+					LegalSkill = true;
+				}
+
+				if (skillid >= 1368 && skillid <= 1373)
+				{
+					LegalSkill = true;
+				}
+
+				if (skillid >= 3000 && skillid < 7000)
+				{
+					LegalSkill = true;
+				}
+
+				if (Config.ALLOWED_SKILLS_LIST.contains(skillid))
+				{
+					LegalSkill = true;
+				}
+
+				if (!LegalSkill)
+				{
+					removeSkill(skill);
+					sendMessage("[sVR]: Ilegal skill detected: "+skill.getName()+".");
+					sendMessage("[sVR]: The ilegal skill has been removed.");
+				}
+			}
+		}
+	}
}
Index: /trunk/Game/java/net/sf/l2j/Config.java
===================================================================
--- /trunk/Game/java/net/sf/l2j/Config.java (revision 136)
+++ /trunk/Game/java/net/sf/l2j/Config.java (revision 178)
@@ -589,4 +589,7 @@
     public static int                  CHAMPION_REWARD_ID;
     public static int                  CHAMPION_REWARD_QTY;
+    public static boolean              CHECK_SKILLS_ON_ENTER;
+    public static String               ALLOWED_SKILLS;
+    public static FastList<Integer>    ALLOWED_SKILLS_LIST = new FastList<Integer>();
     
     /** Events */
@@ -616,12 +619,12 @@
     public static String               GAME_VERSION;
     public static String               BUILD_DATE;
-    
+
     /** Data Version */
     public static String               DATA_VERSION;

     /** HexID */
-    public static int                 SERVER_ID;
-    public static byte[]              HEX_ID;
-    
+    public static int                  SERVER_ID;
+    public static byte[]               HEX_ID;
+
     /** Custom */
     // Comming Soon !
@@ -1324,4 +1327,11 @@
                 CHAMPION_REWARD_ID                           = Integer.parseInt(Mods.getProperty("ChampionRewardItemID", "6393"));
                 CHAMPION_REWARD_QTY                          = Integer.parseInt(Mods.getProperty("ChampionRewardItemQty", "1"));
+                CHECK_SKILLS_ON_ENTER                        = Boolean.parseBoolean(Mods.getProperty("CheckSkillsOnEnter", "False"));
+                ALLOWED_SKILLS                               = Mods.getProperty("AllowedSkills", "541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,617,618,619");
+                ALLOWED_SKILLS_LIST                          = new FastList<Integer>();
+                for (String id : ALLOWED_SKILLS.trim().split(","))
+                {
+                	ALLOWED_SKILLS_LIST.add(Integer.parseInt(id.trim()));
+                }
             }
             catch (Exception e)
@@ -1493,6 +1503,6 @@
                 Custom.load(is);
                 is.close();
-                
-                // Comming Soon
+
+                // Commgin Soon !
             }
             catch (Exception e)

I know shares that are not mine doesn't count a lot for the contest but someone might find it useful thanks thanks thanks.

Posted

this setting isnt already exist from the ready packs...?oO

Yes L2Oneo is very old pack

 

Whats the need, when the multiskill hack was fixed instead.

whar are you speaking about ?

Posted

whar are you speaking about ?

 

im talking about the stupidity of making codes to prevent "possible" hacks.. when its logical to fix the problem at its source? it means that instead of making a check on enter world or whatever.. you fix the villagemasterinstance and prevent the skill hack in the first place.

 

anyway, i guess this code is usefull if you dont know how and you wanna make something custom..

  • 7 months later...
Posted

Can create one command for this example . //checkskills and the source code checking automatic for skill and automatic delete the anonymous skills?

 

Sorry for my english ...thanks

  • 7 months later...
Posted

I will start from credits: L2Oneo

This checks illegal skills on enter, useful especially on pvp servers you write the skills you allow on configs.

 

Patch:

Index: /trunk/Game/java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java
===================================================================
--- /trunk/Game/java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java (revision 153)
+++ /trunk/Game/java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java (revision 178)
@@ -315,4 +315,8 @@
         TvTEvent.onLogin(activeChar);
         CrownManager.getInstance().checkCrowns(activeChar);
+        if (Config.CHECK_SKILLS_ON_ENTER && !Config.SKILL_LEARN)
+        {
+        	activeChar.checkIlegalSkills();
+        }
	}

Index: /trunk/Game/java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java
===================================================================
--- /trunk/Game/java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java (revision 88)
+++ /trunk/Game/java/net/sf/l2j/gameserver/model/actor/instance/L2VillageMasterInstance.java (revision 178)
@@ -71,5 +71,5 @@
     {
         String[] commandStr = command.split(" ");
-        String actualCommand = commandStr[0]; // Get actual command
+        String actualCommand = commandStr[0];

         String cmdParams = "";
@@ -256,4 +256,9 @@
                     content.append("Change Subclass:<br>Which of the following sub classes would you like to change?<br>");
                     int classIndex = 1;
+
+                    if (Config.CHECK_SKILLS_ON_ENTER && !Config.SKILL_LEARN)
+                    {
+                    	player.checkIlegalSkills();
+                    }

                     for (Iterator<SubClass> subList = iterSubClasses(player); subList.hasNext();)
@@ -375,4 +380,9 @@
                         + CharTemplateTable.getClassNameById(player.getActiveClass()) + "</font>.");

+                    if (Config.CHECK_SKILLS_ON_ENTER && !Config.SKILL_LEARN)
+                    {
+                    	player.checkIlegalSkills();
+                    }
+
                     player.sendPacket(new SystemMessage(SystemMessageId.SUBCLASS_TRANSFER_COMPLETED)); // Transfer completed.
                     break;
@@ -410,4 +420,9 @@

                         player.sendPacket(new SystemMessage(SystemMessageId.ADD_NEW_SUBCLASS)); // Subclass added.
+
+                        if (Config.CHECK_SKILLS_ON_ENTER && !Config.SKILL_LEARN)
+                        {
+                        	player.checkIlegalSkills();
+                        }
                     }
                     else
Index: /trunk/Game/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- /trunk/Game/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 161)
+++ /trunk/Game/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 178)
@@ -10163,3 +10163,69 @@
		return _currentSkillWorldPosition;
	}
+
+	public void checkIlegalSkills()
+	{
+		boolean LegalSkill = false;
+
+		if (!isGM())
+		{
+			Collection<L2SkillLearn> skillTree = SkillTreeTable.getInstance().getAllowedSkills(getClassId());
+
+			for (L2Skill skill : getAllSkills())
+			{
+				int skillid = skill.getId();
+
+				LegalSkill = false;
+
+				for (L2SkillLearn temp : skillTree)
+				{
+					if (temp.getId() == skillid)
+						LegalSkill = true;
+				}
+
+				if (isCursedWeaponEquiped() && skillid == CursedWeaponsManager.getInstance().getCursedWeapon(_cursedWeaponEquipedId).getSkillId())
+				{
+					LegalSkill = true;
+				}
+
+				if (getClan() != null && (skillid >= 370 && skillid <= 391))
+				{
+					LegalSkill = true;
+				}
+
+				if (getClan() != null && (skillid == 246 || skillid == 247))
+				{
+					if (getClan().getLeaderId() == getObjectId())
+						LegalSkill = true;
+				}
+
+				if (skillid >= 1312 && skillid <= 1322)
+				{
+					LegalSkill = true;
+				}
+
+				if (skillid >= 1368 && skillid <= 1373)
+				{
+					LegalSkill = true;
+				}
+
+				if (skillid >= 3000 && skillid < 7000)
+				{
+					LegalSkill = true;
+				}
+
+				if (Config.ALLOWED_SKILLS_LIST.contains(skillid))
+				{
+					LegalSkill = true;
+				}
+
+				if (!LegalSkill)
+				{
+					removeSkill(skill);
+					sendMessage("[sVR]: Ilegal skill detected: "+skill.getName()+".");
+					sendMessage("[sVR]: The ilegal skill has been removed.");
+				}
+			}
+		}
+	}
}
Index: /trunk/Game/java/net/sf/l2j/Config.java
===================================================================
--- /trunk/Game/java/net/sf/l2j/Config.java (revision 136)
+++ /trunk/Game/java/net/sf/l2j/Config.java (revision 178)
@@ -589,4 +589,7 @@
     public static int                  CHAMPION_REWARD_ID;
     public static int                  CHAMPION_REWARD_QTY;
+    public static boolean              CHECK_SKILLS_ON_ENTER;
+    public static String               ALLOWED_SKILLS;
+    public static FastList<Integer>    ALLOWED_SKILLS_LIST = new FastList<Integer>();
     
     /** Events */
@@ -616,12 +619,12 @@
     public static String               GAME_VERSION;
     public static String               BUILD_DATE;
-    
+
     /** Data Version */
     public static String               DATA_VERSION;

     /** HexID */
-    public static int                 SERVER_ID;
-    public static byte[]              HEX_ID;
-    
+    public static int                  SERVER_ID;
+    public static byte[]               HEX_ID;
+
     /** Custom */
     // Comming Soon !
@@ -1324,4 +1327,11 @@
                 CHAMPION_REWARD_ID                           = Integer.parseInt(Mods.getProperty("ChampionRewardItemID", "6393"));
                 CHAMPION_REWARD_QTY                          = Integer.parseInt(Mods.getProperty("ChampionRewardItemQty", "1"));
+                CHECK_SKILLS_ON_ENTER                        = Boolean.parseBoolean(Mods.getProperty("CheckSkillsOnEnter", "False"));
+                ALLOWED_SKILLS                               = Mods.getProperty("AllowedSkills", "541,542,543,544,545,546,547,548,549,550,551,552,553,554,555,556,557,558,617,618,619");
+                ALLOWED_SKILLS_LIST                          = new FastList<Integer>();
+                for (String id : ALLOWED_SKILLS.trim().split(","))
+                {
+                	ALLOWED_SKILLS_LIST.add(Integer.parseInt(id.trim()));
+                }
             }
             catch (Exception e)
@@ -1493,6 +1503,6 @@
                 Custom.load(is);
                 is.close();
-                
-                // Comming Soon
+
+                // Commgin Soon !
             }
             catch (Exception e)

I know shares that are not mine doesn't count a lot for the contest but someone might find it useful thanks thanks thanks.

 

Bad skill check already excists in l2j configs, idk for old packs but the latest freya has it on configs

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Posts

    • It's not because I'm an admin that he treated me differently. I actually gave him several clients from my side without him even knowing they came from me, and most of them had no issues. I was also waiting 3–4 weeks at times for things I bought from AvE, even when I was in a rush. He still delivered in the end. That said, I'm not defending him blindly. I'm just saying it's unlikely he’d risk scamming someone over 60–100€, especially knowing how quickly word spreads here.
    • For exact same reason - there were accusation that I scammed. When was it? 2016? But in that time, admins actually didn't listen. I got banned, then unbaned (when I prooved I've refunded) but I was trash talking to mods. When few months later same shit happened, Grisom (?) old global mod, banned me anyway. You can read somewhere on forum how I was shitting on him for doing that (from other account because original account was banned) - which was banned too. He is not here anymore I think. Back in the days I was well know for not carring that much if I was talking to mod or admin, I didn't hold my tongue. Now You know. Just like You know - if I delay, I deliver or refund. I'm not a scammer, even if my old time haterz love to repeat themselfs like mantra. I don't care.
    • Okay I respect that but why is your other account banned?   I don't think this happened just because you delayed somebodys work even in 2012
    • Do You understand the fact, I won't scam anyone? Can You grasp such idea?  Second of all, if a random restaurant on Google Maps has 599 positive reviews and few negative ones with 4,8* score, do You ask Google to block it's profile and burn the place down? No? Then why the fuck You are crying about my random delays? If someone can't get a CUSTOM DESIGN on time, I refund. I'm not 16  y.o. anymore. I don't make living out of this L2 bullshit. Never did. Since 2012 I've made shit tons of projects. How many delays did I have? 12? 15? Out of hundrets of projects. Calm Your tits please. If I would actually take 4k euro and NOT deliver and NOT refund - admins can ban me. So don't compare me to Simple. And just so You know, Celestine sent me customers, so it's not like I've worked with him on his account all the time. That's another thing You won't understand. I won't waste anymore time on You and any other cunt who never was my customer but is bitching just because he has nothing better to do in his life. You don't like my work? Hove along, I don't give a shit. 
  • Topics

×
×
  • Create New...