ZloD3y 2 Опубликовано 11 октября, 2014 Как к лыжам H5 WhoAmI прикрутить (доп статы чара voice command) ? Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
L2jTeam 17 Опубликовано 11 октября, 2014 в датапаке whoami.htm, добавить статы какие нужны, проверить в ядре, их вывод. Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
ZloD3y 2 Опубликовано 11 октября, 2014 А готового нету ? Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
L2jTeam 17 Опубликовано 11 октября, 2014 У меня так реализовано, сделайте под L2jserver: package l2jTeam.gs.handler.voicecommands.impl; import java.text.NumberFormat; import java.util.Locale; import l2jTeam.gs.configuration; import l2jTeam.gs.data.htm.HtmCache; import l2jTeam.gs.handler.voicecommands.IVoicedCommandHandler; import l2jTeam.gs.models.Creature; import l2jTeam.gs.models.Player; import l2jTeam.gs.models.base.Element; import l2jTeam.gs.models.items.ItemInstance; import l2jTeam.gs.network.serverpackets.NpcHtmlMessage; import l2jTeam.gs.stats.Formulas; import l2jTeam.gs.stats.Stats; import l2jTeam.gs.templates.item.WeaponTemplate.WeaponType; import l2jTeam.gs.utils.Strings; import org.apache.commons.lang3.text.StrBuilder; public class WhoAmI implements IVoicedCommandHandler { private final String[] _commandList = new String[] { "stats", "statistics" }; @Override public String[] getVoicedCommandList() { return _commandList; } @Override public boolean useVoicedCommand(String command, Player player, String args) { Creature target = null; double hpRegen = Formulas.calcHpRegen(player); double cpRegen = Formulas.calcCpRegen(player); double mpRegen = Formulas.calcMpRegen(player); double hpDrain = player.calcStat(Stats.ABSORB_DAMAGE_PERCENT, 0., target, null); double mpDrain = player.calcStat(Stats.ABSORB_DAMAGEMP_PERCENT, 0., target, null); double hpGain = player.calcStat(Stats.HEAL_EFFECTIVNESS, 100., target, null); double mpGain = player.calcStat(Stats.MANAHEAL_EFFECTIVNESS, 100., target, null); double critPerc = 2 * player.calcStat(Stats.CRITICAL_DAMAGE, target, null); double critStatic = player.calcStat(Stats.CRITICAL_DAMAGE_STATIC, target, null); double mCritRate = player.calcStat(Stats.MCRITICAL_RATE, target, null); double blowRate = player.calcStat(Stats.FATALBLOW_RATE, target, null); ItemInstance shld = player.getSecondaryWeaponInstance(); boolean shield = shld != null && shld.getItemType() == WeaponType.NONE; double shieldDef = shield ? player.calcStat(Stats.SHIELD_DEFENCE, player.getTemplate().baseShldDef, target, null) : 0.; double shieldRate = shield ? player.calcStat(Stats.SHIELD_RATE, target, null) : 0.; double xpRate = configuration.RATE_XP * player.getBonus().getRateXp(); double spRate = configuration.RATE_SP * player.getBonus().getRateSp(); double dropRate = configuration.RATE_DROP_ITEMS * player.getBonus().getDropItems(); double adenaRate = configuration.RATE_DROP_ADENA * player.getBonus().getDropAdena(); double spoilRate = configuration.RATE_DROP_SPOIL * player.getBonus().getDropSpoil(); double fireResist = player.calcStat(Element.FIRE.getDefence(), 0., target, null); double windResist = player.calcStat(Element.WIND.getDefence(), 0., target, null); double waterResist = player.calcStat(Element.WATER.getDefence(), 0., target, null); double earthResist = player.calcStat(Element.EARTH.getDefence(), 0., target, null); double holyResist = player.calcStat(Element.HOLY.getDefence(), 0., target, null); double unholyResist = player.calcStat(Element.UNHOLY.getDefence(), 0., target, null); double bleedPower = player.calcStat(Stats.BLEED_POWER, target, null); double bleedResist = player.calcStat(Stats.BLEED_RESIST, target, null); double poisonPower = player.calcStat(Stats.POISON_POWER, target, null); double poisonResist = player.calcStat(Stats.POISON_RESIST, target, null); double stunPower = player.calcStat(Stats.STUN_POWER, target, null); double stunResist = player.calcStat(Stats.STUN_RESIST, target, null); double rootPower = player.calcStat(Stats.ROOT_POWER, target, null); double rootResist = player.calcStat(Stats.ROOT_RESIST, target, null); double sleepPower = player.calcStat(Stats.SLEEP_POWER, target, null); double sleepResist = player.calcStat(Stats.SLEEP_RESIST, target, null); double paralyzePower = player.calcStat(Stats.PARALYZE_POWER, target, null); double paralyzeResist = player.calcStat(Stats.PARALYZE_RESIST, target, null); double mentalPower = player.calcStat(Stats.MENTAL_POWER, target, null); double mentalResist = player.calcStat(Stats.MENTAL_RESIST, target, null); double debuffPower = player.calcStat(Stats.DEBUFF_POWER, target, null); double debuffResist = player.calcStat(Stats.DEBUFF_RESIST, target, null); double cancelPower = player.calcStat(Stats.CANCEL_POWER, target, null); double cancelResist = player.calcStat(Stats.CANCEL_RESIST, target, null); double swordResist = 100. - player.calcStat(Stats.SWORD_WPN_VULNERABILITY, target, null); double dualResist = 100. - player.calcStat(Stats.DUAL_WPN_VULNERABILITY, target, null); double bluntResist = 100. - player.calcStat(Stats.BLUNT_WPN_VULNERABILITY, target, null); double daggerResist = 100. - player.calcStat(Stats.DAGGER_WPN_VULNERABILITY, target, null); double bowResist = 100. - player.calcStat(Stats.BOW_WPN_VULNERABILITY, target, null); double crossbowResist = 100. - player.calcStat(Stats.CROSSBOW_WPN_VULNERABILITY, target, null); double poleResist = 100. - player.calcStat(Stats.POLE_WPN_VULNERABILITY, target, null); double fistResist = 100. - player.calcStat(Stats.FIST_WPN_VULNERABILITY, target, null); double critChanceResist = 100. - player.calcStat(Stats.CRIT_CHANCE_RECEPTIVE, target, null); double critDamResistStatic = player.calcStat(Stats.CRIT_DAMAGE_RECEPTIVE, target, null); double critDamResist = 100. - 100 * (player.calcStat(Stats.CRIT_DAMAGE_RECEPTIVE, 1., target, null) - critDamResistStatic); String dialog = HtmCache.getInstance().getNotNull("command/whoami.htm", player); NumberFormat df = NumberFormat.getInstance(Locale.ENGLISH); df.setMaximumFractionDigits(1); df.setMinimumFractionDigits(1); StrBuilder sb = new StrBuilder(dialog); sb.replaceFirst("%hpRegen%", df.format(hpRegen)); sb.replaceFirst("%cpRegen%", df.format(cpRegen)); sb.replaceFirst("%mpRegen%", df.format(mpRegen)); sb.replaceFirst("%hpDrain%", df.format(hpDrain)); sb.replaceFirst("%mpDrain%", df.format(mpDrain)); sb.replaceFirst("%hpGain%", df.format(hpGain)); sb.replaceFirst("%mpGain%", df.format(mpGain)); sb.replaceFirst("%critPerc%", df.format(critPerc)); sb.replaceFirst("%critStatic%", df.format(critStatic)); sb.replaceFirst("%mCritRate%", df.format(mCritRate)); sb.replaceFirst("%blowRate%", df.format(blowRate)); sb.replaceFirst("%shieldDef%", df.format(shieldDef)); sb.replaceFirst("%shieldRate%", df.format(shieldRate)); if(configuration.show_rates) { sb.replaceFirst("%xpRate%", df.format(xpRate)); sb.replaceFirst("%spRate%", df.format(spRate)); sb.replaceFirst("%dropRate%", df.format(dropRate)); sb.replaceFirst("%adenaRate%", df.format(adenaRate)); sb.replaceFirst("%spoilRate%", df.format(spoilRate)); } sb.replaceFirst("%fireResist%", df.format(fireResist)); sb.replaceFirst("%windResist%", df.format(windResist)); sb.replaceFirst("%waterResist%", df.format(waterResist)); sb.replaceFirst("%earthResist%", df.format(earthResist)); sb.replaceFirst("%holyResist%", df.format(holyResist)); sb.replaceFirst("%darkResist%", df.format(unholyResist)); sb.replaceFirst("%bleedPower%", df.format(bleedPower)); sb.replaceFirst("%bleedResist%", df.format(bleedResist)); sb.replaceFirst("%poisonPower%", df.format(poisonPower)); sb.replaceFirst("%poisonResist%", df.format(poisonResist)); sb.replaceFirst("%stunPower%", df.format(stunPower)); sb.replaceFirst("%stunResist%", df.format(stunResist)); sb.replaceFirst("%rootPower%", df.format(rootPower)); sb.replaceFirst("%rootResist%", df.format(rootResist)); sb.replaceFirst("%sleepPower%", df.format(sleepPower)); sb.replaceFirst("%sleepResist%", df.format(sleepResist)); sb.replaceFirst("%paralyzePower%", df.format(paralyzePower)); sb.replaceFirst("%paralyzeResist%", df.format(paralyzeResist)); sb.replaceFirst("%mentalPower%", df.format(mentalPower)); sb.replaceFirst("%mentalResist%", df.format(mentalResist)); sb.replaceFirst("%debuffPower%", df.format(debuffPower)); sb.replaceFirst("%debuffResist%", df.format(debuffResist)); sb.replaceFirst("%cancelPower%", df.format(cancelPower)); sb.replaceFirst("%cancelResist%", df.format(cancelResist)); sb.replaceFirst("%swordResist%", df.format(swordResist)); sb.replaceFirst("%dualResist%", df.format(dualResist)); sb.replaceFirst("%bluntResist%", df.format(bluntResist)); sb.replaceFirst("%daggerResist%", df.format(daggerResist)); sb.replaceFirst("%bowResist%", df.format(bowResist)); sb.replaceFirst("%crossbowResist%", df.format(crossbowResist)); sb.replaceFirst("%fistResist%", df.format(fistResist)); sb.replaceFirst("%poleResist%", df.format(poleResist)); sb.replaceFirst("%critChanceResist%", df.format(critChanceResist)); sb.replaceFirst("%critDamResist%", df.format(critDamResist)); NpcHtmlMessage msg = new NpcHtmlMessage(0); msg.setHtml(Strings.bbParse(sb.toString())); player.sendPacket(msg); return true; } } 1 Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
ZloD3y 2 Опубликовано 11 октября, 2014 Нету класса Creature и Player, буду что то думать. Спасибо Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
L2jTeam 17 Опубликовано 11 октября, 2014 Нету класса Creature и Player, буду что то думать. Спасибо L2Character.java и L2PcInstance.java Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
ZloD3y 2 Опубликовано 11 октября, 2014 (изменено) Спасибо ) Изменено 11 октября, 2014 пользователем ZloD3y Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
L2jTeam 17 Опубликовано 11 октября, 2014 Пробуйте, там надо немного структуру поменять, в принципе будет время, могу помочь с реализацией. Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
ZloD3y 2 Опубликовано 11 октября, 2014 Creature target = null; что это creature ? Пэт ? Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
L2jTeam 17 Опубликовано 11 октября, 2014 Creature target = null; что это creature ? Пэт ? Вроде того) Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
ZloD3y 2 Опубликовано 11 октября, 2014 (изменено) Почти закончил Есть переменная cl ей присваивается текст. html.setHtml(cl); ошибка html.setHtml(""+cl+""); - по идее должно работать но нифига) Все потупило и схавало ) Изменено 11 октября, 2014 пользователем ZloD3y Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
L2jTeam 17 Опубликовано 11 октября, 2014 (изменено) Заработало? Можно вывести в файл всё это, например: String filename = "data/html/command/whoami.htm"; Изменено 11 октября, 2014 пользователем L2jTeam Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
ZloD3y 2 Опубликовано 11 октября, 2014 Да, я там почти все заново переписал )) Хочу еще пару параметров дописать. Позже сюда скину готовый вариант но придется дописывать в CharStat самому т.к. я уже начал и все раскидал) Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
ZloD3y 2 Опубликовано 11 октября, 2014 или и то и то скину ) Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
L2jTeam 17 Опубликовано 11 октября, 2014 Конечно, будет полезно, поставлю + Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
ZloD3y 2 Опубликовано 11 октября, 2014 Скину завтра или позже т.к. иду гулять. Я кину 3 файла 1 сам Whoami, 1 Stats (повырезать надо), 1 CharStats(тоже повырезать что надо) Позже буду =* XD Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
ZloD3y 2 Опубликовано 11 октября, 2014 (изменено) Система реализована не очень красиво но все же работает ))) Красоту навести не сложено может позже сделаю апдейт CharStats.java package com.l2jserver.gameserver.model.actor.stat; import com.l2jserver.Config; import com.l2jserver.gameserver.model.Elementals; import com.l2jserver.gameserver.model.PcCondOverride; import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.items.L2Weapon; import com.l2jserver.gameserver.model.items.instance.L2ItemInstance; import com.l2jserver.gameserver.model.items.type.L2WeaponType; import com.l2jserver.gameserver.model.skills.L2Skill; import com.l2jserver.gameserver.model.stats.Calculator; import com.l2jserver.gameserver.model.stats.Env; import com.l2jserver.gameserver.model.stats.Stats; /* Zl0D3Y special for l2MAXI =* */ public class CharStat { private final L2Character _activeChar; private long _exp = 0; private int _sp = 0; private byte _level = 1; public CharStat(L2Character activeChar) { _activeChar = activeChar; } public final double calcStat(Stats stat, double init) { return calcStat(stat, init, null, null); } public final double calcStat(Stats stat, double init, L2Character target, L2Skill skill) { if ((_activeChar == null) || (stat == null)) { return init; } int id = stat.ordinal(); Calculator c = _activeChar.getCalculators()[id]; // If no Func object found, no modifier is applied if ((c == null) || (c.size() == 0)) { return init; } // Create and init an Env object to pass parameters to the Calculator Env env = new Env(); env.setCharacter(_activeChar); env.setTarget(target); env.setSkill(skill); env.setValue(init); // Launch the calculation c.calc(env); // avoid some troubles with negative stats (some stats should never be negative) if (env.getValue() <= 0) { switch (stat) { case MAX_HP: case MAX_MP: case MAX_CP: case MAGIC_DEFENCE: case POWER_DEFENCE: case POWER_ATTACK: case MAGIC_ATTACK: case POWER_ATTACK_SPEED: case MAGIC_ATTACK_SPEED: case SHIELD_DEFENCE: case STAT_CON: case STAT_DEX: case STAT_INT: case STAT_MEN: case STAT_STR: case STAT_WIT: env.setValue(1); } } return env.getValue(); } /** * @return the Accuracy (base+modifier) of the L2Character in function of the Weapon Expertise Penalty. */ public int getAccuracy() { if (_activeChar == null) { return 0; } return (int) Math.round(calcStat(Stats.ACCURACY_COMBAT, 0, null, null)); } public L2Character getActiveChar() { return _activeChar; } /** * @return the Attack Speed multiplier (base+modifier) of the L2Character to get proper animations. */ public final float getAttackSpeedMultiplier() { if (_activeChar == null) { return 1; } return (float) (((1.1) * getPAtkSpd()) / _activeChar.getTemplate().getBasePAtkSpd()); } /** * @return the CON of the L2Character (base+modifier). */ public final int getCON() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.STAT_CON, _activeChar.getTemplate().getBaseCON()); } /** * @param target * @param init * @return the Critical Damage rate (base+modifier) of the L2Character. */ public final double getCriticalDmg(L2Character target, double init) { return calcStat(Stats.CRITICAL_DAMAGE, init, target, null); } /** * @param target * @param skill * @return the Critical Hit rate (base+modifier) of the L2Character. */ public int getCriticalHit(L2Character target, L2Skill skill) { if (_activeChar == null) { return 1; } int criticalHit = (int) calcStat(Stats.CRITICAL_RATE, _activeChar.getTemplate().getBaseCritRate(), target, skill); // Set a cap of Critical Hit at 500 return Math.min(criticalHit, Config.MAX_PCRIT_RATE); } /** * @return the DEX of the L2Character (base+modifier). */ public final int getDEX() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.STAT_DEX, _activeChar.getTemplate().getBaseDEX()); } /** * @param target * @return the Attack Evasion rate (base+modifier) of the L2Character. */ public int getEvasionRate(L2Character target) { if (_activeChar == null) { return 1; } int val = (int) Math.round(calcStat(Stats.EVASION_RATE, 0, target, null)); if ((val > Config.MAX_EVASION) && !_activeChar.canOverrideCond(PcCondOverride.MAX_STATS_VALUE)) { val = Config.MAX_EVASION; } return val; } public long getExp() { return _exp; } public void setExp(long value) { _exp = value; } /** * @return the INT of the L2Character (base+modifier). */ public int getINT() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.STAT_INT, _activeChar.getTemplate().getBaseINT()); } public byte getLevel() { return _level; } public void setLevel(byte value) { _level = value; } /** * @param skill * @return the Magical Attack range (base+modifier) of the L2Character. */ public final int getMagicalAttackRange(L2Skill skill) { if (_activeChar == null) { return 1; } if (skill != null) { return (int) calcStat(Stats.MAGIC_ATTACK_RANGE, skill.getCastRange(), null, skill); } return _activeChar.getTemplate().getBaseAtkRange(); } public int getMaxCp() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.MAX_CP, _activeChar.getTemplate().getBaseCpMax()); } public int getMaxRecoverableCp() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.MAX_RECOVERABLE_CP, getMaxCp()); } public int getMaxHp() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.MAX_HP, _activeChar.getTemplate().getBaseHpMax()); } public int getMaxRecoverableHp() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.MAX_RECOVERABLE_HP, getMaxHp()); } public int getMaxMp() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.MAX_MP, _activeChar.getTemplate().getBaseMpMax()); } public int getMaxRecoverableMp() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.MAX_RECOVERABLE_MP, getMaxMp()); } /** * Return the MAtk (base+modifier) of the L2Character.<br> * <B><U>Example of use</U>: Calculate Magic damage * @param target The L2Character targeted by the skill * @param skill The L2Skill used against the target * @return */ public int getMAtk(L2Character target, L2Skill skill) { if (_activeChar == null) { return 1; } float bonusAtk = 1; if (Config.EASY_CHAMPION_ENABLE && _activeChar.isEasyChampion()) { bonusAtk = Config.EASY_CHAMPION_ATK; } else if (Config.HARD_CHAMPION_ENABLE && _activeChar.isHardChampion()) { bonusAtk = Config.HARD_CHAMPION_ATK; } if (_activeChar.isRaid()) { bonusAtk *= Config.RAID_MATTACK_MULTIPLIER; } // Calculate modifiers Magic Attack return (int) calcStat(Stats.MAGIC_ATTACK, _activeChar.getTemplate().getBaseMAtk() * bonusAtk, target, skill); } /** * @return the MAtk Speed (base+modifier) of the L2Character in function of the Armour Expertise Penalty. */ public int getMAtkSpd() { if (_activeChar == null) { return 1; } float bonusSpdAtk = 1; if (Config.EASY_CHAMPION_ENABLE && _activeChar.isEasyChampion()) { bonusSpdAtk = Config.EASY_CHAMPION_SPD_ATK; } else if (Config.HARD_CHAMPION_ENABLE && _activeChar.isHardChampion()) { bonusSpdAtk = Config.HARD_CHAMPION_SPD_ATK; } double val = calcStat(Stats.MAGIC_ATTACK_SPEED, _activeChar.getTemplate().getBaseMAtkSpd() * bonusSpdAtk); if ((val > Config.MAX_MATK_SPEED) && !_activeChar.canOverrideCond(PcCondOverride.MAX_STATS_VALUE)) { val = Config.MAX_MATK_SPEED; } return (int) val; } /** * @param target * @param skill * @return the Magic Critical Hit rate (base+modifier) of the L2Character. */ public final int getMCriticalHit(L2Character target, L2Skill skill) { if (_activeChar == null) { return 1; } double mrate = calcStat(Stats.MCRITICAL_RATE, 1, target, skill) * 10; // Set a cap of Magical Critical Hit at 200 return (int) Math.min(mrate, Config.MAX_MCRIT_RATE); } /** * <B><U>Example of use </U>: Calculate Magic damage. * @param target The L2Character targeted by the skill * @param skill The L2Skill used against the target * @return the MDef (base+modifier) of the L2Character against a skill in function of abnormal effects in progress. */ public int getMDef(L2Character target, L2Skill skill) { if (_activeChar == null) { return 1; } // Get the base MDef of the L2Character double defence = _activeChar.getTemplate().getBaseMDef(); // Calculate modifier for Raid Bosses if (_activeChar.isRaid()) { defence *= Config.RAID_MDEFENCE_MULTIPLIER; } // Calculate modifiers Magic Attack return (int) calcStat(Stats.MAGIC_DEFENCE, defence, target, skill); } /** * @return the MEN of the L2Character (base+modifier). */ public final int getMEN() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.STAT_MEN, _activeChar.getTemplate().getBaseMEN()); } public float getMovementSpeedMultiplier() { if (_activeChar == null) { return 1; } return getRunSpeed() / (float) _activeChar.getTemplate().getBaseRunSpd(); } /** * @return the RunSpeed (base+modifier) or WalkSpeed (base+modifier) of the L2Character in function of the movement type. */ public float getMoveSpeed() { if (_activeChar == null) { return 1; } if (_activeChar.isRunning()) { return getRunSpeed(); } return getWalkSpeed(); } /** * @param skill * @return the MReuse rate (base+modifier) of the L2Character. */ public final double getMReuseRate(L2Skill skill) { if (_activeChar == null) { return 1; } return calcStat(Stats.MAGIC_REUSE_RATE, _activeChar.getTemplate().getBaseMReuseRate(), null, skill); } public final double getPReuseRate(L2Skill skill) { if (_activeChar == null) { return 1; } return calcStat(Stats.MAGIC_REUSE_RATE, _activeChar.getTemplate().getBaseMReuseRate(), null, skill); } /** * @param target * @return the PAtk (base+modifier) of the L2Character. */ public int getPAtk(L2Character target) { if (_activeChar == null) { return 1; } float bonusAtk = 1; if (Config.EASY_CHAMPION_ENABLE && _activeChar.isEasyChampion()) { bonusAtk = Config.EASY_CHAMPION_ATK; } else if (Config.HARD_CHAMPION_ENABLE && _activeChar.isHardChampion()) { bonusAtk = Config.HARD_CHAMPION_ATK; } if (_activeChar.isRaid()) { bonusAtk *= Config.RAID_PATTACK_MULTIPLIER; } return (int) calcStat(Stats.POWER_ATTACK, _activeChar.getTemplate().getBasePAtk() * bonusAtk, target, null); } /** * @param target * @return the PAtk Modifier against animals. */ public final double getPAtkAnimals(L2Character target) { return calcStat(Stats.PATK_ANIMALS, 1, target, null); } /** * @param target * @return the PAtk Modifier against dragons. */ public final double getPAtkDragons(L2Character target) { return calcStat(Stats.PATK_DRAGONS, 1, target, null); } /** * @param target * @return the PAtk Modifier against insects. */ public final double getPAtkInsects(L2Character target) { return calcStat(Stats.PATK_INSECTS, 1, target, null); } /** * @param target * @return the PAtk Modifier against monsters. */ public final double getPAtkMonsters(L2Character target) { return calcStat(Stats.PATK_MONSTERS, 1, target, null); } /** * @param target * @return the PAtk Modifier against plants. */ public final double getPAtkPlants(L2Character target) { return calcStat(Stats.PATK_PLANTS, 1, target, null); } /** * @param target * @return the PAtk Modifier against giants. */ public final double getPAtkGiants(L2Character target) { return calcStat(Stats.PATK_GIANTS, 1, target, null); } /** * @param target * @return the PAtk Modifier against magic creatures. */ public final double getPAtkMagicCreatures(L2Character target) { return calcStat(Stats.PATK_MCREATURES, 1, target, null); } /** * @return the PAtk Speed (base+modifier) of the L2Character in function of the Armour Expertise Penalty. */ public int getPAtkSpd() { if (_activeChar == null) { return 1; } float bonusAtk = 1; if (Config.EASY_CHAMPION_ENABLE && _activeChar.isEasyChampion()) { bonusAtk = Config.EASY_CHAMPION_SPD_ATK; } else if (Config.HARD_CHAMPION_ENABLE && _activeChar.isHardChampion()) { bonusAtk = Config.HARD_CHAMPION_SPD_ATK; } int val = (int) Math.round(calcStat(Stats.POWER_ATTACK_SPEED, _activeChar.getTemplate().getBasePAtkSpd() * bonusAtk, null, null)); return val; } /** * @param target * @return the PDef Modifier against animals. */ public final double getPDefAnimals(L2Character target) { return calcStat(Stats.PDEF_ANIMALS, 1, target, null); } /** * @param target * @return the PDef Modifier against dragons. */ public final double getPDefDragons(L2Character target) { return calcStat(Stats.PDEF_DRAGONS, 1, target, null); } /** * @param target * @return the PDef Modifier against insects. */ public final double getPDefInsects(L2Character target) { return calcStat(Stats.PDEF_INSECTS, 1, target, null); } /** * @param target * @return the PDef Modifier against monsters. */ public final double getPDefMonsters(L2Character target) { return calcStat(Stats.PDEF_MONSTERS, 1, target, null); } /** * @param target * @return the PDef Modifier against plants. */ public final double getPDefPlants(L2Character target) { return calcStat(Stats.PDEF_PLANTS, 1, target, null); } /** * @param target * @return the PDef Modifier against giants. */ public final double getPDefGiants(L2Character target) { return calcStat(Stats.PDEF_GIANTS, 1, target, null); } /** * @param target * @return the PDef Modifier against giants. */ public final double getPDefMagicCreatures(L2Character target) { return calcStat(Stats.PDEF_MCREATURES, 1, target, null); } /** * @param target * @return the PDef (base+modifier) of the L2Character. */ public int getPDef(L2Character target) { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.POWER_DEFENCE, (_activeChar.isRaid()) ? _activeChar.getTemplate().getBasePDef() * Config.RAID_PDEFENCE_MULTIPLIER : _activeChar.getTemplate().getBasePDef(), target, null); } /** * @return the Physical Attack range (base+modifier) of the L2Character. */ public final int getPhysicalAttackRange() { if (_activeChar == null) { return 1; } if (_activeChar.isTransformed()) { return _activeChar.getTemplate().getBaseAtkRange(); } // Polearm handled here for now. Basically L2PcInstance could have a function // similar to FuncBowAtkRange and NPC are defined in DP. L2Weapon weaponItem = _activeChar.getActiveWeaponItem(); if ((weaponItem != null) && (weaponItem.getItemType() == L2WeaponType.POLE)) { return (int) calcStat(Stats.POWER_ATTACK_RANGE, 66); } return (int) calcStat(Stats.POWER_ATTACK_RANGE, _activeChar.getTemplate().getBaseAtkRange()); } /** * @param target * @return the weapon reuse modifier. */ public final double getWeaponReuseModifier(L2Character target) { return calcStat(Stats.ATK_REUSE, 1, target, null); } /** * @return the RunSpeed (base+modifier) of the L2Character in function of the Armour Expertise Penalty. */ public int getRunSpeed() { if (_activeChar == null) { return 1; } // err we should be adding TO the persons run speed // not making it a constant double baseRunSpd = _activeChar.getTemplate().getBaseRunSpd(); if (baseRunSpd == 0) { return 0; } return (int) Math.round(calcStat(Stats.RUN_SPEED, baseRunSpd, null, null)); } /** * @return the ShieldDef rate (base+modifier) of the L2Character. */ public final int getShldDef() { return (int) calcStat(Stats.SHIELD_DEFENCE, 0); } public int getSp() { return _sp; } public void setSp(int value) { _sp = value; } /** * @return the STR of the L2Character (base+modifier). */ public final int getSTR() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.STAT_STR, _activeChar.getTemplate().getBaseSTR()); } /** * @return the WalkSpeed (base+modifier) of the L2Character. */ public int getWalkSpeed() { if (_activeChar == null) { return 1; } double baseWalkSpd = _activeChar.getTemplate().getBaseWalkSpd(); if (baseWalkSpd == 0) { return 0; } return (int) calcStat(Stats.WALK_SPEED, baseWalkSpd); } /** * @return the WIT of the L2Character (base+modifier). */ public final int getWIT() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.STAT_WIT, _activeChar.getTemplate().getBaseWIT()); } /** * @param skill * @return the mpConsume. */ public final int getMpConsume(L2Skill skill) { if (skill == null) { return 1; } double mpConsume = skill.getMpConsume(); double nextDanceMpCost = Math.ceil(skill.getMpConsume() / 2.); if (skill.isDance()) { if (Config.DANCE_CONSUME_ADDITIONAL_MP && (_activeChar != null) && (_activeChar.getDanceCount() > 0)) { mpConsume += _activeChar.getDanceCount() * nextDanceMpCost; } } mpConsume = calcStat(Stats.MP_CONSUME, mpConsume, null, skill); if (skill.isDance()) { return (int) calcStat(Stats.DANCE_MP_CONSUME_RATE, mpConsume); } else if (skill.isMagic()) { return (int) calcStat(Stats.MAGICAL_MP_CONSUME_RATE, mpConsume); } else { return (int) calcStat(Stats.PHYSICAL_MP_CONSUME_RATE, mpConsume); } } /** * @param skill * @return the mpInitialConsume. */ public final int getMpInitialConsume(L2Skill skill) { if (skill == null) { return 1; } double mpConsume = calcStat(Stats.MP_CONSUME, skill.getMpInitialConsume(), null, skill); if (skill.isDance()) { return (int) calcStat(Stats.DANCE_MP_CONSUME_RATE, mpConsume); } else if (skill.isMagic()) { return (int) calcStat(Stats.MAGICAL_MP_CONSUME_RATE, mpConsume); } else { return (int) calcStat(Stats.PHYSICAL_MP_CONSUME_RATE, mpConsume); } } public byte getAttackElement() { L2ItemInstance weaponInstance = _activeChar.getActiveWeaponInstance(); // 1st order - weapon element if ((weaponInstance != null) && (weaponInstance.getAttackElementType() >= 0)) { return weaponInstance.getAttackElementType(); } // temp fix starts int tempVal = 0, stats[] = { 0, 0, 0, 0, 0, 0 }; byte returnVal = -2; stats[0] = (int) calcStat(Stats.FIRE_POWER, _activeChar.getTemplate().getBaseFire()); stats[1] = (int) calcStat(Stats.WATER_POWER, _activeChar.getTemplate().getBaseWater()); stats[2] = (int) calcStat(Stats.WIND_POWER, _activeChar.getTemplate().getBaseWind()); stats[3] = (int) calcStat(Stats.EARTH_POWER, _activeChar.getTemplate().getBaseEarth()); stats[4] = (int) calcStat(Stats.HOLY_POWER, _activeChar.getTemplate().getBaseHoly()); stats[5] = (int) calcStat(Stats.DARK_POWER, _activeChar.getTemplate().getBaseDark()); for (byte x = 0; x < 6; x++) { if (stats[x] > tempVal) { returnVal = x; tempVal = stats[x]; } } return returnVal; // temp fix ends /* * uncomment me once deadlocks in getAllEffects() fixed return _activeChar.getElementIdFromEffects(); */ } public int getAttackElementValue(byte attackAttribute) { switch (attackAttribute) { case Elementals.FIRE: return (int) calcStat(Stats.FIRE_POWER, _activeChar.getTemplate().getBaseFire()); case Elementals.WATER: return (int) calcStat(Stats.WATER_POWER, _activeChar.getTemplate().getBaseWater()); case Elementals.WIND: return (int) calcStat(Stats.WIND_POWER, _activeChar.getTemplate().getBaseWind()); case Elementals.EARTH: return (int) calcStat(Stats.EARTH_POWER, _activeChar.getTemplate().getBaseEarth()); case Elementals.HOLY: return (int) calcStat(Stats.HOLY_POWER, _activeChar.getTemplate().getBaseHoly()); case Elementals.DARK: return (int) calcStat(Stats.DARK_POWER, _activeChar.getTemplate().getBaseDark()); default: return 0; } } public int getDefenseElementValue(byte defenseAttribute) { switch (defenseAttribute) { case Elementals.FIRE: return (int) calcStat(Stats.FIRE_RES, _activeChar.getTemplate().getBaseFireRes()); case Elementals.WATER: return (int) calcStat(Stats.WATER_RES, _activeChar.getTemplate().getBaseWaterRes()); case Elementals.WIND: return (int) calcStat(Stats.WIND_RES, _activeChar.getTemplate().getBaseWindRes()); case Elementals.EARTH: return (int) calcStat(Stats.EARTH_RES, _activeChar.getTemplate().getBaseEarthRes()); case Elementals.HOLY: return (int) calcStat(Stats.HOLY_RES, _activeChar.getTemplate().getBaseHolyRes()); case Elementals.DARK: return (int) calcStat(Stats.DARK_RES, _activeChar.getTemplate().getBaseDarkRes()); default: return 0; } } } datapack -> handlers.voicedcommandhandlers package handlers.voicedcommandhandlers; import com.l2jserver.gameserver.handler.IVoicedCommandHandler; import com.l2jserver.gameserver.model.actor.instance.L2PcInstance; import com.l2jserver.gameserver.network.serverpackets.NpcHtmlMessage; import com.l2jserver.gameserver.model.stats.Stats; import javolution.text.TextBuilder; /* Zl0D3Y special for l2MAXI =* */ public class Voiced_MyStats implements IVoicedCommandHandler { private static final String[] VOICED_COMMANDS = { "stats", "statistics", "whoami", "whoiam" }; public boolean useVoicedCommand(String command, L2PcInstance activeChar, String target) { if (command.startsWith("whoiam") || command.startsWith("whoami") || command.startsWith("whoami") || command.startsWith("whoiam")) { TextBuilder cl = new TextBuilder(); NpcHtmlMessage html = new NpcHtmlMessage(activeChar.getObjectId()); cl.append("<html><head><title>CHARACTER "+activeChar.getName()+" STATS"+"</title></head><body>"); cl.append("<center>BASE STATS(only player)</center><br>"); cl.append("<table border=\"0\" width=\"100%\">"); cl.append("<tr><td>STR="+activeChar.getStat().getSTR()+"</td></tr>"); cl.append("<tr><td>CON="+activeChar.getStat().getCON()+"</td></tr>"); cl.append("<tr><td>DEX="+activeChar.getStat().getDEX()+"</td></tr>"); cl.append("<tr><td>INT="+activeChar.getStat().getINT()+"</td></tr>"); cl.append("<tr><td>WIT="+activeChar.getStat().getWIT()+"</td></tr>"); cl.append("<tr><td>MEN="+activeChar.getStat().getMEN()+"</td></tr>"); cl.append("<tr><td>skillMastery(SKILL_MASTERY)="+Math.round(activeChar.calcStat(Stats.SKILL_MASTERY, 0, null, null))+"</td></tr>"); cl.append("<tr><td>pvpPhysDmg="+Math.round(activeChar.calcStat(Stats.PVP_PHYSICAL_DMG, 0, null, null))+"</td></tr>"); cl.append("<tr><td>pvpMagicalDmg="+Math.round(activeChar.calcStat(Stats.PVP_MAGICAL_DMG, 0, null, null))+"</td></tr>"); cl.append("<tr><td>pvpPhysSkillsDmg="+Math.round(activeChar.calcStat(Stats.PVP_PHYS_SKILL_DMG, 0, null, null))+"</td></tr>"); cl.append("<tr><td>pvpPhysDef="+Math.round(activeChar.calcStat(Stats.PVP_PHYSICAL_DEF, 0, null, null))+"</td></tr>"); cl.append("<tr><td>pvpMagicalDef="+Math.round(activeChar.calcStat(Stats.PVP_MAGICAL_DEF, 0, null, null))+"</td></tr>"); cl.append("<tr><td>pvpPhysSkillsDef="+Math.round(activeChar.calcStat(Stats.PVP_PHYS_SKILL_DEF, 0, null, null))+"</td></tr>"); cl.append("</table><br>"); cl.append("<center>HP/MP/CP</center><br>"); cl.append("<table border=\"0\" width=\"100%\">"); cl.append("<tr><td>maxHp(MAX_HP)="+activeChar.getMaxHp()+"("+Math.round(activeChar.calcStat(Stats.MAX_HP, 0, null, null))+")"+"</td></tr>"); cl.append("<tr><td>maxMp(MAX_MP)="+activeChar.getMaxMp()+"("+Math.round(activeChar.calcStat(Stats.MAX_MP, 0, null, null))+")"+"</td></tr>"); cl.append("<tr><td>maxCp(MAX_CP)="+activeChar.getMaxCp()+"("+Math.round(activeChar.calcStat(Stats.MAX_CP, 0, null, null))+")"+"</td></tr>"); cl.append("<tr><td>regHp="+Math.round(activeChar.calcStat(Stats.REGENERATE_HP_RATE, 0, null, null))+"</td></tr>"); cl.append("<tr><td>regMp="+Math.round(activeChar.calcStat(Stats.REGENERATE_MP_RATE, 0, null, null))+"</td></tr>"); cl.append("<tr><td>regCp="+Math.round(activeChar.calcStat(Stats.REGENERATE_CP_RATE, 0, null, null))+"</td></tr>"); cl.append("<tr><td>gainHp="+Math.round(activeChar.calcStat(Stats.HEAL_EFFECTIVNESS, 0, null, null))+"</td></tr>"); cl.append("<tr><td>gainMp="+Math.round(activeChar.calcStat(Stats.RECHARGE_MP_RATE, 0, null, null))+"</td></tr>"); cl.append("<tr><td>giveHp="+Math.round(activeChar.calcStat(Stats.HEAL_PROFICIENCY, 0, null, null))+"</td></tr>"); cl.append("<tr><td>bonusHp="+Math.round(activeChar.calcStat(Stats.HEAL_STATIC_BONUS, 0, null, null))+"</td></tr>"); cl.append("</table><br>"); cl.append("<center>Atk/Def</center><br>"); cl.append("<table border=\"0\" width=\"100%\">"); cl.append("<tr><td>pDef="+activeChar.getStat().getPDef(null)+"</td></tr>"); cl.append("<tr><td>mDef="+activeChar.getStat().getMDef(null,null)+"</td></tr>"); cl.append("<tr><td>pAtk="+activeChar.getStat().getPAtk(null)+"</td></tr>"); cl.append("<tr><td>mAtk="+activeChar.getStat().getMAtk(null,null)+"</td></tr>"); cl.append("<tr><td>pAtkSpd="+activeChar.getStat().getPAtkSpd()+"</td></tr>"); cl.append("<tr><td>mAtkSpd="+activeChar.getStat().getMAtkSpd()+"</td></tr>"); cl.append("<tr><td>sDef(SHIELD_DEFENCE)="+activeChar.getStat().getShldDef()+"</td></tr>"); cl.append("<tr><td>rShld(SHIELD_RATE)="+Math.round(activeChar.calcStat(Stats.SHIELD_RATE, 0, null, null))+"</td></tr>"); cl.append("<tr><td>shldAngle(SHIELD_ANGLE)="+Math.round(activeChar.calcStat(Stats.SHIELD_ANGLE, 0, null, null))+"</td></tr>"); cl.append("<tr><td>rCrit(CRITICAL_RATE)="+activeChar.getStat().getCriticalHit(activeChar, null)+"%</td></tr>"); cl.append("<tr><td>cAtk(CRITICAL_DAMAGE)="+activeChar.getStat().getCriticalDmg(activeChar, 1)+"</td></tr>"); cl.append("<tr><td>cAtkAdd(CRITICAL_DAMAGE_ADD)="+Math.round(activeChar.calcStat(Stats.CRITICAL_DAMAGE_ADD, 0, null, null))+"</td></tr>"); cl.append("<tr><td>mCritRate(MCRITICAL_RATE)="+(activeChar.getStat().getMCriticalHit(activeChar, null) / 10)+"%</td></tr>"); cl.append("<tr><td>critRateVuln(CRIT_RATE_VULN)="+Math.round(activeChar.calcStat(Stats.CRIT_RATE_VULN, 1, null, null))+"</td></tr>"); cl.append("<tr><td>rEvas(EVASION_RATE)="+activeChar.getStat().getEvasionRate(null)+"</td></tr>"); cl.append("<tr><td>pSkillEvas(P_SKILL_EVASION)="+activeChar.calcStat(Stats.P_SKILL_EVASION, 0, null, null)+"</td></tr>"); cl.append("<tr><td>blowRate(BLOW_RATE)="+activeChar.calcStat(Stats.BLOW_RATE, 1, null, null)+"</td></tr>"); cl.append("<tr><td>lethalRate(LETHAL_RATE)="+activeChar.calcStat(Stats.LETHAL_RATE, 1, null, null)+"</td></tr>"); cl.append("<tr><td>accCombat(ACCURACY_COMBAT)="+Math.round(activeChar.calcStat(Stats.ACCURACY_COMBAT, 0, null, null))+"</td></tr>"); cl.append("<tr><td>pAtkRange="+activeChar.getStat().getPhysicalAttackRange()+" (ATTACK_RANGE="+Math.round(activeChar.calcStat(Stats.POWER_ATTACK_RANGE, 0, null, null))+" base="+activeChar.getTemplate().getBaseAtkRange()+")"+"</td></tr>"); cl.append("<tr><td>mAtkRange(MAGIC_ATTACK_RANGE)="+Math.round(activeChar.calcStat(Stats.MAGIC_ATTACK_RANGE, 1, null, null))+"</td></tr>"); cl.append("<tr><td>pAtkAngle(POWER_ATTACK_ANGLE)="+Math.round(activeChar.calcStat(Stats.POWER_ATTACK_ANGLE, 1, null, null))+"</td></tr>"); cl.append("<tr><td>atkCountMax(ATTACK_COUNT_MAX)="+Math.round(activeChar.calcStat(Stats.ATTACK_COUNT_MAX, 1, null, null))+"</td></tr>"); cl.append("<tr><td>poleAngle(POLE_ATTACK_ANGLE)="+Math.round(activeChar.calcStat(Stats.POLE_ATTACK_ANGLE, 1, null, null))+"</td></tr>"); cl.append("<tr><td>pReuse(PHYS_REUSE_RATE)="+activeChar.getStat().getPReuseRate(null)+"</td></tr>"); cl.append("<tr><td>mReuse(MAGIC_REUSE_RATE)="+activeChar.getStat().getMReuseRate(null)+"</td></tr>"); cl.append("<tr><td>bowReuse(BOW_REUSE)="+Math.round(activeChar.calcStat(Stats.BOW_REUSE, 0, null, null))+"</td></tr>"); cl.append("<tr><td>runSpd(RUN_SPEED)="+activeChar.getStat().getRunSpeed()+"</td></tr>"); cl.append("<tr><td>walkSpd(WALK_SPEED)="+activeChar.getStat().getWalkSpeed()+"</td></tr>"); cl.append("</table><br>"); cl.append("<center>Vulnerability</center><br>"); cl.append("<table border=\"0\" width=\"100%\">"); //cl.append("<tr><td>aggressionVuln="+activeChar.calcStat(Stats.AGGRESSION_VULN, 1, null, null)+"</td></tr>"); cl.append("<tr><td>bleedVuln="+activeChar.calcStat(Stats.BLEED_VULN, 0, null, null)+"</td></tr>"); cl.append("<tr><td>poisonVuln="+activeChar.calcStat(Stats.POISON_VULN, 0, null, null)+"</td></tr>"); cl.append("<tr><td>stunVuln="+activeChar.calcStat(Stats.STUN_VULN, 0, null, null)+"</td></tr>"); cl.append("<tr><td>paralyzeVuln="+activeChar.calcStat(Stats.PARALYZE_VULN, 0, null, null)+"</td></tr>"); cl.append("<tr><td>rootVuln="+activeChar.calcStat(Stats.ROOT_VULN, 0, null, null)+"</td></tr>"); cl.append("<tr><td>sleepVuln="+activeChar.calcStat(Stats.SLEEP_VULN, 0, null, null)+"</td></tr>"); cl.append("<tr><td>confusionVuln="+activeChar.calcStat(Stats.CONFUSION_VULN, 0, null, null)+"</td></tr>"); cl.append("<tr><td>movementVuln="+activeChar.calcStat(Stats.MOVEMENT_VULN, 0, null, null)+"</td></tr>"); cl.append("<tr><td>cancelVuln="+activeChar.calcStat(Stats.CANCEL_VULN, 0, null, null)+"</td></tr>"); cl.append("<tr><td>derangementVuln="+activeChar.calcStat(Stats.DERANGEMENT_VULN, 0, null, null)+"</td></tr>"); cl.append("<tr><td>debuffVuln="+activeChar.calcStat(Stats.DEBUFF_VULN, 0, null, null)+"</td></tr>"); cl.append("<tr><td>buffVuln="+activeChar.calcStat(Stats.BUFF_VULN, 0, null, null)+"</td></tr>"); cl.append("<tr><td>cancelCastVuln="+activeChar.calcStat(Stats.CANCELCAST_VULN, 0, null, null)+"</td></tr>"); cl.append("<tr><td>critVuln="+activeChar.calcStat(Stats.CRIT_VULN, 1, null, null)+"</td></tr>"); cl.append("<tr><td>fireVuln="+activeChar.calcStat(Stats.FIRE_RES, 0, null, null)+"</td></tr>"); cl.append("<tr><td>windVuln="+activeChar.calcStat(Stats.WIND_RES, 0, null, null)+"</td></tr>"); cl.append("<tr><td>waterVuln="+activeChar.calcStat(Stats.WATER_RES, 0, null, null)+"</td></tr>"); cl.append("<tr><td>earthVuln="+activeChar.calcStat(Stats.EARTH_RES, 0, null, null)+"</td></tr>"); cl.append("<tr><td>holyVuln="+activeChar.calcStat(Stats.HOLY_RES, 0, null, null)+"</td></tr>"); cl.append("<tr><td>darkVuln="+activeChar.calcStat(Stats.DARK_RES, 0, null, null)+"</td></tr>"); cl.append("<tr><td>magicSuccVuln="+activeChar.calcStat(Stats.MAGIC_SUCCESS_VULN, 1, null, null)+"</td></tr>"); cl.append("<tr><td>magicFailureRate="+activeChar.calcStat(Stats.MAGIC_FAILURE_RATE, 1, null, null)+"</td></tr>"); cl.append("<tr><td>swordWpnVuln="+activeChar.calcStat(Stats.SWORD_WPN_VULN, 1, null, null)+"</td></tr>"); cl.append("<tr><td>bluntWpnVuln="+activeChar.calcStat(Stats.BLUNT_WPN_VULN, 1, null, null)+"</td></tr>"); cl.append("<tr><td>daggerWpnVuln="+activeChar.calcStat(Stats.DAGGER_WPN_VULN, 1, null, null)+"</td></tr>"); cl.append("<tr><td>bowWpnVuln="+activeChar.calcStat(Stats.BOW_WPN_VULN, 1, null, null)+"</td></tr>"); cl.append("<tr><td>crossbowWpnVuln="+activeChar.calcStat(Stats.CROSSBOW_WPN_VULN, 1, null, null)+"</td></tr>"); cl.append("<tr><td>poleWpnVuln="+activeChar.calcStat(Stats.POLE_WPN_VULN, 1, null, null)+"</td></tr>"); cl.append("<tr><td>fistWpnVuln="+activeChar.calcStat(Stats.FIST_WPN_VULN, 1, null, null)+"</td></tr>"); cl.append("<tr><td>dualWpnVuln="+activeChar.calcStat(Stats.DUAL_WPN_VULN, 1, null, null)+"</td></tr>"); cl.append("<tr><td>dualFistWpnVuln="+activeChar.calcStat(Stats.DUALFIST_WPN_VULN, 1, null, null)+"</td></tr>"); cl.append("<tr><td>bigSwordWpnVuln="+activeChar.calcStat(Stats.BIGSWORD_WPN_VULN, 1, null, null)+"</td></tr>"); cl.append("<tr><td>bigBluntWpnVuln="+activeChar.calcStat(Stats.BIGBLUNT_WPN_VULN, 1, null, null)+"</td></tr>"); cl.append("<tr><td>dualDaggerWpnVuln="+activeChar.calcStat(Stats.DUALDAGGER_WPN_VULN, 1, null, null)+"</td></tr>"); cl.append("<tr><td>rapierWpnVuln="+activeChar.calcStat(Stats.RAPIER_WPN_VULN, 1, null, null)+"</td></tr>"); cl.append("<tr><td>ancientWpnVuln="+activeChar.calcStat(Stats.ANCIENT_WPN_VULN, 1, null, null)+"</td></tr>"); cl.append("<tr><td>fallVuln="+activeChar.calcStat(Stats.FALL_VULN, 1, null, null)+"</td></tr>"); cl.append("</table><br>"); cl.append("<center>Skills Power</center><br>"); cl.append("<table border=\"0\" width=\"100%\">"); cl.append("<tr><td>firePower="+Math.round(activeChar.calcStat(Stats.FIRE_POWER, 0, null, null))+"</td></tr>"); cl.append("<tr><td>waterPower="+Math.round(activeChar.calcStat(Stats.WATER_POWER, 0, null, null))+"</td></tr>"); cl.append("<tr><td>windPower="+Math.round(activeChar.calcStat(Stats.WIND_POWER, 0, null, null))+"</td></tr>"); cl.append("<tr><td>earthPower="+Math.round(activeChar.calcStat(Stats.EARTH_POWER, 0, null, null))+"</td></tr>"); cl.append("<tr><td>holyPower="+Math.round(activeChar.calcStat(Stats.HOLY_POWER, 0, null, null))+"</td></tr>"); cl.append("<tr><td>darkPower="+Math.round(activeChar.calcStat(Stats.DARK_POWER, 0, null, null))+"</td></tr>"); cl.append("</table><br>"); cl.append("<center>Profs</center><br>"); cl.append("<table border=\"0\" width=\"100%\">"); cl.append("<tr><td>aggressionProf="+Math.round(activeChar.calcStat(Stats.AGGRESSION_PROF, 0, null, null))+"</td></tr>"); cl.append("<tr><td>bleedProf="+Math.round(activeChar.calcStat(Stats.BLEED_PROF, 0, null, null))+"</td></tr>"); cl.append("<tr><td>poisonProf="+Math.round(activeChar.calcStat(Stats.POISON_PROF, 0, null, null))+"</td></tr>"); cl.append("<tr><td>stunProf="+Math.round(activeChar.calcStat(Stats.STUN_PROF, 0, null, null))+"</td></tr>"); cl.append("<tr><td>paralyzeProf="+Math.round(activeChar.calcStat(Stats.PARALYZE_PROF, 0, null, null))+"</td></tr>"); cl.append("<tr><td>rootProf="+Math.round(activeChar.calcStat(Stats.ROOT_PROF, 0, null, null))+"</td></tr>"); cl.append("<tr><td>sleepProf="+Math.round(activeChar.calcStat(Stats.SLEEP_PROF, 0, null, null))+"</td></tr>"); cl.append("<tr><td>confusionProf="+Math.round(activeChar.calcStat(Stats.CONFUSION_PROF, 0, null, null))+"</td></tr>"); cl.append("<tr><td>movementProf="+Math.round(activeChar.calcStat(Stats.PROF, 0, null, null))+"</td></tr>"); cl.append("<tr><td>cancelProf="+Math.round(activeChar.calcStat(Stats.CANCEL_PROF, 0, null, null))+"</td></tr>"); cl.append("<tr><td>derangementProf="+Math.round(activeChar.calcStat(Stats.DERANGEMENT_PROF, 0, null, null))+"</td></tr>"); cl.append("<tr><td>debuffProf="+Math.round(activeChar.calcStat(Stats.DEBUFF_PROF, 0, null, null))+"</td></tr>"); cl.append("<tr><td>critProf="+Math.round(activeChar.calcStat(Stats.CRIT_PROF, 0, null, null))+"</td></tr>"); cl.append("</table><br>"); cl.append("<center>Reflect && etc</center><br>"); cl.append("<table border=\"0\" width=\"100%\">"); cl.append("<tr><td>reflectDam="+Math.round(activeChar.calcStat(Stats.REFLECT_DAMAGE_PERCENT, 0, null, null))+"</td></tr>"); cl.append("<tr><td>reflectSkillMagic="+Math.round(activeChar.calcStat(Stats.REFLECT_SKILL_MAGIC, 0, null, null))+"</td></tr>"); cl.append("<tr><td>reflectSkillPhysic="+Math.round(activeChar.calcStat(Stats.REFLECT_SKILL_PHYSIC, 0, null, null))+"</td></tr>"); cl.append("<tr><td>reflectSkillMeleePhysic="+Math.round(activeChar.calcStat(Stats.REFLECT_SKILL_MELEE_PHYSIC, 0, null, null))+"</td></tr>"); cl.append("<tr><td>absorbDam="+Math.round(activeChar.calcStat(Stats.ABSORB_DAMAGE_PERCENT, 0, null, null))+"</td></tr>"); cl.append("<tr><td>transDam="+Math.round(activeChar.calcStat(Stats.TRANSFER_DAMAGE_PERCENT, 0, null, null))+"</td></tr>"); cl.append("<tr><td>absorbDamMana="+Math.round(activeChar.calcStat(Stats.ABSORB_MANA_DAMAGE_PERCENT, 0, null, null))+"</td></tr>"); cl.append("<tr><td>reflectDamMagic="+Math.round(activeChar.calcStat(Stats.REFLECT_DAMAGE_MAGIC, 0, null, null))+"</td></tr>"); cl.append("<tr><td>counterAttack="+Math.round(activeChar.calcStat(Stats.COUNTER_ATTACK, 0, null, null))+"</td></tr>"); cl.append("</table><br>"); cl.append("<center>Consume</center><br>"); cl.append("<table border=\"0\" width=\"100%\">"); cl.append("<tr><td>PhysicalMpConsumeRate="+activeChar.calcStat(Stats.PHYSICAL_MP_CONSUME_RATE, 1, null, null)+"</td></tr>"); cl.append("<tr><td>MagicalMpConsumeRate="+activeChar.calcStat(Stats.MAGICAL_MP_CONSUME_RATE, 1, null, null)+"</td></tr>"); cl.append("<tr><td>DanceMpConsumeRate="+activeChar.calcStat(Stats.DANCE_MP_CONSUME_RATE, 1, null, null)+"</td></tr>"); cl.append("<tr><td>BowMpConsumeRate="+activeChar.calcStat(Stats.BOW_MP_CONSUME_RATE, 1, null, null)+"</td></tr>"); cl.append("<tr><td>MpConsume="+activeChar.calcStat(Stats.MP_CONSUME, 1, null, null)+"</td></tr>"); cl.append("</table>"); cl.append("</body></html>"); html.setHtml(""+cl+""); activeChar.sendPacket(html); } return false; } public String[] getVoicedCommandList() { return VOICED_COMMANDS; } } CharStat.java package com.l2jserver.gameserver.model.actor.stat; import com.l2jserver.Config; import com.l2jserver.gameserver.model.Elementals; import com.l2jserver.gameserver.model.PcCondOverride; import com.l2jserver.gameserver.model.actor.L2Character; import com.l2jserver.gameserver.model.items.L2Weapon; import com.l2jserver.gameserver.model.items.instance.L2ItemInstance; import com.l2jserver.gameserver.model.items.type.L2WeaponType; import com.l2jserver.gameserver.model.skills.L2Skill; import com.l2jserver.gameserver.model.stats.Calculator; import com.l2jserver.gameserver.model.stats.Env; import com.l2jserver.gameserver.model.stats.Stats; /* Zl0D3Y special for l2MAXI =* */ public class CharStat { private final L2Character _activeChar; private long _exp = 0; private int _sp = 0; private byte _level = 1; public CharStat(L2Character activeChar) { _activeChar = activeChar; } public final double calcStat(Stats stat, double init) { return calcStat(stat, init, null, null); } public final double calcStat(Stats stat, double init, L2Character target, L2Skill skill) { if ((_activeChar == null) || (stat == null)) { return init; } int id = stat.ordinal(); Calculator c = _activeChar.getCalculators()[id]; // If no Func object found, no modifier is applied if ((c == null) || (c.size() == 0)) { return init; } // Create and init an Env object to pass parameters to the Calculator Env env = new Env(); env.setCharacter(_activeChar); env.setTarget(target); env.setSkill(skill); env.setValue(init); // Launch the calculation c.calc(env); // avoid some troubles with negative stats (some stats should never be negative) if (env.getValue() <= 0) { switch (stat) { case MAX_HP: case MAX_MP: case MAX_CP: case MAGIC_DEFENCE: case POWER_DEFENCE: case POWER_ATTACK: case MAGIC_ATTACK: case POWER_ATTACK_SPEED: case MAGIC_ATTACK_SPEED: case SHIELD_DEFENCE: case STAT_CON: case STAT_DEX: case STAT_INT: case STAT_MEN: case STAT_STR: case STAT_WIT: env.setValue(1); } } return env.getValue(); } /** * @return the Accuracy (base+modifier) of the L2Character in function of the Weapon Expertise Penalty. */ public int getAccuracy() { if (_activeChar == null) { return 0; } return (int) Math.round(calcStat(Stats.ACCURACY_COMBAT, 0, null, null)); } public L2Character getActiveChar() { return _activeChar; } /** * @return the Attack Speed multiplier (base+modifier) of the L2Character to get proper animations. */ public final float getAttackSpeedMultiplier() { if (_activeChar == null) { return 1; } return (float) (((1.1) * getPAtkSpd()) / _activeChar.getTemplate().getBasePAtkSpd()); } /** * @return the CON of the L2Character (base+modifier). */ public final int getCON() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.STAT_CON, _activeChar.getTemplate().getBaseCON()); } /** * @param target * @param init * @return the Critical Damage rate (base+modifier) of the L2Character. */ public final double getCriticalDmg(L2Character target, double init) { return calcStat(Stats.CRITICAL_DAMAGE, init, target, null); } /** * @param target * @param skill * @return the Critical Hit rate (base+modifier) of the L2Character. */ public int getCriticalHit(L2Character target, L2Skill skill) { if (_activeChar == null) { return 1; } int criticalHit = (int) calcStat(Stats.CRITICAL_RATE, _activeChar.getTemplate().getBaseCritRate(), target, skill); // Set a cap of Critical Hit at 500 return Math.min(criticalHit, Config.MAX_PCRIT_RATE); } /** * @return the DEX of the L2Character (base+modifier). */ public final int getDEX() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.STAT_DEX, _activeChar.getTemplate().getBaseDEX()); } /** * @param target * @return the Attack Evasion rate (base+modifier) of the L2Character. */ public int getEvasionRate(L2Character target) { if (_activeChar == null) { return 1; } int val = (int) Math.round(calcStat(Stats.EVASION_RATE, 0, target, null)); if ((val > Config.MAX_EVASION) && !_activeChar.canOverrideCond(PcCondOverride.MAX_STATS_VALUE)) { val = Config.MAX_EVASION; } return val; } public long getExp() { return _exp; } public void setExp(long value) { _exp = value; } /** * @return the INT of the L2Character (base+modifier). */ public int getINT() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.STAT_INT, _activeChar.getTemplate().getBaseINT()); } public byte getLevel() { return _level; } public void setLevel(byte value) { _level = value; } /** * @param skill * @return the Magical Attack range (base+modifier) of the L2Character. */ public final int getMagicalAttackRange(L2Skill skill) { if (_activeChar == null) { return 1; } if (skill != null) { return (int) calcStat(Stats.MAGIC_ATTACK_RANGE, skill.getCastRange(), null, skill); } return _activeChar.getTemplate().getBaseAtkRange(); } public int getMaxCp() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.MAX_CP, _activeChar.getTemplate().getBaseCpMax()); } public int getMaxRecoverableCp() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.MAX_RECOVERABLE_CP, getMaxCp()); } public int getMaxHp() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.MAX_HP, _activeChar.getTemplate().getBaseHpMax()); } public int getMaxRecoverableHp() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.MAX_RECOVERABLE_HP, getMaxHp()); } public int getMaxMp() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.MAX_MP, _activeChar.getTemplate().getBaseMpMax()); } public int getMaxRecoverableMp() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.MAX_RECOVERABLE_MP, getMaxMp()); } /** * Return the MAtk (base+modifier) of the L2Character.<br> * <B><U>Example of use</U>: Calculate Magic damage * @param target The L2Character targeted by the skill * @param skill The L2Skill used against the target * @return */ public int getMAtk(L2Character target, L2Skill skill) { if (_activeChar == null) { return 1; } float bonusAtk = 1; if (Config.EASY_CHAMPION_ENABLE && _activeChar.isEasyChampion()) { bonusAtk = Config.EASY_CHAMPION_ATK; } else if (Config.HARD_CHAMPION_ENABLE && _activeChar.isHardChampion()) { bonusAtk = Config.HARD_CHAMPION_ATK; } if (_activeChar.isRaid()) { bonusAtk *= Config.RAID_MATTACK_MULTIPLIER; } // Calculate modifiers Magic Attack return (int) calcStat(Stats.MAGIC_ATTACK, _activeChar.getTemplate().getBaseMAtk() * bonusAtk, target, skill); } /** * @return the MAtk Speed (base+modifier) of the L2Character in function of the Armour Expertise Penalty. */ public int getMAtkSpd() { if (_activeChar == null) { return 1; } float bonusSpdAtk = 1; if (Config.EASY_CHAMPION_ENABLE && _activeChar.isEasyChampion()) { bonusSpdAtk = Config.EASY_CHAMPION_SPD_ATK; } else if (Config.HARD_CHAMPION_ENABLE && _activeChar.isHardChampion()) { bonusSpdAtk = Config.HARD_CHAMPION_SPD_ATK; } double val = calcStat(Stats.MAGIC_ATTACK_SPEED, _activeChar.getTemplate().getBaseMAtkSpd() * bonusSpdAtk); if ((val > Config.MAX_MATK_SPEED) && !_activeChar.canOverrideCond(PcCondOverride.MAX_STATS_VALUE)) { val = Config.MAX_MATK_SPEED; } return (int) val; } /** * @param target * @param skill * @return the Magic Critical Hit rate (base+modifier) of the L2Character. */ public final int getMCriticalHit(L2Character target, L2Skill skill) { if (_activeChar == null) { return 1; } double mrate = calcStat(Stats.MCRITICAL_RATE, 1, target, skill) * 10; // Set a cap of Magical Critical Hit at 200 return (int) Math.min(mrate, Config.MAX_MCRIT_RATE); } /** * <B><U>Example of use </U>: Calculate Magic damage. * @param target The L2Character targeted by the skill * @param skill The L2Skill used against the target * @return the MDef (base+modifier) of the L2Character against a skill in function of abnormal effects in progress. */ public int getMDef(L2Character target, L2Skill skill) { if (_activeChar == null) { return 1; } // Get the base MDef of the L2Character double defence = _activeChar.getTemplate().getBaseMDef(); // Calculate modifier for Raid Bosses if (_activeChar.isRaid()) { defence *= Config.RAID_MDEFENCE_MULTIPLIER; } // Calculate modifiers Magic Attack return (int) calcStat(Stats.MAGIC_DEFENCE, defence, target, skill); } /** * @return the MEN of the L2Character (base+modifier). */ public final int getMEN() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.STAT_MEN, _activeChar.getTemplate().getBaseMEN()); } public float getMovementSpeedMultiplier() { if (_activeChar == null) { return 1; } return getRunSpeed() / (float) _activeChar.getTemplate().getBaseRunSpd(); } /** * @return the RunSpeed (base+modifier) or WalkSpeed (base+modifier) of the L2Character in function of the movement type. */ public float getMoveSpeed() { if (_activeChar == null) { return 1; } if (_activeChar.isRunning()) { return getRunSpeed(); } return getWalkSpeed(); } /** * @param skill * @return the MReuse rate (base+modifier) of the L2Character. */ public final double getMReuseRate(L2Skill skill) { if (_activeChar == null) { return 1; } return calcStat(Stats.MAGIC_REUSE_RATE, _activeChar.getTemplate().getBaseMReuseRate(), null, skill); } public final double getPReuseRate(L2Skill skill) { if (_activeChar == null) { return 1; } return calcStat(Stats.MAGIC_REUSE_RATE, _activeChar.getTemplate().getBaseMReuseRate(), null, skill); } /** * @param target * @return the PAtk (base+modifier) of the L2Character. */ public int getPAtk(L2Character target) { if (_activeChar == null) { return 1; } float bonusAtk = 1; if (Config.EASY_CHAMPION_ENABLE && _activeChar.isEasyChampion()) { bonusAtk = Config.EASY_CHAMPION_ATK; } else if (Config.HARD_CHAMPION_ENABLE && _activeChar.isHardChampion()) { bonusAtk = Config.HARD_CHAMPION_ATK; } if (_activeChar.isRaid()) { bonusAtk *= Config.RAID_PATTACK_MULTIPLIER; } return (int) calcStat(Stats.POWER_ATTACK, _activeChar.getTemplate().getBasePAtk() * bonusAtk, target, null); } /** * @param target * @return the PAtk Modifier against animals. */ public final double getPAtkAnimals(L2Character target) { return calcStat(Stats.PATK_ANIMALS, 1, target, null); } /** * @param target * @return the PAtk Modifier against dragons. */ public final double getPAtkDragons(L2Character target) { return calcStat(Stats.PATK_DRAGONS, 1, target, null); } /** * @param target * @return the PAtk Modifier against insects. */ public final double getPAtkInsects(L2Character target) { return calcStat(Stats.PATK_INSECTS, 1, target, null); } /** * @param target * @return the PAtk Modifier against monsters. */ public final double getPAtkMonsters(L2Character target) { return calcStat(Stats.PATK_MONSTERS, 1, target, null); } /** * @param target * @return the PAtk Modifier against plants. */ public final double getPAtkPlants(L2Character target) { return calcStat(Stats.PATK_PLANTS, 1, target, null); } /** * @param target * @return the PAtk Modifier against giants. */ public final double getPAtkGiants(L2Character target) { return calcStat(Stats.PATK_GIANTS, 1, target, null); } /** * @param target * @return the PAtk Modifier against magic creatures. */ public final double getPAtkMagicCreatures(L2Character target) { return calcStat(Stats.PATK_MCREATURES, 1, target, null); } /** * @return the PAtk Speed (base+modifier) of the L2Character in function of the Armour Expertise Penalty. */ public int getPAtkSpd() { if (_activeChar == null) { return 1; } float bonusAtk = 1; if (Config.EASY_CHAMPION_ENABLE && _activeChar.isEasyChampion()) { bonusAtk = Config.EASY_CHAMPION_SPD_ATK; } else if (Config.HARD_CHAMPION_ENABLE && _activeChar.isHardChampion()) { bonusAtk = Config.HARD_CHAMPION_SPD_ATK; } int val = (int) Math.round(calcStat(Stats.POWER_ATTACK_SPEED, _activeChar.getTemplate().getBasePAtkSpd() * bonusAtk, null, null)); return val; } /** * @param target * @return the PDef Modifier against animals. */ public final double getPDefAnimals(L2Character target) { return calcStat(Stats.PDEF_ANIMALS, 1, target, null); } /** * @param target * @return the PDef Modifier against dragons. */ public final double getPDefDragons(L2Character target) { return calcStat(Stats.PDEF_DRAGONS, 1, target, null); } /** * @param target * @return the PDef Modifier against insects. */ public final double getPDefInsects(L2Character target) { return calcStat(Stats.PDEF_INSECTS, 1, target, null); } /** * @param target * @return the PDef Modifier against monsters. */ public final double getPDefMonsters(L2Character target) { return calcStat(Stats.PDEF_MONSTERS, 1, target, null); } /** * @param target * @return the PDef Modifier against plants. */ public final double getPDefPlants(L2Character target) { return calcStat(Stats.PDEF_PLANTS, 1, target, null); } /** * @param target * @return the PDef Modifier against giants. */ public final double getPDefGiants(L2Character target) { return calcStat(Stats.PDEF_GIANTS, 1, target, null); } /** * @param target * @return the PDef Modifier against giants. */ public final double getPDefMagicCreatures(L2Character target) { return calcStat(Stats.PDEF_MCREATURES, 1, target, null); } /** * @param target * @return the PDef (base+modifier) of the L2Character. */ public int getPDef(L2Character target) { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.POWER_DEFENCE, (_activeChar.isRaid()) ? _activeChar.getTemplate().getBasePDef() * Config.RAID_PDEFENCE_MULTIPLIER : _activeChar.getTemplate().getBasePDef(), target, null); } /** * @return the Physical Attack range (base+modifier) of the L2Character. */ public final int getPhysicalAttackRange() { if (_activeChar == null) { return 1; } if (_activeChar.isTransformed()) { return _activeChar.getTemplate().getBaseAtkRange(); } // Polearm handled here for now. Basically L2PcInstance could have a function // similar to FuncBowAtkRange and NPC are defined in DP. L2Weapon weaponItem = _activeChar.getActiveWeaponItem(); if ((weaponItem != null) && (weaponItem.getItemType() == L2WeaponType.POLE)) { return (int) calcStat(Stats.POWER_ATTACK_RANGE, 66); } return (int) calcStat(Stats.POWER_ATTACK_RANGE, _activeChar.getTemplate().getBaseAtkRange()); } /** * @param target * @return the weapon reuse modifier. */ public final double getWeaponReuseModifier(L2Character target) { return calcStat(Stats.ATK_REUSE, 1, target, null); } /** * @return the RunSpeed (base+modifier) of the L2Character in function of the Armour Expertise Penalty. */ public int getRunSpeed() { if (_activeChar == null) { return 1; } // err we should be adding TO the persons run speed // not making it a constant double baseRunSpd = _activeChar.getTemplate().getBaseRunSpd(); if (baseRunSpd == 0) { return 0; } return (int) Math.round(calcStat(Stats.RUN_SPEED, baseRunSpd, null, null)); } /** * @return the ShieldDef rate (base+modifier) of the L2Character. */ public final int getShldDef() { return (int) calcStat(Stats.SHIELD_DEFENCE, 0); } public int getSp() { return _sp; } public void setSp(int value) { _sp = value; } /** * @return the STR of the L2Character (base+modifier). */ public final int getSTR() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.STAT_STR, _activeChar.getTemplate().getBaseSTR()); } /** * @return the WalkSpeed (base+modifier) of the L2Character. */ public int getWalkSpeed() { if (_activeChar == null) { return 1; } double baseWalkSpd = _activeChar.getTemplate().getBaseWalkSpd(); if (baseWalkSpd == 0) { return 0; } return (int) calcStat(Stats.WALK_SPEED, baseWalkSpd); } /** * @return the WIT of the L2Character (base+modifier). */ public final int getWIT() { if (_activeChar == null) { return 1; } return (int) calcStat(Stats.STAT_WIT, _activeChar.getTemplate().getBaseWIT()); } /** * @param skill * @return the mpConsume. */ public final int getMpConsume(L2Skill skill) { if (skill == null) { return 1; } double mpConsume = skill.getMpConsume(); double nextDanceMpCost = Math.ceil(skill.getMpConsume() / 2.); if (skill.isDance()) { if (Config.DANCE_CONSUME_ADDITIONAL_MP && (_activeChar != null) && (_activeChar.getDanceCount() > 0)) { mpConsume += _activeChar.getDanceCount() * nextDanceMpCost; } } mpConsume = calcStat(Stats.MP_CONSUME, mpConsume, null, skill); if (skill.isDance()) { return (int) calcStat(Stats.DANCE_MP_CONSUME_RATE, mpConsume); } else if (skill.isMagic()) { return (int) calcStat(Stats.MAGICAL_MP_CONSUME_RATE, mpConsume); } else { return (int) calcStat(Stats.PHYSICAL_MP_CONSUME_RATE, mpConsume); } } /** * @param skill * @return the mpInitialConsume. */ public final int getMpInitialConsume(L2Skill skill) { if (skill == null) { return 1; } double mpConsume = calcStat(Stats.MP_CONSUME, skill.getMpInitialConsume(), null, skill); if (skill.isDance()) { return (int) calcStat(Stats.DANCE_MP_CONSUME_RATE, mpConsume); } else if (skill.isMagic()) { return (int) calcStat(Stats.MAGICAL_MP_CONSUME_RATE, mpConsume); } else { return (int) calcStat(Stats.PHYSICAL_MP_CONSUME_RATE, mpConsume); } } public byte getAttackElement() { L2ItemInstance weaponInstance = _activeChar.getActiveWeaponInstance(); // 1st order - weapon element if ((weaponInstance != null) && (weaponInstance.getAttackElementType() >= 0)) { return weaponInstance.getAttackElementType(); } // temp fix starts int tempVal = 0, stats[] = { 0, 0, 0, 0, 0, 0 }; byte returnVal = -2; stats[0] = (int) calcStat(Stats.FIRE_POWER, _activeChar.getTemplate().getBaseFire()); stats[1] = (int) calcStat(Stats.WATER_POWER, _activeChar.getTemplate().getBaseWater()); stats[2] = (int) calcStat(Stats.WIND_POWER, _activeChar.getTemplate().getBaseWind()); stats[3] = (int) calcStat(Stats.EARTH_POWER, _activeChar.getTemplate().getBaseEarth()); stats[4] = (int) calcStat(Stats.HOLY_POWER, _activeChar.getTemplate().getBaseHoly()); stats[5] = (int) calcStat(Stats.DARK_POWER, _activeChar.getTemplate().getBaseDark()); for (byte x = 0; x < 6; x++) { if (stats[x] > tempVal) { returnVal = x; tempVal = stats[x]; } } return returnVal; // temp fix ends /* * uncomment me once deadlocks in getAllEffects() fixed return _activeChar.getElementIdFromEffects(); */ } public int getAttackElementValue(byte attackAttribute) { switch (attackAttribute) { case Elementals.FIRE: return (int) calcStat(Stats.FIRE_POWER, _activeChar.getTemplate().getBaseFire()); case Elementals.WATER: return (int) calcStat(Stats.WATER_POWER, _activeChar.getTemplate().getBaseWater()); case Elementals.WIND: return (int) calcStat(Stats.WIND_POWER, _activeChar.getTemplate().getBaseWind()); case Elementals.EARTH: return (int) calcStat(Stats.EARTH_POWER, _activeChar.getTemplate().getBaseEarth()); case Elementals.HOLY: return (int) calcStat(Stats.HOLY_POWER, _activeChar.getTemplate().getBaseHoly()); case Elementals.DARK: return (int) calcStat(Stats.DARK_POWER, _activeChar.getTemplate().getBaseDark()); default: return 0; } } public int getDefenseElementValue(byte defenseAttribute) { switch (defenseAttribute) { case Elementals.FIRE: return (int) calcStat(Stats.FIRE_RES, _activeChar.getTemplate().getBaseFireRes()); case Elementals.WATER: return (int) calcStat(Stats.WATER_RES, _activeChar.getTemplate().getBaseWaterRes()); case Elementals.WIND: return (int) calcStat(Stats.WIND_RES, _activeChar.getTemplate().getBaseWindRes()); case Elementals.EARTH: return (int) calcStat(Stats.EARTH_RES, _activeChar.getTemplate().getBaseEarthRes()); case Elementals.HOLY: return (int) calcStat(Stats.HOLY_RES, _activeChar.getTemplate().getBaseHolyRes()); case Elementals.DARK: return (int) calcStat(Stats.DARK_RES, _activeChar.getTemplate().getBaseDarkRes()); default: return 0; } } } Изменено 11 октября, 2014 пользователем ZloD3y 1 Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты
ZloD3y 2 Опубликовано 11 октября, 2014 (изменено) В апдейте будет уже только Voiced_MyStats Изменено 11 октября, 2014 пользователем ZloD3y Поделиться сообщением Ссылка на сообщение Поделиться на другие сайты