Merge pull request #6 from dginovker/pestcontrol

Lots of pest control changes
This commit is contained in:
Daniel Ginovker 2019-06-15 22:24:33 -04:00 committed by GitHub
commit f37d415cca
25 changed files with 388 additions and 148 deletions

View file

@ -11,6 +11,8 @@ import org.crandor.net.amsc.WorldCommunicator;
import org.crandor.tools.TimeStamp;
import org.crandor.tools.backup.AutoBackup;
import java.net.BindException;
/**
* The main class, for those that are unable to read the class' name.
* @author Emperor
@ -51,7 +53,14 @@ public final class Main{
SQLManager.init();
Runtime.getRuntime().addShutdownHook(new Thread(new SystemShutdownHook()));
SystemLogger.log("Starting NIO reactor...");
reactor = NioReactor.configure(43594 + GameWorld.getSettings().getWorldId());
try {
reactor = NioReactor.configure(43594 + GameWorld.getSettings().getWorldId());
} catch (BindException e) {
System.out.println("Port " + 43594 + GameWorld.getSettings().getWorldId() + " is already in use!");
throw e;
}
WorldCommunicator.connect();
reactor.start();
SystemLogger.log(GameWorld.getName() + " flags " + GameWorld.getSettings().toString());

View file

@ -266,5 +266,4 @@ public abstract class Node {
public void setRenderable(boolean renderable) {
this.renderable = renderable;
}
}

View file

@ -298,6 +298,11 @@ public class Player extends Entity {
*/
protected SkillerTasks skillTasks = new SkillerTasks();
/**
* A custom state for bot debugging
*/
private String customState = "";
/**
* Constructs a new {@code Player} {@code Object}.
* @param details The player's details.
@ -1261,5 +1266,12 @@ public class Player extends Entity {
}
public String getCustomState() {
return customState;
}
public void setCustomState(String state)
{
this.customState = state;
}
}

View file

@ -13,7 +13,6 @@ import org.crandor.game.interaction.Option;
import org.crandor.game.interaction.OptionHandler;
import org.crandor.game.node.Node;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.CombatStyle;
import org.crandor.game.node.entity.npc.NPC;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.info.PlayerDetails;
@ -134,12 +133,16 @@ public class AIPlayer extends Player {
{
Pathfinder.find(this, this.getLocation().transform(RandomFunction.random(radiusX, (radiusX * -1)), RandomFunction.random(radiusY, (radiusY * -1)), 0), false, Pathfinder.SMART).walk(this);
}
protected void walkToPosSmart(Location loc) {
Pathfinder.find(this, loc, true, Pathfinder.SMART).walk(this);
}
public void walkPos(int x, int y)
{
Pathfinder.find(this, new Location(x, y));
}
public boolean checkVictimIsPlayer()
{
if (this.getProperties().getCombatPulse().getVictim() != null)
@ -147,8 +150,8 @@ public class AIPlayer extends Player {
return true;
return false;
}
public Item getItemById(int id)
public Item getItemById(int id)
{
for (int i = 0; i < 28; i++)
{
@ -161,7 +164,7 @@ public class AIPlayer extends Player {
}
return null;
}
private ArrayList<Node> getNodeInRange(int range, int entry)
{
int meX = this.getLocation().getX();
@ -176,25 +179,25 @@ public class AIPlayer extends Player {
Node node = RegionManager.getObject(0, meX + x, meY + y);
if (node != null)
if (node.getId() == entry)
nodes.add(node);
nodes.add(node);
Node node2 = RegionManager.getObject(0, meX + x, meY - y);
if (node2 != null)
if (node2.getId() == entry)
nodes.add(node2);
nodes.add(node2);
Node node3 = RegionManager.getObject(0, meX - x, meY + y);
if (node3 != null)
if (node3.getId() == entry)
nodes.add(node3);
nodes.add(node3);
Node node4 = RegionManager.getObject(0, meX - x, meY - y);
if (node4 != null)
if (node4.getId() == entry)
nodes.add(node4);
nodes.add(node4);
}
}
return nodes;
}
private ArrayList<Node> getNodeInRange(int range, ArrayList<Integer> entrys)
private ArrayList<Node> getNodeInRange(int range, List<Integer> entrys)
{
int meX = this.getLocation().getX();
int meY = this.getLocation().getY();
@ -208,48 +211,48 @@ public class AIPlayer extends Player {
Node node = RegionManager.getObject(0, meX + x, meY + y);
if (node != null)
if (entrys.contains(node.getId()))
nodes.add(node);
nodes.add(node);
Node node2 = RegionManager.getObject(0, meX + x, meY - y);
if (node2 != null)
if (entrys.contains(node2.getId()))
nodes.add(node2);
nodes.add(node2);
Node node3 = RegionManager.getObject(0, meX - x, meY + y);
if (node3 != null)
if (entrys.contains(node3.getId()))
nodes.add(node3);
nodes.add(node3);
Node node4 = RegionManager.getObject(0, meX - x, meY - y);
if (node4 != null)
if (entrys.contains(node4.getId()))
nodes.add(node4);
nodes.add(node4);
}
}
return nodes;
}
public Node getClosestNodeWithEntry(int range, int entry)
{
ArrayList<Node> nodeList = getNodeInRange(range, entry);
if (nodeList.isEmpty())
{
System.out.println("nodelist empty");
//System.out.println("nodelist empty");
return null;
}
Node node = getClosestNodeinNodeList(nodeList);
return node;
}
public Node getClosestNodeWithEntry(int range, ArrayList<Integer> entrys)
public Node getClosestNodeWithEntry(int range, List<Integer> entrys)
{
ArrayList<Node> nodeList = getNodeInRange(range, entrys);
if (nodeList.isEmpty())
{
System.out.println("nodelist empty");
//System.out.println("nodelist empty");
return null;
}
Node node = getClosestNodeinNodeList(nodeList);
return node;
}
public Node getClosesCreature(int radius) {
int distance = radius + 1;
Node npcReturn = null;
@ -262,7 +265,7 @@ public class AIPlayer extends Player {
}
return npcReturn;
}
public Node getClosesCreature(int radius, int entry) {
int distance = radius + 1;
Node npcReturn = null;
@ -277,7 +280,7 @@ public class AIPlayer extends Player {
}
return npcReturn;
}
public Node getClosesCreature(int radius, ArrayList<Integer> entrys) {
int distance = radius + 1;
Node npcReturn = null;
@ -292,15 +295,15 @@ public class AIPlayer extends Player {
}
return npcReturn;
}
private Node getClosestNodeinNodeList(ArrayList<Node> nodes)
{
if (nodes.isEmpty())
{
System.out.println("nodelist empty");
//System.out.println("nodelist empty");
return null;
}
double distance = 0;
Node nodeReturn = null;
for (Node node : nodes)
@ -388,5 +391,4 @@ public class AIPlayer extends Player {
public void setControler(Player controler) {
this.controler = controler;
}
}

View file

@ -0,0 +1,178 @@
package org.crandor.game.node.entity.player.ai.minigamebots;
import org.crandor.game.content.skill.Skills;
import org.crandor.game.node.Node;
import org.crandor.game.node.entity.player.ai.pvmbots.PvMBots;
import org.crandor.game.node.entity.player.link.prayer.*;
import org.crandor.game.world.map.Location;
import org.crandor.net.packet.in.InteractionPacket;
import org.crandor.tools.RandomFunction;
import java.util.Random;
import static plugin.activity.pestcontrol.PestControlHelper.*;
public class PestControlTestBot extends PvMBots {
private int tick = 0;
private int combatMoveTimer = 0;
private int movetimer = 0;
private int randomType;
private BoatInfo myBoat = BoatInfo.NOVICE;
enum State {
OUTSIDE_GANGPLANK,
WAITING_IN_BOAT,
NPC_COMBAT,
GET_TO_PC
}
public PestControlTestBot(String name, Location l) {
super(name, legitimizeLocation(l));
randomType = new Random().nextInt(100);
}
private static Location legitimizeLocation(Location l) {
return landerContainsLoc(l) ? new Location(2657, 2639, 0) : l;
}
@Override
public void tick()
{
super.tick();
movetimer --;
if (movetimer <= 0)
{
movetimer = 0;
State state = getState();
this.setCustomState(String.valueOf(state));
switch (state)
{
case GET_TO_PC:
getToPC();
break;
case OUTSIDE_GANGPLANK:
enterBoat();
break;
case WAITING_IN_BOAT:
idleInBoat();
break;
case NPC_COMBAT:
attackNPCs();
break;
}
}
}
private State getState() {
if (landerContainsLoc(this.getLocation()))
{
return State.WAITING_IN_BOAT;
}
if (isInPestControlInstance(this))
{
return State.NPC_COMBAT;
}
if (outsideGangplankContainsLoc(this.getLocation()))
{
return State.OUTSIDE_GANGPLANK;
}
return State.GET_TO_PC;
}
private void attackNPCs() {
Node test = getClosestNodeWithEntry(5, GATE_ENTRIES);
if (!this.inCombat() && test != null) {
InteractionPacket.handleObjectInteraction(this, 0, test.getLocation(), test.getId());
}
//Npc Combat
if (tick == 0)
{
if (!this.inCombat())
AttackNpcsInRadius(this, 15);
this.tick = 10;
}
else
this.tick--;
this.eat(379);
this.getSkills().setLevel(Skills.PRAYER, 99);
this.getSkills().setStaticLevel(Skills.PRAYER, 99);
if (!(this.getPrayer().getActive().contains(PrayerType.PROTECT_FROM_MELEE)))
this.getPrayer().toggle(PrayerType.PROTECT_FROM_MELEE);
if (!this.inCombat())
{
if (combatMoveTimer <= 0)
{
if (this.FindTargets(this, 5) == null)
this.randomWalk(5, 5);
this.combatMoveTimer = 5;
}
}
}
private int insideBoatWalks = 3;
private void idleInBoat() {
if (randomType < 15) //He's the type of guy to walk around the boat
{
if (new Random().nextInt(insideBoatWalks) <= 1)
{
insideBoatWalks *= 1.5;
if (new Random().nextInt(7) == 1)
{
this.walkToPosSmart(new Location(2660, 2638));
} else {
this.walkToPosSmart(myBoat.boatBorder.getRandomLoc());
}
}
if (new Random().nextInt(3) == 1)
{
insideBoatWalks += 2;
}
}
}
private void enterBoat() {
if (new Random().nextInt(3) <= 1) //Don't join instantly
{
return;
}
if (randomType > 20 && new Random().nextInt(4) == 0) //Idle outside ladder
{
if (new Random().nextInt(16) == 0)
{
this.walkToPosSmart(myBoat.outsideBoatBorder.getRandomLoc());
movetimer += RandomFunction.normalPlusWeightRandDist(400, 200);
//System.out.println("Rare movetimer set on " + this.getName());
}
movetimer = RandomFunction.normalPlusWeightRandDist(100, 50);
//System.out.println("Set movetimer to " + movetimer + " on " + this.getName());
return;
}
if (randomType < 60 && new Random().nextInt(6) == 1) //Missclick the ladder
{
movetimer = new Random().nextInt(2);
this.walkToPosSmart(myBoat.outsideBoatBorder.getWeightedRandomLoc(3));
return;
}
Node test = getClosestNodeWithEntry(15, myBoat.ladderId);
InteractionPacket.handleObjectInteraction(this, 0, test.getLocation(), test.getId());
insideBoatWalks = 3;
}
private void getToPC() {
Node test = getClosestNodeWithEntry(25, myBoat.ladderId);
if (test == null)
{
this.teleport(PestControlIslandLocation);
} else {
InteractionPacket.handleObjectInteraction(this, test);
}
}
}

View file

@ -1,78 +0,0 @@
package org.crandor.game.node.entity.player.ai.pvmbots;
import java.util.ArrayList;
import org.crandor.game.content.skill.Skills;
import org.crandor.game.node.Node;
import org.crandor.game.node.entity.player.ai.AIPlayer;
import org.crandor.game.node.entity.player.link.TeleportManager.TeleportType;
import org.crandor.game.node.entity.player.link.prayer.*;
import org.crandor.game.world.GameWorld;
import org.crandor.game.world.map.Location;
import org.crandor.game.world.map.zone.impl.WildernessZone;
import org.crandor.net.packet.in.InteractionPacket;
import org.crandor.tools.RandomFunction;
public class PestControlTestBot extends PvMBots{
private int tick = 0;
private int movetimer = 0;
public PestControlTestBot(String name, Location l) {
super(name, l);
// TODO Auto-generated constructor stub
}
@Override
public void tick()
{
super.tick();
Node test = getClosestNodeWithEntry(15, 14315);
if (test != null) {
int x = test.getLocation().getX();
int y = test.getLocation().getY();
if (this.getLocation() != new Location(2660, 2638))
InteractionPacket.handleObjectInteraction(this, 0, x, y, test.getId());
}
ArrayList<Integer> doorEntrys = new ArrayList<Integer>();
doorEntrys.add(14233);
doorEntrys.add(14235);
test = getClosestNodeWithEntry(5, doorEntrys);
if (!this.inCombat() && test != null) {
int x = test.getLocation().getX();
int y = test.getLocation().getY();
InteractionPacket.handleObjectInteraction(this, 0, x, y, test.getId());
}
//Npc Combat
if (tick == 0)
{
if (!this.inCombat())
AttackNpcsInRadius(this, 15);
this.tick = 10;
}
else
this.tick--;
this.eat(379);
this.getSkills().setLevel(Skills.PRAYER, 99);
this.getSkills().setStaticLevel(Skills.PRAYER, 99);
if (!(this.getPrayer().getActive().contains(PrayerType.PROTECT_FROM_MELEE)))
this.getPrayer().toggle(PrayerType.PROTECT_FROM_MELEE);
if (!this.inCombat())
{
if (movetimer == 0)
{
if (this.FindTargets(this, 5) == null)
this.randomWalk(5, 5);
this.movetimer = 5;
}
else
movetimer --;
}
}
}

View file

@ -6,6 +6,7 @@ import org.crandor.game.container.impl.EquipmentContainer;
import org.crandor.game.content.skill.Skills;
import org.crandor.game.node.entity.combat.CombatSpell;
import org.crandor.game.node.entity.player.ai.AIPlayer;
import org.crandor.game.node.entity.player.ai.minigamebots.PestControlTestBot;
import org.crandor.game.node.entity.player.link.SpellBookManager;
import org.crandor.game.node.entity.player.link.appearance.Gender;
import org.crandor.game.node.item.Item;

View file

@ -4,22 +4,12 @@ import org.crandor.game.world.map.Location;
import java.util.ArrayList;
import org.crandor.cache.def.impl.ObjectDefinition;
import org.crandor.game.content.skill.Skills;
import org.crandor.game.content.skill.free.gather.*;
import org.crandor.game.interaction.Interaction;
import org.crandor.game.interaction.Option;
import org.crandor.game.interaction.OptionHandler;
import org.crandor.game.node.Node;
import org.crandor.game.node.entity.player.ai.AIPlayer;
import org.crandor.game.node.item.Item;
import org.crandor.game.node.object.GameObject;
import org.crandor.game.world.map.RegionManager;
import org.crandor.game.world.map.path.Pathfinder;
import org.crandor.net.packet.in.InteractionPacket;
import org.crandor.tools.RandomFunction;
import plugin.skill.gather.*;
public class SkillingBot extends AIPlayer{

View file

@ -11,16 +11,12 @@ import org.crandor.game.content.global.consumable.Food;
import org.crandor.game.content.skill.Skills;
import org.crandor.game.interaction.Option;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.equipment.Weapon;
import org.crandor.game.node.entity.npc.NPC;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.ai.AIPlayer;
import org.crandor.game.node.entity.player.link.prayer.PrayerType;
import org.crandor.game.node.item.Item;
import org.crandor.game.world.map.Location;
import org.crandor.game.world.map.RegionManager;
import org.crandor.game.world.update.flag.context.ChatMessage;
import org.crandor.game.world.update.flag.player.ChatFlag;
import org.crandor.tools.RandomFunction;
public class WildernessBot extends AIPlayer {

View file

@ -2,9 +2,11 @@ package org.crandor.game.world.map.zone;
import org.crandor.game.node.Node;
import org.crandor.game.world.map.Location;
import org.crandor.tools.RandomFunction;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
/**
* Represents the borders of a zone.
@ -210,6 +212,20 @@ public final class ZoneBorders {
return exceptions;
}
public Location getWeightedRandomLoc(int intensity)
{
int x = northEastX - southWestX == 0 ? southWestX : RandomFunction.normalRandDist(northEastX - southWestX, intensity) + southWestX;
int y = northEastY - southWestY == 0 ? southWestY : RandomFunction.normalRandDist(northEastY - southWestY, intensity) + southWestY;
return new Location(x, y);
}
public Location getRandomLoc() {
int x = northEastX - southWestX == 0 ? southWestX : new Random().nextInt(northEastX - southWestX) + southWestX;
int y = northEastY - southWestY == 0 ? southWestY : new Random().nextInt(northEastY - southWestY) + southWestY;
//System.out.println("Generated x,y " + x + ", " + y);
return new Location(x, y);
}
/**
* Adds an exception.
* @param exception The exception to add.

View file

@ -4,6 +4,7 @@ import org.crandor.ServerConstants;
import org.crandor.game.interaction.Interaction;
import org.crandor.game.interaction.MovementPulse;
import org.crandor.game.interaction.Option;
import org.crandor.game.node.Node;
import org.crandor.game.node.entity.npc.NPC;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.entity.player.ai.AIPlayer;
@ -178,6 +179,27 @@ public final class InteractionPacket implements IncomingPacket {
npc.getInteraction().handle(player, option);
}
/**
* Handles Node interaction with the first index
* @param player The interacting player.
* @param n The node to interact with.
*/
public static void handleObjectInteraction(final Player player, Node n)
{
handleObjectInteraction(player, 0, n.getLocation(), n.getId());
}
/**
* Handles object interaction
* @param player The interacting player.
* @param optionIndex The option index.
* @param l The (x,y) location of the object.
* @param objectId The object id.
*/
public static void handleObjectInteraction(final Player player, int optionIndex, Location l, int objectId) {
handleObjectInteraction(player, optionIndex, l.getX(), l.getY(), objectId);
}
/**
* Handles object interaction
* @param player The interacting player.

View file

@ -88,6 +88,29 @@ public class RandomFunction {
return RANDOM.nextInt(maxValue);
}
public static int nextInt(int val)
{
return RANDOM.nextInt(val);
}
public static int normalRandDist(int i, int intensity) {
int sum = 0;
for (int j = 0; j < intensity; j++) {
sum += RANDOM.nextInt(i);
}
return sum/intensity;
}
public static int normalRandDist(int i) {
return (RANDOM.nextInt(i) + RANDOM.nextInt(i))/2;
}
public static int normalPlusWeightRandDist(int val, int weight)
{
int normalDistRand = (RANDOM.nextInt(val) + RANDOM.nextInt(val))/2;
return normalDistRand/2 + weight < val ? normalDistRand/2 + weight : normalPlusWeightRandDist(val, weight - 1);
}
/**
* Gets a chance item.
* @param items the items.

View file

@ -5,6 +5,7 @@ import org.crandor.game.node.Node;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.node.object.GameObject;
import org.crandor.game.world.map.Location;
import org.crandor.game.world.map.zone.MapZone;
import org.crandor.game.world.map.zone.ZoneBorders;
import org.crandor.game.world.map.zone.ZoneRestriction;
@ -91,9 +92,13 @@ public final class PCLanderZone extends MapZone {
@Override
public void configure() {
register(new ZoneBorders(2659, 2637, 2664, 2664));
register(new ZoneBorders(2637, 2641, 2642, 2648));
register(new ZoneBorders(2631, 2648, 2636, 2655));
ZoneBorders boatA = new ZoneBorders(2659, 2637, 2664, 2664);
ZoneBorders boatB = new ZoneBorders(2637, 2641, 2642, 2648);
ZoneBorders boatC = new ZoneBorders(2631, 2648, 2636, 2655);
register(boatA);
register(boatB);
register(boatC);
}
}

View file

@ -12,6 +12,8 @@ import org.crandor.game.world.map.Location;
import org.crandor.game.world.map.RegionPlane;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.tools.RandomFunction;
import plugin.activity.pestcontrol.monsters.PCRavagerNPC;
import plugin.activity.pestcontrol.monsters.PCSpinnerNPC;
/**
* Handles the portal NPC.

View file

@ -1,7 +1,6 @@
package plugin.activity.pestcontrol;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import org.crandor.ServerConstants;
@ -29,6 +28,7 @@ import org.crandor.plugin.PluginManager;
import org.crandor.tools.RandomFunction;
import org.crandor.plugin.InitializablePlugin;
import org.crandor.tools.StringUtils;
import plugin.activity.pestcontrol.monsters.*;
/**
* Handles the Pest Control activity.
@ -40,7 +40,7 @@ public final class PestControlActivityPlugin extends ActivityPlugin {
/**
* The minimum team size.
*/
protected static final int MIN_TEAM_SIZE = GameWorld.getSettings().isDevMode() ? 1 : 5;
protected static final int MIN_TEAM_SIZE = 5; //GameWorld.getSettings().isDevMode() ? 1 : 5;
/**
* The maximum team size.
@ -74,24 +74,24 @@ public final class PestControlActivityPlugin extends ActivityPlugin {
@Override
public boolean pulse() {
for (Iterator<PestControlSession> it = sessions.iterator(); it.hasNext();) {
PestControlSession session = it.next();
if (session != null && session.update()) {
it.remove();
sessions.removeIf(session -> session != null && session.update());
ticks++;
if (waitingPlayers.size() >= MAX_TEAM_SIZE && ticks < 475)
{
ticks = 485;
}
if ((ticks < 450 && ticks % 100 == 0) || (ticks % 50 == 0) || ticks == 485) {
for (Player p : waitingPlayers) {
updateTime(p);
}
}
if (++ticks >= 500) { // 500
if (ticks >= 500) {
if (waitingPlayers.size() >= MIN_TEAM_SIZE) {
PestControlActivityPlugin.this.start();
} else {
ticks = 400;
}
}
if ((ticks < 450 && ticks % 100 == 0) || (ticks % 50 == 0)) {
for (Player p : waitingPlayers) {
updateTime(p);
}
}
return false;
}
};
@ -105,6 +105,7 @@ public final class PestControlActivityPlugin extends ActivityPlugin {
session.getRegion().getRegionZones().add(new RegionZone(this, session.getRegion().getBorders()));
sessions.add(session);
ticks = 0;
updatePlayerCount();
}
/**

View file

@ -0,0 +1,54 @@
package plugin.activity.pestcontrol;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.world.map.Location;
import org.crandor.game.world.map.zone.ZoneBorders;
import java.util.Arrays;
import java.util.List;
public class PestControlHelper {
public enum BoatInfo
{
NOVICE(new ZoneBorders(2660, 2638, 2664, 2644), new ZoneBorders(2657, 2637, 2657, 2643), 14315),
INTERMEDIATE(new ZoneBorders(2638, 2642, 2641, 2647), new ZoneBorders(2644, 2642, 2644, 2646), 25629),
VERTERAN(new ZoneBorders(2632, 2649, 2635, 2654), new ZoneBorders(2639, 2652, 2638, 2655), 25632);
BoatInfo(ZoneBorders boatBorder, ZoneBorders outsideBoatBorder, int ladderId)
{
this.boatBorder = boatBorder;
this.outsideBoatBorder = outsideBoatBorder;
this.ladderId = ladderId;
}
public ZoneBorders boatBorder;
public ZoneBorders outsideBoatBorder;
public int ladderId;
}
public static List<Integer> GATE_ENTRIES = Arrays.asList(14233, 14235);
public static final Location PestControlIslandLocation = Location.create(2659, 2649, 0);
public static boolean isInPestControlInstance(Player p)
{
return p.getAttribute("pc_zeal") != null;
}
public static boolean landerContainsLoc(Location l)
{
for (BoatInfo i : BoatInfo.values())
if (i.boatBorder.insideBorder(l))
return true;
return false;
}
public static boolean outsideGangplankContainsLoc(Location l)
{
for (BoatInfo i : BoatInfo.values())
if (i.outsideBoatBorder.insideBorder(l))
return true;
return false;
}
}

View file

@ -18,6 +18,8 @@ import org.crandor.game.world.map.RegionPlane;
import org.crandor.game.world.map.build.DynamicRegion;
import org.crandor.tools.RandomFunction;
import static plugin.activity.pestcontrol.PestControlActivityPlugin.MAX_TEAM_SIZE;
/**
* Represents a pest control session.
* @author Emperor
@ -158,8 +160,7 @@ public final class PestControlSession {
/**
* Sends a string on the interface to all players in the region.
* @param message The message to send.
* @param child The child id.
* @param value The message value to send.
*/
public void sendConfig(int value) {
for (Player p : region.getPlanes()[0].getPlayers()) {
@ -219,7 +220,7 @@ public final class PestControlSession {
for (Iterator<Player> it = waitingPlayers.iterator(); it.hasNext();) {
Player p = it.next();
if (p.getSession().isActive()) {
if (++count > 25) {
if (++count > MAX_TEAM_SIZE) {
int priority = p.getAttribute("pc_prior", 0) + 1;
p.getPacketDispatch().sendMessage("You have been given priority level " + priority + " over other players in joining the next");
p.getPacketDispatch().sendMessage("game.");

View file

@ -11,6 +11,7 @@ import org.crandor.game.world.map.RegionManager;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import org.crandor.tools.RandomFunction;
import plugin.activity.pestcontrol.monsters.*;
/**
* Handles the void knight seal.

View file

@ -1,4 +1,4 @@
package plugin.activity.pestcontrol;
package plugin.activity.pestcontrol.monsters;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
@ -10,6 +10,7 @@ import org.crandor.game.node.entity.npc.AbstractNPC;
import org.crandor.game.node.entity.player.Player;
import org.crandor.game.world.map.Location;
import org.crandor.game.world.map.MapDistance;
import plugin.activity.pestcontrol.PestControlSession;
/**
* Handles the Defiler NPCs.

View file

@ -1,4 +1,4 @@
package plugin.activity.pestcontrol;
package plugin.activity.pestcontrol.monsters;
import org.crandor.game.interaction.MovementPulse;
import org.crandor.game.node.Node;
@ -15,6 +15,7 @@ import org.crandor.game.world.map.MapDistance;
import org.crandor.game.world.map.path.Pathfinder;
import org.crandor.game.world.map.zone.ZoneBorders;
import org.crandor.tools.RandomFunction;
import plugin.activity.pestcontrol.PestControlSession;
/**
* Handles the Ravager pest control NPC.

View file

@ -1,4 +1,4 @@
package plugin.activity.pestcontrol;
package plugin.activity.pestcontrol.monsters;
import java.util.ArrayList;
import java.util.Collections;
@ -20,6 +20,7 @@ import org.crandor.game.world.map.RegionManager;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.tools.RandomFunction;
import plugin.activity.pestcontrol.PestControlSession;
/**
* Handles the pest control shifter NPCs.

View file

@ -1,4 +1,4 @@
package plugin.activity.pestcontrol;
package plugin.activity.pestcontrol.monsters;
import org.crandor.game.interaction.MovementPulse;
import org.crandor.game.node.entity.Entity;
@ -16,6 +16,7 @@ import org.crandor.game.world.map.RegionManager;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.tools.RandomFunction;
import plugin.activity.pestcontrol.PestControlSession;
/**
* Handles a pest control spinner NPC.

View file

@ -1,4 +1,4 @@
package plugin.activity.pestcontrol;
package plugin.activity.pestcontrol.monsters;
import java.util.ArrayList;
@ -17,6 +17,7 @@ import org.crandor.game.world.map.RegionManager;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.tools.RandomFunction;
import plugin.activity.pestcontrol.PestControlSession;
/**
* Handles the pest control splatter NPC.

View file

@ -1,4 +1,4 @@
package plugin.activity.pestcontrol;
package plugin.activity.pestcontrol.monsters;
import org.crandor.game.node.entity.Entity;
import org.crandor.game.node.entity.combat.BattleState;
@ -18,6 +18,7 @@ import org.crandor.game.world.map.MapDistance;
import org.crandor.game.world.update.flag.context.Animation;
import org.crandor.game.world.update.flag.context.Graphics;
import org.crandor.plugin.Plugin;
import plugin.activity.pestcontrol.PestControlSession;
/**
* Handles the torcher pest control NPC.

View file

@ -53,11 +53,11 @@ public class PlayerExamineInterfacePlugin extends ComponentPlugin {
player.getPacketDispatch().sendString("Total Level -> ", 31, 9);
player.getPacketDispatch().sendString("Inventory items -> ", 31, 10);
player.getPacketDispatch().sendString("Inventory value -> ", 31, 16);
player.getPacketDispatch().sendString("Bank value-> ", 31, 19);
player.getPacketDispatch().sendString("Custom state-> ", 31, 19);
player.getPacketDispatch().sendString("" + examined.getSkills().getTotalLevel(), 31, 11);
player.getPacketDispatch().sendString("" + examined.getInventory().itemCount(), 31, 12);
player.getPacketDispatch().sendString("" + examined.getInventory().getWealth(), 31, 17);
player.getPacketDispatch().sendString("" + examined.getBank().getWealth(), 31, 20);
player.getPacketDispatch().sendString("" + examined.getCustomState(), 31, 20);
player.getPacketDispatch().sendString("Close", 31, 5);
}
}