При продаже вещей чаром, который имеет данный пассивный скилл, все итемы продаются дороже на 24% любому мерханту.
Скрытый текст
@Override
protected void runImpl()
{
L2PcInstance player = getClient().getActiveChar();
if(player == null)
return;
if (!getClient().getFloodProtectors().getTransaction().tryPerformAction("buy"))
{
player.sendMessage("У меня не десять рук...");
return;
}
// Alt game - Karma punishment
if(!Config.ALT_GAME_KARMA_PLAYER_CAN_SHOP && player.getKarma() > 0)
return;
L2Object target = player.getTarget();
if(!player.isGM() && (target == null // No target (ie GM Shop)
|| !(target instanceof L2MerchantInstance) // Target not a merchant and not mercmanager
|| !player.isInsideRadius(target, L2NpcInstance.INTERACTION_DISTANCE, false, false)))
return; // Distance is too far
boolean ok = true;
String htmlFolder = "";
if(target != null)
{
if(target instanceof L2MerchantInstance)
{
htmlFolder = "merchant";
}
else if(target instanceof L2FishermanInstance)
{
htmlFolder = "fisherman";
}
else
{
ok = false;
}
}
else
{
ok = false;
}
L2NpcInstance merchant = null;
if(ok)
{
merchant = (L2NpcInstance) target;
}
if(merchant != null && _listId > 1000000) // lease
{
if(merchant.getTemplate().npcId != _listId - 1000000)
{
sendPacket(ActionFailed.STATIC_PACKET);
return;
}
}
long totalPrice = 0;
//long totalPrice2 = 0;
// Proceed the sell
for(int i = 0; i < _count; i++)
{
int objectId = _items[i * 3 + 0];
@SuppressWarnings("unused")
int itemId = _items[i * 3 + 1];
int count = _items[i * 3 + 2];
// Check count
if(count <= 0 || count > Integer.MAX_VALUE)
{
SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED);
sendPacket(sm);
sm = null;
return;
}
L2ItemInstance item = player.checkItemManipulation(objectId, count, "sell");
// Check Item
if(item == null || !item.getItem().isSellable())
{
continue;
}
long price = item.getReferencePrice() / 2;
totalPrice += price * count;
// Fix exploit during Sell
if ((Integer.MAX_VALUE / count) < price || totalPrice > Integer.MAX_VALUE)
{
SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED);
sendPacket(sm);
sm = null;
return;
}
// Check totalPrice
if(totalPrice <= 0)
{
SystemMessage sm = new SystemMessage(SystemMessageId.YOU_HAVE_EXCEEDED_QUANTITY_THAT_CAN_BE_INPUTTED);
sendPacket(sm);
sm = null;
return;
}
item = player.getInventory().destroyItem("Sell", objectId, count, player, null);
}
player.addAdena("Sell", (int) totalPrice, merchant, false);
String html = HtmCache.getInstance().getHtm("data/html/" + htmlFolder + "/" + merchant.getNpcId() + "-sold.htm");
if(html != null)
{
NpcHtmlMessage soldMsg = new NpcHtmlMessage(merchant.getObjectId());
soldMsg.setHtml(html.replaceAll("%objectId%", String.valueOf(merchant.getObjectId())));
player.sendPacket(soldMsg);
}
// Update current load as well
StatusUpdate su = new StatusUpdate(player.getObjectId());
su.addAttribute(StatusUpdate.CUR_LOAD, player.getCurrentLoad());
player.sendPacket(su);
player.sendPacket(new ItemList(player, true));
}
Задача: Сделать так, чтобы в .xml скила, теге power, цифра - обозначала количество %.
Т.е.
<set name="power" val="24"/> будет означать, что вещи будут продаватся на 24% дороже.
Вот только не пойму, как можно вызвать метод getPower, или я не в ту степь думаю?
Будьте добры подскажите...

Вход
Регистрация

Публикации
Мужчина
История изменения имен