@Override public void act(Player player, Item parentItem, Item targetItem) { if (!player.getInventory().decreaseByObjectId(parentItem.getObjectId(), 1)) { return; } if (targetItem.getItemSkinTemplate().isItemDyePermitted()) { if (getColorBGRA() == 0) { targetItem.setItemColor(0); targetItem.setColorExpireTime(0); } else { targetItem.setItemColor(parentItem.getItemTemplate().getTemplateId()); if (minutes != null) { targetItem.setColorExpireTime((int) (System.currentTimeMillis() / 1000 + minutes * 60)); } } // item is equipped, so need broadcast packet if (player.getEquipment().getEquippedItemByObjId(targetItem.getObjectId()) != null) { PacketSendUtility.broadcastPacket( player, new SM_UPDATE_PLAYER_APPEARANCE( player.getObjectId(), player.getEquipment().getEquippedForApparence()), true); player.getEquipment().setPersistentState(PersistentState.UPDATE_REQUIRED); } // item is not equipped else { player.getInventory().setPersistentState(PersistentState.UPDATE_REQUIRED); } ItemPacketService.updateItemAfterInfoChange(player, targetItem); } }
@Override protected void writeImpl(AionChannelHandler cHandler) { writeD(playerId); short mask = 0; for (Item item : items) { mask |= item.getEquipmentSlot(); } writeH(mask); for (Item item : items) { writeD(item.getItemSkinTemplate().getTemplateId()); GodStone godStone = item.getGodStone(); writeD(godStone != null ? godStone.getItemId() : 0); writeD(item.getItemColor()); writeH(0x00); // unk (0x00) } }