private static void summonJadHealers(Player p, Npc jad) { for (int i = 0; i < 4; i++) { Npc npc = new Npc(2746); Location minCoords = new Location((20000 + 2363) + (200 * p.getIndex()), 25502, 0); Location maxCoords = new Location((20000 + 2430) + (200 * p.getIndex()), 25123, 0); npc.setMinimumCoords(minCoords); npc.setMaximumCoords(maxCoords); npc.setLocation(new Location((20000 + 2387) + (200 * p.getIndex()) + Misc.random(22), 20000 + 5069 + Misc.random(33), 0)); npc.setEntityFocus(jad.getClientIndex()); npc.setOwner(p); npc.getFollow().setFollowing(jad); npc.setTarget(null); Server.getNpcList().Add(npc); Event jadHealerEvent = new Event(2000); jadHealerEvent.setAction(() => { if (npc.isDead() || npc.isHidden() || npc.isDestroyed()) { jadHealerEvent.stop(); return; } if (npc.getLocation().withinDistance(jad.getLocation(), 2) && !npc.inCombat()) { if (Misc.random(7) == 0) { jad.setLastGraphics(new Graphics(444)); npc.setLastAnimation(new Animation(9254)); int jadMaxHp = jad.getMaxHp(); jad.heal((int)(jadMaxHp * 0.5)); } } }); Server.registerEvent(jadHealerEvent); } }
private static bool canThieveNpc(Player p, Npc npc, int index) { if (p == null || npc == null || npc.isDead() || npc.isHidden() || npc.isDestroyed() || p.isDead() || p.isDestroyed()) { return false; } if (!p.getLocation().withinDistance(npc.getLocation(), 2)) { return false; } if (p.getSkills().getGreaterLevel(Skills.SKILL.THIEVING) < NPC_LVL[index]) { p.getPackets().sendMessage("You need a Thieving level of " + NPC_LVL[index] + " to rob this Npc."); p.setFaceLocation(npc.getLocation()); return false; } if (p.getInventory().findFreeSlot() == -1) { p.getPackets().sendMessage("You need a free inventory space for any potential loot."); return false; } if (p.getTemporaryAttribute("stunned") != null) { return false; } if (p.getTemporaryAttribute("lastPickPocket") != null) { if (Environment.TickCount - (int)p.getTemporaryAttribute("lastPickPocket") < 1500) { return false; } } return true; }