mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-10 10:20:41 -07:00
A lot of bot updates
This commit is contained in:
parent
b24957bd06
commit
235cdf653f
30 changed files with 5423 additions and 67 deletions
File diff suppressed because it is too large
Load diff
|
|
@ -1,4 +1,4 @@
|
|||
name=Crandor
|
||||
name=2009scape
|
||||
beta=false
|
||||
sql=true
|
||||
devMode=true
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
name=Crandor
|
||||
name=2009scape
|
||||
beta=false
|
||||
sql=true
|
||||
devMode=true
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
name=Crandor
|
||||
name=2009scape
|
||||
beta=false
|
||||
sql=true
|
||||
devMode=true
|
||||
|
|
|
|||
|
|
@ -302,7 +302,6 @@ public class RenderAnimationDefinition {
|
|||
for (int i = 0; i < length; i++) {
|
||||
System.out.print(Array.get(object, i) + (i < (length - 1) ? ", " : "]"));
|
||||
}
|
||||
System.out.println();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
@ -319,7 +318,6 @@ public class RenderAnimationDefinition {
|
|||
for (int i = 0; i < length; i++) {
|
||||
System.out.print(Array.get(object, i) + (i < (length - 1) ? ", " : "]"));
|
||||
}
|
||||
System.out.println();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,6 +44,11 @@ public final class Skills {
|
|||
*/
|
||||
public static final int ATTACK = 0, DEFENCE = 1, STRENGTH = 2, HITPOINTS = 3, RANGE = 4, PRAYER = 5, MAGIC = 6, COOKING = 7, WOODCUTTING = 8, FLETCHING = 9, FISHING = 10, FIREMAKING = 11, CRAFTING = 12, SMITHING = 13, MINING = 14, HERBLORE = 15, AGILITY = 16, THIEVING = 17, SLAYER = 18, FARMING = 19, RUNECRAFTING = 20, HUNTER = 21, CONSTRUCTION = 22, SUMMONING = 23;
|
||||
|
||||
/**
|
||||
* Number of skills in game
|
||||
*/
|
||||
public static final int NUM_SKILLS = 24;
|
||||
|
||||
/**
|
||||
* Represents the entity instance.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ public final class RareDropTable {
|
|||
int id = Integer.parseInt(arg[1]);
|
||||
int amount = 1;
|
||||
int amount2 = amount;
|
||||
System.out.println(id);
|
||||
System.out.println("Rare drop table: " + id);
|
||||
if (arg[2].contains("-")) {
|
||||
String[] amt = arg[2].split("-");
|
||||
amount = Integer.parseInt(amt[0]);
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ public final class AIPBuilder {
|
|||
{
|
||||
final AIPlayer bot = new AIPlayer(loc);
|
||||
bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE);
|
||||
Repository.getPlayers().add(bot);
|
||||
bot.init();
|
||||
|
||||
|
||||
|
||||
bot.getSkills().setStaticLevel(Skills.MAGIC, RandomFunction.getRandom(99));
|
||||
bot.getSkills().setStaticLevel(Skills.DEFENCE, RandomFunction.getRandom(99));
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import java.util.*;
|
|||
|
||||
import org.crandor.game.content.dialogue.DialoguePlugin;
|
||||
import org.crandor.game.content.global.tutorial.CharacterDesign;
|
||||
import org.crandor.game.content.skill.Skills;
|
||||
import org.crandor.game.interaction.DestinationFlag;
|
||||
import org.crandor.game.interaction.MovementPulse;
|
||||
import org.crandor.game.interaction.Option;
|
||||
|
|
@ -15,11 +16,13 @@ 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.info.PlayerDetails;
|
||||
import org.crandor.game.node.entity.player.link.appearance.Gender;
|
||||
import org.crandor.game.node.item.Item;
|
||||
import org.crandor.game.world.map.Direction;
|
||||
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 org.crandor.net.packet.in.InteractionPacket;
|
||||
import org.crandor.plugin.Plugin;
|
||||
import org.crandor.tools.RandomFunction;
|
||||
|
|
@ -82,8 +85,24 @@ public class AIPlayer extends Player {
|
|||
super.setLocation(startLocation = l);
|
||||
super.artificial = true;
|
||||
super.getDetails().setSession(ArtificialSession.getSingleton());
|
||||
Repository.getPlayers().add(this);
|
||||
this.username = StringUtils.formatDisplayName(name + (currentUID + 1));
|
||||
this.uid = currentUID++;
|
||||
this.generateRandomValues();
|
||||
this.init();
|
||||
}
|
||||
|
||||
private void generateRandomValues() {
|
||||
this.getAppearance().setGender(RandomFunction.random(5) == 1 ? Gender.FEMALE : Gender.MALE);
|
||||
|
||||
for (int i = 0; i < Skills.NUM_SKILLS; i++) {
|
||||
this.getSkills().setLevel(i, RandomFunction.random(99));
|
||||
this.getSkills().setStaticLevel(i, RandomFunction.random(99));
|
||||
}
|
||||
|
||||
this.setDirection(Direction.values()[new Random().nextInt(Direction.values().length)]); //Random facing dir
|
||||
this.getSkills().updateCombatLevel();
|
||||
this.getAppearance().sync();
|
||||
}
|
||||
|
||||
public static String retrieveRandomName() //Reads a random line from the file O_O
|
||||
|
|
@ -396,7 +415,7 @@ public class AIPlayer extends Player {
|
|||
@Override
|
||||
public void clear() {
|
||||
botMapping.remove(uid);
|
||||
super.clear();
|
||||
super.clear(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -423,6 +442,7 @@ public class AIPlayer extends Player {
|
|||
AIPlayer player = botMapping.get(uid);
|
||||
if (player != null) {
|
||||
player.clear();
|
||||
Repository.getPlayers().remove(player);
|
||||
return;
|
||||
}
|
||||
System.err.println("Could not deregister AIP#" + uid + ": UID not added to the mapping!");
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public class GeneralBotCreator {
|
|||
public GeneralBotCreator(Location loc, Script botScript)
|
||||
{
|
||||
botScript.bot = AIPBuilder.create(loc);
|
||||
Repository.getPlayers().add(botScript.bot);
|
||||
|
||||
botScript.init();
|
||||
|
||||
GameWorld.submit(new Pulse(1, botScript.bot) {
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class LobsterCatcher extends Script {
|
|||
Pathfinder.find(bot, Location.create(2837, 3435, 0)).walk(bot);
|
||||
|
||||
if (spot != null) {
|
||||
System.out.println(spot.getLocation().toString());
|
||||
System.out.println("LobsterCatcher: " + spot.getLocation().toString());
|
||||
spot.getInteraction().handle(bot, spot.getInteraction().get(0));
|
||||
}
|
||||
|
||||
|
|
@ -61,6 +61,6 @@ public class LobsterCatcher extends Script {
|
|||
bank.getInteraction().handle(bot, bank.getInteraction().get(2));
|
||||
}
|
||||
|
||||
System.out.println(tick);
|
||||
System.out.println("LobsterCatcher: " + tick);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,34 @@
|
|||
package org.crandor.game.node.entity.player.ai.lumbridge;
|
||||
|
||||
import org.crandor.game.node.entity.player.ai.AIPlayer;
|
||||
import org.crandor.game.world.map.Location;
|
||||
import org.crandor.game.world.map.zone.ZoneBorders;
|
||||
import org.crandor.tools.RandomFunction;
|
||||
|
||||
public class DeadIdler extends AIPlayer {
|
||||
//Recreation of players I saw in w417 who seemed to have quit their computer after dying.
|
||||
|
||||
private int tick = RandomFunction.random(500);
|
||||
|
||||
public DeadIdler()
|
||||
{
|
||||
super(getRandomRespawnLoc());
|
||||
this.setCustomState("Lumbridge Bot");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick()
|
||||
{
|
||||
super.tick();
|
||||
if (this.tick > 0)
|
||||
{
|
||||
tick --;
|
||||
} else {
|
||||
AIPlayer.deregister(this.getUid());
|
||||
}
|
||||
}
|
||||
|
||||
private static Location getRandomRespawnLoc() {
|
||||
return new ZoneBorders(3219, 3218, 3223, 3219).getRandomLoc();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
package org.crandor.game.node.entity.player.ai.lumbridge;
|
||||
|
||||
import org.crandor.tools.RandomFunction;
|
||||
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* Creates a few random bots around Lumbridge area.
|
||||
* Code by Red Bracket
|
||||
*/
|
||||
public class LumbridgeBotHandler {
|
||||
public static void immersiveLumbridge()
|
||||
{
|
||||
//Generate a few random bots here and there
|
||||
|
||||
generateDeadIdlers();
|
||||
}
|
||||
|
||||
private static void generateDeadIdlers() {
|
||||
Executors.newSingleThreadExecutor().execute(() -> {
|
||||
while (true) //Would probably be better if this could be "while game is running"
|
||||
{
|
||||
new DeadIdler();
|
||||
try {
|
||||
Thread.sleep(RandomFunction.random(300_000));
|
||||
} catch (InterruptedException e) {
|
||||
System.out.println("LumbridgeBotHandler can't sleep!!?");
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
@ -7,7 +7,6 @@ public class LowestBot extends PvMBots{
|
|||
|
||||
public LowestBot(Location l) {
|
||||
super(l);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
private int tick = 0;
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ public class PvMBots extends AIPlayer {
|
|||
|
||||
public PvMBots(Location l) {
|
||||
super(l);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -95,10 +94,13 @@ public class PvMBots extends AIPlayer {
|
|||
this.tick++;
|
||||
|
||||
//Despawn
|
||||
if (this.getSkills().getLifepoints() == 0)
|
||||
if (this.getSkills().getLifepoints() == 0){
|
||||
//TODO: Just respawn a new bot (not sure how you'd do that :L)
|
||||
// Maybe make all PvMBots know what to do if they aren't in right area? I.e. pest control bots teleport to PC
|
||||
//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 % 10 == 0) {
|
||||
|
|
|
|||
|
|
@ -11,7 +11,6 @@ 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{
|
||||
|
|
@ -64,11 +63,11 @@ public final class PvMBotsBuilder{
|
|||
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.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));
|
||||
|
|
@ -77,7 +76,7 @@ public final class PvMBotsBuilder{
|
|||
|
||||
public static void generateMinLevels(PvMBots p)
|
||||
{
|
||||
//Slayer so they can attack alls monsters
|
||||
//Slayer so they can attack all monsters
|
||||
p.getSkills().setLevel(Skills.SLAYER, 99);
|
||||
p.getSkills().setStaticLevel(Skills.SLAYER, 99);
|
||||
int combatType = RandomFunction.getRandom(2);
|
||||
|
|
@ -145,7 +144,7 @@ public final class PvMBotsBuilder{
|
|||
}
|
||||
}
|
||||
|
||||
public static void createPestControlBot(PestControlTestBot p)
|
||||
public static void customizePestControlBot(PestControlTestBot p)
|
||||
{
|
||||
p.getSkills().setLevel(Skills.SLAYER, 99);
|
||||
p.getSkills().setStaticLevel(Skills.SLAYER, 99);
|
||||
|
|
@ -469,37 +468,29 @@ public final class PvMBotsBuilder{
|
|||
{
|
||||
final PvMBots bot = PvMBotsBuilder.create(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(loc);
|
||||
bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE);
|
||||
Repository.getPlayers().add(bot);
|
||||
bot.init();
|
||||
|
||||
createPestControlBot(bot);
|
||||
|
||||
customizePestControlBot(bot);
|
||||
}
|
||||
|
||||
public static void spawnLowest(Location loc)
|
||||
{
|
||||
final LowestBot bot = PvMBotsBuilder.createLowest(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(loc);
|
||||
bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE);
|
||||
Repository.getPlayers().add(bot);
|
||||
bot.init();
|
||||
|
||||
|
||||
createNoob(bot);
|
||||
}
|
||||
|
||||
|
|
@ -507,8 +498,8 @@ public final class PvMBotsBuilder{
|
|||
{
|
||||
final DragonKiller bot = PvMBotsBuilder.createDragonKiller(loc);
|
||||
bot.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE);
|
||||
Repository.getPlayers().add(bot);
|
||||
bot.init();
|
||||
|
||||
|
||||
|
||||
createDragonKiller(bot);
|
||||
}
|
||||
|
|
@ -518,8 +509,8 @@ public final class PvMBotsBuilder{
|
|||
final GiantMoleBot bot = PvMBotsBuilder.createGiantMoleBot(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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ public class ResourceAIPActions {
|
|||
ov = 0;
|
||||
}
|
||||
// ov = 0;
|
||||
System.out.println(ov);
|
||||
System.out.println("ResourceAIPActions" + ov);
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.crandor.game.node.entity.player.ai.resource;
|
|||
|
||||
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.lumbridge.LumbridgeBotHandler;
|
||||
import org.crandor.game.node.entity.player.ai.pvmbots.PvMBotsBuilder;
|
||||
import org.crandor.game.node.entity.player.ai.resource.task.ResourceTask;
|
||||
import org.crandor.game.node.entity.player.ai.resource.task.ResourceTasks;
|
||||
|
|
@ -37,8 +38,9 @@ public class ResourceAIPManager {
|
|||
|
||||
public void immerseWorld() { //There's probably a better place for this (it adds bot at bootup)
|
||||
PvMBotsBuilder.immersiveSpawns();
|
||||
AIPBuilder.immersiveSpawns();
|
||||
SkillingBotsBuilder.immersiveSpawnsSkillingBots();
|
||||
LumbridgeBotHandler.immersiveLumbridge();
|
||||
//AIPBuilder.immersiveSpawns();
|
||||
//SkillingBotsBuilder.immersiveSpawnsSkillingBots();
|
||||
System.out.println("Loaded immerseWorld");
|
||||
}
|
||||
|
||||
|
|
@ -96,7 +98,7 @@ public class ResourceAIPManager {
|
|||
continue;
|
||||
StringBuilder query = new StringBuilder();
|
||||
query.append("UPDATE `members` SET `taskName`='" + entry.getKey().getTaskName() + "',`taskTime`='" + entry.getValue() + "' WHERE `username`='" + player.getUsername() + "'");
|
||||
System.out.println(query.toString());
|
||||
System.out.println("ResourceAIPManager: " + query.toString());
|
||||
GameWorld.getDatabaseManager().update("global", query.toString());
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ import org.crandor.game.node.entity.player.ai.AIPlayer;
|
|||
import org.crandor.game.node.item.Item;
|
||||
import org.crandor.net.packet.in.InteractionPacket;
|
||||
|
||||
public class SkillingBot extends AIPlayer{
|
||||
public class SkillingBot extends AIPlayer {
|
||||
|
||||
private int tick = 5;
|
||||
private ArrayList<Integer> interactNodeIds;
|
||||
|
|
@ -24,7 +24,6 @@ public class SkillingBot extends AIPlayer{
|
|||
super(l);
|
||||
this.fromWhereDoIdrop = 0;
|
||||
this.interactionRange = 15;
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public SkillingBot(Location l, int skill, ArrayList<Integer> entrys)
|
||||
|
|
|
|||
|
|
@ -23,8 +23,8 @@ public final class SkillingBotsBuilder extends AIPlayer {
|
|||
{
|
||||
SkillingBot bot = new SkillingBot(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;
|
||||
}
|
||||
|
|
@ -33,8 +33,8 @@ public final class SkillingBotsBuilder extends AIPlayer {
|
|||
{
|
||||
SkillingBot bot = new SkillingBot(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;
|
||||
}
|
||||
|
|
@ -44,8 +44,8 @@ public final class SkillingBotsBuilder extends AIPlayer {
|
|||
SkillingBot bot = new SkillingBot(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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -518,9 +518,9 @@ public final class PvPBotsBuilder{
|
|||
final WildernessBot bot = PvPBotsBuilder.create(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) {
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ public class WildernessBot extends AIPlayer {
|
|||
|
||||
private void checkBarrowsSwitch()
|
||||
{
|
||||
System.out.println(this.getSkills().getLifepoints());
|
||||
System.out.println("WildernessBot: " + this.getSkills().getLifepoints());
|
||||
Entity target = getTarget();
|
||||
if (target == null)
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -106,7 +106,7 @@ public class SpawnData implements SavingModule {
|
|||
case 7:
|
||||
for (int i = 0; i < PKPackage.values().length; i++) {
|
||||
purchased = PKPackage.values()[i].ordinal();
|
||||
System.out.println(PKPackage.values()[i].ordinal());
|
||||
System.out.println("SpawnData: " + PKPackage.values()[i].ordinal());
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ public final class CheckRandomCondition extends ScriptContext {
|
|||
|
||||
@Override
|
||||
public boolean execute(Object... args) {
|
||||
System.out.println( (String) ((Entity) args[0]).getAttribute("asc_random") );
|
||||
System.out.println("CheckRandomCondition:" + (String) ((Entity) args[0]).getAttribute("asc_random") );
|
||||
return ((Entity) args[0]).getAttribute("asc_random", 0) == value;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ public final class OptionDialInstruction extends ScriptContext {
|
|||
|
||||
@Override
|
||||
public ScriptContext create(String args) {
|
||||
System.out.println(args);
|
||||
System.out.println("OptionDialInstruction: " + args);
|
||||
ScriptContext context = super.create(args);
|
||||
|
||||
if (context != null) {
|
||||
|
|
|
|||
|
|
@ -221,9 +221,8 @@ public final class ZoneBorders {
|
|||
}
|
||||
|
||||
public Location getRandomLoc() {
|
||||
int x = northEastX - southWestX == 0 ? southWestX : new Random().nextInt(northEastX - southWestX) + southWestX;
|
||||
int y = northEastY - southWestY == 0 ? southWestY : new Random().nextInt(northEastY - southWestY) + southWestY;
|
||||
//System.out.println("Generated x,y " + x + ", " + y);
|
||||
int x = northEastX - southWestX == 0 ? southWestX : new Random().nextInt(northEastX - southWestX + 1) + southWestX;
|
||||
int y = northEastY - southWestY == 0 ? southWestY : new Random().nextInt(northEastY - southWestY + 1) + southWestY;
|
||||
return new Location(x, y);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -93,6 +93,9 @@ public class RandomFunction {
|
|||
return RANDOM.nextInt(val);
|
||||
}
|
||||
|
||||
/*
|
||||
* Generates a random number likely closer to the middle of i
|
||||
*/
|
||||
public static int normalRandDist(int i, int intensity) {
|
||||
int sum = 0;
|
||||
for (int j = 0; j < intensity; j++) {
|
||||
|
|
@ -105,6 +108,9 @@ public class RandomFunction {
|
|||
return (RANDOM.nextInt(i) + RANDOM.nextInt(i))/2;
|
||||
}
|
||||
|
||||
/*
|
||||
* Generates a random number likely in the area above val (I think)
|
||||
*/
|
||||
public static int normalPlusWeightRandDist(int val, int weight)
|
||||
{
|
||||
int normalDistRand = (RANDOM.nextInt(val) + RANDOM.nextInt(val))/2;
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ public final class AIPCommandPlugin extends CommandPlugin {
|
|||
case "aip":
|
||||
name = args.length < 2 ? player.getName() : args[1];
|
||||
AIPlayer p = AIPBuilder.copy(player, player.getLocation().transform(0, 1, 0));
|
||||
Repository.getPlayers().add(p);
|
||||
|
||||
p.init();
|
||||
|
||||
Interaction.sendOption(player, 7, "Control");
|
||||
|
|
@ -110,7 +110,7 @@ public final class AIPCommandPlugin extends CommandPlugin {
|
|||
// 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);
|
||||
|
|
@ -148,7 +148,7 @@ public final class AIPCommandPlugin extends CommandPlugin {
|
|||
final AIPlayer aip = AIPBuilder.create( 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);
|
||||
|
||||
|
|
@ -170,7 +170,7 @@ public final class AIPCommandPlugin extends CommandPlugin {
|
|||
final AIPlayer aip = AIPBuilder.create(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);
|
||||
|
||||
|
|
|
|||
|
|
@ -82,6 +82,7 @@ public final class BetaCommandPlugin extends CommandPlugin {
|
|||
|
||||
case "pos":
|
||||
case "position":
|
||||
case "coords":
|
||||
case "loc":
|
||||
final Location l = player.getLocation();
|
||||
final Region r = player.getViewport().getRegion();
|
||||
|
|
|
|||
|
|
@ -26,7 +26,6 @@ public class BasicStarter implements Plugin<Player> {
|
|||
|
||||
@Override
|
||||
public Plugin<Player> newInstance(Player player) throws Throwable {
|
||||
System.out.println(player.getDetails().getLastLogin());
|
||||
if (player.getDetails().getLastLogin() == 0) {
|
||||
for (int[] item : STARTER_ITEMS) {
|
||||
player.getInventory().add(new Item(item[0], item[1]));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue