From 3ae2479692047de13a08bbc8f03761b46cb1e0bb Mon Sep 17 00:00:00 2001 From: mobius <8391001+MobiusDevelopment@users.noreply.github.com> Date: Thu, 15 Jan 2015 13:21:00 +0000 Subject: [PATCH] Battalion zone - incomplete. Contributed by Ionut. --- trunk/dist/game/config/Custom.properties | 121 ++++++++ trunk/dist/game/data/xsd/zones.xsd | 1 + trunk/dist/game/data/zones/battalion.xml | 9 + trunk/java/com/l2jserver/Config.java | 132 +++++++++ .../model/actor/instance/L2PcInstance.java | 3 + .../gameserver/model/zone/ZoneId.java | 3 +- .../model/zone/type/L2BattalionZone.java | 268 ++++++++++++++++++ .../network/clientpackets/Logout.java | 8 + .../network/clientpackets/RequestRestart.java | 8 + .../network/clientpackets/UseItem.java | 8 + .../gameserver/network/serverpackets/Die.java | 12 + .../serverpackets/ExShowScreenMessage.java | 24 ++ 12 files changed, 596 insertions(+), 1 deletion(-) create mode 100644 trunk/dist/game/data/zones/battalion.xml create mode 100644 trunk/java/com/l2jserver/gameserver/model/zone/type/L2BattalionZone.java diff --git a/trunk/dist/game/config/Custom.properties b/trunk/dist/game/config/Custom.properties index 4dcd723ab2..64a41efa11 100644 --- a/trunk/dist/game/config/Custom.properties +++ b/trunk/dist/game/config/Custom.properties @@ -717,3 +717,124 @@ PremiumRateSpoilAmount = 2 # Usage: itemId1,multiplier1;itemId2,multiplier2;... PremiumRateDropChanceByItemId = 57,2 PremiumRateDropAmountByItemId = 57,2 + + +# --------------------------------------------------------------------------- +# Battalion zone - a custom feature for your server (Mass or Solo Battalion) +# --------------------------------------------------------------------------- + +# This option will turn on PvP flag to all people when entering to the zone. +BTZEnablePvP = True + +# If set to false, zone will be no-restart zone. +BTZRestartZone = False + +# If set to false, zone will be no-logout zone. +BTZLogoutZone = False + +# If set to false, zone will be no-store zone. +BTZStoreZone = False + +# Give noblesse after revive? +BTZReviveNoblesse = False + +# Heal after revive? +BTZReviveHeal = False + +# If set to true, players will take noblesse blessing when entering. +BTZGiveNoblesse = True + +# Remove buffs when entering to the zone. +BTZRemoveBuffs = False + +# Remove pets when entering to the zone. +BTZRemovePets = False + +# Delay, in seconds, to wait before revive. +# 0 to disable +BTZReviveDelay = 10 + +# Delay, in seconds, to wait before revive (for support classes). +# 0 to disable +BTZReviveSupportDelay = 15 + +# Which are the support classes? +# Example: 93,85,12 +BTZSupport = 93 + +# Set the spawn points where players will be teleported on revive, if enabled. +# Example: 150111,144740,-12248;143665,144418,-12022;144443,147685,-12139 +BTZSpawnLoc = 150111,144740,-12248;143665,144418,-12022;144443,147685,-12139 + +# Random respawn radius +BTZRespawnRadius = 500 + +# List of Items(id's) that won't be usable inside this area and also will be unequiped when entering. +# (armor, weapons, scrolls, potions, etc), example: 728,7575, 6383, 1538 +BTZItems = 728,7575,6383,1538 + +# List of Grades that won't be usable inside this area and also will be unequiped when entering. +# Example: D,C,B,A,S,S80,S84,R,R95,R99 +BTZGrades = C,B,A + +# Items with this enchant or more won't be usable inside this area and also will be unequiped when entering. +# 0 to disable +BTZEnchant = 0 + +# Players with one of that classes won't be able to enter to the zone. +# Example: 93,85,12 +BTZClasses = 92 + +# --------------------------------------------------------------------------- +# Options if you set Battalion zone as Solo. +# --------------------------------------------------------------------------- + +# Disable clan crests? +BTZDisableCrests = False + +# Allow mass skills (heal hp, heal mp, heal cp etc.) for clan/allies members? +BTZHealAllies = False + +# Can attack clan/allies members w.o CTRL on? +BTZAttackAllies = False + +# Character custom name inside zone? +BTZAddCustomName = False + +# Character custom name inside zone? +BTZName = Player + +# Character custom title inside zone? +BTZAddCustomTitle = False + +# Character custom title inside zone? +BTZTitle = Kill Me + +# PvP Count restriction while joining the zone? +# 0 to disable +BTZPvpCount = 500 + +# --------------------------------------------------------------------------- +# Rewards for hunting inside Battalion zone +# --------------------------------------------------------------------------- + +# Reward for every kill you make. +# Example: 57,100000;14720,1 +BTZRewards = 57,100000;14720,1 + +# Reward for every kill your party makes. +# Example: 57,100000;14720,1 +BTZSupportRewards = 57,100000;14720,1 + +# Chances to get rewarded when your party killing someone (calculated in %) +# Example: 57,100000;14720,1 +BTZChanceSupportRewards = 50 + +# --------------------------------------------------------------------------- +# Anti feed inside Battalion zone +# --------------------------------------------------------------------------- + +# Delay time when killing the same person multiple times (calculated in seconds). +# Example: 30 +# 0 for no delay (disable) +BTZDelay = 10 diff --git a/trunk/dist/game/data/xsd/zones.xsd b/trunk/dist/game/data/xsd/zones.xsd index 10b9d551c3..83dba8e839 100644 --- a/trunk/dist/game/data/xsd/zones.xsd +++ b/trunk/dist/game/data/xsd/zones.xsd @@ -149,6 +149,7 @@ + diff --git a/trunk/dist/game/data/zones/battalion.xml b/trunk/dist/game/data/zones/battalion.xml new file mode 100644 index 0000000000..ecd4e316e7 --- /dev/null +++ b/trunk/dist/game/data/zones/battalion.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/trunk/java/com/l2jserver/Config.java b/trunk/java/com/l2jserver/Config.java index 35990975a0..e47fccd315 100644 --- a/trunk/java/com/l2jserver/Config.java +++ b/trunk/java/com/l2jserver/Config.java @@ -847,6 +847,24 @@ public final class Config public static float PREMIUM_RATE_SPOIL_AMOUNT; public static Map PREMIUM_RATE_DROP_CHANCE_BY_ID; public static Map PREMIUM_RATE_DROP_AMOUNT_BY_ID; + public static boolean BTZ_PVP_ENABLED; + public static int[][] BTZ_SPAWN_LOCATIONS; + public static int BTZ_REVIVE_DELAY; + public static boolean BTZ_REVIVE; + public static boolean BTZ_GIVE_NOBLES; + public static List BTZ_ITEMS = new ArrayList<>(); + public static List BTZ_CLASSES = new ArrayList<>(); + public static List BTZ_GRADES = new ArrayList<>(); + public static int BTZ_RADIUS; + public static int BTZ_ENCHANT; + public static boolean BTZ_RESTART_ZONE; + public static boolean BTZ_STORE_ZONE; + public static boolean BTZ_LOGOUT_ZONE; + public static boolean BTZ_REVIVE_NOBLESS; + public static boolean BTZ_REVIVE_HEAL; + public static boolean BTZ_REMOVE_BUFFS; + public static boolean BTZ_REMOVE_PETS; + public static List BTZ_REWARDS; // -------------------------------------------------- // NPC Settings @@ -2725,6 +2743,71 @@ public final class Config } } + BTZ_PVP_ENABLED = CustomSettings.getBoolean("BTZEnablePvP", false); + BTZ_SPAWN_LOCATIONS = parseZonesList(CustomSettings.getString("BTZSpawnLoc", "150111,144740,-12248")); + BTZ_REVIVE_DELAY = CustomSettings.getInt("BTZReviveDelay", 10); + if (BTZ_REVIVE_DELAY != 0) + { + BTZ_REVIVE = true; + } + BTZ_GIVE_NOBLES = CustomSettings.getBoolean("BTZGiveNoblesse", false); + tempString = CustomSettings.getString("BTZItems", "").split(","); + if (tempString.length != 0) + { + for (String i : tempString) + { + BTZ_ITEMS.add(i); + } + } + tempString = CustomSettings.getString("BTZGrades", "").split(","); + if (tempString.length != 0) + { + for (String i : tempString) + { + if (i.equals("D") || i.equals("C") || i.equals("B") || i.equals("A") || i.equals("S") || i.equals("S80") || i.equals("S84") || i.equals("R") || i.equals("R95") || i.equals("R99")) + { + BTZ_GRADES.add(i); + } + } + } + tempString = CustomSettings.getString("BTZClasses", "").split(","); + if (tempString.length != 0) + { + for (String i : tempString) + { + BTZ_CLASSES.add(i); + } + } + BTZ_RADIUS = CustomSettings.getInt("BTZRespawnRadius", 500); + BTZ_ENCHANT = CustomSettings.getInt("BTZEnchant", 0); + BTZ_REMOVE_BUFFS = CustomSettings.getBoolean("BTZRemoveBuffs", false); + BTZ_REMOVE_PETS = CustomSettings.getBoolean("BTZRemovePets", false); + BTZ_RESTART_ZONE = CustomSettings.getBoolean("BTZRestartZone", false); + BTZ_STORE_ZONE = CustomSettings.getBoolean("BTZStoreZone", false); + BTZ_LOGOUT_ZONE = CustomSettings.getBoolean("BTZLogoutZone", false); + BTZ_REVIVE_NOBLESS = CustomSettings.getBoolean("BTZReviveNoblesse", false); + BTZ_REVIVE_HEAL = CustomSettings.getBoolean("BTZReviveHeal", false); + BTZ_REWARDS = new ArrayList<>(); + tempString = CustomSettings.getString("BTZRewards", "57,100000").split(";"); + for (String reward : tempString) + { + String[] rewardSplit = reward.split(","); + if (rewardSplit.length == 2) + { + try + { + BTZ_REWARDS.add(new int[] + { + Integer.parseInt(rewardSplit[0]), + Integer.parseInt(rewardSplit[1]) + }); + } + catch (NumberFormatException nfe) + { + } + } + } + // Load PvP L2Properties file (if exists) final PropertiesParser PVPSettings = new PropertiesParser(PVP_CONFIG_FILE); @@ -4093,6 +4176,55 @@ public final class Config return result; } + private static int[][] parseZonesList(String line) + { + final String[] propertySplit = line.split(";"); + if (propertySplit.length == 0) + { + return null; + } + + int i = 0; + String[] valueSplit; + final int[][] result = new int[propertySplit.length][]; + for (String value : propertySplit) + { + valueSplit = value.split(","); + if (valueSplit.length != 3) + { + return null; + } + + result[i] = new int[3]; + try + { + result[i][0] = Integer.parseInt(valueSplit[0]); + } + catch (NumberFormatException e) + { + return null; + } + try + { + result[i][1] = Integer.parseInt(valueSplit[1]); + } + catch (NumberFormatException e) + { + return null; + } + try + { + result[i][2] = Integer.parseInt(valueSplit[2]); + } + catch (NumberFormatException e) + { + return null; + } + i++; + } + return result; + } + private static class IPConfigData implements DocumentParser { private static final List _subnets = new ArrayList<>(5); diff --git a/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java b/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java index 13d803da05..cb53a20ded 100644 --- a/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java +++ b/trunk/java/com/l2jserver/gameserver/model/actor/instance/L2PcInstance.java @@ -251,6 +251,7 @@ import com.l2jserver.gameserver.model.variables.AccountVariables; import com.l2jserver.gameserver.model.variables.PlayerVariables; import com.l2jserver.gameserver.model.zone.L2ZoneType; import com.l2jserver.gameserver.model.zone.ZoneId; +import com.l2jserver.gameserver.model.zone.type.L2BattalionZone; import com.l2jserver.gameserver.model.zone.type.L2BossZone; import com.l2jserver.gameserver.network.L2GameClient; import com.l2jserver.gameserver.network.SystemMessageId; @@ -5599,6 +5600,8 @@ public final class L2PcInstance extends L2Playable { setPvpKills(getPvpKills() + 1); + L2BattalionZone.givereward(this); + // Send a Server->Client UserInfo packet to attacker with its Karma and PK Counter UserInfo ui = new UserInfo(this, false); ui.addComponentType(UserInfoType.SOCIAL); diff --git a/trunk/java/com/l2jserver/gameserver/model/zone/ZoneId.java b/trunk/java/com/l2jserver/gameserver/model/zone/ZoneId.java index b382594958..bfb8dcaa7c 100644 --- a/trunk/java/com/l2jserver/gameserver/model/zone/ZoneId.java +++ b/trunk/java/com/l2jserver/gameserver/model/zone/ZoneId.java @@ -47,7 +47,8 @@ public enum ZoneId NO_BOOKMARK, NO_ITEM_DROP, NO_RESTART, - JUMP; + JUMP, + BATTALION; public static int getZoneCount() { diff --git a/trunk/java/com/l2jserver/gameserver/model/zone/type/L2BattalionZone.java b/trunk/java/com/l2jserver/gameserver/model/zone/type/L2BattalionZone.java new file mode 100644 index 0000000000..62bab3b01d --- /dev/null +++ b/trunk/java/com/l2jserver/gameserver/model/zone/type/L2BattalionZone.java @@ -0,0 +1,268 @@ +/* + * Copyright (C) 2004-2015 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 . + */ +package com.l2jserver.gameserver.model.zone.type; + +import com.l2jserver.Config; +import com.l2jserver.gameserver.ThreadPoolManager; +import com.l2jserver.gameserver.datatables.ItemTable; +import com.l2jserver.gameserver.datatables.SkillData; +import com.l2jserver.gameserver.model.actor.L2Character; +import com.l2jserver.gameserver.model.actor.L2Summon; +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; +import com.l2jserver.gameserver.model.itemcontainer.PcInventory; +import com.l2jserver.gameserver.model.items.instance.L2ItemInstance; +import com.l2jserver.gameserver.model.skills.Skill; +import com.l2jserver.gameserver.model.zone.L2ZoneRespawn; +import com.l2jserver.gameserver.model.zone.ZoneId; +import com.l2jserver.gameserver.network.SystemMessageId; +import com.l2jserver.gameserver.network.serverpackets.ExShowScreenMessage; +import com.l2jserver.gameserver.network.serverpackets.SystemMessage; +import com.l2jserver.util.Rnd; + +/** + * Another type of damage zone with skills + * @author kerberos + */ +public class L2BattalionZone extends L2ZoneRespawn +{ + private final static Skill NOBLESS_SKILL = SkillData.getInstance().getSkill(1323, 1); + private final static String[] GRADE_NAMES = + { + "", + "D", + "C", + "B", + "A", + "S", + "S80", + "S84", + "R", + "R95", + "R99" + }; + + public L2BattalionZone(int id) + { + super(id); + } + + @Override + protected void onEnter(L2Character character) + { + character.setInsideZone(ZoneId.NO_SUMMON_FRIEND, true); + character.setInsideZone(ZoneId.BATTALION, true); + character.setInsideZone(ZoneId.PVP, true); + if (!Config.BTZ_STORE_ZONE) + { + character.setInsideZone(ZoneId.NO_STORE, true); + } + + if (character.isPlayer()) + { + final L2PcInstance activeChar = character.getActingPlayer(); + if ((Config.BTZ_CLASSES != null) && Config.BTZ_CLASSES.contains("" + activeChar.getClassId().getId())) + { + activeChar.teleToLocation(83597, 147888, -3405); + activeChar.sendMessage("Your class is not allowed in the Battalion zone."); + return; + } + + for (L2ItemInstance o : activeChar.getInventory().getItems()) + { + if (o.isEquipable() && o.isEquipped() && !checkItem(o)) + { + int slot = activeChar.getInventory().getSlotFromItem(o); + activeChar.getInventory().unEquipItemInBodySlot(slot); + activeChar.sendMessage(o.getName() + " unequiped because is not allowed inside this zone."); + } + } + activeChar.sendMessage("You entered into the Battalion zone."); + clear(activeChar); + if (Config.BTZ_GIVE_NOBLES) + { + NOBLESS_SKILL.applyEffects(activeChar, activeChar); + } + if (Config.BTZ_PVP_ENABLED) + { + activeChar.updatePvPFlag(1); + } + + } + } + + @Override + protected void onExit(L2Character character) + { + character.setInsideZone(ZoneId.NO_SUMMON_FRIEND, false); + character.setInsideZone(ZoneId.BATTALION, false); + character.setInsideZone(ZoneId.PVP, false); + if (!Config.BTZ_STORE_ZONE) + { + character.setInsideZone(ZoneId.NO_STORE, false); + } + + if (character.isPlayer()) + { + final L2PcInstance activeChar = character.getActingPlayer(); + activeChar.sendMessage("You left from a Battalion zone."); + + if (Config.BTZ_PVP_ENABLED) + { + activeChar.stopPvPFlag(); + } + } + } + + @Override + public void onDieInside(final L2Character character) + { + if (character.isPlayer()) + { + final L2PcInstance activeChar = character.getActingPlayer(); + if (Config.BTZ_REVIVE) + { + ThreadPoolManager.getInstance().scheduleGeneral(() -> + { + activeChar.doRevive(); + heal(activeChar); + int[] loc = Config.BTZ_SPAWN_LOCATIONS[Rnd.get(Config.BTZ_SPAWN_LOCATIONS.length)]; + activeChar.teleToLocation(loc[0] + Rnd.get(-Config.BTZ_RADIUS, Config.BTZ_RADIUS), loc[1] + Rnd.get(-Config.BTZ_RADIUS, Config.BTZ_RADIUS), loc[2]); + }, Config.BTZ_REVIVE_DELAY * 1000); + + ExShowScreenMessage revive = new ExShowScreenMessage("You will be respawned in " + Config.BTZ_REVIVE_DELAY + " seconds.", 5000, true, 2); // 5 Seconds display + activeChar.sendPacket(revive); + } + } + } + + @Override + public void onReviveInside(L2Character character) + { + if (character.isPlayer()) + { + final L2PcInstance activeChar = character.getActingPlayer(); + if (Config.BTZ_REVIVE_NOBLESS) + { + NOBLESS_SKILL.applyEffects(activeChar, activeChar); + } + if (Config.BTZ_REVIVE_HEAL) + { + heal(activeChar); + } + } + } + + private void clear(L2PcInstance player) + { + if (Config.BTZ_REMOVE_BUFFS) + { + player.stopAllEffectsExceptThoseThatLastThroughDeath(); + if (Config.BTZ_REMOVE_PETS) + { + L2Summon pet = player.getSummon(); + if (pet != null) + { + pet.stopAllEffectsExceptThoseThatLastThroughDeath(); + pet.unSummon(player); + } + } + } + else + { + if (Config.BTZ_REMOVE_PETS) + { + L2Summon pet = player.getSummon(); + if (pet != null) + { + pet.unSummon(player); + } + } + } + } + + private static void heal(L2PcInstance activeChar) + { + activeChar.setCurrentHp(activeChar.getMaxHp()); + activeChar.setCurrentCp(activeChar.getMaxCp()); + activeChar.setCurrentMp(activeChar.getMaxMp()); + } + + public static void givereward(L2PcInstance player) + { + if (player.isInsideZone(ZoneId.BATTALION)) + { + SystemMessage systemMessage = null; + + for (int[] reward : Config.BTZ_REWARDS) + { + final PcInventory inv = player.getInventory(); + + if (ItemTable.getInstance().createDummyItem(reward[0]).isStackable()) + { + inv.addItem("L2MultiFunctionZone ", reward[0], reward[1], player, player); + + if (reward[1] > 1) + { + systemMessage = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S2_S1_S); + systemMessage.addItemName(reward[0]); + systemMessage.addLong(reward[1]); + } + else + { + systemMessage = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1); + systemMessage.addItemName(reward[0]); + } + player.sendPacket(systemMessage); + } + else + { + for (int i = 0; i < reward[1]; ++i) + { + inv.addItem("L2MultiFunctionZone ", reward[0], 1, player, player); + systemMessage = SystemMessage.getSystemMessage(SystemMessageId.YOU_HAVE_EARNED_S1); + systemMessage.addItemName(reward[0]); + player.sendPacket(systemMessage); + } + } + } + } + } + + public static boolean checkItem(L2ItemInstance item) + { + final int o = item.getItem().getCrystalType().ordinal(); + final int e = item.getEnchantLevel(); + + if ((Config.BTZ_ENCHANT != 0) && (e >= Config.BTZ_ENCHANT)) + { + return false; + } + + if (Config.BTZ_GRADES.contains(GRADE_NAMES[o])) + { + return false; + } + + if ((Config.BTZ_ITEMS != null) && Config.BTZ_ITEMS.contains("" + item.getId())) + { + return false; + } + return true; + } +} \ No newline at end of file diff --git a/trunk/java/com/l2jserver/gameserver/network/clientpackets/Logout.java b/trunk/java/com/l2jserver/gameserver/network/clientpackets/Logout.java index 40d63cc605..fb2c2fabd3 100644 --- a/trunk/java/com/l2jserver/gameserver/network/clientpackets/Logout.java +++ b/trunk/java/com/l2jserver/gameserver/network/clientpackets/Logout.java @@ -25,6 +25,7 @@ import java.util.logging.Logger; import com.l2jserver.Config; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.model.entity.L2Event; +import com.l2jserver.gameserver.model.zone.ZoneId; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ActionFailed; import com.l2jserver.gameserver.taskmanager.AttackStanceTaskManager; @@ -70,6 +71,13 @@ public final class Logout extends L2GameClientPacket return; } + if (player.isInsideZone(ZoneId.BATTALION) && !Config.BTZ_LOGOUT_ZONE) + { + player.sendMessage("You cannot logout while inside a Battalion zone."); + player.sendPacket(ActionFailed.STATIC_PACKET); + return; + } + // Don't allow leaving if player is fighting if (AttackStanceTaskManager.getInstance().hasAttackStanceTask(player)) { diff --git a/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestRestart.java b/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestRestart.java index fa95cf124d..89fc6dca18 100644 --- a/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestRestart.java +++ b/trunk/java/com/l2jserver/gameserver/network/clientpackets/RequestRestart.java @@ -26,6 +26,7 @@ import com.l2jserver.Config; import com.l2jserver.gameserver.enums.PrivateStoreType; import com.l2jserver.gameserver.instancemanager.AntiFeedManager; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; +import com.l2jserver.gameserver.model.zone.ZoneId; import com.l2jserver.gameserver.network.L2GameClient; import com.l2jserver.gameserver.network.L2GameClient.GameClientState; import com.l2jserver.gameserver.network.SystemMessageId; @@ -90,6 +91,13 @@ public final class RequestRestart extends L2GameClientPacket return; } + if (player.isInsideZone(ZoneId.BATTALION) && !Config.BTZ_RESTART_ZONE) + { + player.sendMessage("You cannot restart while inside a Battalion zone."); + sendPacket(RestartResponse.valueOf(false)); + return; + } + if (player.isBlockedFromExit()) { sendPacket(RestartResponse.valueOf(false)); diff --git a/trunk/java/com/l2jserver/gameserver/network/clientpackets/UseItem.java b/trunk/java/com/l2jserver/gameserver/network/clientpackets/UseItem.java index 549da56be1..2d119f3d84 100644 --- a/trunk/java/com/l2jserver/gameserver/network/clientpackets/UseItem.java +++ b/trunk/java/com/l2jserver/gameserver/network/clientpackets/UseItem.java @@ -42,6 +42,8 @@ import com.l2jserver.gameserver.model.items.instance.L2ItemInstance; import com.l2jserver.gameserver.model.items.type.ArmorType; import com.l2jserver.gameserver.model.items.type.WeaponType; import com.l2jserver.gameserver.model.skills.Skill; +import com.l2jserver.gameserver.model.zone.ZoneId; +import com.l2jserver.gameserver.model.zone.type.L2BattalionZone; import com.l2jserver.gameserver.network.SystemMessageId; import com.l2jserver.gameserver.network.serverpackets.ActionFailed; import com.l2jserver.gameserver.network.serverpackets.ExUseSharedGroupItem; @@ -127,6 +129,12 @@ public final class UseItem extends L2GameClientPacket return; } + if (activeChar.isInsideZone(ZoneId.BATTALION) && !L2BattalionZone.checkItem(item)) + { + getClient().getActiveChar().sendMessage("You cannot use " + item.getName() + " inside this zone."); + return; + } + if (item.getItem().getType2() == L2Item.TYPE2_QUEST) { activeChar.sendPacket(SystemMessageId.YOU_CANNOT_USE_QUEST_ITEMS); diff --git a/trunk/java/com/l2jserver/gameserver/network/serverpackets/Die.java b/trunk/java/com/l2jserver/gameserver/network/serverpackets/Die.java index d9430bb07b..34ab4eeaac 100644 --- a/trunk/java/com/l2jserver/gameserver/network/serverpackets/Die.java +++ b/trunk/java/com/l2jserver/gameserver/network/serverpackets/Die.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.Collections; import java.util.List; +import com.l2jserver.Config; import com.l2jserver.gameserver.instancemanager.CHSiegeManager; import com.l2jserver.gameserver.instancemanager.CastleManager; import com.l2jserver.gameserver.instancemanager.FortManager; @@ -31,6 +32,7 @@ import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.entity.Castle; import com.l2jserver.gameserver.model.entity.Fort; import com.l2jserver.gameserver.model.entity.clanhall.SiegableHall; +import com.l2jserver.gameserver.model.zone.ZoneId; /** * @author UnAfraid, Nos @@ -81,6 +83,16 @@ public class Die extends L2GameServerPacket _toFortress = ((clan != null) && (clan.getFortId() > 0)) || isInFortDefense; } + if (activeChar.isInsideZone(ZoneId.BATTALION) && !Config.BTZ_REVIVE) + { + _toVillage = false; + _toClanHall = false; + _toCastle = false; + _toOutpost = false; + _useFeather = false; + _toFortress = false; + } + _isSweepable = activeChar.isAttackable() && activeChar.isSweepActive(); } diff --git a/trunk/java/com/l2jserver/gameserver/network/serverpackets/ExShowScreenMessage.java b/trunk/java/com/l2jserver/gameserver/network/serverpackets/ExShowScreenMessage.java index 02bc6918b9..fa6f62f109 100644 --- a/trunk/java/com/l2jserver/gameserver/network/serverpackets/ExShowScreenMessage.java +++ b/trunk/java/com/l2jserver/gameserver/network/serverpackets/ExShowScreenMessage.java @@ -74,6 +74,30 @@ public class ExShowScreenMessage extends L2GameServerPacket _npcString = -1; } + /** + * Display a String on the screen for a given time. + * @param text the text to display + * @param time the display time + * @param position the position on the screen + * @param showEffect upper effect (false - disabled, true - enabled) - _position must be 2 (center) otherwise no effect + */ + + public ExShowScreenMessage(String text, int time, boolean showEffect, int position) + { + _type = 2; + _sysMessageId = -1; + _unk1 = 0; + _unk2 = 0; + _unk3 = 0; + _fade = false; + _position = TOP_CENTER; + _text = text; + _time = time; + _size = 0; + _effect = showEffect; + _npcString = -1; + } + /** * Display a NPC String on the screen for a given position and time. * @param npcString the NPC String Id