Jump to content

Recommended Posts

Posted

Hi guys. I(and i mean I) created a custom item(configurable id), that when you click it, it will give you pvp pk points of your choice(configurable) and it will delete the item(i didn't have to write this :P). It cannot be used during olympiad(configurable), during you are dead(non-configurable), if you are not nobless(configurable), if you are not hero(configurable), if you are not with a subclass(configurable) or if you are not at the required level(configurable). It was a bit tricky to make it, because i had to create(actually c/p and change sth) new methods in L2PcInstance. Anyway here:

Index: gameserver/java/net/sf/l2j/Config.java
===================================================================
--- gameserver/java/net/sf/l2j/Config.java	(revision 29)
+++ gameserver/java/net/sf/l2j/Config.java	(working copy)
@@ -42,6 +42,16 @@
{
     protected static final Logger _log = Logger.getLogger(Config.class.getName());
     
+    public static boolean ALLOW_PVP_PK_ITEM;
+    public static int PVP_PK_ITEM_ID;
+    public static int PVP_PK_ITEM_LVL_NEEDED;
+    public static boolean PVP_PK_ITEM_IN_OLYMPIAD;
+    public static boolean PVP_PK_ITEM_SUBCLASS_NEEDED;
+    public static boolean PVP_PK_ITEM_HERO_NEEDED;
+    public static boolean PVP_PK_ITEM_NOBLE_NEEDED;
+    public static int PVP_PK_ITEM_PVPS_REWARD;
+    public static int PVP_PK_ITEM_PKS_REWARD;
+
	/**--------------------------------------------------
	// Property File Definitions
	//-------------------------------------------------*/
@@ -1058,6 +1068,15 @@
                 
     	        BUFFS_MAX_AMOUNT 		= Byte.parseByte(playersSettings.getProperty("maxbuffamount","24"));
     	        STORE_SKILL_COOLTIME 	= Boolean.parseBoolean(playersSettings.getProperty("StoreSkillCooltime", "true"));
+    	        ALLOW_PVP_PK_ITEM  	= Boolean.parseBoolean(playersSettings.getProperty("AllowPvpPkItem", "false"));
+    	        PVP_PK_ITEM_ID = Integer.parseInt(playersSettings.getProperty("PvpPkItemId", "6673"));
+    	        PVP_PK_ITEM_LVL_NEEDED = Integer.parseInt(playersSettings.getProperty("PvpPkItemLvlNeeded", "76"));
+    	        PVP_PK_ITEM_IN_OLYMPIAD 	= Boolean.parseBoolean(playersSettings.getProperty("PvpPkItemInOlympiad", "false"));
+    	        PVP_PK_ITEM_SUBCLASS_NEEDED 	= Boolean.parseBoolean(playersSettings.getProperty("PvpPkItemSubclassNedded", "true"));
+    	        PVP_PK_ITEM_HERO_NEEDED 	= Boolean.parseBoolean(playersSettings.getProperty("PvpPkItemHeroNeeded", "false"));
+    	        PVP_PK_ITEM_NOBLE_NEEDED 	= Boolean.parseBoolean(playersSettings.getProperty("PvpPkItemNobleNeeded", "true"));
+    	        PVP_PK_ITEM_PVPS_REWARD = Integer.parseInt(playersSettings.getProperty("PvpPkItemPvpsReward", "1000"));
+    	        PVP_PK_ITEM_PKS_REWARD = Integer.parseInt(playersSettings.getProperty("PvpPkItemPksReward", "1000"));
             }
             catch (Exception e)
             {
Index: gameserver/java/net/sf/l2j/gameserver/handler/itemhandlers/PvpPkItem.java
===================================================================
--- gameserver/java/net/sf/l2j/gameserver/handler/itemhandlers/PvpPkItem.java	(revision 0)
+++ gameserver/java/net/sf/l2j/gameserver/handler/itemhandlers/PvpPkItem.java	(revision 0)
@@ -0,0 +1,95 @@
+/*
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+ * 02111-1307, USA.
+ *
+ * http://www.gnu.org/copyleft/gpl.html
+ */
+package net.sf.l2j.gameserver.handler.itemhandlers;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.handler.IItemHandler;
+import net.sf.l2j.gameserver.model.L2Character;
+import net.sf.l2j.gameserver.model.L2ItemInstance;
+import net.sf.l2j.gameserver.model.L2World;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.actor.instance.L2PlayableInstance;
+import net.sf.l2j.gameserver.model.actor.stat.PcStat;
+import net.sf.l2j.gameserver.model.zone.type.L2BossZone;
+import net.sf.l2j.gameserver.network.L2GameClient;
+import net.sf.l2j.gameserver.network.serverpackets.CharInfo;
+import net.sf.l2j.gameserver.network.serverpackets.ItemList;
+import net.sf.l2j.gameserver.network.serverpackets.L2GameServerPacket;
+import net.sf.l2j.gameserver.network.serverpackets.UserInfo;
+import net.sf.l2j.gameserver.util.Broadcast;
+
+/**
+ * Beast SoulShot Handler
+ *
+ * @author Tempy
+ */
+public class PvpPkItem implements IItemHandler
+{
+    // All the item IDs that this handler knows.
+    private static final int[] ITEM_IDS = { Config.PVP_PK_ITEM_ID };
+    
+    public void useItem(L2PlayableInstance playable, L2ItemInstance item)
+    {
+        if(!(playable instanceof L2PcInstance))
+            return;
+        L2PcInstance activeChar = (L2PcInstance)playable;
+        if (activeChar.getLevel() < Config.PVP_PK_ITEM_LVL_NEEDED)
+        {
+        	activeChar.sendMessage("You need to be over level " +Config.PVP_PK_ITEM_LVL_NEEDED+ " to use this item.");
+        	return;
+        }
+        if (activeChar.isInOlympiadMode() && Config.PVP_PK_ITEM_IN_OLYMPIAD)
+        {
+        	activeChar.sendMessage("You cannot use this item in Olympiad Mode!");
+        	return;
+        }
+        if (activeChar.isAlikeDead())
+        {
+        	activeChar.sendMessage("You cannot use this item while you are dead!");
+        	return;
+        }
+        if (!activeChar.isSubClassActive() && Config.PVP_PK_ITEM_SUBCLASS_NEEDED)
+        {
+        	activeChar.sendMessage("You cannot use this item in your main class!");
+        	return;
+        }
+        if (!activeChar.isHero() && Config.PVP_PK_ITEM_HERO_NEEDED)
+        {
+        	activeChar.sendMessage("You cannot use this item if you are not hero!");
+        	return;
+        }
+        if (!activeChar.isNoble() && Config.PVP_PK_ITEM_NOBLE_NEEDED)
+        {
+        	activeChar.sendMessage("You cannot use this item if you are not noble!");
+        	return;
+        }
+        else
+        {
+        	activeChar.addPvpKills(Config.PVP_PK_ITEM_PVPS_REWARD);
+        	activeChar.addPkKills(Config.PVP_PK_ITEM_PKS_REWARD);
+            activeChar.sendMessage("Gratz! You have been rewarded with " +Config.PVP_PK_ITEM_PVPS_REWARD+ " pvps and " +Config.PVP_PK_ITEM_PKS_REWARD+ " pks!");
+            playable.destroyItem("Consume", item.getObjectId(), 1, null, false);
+        }
+    }
+
+    public int[] getItemIds()
+    {
+        return ITEM_IDS;
+    }
+}
Index: gameserver/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- gameserver/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(revision 29)
+++ gameserver/java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java	(working copy)
@@ -344,8 +344,8 @@

	private long _expBeforeDeath;
	private int _karma;
-	private int _pvpKills;
-	private int _pkKills;
+	public int _pvpKills;
+	public int _pkKills;
	private byte _pvpFlag;
	private byte _siegeState = 0;
	private int _curWeightPenalty = 0;
@@ -4338,7 +4338,23 @@
         // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
         sendPacket(new UserInfo(this));
     }
+    public void addPvpKills(int pvpKills)
+    {
+        // Add karma to attacker and increase its PK counter
+        setPvpKills(getPvpKills() + Config.PVP_PK_ITEM_PVPS_REWARD);

+        // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
+        sendPacket(new UserInfo(this));
+    }
+    public void addPkKills(int pkKills)
+    {
+        // Add karma to attacker and increase its PK counter
+        setPkKills(getPkKills() + Config.PVP_PK_ITEM_PKS_REWARD);
+
+        // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
+        sendPacket(new UserInfo(this));
+    }
+
     /**
      * Increase pk count, karma and send the info to the player
      *
Index: gameserver/java/net/sf/l2j/gameserver/handler/ItemHandler.java
===================================================================
--- gameserver/java/net/sf/l2j/gameserver/handler/ItemHandler.java	(revision 29)
+++ gameserver/java/net/sf/l2j/gameserver/handler/ItemHandler.java	(working copy)
@@ -18,6 +18,7 @@
  */
package net.sf.l2j.gameserver.handler;

+import net.sf.l2j.Config;
import java.util.Map;
import java.util.TreeMap;
import net.sf.l2j.gameserver.handler.itemhandlers.*;
@@ -60,6 +61,10 @@
         registerItemHandler(new PaganKeys());
		registerItemHandler(new Maps());
		registerItemHandler(new Potions());
+		if (Config.ALLOW_PVP_PK_ITEM)
+		{
+			registerItemHandler(new PvpPkItem());
+		}
		registerItemHandler(new Recipes());
         registerItemHandler(new RollingDice());
         registerItemHandler(new MysteryPotion());
Index: gameserver/java/config/players.properties
===================================================================
--- gameserver/java/config/players.properties	(revision 29)
+++ gameserver/java/config/players.properties	(working copy)
@@ -320,4 +320,30 @@
maxbuffamount = 24

# Store buffs/debuffs on user logout?
-StoreSkillCooltime = True
\ No newline at end of file
+StoreSkillCooltime = True
+
+#=============================================================
+#                        PVP - PK ITEM CONFIGS
+#=============================================================
+
+# Explanation: When a character is in the right conditions to use this item,
+# when he use it he will be rewarded with the pvps and pks amount you will choose.
+
+# Allow pvp pk item? Default: False
+AllowPvpPkItem = False
+# Item id for pvp pk item? Default: 6673
+PvpPkItemId = 6673
+# PvP Pk item level needed to use? Default: 76
+PvpPkItemLvlNeeded = 76
+# Allow to use pvp pk item in olympiad? Default: False
+PvpPkItemInOlympiad = False
+# Player must be in subclass to use pvp pk item? Default: True
+PvpPkItemSubclassNeeded = True
+# Player must be a server hero to use pvp pk item? Default: False
+PvpPkItemHeroNeeded = False
+# Player must be nobless to use pvp pk item? Default: True
+PvpPkItemNobleNeeded = True
+# How many pvps will the player be rewarded with if he use the item? Default: 1000
+PvpPkItemPvpsReward = 1000
+# How many pks will the player be rewarded with if he use the item? Default: 1000
+PvpPkItemPksReward = 1000
\ No newline at end of file

 

I don't need feedback, it is tested. Credits are 100% mine. Have Fun!

 

NOTE: It is coded on latest revision(29) of L2JaCis.

Posted

Well,

The code aint bad,ofc it can be done in a better way than this now.

Thanks for share.


Also i think it will ruin the gameplay >.>

Posted

Well,

The code aint bad,ofc it can be done in a better way than this now.

Thanks for share.


Also i think it will ruin the gameplay >.>

hmm why will it ruin the gameplay?

Posted

Bad idea.

An item to give pvps and pk....bahh...

No fun like that.

 

And btw what's the prob if he use it with main class?

or in olympiad?

some ppl might not want :D i liked the idea, because i thought the pvp pk color.... it could be nice in some servers....

Posted

Well,

The code aint bad,ofc it can be done in a better way than this now.

Thanks for share.


Also i think it will ruin the gameplay >.>

whats way is better?
Posted

whats way is better?

i think he means that i could use increasePvpKills() method and not create a new one. anyway that works too, doesn't it?

Posted

whats way is better?

Since he can use the methods which is exist,there's no reason to create new >.>

Also Olympus you use too many useless booleans >.>

Posted

Since he can use the methods which is exist,there's no reason to create new >.>

Also Olympus you use too many useless booleans >.>

i want ppl to FULLY configure it. also when i used existing methods i had so many errors.... nm i made 2 new methods, 4 lines each, will they cause lags? :D

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

    • never met a programmer that doesnt know english xD and as he said his knowledge and skills are beyond our imagination xD
    • nice work, welcome back to world of lineage development @melron 😄
    • He's likely baiting you to download his source full of backdoors indeed
    • Yeah inside router i had to enable udnp services 
    • Hello cheaters, As a team of avid developers and enthusiasts of Lineage 2, we are excited to present the L2 Control Hub, a groundbreaking plugin designed by myself and my collaborator, StinkyMadness. This innovative tool equips server administrators with powerful automation capabilities directly within the game's community board. L2 Control Hub simplifies the creation and management of automations, enabling you to customize your server operations without the need to modify the source code.   Key Features of L2 Control Hub: Robust Automation Triggers: Select from a plethora of triggers currently available, with continuous additions in the works to enhance your control options. Dynamic Conditions and Actions: Tailor your server operations with an extensive range of conditions and actions, ensuring flexible and precise control over game events and player interactions. Customizable Variables: Easily integrate server-specific variables from your database to further personalize and streamline your automations. Utilize these variables across various automation scenarios to cater to your specific server requirements. JavaScript Integration: Execute custom JavaScript codes that interact seamlessly with Java classes, bringing advanced functionalities to your server's ecosystem.   Explore L2 Control Hub in Action: We've prepared a series of video tutorials to demonstrate the capabilities of L2 Control Hub: Control Hub - Create a Simple Flow with 1 Condition and 1 Action: Get started with basic automations. Control Hub - Multiple Conditions with Multiple Actions: Explore more complex automations for detailed server management. Control Hub - Using Variables: Discover how to implement and use custom variables for tailored automations. Control Hub - Using JavaScript: Experience the power of custom scripts in enhancing your server functionality.   L2 Control Hub is currently about 70% complete, and we are actively developing and refining features. We invite you to join our ➡️ Discord community ⬅️ to engage with the development process, provide feedback, and be the first to test new features. Additionally, any updates or changes to the plugin are seamlessly delivered to all customers directly from our web server, ensuring your system is always up-to-date without the need for manual downloads.   Your game, your rules, automated. Join us in redefining server management in Lineage 2 and elevate your gaming community with unmatched automation capabilities. For more details, contact us directly to get started with L2 Control Hub.   Currently, the plugin is developed using aCis sources. We will continue with these sources until we finalize all the necessary details before proceeding to integrate with the more prominent sources available.       The L2 Control Hub is designed to extend beyond mere functional additions to your server. We are in the process of implementing a suite of advanced mechanisms, such as a vote manager capable of interfacing with any Lineage 2 voting site without requiring configuration, live statistics to provide admins with real-time insights, and an event engine that can generate any desired event within seconds. All these features will be seamlessly integrated into the module, enhancing your server management experience significantly.     Please note that L2 Control Hub will be a premium tool, reflecting the extensive features and benefits it offers. While we are finalizing the pricing structure, rest assured that we aim to deliver great value for your investment. We will announce the cost details soon on our platforms to ensure everyone is well-informed and can plan accordingly. Join us to take your server management to the next level with L2 Control Hub.     
  • Topics

×
×
  • Create New...