| allanalcantara |
05-04-2011 02:23 PM |
PvP Trader
Com esse MOD Os jogadores serão capazes de escolher uma recompensa (tornar-se herói até a reinicialização, tornar-se noblesse, conseguir alguma coisa (item), pegue o skill (habilidades item sugerido). Assim, o exemplo recompensa sethero, admin definido, a custar 500 pvps. Após personagem escolhe esta recompensa , 500 pvps serão tomadas a partir dele, e ele se tornará herói até a reinicialização. Além disso, uma mensagem será enviada para ele. Veja configs para mais informações.
Código:
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 Anarchy
+ */
+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)
{
- Aqui está um exemplo de html, você deve colocá-lo em:
/ data / html / default (e como o nome, o id do seu NPC):
Código:
<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>
- Se você quiser mais recompensas a ser adicionadas, a resposta aqui (eu não vou adicionar recompensas bobas).
- Ele é codificado em l2jaCis, rev. 66.
- Para trabalhar, você deve fazer um npc com o tipo: L2PvpTrader.
- É 100% testado.
Divirta-se!
credits anarchy
adaptação allanalcantarA
|