- Хроники
- Chaotic Throne: High Five
- Исходники
- Присутствуют
- Сборка
- jts
Пришлось посидеть, подправить код чтобы наконец dressme заработало, но dressme-weapon отказывается работать - бьет ошибку в ГС null
ERROR DressMe - Dress me system: Weapon Map is null.
Возможно кто-то подскажет что тут не так?
ERROR DressMe - Dress me system: Weapon Map is null.
Возможно кто-то подскажет что тут не так?
Код:
else if("dressme-weapon".equals(command))
{
ItemInstance slot = player.getInventory().getPaperdollItem(Inventory.PAPERDOLL_RHAND);
if(slot == null)
{
player.sendMessage("Error: Weapon must be equiped!");
return false;
}
ItemType type = slot.getItemType();
HtmlMessage html = new HtmlMessage(5).setFile("command/dressme/index-weapon.htm");
String template = HtmCache.getInstance().getHtml("command/dressme/template-weapon.htm", player);
String block = "";
String list = "";
if(args == null)
args = "1";
String[] param = args.split(" ");
final int page = param[0].length() > 0 ? Integer.parseInt(param[0]) : 1;
final int perpage = 5;
int counter = 0;
Map<Integer, DressWeaponData> map = new HashMap<>();
map = initMap(type.toString());
if(map == null)
{
player.sendMessage(player.isLangRus() ? "Ваше оружие не поддерживается!" : "Your weapon type is not supported!");
_log.error("Dress me system: Weapon Map is null.");
return false;
}
for(int i = (page - 1) * perpage; i < map.size(); i++)
{
DressWeaponData weapon = map.get(i + 1);
if(weapon != null)
{
block = template;
String cloak_name = weapon.getName();
if(cloak_name.length() > 29)
cloak_name = cloak_name.substring(0, 29) + "...";
block = block.replace("{bypass}", "bypass -h user_dress-weaponpage " + weapon.getId());
block = block.replace("{name}", cloak_name);
block = block.replace("{price}", Util.formatPay(player, weapon.getPriceCount(), weapon.getPriceId()));
block = block.replace("{icon}", Util.getItemIcon(weapon.getId()));
list += block;
}
counter++;
if(counter >= perpage)
break;
}
double count = Math.ceil((double) map.size() / (double) perpage);
int inline = 1;
String navigation = "";
for(int i = 1; i <= count; i++)
{
if(i == page)
navigation += "<td width=25 align=center valign=top><button value=\"[" + i + "]\" action=\"bypass -h user_dressme-weapon " + i + "\" width=32 height=25 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td>";
else
navigation += "<td width=25 align=center valign=top><button value=\"" + i + "\" action=\"bypass -h user_dressme-weapon " + i + "\" width=32 height=25 back=\"L2UI_CT1.Button_DF_Down\" fore=\"L2UI_CT1.Button_DF\"></td>";
if(inline % 7 == 0)
navigation += "</tr><tr>";
inline++;
}
if(navigation.equals(""))
navigation = "<td width=30 align=center valign=top>...</td>";
html = html.replace("%list%", list);
html = html.replace("%navigation%", navigation);
player.sendPacket(html);
return true;
}