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

    • all your doubts ask chatgpt, also ask what you could do yourself hahaha
    • This post originally appeared on MmoGah. Odin: Valhalla Rising is an ambitious open-world MMORPG developed with Unreal Engine 4, offering breathtaking visuals and immersive gameplay. I will share everything you need to know before starting it.     Re-rolling In Odin, re-rolling isn't a practical strategy. Unlike most gacha games, where it's common to reset for better initial pulls, Odin focuses heavily on long-term growth. The earlier you begin playing and developing your character, the more advantages you'll gain over time. Instead of spending your efforts on re-rolling for ideal equipment, it's better to dive in and start progressing right away.   Server Selection Before starting your character, selecting a server is a crucial step. Since Odin doesn't support cross-server gameplay, coordinating with your friends, family, or guildmates is essential to ensure everyone creates their characters on the same server. Take the time to plan with your group beforehand. After deciding on a server, your next major choice will be picking a class.   Class Breakdown Odin features four primary starting classes: Warrior, Sorceress, Rogue, and Priest. Each class comes with its own distinct playstyle and unique strengths, so choose wisely, as your selection is permanent. However, even free-to-play players can create up to three characters on one server, giving you the flexibility to try different options and find the one that matches your preferences.   Quest and Leveling Once your character is created, your initial objective is to work through the main questline. This acts as both a tutorial and a method for early leveling. Odin simplifies the process with a convenient quest button that handles navigation, starts dialogues, and even enables auto-combat. This user-friendly feature allows beginners to grasp the basics of the game without feeling overloaded.   Auto Combat and No Kill-steal Mode Auto combat is an essential feature in Odin, enabling your character to battle monsters autonomously. This system allows you to effortlessly gain experience and loot, even while you're busy studying, cooking, or unwinding. To optimize its use, activate the no-kill-steal mode. This setting prevents your character from targeting monsters already engaged by other players, helping you avoid conflicts or potential PvP situations. However, if a quest becomes difficult to complete due to overcrowded areas, you can temporarily disable this mode to overcome the obstacle and move forward.   Item Management and Potions Don't overlook the importance of consumable items, especially health potions. These can be purchased, along with buffs, from general merchants in villages, and they play a crucial role in improving your combat efficiency and ensuring your survival. Always aim to keep a full stock of HP potions and carry buffs that boost attack, defense, or regeneration in batches of 5-10 for convenience.   Once you've acquired your consumables, assign them to your quick slots located at the bottom center of the screen. Swiping down activates these slots, and items like potions will automatically be used when necessary, so you don't need to worry about them mid-battle. Keep a close eye on your potion reserves, as running out during a tough fight could leave you vulnerable before reaching a safe area. In the early stages of the game, it's better to return to town for a restock if supplies are low rather than risking unnecessary defeats. You can also enable notifications to alert you when your health or potion count drops too low—a handy feature for staying prepared if your attention is elsewhere.   Leveling and AFK Farming Once you've mastered the fundamentals, the next step is to focus on leveling up and enhancing your character. Gaining levels is your primary source of progression early on, as it not only improves your stats but also unlocks crucial game features and new abilities. At this stage, simply sticking to the main questline provides a reliable and efficient way to gain experience.   Additionally, Odin includes a highly convenient idle feature called AFK mode. This allows your character to keep farming for resources and experience even when the game is closed, with a maximum duration of 8 hours per day. It's an excellent option for making progress while you're asleep, commuting, or otherwise occupied.   Gear Upgrades When the time comes to improve your gear, the initial focus should be on upgrading from normal-grade equipment to high-grade items. These provide significantly better stats and can be enhanced further to increase their effectiveness. Enhancing requires enhancement stones and gold, but it's important to stay within the safe enhancement limit. Attempting upgrades beyond this limit carries the risk of destroying your gear if the enhancement fails. Stick to safe enhancements until you've gained more experience and accumulated spare equipment to mitigate potential losses.   Skill Purchases When you've accumulated enough gold, it's time to invest in skills. These are crucial for enhancing your combat abilities and provide key benefits tailored to your class, whether it's increasing damage output, improving healing capabilities, or adding valuable utility. Before purchasing, ensure your character meets the level prerequisites for each skill. Your ultimate goal will be progressing through and completing the main questline in Midgard as you continue to develop your character.   Unlocking Jotenheim Finishing this milestone grants you access to the next region, Jetunheim, unlocking a variety of new content and challenges. This marks your first significant achievement in the game and is an essential early objective to strive for as you progress.   Joining a Guild Joining a guild is a highly beneficial step in Odin. Guilds not only provide opportunities for social interaction and group activities but also offer passive bonuses that can significantly enhance your gameplay. Even if you're not particularly active socially, being part of any guild is advantageous. The guild feature becomes accessible after completing Chapter 4, Quest 19 of the main story.   Guilds provide various perks, including buffs that scale with the guild's level. Additionally, you can earn guild coins by contributing through donations, quest completions, or regular logins. These coins can be exchanged for valuable rewards, such as epic-grade armor. The more you actively contribute to your guild, the greater the overall benefits for both you and the guild itself. Joining early and staying involved will undoubtedly strengthen your progression in the game.   Conclusion Here is the end of this beginners' guide. I hope these tips will help you level fast in Odin.
    • You can actually make a pseudomount code in your server, that way it can be displayed.. a friend made it for the l2off and i extended it a bit.. if u have l2off i might be able to help u on that
    • Discord : utchiha_market Telegram : https://t.me/utchiha_market Auto Buy Store : https://utchihamkt.mysellauth.com/ Join our server for more products : https://discord.gg/uthciha-services https://campsite.bio/utchihaamkt
  • Topics

×
×
  • Create New...