Sync with L2jServer HighFive Apr 21st 2015.

This commit is contained in:
MobiusDev
2015-04-22 09:59:28 +00:00
parent c896c6cd51
commit 1a6970e30d
37 changed files with 1518 additions and 1298 deletions

View File

@ -85,7 +85,7 @@ public class L2NpcActionShift implements IActionShiftHandler
html.replace("%accu%", String.valueOf(((L2Character) target).getAccuracy()));
html.replace("%evas%", String.valueOf(((L2Character) target).getEvasionRate(null)));
html.replace("%crit%", String.valueOf(((L2Character) target).getCriticalHit(null, null)));
html.replace("%rspd%", String.valueOf(((L2Character) target).getRunSpeed()));
html.replace("%rspd%", String.valueOf((int) ((L2Character) target).getRunSpeed()));
html.replace("%aspd%", String.valueOf(((L2Character) target).getPAtkSpd()));
html.replace("%cspd%", String.valueOf(((L2Character) target).getMAtkSpd()));
html.replace("%atkType%", String.valueOf(((L2Character) target).getTemplate().getBaseAttackType()));

View File

@ -1005,7 +1005,7 @@ public class AdminEditChar implements IAdminCommandHandler
adminReply.replace("%accuracy%", String.valueOf(player.getAccuracy()));
adminReply.replace("%evasion%", String.valueOf(player.getEvasionRate(null)));
adminReply.replace("%critical%", String.valueOf(player.getCriticalHit(null, null)));
adminReply.replace("%runspeed%", String.valueOf(player.getRunSpeed()));
adminReply.replace("%runspeed%", String.valueOf((int) player.getRunSpeed()));
adminReply.replace("%patkspd%", String.valueOf(player.getPAtkSpd()));
adminReply.replace("%matkspd%", String.valueOf(player.getMAtkSpd()));
adminReply.replace("%access%", player.getAccessLevel().getLevel() + " (" + player.getAccessLevel().getName() + ")");

View File

@ -290,34 +290,7 @@ public class NpcViewMod implements IBypassHandler
final IDropItem dropItem = dropList.get(i);
if (dropItem instanceof GeneralDropItem)
{
final GeneralDropItem generalDropItem = (GeneralDropItem) dropItem;
final L2Item item = ItemTable.getInstance().getTemplate(generalDropItem.getItemId());
sb.append("<table width=332 cellpadding=2 cellspacing=0 background=\"L2UI_CT1.Windows.Windows_DF_TooltipBG\">");
sb.append("<tr><td width=32 valign=top>");
sb.append("<img src=\"" + item.getIcon() + "\" width=32 height=32>");
sb.append("</td><td fixwidth=300 align=center><font name=\"hs9\" color=\"CD9000\">");
sb.append(item.getName());
sb.append("</font></td></tr><tr><td width=32></td><td width=300><table width=295 cellpadding=0 cellspacing=0>");
sb.append("<tr><td width=48 align=right valign=top><font color=\"LEVEL\">Amount:</font></td>");
sb.append("<td width=247 align=center>");
final long min = generalDropItem.getMin(npc, activeChar);
final long max = generalDropItem.getMax(npc, activeChar);
if (min == max)
{
sb.append(amountFormat.format(min));
}
else
{
sb.append(amountFormat.format(min));
sb.append(" - ");
sb.append(amountFormat.format(max));
}
sb.append("</td></tr><tr><td width=48 align=right valign=top><font color=\"LEVEL\">Chance:</font></td>");
sb.append("<td width=247 align=center>");
sb.append(chanceFormat.format(Math.min(generalDropItem.getChance(npc, activeChar), 100)));
sb.append("%</td></tr></table></td></tr><tr><td width=32></td><td width=300>&nbsp;</td></tr></table>");
addGeneralDropItem(activeChar, npc, amountFormat, chanceFormat, sb, (GeneralDropItem) dropItem);
}
else if (dropItem instanceof GroupedGeneralDropItem)
{
@ -325,46 +298,21 @@ public class NpcViewMod implements IBypassHandler
if (generalGroupedDropItem.getItems().size() == 1)
{
final GeneralDropItem generalDropItem = generalGroupedDropItem.getItems().get(0);
final L2Item item = ItemTable.getInstance().getTemplate(generalDropItem.getItemId());
sb.append("<table width=332 cellpadding=2 cellspacing=0 background=\"L2UI_CT1.Windows.Windows_DF_TooltipBG\">");
sb.append("<tr><td width=32 valign=top>");
sb.append("<img src=\"" + item.getIcon() + "\" width=32 height=32>");
sb.append("</td><td fixwidth=300 align=center><font name=\"hs9\" color=\"CD9000\">");
sb.append(item.getName());
sb.append("</font></td></tr><tr><td width=32></td><td width=300><table width=295 cellpadding=0 cellspacing=0>");
sb.append("<tr><td width=48 align=right valign=top><font color=\"LEVEL\">Amount:</font></td>");
sb.append("<td width=247 align=center>");
final long min = generalDropItem.getMin(npc, activeChar);
final long max = generalDropItem.getMax(npc, activeChar);
if (min == max)
{
sb.append(amountFormat.format(min));
}
else
{
sb.append(amountFormat.format(min));
sb.append(" - ");
sb.append(amountFormat.format(max));
}
sb.append("</td></tr><tr><td width=48 align=right valign=top><font color=\"LEVEL\">Chance:</font></td>");
sb.append("<td width=247 align=center>");
sb.append(chanceFormat.format(Math.min(generalGroupedDropItem.getChance(npc, activeChar), 100)));
sb.append("%</td></tr></table></td></tr><tr><td width=32></td><td width=300>&nbsp;</td></tr></table>");
addGeneralDropItem(activeChar, npc, amountFormat, chanceFormat, sb, new GeneralDropItem(generalDropItem.getItemId(), generalDropItem.getMin(), generalDropItem.getMax(), (generalDropItem.getChance() * generalGroupedDropItem.getChance()) / 100, generalDropItem.getAmountStrategy(), generalDropItem.getChanceStrategy(), generalGroupedDropItem.getPreciseStrategy(), generalGroupedDropItem.getKillerChanceModifierStrategy(), generalDropItem.getDropCalculationStrategy()));
}
else
{
GroupedGeneralDropItem normalized = generalGroupedDropItem.normalizeMe(npc, activeChar);
sb.append("<table width=332 cellpadding=2 cellspacing=0 background=\"L2UI_CT1.Windows.Windows_DF_TooltipBG\">");
sb.append("<tr><td width=32 valign=top><img src=\"L2UI_CT1.ICON_DF_premiumItem\" width=32 height=32></td>");
sb.append("<td fixwidth=300 align=center><font name=\"ScreenMessageSmall\" color=\"CD9000\">One from group</font>");
sb.append("</td></tr><tr><td width=32></td><td width=300><table width=295 cellpadding=0 cellspacing=0><tr>");
sb.append("<td width=48 align=right valign=top><font color=\"LEVEL\">Chance:</font></td>");
sb.append("<td width=247 align=center>");
sb.append(chanceFormat.format(Math.min(generalGroupedDropItem.getChance(npc, activeChar), 100)));
sb.append(chanceFormat.format(Math.min(normalized.getChance(), 100)));
sb.append("%</td></tr></table><br>");
for (GeneralDropItem generalDropItem : generalGroupedDropItem.getItems())
for (GeneralDropItem generalDropItem : normalized.getItems())
{
final L2Item item = ItemTable.getInstance().getTemplate(generalDropItem.getItemId());
sb.append("<table width=291 cellpadding=2 cellspacing=0 background=\"L2UI_CT1.Windows.Windows_DF_TooltipBG\">");
@ -374,9 +322,9 @@ public class NpcViewMod implements IBypassHandler
sb.append(item.getName());
sb.append("</font></td></tr><tr><td width=32></td><td width=259><table width=253 cellpadding=0 cellspacing=0>");
sb.append("<tr><td width=48 align=right valign=top><font color=\"LEVEL\">Amount:</font></td><td width=205 align=center>");
final long min = generalDropItem.getMin(npc, activeChar);
final long max = generalDropItem.getMax(npc, activeChar);
MinMax minMax = getPreciseMinMax(normalized.getChance(), generalDropItem.getMin(npc, activeChar), generalDropItem.getMax(npc, activeChar), generalDropItem.isPreciseCalculated());
final long min = minMax.min;
final long max = minMax.max;
if (min == max)
{
sb.append(amountFormat.format(min));
@ -433,4 +381,68 @@ public class NpcViewMod implements IBypassHandler
html = html.replaceAll("%items%", bodySb.toString());
Util.sendCBHtml(activeChar, html);
}
/**
* @param activeChar
* @param npc
* @param amountFormat
* @param chanceFormat
* @param sb
* @param dropItem
*/
private static void addGeneralDropItem(L2PcInstance activeChar, L2Npc npc, final DecimalFormat amountFormat, final DecimalFormat chanceFormat, final StringBuilder sb, final GeneralDropItem dropItem)
{
final L2Item item = ItemTable.getInstance().getTemplate(dropItem.getItemId());
sb.append("<table width=332 cellpadding=2 cellspacing=0 background=\"L2UI_CT1.Windows.Windows_DF_TooltipBG\">");
sb.append("<tr><td width=32 valign=top>");
sb.append("<img src=\"" + item.getIcon() + "\" width=32 height=32>");
sb.append("</td><td fixwidth=300 align=center><font name=\"hs9\" color=\"CD9000\">");
sb.append(item.getName());
sb.append("</font></td></tr><tr><td width=32></td><td width=300><table width=295 cellpadding=0 cellspacing=0>");
sb.append("<tr><td width=48 align=right valign=top><font color=\"LEVEL\">Amount:</font></td>");
sb.append("<td width=247 align=center>");
MinMax minMax = getPreciseMinMax(dropItem.getChance(npc, activeChar), dropItem.getMin(npc, activeChar), dropItem.getMax(npc, activeChar), dropItem.isPreciseCalculated());
final long min = minMax.min;
final long max = minMax.max;
if (min == max)
{
sb.append(amountFormat.format(min));
}
else
{
sb.append(amountFormat.format(min));
sb.append(" - ");
sb.append(amountFormat.format(max));
}
sb.append("</td></tr><tr><td width=48 align=right valign=top><font color=\"LEVEL\">Chance:</font></td>");
sb.append("<td width=247 align=center>");
sb.append(chanceFormat.format(Math.min(dropItem.getChance(npc, activeChar), 100)));
sb.append("%</td></tr></table></td></tr><tr><td width=32></td><td width=300>&nbsp;</td></tr></table>");
}
private static class MinMax
{
public final long min, max;
public MinMax(long min, long max)
{
this.min = min;
this.max = max;
}
}
private static MinMax getPreciseMinMax(double chance, long min, long max, boolean isPrecise)
{
if (!isPrecise || (chance <= 100))
{
return new MinMax(min, max);
}
int mult = (int) (chance) / 100;
return new MinMax(mult * min, (chance % 100) > 0 ? (mult + 1) * max : mult * max);
}
}