@Override public String onAggroRangeEnter(L2NpcInstance npc, L2PcInstance player, boolean isPet) { int npcId = npc.getNpcId(); if (npcId == ZAKEN) { if (_Zone.isInsideZone(npc)) { L2Character target = isPet ? player.getPet() : player; ((L2Attackable) npc).addDamageHate(target, 1, 200); } if (player.getZ() > (npc.getZ() - 100) && player.getZ() < (npc.getZ() + 100)) { if (_quest0 < 5 && Rnd.get(3) < 1) { if (_quest0 == 0) { c_quest0 = player; } else if (_quest0 == 1) { c_quest1 = player; } else if (_quest0 == 2) { c_quest2 = player; } else if (_quest0 == 3) { c_quest3 = player; } else if (_quest0 == 4) { c_quest4 = player; } _quest0++; } if (Rnd.get(15) < 1) { int i0 = Rnd.get((15 * 15)); if (i0 < 1) { npc.setTarget(player); npc.doCast(SkillTable.getInstance().getInfo(4216, 1)); } else if (i0 < 2) { npc.setTarget(player); npc.doCast(SkillTable.getInstance().getInfo(4217, 1)); } else if (i0 < 4) { npc.setTarget(player); npc.doCast(SkillTable.getInstance().getInfo(4219, 1)); } else if (i0 < 8) { npc.setTarget(player); npc.doCast(SkillTable.getInstance().getInfo(4218, 1)); } else if (i0 < 15) { for (L2Character character : npc.getKnownList().getKnownCharactersInRadius(100)) { if (character != player) continue; if (player != ((L2Attackable) npc).getMostHated()) { npc.setTarget(player); npc.doCast(SkillTable.getInstance().getInfo(4221, 1)); } } } if (Rnd.get(2) < 1) { if (player == ((L2Attackable) npc).getMostHated()) { npc.setTarget(player); npc.doCast(SkillTable.getInstance().getInfo(4220, 1)); } } } } } return super.onAggroRangeEnter(npc, player, isPet); }
@Override public String onAttack(L2NpcInstance npc, L2PcInstance attacker, int damage, boolean isPet) { int npcId = npc.getNpcId(); if (npcId == ZAKEN) { if (attacker.getMountType() == 1) { int sk_4258 = 0; L2Effect[] effects = attacker.getAllEffects(); if (effects != null && effects.length != 0) { for (L2Effect e : effects) { if (e.getSkill().getId() == 4258) { sk_4258 = 1; } } } if (sk_4258 == 0) { npc.setTarget(attacker); npc.doCast(SkillTable.getInstance().getInfo(4258, 1)); } } L2Character originalAttacker = isPet ? attacker.getPet() : attacker; int hate = (int) (((damage / npc.getMaxHp()) / 0.05) * 20000); ((L2Attackable) npc).addDamageHate(originalAttacker, 0, hate); if (Rnd.get(10) < 1) { int i0 = Rnd.get((15 * 15)); if (i0 < 1) { npc.setTarget(attacker); npc.doCast(SkillTable.getInstance().getInfo(4216, 1)); } else if (i0 < 2) { npc.setTarget(attacker); npc.doCast(SkillTable.getInstance().getInfo(4217, 1)); } else if (i0 < 4) { npc.setTarget(attacker); npc.doCast(SkillTable.getInstance().getInfo(4219, 1)); } else if (i0 < 8) { npc.setTarget(attacker); npc.doCast(SkillTable.getInstance().getInfo(4218, 1)); } else if (i0 < 15) { for (L2Character character : npc.getKnownList().getKnownCharactersInRadius(100)) { if (character != attacker) continue; if (attacker != ((L2Attackable) npc).getMostHated()) { npc.setTarget(attacker); npc.doCast(SkillTable.getInstance().getInfo(4221, 1)); } } } if (Rnd.get(2) < 1) { if (attacker == ((L2Attackable) npc).getMostHated()) { npc.setTarget(attacker); npc.doCast(SkillTable.getInstance().getInfo(4220, 1)); } } } if (getTimeHour() < 5) { } else if (npc.getCurrentHp() < ((npc.getMaxHp() * _quest2) / 4.0)) { _quest2 = (_quest2 - 1); int i2 = Rnd.get(15); _ai1 = Xcoords[i2] + Rnd.get(650); _ai2 = Ycoords[i2] + Rnd.get(650); _ai3 = Zcoords[i2]; npc.setTarget(npc); npc.doCast(SkillTable.getInstance().getInfo(4222, 1)); } } return super.onAttack(npc, attacker, damage, isPet); }
@Override protected void runImpl() { L2PcInstance player = getClient().getActiveChar(); if (player == null || !(player.getPet().isPet)) return; // Alt game - Karma punishment if (!Config.ALT_GAME_KARMA_PLAYER_CAN_TRADE && player.getKarma() > 0) return; if (player.getPrivateStoreType() != 0) { player.sendMessage("Cannot exchange items while trading"); return; } if (player.isCastingNow()) { return; } if (player.getActiveEnchantItem() != null) { Util.handleIllegalPlayerAction( player, "Player " + player.getName() + " Tried To Use Enchant Exploit! Ban This Player", Config.DEFAULT_PUNISH); return; } if (player.InventoryMoreLimit()) { return; } // Exploit Fix for Hero weapons Uses pet Inventory to buy New One. // [L2Scoria] L2ItemInstance item = player.getInventory().getItemByObjectId(_objectId); if (item == null) return; if (item.isAugmented()) return; if (!item.isDropable() || !item.isDestroyable() || !item.isTradeable()) { sendPacket(new SystemMessage(SystemMessageId.ITEM_NOT_FOR_PETS)); return; } if (item.isTimeLimitedItem()) { sendPacket(new SystemMessage(SystemMessageId.ITEM_NOT_FOR_PETS)); return; } L2PetInstance pet = (L2PetInstance) player.getPet(); if (pet.isDead()) { sendPacket(new SystemMessage(SystemMessageId.CANNOT_GIVE_ITEMS_TO_DEAD_PET)); return; } if (_amount < 0) return; if (player.transferItem("Transfer", _objectId, _amount, pet.getInventory(), pet) == null) { _log.warn( "Invalid item transfer request: " + pet.getName() + "(pet) --> " + player.getName()); } }