|
Флудер
Регистрация: 20.01.2015
Сообщений: 7,201
С нами:
5952720
Репутация:
6527
|
|
Сообщение от Спойлер
public class HeroItems extends Functions
{
//TODO: Bonux, переделать, чтобы было мультиязычное!
private static final String[][] HERO_ITEMS = {
{
"6611",
"weapon_the_sword_of_hero_i00",
"Infinity Blade",
"During a critical attack, decreases one's P. Def and increases de-buff casting ability, damage shield effect, Max HP, Max MP, Max CP, and shield defense power. Also enhances damage to target during PvP.",
"524/230",
"Sword" },
{
"6612",
"weapon_the_two_handed_sword_of_hero_i00",
"Infinity Cleaver",
"Increases Max HP, Max CP, critical power and critical chance. Inflicts extra damage when a critical attack occurs and has possibility of reflecting the skill back on the player. Also enhances damage to target during PvP.",
"638/230",
"Two Handed Sword" },
{
"6613",
"weapon_the_axe_of_hero_i00",
"Infinity Axe",
"During a critical attack, it bestows one the ability to cause internal conflict to one's opponent. Damage shield function, Max HP, Max MP, Max CP as well as one's shield defense rate are increased. It also enhances damage to one's opponent during PvP.",
"524/230",
"Blunt" },
{
"6614",
"weapon_the_mace_of_hero_i00",
"Infinity Rod",
"When good magic is casted upon a target, increases MaxMP, MaxCP, Casting Spd, and MP regeneration rate. Also recovers HP 100% and enhances damage to target during PvP.",
"420/307",
"Blunt" },
{
"6615",
"weapon_the_hammer_of_hero_i00",
"Infinity Crusher",
"Increases MaxHP, MaxCP, and Atk. Spd. Stuns a target when a critical attack occurs and has possibility of reflecting the skill back on the player. Also enhances damage to target during PvP.",
"638/230",
"Blunt" },
{
"6616",
"weapon_the_staff_of_hero_i00",
"Infinity Scepter",
"When casting good magic, it can recover HP by 100% at a certain rate, increases MAX MP, MaxCP, M. Atk., lower MP Consumption, increases the Magic Critical rate, and reduce the Magic Cancel. Enhances damage to target during PvP.",
"511/337",
"Blunt" },
{
"6617",
"weapon_the_dagger_of_hero_i00",
"Infinity Stinger",
"Increases MaxMP, MaxCP, Atk. Spd., MP regen rate, and the success rate of Mortal and Deadly Blow from the back of the target. Silences the target when a critical attack occurs and has Vampiric Rage effect. Also enhances damage to target during PvP.",
"458/230",
"Dagger" },
{
"6618",
"weapon_the_fist_of_hero_i00",
"Infinity Fang",
"Increases MaxHP, MaxMP, MaxCP and evasion. Stuns a target when a critical attack occurs and has possibility of reflecting the skill back on the player at a certain probability rate. Also enhances damage to target during PvP.",
"638/230",
"Dual Fist" },
{
"6619",
"weapon_the_bow_of_hero_i00",
"Infinity Bow",
"Increases MaxMP/MaxCP and decreases re-use delay of a bow. Slows target when a critical attack occurs and has Cheap Shot effect. Also enhances damage to target during PvP.",
"952/230",
"Bow" },
{
"6620",
"weapon_the_dualsword_of_hero_i00",
"Infinity Wing",
"When a critical attack occurs, increases MaxHP, MaxMP, MaxCP and critical chance. Silences the target and has possibility of reflecting the skill back on the target. Also enhances damage to target during PvP.",
"638/230",
"Dual Sword" },
{
"6621",
"weapon_the_pole_of_hero_i00",
"Infinity Spear",
"During a critical attack, increases MaxHP, Max CP, Atk. Spd. and Accuracy. Casts dispel on a target and has possibility of reflecting the skill back on the target. Also enhances damage to target during PvP.",
"524/230",
"Pole" },
{
"9388",
"weapon_infinity_rapier_i00",
"Infinity Rapier",
"Decreases the target P. Def and increases the de-buff casting ability, the damage shield ability, and the Max HP/Max MP/Max CP on a critical attack. Increases damage inflicted during PvP.A critical attack will have a chance to increase P. Atk., M. Atk., and healing power, and decrease MP consumption during skill use, for you and your party members.",
"475/230",
"Rapier" },
{
"9389",
"weapon_infinity_sword_i00",
"Infinity Sword",
"Increases critical attack success rate/power, MaxHP, MaxCP, and damage inflicted during PvP. Also inflicts extra damage on critical attacks, and reflects debuff attacks back on enemies.",
"568/230",
"Ancient Sword" },
{
"9390",
"weapon_infinity_shooter_i00",
"Infinity Shooter",
"Produces the following effects when a critical attack occurs: the target is slowed, decrease MP consumption for skill use, and increase Max MP/Max CP. Enhances damage done to the target during PvP.",
"584/230",
"Crossbow" } };
public void rendershop(String[] val)
{
Player player = getSelf();
NpcInstance npc = getNpc();
if(player == null || npc == null)
return;
String fileName = OLYMPIAD_HTML_PATH;
boolean succ = true;
if(!player.isHero())
{
fileName += "monument_weapon_no_hero.htm";
succ = false;
}
else
{
for(String heroItem[] : HERO_ITEMS)
{
int itemId = Integer.parseInt(heroItem[0]);
if(player.getInventory().getItemByItemId(itemId) != null)
{
fileName += "monument_weapon_have.htm";
succ = false;
break;
}
}
}
if(!succ)
{
npc.showChatWindow(player, fileName);
return;
}
boolean isKamael = player.getRace() == Race.kamael;
String htmltext = "";
if(val[0].equalsIgnoreCase("list"))
{
htmltext = "List of Hero Weapons:";
for(int i = isKamael ? 11 : 0; i ";
htmltext += "";
htmltext += "[" + HERO_ITEMS[2] + "]";
htmltext += "Type: " + HERO_ITEMS[5] + ", Patk/Matk: " + HERO_ITEMS[4];
htmltext += "";
}
htmltext += "";
}
else if(Integer.parseInt(val[0]) >= 0 && Integer.parseInt(val[0]) 10 ? 2234 : 1484;
htmltext = "Item Information:";
htmltext += "";
htmltext += "";
htmltext += "";
htmltext += "";
htmltext += "[" + HERO_ITEMS[itemIndex][2] + "]";
htmltext += "Type: " + HERO_ITEMS[itemIndex][5] + ", Patk/Matk: " + HERO_ITEMS[itemIndex][4] + "";
htmltext += "";
htmltext += "" + HERO_ITEMS[itemIndex][3] + "";
htmltext += "
";
htmltext += "
";
htmltext += "";
}
show(htmltext, player, npc);
}
public void getweapon(String[] var)
{
Player player = getSelf();
if(player == null)
return;
int item = Integer.parseInt(var[0]);
if(item 6621 || item 9390)
{
System.out.println(player.getName() + " tried to obtain non hero item using hero weapon service. Ban him!");
return;
}
NpcInstance npc = getNpc();
if(npc == null)
return;
String fileName = OLYMPIAD_HTML_PATH;
if(player.isHero())
{
boolean have = false;
for(String heroItem[] : HERO_ITEMS)
{
int itemId = Integer.parseInt(heroItem[0]);
if(player.getInventory().getItemByItemId(itemId) != null)
{
fileName += "monument_weapon_have.htm";
have = true;
break;
}
}
if(!have)
{
ItemFunctions.addItem(player, item, 1, true);
fileName += "monument_weapon_give.htm";
}
}
else
fileName += "monument_weapon_no_hero.htm";
npc.showChatWindow(player, fileName);
}
public String getcir()
{
Player player = getSelf();
if(player == null)
return null;
NpcInstance npc = getNpc();
if(npc == null)
return null;
String fileName = OLYMPIAD_HTML_PATH;
if(player.isHero())
{
if(player.getInventory().getItemByItemId(6842) != null)
fileName += "monument_circlet_have.htm";
else
{
ItemFunctions.addItem(player, 6842, 1, true); //Wings of Destiny Circlet
fileName += "monument_circlet_give.htm";
}
}
else
fileName += "monument_circlet_no_hero.htm";
npc.showChatWindow(player, fileName);
return null;
}
}
[/I]
Госпади упаси мои глаза, зачем сделать инстанс и в нём проверку на хиро оружия? Лучше фейк сервисов с кучей левого кода.
Сообщение от Спойлер
package services;
import java.util.ArrayList;
import core.gameserver.Config;
import core.gameserver.model.SimpleSpawner;
import core.gameserver.scripts.Functions;
import core.gameserver.scripts.ScriptFile;
public class FightClub extends Functions implements ScriptFile
{
private static final ArrayList _spawns_fight_club_manager = new ArrayList();
public static int FIGHT_CLUB_MANAGER = 13112;
private void spawnFightClub()
{
final int FIGHT_CLUB_MANAGER_SPAWN[][] = {
{ 82248, 147544, -3494, 13828 }, // Giran
{ 147480, 27288, -2228, 49151 }, // Aden
{ 82536, 53144, -1521, 0 }, // Oren
{ 16184, 144440, -3054, 16383 }, // Dion
{ 112488, 220264, -3627, 32767 }, // Heine
{ -15048, 121944, -3074, 0 }, // Gludio
{ 147384, -55352, -2759, 60699 }, // Goddard
{ 87688, -143352, -1318, 29412 }, // Shuttgard
{ -84776, 150904, -3154, 0 }, // Gludin
{ 36312, -48232, -1120, 0 }, // Rune
};
SpawnNPCs(FIGHT_CLUB_MANAGER, FIGHT_CLUB_MANAGER_SPAWN, _spawns_fight_club_manager);
}
@Override
public void onLoad()
{
if(Config.FIGHT_CLUB_ENABLED)
spawnFightClub();
}
@Override
public void onReload()
{}
@Override
public void onShutdown()
{}
}
Не легче ли создать группу спавна и сделать менеджером или в самом спавнере.
Сообщение от Спойлер
package services;
import java.util.ArrayList;
import java.util.List;
import core.gameserver.model.Creature;
import core.gameserver.model.Player;
import core.gameserver.model.base.Race;
import core.gameserver.model.instances.NpcInstance;
import core.gameserver.network.l2.s2c.MagicSkillUse;
import core.gameserver.scripts.Functions;
import core.gameserver.tables.SkillTable;
public class SupportMagic extends Functions
{
private final static int[][] _mageBuff = new int[][]{
// minlevel maxlevel skill skilllevel
{6, 75, 4322, 1}, // windwalk
{6, 75, 4323, 1}, // shield
{6, 75, 5637, 1}, // Magic Barrier 1
{6, 75, 4328, 1}, // blessthesoul
{6, 75, 4329, 1}, // acumen
{6, 75, 4330, 1}, // concentration
{6, 75, 4331, 1}, // empower
{16, 34, 4338, 1}, // life cubic
};
private final static int[][] _warrBuff = new int[][]{
// minlevel maxlevel skill
{6, 75, 4322, 1}, // windwalk
{6, 75, 4323, 1}, // shield
{6, 75, 5637, 1}, // Magic Barrier 1
{6, 75, 4324, 1}, // btb
{6, 75, 4325, 1}, // vampirerage
{6, 75, 4326, 1}, // regeneration
{6, 39, 4327, 1}, // haste 1
{40, 75, 5632, 1}, // haste 2
{16, 34, 4338, 1}, // life cubic
};
private final static int[][] _summonBuff = new int[][]{
// minlevel maxlevel skill
{6, 75, 4322, 1}, // windwalk
{6, 75, 4323, 1}, // shield
{6, 75, 5637, 1}, // Magic Barrier 1
{6, 75, 4324, 1}, // btb
{6, 75, 4325, 1}, // vampirerage
{6, 75, 4326, 1}, // regeneration
{6, 75, 4328, 1}, // blessthesoul
{6, 75, 4329, 1}, // acumen
{6, 75, 4330, 1}, // concentration
{6, 75, 4331, 1}, // empower
{6, 39, 4327, 1}, // haste 1
{40, 75, 5632, 1}, // haste 2
};
private final static int minSupLvl = 6;
private final static int maxSupLvl = 75;
public void getSupportMagic()
{
Player player = getSelf();
NpcInstance npc = getNpc();
doSupportMagic(npc, player, false);
}
public void getSupportServitorMagic()
{
Player player = getSelf();
NpcInstance npc = getNpc();
doSupportMagic(npc, player, true);
}
public void getProtectionBlessing()
{
Player player = getSelf();
NpcInstance npc = getNpc();
// Не выдаём блессиг протекшена ПКшникам.
if(player.getKarma() > 0)
return;
if(player.getLevel() > 39 || player.getClassId().getLevel() >= 3)
{
show("default/newbie_blessing_no.htm", player, npc);
return;
}
npc.doCast(SkillTable.getInstance().getInfo(5182, 1), player, true);
}
public static void doSupportMagic(NpcInstance npc, Player player, boolean servitor)
{
// Prevent a cursed weapon weilder of being buffed
if(player.isCursedWeaponEquipped())
return;
int lvl = player.getLevel();
if(servitor && (player.getPet() == null || !player.getPet().isSummon()))
{
show("default/newbie_nosupport_servitor.htm", player, npc);
return;
}
else
{
if(lvl maxSupLvl)
{
show("default/newbie_nosupport_max.htm", player, npc);
return;
}
}
List target = new ArrayList();
if(servitor)
{
target.add(player.getPet());
for(int[] buff : _summonBuff)
if(lvl >= buff[0] && lvl = buff[0] && lvl = buff[0] && lvl ";
append += "Список доступных локаций:
";
}
else
{
append += "Teleport to catacomb or necropolis. ";
append += "You may teleport to any of the following hunting locations.
";
}
if(player.getLevel() ";
append += "[scripts_Util:Gatekeeper 45248 124223 -5408 0|The Pilgrim's Necropolis (30-40)]";
append += "[scripts_Util:Gatekeeper 110911 174013 -5439 0|Necropolis of Worship (40-50)]";
append += "[scripts_Util:Gatekeeper -22101 77383 -5173 0|The Patriot's Necropolis (50-60)]";
append += "[scripts_Util:Gatekeeper -52654 79149 -4741 0|Necropolis of Devotion (60-70)]";
append += "[scripts_Util:Gatekeeper 117884 132796 -4831 0|Necropolis of Martyrdom (60-70)]";
append += "[scripts_Util:Gatekeeper 82750 209250 -5401 0|The Saint's Necropolis (70-80)]";
append += "[scripts_Util:Gatekeeper 171897 -17606 -4901 0|Disciples Necropolis(70-80)]
";
append += "[scripts_Util:Gatekeeper 42322 143927 -5381 0|Catacomb of the Heretic (30-40)]";
append += "[scripts_Util:Gatekeeper 45841 170307 -4981 0|Catacomb of the Branded (40-50)]";
append += "[scripts_Util:Gatekeeper 77348 78445 -5125 0|Catacomb of the Apostate (50-60)]";
append += "[scripts_Util:Gatekeeper 139955 79693 -5429 0|Catacomb of the Witch (60-70)]";
append += "[scripts_Util:Gatekeeper -19827 13509 -4901 0|Catacomb of Dark Omens (70-80)]";
append += "[scripts_Util:Gatekeeper 113573 84513 -6541 0|Catacomb of the Forbidden Path (70-80)]";
}
else
{
append += "[scripts_Util:Gatekeeper -41567 209463 -5080 10000|Necropolis of Sacrifice (20-30) - 10000 Adena]";
append += "[scripts_Util:Gatekeeper 45248 124223 -5408 20000|The Pilgrim's Necropolis (30-40) - 20000 Adena]";
append += "[scripts_Util:Gatekeeper 110911 174013 -5439 30000|Necropolis of Worship (40-50) - 30000 Adena]";
append += "[scripts_Util:Gatekeeper -22101 77383 -5173 40000|The Patriot's Necropolis (50-60) - 40000 Adena]";
append += "[scripts_Util:Gatekeeper -52654 79149 -4741 50000|Necropolis of Devotion (60-70) - 50000 Adena]";
append += "[scripts_Util:Gatekeeper 117884 132796 -4831 50000|Necropolis of Martyrdom (60-70) - 50000 Adena]";
append += "[scripts_Util:Gatekeeper 82750 209250 -5401 60000|The Saint's Necropolis (70-80) - 60000 Adena]";
append += "[scripts_Util:Gatekeeper 171897 -17606 -4901 60000|Disciples Necropolis(70-80) - 60000 Adena]
";
append += "[scripts_Util:Gatekeeper 42322 143927 -5381 20000|Catacomb of the Heretic (30-40) - 20000 Adena]";
append += "[scripts_Util:Gatekeeper 45841 170307 -4981 30000|Catacomb of the Branded (40-50) - 30000 Adena]";
append += "[scripts_Util:Gatekeeper 77348 78445 -5125 40000|Catacomb of the Apostate (50-60) - 40000 Adena]";
append += "[scripts_Util:Gatekeeper 139955 79693 -5429 50000|Catacomb of the Witch (60-70) - 50000 Adena]";
append += "[scripts_Util:Gatekeeper -19827 13509 -4901 60000|Catacomb of Dark Omens (70-80) - 60000 Adena]";
append += "[scripts_Util:Gatekeeper 113573 84513 -6541 60000|Catacomb of the Forbidden Path (70-80) - 60000 Adena]";
}
return append;
}
}
Ну просто отличная реализация в катакомбы нечего сказать.
Остальные фейк сервисы(да да фейк, это не сервисы) я не стану расписывать т.к однотипно оно сделано, я пойду дальше в кб.
Сообщение от Спойлер
package services.community;
import java.util.StringTokenizer;
import core.gameserver.Config;
import core.gameserver.data.htm.HtmCache;
import core.gameserver.handler.bbs.CommunityBoardManager;
import core.gameserver.model.base.Element;
import core.gameserver.network.l2.s2c.ShowBoard;
import core.gameserver.scripts.Functions;
import core.gameserver.model.Player;
import core.gameserver.model.items.ItemInstance;
import core.gameserver.data.xml.holder.ItemHolder;
import core.gameserver.network.l2.s2c.InventoryUpdate;
import core.gameserver.handler.bbs.ICommunityBoardHandler ;
import core.gameserver.templates.item.EtcItemTemplate;
import core.gameserver.network.l2.components.SystemMsg;
import core.gameserver.model.base.TeamType;
import core.gameserver.templates.item.ItemTemplate;
import core.gameserver.scripts.ScriptFile;
import core.gameserver.templates.item.ArmorTemplate.Armor Type;
import core.gameserver.templates.item.support.EnchantItem ;
import core.gameserver.utils.BbsUtil;
import core.gameserver.utils.Log;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class ManageEnchant extends Functions implements ScriptFile, ICommunityBoardHandler
{
static final Logger _log = LoggerFactory.getLogger(ManageEnchant.class);
private int enchant_item = Config.COMMUNITYBOARD_ENCHANT_ITEM;
private int max_enchant = Config.COMMUNITYBOARD_MAX_ENCHANT;
private int[] enchant_level = Config.COMMUNITYBOARD_ENCHANT_LVL;
private int[] ench_price_weapon = Config.COMMUNITYBOARD_ENCHANT_PRICE_WEAPON;
private int[] ench_price_armor = Config.COMMUNITYBOARD_ENCHANT_PRICE_ARMOR;
private int[] atr_lvl_weapon = Config.COMMUNITYBOARD_ENCHANT_ATRIBUTE_LVL_WEAPON;
private int[] atr_price_weapon = Config.COMMUNITYBOARD_ENCHANT_ATRIBUTE_PRICE_WEAPO N;
private int[] atr_lvl_armor = Config.COMMUNITYBOARD_ENCHANT_ATRIBUTE_LVL_ARMOR;
private int[] atr_price_armor = Config.COMMUNITYBOARD_ENCHANT_ATRIBUTE_PRICE_ARMOR ;
private boolean atr_pvp = Config.COMMUNITYBOARD_ENCHANT_ATRIBUTE_PVP;
@Override
public void onLoad(){
if(Config.COMMUNITYBOARD_ENABLED)
{
_log.info("CommunityBoard: Enchant Community service loaded.");
CommunityBoardManager.getInstance().registerHandle r(this);
}
}
@Override
public void onReload(){
if(Config.COMMUNITYBOARD_ENABLED)
{
CommunityBoardManager.getInstance().removeHandler( this);
}
}
@Override
public void onShutdown(){}
@Override
public String[] getBypassCommands(){
return new String[] {
"_cbbsechant",
"_cbbsechantlist",
"_cbbsechantChus",
"_cbbsechantAtr",
"_cbbsechantgo",
"_cbbsechantuseAtr"
};
}
@Override
public void onBypassCommand(Player activeChar, String bypass){
if(!CheckCondition(activeChar))
return;
if (bypass.startsWith("_cbbsechant"))
{
String name = "None Name";
String html = HtmCache.getInstance().getNotNull(Config.BBS_HOME_ DIR + "pages/enchant.htm", activeChar);
name = ItemHolder.getInstance().getTemplate(enchant_item) .getName();
StringBuilder sb = new StringBuilder("");
sb.append("");
ItemInstance[] arr = activeChar.getInventory().getItems();
int len = arr.length;
for (int i = 0; i = 7816 && _item.getItemId() = (max_enchant + 1) || !_item.canBeEnchanted(true)
|| _item.getEquipSlot() == ItemTemplate.SLOT_HAIR || _item.getEquipSlot() == ItemTemplate.SLOT_DHAIR)
continue;
sb.append(new StringBuilder(""));
sb.append(new StringBuilder("" + _item.getTemplate().getName() + " " + (_item.getEnchantLevel() Заточено на: +" + _item.getEnchantLevel())) + ""));
sb.append(new StringBuilder("Заточка за: " + name + ""));
sb.append("");
sb.append("");
if(Config.ALLOW_BBS_ENCHANT_ELEMENTAR)
sb.append(new StringBuilder(""));
sb.append("");
if(Config.ALLOW_BBS_ENCHANT_ATT)
sb.append(new StringBuilder(""));
sb.append("");
}
sb.append("");
html = html.replace("%enchanter%", sb.toString());
html = BbsUtil.htmlBuff(html, activeChar);
ShowBoard.separateAndSend(html, activeChar);
}
if (bypass.startsWith("_cbbsechantlist"))
{
StringTokenizer st2 = new StringTokenizer(bypass, ";");
String[] mBypass = st2.nextToken().split(":");
int ItemForEchantObjID = Integer.parseInt(mBypass[1]);
String name = "None Name";
String html = HtmCache.getInstance().getNotNull(Config.BBS_HOME_ DIR + "pages/enchant.htm", activeChar);
name = ItemHolder.getInstance().getTemplate(enchant_item) .getName();
ItemInstance EhchantItem = activeChar.getInventory().getItemByObjectId(ItemFo rEchantObjID);
StringBuilder sb = new StringBuilder("");
sb.append("Для обычной заточки выбрана вещь:");
sb.append(new StringBuilder(" "));
sb.append(new StringBuilder("" + EhchantItem.getTemplate().getName() + " " + (EhchantItem.getEnchantLevel() Заточено на: +" + EhchantItem.getEnchantLevel())) + ""));
sb.append(new StringBuilder("Заточка производится за: " + name + ""));
sb.append("");
sb.append(new StringBuilder(" "));
sb.append("");
sb.append("");
sb.append("
");
sb.append("
");
sb.append("");
for(int i = 0; i "));
//sb.append("");
}
sb.append("");
html = html.replace("%enchanter%", sb.toString());
html = BbsUtil.htmlBuff(html, activeChar);
ShowBoard.separateAndSend(html, activeChar);
}
if (bypass.startsWith("_cbbsechantChus"))
{
StringTokenizer st2 = new StringTokenizer(bypass, ";");
String[] mBypass = st2.nextToken().split(":");
int ItemForEchantObjID = Integer.parseInt(mBypass[1]);
String name = "None Name";
String html = HtmCache.getInstance().getNotNull(Config.BBS_HOME_ DIR + "pages/enchant.htm", activeChar);
name = ItemHolder.getInstance().getTemplate(enchant_item) .getName();
ItemInstance EhchantItem = activeChar.getInventory().getItemByObjectId(ItemFo rEchantObjID);
StringBuilder sb = new StringBuilder("");
sb.append("Для заточки на атрибут выбрана вещь:
");
sb.append(new StringBuilder(" "));
sb.append(new StringBuilder("" + EhchantItem.getTemplate().getName() + " " + (EhchantItem.getEnchantLevel() Заточено на: +" + EhchantItem.getEnchantLevel())) + ""));
sb.append(new StringBuilder("Заточка производится за: " + name + ""));
sb.append("");
sb.append(new StringBuilder(" "));
sb.append("");
sb.append("");
sb.append("
");
sb.append("
");
sb.append("");
sb.append("
");
sb.append(new StringBuilder(""));
sb.append("
");
sb.append(new StringBuilder(""));
sb.append("
");
sb.append(new StringBuilder(""));
sb.append("");
sb.append("
");
sb.append(new StringBuilder(""));
sb.append("
");
sb.append(new StringBuilder(""));
sb.append("
");
sb.append(new StringBuilder(""));
sb.append("");
html = html.replace("%enchanter%", sb.toString());
html = BbsUtil.htmlBuff(html, activeChar);
ShowBoard.separateAndSend(html, activeChar);
}
if (bypass.startsWith("_cbbsechantAtr"))
{
StringTokenizer st2 = new StringTokenizer(bypass, ";");
String[] mBypass = st2.nextToken().split(":");
int AtributType = Integer.parseInt(mBypass[1]);
int ItemForEchantObjID = Integer.parseInt(mBypass[2]);
String ElementName = "";
if (AtributType == 0)
ElementName = "Fire";
else if (AtributType == 1)
ElementName = "Water";
else if (AtributType == 2)
ElementName = "Wind";
else if (AtributType == 3)
ElementName = "Earth";
else if (AtributType == 4)
ElementName = "Divine";
else if (AtributType == 5)
ElementName = "Dark";
String name = "None Name";
String html = HtmCache.getInstance().getNotNull(Config.BBS_HOME_ DIR + "pages/enchant.htm", activeChar);
name = ItemHolder.getInstance().getTemplate(enchant_item) .getName();
ItemInstance EhchantItem = activeChar.getInventory().getItemByObjectId(ItemFo rEchantObjID);
StringBuilder sb = new StringBuilder("");
sb.append(new StringBuilder("Выбран элемент: " + ElementName + " Для заточки выбрана вещь:"));
sb.append(new StringBuilder(" "));
sb.append(new StringBuilder("" + EhchantItem.getTemplate().getName() + " " + (EhchantItem.getEnchantLevel() Заточено на: +" + EhchantItem.getEnchantLevel())) + ""));
sb.append(new StringBuilder("Заточка производится за: " + name + ""));
sb.append("");
sb.append(new StringBuilder(" "));
sb.append("");
sb.append("");
sb.append("");
if (EhchantItem.getTemplate().getCrystalType() == ItemTemplate.Grade.S || EhchantItem.getTemplate().getCrystalType() == ItemTemplate.Grade.S80 || EhchantItem.getTemplate().getCrystalType() == ItemTemplate.Grade.S84)
{
sb.append("");
for(int i = 0; i "));
sb.append("");
}
sb.append("");
}
else if (EhchantItem.getTemplate().getCrystalType() == ItemTemplate.Grade.S || EhchantItem.getTemplate().getCrystalType() == ItemTemplate.Grade.S80 || EhchantItem.getTemplate().getCrystalType() == ItemTemplate.Grade.S84)
{
sb.append("");
for(int i = 0; i "));
sb.append("");
}
sb.append("");
sb.append("");
}
else
{
sb.append("");
sb.append("");
sb.append("");
sb.append("");
sb.append("");
sb.append("Заточка данной вещи не возможна!");
sb.append("");
sb.append("");
sb.append("");
sb.append("");
sb.append("");
}
sb.append("");
html = html.replace("%enchanter%", sb.toString());
html = BbsUtil.htmlBuff(html, activeChar);
ShowBoard.separateAndSend(html, activeChar);
}
if (bypass.startsWith("_cbbsechantgo"))
{
StringTokenizer st2 = new StringTokenizer(bypass, ";");
String[] mBypass = st2.nextToken().split(":");
int EchantVal = Integer.parseInt(mBypass[1]);
int EchantPrice = Integer.parseInt(mBypass[2]);
int EchantObjID = Integer.parseInt(mBypass[3]);
ItemTemplate item = ItemHolder.getInstance().getTemplate(enchant_item) ;
ItemInstance pay = activeChar.getInventory().getItemByItemId(item.get ItemId());
ItemInstance EhchantItem = activeChar.getInventory().getItemByObjectId(Echant ObjID);
if (pay != null && pay.getCount() >= EchantPrice)
{
activeChar.getInventory().destroyItem(pay, EchantPrice);
EhchantItem.setEnchantLevel(EchantVal);
activeChar.getInventory().equipItem(EhchantItem);
activeChar.sendPacket(new InventoryUpdate().addModifiedItem(EhchantItem));
activeChar.broadcastUserInfo(true);
activeChar.broadcastCharInfo();
activeChar.sendMessage(new StringBuilder("" + EhchantItem.getTemplate().getName() + " было заточено до " + EchantVal + ".").toString());
Log.add(new StringBuilder(activeChar.getName() + " enchant item:" + EhchantItem.getTemplate().getName() + " val: " + EchantVal + "").toString(), "wmzSeller");
onBypassCommand(activeChar, "_cbbsechant");
}
else
activeChar.sendPacket(SystemMsg.INCORRECT_ITEM_COU NT);
}
if (bypass.startsWith("_cbbsechantuseAtr"))
{
StringTokenizer st2 = new StringTokenizer(bypass, ";");
String[] mBypass = st2.nextToken().split(":");
int EchantVal = Integer.parseInt(mBypass[1]);
int AtrType = Integer.parseInt(mBypass[2]);
int EchantPrice = Integer.parseInt(mBypass[3]);
int EchantObjID = Integer.parseInt(mBypass[4]);
ItemTemplate item = ItemHolder.getInstance().getTemplate(enchant_item) ;
ItemInstance pay = activeChar.getInventory().getItemByItemId(item.get ItemId());
ItemInstance EhchantItem = activeChar.getInventory().getItemByObjectId(Echant ObjID);
if(EhchantItem.isWeapon()){
if (pay != null && pay.getCount() >= EchantPrice){
activeChar.getInventory().destroyItem(pay, EchantPrice);
activeChar.getInventory().unEquipItem(EhchantItem) ;
EhchantItem.setAttributeElement(getAttr(AtrType), EchantVal);
activeChar.getInventory().equipItem(EhchantItem);
activeChar.sendPacket(new InventoryUpdate().addModifiedItem(EhchantItem));
activeChar.broadcastUserInfo(true);
activeChar.sendMessage(new StringBuilder("Значение атрибута " + EhchantItem.getTemplate().getName() + " увеличено до " + EchantVal + ".").toString());
Log.add(new StringBuilder(activeChar.getName() + " enchant item:" + EhchantItem.getTemplate().getName() + " val: " + EchantVal + " AtributType:" + AtrType).toString(), "wmzSeller");
onBypassCommand(activeChar, "_cbbsechant");
}
else
activeChar.sendPacket(SystemMsg.INCORRECT_ITEM_COU NT);
}
else if(EhchantItem.isArmor()){
if(!canEnchantArmorAttribute(AtrType, EhchantItem)){
activeChar.sendMessage("Невозможно вставить аттрибут в броню, не соблюдены условия");
return;
}
if (pay != null && pay.getCount() >= EchantPrice){
activeChar.getInventory().destroyItem(pay, EchantPrice);
activeChar.getInventory().unEquipItem(EhchantItem) ;
EhchantItem.setAttributeElement(getAttr(AtrType), EchantVal);
activeChar.getInventory().equipItem(EhchantItem);
activeChar.sendPacket(new InventoryUpdate().addModifiedItem(EhchantItem));
activeChar.broadcastUserInfo(true);
activeChar.sendMessage(new StringBuilder("Значение атрибута " + EhchantItem.getTemplate().getName() + " увеличено до " + EchantVal + ".").toString());
Log.add(new StringBuilder(activeChar.getName() + " enchant item:" + EhchantItem.getTemplate().getName() + " val: " + EchantVal + " AtributType:" + AtrType).toString(), "wmzSeller");
onBypassCommand(activeChar, "_cbbsechant");
}
}
else{
if (activeChar.isLangRus())
activeChar.sendMessage("В данную вещь нельзя вставить атрибут.");
else
activeChar.sendMessage("In this thing you can not insert the attribute.");
}
}
}
public void onWriteCommand(Player player, String bypass, String arg1, String arg2, String arg3, String arg4, String arg5) {
//To change body of implemented methods use File | Settings | File Templates.
}
private boolean canEnchantArmorAttribute(int attr, ItemInstance item){
switch(attr)
{
case 0:
if(item.getDefenceWater() != 0)
return false;
break;
case 1:
if(item.getDefenceFire() != 0)
return false;
break;
case 2:
if(item.getDefenceEarth() != 0)
return false;
break;
case 3:
if(item.getDefenceWind() != 0)
return false;
break;
case 4:
if(item.getDefenceUnholy() != 0)
return false;
break;
case 5:
if(item.getDefenceHoly() != 0)
return false;
break;
}
return true;
}
private Element getAttr(int attr){
Element El = Element.NONE;
switch(attr)
{
case 0:
El = Element.FIRE;
break;
case 1:
El = Element.WATER;
break;
case 2:
El = Element.WIND;
break;
case 3:
El = Element.EARTH;
break;
case 4:
El = Element.HOLY;
break;
case 5:
El = Element.UNHOLY;
break;
}
return El;
}
private static boolean CheckCondition(Player player){
if(player == null)
return false;
if(player.isDead())
return false;
if((player.getPvpFlag() != 0 || player.isInDuel() || player.isInCombat() || player.isAttackingNow()))
{
if (player.isLangRus())
player.sendMessage("Во время боя нельзя использовать данную функцию.");
else
player.sendMessage("During combat, you can not use this feature.");
return false;
}
if (player.isInOlympiadMode())
{
if (player.isLangRus())
player.sendMessage("Во время Олимпиады нельзя использовать данную функцию.");
else
player.sendMessage("During the Olympics you can not use this feature.");
return false;
}
if (!Config.COMMUNITYBOARD_ENCHANT_ENABLED)
{
if (player.isLangRus())
player.sendMessage("Функция заточки отключена.");
else
player.sendMessage("Enchant off function.");
return false;
}
if (player.getTeam() != TeamType.NONE)
{
if (player.isLangRus())
player.sendMessage("Нельзя использовать заточку во время эвентов.");
else
player.sendMessage("You can not use the enchant during Events.");
return false;
}
return true;
}
}
Сообщение от Спойлер
[/I][/I][/I][/I][/I][/I][/I][/I][/I][/I][/I][/I][/I][/I][/I][/I][/I][/I][/I]
А теперь берём в руки hxd редактором и ловим веселье. Код просто отменного качества, достоин почёта и уважения. Остальные скрипты кб не стоит смотреть, там чёрт ногу сломит.
Сообщение от Спойлер
services/villagemaster
services/petelove
Не смотреть сюда, опасно может убить
[/I][/I][/I][/I]
|