Pest control fixes & pc bot modularization

This commit is contained in:
dginovker 2019-06-15 20:41:29 -04:00
parent 0ecae80828
commit 236fec4824
10 changed files with 172 additions and 56 deletions

View file

@ -90,20 +90,15 @@ public final class PCLanderZone extends MapZone {
return super.leave(e, logout);
}
private static ZoneBorders boatA = new ZoneBorders(2659, 2637, 2664, 2664); //I should probably find the real names
private static ZoneBorders boatB = new ZoneBorders(2637, 2641, 2642, 2648);
private static ZoneBorders boatC = new ZoneBorders(2631, 2648, 2636, 2655);
@Override
public void configure() {
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);
}
public static boolean landerContainsLoc(Location l)
{
return boatA.insideBorder(l) || boatB.insideBorder(l) || boatC.insideBorder(l);
}
}

View file

@ -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.
@ -76,11 +76,11 @@ public final class PestControlActivityPlugin extends ActivityPlugin {
public boolean pulse() {
sessions.removeIf(session -> session != null && session.update());
ticks++;
if (waitingPlayers.size() >= MAX_TEAM_SIZE && ticks < 575)
if (waitingPlayers.size() >= MAX_TEAM_SIZE && ticks < 475);
{
ticks = 585;
ticks = 485;
}
if ((ticks < 450 && ticks % 100 == 0) || (ticks % 50 == 0) || ticks == 596) {
if ((ticks < 450 && ticks % 100 == 0) || (ticks % 50 == 0) || ticks == 485) {
for (Player p : waitingPlayers) {
updateTime(p);
}

View file

@ -1,5 +1,53 @@
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, 2663, 2643), new ZoneBorders(2657, 2638, 2657, 2641)),
INTERMEDIATE(new ZoneBorders(2638, 2642, 2641, 2647), new ZoneBorders(2644, 2642, 2644, 2646)),
VERTERAN(new ZoneBorders(2632, 2649, 2635, 2654), new ZoneBorders(2639, 2652, 2638, 2655));
BoatInfo(ZoneBorders boatBorder, ZoneBorders outsideBoatBorder)
{
this.boatBorder = boatBorder;
this.outsideBoatBorder = outsideBoatBorder;
}
public ZoneBorders boatBorder;
public ZoneBorders outsideBoatBorder;
}
public static final int NOVICE_GANGPLANK = 14315;
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

@ -160,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()) {

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);
}
}