Jump to content

[Share]PvP Trader.


Recommended Posts

Hi guys. I decided to make a new share. It may be similar to PvP Merchant, but it's not. It's a new share, created 100% by me. So what is it, it's not something special. Players will be able to choose a reward(become hero until restart, become noblesse, get something(item), get a skill(item skills suggested). So example, admin set sethero reward, to cost 500 pvps. After character chooses this reward, 500 pvps will be taken from him, and he will become hero until restart. Also a message will be sent to him. See configs for further info.

 

Here:

Index: java/config/npcs.properties
===================================================================
--- java/config/npcs.properties	(revision 66)
+++ java/config/npcs.properties	(working copy)
@@ -148,4 +148,25 @@
# The always on option allows to ignore all this and let all grids be active at all times
GridsAlwaysOn = False
GridNeighborTurnOnTime = 1
-GridNeighborTurnOffTime = 90
\ No newline at end of file
+GridNeighborTurnOffTime = 90
+
+# PvP Trader npc settings.
+
+# Set hero until restart.
+# How many pvps will it cost?
+SetHeroPvpCost = 500
+# Set noblesse.
+# How many pvps will it cost?
+SetNoblePvpCost = 250
+# Give item.
+# How many pvps will it cost?
+GiveItemPvpCost = 100
+ItemId = 3470
+ItemCount = 500
+# Get a skill.
+# Suggestion: Use augment skills.
+# How many pvps will it cost?
+GetASkillPvpCost = 1500
+# Default skill: Item Skill Active: Cheer (Increases your cp by 300.)
+SkillId = 3131
+SkillLvl = 10
\ No newline at end of file
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PvpTraderInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PvpTraderInstance.java	(revision 0)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PvpTraderInstance.java	(revision 0)
@@ -0,0 +1,119 @@
+/* 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.model.actor.instance;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.datatables.SkillTable;
+import net.sf.l2j.gameserver.model.L2Skill;
+import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
+import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;
+import net.sf.l2j.gameserver.templates.item.L2Item;
+
+/**
+ *
+ * @author  Olympus
+ */
+public class L2PvpTraderInstance extends L2NpcInstance
+{
+	public L2PvpTraderInstance(int objectId, L2NpcTemplate template)
+	{
+		super(objectId, template);
+	}
+	@Override
+	public void onBypassFeedback(L2PcInstance player, String command)
+	{
+		if (command.startsWith("setHero"))
+		{
+			if (player.isHero())
+			{
+				player.sendMessage("You are already hero.");
+				return;
+			}
+			else if (player.getPvpKills() < Config.SET_HERO_PVP_COST)
+			{
+				player.sendMessage("You need "+Config.SET_HERO_PVP_COST+" pvp(s) to become hero until restart.");
+				return;
+			}
+			else if (!player.isHero() && player.getPvpKills() >= Config.SET_HERO_PVP_COST)
+			{
+				player.setHero(true);
+				player.setPvpKills(player.getPvpKills() - Config.SET_HERO_PVP_COST);
+				player.broadcastUserInfo();
+				player.sendMessage("You have become a server hero until restart, and "+Config.SET_HERO_PVP_COST+" pvp(s) were taken from you.");
+			}
+		}
+		if (command.startsWith("setNoble"))
+		{
+			if (player.isNoble())
+			{
+				player.sendMessage("You are already noblesse.");
+				return;
+			}
+			else if (player.getPvpKills() < Config.SET_NOBLE_PVP_COST)
+			{
+				player.sendMessage("You need "+Config.SET_NOBLE_PVP_COST+" pvp(s) to become noblesse.");
+				return;
+			}
+			else if (!player.isNoble() && player.getPvpKills() >= Config.SET_NOBLE_PVP_COST)
+			{
+				player.setNoble(true);
+				player.setPvpKills(player.getPvpKills() - Config.SET_NOBLE_PVP_COST);
+				player.broadcastUserInfo();
+				player.sendMessage("You have become noblesse, and "+Config.SET_NOBLE_PVP_COST+" pvp(s) were taken from you.");
+			}
+		}
+		if (command.startsWith("addItem"))
+		{
+			if (player.getPvpKills() < Config.GIVE_ITEM_PVP_COST)
+			{
+				player.sendMessage("You need "+Config.SET_NOBLE_PVP_COST+" pvp(s) to get a reward.");
+				return;
+			}
+			else if (player.getPvpKills() >= Config.GIVE_ITEM_PVP_COST)
+			{
+				player.addItem("PvpReward", Config.ITEM_ID, Config.ITEM_COUNT, player, true);
+				player.setPvpKills(player.getPvpKills() - Config.GIVE_ITEM_PVP_COST);
+				player.broadcastUserInfo();
+				player.sendMessage("You have taken a reward and "+Config.GIVE_ITEM_PVP_COST+" pvp(s) have been taken from you. Check your inventory.");
+			}
+		}
+		if (command.startsWith("addSkill"))
+		{
+			if (player.getPvpKills() < Config.GET_A_SKILL_PVP_COST)
+			{
+				player.sendMessage("You need "+Config.GET_A_SKILL_PVP_COST+" pvp(s) to get a skill.");
+				return;
+			}
+			else if (player.getPvpKills() >= Config.GET_A_SKILL_PVP_COST)
+			{
+				L2Skill skill = null;
+				skill = SkillTable.getInstance().getInfo(Config.SKILL_ID, Config.SKILL_LVL);
+				player.addSkill(skill, true);
+				player.setPvpKills(player.getPvpKills() - Config.GET_A_SKILL_PVP_COST);
+				player.sendSkillList();
+				player.broadcastUserInfo();
+				player.sendMessage("You have learned "+skill.getName()+" lvl "+Config.SKILL_LVL+", and "+Config.GET_A_SKILL_PVP_COST+" pvp(s) have been taken from you. Check your skills list.");
+			}
+		}
+	}
+}
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java	(revision 66)
+++ java/net/sf/l2j/Config.java	(working copy)
@@ -296,6 +296,15 @@
    public static int GRID_NEIGHBOR_TURNON_TIME;
    public static int GRID_NEIGHBOR_TURNOFF_TIME;
    
+    public static int SET_HERO_PVP_COST;
+    public static int SET_NOBLE_PVP_COST;
+    public static int GIVE_ITEM_PVP_COST;
+    public static int ITEM_ID;
+    public static int ITEM_COUNT;
+    public static int GET_A_SKILL_PVP_COST;
+    public static int SKILL_ID;
+    public static int SKILL_LVL;
+    
    //--------------------------------------------------
	// Players
	//--------------------------------------------------
@@ -895,6 +904,15 @@
                GRIDS_ALWAYS_ON           	= Boolean.parseBoolean(npcsSettings.getProperty("GridsAlwaysOn", "False"));
                GRID_NEIGHBOR_TURNON_TIME 	= Integer.parseInt(npcsSettings.getProperty("GridNeighborTurnOnTime", "1"));
                GRID_NEIGHBOR_TURNOFF_TIME	= Integer.parseInt(npcsSettings.getProperty("GridNeighborTurnOffTime", "90"));
+                
+                SET_HERO_PVP_COST	= Integer.parseInt(npcsSettings.getProperty("SetHeroPvpCost", "500"));
+                SET_NOBLE_PVP_COST	= Integer.parseInt(npcsSettings.getProperty("SetNoblePvpCost", "250"));
+                GIVE_ITEM_PVP_COST	= Integer.parseInt(npcsSettings.getProperty("GiveItemPvpCost", "100"));
+                ITEM_ID	= Integer.parseInt(npcsSettings.getProperty("ItemId", "3470"));
+                ITEM_COUNT	= Integer.parseInt(npcsSettings.getProperty("ItemCount", "500"));
+                GET_A_SKILL_PVP_COST	= Integer.parseInt(npcsSettings.getProperty("GetASkillPvpCost", "1500"));
+                SKILL_ID	= Integer.parseInt(npcsSettings.getProperty("SkillId", "3131"));
+                SKILL_LVL	= Integer.parseInt(npcsSettings.getProperty("SkillLvl", "10"));
            }
            catch (Exception e)
            {

 

NOTES:

- Credits are mine, so messages as: "nab already shared", "seen this before here", will be ignored.

- Here is a sample html, you should put it at: /data/html/default(and ofc as name, the id of your npc):

<html><body><br>
<center>Welcome to PvP Trader!<br>
Select your reward:<br>
<a action="bypass -h npc_%objectId%_setHero">Make me hero until restart!</a><br>
<a action="bypass -h npc_%objectId%_setNoble">Make me noblesse!</a><br>
<a action="bypass -h npc_%objectId%_addItem">Give me something!</a><br>
<a action="bypass -h npc_%objectId%_addSkill">Give me a skill!</a></center>
</body></html>

- If you want more rewards to be added, reply here(i won't add silly rewards).

- It is coded on l2jaCis, rev. 66.

- In order to work, you should make an npc with type: L2PvpTrader.

- It is 100% tested.

 

Have fun!

Link to comment
Share on other sites

Hi guys. I decided to make a new share. It may be similar to PvP Merchant, but it's not. It's a new share, created 100% by me. So what is it, it's not something special. Players will be able to choose a reward(become hero until restart, become noblesse, get something(item), get a skill(item skills suggested). So example, admin set sethero reward, to cost 500 pvps. After character chooses this reward, 500 pvps will be taken from him, and he will become hero until restart. Also a message will be sent to him. See configs for further info.

 

Here:

Index: java/config/npcs.properties
===================================================================
--- java/config/npcs.properties	(revision 66)
+++ java/config/npcs.properties	(working copy)
@@ -148,4 +148,25 @@
# The always on option allows to ignore all this and let all grids be active at all times
GridsAlwaysOn = False
GridNeighborTurnOnTime = 1
-GridNeighborTurnOffTime = 90
\ No newline at end of file
+GridNeighborTurnOffTime = 90
+
+# PvP Trader npc settings.
+
+# Set hero until restart.
+# How many pvps will it cost?
+SetHeroPvpCost = 500
+# Set noblesse.
+# How many pvps will it cost?
+SetNoblePvpCost = 250
+# Give item.
+# How many pvps will it cost?
+GiveItemPvpCost = 100
+ItemId = 3470
+ItemCount = 500
+# Get a skill.
+# Suggestion: Use augment skills.
+# How many pvps will it cost?
+GetASkillPvpCost = 1500
+# Default skill: Item Skill Active: Cheer (Increases your cp by 300.)
+SkillId = 3131
+SkillLvl = 10
\ No newline at end of file
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PvpTraderInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PvpTraderInstance.java	(revision 0)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PvpTraderInstance.java	(revision 0)
@@ -0,0 +1,119 @@
+/* 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.model.actor.instance;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.datatables.SkillTable;
+import net.sf.l2j.gameserver.model.L2Skill;
+import net.sf.l2j.gameserver.model.actor.instance.L2NpcInstance;
+import net.sf.l2j.gameserver.templates.chars.L2NpcTemplate;
+import net.sf.l2j.gameserver.templates.item.L2Item;
+
+/**
+ *
+ * @author  Olympus
+ */
+public class L2PvpTraderInstance extends L2NpcInstance
+{
+	public L2PvpTraderInstance(int objectId, L2NpcTemplate template)
+	{
+		super(objectId, template);
+	}
+	@Override
+	public void onBypassFeedback(L2PcInstance player, String command)
+	{
+		if (command.startsWith("setHero"))
+		{
+			if (player.isHero())
+			{
+				player.sendMessage("You are already hero.");
+				return;
+			}
+			else if (player.getPvpKills() < Config.SET_HERO_PVP_COST)
+			{
+				player.sendMessage("You need "+Config.SET_HERO_PVP_COST+" pvp(s) to become hero until restart.");
+				return;
+			}
+			else if (!player.isHero() && player.getPvpKills() >= Config.SET_HERO_PVP_COST)
+			{
+				player.setHero(true);
+				player.setPvpKills(player.getPvpKills() - Config.SET_HERO_PVP_COST);
+				player.broadcastUserInfo();
+				player.sendMessage("You have become a server hero until restart, and "+Config.SET_HERO_PVP_COST+" pvp(s) were taken from you.");
+			}
+		}
+		if (command.startsWith("setNoble"))
+		{
+			if (player.isNoble())
+			{
+				player.sendMessage("You are already noblesse.");
+				return;
+			}
+			else if (player.getPvpKills() < Config.SET_NOBLE_PVP_COST)
+			{
+				player.sendMessage("You need "+Config.SET_NOBLE_PVP_COST+" pvp(s) to become noblesse.");
+				return;
+			}
+			else if (!player.isNoble() && player.getPvpKills() >= Config.SET_NOBLE_PVP_COST)
+			{
+				player.setNoble(true);
+				player.setPvpKills(player.getPvpKills() - Config.SET_NOBLE_PVP_COST);
+				player.broadcastUserInfo();
+				player.sendMessage("You have become noblesse, and "+Config.SET_NOBLE_PVP_COST+" pvp(s) were taken from you.");
+			}
+		}
+		if (command.startsWith("addItem"))
+		{
+			if (player.getPvpKills() < Config.GIVE_ITEM_PVP_COST)
+			{
+				player.sendMessage("You need "+Config.SET_NOBLE_PVP_COST+" pvp(s) to get a reward.");
+				return;
+			}
+			else if (player.getPvpKills() >= Config.GIVE_ITEM_PVP_COST)
+			{
+				player.addItem("PvpReward", Config.ITEM_ID, Config.ITEM_COUNT, player, true);
+				player.setPvpKills(player.getPvpKills() - Config.GIVE_ITEM_PVP_COST);
+				player.broadcastUserInfo();
+				player.sendMessage("You have taken a reward and "+Config.GIVE_ITEM_PVP_COST+" pvp(s) have been taken from you. Check your inventory.");
+			}
+		}
+		if (command.startsWith("addSkill"))
+		{
+			if (player.getPvpKills() < Config.GET_A_SKILL_PVP_COST)
+			{
+				player.sendMessage("You need "+Config.GET_A_SKILL_PVP_COST+" pvp(s) to get a skill.");
+				return;
+			}
+			else if (player.getPvpKills() >= Config.GET_A_SKILL_PVP_COST)
+			{
+				L2Skill skill = null;
+				skill = SkillTable.getInstance().getInfo(Config.SKILL_ID, Config.SKILL_LVL);
+				player.addSkill(skill, true);
+				player.setPvpKills(player.getPvpKills() - Config.GET_A_SKILL_PVP_COST);
+				player.sendSkillList();
+				player.broadcastUserInfo();
+				player.sendMessage("You have learned "+skill.getName()+" lvl "+Config.SKILL_LVL+", and "+Config.GET_A_SKILL_PVP_COST+" pvp(s) have been taken from you. Check your skills list.");
+			}
+		}
+	}
+}
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java	(revision 66)
+++ java/net/sf/l2j/Config.java	(working copy)
@@ -296,6 +296,15 @@
     public static int GRID_NEIGHBOR_TURNON_TIME;
     public static int GRID_NEIGHBOR_TURNOFF_TIME;
     
+    public static int SET_HERO_PVP_COST;
+    public static int SET_NOBLE_PVP_COST;
+    public static int GIVE_ITEM_PVP_COST;
+    public static int ITEM_ID;
+    public static int ITEM_COUNT;
+    public static int GET_A_SKILL_PVP_COST;
+    public static int SKILL_ID;
+    public static int SKILL_LVL;
+    
     //--------------------------------------------------
	// Players
	//--------------------------------------------------
@@ -895,6 +904,15 @@
                 GRIDS_ALWAYS_ON           	= Boolean.parseBoolean(npcsSettings.getProperty("GridsAlwaysOn", "False"));
                 GRID_NEIGHBOR_TURNON_TIME 	= Integer.parseInt(npcsSettings.getProperty("GridNeighborTurnOnTime", "1"));
                 GRID_NEIGHBOR_TURNOFF_TIME	= Integer.parseInt(npcsSettings.getProperty("GridNeighborTurnOffTime", "90"));
+                
+                SET_HERO_PVP_COST	= Integer.parseInt(npcsSettings.getProperty("SetHeroPvpCost", "500"));
+                SET_NOBLE_PVP_COST	= Integer.parseInt(npcsSettings.getProperty("SetNoblePvpCost", "250"));
+                GIVE_ITEM_PVP_COST	= Integer.parseInt(npcsSettings.getProperty("GiveItemPvpCost", "100"));
+                ITEM_ID	= Integer.parseInt(npcsSettings.getProperty("ItemId", "3470"));
+                ITEM_COUNT	= Integer.parseInt(npcsSettings.getProperty("ItemCount", "500"));
+                GET_A_SKILL_PVP_COST	= Integer.parseInt(npcsSettings.getProperty("GetASkillPvpCost", "1500"));
+                SKILL_ID	= Integer.parseInt(npcsSettings.getProperty("SkillId", "3131"));
+                SKILL_LVL	= Integer.parseInt(npcsSettings.getProperty("SkillLvl", "10"));
             }
             catch (Exception e)
             {

 

NOTES:

- Credits are mine, so messages as: "nab already shared", "seen this before here", will be ignored.

- Here is a sample html, you should put it at: /data/html/default(and ofc as name, the id of your npc):

<html><body><br>
<center>Welcome to PvP Trader!<br>
Select your reward:<br>
<a action="bypass -h npc_%objectId%_setHero">Make me hero until restart!</a><br>
<a action="bypass -h npc_%objectId%_setNoble">Make me noblesse!</a><br>
<a action="bypass -h npc_%objectId%_addItem">Give me something!</a><br>
<a action="bypass -h npc_%objectId%_addSkill">Give me a skill!</a></center>
</body></html>

- If you want more rewards to be added, reply here(i won't add silly rewards).

- It is coded on l2jaCis, rev. 66.

- In order to work, you should make an npc with type: L2PvpTrader.

- It is 100% tested.

 

Have fun!

Hey ,  i like your idea ! Its more usefull  than put the codes one by one , Wow pvp trader xD
Link to comment
Share on other sites

awesome i must add this to my server ! Thanks and gl

hmm thank you, but stop spamming, not only in my post but in others too..... anyway...

Link to comment
Share on other sites

Better to create on html window :) , but good try

wouldn't this be using python ? .. and that i know using python scripts lags pack or something like that, i don't really remember .. i read that somewhere else ..

 

@ontopic: nice one ;) this is new .. althought people will hate the idea of losing pvp points xD!

Link to comment
Share on other sites

wouldn't this be using python ? .. and that i know using python scripts lags pack or something like that, i don't really remember .. i read that somewhere else ..

 

@ontopic: nice one ;) this is new .. althought people will hate the idea of losing pvp points xD!

It can be done easily on java.
Link to comment
Share on other sites

I didn't understand Krash, what do you mean?

Now to choose what do you want you should write the command you can make it with options.
Link to comment
Share on other sites

So you want players to be able to use a command (.pvpreward example), and a window will open showing them their options?

Exactly , isn't better?
Link to comment
Share on other sites

Exactly , isn't better?

nope .. at least for me would be bad :(

it's ok keep it on shop, so people need to visit city or npc and don't have everything so easy.

Link to comment
Share on other sites

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.



×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock