Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/config/functions/l2jfrozen.properties b/config/functions/l2jfrozen.properties
- index b1eaa98..169b5ee 100644
- --- a/config/functions/l2jfrozen.properties
- +++ b/config/functions/l2jfrozen.properties
- @@ -281,4 +281,12 @@
- ProtectorSkillLevel = 13
- ProtectorSkillTime = 600
- # Npc Protector Message
- ProtectorMessage = Hey You!, Never Kill On This Area, Go Read The Rules!
- +
- +#=============================================================
- +# Item Class Change
- +#=============================================================
- +#Item Coin Class
- +ItemCard = 0
- +
- diff --git a/head-src/com/l2jfrozen/Config.java b/head-src/com/l2jfrozen/Config.java
- index 7f8d0ef..4b37abc 100644
- --- a/head-src/com/l2jfrozen/Config.java
- +++ b/head-src/com/l2jfrozen/Config.java
- @@ -2337,6 +2337,7 @@
- public static float DONATOR_ADENA_RATE;
- public static float DONATOR_DROP_RATE;
- public static float DONATOR_SPOIL_RATE;
- + public static int ITEM_CLASS_ID;
- public static boolean CUSTOM_SPAWNLIST_TABLE;
- public static boolean SAVE_GMSPAWN_ON_CUSTOM;
- public static boolean DELETE_GMSPAWN_ON_CUSTOM;
- @@ -2441,6 +2442,7 @@
- is.close();
- /** Custom Tables **/
- + ITEM_CLASS_ID = Integer.parseInt(L2JFrozenSettings.getProperty("ItemCard", "0"));
- CUSTOM_SPAWNLIST_TABLE = Boolean.valueOf(L2JFrozenSettings.getProperty("CustomSpawnlistTable", "True"));
- SAVE_GMSPAWN_ON_CUSTOM = Boolean.valueOf(L2JFrozenSettings.getProperty("SaveGmSpawnOnCustom", "True"));
- DELETE_GMSPAWN_ON_CUSTOM = Boolean.valueOf(L2JFrozenSettings.getProperty("DeleteGmSpawnOnCustom", "True"));
- diff --git a/head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java b/head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java
- index 8dad568..2264488 100644
- --- a/head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java
- +++ b/head-src/com/l2jfrozen/gameserver/handler/ItemHandler.java
- @@ -35,6 +35,7 @@
- import com.l2jfrozen.gameserver.handler.itemhandlers.CharChangePotions;
- import com.l2jfrozen.gameserver.handler.itemhandlers.ChestKey;
- import com.l2jfrozen.gameserver.handler.itemhandlers.ChristmasTree;
- +import com.l2jfrozen.gameserver.handler.itemhandlers.ClassItem;
- import com.l2jfrozen.gameserver.handler.itemhandlers.CrystalCarol;
- import com.l2jfrozen.gameserver.handler.itemhandlers.Crystals;
- import com.l2jfrozen.gameserver.handler.itemhandlers.CustomPotions;
- @@ -110,6 +111,7 @@
- private ItemHandler()
- {
- _datatable = new TreeMap<>();
- + registerItemHandler(new ClassItem());
- registerItemHandler(new ScrollOfEscape());
- registerItemHandler(new ScrollOfResurrection());
- registerItemHandler(new SoulShots());
- diff --git a/head-src/com/l2jfrozen/gameserver/handler/itemhandlers/ClassItem.java b/head-src/com/l2jfrozen/gameserver/handler/itemhandlers/ClassItem.java
- new file mode 100644
- index 0000000..f6f485d
- --- /dev/null
- +++ b/head-src/com/l2jfrozen/gameserver/handler/itemhandlers/ClassItem.java
- @@ -0,0 +1,58 @@
- +/*
- + * 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.l2jfrozen.gameserver.handler.itemhandlers;
- +
- +import com.l2jfrozen.Config;
- +import com.l2jfrozen.gameserver.handler.IItemHandler;
- +import com.l2jfrozen.gameserver.model.L2Character;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2ItemInstance;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jfrozen.gameserver.model.actor.instance.L2PlayableInstance;
- +import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
- +import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
- +
- +public class ClassItem implements IItemHandler
- +{
- + private static final int[] ITEM_IDS = { Config.ITEM_CLASS_ID };
- +
- + @Override
- + public void useItem(final L2PlayableInstance playable, final L2ItemInstance item)
- + {
- +
- +
- + if (!(playable instanceof L2PcInstance))
- + return;
- + final L2PcInstance activeChar = (L2PcInstance) playable;
- + if (activeChar.isInOlympiadMode())
- + {
- + activeChar.sendMessage("This Item Cannot Be Used On Olympiad Games.");
- + }
- + else if (!activeChar.isInsideZone(L2Character.ZONE_PEACE)){
- + activeChar.sendMessage("You can only use this item in peace zone..");
- + return;
- + }
- + activeChar.setClassChangeItemId(item.getItemId());
- + final NpcHtmlMessage html = new NpcHtmlMessage(0);
- + html.setFile("data/html/mods/class_changer/Warning.htm");
- + activeChar.sendPacket(html);
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- +
- + @Override
- + public int[] getItemIds()
- + {
- + return ITEM_IDS;
- + }
- +}
- \ No newline at end of file
- diff --git a/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java b/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
- index 223b046..eafa66d 100644
- --- a/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
- +++ b/head-src/com/l2jfrozen/gameserver/model/actor/instance/L2PcInstance.java
- @@ -19643,5 +19643,19 @@
- _currentPetSkill = new SkillDat(currentSkill, ctrlPressed, shiftPressed);
- }
- +
- + //inicio classitem
- + private int _classChangeItemId = 0;
- +
- + public int getClassChangeItemId()
- + {
- + return _classChangeItemId;
- + }
- +
- + public void setClassChangeItemId(int itemId)
- + {
- + _classChangeItemId = itemId;
- + }
- + //fim class item
- }
- \ No newline at end of file
- diff --git a/head-src/com/l2jfrozen/gameserver/model/entity/olympiad/Olympiad.java b/head-src/com/l2jfrozen/gameserver/model/entity/olympiad/Olympiad.java
- index 4e14ca8..75bea8c 100644
- --- a/head-src/com/l2jfrozen/gameserver/model/entity/olympiad/Olympiad.java
- +++ b/head-src/com/l2jfrozen/gameserver/model/entity/olympiad/Olympiad.java
- @@ -572,7 +572,7 @@
- return _nobles.size();
- }
- - protected static StatsSet getNobleStats(final int playerId)
- + public static StatsSet getNobleStats(final int playerId)
- {
- return _nobles.get(playerId);
- }
- diff --git a/head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java b/head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java
- index 921c087..2f940ba 100644
- --- a/head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java
- +++ b/head-src/com/l2jfrozen/gameserver/network/clientpackets/RequestBypassToServer.java
- @@ -20,6 +20,10 @@
- */
- package com.l2jfrozen.gameserver.network.clientpackets;
- +import java.sql.Connection;
- +import java.sql.PreparedStatement;
- +import java.util.StringTokenizer;
- +
- import org.apache.log4j.Logger;
- import com.l2jfrozen.Config;
- @@ -30,12 +34,14 @@
- import com.l2jfrozen.gameserver.handler.IAdminCommandHandler;
- import com.l2jfrozen.gameserver.handler.custom.CustomBypassHandler;
- import com.l2jfrozen.gameserver.model.L2Object;
- +import com.l2jfrozen.gameserver.model.L2Skill;
- import com.l2jfrozen.gameserver.model.L2World;
- import com.l2jfrozen.gameserver.model.actor.instance.L2ClassMasterInstance;
- import com.l2jfrozen.gameserver.model.actor.instance.L2NpcInstance;
- import com.l2jfrozen.gameserver.model.actor.instance.L2PcInstance;
- import com.l2jfrozen.gameserver.model.actor.instance.L2SymbolMakerInstance;
- import com.l2jfrozen.gameserver.model.actor.position.L2CharPosition;
- +import com.l2jfrozen.gameserver.model.base.ClassId;
- import com.l2jfrozen.gameserver.model.entity.event.CTF;
- import com.l2jfrozen.gameserver.model.entity.event.DM;
- import com.l2jfrozen.gameserver.model.entity.event.L2Event;
- @@ -44,7 +50,10 @@
- import com.l2jfrozen.gameserver.model.entity.olympiad.Olympiad;
- import com.l2jfrozen.gameserver.network.serverpackets.ActionFailed;
- import com.l2jfrozen.gameserver.network.serverpackets.NpcHtmlMessage;
- +import com.l2jfrozen.gameserver.network.serverpackets.PlaySound;
- +import com.l2jfrozen.gameserver.templates.StatsSet;
- import com.l2jfrozen.gameserver.util.GMAudit;
- +import com.l2jfrozen.util.database.L2DatabaseFactory;
- public final class RequestBypassToServer extends L2GameClientPacket
- {
- @@ -318,6 +327,40 @@
- {
- Olympiad.bypassChangeArena(_command, activeChar);
- }
- + else if (_command.startsWith("class_index"))
- + {
- + NpcHtmlMessage html = new NpcHtmlMessage(0);
- + html.setFile("data/html/mods/class_changer/Class.htm");
- + activeChar.sendPacket(html);
- + activeChar.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- + else if (_command.startsWith("classe_change"))
- + {
- + StringTokenizer st = new StringTokenizer(_command);
- + st.nextToken();
- + String type = null;
- + type = st.nextToken();
- + try
- + {
- + if (activeChar.getBaseClass() != activeChar.getClassId().getId())
- + {
- + activeChar.sendMessage("You need to be in your base class to be able to use this item.");
- + return ;
- + }
- + if (activeChar.getLevel() < 76)
- + {
- + activeChar.sendMessage("You need to be at least 76 level in order to use class card.");
- + return;
- + }
- + if (activeChar.isInOlympiadMode())
- + {
- + activeChar.sendMessage("This item cannot be used on olympiad games.");
- + return;
- + }
- + ClassChangeCoin(activeChar, type);
- + }
- + catch (StringIndexOutOfBoundsException e)
- + {
- + }
- + }
- }
- catch (final Exception e)
- {
- @@ -332,6 +375,842 @@
- // }
- }
- + private static void ClassChangeCoin(L2PcInstance player, String command)
- + {
- + String nameclasse = player.getTemplate().getClassName();
- +
- + String type = command;
- + if (type.equals("---SELECT---"))
- + {
- + NpcHtmlMessage html = new NpcHtmlMessage(0);
- + html.setFile("data/html/mods/class_changer/Class.htm");
- + player.sendPacket(html);
- + player.sendPacket(ActionFailed.STATIC_PACKET);
- + }
- + if (type.equals("Duelist"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 88)
- + {
- + player.sendMessage("Your class is already " + nameclasse + ".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(88);
- + if (!player.isSubClassActive())
- + player.setBaseClass(88);
- +
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("DreadNought"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 89)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(89);
- + if (!player.isSubClassActive())
- + player.setBaseClass(89);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Phoenix_Knight"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 90)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(90);
- + if (!player.isSubClassActive())
- + player.setBaseClass(90);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Hell_Knight"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 91)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(91);
- + if (!player.isSubClassActive())
- + player.setBaseClass(91);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Sagittarius"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 92)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(92);
- + if (!player.isSubClassActive())
- + player.setBaseClass(92);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Adventurer"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 93)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(93);
- + if (!player.isSubClassActive())
- + player.setBaseClass(93);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Archmage"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 94)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(94);
- + if (!player.isSubClassActive())
- + player.setBaseClass(94);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Soultaker"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 95)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(95);
- + if (!player.isSubClassActive())
- + player.setBaseClass(95);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Arcana_Lord"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 96)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(96);
- + if (!player.isSubClassActive())
- + player.setBaseClass(96);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Cardinal"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 97)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(97);
- + if (!player.isSubClassActive())
- + player.setBaseClass(97);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Hierophant"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 98)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(98);
- + if (!player.isSubClassActive())
- + player.setBaseClass(98);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Eva_Templar"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 99)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(99);
- + if (!player.isSubClassActive())
- + player.setBaseClass(99);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Sword_Muse"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 100)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(100);
- + if (!player.isSubClassActive())
- + player.setBaseClass(100);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Wind_Rider"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 101)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(101);
- + if (!player.isSubClassActive())
- + player.setBaseClass(101);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Moonli_Sentinel"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 102)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(102);
- + if (!player.isSubClassActive())
- + player.setBaseClass(102);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Mystic_Muse"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 103)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(103);
- + if (!player.isSubClassActive())
- + player.setBaseClass(103);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Elemental_Master"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 104)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(104);
- + if (!player.isSubClassActive())
- + player.setBaseClass(104);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Eva_Saint"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 105)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(105);
- + if (!player.isSubClassActive())
- + player.setBaseClass(105);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Shillien_Templar"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 106)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(106);
- + if (!player.isSubClassActive())
- + player.setBaseClass(106);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Spectral_Dancer"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 107)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(107);
- + if (!player.isSubClassActive())
- + player.setBaseClass(107);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Ghost_Hunter"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 108)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(108);
- + if (!player.isSubClassActive())
- + player.setBaseClass(108);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Ghost_Sentinel"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 109)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(109);
- + if (!player.isSubClassActive())
- + player.setBaseClass(109);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Storm_Screamer"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 110)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(110);
- + if (!player.isSubClassActive())
- + player.setBaseClass(110);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Spectral_Master"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 111)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(111);
- + if (!player.isSubClassActive())
- + player.setBaseClass(111);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Shillen_Saint"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 112)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(112);
- + if (!player.isSubClassActive())
- + player.setBaseClass(112);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Titan"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 113)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(113);
- + if (!player.isSubClassActive())
- + player.setBaseClass(113);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Grand_Khauatari"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 114)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(114);
- + if (!player.isSubClassActive())
- + player.setBaseClass(114);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Dominator"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 115)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(115);
- + if (!player.isSubClassActive())
- + player.setBaseClass(115);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Doomcryer"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 116)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(116);
- + if (!player.isSubClassActive())
- + player.setBaseClass(116);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Fortune_Seeker"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 117)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(117);
- + if (!player.isSubClassActive())
- + player.setBaseClass(117);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + if (type.equals("Maestro"))
- + {
- + if (player.getInventory().getInventoryItemCount(Config.ITEM_CLASS_ID, 0) >= 1)
- + {
- + if (player.getClassId().getId() == 118)
- + {
- + player.sendMessage("Your class is already "+nameclasse+".");
- + return;
- + }
- +
- + RemoverSkills(player);
- +
- + player.setClassId(118);
- + if (!player.isSubClassActive())
- + player.setBaseClass(118);
- + Finish(player);
- + }
- + else
- + {
- + player.sendMessage("You dont have class card item!");
- + return;
- + }
- + }
- + }
- + private static void Finish(L2PcInstance activeChar)
- + {
- + String newclass = activeChar.getTemplate().getClassName();
- +
- + DeleteHenna(activeChar, 0);
- +
- + activeChar.sendMessage(activeChar.getName() + " is now a " + newclass + ".");
- + activeChar.refreshOverloaded();
- + activeChar.store();
- + activeChar.broadcastUserInfo();
- + activeChar.sendSkillList();
- + activeChar.sendPacket(new PlaySound("ItemSound.quest_finish"));
- +
- + if (activeChar.isNoble())
- + {
- + StatsSet playerStat = Olympiad.getNobleStats(activeChar.getObjectId());
- + if (!(playerStat == null))
- + {
- + updateClasse(activeChar);
- + DeleteHero(activeChar);
- + activeChar.sendMessage("You now has " + Olympiad.getInstance().getNoblePoints(activeChar.getObjectId()) + " Olympiad points.");
- + }
- + }
- + activeChar.sendMessage("You will be disconnected for security reasons.");
- + waitSecs(5);
- +
- + activeChar.getClient().closeNow();
- + }
- + public static void DeleteHenna(L2PcInstance player, int classIndex)
- + {
- + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
- + {
- + // Remove all henna info stored for this sub-class.
- + PreparedStatement statement = con.prepareStatement(DELETE_CHAR_HENNAS);
- + statement.setInt(1, player.getObjectId());
- + statement.setInt(2, classIndex);
- + statement.execute();
- + statement.close();
- + con.close();
- + }
- + catch (Exception e)
- + {
- + LOGGER.warn("could not clear char Hero: " + e);
- + }
- + }
- +
- + public static void DeleteHero(L2PcInstance player)
- + {
- + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
- + {
- + PreparedStatement statement = con.prepareStatement(DELETE_CHAR_HERO);
- + statement.setInt(1, player.getObjectId());
- + statement.execute();
- + statement.close();
- + con.close();
- + }
- + catch (Exception e)
- + {
- + LOGGER.warn("could not clear char Hero: " + e);
- + }
- + }
- + private static void RemoverSkills(L2PcInstance activeChar)
- + {
- + L2Skill[] skills = activeChar.getAllSkills();
- +
- + for (L2Skill skill : skills)
- + activeChar.removeSkill(skill);
- +
- + activeChar.destroyItemByItemId("Classe Change", activeChar.getClassChangeItemId(), 1, null, true);
- + }
- + // Updates That Will be Executed by MySQL
- + // ----------------------------------------
- + static String INSERT_DATA = "REPLACE INTO olympiad_nobles (char_id, class_id, olympiad_points) VALUES (?,?,?)";
- + static String OLYMPIAD_UPDATE = "UPDATE olympiad_nobles SET class_id=?, olympiad_points=?, competitions_done=?, competitions_won=?, competitions_lost=?, competitions_drawn=? WHERE char_Id=?";
- + static String DELETE_CHAR_HERO = "DELETE FROM heroes WHERE char_id=?";
- + static String DELETE_CHAR_HENNAS = "DELETE FROM character_hennas WHERE char_obj_id=? AND class_index=?";
- +
- + public static void waitSecs(int i)
- + {
- + try
- + {
- + Thread.sleep(i * 1000);
- + }
- + catch (InterruptedException e)
- + {
- + e.printStackTrace();
- + }
- + }
- + public static void updateClasse(L2PcInstance player)
- + {
- + if (player == null)
- + return;
- +
- + try (Connection con = L2DatabaseFactory.getInstance().getConnection())
- + {
- + PreparedStatement stmt = con.prepareStatement(INSERT_DATA);
- +
- + stmt.setInt(1, player.getObjectId());
- + stmt.setInt(2, player.getClassId().getId());
- + stmt.setInt(3, 18);
- + stmt.execute();
- + stmt.close();
- + con.close();
- + }
- + catch (Exception e)
- + {
- + LOGGER.warn("Class Card: Could not clear char Olympiad Points: " + e);
- + }
- + }
- /**
- * @param activeChar
- */
- diff --git a/head-src/com/l2jfrozen/gameserver/templates/L2PcTemplate.java b/head-src/com/l2jfrozen/gameserver/templates/L2PcTemplate.java
- index 1f4bb2d..a5f4b7c 100644
- --- a/head-src/com/l2jfrozen/gameserver/templates/L2PcTemplate.java
- +++ b/head-src/com/l2jfrozen/gameserver/templates/L2PcTemplate.java
- @@ -138,4 +138,9 @@
- {
- return 333; // TODO: unhardcode it
- }
- +
- + public String getClassName()
- + {
- + return className;
- + }
- }
Add Comment
Please, Sign In to add comment