Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminTownWar.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminTownWar.java (revision 0)
+++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminTownWar.java (revision 0)
@@ -0,0 +1,185 @@
+
+package net.sf.l2j.gameserver.handler.admincommandhandlers;
+
+import java.util.Collection;
+
+import net.sf.l2j.Config;
+import net.sf.l2j.gameserver.Announcements;
+import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
+import net.sf.l2j.gameserver.instancemanager.TownManager;
+import net.sf.l2j.gameserver.model.L2Object;
+import net.sf.l2j.gameserver.model.L2World;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+import net.sf.l2j.gameserver.model.zone.type.L2TownZone;
+
+public class AdminTownWar implements IAdminCommandHandler
+{
+ private static final String[] ADMIN_COMMANDS =
+ {
+ "admin_townwar_start",
+ "admin_townwar_end"
+ };
+ private L2Object _activeObject;
+ public final L2Object getActiveObject()
+ {
+ return _activeObject;
+ }
+ public boolean useAdminCommand(String command, L2PcInstance activeChar)
+ {
+ if (command.startsWith("admin_townwar_start"))
+ {
+ startTW(activeChar);
+ }
+ if (command.startsWith("admin_townwar_end"))
+ {
+ endTW(activeChar);
+ }
+ return true;
+ }
+ @SuppressWarnings("deprecation")
+ private void startTW(L2PcInstance activeChar)
+ {
+ if (Config.TW_ALL_TOWNS)
+ {
+ TownManager.getTown(1).setParameter("isPeaceZone", "false");
+ TownManager.getTown(2).setParameter("isPeaceZone", "false");
+ TownManager.getTown(3).setParameter("isPeaceZone", "false");
+ TownManager.getTown(4).setParameter("isPeaceZone", "false");
+ TownManager.getTown(5).setParameter("isPeaceZone", "false");
+ TownManager.getTown(6).setParameter("isPeaceZone", "false");
+ TownManager.getTown(7).setParameter("isPeaceZone", "false");
+ TownManager.getTown(8).setParameter("isPeaceZone", "false");
+ TownManager.getTown(9).setParameter("isPeaceZone", "false");
+ TownManager.getTown(10).setParameter("isPeaceZone", "false");
+ TownManager.getTown(11).setParameter("isPeaceZone", "false");
+ TownManager.getTown(12).setParameter("isPeaceZone", "false");
+ TownManager.getTown(13).setParameter("isPeaceZone", "false");
+ TownManager.getTown(14).setParameter("isPeaceZone", "false");
+ TownManager.getTown(15).setParameter("isPeaceZone", "false");
+ TownManager.getTown(16).setParameter("isPeaceZone", "false");
+ TownManager.getTown(17).setParameter("isPeaceZone", "false");
+ TownManager.getTown(19).setParameter("isPeaceZone", "false");
+ TownManager.getTown(20).setParameter("isPeaceZone", "false");
+ }
+ if (!Config.TW_ALL_TOWNS && Config.TW_TOWN_ID != 18 && Config.TW_TOWN_ID != 21 && Config.TW_TOWN_ID != 22)
+ {
+ TownManager.getTown(Config.TW_TOWN_ID).setParameter("isPeaceZone", "false");
+ }
+
+ Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();
+ {
+ int x,y,z;
+ L2TownZone Town;
+ byte zonaPaz = 1;
+
+ for (L2PcInstance onlinePlayer : pls)
+ if (onlinePlayer.isOnline() == 1 )
+ {
+ x = onlinePlayer.getX();
+ y = onlinePlayer.getY();
+ z = onlinePlayer.getZ();
+
+ Town = TownManager.getTown(x, y, z);
+ if (Town != null)
+ {
+ if(Town.getTownId() == Config.TW_TOWN_ID && !Config.TW_ALL_TOWNS)
+ {
+ onlinePlayer.setInsideZone(zonaPaz, false);
+ onlinePlayer.revalidateZone(true);
+ }
+ else if (Config.TW_ALL_TOWNS)
+ {
+ onlinePlayer.setInsideZone(zonaPaz, false);
+ onlinePlayer.revalidateZone(true);
+ }
+ }
+ onlinePlayer.setInTownWar(true);
+ }
+ }
+
+ if (Config.TW_ALL_TOWNS)
+ {
+ Announcements.getInstance().announceToAll("All towns have been set war zone by " + activeChar.getName() + ".");
+ }
+ if (!Config.TW_ALL_TOWNS)
+ {
+ Announcements.getInstance().announceToAll(TownManager.getTown(Config.TW_TOWN_ID).getName() + " has been set war zone by " + activeChar.getName() + ".");
+ }
+ }
+
+
+ @SuppressWarnings("deprecation")
+ private void endTW(L2PcInstance activeChar)
+ {
+ if (Config.TW_ALL_TOWNS)
+ {
+ TownManager.getTown(1).setParameter("isPeaceZone", "true");
+ TownManager.getTown(2).setParameter("isPeaceZone", "true");
+ TownManager.getTown(3).setParameter("isPeaceZone", "true");
+ TownManager.getTown(4).setParameter("isPeaceZone", "true");
+ TownManager.getTown(5).setParameter("isPeaceZone", "true");
+ TownManager.getTown(6).setParameter("isPeaceZone", "true");
+ TownManager.getTown(7).setParameter("isPeaceZone", "true");
+ TownManager.getTown(8).setParameter("isPeaceZone", "true");
+ TownManager.getTown(9).setParameter("isPeaceZone", "true");
+ TownManager.getTown(10).setParameter("isPeaceZone", "true");
+ TownManager.getTown(11).setParameter("isPeaceZone", "true");
+ TownManager.getTown(12).setParameter("isPeaceZone", "true");
+ TownManager.getTown(13).setParameter("isPeaceZone", "true");
+ TownManager.getTown(14).setParameter("isPeaceZone", "true");
+ TownManager.getTown(15).setParameter("isPeaceZone", "true");
+ TownManager.getTown(16).setParameter("isPeaceZone", "true");
+ TownManager.getTown(17).setParameter("isPeaceZone", "true");
+ TownManager.getTown(19).setParameter("isPeaceZone", "true");
+ TownManager.getTown(20).setParameter("isPeaceZone", "true");
+ }
+ if (!Config.TW_ALL_TOWNS && Config.TW_TOWN_ID != 18 && Config.TW_TOWN_ID != 21 && Config.TW_TOWN_ID != 22)
+ {
+ TownManager.getTown(Config.TW_TOWN_ID).setParameter("isPeaceZone", "true");
+ }
+
+ Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();
+ {
+ int xx,yy,zz;
+ L2TownZone Town;
+ byte zonaPaz = 1;
+
+ for (L2PcInstance onlinePlayer : pls)
+ if (onlinePlayer.isOnline() == 1 )
+ {
+ xx = onlinePlayer.getX();
+ yy = onlinePlayer.getY();
+ zz = onlinePlayer.getZ();
+
+ Town = TownManager.getTown(xx,yy,zz);
+ if (Town != null)
+ {
+ if(Town.getTownId() == Config.TW_TOWN_ID && !Config.TW_ALL_TOWNS)
+ {
+ onlinePlayer.setInsideZone(zonaPaz, true);
+ onlinePlayer.revalidateZone(true);
+ }
+ else if (Config.TW_ALL_TOWNS)
+ {
+ onlinePlayer.setInsideZone(zonaPaz, true);
+ onlinePlayer.revalidateZone(true);
+ }
+ }
+ onlinePlayer.setInTownWar(false);
+ }
+ }
+ if (Config.TW_ALL_TOWNS)
+ {
+ Announcements.getInstance().announceToAll("All towns have been set back to normal by " + activeChar.getName() + ".");
+ }
+ if (!Config.TW_ALL_TOWNS)
+ {
+ Announcements.getInstance().announceToAll(TownManager.getTown(Config.TW_TOWN_ID).getName() + " has been set back to normal by " + activeChar.getName() + ".");
+ }
+ }
+
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+}\ No newline at end of file
Index: java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (revision 2797)
+++ java/net/sf/l2j/gameserver/handler/AdminCommandHandler.java (working copy)
@@ -105,6 +105,7 @@
registerAdminCommandHandler(new AdminTvTEvent());
registerAdminCommandHandler(new AdminUnblockIp());
registerAdminCommandHandler(new AdminZone());
+ registerAdminCommandHandler(new AdminTownWar());
_log.config("AdminCommandHandler: Loaded " + _datatable.size() + " handlers.");
}
Index: java/net/sf/l2j/gameserver/model/L2Character.java
===================================================================
--- java/net/sf/l2j/gameserver/model/L2Character.java (revision 2797)
+++ java/net/sf/l2j/gameserver/model/L2Character.java (working copy)
@@ -75,6 +75,7 @@
import net.sf.l2j.gameserver.model.itemcontainer.Inventory;
import net.sf.l2j.gameserver.model.quest.Quest;
import net.sf.l2j.gameserver.model.quest.QuestState;
+import net.sf.l2j.gameserver.model.zone.type.L2TownZone;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.network.serverpackets.ActionFailed;
import net.sf.l2j.gameserver.network.serverpackets.Attack;
@@ -559,8 +566,31 @@
* <li>Modify the position of the pet if necessary</li><BR><BR>
*
*/
+ private boolean _inTownWar;
+ public final boolean isinTownWar() { return _inTownWar; }
+ public final void setInTownWar(boolean value) { _inTownWar = value; }
public void teleToLocation(int x, int y, int z, boolean allowRandomOffset)
{
+ if(Config.TW_DISABLE_GK)
+ {
+ int x1,y1,z1;
+ x1 = getX();
+ y1 = getY();
+ z1 = getZ();
+ L2TownZone Town;
+ Town = TownManager.getTown(x1,y1,z1);
+ if (Town != null && isinTownWar() )
+ {
+ if (Town.getTownId() == Config.TW_TOWN_ID && !Config.TW_ALL_TOWNS)
+ {
+ return;
+ }
+ else if (Config.TW_ALL_TOWNS)
+ {
+ return;
+ }
+ }
+ }
// Stop movement
stopMove(null, false);
abortAttack();
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 2797)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -81,6 +81,7 @@
import net.sf.l2j.gameserver.instancemanager.ItemsOnGroundManager;
import net.sf.l2j.gameserver.instancemanager.QuestManager;
import net.sf.l2j.gameserver.instancemanager.SiegeManager;
+import net.sf.l2j.gameserver.instancemanager.TownManager;
import net.sf.l2j.gameserver.model.BlockList;
import net.sf.l2j.gameserver.model.FishData;
import net.sf.l2j.gameserver.model.L2AccessLevel;
@@ -139,6 +140,7 @@
import net.sf.l2j.gameserver.model.quest.Quest;
import net.sf.l2j.gameserver.model.quest.QuestState;
import net.sf.l2j.gameserver.model.quest.State;
+import net.sf.l2j.gameserver.model.zone.type.L2TownZone;
import net.sf.l2j.gameserver.network.L2GameClient;
import net.sf.l2j.gameserver.network.SystemMessageId;
import net.sf.l2j.gameserver.network.serverpackets.AbnormalStatusUpdate;
@@ -4950,6 +4952,26 @@
@Override
public boolean doDie(L2Character killer)
{
+ if (Config.TW_RESS_ON_DIE)
+ {
+ int x1,y1,z1;
+ x1 = getX();
+ y1 = getY();
+ z1 = getZ();
+ L2TownZone Town;
+ Town = TownManager.getTown(x1,y1,z1);
+ if (Town != null && isinTownWar())
+ {
+ if (Town.getTownId() == Config.TW_TOWN_ID && !Config.TW_ALL_TOWNS)
+ {
+ reviveRequest(this, null, false);
+ }
+ else if (Config.TW_ALL_TOWNS)
+ {
+ reviveRequest(this, null, false);
+ }
+ }
+ }
// Kill the L2PcInstance
if (!super.doDie(killer))
return false;
@@ -5283,6 +5285,25 @@
*/
public void increasePvpKills()
{
+ int x,y,z;
+ x = getX();
+ y = getY();
+ z = getZ();
+ L2TownZone Town;
+ Town = TownManager.getTown(x,y,z);
+ if (Town != null && isinTownWar())
+ {
+ if (Town.getTownId() == Config.TW_TOWN_ID && !Config.TW_ALL_TOWNS)
+ {
+ getInventory().addItem("TownWar", Config.TW_ITEM_ID, Config.TW_ITEM_AMOUNT, this, this);
+ sendMessage("You received your prize for a town war kill!");
+ }
+ else if (Config.TW_ALL_TOWNS)
+ {
+ getInventory().addItem("TownWar", Config.TW_ITEM_ID, Config.TW_ITEM_AMOUNT, this, this);
+ sendMessage("You received your prize for a town war kill!");
+ }
+ }
// Add karma to attacker and increase its PK counter
setPvpKills(getPvpKills() + 1);
@@ -5334,8 +5355,42 @@
newKarma = Integer.MAX_VALUE - getKarma();
// Add karma to attacker and increase its PK counter
+ int x,y,z;
+ x = getX();
+ y = getY();
+ z = getZ();
+ L2TownZone Town;
+ Town = TownManager.getTown(x,y,z);
+
setPkKills(getPkKills() + 1);
- setKarma(getKarma() + newKarma);
+ if (Town != null && isinTownWar())
+ {
+ //nothing
+ }
+ else if (Town != null && !isinTownWar())
+ {
+ setKarma(getKarma() + newKarma);
+ }
+ else if (Town == null)
+ {
+ setKarma(getKarma() + newKarma);
+ }
+
+
+ if (Town != null && isinTownWar())
+ {
+ if (Town.getTownId() == Config.TW_TOWN_ID && !Config.TW_ALL_TOWNS)
+ {
+ getInventory().addItem("TownWar", Config.TW_ITEM_ID, Config.TW_ITEM_AMOUNT, this, this);
+ sendMessage("You received your prize for a town war kill!");
+ }
+ else if (Config.TW_ALL_TOWNS && Town.getTownId() != 0)
+ {
+ getInventory().addItem("TownWar", Config.TW_ITEM_ID, Config.TW_ITEM_AMOUNT, this, this);
+ sendMessage("You received your prize for a town war kill!");
+ }
+ }
+
// Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
sendPacket(new UserInfo(this));
@@ -11945,30 +12084,51 @@
}
super.setIsCastingNow(value);
}
- public void checkItemRestriction()
- {
- for (int i = 0; i < Inventory.PAPERDOLL_TOTALSLOTS; i++)
+
+ /**
+ * @param b
+ */
+ private boolean isintwtown = false;
+
+ public boolean isInsideTWTown()
+ {
+ if (isintwtown)
{
- L2ItemInstance equippedItem = getInventory().getPaperdollItem(i);
- if (equippedItem != null && !equippedItem.getItem().checkCondition(this, this))
- {
- getInventory().unEquipItemInSlotAndRecord(i);
- if (equippedItem.isWear())
- continue;
- SystemMessage sm = null;
- if (equippedItem.getEnchantLevel() > 0)
- {
- sm = new SystemMessage(SystemMessageId.EQUIPMENT_S1_S2_REMOVED);
- sm.addNumber(equippedItem.getEnchantLevel());
- sm.addItemName(equippedItem);
- }
- else
- {
- sm = new SystemMessage(SystemMessageId.S1_DISARMED);
- sm.addItemName(equippedItem);
- }
- sendPacket(sm);
- }
+ return true;
}
- }
+ else
+ return false;
+
+ }
+
+ public void setInsideTWTown(boolean b)
+ {
+ isintwtown = true;
+ }
+ public void checkItemRestriction()
+ {
+ for (int i = 0; i < Inventory.PAPERDOLL_TOTALSLOTS; i++)
+ {
+ L2ItemInstance equippedItem = getInventory().getPaperdollItem(i);
+ if (equippedItem != null && !equippedItem.getItem().checkCondition(this, this))
+ {
+ getInventory().unEquipItemInSlotAndRecord(i);
+ if (equippedItem.isWear())
+ continue;
+ SystemMessage sm = null;
+ if (equippedItem.getEnchantLevel() > 0)
+ {
+ sm = new SystemMessage(SystemMessageId.EQUIPMENT_S1_S2_REMOVED);
+ sm.addNumber(equippedItem.getEnchantLevel());
+ sm.addItemName(equippedItem);
+ }
+ else
+ {
+ sm = new SystemMessage(SystemMessageId.S1_DISARMED);
+ sm.addItemName(equippedItem);
+ }
+ sendPacket(sm);
+ }
+ }
+ }
}
Index: java/net/sf/l2j/gameserver/instancemanager/TownManager.java
===================================================================
--- java/net/sf/l2j/gameserver/instancemanager/TownManager.java (revision 2797)
+++ java/net/sf/l2j/gameserver/instancemanager/TownManager.java (working copy)
@@ -14,12 +14,14 @@
*/
package net.sf.l2j.gameserver.instancemanager;
+import java.util.logging.Logger;
+
+import javolution.util.FastList;
import net.sf.l2j.gameserver.datatables.MapRegionTable;
import net.sf.l2j.gameserver.model.L2Object;
import net.sf.l2j.gameserver.model.entity.Castle;
+import net.sf.l2j.gameserver.model.zone.type.L2TownZone;
import net.sf.l2j.gameserver.model.zone.L2ZoneType;
-import net.sf.l2j.gameserver.model.zone.type.L2TownZone;
-
public class TownManager
{
//private static final Logger _log = Logger.getLogger(TownManager.class.getName());
@@ -167,12 +169,11 @@
public final static L2TownZone getTown(int townId)
{
- for (L2ZoneType temp : ZoneManager.getInstance().getAllZones())
- {
- if (temp instanceof L2TownZone && ((L2TownZone) temp).getTownId() == townId)
- return (L2TownZone) temp;
- }
- return null;
+ for (L2ZoneType temp : ZoneManager.getInstance().getAllZones())
+ {
+ if (temp instanceof L2TownZone && ((L2TownZone) temp).getTownId() == townId)
+ return (L2TownZone) temp;
+ } return null;
}
/**
@@ -184,11 +185,10 @@
*/
public final static L2TownZone getTown(int x, int y, int z)
{
- for (L2ZoneType temp : ZoneManager.getInstance().getZones(x, y, z))
- {
- if (temp instanceof L2TownZone)
- return (L2TownZone) temp;
- }
- return null;
+ for (L2ZoneType temp : ZoneManager.getInstance().getZones(x, y, z))
+ {
+ if (temp instanceof L2TownZone)
+ return (L2TownZone) temp;
+ } return null;
}
}
Index: java/net/sf/l2j/Config.java
===================================================================
--- java/net/sf/l2j/Config.java (revision 2797)
+++ java/net/sf/l2j/Config.java (working copy)
@@ -109,6 +109,7 @@
public static Map<Integer, Integer> SKILL_REUSE_LIST;
public static boolean AUTO_LEARN_SKILLS;
public static boolean AUTO_LOOT_HERBS;
+ public static boolean AUTO_LOOT_RAID;
public static byte BUFFS_MAX_AMOUNT;
public static byte DANCES_MAX_AMOUNT;
public static boolean AUTO_LEARN_DIVINE_INSPIRATION;
@@ -395,6 +396,7 @@
public static int MIN_MONSTER_ANIMATION;
public static int MAX_MONSTER_ANIMATION;
public static int COORD_SYNCHRONIZE;
+ public static int MULTISELL_MAX_AMOUNT;
public static boolean GRIDS_ALWAYS_ON;
public static int GRID_NEIGHBOR_TURNON_TIME;
public static int GRID_NEIGHBOR_TURNOFF_TIME;
@@ -560,7 +562,12 @@
public static boolean L2JMOD_ENABLE_WAREHOUSESORTING_CLAN;
public static boolean L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE;
public static boolean L2JMOD_ENABLE_WAREHOUSESORTING_FREIGHT;
-
+ public static int TW_TOWN_ID;
+ public static boolean TW_ALL_TOWNS;
+ public static int TW_ITEM_ID;
+ public static int TW_ITEM_AMOUNT;
+ public static boolean TW_ALLOW_KARMA;
+ public static boolean TW_DISABLE_GK;
+ public static boolean TW_RESS_ON_DIE;
/** ************************************************** **/
/** L2JMods Settings -End **/
/** ************************************************** **/
@@ -1344,6 +1351,7 @@
ALT_PARTY_RANGE2 = Integer.parseInt(Character.getProperty("AltPartyRange2", "1400"));
STARTING_ADENA = Integer.parseInt(Character.getProperty("StartingAdena", "100"));
AUTO_LOOT = Boolean.parseBoolean(Character.getProperty("AutoLoot", "true"));
+ AUTO_LOOT_RAID = Boolean.parseBoolean(Character.getProperty("AutoLootRaid", "true"));
UNSTUCK_INTERVAL = Integer.parseInt(Character.getProperty("UnstuckInterval", "300"));
PLAYER_SPAWN_PROTECTION = Integer.parseInt(Character.getProperty("PlayerSpawnProtection", "0"));
RESPAWN_RANDOM_ENABLED = Boolean.parseBoolean(Character.getProperty("RespawnRandomInTown", "False"));
@@ -1512,6 +1520,7 @@
MIN_MONSTER_ANIMATION = Integer.parseInt(General.getProperty("MinMonsterAnimation", "5"));
MAX_MONSTER_ANIMATION = Integer.parseInt(General.getProperty("MaxMonsterAnimation", "20"));
COORD_SYNCHRONIZE = Integer.parseInt(General.getProperty("CoordSynchronize", "-1"));
+ MULTISELL_MAX_AMOUNT = Integer.parseInt(General.getProperty("MaxAmountBuy", "5000"));
GRIDS_ALWAYS_ON = Boolean.parseBoolean(General.getProperty("GridsAlwaysOn", "False"));
GRID_NEIGHBOR_TURNON_TIME = Integer.parseInt(General.getProperty("GridNeighborTurnOnTime", "1"));
GRID_NEIGHBOR_TURNOFF_TIME = Integer.parseInt(General.getProperty("GridNeighborTurnOffTime", "90"));
@@ -1767,7 +1776,15 @@
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"));
-
+
+ TW_TOWN_ID = Integer.parseInt(L2JModSettings.getProperty("TWTownId", "9"));
+ TW_ALL_TOWNS = Boolean.parseBoolean(L2JModSettings.getProperty("TWAllTowns", "False"));
+ TW_ITEM_ID = Integer.parseInt(L2JModSettings.getProperty("TownWarItemId", "57"));
+ TW_ITEM_AMOUNT = Integer.parseInt(L2JModSettings.getProperty("TownWarItemAmount", "5000"));
+ TW_ALLOW_KARMA = Boolean.parseBoolean(L2JModSettings.getProperty("AllowKarma", "False"));
+ TW_DISABLE_GK = Boolean.parseBoolean(L2JModSettings.getProperty("DisableGK", "True"));
+ TW_RESS_ON_DIE = Boolean.parseBoolean(L2JModSettings.getProperty("SendRessOnDeath", "False"));
+
+
if (TVT_EVENT_PARTICIPATION_NPC_ID == 0)
{
TVT_EVENT_ENABLED = false;
@@ -2104,6 +2121,7 @@
else if (pName.equalsIgnoreCase("PreciseDropCalculation")) PRECISE_DROP_CALCULATION = Boolean.parseBoolean(pValue);
else if (pName.equalsIgnoreCase("MultipleItemDrop")) MULTIPLE_ITEM_DROP = Boolean.parseBoolean(pValue);
else if (pName.equalsIgnoreCase("CoordSynchronize")) COORD_SYNCHRONIZE = Integer.parseInt(pValue);
+ else if (pName.equalsIgnoreCase("MaxAmountBuy")) MULTISELL_MAX_AMOUNT = Integer.parseInt(pValue);
else if (pName.equalsIgnoreCase("DeleteCharAfterDays")) DELETE_DAYS = Integer.parseInt(pValue);
else if (pName.equalsIgnoreCase("AllowDiscardItem")) ALLOW_DISCARDITEM = Boolean.parseBoolean(pValue);
@@ -2249,6 +2267,7 @@
else if (pName.equalsIgnoreCase("LifeCrystalNeeded")) LIFE_CRYSTAL_NEEDED = Boolean.parseBoolean(pValue);
else if (pName.equalsIgnoreCase("SpBookNeeded")) SP_BOOK_NEEDED = Boolean.parseBoolean(pValue);
else if (pName.equalsIgnoreCase("AutoLoot")) AUTO_LOOT = Boolean.parseBoolean(pValue);
+ else if (pName.equalsIgnoreCase("AutoLootRaid")) AUTO_LOOT_RAID = Boolean.parseBoolean(pValue);
else if (pName.equalsIgnoreCase("AutoLootHerbs")) AUTO_LOOT_HERBS = Boolean.parseBoolean(pValue);
else if (pName.equalsIgnoreCase("AltKarmaPlayerCanBeKilledInPeaceZone")) ALT_GAME_KARMA_PLAYER_CAN_BE_KILLED_IN_PEACEZONE = Boolean.parseBoolean(pValue);
@@ -2298,7 +2317,14 @@
else if (pName.equalsIgnoreCase("TvTEventParticipationTime")) TVT_EVENT_PARTICIPATION_TIME = Integer.parseInt(pValue);
else if (pName.equalsIgnoreCase("TvTEventRunningTime")) TVT_EVENT_RUNNING_TIME = Integer.parseInt(pValue);
else if (pName.equalsIgnoreCase("TvTEventParticipationNpcId")) TVT_EVENT_PARTICIPATION_NPC_ID = Integer.parseInt(pValue);
-
+
+ else if (pName.equalsIgnoreCase("TownWarItemId")) TW_ITEM_ID = Integer.parseInt(pValue);
+ else if (pName.equalsIgnoreCase("TownWarItemAmount")) TW_ITEM_AMOUNT = Integer.parseInt(pValue);
+ else if (pName.equalsIgnoreCase("AllowKarma")) TW_ALLOW_KARMA = Boolean.parseBoolean(pValue);
+ else if (pName.equalsIgnoreCase("DisableGK")) TW_DISABLE_GK = Boolean.parseBoolean(pValue);
+ else if (pName.equalsIgnoreCase("TWTownId")) TW_TOWN_ID = Integer.parseInt(pValue);
+ else if (pName.equalsIgnoreCase("TWAllTowns")) TW_ALL_TOWNS = Boolean.parseBoolean(pValue);
+ else if (pName.equalsIgnoreCase("SendRessOnDeath")) TW_RESS_ON_DIE = Boolean.parseBoolean(pValue);
+
// L2JMOD Warehouse Sorting
else if (pName.equalsIgnoreCase("EnableWarehouseSortingClan")) L2JMOD_ENABLE_WAREHOUSESORTING_CLAN = Boolean.parseBoolean(pValue);
else if (pName.equalsIgnoreCase("EnableWarehouseSortingPrivate")) L2JMOD_ENABLE_WAREHOUSESORTING_PRIVATE = Boolean.parseBoolean(pValue);
Index: java/config/l2jmods.properties
===================================================================
--- java/config/l2jmods.properties (revision 2797)
+++ java/config/l2jmods.properties (working copy)
@@ -161,4 +161,51 @@
#----------------------------------
EnableWarehouseSortingClan = False
EnableWarehouseSortingPrivate = False
-EnableWarehouseSortingFreight = False
\ No newline at end of file
+EnableWarehouseSortingFreight = False
+
+#----------------------------------
+#Town War
+#----------------------------------
+# //townwar_start - Starts town war in Giran
+# //townwar_end - Ends townwar in Giran
+# Town id
+#2: // Talking Island
+#3: // Elven village
+#1: // Dark elf village
+#4: // Orc village
+#6: // Dwarven village
+#7: // Gludio
+#5: // Gludin
+#8: // Dion
+#9: // Giran
+#10: // Oren
+#12: // Aden
+#11: // Hunters village
+#9: // Giran Harbour
+#15: // Heine
+#14: // Rune
+#13: // Goddard
+#17: // Schuttgart
+#16: // Floran
+#20: //Kamael Village
+TWTownId = 9
+
+#Set all towns?
+TWAllTowns = False
+
+#Reward for each kill:
+
+TownWarItemId = 57
+TownWarItemAmount = 5000
+
+# Give PKers karma during townwar?
+AllowKarma = False
+
+# Disable GK while in event?
+DisableGK = True
+
+# If yes it will send a ressurect ask on death.
+# If no when you die youll be there dead until the event ends.
+# Set to false if you want KOTH town.
+SendRessOnDeath = false
+
### Eclipse Workspace Patch 1.0
#P Chr.6GMS
Index: java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java
===================================================================
--- java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java (revision 5263)
+++ java/net/sf/l2j/gameserver/clientpackets/EnterWorld.java (working copy)
@@ -272,6 +272,13 @@
sendPacket(new PledgeShowMemberListAll(activeChar.getClan(), activeChar));
sendPacket(new PledgeStatusChanged(activeChar.getClan()));
}
+
+ if(activeChar.isPvpMaster()){
+ Announcements.getInstance().announceToAll("Day's pvp master "+activeChar.getName()+" is now Online.");
+ activeChar.getAppearance().setNameColor(0xFFFF);
+ activeChar.getAppearance().setTitleColor(0xFFFF);
+
+ }
if (activeChar.isAlikeDead())
{
Index: java/net/sf/l2j/gameserver/Olympiad.java
===================================================================
--- java/net/sf/l2j/gameserver/Olympiad.java (revision 5263)
+++ java/net/sf/l2j/gameserver/Olympiad.java (working copy)
@@ -46,6 +46,7 @@
import net.sf.l2j.gameserver.datatables.HeroSkillTable;
import net.sf.l2j.gameserver.datatables.SkillTable;
import net.sf.l2j.gameserver.instancemanager.OlympiadStadiaManager;
+import net.sf.l2j.gameserver.model.DayPvp;
import net.sf.l2j.gameserver.model.Inventory;
import net.sf.l2j.gameserver.model.L2ItemInstance;
import net.sf.l2j.gameserver.model.L2Party;
@@ -597,6 +598,8 @@
{
if (isOlympiadEnd())
return;
+
+ DayPvp.newPvpMaster();
_inCompPeriod = true;
OlympiadManager om = new OlympiadManager();
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 5263)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -214,8 +214,8 @@
private static final String RESTORE_SKILL_SAVE = "SELECT skill_id,skill_level,effect_count,effect_cur_time, reuse_delay FROM character_skills_save WHERE char_obj_id=? AND class_index=? AND restore_type=? ORDER BY buff_index ASC";
private static final String DELETE_SKILL_SAVE = "DELETE FROM character_skills_save WHERE char_obj_id=? AND class_index=?";
- private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=? WHERE obj_id=?";
- private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level FROM characters WHERE obj_id=?";
+ private static final String UPDATE_CHARACTER = "UPDATE characters SET level=?,maxHp=?,curHp=?,maxCp=?,curCp=?,maxMp=?,curMp=?,str=?,con=?,dex=?,_int=?,men=?,wit=?,face=?,hairStyle=?,hairColor=?,heading=?,x=?,y=?,z=?,exp=?,expBeforeDeath=?,sp=?,karma=?,pvpkills=?,pkkills=?,rec_have=?,rec_left=?,clanid=?,maxload=?,race=?,classid=?,deletetime=?,title=?,accesslevel=?,online=?,isin7sdungeon=?,clan_privs=?,wantspeace=?,base_class=?,onlinetime=?,in_jail=?,jail_timer=?,newbie=?,nobless=?,power_grade=?,subpledge=?,last_recom_date=?,lvl_joined_academy=?,apprentice=?,sponsor=?,varka_ketra_ally=?,clan_join_expiry_time=?,clan_create_expiry_time=?,char_name=?,death_penalty_level=?,daypvp=?,pvpmaster=? WHERE obj_id=?";
+ private static final String RESTORE_CHARACTER = "SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxCp, curCp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, expBeforeDeath, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, clan_privs, wantspeace, base_class, onlinetime, isin7sdungeon, in_jail, jail_timer, newbie, nobless, power_grade, subpledge, last_recom_date, lvl_joined_academy, apprentice, sponsor, varka_ketra_ally,clan_join_expiry_time,clan_create_expiry_time,death_penalty_level,daypvp,pvpmaster FROM characters WHERE obj_id=?";
private static final String RESTORE_CHAR_SUBCLASSES = "SELECT class_id,exp,sp,level,class_index FROM character_subclasses WHERE char_obj_id=? ORDER BY class_index ASC";
private static final String ADD_CHAR_SUBCLASS = "INSERT INTO character_subclasses (char_obj_id,class_id,exp,sp,level,class_index) VALUES (?,?,?,?,?,?)";
private static final String UPDATE_CHAR_SUBCLASS = "UPDATE character_subclasses SET exp=?,sp=?,level=?,class_id=? WHERE char_obj_id=? AND class_index =?";
@@ -347,6 +347,8 @@
/** The number of player killed during a PvP (the player killed was PvP Flagged) */
private int _pvpKills;
+
+ private int _daypvp;
/** The PK counter of the L2PcInstance (= Number of non PvP Flagged player killed) */
private int _pkKills;
@@ -451,6 +453,7 @@
private boolean _noble = false;
private boolean _hero = false;
+ private boolean _pvpmaster = false;
/** The L2FolkInstance corresponding to the last Folk wich one the player talked. */
private L2FolkInstance _lastFolkNpc = null;
@@ -679,6 +682,8 @@
private int _engageid = 0;
private boolean _marryrequest = false;
private boolean _marryaccepted = false;
+
+ private int masterkills = 0;
// Current force buff this caster is casting to a target
protected ForceBuff _forceBuff;
@@ -1891,6 +1896,14 @@
{
_pvpKills = pvpKills;
}
+
+ public void setDayPvp(int dayPvp){
+ _daypvp = dayPvp;
+ }
+
+ public int getDayPvp(){
+ return _daypvp;
+ }
/**
* Return the ClassId object of the L2PcInstance contained in L2PcTemplate.<BR><BR>
@@ -4176,6 +4189,8 @@
{
pk.kills.add(getName());
}
+
+ masterkills = 0;
// Clear resurrect xp calculation
setExpBeforeDeath(0);
@@ -4448,6 +4463,23 @@
{
// Add karma to attacker and increase its PK counter
setPvpKills(getPvpKills() + 1);
+
+ if(isPvpMaster())
+ masterkills++;
+
+ switch(masterkills){
+ case 4:
+ getStatus().setCurrentCp(getMaxCp());
+ getStatus().setCurrentHp(getMaxHp());
+ getStatus().setCurrentMp(getMaxMp());
+ sendMessage("You rewarded with full hp,cp,mp cause of your pvp master's ability");
+ masterkills = 0;
+ break;
+ default:
+ ;
+ }
+
+ setDayPvp(getDayPvp() + 1);
// Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
sendPacket(new UserInfo(this));
@@ -5463,7 +5495,7 @@
"movement_multiplier,attack_speed_multiplier,colRad,colHeight," +
"exp,sp,karma,pvpkills,pkkills,clanid,maxload,race,classid,deletetime," +
"cancraft,title,accesslevel,online,isin7sdungeon,clan_privs,wantspeace," +
- "base_class,newbie,nobless,power_grade,last_recom_date) " +
+ "base_class,newbie,nobless,power_grade,last_recom_date,daypvp,pvpmaster) " +
"values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
statement.setString(1, _accountName);
statement.setInt(2, getObjectId());
@@ -5595,6 +5627,8 @@
player.setOnlineTime(rset.getLong("onlinetime"));
player.setNewbie(rset.getInt("newbie")==1);
player.setNoble(rset.getInt("nobless")==1);
+ player.setPvpMaster(rset.getInt("pvpmaster")==1);
+ player.setDayPvp(rset.getInt("daypvp"));
player.setClanJoinExpiryTime(rset.getLong("clan_join_expiry_time"));
if (player.getClanJoinExpiryTime() < System.currentTimeMillis())
@@ -6059,7 +6093,9 @@
statement.setLong(54, getClanCreateExpiryTime());
statement.setString(55, getName());
statement.setLong(56, getDeathPenaltyBuffLevel());
- statement.setInt(57, getObjectId());
+ statement.setInt(57, getDayPvp());
+ statement.setInt(58, isPvpMaster() ? 1 : 0);
+ statement.setInt(59, getObjectId());
statement.execute();
statement.close();
@@ -8214,6 +8250,14 @@
}
return true;
}
+
+ public boolean isPvpMaster(){
+ return _pvpmaster;
+ }
+
+ public void setPvpMaster(boolean t){
+ _pvpmaster = t;
+ }
public boolean isNoble()
{
Index: java/net/sf/l2j/gameserver/model/DayPvp.java
===================================================================
--- java/net/sf/l2j/gameserver/model/DayPvp.java (revision 0)
+++ java/net/sf/l2j/gameserver/model/DayPvp.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.model;
+
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+
+import net.sf.l2j.L2DatabaseFactory;
+import net.sf.l2j.gameserver.Announcements;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ *
+ * @author Iracundus
+ */
+public class DayPvp
+{
+
+ public static void newPvpMaster(){
+
+ int masterId = 0;
+ Connection con = null;
+ PreparedStatement state = null;
+ ResultSet rset = null;
+
+ try{
+ con = L2DatabaseFactory.getInstance().getConnection();
+ state = con.prepareStatement("SELECT obj_Id,daypvp FROM characters ORDER BY daypvp DESC LIMIT 1;");
+ rset = state.executeQuery();
+ if(rset.next())
+ masterId = rset.getInt(1);
+
+ if(masterId == 0)
+ return;
+
+ state.close();
+ rset.close();
+
+ for(L2PcInstance p : L2World.getInstance().getAllPlayers()){
+ if(p.getObjectId() == masterId)
+ {
+ p.getAppearance().setNameColor(0xFFFF);
+ p.getAppearance().setTitleColor(0xFFFF);
+
+ p.sendMessage("You are the pvp master today");
+ p.setPvpMaster(true);
+
+ p.broadcastUserInfo();
+
+ Announcements.getInstance().announceToAll("Day's Pvp Master is : "+p.getName());
+ }
+ }
+
+ state = con.prepareStatement("UPDATE characters SET pvpmaster=1 WHERE obj_Id=?");
+ state.setInt(1, masterId);
+ state.execute();
+ state.close();
+
+ state = con.prepareStatement("UPDATE characters SET daypvp=0,pvpmaster=0 WHERE obj_Id!=?");
+ state.setInt(1, masterId);
+ state.execute();
+ state.close();
+ }
+ catch(Exception e){
+ e.printStackTrace();
+ }
+ finally{
+ try
+ {
+ con.close();
+ }
+ catch (SQLException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ }
+}
### Eclipse Workspace Patch 1.0
#P Chr.6DTP
Index: sql/characters.sql
===================================================================
--- sql/characters.sql (revision 8778)
+++ sql/characters.sql (working copy)
@@ -79,6 +79,8 @@
clan_join_expiry_time DECIMAL(20,0) NOT NULL DEFAULT 0,
clan_create_expiry_time DECIMAL(20,0) NOT NULL DEFAULT 0,
death_penalty_level int(2) NOT NULL DEFAULT 0,
+ daypvp decimal(11,0) default NULL,
+ pvpmaster decimal(1,0) NOT NULL DEFAULT 0,
PRIMARY KEY (obj_Id),
KEY `clanid` (`clanid`)
) ;
### Eclipse Workspace Patch 1.0
#P Chr.6GMS
Index: java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (revision 5263)
+++ java/net/sf/l2j/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -51,6 +51,7 @@
import net.sf.l2j.gameserver.ai.L2PlayerAI;
import net.sf.l2j.gameserver.cache.HtmCache;
import net.sf.l2j.gameserver.cache.WarehouseCacheManager;
+import net.sf.l2j.gameserver.clientpackets.Say2;
import net.sf.l2j.gameserver.communitybbs.BB.Forum;
import net.sf.l2j.gameserver.communitybbs.Manager.ForumsBBSManager;
import net.sf.l2j.gameserver.datatables.CharTemplateTable;
@@ -82,6 +83,7 @@
import net.sf.l2j.gameserver.model.BlockList;
import net.sf.l2j.gameserver.model.FishData;
import net.sf.l2j.gameserver.model.ForceBuff;
+import net.sf.l2j.gameserver.model.Hide;
import net.sf.l2j.gameserver.model.Inventory;
import net.sf.l2j.gameserver.model.ItemContainer;
import net.sf.l2j.gameserver.model.L2Attackable;
@@ -137,6 +139,7 @@
import net.sf.l2j.gameserver.serverpackets.ChangeWaitType;
import net.sf.l2j.gameserver.serverpackets.CharInfo;
import net.sf.l2j.gameserver.serverpackets.ConfirmDlg;
+import net.sf.l2j.gameserver.serverpackets.CreatureSay;
import net.sf.l2j.gameserver.serverpackets.EtcStatusUpdate;
import net.sf.l2j.gameserver.serverpackets.ExAutoSoulShot;
import net.sf.l2j.gameserver.serverpackets.ExDuelUpdateUserInfo;
@@ -3826,6 +3829,16 @@
&& (target.getOwnerId() == getObjectId() || isInLooterParty(target.getOwnerId())))
target.resetOwnerTimer();
+ if(target.isHide()){
+
+ getInventory().addItem("", Hide.rewardId, Hide.rewardCount, this, null);
+ sendPacket(new InventoryUpdate());
+ sendMessage("You won the event!");
+ Hide.cleanEvent();
+ Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Hide Event","Winner is: "+getName()+".Event ended."));
+ target.setHide(false);
+ return;
+ }
// Remove the L2ItemInstance from the world and send server->client GetItem packets
target.pickupMe(this);
if(Config.SAVE_DROPPED_ITEM) // item must be removed from ItemsOnGroundManager if is active
Index: java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminGoHide.java
===================================================================
--- java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminGoHide.java (revision 0)
+++ java/net/sf/l2j/gameserver/handler/admincommandhandlers/AdminGoHide.java (revision 0)
@@ -0,0 +1,59 @@
+/* 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.admincommandhandlers;
+
+import net.sf.l2j.gameserver.handler.IAdminCommandHandler;
+import net.sf.l2j.gameserver.model.Hide;
+import net.sf.l2j.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ *
+ * @author Iracundus
+ */
+public class AdminGoHide implements IAdminCommandHandler
+{
+
+ private static String[] ADMIN_COMMANDS = {"admin_gohide"};
+
+ @Override
+ public boolean useAdminCommand(String command, L2PcInstance activeChar)
+ {
+ if(command.startsWith("admin_gohide")){
+ if(activeChar == null)
+ return false;
+
+ if(Hide.running == false){
+ activeChar.sendMessage("Event is not in progress");
+ return false;
+ }
+
+ int x = Hide.getX() , y = Hide.getY() , z = Hide.getZ();
+ activeChar.teleToLocation(x, y, z);
+ }
+
+ return true;
+ }
+
+
+ @Override
+ public String[] getAdminCommandList()
+ {
+ return ADMIN_COMMANDS;
+ }
+
+}
Index: java/net/sf/l2j/gameserver/model/L2ItemInstance.java
===================================================================
--- java/net/sf/l2j/gameserver/model/L2ItemInstance.java (revision 5263)
+++ java/net/sf/l2j/gameserver/model/L2ItemInstance.java (working copy)
@@ -92,6 +92,8 @@
/** Slot where item is stored */
private int _locData;
+ private boolean hide;
+
/** Level of enchantment of the item */
private int _enchantLevel;
@@ -286,6 +288,14 @@
}
}
+ public boolean isHide(){
+ return hide;
+ }
+
+ public void setHide(boolean j){
+ hide = j;
+ }
+
// No logging (function designed for shots only)
public void changeCountWithoutTrace(String process, int count, L2PcInstance creator, L2Object reference)
{
Index: java/net/sf/l2j/gameserver/model/Hide.java
===================================================================
--- java/net/sf/l2j/gameserver/model/Hide.java (revision 0)
+++ java/net/sf/l2j/gameserver/model/Hide.java (revision 0)
@@ -0,0 +1,120 @@
+package net.sf.l2j.gameserver.model;
+
+
+import net.sf.l2j.gameserver.ThreadPoolManager;
+import net.sf.l2j.gameserver.clientpackets.Say2;
+import net.sf.l2j.gameserver.network.SystemMessageId;
+import net.sf.l2j.gameserver.serverpackets.CreatureSay;
+import net.sf.l2j.gameserver.serverpackets.SystemMessage;
+import net.sf.l2j.gameserver.util.Broadcast;
+import net.sf.l2j.util.Rnd;
+
+public class Hide{
+
+ public static final int rewardId = 2807;
+ public static final int rewardCount = 50;
+ private static Hide _instance;
+ private final int delay = 180000;
+ private final static int itemId = 7683;
+ private final static int itemCount = 1;
+ public static boolean running = false;
+ private static int x;
+ private static int y;
+ private static int z = 0;
+ private final int[][] teleports = { {116496,145020,-2569} , {18605,145378,-3129} , {-83083,150505,-3134} };
+ static L2ItemInstance item = null;
+
+ public static int getX(){
+ return x;
+ }
+
+ public static int getY(){
+ return y;
+ }
+
+ public static int getZ(){
+ return z;
+ }
+
+ public static int getItemId(){
+ return itemId;
+ }
+
+ public static int getItemCount(){
+ return itemCount;
+ }
+
+ public void startEvent(){
+ running = true;
+ System.out.println("Automatic Hide Event started with success.");
+ int s = Rnd.get(teleports.length);
+ x = teleports[s][0];
+ y = teleports[s][1];
+ z = teleports[s][2];
+ SystemMessage sm = new SystemMessage(SystemMessageId.S2_WAS_DROPPED_IN_THE_S1_REGION);
+ sm.addZoneName(getX(), getY(), getZ());
+ sm.addItemName(itemId);
+ item = new L2ItemInstance(Rnd.get(65535),itemId);
+ L2World.getInstance().storeObject(item);
+ item.setCount(itemCount);
+ item.setHide(true);
+ item.getPosition().setWorldPosition(x, y ,z);
+ item.getPosition().setWorldRegion(L2World.getInstance().getRegion(item.getPosition().getWorldPosition()));
+ item.getPosition().getWorldRegion().addVisibleObject(item);
+ item.setProtected(false);
+ item.setIsVisible(true);
+ L2World.getInstance().addVisibleObject(item, item.getPosition().getWorldRegion(), null);
+
+
+
+ Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Hide Event","Event started, Item dropped: "+item.getItem().getName()+", find it and win!"));
+ Broadcast.toAllOnlinePlayers(sm);
+ ThreadPoolManager.getInstance().scheduleGeneral(new Check(), 60000);
+ }
+
+ public void checkAfterTime(){
+ if(running == false)
+ return;
+ if(item.isHide())
+ item.setHide(false);
+ item.decayMe();
+ L2World.getInstance().removeObject(item);
+ cleanEvent();
+ Broadcast.toAllOnlinePlayers(new CreatureSay(0,Say2.ANNOUNCEMENT,"Hide Event","Unfortunately,none find the item , event finished!"));
+ }
+
+ public static void cleanEvent(){
+ x = 0;
+ y = 0;
+ z = 0;
+ running = false;
+ if(item != null){
+ item.decayMe();
+ L2World.getInstance().removeObject(item);
+ }
+ item = null;
+ }
+
+ private Hide(){
+ ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(new Event(), delay, delay);
+ System.out.println("Automatic Hide event loaded with success.");
+ }
+
+ public static Hide getInstance(){
+ if(_instance == null)
+ _instance = new Hide();
+ return _instance;
+ }
+
+ public class Check implements Runnable{
+ public void run(){
+ checkAfterTime();
+ }
+ }
+
+ public class Event implements Runnable{
+ public void run(){
+ startEvent();
+ }
+ }
+}
\ No newline at end of file
Index: java/net/sf/l2j/gameserver/GameServer.java
===================================================================
--- java/net/sf/l2j/gameserver/GameServer.java (revision 5263)
+++ java/net/sf/l2j/gameserver/GameServer.java (working copy)
@@ -90,6 +90,7 @@
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminGeodata;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminGm;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminGmChat;
+import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminGoHide;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminHeal;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminHelpPage;
import net.sf.l2j.gameserver.handler.admincommandhandlers.AdminInvul;
@@ -218,6 +219,7 @@
import net.sf.l2j.gameserver.instancemanager.SiegeManager;
import net.sf.l2j.gameserver.model.AutoChatHandler;
import net.sf.l2j.gameserver.model.AutoSpawnHandler;
+import net.sf.l2j.gameserver.model.Hide;
import net.sf.l2j.gameserver.model.L2Manor;
import net.sf.l2j.gameserver.model.L2PetDataTable;
import net.sf.l2j.gameserver.model.L2World;
@@ -518,6 +520,7 @@
_adminCommandHandler = AdminCommandHandler.getInstance();
_adminCommandHandler.registerAdminCommandHandler(new AdminAdmin());
+ _adminCommandHandler.registerAdminCommandHandler(new AdminGoHide());
_adminCommandHandler.registerAdminCommandHandler(new AdminInvul());
_adminCommandHandler.registerAdminCommandHandler(new AdminDelete());
_adminCommandHandler.registerAdminCommandHandler(new AdminKill());
@@ -604,6 +607,7 @@
CoupleManager.getInstance();
TaskManager.getInstance();
+ Hide.getInstance();
GmListTable.getInstance();
### Eclipse Workspace Patch 1.0
#P L2J_DataPack_BETA
Index: dist/game/data/scripts.cfg
===================================================================
--- dist/game/data/scripts.cfg (revision 10487)
+++ dist/game/data/scripts.cfg (working copy)
@@ -313,3 +313,4 @@
#events/FreyaCelebration/FreyaCelebration.java
#events/MasterOfEnchanting/MasterOfEnchanting.java
#events/LoveYourGatekeeper/LoveYourGatekeeper.java
+events/SaveTheCow/SaveTheCow.java
\ No newline at end of file
Index: dist/game/data/scripts/events/SaveTheCow/32476-12.htm
===================================================================
--- dist/game/data/scripts/events/SaveTheCow/32476-12.htm (revision 0)
+++ dist/game/data/scripts/events/SaveTheCow/32476-12.htm (working copy)
@@ -0,0 +1,3 @@
+<html><body>Employee of Magic Research Institute:<br>
+The situation here is back to normal, and the event pack sale is over.
+</body></html>
\ No newline at end of file
Index: dist/game/data/scripts/events/SaveTheCow/32476-04.htm
===================================================================
--- dist/game/data/scripts/events/SaveTheCow/32476-04.htm (revision 0)
+++ dist/game/data/scripts/events/SaveTheCow/32476-04.htm (working copy)
@@ -0,0 +1,4 @@
+<html><body>Employee of Magic Research Institute:<br>
+You must bring at least <font color="LEVEL">50 Apigas</font> in order to receive a reward.<br>
+Come again when you have enough.
+</body></html>
\ No newline at end of file
Index: dist/game/data/scripts/events/SaveTheCow/32476-08.htm
===================================================================
--- dist/game/data/scripts/events/SaveTheCow/32476-08.htm (revision 0)
+++ dist/game/data/scripts/events/SaveTheCow/32476-08.htm (working copy)
@@ -0,0 +1,7 @@
+<html><body>Employee of Magic Research Institute:<br>
+You'll help us? Excellent! Let me give you some instructions. Come see me <font color="LEVEL">every 12 hours</font> and I'll give you a scroll and a Cupid's Fatigue Recovery Potion, which you can use to call out the fatigued cows and revitalize them. Just so you know, the captain cows are very difficult -- you'll need some friends to help you. <font color="LEVEL">Also remember</font> that you must be careful not to lease the cow during the revitalization process, since the cows are very sensitive animals.<br>
+If you find the lost scrolls, you can also use them to revitalize the cows' energies. After you've done so, the cows will pay you in their currency, which is called Apiga. Bring that Apiga to me and I'll give you a reward. Oh, sometimes a bull or captain bull will give you Golden Apiga. Bring me that and I'll give you a special reward. One more thing: some very fatigued cows will need their energies revitalized very quickly. If you can do so within the required time frame, the Apigas you'll receive will be doubled.<br>
+<br>
+<br>
+<a action="bypass -h Quest SaveTheCow 32476-09.htm">Ask about Apigas.</a>
+</body></html>
\ No newline at end of file
Index: dist/game/data/scripts/events/SaveTheCow/32476-03.htm
===================================================================
--- dist/game/data/scripts/events/SaveTheCow/32476-03.htm (revision 0)
+++ dist/game/data/scripts/events/SaveTheCow/32476-03.htm (working copy)
@@ -0,0 +1,4 @@
+<html><body>Employee of Magic Research Institute:<br>
+You need more Adena.<br>
+A minimum of <font color="LEVEL">10,000 Adena</font> is required.<br>
+</body></html>
\ No newline at end of file
Index: dist/game/data/stats/skills/02800-02899.xml
===================================================================
--- dist/game/data/stats/skills/02800-02899.xml (revision 10487)
+++ dist/game/data/stats/skills/02800-02899.xml (working copy)
@@ -1467,26 +1467,46 @@
</for>
</skill>
<skill id="2867" levels="1" name="Cupid's Cure">
- <set name="effectPoint" val="-1000" />
+ <set name="baseCritRate" val="15" />
+ <set name="castRange" val="500" />
+ <set name="effectRange" val="700" />
+ <set name="hitTime" val="1000" />
<set name="icon" val="icon.skill3260" />
<set name="isMagic" val="2" /> <!-- Static Skill -->
<set name="itemConsumeCount" val="1" />
<set name="itemConsumeId" val="14722" /> <!-- Event - Cupid's Fatigue Recovery Potion -->
<set name="magicLvl" val="1" />
- <set name="operateType" val="A1" />
- <set name="reuseDelay" val="1000" />
- <set name="targetType" val="NONE" />
+ <set name="mpConsume" val="1" />
+ <set name="operateType" val="A1" />
+ <set name="power" val="100" />
+ <set name="reuseDelay" val="1000" />
+ <set name="skillType" val="PDAM" />
+ <set name="staticDamage" val="true" />
+ <set name="targetType" val="ONE" />
+ <cond msgId="109">
+ <target npcId="13187,13188,13189,13190,13191,13192" />
+ </cond>
</skill>
<skill id="2868" levels="1" name="Cupid's Enhanced Cure">
- <set name="effectPoint" val="-1000" />
+ <set name="baseCritRate" val="15" />
+ <set name="castRange" val="500" />
+ <set name="effectRange" val="700" />
+ <set name="hitTime" val="1000" />
<set name="icon" val="icon.skill3260" />
- <set name="isMagic" val="2" /> <!-- Static Skill -->
+ <set name="isMagic" val="2" /> <!-- Static Skill -->
<set name="itemConsumeCount" val="1" />
<set name="itemConsumeId" val="14723" /> <!-- Event - Cupid's Powerful Fatigue Recovery Potion -->
<set name="magicLvl" val="1" />
- <set name="operateType" val="A1" />
- <set name="reuseDelay" val="4000" />
- <set name="targetType" val="NONE" />
+ <set name="mpConsume" val="1" />
+ <set name="operateType" val="A1" />
+ <set name="power" val="200" />
+ <set name="reuseDelay" val="4000" />
+ <set name="skillType" val="PDAM" />
+ <set name="staticDamage" val="true" />
+ <set name="targetType" val="ONE" />
+ <cond msgId="109">
+ <target npcId="13187,13188,13189,13190,13191,13192" />
+ </cond>
</skill>
<skill id="2869" levels="1" name="Event - Milk Cow Summon Scroll">
<!-- Confirmed CT2.5 -->
Index: dist/game/data/scripts/events/SaveTheCow/SaveTheCow.java
===================================================================
--- dist/game/data/scripts/events/SaveTheCow/SaveTheCow.java (revision 0)
+++ dist/game/data/scripts/events/SaveTheCow/SaveTheCow.java (working copy)
@@ -0,0 +1,475 @@
+/*
+ * Copyright (C) 2004-2014 L2J DataPack
+ *
+ * This file is part of L2J DataPack.
+ *
+ * L2J DataPack 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * L2J DataPack 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, see <http://www.gnu.org/licenses/>.
+ */
+package events.SaveTheCow;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.l2jserver.gameserver.ai.CtrlIntention;
+import com.l2jserver.gameserver.model.L2Object;
+import com.l2jserver.gameserver.model.actor.L2Attackable;
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.event.LongTimeEvent;
+import com.l2jserver.gameserver.model.holders.ItemHolder;
+import com.l2jserver.gameserver.model.holders.QuestItemHolder;
+import com.l2jserver.gameserver.model.holders.SkillHolder;
+import com.l2jserver.gameserver.model.itemcontainer.Inventory;
+import com.l2jserver.gameserver.model.quest.QuestState;
+import com.l2jserver.gameserver.model.skills.Skill;
+import com.l2jserver.gameserver.model.variables.PlayerVariables;
+import com.l2jserver.gameserver.network.NpcStringId;
+import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.clientpackets.Say2;
+import com.l2jserver.gameserver.network.serverpackets.NpcSay;
+import com.l2jserver.gameserver.network.serverpackets.PlaySound;
+import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
+
+/**
+ * Save the Cow event AI.<br>
+ * Partially based on GKR's Catch a Tiger event.
+ * @author Pandragon
+ */
+public class SaveTheCow extends LongTimeEvent
+{
+ // NPC
+ private static final int MANAGER = 32476;
+ // Items
+ private static final int POTION = 14722;
+ private static final int APIGA = 14720;
+ private static final int GOLDEN_APIGA = 14721;
+ private static final int PACKAGE = 14740;
+ // Monsters
+ private static final int MILK_COW = 13187;
+ private static final int HEAD_MILK_COW = 13188;
+ private static final int BULL = 13189;
+ private static final int HEAD_BULL = 13190;
+ private static final int GLOOMY_MILK_COW = 13191;
+ private static final int GLOOMY_HEAD_MILK_COW = 13192;
+ private static final int PIG = 13196;
+ // Rewards
+ private static final int GEMSTONE_S = 2134;
+ private static final int VITALITY_POTION = 15438; // Vitality Maintaining Potion (10 minutes)
+ private static final QuestItemHolder[] REWARDS =
+ {
+ new QuestItemHolder(14739, 61, 10), // Event - Fresh Milk
+ new QuestItemHolder(8664, 48, 2), // Facelifting Potion - A (Event)
+ new QuestItemHolder(8665, 45, 2), // Facelifting Potion - B (Event)
+ new QuestItemHolder(8666, 42, 2), // Facelifting Potion - C (Event)
+ new QuestItemHolder(8671, 39, 2), // Hair Style Change Potion - A (Event)
+ new QuestItemHolder(8672, 36, 2), // Hair Style Change Potion - B (Event)
+ new QuestItemHolder(8673, 33, 2), // Hair Style Change Potion - C (Event)
+ new QuestItemHolder(8674, 30, 2), // Hair Style Change Potion - D (Event)
+ new QuestItemHolder(8675, 27, 2), // Hair Style Change Potion - E (Event)
+ new QuestItemHolder(8676, 24, 2), // Hair Style Change Potion - F (Event)
+ new QuestItemHolder(8677, 21, 2), // Hair Style Change Potion - G (Event)
+ new QuestItemHolder(8667, 18, 2), // Dye Potion - A (Event)
+ new QuestItemHolder(8668, 15, 2), // Dye Potion - B (Event)
+ new QuestItemHolder(8669, 12, 2), // Dye Potion - C (Event)
+ new QuestItemHolder(8670, 9, 2), // Dye Potion - D (Event)
+ new QuestItemHolder(9570, 8, 1), // Red Soul Crystal - Stage 14
+ new QuestItemHolder(9571, 7, 1), // Blue Soul Crystal - Stage 14
+ new QuestItemHolder(9572, 6, 1), // Green Soul Crystal - Stage 14
+ new QuestItemHolder(10480, 5, 1), // Red Soul Crystal - Stage 15
+ new QuestItemHolder(10481, 4, 1), // Blue Soul Crystal - Stage 15
+ new QuestItemHolder(10482, 3, 1), // Green Soul Crystal - Stage 15
+ new QuestItemHolder(13071, 2, 1), // Red Soul Crystal - Stage 16
+ new QuestItemHolder(13072, 1, 1), // Blue Soul Crystal - Stage 16
+ new QuestItemHolder(13073, 0, 1), // Green Soul Crystal - Stage 16
+ };
+ // Misc
+ private static final int PAYMENT = 10000;
+ private static final long INTERVAL = 12L * 60 * 60 * 1000; // 12hours
+
+ private static final int MILK_COW_SKILL = 2869; // Scroll Skill
+ private static final int HEAD_MILK_COW_SKILL = 2870; // Scroll Skill
+ private static final int GLOOMY_MILK_COW_SKILL = 2871; // Scroll Skill
+ private static final int GLOOMY_HEAD_MILK_COW_SKILL = 2872; // Scroll Skill
+ private static final int CUPID_CURE = 2867; // Cupid's Cure
+ private static final int CUPID_ENHANCED_CURE = 2868; // Cupid's Enhanced Cure
+ private static final SkillHolder DOUBT_SKILL = new SkillHolder(5994, 1); // Effect of Doubt
+
+ private static Map<Integer, ItemHolder> CUPID_CURE_CHANCES = new HashMap<>();
+ {
+ CUPID_CURE_CHANCES.put(MILK_COW, new ItemHolder(30, 2));
+ CUPID_CURE_CHANCES.put(GLOOMY_MILK_COW, new ItemHolder(25, 3));
+ CUPID_CURE_CHANCES.put(HEAD_MILK_COW, new ItemHolder(20, 4));
+ CUPID_CURE_CHANCES.put(GLOOMY_HEAD_MILK_COW, new ItemHolder(15, 5));
+ }
+ private static Map<Integer, ItemHolder> CUPID_ENHANCED_CURE_CHANCES = new HashMap<>();
+ {
+ CUPID_CURE_CHANCES.put(MILK_COW, new ItemHolder(50, 2));
+ CUPID_CURE_CHANCES.put(GLOOMY_MILK_COW, new ItemHolder(45, 3));
+ CUPID_CURE_CHANCES.put(HEAD_MILK_COW, new ItemHolder(40, 4));
+ CUPID_CURE_CHANCES.put(GLOOMY_HEAD_MILK_COW, new ItemHolder(25, 5));
+ }
+
+ private static final NpcStringId[] PIG_SKILL_ATTACK_TEXT =
+ {
+ NpcStringId.WHATS_THIS_FOOD,
+ NpcStringId.MY_ENERGY_IS_OVERFLOWING_I_DONT_NEED_ANY_FATIGUE_RECOVERY_POTION,
+ NpcStringId.WHATS_THE_MATTER_THATS_AN_AMATEUR_MOVE
+ };
+
+ private static final NpcStringId[] PIG_ON_SPAWN_TEXT =
+ {
+ NpcStringId.ROAR_NO_OINK_OINK_SEE_IM_A_PIG_OINK_OINK,
+ NpcStringId.WHO_AM_I_WHERE_AM_I_OINK_OINK
+ };
+
+ private static final NpcStringId[] NO_SKILL_ATTACK_TEXT =
+ {
+ NpcStringId.HEY_ARE_YOU_PLANNING_ON_EATING_ME_USE_A_CUPIDS_FATIGUE_RECOVERY_POTION_ALREADY,
+ NpcStringId.ILL_PASS_ON_AN_AMATEURS_MERIDIAN_MASSAGE_USE_A_CUPIDS_FATIGUE_RECOVERY_POTION_ALREADY
+ };
+
+ private static final String[] DEATH_TEXT =
+ {
+ "*Muuuu* I feel like I could use a nap...!",
+ "*Muuuu* I'm sleepy. Think I'll go take a nap.",
+ "I can't feel my legs anymore... ZzzZzz"
+ };
+
+ private SaveTheCow()
+ {
+ super(SaveTheCow.class.getSimpleName(), "events");
+ addFirstTalkId(MANAGER);
+ addStartNpc(MANAGER);
+ addTalkId(MANAGER);
+ addSpawnId(MILK_COW, HEAD_MILK_COW, GLOOMY_MILK_COW, GLOOMY_HEAD_MILK_COW, PIG);
+ addAttackId(MILK_COW, HEAD_MILK_COW, GLOOMY_MILK_COW, GLOOMY_HEAD_MILK_COW, PIG);
+ addKillId(BULL, HEAD_BULL);
+ addSkillSeeId(MILK_COW, HEAD_MILK_COW, GLOOMY_MILK_COW, GLOOMY_HEAD_MILK_COW);
+ }
+
+ @Override
+ public String onFirstTalk(L2Npc npc, L2PcInstance player)
+ {
+ if (player.getQuestState(getName()) == null)
+ {
+ newQuestState(player);
+ }
+ return isDropPeriod() ? "32476-01.htm" : "32476-11.htm";
+ }
+
+ @Override
+ public String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+ {
+ final QuestState st = player.getQuestState(getName());
+ String htmltext = event.endsWith(".htm") ? event : "";
+
+ if (st == null)
+ {
+ return null;
+ }
+
+ switch (event)
+ {
+ case "give_package":
+ {
+ if (isDropPeriod())
+ {
+ if (getQuestItemsCount(player, Inventory.ADENA_ID) >= PAYMENT)
+ {
+ final long now = System.currentTimeMillis();
+ final PlayerVariables vars = player.getVariables();
+ final long nextTime = vars.getString("SAVE_THE_COW_REWARD_TIME", null) == null ? 0 : Long.parseLong(vars.getString("SAVE_THE_COW_REWARD_TIME"));
+
+ if (now > nextTime)
+ {
+ st.startQuest();
+ takeItems(player, Inventory.ADENA_ID, PAYMENT);
+ giveItems(player, PACKAGE, 1);
+ vars.set("SAVE_THE_COW_REWARD_TIME", Long.toString(System.currentTimeMillis() + INTERVAL));
+ }
+ else
+ {
+ long remainingTime = (nextTime - System.currentTimeMillis()) / 1000;
+ int hours = (int) (remainingTime / 3600);
+ int minutes = (int) ((remainingTime % 3600) / 60);
+ SystemMessage sm = SystemMessage.getSystemMessage(SystemMessageId.AVAILABLE_AFTER_S1_S2_HOURS_S3_MINUTES);
+ sm.addItemName(PACKAGE);
+ sm.addInt(hours);
+ sm.addInt(minutes);
+ player.sendPacket(sm);
+ }
+ }
+ else
+ {
+ htmltext = "32476-03.htm";
+ }
+ }
+ else
+ {
+ htmltext = "32476-12.htm";
+ }
+ break;
+ }
+ case "give_potions":
+ {
+ if (player.getAdena() >= PAYMENT)
+ {
+ takeItems(player, Inventory.ADENA_ID, PAYMENT);
+ giveItems(player, POTION, 200);
+ }
+ else
+ {
+ htmltext = "32476-03.htm";
+ }
+ break;
+ }
+ case "give_reward":
+ {
+ if (getQuestItemsCount(player, APIGA) >= 50)
+ {
+ htmltext = "32476-06.htm";
+ takeItems(player, APIGA, 50);
+ int random = getRandom(100);
+ for (QuestItemHolder holder : REWARDS)
+ {
+ if (random >= holder.getChance())
+ {
+ rewardItems(player, holder.getId(), getRandom(1, (int) holder.getCount()));
+ break;
+ }
+ }
+ }
+ else
+ {
+ htmltext = "32476-04.htm";
+ }
+ break;
+ }
+ case "give_adv_reward":
+ {
+ if (getQuestItemsCount(player, GOLDEN_APIGA) >= 50)
+ {
+ htmltext = "32476-06.htm";
+ takeItems(player, APIGA, 50);
+ rewardItems(player, VITALITY_POTION, 1);
+ rewardItems(player, GEMSTONE_S, 1);
+ rewardItems(player, getRandom(9546, 9551), 1); // random attribute stone
+ }
+ else
+ {
+ htmltext = "32476-05.htm";
+ }
+ break;
+ }
+ case "double_reward_lost":
+ {
+ if (npc != null)
+ {
+ npc.setBusyMessage("normal");
+ }
+ break;
+ }
+ }
+ return htmltext;
+ }
+
+ @Override
+ public String onAttack(L2Npc npc, L2PcInstance attacker, int damage, boolean isPet, Skill skill)
+ {
+ // start counting down
+ if (!npc.isBusy())
+ {
+ npc.setBusy(true);
+ startQuestTimer("double_reward_lost", 10000, npc, null);
+ }
+
+ int npcId = npc.getId();
+ if ((skill != null) && ((skill.getId() == CUPID_CURE) || (skill.getId() == CUPID_ENHANCED_CURE)))
+ {
+ if (npcId != PIG)
+ {
+ String snd = ((npcId == MILK_COW) || (npcId == GLOOMY_MILK_COW)) ? "EV_04" : "EV_03";
+ attacker.sendPacket(new PlaySound(snd));
+ }
+ }
+ else
+ {
+ npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npcId, (npcId == PIG) ? PIG_SKILL_ATTACK_TEXT[getRandom(3)] : NO_SKILL_ATTACK_TEXT[getRandom(2)]));
+ if (getRandom(100) < 10)
+ {
+ npc.setTarget(attacker);
+ npc.doCast(DOUBT_SKILL.getSkill());
+ }
+ }
+ return super.onAttack(npc, attacker, damage, isPet, skill);
+ }
+
+ @Override
+ public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet)
+ {
+ if (killer.getQuestState(getName()) == null)
+ {
+ newQuestState(killer);
+ }
+
+ if (npc.getId() == HEAD_BULL)
+ {
+ if (getRandomBoolean())
+ {
+ rewardItems(killer, GOLDEN_APIGA, getRandom(5, 10));
+ }
+ else
+ {
+ rewardItems(killer, APIGA, getRandom(5, 10));
+ }
+ }
+ else
+ {
+ if (getRandomBoolean())
+ {
+ rewardItems(killer, GOLDEN_APIGA, getRandom(3, 5));
+ }
+ else
+ {
+ rewardItems(killer, APIGA, getRandom(3, 5));
+ }
+ }
+ NpcSay ns = new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), DEATH_TEXT[getRandom(3)]);
+ npc.broadcastPacket(ns);
+ return super.onKill(npc, killer, isPet);
+ }
+
+ @Override
+ public String onSpawn(L2Npc npc)
+ {
+ if (npc.getId() == PIG)
+ {
+ npc.broadcastPacket(new NpcSay(npc.getObjectId(), Say2.NPC_ALL, npc.getId(), PIG_ON_SPAWN_TEXT[getRandom(2)]));
+ }
+ else
+ {
+ npc.disableCoreAI(true);
+ }
+ return super.onSpawn(npc);
+ }
+
+ @Override
+ public String onSkillSee(L2Npc npc, L2PcInstance caster, Skill skill, L2Object[] targets, boolean isPet)
+ {
+ final int skillId = skill.getId();
+ final int npcId = npc.getId();
+
+ if (!npc.isInvul())
+ {
+ // Summon randomness (cow, bull or pig)
+ switch (skillId)
+ {
+ case MILK_COW_SKILL:
+ case GLOOMY_MILK_COW_SKILL:
+ {
+ final int random = getRandom(10);
+ if (random == 0)
+ {
+ addSpawn(PIG, npc, false, 10000);
+ npc.deleteMe();
+ }
+ else if (random < 3)
+ {
+ final L2Attackable bullSpawn = (L2Attackable) addSpawn(BULL, npc, false, 360000);
+ npc.deleteMe();
+ bullSpawn.addDamageHate(caster, 0, 500);
+ bullSpawn.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, caster);
+ bullSpawn.setRunning();
+ }
+ else
+ {
+ npc.setIsInvul(true);
+ npc.setBusy(false);
+ npc.setBusyMessage("double");
+ }
+ break;
+ }
+ case HEAD_MILK_COW_SKILL:
+ case GLOOMY_HEAD_MILK_COW_SKILL:
+ {
+ final int random = getRandom(10);
+ if (random == 0)
+ {
+ addSpawn(PIG, npc, false, 10000);
+ npc.deleteMe();
+ }
+ else if (random < 3)
+ {
+ final L2Attackable bullSpawn = (L2Attackable) addSpawn(HEAD_BULL, npc, false, 360000);
+ npc.deleteMe();
+ bullSpawn.addDamageHate(caster, 0, 500);
+ bullSpawn.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, caster);
+ bullSpawn.setRunning();
+ }
+ else
+ {
+ npc.setIsInvul(true);
+ npc.setBusy(false);
+ npc.setBusyMessage("double");
+ }
+ break;
+ }
+ }
+ }
+
+ final int chance;
+ final int maxCount;
+
+ if (caster.getTarget() != npc)
+ {
+ chance = 0;
+ maxCount = 0;
+ }
+ else if (skillId == CUPID_CURE)
+ {
+ chance = CUPID_CURE_CHANCES.get(npcId).getId();
+ maxCount = (int) CUPID_CURE_CHANCES.get(npcId).getCount();
+ }
+ else if (skillId == CUPID_ENHANCED_CURE)
+ {
+ chance = CUPID_ENHANCED_CURE_CHANCES.get(npcId).getId();
+ maxCount = (int) CUPID_ENHANCED_CURE_CHANCES.get(npcId).getCount();
+ }
+ else
+ {
+ chance = 0;
+ maxCount = 0;
+ }
+
+ if ((chance > 0) && (getRandom(100) < chance))
+ {
+ if (npc.getBusyMessage().equals("double") && ((npcId == GLOOMY_MILK_COW) || (npcId == GLOOMY_HEAD_MILK_COW)))
+ {
+ rewardItems(caster, APIGA, getRandom(maxCount, maxCount * 2));
+ }
+ else
+ {
+ rewardItems(caster, APIGA, getRandom(1, maxCount));
+ }
+ npc.deleteMe();
+ }
+
+ return super.onSkillSee(npc, caster, skill, targets, isPet);
+ }
+
+ public static void main(String[] args)
+ {
+ new SaveTheCow();
+ }
+}
\ No newline at end of file
Index: dist/game/data/stats/items/14700-14799.xml
===================================================================
--- dist/game/data/stats/items/14700-14799.xml (revision 10487)
+++ dist/game/data/stats/items/14700-14799.xml (working copy)
@@ -316,7 +316,7 @@
<set name="reuse_delay" val="10000" />
<set name="is_stackable" val="true" />
<set name="handler" val="ItemSkills" />
- <set name="item_skill" val="2880-1" />
+ <set name="item_skill" val="2871-1" />
</item>
<item id="14727" type="EtcItem" name="Event - Gloomy Head Milk Cow Summon Scroll">
<set name="icon" val="icon.etc_scroll_of_milkcattle_b_i00" />
@@ -326,7 +326,7 @@
<set name="reuse_delay" val="10000" />
<set name="is_stackable" val="true" />
<set name="handler" val="ItemSkills" />
- <set name="item_skill" val="2881-1" />
+ <set name="item_skill" val="2872-1" />
</item>
<item id="14728" type="EtcItem" name="Event - Orr Cube - 30-day limited period">
<set name="icon" val="icon.etc_ore_cube_event_i00" />
Index: dist/game/data/scripts/events/SaveTheCow/32476-07.htm
===================================================================
--- dist/game/data/scripts/events/SaveTheCow/32476-07.htm (revision 0)
+++ dist/game/data/scripts/events/SaveTheCow/32476-07.htm (working copy)
@@ -0,0 +1,8 @@
+<html><body>Employee of Magic Research Institute:<br>
+A few days ago, the Magic Research Institute finally developed a new device to rapidly revitalize the cows' energies. We have already received a larger number of orders.<br>
+But the device was overwhelmed and suddenly exploded; the order scrolls were scattered to the four winds!<br>
+Until we have repaired the device, all orders have to be input manually. Worse, we still have to find all those missing scrolls! And we're very short-handed as it is...<br>
+<br>
+<br>
+<a action="bypass -h Quest SaveTheCow 32476-08.htm">"Can I help you?"</a>
+</body></html>
\ No newline at end of file
Index: dist/game/data/scripts/events/SaveTheCow/32476-09.htm
===================================================================
--- dist/game/data/scripts/events/SaveTheCow/32476-09.htm (revision 0)
+++ dist/game/data/scripts/events/SaveTheCow/32476-09.htm (working copy)
@@ -0,0 +1,4 @@
+<html><body>Employee of Magic Research Institute:<br>
+Enscribed on the Apiga is the figure of a smiling pig, a traditional image of wealth and luck. Adventurers particularly favor them as tokens of good fortune. They often give Apigas to friends as gifts.<br>
+I don't know if Apigas really will bring you luck, but since we need adventurers right now, I'm very glad that they believe that!
+</body></html>
\ No newline at end of file
Index: dist/game/data/scripts/events/SaveTheCow/32476-10.htm
===================================================================
--- dist/game/data/scripts/events/SaveTheCow/32476-10.htm (revision 0)
+++ dist/game/data/scripts/events/SaveTheCow/32476-10.htm (working copy)
@@ -0,0 +1,3 @@
+<html><body>Employee of Magic Research Institute:<br>
+We have prepared <font color="LEVEL">Fresh Milk</font> from the cows, lots of <font color="LEVEL">Facelifting Potions</font> and even <font color="LEVEL">level 14 to 16 Soul Crystals</font> for adventurers who help us. As a reward for bringing us Golden Apigas, we will give you an <font color="LEVEL">S Grade Gemstone</font>, an <font color="LEVEL">Attribute Stone</font> and also a <font color="LEVEL">Vitality Maintaining Potion</font> which restores your vitality.<br>
+</body></html>
\ No newline at end of file
Index: dist/game/data/scripts/events/SaveTheCow/32476-02.htm
===================================================================
--- dist/game/data/scripts/events/SaveTheCow/32476-02.htm (revision 0)
+++ dist/game/data/scripts/events/SaveTheCow/32476-02.htm (working copy)
@@ -0,0 +1,9 @@
+<html><body>Employee of Magic Research Institute:<br>
+Thank you very much!<br>
+Bring 50 Apigas or Golden Apigas and we will give you a reward.<br>
+<br>
+<br>
+<a action="bypass -h Quest SaveTheCow give_reward">Give her 50 Apigas.</a><br>
+<a action="bypass -h Quest SaveTheCow give_adv_reward">Give her 50 Golden Apigas.</a><br>
+<a action="bypass -h Quest SaveTheCow 32476-10.htm">Ask about the reward.</a>
+</body></html>
\ No newline at end of file
Index: dist/game/data/stats/npcs/13100-13200.xml
===================================================================
--- dist/game/data/stats/npcs/13100-13200.xml (revision 10487)
+++ dist/game/data/stats/npcs/13100-13200.xml (working copy)
@@ -3307,7 +3307,7 @@
<height normal="50" />
</collision>
</npc>
- <npc id="13187" level="85" type="L2Npc" name="Milk Cow">
+ <npc id="13187" level="85" type="L2Monster" name="Milk Cow">
<!-- Confirmed CT2.5 -->
<race>ANIMAL</race>
<sex>MALE</sex>
@@ -3343,7 +3343,7 @@
<height normal="12.5" />
</collision>
</npc>
- <npc id="13188" level="85" type="L2Npc" name="Head Milk Cow">
+ <npc id="13188" level="85" type="L2Monster" name="Head Milk Cow">
<!-- Confirmed CT2.5 -->
<race>ANIMAL</race>
<sex>MALE</sex>
@@ -3379,7 +3379,7 @@
<height normal="28.5" />
</collision>
</npc>
- <npc id="13189" level="85" type="L2Npc" name="Bull">
+ <npc id="13189" level="85" type="L2Monster" name="Bull">
<!-- Confirmed CT2.5 -->
<race>ANIMAL</race>
<sex>MALE</sex>
@@ -3415,7 +3415,7 @@
<height normal="12.5" />
</collision>
</npc>
- <npc id="13190" level="85" type="L2Npc" name="Head Bull">
+ <npc id="13190" level="85" type="L2Monster" name="Head Bull">
<!-- Confirmed CT2.5 -->
<race>ANIMAL</race>
<sex>MALE</sex>
@@ -3451,7 +3451,7 @@
<height normal="28.5" />
</collision>
</npc>
- <npc id="13191" level="85" type="L2Npc" name="Gloomy Milk Cow">
+ <npc id="13191" level="85" type="L2Monster" name="Gloomy Milk Cow">
<!-- Confirmed CT2.5 -->
<race>ANIMAL</race>
<sex>MALE</sex>
@@ -3487,7 +3487,7 @@
<height normal="12.5" />
</collision>
</npc>
- <npc id="13192" level="85" type="L2Npc" name="Gloomy Head Milk Cow">
+ <npc id="13192" level="85" type="L2Monster" name="Gloomy Head Milk Cow">
<!-- Confirmed CT2.5 -->
<race>ANIMAL</race>
<sex>MALE</sex>
Index: dist/game/data/scripts/events/SaveTheCow/config.xml
===================================================================
--- dist/game/data/scripts/events/SaveTheCow/config.xml (revision 0)
+++ dist/game/data/scripts/events/SaveTheCow/config.xml (working copy)
@@ -0,0 +1,49 @@
+<Event name="Save the Cow" active="12 10 2009-26 10 2009" dropPeriod="12 10 2009-25 10 2009">
+ <Droplist>
+ <add item="14724" min="1" max="1" chance="1%" /> <!-- Milk Cow Scroll -->
+ <add item="14725" min="1" max="1" chance="1%" /> <!-- Head Milk Cow Scroll -->
+ <add item="14726" min="1" max="1" chance="1%" /> <!-- Gloomy Milk Cow Scroll -->
+ <add item="14727" min="1" max="1" chance="1%" /> <!-- Gloomy Milk Head Cow Scroll -->
+ </Droplist>
+ <Spawnlist>
+ <add npc="32476" x="16111" y="142850" z="-2707" heading="16000" />
+ <add npc="32476" x="17275" y="145000" z="-3037" heading="25000" />
+ <add npc="32476" x="83037" y="149324" z="-3470" heading="44000" />
+ <add npc="32476" x="82145" y="148609" z="-3468" heading="0" />
+ <add npc="32476" x="81755" y="146487" z="-3534" heading="32768" />
+ <add npc="32476" x="-81031" y="150038" z="-3045" heading="0" />
+ <add npc="32476" x="-83156" y="150994" z="-3130" heading="0" />
+ <add npc="32476" x="-13727" y="122117" z="-2990" heading="16384" />
+ <add npc="32476" x="-14129" y="123869" z="-3118" heading="40959" />
+ <add npc="32476" x="-84411" y="244813" z="-3730" heading="57343" />
+ <add npc="32476" x="-84023" y="243051" z="-3730" heading="4096" />
+ <add npc="32476" x="46908" y="50856" z="-2997" heading="8192" />
+ <add npc="32476" x="45538" y="48357" z="-3061" heading="18000" />
+ <add npc="32476" x="9929" y="16324" z="-4576" heading="62999" />
+ <add npc="32476" x="11546" y="17599" z="-4586" heading="46900" />
+ <add npc="32476" x="81987" y="53723" z="-1497" heading="0" />
+ <add npc="32476" x="81083" y="56118" z="-1562" heading="32768" />
+ <add npc="32476" x="147200" y="25614" z="-2014" heading="16384" />
+ <add npc="32476" x="148557" y="26806" z="-2206" heading="32768" />
+ <add npc="32476" x="117356" y="76708" z="-2695" heading="49151" />
+ <add npc="32476" x="115887" y="76382" z="-2714" heading="0" />
+ <add npc="32476" x="-117239" y="46842" z="367" heading="49151" />
+ <add npc="32476" x="-119494" y="44882" z="367" heading="24576" />
+ <add npc="32476" x="111004" y="218928" z="-3544" heading="16384" />
+ <add npc="32476" x="108426" y="221876" z="-3600" heading="49151" />
+ <add npc="32476" x="-45278" y="-112766" z="-241" heading="0" />
+ <add npc="32476" x="-45372" y="-114104" z="-241" heading="16384" />
+ <add npc="32476" x="115096" y="-178370" z="-891" heading="0" />
+ <add npc="32476" x="116199" y="-182694" z="-1506" heading="0" />
+ <add npc="32476" x="86865" y="-142915" z="-1341" heading="26000" />
+ <add npc="32476" x="85584" y="-142490" z="-1343" heading="0" />
+ <add npc="32476" x="147421" y="-55435" z="-2736" heading="49151" />
+ <add npc="32476" x="148206" y="-55786" z="-2782" heading="61439" />
+ <add npc="32476" x="43165" y="-48461" z="-797" heading="17000" />
+ <add npc="32476" x="43966" y="-47709" z="-798" heading="49999" />
+ </Spawnlist>
+ <messages>
+ <add type="onEnd" text="Save the Cow: Event end!" />
+ <add type="onEnter" text="Save the Cow: Event ongoing!" />
+ </messages>
+</Event>
\ No newline at end of file
Index: dist/game/data/scripts/events/SaveTheCow/32476-06.htm
===================================================================
--- dist/game/data/scripts/events/SaveTheCow/32476-06.htm (revision 0)
+++ dist/game/data/scripts/events/SaveTheCow/32476-06.htm (working copy)
@@ -0,0 +1,4 @@
+<html><body>Employee of Magic Research Institute:<br>
+Please take it with our thanks for a job well done!<br>
+You have our undying gratitude!
+</body></html>
\ No newline at end of file
Index: dist/game/data/scripts/events/SaveTheCow/32476-11.htm
===================================================================
--- dist/game/data/scripts/events/SaveTheCow/32476-11.htm (revision 0)
+++ dist/game/data/scripts/events/SaveTheCow/32476-11.htm (working copy)
@@ -0,0 +1,8 @@
+<html><body>Employee of Magic Research Institute:<br>
+Whew!<br>
+We were able to restore order quickly thanks to the help of so many adventurers.<br>
+Bring back Agigas or Golden Apigas and you will be rewarded.<br>
+<br>
+<br>
+<a action="bypass -h Quest SaveTheCow give_potions">Buy 200 Cupid's Fatigue Recovery Potions (10,000 Adena).</a>
+<a action="bypass -h Quest SaveTheCow 32476-02.htm">Receive a reward.</a></body></html>
\ No newline at end of file
Index: dist/game/data/scripts/events/SaveTheCow/32476-01.htm
===================================================================
--- dist/game/data/scripts/events/SaveTheCow/32476-01.htm (revision 0)
+++ dist/game/data/scripts/events/SaveTheCow/32476-01.htm (working copy)
@@ -0,0 +1,10 @@
+<html><body>Employee of Magic Research Institute:<br>
+Arghh! I am so busy! The work never stops!<br>
+It's worse than usual -- one of our prized devices has broken, and unless we can fix it all our research will screech to a stop. Please help us!<br>
+<br>
+<br>
+<a action="bypass -h Quest SaveTheCow 32476-07.htm">Ask what happened.</a><br>
+<a action="bypass -h Quest SaveTheCow give_package">Buy a "Save a Cow" Event Pack (10,000 Adena).</a><br>
+<a action="bypass -h Quest SaveTheCow give_potions">Buy 200 Cupid's Fatigue Recovery Potions (10,000 Adena).</a><br>
+<a action="bypass -h Quest SaveTheCow 32476-02.htm">Receive a reward.</a>
+</body></html>
\ No newline at end of file
Index: dist/game/data/scripts/events/SaveTheCow/32476-05.htm
===================================================================
--- dist/game/data/scripts/events/SaveTheCow/32476-05.htm (revision 0)
+++ dist/game/data/scripts/events/SaveTheCow/32476-05.htm (working copy)
@@ -0,0 +1,4 @@
+<html><body>Employee of Magic Research Institute:<br>
+You must bring at least <font color="LEVEL">50 Golden Apigas</font> in order to receive a reward.<br>
+Come again when you have enough.
+</body></html>
\ No newline at end of file
/*
* 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
*/
package custom.events.SpooksScarecrows;
import com.l2jserver.gameserver.datatables.NpcData;
import com.l2jserver.gameserver.enums.Race;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jserver.gameserver.model.quest.Quest;
/**
* @author fissban
*/
public class SpooksScarecrows extends Quest
{
// TODO porcentajes sin confirmar
private static final int[][] DROPLIST =
{
{
14057, // Scarecrow JackTransformation Stick 30 Day
94, // 5%
},
{
20034, // Revita Pop
69, // 30%
},
};
@Override
public String onKill(L2Npc npc, L2PcInstance killer, boolean isPet)
{
if ((npc.getLevel() <= 40) && (killer.getLevel() <= 49))
{
Race nRace = npc.getTemplate().getRace();
if (Race.UNDEAD == nRace)
{
dropItem(npc, killer, DROPLIST);
}
}
return super.onKill(npc, killer, isPet);
}
private static final void dropItem(L2Npc mob, L2PcInstance player, int[][] droplist)
{
final int chance = getRandom(100);
for (int[] drop : droplist)
{
if (chance > drop[1])
{
player.addItem("Drop", drop[0], 1, player, true);
return;
}
}
}
public SpooksScarecrows()
{
super(-1, SpooksScarecrows.class.getSimpleName(), "events");
for (L2NpcTemplate template : NpcData.getInstance().getAllNpcOfClassType("L2Monster"))
{
addKillId(template.getId());
}
}
public static void main(String[] args)
{
new SpooksScarecrows();
}
}
CitarInformación del evento:
CitarInformación rápida:
### Eclipse Workspace Patch 1.0
#P L2J_Server
Index: java/com/l2jserver/Config.java
===================================================================
--- java/com/l2jserver/Config.java (revision 4767)
+++ java/com/l2jserver/Config.java (working copy)
@@ -56,6 +56,7 @@
//--------------------------------------------------
// L2J Property File Definitions
//--------------------------------------------------
+ public static final String BIO_CONFIG_FILE = "./config/biohazard.properties";
public static final String CHARACTER_CONFIG_FILE = "./config/Character.properties";
public static final String FEATURE_CONFIG_FILE = "./config/Feature.properties";
public static final String FORTSIEGE_CONFIGURATION_FILE = "./config/fortsiege.properties";
@@ -86,6 +87,19 @@
//--------------------------------------------------
+ // Biohazard Config
+ //--------------------------------------------------
+ public static boolean BIOHAZARD_EVENT_ENABLED;
+ public static String[] BIOHAZARD_EVENT_INTERVAL;
+ public static boolean ALLOWPVPPKBIO;
+ public static int BIOHAZARDMINPLAYERS;
+ public static int BIOHAZARD_X;
+ public static int BIOHAZARD_Y;
+ public static int BIOHAZARD_Z;
+ public static int BIOHAZARDREWARDID;
+ public static int BIOHAZARDREWARDAMOUNT;
+
+ //--------------------------------------------------
// L2J Variable Definitions
//--------------------------------------------------
public static int MASTERACCESS_LEVEL;
@@ -1110,6 +1124,29 @@
{
try
{
+ L2Properties BIOSettings = new L2Properties();
+ is = new FileInputStream(new File(BIO_CONFIG_FILE));
+ BIOSettings.load(is);
+
+ BIOHAZARD_EVENT_ENABLED = Boolean.parseBoolean(BIOSettings.getProperty("BiohazardEventEnabled", "false"));
+ BIOHAZARD_EVENT_INTERVAL = BIOSettings.getProperty("BiohazardEventInterval", "20:00").split(",");
+ ALLOWPVPPKBIO = Boolean.parseBoolean(BIOSettings.getProperty("BiohazardAllowPvPPkCount", "false"));
+ BIOHAZARDMINPLAYERS = Integer.parseInt(BIOSettings.getProperty("Biohazardminplayers", "2"));
+ BIOHAZARD_X = Integer.parseInt(BIOSettings.getProperty("setX", "-17507"));
+ BIOHAZARD_Y = Integer.parseInt(BIOSettings.getProperty("setY", "143206"));
+ BIOHAZARD_Z = Integer.parseInt(BIOSettings.getProperty("setZ", "-3911"));
+ BIOHAZARDREWARDID = Integer.parseInt(BIOSettings.getProperty("BiohazardRewardId", "57"));
+ BIOHAZARDREWARDAMOUNT = Integer.parseInt(BIOSettings.getProperty("BiohazardRewardAmount", "1000"));
+
+ }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ throw new Error("Failed to Load "+BIO_CONFIG_FILE+" File.");
+ }
+
+ try
+ {
L2Properties serverSettings = new L2Properties();
is = new FileInputStream(new File(CONFIGURATION_FILE));
serverSettings.load(is);
Index: java/config/biohazard.properties
===================================================================
--- java/config/biohazard.properties (revision 0)
+++ java/config/biohazard.properties (revision 0)
@@ -0,0 +1,23 @@
+# ---------------------------------------------------------------------------
+# Biohazard Event Engine
+# ---------------------------------------------------------------------------
+# Enable/Disable BiohazardEvent System
+BiohazardEventEnabled = False
+
+# Times Biohazard will occur (24h format).
+BiohazardEventInterval = 9:00,15:00,21:00,3:00
+
+# set True to allow PvP PK points
+BiohazardAllowPvPPkCount = False
+
+# Min amount of players allowed in the event.
+Biohazardminplayers = 2
+
+# Set Location x,y,z for this event.
+setX = -17507
+setY = 143206
+setZ = -3911
+
+# Reward for winning team.
+BiohazardRewardId = 57
+BiohazardRewardAmount = 1000
\ No newline at end of file
Index: java/com/l2jserver/gameserver/model/entity/Biohazard.java
===================================================================
--- java/com/l2jserver/gameserver/model/entity/Biohazard.java (revision 0)
+++ java/com/l2jserver/gameserver/model/entity/Biohazard.java (revision 0)
@@ -0,0 +1,310 @@
+/*
+ * 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.entity;
+
+
+import java.util.Random;
+import javolution.util.FastSet;
+
+import com.l2jserver.Config;
+import com.l2jserver.gameserver.Announcements;
+import com.l2jserver.gameserver.instancemanager.TransformationManager;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.olympiad.OlympiadManager;
+import com.l2jserver.util.Rnd;
+
+public class Biohazard
+{
+ enum EventState
+ {
+ INACTIVE,
+ INACTIVATING,
+ REGISTERING,
+ STARTED,
+ REWARDING
+ }
+
+ private static EventState _state = EventState.INACTIVE;
+
+ public static FastSet<L2PcInstance> _participants = new FastSet<L2PcInstance>();
+ public static FastSet<L2PcInstance> _infected = new FastSet<L2PcInstance>();
+ public static FastSet<L2PcInstance> _notInfected = new FastSet<L2PcInstance>();
+
+ public static boolean isStarted()
+ {
+ if (_state == EventState.STARTED)
+ return true;
+ return false;
+ }
+
+ public static boolean isRegistering()
+ {
+ if (_state == EventState.REGISTERING)
+ return true;
+ return false;
+ }
+
+ public static void startRegistering()
+ {
+ if (_state == EventState.REGISTERING || _state == EventState.STARTED)
+ return;
+ Announcements.getInstance().announceToAll("Biohazard: Registration is open.");
+ Announcements.getInstance().announceToAll("Biohazard: Type \".bhreg\" to register to event.");
+ Announcements.getInstance().announceToAll("Biohazard: Type \".bhunreg\" to unregister from event.");
+ _state = EventState.REGISTERING;
+ int step = 0;
+ int after = 0;
+ for (int i = 40; i > 0; i-=10)
+ {
+ switch(i)
+ {
+ case 40:
+ step = 5;
+ after = 15;
+ break;
+ case 30:
+ step = 5;
+ after = 10;
+ break;
+ case 20:
+ step = 4;
+ after = 5;
+ break;
+ case 10:
+ step = 1;
+ after = 1;
+ break;
+ }
+ if (_state == EventState.INACTIVE)
+ return;
+ Announcements.getInstance().announceToAll("Biohazard: Registration will be closed in " + after + " minute(s).");
+ try{Thread.sleep(step*60000);}catch (Exception e){}
+ }
+ //sound = "";
+ try{Thread.sleep(10000);}catch (Exception e){}
+ if (_state == EventState.INACTIVE)
+ return;
+ if (_participants.size() >= Config.BIOHAZARDMINPLAYERS)
+ {
+ Announcements.getInstance().announceToAll("Biohazard: Teleporting players in 15 seconds.");
+ try{Thread.sleep(15000);}catch (Exception e){}
+ _state = EventState.STARTED;
+ startEventAndTelePl();
+ }
+ else
+ Announcements.getInstance().announceToAll("Biohazard: Event aborted due to lack of participants.");
+ }
+
+ public static void addParticipant(L2PcInstance player)
+ {
+ if (OlympiadManager.getInstance().isRegistered(player) || TvTEvent.isPlayerParticipant(player.getObjectId()))
+ {
+ player.sendMessage("You cannot register because of registration in another event");
+ return;
+ }
+ if (_state == EventState.REGISTERING && !_participants.contains(player))
+ {
+ _participants.add(player);
+ player.sendMessage("You have successfully registered to this event");
+ }
+ else
+ player.sendMessage("You are already registered or it's not registration time.");
+ }
+
+ public static void removeParticipant(L2PcInstance player)
+ {
+ if (_state == EventState.REGISTERING)
+ {
+ if (_participants.contains(player))
+ {
+ _participants.remove(player);
+ player.sendMessage("You have unregistered to this event.");
+ }
+ else
+ player.sendMessage("You aren't registered in this event.");
+ player.setIsInBiohazard(false);
+ }
+ else
+ player.sendMessage("It's not registration time.");
+ }
+
+ public static void startEventAndTelePl()
+ {
+ int time;
+ Random r = new Random();
+ time = r.nextInt(35000); // 35000 = 35 Seconds
+
+ if (_state == EventState.INACTIVE)
+ return;
+ synchronized(_participants)
+ {
+ for (L2PcInstance pl : _participants)
+ if (pl.isOnline())
+ {
+ _notInfected.add(pl);
+ pl.stopAllEffects();
+ pl._oldX = pl.getX();
+ pl._oldY = pl.getY();
+ pl._oldZ = pl.getZ();
+ pl.teleToLocation(Config.BIOHAZARD_X,Config.BIOHAZARD_Y,Config.BIOHAZARD_Z);
+ pl.setTeam(0);
+ pl.setIsInBiohazard(true);
+ pl.untransform();
+ }
+ }
+ Announcements.getInstance().announceToAll("Biohazard: In some seconds a virus will take over anyone and he will become zombie!");
+ try{Thread.sleep(time);}catch (Exception e){}
+ int num = Math.round(Rnd.get(_notInfected.size()-1));
+ L2PcInstance infectFirst = getAllNotInfected()[num];
+ infectPlayer(infectFirst);
+ Announcements.getInstance().announceToAll("Biohazard: Virus took over " + infectFirst.getName() + " body and he wants to infect everybody else!");
+ }
+
+ public static void infectPlayer(L2PcInstance zombie)
+ {
+ if (_state == EventState.INACTIVE)
+ return;
+ zombie.setIsZombie(true);
+ _notInfected.remove(zombie);
+ _infected.add(zombie);
+ TransformationManager.getInstance().transformPlayer(303, zombie);
+ zombie.stopAllEffects();
+ zombie.setCurrentHp(zombie.getMaxHp());
+ zombie.setCurrentMp(zombie.getMaxMp());
+ zombie.setCurrentCp(zombie.getMaxCp());
+ if (_notInfected.size() == 0)
+ zombiesWin();
+ }
+
+ public static void onLogout(L2PcInstance playerInstance)
+ {
+ if (_state == EventState.REGISTERING)
+ removeParticipant(playerInstance);
+ else if (_state == EventState.STARTED)
+ {
+ playerInstance.setXYZ(playerInstance._oldX,playerInstance._oldY,playerInstance._oldZ);
+ if (!playerInstance.isZombie())
+ _notInfected.remove(playerInstance);
+ else if (playerInstance.isZombie())
+ _infected.remove(playerInstance);
+ if (_notInfected.size() == 0)
+ zombiesWin();
+ if (_infected.size() == 0)
+ playersWin();
+ }
+ }
+
+ public static void zombiesWin()
+ {
+ if (_state == EventState.INACTIVE)
+ return;
+ Announcements.getInstance().announceToAll("Biohazard: Zombies won.");
+ Announcements.getInstance().announceToAll("Biohazard: Rewarding and teleporting participants back to village in 20 seconds.");
+ _state = EventState.REWARDING;
+ try{Thread.sleep(15000);}catch (Exception e){}
+ synchronized(_infected)
+ {
+ for (L2PcInstance pl : _infected)
+ if (pl.isOnline())
+ pl.addItem("Biohazard", Config.BIOHAZARDREWARDID, Config.BIOHAZARDREWARDAMOUNT, pl, true);
+ Biohazard.teleport();
+ }
+ }
+
+ public static void playersWin()
+ {
+ Announcements.getInstance().announceToAll("Biohazard: Players won.");
+ Announcements.getInstance().announceToAll("Biohazard: Rewarding and teleporting participants back to village in 15 seconds.");
+ _state = EventState.REWARDING;
+ try{Thread.sleep(15000);}catch (Exception e){}
+ synchronized(_notInfected)
+ {
+ for (L2PcInstance pl : _notInfected)
+ if (pl.isOnline())
+ pl.addItem("Biohazard", Config.BIOHAZARDREWARDID, Config.BIOHAZARDREWARDAMOUNT, pl, true);
+ Biohazard.teleport();
+ }
+ }
+
+ public static void teleport()
+ {
+ synchronized(_participants)
+ {
+ synchronized(_notInfected)
+ {
+ for (L2PcInstance pl : _notInfected)
+ if (pl.isOnline())
+ {
+ pl.stopAllEffects();
+ pl.setIsInBiohazard(false);
+// if (pl.inWorld() == 1)
+// pl.setTeam(pl.getFactionId());
+ }
+ }
+ synchronized(_infected)
+ {
+ for (L2PcInstance pl : _infected)
+ if (pl.isOnline())
+ {
+ pl.doRevive();
+ pl.stopAllEffects();
+ if (pl.isTransformed())
+ pl.untransform();
+ pl.setIsZombie(false);
+ pl.setIsInBiohazard(false);
+// if (pl.inWorld() == 1)
+// pl.setTeam(pl.getFactionId());
+ }
+ }
+ try{Thread.sleep(4000);}catch (Exception e){}
+ for (L2PcInstance pl : _participants)
+ pl.teleToLocation(pl._oldX,pl._oldY,pl._oldZ);
+ }
+ _participants.clear();
+ _infected.clear();
+ _notInfected.clear();
+ _state = EventState.INACTIVE;
+ }
+
+ public static L2PcInstance[] getAllNotInfected()
+ {
+ synchronized(_notInfected)
+ {
+ return _notInfected.toArray(new L2PcInstance[_notInfected.size()]);
+ }
+ }
+
+ public static void abortEvent()
+ {
+ _state = EventState.INACTIVE;
+ _participants.clear();
+ _notInfected.clear();
+ _infected.clear();
+ Announcements.getInstance().announceToAll("Biohazard: Event aborted.");
+ }
+
+ public static boolean isInactive()
+ {
+ boolean isInactive;
+
+ synchronized (_state)
+ {
+ isInactive = _state == EventState.INACTIVE;
+ }
+
+ return isInactive;
+ }
+
+}
\ No newline at end of file
Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 4767)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -150,6 +150,7 @@
import com.l2jserver.gameserver.model.base.PlayerClass;
import com.l2jserver.gameserver.model.base.Race;
import com.l2jserver.gameserver.model.base.SubClass;
+import com.l2jserver.gameserver.model.entity.Biohazard;
import com.l2jserver.gameserver.model.entity.Castle;
import com.l2jserver.gameserver.model.entity.Duel;
import com.l2jserver.gameserver.model.entity.Fort;
@@ -480,6 +481,26 @@
}
}
+ /** Biohazard */
+ private static boolean _inBiohazard = false;
+ public boolean _isZombie = false;
+ public void setIsZombie(boolean a)
+ {
+ _isZombie = a;
+ }
+ public boolean isZombie()
+ {
+ return _isZombie;
+ }
+ private boolean inBiohazard()
+ {
+ return _inBiohazard;
+ }
+ public void setIsInBiohazard(boolean b)
+ {
+ _inBiohazard = b;
+ }
+
/** Olympiad */
private boolean _inOlympiadMode = false;
private boolean _OlympiadStart = false;
@@ -4892,6 +4913,10 @@
@Override
public synchronized void untransform()
{
+ // Biohazard
+ if (inBiohazard() && Biohazard.isStarted() && _transformation != null && isZombie())
+ return;
+
if (_transformation != null)
{
setQueuedSkill(null, false, false);
@@ -5324,6 +5349,23 @@
// Kill the L2PcInstance
if (!super.doDie(killer))
return false;
+
+ // Biohazard
+ if (killer instanceof L2PcInstance)
+ {
+ L2PcInstance pl = (L2PcInstance) killer;
+ if (inBiohazard() && !isZombie() && pl.inBiohazard() && pl.isZombie() && Biohazard.isStarted())
+ {
+ pl.abortAttack();
+ pl.abortCast();
+ doRevive();
+ Biohazard.infectPlayer(this);
+ stopAllEffects();
+ setCurrentHp(getMaxHp());
+ setCurrentMp(getMaxMp());
+ setCurrentCp(getMaxCp());
+ }
+ }
if (isMounted())
stopFeed();
@@ -5483,6 +5525,17 @@
{
reviveRequest(this, null, false);
}
+ // Biohazard
+ if (isZombie() && inBiohazard())
+ {
+ if(Biohazard._infected.contains(this))
+ {
+ Biohazard._infected.remove(this);
+ untransform();
+ if (Biohazard._infected.size() == 0)
+ Biohazard.playersWin();
+ }
+ }
return true;
}
@@ -5677,6 +5730,13 @@
if (target instanceof L2PcInstance
&& AntiFeedManager.getInstance().check(this, target))
{
+ // Add by Biohazard Event
+ if(Config.ALLOWPVPPKBIO)
+ {
+ if (Biohazard.isStarted() && _inBiohazard)
+ return;
+ }
+
// Add karma to attacker and increase its PK counter
setPvpKills(getPvpKills() + 1);
@@ -5738,6 +5798,13 @@
if (getKarma() > (Integer.MAX_VALUE - newKarma))
newKarma = Integer.MAX_VALUE - getKarma();
+ // Add by Biohazard Event
+ if(Config.ALLOWPVPPKBIO)
+ {
+ if (Biohazard.isStarted() && _inBiohazard)
+ return;
+ }
+
// Add karma to attacker and increase its PK counter
setKarma(getKarma() + newKarma);
if (target instanceof L2PcInstance
@@ -8459,6 +8526,17 @@
// Check if the attacker isn't the L2PcInstance Pet
if (attacker == this || attacker == getPet())
return false;
+
+ // Biohazard
+ L2PcInstance player = null;
+ if (attacker instanceof L2PcInstance)
+ player = (L2PcInstance) attacker;
+ if (attacker instanceof L2SummonInstance)
+ player = ((L2SummonInstance) attacker).getOwner();
+
+ if (player != null)
+ if (Biohazard.isStarted() && player.inBiohazard() && inBiohazard() && player.isZombie() != isZombie())
+ return true;
// TODO: check for friendly mobs
// Check if the attacker is a L2MonsterInstance
@@ -8859,6 +8937,10 @@
return false;
}
+ // Biohazard
+ if (skill.getId() == 619 && inBiohazard() && isZombie())
+ return false;
+
//************************************* Check Skill Type *******************************************
// Check if this is offensive magic skill
@@ -8869,6 +8951,25 @@
// If L2Character or target is in a peace zone, send a system message TARGET_IN_PEACEZONE a Server->Client packet ActionFailed
sendPacket(SystemMessage.getSystemMessage(SystemMessageId.TARGET_IN_PEACEZONE));
sendPacket(ActionFailed.STATIC_PACKET);
+
+ // Biohazard
+ boolean cond = true;
+ L2PcInstance trgtF = null;
+ if (target instanceof L2PcInstance)
+ trgtF = (L2PcInstance)target;
+ else if (target instanceof L2SummonInstance)
+ trgtF = ((L2SummonInstance)target).getOwner();
+ if (trgtF != null)
+ if (Biohazard.isStarted() && trgtF.inBiohazard() && inBiohazard())
+ {
+ if (trgtF.isZombie() != isZombie())
+ cond = true;
+ if (trgtF.isZombie() == isZombie())
+ cond = false;
+ }
+
+ if (!cond)
+
return false;
}
@@ -9294,6 +9395,9 @@
SkillDat skilldatpet = getCurrentPetSkill();
if(skill.isPvpSkill()) // pvp skill
{
+ // Biohazard
+ if (Biohazard.isStarted() && inBiohazard() && ((L2PcInstance)target).inBiohazard() && isZombie() != ((L2PcInstance)target).isZombie())
+ return true;
if(getClan() != null && ((L2PcInstance)target).getClan() != null)
{
if(getClan().isAtWarWith(((L2PcInstance)target).getClan().getClanId()) && ((L2PcInstance)target).getClan().isAtWarWith(getClan().getClanId()))
@@ -11778,6 +11882,15 @@
_log.log(Level.SEVERE, "deleteMe()", e);
}
+ try
+ {
+ Biohazard.onLogout(this);
+ }
+ catch (Exception e)
+ {
+ _log.log(Level.SEVERE, "deleteMe()", e);
+ }
+
// Update database with items in its inventory and remove them from the world
try
{
@@ -12985,6 +13098,11 @@
private int _eventEffectId = 0;
private boolean _isInSiege;
+ // Biohazard
+ public int _oldX;
+ public int _oldY;
+ public int _oldZ;
+
public Collection<TimeStamp> getReuseTimeStamps()
{
return _reuseTimeStamps.values();
Index: java/com/l2jserver/gameserver/GameServer.java
===================================================================
--- java/com/l2jserver/gameserver/GameServer.java (revision 4767)
+++ java/com/l2jserver/gameserver/GameServer.java (working copy)
@@ -119,6 +119,7 @@
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.PartyMatchRoomList;
import com.l2jserver.gameserver.model.PartyMatchWaitingList;
+import com.l2jserver.gameserver.model.entity.BiohazardManager;
import com.l2jserver.gameserver.model.entity.Hero;
import com.l2jserver.gameserver.model.entity.TvTManager;
import com.l2jserver.gameserver.model.olympiad.Olympiad;
@@ -399,6 +400,7 @@
_log.info("IdFactory: Free ObjectID's remaining: " + IdFactory.getInstance().size());
+ BiohazardManager.getInstance();
TvTManager.getInstance();
KnownListUpdateTaskManager.getInstance();
Index: java/com/l2jserver/gameserver/model/entity/BiohazardManager.java
===================================================================
--- java/com/l2jserver/gameserver/model/entity/BiohazardManager.java (revision 0)
+++ java/com/l2jserver/gameserver/model/entity/BiohazardManager.java (revision 0)
@@ -0,0 +1,146 @@
+/*
+ * 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.entity;
+
+import java.util.Calendar;
+import java.util.concurrent.ScheduledFuture;
+import java.util.logging.Logger;
+
+import com.l2jserver.Config;
+import com.l2jserver.gameserver.model.entity.Biohazard;
+import com.l2jserver.gameserver.ThreadPoolManager;
+
+
+public class BiohazardManager
+{
+ protected static final Logger _log = Logger.getLogger(BiohazardManager.class.getName());
+
+ /** Task for event cycles<br> */
+ private BiohazardStartTask _task;
+
+ /**
+ * New instance only by getInstance()<br>
+ */
+ private BiohazardManager()
+ {
+ if (Config.BIOHAZARD_EVENT_ENABLED)
+ {
+ this.scheduleEventStart();
+ _log.info("[Biohazard] EventEngine: Engine started.");
+ }
+ else
+ {
+ _log.info("[Biohazard] EventEngine: Engine is disabled.");
+ }
+ }
+
+ public static BiohazardManager getInstance()
+ {
+ return SingletonHolder._instance;
+ }
+
+ public void scheduleEventStart()
+ {
+ try
+ {
+ final Calendar currentTime = Calendar.getInstance();
+ Calendar nextStartTime = null;
+ Calendar testStartTime = null;
+ for (String timeOfDay : Config.BIOHAZARD_EVENT_INTERVAL)
+ {
+ // Creating a Calendar object from the specified interval value
+ testStartTime = Calendar.getInstance();
+ testStartTime.setLenient(true);
+ String[] splitTimeOfDay = timeOfDay.split(":");
+ testStartTime.set(Calendar.HOUR_OF_DAY, Integer.parseInt(splitTimeOfDay[0]));
+ testStartTime.set(Calendar.MINUTE, Integer.parseInt(splitTimeOfDay[1]));
+ // If the date is in the past, make it the next day (Example: Checking for "1:00", when the time is 23:57.)
+ if (testStartTime.getTimeInMillis() < currentTime.getTimeInMillis())
+ testStartTime.add(Calendar.DAY_OF_MONTH, 1);
+
+ // Check for the test date to be the minimum (smallest in the specified list)
+ if (nextStartTime == null || testStartTime.getTimeInMillis() < nextStartTime.getTimeInMillis())
+ nextStartTime = testStartTime;
+
+ }
+ _task = new BiohazardStartTask(nextStartTime.getTimeInMillis());
+ ThreadPoolManager.getInstance().executeTask(_task);
+ }
+ catch (Exception e)
+ {
+ _log.warning("BiohazardEventEngine[BiohazardManager.scheduleEventStart()]: Error figuring out a start time. Check BiohazardEventInterval in config file.");
+ }
+ }
+
+ public void startEvent()
+ {
+ Biohazard.startRegistering();
+ this.scheduleEventStart();
+
+ }
+
+ public void skipDelay()
+ {
+ if (_task.nextRun.cancel(false))
+ {
+ _task.setStartTime(System.currentTimeMillis());
+ ThreadPoolManager.getInstance().executeTask(_task);
+ }
+ }
+
+ class BiohazardStartTask implements Runnable
+ {
+ private long _startTime;
+ public ScheduledFuture<?> nextRun;
+
+ public BiohazardStartTask(long startTime)
+ {
+ _startTime = startTime;
+ }
+
+ public void setStartTime(long startTime)
+ {
+ _startTime = startTime;
+ }
+
+ public void run()
+ {
+ final int delay = (int) Math.round((_startTime - System.currentTimeMillis()) / 1000.0);
+
+ // start
+ if(delay <= 0)
+ {
+ if (Biohazard.isInactive())
+ startEvent();
+ return;
+ }
+
+ int nextMsg = 0;
+ if (delay > 0)
+ {
+ nextMsg = delay;
+ }
+
+ nextRun = ThreadPoolManager.getInstance().scheduleGeneral(this, nextMsg * 1000);
+
+ }
+ }
+
+ @SuppressWarnings("synthetic-access")
+ private static class SingletonHolder
+ {
+ protected static final BiohazardManager _instance = new BiohazardManager();
+ }
+}
\ No newline at end of file
#P L2J_DataPack
Index: data/scripts/handlers/usercommandhandlers/Escape.java
===================================================================
--- data/scripts/handlers/usercommandhandlers/Escape.java (revision 8221)
+++ data/scripts/handlers/usercommandhandlers/Escape.java (working copy)
@@ -57,6 +57,13 @@
return false;
}
+ // Biohazard
+ if (activeChar.isinBiohazard())
+ {
+ activeChar.sendPacket(ActionFailed.STATIC_PACKET);
+ return false;
+ }
+
int unstuckTimer = (activeChar.getAccessLevel().isGm() ? 1000 : Config.UNSTUCK_INTERVAL * 1000);
Index: data/scripts/handlers/MasterHandler.java
===================================================================
--- data/scripts/handlers/MasterHandler.java (revision 8221)
+++ data/scripts/handlers/MasterHandler.java (working copy)
@@ -244,6 +244,7 @@
import handlers.usercommandhandlers.PartyInfo;
import handlers.usercommandhandlers.Time;
import handlers.voicedcommandhandlers.Banking;
+import handlers.voicedcommandhandlers.biohazard;
import handlers.voicedcommandhandlers.ChatAdmin;
import handlers.voicedcommandhandlers.Debug;
import handlers.voicedcommandhandlers.Lang;
@@ -550,6 +551,7 @@
private static void loadVoicedHandlers()
{
+ VOICE.registerVoicedCommandHandler(new biohazard());
VOICE.registerVoicedCommandHandler(new stats());
if (Config.L2JMOD_ALLOW_WEDDING)
VOICE.registerVoicedCommandHandler(new Wedding());
Index: data/scripts/handlers/voicedcommandhandlers/biohazard.java
===================================================================
--- data/scripts/handlers/voicedcommandhandlers/biohazard.java (revision 0)
+++ data/scripts/handlers/voicedcommandhandlers/biohazard.java (revision 0)
@@ -0,0 +1,38 @@
+/*
+ * 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
+ */
+package handlers.voicedcommandhandlers;
+
+import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.Biohazard;
+
+public class biohazard implements IVoicedCommandHandler
+{
+ private static final String[] VOICED_COMMANDS = { "bhreg", "bhunreg" };
+
+ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
+ {
+ if (command.equalsIgnoreCase("bhreg"))
+ Biohazard.addParticipant(activeChar);
+ else if (command.equalsIgnoreCase("bhunreg"))
+ Biohazard.removeParticipant(activeChar);
+ return true;
+ }
+
+ public String[] getVoicedCommandList()
+ {
+ return VOICED_COMMANDS;
+ }
+}
\ No newline at end of file
### Eclipse Workspace Patch 1.0
#P L2J_DataPack_BETA
Index: dist/game/data/scripts/handlers/MasterHandler.java
===================================================================
--- dist/game/data/scripts/handlers/MasterHandler.java (revision 9910)
+++ dist/game/data/scripts/handlers/MasterHandler.java (working copy)
@@ -274,6 +274,7 @@
import handlers.usercommandhandlers.Time;
import handlers.usercommandhandlers.Unstuck;
import handlers.voicedcommandhandlers.Banking;
+import handlers.voicedcommandhandlers.Chamber;
import handlers.voicedcommandhandlers.ChangePassword;
import handlers.voicedcommandhandlers.ChatAdmin;
import handlers.voicedcommandhandlers.Debug;
@@ -540,6 +541,7 @@
// TODO: Add configuration options for this voiced commands:
// CastleVCmd.class,
// SetVCmd.class,
+ Chamber.class,
(Config.L2JMOD_ALLOW_WEDDING ? Wedding.class : null),
(Config.BANKING_SYSTEM_ENABLED ? Banking.class : null),
(Config.TVT_ALLOW_VOICED_COMMAND ? TvTVoicedInfo.class : null),
Index: dist/game/data/scripts/handlers/voicedcommandhandlers/Chamber.java
===================================================================
--- dist/game/data/scripts/handlers/voicedcommandhandlers/Chamber.java (revision 0)
+++ dist/game/data/scripts/handlers/voicedcommandhandlers/Chamber.java (revision 0)
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2004-2013 L2J DataPack
+ *
+ * This file is part of L2J DataPack.
+ *
+ * L2J DataPack 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * L2J DataPack 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, see <http://www.gnu.org/licenses/>.
+ */
+package handlers.voicedcommandhandlers;
+
+import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.OneInTheChamber;
+
+/**
+ * @author Zoey76
+ */
+public class Chamber implements IVoicedCommandHandler
+{
+ private static final String[] VOICED_COMMANDS =
+ {
+ "register",
+ "unregister"
+
+ };
+
+ @Override
+ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
+ {
+ if (command.equalsIgnoreCase(VOICED_COMMANDS[0]))
+ {
+ OneInTheChamber.getInstance().register(activeChar);
+ }
+ else if (command.equalsIgnoreCase(VOICED_COMMANDS[1]))
+ {
+ OneInTheChamber.getInstance().unregister(activeChar);
+ }
+
+ return true;
+ }
+
+ @Override
+ public String[] getVoicedCommandList()
+ {
+ return VOICED_COMMANDS;
+ }
+}
#P L2J_Server_BETA
Index: java/com/l2jserver/gameserver/network/clientpackets/RequestRestartPoint.java
===================================================================
--- java/com/l2jserver/gameserver/network/clientpackets/RequestRestartPoint.java (revision 6166)
+++ java/com/l2jserver/gameserver/network/clientpackets/RequestRestartPoint.java (working copy)
@@ -33,6 +33,7 @@
import com.l2jserver.gameserver.model.entity.Castle;
import com.l2jserver.gameserver.model.entity.ClanHall;
import com.l2jserver.gameserver.model.entity.Fort;
+import com.l2jserver.gameserver.model.entity.OneInTheChamber;
import com.l2jserver.gameserver.model.entity.clanhall.SiegableHall;
/**
@@ -264,7 +265,14 @@
}
default:
{
- loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.TOWN);
+ if (activeChar.inChamber)
+ {
+ loc = new Location(OneInTheChamber.getInstance().getX(), OneInTheChamber.getInstance().getY(), OneInTheChamber.getInstance().getZ());
+ }
+ else
+ {
+ loc = MapRegionManager.getInstance().getTeleToLocation(activeChar, TeleportWhereType.TOWN);
+ }
break;
}
}
Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 6166)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -196,6 +196,7 @@
import com.l2jserver.gameserver.model.entity.Hero;
import com.l2jserver.gameserver.model.entity.Instance;
import com.l2jserver.gameserver.model.entity.L2Event;
+import com.l2jserver.gameserver.model.entity.OneInTheChamber;
import com.l2jserver.gameserver.model.entity.Siege;
import com.l2jserver.gameserver.model.entity.TvTEvent;
import com.l2jserver.gameserver.model.fishing.L2Fish;
@@ -336,6 +337,10 @@
*/
public final class L2PcInstance extends L2Playable
{
+
+ public int chamberKills = 0;
+ public boolean inChamber = false;
+ public int arrowCount = 0;
// Character Skill SQL String Definitions:
private static final String RESTORE_SKILLS_FOR_CHAR = "SELECT skill_id,skill_level FROM character_skills WHERE charId=? AND class_index=?";
private static final String ADD_NEW_SKILL = "INSERT INTO character_skills (charId,skill_id,skill_level,class_index) VALUES (?,?,?,?)";
@@ -427,7 +432,13 @@
public void doAttack(L2Character target)
{
super.doAttack(target);
-
+ L2PcInstance targett = target.getActingPlayer();
+ if (inChamber)
+ {
+ targett.doDie(target);
+ chamberKills += 1;
+ OneInTheChamber.getInstance().addArrow(this.getPlayer());
+ }
// cancel the recent fake-death protection instantly if the player attacks or casts spells
getPlayer().setRecentFakeDeath(false);
}
@@ -5448,6 +5459,10 @@
return false;
}
+ if (inChamber)
+ {
+ OneInTheChamber.addArrow(this.getActingPlayer());
+ }
if (isMounted())
{
stopFeed();
@@ -5810,7 +5825,6 @@
{
// Add karma to attacker and increase its PK counter
setPvpKills(getPvpKills() + 1);
-
// Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
sendPacket(new UserInfo(this));
sendPacket(new ExBrExtraUserInfo(this));
Index: java/com/l2jserver/gameserver/model/entity/OneInTheChamber.java
===================================================================
--- java/com/l2jserver/gameserver/model/entity/OneInTheChamber.java (revision 0)
+++ java/com/l2jserver/gameserver/model/entity/OneInTheChamber.java (revision 0)
@@ -0,0 +1,215 @@
+/*
+ * Copyright (C) 2004-2013 L2J Server
+ *
+ * This file is part of L2J Server.
+ *
+ * L2J Server 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * L2J Server 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, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.entity;
+
+import javolution.util.FastList;
+
+import com.l2jserver.gameserver.Announcements;
+import com.l2jserver.gameserver.ThreadPoolManager;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
+import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
+
+/**
+ * @author Marwan
+ */
+public class OneInTheChamber
+{
+ int regTime = 1;
+ int eventTime = 10;
+ int LocationX = 1;
+ int LocationY = 1;
+ int LocationZ = 1;
+ int itemId = 57;
+ int itemCount = 100;
+ FastList<L2PcInstance> players = new FastList<L2PcInstance>();
+ L2PcInstance pls = null;
+
+ public OneInTheChamber()
+ {
+ ThreadPoolManager.getInstance().scheduleAiAtFixedRate(new Run(), 600000, 600000);
+
+ }
+
+ public class Run implements Runnable
+ {
+
+ @Override
+ public void run()
+ {
+ start();
+ }
+ }
+
+ public void start()
+ {
+ announce("One in The Chamber event will start in " + regTime, true);
+ sleep(regTime);
+ if (players.size() >= 2)
+ {
+ announce("One in The Chamber event has started", true);
+ telePlayers(LocationX, LocationY, LocationZ);
+ giveBow();
+ announce("You have been teleported to event area", false);
+ sleep(eventTime);
+ reward();
+ clean();
+ }
+ else
+ {
+ announce("One in The Chamber event has ended due to lack of participants", true);
+
+ }
+ }
+
+ public void register(L2PcInstance i)
+ {
+ players.add(i);
+ i.inChamber = true;
+ }
+
+ public void unregister(L2PcInstance i)
+ {
+ players.remove(i);
+ i.inChamber = false;
+ }
+
+ public void telePlayers(int x, int y, int z)
+ {
+ for (L2PcInstance pls : players)
+ {
+ pls.teleToLocation(x, y, z);
+ }
+ }
+
+ public void announce(String message, boolean all)
+ {
+ if (all)
+ {
+ Announcements.getInstance().announceToAll(message);
+ }
+ else
+ {
+ for (L2PcInstance pls : players)
+ {
+ CreatureSay cs = new CreatureSay(1, 2, "OneInTheChamber", message);
+ pls.sendPacket(cs);
+
+ }
+ }
+ }
+
+ public void sleep(int mints)
+ {
+ try
+ {
+ Thread.sleep(mints * 1000);
+ }
+ catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public int getX()
+ {
+ return LocationX;
+ }
+
+ public int getY()
+ {
+ return LocationY;
+ }
+
+ public int getZ()
+ {
+ return LocationZ;
+ }
+
+ public void giveBow()
+ {
+ for (L2PcInstance pls : players)
+ {
+
+ pls.getInventory().addItem("bow", 14, 1, pls, this);
+ announce("You have recieved a bow and one arrow", false);
+ }
+ }
+
+ public void removeArrows()
+ {
+ for (L2PcInstance pls : players)
+ {
+ L2ItemInstance item;
+ item = pls.getInventory().getItemByItemId(17);
+ if (item != null)
+ {
+ pls.getInventory().destroyItemByItemId("arrow", item.getId(), item.getCount(), pls, item);
+ }
+ pls.arrowCount = (int) item.getCount();
+ }
+ }
+
+ public void addArrowsBack()
+ {
+ for (L2PcInstance pls : players)
+ {
+
+ pls.getInventory().addItem("arrow", 17, pls.arrowCount, pls, this);
+ }
+ }
+
+ public static void addArrow(L2PcInstance player)
+ {
+ player.getInventory().addItem("arrow", 17, 1, player, null);
+ }
+
+ public void reward()
+ {
+ int topkills = 0;
+ for (L2PcInstance playas : players)
+ {
+ if (topkills < playas.chamberKills)
+ {
+ topkills = playas.chamberKills;
+ pls = playas;
+ }
+ }
+ pls.addItem("chamber", itemId, itemCount, pls, false);
+ announce(pls.getName() + " has won OneInTheChamber event", true);
+
+ }
+
+ public void clean()
+ {
+ players.removeAll(players);
+ addArrowsBack();
+ }
+
+ public static OneInTheChamber getInstance()
+ {
+ return SingletonHolder._instance;
+ }
+
+ private static class SingletonHolder
+ {
+ @SuppressWarnings("synthetic-access")
+ protected static final OneInTheChamber _instance = new OneInTheChamber();
+ }
+}
### Eclipse Workspace Patch 1.0
#P L2J_Server
Index: dist/game/config/SlotMachine.properties
===================================================================
--- dist/game/config/SlotMachine.properties (revision 0)
+++ dist/game/config/SlotMachine.properties (revision 0)
@@ -0,0 +1,20 @@
+# -----------------------------------------------------------------------------------------------------------
+# L2jHidden - SlotMachine
+# Developed by Wyatt
+# -----------------------------------------------------------------------------------------------------------
+# Configs
+# -----------------------------------------------------------------------------------------------------------
+# Here you must especify your Server Name that will be specified in the NPC html
+ServerName = L2jHidden
+
+# Here you must especify the ID of the NPC that you want to use
+NpcId = 100
+
+# Here you must especify the rewards that will be given to the players
+# You can add multiple rewards, Example: 57,10000000;5575,5000000
+Rewards = 57,10000000;5575,5000000
+
+
+# Here you must especify the feed that will be taken for each try
+# You can add multiple feeds, Example: 57,200000;5575,50000
+Feed = 57,200000;5575,50000
Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 5822)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -496,6 +499,9 @@
private boolean _isInSiege;
private boolean _isInHideoutSiege = false;
+ //Wyatt SlotMachine Event
+ public boolean win = false;
+
public enum PunishLevel
{
NONE(0, ""),
### Eclipse Workspace Patch 1.0
#P L2J_DataPack
Index: dist/game/data/scripts/custom/SlotMachine/SlotMachine.java
===================================================================
--- dist/game/data/scripts/custom/SlotMachine/SlotMachine.java (revision 0)
+++ dist/game/data/scripts/custom/SlotMachine/SlotMachine.java (revision 0)
@@ -0,0 +1,751 @@
+package custom.SlotMachine;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Properties;
+import javolution.text.TextBuilder;
+import com.l2jserver.gameserver.datatables.ItemTable;
+import com.l2jserver.gameserver.datatables.SkillTable;
+import com.l2jserver.gameserver.model.actor.L2Npc;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.itemcontainer.PcInventory;
+import com.l2jserver.gameserver.model.quest.Quest;
+import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
+import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
+import com.l2jserver.util.Rnd;
+import com.l2jserver.util.StringUtil;
+
+/**
+ *
+ * @author Wyatt
+ *
+ */
+
+public class SlotMachine extends Quest
+{
+ private static final String qn = "SlotMachine";
+ private static String servername = "";
+ private static List<int[]> rewards;
+ private static List<int[]> feed;
+ private static int npcid = 0;
+
+ public SlotMachine(int questId, String name, String descr)
+ {
+ super(questId, name, descr);
+ loadConfigs();
+ addStartNpc(npcid);
+ addTalkId(npcid);
+ addFirstTalkId(npcid);
+ }
+
+ @Override
+ public final String onAdvEvent(String event, L2Npc npc, L2PcInstance player)
+ {
+ if (npc.getNpcId() == npcid && event.equals("play") && checkstatus(player))
+ {
+ for (int[] i : feed)
+ {
+ if(player.getInventory().getItemByItemId(i[0]) == null || (player.getInventory().getItemByItemId(i[0]) != null && player.getInventory().getItemByItemId(i[0]).getCount() < i[1]))
+ {
+ player.sendMessage("You don't have enough items.");
+ return null;
+ }
+ }
+
+ for (int[] i : feed)
+ {
+ player.destroyItem("SlotMachineConsumition", player.getInventory().getItemByItemId(i[0]).getObjectId(), i[1], null, false);
+ }
+
+ try
+ {
+ for (int[] feeds : feed)
+ {
+ player.sendMessage("Consumed: "+feeds[1]+" of "+ItemTable.getInstance().createDummyItem(feeds[0]).getItemName()+" by SlotMachine.");
+ }
+
+ run(player);
+ }
+ catch (InterruptedException e)
+ {
+ e.printStackTrace();
+ }
+ }
+ return null;
+ }
+
+ void checkresult(L2PcInstance player)
+ {
+ SystemMessage systemMessage = null;
+
+ if(player.win)
+ {
+ for (int[] r : rewards)
+ {
+ PcInventory inv = player.getInventory();
+
+ if (ItemTable.getInstance().createDummyItem(r[0]).isStackable())
+ {
+ inv.addItem("SlotMachine", r[0], r[1], player, player);
+
+ if (r[1] > 1)
+ {
+ systemMessage = SystemMessage.getSystemMessage(SystemMessageId.EARNED_S2_S1_S);
+ systemMessage.addItemName(r[0]);
+ systemMessage.addItemNumber(r[1]);
+ }
+ else
+ {
+ systemMessage = SystemMessage.getSystemMessage(SystemMessageId.EARNED_ITEM_S1);
+ systemMessage.addItemName(r[0]);
+ }
+ player.sendPacket(systemMessage);
+ }
+ else
+ {
+ for (int i = 0; i < r[1]; ++i)
+ {
+ inv.addItem("SlotMachine", r[0], 1, player, player);
+ systemMessage = SystemMessage.getSystemMessage(SystemMessageId.EARNED_ITEM_S1);
+ systemMessage.addItemName(r[0]);
+ player.sendPacket(systemMessage);
+ }
+ }
+ }
+ showresult(player, true);
+ player.useMagic(SkillTable.getInstance().getInfo(5965, 1), true, true);
+ }
+ else
+ {
+ showresult(player, false);
+ }
+ player.setIsImmobilized(false);
+ player.win = false;
+ }
+
+ boolean checkstatus(L2PcInstance player)
+ {
+ if(player == null)
+ {
+ return false;
+ }
+ return true;
+ }
+
+ void run(L2PcInstance player) throws InterruptedException
+ {
+ int a = Rnd.get(10,30);
+ int ar = a % 3;
+ int b = Rnd.get(10,30);
+ int br = b % 3;
+ int c = Rnd.get(10,30);
+ int i = 1;
+ player.setIsImmobilized(true);
+
+ while(i <= a)
+ {
+ if (!checkstatus(player))
+ {
+ return;
+ }
+
+ if(i % 3 == 0)
+ {
+ showpage(player, "a", "b", "c");
+ }
+ else if(i % 3 == 1)
+ {
+ showpage(player, "b", "b", "c");
+ }
+ else if(i % 3 == 2)
+ {
+ showpage(player, "c", "b", "c");
+ }
+ Thread.sleep(150);
+ i++;
+ }
+
+ Thread.sleep(1000);
+ i = 1;
+ while(i <= b)
+ {
+ if (!checkstatus(player))
+ {
+ return;
+ }
+
+ if (ar == 0)
+ {
+ if(i % 3 == 0)
+ {
+ showpage(player, "a", "b", "c");
+ }
+ else if(i % 3 == 1)
+ {
+ showpage(player, "a", "c", "c");
+ }
+ else if(i % 3 == 2)
+ {
+ showpage(player, "a", "a", "c");
+ }
+ }
+
+ else if (ar == 1)
+ {
+ if(i % 3 == 0)
+ {
+ showpage(player, "b", "b", "c");
+ }
+ else if(i % 3 == 1)
+ {
+ showpage(player, "b", "c", "c");
+ }
+ else if(i % 3 == 2)
+ {
+ showpage(player, "b", "a", "c");
+ }
+ }
+
+ else if (ar == 2)
+ {
+ if(i % 3 == 0)
+ {
+ showpage(player, "c", "b", "c");
+ }
+ else if(i % 3 == 1)
+ {
+ showpage(player, "c", "c", "c");
+ player.win = true;
+ }
+ else if(i % 3 == 2)
+ {
+ showpage(player, "c", "a", "c");
+ }
+ }
+ Thread.sleep(150);
+ i++;
+ }
+
+ Thread.sleep(1000);
+ i = 1;
+ while(i <= c)
+ {
+ if (!checkstatus(player))
+ {
+ return;
+ }
+
+ if (br == 0)
+ {
+ if (ar == 0)
+ {
+ if(i % 3 == 0)
+ {
+ showpage(player, "a", "b", "c");
+ }
+ else if(i % 3 == 1)
+ {
+ showpage(player, "a", "b", "a");
+ }
+ else if(i % 3 == 2)
+ {
+ showpage(player, "a", "b", "b");
+ }
+ }
+
+ else if (ar == 1)
+ {
+ if(i % 3 == 0)
+ {
+ showpage(player, "b", "b", "c");
+ }
+ else if(i % 3 == 1)
+ {
+ showpage(player, "b", "b", "a");
+ }
+ else if(i % 3 == 2)
+ {
+ showpage(player, "b", "b", "b");
+ player.win = true;
+ }
+ }
+
+ else if (ar == 2)
+ {
+ if(i % 3 == 0)
+ {
+ showpage(player, "c", "b", "c");
+ }
+ else if(i % 3 == 1)
+ {
+ showpage(player, "c", "b", "a");
+ }
+ else if(i % 3 == 2)
+ {
+ showpage(player, "c", "b", "b");
+ }
+ }
+ }
+
+ else if (br == 1)
+ {
+ if (ar == 0)
+ {
+ if(i % 3 == 0)
+ {
+ showpage(player, "a", "c", "c");
+ }
+ else if(i % 3 == 1)
+ {
+ showpage(player, "a", "c", "a");
+ }
+ else if(i % 3 == 2)
+ {
+ showpage(player, "a", "c", "b");
+ }
+ }
+
+ else if (ar == 1)
+ {
+ if(i % 3 == 0)
+ {
+ showpage(player, "b", "c", "c");
+ }
+ else if(i % 3 == 1)
+ {
+ showpage(player, "b", "c", "a");
+ }
+ else if(i % 3 == 2)
+ {
+ showpage(player, "b", "c", "b");
+ }
+ }
+
+ else if (ar == 2)
+ {
+ if(i % 3 == 0)
+ {
+ showpage(player, "c", "c", "c");
+ player.win = true;
+ }
+ else if(i % 3 == 1)
+ {
+ showpage(player, "c", "c", "a");
+ }
+ else if(i % 3 == 2)
+ {
+ showpage(player, "c", "c", "b");
+ }
+ }
+ }
+
+ else if (br == 2)
+ {
+ if (ar == 0)
+ {
+ if(i % 3 == 0)
+ {
+ showpage(player, "a", "a", "c");
+ }
+ else if(i % 3 == 1)
+ {
+ showpage(player, "a", "a", "a");
+ player.win = true;
+ }
+ else if(i % 3 == 2)
+ {
+ showpage(player, "a", "a", "b");
+ }
+ }
+
+ else if (ar == 1)
+ {
+ if(i % 3 == 0)
+ {
+ showpage(player, "b", "a", "c");
+ }
+ else if(i % 3 == 1)
+ {
+ showpage(player, "b", "a", "a");
+ }
+ else if(i % 3 == 2)
+ {
+ showpage(player, "b", "a", "b");
+ }
+ }
+
+ else if (ar == 2)
+ {
+ if(i % 3 == 0)
+ {
+ showpage(player, "c", "a", "c");
+ }
+ else if(i % 3 == 1)
+ {
+ showpage(player, "c", "a", "a");
+ }
+ else if(i % 3 == 2)
+ {
+ showpage(player, "c", "a", "b");
+ }
+ }
+ }
+ Thread.sleep(150);
+ i++;
+ }
+ Thread.sleep(2000);
+
+ if(checkstatus(player))
+ {
+ checkresult(player);
+ }
+ }
+
+ @Override
+ public String onFirstTalk(L2Npc npc, L2PcInstance player)
+ {
+ showmain(player);
+ return null;
+ }
+
+ void showpage(L2PcInstance activeChar, String a, String b, String c)
+ {
+ NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
+ TextBuilder replyMSG = new TextBuilder("<html><title>"+servername+" Slot Machine</title><body>");
+ replyMSG.append("<center><img src=\"l2ui.squaregray\" width=290 height=1></center>");
+ replyMSG.append("<center>" +
+ "<table width=270 cellpadding=0 cellspacing=0>" +
+ "<tr>" +
+ "<td width=270>" +
+ "<table width=270 height=50 cellspacing=0 cellpadding=0>" +
+ "<tr>");
+ replyMSG.append("<td width=45>" +
+ "<center><img src=br_cashtex.item.br_cash_rune_of_rp_i00 width=32 height=32></center>" +
+ "</td>");
+ replyMSG.append("<td width=170>" +
+ "<center><font color=af9f47>Slot Machine Main Menu</font></center>");
+ replyMSG.append("</td>" +
+ "<td width=32>" +
+ "<img src=br_cashtex.item.br_cash_rune_of_rp_i00 width=32 height=32>" +
+ "</td>" +
+ "</tr>" +
+ "</table>" +
+
+ "<center><img src=\"l2ui.squaregray\" width=290 height=1></center><br>" +
+
+ "<table width=270 height=30 bgcolor=5b574c cellspacing=0 cellpadding=7>" +
+ "<tr>" +
+ "<td valign=top>" +
+ "<table width=270 cellspacing=0 cellpadding=0>" +
+ "<tr>");
+ replyMSG.append("<td><center>Playing with SlotMachine...</center>" +
+ "</td>" +
+ "</tr>" +
+ "</table>" +
+ "</td>" +
+ "</tr>" +
+ "</table>");
+
+ replyMSG.append("<br><center><img src=\"l2ui.squaregray\" width=290 height=1></center><br>" +
+
+ "<table width=270 height=30 cellpadding=0 cellspacing=0 valign=top>" +
+ "<tr>" +
+ "<td>" +
+ "<table width=270 height=40 bgcolor=090908 cellspacing=0 cellpadding=7>" +
+ "<tr>" +
+ "<td valign=top>" +
+ "<table width=270 cellspacing=0 cellpadding=0>" +
+ "<tr>");
+ replyMSG.append("<td height=24 valign=top>" +
+ "<center>" +
+ "<table cellspacing=-1>" +
+ "<tr>" +
+ "<td><img src=\"icon.etc_dice_"+a+"_i00\" " +
+ "width=32 height=32>" +
+ "</td>" +
+ "<td>" +
+ "<img src=\"icon.etc_dice_"+b+"_i00\" width=32 height=32>" +
+ "</td>" +
+ "<td>" +
+ "<img src=\"icon.etc_dice_"+c+"_i00\" width=32 height=32>" +
+ "</td>" +
+ "</tr>" +
+ "</table>" +
+ "</center><br><br>");
+ replyMSG.append("</td><br>" +
+ "<br></tr>" +
+ "</table>" +
+ "</td>" +
+ "</tr>" +
+ "</table>" +
+ "</td>" +
+ "</tr>" +
+ "</table>" +
+
+ "<br><br><center><img src=\"l2ui.squaregray\" width=290 height=1></center><br>");
+
+ replyMSG.append("<center><table width=270>" +
+ "<tr>" +
+ "<td width=270>" +
+ "<center><font color=444444>By Wyatt</color><br>" +
+ "</center>" +
+ "</td>" +
+ "</tr>" +
+ "</table></center>");
+ replyMSG.append("</tr>" +
+ "</td>" +
+ "</table>" +
+ "</center>");
+ replyMSG.append("</body></html>");
+ adminReply.setHtml(replyMSG.toString());
+ activeChar.sendPacket(adminReply);
+ }
+
+ void showmain(L2PcInstance activeChar)
+ {
+ NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
+ TextBuilder replyMSG = new TextBuilder("<html><title>"+servername+" Slot Machine</title><body>");
+ replyMSG.append("<center><img src=\"l2ui.squaregray\" width=290 height=1></center>");
+ replyMSG.append("<center>" +
+ "<table width=270 cellpadding=0 cellspacing=0>" +
+ "<tr>" +
+ "<td width=270>" +
+ "<table width=270 height=50 cellspacing=0 cellpadding=0>" +
+ "<tr>");
+ replyMSG.append("<td width=45>" +
+ "<center><img src=br_cashtex.item.br_cash_rune_of_rp_i00 width=32 height=32></center>" +
+ "</td>");
+ replyMSG.append("<td width=170>" +
+ "<center><font color=af9f47>Slot Machine Main Menu</font></center>");
+ replyMSG.append("</td>" +
+ "<td width=32>" +
+ "<img src=br_cashtex.item.br_cash_rune_of_rp_i00 width=32 height=32>" +
+ "</td>" +
+ "</tr>" +
+ "</table>" +
+
+ "<center><img src=\"l2ui.squaregray\" width=290 height=1></center><br>" +
+
+ "<table width=270 height=30 bgcolor=5b574c cellspacing=0 cellpadding=7>" +
+ "<tr>" +
+ "<td valign=top>" +
+ "<table width=270 cellspacing=0 cellpadding=0>" +
+ "<tr>");
+ replyMSG.append("<td><center>Do you want to play?</center>" +
+ "</td>" +
+ "</tr>" +
+ "</table>" +
+ "</td>" +
+ "</tr>" +
+ "</table>");
+
+ replyMSG.append("<br><center><img src=\"l2ui.squaregray\" width=290 height=1></center><br>" +
+
+ "<table width=270 height=30 cellpadding=0 cellspacing=0 valign=top>" +
+ "<tr>" +
+ "<td>" +
+ "<table width=270 height=40 bgcolor=090908 cellspacing=0 cellpadding=7>" +
+ "<tr>" +
+ "<td valign=top>" +
+ "<table width=270 cellspacing=0 cellpadding=0>" +
+ "<tr>");
+ replyMSG.append("<td height=24 valign=top>Hi <font color=LEVEL>"+activeChar.getName()+"</font>! Here you are inside SlotMachine event." +
+ " Every time that you play here you will waste:<br>");
+ for (int[] feeds : feed)
+ {
+ replyMSG.append("-<font color=LEVEL>"+feeds[1]+"</font> of <font color=LEVEL>"+ItemTable.getInstance().createDummyItem(feeds[0]).getItemName()+"</font><br>");
+ }
+
+ replyMSG.append("<center><button value=\"Lets Play\" action=\"bypass -h Quest SlotMachine play\" width=70 height=30 " +
+ "back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center><br>");
+ replyMSG.append("</td><br></tr>" +
+ "</table>" +
+ "</td>" +
+ "</tr>" +
+ "</table>" +
+ "</td>" +
+ "</tr>" +
+ "</table>" +
+
+ "<br><br><center><img src=\"l2ui.squaregray\" width=290 height=1></center><br>");
+
+ replyMSG.append("<center><table width=270>" +
+ "<tr>" +
+ "<td width=270>" +
+ "<center><font color=444444>By Wyatt</color><br>" +
+ "</center>" +
+ "</td>" +
+ "</tr>" +
+ "</table></center>");
+ replyMSG.append("</tr>" +
+ "</td>" +
+ "</table>" +
+ "</center>");
+ replyMSG.append("</body></html>");
+ adminReply.setHtml(replyMSG.toString());
+ activeChar.sendPacket(adminReply);
+ }
+
+ void showresult(L2PcInstance activeChar, boolean l)
+ {
+ String result ="";
+ if(l)
+ {
+ result = "Congratulations you won!";
+ }
+ else
+ {
+ result = "I'm sorry you lost...";
+ }
+ NpcHtmlMessage adminReply = new NpcHtmlMessage(5);
+ TextBuilder replyMSG = new TextBuilder("<html><title>"+servername+" Slot Machine</title><body>");
+ replyMSG.append("<center><img src=\"l2ui.squaregray\" width=290 height=1></center>");
+ replyMSG.append("<center>" +
+ "<table width=270 cellpadding=0 cellspacing=0>" +
+ "<tr>" +
+ "<td width=270>" +
+ "<table width=270 height=50 cellspacing=0 cellpadding=0>" +
+ "<tr>");
+ replyMSG.append("<td width=45>" +
+ "<center><img src=br_cashtex.item.br_cash_rune_of_rp_i00 width=32 height=32></center>" +
+ "</td>");
+ replyMSG.append("<td width=170>" +
+ "<center><font color=af9f47>Slot Machine Main Menu</font></center>");
+ replyMSG.append("</td>" +
+ "<td width=32>" +
+ "<img src=br_cashtex.item.br_cash_rune_of_rp_i00 width=32 height=32>" +
+ "</td>" +
+ "</tr>" +
+ "</table>" +
+
+ "<center><img src=\"l2ui.squaregray\" width=290 height=1></center><br>" +
+
+ "<table width=270 height=30 bgcolor=5b574c cellspacing=0 cellpadding=7>" +
+ "<tr>" +
+ "<td valign=top>" +
+ "<table width=270 cellspacing=0 cellpadding=0>" +
+ "<tr>");
+
+ replyMSG.append("<td><center>"+result+"</center>" +
+ "</td>" +
+ "</tr>" +
+ "</table>" +
+ "</td>" +
+ "</tr>" +
+ "</table>");
+
+ replyMSG.append("<br><center><img src=\"l2ui.squaregray\" width=290 height=1></center><br>" +
+
+ "<table width=270 height=30 cellpadding=0 cellspacing=0 valign=top>" +
+ "<tr>" +
+ "<td>" +
+ "<table width=270 height=40 bgcolor=090908 cellspacing=0 cellpadding=7>" +
+ "<tr>" +
+ "<td valign=top>" +
+ "<table width=270 cellspacing=0 cellpadding=0>" +
+ "<tr>");
+ replyMSG.append("<td height=24 valign=top>Do you want to play again <font color=LEVEL>"+activeChar.getName()+"</font>?");
+ replyMSG.append("<center><button value=\"Lets Play\" action=\"bypass -h Quest SlotMachine play\" width=70 height=30 " +
+ "back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></center><br>");
+ replyMSG.append("</td><br></tr>" +
+ "</table>" +
+ "</td>" +
+ "</tr>" +
+ "</table>" +
+ "</td>" +
+ "</tr>" +
+ "</table>" +
+
+ "<br><br><center><img src=\"l2ui.squaregray\" width=290 height=1></center><br>");
+
+ replyMSG.append("<center><table width=270>" +
+ "<tr>" +
+ "<td width=270>" +
+ "<center><font color=444444>By Wyatt</color><br>" +
+ "</center>" +
+ "</td>" +
+ "</tr>" +
+ "</table></center>");
+ replyMSG.append("</tr>" +
+ "</td>" +
+ "</table>" +
+ "</center>");
+ replyMSG.append("</body></html>");
+ adminReply.setHtml(replyMSG.toString());
+ activeChar.sendPacket(adminReply);
+ }
+
+ void loadConfigs()
+ {
+ try
+ {
+ Properties prop = new Properties();
+ prop.load(new FileInputStream(new File("./config/SlotMachine.properties")));
+ servername = prop.getProperty("ServerName", "Hidden");
+ npcid = Integer.parseInt(prop.getProperty("NpcId", "100"));
+ rewards = new ArrayList<>();
+ String[] propertySplit = prop.getProperty("Rewards", "57,100").split(";");
+
+ for (String reward : propertySplit)
+ {
+ String[] rewardSplit = reward.split(",");
+
+ if (rewardSplit.length != 2)
+ {
+ _log.warning(StringUtil.concat("SlotMachine invalid config property -> Reward \"", reward, "\""));
+ }
+ else
+ {
+ try
+ {
+ rewards.add(new int[]{Integer.parseInt(rewardSplit[0]), Integer.parseInt(rewardSplit[1])});
+ }
+ catch (NumberFormatException nfe)
+ {
+ if (!reward.isEmpty())
+ {
+ _log.warning(StringUtil.concat("SlotMachine invalid config property -> Reward \"", reward, "\""));
+ }
+ }
+ }
+ }
+ feed = new ArrayList<>();
+ propertySplit = prop.getProperty("Feed", "57,1").split(";");
+
+ for (String feeds : propertySplit)
+ {
+ String[] feedSplit = feeds.split(",");
+ if (feedSplit.length != 2)
+ {
+ _log.warning(StringUtil.concat("SlotMachine invalid config property -> Feed \"", feeds, "\""));
+ }
+ else
+ {
+ try
+ {
+ feed.add(new int[]{Integer.parseInt(feedSplit[0]), Integer.parseInt(feedSplit[1])});
+ }
+ catch (NumberFormatException nfe)
+ {
+ if (!feeds.isEmpty())
+ {
+ _log.warning(StringUtil.concat("SlotMachine invalid config property -> Feed \"", feeds, "\""));
+ }
+ }
+ }
+ }
+ }
+ catch(Exception e)
+ {
+ e.printStackTrace();
+ }
+ }
+
+ public static void main(String args[])
+ {
+ new SlotMachine(-1, qn, "custom");
+ }
+}
\ No newline at end of file
Index: dist/game/data/scripts.cfg
===================================================================
--- dist/game/data/scripts.cfg (revision 9467)
+++ dist/game/data/scripts.cfg (working copy)
@@ -686,6 +686,7 @@
quests/Q10291_FireDragonDestroyer/Q10291_FireDragonDestroyer.java
# Custom
+custom/SlotMachine/SlotMachine.java
custom/FortuneTelling/FortuneTelling.java
custom/Nottingale/Nottingale.java
custom/EchoCrystals/EchoCrystals.java
CitarCORE:
### Eclipse Workspace Patch 1.0
#P L2J_Server
Index: java/com/l2jserver/gameserver/model/entity/PkHunterEvent.java
===================================================================
--- java/com/l2jserver/gameserver/model/entity/PkHunterEvent.java (revision 0)
+++ java/com/l2jserver/gameserver/model/entity/PkHunterEvent.java (revision 0)
@@ -0,0 +1,158 @@
+/*
+ * 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.entity;
+
+import com.l2jserver.gameserver.model.L2World;
+import com.l2jserver.gameserver.model.actor.L2Character;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.util.Util;
+
+/**
+ *
+ * @author Wyatt
+ *
+ */
+
+public class PkHunterEvent
+{
+ private static boolean isActive = false;
+ private static L2PcInstance Pk = null;
+ private static int[] PkLocation = {0,0,0};
+
+ public static boolean isActive()
+ {
+ return isActive;
+ }
+
+ public static L2PcInstance getPk()
+ {
+ return Pk;
+ }
+
+ public static void setPk(L2PcInstance player)
+ {
+ Pk = player;
+ }
+
+ public static void setActive(Boolean active)
+ {
+ isActive = active;
+ }
+
+ public static void setPkLocation(int x, int y, int z)
+ {
+ PkLocation[0] = x;
+ PkLocation[1] = y;
+ PkLocation[2] = z;
+ }
+
+ public static int[] getPkLocation()
+ {
+ return PkLocation;
+ }
+
+ public static boolean isPk(L2Character pk)
+ {
+ if(pk != null && getPk() != null && pk.getName().equals(getPk().getName()))
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public static boolean isPkOnline()
+ {
+ if(getPk() != null && getPk().isOnline())
+ {
+ return true;
+ }
+ return false;
+ }
+
+ public static void sendLocationMessage(L2PcInstance activeChar)
+ {
+ if(isPkOnline())
+ {
+ L2PcInstance target = L2World.getInstance().getPlayer(PkHunterEvent.getPk().getName());
+ double angle = activeChar.getHeading()/182.044444444;
+ double angle2 = Util.calculateAngleFrom(activeChar, target);
+ String location = "";
+ String distance = "";
+ double finalAngle = angle - angle2;
+
+ if(finalAngle < 0)
+ finalAngle +=360;
+
+ double octamore = 22.5;
+
+ if(finalAngle>=octamore*15 && finalAngle <octamore*17)
+ {
+ location = " infront of you";
+ }
+ else if(finalAngle >= octamore*1 && finalAngle < octamore * 3)
+ {
+ location = " infront of you, on your left";
+ }
+ else if(finalAngle >= octamore*3 && finalAngle < octamore * 5)
+ {
+ location = " on your left";
+ }
+ else if(finalAngle >= octamore*5 && finalAngle < octamore * 7)
+ {
+ location = " behind you, on your left";
+ }
+ else if(finalAngle >= octamore*7 && finalAngle < octamore * 9)
+ {
+ location = " behind you";
+ }
+ else if(finalAngle >= octamore*9 && finalAngle < octamore * 11)
+ {
+ location = " behind you, on your right";
+ }
+ else if(finalAngle >= octamore*11 && finalAngle < octamore * 13)
+ {
+ location = " on your right";
+ }
+ else if(finalAngle >= octamore*13 && finalAngle < octamore * 15)
+ {
+ location = " infront of you, on your right";
+ }
+ else
+ {
+ location = " infront of you";
+ }
+
+ double dist = Util.calculateDistance(activeChar, target, false);
+
+ if(dist < 400)
+ distance = ", very close";
+ else if(dist < 1000)
+ distance = ", close";
+ else if(dist < 4000)
+ distance = ", at medium range";
+ else if(dist < 12000)
+ distance = ", quite some distance away";
+ else if(dist < 20000)
+ distance = ", far away";
+ else
+ distance = ", very very far away";
+ activeChar.sendMessage(target.getName()+ " is" + location + " "+ distance+".");
+ }
+ else
+ {
+ activeChar.sendMessage("The PK is Offline now.");
+ }
+ }
+}
Index: java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (revision 5822)
+++ java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java (working copy)
@@ -160,6 +160,8 @@
import com.l2jserver.gameserver.model.entity.Hero;
import com.l2jserver.gameserver.model.entity.Instance;
import com.l2jserver.gameserver.model.entity.L2Event;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
+import com.l2jserver.gameserver.model.entity.PkHunterEventConditions;
import com.l2jserver.gameserver.model.entity.Siege;
import com.l2jserver.gameserver.model.entity.TvTEvent;
import com.l2jserver.gameserver.model.fishing.L2Fish;
@@ -5507,6 +5533,7 @@
L2PcInstance pk = killer.getActingPlayer();
TvTEvent.onKill(killer, this);
+ PkHunterEventConditions.checkDie(killer, this);
if (L2Event.isParticipant(pk) && pk != null)
pk.getEventStatus().kills.add(this);
@@ -5673,6 +5703,11 @@
)
return;
+ if(PkHunterEvent.isPk(killer) && !Config.DROP_PKHUNTEREVENT)
+ {
+ return;
+ }
+
if ((!isInsideZone(ZONE_PVP) || pk == null) && (!isGM() || Config.KARMA_DROP_GM))
{
boolean isKarmaDrop = false;
@@ -5914,6 +6003,7 @@
&& AntiFeedManager.getInstance().check(this, target))
setPkKills(getPkKills() + 1);
+ PkHunterEventConditions.checkPk(this, target);
// Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter
sendPacket(new UserInfo(this));
sendPacket(new ExBrExtraUserInfo(this));
Index: java/com/l2jserver/gameserver/network/clientpackets/Logout.java
===================================================================
--- java/com/l2jserver/gameserver/network/clientpackets/Logout.java (revision 5822)
+++ java/com/l2jserver/gameserver/network/clientpackets/Logout.java (working copy)
@@ -23,6 +23,7 @@
import com.l2jserver.gameserver.model.L2Party;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.L2Event;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
@@ -59,6 +60,13 @@
return;
}
+ if (PkHunterEvent.isPk(player))
+ {
+ player.sendPacket(ActionFailed.STATIC_PACKET);
+ player.sendMessage("You can't logout while in event.");
+ return;
+ }
+
if (player.isLocked())
{
_log.warning("Player " + player.getName() + " tried to logout during class change.");
Index: java/com/l2jserver/gameserver/model/olympiad/OlympiadManager.java
===================================================================
--- java/com/l2jserver/gameserver/model/olympiad/OlympiadManager.java (revision 5822)
+++ java/com/l2jserver/gameserver/model/olympiad/OlympiadManager.java (working copy)
@@ -28,6 +28,7 @@
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
import com.l2jserver.gameserver.model.entity.TvTEvent;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
@@ -456,6 +457,12 @@
return false;
}
+ if (PkHunterEvent.isPk(player))
+ {
+ player.sendMessage("You can't participate in Olympiads while in event.");
+ return false;
+ }
+
final int charId = noble.getObjectId();
if (TvTEvent.isPlayerParticipant(charId))
{
Index: java/com/l2jserver/gameserver/model/skills/l2skills/L2SkillTeleport.java
===================================================================
--- java/com/l2jserver/gameserver/model/skills/l2skills/L2SkillTeleport.java (revision 5822)
+++ java/com/l2jserver/gameserver/model/skills/l2skills/L2SkillTeleport.java (working copy)
@@ -23,6 +23,7 @@
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
import com.l2jserver.gameserver.model.entity.TvTEvent;
import com.l2jserver.gameserver.model.skills.L2Skill;
import com.l2jserver.gameserver.model.skills.L2SkillType;
@@ -63,6 +64,12 @@
return;
}
+ if (PkHunterEvent.isPk(activeChar))
+ {
+ activeChar.sendMessage("You can't use escape skills while in event.");
+ return;
+ }
+
if (activeChar.isAfraid())
{
activeChar.sendPacket(ActionFailed.STATIC_PACKET);
Index: java/com/l2jserver/Config.java
===================================================================
--- java/com/l2jserver/Config.java (revision 5822)
+++ java/com/l2jserver/Config.java (working copy)
@@ -765,7 +765,14 @@
public static int L2JMOD_DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP;
public static TIntIntHashMap L2JMOD_DUALBOX_CHECK_WHITELIST;
public static boolean L2JMOD_ALLOW_CHANGE_PASSWORD;
+ public static boolean ENABLE_PKHUNTEREVENT;
+ public static boolean DROP_PKHUNTEREVENT;
+ public static int PKHUNTEREVENT_CHANCE;
+ public static int TIME_PKHUNTEREVENT;
+ public static List<int[]> PKHUNTEREVENT_REWARD;
+ public static List<int[]> PKHUNTEREVENT_PK_REWARD;
+
// --------------------------------------------------
// NPC Settings
// --------------------------------------------------
@@ -2728,6 +2735,57 @@
}
}
L2JMOD_ALLOW_CHANGE_PASSWORD = Boolean.parseBoolean(L2JModSettings.getProperty("AllowChangePassword", "False"));
+ ENABLE_PKHUNTEREVENT = Boolean.parseBoolean(L2JModSettings.getProperty("EnablePKHunterEvent", "True"));
+ DROP_PKHUNTEREVENT = Boolean.parseBoolean(L2JModSettings.getProperty("PKHunterEventDrop", "False"));
+ PKHUNTEREVENT_CHANCE = Integer.parseInt(L2JModSettings.getProperty("PKHunterEventChance", "20"));
+ TIME_PKHUNTEREVENT = Integer.parseInt(L2JModSettings.getProperty("PKHunterEventTime", "5"));
+
+ if(PKHUNTEREVENT_CHANCE < 1)
+ {
+ PKHUNTEREVENT_CHANCE = 1;
+ }
+ PKHUNTEREVENT_REWARD = new ArrayList<>();
+ propertySplit = L2JModSettings.getProperty("PKHunterEventRewards", "14720,5;14721,2").split(";");
+
+ for (String reward : propertySplit)
+ {
+ String[] rewardSplit = reward.split(",");
+ if (rewardSplit.length != 2)
+ _log.warning(StringUtil.concat("PkHunterEvent: invalid config property ->PkHunterEventRewards \"", reward, "\""));
+ else
+ {
+ try
+ {
+ PKHUNTEREVENT_REWARD.add(new int[]{Integer.parseInt(rewardSplit[0]), Integer.parseInt(rewardSplit[1])});
+ }
+ catch (NumberFormatException nfe)
+ {
+ if (!reward.isEmpty())
+ _log.warning(StringUtil.concat("PkHunterEvent: invalid config property -> PkHunterEventRewards \"", reward, "\""));
+ }
+ }
+ }
+ PKHUNTEREVENT_PK_REWARD = new ArrayList<>();
+ propertySplit = L2JModSettings.getProperty("PKHunterEventPkRewards", "14720,5;14721,2").split(";");
+
+ for (String reward : propertySplit)
+ {
+ String[] rewardSplit = reward.split(",");
+ if (rewardSplit.length != 2)
+ _log.warning(StringUtil.concat("PkHunterEvent: invalid config property ->PkHunterEventPkRewards \"", reward, "\""));
+ else
+ {
+ try
+ {
+ PKHUNTEREVENT_PK_REWARD.add(new int[]{Integer.parseInt(rewardSplit[0]), Integer.parseInt(rewardSplit[1])});
+ }
+ catch (NumberFormatException nfe)
+ {
+ if (!reward.isEmpty())
+ _log.warning(StringUtil.concat("PkHunterEvent: invalid config property -> PkHunterEventPkRewards \"", reward, "\""));
+ }
+ }
+ }
}
catch (Exception e)
{
Index: java/com/l2jserver/gameserver/network/clientpackets/RequestRestart.java
===================================================================
--- java/com/l2jserver/gameserver/network/clientpackets/RequestRestart.java (revision 5822)
+++ java/com/l2jserver/gameserver/network/clientpackets/RequestRestart.java (working copy)
@@ -26,9 +26,11 @@
import com.l2jserver.gameserver.instancemanager.AntiFeedManager;
import com.l2jserver.gameserver.model.L2Party;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
import com.l2jserver.gameserver.network.L2GameClient;
import com.l2jserver.gameserver.network.L2GameClient.GameClientState;
import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
import com.l2jserver.gameserver.network.serverpackets.CharSelectionInfo;
import com.l2jserver.gameserver.network.serverpackets.RestartResponse;
import com.l2jserver.gameserver.scripting.scriptengine.listeners.player.PlayerDespawnListener;
@@ -65,6 +67,13 @@
return;
}
+ if (PkHunterEvent.isPk(player))
+ {
+ player.sendPacket(ActionFailed.STATIC_PACKET);
+ sendPacket(RestartResponse.valueOf(false));
+ return;
+ }
+
if (player.isLocked())
{
_log.warning("Player " + player.getName() + " tried to restart during class change.");
Index: java/com/l2jserver/gameserver/model/entity/PkHunterEventConditions.java
===================================================================
--- java/com/l2jserver/gameserver/model/entity/PkHunterEventConditions.java (revision 0)
+++ java/com/l2jserver/gameserver/model/entity/PkHunterEventConditions.java (revision 0)
@@ -0,0 +1,199 @@
+/*
+ * 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.entity;
+
+import java.util.concurrent.ScheduledFuture;
+
+import com.l2jserver.Config;
+import com.l2jserver.gameserver.Announcements;
+import com.l2jserver.gameserver.ThreadPoolManager;
+import com.l2jserver.gameserver.datatables.ItemTable;
+import com.l2jserver.gameserver.model.L2Object;
+import com.l2jserver.gameserver.model.actor.L2Character;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.itemcontainer.PcInventory;
+import com.l2jserver.gameserver.network.SystemMessageId;
+import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
+import com.l2jserver.util.Rnd;
+
+/**
+ *
+ * @author Wyatt
+ *
+ */
+
+public class PkHunterEventConditions
+{
+ private static ScheduledFuture<?> _timerTask;
+
+ public static void checkFinishByMobs(L2PcInstance killer)
+ {
+ if (PkHunterEvent.isPk(killer) && Config.ENABLE_PKHUNTEREVENT)
+ {
+ if(killer.getKarma() == 0)
+ {
+ Announcements.getInstance().announceToAll("PkHunter Event ended. "+killer.getName()+" has survived.", true);
+ PkHunterEvent.setPk(killer);
+ PkHunterEvent.setActive(false);
+ killer.setTeam(0);
+ endTask();
+ rewardPk(killer);
+ }
+ }
+ }
+
+ public static void checkDie(L2Object killer, final L2PcInstance killed)
+ {
+ if(PkHunterEvent.isPk(killed) && Config.ENABLE_PKHUNTEREVENT)
+ {
+ if(killer instanceof L2PcInstance)
+ {
+ L2PcInstance kr = ((L2PcInstance)killer);
+ SystemMessage systemMessage = null;
+
+ for (int[] reward : Config.PKHUNTEREVENT_REWARD)
+ {
+ PcInventory inv = kr.getInventory();
+
+ if (ItemTable.getInstance().createDummyItem(reward[0]).isStackable())
+ {
+ inv.addItem("PKHunter Event", reward[0], reward[1], kr, kr);
+
+ if (reward[1] > 1)
+ {
+ systemMessage = SystemMessage.getSystemMessage(SystemMessageId.EARNED_S2_S1_S);
+ systemMessage.addItemName(reward[0]);
+ systemMessage.addItemNumber(reward[1]);
+ }
+ else
+ {
+ systemMessage = SystemMessage.getSystemMessage(SystemMessageId.EARNED_ITEM_S1);
+ systemMessage.addItemName(reward[0]);
+ }
+ kr.sendPacket(systemMessage);
+ }
+ else
+ {
+ for (int i = 0; i < reward[1]; ++i)
+ {
+ inv.addItem("PkHunter Event", reward[0], 1, kr, kr);
+ systemMessage = SystemMessage.getSystemMessage(SystemMessageId.EARNED_ITEM_S1);
+ systemMessage.addItemName(reward[0]);
+ kr.sendPacket(systemMessage);
+ }
+ }
+ }
+ }
+ Announcements.getInstance().announceToAll("Pk Hunting Event: Event ended. "+killer.getName()+" killed the Pk.", true);
+ killed.setTeam(0);
+ PkHunterEvent.setActive(false);
+ PkHunterEvent.setPk(null);
+ endTask();
+
+ ThreadPoolManager.getInstance().scheduleGeneral(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ killed.setKarma(0);
+ }
+ },100);
+ }
+ }
+
+ public static void checkPk(L2PcInstance killer, L2Character target)
+ {
+ if (Config.ENABLE_PKHUNTEREVENT && !PkHunterEvent.isActive())
+ {
+ switch(Rnd.get(1, Config.PKHUNTEREVENT_CHANCE))
+ {
+ case 1:
+ killer.setKarma(900000);
+ killer.setTeam(2);
+ PkHunterEvent.setActive(true);
+ PkHunterEvent.setPk(killer);
+ PkHunterEvent.setPkLocation(killer.getX(), killer.getY(), killer.getZ());
+ startEvent();
+ break;
+ }
+ }
+ }
+
+ public static void endCoward(L2PcInstance activeChar)
+ {
+ if(PkHunterEvent.isActive())
+ {
+ PkHunterEvent.setActive(false);
+ PkHunterEvent.setPk(null);
+ Announcements.getInstance().announceToAll("PkHunter Event ended.", true);
+ endTask();
+ }
+ activeChar.setKarma(10000);
+ activeChar.sendMessage("You karma updated to 10.000 due to be a coward, PkHunter Event ended.");
+ }
+
+ public static void startEvent()
+ {
+ Announcements.getInstance().announceToAll("PkHunter Event started: "+PkHunterEvent.getPk().getName()+" is the PK, write .gopk to teleport where the pk was done. Write .pkinfo to know if you are far or near to him.", true);
+ _timerTask = ThreadPoolManager.getInstance().scheduleGeneral(new PkHunterEventTask(), Config.TIME_PKHUNTEREVENT * 60000);
+ }
+
+ static void endTask()
+ {
+ if(_timerTask != null)
+ {
+ _timerTask.cancel(false);
+ }
+ _timerTask = null;
+ }
+
+ public static void rewardPk(L2PcInstance kr)
+ {
+ SystemMessage systemMessage = null;
+
+ for (int[] reward : Config.PKHUNTEREVENT_PK_REWARD)
+ {
+ PcInventory inv = kr.getInventory();
+
+ if (ItemTable.getInstance().createDummyItem(reward[0]).isStackable())
+ {
+ inv.addItem("PKHunter Event", reward[0], reward[1], kr, kr);
+
+ if (reward[1] > 1)
+ {
+ systemMessage = SystemMessage.getSystemMessage(SystemMessageId.EARNED_S2_S1_S);
+ systemMessage.addItemName(reward[0]);
+ systemMessage.addItemNumber(reward[1]);
+ }
+ else
+ {
+ systemMessage = SystemMessage.getSystemMessage(SystemMessageId.EARNED_ITEM_S1);
+ systemMessage.addItemName(reward[0]);
+ }
+ kr.sendPacket(systemMessage);
+ }
+ else
+ {
+ for (int i = 0; i < reward[1]; ++i)
+ {
+ inv.addItem("PkHunter Event", reward[0], 1, kr, kr);
+ systemMessage = SystemMessage.getSystemMessage(SystemMessageId.EARNED_ITEM_S1);
+ systemMessage.addItemName(reward[0]);
+ kr.sendPacket(systemMessage);
+ }
+ }
+ }
+ }
+}
Index: java/com/l2jserver/gameserver/model/entity/PkHunterEventTask.java
===================================================================
--- java/com/l2jserver/gameserver/model/entity/PkHunterEventTask.java (revision 0)
+++ java/com/l2jserver/gameserver/model/entity/PkHunterEventTask.java (revision 0)
@@ -0,0 +1,42 @@
+/*
+ * 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
+ */
+package com.l2jserver.gameserver.model.entity;
+
+import com.l2jserver.gameserver.Announcements;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+
+/**
+ *
+ * @author Wyatt
+ *
+ */
+
+public class PkHunterEventTask implements Runnable
+{
+ @Override
+ public void run()
+ {
+ if(PkHunterEvent.isPkOnline())
+ {
+ L2PcInstance kr = PkHunterEvent.getPk();
+ kr.setKarma(0);
+ kr.setTeam(0);
+ PkHunterEventConditions.rewardPk(kr);
+ }
+ Announcements.getInstance().announceToAll("PkHunter Event ended. "+PkHunterEvent.getPk().getName()+" has survived.", true);
+ PkHunterEvent.setActive(false);
+ PkHunterEvent.setPk(null);
+ }
+}
Index: dist/game/config/l2jmods.properties
===================================================================
--- dist/game/config/l2jmods.properties (revision 5822)
+++ dist/game/config/l2jmods.properties (working copy)
@@ -461,4 +461,29 @@
# ---------------------------------------------------------------------------
# Enables .changepassword voiced command which allows the players to change their account's password ingame.
# Default: False
-AllowChangePassword = False
\ No newline at end of file
+AllowChangePassword = False
+
+# ---------------------------------------------------------------------------
+# PkHunter - Event
+# ---------------------------------------------------------------------------
+# Enable/Disable PkHunter Event, Default: True
+EnablePKHunterEvent = True
+
+# Chance to start the event when someone gets PK. The probability will be 1/20 if its default.
+# Default: 20
+PKHunterEventChance = 20
+
+# Reward for the player that kills the PK.
+# Example: PKHunterEventRewards = itemId,amount;itemId,amount;itemId,amount
+PKHunterEventRewards = 14720,5;14721,2
+
+# Reward for the PK if he survives.
+# Example: PKHunterEventRewards = itemId,amount;itemId,amount;itemId,amount
+PKHunterEventPkRewards = 14720,25;14721,10
+
+# Enable/Disable if the PK of the event will have chances to drop or not, Default: False
+PKHunterEventDrop = False
+
+# Time that will take the event to end if noone kills the PK. In minutes.
+# Default: 5
+PKHunterEventTime = 5
\ No newline at end of file
Index: java/com/l2jserver/gameserver/model/skills/l2skills/L2SkillMount.java
===================================================================
--- java/com/l2jserver/gameserver/model/skills/l2skills/L2SkillMount.java (revision 5822)
+++ java/com/l2jserver/gameserver/model/skills/l2skills/L2SkillMount.java (working copy)
@@ -18,6 +18,7 @@
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
import com.l2jserver.gameserver.model.entity.TvTEvent;
import com.l2jserver.gameserver.model.skills.L2Skill;
import com.l2jserver.gameserver.network.SystemMessageId;
@@ -54,6 +55,12 @@
return;
}
+ if (PkHunterEvent.isPk(activePlayer))
+ {
+ activePlayer.sendMessage("You can't mount while in event.");
+ return;
+ }
+
// Dismount Action
if (_npcId == 0)
{
Index: java/com/l2jserver/gameserver/model/actor/L2Attackable.java
===================================================================
--- java/com/l2jserver/gameserver/model/actor/L2Attackable.java (revision 5822)
+++ java/com/l2jserver/gameserver/model/actor/L2Attackable.java (working copy)
@@ -52,6 +52,7 @@
import com.l2jserver.gameserver.model.actor.knownlist.AttackableKnownList;
import com.l2jserver.gameserver.model.actor.status.AttackableStatus;
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
+import com.l2jserver.gameserver.model.entity.PkHunterEventConditions;
import com.l2jserver.gameserver.model.itemcontainer.PcInventory;
import com.l2jserver.gameserver.model.items.L2Item;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
@@ -540,6 +541,8 @@
if (player != null)
{
+ PkHunterEventConditions.checkFinishByMobs(player);
+
if (getTemplate().getEventQuests(Quest.QuestEventType.ON_KILL) != null)
{
for (Quest quest : getTemplate().getEventQuests(Quest.QuestEventType.ON_KILL))
Index: java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java
===================================================================
--- java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (revision 5822)
+++ java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java (working copy)
@@ -53,6 +53,7 @@
import com.l2jserver.gameserver.model.entity.Fort;
import com.l2jserver.gameserver.model.entity.FortSiege;
import com.l2jserver.gameserver.model.entity.L2Event;
+import com.l2jserver.gameserver.model.entity.PkHunterEventConditions;
import com.l2jserver.gameserver.model.entity.Siege;
import com.l2jserver.gameserver.model.entity.TvTEvent;
import com.l2jserver.gameserver.model.entity.clanhall.AuctionableHall;
@@ -218,6 +219,13 @@
SkillTreesData.getInstance().addSkills(activeChar, true);
}
}
+ else
+ {
+ if (activeChar.getKarma() >= 500000 && !activeChar.isCursedWeaponEquipped() && Config.ENABLE_PKHUNTEREVENT)
+ {
+ PkHunterEventConditions.endCoward(activeChar);
+ }
+ }
// Set dead status if applies
if (activeChar.getCurrentHp() < 0.5)
CitarDATA:
### Eclipse Workspace Patch 1.0
#P L2J_DataPack
Index: dist/game/data/scripts/handlers/MasterHandler.java
===================================================================
--- dist/game/data/scripts/handlers/MasterHandler.java (revision 9467)
+++ dist/game/data/scripts/handlers/MasterHandler.java (working copy);
@@ -290,6 +291,7 @@
import handlers.voicedcommandhandlers.Debug;
import handlers.voicedcommandhandlers.Hellbound;
import handlers.voicedcommandhandlers.Lang;
+import handlers.voicedcommandhandlers.PkHunterVoiced;
import handlers.voicedcommandhandlers.StatsVCmd;
import handlers.voicedcommandhandlers.TvTVoicedInfo;
import handlers.voicedcommandhandlers.Wedding;
@@ -603,6 +606,7 @@
(Config.L2JMOD_DEBUG_VOICE_COMMAND ? Debug.class : null),
(Config.L2JMOD_ALLOW_CHANGE_PASSWORD ? ChangePassword.class : null),
(Config.L2JMOD_HELLBOUND_STATUS ? Hellbound.class : null),
+ (Config.ENABLE_PKHUNTEREVENT ? PkHunterVoiced.class : null),
},
{
// Target Handlers
Index: dist/game/data/scripts/handlers/itemhandlers/ItemSkills.java
===================================================================
--- dist/game/data/scripts/handlers/itemhandlers/ItemSkills.java (revision 9467)
+++ dist/game/data/scripts/handlers/itemhandlers/ItemSkills.java (working copy)
@@ -14,8 +14,10 @@
*/
package handlers.itemhandlers;
+import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Playable;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
@@ -33,6 +35,16 @@
activeChar.sendPacket(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT);
return false;
}
+ else if((activeChar != null) && PkHunterEvent.isPk(activeChar))
+ {
+ activeChar.sendMessage("You cannot use this item while in this zone.");
+ return false;
+ }
+ else if(activeChar != null && activeChar.isInsideZone(L2Character.MASS_ZONE) && item.getItemId() != 728 && item.getItemId() != 5592 && item.getItemId() != 20353)
+ {
+ activeChar.sendMessage("You cannot use this item while in this zone.");
+ return false;
+ }
return super.useItem(playable, item, forceUse);
}
}
Index: dist/game/data/scripts/handlers/skillhandlers/SummonFriend.java
===================================================================
--- dist/game/data/scripts/handlers/skillhandlers/SummonFriend.java (revision 9467)
+++ dist/game/data/scripts/handlers/skillhandlers/SummonFriend.java (working copy)
@@ -21,6 +21,7 @@
import com.l2jserver.gameserver.model.L2Party;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
import com.l2jserver.gameserver.model.skills.L2Skill;
import com.l2jserver.gameserver.model.skills.L2SkillType;
import com.l2jserver.gameserver.network.SystemMessageId;
@@ -98,6 +99,11 @@
if (skill.getId() == 1403) //Summon Friend
{
+ if (PkHunterEvent.isPk(activePlayer) || PkHunterEvent.isPk(targetPlayer))
+ {
+ activeChar.sendMessage("Players can't be summoned while in event.");
+ return;
+ }
// Send message
final ConfirmDlg confirm = new ConfirmDlg(SystemMessageId.C1_WISHES_TO_SUMMON_YOU_FROM_S2_DO_YOU_ACCEPT.getId());
confirm.addCharName(activeChar);
Index: dist/game/data/scripts/handlers/usercommandhandlers/Escape.java
===================================================================
--- dist/game/data/scripts/handlers/usercommandhandlers/Escape.java (revision 9467)
+++ dist/game/data/scripts/handlers/usercommandhandlers/Escape.java (working copy)
@@ -25,6 +25,7 @@
import com.l2jserver.gameserver.instancemanager.GrandBossManager;
import com.l2jserver.gameserver.instancemanager.MapRegionManager;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
import com.l2jserver.gameserver.model.entity.TvTEvent;
import com.l2jserver.gameserver.model.skills.L2Skill;
import com.l2jserver.gameserver.network.serverpackets.ActionFailed;
@@ -75,6 +76,12 @@
return false;
}
+ if (PkHunterEvent.isPk(activeChar))
+ {
+ activeChar.sendMessage("You can't escape while in event.");
+ return false;
+ }
+
if (activeChar.isCastingNow() || activeChar.isMovementDisabled() || activeChar.isMuted()
|| activeChar.isAlikeDead() || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || activeChar.isCombatFlagEquipped())
return false;
Index: dist/game/data/scripts/handlers/itemhandlers/SummonItems.java
===================================================================
--- dist/game/data/scripts/handlers/itemhandlers/SummonItems.java (revision 9467)
+++ dist/game/data/scripts/handlers/itemhandlers/SummonItems.java (working copy)
@@ -37,6 +37,7 @@
import com.l2jserver.gameserver.model.actor.instance.L2PetInstance;
import com.l2jserver.gameserver.model.actor.instance.L2XmassTreeInstance;
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
import com.l2jserver.gameserver.model.entity.TvTEvent;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
@@ -85,6 +86,11 @@
activeChar.sendPacket(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT);
return false;
}
+ if (PkHunterEvent.isPk(activeChar))
+ {
+ activeChar.sendMessage("You can't use this item while in event.");
+ return false;
+ }
if (activeChar.isAllSkillsDisabled() || activeChar.isCastingNow())
return false;
Index: dist/game/data/scripts/handlers/voicedcommandhandlers/PkHunterVoiced.java
===================================================================
--- dist/game/data/scripts/handlers/voicedcommandhandlers/PkHunterVoiced.java (revision 0)
+++ dist/game/data/scripts/handlers/voicedcommandhandlers/PkHunterVoiced.java (revision 0)
@@ -0,0 +1,80 @@
+/*
+ * 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 3 of the License, 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, see <http://www.gnu.org/licenses/>.
+ */
+package handlers.voicedcommandhandlers;
+
+
+import com.l2jserver.gameserver.handler.IVoicedCommandHandler;
+import com.l2jserver.gameserver.model.StatsSet;
+import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
+import com.l2jserver.gameserver.model.skills.l2skills.L2SkillTeleport;
+
+/**
+ *
+ * @author Wyatt
+ */
+
+public class PkHunterVoiced implements IVoicedCommandHandler
+{
+ private static final String[] VOICED_COMMANDS = { "gopk", "pkinfo"};
+
+ @Override
+ public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target)
+ {
+ if (command.toLowerCase().equals("gopk"))
+ {
+ if (activeChar.isFestivalParticipant() || activeChar.isInJail() || activeChar.isInDuel()
+ || activeChar.isInOlympiadMode() || activeChar.inObserverMode() || PkHunterEvent.isPk(activeChar)
+ )
+ {
+ activeChar.sendMessage("You can't use this command while participating in the Festival!");
+ return false;
+ }
+
+ if (PkHunterEvent.isActive())
+ {
+ StatsSet set = new StatsSet();
+ set.set("skill_id", "2525");
+ set.set("level", "1");
+ set.set("target", "TARGET_SELF");
+ set.set("name", "Scroll to move to PkHunter Event area");
+ set.set("isMagic", "2");
+ set.set("itemConsumeCount", "0");
+ set.set("hitTime", "10000");
+ set.set("operateType", "A1");
+ set.set("skillType", "TELEPORT");
+ set.set("teleCoords", PkHunterEvent.getPkLocation()[0]+","+PkHunterEvent.getPkLocation()[1]+","+PkHunterEvent.getPkLocation()[2]);
+ activeChar.useMagic(new L2SkillTeleport(set), false, true);
+ activeChar.sendMessage("Moving to PkHunter Event area...");
+ }
+ else
+ {
+ activeChar.sendMessage("PkHunter Event is not currently active.");
+ return false;
+ }
+ }
+ else if (command.toLowerCase().equals("pkinfo"))
+ {
+ PkHunterEvent.sendLocationMessage(activeChar);
+ }
+ return true;
+ }
+
+ @Override
+ public String[] getVoicedCommandList()
+ {
+ return VOICED_COMMANDS;
+ }
+}
\ No newline at end of file
Index: dist/game/data/scripts/handlers/itemhandlers/ItemSkills.java
===================================================================
--- dist/game/data/scripts/handlers/itemhandlers/ItemSkills.java (revision 9467)
+++ dist/game/data/scripts/handlers/itemhandlers/ItemSkills.java (working copy)
@@ -14,6 +14,7 @@
*/
package handlers.itemhandlers;
+import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.L2Playable;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
@@ -33,6 +34,11 @@
activeChar.sendPacket(SystemMessageId.THIS_ITEM_IS_NOT_AVAILABLE_FOR_THE_OLYMPIAD_EVENT);
return false;
}
+ else if(activeChar != null && activeChar.isInsideZone(L2Character.MASS_ZONE) && item.getItemId() != 728 && item.getItemId() != 5592 && item.getItemId() != 20353)
+ {
+ activeChar.sendMessage("You cannot use this item while in this zone.");
+ return false;
+ }
return super.useItem(playable, item, forceUse);
}
}
Index: dist/game/data/scripts/handlers/bypasshandlers/OlympiadObservation.java
===================================================================
--- dist/game/data/scripts/handlers/bypasshandlers/OlympiadObservation.java (revision 9467)
+++ dist/game/data/scripts/handlers/bypasshandlers/OlympiadObservation.java (working copy)
@@ -20,6 +20,7 @@
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.gameserver.model.actor.instance.L2OlympiadManagerInstance;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
+import com.l2jserver.gameserver.model.entity.PkHunterEvent;
import com.l2jserver.gameserver.model.entity.TvTEvent;
import com.l2jserver.gameserver.model.olympiad.Olympiad;
import com.l2jserver.gameserver.model.olympiad.OlympiadGameManager;
@@ -216,6 +217,11 @@
activeChar.sendMessage("You can not observe games while registered for TvT");
return false;
}
+ if (PkHunterEvent.isPk(activeChar))
+ {
+ activeChar.sendMessage("You can't observe games while in event.");
+ return false;
+ }
}
final int arenaId = Integer.parseInt(command.substring(12).trim());