Jump to content

Recommended Posts

Posted

The patch wasn't created by me!! I haven't tested it! I just share it!

The patch covers two features:

 

It protects low lvls from being PK'd by high lvls.

 

Admin can specify the difference of the lvls. Then if difference of attacker lvl and target lvl is more than the specified difference, the target is protected only if all of the following is true:

 

   * target is not PK

   * target is not flagged (chaotic state)

   * target is not member of a clan that has mutual war with attacker's clan

   * target is not in PVP or SIEGE zone

 

 

I tested the patch and it works both for physical skills and magic skills.

 

It protects players from mass PK.

 

Admin can set limit for number of PKs within certain time and punishment if the limit is exceeded. Currently only jail punishment is supported.

Index: java/config/l2jmods.properties
===================================================================
--- java/config/l2jmods.properties	(revision 2814)
+++ java/config/l2jmods.properties	(working copy)
@@ -170,4 +170,25 @@
# - mana potion (item id 728), using skill id 2005
# Please, notice this is just core support, server administrator is requested to
# edit skill 2005 on DataPack to get them working
-EnableManaPotionSupport = False
\ No newline at end of file
+EnableManaPotionSupport = False
+
+#---------------------------------------------------------------
+# PK protection
+#---------------------------------------------------------------
+# Disables attacking char if the attacker's lvl minus victim's lvl is over
+# specified difference and the target is not flagged. For example, if you want
+# to disable PK'ing chars that are more than 20 lvls below attacker's lvl, set
+# the value to 20. Setting the value to 0 disables the feature.
+DisableAttackIfLvlDifferenceOver=0
+# If player has more than specified number of PKs in the monitored period,
+# he/she is automatically punished. If set to zero, this feature is disabled.
+PunishPKPlayerIfPKsOver=0
+# For what period (in seconds) the PKs should be monitored
+PKMonitorPeriod=3600
+# Punisment type:
+#   jail - char will be jailed
+PKPunishmentType=jail
+# Punishment length (in seconds)
+# If punishment type is jail then the punishment period should be divisable by
+# 60 as jail punishment is counted in minutes
+PKPunishmentPeriod=3600
\ No newline at end of file
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java	(revision 2814)
+++ java/net/sf/l2j/Config.java	(working copy)
@@ -561,6 +561,11 @@
    public static boolean	L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE;
    public static boolean	L2JMOD_ENABLE_WAREHOUSESORTING_FREIGHT;
    public static boolean 	L2JMOD_ENABLE_MANA_POTIONS_SUPPORT;
+    public static int           L2JMOD_DISABLE_ATTACK_IF_LVL_DIFFERENCE_OVER;
+    public static int           L2JMOD_PUNISH_PK_PLAYER_IF_PKS_OVER;
+    public static long          L2JMOD_PK_MONITOR_PERIOD;
+    public static String        L2JMOD_PK_PUNISHMENT_TYPE;
+    public static long          L2JMOD_PK_PUNISHMENT_PERIOD;
    
    /** ************************************************** **/
	/** L2JMods Settings -End                              **/
@@ -1768,6 +1773,12 @@
	                L2JMOD_ENABLE_WAREHOUSESORTING_CLAN     = Boolean.valueOf(L2JModSettings.getProperty("EnableWarehouseSortingClan", "False"));
	                L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE  = Boolean.valueOf(L2JModSettings.getProperty("EnableWarehouseSortingPrivate", "False"));
	                L2JMOD_ENABLE_WAREHOUSESORTING_FREIGHT  = Boolean.valueOf(L2JModSettings.getProperty("EnableWarehouseSortingFreight", "False"));
+
+                        L2JMOD_DISABLE_ATTACK_IF_LVL_DIFFERENCE_OVER = Integer.parseInt(L2JModSettings.getProperty("DisableAttackIfLvlDifferenceOver", "0"));
+                        L2JMOD_PUNISH_PK_PLAYER_IF_PKS_OVER = Integer.parseInt(L2JModSettings.getProperty("PunishPKPlayerIfPKsOver", "0"));
+                        L2JMOD_PK_MONITOR_PERIOD = Long.parseLong(L2JModSettings.getProperty("PKMonitorPeriod", "3600"));
+                        L2JMOD_PK_PUNISHMENT_TYPE = L2JModSettings.getProperty("PKPunishmentType", "jail");
+                        L2JMOD_PK_PUNISHMENT_PERIOD = Long.parseLong(L2JModSettings.getProperty("PKPunishmentPeriod", "3600"));

	                if (TVT_EVENT_PARTICIPATION_NPC_ID == 0)
	                {
@@ -2310,6 +2321,13 @@
        // L2JMod Mana potion
        else if (pName.equalsIgnoreCase("EnableManaPotionSupport")) L2JMOD_ENABLE_MANA_POTIONS_SUPPORT = Boolean.parseBoolean(pValue);

+        // L2JMOD Disable PK'ing Low Lvls
+        else if (pName.equalsIgnoreCase("DisableAttackIfLvlDifferenceOver")) L2JMOD_DISABLE_ATTACK_IF_LVL_DIFFERENCE_OVER = Integer.parseInt(pValue);
+        else if (pName.equalsIgnoreCase("PunishPKPlayerIfPKsOver")) L2JMOD_PUNISH_PK_PLAYER_IF_PKS_OVER = Integer.parseInt(pValue);
+        else if (pName.equalsIgnoreCase("PKMonitorPeriod")) L2JMOD_PK_MONITOR_PERIOD = Long.parseLong(pValue);
+        else if (pName.equalsIgnoreCase("PKPunishmentType")) L2JMOD_PK_PUNISHMENT_TYPE = pValue;
+        else if (pName.equalsIgnoreCase("PKPunishmentPeriod")) L2JMOD_PK_PUNISHMENT_PERIOD = Long.parseLong(pValue);
+
        // PvP settings
        else if (pName.equalsIgnoreCase("MinKarma")) KARMA_MIN_KARMA = Integer.parseInt(pValue);
        else if (pName.equalsIgnoreCase("MaxKarma")) KARMA_MAX_KARMA = Integer.parseInt(pValue);
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(revision 2814)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -307,10 +307,16 @@
		@Override
		public void doAttack(L2Character target)
        {
+                    if (target instanceof L2PcInstance &&
+                            isPKProtected((L2PcInstance) target)) {
+                        sendMessage("You cannot attack player with too low level.");
+                        sendPacket(ActionFailed.STATIC_PACKET);
+                    } else {
			super.doAttack(target);

			// cancel the recent fake-death protection instantly if the player attacks or casts spells
			getPlayer().setRecentFakeDeath(false);
+                    }
		}

		@Override
@@ -760,6 +766,9 @@
	private boolean _marryrequest = false;
	private boolean _marryaccepted = false;

+        /** L2JMOD PK protection **/
+        private List<Long> _pKsCounter = new FastList<Long>();
+
    /** Skill casting information (used to queue when several skills are cast in a short time) **/
    public class SkillDat
    {
@@ -5334,6 +5343,32 @@

        // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
        sendPacket(new UserInfo(this));
+
+        /** Mass PK protection stuff **/
+        if (Config.L2JMOD_PUNISH_PK_PLAYER_IF_PKS_OVER > 0) {
+            // Remove expired PKs
+            for (final Long pKTime : _pKsCounter) {
+                if (System.currentTimeMillis() - pKTime.longValue() >
+                        Config.L2JMOD_PK_MONITOR_PERIOD * 1000) {
+                    _pKsCounter.remove(pKTime);
+                } else {
+                    // We reached timestamps that are still valid
+                    break;
+                }
+            }
+
+            // Add new timestamp
+            _pKsCounter.add(Long.valueOf(System.currentTimeMillis()));
+
+            // If PK count is greater than limit then punish the char
+            if (_pKsCounter.size() > Config.L2JMOD_PUNISH_PK_PLAYER_IF_PKS_OVER) {
+                if ("jail".equals(Config.L2JMOD_PK_PUNISHMENT_TYPE)) {
+                    setPunishLevel(PunishLevel.JAIL,
+                            (int) (Config.L2JMOD_PK_PUNISHMENT_PERIOD / 60));
+                    sendMessage("Jailed for excessive PK.");
+                }
+            }
+        }
    }

	public int calculateKarmaLost(long exp)
@@ -8042,6 +8077,14 @@
			    break;
		}

+                if (target != this && target instanceof L2PcInstance &&
+                        skill.isOffensive() && isPKProtected((L2PcInstance) target)) {
+                    setIsCastingNow(false);
+                    sendMessage("You cannot attack player with too low level.");
+                    sendPacket(ActionFailed.STATIC_PACKET);
+                    return;
+                }
+
		// Notify the AI with AI_INTENTION_CAST and target
		getAI().setIntention(CtrlIntention.AI_INTENTION_CAST, skill, target);
    }
@@ -8578,6 +8621,43 @@
		return true;
	}

+        /**
+         * Checks whether <code>target</code> is PK protected when attacking
+         * by <code>this</code>. <code>target</code> is PK protected if it is
+         * not flagged, has no karma and difference between players lvl and
+         * target's lvl is above {@link
+         * net.sf.l2j.Config#L2JMOD_DISABLE_ATTACK_IF_LVL_DIFFERENCE_OVER}.
+         * <code>target</code> is not protected if in mutual war with attacker's
+         * clan or if in siege zone or pvp zone.
+         * 
+         * @param target attack target
+         *
+         * @return true if target is PK protected, otherwise false
+         */
+        public boolean isPKProtected(final L2PcInstance target) {
+            if (Config.L2JMOD_DISABLE_ATTACK_IF_LVL_DIFFERENCE_OVER > 0 &&
+                    target instanceof L2PcInstance) {
+                final L2PcInstance targetPlayer = (L2PcInstance) target;
+
+                if (targetPlayer.isInsideZone(L2Character.ZONE_SIEGE) ||
+                        targetPlayer.isInsideZone(L2Character.ZONE_PVP) ||
+                        (getClan() != null && targetPlayer.getClan() != null &&
+                        targetPlayer.getClan().isAtWarWith(getClanId()))) {
+                    return false;
+                }
+
+                if (targetPlayer.getPvpFlag() == 0 &&
+                        targetPlayer.getKarma() == 0 &&
+                        targetPlayer.getLevel() +
+                        Config.L2JMOD_DISABLE_ATTACK_IF_LVL_DIFFERENCE_OVER <
+                        getLevel()) {
+                    return true;
+                }
+            }
+
+            return false;
+        }
+
	/**
	 * Return True if the L2PcInstance is a Mage.<BR><BR>
	 */

That was the patch ...

Credits l2jserver member:fordfrog

 

  • 1 year later...
  • 3 weeks later...
Posted

has a problem when you take a pk, karma gets you there is going to kill the mobs to get the karma there suddenly takes jail. ja dare the mode has a bug in the code because he killing the mobs ta understand as if you are giving more pk, the right would be to count only the char's ...

 

  • 1 month later...
  • 3 months later...
  • 3 weeks later...
  • 1 month later...
Posted

fix for freya :P

 

 

                if (target != this && target instanceof L2PcInstance &&
                       skill.isOffensive() && isPKProtected((L2PcInstance) target)) {
                    setIsCastingNow(false);
                    sendMessage("You cannot attack player with too low level.");
                    sendPacket(ActionFailed.STATIC_PACKET);
-                   return;
+                  return false;
                }

 

  • 3 weeks later...
  • 3 years later...
  • 2 months later...

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

    • Get in touch via Discord, I created the autofarm you are looking for.   discord: admkelly
    • Classic move "its not a virus, all antiviruses are just wrong." The moment someone starts yelling "FIND THE MALICIOUS CODE" and mocking heuristic detection, its usually because there is something shady in there… or they have no clue what heuristic detection even is. If your files was clean, you wouldn’t be this defensive or getting personal.   when half the AV vendors are throwing out names like Trojan.Win32.Kasidet, Trj/Chgt.AD, and Gen:Variant.Tedy.537463, maybe it’s not "heuristics", maybe its just a shady-ass .rar. If there is smoke you don't argue with the smoke detector, you check the kitchen. But hey, maybe they all got paid too, right? 🤷‍♂️ the argue comes down to trusting you (a nobody) versus AV vendors   Popular threat label trojan.tedy Threat categories trojan  Family labels tedy   can i call you Teddy from now on? yes i can Teddy               Dont forget it was not something generic or maybe suspicious it just got detected with its specific version. and not only Teddy's Teddy some others too Kaspersky says Kasidet trojan keylogger, spyware, classic nasty stuff. Bitdefender, GData, VIPRE? Tedy variant, an actual known malware family. Panda, QuickHeal, Sophos, Fortinet everyone sees something dirty in there. But sure, they’re all wrong, and you’re the cybersecurity messiah who cracked the code. You really expect people to believe that 10 independent vendors with zero incentive to conspire against your .rar just happened to flag your file as malware… by accident? Maybe try this next time: instead of uploading garbage and calling people “idiots” when they don’t trust it, just don’t upload malware. Problem solved.
    • https://github.com/gawric/Guide-L2Unity/blob/main/Guide/Pakets/Blowfish/General description.md   Perhaps you will find it useful piece of encryption and decryption code from Acis Interlude   I transferred these methods to Unity c# and everything works fine   https://ibb.co/DHhP0JYr   I think the first 2 bytes are the packet size. Third byte packet id And then the information itself   It's all there in l2j servers  
    • Hello everyone, I'm facing exactly the same issue mentioned in this topic. I've correctly implemented several new mounts in my Lineage 2 Interlude server, but whenever I use the ride/mount action, the client always displays the default strider animation (lineagemonster.strider_m00), even though in my npcgrp.dat everything is correctly referenced to my custom ride.u files (e.g., ride.wolfhound_m00).   90102 Rider.wing_hound_vehicle Riders.wing_hound_vehicle_m00 2 RidersTex.wing_hound_t00 RidersTex.wing_hound_t01 0 1 0 1.00000000 0 1 4 ItemSound.armor_metal_weak_1 ItemSound.armor_leather_3 ItemSound.armor_metal_weak_3 ItemSound.armor_metal_weak_5 3 MonSound12.w_hound_dmg_1 MonSound12.w_hound_dmg_2 MonSound12.w_hound_dmg_3 0 1 0 LineageEffect.p_u002_a 0 50.00000000 250.00000000 70.00000000 0 1 41000 Rider.gray_horse Riders.gray_horse_m00 3 RidersTex.gray_horse.gray_horse_t00 RidersTex.gray_horse.gray_horse_t01 RidersTex.gray_horse.gray_horse_t02 0 1 0 1.05882394 0 1 4 MonSound.Hit_Shell_1 MonSound.Hit_normal_3 MonSound.Hit_Wood_3 MonSound.Hit_normal_12 3 MonSound.unicorn_b_dmg_1 MonSound.unicorn_b_dmg_2 MonSound.unicorn_b_dmg_3 0 1 0 LineageEffect.p_u002_a 0 50.00000000 250.00000000 70.00000000 0 1 41001 Rider.tawny_maned_lion Riders.tawny_maned_lion_m00 3 RidersTex.tawny_maned_lion.tawny_maned_lion_t00 RidersTex.tawny_maned_lion.tawny_maned_lion_t01 RidersTex.tawny_maned_lion.tawny_maned_lion_t02 0 1 0 1.50000000 0 1 5 MonSound.Hit_normal_12 MonSound.Hit_Normal_1 MonSound.Hit_Shell_3 MonSound.Hit_Shell_4 MonSound.Hit_Wet_4 3 MonSound.strider_dmg_1 MonSound.strider_dmg_2 MonSound.strider_dmg_3 0 1 0 LineageEffect.p_u002_a 0 50.00000000 250.00000000 70.00000000 0 1 41002 Rider.steam_sledge Riders.steam_sledge_m00 4 RidersTex.steam_sledge.steam_sledge_t00 RidersTex.steam_sledge.steam_sledge_t01 RidersTex.steam_sledge.steam_sledge_t02 RidersTex.steam_sledge.steam_sledge_t03 0 1 0 1.50000000 0 1 5 ItemSound.armor_metal_weak_3 ItemSound.armor_metal_weak_5 ItemSound.armor_metal_weak_10 ItemSound.armor_metal_alt_1 ItemSound.armor_metal_alt_6 3 MonSound.iron_golem_breathe MonSound.iron_golem_dmg_2 MonSound.iron_golem_dmg_3 0 1 0 LineageEffect.p_u002_a 0 50.00000000 250.00000000 70.00000000 0 1 41003 Rider.br_z_bike Riders.br_z_bike_m00 1 RidersTex.npc.br_z_bike_t00 0 1 0 1.00000000 0 1 5 MonSound.Hit_wood_1 MonSound.Hit_Wood_2 MonSound.Hit_Wood_3 MonSound.Hit_Wood_4 MonSound.Hit_Wood_5 0 0 1 0 LineageEffect.p_u002_a 0 50.00000000 250.00000000 70.00000000 0 1 41004 Rider.br_g_ant_princess Riders.g_ant_princess_m00 3 RidersTex.Npc.g_ant_princess_t00 RidersTex.Npc.g_ant_princess_t01 RidersTex.Npc.g_ant_princess_t02 0 1 0 1.39999998 0 1 4 MonSound.Hit_Normal_10 MonSound.Hit_Shell_2 MonSound.Hit_Wet_5 ItemSound.shield_bone_1 3 MonSound.queen_ant_dmg_1 MonSound.queen_ant_dmg_2 MonSound.queen_ant_dmg_3 0 1 0 LineageEffect.p_u002_a 0 50.00000000 250.00000000 70.00000000 0 1 41005 Rider.br_g_black_bear Riders.g_black_bear 2 RidersTex.Npc.g_black_bear_t00 RidersTex.Npc.g_black_bear_t01 0 1 0 1.39999998 0 1 4 MonSound.Hit_Normal_11 MonSound.Hit_Normal_13 MonSound.Hit_Wet_5 ItemSound.shield_bone_3 3 MonSound11.Kerberos_dmg01 MonSound11.Kerberos_dmg02 MonSound11.Kerberos_dmg03 0 1 0 LineageEffect.p_u002_a 0 50.00000000 250.00000000 70.00000000 0 1 41006 Rider.br_g_halloween_flying_broom Riders.g_halloween_flying_broom_m00 1 RidersTex.Npc.g_halloween_flying_broom 0 1 0 1.39999998 0 1 5 MonSound.Hit_wood_1 MonSound.Hit_Wood_2 MonSound.Hit_Wood_3 MonSound.Hit_Wood_4 MonSound.Hit_Wood_5 0 0 1 0 LineageEffect.p_u002_a 0 50.00000000 250.00000000 70.00000000 0 1 41007 Rider.illusion_vehicle Riders.illusion_vehicle_m00 2 RidersTex.bird_vehicle.bird_vehicle_t00 RidersTex.bird_vehicle.bird_vehicle_t01 0 1 0 1.05882394 0 1 4 MonSound.Hit_normal_3 MonSound.Hit_Wet_1 MonSound.Hit_Bone_2 MonSound.Hit_normal_12 0 0 1 0 LineageEffect.p_u002_a 0 50.00000000 250.00000000 70.00000000 0 1 41008 Rider.vehicle_lindvior Riders.vehicle_lindvior_m00 2 RidersTex.Vehicle_Lindvior.Vehicle_Lindvior_t00 RidersTex.Vehicle_Lindvior.Vehicle_Lindvior_t01 0 1 0 1.05882394 0 1 4 MonSound.Hit_Normal_1 MonSound.Hit_Wet_3 MonSound.Hit_Bone_8 MonSound.Hit_Wet_5 3 MonSound3.dragon_mage_dmg_1 MonSound3.dragon_mage_dmg_2 MonSound3.dragon_mage_dmg_3 0 1 0 LineageEffect.p_u002_a 0 50.00000000 250.00000000 70.00000000 0 1 41009 Rider.craft_vehicle_dwarf Riders.craft_vehicle_dwarf_m00 2 RidersTex.craft_vehicle_dwarf.craft_vehicle_dwarf_t00 RidersTex.craft_vehicle_dwarf.craft_vehicle_dwarf_t01 0 1 0 1.05882394 0 1 4 MonSound.Hit_Normal_1 MonSound.Hit_Wood_2 MonSound.Hit_Wood_3 MonSound.Hit_Normal_7 0 0 1 0 LineageEffect.p_u002_a 0 50.00000000 250.00000000 70.00000000 0 1 41010 Rider.eligor_vehicle Riders.eligor_vehicle_m00 2 RidersTex.eligor_vehicle.eligor_vehicle_t00 RidersTex.eligor_vehicle.eligor_vehicle_t01 0 1 0 1.00000000 0 1 4 MonSound.Hit_normal_3 MonSound.Hit_Wet_1 MonSound.Hit_Bone_2 MonSound.Hit_normal_12 3 MonSound16.kanilof_dmg_1 MonSound16.kanilof_dmg_2 MonSound16.kanilof_dmg_3 0 1 0 LineageEffect.p_u002_a 0 50.00000000 250.00000000 70.00000000 0 1 41011 Rider.elder_pegasus_vehicle Riders.elder_pegasus_vehicle_m00 2 RidersTex.elder_pegasus_vehicle.elder_pegasus_event_vehicle_t00 RidersTex.elder_pegasus_vehicle.elder_pegasus_event_vehicle_t01 0 1 0 1.00000000 0 1 5 MonSound.Hit_Normal_1 MonSound.Hit_Normal_6 MonSound.Hit_Normal_7 MonSound.Hit_Normal_8 MonSound.Hit_normal_12 3 MonSound12.cobalt_horse_dmg_1 MonSound12.cobalt_horse_dmg_2 MonSound12.cobalt_horse_dmg_3 0 1 0 LineageEffect.p_u002_a 0 50.00000000 250.00000000 70.00000000 0 1 41012 Rider.wing_hound_vehicle Riders.wing_hound_vehicle_m00 2 RidersTex.wing_hound_t00 RidersTex.wing_hound_t01 0 1 0 1.00000000 0 1 4 ItemSound.armor_metal_weak_1 ItemSound.armor_leather_3 ItemSound.armor_metal_weak_3 ItemSound.armor_metal_weak_5 3 MonSound12.w_hound_dmg_1 MonSound12.w_hound_dmg_2 MonSound12.w_hound_dmg_3 0 1 0 LineageEffect.p_u002_a 0 50.00000000 250.00000000 70.00000000 0 1 41013 Rider.sp_griffin_vehicle Riders.sp_griffin_vehicle_m00 3 RidersTex.griffin_vehicle.griffin_vehicle_t00 RidersTex.griffin_vehicle.griffin_vehicle_t01 RidersTex.griffin_vehicle.griffin_vehicle_t02 0 1 0 1.00000000 0 1 5 MonSound.Hit_Normal_1 MonSound.Hit_Normal_6 MonSound.Hit_Normal_7 MonSound.Hit_Normal_8 MonSound.Hit_normal_12 3 MonSound23.sp_griffin_dmg_1 MonSound23.sp_griffin_dmg_2 MonSound23.sp_griffin_dmg_3 0 1 0 LineageEffect.p_u002_a 0 50.00000000 250.00000000 70.00000000 0 1 I've examined the server-side code and realized the problem likely comes from the client only looking at the _rideType (which is 1 for STRIDER) and ignoring the _rideNpcId when determining which animation to load. @Banshee Garnet mentioned an "extended dll" - does this involve modifying the L2.dll or L2Client.dll so it checks the NpcId in addition to the rideType? Has anyone already made this modification and could share more details on how to proceed? Looking at l2royale.com, I can see they indeed have multiple functional mounts in their Interlude client. I'd like to understand which approach they used: Is it indeed a DLL modification? Which specific parts of the DLL need to be modified? Are there already patches or tools that allow adding this functionality? If anyone has successfully implemented multiple mounts in Interlude or knows the precise technical solution, I would be very grateful for any information or help. Thanks in advance!
  • Topics

×
×
  • Create New...