Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ### Eclipse Workspace Patch 1.0
- #P L2J_Server_BETA
- Index: dist/game/config/L2JMods.properties
- ===================================================================
- --- dist/game/config/L2JMods.properties (revision 5588)
- +++ dist/game/config/L2JMods.properties (working copy)
- @@ -461,4 +461,40 @@
- # ---------------------------------------------------------------------------
- # 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
- +
- +# ---------------------------------------------------------------------------
- +# Donate Window
- +# ---------------------------------------------------------------------------
- +# Item id that will be used to buy services in Donate Window
- +DonateItemId = 57
- +# Price of Hp/Mp/Cp Fully heal
- +DonateHeal = 500
- +# Price of Removing all debuffs
- +DonateRemoveDebuff = 200
- +# Price of Blessed Soe during combat
- +DonateBsoe = 200
- +# Price of removing all skill reuses
- +DonateRemoveReuse = 300
- +# Price of removing karma
- +DonateRemoveKarma = 300
- +# Price of self ressurection
- +DonateSelfRes = 500
- +# Price of removing Clan Penaltys
- +DonateRemovePenaltys = 100
- +# Price of consumables(shots(500), arrows(500), potions(50), spirit ore(300), soul ore(200))
- +DonateConsumables = 20
- +# Price of adding attribute +5 to a weapon
- +DonateAttribute = 200
- +# Price of adding 5 olympiad points
- +DonateOlyPointsAdd = 500
- +# Price of adding 50kk adena
- +DonateAdena = 100
- +# Price of getting Cursed Weapon(only if its not taken)
- +DonateCursedWeapon = 300
- +# Price of enchanting Weapon +1
- +DonateEnchantWeapon = 800
- +# Price of enchanting Armor(always weakest is enchanted)
- +DonateEnchantArmor = 500
- +# Price of enchanting Jewely(always weakest is enchanted)
- +DonateEnchantJewely = 400
- \ No newline at end of file
- Index: java/com/l2jserver/Config.java
- ===================================================================
- --- java/com/l2jserver/Config.java (revision 5588)
- +++ java/com/l2jserver/Config.java (working copy)
- @@ -763,6 +763,22 @@
- public static int L2JMOD_DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP;
- public static Map<Integer, Integer> L2JMOD_DUALBOX_CHECK_WHITELIST;
- public static boolean L2JMOD_ALLOW_CHANGE_PASSWORD;
- + public static int DONATE_ITEM_ID;
- + public static int DONATE_HEAL;
- + public static int DONATE_REMOVE_DEBUFF;
- + public static int DONATE_BSOE;
- + public static int DONATE_REMOVE_REUSE;
- + public static int DONATE_REMOVE_KARMA;
- + public static int DONATE_SELF_RES;
- + public static int DONATE_REMOVE_CLAN_PENALTYS;
- + public static int DONATE_CONSUMABLES;
- + public static int DONATE_ATTRIBUTE;
- + public static int DONATE_OLYMPIAD_POINT;
- + public static int DONATE_ADENA;
- + public static int DONATE_CURSED_WEAPON;
- + public static int DONATE_ENCHANT_WEAPON;
- + public static int DONATE_ENCHANT_ARMOR;
- + public static int DONATE_ENCHANT_JEWELY;
- // --------------------------------------------------
- // NPC Settings
- @@ -2673,6 +2689,24 @@
- }
- L2JMOD_ALLOW_CHANGE_PASSWORD = Boolean.parseBoolean(L2JModSettings.getProperty("AllowChangePassword", "False"));
- + DONATE_ITEM_ID = Integer.parseInt(L2JModSettings.getProperty("DonateItemId", "57"));
- + DONATE_HEAL = Integer.parseInt(L2JModSettings.getProperty("DonateHeal", "500"));
- + DONATE_REMOVE_DEBUFF = Integer.parseInt(L2JModSettings.getProperty("DonateRemoveDebuff", "200"));
- + DONATE_BSOE = Integer.parseInt(L2JModSettings.getProperty("DonateBsoe", "200"));
- + DONATE_REMOVE_REUSE = Integer.parseInt(L2JModSettings.getProperty("DonateRemoveReuse", "300"));
- + DONATE_REMOVE_KARMA = Integer.parseInt(L2JModSettings.getProperty("DonateRemoveKarma", "300"));
- + DONATE_SELF_RES = Integer.parseInt(L2JModSettings.getProperty("DonateSelfRes", "500"));
- + DONATE_REMOVE_CLAN_PENALTYS = Integer.parseInt(L2JModSettings.getProperty("DonateRemovePenaltys", "100"));
- + DONATE_CONSUMABLES = Integer.parseInt(L2JModSettings.getProperty("DonateConsumables", "20"));
- + DONATE_ATTRIBUTE = Integer.parseInt(L2JModSettings.getProperty("DonateAttribute", "200"));
- + DONATE_OLYMPIAD_POINT = Integer.parseInt(L2JModSettings.getProperty("DonateOlyPointsAdd", "500"));
- + DONATE_ADENA = Integer.parseInt(L2JModSettings.getProperty("DonateAdena", "100"));
- + DONATE_CURSED_WEAPON = Integer.parseInt(L2JModSettings.getProperty("DonateCursedWeapon", "300"));
- + DONATE_ENCHANT_WEAPON = Integer.parseInt(L2JModSettings.getProperty("DonateEnchantWeapon", "800"));
- + DONATE_ENCHANT_ARMOR = Integer.parseInt(L2JModSettings.getProperty("DonateEnchantArmor", "500"));
- + DONATE_ENCHANT_JEWELY = Integer.parseInt(L2JModSettings.getProperty("DonateEnchantJewely", "400"));
- +
- +
- // Load PvP L2Properties file (if exists)
- final File pvp = new File(PVP_CONFIG_FILE);
- L2Properties PVPSettings = new L2Properties();
- Index: java/com/l2jserver/gameserver/network/clientpackets/RequestBypassToServer.java
- ===================================================================
- --- java/com/l2jserver/gameserver/network/clientpackets/RequestBypassToServer.java (revision 5588)
- +++ java/com/l2jserver/gameserver/network/clientpackets/RequestBypassToServer.java (working copy)
- @@ -26,6 +26,7 @@
- import com.l2jserver.gameserver.datatables.AdminTable;
- import com.l2jserver.gameserver.handler.AdminCommandHandler;
- import com.l2jserver.gameserver.handler.BypassHandler;
- +import com.l2jserver.gameserver.handler.Donate;
- import com.l2jserver.gameserver.handler.IAdminCommandHandler;
- import com.l2jserver.gameserver.handler.IBypassHandler;
- import com.l2jserver.gameserver.model.L2CharPosition;
- @@ -306,6 +307,10 @@
- handler.useBypass("arenachange " + (arenaId - 1), activeChar, null);
- }
- }
- + else if(_command.startsWith("_donate"))
- + {
- + Donate.onBypass(activeChar, _command.substring(8));
- + }
- else
- {
- final IBypassHandler handler = BypassHandler.getInstance().getHandler(_command);
- Index: java/com/l2jserver/gameserver/model/olympiad/Olympiad.java
- ===================================================================
- --- java/com/l2jserver/gameserver/model/olympiad/Olympiad.java (revision 5588)
- +++ java/com/l2jserver/gameserver/model/olympiad/Olympiad.java (working copy)
- @@ -446,7 +446,7 @@
- return _nobles.size();
- }
- - protected static StatsSet getNobleStats(int playerId)
- + public static StatsSet getNobleStats(int playerId)
- {
- return _nobles.get(playerId);
- }
- Index: java/com/l2jserver/gameserver/handler/Donate.java
- ===================================================================
- --- java/com/l2jserver/gameserver/handler/Donate.java (revision 0)
- +++ java/com/l2jserver/gameserver/handler/Donate.java (working copy)
- @@ -0,0 +1,396 @@
- +/*
- + * 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.handler;
- +
- +import com.l2jserver.Config;
- +import com.l2jserver.gameserver.datatables.ItemTable;
- +import com.l2jserver.gameserver.datatables.SkillTable;
- +import com.l2jserver.gameserver.instancemanager.CursedWeaponsManager;
- +import com.l2jserver.gameserver.model.CursedWeapon;
- +import com.l2jserver.gameserver.model.actor.L2Character;
- +import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
- +import com.l2jserver.gameserver.model.effects.L2Effect;
- +import com.l2jserver.gameserver.model.itemcontainer.Inventory;
- +import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
- +import com.l2jserver.gameserver.model.olympiad.Olympiad;
- +import com.l2jserver.gameserver.model.skills.L2Skill;
- +import com.l2jserver.gameserver.network.serverpackets.InventoryUpdate;
- +import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage;
- +import com.l2jserver.gameserver.network.serverpackets.SkillCoolTime;
- +
- +/**
- + * @author Vampir
- + */
- +public class Donate implements IVoicedCommandHandler
- +{
- + private static final String[] VOICED_COMMANDS =
- + {
- + "donate"
- + };
- +
- + //{button name, button command, icon}
- + private static final String[][] combatButtons = {
- + {"Full Heal", "hp", "icon.skill5934"},
- + {"Cure Debuff", "dbuff", "icon.skill0430"},
- + {"Bsoe", "bsoe", "icon.skill0430"},
- + {"Reuse Skills", "clearReuse", "icon.skill0430"},
- + {"Remove Karma", "clearKarma", "icon.skill0430"},
- + {"Ress Myself", "resMe", "icon.skill0430"},
- + };
- +
- + //{button name, button command, icon}
- + private static final String[][] townButtons = {
- + {"Remove Clan Penaltys", "deleteClanPenaltys", "icon.skill0430"},
- + {"Add Consumables", "addConsumables", "icon.skill0430"},
- + {"Add Wpn Attribute", "addAttribute", "icon.skill0430"},
- + {"Add 5 Oly points", "addOlyPoints", "icon.skill0430"},
- + {"Add 50kk adena", "addAdena", "icon.skill0430"},
- + {"Get Cursed Weapon", "addCursedWeapon", "icon.skill0430"},
- + {"Enchant Weapon", "enchantWeapon", "icon.skill0430"},
- + {"Enchant Armor", "enchantArmor", "icon.skill0430"},
- + {"Enchant Jewely", "enchantJewely", "icon.skill0430"},
- + };
- +
- + @Override
- + public boolean useVoicedCommand(String command, L2PcInstance activeChar, String params)
- + {
- + if (command.equals(VOICED_COMMANDS[0]))//donate
- + {
- + setToShowPage(activeChar);
- +
- + return true;
- + }
- + return false;
- + }
- +
- + public static void onBypass(L2PcInstance activeChar, String command)
- + {
- + String donateItemName = ItemTable.getInstance().getTemplate(Config.DONATE_ITEM_ID).getName();
- + if(command.equals("changePage"))
- + {
- + String[][] buttons;
- + if(activeChar.isInsideZone(L2Character.ZONE_PEACE))
- + buttons = combatButtons;
- + else
- + buttons = townButtons;
- + showPage(activeChar, buttons);
- + }
- + else if(command.equals("hp"))
- + {
- + if(activeChar.getInventory().destroyItemByItemId("Donate", Config.DONATE_ITEM_ID, Config.DONATE_HEAL, activeChar, true) != null)
- + {
- + activeChar.setCurrentHpMp(activeChar.getMaxHp(), activeChar.getMaxMp());
- + activeChar.setCurrentCp(activeChar.getMaxCp());
- + activeChar.sendMessage("Your Hp, Cp and Mp has been restored for "+Config.DONATE_HEAL+" "+donateItemName+"!");
- + }
- + else
- + activeChar.sendMessage("You need "+Config.DONATE_HEAL+" "+donateItemName+" to restore your health!");
- + }
- + else if(command.equals("dbuff"))
- + {
- + L2Effect[] effects = activeChar.getAllEffects();
- + if (effects == null || effects.length == 0)
- + return;
- + if(activeChar.getInventory().destroyItemByItemId("Donate", Config.DONATE_ITEM_ID, Config.DONATE_REMOVE_DEBUFF, activeChar, true) != null)
- + {
- + for (L2Effect e : effects)
- + if (e.getSkill().isDebuff())
- + e.exit();
- + activeChar.sendMessage("Your debuffs has been removed for "+Config.DONATE_REMOVE_DEBUFF+" "+donateItemName+"!");
- + }
- + else
- + activeChar.sendMessage("You need "+Config.DONATE_REMOVE_DEBUFF+" "+donateItemName+" to remove your debuffs!");
- + }
- + else if(command.equals("bsoe"))
- + {
- + if(activeChar.getInventory().destroyItemByItemId("Donate", Config.DONATE_ITEM_ID, Config.DONATE_BSOE, activeChar, true) != null)
- + {
- + L2Skill GM_escape = SkillTable.getInstance().getInfo(2100, 1);
- + activeChar.doCast(GM_escape);
- + activeChar.sendMessage("You have escaped from the battle for "+Config.DONATE_BSOE+" "+donateItemName+"!");
- + }
- + else
- + activeChar.sendMessage("You need "+Config.DONATE_BSOE+" "+donateItemName+" to escape from the battle!");
- + }
- + else if(command.equals("clearReuse"))
- + {
- + if(activeChar.getInventory().destroyItemByItemId("Donate", Config.DONATE_ITEM_ID, Config.DONATE_REMOVE_REUSE, activeChar, true) != null)
- + {
- + activeChar.getSkillReuseTimeStamps().clear();
- + activeChar.getDisabledSkills().clear();
- + activeChar.sendPacket(new SkillCoolTime(activeChar));
- + activeChar.sendMessage("You have removed skills reuse for "+Config.DONATE_REMOVE_REUSE+" "+donateItemName+"!");
- + }
- + else
- + activeChar.sendMessage("You need "+Config.DONATE_REMOVE_REUSE+" "+donateItemName+" to remove skills reuses!");
- + }
- + else if(command.equals("clearKarma"))
- + {
- + if(activeChar.getInventory().destroyItemByItemId("Donate", Config.DONATE_ITEM_ID, Config.DONATE_REMOVE_KARMA, activeChar, true) != null)
- + {
- + activeChar.setKarma(0);
- + activeChar.sendMessage("You have cleared your karma for "+Config.DONATE_REMOVE_KARMA+" "+donateItemName+"!");
- + }
- + else
- + activeChar.sendMessage("You need "+Config.DONATE_REMOVE_KARMA+" "+donateItemName+" to clear your karma!");
- + }
- + else if(command.equals("resMe"))
- + {
- + if(activeChar.isDead())
- + {
- + if(activeChar.getInventory().destroyItemByItemId("Donate", Config.DONATE_ITEM_ID, Config.DONATE_SELF_RES, activeChar, true) != null)
- + {
- + activeChar.restoreExp(100.0);
- + activeChar.doRevive();
- + activeChar.sendMessage("You have been ressurected for "+Config.DONATE_SELF_RES+" "+donateItemName+"!");
- + }
- + else
- + activeChar.sendMessage("You need "+Config.DONATE_SELF_RES+" "+donateItemName+" to ressurect yourself!");
- + }
- + }
- + else if(command.equals("deleteClanPenaltys"))
- + {
- + if(activeChar.getInventory().destroyItemByItemId("Donate", Config.DONATE_ITEM_ID, Config.DONATE_REMOVE_CLAN_PENALTYS, activeChar, true) != null)
- + {
- + activeChar.setClanCreateExpiryTime(0);
- + activeChar.setClanJoinExpiryTime(0);
- + activeChar.sendMessage("You have removed Clan Penaltys for "+Config.DONATE_REMOVE_CLAN_PENALTYS+" "+donateItemName+"!");
- + }
- + else
- + activeChar.sendMessage("You need "+Config.DONATE_REMOVE_CLAN_PENALTYS+" "+donateItemName+" to remove Clan Penaltys!");
- + }
- + else if(command.equals("addConsumables"))
- + {
- + if(activeChar.getInventory().destroyItemByItemId("Donate", Config.DONATE_ITEM_ID, Config.DONATE_CONSUMABLES, activeChar, true) != null)
- + {
- + activeChar.addItem("Donate", 1345, 500, activeChar, false);//Shining Arrow
- + activeChar.addItem("Donate", 1467, 500, activeChar, false);//SoulShot S
- + activeChar.addItem("Donate", 3952, 500, activeChar, false);//Blessed SpiritShot S
- + activeChar.addItem("Donate", 3031, 300, activeChar, false);//Spirit Ore
- + activeChar.addItem("Donate", 1785, 300, activeChar, false);//Soul Ore
- + activeChar.addItem("Donate", 1061, 50, activeChar, false);//Greater Healing Potion
- + activeChar.addItem("Donate", 5592, 50, activeChar, false);//Greater CP Potion
- + activeChar.sendMessage("You have earned few consumables for "+Config.DONATE_CONSUMABLES+" "+donateItemName+"!");
- + }
- + else
- + {
- + activeChar.sendMessage("You need "+Config.DONATE_CONSUMABLES+" "+donateItemName+" to get Consumables!");
- + }
- + }
- + else if(command.equals("addAttribute"))
- + {
- + L2ItemInstance weapon = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
- + if(weapon != null && weapon.getAttackElementPower() != 0)
- + {
- + if(activeChar.getInventory().destroyItemByItemId("Donate", Config.DONATE_ITEM_ID, Config.DONATE_ATTRIBUTE, activeChar, true) != null)
- + {
- + activeChar.getInventory().unEquipItemInSlot(Inventory.PAPERDOLL_RHAND);
- + weapon.setElementAttr(weapon.getAttackElementType(), weapon.getAttackElementPower()+5);
- + activeChar.getInventory().equipItem(weapon);
- +
- + InventoryUpdate iu = new InventoryUpdate();
- + iu.addModifiedItem(weapon);
- + activeChar.sendPacket(iu);
- + activeChar.sendMessage("You have increased Attribute of weapon for "+Config.DONATE_ATTRIBUTE+" "+donateItemName+"!");
- + }
- + else
- + {
- + activeChar.sendMessage("You need "+Config.DONATE_ATTRIBUTE+" "+donateItemName+" to increase Attribute!");
- + }
- + }
- + else
- + activeChar.sendMessage("You need to have weapon that already have attribute on it first!");
- + }
- + else if(command.equals("addOlyPoints"))
- + {
- + if(activeChar.isNoble())
- + {
- + if(activeChar.getInventory().destroyItemByItemId("Donate", Config.DONATE_ITEM_ID, Config.DONATE_OLYMPIAD_POINT, activeChar, true) != null)
- + {
- + int currentPoints = Olympiad.getNobleStats(activeChar.getObjectId()).getInteger("olympiad_points");
- + currentPoints += 5;
- + Olympiad.getNobleStats(activeChar.getObjectId()).set("olympiad_points", currentPoints);
- + activeChar.sendMessage("You have earned 5 olympiad points for "+Config.DONATE_OLYMPIAD_POINT+" "+donateItemName+"!");
- + }
- + else
- + activeChar.sendMessage("You need "+Config.DONATE_OLYMPIAD_POINT+" "+donateItemName+" to get Olympiad points!");
- + }
- + }
- + else if(command.equals("addAdena"))
- + {
- + if(activeChar.getInventory().destroyItemByItemId("Donate", Config.DONATE_ITEM_ID, Config.DONATE_ADENA, activeChar, true) != null)
- + {
- + activeChar.addAdena("Donate", 50000000, activeChar, false);
- + activeChar.sendMessage("You have earned 50kk adena for "+Config.DONATE_ADENA+" "+donateItemName+"!");
- + }
- + else
- + activeChar.sendMessage("You need "+Config.DONATE_ADENA+" "+donateItemName+" to get 50kk adena!");
- + }
- + else if(command.equals("addCursedWeapon"))
- + {
- + for(CursedWeapon cw : CursedWeaponsManager.getInstance().getCursedWeapons())
- + if (!cw.isActive())
- + {
- + if(activeChar.getInventory().destroyItemByItemId("Donate", Config.DONATE_ITEM_ID, Config.DONATE_CURSED_WEAPON, activeChar, true) != null)
- + {
- + activeChar.addItem("Donate", cw.getItemId(), 1, activeChar, true);
- + cw.setEndTime(System.currentTimeMillis() + cw.getDuration() * 60000L);
- + cw.reActivate();
- + activeChar.sendMessage("You have earned Cursed Weapon for "+Config.DONATE_CURSED_WEAPON+" "+donateItemName+"!");
- + setToShowPage(activeChar);
- + return;
- + }
- + }
- + activeChar.sendMessage("You need "+Config.DONATE_CURSED_WEAPON+" "+donateItemName+" to get Cursed Weapon and at least one of them cannot be used!");
- + }
- + else if(command.equals("enchantWeapon"))
- + {
- + L2ItemInstance weapon = activeChar.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
- + if(weapon != null)
- + {
- + if(activeChar.getInventory().destroyItemByItemId("Donate", Config.DONATE_ITEM_ID, Config.DONATE_ENCHANT_WEAPON, activeChar, true) != null)
- + {
- + activeChar.getInventory().unEquipItemInSlot(Inventory.PAPERDOLL_RHAND);
- + weapon.setEnchantLevel(weapon.getEnchantLevel()+1);
- + activeChar.getInventory().equipItem(weapon);
- +
- + InventoryUpdate iu = new InventoryUpdate();
- + iu.addModifiedItem(weapon);
- + activeChar.sendPacket(iu);
- + activeChar.sendMessage("Your Weapon has been enchanted for "+Config.DONATE_ENCHANT_WEAPON+" "+donateItemName+"!");
- + }
- + else
- + activeChar.sendMessage("You need "+Config.DONATE_ENCHANT_WEAPON+" "+donateItemName+" to enchant your weapon!");
- + }
- + }
- + else if(command.equals("enchantArmor"))
- + {
- + int[] armorParts = {Inventory.PAPERDOLL_HEAD, Inventory.PAPERDOLL_CHEST, Inventory.PAPERDOLL_LEGS, Inventory.PAPERDOLL_GLOVES, Inventory.PAPERDOLL_FEET};
- + L2ItemInstance weakestArmor = null;
- + int weakestEnchantLevel = 100;
- + for(int part : armorParts)
- + {
- + L2ItemInstance armor = activeChar.getInventory().getPaperdollItem(part);
- + if(armor != null && armor.getEnchantLevel()<weakestEnchantLevel)
- + {
- + weakestEnchantLevel = armor.getEnchantLevel();
- + weakestArmor = armor;
- + }
- + }
- + if(weakestArmor != null)
- + {
- + if(activeChar.getInventory().destroyItemByItemId("Donate", Config.DONATE_ITEM_ID, Config.DONATE_ENCHANT_ARMOR, activeChar, true) != null)
- + {
- + weakestArmor.setEnchantLevel(weakestArmor.getEnchantLevel()+1);
- + InventoryUpdate iu = new InventoryUpdate();
- + iu.addModifiedItem(weakestArmor);
- + activeChar.sendPacket(iu);
- + activeChar.sendMessage("Your armor part has been enchanted for "+Config.DONATE_ENCHANT_ARMOR+" "+donateItemName+"!");
- + }
- + else
- + activeChar.sendMessage("You need "+Config.DONATE_ENCHANT_ARMOR+" "+donateItemName+" to enchant your armor part!");
- + }
- + }
- + else if(command.equals("enchantJewely"))
- + {
- + int[] jewelyParts = {Inventory.PAPERDOLL_LFINGER, Inventory.PAPERDOLL_RFINGER, Inventory.PAPERDOLL_LEAR, Inventory.PAPERDOLL_REAR, Inventory.PAPERDOLL_NECK};
- + L2ItemInstance weakestJewely = null;
- + int weakestEnchantLevel = 100;
- + for(int part : jewelyParts)
- + {
- + L2ItemInstance jewely = activeChar.getInventory().getPaperdollItem(part);
- + if(jewely != null && jewely.getEnchantLevel()<weakestEnchantLevel)
- + {
- + weakestEnchantLevel = jewely.getEnchantLevel();
- + weakestJewely = jewely;
- + }
- + }
- + if(weakestJewely != null)
- + {
- + if(activeChar.getInventory().destroyItemByItemId("Donate", Config.DONATE_ITEM_ID, Config.DONATE_ENCHANT_JEWELY, activeChar, true) != null)
- + {
- + weakestJewely.setEnchantLevel(weakestJewely.getEnchantLevel()+1);
- + InventoryUpdate iu = new InventoryUpdate();
- + iu.addModifiedItem(weakestJewely);
- + activeChar.sendPacket(iu);
- + activeChar.sendMessage("Your jewely has been enchanted for "+Config.DONATE_ENCHANT_JEWELY+" "+donateItemName+"!");
- + }
- + else
- + activeChar.sendMessage("You need "+Config.DONATE_ENCHANT_JEWELY+" "+donateItemName+" to enchant your jewely!");
- + }
- + }
- + setToShowPage(activeChar);
- + }
- +
- + private static void showPage(L2PcInstance activeChar, String[][] buttons)
- + {
- + String text = "<html><head><title>Donate Page</title></head><body>";
- + text += "";
- + text += "<center>";
- + text += "<table width=230>";
- + int buttonIndex = 0;
- + for(int i = 0;i<Math.ceil(buttons.length/(double)2);i++)
- + {
- + text += "<tr>";
- + for(int x = 0;x<2;x++)
- + {
- + if(buttonIndex < buttons.length)
- + text += "<td align=center><img src=\""+buttons[buttonIndex][2]+"\" width=32 height=32></td>";
- + else
- + text += "<td></td>";
- + buttonIndex++;
- + }
- + buttonIndex -= 2;
- + text += "</tr>";
- + text += "<tr><td></td></tr>";
- + text += "<tr>";
- +
- + for(int x = 0;x<2;x++)
- + {
- + if(buttonIndex < buttons.length)
- + text += "<td align=center><button value=\""+buttons[buttonIndex][0]+"\" action=\"bypass -h _donate "+buttons[buttonIndex][1]+"\" width=130 height=26 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td>";
- + else
- + text += "<td></td>";
- + buttonIndex++;
- + }
- + text += "</tr>";
- + text += "<tr><td></td></tr>";
- + }
- +
- + text += "<tr><td></td><td align=center><button value=\"Next Page\" action=\"bypass -h _donate cPage\" width=85 height=26 back=\"L2UI_ct1.button_df\" fore=\"L2UI_ct1.button_df\"></td><td></td></tr>";
- + text += "</body></html>";
- +
- + NpcHtmlMessage msg = new NpcHtmlMessage(activeChar.getObjectId());
- + msg.setHtml(text);
- + activeChar.sendPacket(msg);
- + }
- +
- + public static void setToShowPage(L2PcInstance activeChar)
- + {
- + String[][] buttons;
- + if(activeChar.isInsideZone(L2Character.ZONE_PEACE))
- + buttons = townButtons;
- + else
- + buttons = combatButtons;
- +
- + showPage(activeChar, buttons);
- + }
- +
- + @Override
- + public String[] getVoicedCommandList()
- + {
- + return VOICED_COMMANDS;
- + }
- +}
- \ No newline at end of file
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement