forked from 2009Scape/Server
Lotta bots
This commit is contained in:
parent
a95b194865
commit
8666fce9b0
30 changed files with 4746 additions and 272 deletions
|
|
@ -12,7 +12,7 @@ public class GameLaunch {
|
|||
/**
|
||||
* The game settings.
|
||||
*/
|
||||
public static GameSetting SETTINGS = new GameSetting("RuneScape", Configurations.LOCAL_SERVER ? "127.0.0.1" : "frostblades.org", 1, "live", false, false);
|
||||
public static GameSetting SETTINGS = new GameSetting("Fat Cunt", Configurations.LOCAL_SERVER ? "127.0.0.1" : "frostblades.org", 1, "live", false, false);
|
||||
|
||||
/**
|
||||
* The main method.
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -269,7 +269,7 @@ public final class CharacterDesign {
|
|||
* Randomizes the player's look.
|
||||
* @param player the player.
|
||||
*/
|
||||
private static void randomize(Player player, boolean head) {
|
||||
public static void randomize(Player player, boolean head) {
|
||||
if (head) {
|
||||
changeLook(player, 0, RandomFunction.random(2) == 1);
|
||||
changeLook(player, 1, RandomFunction.random(2) == 1);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,20 +1,29 @@
|
|||
package org.crandor.game.node.entity.player.ai;
|
||||
|
||||
import org.crandor.ServerConstants;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.crandor.game.content.dialogue.DialoguePlugin;
|
||||
import org.crandor.game.content.global.tutorial.CharacterDesign;
|
||||
import org.crandor.game.interaction.DestinationFlag;
|
||||
import org.crandor.game.interaction.MovementPulse;
|
||||
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.ai.general.ScriptAPI;
|
||||
import org.crandor.game.node.entity.player.ai.general.scriptrepository.Script;
|
||||
import org.crandor.game.node.entity.player.info.PlayerDetails;
|
||||
import org.crandor.game.system.task.Pulse;
|
||||
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.map.path.Pathfinder;
|
||||
import org.crandor.plugin.Plugin;
|
||||
import org.crandor.tools.RandomFunction;
|
||||
import org.crandor.tools.StringUtils;
|
||||
import plugin.skill.thieving.ThievingOptionPlugin;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Represents an <b>A</b>rtificial <b>I</b>ntelligent <b>P</b>layer.
|
||||
|
|
@ -56,6 +65,8 @@ public class AIPlayer extends Player {
|
|||
* The player controlling this AIP.
|
||||
*/
|
||||
private Player controler;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Constructs a new {@code AIPlayer} {@code Object}.
|
||||
|
|
@ -64,23 +75,24 @@ public class AIPlayer extends Player {
|
|||
*/
|
||||
@SuppressWarnings("deprecation")
|
||||
public AIPlayer(String name, Location l) {
|
||||
super(new PlayerDetails(/*"/aip" + (currentUID + 1) + ":" + */name));
|
||||
super(new PlayerDetails("/aip" + (currentUID + 1) + ":" + name));
|
||||
super.setLocation(startLocation = l);
|
||||
super.artificial = true;
|
||||
super.getDetails().setSession(ArtificialSession.getSingleton());
|
||||
this.username = StringUtils.formatDisplayName(name);
|
||||
this.username = StringUtils.formatDisplayName(name + (currentUID + 1));
|
||||
this.uid = currentUID++;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
getProperties().setSpawnLocation(/*startLocation*/ ServerConstants.HOME_LOCATION);
|
||||
getProperties().setSpawnLocation(startLocation);
|
||||
getInterfaceManager().openDefaultTabs();
|
||||
getSession().setObject(this);
|
||||
botMapping.put(uid, this);
|
||||
super.init();
|
||||
getSettings().setRunToggled(true);
|
||||
/*getInteraction().set(new Option("Control", 7).setHandler(new OptionHandler() {
|
||||
CharacterDesign.randomize(this, false);
|
||||
getInteraction().set(new Option("Control", 7).setHandler(new OptionHandler() {
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
return null;
|
||||
|
|
@ -100,7 +112,8 @@ public class AIPlayer extends Player {
|
|||
return false;
|
||||
}
|
||||
|
||||
}));*/
|
||||
}));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -116,6 +129,191 @@ public class AIPlayer extends Player {
|
|||
}
|
||||
}, "movement");
|
||||
}
|
||||
|
||||
public void randomWalk(int radiusX, int radiusY)
|
||||
{
|
||||
Pathfinder.find(this, this.getLocation().transform(RandomFunction.random(radiusX, (radiusX * -1)), RandomFunction.random(radiusY, (radiusY * -1)), 0), false, 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)
|
||||
if (this.getProperties().getCombatPulse().getVictim().isPlayer())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public Item getItemById(int id)
|
||||
{
|
||||
for (int i = 0; i < 28; i++)
|
||||
{
|
||||
Item item = this.getInventory().get(i);
|
||||
if (item != null)
|
||||
{
|
||||
if (item.getId() == id)
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private ArrayList<Node> getNodeInRange(int range, int entry)
|
||||
{
|
||||
int meX = this.getLocation().getX();
|
||||
int meY = this.getLocation().getY();
|
||||
//int meX2 = this.getLocation().getX();
|
||||
//System.out.println("local " + meX + " real x? " + meX2 );
|
||||
ArrayList<Node> nodes = new ArrayList<Node>();
|
||||
for (int x = 0; x < range; x++)
|
||||
{
|
||||
for (int y = 0; y < range - x; y++)
|
||||
{
|
||||
Node node = RegionManager.getObject(0, meX + x, meY + y);
|
||||
if (node != null)
|
||||
if (node.getId() == entry)
|
||||
nodes.add(node);
|
||||
Node node2 = RegionManager.getObject(0, meX + x, meY - y);
|
||||
if (node2 != null)
|
||||
if (node2.getId() == entry)
|
||||
nodes.add(node2);
|
||||
Node node3 = RegionManager.getObject(0, meX - x, meY + y);
|
||||
if (node3 != null)
|
||||
if (node3.getId() == entry)
|
||||
nodes.add(node3);
|
||||
Node node4 = RegionManager.getObject(0, meX - x, meY - y);
|
||||
if (node4 != null)
|
||||
if (node4.getId() == entry)
|
||||
nodes.add(node4);
|
||||
}
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
|
||||
private ArrayList<Node> getNodeInRange(int range, ArrayList<Integer> entrys)
|
||||
{
|
||||
int meX = this.getLocation().getX();
|
||||
int meY = this.getLocation().getY();
|
||||
//int meX2 = this.getLocation().getX();
|
||||
//System.out.println("local " + meX + " real x? " + meX2 );
|
||||
ArrayList<Node> nodes = new ArrayList<Node>();
|
||||
for (int x = 0; x < range; x++)
|
||||
{
|
||||
for (int y = 0; y < range - x; y++)
|
||||
{
|
||||
Node node = RegionManager.getObject(0, meX + x, meY + y);
|
||||
if (node != null)
|
||||
if (entrys.contains(node.getId()))
|
||||
nodes.add(node);
|
||||
Node node2 = RegionManager.getObject(0, meX + x, meY - y);
|
||||
if (node2 != null)
|
||||
if (entrys.contains(node2.getId()))
|
||||
nodes.add(node2);
|
||||
Node node3 = RegionManager.getObject(0, meX - x, meY + y);
|
||||
if (node3 != null)
|
||||
if (entrys.contains(node3.getId()))
|
||||
nodes.add(node3);
|
||||
Node node4 = RegionManager.getObject(0, meX - x, meY - y);
|
||||
if (node4 != null)
|
||||
if (entrys.contains(node4.getId()))
|
||||
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");
|
||||
return null;
|
||||
}
|
||||
Node node = getClosestNodeinNodeList(nodeList);
|
||||
return node;
|
||||
}
|
||||
|
||||
public Node getClosestNodeWithEntry(int range, ArrayList<Integer> entrys)
|
||||
{
|
||||
ArrayList<Node> nodeList = getNodeInRange(range, entrys);
|
||||
if (nodeList.isEmpty())
|
||||
{
|
||||
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;
|
||||
for (NPC npc : RegionManager.getLocalNpcs(this, radius)) {
|
||||
double distanceToNpc = npc.getLocation().getDistance(this.getLocation());
|
||||
if ((distanceToNpc) < distance) {
|
||||
distance = (int) distanceToNpc;
|
||||
npcReturn = npc;
|
||||
}
|
||||
}
|
||||
return npcReturn;
|
||||
}
|
||||
|
||||
public Node getClosesCreature(int radius, int entry) {
|
||||
int distance = radius + 1;
|
||||
Node npcReturn = null;
|
||||
for (NPC npc : RegionManager.getLocalNpcs(this, radius)) {
|
||||
double distanceToNpc = npc.getLocation().getDistance(this.getLocation());
|
||||
if (npc.getId() == entry) {
|
||||
if ((distanceToNpc) < distance) {
|
||||
distance = (int) distanceToNpc;
|
||||
npcReturn = npc;
|
||||
}
|
||||
}
|
||||
}
|
||||
return npcReturn;
|
||||
}
|
||||
|
||||
public Node getClosesCreature(int radius, ArrayList<Integer> entrys) {
|
||||
int distance = radius + 1;
|
||||
Node npcReturn = null;
|
||||
for (NPC npc : RegionManager.getLocalNpcs(this, radius)) {
|
||||
double distanceToNpc = npc.getLocation().getDistance(this.getLocation());
|
||||
if (entrys.contains(npc.getId())) {
|
||||
if ((distanceToNpc) < distance) {
|
||||
distance = (int) distanceToNpc;
|
||||
npcReturn = npc;
|
||||
}
|
||||
}
|
||||
}
|
||||
return npcReturn;
|
||||
}
|
||||
|
||||
private Node getClosestNodeinNodeList(ArrayList<Node> nodes)
|
||||
{
|
||||
if (nodes.isEmpty())
|
||||
{
|
||||
System.out.println("nodelist empty");
|
||||
return null;
|
||||
}
|
||||
|
||||
double distance = 0;
|
||||
Node nodeReturn = null;
|
||||
for (Node node : nodes)
|
||||
{
|
||||
double nodeDistance = this.getLocation().getDistance(node.getLocation());
|
||||
if (nodeReturn == null || nodeDistance < distance)
|
||||
{
|
||||
distance = nodeDistance;
|
||||
nodeReturn = node;
|
||||
}
|
||||
}
|
||||
return nodeReturn;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clear() {
|
||||
|
|
@ -130,12 +328,6 @@ public class AIPlayer extends Player {
|
|||
}
|
||||
super.reset();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void finalizeDeath(Entity killer) {
|
||||
super.finalizeDeath(killer);
|
||||
this.setAttribute("dead", true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the UID.
|
||||
|
|
@ -196,4 +388,5 @@ public class AIPlayer extends Player {
|
|||
public void setControler(Player controler) {
|
||||
this.controler = controler;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
package org.crandor.game.node.entity.player.ai;
|
||||
|
||||
import org.crandor.net.IoSession;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
import org.crandor.net.IoSession;
|
||||
|
||||
/**
|
||||
* Represents an artificial networking session.
|
||||
* @author Emperor
|
||||
|
|
|
|||
|
|
@ -21,12 +21,28 @@ public class ScriptAPI {
|
|||
}
|
||||
|
||||
public Node getNearestNode(String entityName)
|
||||
{
|
||||
Node entity = null;
|
||||
double minDistance = Double.MAX_VALUE;
|
||||
for (Node node : RegionManager.forId(bot.getLocation().getRegionId()).getPlanes()[bot.getLocation().getZ()].getEntities())
|
||||
{
|
||||
if (node != null && node.getName().equals(entityName) && distance(bot, node) < minDistance && !Pathfinder.find(bot, node).isMoveNear())
|
||||
{
|
||||
entity = node;
|
||||
minDistance = distance(bot, node);
|
||||
}
|
||||
}
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
public Node getNearestNode(int id)
|
||||
{
|
||||
Node entity = null;
|
||||
double minDistance = Double.MAX_VALUE;
|
||||
for (Node e : RegionManager.forId(bot.getLocation().getRegionId()).getPlanes()[bot.getLocation().getZ()].getEntities())
|
||||
{
|
||||
if (e != null && e.getName().equals(entityName) && distance(bot, e) < minDistance && !Pathfinder.find(bot, e).isMoveNear())
|
||||
if (e != null && e.getId() == id && distance(bot, e) < minDistance && !Pathfinder.find(bot, e).isMoveNear())
|
||||
{
|
||||
entity = e;
|
||||
minDistance = distance(bot, e);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,66 @@
|
|||
package org.crandor.game.node.entity.player.ai.general.scriptrepository;
|
||||
|
||||
import org.crandor.game.content.skill.Skills;
|
||||
import org.crandor.game.node.Node;
|
||||
import org.crandor.game.node.item.Item;
|
||||
import org.crandor.game.world.map.Location;
|
||||
import org.crandor.game.world.map.path.Pathfinder;
|
||||
import org.crandor.tools.RandomFunction;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
public class LobsterCatcher extends Script {
|
||||
|
||||
enum Sets {
|
||||
|
||||
SET_1 (Arrays.asList(new Item(2643), new Item(9470), new Item(10756), new Item(10394), new Item(88), new Item(9793))),
|
||||
SET_2 (Arrays.asList(new Item(2643), new Item(6585), new Item(10750), new Item(10394), new Item(88), new Item(9793))),
|
||||
SET_3 (Arrays.asList(new Item(9472), new Item(9470), new Item(10750), new Item(10394), new Item(88), new Item(9786))),
|
||||
SET_4 (Arrays.asList(new Item(2639), new Item(6585), new Item(10752), new Item(10394), new Item(88), new Item(9786))),
|
||||
SET_5 (Arrays.asList(new Item(2639), new Item(9470), new Item(10750), new Item(10394), new Item(88), new Item(9784))),
|
||||
SET_6 (Arrays.asList(new Item(2639), new Item(6585), new Item(10750), new Item(10394), new Item(88), new Item(9784)));
|
||||
|
||||
private List<Item> equipment;
|
||||
|
||||
Sets(List<Item> equipment) {
|
||||
this.equipment = equipment;
|
||||
}
|
||||
|
||||
public List<Item> getEquipment() {
|
||||
return equipment;
|
||||
}
|
||||
}
|
||||
|
||||
private int tick = 0;
|
||||
|
||||
public LobsterCatcher() {
|
||||
int setUp = RandomFunction.random(Sets.values().length);
|
||||
this.equipment.addAll(Sets.values()[setUp].getEquipment());
|
||||
this.inventory.add(new Item(301));
|
||||
this.skills.put(Skills.FISHING, 40);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void runLoop() {
|
||||
tick++;
|
||||
Node spot = scriptAPI.getNearestNode(333);
|
||||
Node bank = scriptAPI.getNearestNode(2213);
|
||||
|
||||
|
||||
Pathfinder.find(bot, Location.create(2837, 3435, 0)).walk(bot);
|
||||
|
||||
if (spot != null) {
|
||||
System.out.println(spot.getLocation().toString());
|
||||
spot.getInteraction().handle(bot, spot.getInteraction().get(0));
|
||||
}
|
||||
|
||||
|
||||
if (bot.getInventory().isFull()) {
|
||||
bank.getInteraction().handle(bot, bank.getInteraction().get(2));
|
||||
}
|
||||
|
||||
System.out.println(tick);
|
||||
}
|
||||
}
|
||||
|
|
@ -6,8 +6,7 @@ import org.crandor.game.node.item.Item;
|
|||
import java.util.Arrays;
|
||||
|
||||
public class ManThiever extends Script {
|
||||
public ManThiever()
|
||||
{
|
||||
public ManThiever() {
|
||||
this.equipment.addAll(Arrays.asList(new Item(1103), new Item(1139), new Item(1265)));
|
||||
}
|
||||
|
||||
|
|
@ -15,8 +14,7 @@ public class ManThiever extends Script {
|
|||
public void runLoop() {
|
||||
Node man = scriptAPI.getNearestNode("Man");
|
||||
|
||||
if (man != null)
|
||||
{
|
||||
if (man != null) {
|
||||
man.getInteraction().handle(bot, man.getInteraction().get(2));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,11 +5,16 @@ import org.crandor.game.node.entity.player.ai.general.ScriptAPI;
|
|||
import org.crandor.game.node.item.Item;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class Script {
|
||||
|
||||
public ScriptAPI scriptAPI;
|
||||
public ArrayList<Item> inventory = new ArrayList<>();
|
||||
public ArrayList<Item> equipment = new ArrayList<>();
|
||||
public Map<Integer, Integer> skills = new HashMap<>();
|
||||
|
||||
|
||||
public AIPlayer bot;
|
||||
|
||||
|
|
@ -26,7 +31,18 @@ public abstract class Script {
|
|||
{
|
||||
bot.getEquipment().add(i, true, false);
|
||||
}
|
||||
for (Map.Entry<Integer, Integer> skill : skills.entrySet())
|
||||
{
|
||||
setLevel(skill.getKey(), skill.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
public abstract void runLoop();
|
||||
|
||||
public void setLevel(int skill, int level) {
|
||||
bot.getSkills().setLevel(skill, level);
|
||||
bot.getSkills().setStaticLevel(skill, level);
|
||||
bot.getSkills().updateCombatLevel();
|
||||
bot.getAppearance().sync();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
package org.crandor.game.node.entity.player.ai.pvmbots;
|
||||
|
||||
import org.crandor.game.content.skill.Skills;
|
||||
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.tools.RandomFunction;
|
||||
|
||||
public class DragonKiller extends PvMBots{
|
||||
|
||||
private int tick = 0;
|
||||
|
||||
public DragonKiller(String name, Location l) {
|
||||
super(name, l);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
super.tick();
|
||||
|
||||
//Despawn
|
||||
if (this.getSkills().getLifepoints() == 0 || this.getLocation().equals(new Location(0, 0)))
|
||||
//this.teleport(new Location(500, 500));
|
||||
//Despawning not being delayed causes 3 errors in the console
|
||||
AIPlayer.deregister(this.getUid());
|
||||
|
||||
if (this.checkVictimIsPlayer())
|
||||
{
|
||||
tryEscape();
|
||||
}
|
||||
|
||||
//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);
|
||||
//this.getPrayer().toggle()
|
||||
}
|
||||
|
||||
public void tryEscape()
|
||||
{
|
||||
if (this.isTeleBlocked() == false)
|
||||
{
|
||||
if (WildernessZone.getWilderness(this) <= 20)
|
||||
{
|
||||
System.out.println("not Teleblocked");
|
||||
this.teleport(new Location(0, 0));
|
||||
}
|
||||
}
|
||||
else
|
||||
return;
|
||||
//run away
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,68 @@
|
|||
package org.crandor.game.node.entity.player.ai.pvmbots;
|
||||
|
||||
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;
|
||||
|
||||
public class GiantMoleBot extends PvMBots{
|
||||
|
||||
public GiantMoleBot(String name, Location l) {
|
||||
super(name, l);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
int tick = 0;
|
||||
int movetimer = 5;
|
||||
|
||||
private void checkLightSource()
|
||||
{
|
||||
if (!this.getInventory().containItems(33))
|
||||
{
|
||||
if (this.getInventory().containItems(36))
|
||||
this.getInventory().remove(new Item(36));
|
||||
this.getInventory().add(new Item(33));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
checkLightSource();
|
||||
super.tick();
|
||||
PrayerType type[] = {PrayerType.PROTECT_FROM_MELEE, PrayerType.PIETY};
|
||||
this.CheckPrayer(type);
|
||||
|
||||
//Despawn
|
||||
if (this.getSkills().getLifepoints() == 0)
|
||||
//this.teleport(new Location(500, 500));
|
||||
//Despawning not being delayed causes 3 errors in the console
|
||||
AIPlayer.deregister(this.getUid());
|
||||
|
||||
//Npc Combat
|
||||
if (this.tick == 0)
|
||||
{
|
||||
if (!this.inCombat())
|
||||
AttackNpcsInRadius(this, 50);
|
||||
this.tick = 5;
|
||||
}
|
||||
|
||||
else
|
||||
this.tick--;
|
||||
|
||||
/*if (this.movetimer == 0)
|
||||
{
|
||||
if (!this.inCombat())
|
||||
{
|
||||
this.randomWalk(10, 10);
|
||||
}
|
||||
this.movetimer = 4;
|
||||
}
|
||||
else
|
||||
this.movetimer--;*/
|
||||
//if (this.getSkills().getLifepoints() > 1)
|
||||
//this.eat();
|
||||
//this.getPrayer().toggle()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
package org.crandor.game.node.entity.player.ai.pvmbots;
|
||||
|
||||
import org.crandor.game.node.entity.player.ai.AIPlayer;
|
||||
import org.crandor.game.world.map.Location;
|
||||
|
||||
public class LowestBot extends PvMBots{
|
||||
|
||||
public LowestBot(String name, Location l) {
|
||||
super(name, l);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
private int tick = 0;
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
super.tick();
|
||||
|
||||
//Despawn
|
||||
if (this.getSkills().getLifepoints() == 0)
|
||||
//this.teleport(new Location(500, 500));
|
||||
//Despawning not being delayed causes 3 errors in the console
|
||||
AIPlayer.deregister(this.getUid());
|
||||
|
||||
//Npc Combat
|
||||
if (tick == 0)
|
||||
{
|
||||
if (!this.inCombat())
|
||||
AttackNpcsInRadius(this, 5);
|
||||
this.tick = 10;
|
||||
}
|
||||
else
|
||||
this.tick--;
|
||||
|
||||
this.eat(329);
|
||||
//this.getPrayer().toggle()
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
package org.crandor.game.node.entity.player.ai.pvmbots;
|
||||
|
||||
import org.crandor.game.node.entity.player.ai.AIPlayer;
|
||||
import org.crandor.game.world.map.Location;
|
||||
|
||||
public class NoobBot extends PvMBots{
|
||||
|
||||
private int tick = 0;
|
||||
private int movetimer = 0;
|
||||
|
||||
public NoobBot(String name, Location l) {
|
||||
super(name, l);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
super.tick();
|
||||
|
||||
//Despawn
|
||||
if (this.getSkills().getLifepoints() == 0)
|
||||
//this.teleport(new Location(500, 500));
|
||||
//Despawning not being delayed causes 3 errors in the console
|
||||
AIPlayer.deregister(this.getUid());
|
||||
|
||||
//Npc Combat
|
||||
if (tick == 0)
|
||||
{
|
||||
if (!this.inCombat())
|
||||
AttackNpcsInRadius(this, 5);
|
||||
this.tick = 5;
|
||||
}
|
||||
else
|
||||
this.tick--;
|
||||
|
||||
this.eat(329);
|
||||
//this.getPrayer().toggle()
|
||||
//System.out.println(this.getPulseManager().getCurrent());
|
||||
|
||||
if (!this.inCombat())
|
||||
{
|
||||
if (movetimer == 0)
|
||||
{
|
||||
if (this.FindTargets(this, 5) == null)
|
||||
this.randomWalk(5, 5);
|
||||
this.movetimer = 10;
|
||||
}
|
||||
else
|
||||
movetimer --;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,78 @@
|
|||
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 --;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,125 @@
|
|||
package org.crandor.game.node.entity.player.ai.pvmbots;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.crandor.game.content.global.consumable.Consumable;
|
||||
import org.crandor.game.content.global.consumable.ConsumableProperties;
|
||||
import org.crandor.game.content.global.consumable.Consumables;
|
||||
import org.crandor.game.content.global.consumable.Food;
|
||||
import org.crandor.game.content.skill.Skills;
|
||||
import org.crandor.game.node.entity.Entity;
|
||||
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.Animation;
|
||||
import org.crandor.tools.RandomFunction;
|
||||
|
||||
public class PvMBots extends AIPlayer {
|
||||
|
||||
//Used so the bot doesn't spam actions
|
||||
private int tick = 0;
|
||||
|
||||
public PvMBots(String name, Location l) {
|
||||
super(name, l);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
public List<Entity> FindTargets(Entity entity, int radius) {
|
||||
List<Entity> targets = new ArrayList<>();
|
||||
for (NPC npc : RegionManager.getLocalNpcs(entity, radius)) {
|
||||
{
|
||||
if (checkValidTargets(npc))
|
||||
targets.add(npc);
|
||||
}
|
||||
}
|
||||
if (targets.size() == 0)
|
||||
return null;
|
||||
return targets;
|
||||
}
|
||||
|
||||
public boolean checkValidTargets(NPC target) {
|
||||
if (!target.isActive()) {
|
||||
return false;
|
||||
}
|
||||
if (!target.getProperties().isMultiZone() && target.inCombat()) {
|
||||
return false;
|
||||
}
|
||||
if (!target.getDefinition().hasAction("attack")) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void AttackNpcsInRadius(Player bot, int radius) {
|
||||
if (bot.inCombat())
|
||||
return;
|
||||
List<Entity> creatures = FindTargets(bot, radius);
|
||||
if (creatures == null) {
|
||||
return;
|
||||
}
|
||||
if (!(creatures.isEmpty())) {
|
||||
bot.attack(creatures.get(RandomFunction.getRandom((creatures.size() - 1))));
|
||||
return;
|
||||
} else {
|
||||
creatures = FindTargets(bot, radius);
|
||||
if (!creatures.isEmpty())
|
||||
bot.attack(creatures.get(RandomFunction.getRandom((creatures.size() - 1))));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
|
||||
//Despawn
|
||||
if (this.getSkills().getLifepoints() == 0)
|
||||
//this.teleport(new Location(500, 500));
|
||||
//Despawning not being delayed causes 3 errors in the console
|
||||
AIPlayer.deregister(this.getUid());
|
||||
|
||||
//Npc Combat
|
||||
if (tick == 0) {
|
||||
if (!this.inCombat())
|
||||
AttackNpcsInRadius(this, 5);
|
||||
this.tick = 10;
|
||||
} else
|
||||
this.tick--;
|
||||
|
||||
//this.eat();
|
||||
//this.getPrayer().toggle()
|
||||
}
|
||||
|
||||
public void CheckPrayer(PrayerType type[]) {
|
||||
for (int i = 0; i < type.length; i++)
|
||||
this.getPrayer().toggle(type[i]);
|
||||
}
|
||||
|
||||
public void eat(int foodId) {
|
||||
Item foodItem = new Item(foodId);
|
||||
|
||||
if ((this.getSkills().getStaticLevel(Skills.HITPOINTS) >= this.getSkills().getLifepoints() * 3) && this.getInventory().containsItem(foodItem)) {
|
||||
this.lock(3);
|
||||
//this.animate(new Animation(829));
|
||||
Item food = this.getInventory().getItem(foodItem);
|
||||
|
||||
Consumable consumable = Consumables.forFood(food);
|
||||
|
||||
if (consumable == null) {
|
||||
consumable = new Food(food.getId(), new ConsumableProperties(1));
|
||||
}
|
||||
|
||||
consumable.consume(food, this);
|
||||
this.getProperties().getCombatPulse().delayNextAttack(3);
|
||||
}
|
||||
if (this.checkVictimIsPlayer() == false)
|
||||
if (!(this.getInventory().contains(foodId, 1)))
|
||||
this.getInventory().add(new Item(foodId, 5)); //Add Food to Inventory
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,623 @@
|
|||
package org.crandor.game.node.entity.player.ai.pvmbots;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
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.link.SpellBookManager;
|
||||
import org.crandor.game.node.entity.player.link.appearance.Gender;
|
||||
import org.crandor.game.node.item.Item;
|
||||
import org.crandor.game.world.map.Location;
|
||||
import org.crandor.game.world.repository.Repository;
|
||||
import org.crandor.tools.RandomFunction;
|
||||
|
||||
public final class PvMBotsBuilder{
|
||||
|
||||
public static PestControlTestBot createPestControlTestBot(String name, Location l)
|
||||
{
|
||||
return new PestControlTestBot(name, l);
|
||||
}
|
||||
|
||||
public static PvMBots create(String name, Location l)
|
||||
{
|
||||
return new PvMBots(name, l);
|
||||
}
|
||||
|
||||
public static LowestBot createLowest(String name, Location l)
|
||||
{
|
||||
return new LowestBot(name, l);
|
||||
}
|
||||
|
||||
public static NoobBot createNoob(String name, Location l)
|
||||
{
|
||||
return new NoobBot(name, l);
|
||||
}
|
||||
|
||||
public static DragonKiller createDragonKiller(String name, Location l)
|
||||
{
|
||||
return new DragonKiller(name, l);
|
||||
}
|
||||
|
||||
public static GiantMoleBot createGiantMoleBot(String name, Location l)
|
||||
{
|
||||
return new GiantMoleBot(name, l);
|
||||
}
|
||||
|
||||
public static void generateGiantMoleBot(PvMBots p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.SLAYER, 99);
|
||||
p.getSkills().setStaticLevel(Skills.SLAYER, 99);
|
||||
p.getSkills().setLevel(Skills.STRENGTH, 99);
|
||||
p.getSkills().setStaticLevel(Skills.STRENGTH, 99);
|
||||
p.getSkills().setLevel(Skills.ATTACK, 99);
|
||||
p.getSkills().setStaticLevel(Skills.ATTACK, 99);
|
||||
p.getSkills().setStaticLevel(Skills.HITPOINTS, 99);
|
||||
p.getSkills().setLevel(Skills.HITPOINTS, 99);
|
||||
p.getSkills().setStaticLevel(Skills.DEFENCE, 99);
|
||||
p.getSkills().setLevel(Skills.DEFENCE, 99);
|
||||
p.getSkills().setStaticLevel(Skills.PRAYER, 99);
|
||||
p.getSkills().setLevel(Skills.PRAYER, 99);
|
||||
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
|
||||
p.getEquipment().replace(new Item(4720) ,EquipmentContainer.SLOT_CHEST);
|
||||
p.getEquipment().replace(new Item(4722) ,EquipmentContainer.SLOT_LEGS);
|
||||
p.getEquipment().replace(new Item(4716) ,EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(4718) ,EquipmentContainer.SLOT_WEAPON);
|
||||
p.getEquipment().replace(new Item(-1) ,EquipmentContainer.SLOT_SHIELD);
|
||||
|
||||
p.getInventory().add(new Item(952));
|
||||
p.getInventory().add(new Item(33));
|
||||
|
||||
}
|
||||
|
||||
public static void generateMinLevels(PvMBots p)
|
||||
{
|
||||
//Slayer so they can attack alls monsters
|
||||
p.getSkills().setLevel(Skills.SLAYER, 99);
|
||||
p.getSkills().setStaticLevel(Skills.SLAYER, 99);
|
||||
int combatType = RandomFunction.getRandom(2);
|
||||
p.getSkills().setLevel(Skills.HITPOINTS, 15);
|
||||
p.getSkills().setStaticLevel(Skills.HITPOINTS, 15);
|
||||
p.getInventory().add(new Item(329, 5));
|
||||
switch(combatType)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
buildArcherStats(p);
|
||||
buildArcherEquipment(p);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
buildMeleeStats(p);
|
||||
buildMeleeEquipment(p);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
buildMageStats(p);
|
||||
buildMagicEquipment(p);
|
||||
setupWizard(p);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
buildMeleeStats(p);
|
||||
buildMeleeEquipment(p);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void createDragonKiller(DragonKiller p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.SLAYER, 99);
|
||||
p.getSkills().setStaticLevel(Skills.SLAYER, 99);
|
||||
int combatType = RandomFunction.getRandom(2);
|
||||
p.getSkills().setLevel(Skills.HITPOINTS, 55);
|
||||
p.getSkills().setStaticLevel(Skills.HITPOINTS, 55);
|
||||
switch(combatType)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
buildDragonArcherStats(p);
|
||||
buildDragonArcherEquipment(p);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
buildDragonMeleeStats(p);
|
||||
buildDragonMeleeEquipment(p);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
buildDragonMeleeStats(p);
|
||||
buildDragonMeleeEquipment(p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void createPestControlBot(PestControlTestBot p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.SLAYER, 99);
|
||||
p.getSkills().setStaticLevel(Skills.SLAYER, 99);
|
||||
int combatType = RandomFunction.getRandom(2);
|
||||
buildMaxMeleeStats(p);
|
||||
buildMaxMeleeEquipment(p);
|
||||
switch(combatType)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void buildMaxMeleeStats(AIPlayer p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.ATTACK, 99);
|
||||
p.getSkills().setStaticLevel(Skills.ATTACK, 99);
|
||||
p.getSkills().setLevel(Skills.STRENGTH, 99);
|
||||
p.getSkills().setStaticLevel(Skills.STRENGTH, 99);
|
||||
p.getSkills().setLevel(Skills.DEFENCE, 99);
|
||||
p.getSkills().setStaticLevel(Skills.DEFENCE, 99);
|
||||
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
}
|
||||
|
||||
private static void buildMaxMeleeEquipment(AIPlayer p) {
|
||||
int[] helms = {
|
||||
3751, //Berserker Helm
|
||||
};
|
||||
int[] shield = {
|
||||
14767, //Dragon defender
|
||||
};
|
||||
int[] platebody = {
|
||||
11724, //Bandos chainmail.
|
||||
};
|
||||
int[] platelegs = {
|
||||
11726, //Bandos Tassets.
|
||||
};
|
||||
int[] amulets = {
|
||||
6585, //fury
|
||||
};
|
||||
int[] boots = {
|
||||
3105, //Climbing boots.
|
||||
};
|
||||
int[] cape = {
|
||||
6570, //Fire cape.
|
||||
};
|
||||
int[] gloves = {
|
||||
7462, //Barrows Gloves.
|
||||
};
|
||||
|
||||
int[] weapons2 = {
|
||||
4151, //Whip
|
||||
};
|
||||
|
||||
p.getEquipment().replace(new Item(helms[RandomFunction.random(helms.length)]), EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(shield[RandomFunction.random(shield.length)]), EquipmentContainer.SLOT_SHIELD);
|
||||
p.getEquipment().replace(new Item(platebody[RandomFunction.random(platebody.length)]), EquipmentContainer.SLOT_CHEST);
|
||||
p.getEquipment().replace(new Item(platelegs[RandomFunction.random(platelegs.length)]), EquipmentContainer.SLOT_LEGS);
|
||||
p.getEquipment().replace(new Item(weapons2[RandomFunction.random(weapons2.length)]), EquipmentContainer.SLOT_WEAPON);
|
||||
p.getEquipment().replace(new Item(amulets[RandomFunction.random(amulets.length)]), EquipmentContainer.SLOT_AMULET);
|
||||
p.getEquipment().replace(new Item(boots[RandomFunction.random(boots.length)]), EquipmentContainer.SLOT_FEET);
|
||||
p.getEquipment().replace(new Item(cape[RandomFunction.random(cape.length)]), EquipmentContainer.SLOT_CAPE);
|
||||
p.getEquipment().replace(new Item(gloves[RandomFunction.random(gloves.length)]), EquipmentContainer.SLOT_HANDS);
|
||||
}
|
||||
|
||||
public static void createNoob(NoobBot p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.SLAYER, 99);
|
||||
p.getSkills().setStaticLevel(Skills.SLAYER, 99);
|
||||
int combatType = RandomFunction.getRandom(3);
|
||||
p.getSkills().setLevel(Skills.HITPOINTS, 10 + RandomFunction.getRandom(10));
|
||||
p.getSkills().setStaticLevel(Skills.HITPOINTS, 10 + RandomFunction.getRandom(10));
|
||||
p.getSkills().setLevel(Skills.DEFENCE, 1 + RandomFunction.getRandom(9));
|
||||
p.getSkills().setStaticLevel(Skills.DEFENCE, 1 + RandomFunction.getRandom(9));
|
||||
p.getInventory().add(new Item(329, 5));
|
||||
switch(combatType)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
buildNoobArcherStats(p);
|
||||
buildNoobArcherEquipment(p);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
buildNoobMeleeStats(p);
|
||||
buildNoobMeleeEquipment(p);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
buildNoobMageStats(p);
|
||||
buildNoobMagicEquipment(p);
|
||||
setupWizard(p);
|
||||
}
|
||||
default:
|
||||
{
|
||||
buildNoobMeleeStats(p);
|
||||
buildNoobMeleeEquipment(p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void buildArcherStats(PvMBots p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.RANGE, 10);
|
||||
p.getSkills().setStaticLevel(Skills.RANGE, 10);
|
||||
p.getSkills().setLevel(Skills.DEFENCE, 10);
|
||||
p.getSkills().setStaticLevel(Skills.DEFENCE, 10);
|
||||
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
}
|
||||
|
||||
private static void buildDragonArcherStats(DragonKiller p)
|
||||
{
|
||||
p.getSkills().setStaticLevel(Skills.RANGE, 55 + RandomFunction.getRandom(15));
|
||||
p.getSkills().setLevel(Skills.RANGE, p.getSkills().getLevel(Skills.RANGE));
|
||||
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
}
|
||||
|
||||
private static void buildNoobArcherStats(NoobBot p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.RANGE, 1 + RandomFunction.getRandom(10));
|
||||
p.getSkills().setStaticLevel(Skills.RANGE, 1 + RandomFunction.getRandom(10));
|
||||
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
}
|
||||
|
||||
public static void buildMeleeStats(PvMBots p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.ATTACK, 10);
|
||||
p.getSkills().setStaticLevel(Skills.ATTACK, 10);
|
||||
p.getSkills().setLevel(Skills.STRENGTH, 10);
|
||||
p.getSkills().setStaticLevel(Skills.STRENGTH, 10);
|
||||
p.getSkills().setLevel(Skills.DEFENCE, 10);
|
||||
p.getSkills().setStaticLevel(Skills.DEFENCE, 10);
|
||||
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
}
|
||||
|
||||
public static void buildDragonMeleeStats(DragonKiller p)
|
||||
{
|
||||
|
||||
p.getSkills().setStaticLevel(Skills.ATTACK, 55 + RandomFunction.getRandom(15));
|
||||
p.getSkills().setLevel(Skills.ATTACK, p.getSkills().getLevel(Skills.ATTACK));
|
||||
p.getSkills().setStaticLevel(Skills.STRENGTH, 55 + RandomFunction.getRandom(15));
|
||||
p.getSkills().setLevel(Skills.STRENGTH, p.getSkills().getLevel(Skills.STRENGTH));
|
||||
p.getSkills().setLevel(Skills.DEFENCE, 45 + RandomFunction.getRandom(15));
|
||||
p.getSkills().setLevel(Skills.DEFENCE, p.getSkills().getLevel(Skills.DEFENCE));
|
||||
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
}
|
||||
|
||||
private static void buildNoobMeleeStats(NoobBot p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.ATTACK, 1 + RandomFunction.getRandom(10));
|
||||
p.getSkills().setStaticLevel(Skills.ATTACK, 1 + RandomFunction.getRandom(10));
|
||||
p.getSkills().setLevel(Skills.STRENGTH, 1 + RandomFunction.getRandom(10));
|
||||
p.getSkills().setStaticLevel(Skills.STRENGTH, 1 + RandomFunction.getRandom(10));
|
||||
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
}
|
||||
|
||||
private static void buildMageStats(PvMBots p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.MAGIC, 10);
|
||||
p.getSkills().setStaticLevel(Skills.MAGIC, 10);
|
||||
p.getSkills().setLevel(Skills.DEFENCE, 10);
|
||||
p.getSkills().setStaticLevel(Skills.DEFENCE, 10);
|
||||
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
}
|
||||
|
||||
private static void buildNoobMageStats(NoobBot p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.MAGIC, 1 + RandomFunction.getRandom(10));
|
||||
p.getSkills().setStaticLevel(Skills.MAGIC, 1 + RandomFunction.getRandom(10));
|
||||
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
}
|
||||
|
||||
private static void setupWizard(PvMBots p)
|
||||
{
|
||||
//final int SPELL_IDS[] = new int[] {1, 4, 6, 8, 10, 14, 17, 20, 24, 27, 33, 38, 45, 48, 52, 55 };
|
||||
p.getProperties().setAutocastSpell(((CombatSpell) SpellBookManager.SpellBook.MODERN.getSpell(1)));
|
||||
p.getInventory().add(new Item(556, 1000)); //Air runes
|
||||
p.getInventory().add(new Item(558, 1000)); //Mind runes
|
||||
}
|
||||
|
||||
private static void buildArcherEquipment(PvMBots p)
|
||||
{
|
||||
p.getEquipment().replace(new Item(1169), EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(1129), EquipmentContainer.SLOT_CHEST);
|
||||
p.getEquipment().replace(new Item(1095), EquipmentContainer.SLOT_LEGS);
|
||||
p.getEquipment().replace(new Item(841), EquipmentContainer.SLOT_WEAPON);
|
||||
p.getEquipment().replace(new Item(884, 5000), EquipmentContainer.SLOT_ARROWS);
|
||||
p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE);
|
||||
p.getEquipment().replace(new Item(1478), EquipmentContainer.SLOT_AMULET);
|
||||
}
|
||||
|
||||
private static void buildDragonArcherEquipment(DragonKiller p)
|
||||
{
|
||||
p.getEquipment().replace(new Item(1169), EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(13483), EquipmentContainer.SLOT_CHEST);
|
||||
p.getEquipment().replace(new Item(1099), EquipmentContainer.SLOT_LEGS);
|
||||
p.getEquipment().replace(new Item(9185), EquipmentContainer.SLOT_WEAPON);
|
||||
p.getEquipment().replace(new Item(1540), EquipmentContainer.SLOT_SHIELD);
|
||||
p.getEquipment().replace(new Item(9140, 500), EquipmentContainer.SLOT_ARROWS);
|
||||
p.getEquipment().replace(new Item(10498), EquipmentContainer.SLOT_CAPE);
|
||||
p.getEquipment().replace(new Item(1478), EquipmentContainer.SLOT_AMULET);
|
||||
}
|
||||
|
||||
private static void buildNoobArcherEquipment(PvMBots p)
|
||||
{
|
||||
int hats[] = {1169, 1169, 1139, 1137, 1153, 579};
|
||||
int legs[] = {1095, 7366, 1075, 1087, 1095};
|
||||
int chest[] = {1129, 1103, 1101, 1129, 1117, 577};
|
||||
|
||||
p.getEquipment().replace(new Item(hats[RandomFunction.getRandom(hats.length - 1)]), EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(chest[RandomFunction.getRandom(chest.length - 1)]), EquipmentContainer.SLOT_CHEST);
|
||||
p.getEquipment().replace(new Item(legs[RandomFunction.getRandom(legs.length - 1)]), EquipmentContainer.SLOT_LEGS);
|
||||
p.getEquipment().replace(new Item(841), EquipmentContainer.SLOT_WEAPON);
|
||||
p.getEquipment().replace(new Item(884, 5000), EquipmentContainer.SLOT_ARROWS);
|
||||
p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE);
|
||||
p.getEquipment().replace(new Item(1478), EquipmentContainer.SLOT_AMULET);
|
||||
}
|
||||
|
||||
private static void buildMeleeEquipment(PvMBots p)
|
||||
{
|
||||
p.getEquipment().replace(new Item(1153), EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(1115), EquipmentContainer.SLOT_CHEST);
|
||||
p.getEquipment().replace(new Item(1067), EquipmentContainer.SLOT_LEGS);
|
||||
p.getEquipment().replace(new Item(1309), EquipmentContainer.SLOT_WEAPON);
|
||||
p.getEquipment().replace(new Item(884), EquipmentContainer.SLOT_ARROWS);
|
||||
p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE);
|
||||
p.getEquipment().replace(new Item(1725), EquipmentContainer.SLOT_AMULET);
|
||||
}
|
||||
|
||||
private static void buildDragonMeleeEquipment(DragonKiller p)
|
||||
{
|
||||
p.getEquipment().replace(new Item(1163), EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(1127), EquipmentContainer.SLOT_CHEST);
|
||||
p.getEquipment().replace(new Item(1079), EquipmentContainer.SLOT_LEGS);
|
||||
p.getEquipment().replace(new Item(1333), EquipmentContainer.SLOT_WEAPON);
|
||||
p.getEquipment().replace(new Item(1540), EquipmentContainer.SLOT_SHIELD);
|
||||
p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE);
|
||||
p.getEquipment().replace(new Item(1725), EquipmentContainer.SLOT_AMULET);
|
||||
}
|
||||
|
||||
private static void buildNoobMeleeEquipment(PvMBots p)
|
||||
{
|
||||
int hats[] = {1169, 1169, 1139, 1137, 1153, 579};
|
||||
int legs[] = {1095, 7366, 1075, 1087, 1095};
|
||||
int chest[] = {1129, 1103, 1101, 1129, 1117, 577};
|
||||
int weapons[] = {1307, 1321, 1375, 1203, 1239, 1267, 1293, 1323, 1335};
|
||||
|
||||
p.getEquipment().replace(new Item(hats[RandomFunction.getRandom(hats.length - 1)]), EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(chest[RandomFunction.getRandom(chest.length - 1)]), EquipmentContainer.SLOT_CHEST);
|
||||
p.getEquipment().replace(new Item(legs[RandomFunction.getRandom(legs.length - 1)]), EquipmentContainer.SLOT_LEGS);
|
||||
p.getEquipment().replace(new Item(weapons[RandomFunction.getRandom(weapons.length - 1)]), EquipmentContainer.SLOT_WEAPON);
|
||||
p.getEquipment().replace(new Item(884), EquipmentContainer.SLOT_ARROWS);
|
||||
p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE);
|
||||
p.getEquipment().replace(new Item(1725), EquipmentContainer.SLOT_AMULET);
|
||||
}
|
||||
|
||||
private static void buildMagicEquipment(PvMBots p)
|
||||
{
|
||||
p.getEquipment().replace(new Item(579), EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(577), EquipmentContainer.SLOT_CHEST);
|
||||
p.getEquipment().replace(new Item(1011), EquipmentContainer.SLOT_LEGS);
|
||||
p.getEquipment().replace(new Item(1389), EquipmentContainer.SLOT_WEAPON);
|
||||
p.getEquipment().replace(new Item(884), EquipmentContainer.SLOT_ARROWS);
|
||||
p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE);
|
||||
p.getEquipment().replace(new Item(1727), EquipmentContainer.SLOT_AMULET);
|
||||
}
|
||||
|
||||
private static void buildNoobMagicEquipment(PvMBots p)
|
||||
{
|
||||
int hats[] = {1169, 1169, 1139, 1137, 1153, 579};
|
||||
int legs[] = {1095, 7366, 1075, 1087, 1095};
|
||||
int chest[] = {1129, 1103, 1101, 1129, 1117, 577};
|
||||
int weapons[] = {1379, 1383, 1385, 1387, 1389};
|
||||
|
||||
p.getEquipment().replace(new Item(hats[RandomFunction.getRandom(hats.length - 1)]), EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(chest[RandomFunction.getRandom(chest.length - 1)]), EquipmentContainer.SLOT_CHEST);
|
||||
p.getEquipment().replace(new Item(legs[RandomFunction.getRandom(legs.length - 1)]), EquipmentContainer.SLOT_LEGS);
|
||||
p.getEquipment().replace(new Item(weapons[RandomFunction.getRandom(weapons.length - 1)]), EquipmentContainer.SLOT_WEAPON);
|
||||
p.getEquipment().replace(new Item(884), EquipmentContainer.SLOT_ARROWS);
|
||||
p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE);
|
||||
p.getEquipment().replace(new Item(1727), EquipmentContainer.SLOT_AMULET);
|
||||
}
|
||||
|
||||
public static void spawn(Location loc)
|
||||
{
|
||||
final PvMBots bot = PvMBotsBuilder.create("bottest", loc);
|
||||
bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE);
|
||||
Repository.getPlayers().add(bot);
|
||||
bot.init();
|
||||
}
|
||||
|
||||
public static void spawnPestControlTestBot(Location loc)
|
||||
{
|
||||
final PestControlTestBot bot = PvMBotsBuilder.createPestControlTestBot("PestBot", loc);
|
||||
bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE);
|
||||
Repository.getPlayers().add(bot);
|
||||
bot.init();
|
||||
|
||||
createPestControlBot(bot);
|
||||
}
|
||||
|
||||
public static void spawnLowest(Location loc)
|
||||
{
|
||||
final LowestBot bot = PvMBotsBuilder.createLowest("bottest", loc);
|
||||
bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE);
|
||||
Repository.getPlayers().add(bot);
|
||||
bot.init();
|
||||
|
||||
generateMinLevels(bot);
|
||||
}
|
||||
|
||||
public static void spawnNoob(Location loc)
|
||||
{
|
||||
final NoobBot bot = PvMBotsBuilder.createNoob("bottest", loc);
|
||||
bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE);
|
||||
Repository.getPlayers().add(bot);
|
||||
bot.init();
|
||||
|
||||
createNoob(bot);
|
||||
}
|
||||
|
||||
public static void spawnDragonKiller(Location loc)
|
||||
{
|
||||
final DragonKiller bot = PvMBotsBuilder.createDragonKiller("bottest", loc);
|
||||
bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE);
|
||||
Repository.getPlayers().add(bot);
|
||||
bot.init();
|
||||
|
||||
createDragonKiller(bot);
|
||||
}
|
||||
|
||||
public static void spawnGiantMoleBot(Location loc)
|
||||
{
|
||||
final GiantMoleBot bot = PvMBotsBuilder.createGiantMoleBot("bottest", new Location(0, 0));
|
||||
bot.teleport(loc);
|
||||
bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE);
|
||||
Repository.getPlayers().add(bot);
|
||||
bot.init();
|
||||
|
||||
generateGiantMoleBot(bot);
|
||||
}
|
||||
|
||||
public static void immersiveSpawns()
|
||||
{
|
||||
//Lumbridge
|
||||
//GOBLINS
|
||||
spawnLowest(new Location(3259, 3224));
|
||||
spawnLowest(new Location(3251, 3235));
|
||||
spawnLowest(new Location(3244, 3247));
|
||||
spawnNoob(new Location(3244, 3247));
|
||||
//COWS
|
||||
spawnLowest(new Location(3259, 3245));
|
||||
spawnLowest(new Location(3258, 3261));
|
||||
spawnLowest(new Location(3263, 3263));
|
||||
spawnLowest(new Location(3263, 3271));
|
||||
spawnLowest(new Location(3254, 3288));
|
||||
//CHICKENS
|
||||
spawnLowest(new Location(3234, 3294));
|
||||
spawnLowest(new Location(3229, 3297));
|
||||
//GOBLINS2
|
||||
spawnLowest(new Location(3182, 3255));
|
||||
spawnLowest(new Location(3169, 3254));
|
||||
spawnLowest(new Location(3167, 3233));
|
||||
spawnLowest(new Location(3152, 3228));
|
||||
//Lumby castle
|
||||
spawnLowest(new Location(3221, 3219));
|
||||
spawnNoob(new Location(3193, 3208));
|
||||
//Lumby swamp
|
||||
spawnNoob(new Location(3224, 3186));
|
||||
spawnNoob(new Location(3217, 3177));
|
||||
spawnNoob(new Location(3209, 3191));
|
||||
|
||||
//Edge
|
||||
spawnLowest(new Location(3096, 3509));
|
||||
|
||||
//Edge dungeon
|
||||
//Hill giants
|
||||
spawnLowest(new Location(3118, 9848));
|
||||
spawnLowest(new Location(3110, 9842));
|
||||
spawnLowest(new Location(3115, 9836));
|
||||
spawnLowest(new Location(3107, 9832));
|
||||
spawnLowest(new Location(3099, 9834));
|
||||
//brass key room
|
||||
spawnLowest(new Location(3127, 9863));
|
||||
|
||||
//Dark wizzards
|
||||
spawnLowest(new Location(3226, 3367));
|
||||
spawnLowest(new Location(3226, 3368));
|
||||
spawnLowest(new Location(3230, 3373));
|
||||
spawnLowest(new Location(3209, 3378));
|
||||
|
||||
//Varrock palace
|
||||
spawnLowest(new Location(3218, 3465));
|
||||
spawnLowest(new Location(3209, 3462));
|
||||
|
||||
//Varrock Sewers
|
||||
spawnLowest(new Location(3235, 9868));
|
||||
spawnLowest(new Location(3242, 9915));
|
||||
spawnLowest(new Location(3176, 9883));
|
||||
|
||||
//Dragons Wilderness
|
||||
//WEST
|
||||
spawnDragonKiller(new Location(2977, 3614));
|
||||
spawnDragonKiller(new Location(2987, 3619));
|
||||
|
||||
//Burthrope Dungeon
|
||||
//Blue dragons
|
||||
spawnDragonKiller(new Location(2901, 9799));
|
||||
spawnDragonKiller(new Location(2910, 9804));
|
||||
//Al kharid
|
||||
//palace
|
||||
spawnLowest(new Location(3301, 3173));
|
||||
spawnNoob(new Location(3293, 3170));
|
||||
spawnNoob(new Location(3286, 3171));
|
||||
spawnNoob(new Location(3289, 3169));
|
||||
|
||||
//Slayer Tower
|
||||
spawnLowest(new Location(3412, 3173));
|
||||
spawnNoob(new Location(3412, 3539));
|
||||
spawnNoob(new Location(3420, 3545));
|
||||
spawnNoob(new Location(3420, 3545));
|
||||
spawnNoob(new Location(3420, 3558));
|
||||
spawnNoob(new Location(3433, 3571));
|
||||
//Replace with something like rune bots
|
||||
spawnDragonKiller(new Location(3437, 3562, 1));
|
||||
spawnDragonKiller(new Location(3437, 3562, 1));
|
||||
spawnDragonKiller(new Location(3437, 3562, 1));
|
||||
//Bloodvelds
|
||||
spawnDragonKiller(new Location(3417, 3561, 1));
|
||||
spawnDragonKiller(new Location(3417, 3561, 1));
|
||||
spawnDragonKiller(new Location(3417, 3561, 1));
|
||||
//Brimhaven dragons
|
||||
spawnDragonKiller(new Location(2704, 9450));
|
||||
spawnDragonKiller(new Location(2704, 9450));
|
||||
}
|
||||
public void randomItem()
|
||||
{
|
||||
Item test = null;
|
||||
ArrayList<Item> tests = new ArrayList<Item>();
|
||||
for (int x = 0; x < 9999; x++)
|
||||
test = new Item(x);
|
||||
if (test.getDefinition().getEquipId() != 0)
|
||||
tests.add(test);
|
||||
}
|
||||
}
|
||||
|
|
@ -1,37 +1,52 @@
|
|||
package org.crandor.game.node.entity.player.ai.pvp;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.crandor.game.container.impl.EquipmentContainer;
|
||||
import org.crandor.game.content.global.consumable.*;
|
||||
import org.crandor.game.content.global.consumable.Consumable;
|
||||
import org.crandor.game.content.global.consumable.ConsumableProperties;
|
||||
import org.crandor.game.content.global.consumable.Consumables;
|
||||
import org.crandor.game.content.global.consumable.Food;
|
||||
import org.crandor.game.content.skill.Skills;
|
||||
import org.crandor.game.node.entity.Entity;
|
||||
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.item.Item;
|
||||
import org.crandor.game.system.task.Pulse;
|
||||
import org.crandor.game.world.GameWorld;
|
||||
import org.crandor.game.world.map.RegionManager;
|
||||
import org.crandor.game.world.map.path.Pathfinder;
|
||||
import org.crandor.game.world.update.flag.context.ChatMessage;
|
||||
import org.crandor.game.world.update.flag.player.ChatFlag;
|
||||
import org.crandor.tools.RandomFunction;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PVPAIPActions {
|
||||
|
||||
public static List<AIPlayer> pvp_players = null;
|
||||
|
||||
private static final String[] trashMessages = {
|
||||
"Your suck brooo",
|
||||
"Your suck broo",
|
||||
"Your suck bro",
|
||||
"Come on dude",
|
||||
"lol",
|
||||
"l0l",
|
||||
"I'll do your bloody nan in m8",
|
||||
"Your sister smells like a tuna sandwich",
|
||||
"You suck at bridding bro lmao",
|
||||
"Gf your bank :)",
|
||||
"Just delete your cache ur bad",
|
||||
"FFS mate get wrekt",
|
||||
"Dylan is a better pkr than u, kid..l0l"
|
||||
|
||||
|
||||
};
|
||||
|
||||
private static final String[] safeMessages = {
|
||||
"Safe up bro",
|
||||
"Stop safein",
|
||||
"No safing bro",
|
||||
"Safe up n00b",
|
||||
"No safe",
|
||||
"Get rekt m8",
|
||||
"Stop fkin eating scrub",
|
||||
"Dw, you're gunna die anyhow.. :)",
|
||||
"Either ur eating shrimps or I'm hitting high asf",
|
||||
"Once i kill u wanna rematch?",
|
||||
|
||||
};
|
||||
|
||||
public static void syncBotThread(final Player player) {
|
||||
|
|
@ -49,11 +64,9 @@ public class PVPAIPActions {
|
|||
int ticks;
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
if (bot.getLocation().equals(3088, 3491, 0)) {
|
||||
System.out.println("Logging out");
|
||||
if (bot.getAttribute("dead", true)) {
|
||||
AIPlayer.deregister(bot.getUid());
|
||||
pvp_players.remove(bot);
|
||||
bot.getPacketDispatch().sendLogout();
|
||||
return true;
|
||||
}
|
||||
if (!bot.getInventory().contains(385, 1)) {
|
||||
|
|
@ -69,20 +82,22 @@ public class PVPAIPActions {
|
|||
if (!pvp_players.contains(target) || !Pathfinder.find(bot, target[0]).isSuccessful() || !canAttack(bot, target[0])) {
|
||||
target[0] = pvp_players.get(RandomFunction.getRandom(pvp_players.size() - 1));
|
||||
}
|
||||
pot(bot);
|
||||
attackTarget(player, bot, target[0]);
|
||||
//prayer(bot, target[0]);
|
||||
eat(bot, target[0]);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void attackTarget(Player player, AIPlayer bot, AIPlayer target) {
|
||||
//If bots target is not himself we continue.
|
||||
if (bot != target) {
|
||||
//If they are in combat or attacking:
|
||||
if (bot.getProperties().getCombatPulse().isInCombat() || bot.getProperties().getCombatPulse().isAttacking()) {
|
||||
//TODO: Pray
|
||||
Item weapon = bot.getEquipment().get(EquipmentContainer.SLOT_WEAPON);
|
||||
if (RandomFunction.getRandom(25) == 1) {
|
||||
if(bot.getSettings().getSpecialEnergy() == 100) { //TODO: Change 100 to their weielded weapons spec max amount
|
||||
|
|
@ -90,7 +105,7 @@ public class PVPAIPActions {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
if (RandomFunction.getRandom(25) == 1 && player != null) {
|
||||
if (RandomFunction.getRandom(25) == 1) {
|
||||
bot.attack(player);
|
||||
} else {
|
||||
//If a 1/50 chance is true, the attacker screams his opponents name hoping his team will dogpile him.
|
||||
|
|
@ -116,7 +131,10 @@ public class PVPAIPActions {
|
|||
* TODO: Possibly make them run away and hop the ditch (I did not do this because we have no other actions than pking at the moment).
|
||||
*/
|
||||
private static void flee(final AIPlayer bot) {
|
||||
bot.sendChat("WE FLEEIN");
|
||||
bot.sendChat("Outta food m8! Off!");
|
||||
bot.sendChat("Ahh!");
|
||||
bot.sendChat("GTFO M8");
|
||||
bot.sendChat("Someone spec him!");
|
||||
GameWorld.submit(new Pulse(1, bot) {
|
||||
int ticks;
|
||||
@Override
|
||||
|
|
@ -166,27 +184,6 @@ public class PVPAIPActions {
|
|||
}
|
||||
}
|
||||
|
||||
private static void pot(Player bot) {
|
||||
Item[] pots = new Item[] { new Item(145), new Item(157), new Item(163), new Item(169), new Item(3042)};
|
||||
//385 is shark, you can add more from there easier.
|
||||
for (Item pot : pots) {
|
||||
if (((PotionEffect.SUPER_ATTACK.getSkillBonus(bot) == null) || PotionEffect.SUPER_STRENGTH.getSkillBonus(bot) == null || PotionEffect.SUPER_DEFENCE.getSkillBonus(bot) == null || PotionEffect.RANGING_POTION.getSkillBonus(bot) == null || PotionEffect.MAGIC_POTION.getSkillBonus(bot) == null) && bot.getInventory().containsItem(pot)) {
|
||||
bot.lock(3);
|
||||
Item potion = bot.getInventory().getItem(pot);
|
||||
Consumable consumable = Consumables.forDrink(potion);
|
||||
if (consumable == null) {
|
||||
consumable = new Drink(potion.getId(), new ConsumableProperties(1));
|
||||
}
|
||||
consumable.consume(potion, bot);
|
||||
bot.getProperties().getCombatPulse().delayNextAttack(3);
|
||||
int chatRandom = RandomFunction.getRandom(50);
|
||||
if (chatRandom == 1) {
|
||||
bot.getUpdateMasks().register(new ChatFlag(new ChatMessage(bot, safeMessages[RandomFunction.getRandom(safeMessages.length - 1)], 0, 0)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean canAttack(Player p, Player t) {
|
||||
int level = p.getSkullManager().getLevel();
|
||||
if (t.getSkullManager().getLevel() < level) {
|
||||
|
|
|
|||
|
|
@ -27,12 +27,17 @@ public class PVPAIPBuilderUtils {
|
|||
buildWizardStats(p);
|
||||
buildWizardEquipment(p);
|
||||
break;
|
||||
case 3:
|
||||
//max rune
|
||||
buildMaxMeleeStats(p);
|
||||
buildMaxMeleeEquipment(p);
|
||||
break;
|
||||
}
|
||||
p.getInventory().add(new Item(385, 20));
|
||||
p.getProperties().setCombatLevel(100);
|
||||
p.getProperties().setCombatLevel(126);
|
||||
|
||||
p.getSkills().setLevel(Skills.PRAYER, 99);
|
||||
p.getSkills().setStaticLevel(Skills.PRAYER, 99);
|
||||
p.getSkills().setLevel(Skills.PRAYER, 98);
|
||||
p.getSkills().setStaticLevel(Skills.PRAYER, 98);
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
correctHitpointsStat(p);
|
||||
|
|
@ -40,7 +45,8 @@ public class PVPAIPBuilderUtils {
|
|||
|
||||
private static void buildWizardEquipment(AIPlayer p) {
|
||||
int[] weapons = {
|
||||
1381
|
||||
1381,
|
||||
4675,
|
||||
};
|
||||
int hat = -1;
|
||||
int platebody = -1;
|
||||
|
|
@ -73,6 +79,13 @@ public class PVPAIPBuilderUtils {
|
|||
gloves = RandomFunction.getRandom(10) == 1 ? generateGloves() : 4115;
|
||||
boots = RandomFunction.getRandom(10) == 1 ? generateBoots() : 4117;
|
||||
break;
|
||||
case 3:
|
||||
hat = 4708;
|
||||
platebody = 4712;
|
||||
platelegs = 44714;
|
||||
gloves = RandomFunction.getRandom(10) == 1 ? generateGloves() : 4095;
|
||||
boots = RandomFunction.getRandom(10) == 1 ? generateBoots() : 4097;
|
||||
break;
|
||||
}
|
||||
p.getEquipment().replace(new Item(hat), EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(platebody), EquipmentContainer.SLOT_CHEST);
|
||||
|
|
@ -86,8 +99,8 @@ public class PVPAIPBuilderUtils {
|
|||
}
|
||||
|
||||
private static void setupWizard(AIPlayer p) {
|
||||
final int SPELL_IDS[] = new int[] {1, 4, 6, 8, 10, 14, 17, 20, 24, 27, 33, 38, 45, 48, 52, 55 };
|
||||
p.getProperties().setAutocastSpell(((CombatSpell) SpellBookManager.SpellBook.MODERN.getSpell(SPELL_IDS[RandomFunction.random(SPELL_IDS.length)])));
|
||||
//final int SPELL_IDS[] = new int[] {1, 4, 6, 8, 10, 14, 17, 20, 24, 27, 33, 38, 45, 48, 52, 55 };
|
||||
p.getProperties().setAutocastSpell(((CombatSpell) SpellBookManager.SpellBook.MODERN.getSpell(55)));
|
||||
p.getInventory().add(new Item(554, 1000)); //Fire runes
|
||||
p.getInventory().add(new Item(555, 1000)); //Water runes
|
||||
p.getInventory().add(new Item(556, 1000)); //Air runes
|
||||
|
|
@ -101,8 +114,8 @@ public class PVPAIPBuilderUtils {
|
|||
}
|
||||
|
||||
private static void buildWizardStats(AIPlayer p) {
|
||||
int magicLevel = RandomFunction.random(60, 99);
|
||||
int defenceLevel = RandomFunction.random(40, 99);
|
||||
int magicLevel = RandomFunction.random(80, 98);
|
||||
int defenceLevel = RandomFunction.random(80, 98);
|
||||
|
||||
p.getSkills().setLevel(Skills.MAGIC, magicLevel);
|
||||
p.getSkills().setStaticLevel(Skills.MAGIC, magicLevel);
|
||||
|
|
@ -116,9 +129,9 @@ public class PVPAIPBuilderUtils {
|
|||
|
||||
|
||||
private static void buildMeleeStats(AIPlayer p) {
|
||||
int attackLevel = RandomFunction.random(60, 99);
|
||||
int attackLevel = RandomFunction.random(80, 98);
|
||||
int strengthLevel = RandomFunction.random(attackLevel - 10, attackLevel + 10);
|
||||
int defenceLevel = RandomFunction.random(40, 99);
|
||||
int defenceLevel = RandomFunction.random(60, 98);
|
||||
|
||||
p.getSkills().setLevel(Skills.ATTACK, attackLevel);
|
||||
p.getSkills().setStaticLevel(Skills.ATTACK, attackLevel);
|
||||
|
|
@ -137,6 +150,9 @@ public class PVPAIPBuilderUtils {
|
|||
1163, //Rune Full Helm
|
||||
3751, //Berserker Helm
|
||||
3753, //Warrior Helm
|
||||
10828,
|
||||
1038,
|
||||
4753,
|
||||
//TODO: No helm
|
||||
};
|
||||
int[] shield = {
|
||||
|
|
@ -144,13 +160,22 @@ public class PVPAIPBuilderUtils {
|
|||
1201, //Rune kiteshield
|
||||
6524, //Obsidian shield
|
||||
8850, //Rune defender
|
||||
11283, //dragonfire shield
|
||||
14767, //dragon defender
|
||||
};
|
||||
int[] platebody = {
|
||||
1113, //Rune chainmail.
|
||||
1127, //Rune platebody.
|
||||
10551,
|
||||
4757,
|
||||
11724,
|
||||
4720,
|
||||
};
|
||||
int[] platelegs = {
|
||||
1079, //Rune platelegs.
|
||||
4759,
|
||||
11726,
|
||||
1075,
|
||||
};
|
||||
p.getEquipment().replace(new Item(helms[RandomFunction.random(helms.length)]), EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(shield[RandomFunction.random(shield.length)]), EquipmentContainer.SLOT_SHIELD);
|
||||
|
|
@ -164,17 +189,69 @@ public class PVPAIPBuilderUtils {
|
|||
}
|
||||
|
||||
public static final int[] weapons = {
|
||||
1303, //Rune long sword
|
||||
1305, //Dragon longsword
|
||||
1434, //Dragon mace
|
||||
1215, //Dragon dagger
|
||||
5698, //DDS
|
||||
4151, //Whip
|
||||
4587, //Dragon Scimitar
|
||||
|
||||
};
|
||||
|
||||
|
||||
private static void buildMaxMeleeStats(AIPlayer p) {
|
||||
|
||||
p.getSkills().setLevel(Skills.ATTACK, 99);
|
||||
p.getSkills().setStaticLevel(Skills.ATTACK, 99);
|
||||
p.getSkills().setLevel(Skills.STRENGTH, 99);
|
||||
p.getSkills().setStaticLevel(Skills.STRENGTH, 99);
|
||||
p.getSkills().setLevel(Skills.DEFENCE, 99);
|
||||
p.getSkills().setStaticLevel(Skills.DEFENCE, 99);
|
||||
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
correctHitpointsStat(p);
|
||||
}
|
||||
|
||||
private static void buildMaxMeleeEquipment(AIPlayer p) {
|
||||
int[] helms = {
|
||||
3751, //Berserker Helm
|
||||
};
|
||||
int[] shield = {
|
||||
14767, //Dragon defender
|
||||
};
|
||||
int[] platebody = {
|
||||
11724, //Bandos chainmail.
|
||||
};
|
||||
int[] platelegs = {
|
||||
11726, //Bandos Tassets.
|
||||
};
|
||||
int[] amulets = {
|
||||
6585, //fury
|
||||
};
|
||||
int[] boots = {
|
||||
3105, //Climbing boots.
|
||||
};
|
||||
int[] cape = {
|
||||
6570, //Fire cape.
|
||||
};
|
||||
int[] gloves = {
|
||||
7462, //Barrows Gloves.
|
||||
};
|
||||
p.getEquipment().replace(new Item(helms[RandomFunction.random(helms.length)]), EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(shield[RandomFunction.random(shield.length)]), EquipmentContainer.SLOT_SHIELD);
|
||||
p.getEquipment().replace(new Item(platebody[RandomFunction.random(platebody.length)]), EquipmentContainer.SLOT_CHEST);
|
||||
p.getEquipment().replace(new Item(platelegs[RandomFunction.random(platelegs.length)]), EquipmentContainer.SLOT_LEGS);
|
||||
p.getEquipment().replace(new Item(weapons2[RandomFunction.random(weapons2.length)]), EquipmentContainer.SLOT_WEAPON);
|
||||
p.getEquipment().replace(new Item(amulets[RandomFunction.random(amulets.length)]), EquipmentContainer.SLOT_AMULET);
|
||||
p.getEquipment().replace(new Item(boots[RandomFunction.random(boots.length)]), EquipmentContainer.SLOT_FEET);
|
||||
p.getEquipment().replace(new Item(cape[RandomFunction.random(cape.length)]), EquipmentContainer.SLOT_CAPE);
|
||||
p.getEquipment().replace(new Item(gloves[RandomFunction.random(gloves.length)]), EquipmentContainer.SLOT_HANDS);
|
||||
}
|
||||
|
||||
public static final int[] weapons2 = {
|
||||
4151, //Whip
|
||||
};
|
||||
|
||||
private static void buildArcherStats(AIPlayer p) {
|
||||
int rangedLevel = RandomFunction.random(60, 99);
|
||||
int defenceLevel = RandomFunction.random(40, 99);
|
||||
int rangedLevel = RandomFunction.random(80, 98);
|
||||
int defenceLevel = RandomFunction.random(60, 98);
|
||||
|
||||
p.getSkills().setLevel(Skills.RANGE, rangedLevel);
|
||||
p.getSkills().setStaticLevel(Skills.RANGE, rangedLevel);
|
||||
|
|
@ -189,15 +266,19 @@ public class PVPAIPBuilderUtils {
|
|||
private static void buildArcherEquipment(AIPlayer p) {
|
||||
int[] helms = {
|
||||
3749, //Archer helm
|
||||
2581,
|
||||
10828,
|
||||
};
|
||||
int[] weapons = {
|
||||
857, //Yew shortbow
|
||||
855, //Yew longbow
|
||||
861, //Magic shortbow
|
||||
859, //Magic longbow
|
||||
11235,
|
||||
};
|
||||
int[] arrows = {
|
||||
892, //Rune arrow
|
||||
11212,
|
||||
};
|
||||
int platebody = -1;
|
||||
int platelegs = -1;
|
||||
|
|
@ -245,6 +326,7 @@ public class PVPAIPBuilderUtils {
|
|||
2412, //Saradomin Cape
|
||||
2413, //Guthix Cape
|
||||
2414, //Zamorak Cape
|
||||
6570,
|
||||
};
|
||||
return capes[RandomFunction.random(capes.length)];
|
||||
}
|
||||
|
|
@ -256,13 +338,15 @@ public class PVPAIPBuilderUtils {
|
|||
1727, //Amulet of magic
|
||||
1729, //Amulet of defence
|
||||
1478, //Amulet of accuracy
|
||||
6585,
|
||||
};
|
||||
return amulets[RandomFunction.random(amulets.length)];
|
||||
}
|
||||
|
||||
private static int generateGloves() {
|
||||
int[] gloves = {
|
||||
1059
|
||||
1059,
|
||||
7462
|
||||
};
|
||||
return gloves[RandomFunction.random(gloves.length)];
|
||||
}
|
||||
|
|
@ -273,6 +357,7 @@ public class PVPAIPBuilderUtils {
|
|||
1837, //Desert boots.
|
||||
3105, //Climbing boots.
|
||||
3791, //Fremmy boots.
|
||||
11732,
|
||||
};
|
||||
return boots[RandomFunction.random(boots.length)];
|
||||
}
|
||||
|
|
@ -280,16 +365,17 @@ public class PVPAIPBuilderUtils {
|
|||
private static void correctHitpointsStat(AIPlayer player) {
|
||||
player.getSkills().setLevel(Skills.HITPOINTS, 10);
|
||||
player.getSkills().setStaticLevel(Skills.HITPOINTS, 10);
|
||||
double total_exp =
|
||||
player.getSkills().getExperience(Skills.ATTACK) +
|
||||
player.getSkills().getExperience(Skills.STRENGTH) +
|
||||
player.getSkills().getExperience(Skills.DEFENCE) +
|
||||
player.getSkills().getExperience(Skills.RANGE)+
|
||||
player.getSkills().getExperience(Skills.MAGIC);
|
||||
double hp_exp = Math.floor(total_exp / 3.0) + 1154;
|
||||
player.getSkills().addExperience(Skills.HITPOINTS, hp_exp);
|
||||
player.getSkills().updateCombatLevel();
|
||||
player.getAppearance().sync();
|
||||
int rangedLevel = RandomFunction.random(80, 98);
|
||||
int defenceLevel = RandomFunction.random(80, 98);
|
||||
|
||||
player.getSkills().setLevel(Skills.HITPOINTS, rangedLevel);
|
||||
player.getSkills().setStaticLevel(Skills.HITPOINTS, rangedLevel);
|
||||
player.getSkills().setLevel(Skills.HITPOINTS, defenceLevel);
|
||||
player.getSkills().setStaticLevel(Skills.HITPOINTS, defenceLevel);
|
||||
|
||||
player.getSkills().updateCombatLevel();
|
||||
player.getAppearance().sync();
|
||||
}
|
||||
|
||||
public static final String[] names = {
|
||||
|
|
@ -420,6 +506,7 @@ public class PVPAIPBuilderUtils {
|
|||
"k4eo9ssi7",
|
||||
"juxikeederast",
|
||||
"d_man_5567",
|
||||
"mod_richard",
|
||||
"q1w2e1r2",
|
||||
"be_kingless",
|
||||
"hardflip",
|
||||
|
|
@ -437,6 +524,10 @@ public class PVPAIPBuilderUtils {
|
|||
"giantpenis3959737",
|
||||
"dragonoid798",
|
||||
"qwerty798",
|
||||
"dylansuxnutz",
|
||||
"2016",
|
||||
"nigbittiesbro",
|
||||
"pk4lifefoo",
|
||||
"logieboi",
|
||||
"wichking",
|
||||
"kyros60r0bl33mfzo",
|
||||
|
|
|
|||
|
|
@ -1,20 +1,15 @@
|
|||
package org.crandor.game.node.entity.player.ai.resource;
|
||||
|
||||
import org.crandor.game.content.skill.free.gather.GatheringSkillPulse;
|
||||
import org.crandor.game.content.skill.free.gather.SkillingResource;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.entity.player.ai.AIPlayer;
|
||||
import org.crandor.game.node.object.GameObject;
|
||||
import org.crandor.game.system.task.Pulse;
|
||||
import org.crandor.game.world.GameWorld;
|
||||
import org.crandor.game.world.map.Location;
|
||||
import org.crandor.game.world.map.RegionManager;
|
||||
import org.crandor.game.world.map.path.Pathfinder;
|
||||
import org.crandor.game.world.repository.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class ResourceAIPActions {
|
||||
|
||||
|
||||
public static List<AIPlayer> resource_players = null;
|
||||
|
||||
|
|
@ -28,6 +23,7 @@ public class ResourceAIPActions {
|
|||
final AIPlayer bot = resource_players.get(aip_index);
|
||||
GameWorld.submit(new Pulse(1, bot) {
|
||||
int ticks;
|
||||
int ov;
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
/*if (bot.getInventory().freeSlots() < 1) {
|
||||
|
|
@ -40,18 +36,36 @@ public class ResourceAIPActions {
|
|||
resource_players.remove(bot);
|
||||
return true;
|
||||
}
|
||||
chopTree(bot, RegionManager.getObject(Location.create(3234,3231,0)));
|
||||
if (ov++ >= 3) {
|
||||
chopTree(bot);
|
||||
ov = 0;
|
||||
}
|
||||
// ov = 0;
|
||||
System.out.println(ov);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static void chopTree(final AIPlayer bot, final GameObject node) {
|
||||
bot.sendChat("WE CHOPPIN");
|
||||
// Pathfinder.find(bot, node);
|
||||
private static boolean chopTree(final AIPlayer bot) {
|
||||
/*for (GameObject[] o : RegionManager.forId(bot.getLocation().getRegionId()).getPlanes()[0].getObjects()) {
|
||||
for (GameObject obj : o) {
|
||||
if (obj != null) {
|
||||
for (SkillingResource r : SkillingResource.values()) {
|
||||
if (obj.getId() == r.getId()) {
|
||||
Pathfinder.find(bot, obj).walk(bot);
|
||||
bot.sendChat("WE CHOPPIN");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
bot.attack(Repository.getNpcs().get(106));
|
||||
|
||||
// Pulse pulse = new GatheringSkillPulse(bot, node);
|
||||
bot.getPulseManager().run(new GatheringSkillPulse(bot, node));
|
||||
// bot.getPulseManager().run(new GatheringSkillPulse(bot, node));
|
||||
// pulse.start();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,141 @@
|
|||
package org.crandor.game.node.entity.player.ai.skillingbot;
|
||||
|
||||
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{
|
||||
|
||||
private int tick = 5;
|
||||
private ArrayList<Integer> interactNodeIds;
|
||||
private int fromWhereDoIdrop;
|
||||
private int skill;
|
||||
private int interactionRange;
|
||||
|
||||
public SkillingBot(String name, Location l)
|
||||
{
|
||||
super(name, l);
|
||||
this.fromWhereDoIdrop = 0;
|
||||
this.interactionRange = 15;
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public SkillingBot(String name, Location l, int skill, ArrayList<Integer> entrys)
|
||||
{
|
||||
super(name, l);
|
||||
this.skill = skill;
|
||||
this.fromWhereDoIdrop = 0;
|
||||
this.interactNodeIds = entrys;
|
||||
this.interactionRange = 15;
|
||||
|
||||
switch (this.skill)
|
||||
{
|
||||
case Skills.MINING:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
super.tick();
|
||||
|
||||
//Despawn
|
||||
if (this.getSkills().getLifepoints() == 0)
|
||||
AIPlayer.deregister(this.getUid());
|
||||
|
||||
//Interact with object
|
||||
if (this.tick <= 0)
|
||||
{
|
||||
this.tick = 5;
|
||||
if (this.skill == Skills.FISHING)
|
||||
this.tick = 20;
|
||||
|
||||
// Node test = getClosestNodeWithEntry(15, 15503);
|
||||
Node node;
|
||||
if (this.skill != Skills.FISHING)
|
||||
{
|
||||
node = getClosestNodeWithEntry(interactionRange, interactNodeIds);
|
||||
}
|
||||
else
|
||||
{
|
||||
node = getClosesCreature(interactionRange, interactNodeIds);
|
||||
// if (test != null)
|
||||
// System.out.println("interact with " + test.getName());
|
||||
}
|
||||
|
||||
if (node == null) {
|
||||
System.out.println("Object not found " + this.skill);
|
||||
return;
|
||||
}
|
||||
|
||||
//System.out.println("free slots " + this.getInventory().freeSlots());
|
||||
|
||||
if (this.getInventory().isFull())
|
||||
{
|
||||
// System.out.println(this.getName() + " starts droping from " + fromWhereDoIdrop);
|
||||
for (int i = fromWhereDoIdrop; i < 28; i++)
|
||||
{
|
||||
Item drop = this.getInventory().get(i);
|
||||
final Option option = drop.getInteraction().get(4);
|
||||
drop.getInteraction().handleItemOption(this, option, this.getInventory());
|
||||
// System.out.println("drop item " + i);
|
||||
}
|
||||
}
|
||||
|
||||
int x = node.getLocation().getX();
|
||||
int y = node.getLocation().getY();
|
||||
if (this.skill != Skills.FISHING)
|
||||
{
|
||||
InteractionPacket.handleObjectInteraction(this, 0, x, y, node.getId());
|
||||
}
|
||||
else
|
||||
{
|
||||
InteractionPacket.handleNPCInteraction(this, 0, node.getIndex());
|
||||
}
|
||||
}
|
||||
else
|
||||
this.tick--;
|
||||
}
|
||||
|
||||
public int getSkill()
|
||||
{
|
||||
return this.skill;
|
||||
}
|
||||
|
||||
public int getFromWhereToDrop()
|
||||
{
|
||||
return this.fromWhereDoIdrop;
|
||||
}
|
||||
|
||||
public void setFromWhereDoIdrop(int id)
|
||||
{
|
||||
this.fromWhereDoIdrop = id;
|
||||
}
|
||||
|
||||
public void setInteractionRange(int range)
|
||||
{
|
||||
this.interactionRange = range;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,209 @@
|
|||
package org.crandor.game.node.entity.player.ai.skillingbot;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.crandor.game.container.impl.EquipmentContainer;
|
||||
import org.crandor.game.content.global.tutorial.CharacterDesign;
|
||||
import org.crandor.game.content.skill.Skills;
|
||||
import org.crandor.game.node.entity.player.ai.AIPlayer;
|
||||
import org.crandor.game.node.entity.player.link.appearance.Gender;
|
||||
import org.crandor.game.node.item.Item;
|
||||
import org.crandor.game.world.map.Location;
|
||||
import org.crandor.game.world.repository.Repository;
|
||||
import org.crandor.tools.RandomFunction;
|
||||
|
||||
public final class SkillingBotsBuilder extends AIPlayer {
|
||||
|
||||
public SkillingBotsBuilder(String name, Location l) {
|
||||
super(name, l);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
private static SkillingBot generateMiningBot(String name, Location loc, ArrayList<Integer> entrys)
|
||||
{
|
||||
SkillingBot bot = new SkillingBot(name, loc, Skills.MINING, entrys);
|
||||
bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE);
|
||||
Repository.getPlayers().add(bot);
|
||||
bot.init();
|
||||
bot.getEquipment().replace(new Item(1265), EquipmentContainer.SLOT_WEAPON);
|
||||
return bot;
|
||||
}
|
||||
|
||||
private static SkillingBot generateWoodcuttingBot(String name, Location loc, ArrayList<Integer> entrys)
|
||||
{
|
||||
SkillingBot bot = new SkillingBot(name, loc, Skills.WOODCUTTING, entrys);
|
||||
bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE);
|
||||
Repository.getPlayers().add(bot);
|
||||
bot.init();
|
||||
bot.getEquipment().replace(new Item(1351), EquipmentContainer.SLOT_WEAPON);
|
||||
return bot;
|
||||
}
|
||||
|
||||
private static SkillingBot generateFishingBot(String name, Location loc, ArrayList<Integer> entrys)
|
||||
{
|
||||
SkillingBot bot = new SkillingBot(name, loc, Skills.FISHING, entrys);
|
||||
bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE);
|
||||
CharacterDesign.randomize(bot, false);
|
||||
Repository.getPlayers().add(bot);
|
||||
bot.init();
|
||||
return bot;
|
||||
}
|
||||
|
||||
public static void spawnClayBotVarrock(String name, Location loc)
|
||||
{
|
||||
ArrayList<Integer> entrys = new ArrayList<Integer>();
|
||||
entrys.add(15503);
|
||||
entrys.add(15505);
|
||||
|
||||
SkillingBot bot = generateMiningBot(name, loc, entrys);
|
||||
|
||||
bot.getSkills().setLevel(Skills.MINING, 10);
|
||||
}
|
||||
|
||||
public static void spawnIronBotVarrock(String name, Location loc)
|
||||
{
|
||||
ArrayList<Integer> entrys = new ArrayList<Integer>();
|
||||
entrys.add(11954);
|
||||
entrys.add(11955);
|
||||
entrys.add(11956);
|
||||
|
||||
SkillingBot bot = generateMiningBot(name, loc, entrys);
|
||||
|
||||
bot.getSkills().setLevel(Skills.MINING, 25);
|
||||
}
|
||||
|
||||
public static void spawnSilverBotVarrock(String name, Location loc)
|
||||
{
|
||||
ArrayList<Integer> entrys = new ArrayList<Integer>();
|
||||
entrys.add(11948);
|
||||
entrys.add(11949);
|
||||
entrys.add(11950);
|
||||
|
||||
SkillingBot bot = generateMiningBot(name, loc, entrys);
|
||||
|
||||
bot.getSkills().setLevel(Skills.MINING, 30);
|
||||
}
|
||||
|
||||
public static void spawnTinBotVarrock(String name, Location loc)
|
||||
{
|
||||
ArrayList<Integer> entrys = new ArrayList<Integer>();
|
||||
entrys.add(11957);
|
||||
entrys.add(11959);
|
||||
entrys.add(11958);
|
||||
|
||||
SkillingBot bot = generateMiningBot(name, loc, entrys);
|
||||
|
||||
bot.getSkills().setLevel(Skills.MINING, 5);
|
||||
}
|
||||
|
||||
public static void spawnTinBotLumbridge(String name, Location loc)
|
||||
{
|
||||
ArrayList<Integer> entrys = new ArrayList<Integer>();
|
||||
entrys.add(11933);
|
||||
entrys.add(11934);
|
||||
entrys.add(11935);
|
||||
|
||||
SkillingBot bot = generateMiningBot(name, loc, entrys);
|
||||
|
||||
bot.getSkills().setLevel(Skills.MINING, 5);
|
||||
}
|
||||
|
||||
public static void spawnCopperBotLumbridge(String name, Location loc)
|
||||
{
|
||||
ArrayList<Integer> entrys = new ArrayList<Integer>();
|
||||
entrys.add(11936);
|
||||
entrys.add(11937);
|
||||
entrys.add(11938);
|
||||
|
||||
SkillingBot bot = generateMiningBot(name, loc, entrys);
|
||||
|
||||
bot.getSkills().setLevel(Skills.MINING, 5);
|
||||
}
|
||||
|
||||
public static void spawnOakTreeBotLumbridge(String name, Location loc)
|
||||
{
|
||||
ArrayList<Integer> entrys = new ArrayList<Integer>();
|
||||
entrys.add(1281);
|
||||
entrys.add(1278);
|
||||
entrys.add(1276);
|
||||
|
||||
SkillingBot bot = generateWoodcuttingBot(name, loc, entrys);
|
||||
|
||||
bot.getSkills().setLevel(Skills.WOODCUTTING, 25);
|
||||
bot.setInteractionRange(25);
|
||||
}
|
||||
|
||||
public static void spawnDeadTreeBotLumbridge(String name, Location loc)
|
||||
{
|
||||
ArrayList<Integer> entrys = new ArrayList<Integer>();
|
||||
entrys.add(1282);
|
||||
entrys.add(1286);
|
||||
|
||||
SkillingBot bot = generateWoodcuttingBot(name, loc, entrys);
|
||||
|
||||
bot.getSkills().setLevel(Skills.WOODCUTTING, 25);
|
||||
bot.setInteractionRange(15);
|
||||
}
|
||||
|
||||
public static void spawnShrimpFisherLumbridge(String name, Location loc)
|
||||
{
|
||||
ArrayList<Integer> entrys = new ArrayList<Integer>();
|
||||
entrys.add(323);
|
||||
entrys.add(326);
|
||||
|
||||
SkillingBot bot = generateFishingBot(name, loc, entrys);
|
||||
|
||||
bot.getInventory().add(new Item(303));
|
||||
// don't drop net
|
||||
bot.setFromWhereDoIdrop(1);
|
||||
|
||||
bot.getSkills().setLevel(Skills.FISHING, 25);
|
||||
bot.setInteractionRange(25);
|
||||
}
|
||||
|
||||
public static void spawnTroutLumbridge(String name, Location loc)
|
||||
{
|
||||
ArrayList<Integer> entrys = new ArrayList<Integer>();
|
||||
entrys.add(310);
|
||||
|
||||
SkillingBot bot = generateFishingBot(name, loc, entrys);
|
||||
|
||||
bot.getInventory().add(new Item(309));
|
||||
bot.getInventory().add(new Item(314, 20000));
|
||||
// don't drop net
|
||||
bot.setFromWhereDoIdrop(2);
|
||||
|
||||
bot.getSkills().setLevel(Skills.FISHING, 25);
|
||||
bot.setInteractionRange(25);
|
||||
}
|
||||
|
||||
public static void immersiveSpawnsSkillingBots()
|
||||
{
|
||||
// Varrock Mine
|
||||
SkillingBotsBuilder.spawnClayBotVarrock("clay", new Location(3181, 3368));
|
||||
SkillingBotsBuilder.spawnSilverBotVarrock("silver", new Location(3181, 3368));
|
||||
SkillingBotsBuilder.spawnIronBotVarrock("iron", new Location(3181, 3368));
|
||||
SkillingBotsBuilder.spawnTinBotVarrock("tin", new Location(3181, 3368));
|
||||
|
||||
// Lumbridge woodcutting
|
||||
spawnOakTreeBotLumbridge("Bot", new Location(3227, 3243));
|
||||
spawnOakTreeBotLumbridge("Bot", new Location(3186, 3251));
|
||||
spawnOakTreeBotLumbridge("Bot", new Location(3188, 3223));
|
||||
spawnOakTreeBotLumbridge("Bot", new Location(3162, 3222));
|
||||
spawnOakTreeBotLumbridge("Bot", new Location(3162, 3219));
|
||||
spawnOakTreeBotLumbridge("Bot", new Location(3152, 3228));
|
||||
spawnOakTreeBotLumbridge("Bot", new Location(3146, 3244));
|
||||
spawnDeadTreeBotLumbridge("Bot", new Location(3247, 3240));
|
||||
|
||||
// Lumbridge mining
|
||||
spawnTinBotLumbridge("Bot", new Location(3224, 3147));
|
||||
spawnCopperBotLumbridge("Bot", new Location(3224, 3147));
|
||||
|
||||
// Lumbridge Fishing
|
||||
spawnShrimpFisherLumbridge("Bot", new Location(3242, 3151));
|
||||
spawnShrimpFisherLumbridge("Bot", new Location(3238, 3148));
|
||||
spawnShrimpFisherLumbridge("Bot", new Location(3245, 3161));
|
||||
spawnTroutLumbridge("Bot", new Location(3241, 3242));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,551 @@
|
|||
package org.crandor.game.node.entity.player.ai.wilderness;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
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.pvmbots.DragonKiller;
|
||||
import org.crandor.game.node.entity.player.ai.pvmbots.NoobBot;
|
||||
import org.crandor.game.node.entity.player.ai.pvmbots.PvMBots;
|
||||
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;
|
||||
import org.crandor.game.world.map.Location;
|
||||
import org.crandor.game.world.repository.Repository;
|
||||
import org.crandor.tools.RandomFunction;
|
||||
|
||||
public final class PvPBotsBuilder{
|
||||
|
||||
public static WildernessBot create(String name, Location l)
|
||||
{
|
||||
return new WildernessBot(name, l);
|
||||
}
|
||||
|
||||
public static void generateClass(WildernessBot p) {
|
||||
int combatType = RandomFunction.getRandom(1);
|
||||
switch(combatType) {
|
||||
case 0:
|
||||
buildMeleeStats(p);
|
||||
buildMeleeEquipment(p);
|
||||
correctHitpointsStat(p);
|
||||
break;
|
||||
case 1:
|
||||
//max rune
|
||||
buildMaxMeleeStats(p);
|
||||
buildMaxMeleeEquipment(p);
|
||||
correctHitpointsStat(p);
|
||||
break;
|
||||
}
|
||||
p.getInventory().add(new Item(385, 20));
|
||||
p.getProperties().setCombatLevel(126);
|
||||
|
||||
p.getSkills().setLevel(Skills.PRAYER, 98);
|
||||
p.getSkills().setStaticLevel(Skills.PRAYER, 98);
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
}
|
||||
|
||||
|
||||
private static void buildMeleeStats(WildernessBot p) {
|
||||
int attackLevel = RandomFunction.random(80, 98);
|
||||
int strengthLevel = RandomFunction.random(attackLevel - 10, attackLevel + 10);
|
||||
int defenceLevel = RandomFunction.random(60, 98);
|
||||
|
||||
p.getSkills().setLevel(Skills.ATTACK, attackLevel);
|
||||
p.getSkills().setStaticLevel(Skills.ATTACK, attackLevel);
|
||||
p.getSkills().setLevel(Skills.STRENGTH, strengthLevel);
|
||||
p.getSkills().setStaticLevel(Skills.STRENGTH, strengthLevel);
|
||||
p.getSkills().setLevel(Skills.DEFENCE, defenceLevel);
|
||||
p.getSkills().setStaticLevel(Skills.DEFENCE, defenceLevel);
|
||||
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
}
|
||||
|
||||
private static void buildMeleeEquipment(WildernessBot p) {
|
||||
int[] helms = {
|
||||
1163, //Rune Full Helm
|
||||
3751, //Berserker Helm
|
||||
3753, //Warrior Helm
|
||||
10828,
|
||||
1038,
|
||||
4753,
|
||||
};
|
||||
int[] shield = {
|
||||
1185, //Rune sq shield
|
||||
1201, //Rune kiteshield
|
||||
6524, //Obsidian shield
|
||||
8850, //Rune defender
|
||||
11286,
|
||||
14767,
|
||||
};
|
||||
int[] platebody = {
|
||||
1113, //Rune chainmail.
|
||||
1127, //Rune platebody.
|
||||
10551,
|
||||
4757,
|
||||
11724,
|
||||
4720,
|
||||
};
|
||||
int[] platelegs = {
|
||||
1079, //Rune platelegs.
|
||||
4759,
|
||||
11726,
|
||||
1075,
|
||||
};
|
||||
|
||||
p.getEquipment().replace(new Item(helms[RandomFunction.random(helms.length)]), EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(shield[RandomFunction.random(shield.length)]), EquipmentContainer.SLOT_SHIELD);
|
||||
p.getEquipment().replace(new Item(platebody[RandomFunction.random(platebody.length)]), EquipmentContainer.SLOT_CHEST);
|
||||
p.getEquipment().replace(new Item(platelegs[RandomFunction.random(platelegs.length)]), EquipmentContainer.SLOT_LEGS);
|
||||
|
||||
Item weapon = new Item(weapons[RandomFunction.random(weapons.length)]);
|
||||
p.setMainWeapon(weapon.getId());
|
||||
p.getEquipment().replace(weapon, EquipmentContainer.SLOT_WEAPON);
|
||||
|
||||
p.getEquipment().replace(new Item(generateNecklace()), EquipmentContainer.SLOT_AMULET);
|
||||
p.getEquipment().replace(new Item(generateBoots()), EquipmentContainer.SLOT_FEET);
|
||||
p.getEquipment().replace(new Item(generateCape()), EquipmentContainer.SLOT_CAPE);
|
||||
p.getEquipment().replace(new Item(generateGloves()), EquipmentContainer.SLOT_HANDS);
|
||||
}
|
||||
|
||||
public static final int[] weapons = {
|
||||
4151, //Whip
|
||||
4587, //Dragon Scimitar
|
||||
|
||||
};
|
||||
|
||||
|
||||
private static void buildMaxMeleeStats(AIPlayer p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.ATTACK, 99);
|
||||
p.getSkills().setStaticLevel(Skills.ATTACK, 99);
|
||||
p.getSkills().setLevel(Skills.STRENGTH, 99);
|
||||
p.getSkills().setStaticLevel(Skills.STRENGTH, 99);
|
||||
p.getSkills().setLevel(Skills.DEFENCE, 99);
|
||||
p.getSkills().setStaticLevel(Skills.DEFENCE, 99);
|
||||
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
}
|
||||
|
||||
private static void buildMaxMeleeEquipment(AIPlayer p) {
|
||||
int[] helms = {
|
||||
3751, //Berserker Helm
|
||||
};
|
||||
int[] shield = {
|
||||
14767, //Dragon defender
|
||||
};
|
||||
int[] platebody = {
|
||||
11724, //Bandos chainmail.
|
||||
};
|
||||
int[] platelegs = {
|
||||
11726, //Bandos Tassets.
|
||||
};
|
||||
int[] amulets = {
|
||||
6585, //fury
|
||||
};
|
||||
int[] boots = {
|
||||
3105, //Climbing boots.
|
||||
};
|
||||
int[] cape = {
|
||||
6570, //Fire cape.
|
||||
};
|
||||
int[] gloves = {
|
||||
7462, //Barrows Gloves.
|
||||
};
|
||||
p.getEquipment().replace(new Item(helms[RandomFunction.random(helms.length)]), EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(shield[RandomFunction.random(shield.length)]), EquipmentContainer.SLOT_SHIELD);
|
||||
p.getEquipment().replace(new Item(platebody[RandomFunction.random(platebody.length)]), EquipmentContainer.SLOT_CHEST);
|
||||
p.getEquipment().replace(new Item(platelegs[RandomFunction.random(platelegs.length)]), EquipmentContainer.SLOT_LEGS);
|
||||
p.getEquipment().replace(new Item(weapons2[RandomFunction.random(weapons2.length)]), EquipmentContainer.SLOT_WEAPON);
|
||||
p.getEquipment().replace(new Item(amulets[RandomFunction.random(amulets.length)]), EquipmentContainer.SLOT_AMULET);
|
||||
p.getEquipment().replace(new Item(boots[RandomFunction.random(boots.length)]), EquipmentContainer.SLOT_FEET);
|
||||
p.getEquipment().replace(new Item(cape[RandomFunction.random(cape.length)]), EquipmentContainer.SLOT_CAPE);
|
||||
p.getEquipment().replace(new Item(gloves[RandomFunction.random(gloves.length)]), EquipmentContainer.SLOT_HANDS);
|
||||
}
|
||||
|
||||
public static final int[] weapons2 = {
|
||||
4151, //Whip
|
||||
};
|
||||
|
||||
private static int generateCape() {
|
||||
int[] capes = {
|
||||
1052, //Legends Cape
|
||||
6570, //Fire cape
|
||||
};
|
||||
return capes[RandomFunction.random(capes.length)];
|
||||
}
|
||||
|
||||
private static int generateNecklace() {
|
||||
int[] amulets = {
|
||||
1712, //Glory
|
||||
1725, //Strength ammy
|
||||
6585, //fury
|
||||
};
|
||||
return amulets[RandomFunction.random(amulets.length)];
|
||||
}
|
||||
|
||||
private static int generateGloves() {
|
||||
int[] gloves = {
|
||||
1059,
|
||||
7462
|
||||
};
|
||||
return gloves[RandomFunction.random(gloves.length)];
|
||||
}
|
||||
|
||||
private static int generateBoots() {
|
||||
int[] boots = {
|
||||
1061, //Leather boots.
|
||||
1837, //Desert boots.
|
||||
3105, //Climbing boots.
|
||||
3791, //Fremmy boots.
|
||||
11732,
|
||||
};
|
||||
return boots[RandomFunction.random(boots.length)];
|
||||
}
|
||||
|
||||
public static void generateMinLevels(PvMBots p)
|
||||
{
|
||||
//Slayer so they can attack alls monsters
|
||||
p.getSkills().setLevel(Skills.SLAYER, 99);
|
||||
p.getSkills().setStaticLevel(Skills.SLAYER, 99);
|
||||
int combatType = RandomFunction.getRandom(2);
|
||||
p.getSkills().setLevel(Skills.HITPOINTS, 15);
|
||||
p.getSkills().setStaticLevel(Skills.HITPOINTS, 15);
|
||||
p.getInventory().add(new Item(329, 5));
|
||||
switch(combatType)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
buildArcherStats(p);
|
||||
buildArcherEquipment(p);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
buildMeleeStats(p);
|
||||
buildMeleeEquipment(p);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
buildMageStats(p);
|
||||
buildMagicEquipment(p);
|
||||
setupWizard(p);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
buildMeleeStats(p);
|
||||
buildMeleeEquipment(p);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public static void createDragonKiller(DragonKiller p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.SLAYER, 99);
|
||||
p.getSkills().setStaticLevel(Skills.SLAYER, 99);
|
||||
int combatType = RandomFunction.getRandom(2);
|
||||
p.getSkills().setLevel(Skills.HITPOINTS, 55);
|
||||
p.getSkills().setStaticLevel(Skills.HITPOINTS, 55);
|
||||
switch(combatType)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
buildDragonArcherStats(p);
|
||||
buildDragonArcherEquipment(p);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
buildDragonMeleeStats(p);
|
||||
buildDragonMeleeEquipment(p);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
buildDragonMeleeStats(p);
|
||||
buildDragonMeleeEquipment(p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void createNoob(NoobBot p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.SLAYER, 99);
|
||||
p.getSkills().setStaticLevel(Skills.SLAYER, 99);
|
||||
int combatType = RandomFunction.getRandom(3);
|
||||
p.getSkills().setLevel(Skills.HITPOINTS, 10 + RandomFunction.getRandom(10));
|
||||
p.getSkills().setStaticLevel(Skills.HITPOINTS, 10 + RandomFunction.getRandom(10));
|
||||
p.getSkills().setLevel(Skills.DEFENCE, 1 + RandomFunction.getRandom(9));
|
||||
p.getSkills().setStaticLevel(Skills.DEFENCE, 1 + RandomFunction.getRandom(9));
|
||||
p.getInventory().add(new Item(329, 5));
|
||||
switch(combatType)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
buildNoobArcherStats(p);
|
||||
buildNoobArcherEquipment(p);
|
||||
break;
|
||||
}
|
||||
case 1:
|
||||
{
|
||||
buildNoobMeleeStats(p);
|
||||
buildNoobMeleeEquipment(p);
|
||||
break;
|
||||
}
|
||||
case 2:
|
||||
{
|
||||
buildNoobMageStats(p);
|
||||
buildNoobMagicEquipment(p);
|
||||
setupWizard(p);
|
||||
}
|
||||
default:
|
||||
{
|
||||
buildNoobMeleeStats(p);
|
||||
buildNoobMeleeEquipment(p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void buildArcherStats(PvMBots p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.RANGE, 10);
|
||||
p.getSkills().setStaticLevel(Skills.RANGE, 10);
|
||||
p.getSkills().setLevel(Skills.DEFENCE, 10);
|
||||
p.getSkills().setStaticLevel(Skills.DEFENCE, 10);
|
||||
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
}
|
||||
|
||||
private static void buildDragonArcherStats(DragonKiller p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.RANGE, 55);
|
||||
p.getSkills().setStaticLevel(Skills.RANGE, 55);
|
||||
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
}
|
||||
|
||||
private static void buildNoobArcherStats(NoobBot p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.RANGE, 1 + RandomFunction.getRandom(10));
|
||||
p.getSkills().setStaticLevel(Skills.RANGE, 1 + RandomFunction.getRandom(10));
|
||||
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
}
|
||||
|
||||
public static void buildMeleeStats(PvMBots p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.ATTACK, 10);
|
||||
p.getSkills().setStaticLevel(Skills.ATTACK, 10);
|
||||
p.getSkills().setLevel(Skills.STRENGTH, 10);
|
||||
p.getSkills().setStaticLevel(Skills.STRENGTH, 10);
|
||||
p.getSkills().setLevel(Skills.DEFENCE, 10);
|
||||
p.getSkills().setStaticLevel(Skills.DEFENCE, 10);
|
||||
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
}
|
||||
|
||||
public static void buildDragonMeleeStats(DragonKiller p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.ATTACK, 55);
|
||||
p.getSkills().setStaticLevel(Skills.ATTACK, 55);
|
||||
p.getSkills().setLevel(Skills.STRENGTH, 55);
|
||||
p.getSkills().setStaticLevel(Skills.STRENGTH, 55);
|
||||
p.getSkills().setLevel(Skills.DEFENCE, 45);
|
||||
p.getSkills().setStaticLevel(Skills.DEFENCE, 45);
|
||||
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
}
|
||||
|
||||
private static void buildNoobMeleeStats(NoobBot p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.ATTACK, 1 + RandomFunction.getRandom(10));
|
||||
p.getSkills().setStaticLevel(Skills.ATTACK, 1 + RandomFunction.getRandom(10));
|
||||
p.getSkills().setLevel(Skills.STRENGTH, 1 + RandomFunction.getRandom(10));
|
||||
p.getSkills().setStaticLevel(Skills.STRENGTH, 1 + RandomFunction.getRandom(10));
|
||||
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
}
|
||||
|
||||
private static void buildMageStats(PvMBots p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.MAGIC, 10);
|
||||
p.getSkills().setStaticLevel(Skills.MAGIC, 10);
|
||||
p.getSkills().setLevel(Skills.DEFENCE, 10);
|
||||
p.getSkills().setStaticLevel(Skills.DEFENCE, 10);
|
||||
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
}
|
||||
|
||||
private static void buildNoobMageStats(NoobBot p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.MAGIC, 1 + RandomFunction.getRandom(10));
|
||||
p.getSkills().setStaticLevel(Skills.MAGIC, 1 + RandomFunction.getRandom(10));
|
||||
|
||||
p.getSkills().updateCombatLevel();
|
||||
p.getAppearance().sync();
|
||||
}
|
||||
|
||||
private static void setupWizard(PvMBots p)
|
||||
{
|
||||
//final int SPELL_IDS[] = new int[] {1, 4, 6, 8, 10, 14, 17, 20, 24, 27, 33, 38, 45, 48, 52, 55 };
|
||||
p.getProperties().setAutocastSpell(((CombatSpell) SpellBookManager.SpellBook.MODERN.getSpell(1)));
|
||||
p.getInventory().add(new Item(556, 1000)); //Air runes
|
||||
p.getInventory().add(new Item(558, 1000)); //Mind runes
|
||||
}
|
||||
|
||||
private static void buildArcherEquipment(PvMBots p)
|
||||
{
|
||||
p.getEquipment().replace(new Item(1169), EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(1129), EquipmentContainer.SLOT_CHEST);
|
||||
p.getEquipment().replace(new Item(1095), EquipmentContainer.SLOT_LEGS);
|
||||
p.getEquipment().replace(new Item(841), EquipmentContainer.SLOT_WEAPON);
|
||||
p.getEquipment().replace(new Item(884, 5000), EquipmentContainer.SLOT_ARROWS);
|
||||
p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE);
|
||||
p.getEquipment().replace(new Item(1478), EquipmentContainer.SLOT_AMULET);
|
||||
}
|
||||
|
||||
private static void buildDragonArcherEquipment(DragonKiller p)
|
||||
{
|
||||
p.getEquipment().replace(new Item(1169), EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(13483), EquipmentContainer.SLOT_CHEST);
|
||||
p.getEquipment().replace(new Item(1099), EquipmentContainer.SLOT_LEGS);
|
||||
p.getEquipment().replace(new Item(9185), EquipmentContainer.SLOT_WEAPON);
|
||||
p.getEquipment().replace(new Item(1540), EquipmentContainer.SLOT_SHIELD);
|
||||
p.getEquipment().replace(new Item(9140, 500), EquipmentContainer.SLOT_ARROWS);
|
||||
p.getEquipment().replace(new Item(10498), EquipmentContainer.SLOT_CAPE);
|
||||
p.getEquipment().replace(new Item(1478), EquipmentContainer.SLOT_AMULET);
|
||||
}
|
||||
|
||||
private static void buildNoobArcherEquipment(PvMBots p)
|
||||
{
|
||||
int hats[] = {1169, 1169, 1139, 1137, 1153, 579};
|
||||
int legs[] = {1095, 7366, 1075, 1087, 1095};
|
||||
int chest[] = {1129, 1103, 1101, 1129, 1117, 577};
|
||||
|
||||
p.getEquipment().replace(new Item(hats[RandomFunction.getRandom(hats.length - 1)]), EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(chest[RandomFunction.getRandom(chest.length - 1)]), EquipmentContainer.SLOT_CHEST);
|
||||
p.getEquipment().replace(new Item(legs[RandomFunction.getRandom(legs.length - 1)]), EquipmentContainer.SLOT_LEGS);
|
||||
p.getEquipment().replace(new Item(841), EquipmentContainer.SLOT_WEAPON);
|
||||
p.getEquipment().replace(new Item(884, 5000), EquipmentContainer.SLOT_ARROWS);
|
||||
p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE);
|
||||
p.getEquipment().replace(new Item(1478), EquipmentContainer.SLOT_AMULET);
|
||||
}
|
||||
|
||||
private static void buildMeleeEquipment(PvMBots p)
|
||||
{
|
||||
p.getEquipment().replace(new Item(1153), EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(1115), EquipmentContainer.SLOT_CHEST);
|
||||
p.getEquipment().replace(new Item(1067), EquipmentContainer.SLOT_LEGS);
|
||||
p.getEquipment().replace(new Item(1309), EquipmentContainer.SLOT_WEAPON);
|
||||
p.getEquipment().replace(new Item(884), EquipmentContainer.SLOT_ARROWS);
|
||||
p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE);
|
||||
p.getEquipment().replace(new Item(1725), EquipmentContainer.SLOT_AMULET);
|
||||
}
|
||||
|
||||
private static void buildDragonMeleeEquipment(DragonKiller p)
|
||||
{
|
||||
p.getEquipment().replace(new Item(1163), EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(1127), EquipmentContainer.SLOT_CHEST);
|
||||
p.getEquipment().replace(new Item(1079), EquipmentContainer.SLOT_LEGS);
|
||||
p.getEquipment().replace(new Item(1333), EquipmentContainer.SLOT_WEAPON);
|
||||
p.getEquipment().replace(new Item(1540), EquipmentContainer.SLOT_SHIELD);
|
||||
p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE);
|
||||
p.getEquipment().replace(new Item(1725), EquipmentContainer.SLOT_AMULET);
|
||||
}
|
||||
|
||||
private static void buildNoobMeleeEquipment(PvMBots p)
|
||||
{
|
||||
int hats[] = {1169, 1169, 1139, 1137, 1153, 579};
|
||||
int legs[] = {1095, 7366, 1075, 1087, 1095};
|
||||
int chest[] = {1129, 1103, 1101, 1129, 1117, 577};
|
||||
int weapons[] = {1307, 1321, 1375, 1203, 1239, 1267, 1293, 1323, 1335};
|
||||
|
||||
p.getEquipment().replace(new Item(hats[RandomFunction.getRandom(hats.length - 1)]), EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(chest[RandomFunction.getRandom(chest.length - 1)]), EquipmentContainer.SLOT_CHEST);
|
||||
p.getEquipment().replace(new Item(legs[RandomFunction.getRandom(legs.length - 1)]), EquipmentContainer.SLOT_LEGS);
|
||||
p.getEquipment().replace(new Item(weapons[RandomFunction.getRandom(weapons.length - 1)]), EquipmentContainer.SLOT_WEAPON);
|
||||
p.getEquipment().replace(new Item(884), EquipmentContainer.SLOT_ARROWS);
|
||||
p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE);
|
||||
p.getEquipment().replace(new Item(1725), EquipmentContainer.SLOT_AMULET);
|
||||
}
|
||||
|
||||
private static void buildMagicEquipment(PvMBots p)
|
||||
{
|
||||
p.getEquipment().replace(new Item(579), EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(577), EquipmentContainer.SLOT_CHEST);
|
||||
p.getEquipment().replace(new Item(1011), EquipmentContainer.SLOT_LEGS);
|
||||
p.getEquipment().replace(new Item(1389), EquipmentContainer.SLOT_WEAPON);
|
||||
p.getEquipment().replace(new Item(884), EquipmentContainer.SLOT_ARROWS);
|
||||
p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE);
|
||||
p.getEquipment().replace(new Item(1727), EquipmentContainer.SLOT_AMULET);
|
||||
}
|
||||
|
||||
private static void buildNoobMagicEquipment(PvMBots p)
|
||||
{
|
||||
int hats[] = {1169, 1169, 1139, 1137, 1153, 579};
|
||||
int legs[] = {1095, 7366, 1075, 1087, 1095};
|
||||
int chest[] = {1129, 1103, 1101, 1129, 1117, 577};
|
||||
int weapons[] = {1379, 1383, 1385, 1387, 1389};
|
||||
|
||||
p.getEquipment().replace(new Item(hats[RandomFunction.getRandom(hats.length - 1)]), EquipmentContainer.SLOT_HAT);
|
||||
p.getEquipment().replace(new Item(chest[RandomFunction.getRandom(chest.length - 1)]), EquipmentContainer.SLOT_CHEST);
|
||||
p.getEquipment().replace(new Item(legs[RandomFunction.getRandom(legs.length - 1)]), EquipmentContainer.SLOT_LEGS);
|
||||
p.getEquipment().replace(new Item(weapons[RandomFunction.getRandom(weapons.length - 1)]), EquipmentContainer.SLOT_WEAPON);
|
||||
p.getEquipment().replace(new Item(884), EquipmentContainer.SLOT_ARROWS);
|
||||
p.getEquipment().replace(new Item(1007), EquipmentContainer.SLOT_CAPE);
|
||||
p.getEquipment().replace(new Item(1727), EquipmentContainer.SLOT_AMULET);
|
||||
}
|
||||
|
||||
public static void spawn(Location loc)
|
||||
{
|
||||
final WildernessBot bot = PvPBotsBuilder.create("bottest", new Location(0, 0));
|
||||
bot.teleport(loc);
|
||||
bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE);
|
||||
Repository.getPlayers().add(bot);
|
||||
generateClass(bot);
|
||||
bot.init();
|
||||
}
|
||||
|
||||
private static void correctHitpointsStat(AIPlayer player) {
|
||||
player.getSkills().setLevel(Skills.HITPOINTS, 10);
|
||||
player.getSkills().setStaticLevel(Skills.HITPOINTS, 10);
|
||||
player.getSkills().updateCombatLevel();
|
||||
int rangedLevel = RandomFunction.random(80, 98);
|
||||
int defenceLevel = RandomFunction.random(80, 98);
|
||||
|
||||
player.getSkills().setLevel(Skills.HITPOINTS, rangedLevel);
|
||||
player.getSkills().setStaticLevel(Skills.HITPOINTS, rangedLevel);
|
||||
player.getSkills().setLevel(Skills.HITPOINTS, defenceLevel);
|
||||
player.getSkills().setStaticLevel(Skills.HITPOINTS, defenceLevel);
|
||||
|
||||
player.getSkills().updateCombatLevel();
|
||||
player.getAppearance().sync();
|
||||
}
|
||||
|
||||
public void RandomItem()
|
||||
{
|
||||
Item test = null;
|
||||
ArrayList<Item> tests = new ArrayList<Item>();
|
||||
for (int x = 0; x < 9999; x++)
|
||||
test = new Item(x);
|
||||
if (test.getDefinition().getEquipId() != 0)
|
||||
tests.add(test);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,285 @@
|
|||
package org.crandor.game.node.entity.player.ai.wilderness;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.crandor.game.container.impl.EquipmentContainer;
|
||||
import org.crandor.game.content.global.consumable.Consumable;
|
||||
import org.crandor.game.content.global.consumable.ConsumableProperties;
|
||||
import org.crandor.game.content.global.consumable.Consumables;
|
||||
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 {
|
||||
|
||||
public WildernessBot(String name, Location l) {
|
||||
super(name, l);
|
||||
this.specWeapon = 1215;
|
||||
this.normalWeapon = 4151;
|
||||
this.getInventory().add(new Item(specWeapon));
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public WildernessBot(String name, Location l, int normalWeaponId, int specWeaponId) {
|
||||
super(name, l);
|
||||
this.specWeapon = specWeaponId;
|
||||
this.normalWeapon = normalWeaponId;
|
||||
this.getInventory().add(new Item(specWeaponId));
|
||||
}
|
||||
|
||||
int tick = 0;
|
||||
int movetimer = 0;
|
||||
int agressiveTimer = 2;
|
||||
int eatdelay = 2;
|
||||
boolean fleeing = false;
|
||||
boolean riskIt = false;
|
||||
int specWeapon;// = new Item(1215);
|
||||
int normalWeapon;// = new Item(4151);
|
||||
|
||||
Item chest = this.getEquipment().get(EquipmentContainer.SLOT_CHEST);
|
||||
Item legs = this.getEquipment().get(EquipmentContainer.SLOT_LEGS);
|
||||
Item helmet = this.getEquipment().get(EquipmentContainer.SLOT_HAT);
|
||||
Item weapon = this.getEquipment().get(EquipmentContainer.SLOT_WEAPON);
|
||||
Item shield = this.getEquipment().get(EquipmentContainer.SLOT_SHIELD);
|
||||
|
||||
|
||||
public List<Entity> FindTargets(Entity entity, int radius) {
|
||||
List<Entity> targets = new ArrayList<>();
|
||||
for (Player player : RegionManager.getLocalPlayers(entity, radius)) { {
|
||||
if (checkValidTargets(player))
|
||||
targets.add(player);
|
||||
}
|
||||
}
|
||||
if (targets.size() == 0)
|
||||
return null;
|
||||
return targets;
|
||||
}
|
||||
|
||||
public boolean checkValidTargets(Player target){
|
||||
if (!target.isActive())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!target.getProperties().isMultiZone() && target.inCombat()) {
|
||||
return false;
|
||||
}
|
||||
if (target.inCombat())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public void AttackPlayersInRadius(Player bot, int radius)
|
||||
{
|
||||
if (bot.inCombat())
|
||||
return;
|
||||
List<Entity> players = FindTargets(bot, radius);
|
||||
if (players == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!(players.isEmpty()))
|
||||
{
|
||||
if (agressiveTimer <= 0)
|
||||
bot.attack(players.get(RandomFunction.getRandom((players.size() - 1))));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private Entity getTarget()
|
||||
{
|
||||
return this.getProperties().getCombatPulse().getVictim();
|
||||
}
|
||||
|
||||
private void checkSpecialAttack()
|
||||
{
|
||||
Entity target = getTarget();
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
if (target.getSkills().getLifepoints() <= 75 && this.getSettings().getSpecialEnergy() >= 25)
|
||||
{
|
||||
//System.out.println("try special");
|
||||
Item weapon = this.getItemById(specWeapon);
|
||||
if (weapon != null)
|
||||
{
|
||||
//System.out.println("found weapon " + weapon.getName());
|
||||
final Option option = weapon.getInteraction().get(1);
|
||||
if (option == null)
|
||||
{
|
||||
System.out.println("Option not found");
|
||||
return;
|
||||
}
|
||||
weapon.getInteraction().handleItemOption(this, option, this.getInventory());
|
||||
this.getSettings().setSpecialToggled(true);
|
||||
this.attack(target);
|
||||
}
|
||||
if (!this.getSettings().isSpecialToggled())
|
||||
{
|
||||
//System.out.println("toggle special");
|
||||
this.getSettings().setSpecialToggled(true);
|
||||
this.attack(target);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//System.out.println("try normal again");
|
||||
Item weapon = this.getItemById(normalWeapon);
|
||||
if (weapon != null)
|
||||
{
|
||||
//System.out.println("found weapon " + weapon.getName());
|
||||
final Option option = weapon.getInteraction().get(1);
|
||||
if (option == null)
|
||||
{
|
||||
System.out.println("Option not found");
|
||||
return;
|
||||
}
|
||||
weapon.getInteraction().handleItemOption(this, option, this.getInventory());
|
||||
this.getSettings().setSpecialToggled(false);
|
||||
this.attack(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkBarrowsSwitch()
|
||||
{
|
||||
System.out.println(this.getSkills().getLifepoints());
|
||||
Entity target = getTarget();
|
||||
if (target == null)
|
||||
return;
|
||||
|
||||
if (this.getSkills().getLifepoints() <= 35 && target.isPlayer() && target.getSkills().getLifepoints() <= 60)
|
||||
{
|
||||
this.getEquipment().replace(new Item(4720) ,EquipmentContainer.SLOT_CHEST);
|
||||
this.getEquipment().replace(new Item(4722) ,EquipmentContainer.SLOT_LEGS);
|
||||
this.getEquipment().replace(new Item(4716) ,EquipmentContainer.SLOT_HAT);
|
||||
this.getEquipment().replace(new Item(4719) ,EquipmentContainer.SLOT_WEAPON);
|
||||
this.getEquipment().replace(new Item(-1) ,EquipmentContainer.SLOT_SHIELD);
|
||||
riskIt = true;
|
||||
}
|
||||
else if (riskIt)
|
||||
{
|
||||
this.getEquipment().replace(chest, EquipmentContainer.SLOT_CHEST);
|
||||
this.getEquipment().replace(legs, EquipmentContainer.SLOT_LEGS);
|
||||
this.getEquipment().replace(helmet, EquipmentContainer.SLOT_HAT);
|
||||
this.getEquipment().replace(weapon, EquipmentContainer.SLOT_WEAPON);
|
||||
this.getEquipment().replace(shield, EquipmentContainer.SLOT_SHIELD);
|
||||
riskIt = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void checkPrayer()
|
||||
{
|
||||
if (this.inCombat())
|
||||
{
|
||||
if (!(this.getPrayer().getActive().contains(PrayerType.PIETY)))
|
||||
this.getPrayer().toggle((PrayerType.PIETY));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
super.tick();
|
||||
//checkBarrowsSwitch();
|
||||
checkSpecialAttack();
|
||||
checkPrayer();
|
||||
//Despawn
|
||||
if (this.getSkills().getLifepoints() == 0)
|
||||
//this.teleport(new Location(500, 500));
|
||||
//Despawning not being delayed causes 3 errors in the console
|
||||
AIPlayer.deregister(this.getUid());
|
||||
if (agressiveTimer != 0)
|
||||
{
|
||||
agressiveTimer--;
|
||||
}
|
||||
|
||||
//Combat
|
||||
if (!fleeing)
|
||||
{
|
||||
if (tick == 0)
|
||||
{
|
||||
if (!this.inCombat())
|
||||
AttackPlayersInRadius(this, 5);
|
||||
this.tick = 10;
|
||||
}
|
||||
else
|
||||
this.tick--;
|
||||
|
||||
if (!this.inCombat())
|
||||
{
|
||||
if (movetimer == 0)
|
||||
{
|
||||
//if (this.FindTargets(this, 5) == null)
|
||||
this.randomWalk(20, 20);
|
||||
this.movetimer = 10;
|
||||
}
|
||||
else
|
||||
movetimer --;
|
||||
}
|
||||
}
|
||||
this.sendChat("Tik");
|
||||
this.checkFlee(385);
|
||||
this.eat(385);
|
||||
//this.getPrayer().toggle()
|
||||
}
|
||||
|
||||
public void checkFlee(int foodId)
|
||||
{
|
||||
if (this.getInventory().contains(foodId, 18) == false)
|
||||
{
|
||||
//todo: add tp
|
||||
// if ()
|
||||
this.getProperties().setRetaliating(false);
|
||||
this.sendChat("Oi");
|
||||
walkPos(this.getLocation().getLocalX(), this.getLocation().getLocalY() - 5 - RandomFunction.getRandom(5));
|
||||
fleeing = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void eat(int foodId)
|
||||
{
|
||||
if (riskIt)
|
||||
return;
|
||||
|
||||
Item foodItem = new Item(foodId);
|
||||
|
||||
if (!(this.getInventory().contains(foodId, 1)))
|
||||
return;
|
||||
|
||||
if((this.getSkills().getStaticLevel(Skills.HITPOINTS) >= this.getSkills().getLifepoints() * 3) && this.getInventory().containsItem(foodItem))
|
||||
{
|
||||
this.lock(3);
|
||||
//this.animate(new Animation(829));
|
||||
Item food = this.getInventory().getItem(foodItem);
|
||||
|
||||
Consumable consumable = Consumables.forFood(food);
|
||||
|
||||
if (consumable == null) {
|
||||
consumable = new Food(food.getId(), new ConsumableProperties(1));
|
||||
}
|
||||
|
||||
consumable .consume(food, this);
|
||||
this.getProperties().getCombatPulse().delayNextAttack(3);
|
||||
}
|
||||
}
|
||||
|
||||
public void setMainWeapon(int weapon)
|
||||
{
|
||||
this.normalWeapon = weapon;
|
||||
}
|
||||
}
|
||||
|
|
@ -149,7 +149,7 @@ public final class InteractionPacket implements IncomingPacket {
|
|||
* @param optionIndexthe option index.
|
||||
* @param index the index.
|
||||
*/
|
||||
private static void handleNPCInteraction(Player player, int optionIndex, final int index) {
|
||||
public static void handleNPCInteraction(Player player, int optionIndex, final int index) {
|
||||
if (index < 1 || index > ServerConstants.MAX_NPCS) {
|
||||
PacketRepository.send(ClearMinimapFlag.class, new PlayerContext(player));
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,47 @@
|
|||
package org.crandor.tools;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class LastNameFirstNameP9A {
|
||||
|
||||
private static final int PHYSICAL_SIZE = 100;
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
Random generator = new Random();
|
||||
|
||||
int logicalSize;
|
||||
String menuChoice;
|
||||
int[] origList = new int[PHYSICAL_SIZE];
|
||||
int[] list = new int[PHYSICAL_SIZE];
|
||||
//---------------------------Display My Information---------------------------
|
||||
System.out.println("Main Menu for Sorts and Searches\n\n");
|
||||
System.out.println("1. Generate Random Numbers For the Original Array");
|
||||
System.out.println("2. Copy the original Array");
|
||||
|
||||
while (scanner.hasNext()) {
|
||||
|
||||
|
||||
if (scanner.next().equalsIgnoreCase("Q")) {
|
||||
System.out.println("Thank you for using the program.");
|
||||
System.exit(0);
|
||||
continue;
|
||||
}
|
||||
|
||||
switch (scanner.next()) {
|
||||
|
||||
case "1":
|
||||
System.out.println("How many elements would you like to have in this array?");
|
||||
logicalSize = scanner.nextInt();
|
||||
break;
|
||||
}
|
||||
|
||||
// if (scanner.next().equalsIgnoreCase("1")); {
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
46
09HDscape-server/src/org/crandor/tools/Lesson.java
Normal file
46
09HDscape-server/src/org/crandor/tools/Lesson.java
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
package org.crandor.tools;
|
||||
|
||||
public class Lesson {
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
String text = "Beal";
|
||||
|
||||
System.out.println(frontBack(text));
|
||||
|
||||
}
|
||||
|
||||
public boolean sleepIn(boolean weekday, boolean vaction) {
|
||||
if (!weekday || vaction) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public int sumDouble(int a, int b) {
|
||||
int sum = a + b;
|
||||
return a == b ? sum * 2 : sum;
|
||||
}
|
||||
|
||||
public static String frontBack(String str) {
|
||||
char first = str.charAt(0);
|
||||
char last = str.charAt(str.length() - 1);
|
||||
return str.replace(last, first).replace(first, last);
|
||||
}
|
||||
|
||||
public boolean scores100(int[] scores) {
|
||||
if (scores[0] == 100) {
|
||||
return true;
|
||||
}
|
||||
for (int i = 1; i < scores.length; i++) {
|
||||
if (scores[i - 1] == 100) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package org.crandor.tools;
|
|||
|
||||
import org.crandor.cache.Cache;
|
||||
import org.crandor.cache.def.impl.ItemDefinition;
|
||||
import org.omg.CORBA.CODESET_INCOMPATIBLE;
|
||||
|
||||
|
||||
public class Test {
|
||||
|
|
@ -9,6 +10,22 @@ public class Test {
|
|||
//@SuppressWarnings("unused")
|
||||
public static void main(String...args) {
|
||||
Cache.init();
|
||||
/*while(true) {
|
||||
System.gc();
|
||||
System.gc();
|
||||
System.gc();
|
||||
System.gc();
|
||||
System.gc();
|
||||
System.gc();
|
||||
System.gc();
|
||||
System.gc();
|
||||
System.gc();
|
||||
System.gc();
|
||||
System.gc();
|
||||
System.gc();
|
||||
System.gc();
|
||||
System.out.println("ur gay");
|
||||
}*/
|
||||
/* for (int i = 0; i < Cache.getNPCDefinitionsSize(); i++) {
|
||||
if (NPCDefinition.forId(i).getName().toLowerCase().contains("beaver")) {
|
||||
//System.out.println(i + ", " + NPCDefinition.forId(i).getName());
|
||||
|
|
@ -22,9 +39,21 @@ public class Test {
|
|||
}
|
||||
}*/
|
||||
System.out.println("------Items-------");
|
||||
int count = 0;
|
||||
for (int i = 0; i < Cache.getItemDefinitionsSize(); i++) {
|
||||
|
||||
ItemDefinition def = ItemDefinition.forId(i);
|
||||
System.out.println(def.getName() + ", " + i);
|
||||
if (def.getName().equalsIgnoreCase("null"))
|
||||
continue;
|
||||
if (def.getName().contains("ironman") || def.getName().startsWith("Ironman"))
|
||||
continue;
|
||||
if (!def.isUnnoted())
|
||||
continue;
|
||||
if (def.isMembersOnly())
|
||||
continue;
|
||||
if (def.hasWearAction())
|
||||
System.out.println("new Item(" + def.getId() + "), //" + def.getName() + "\n");
|
||||
// System.out.println(def.getName() + ", " + i + " - " + !def.isUnnoted() + " - COUNT = " + count++);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
package org.crandor.tools.firewatch;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
public class Firewatch {
|
||||
|
||||
private static Map<String, Boolean> firewatch = new HashMap<>(4);
|
||||
|
||||
public static void main(String[] args) {
|
||||
Scanner scanner = new Scanner(System.in);
|
||||
int count = 0;
|
||||
String[] names = {"Willams", "Fabiano", "Martinez", "Popocamartinez", "Millard", "Wilson", "Young", "Dennis"};
|
||||
for (int i = 0; i < names.length; i++) {
|
||||
boolean hasWatch = new Random().nextInt(1) == 0;
|
||||
firewatch.put(names[i++], hasWatch);
|
||||
}
|
||||
System.out.println("Enter the name of the Marine you wish to check:");
|
||||
String name = scanner.nextLine();
|
||||
|
||||
int time = new Random().nextInt(4);
|
||||
|
||||
for (Map.Entry<String, Boolean> marine : firewatch.entrySet()) {
|
||||
if (name.equalsIgnoreCase(marine.getKey())) {
|
||||
System.out.println(name + ( marine.getValue() ? " does " : " does not ") + "have firewatch.");
|
||||
System.out.println("From " + time + " to " + (time + 4) + ".");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,15 +1,20 @@
|
|||
package plugin.command;
|
||||
|
||||
import org.crandor.game.container.Container;
|
||||
import org.crandor.game.content.skill.Skills;
|
||||
import org.crandor.game.interaction.Interaction;
|
||||
import org.crandor.game.node.entity.player.Player;
|
||||
import org.crandor.game.node.entity.player.ai.AIPBuilder;
|
||||
import org.crandor.game.node.entity.player.ai.AIPlayer;
|
||||
import org.crandor.game.node.entity.player.ai.general.GeneralBotCreator;
|
||||
import org.crandor.game.node.entity.player.ai.general.scriptrepository.LobsterCatcher;
|
||||
import org.crandor.game.node.entity.player.ai.general.scriptrepository.ManThiever;
|
||||
import org.crandor.game.node.entity.player.ai.pvmbots.PvMBotsBuilder;
|
||||
import org.crandor.game.node.entity.player.ai.pvp.PVPAIPActions;
|
||||
import org.crandor.game.node.entity.player.ai.pvp.PVPAIPBuilderUtils;
|
||||
import org.crandor.game.node.entity.player.ai.resource.ResourceAIPActions;
|
||||
import org.crandor.game.node.entity.player.ai.skillingbot.SkillingBotsBuilder;
|
||||
import org.crandor.game.node.entity.player.ai.wilderness.PvPBotsBuilder;
|
||||
import org.crandor.game.node.entity.player.link.appearance.Gender;
|
||||
import org.crandor.game.node.item.Item;
|
||||
import org.crandor.game.system.command.CommandPlugin;
|
||||
|
|
@ -31,181 +36,270 @@ import java.util.List;
|
|||
/**
|
||||
* Handles the AIPlayer commands.
|
||||
* These commands are for bots
|
||||
*
|
||||
* @author Emperor
|
||||
*/
|
||||
@InitializablePlugin
|
||||
public final class AIPCommandPlugin extends CommandPlugin {
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
link(CommandSet.ADMINISTRATOR);
|
||||
return this;
|
||||
}
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
link(CommandSet.ADMINISTRATOR);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean parse(final Player player, String name, String[] args) {
|
||||
List<AIPlayer> legion = player.getAttribute("aip_legion");
|
||||
switch (name) {
|
||||
case "desaip":
|
||||
player.removeAttribute("aip_select");
|
||||
return true;
|
||||
case "sellegion":
|
||||
if (legion != null && !legion.isEmpty()) {
|
||||
player.setAttribute("aip_select", legion.get(0));
|
||||
}
|
||||
return true;
|
||||
case "regroup":
|
||||
Player last = player;
|
||||
if (legion != null && !legion.isEmpty()) {
|
||||
for (AIPlayer p : legion) {
|
||||
p.follow(last);
|
||||
last = p;
|
||||
}
|
||||
}
|
||||
player.removeAttribute("aip_select");
|
||||
return true;
|
||||
case "clearlegion":
|
||||
if (legion != null && !legion.isEmpty()) {
|
||||
for (AIPlayer p : legion) {
|
||||
AIPlayer.deregister(p.getUid());
|
||||
}
|
||||
legion.clear();
|
||||
}
|
||||
player.removeAttribute("aip_select");
|
||||
player.removeAttribute("aip_legion");
|
||||
return true;
|
||||
case "clearaips":
|
||||
for (Player p : Repository.getPlayers()) {
|
||||
if (p.isArtificial()) {
|
||||
p.clear();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
case "aip":
|
||||
name = args.length < 2 ? player.getName() : args[1];
|
||||
AIPlayer p = AIPBuilder.copy(player, name, player.getLocation().transform(0, 1, 0));
|
||||
Repository.getPlayers().add(p);
|
||||
p.init();
|
||||
|
||||
Interaction.sendOption(player, 7, "Control");
|
||||
return true;
|
||||
case "legion":
|
||||
int size = args.length < 2 ? 10 : Integer.parseInt(args[1]);
|
||||
last = player;
|
||||
if (legion == null) {
|
||||
player.setAttribute("aip_legion", legion = new ArrayList<>());
|
||||
}
|
||||
Interaction.sendOption(player, 7, "Control");
|
||||
boolean joinClan = player.getCommunication().getClan() != null && !player.getCommunication().getClan().isDefault();
|
||||
String message = player.getName().equals("ethan") ? "The Dark Army marches again!" : null; // Add
|
||||
// your
|
||||
// own
|
||||
// message
|
||||
for (int i = 0; i < size; i++) {
|
||||
final AIPlayer aip = AIPBuilder.copy(player, last.getLocation().transform(0, 1, 0));
|
||||
Repository.getPlayers().add(aip);
|
||||
aip.init();
|
||||
if (legion.isEmpty()) {
|
||||
aip.setAttribute("aip_legion", legion);
|
||||
}
|
||||
legion.add(aip);
|
||||
final Player l = last;
|
||||
if (joinClan) {
|
||||
if (player.getCommunication().getClan().enter(aip)) {
|
||||
aip.getCommunication().setClan(player.getCommunication().getClan());
|
||||
}
|
||||
if (player.getCommunication().getClan().getClanWar() != null) {
|
||||
player.getCommunication().getClan().getClanWar().fireEvent("join", aip);
|
||||
}
|
||||
}
|
||||
GameWorld.submit(new Pulse(1) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
aip.follow(l);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (message != null) {
|
||||
aip.sendChat("The Dark Army marches again!");
|
||||
}
|
||||
last = aip;
|
||||
}
|
||||
return true;
|
||||
case "pvplegion":
|
||||
size = args.length < 2 ? 10 : Integer.parseInt(args[1]);
|
||||
last = player;
|
||||
if (PVPAIPActions.pvp_players == null) {
|
||||
player.setAttribute("aip_legion", PVPAIPActions.pvp_players = new ArrayList<>());
|
||||
}
|
||||
for (int i = 0; i < size; i++) {
|
||||
String aipName = PVPAIPBuilderUtils.names[i];
|
||||
final AIPlayer aip = AIPBuilder.create(aipName, generateLocation(player));
|
||||
aip.setControler(player);
|
||||
aip.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE);
|
||||
Repository.getPlayers().add(aip);
|
||||
aip.init();
|
||||
PVPAIPBuilderUtils.generateClass(aip);
|
||||
|
||||
if (PVPAIPActions.pvp_players.isEmpty()) {
|
||||
aip.setAttribute("aip_legion", PVPAIPActions.pvp_players);
|
||||
}
|
||||
PVPAIPActions.pvp_players.add(aip);
|
||||
last = aip;
|
||||
}
|
||||
return true;
|
||||
|
||||
case "resourcelegion":
|
||||
size = args.length < 2 ? 10 : Integer.parseInt(args[1]);
|
||||
last = player;
|
||||
if (ResourceAIPActions.resource_players == null) {
|
||||
player.setAttribute("aip_legion", ResourceAIPActions.resource_players = new ArrayList<>());
|
||||
}
|
||||
for (int i = 0; i < size; i++) {
|
||||
String aipName = PVPAIPBuilderUtils.names[i];
|
||||
final AIPlayer aip = AIPBuilder.create(aipName, generateLocation(player));
|
||||
aip.setControler(player);
|
||||
aip.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE);
|
||||
Repository.getPlayers().add(aip);
|
||||
aip.init();
|
||||
PVPAIPBuilderUtils.generateClass(aip);
|
||||
|
||||
if (ResourceAIPActions.resource_players .isEmpty()) {
|
||||
aip.setAttribute("aip_legion", ResourceAIPActions.resource_players );
|
||||
}
|
||||
ResourceAIPActions.resource_players.add(aip);
|
||||
last = aip;
|
||||
}
|
||||
return true;
|
||||
case "syncresource":
|
||||
ResourceAIPActions.syncBotThread(player);
|
||||
break;
|
||||
case "pvpfight":
|
||||
PVPAIPActions.syncBotThread(player);
|
||||
return true;
|
||||
@Override
|
||||
public boolean parse(final Player player, String name, String[] args) {
|
||||
List<AIPlayer> legion = player.getAttribute("aip_legion");
|
||||
switch (name) {
|
||||
case "desaip":
|
||||
player.removeAttribute("aip_select");
|
||||
return true;
|
||||
case "sellegion":
|
||||
if (legion != null && !legion.isEmpty()) {
|
||||
player.setAttribute("aip_select", legion.get(0));
|
||||
}
|
||||
return true;
|
||||
case "regroup":
|
||||
Player last = player;
|
||||
if (legion != null && !legion.isEmpty()) {
|
||||
for (AIPlayer p : legion) {
|
||||
p.follow(last);
|
||||
last = p;
|
||||
}
|
||||
}
|
||||
player.removeAttribute("aip_select");
|
||||
return true;
|
||||
case "clearlegion":
|
||||
if (legion != null && !legion.isEmpty()) {
|
||||
for (AIPlayer p : legion) {
|
||||
AIPlayer.deregister(p.getUid());
|
||||
}
|
||||
legion.clear();
|
||||
}
|
||||
player.removeAttribute("aip_select");
|
||||
player.removeAttribute("aip_legion");
|
||||
return true;
|
||||
case "clearaips":
|
||||
for (Player p : Repository.getPlayers()) {
|
||||
if (p.isArtificial()) {
|
||||
p.clear();
|
||||
}
|
||||
}
|
||||
return true;
|
||||
case "aip":
|
||||
name = args.length < 2 ? player.getName() : args[1];
|
||||
AIPlayer p = AIPBuilder.copy(player, name, player.getLocation().transform(0, 1, 0));
|
||||
Repository.getPlayers().add(p);
|
||||
p.init();
|
||||
|
||||
Interaction.sendOption(player, 7, "Control");
|
||||
return true;
|
||||
case "legion":
|
||||
int size = args.length < 2 ? 10 : Integer.parseInt(args[1]);
|
||||
last = player;
|
||||
if (legion == null) {
|
||||
player.setAttribute("aip_legion", legion = new ArrayList<>());
|
||||
}
|
||||
Interaction.sendOption(player, 7, "Control");
|
||||
boolean joinClan = player.getCommunication().getClan() != null && !player.getCommunication().getClan().isDefault();
|
||||
String message = player.getName().equals("ethan") ? "The Dark Army marches again!" : null; // Add
|
||||
// your
|
||||
// own
|
||||
// message
|
||||
for (int i = 0; i < size; i++) {
|
||||
final AIPlayer aip = AIPBuilder.copy(player, last.getLocation().transform(0, 1, 0));
|
||||
Repository.getPlayers().add(aip);
|
||||
aip.init();
|
||||
if (legion.isEmpty()) {
|
||||
aip.setAttribute("aip_legion", legion);
|
||||
}
|
||||
legion.add(aip);
|
||||
final Player l = last;
|
||||
if (joinClan) {
|
||||
if (player.getCommunication().getClan().enter(aip)) {
|
||||
aip.getCommunication().setClan(player.getCommunication().getClan());
|
||||
}
|
||||
if (player.getCommunication().getClan().getClanWar() != null) {
|
||||
player.getCommunication().getClan().getClanWar().fireEvent("join", aip);
|
||||
}
|
||||
}
|
||||
GameWorld.submit(new Pulse(1) {
|
||||
@Override
|
||||
public boolean pulse() {
|
||||
aip.follow(l);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (message != null) {
|
||||
aip.sendChat("The Dark Army marches again!");
|
||||
}
|
||||
last = aip;
|
||||
}
|
||||
return true;
|
||||
case "pvplegion":
|
||||
size = args.length < 2 ? 10 : Integer.parseInt(args[1]);
|
||||
last = player;
|
||||
if (PVPAIPActions.pvp_players == null) {
|
||||
player.setAttribute("aip_legion", PVPAIPActions.pvp_players = new ArrayList<>());
|
||||
}
|
||||
for (int i = 0; i < size; i++) {
|
||||
String aipName = PVPAIPBuilderUtils.names[i];
|
||||
final AIPlayer aip = AIPBuilder.create(aipName, generateLocation(player));
|
||||
aip.setControler(player);
|
||||
aip.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE);
|
||||
Repository.getPlayers().add(aip);
|
||||
aip.init();
|
||||
PVPAIPBuilderUtils.generateClass(aip);
|
||||
|
||||
if (PVPAIPActions.pvp_players.isEmpty()) {
|
||||
aip.setAttribute("aip_legion", PVPAIPActions.pvp_players);
|
||||
}
|
||||
PVPAIPActions.pvp_players.add(aip);
|
||||
last = aip;
|
||||
}
|
||||
return true;
|
||||
|
||||
case "resourcelegion":
|
||||
size = args.length < 2 ? 10 : Integer.parseInt(args[1]);
|
||||
last = player;
|
||||
if (ResourceAIPActions.resource_players == null) {
|
||||
player.setAttribute("aip_legion", ResourceAIPActions.resource_players = new ArrayList<>());
|
||||
}
|
||||
for (int i = 0; i < size; i++) {
|
||||
String aipName = PVPAIPBuilderUtils.names[i];
|
||||
final AIPlayer aip = AIPBuilder.create(aipName, generateLocation(player));
|
||||
aip.setControler(player);
|
||||
aip.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE);
|
||||
Repository.getPlayers().add(aip);
|
||||
aip.init();
|
||||
PVPAIPBuilderUtils.generateClass(aip);
|
||||
|
||||
if (ResourceAIPActions.resource_players.isEmpty()) {
|
||||
aip.setAttribute("aip_legion", ResourceAIPActions.resource_players);
|
||||
}
|
||||
ResourceAIPActions.resource_players.add(aip);
|
||||
last = aip;
|
||||
}
|
||||
return true;
|
||||
case "syncresource":
|
||||
ResourceAIPActions.syncBotThread(player);
|
||||
break;
|
||||
case "pvpfight":
|
||||
PVPAIPActions.syncBotThread(player);
|
||||
return true;
|
||||
|
||||
|
||||
case "bot":
|
||||
PvMBotsBuilder.spawnLowest(player.getLocation());
|
||||
return true;
|
||||
case "molebot":
|
||||
PvMBotsBuilder.spawnGiantMoleBot(player.getLocation());
|
||||
return true;
|
||||
case "slayerpoints":
|
||||
player.getSlayer().setSlayerPoints(50000);
|
||||
return true;
|
||||
case "dragonbot":
|
||||
PvMBotsBuilder.spawnDragonKiller(player.getLocation());
|
||||
return true;
|
||||
case "pure":
|
||||
player.getSkills().setStaticLevel(Skills.HITPOINTS, 60);
|
||||
player.getSkills().setStaticLevel(Skills.RANGE, 95);
|
||||
player.getSkills().setStaticLevel(Skills.MAGIC, 95);
|
||||
player.getSkills().setStaticLevel(Skills.ATTACK, 50);
|
||||
player.getSkills().setStaticLevel(Skills.STRENGTH, 93);
|
||||
player.getSkills().setStaticLevel(Skills.DEFENCE, 1);
|
||||
player.getSkills().setStaticLevel(Skills.PRAYER, 1);
|
||||
player.getSkills().updateCombatLevel();
|
||||
return true;
|
||||
case "noobbot":
|
||||
PvMBotsBuilder.spawnNoob(player.getLocation());
|
||||
return true;
|
||||
case "immersive":
|
||||
PvMBotsBuilder.immersiveSpawns();
|
||||
AIPBuilder.immersiveSpawns();
|
||||
SkillingBotsBuilder.immersiveSpawnsSkillingBots();
|
||||
return true;
|
||||
case "fishtest":
|
||||
SkillingBotsBuilder.spawnTroutLumbridge("Bot", new Location(3241, 3242));
|
||||
return true;
|
||||
case "varrockminebots":
|
||||
SkillingBotsBuilder.spawnClayBotVarrock("clay", new Location(3181, 3368));
|
||||
SkillingBotsBuilder.spawnSilverBotVarrock("silver", new Location(3181, 3368));
|
||||
SkillingBotsBuilder.spawnIronBotVarrock("iron", new Location(3181, 3368));
|
||||
SkillingBotsBuilder.spawnTinBotVarrock("tin", new Location(3181, 3368));
|
||||
return true;
|
||||
case "pvpbot":
|
||||
PvPBotsBuilder.spawn(player.getLocation());
|
||||
return true;
|
||||
case "pvpbots":
|
||||
for (int amountBots = 0; amountBots < 50; amountBots++) {
|
||||
PvPBotsBuilder.spawn(player.getLocation());
|
||||
}
|
||||
return true;
|
||||
case "removetask":
|
||||
if (!player.getSlayer().hasTask()) {
|
||||
player.sendMessage("You don't have an active task right now.");
|
||||
return true;
|
||||
} else {
|
||||
player.getSlayer().clear();
|
||||
player.sendMessage("You have canceled your current task.");
|
||||
return true;
|
||||
}
|
||||
case "pesttest":
|
||||
int arg2;
|
||||
try {
|
||||
arg2 = Integer.parseInt(args[1]);
|
||||
} catch (Exception e) {
|
||||
arg2 = 1;
|
||||
}
|
||||
for (int pestBotsAmount = 0; pestBotsAmount < arg2; pestBotsAmount++) {
|
||||
PvMBotsBuilder.spawnPestControlTestBot(player.getLocation());
|
||||
}
|
||||
return true;
|
||||
case "bots":
|
||||
int arg = 1;
|
||||
int xpos = 0;
|
||||
int ypos = 0;
|
||||
try {
|
||||
arg = Integer.parseInt(args[1]);
|
||||
} catch (Exception e) {
|
||||
System.out.println("Rip " + args[1]);
|
||||
}
|
||||
for (int amountBots2 = 0; amountBots2 < arg; amountBots2++) {
|
||||
xpos = 2500 + RandomFunction.getRandom(1000);
|
||||
ypos = 3000 + RandomFunction.getRandom(500);
|
||||
PvMBotsBuilder.spawnNoob(new Location(xpos, ypos));
|
||||
}
|
||||
System.out.println((xpos) + " " + (ypos));
|
||||
return true;
|
||||
|
||||
/*
|
||||
Start regular bots
|
||||
*/
|
||||
case "manthiev":
|
||||
new GeneralBotCreator("Bot", player.getLocation(), new ManThiever());
|
||||
break;
|
||||
case "manthiev":
|
||||
new GeneralBotCreator("Bot", player.getLocation(), new ManThiever());
|
||||
break;
|
||||
case "fish":
|
||||
new GeneralBotCreator("Fisher", Location.create(2805, 3435, 0), new LobsterCatcher());
|
||||
break;
|
||||
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private Location generateLocation(Player player) {
|
||||
Location random_location = player.getLocation().transform(RandomFunction.random(-15, 15), RandomFunction.random(-15, 15), 0);
|
||||
if (!RegionManager.isTeleportPermitted(random_location)) {
|
||||
return generateLocation(player);
|
||||
}
|
||||
if (!Pathfinder.find(player, random_location, false, Pathfinder.DUMB).isSuccessful()) {
|
||||
return generateLocation(player);
|
||||
}
|
||||
if (RegionManager.getObject(random_location) != null) {
|
||||
return generateLocation(player);
|
||||
}
|
||||
return random_location;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private Location generateLocation(Player player) {
|
||||
Location random_location = player.getLocation().transform(RandomFunction.random(-15, 15), RandomFunction.random(-15, 15), 0);
|
||||
if (!RegionManager.isTeleportPermitted(random_location)) {
|
||||
return generateLocation(player);
|
||||
}
|
||||
if (!Pathfinder.find(player, random_location, false, Pathfinder.DUMB).isSuccessful()) {
|
||||
return generateLocation(player);
|
||||
}
|
||||
if (RegionManager.getObject(random_location) != null) {
|
||||
return generateLocation(player);
|
||||
}
|
||||
return random_location;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue