From 6915f7687ac751a8386e6ef4d5901e735511e8ff Mon Sep 17 00:00:00 2001 From: 2009scape <2009scape@2009scape.com> Date: Wed, 25 Mar 2020 14:13:20 -0400 Subject: [PATCH 01/11] Ignoring future changes to the GE database --- Server/.gitignore | 1 + Server/data/eco/offer_dispatch_db.emp | Bin 3556537 -> 3583221 bytes 2 files changed, 1 insertion(+) diff --git a/Server/.gitignore b/Server/.gitignore index 031002751..ad29d7e67 100644 --- a/Server/.gitignore +++ b/Server/.gitignore @@ -13,3 +13,4 @@ data/profile/** *.eml *.userlibraries data/players/** +data/eco/offer_dispatch_db.emp diff --git a/Server/data/eco/offer_dispatch_db.emp b/Server/data/eco/offer_dispatch_db.emp index 8a564cbc2f86286ff413d4baefe487267090b426..e72a0c90ee35cc5a764251b19d5e246f2614cd35 100644 GIT binary patch delta 29645 zcmZvl2V4}#7sq$6(TfNwC}06ZM66(q61&)dJ7X`{H5$*3Eo;XbjTIB4SQ0fR8a45- zV@t#mYm6naVI%6_-edf~_h$EQ*17$BR_^w``+M_dX5Y-b-8*;8yeL1vcuDq@aFcC= zw|HKQ310=TGvRGhKM${2MoDU!xw7(%5|Xh%lInNZW-foq5z*8Fj0u_0HigfPl3b!h z@T$KXBLgp|JiX$0dPSbSFSY!W@fc8A>mTGE36PD#+Ad zU*SuTI)6t>EUYV8x&v;O(duxotP2rF*iEpT9Ty@jBYz1$FUjZf;Iw9qH{WV#G7t()4%Wamfxx zm8F%am?b+ne#|T4H3b--p+5oB+?d_8go)nB=a(S^$Fq(%3WB{T?7^^yz+MdY;;@%+ z9B&l*omW(AaL0h>PpEe+6>LbY&2P(2m*iZ0Np4E5vzD|Dg*^=RlCYO@ENLBn#SmUf zl8Vm2QxDC4Jk=-}%3kYo_UuzCUeOs@vr@wyvr;1}bq|jLsSxD;I?{I+m@r1{o0D0N zIAet4#O8>y1?Z}!5ShFCd|N<^SPIMTI8dJ$OJSCIVI=IOVK3t_FD!eYL4?mm(3uJ+ zv?$Tj_ohjz@Z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inAz_tgVT{Lc6G3>}Ycv1;-cr%v;L#B4^s~oO7 z6c)(rY|A{TN86|}gu%7izXjkYeVKjfSP<1AjQ#NK@&IhnnU}~X03_uI=faUzL~_&DQNJ! zGH-#oDpOwr^eFmFswt|2L!j({7ldFbVKwMOkF>HSHRf7_22%NHv!~x^eIJIL3FAXY zChReveoV6-Jf@;g&YzW&0lq($!?0h>^@)65a2%<9mTY>kzk-o@*#|rg!B(|umdv!@ z&)BVaOA>B8Q3dp!+8yi9wguqSm6iu}00k8vGQTgcF#u~fTPpAaC2NSq%qO1yC;whx zIfNPaSTq7-o67T^oSVp*Ir_|P5 z-1Q{?G}rw1_UwRxCEVH|#Bo>73&FA*;RQ6)hDNl5!b%-}gREY46 z?5!yrdgn=&FtgcuREfnCtnYF8rWYbPd^6$vn=Epg^$XnSGI&}e7kA9B zRN~mX?sn|C*Kq)Zt6d7`C!6n6e#UP9^EaRN!UEe$Ba Date: Wed, 25 Mar 2020 14:16:48 -0400 Subject: [PATCH 02/11] Ignore this too for @Ethan --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 68e0c615a..005d6aae9 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,4 @@ CompiledServer/**/*.jar **/.idea/workspace.xml **/.idea/* *.class +CompiledServer/ From d11234034f7d62b02b614721c7deec9e622385a5 Mon Sep 17 00:00:00 2001 From: jamix77 <> Date: Fri, 27 Mar 2020 03:36:23 +0000 Subject: [PATCH 03/11] Statistics system Yay funny number stuff for red! --- .../global/ttrail/ClueScrollPlugin.java | 1 + .../free/gather/GatheringSkillPulse.java | 2 + .../org/crandor/game/node/entity/Entity.java | 4 + .../game/node/entity/player/Player.java | 15 +++ .../player/info/login/PlayerParser.java | 5 + .../statistics/PlayerStatisticsManager.java | 115 ++++++++++++++++++ .../player/link/statistics/Statistic.java | 85 +++++++++++++ .../command/DeveloperCommandPlugin.java | 12 ++ .../plugin/command/PlayerCommandPlugin.java | 43 +++++++ .../plugin/dialogue/BorderGuardDialogue.java | 1 + .../object/FieldPickingPlugin.java | 1 + .../object/TollGateOptionPlugin.java | 1 + 12 files changed, 285 insertions(+) create mode 100644 Server/src/org/crandor/game/node/entity/player/link/statistics/PlayerStatisticsManager.java create mode 100644 Server/src/org/crandor/game/node/entity/player/link/statistics/Statistic.java diff --git a/Server/src/org/crandor/game/content/global/ttrail/ClueScrollPlugin.java b/Server/src/org/crandor/game/content/global/ttrail/ClueScrollPlugin.java index 95a8a6f74..12cb4e3a2 100644 --- a/Server/src/org/crandor/game/content/global/ttrail/ClueScrollPlugin.java +++ b/Server/src/org/crandor/game/content/global/ttrail/ClueScrollPlugin.java @@ -86,6 +86,7 @@ public abstract class ClueScrollPlugin extends MapZone implements Plugin } nextStage(player, clue); if (casket) { + player.getStatisticsManager().getCLUES_COMPLETED().incrementAmount(); player.getInventory().replace(level.getCasket(), clue.getSlot()); } else { player.getInventory().remove(clue); diff --git a/Server/src/org/crandor/game/content/skill/free/gather/GatheringSkillPulse.java b/Server/src/org/crandor/game/content/skill/free/gather/GatheringSkillPulse.java index bc983b197..4c3080b11 100644 --- a/Server/src/org/crandor/game/content/skill/free/gather/GatheringSkillPulse.java +++ b/Server/src/org/crandor/game/content/skill/free/gather/GatheringSkillPulse.java @@ -154,6 +154,7 @@ public final class GatheringSkillPulse extends SkillPulse { Projectile.create(player, null, 1776, 35, 30, 20, 25).transform(player, new Location(player.getLocation().getX() + 2, player.getLocation().getY()), true, 25, 25).send(); player.getSkills().addExperience(Skills.WOODCUTTING, resource.getExperience()); player.getSkills().addExperience(Skills.FIREMAKING, resource.getExperience()); + player.getStatisticsManager().getLOGS_OBTAINED().incrementAmount(); return false; } int reward = resource.getReward(); @@ -176,6 +177,7 @@ public final class GatheringSkillPulse extends SkillPulse { player.getPacketDispatch().sendMessage("You cut a branch from the Dramen tree."); } else { player.getPacketDispatch().sendMessage("You get some " + ItemDefinition.forId(reward).getName().toLowerCase() + "."); + player.getStatisticsManager().getLOGS_OBTAINED().incrementAmount(); } // Calculate if the player should receive a bonus gem or bonus ore or both if (!isMiningEssence && isMining) { diff --git a/Server/src/org/crandor/game/node/entity/Entity.java b/Server/src/org/crandor/game/node/entity/Entity.java index c4549a903..d5f9ef9d4 100644 --- a/Server/src/org/crandor/game/node/entity/Entity.java +++ b/Server/src/org/crandor/game/node/entity/Entity.java @@ -211,6 +211,10 @@ public abstract class Entity extends Node { * @param killer The killer of this entity. */ public void finalizeDeath(Entity killer) { + if (killer.isPlayer()) { + if (!((Player)killer).isArtificial()) + ((Player)killer).getStatisticsManager().getENTITIES_KILLED().incrementAmount(); + } skills.restore(); skills.rechargePrayerPoints(); impactHandler.getImpactQueue().clear(); diff --git a/Server/src/org/crandor/game/node/entity/player/Player.java b/Server/src/org/crandor/game/node/entity/player/Player.java index 750c501d6..f77f26de0 100644 --- a/Server/src/org/crandor/game/node/entity/player/Player.java +++ b/Server/src/org/crandor/game/node/entity/player/Player.java @@ -65,6 +65,7 @@ import org.crandor.game.node.entity.player.link.prayer.PrayerType; import org.crandor.game.node.entity.player.link.quest.QuestRepository; import org.crandor.game.node.entity.player.link.request.RequestManager; import org.crandor.game.node.entity.player.link.skillertasks.SkillerTasks; +import org.crandor.game.node.entity.player.link.statistics.PlayerStatisticsManager; import org.crandor.game.node.item.GroundItem; import org.crandor.game.node.item.GroundItemManager; import org.crandor.game.node.item.Item; @@ -99,6 +100,7 @@ import org.crandor.net.packet.out.SkillLevel; import org.crandor.net.packet.out.UpdateSceneGraph; import org.crandor.plugin.Plugin; import org.crandor.tools.StringUtils; + import plugin.activity.pyramidplunder.PlunderObjectManager; /** @@ -302,6 +304,11 @@ public class Player extends Entity { * The jobs minigame manager. */ private final JobsMinigameManager jobsManager = new JobsMinigameManager(this); + + /** + * The statistics manager. + */ + private final PlayerStatisticsManager statisticsManager = new PlayerStatisticsManager(this); /** * The logout plugins. @@ -534,6 +541,10 @@ public class Player extends Entity { return; } getPacketDispatch().sendMessage("Oh dear, you are dead!"); + + if (!isArtificial()) { + getStatisticsManager().getDEATHS().incrementAmount(); + } //If player was a Hardcore Ironman, announce that they died if (this.getIronmanManager().getMode().equals(IronmanMode.HARDCORE)){ //if this was checkRestriction, ultimate irons would be moved to HARDCORE_DEAD as well @@ -1340,4 +1351,8 @@ public class Player extends Entity { public JobsMinigameManager getJobsManager() { return jobsManager; } + + public PlayerStatisticsManager getStatisticsManager() { + return statisticsManager; + } } \ No newline at end of file diff --git a/Server/src/org/crandor/game/node/entity/player/info/login/PlayerParser.java b/Server/src/org/crandor/game/node/entity/player/info/login/PlayerParser.java index a0656b609..5c19f2705 100644 --- a/Server/src/org/crandor/game/node/entity/player/info/login/PlayerParser.java +++ b/Server/src/org/crandor/game/node/entity/player/info/login/PlayerParser.java @@ -149,6 +149,9 @@ public final class PlayerParser { case 46: player.getSkills().parseExpRate(buffer); break; + case 47: + player.getStatisticsManager().parse(buffer); + break; default: System.err.println("[Player parsing] Unhandled opcode: " + opcode + " for " + player.getName() + " - [log=" + Arrays.toString(opcodeLog) + "]."); break; @@ -302,6 +305,8 @@ public final class PlayerParser { } player.getSkills().saveExpRate(buffer.put((byte) 46)); + + player.getStatisticsManager().save(buffer.put((byte)47)); buffer.put((byte) 0); // EOF opcode buffer.flip(); diff --git a/Server/src/org/crandor/game/node/entity/player/link/statistics/PlayerStatisticsManager.java b/Server/src/org/crandor/game/node/entity/player/link/statistics/PlayerStatisticsManager.java new file mode 100644 index 000000000..8978a5aa9 --- /dev/null +++ b/Server/src/org/crandor/game/node/entity/player/link/statistics/PlayerStatisticsManager.java @@ -0,0 +1,115 @@ +package org.crandor.game.node.entity.player.link.statistics; + +import java.nio.ByteBuffer; +import java.util.ArrayList; + +import org.crandor.game.node.entity.player.Player; +import org.crandor.game.node.entity.player.info.login.SavingModule; + +/** + * Stuff + * @author jamix77 + * + */ +public class PlayerStatisticsManager implements SavingModule { + + /** + * Array of statistics. + */ + private final ArrayList STATISTICS = new ArrayList(); + + + private Statistic + AL_KHARID_GATE_PASSES, + FLAX_PICKED, + CLUES_COMPLETED, + ENTITIES_KILLED, + DEATHS, + LOGS_OBTAINED; + + + /** + * The player instance for this manager. + */ + private final Player player; + + + public PlayerStatisticsManager(Player player) { + this.player = player; + if (!player.isArtificial()) + initStats(); + } + + private void initStats() { + AL_KHARID_GATE_PASSES = new Statistic(player,this); + FLAX_PICKED = new Statistic(player,this); + CLUES_COMPLETED = new Statistic(player,this); + LOGS_OBTAINED = new Statistic(player,this); + ENTITIES_KILLED = new Statistic(player,this); + DEATHS = new Statistic(player,this); + } + + @Override + public void save(ByteBuffer buffer) { + for (int i = 0; i < STATISTICS.size(); i++) { + Statistic s = STATISTICS.get(i); + buffer.put((byte) 1).putInt(i).putInt(s.getStatisticalAmount()); + } + buffer.put((byte)0); + } + + @Override + public void parse(ByteBuffer buffer) { + int opcode; + while ((opcode = buffer.get() & 0xFF) != 0) { + switch (opcode) { + case 1: + int index = buffer.getInt(); + int amount = buffer.getInt(); + STATISTICS.get(index).setStatisticalAmount(amount); + break; + } + } + + } + + /** + * Add a statistic to the arraylist. + * @param statistic + */ + public void addStatistic(Statistic statistic) { + STATISTICS.add(statistic); + } + + + public ArrayList getSTATISTICS() { + return STATISTICS; + } + + public Statistic getAL_KHARID_GATE_PASSES() { + return AL_KHARID_GATE_PASSES; + } + + public Statistic getFLAX_PICKED() { + return FLAX_PICKED; + } + + public Statistic getCLUES_COMPLETED() { + return CLUES_COMPLETED; + } + + public Statistic getLOGS_OBTAINED() { + return LOGS_OBTAINED; + } + + public Statistic getENTITIES_KILLED() { + return ENTITIES_KILLED; + } + + public Statistic getDEATHS() { + return DEATHS; + } + + + +} diff --git a/Server/src/org/crandor/game/node/entity/player/link/statistics/Statistic.java b/Server/src/org/crandor/game/node/entity/player/link/statistics/Statistic.java new file mode 100644 index 000000000..56878b1b5 --- /dev/null +++ b/Server/src/org/crandor/game/node/entity/player/link/statistics/Statistic.java @@ -0,0 +1,85 @@ +package org.crandor.game.node.entity.player.link.statistics; + +import org.crandor.game.node.entity.player.Player; + +/** + * A singular statistic. + * @author jamix77 + * + */ +public class Statistic { + + /** + * The player instance for this manager. + */ + private final Player player; + + /** + * The amount of the statistic. + */ + private int statisticalAmount; + + /** + * + * Constructs a new @{Code Statistic} object. + * @param player + */ + public Statistic(Player player, PlayerStatisticsManager sm) { + this(player,0,sm); + } + + /** + * + * Constructs a new @{Code Statistic} object. + * @param player + * @param amount + */ + public Statistic(Player player,int amount, PlayerStatisticsManager sm) { + this.player = player; + this.statisticalAmount = amount; + sm.addStatistic(this); + } + + /** + * Increase only by one. + */ + public void incrementAmount() { + increaseAmount(1); + } + + /** + * Decrease only by one. + */ + public void decrementAmount() { + decreaseAmount(1); + } + + /** + * Increase by a certain amount. + * @param amount + */ + public void increaseAmount(int amount) { + statisticalAmount += amount; + } + + /** + * Decrease by a certain amount. + * @param amount + */ + public void decreaseAmount(int amount) { + statisticalAmount -= amount; + } + + /** + * @return the amount + */ + public int getStatisticalAmount() { + return statisticalAmount; + } + + public void setStatisticalAmount(int statisticalAmount) { + this.statisticalAmount = statisticalAmount; + } + + +} diff --git a/Server/src/plugin/command/DeveloperCommandPlugin.java b/Server/src/plugin/command/DeveloperCommandPlugin.java index 34d7a0e62..a8b5d3737 100644 --- a/Server/src/plugin/command/DeveloperCommandPlugin.java +++ b/Server/src/plugin/command/DeveloperCommandPlugin.java @@ -26,6 +26,7 @@ import org.crandor.game.node.entity.player.ai.resource.ResourceAIPManager; import org.crandor.game.node.entity.player.info.login.PlayerParser; import org.crandor.game.node.entity.player.link.IronmanMode; import org.crandor.game.node.entity.player.link.appearance.Gender; +import org.crandor.game.node.entity.player.link.music.MusicEntry; import org.crandor.game.node.entity.player.link.quest.Quest; import org.crandor.game.node.entity.player.link.skillertasks.Difficulty; import org.crandor.game.node.entity.state.EntityState; @@ -100,6 +101,17 @@ public final class DeveloperCommandPlugin extends CommandPlugin { @Override public boolean parse(final Player player, String name, String[] args) { switch (name) { + case "unlockmusic": + for (MusicEntry me : MusicEntry.getSongs().values()) { + player.getMusicPlayer().unlock(me.getId()); + } + + break; + + case "playsong": + player.getMusicPlayer().play(MusicEntry.getSongs().get(Integer.parseInt(args[1]))); + player.sendMessage("Playing song: " + MusicEntry.getSongs().get(Integer.parseInt(args[1])).getName()); + break; case "find": try { player.getAttributes().put("spawning_items", true); diff --git a/Server/src/plugin/command/PlayerCommandPlugin.java b/Server/src/plugin/command/PlayerCommandPlugin.java index b8190196f..be9e68f77 100644 --- a/Server/src/plugin/command/PlayerCommandPlugin.java +++ b/Server/src/plugin/command/PlayerCommandPlugin.java @@ -2,8 +2,11 @@ package plugin.command; import org.crandor.ServerConstants; import org.crandor.game.component.Component; +import org.crandor.game.content.skill.Skills; import org.crandor.game.node.entity.player.Player; +import org.crandor.game.node.entity.player.info.PlayerDetails; import org.crandor.game.node.entity.player.info.Rights; +import org.crandor.game.node.entity.player.info.login.PlayerParser; import org.crandor.game.node.entity.player.link.IronmanMode; import org.crandor.game.node.entity.player.link.RunScript; import org.crandor.game.node.entity.player.link.quest.Quest; @@ -53,6 +56,18 @@ public final class PlayerCommandPlugin extends CommandPlugin { TutorialStage.load(player, stage, false); break; */ + + case "stats": + if (arguments.length < 2) { + player.sendMessage("You must enter a name to search!"); + } + try { + Player target = new Player(PlayerDetails.getDetails(arguments[1])); + PlayerParser.parse(target); + if (!target.getDetails().parse()) break; + sendHiscore(player,target); + } catch (Exception e) {} + break; case "shop": CREDIT_STORE.open(player); @@ -254,6 +269,34 @@ public final class PlayerCommandPlugin extends CommandPlugin { player.getPacketDispatch().sendString("::bankresettabs", 275, lineId++); player.getPacketDispatch().sendString("Reset all of your bank tabs.", 275, lineId++); } + + private void sendHiscore(Player player, Player target) { + if (player.getInterfaceManager().isOpened()) { + player.sendMessage("Finish what you're currently doing."); + return; + } + player.getInterfaceManager().open(new Component(275)); + //CLear old data + for (int i = 0; i < 311; i++) { + player.getPacketDispatch().sendString("", 275, i); + } + // Title + player.getPacketDispatch().sendString("" + target.getUsername() + "'s stats.", 275, 2); + + // Content + int lineId = 11; + player.getPacketDispatch().sendString("Total level: " + target.getSkills().getTotalLevel(), 275, lineId++); + player.getPacketDispatch().sendString("Total xp: " + StringUtils.getFormattedNumber(target.getSkills().getTotalXp()), 275, lineId++); + for (int i = 0; i < Skills.SKILL_NAME.length; i++) { + player.getPacketDispatch().sendString("" + Skills.SKILL_NAME[i] + ": " + target.getSkills().getLevel(i) + " (" + StringUtils.getFormattedNumber((int) Math.round(target.getSkills().getExperience(i))) + ")", 275, lineId++); + } + player.getPacketDispatch().sendString("(Since 27/03/2020) Al kharid passes: " + target.getStatisticsManager().getAL_KHARID_GATE_PASSES().getStatisticalAmount(), 275, lineId++); + player.getPacketDispatch().sendString("(Since 27/03/2020) Logs chopped: " + target.getStatisticsManager().getLOGS_OBTAINED().getStatisticalAmount(), 275, lineId++); + player.getPacketDispatch().sendString("(Since 27/03/2020) Flax picked: " + target.getStatisticsManager().getFLAX_PICKED().getStatisticalAmount(), 275, lineId++); + player.getPacketDispatch().sendString("(Since 27/03/2020) Clue scrolls completed: " + target.getStatisticsManager().getCLUES_COMPLETED().getStatisticalAmount(), 275, lineId++); + player.getPacketDispatch().sendString("(Since 27/03/2020) Enemies killed: " + target.getStatisticsManager().getENTITIES_KILLED().getStatisticalAmount(), 275, lineId++); + player.getPacketDispatch().sendString("(Since 27/03/2020) Deaths: " + target.getStatisticsManager().getDEATHS().getStatisticalAmount(), 275, lineId++); + } /** * Sends information about donating. diff --git a/Server/src/plugin/dialogue/BorderGuardDialogue.java b/Server/src/plugin/dialogue/BorderGuardDialogue.java index 7641844ac..6303b87c3 100644 --- a/Server/src/plugin/dialogue/BorderGuardDialogue.java +++ b/Server/src/plugin/dialogue/BorderGuardDialogue.java @@ -103,6 +103,7 @@ public final class BorderGuardDialogue extends DialoguePlugin { } if (player.getInventory().remove(COINS)) { DoorActionHandler.handleAutowalkDoor(player, door); + player.getStatisticsManager().getAL_KHARID_GATE_PASSES().incrementAmount(); } else { player.getPacketDispatch().sendMessage("You need 10 gold coins to pay the toll."); } diff --git a/Server/src/plugin/interaction/object/FieldPickingPlugin.java b/Server/src/plugin/interaction/object/FieldPickingPlugin.java index 7f8eb79a0..34d8dee0e 100644 --- a/Server/src/plugin/interaction/object/FieldPickingPlugin.java +++ b/Server/src/plugin/interaction/object/FieldPickingPlugin.java @@ -120,6 +120,7 @@ public final class FieldPickingPlugin extends OptionHandler { int charge = object.getCharge(); player.getAudioManager().send(2581); player.getPacketDispatch().sendMessage("You pick some flax."); + player.getStatisticsManager().getFLAX_PICKED().incrementAmount(); if (charge > 1000 + RandomFunction.random(2, 8)) { object.setActive(false); object.setCharge(1000); diff --git a/Server/src/plugin/interaction/object/TollGateOptionPlugin.java b/Server/src/plugin/interaction/object/TollGateOptionPlugin.java index 88e3409b7..15197865a 100644 --- a/Server/src/plugin/interaction/object/TollGateOptionPlugin.java +++ b/Server/src/plugin/interaction/object/TollGateOptionPlugin.java @@ -25,6 +25,7 @@ public class TollGateOptionPlugin extends OptionHandler { player.getInventory().remove(new Item(995, 10)); player.getPacketDispatch().sendMessage("You quickly pay the 10 gold toll and go through the gates."); DoorActionHandler.handleAutowalkDoor(player, (GameObject) node); + player.getStatisticsManager().getAL_KHARID_GATE_PASSES().incrementAmount(); return true; } else { player.getPacketDispatch().sendMessage("You need 10 gold to pass through the gates."); From 69e65680ec5df6360c724ad1fd904ed3608e369f Mon Sep 17 00:00:00 2001 From: jamix77 <> Date: Fri, 27 Mar 2020 15:49:56 +0000 Subject: [PATCH 04/11] More statistics!! Added more stuff to the statistics tab. and made it easier to search for players, and wont throw errors if a wrong name is added. Good stuff me. RAWR :3 --- .../plugin/command/PlayerCommandPlugin.java | 41 +++++++++++++++---- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/Server/src/plugin/command/PlayerCommandPlugin.java b/Server/src/plugin/command/PlayerCommandPlugin.java index be9e68f77..7c823f33b 100644 --- a/Server/src/plugin/command/PlayerCommandPlugin.java +++ b/Server/src/plugin/command/PlayerCommandPlugin.java @@ -9,6 +9,7 @@ import org.crandor.game.node.entity.player.info.Rights; import org.crandor.game.node.entity.player.info.login.PlayerParser; import org.crandor.game.node.entity.player.link.IronmanMode; import org.crandor.game.node.entity.player.link.RunScript; +import org.crandor.game.node.entity.player.link.music.MusicEntry; import org.crandor.game.node.entity.player.link.quest.Quest; import org.crandor.game.node.entity.player.link.quest.QuestRepository; import org.crandor.game.system.command.CommandPlugin; @@ -58,15 +59,25 @@ public final class PlayerCommandPlugin extends CommandPlugin { */ case "stats": - if (arguments.length < 2) { - player.sendMessage("You must enter a name to search!"); - } - try { - Player target = new Player(PlayerDetails.getDetails(arguments[1])); - PlayerParser.parse(target); - if (!target.getDetails().parse()) break; - sendHiscore(player,target); - } catch (Exception e) {} + + + player.setAttribute("runscript", new RunScript() { + @Override + public boolean handle() { + try { + Player target = new Player(PlayerDetails.getDetails((String)value)); + PlayerParser.parse(target); + if (!target.getDetails().parse()) return true; + sendHiscore(player,target); + } + catch (Exception e) {player.getDialogueInterpreter().sendPlainMessage(false, "That isn't a valid name.");} + return true; + } + }); + player.getDialogueInterpreter().sendInput(true, "Enter a username:"); + + + break; case "shop": @@ -290,12 +301,24 @@ public final class PlayerCommandPlugin extends CommandPlugin { for (int i = 0; i < Skills.SKILL_NAME.length; i++) { player.getPacketDispatch().sendString("" + Skills.SKILL_NAME[i] + ": " + target.getSkills().getLevel(i) + " (" + StringUtils.getFormattedNumber((int) Math.round(target.getSkills().getExperience(i))) + ")", 275, lineId++); } + + //stats player.getPacketDispatch().sendString("(Since 27/03/2020) Al kharid passes: " + target.getStatisticsManager().getAL_KHARID_GATE_PASSES().getStatisticalAmount(), 275, lineId++); player.getPacketDispatch().sendString("(Since 27/03/2020) Logs chopped: " + target.getStatisticsManager().getLOGS_OBTAINED().getStatisticalAmount(), 275, lineId++); player.getPacketDispatch().sendString("(Since 27/03/2020) Flax picked: " + target.getStatisticsManager().getFLAX_PICKED().getStatisticalAmount(), 275, lineId++); player.getPacketDispatch().sendString("(Since 27/03/2020) Clue scrolls completed: " + target.getStatisticsManager().getCLUES_COMPLETED().getStatisticalAmount(), 275, lineId++); player.getPacketDispatch().sendString("(Since 27/03/2020) Enemies killed: " + target.getStatisticsManager().getENTITIES_KILLED().getStatisticalAmount(), 275, lineId++); player.getPacketDispatch().sendString("(Since 27/03/2020) Deaths: " + target.getStatisticsManager().getDEATHS().getStatisticalAmount(), 275, lineId++); + player.getPacketDispatch().sendString("Music tracks unlocked: " + target.getMusicPlayer().getUnlocked().size() + "/" + MusicEntry.getSongs().size(), 275, lineId++); + + + //quests + player.getPacketDispatch().sendString("", 275, lineId++); + player.getPacketDispatch().sendString("Quests Completed:", 275, lineId++); + for (Quest q : QuestRepository.getQuests().values()) { + player.getPacketDispatch().sendString("" + (q.isCompleted(target) ? "" : "") + q.getName() + " ", 275, lineId++); + } + } /** From c6035cced774de8a492042ce45c9a11d88f995a9 Mon Sep 17 00:00:00 2001 From: jamix77 <> Date: Fri, 27 Mar 2020 16:18:50 +0000 Subject: [PATCH 05/11] Quick update Added icons to the name part!! --- Server/src/plugin/command/PlayerCommandPlugin.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Server/src/plugin/command/PlayerCommandPlugin.java b/Server/src/plugin/command/PlayerCommandPlugin.java index 7c823f33b..f7b5da96c 100644 --- a/Server/src/plugin/command/PlayerCommandPlugin.java +++ b/Server/src/plugin/command/PlayerCommandPlugin.java @@ -57,7 +57,6 @@ public final class PlayerCommandPlugin extends CommandPlugin { TutorialStage.load(player, stage, false); break; */ - case "stats": @@ -292,7 +291,10 @@ public final class PlayerCommandPlugin extends CommandPlugin { player.getPacketDispatch().sendString("", 275, i); } // Title - player.getPacketDispatch().sendString("" + target.getUsername() + "'s stats.", 275, 2); + //14 Ult IM + //13 IM + //15 HCIM + player.getPacketDispatch().sendString("" + (target.getRights() == Rights.ADMINISTRATOR ? "" : (target.getRights() == Rights.PLAYER_MODERATOR ? "" : (target.getIronmanManager().getMode() == IronmanMode.STANDARD ? "" : (target.getIronmanManager().getMode() == IronmanMode.ULTIMATE ? "" : (target.getIronmanManager().getMode() == IronmanMode.HARDCORE ? "" : ""))))) + "" + target.getUsername() + "'s stats.", 275, 2); // Content int lineId = 11; From fa37dc1b5af473e4fa3f4f5a79ef3b2241bcb7b5 Mon Sep 17 00:00:00 2001 From: jamix77 <> Date: Fri, 27 Mar 2020 19:16:55 +0000 Subject: [PATCH 06/11] Fixed levels Fixed the levels display! Was dynamic one now the static one! --- Server/src/plugin/command/PlayerCommandPlugin.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Server/src/plugin/command/PlayerCommandPlugin.java b/Server/src/plugin/command/PlayerCommandPlugin.java index f7b5da96c..8550db010 100644 --- a/Server/src/plugin/command/PlayerCommandPlugin.java +++ b/Server/src/plugin/command/PlayerCommandPlugin.java @@ -301,7 +301,7 @@ public final class PlayerCommandPlugin extends CommandPlugin { player.getPacketDispatch().sendString("Total level: " + target.getSkills().getTotalLevel(), 275, lineId++); player.getPacketDispatch().sendString("Total xp: " + StringUtils.getFormattedNumber(target.getSkills().getTotalXp()), 275, lineId++); for (int i = 0; i < Skills.SKILL_NAME.length; i++) { - player.getPacketDispatch().sendString("" + Skills.SKILL_NAME[i] + ": " + target.getSkills().getLevel(i) + " (" + StringUtils.getFormattedNumber((int) Math.round(target.getSkills().getExperience(i))) + ")", 275, lineId++); + player.getPacketDispatch().sendString("" + Skills.SKILL_NAME[i] + ": " + target.getSkills().getStaticLevel(i) + " (" + StringUtils.getFormattedNumber((int) Math.round(target.getSkills().getExperience(i))) + ")", 275, lineId++); } //stats From 3338a6343adb8a18e09f09b310d75def3a459967 Mon Sep 17 00:00:00 2001 From: dginovker Date: Fri, 27 Mar 2020 23:14:06 -0400 Subject: [PATCH 07/11] Improve PC bots --- Server/data/botdata/namesandarmor.txt | 2 - Server/data/botdata/pestcontrolcopies.txt | 12 +- Server/data/eco/grand_exchange_db.emp | Bin 138082 -> 138082 bytes .../org/crandor/game/container/Container.java | 1694 +++++++++-------- .../game/node/entity/player/ai/AIPlayer.java | 11 +- .../minigamebots/pestcontrol/CombatState.java | 10 +- .../pestcontrol/PestControlTestBot.java | 16 +- .../ai/resource/ResourceAIPManager.java | 5 +- .../player/ai/skillingbot/SkillingBot.java | 2 - .../src/plugin/command/AIPCommandPlugin.java | 24 +- 10 files changed, 944 insertions(+), 832 deletions(-) diff --git a/Server/data/botdata/namesandarmor.txt b/Server/data/botdata/namesandarmor.txt index e9945743d..aa642ede3 100644 --- a/Server/data/botdata/namesandarmor.txt +++ b/Server/data/botdata/namesandarmor.txt @@ -41,7 +41,6 @@ wef6qwe4r561:3:0:0:0:0:0:0:0:0:0:0:0:0: Sister 13:3:12600:9793:0:20590:6186:24325:0:13288:0:0:23285:0: IsidraJr:58:0:0:0:0:0:0:0:0:0:0:0:0: BeDeMaSa0891:3:0:0:0:0:0:0:0:0:0:0:0:0: -Jazzy Otto:101:22689:0:22692:1419:22695:0:0:22698:0:0:22701:0: JustSkillezZ:50:1017:0:0:1387:426:0:0:428:0:0:0:0: Elcangri11:39:1017:1007:1727:1381:1035:1199:0:1033:0:1059:1061:0: haroldas 99r:13:1017:1019:1731:843:0:0:0:1015:0:1059:1061:0: @@ -58,7 +57,6 @@ laitukas29:3:0:0:0:0:0:0:0:0:0:0:0:0: AFRODITA-23:38:0:0:0:0:0:0:0:0:0:0:0:0: Monrojas:50:0:1029:1725:1381:0:0:0:1099:0:1065:1061:0: stejler:114:21266:6570:19553:4151:21301:12954:0:21304:0:7462:11840:0: -r0cK4eV3r:103:11850:11852:0:0:11854:0:0:11856:0:11858:11860:0: Loamjytuner:3:0:0:0:0:0:0:0:0:0:0:0:0: u smoke mid:92:12293:10499:10364:1387:1121:1197:0:1071:0:1065:11840:0: MIMIYEEET:64:0:10499:0:861:0:0:0:0:0:0:0:0: diff --git a/Server/data/botdata/pestcontrolcopies.txt b/Server/data/botdata/pestcontrolcopies.txt index b49c37af7..8227fbbd1 100644 --- a/Server/data/botdata/pestcontrolcopies.txt +++ b/Server/data/botdata/pestcontrolcopies.txt @@ -1 +1,11 @@ -sicriona:103:1163:1023:1725:1333:1127:1201:0:1079:0:2922:1061:0: \ No newline at end of file +#Format: +#name:cblevel:helmet:cape:neck:weapon:chest:shield:unknown:legs:unknown:gloves:boots: +sicriona:103:1163:1023:1725:1333:1127:1201:0:1079:0:2922:1061:0: +czar:110:1149:6568:1704:4587:10564:6524:0:4585:0:1059:1061: +loving puppy:95:11665:6568:1704:4587:8839:14767:0:8840:0:8842:1061: +rattle63:83:14096:10499:1704:4151:14094:14767:0:14095:0:8842:1061: +baluga:110:10828:6568:10354:4151:3140:6524:0:4087:0:8842:11732: +crabcake:115:10828:10446:10354:4151:10564:6524:0:4087:0:8842:11732: +Red:94:1163:6568:10354:7158:10564:0:0:4087:0:1059:11732: +puglet:120:10828:6568:6585:11696:4757:0:0:8840:0:1059:3105: +linux:10000:10828:10069:1725:4151:3140:14767:0:4087:0:1059:3105: diff --git a/Server/data/eco/grand_exchange_db.emp b/Server/data/eco/grand_exchange_db.emp index 162477603efb566c10d60ee300e4a04f571bd202..a464ce8d5a4c1a2a5b30b4822f81cb7ba9b2d11d 100644 GIT binary patch delta 25 gcmaE~jpNZa4h{we#zJ}jsE>^ttsIP7IhdlP0d%qlzW@LL delta 25 hcmaE~jpNZa4h{we#ynr^@An%yS~(cEaxg_n0|0!R2w?yK diff --git a/Server/src/org/crandor/game/container/Container.java b/Server/src/org/crandor/game/container/Container.java index 2c7667d31..e9ebf1932 100644 --- a/Server/src/org/crandor/game/container/Container.java +++ b/Server/src/org/crandor/game/container/Container.java @@ -13,888 +13,954 @@ import java.util.Map; /** * Represents a container which contains items. + * * @author Emperor */ public class Container { - /** - * The item array. A crystalline - */ - private Item[] items; + /** + * The item array. A crystalline + */ + private Item[] items; - /** - * The capacity. - */ - private final int capacity; + /** + * The capacity. + */ + private final int capacity; - /** - * The current sort type. - */ - private SortType sortType; + /** + * The current sort type. + */ + private SortType sortType; - /** - * The current container type. - */ - private final ContainerType type; + /** + * The current container type. + */ + private final ContainerType type; - /** - * The current container event. - */ - private ContainerEvent event; + /** + * The current container event. + */ + private ContainerEvent event; - /** - * The container listeners. - */ - private final List listeners = new ArrayList<>(); + /** + * The container listeners. + */ + private final List listeners = new ArrayList<>(); - /** - * Constructs a new {@code Container} {@code Object}. - * @param capacity The capacity. - */ - public Container(int capacity) { - this(capacity, ContainerType.DEFAULT); - } + /** + * Constructs a new {@code Container} {@code Object}. + * + * @param capacity The capacity. + */ + public Container(int capacity) { + this(capacity, ContainerType.DEFAULT); + } - /** - * Constructs a new {@code Container.java} {@code Object}. - * @param capacity the capacity. - * @param items the items to add. - */ - public Container(int capacity, Item... items) { - this(capacity); - add(items); - } + /** + * Constructs a new {@code Container.java} {@code Object}. + * + * @param capacity the capacity. + * @param items the items to add. + */ + public Container(int capacity, Item... items) { + this(capacity); + add(items); + } - /** - * Constructs a new {@code Container} {@code Object}. - * @param capacity The capacity. - * @param type The container type. - */ - public Container(int capacity, ContainerType type) { - this(capacity, type, SortType.ID); - } + /** + * Constructs a new {@code Container} {@code Object}. + * + * @param capacity The capacity. + * @param type The container type. + */ + public Container(int capacity, ContainerType type) { + this(capacity, type, SortType.ID); + } - /** - * Constructs a new {@code Container} {@code Object}. - * @param capacity The capacity. - * @param type The container type. - * @param sortType The sort type. - */ - public Container(int capacity, ContainerType type, SortType sortType) { - this.capacity = capacity; - this.type = type; - this.items = new Item[capacity]; - this.sortType = sortType; - this.event = new ContainerEvent(capacity); - } + /** + * Constructs a new {@code Container} {@code Object}. + * + * @param capacity The capacity. + * @param type The container type. + * @param sortType The sort type. + */ + public Container(int capacity, ContainerType type, SortType sortType) { + this.capacity = capacity; + this.type = type; + this.items = new Item[capacity]; + this.sortType = sortType; + this.event = new ContainerEvent(capacity); + } - /** - * Registers a container listener. - * @param listener The container listener. - * @return This container instance, for chaining. - */ - public Container register(ContainerListener listener) { - listeners.add(listener); - return this; - } + /** + * Registers a container listener. + * + * @param listener The container listener. + * @return This container instance, for chaining. + */ + public Container register(ContainerListener listener) { + listeners.add(listener); + return this; + } - /** - * Adds the items. - * @param items The items to add. - * @return {@code True} if successfully added all items. - */ - public boolean add(Item... items) { - boolean addedAll = true; - for (Item item : items) { - if (item == null) { - continue; - } - if (!add(item, false)) { - addedAll = false; - break; - } - } - update(); - return addedAll; - } + /** + * Adds the items. + * + * @param items The items to add. + * @return {@code True} if successfully added all items. + */ + public boolean add(Item... items) { + boolean addedAll = true; + for (Item item : items) { + if (item == null) { + continue; + } + if (!add(item, false)) { + addedAll = false; + break; + } + } + update(); + return addedAll; + } - /** - * Inserts an item into a specific slot. - * @param fromSlot The original slot of the item. - * @param toSlot The slot to insert into. - */ - public void insert(int fromSlot, int toSlot) { - insert(fromSlot, toSlot, true); - } + /** + * Inserts an item into a specific slot. + * + * @param fromSlot The original slot of the item. + * @param toSlot The slot to insert into. + */ + public void insert(int fromSlot, int toSlot) { + insert(fromSlot, toSlot, true); + } - /** - * Inserts an item into a specific slot. - * @param fromSlot The original slot of the item. - * @param toSlot The slot to insert into. - * @param update If the container packets should be sent. - */ - public void insert(int fromSlot, int toSlot, boolean update) { - Item temp = items[fromSlot]; - if (toSlot > fromSlot) { - for (int i = fromSlot; i < toSlot; i++) { - replace(get(i + 1), i, false); - } - } else if (fromSlot > toSlot) { - for (int i = fromSlot; i > toSlot; i--) { - replace(get(i - 1), i, false); - } - } - replace(temp, toSlot, update); - } + /** + * Inserts an item into a specific slot. + * + * @param fromSlot The original slot of the item. + * @param toSlot The slot to insert into. + * @param update If the container packets should be sent. + */ + public void insert(int fromSlot, int toSlot, boolean update) { + Item temp = items[fromSlot]; + if (toSlot > fromSlot) { + for (int i = fromSlot; i < toSlot; i++) { + replace(get(i + 1), i, false); + } + } else if (fromSlot > toSlot) { + for (int i = fromSlot; i > toSlot; i--) { + replace(get(i - 1), i, false); + } + } + replace(temp, toSlot, update); + } - /** - * Adds an item to this container if full it goes to ground. - * @param item the item. - * @param player the player. - * @param ground - * @return {@code True} if added. - */ - public boolean add(final Item item, final Player player) { - if (!add(item, true, -1)) { - GroundItemManager.create(item, player); - return false; - } - return true; - } + /** + * Adds an item to this container if full it goes to ground. + * + * @param item the item. + * @param player the player. + * @param ground + * @return {@code True} if added. + */ + public boolean add(final Item item, final Player player) { + if (!add(item, true, -1)) { + GroundItemManager.create(item, player); + return false; + } + return true; + } - public boolean addIfDoesntHave(final Item item) { - if(containsItem(item)) { - return false; - } else { - return add(item); + public boolean addIfDoesntHave(final Item item) { + if (containsItem(item)) { + return false; + } else { + return add(item); - } - } + } + } - /** - * Adds an item to this container. - * @param item The item. - * @return {@code True} if the item got added. - */ - public boolean add(Item item) { - return add(item, true, -1); - } + /** + * Adds an item to this container. + * + * @param item The item. + * @return {@code True} if the item got added. + */ + public boolean add(Item item) { + return add(item, true, -1); + } - /** - * Adds an item to this container. - * @param item The item to add. - * @param fireListener If we should update. - * @param preferredSlot The slot to add the item in, when possible. - * @return {@code True} if the item got added. - */ - public boolean add(Item item, boolean fireListener) { - return add(item, fireListener, -1); - } + /** + * Adds an item to this container. + * + * @param item The item to add. + * @param fireListener If we should update. + * @param preferredSlot The slot to add the item in, when possible. + * @return {@code True} if the item got added. + */ + public boolean add(Item item, boolean fireListener) { + return add(item, fireListener, -1); + } - /** - * Adds an item to this container. - * @param item The item to add. - * @param fireListener If we should update. - * @param preferredSlot The slot to add the item in, when possible. - * @return {@code True} if the item got added. - */ - public boolean add(Item item, boolean fireListener, int preferredSlot) { - item = item.copy(); - int maximum = getMaximumAdd(item); - if (maximum == 0) { - return false; - } + /** + * Adds an item to this container. + * + * @param item The item to add. + * @param fireListener If we should update. + * @param preferredSlot The slot to add the item in, when possible. + * @return {@code True} if the item got added. + */ + public boolean add(Item item, boolean fireListener, int preferredSlot) { + item = item.copy(); + int maximum = getMaximumAdd(item); + if (maximum == 0) { + return false; + } // if (preferredSlot > -1 && items[preferredSlot] != null) { // preferredSlot = -1; // } - if (item.getAmount() > maximum) { - item.setAmount(maximum); - } - if (type != ContainerType.NEVER_STACK && (item.getDefinition().isStackable() || type == ContainerType.ALWAYS_STACK || type == ContainerType.SHOP)) { - boolean hashBased = sortType == SortType.HASH; - for (int i = 0; i < items.length; i++) { - if (items[i] != null) { - if ((hashBased && items[i].getIdHash() == item.getIdHash()) || (!hashBased && items[i].getId() == item.getId())) { - int totalCount = item.getAmount() + items[i].getAmount(); - items[i] = new Item(items[i].getId(), totalCount, item.getCharge()); - items[i].setIndex(i); - event.flag(i, items[i]); - if (fireListener) { - update(); - } - return true; - } - } - } - int slot = preferredSlot > -1 ? preferredSlot : freeSlot(); - if (slot == -1) { - return false; - } - items[slot] = item; - item.setIndex(slot); - event.flag(slot, item); - if (fireListener) { - update(); - } - return true; - } - int slots = freeSlots(); - if (slots >= item.getAmount()) { - for (int i = 0; i < item.getAmount(); i++) { - int slot = i == 0 && preferredSlot > -1 ? preferredSlot : freeSlot(); - items[slot] = new Item(item.getId(), 1, item.getCharge()); - items[slot].setIndex(slot); - event.flag(slot, items[slot]); - } - if (fireListener) { - update(); - } - return true; - } - return false; - } + if (item.getAmount() > maximum) { + item.setAmount(maximum); + } + if (type != ContainerType.NEVER_STACK && (item.getDefinition().isStackable() || type == ContainerType.ALWAYS_STACK || type == ContainerType.SHOP)) { + boolean hashBased = sortType == SortType.HASH; + for (int i = 0; i < items.length; i++) { + if (items[i] != null) { + if ((hashBased && items[i].getIdHash() == item.getIdHash()) || (!hashBased && items[i].getId() == item.getId())) { + int totalCount = item.getAmount() + items[i].getAmount(); + items[i] = new Item(items[i].getId(), totalCount, item.getCharge()); + items[i].setIndex(i); + event.flag(i, items[i]); + if (fireListener) { + update(); + } + return true; + } + } + } + int slot = preferredSlot > -1 ? preferredSlot : freeSlot(); + if (slot == -1) { + return false; + } + items[slot] = item; + item.setIndex(slot); + event.flag(slot, item); + if (fireListener) { + update(); + } + return true; + } + int slots = freeSlots(); + if (slots >= item.getAmount()) { + for (int i = 0; i < item.getAmount(); i++) { + int slot = i == 0 && preferredSlot > -1 ? preferredSlot : freeSlot(); + items[slot] = new Item(item.getId(), 1, item.getCharge()); + items[slot].setIndex(slot); + event.flag(slot, items[slot]); + } + if (fireListener) { + update(); + } + return true; + } + return false; + } - /** - * Removes a set of items. - * @param items The set of items. - * @return {@code True} if all items got successfully removed. - */ - public boolean remove(Item... items) { - boolean removedAll = true; - for (Item item : items) { - if (!remove(item, false)) { - removedAll = false; - } - } - update(); - return removedAll; - } + /** + * Removes a set of items. + * + * @param items The set of items. + * @return {@code True} if all items got successfully removed. + */ + public boolean remove(Item... items) { + boolean removedAll = true; + for (Item item : items) { + if (!remove(item, false)) { + removedAll = false; + } + } + update(); + return removedAll; + } - /** - * Removes an item. - * @param item The item. - * @return {@code True} if the item got removed, {@code false} if not. - */ - public boolean remove(Item item) { - return remove(item, true); - } + /** + * Removes an item. + * + * @param item The item. + * @return {@code True} if the item got removed, {@code false} if not. + */ + public boolean remove(Item item) { + return remove(item, true); + } - /** - * Removes an item. - * @param item The item to remove. - * @param fireListener If the fire listener should be "notified". - * @return {@code True} if the item got removed,
{@code false} if not. - */ - public boolean remove(Item item, boolean fireListener) { - int slot = getSlot(item); - if (slot != -1) { - return remove(item, slot, fireListener); - } - return false; - } + /** + * Removes an item. + * + * @param item The item to remove. + * @param fireListener If the fire listener should be "notified". + * @return {@code True} if the item got removed,
{@code false} if not. + */ + public boolean remove(Item item, boolean fireListener) { + int slot = getSlot(item); + if (slot != -1) { + return remove(item, slot, fireListener); + } + return false; + } - /** - * Removes an item from this container. - * @param item The item. - * @param slot The item slot. - * @param fireListener If the fire listener should be "notified". - * @return {@code True} if the item got removed,
{@code false} if the - * item on the slot was null or the ids didn't match. - */ - public boolean remove(Item item, int slot, boolean fireListener) { - Item oldItem = items[slot]; - if (oldItem == null || oldItem.getId() != item.getId()) { - return false; - } - if (item.getAmount() < 1) { - return true; - } - if (oldItem.getDefinition().isStackable() || type.equals(ContainerType.ALWAYS_STACK) || type == ContainerType.SHOP) { - if (item.getAmount() >= oldItem.getAmount()) { - items[slot] = null; - event.flagNull(slot); - if (fireListener) { - update(); - } - return true; - } - items[slot] = new Item(item.getId(), oldItem.getAmount() - item.getAmount(), item.getCharge()); - items[slot].setIndex(slot); - event.flag(slot, items[slot]); - if (fireListener) { - update(); - } - return true; - } - items[slot] = null; - event.flagNull(slot); - int removed = 1; - for (int i = removed; i < item.getAmount(); i++) { - slot = getSlot(item); - if (slot != -1) { - items[slot] = null; - event.flagNull(slot); - } else { - break; - } - } - if (fireListener) { - update(); - } - return true; - } + /** + * Removes an item from this container. + * + * @param item The item. + * @param slot The item slot. + * @param fireListener If the fire listener should be "notified". + * @return {@code True} if the item got removed,
{@code false} if the + * item on the slot was null or the ids didn't match. + */ + public boolean remove(Item item, int slot, boolean fireListener) { + Item oldItem = items[slot]; + if (oldItem == null || oldItem.getId() != item.getId()) { + return false; + } + if (item.getAmount() < 1) { + return true; + } + if (oldItem.getDefinition().isStackable() || type.equals(ContainerType.ALWAYS_STACK) || type == ContainerType.SHOP) { + if (item.getAmount() >= oldItem.getAmount()) { + items[slot] = null; + event.flagNull(slot); + if (fireListener) { + update(); + } + return true; + } + items[slot] = new Item(item.getId(), oldItem.getAmount() - item.getAmount(), item.getCharge()); + items[slot].setIndex(slot); + event.flag(slot, items[slot]); + if (fireListener) { + update(); + } + return true; + } + items[slot] = null; + event.flagNull(slot); + int removed = 1; + for (int i = removed; i < item.getAmount(); i++) { + slot = getSlot(item); + if (slot != -1) { + items[slot] = null; + event.flagNull(slot); + } else { + break; + } + } + if (fireListener) { + update(); + } + return true; + } - /** - * Replaces the item on the given slot with the argued item. - * @param item The item. - * @param slot The slot. - * @return The old item. - */ - public Item replace(Item item, int slot) { - return replace(item, slot, true); - } + /** + * Replaces the item on the given slot with the argued item. + * + * @param item The item. + * @param slot The slot. + * @return The old item. + */ + public Item replace(Item item, int slot) { + return replace(item, slot, true); + } - /** - * Replaces the item on the given slot with the argued item. - * @param item The item. - * @param slot The slot. - * @param fireListener If the listener should be "notified". - * @return The old item. - */ - public Item replace(Item item, int slot, boolean fireListener) { - if (item != null) { - if (item.getAmount() < 1 && type != ContainerType.SHOP) { - item = null; - } else { - item = item.copy(); - } - } - Item oldItem = items[slot]; - items[slot] = item; - if (item == null) { - event.flagNull(slot); - } else { - item.setIndex(slot); - event.flag(slot, item); - } - if (fireListener) { - update(); - } - return oldItem; - } + /** + * Replaces the item on the given slot with the argued item. + * + * @param item The item. + * @param slot The slot. + * @param fireListener If the listener should be "notified". + * @return The old item. + */ + public Item replace(Item item, int slot, boolean fireListener) { + if (item != null) { + if (item.getAmount() < 1 && type != ContainerType.SHOP) { + item = null; + } else { + item = item.copy(); + } + } + Item oldItem = items[slot]; + items[slot] = item; + if (item == null) { + event.flagNull(slot); + } else { + item.setIndex(slot); + event.flag(slot, item); + } + if (fireListener) { + update(); + } + return oldItem; + } - /** - * Updates the container. - */ - public void update() { - if (event.getChangeCount() < 1 && !event.isClear()) { - return; - } - for (ContainerListener listener : listeners) { - listener.update(this, event); - } - event.setClear(false); - event = new ContainerEvent(capacity); - } + /** + * Updates the container. + */ + public void update() { + if (event.getChangeCount() < 1 && !event.isClear()) { + return; + } + for (ContainerListener listener : listeners) { + listener.update(this, event); + } + event.setClear(false); + event = new ContainerEvent(capacity); + } - /** - * Updates the container. - */ - public void update(boolean force) { - if (event.getChangeCount() < 1 && !force) { - return; - } - for (ContainerListener listener : listeners) { - listener.update(this, event); - } - event = new ContainerEvent(capacity); - } + /** + * Updates the container. + */ + public void update(boolean force) { + if (event.getChangeCount() < 1 && !force) { + return; + } + for (ContainerListener listener : listeners) { + listener.update(this, event); + } + event = new ContainerEvent(capacity); + } - /** - * Refreshes the entire container. - */ - public void refresh() { - for (ContainerListener listener : listeners) { - listener.refresh(this); - } - event = new ContainerEvent(capacity); - } + /** + * Refreshes the entire container. + */ + public void refresh() { + for (ContainerListener listener : listeners) { + listener.refresh(this); + } + event = new ContainerEvent(capacity); + } - /** - * Gets the item on the given slot. - * @param slot The slot. - * @return The item on the slot, or {@code null} if the item wasn't there. - */ - public Item get(int slot) { - if (slot < 0 || slot >= items.length) { - return null; - } - return items[slot]; - } + /** + * Gets the item on the given slot. + * + * @param slot The slot. + * @return The id of the item on the slot, or 0 if the item wasn't there. + */ + public int getAsId(int slot) { + if (slot < 0 || slot >= items.length || items[slot] == null) { + return 0; + } + return items[slot].getId(); + } - /** - * Gets the item on the given slot. - * @param slot The slot. - * @return The item on the slot, or a new constructed item with id 0 if the - * item wasn't there. - */ - public Item getNew(int slot) { - Item item = items[slot]; - if (item != null) { - return item; - } - return new Item(0); - } - /** - * Gets the item id on the given slot. - * @param slot The slot. - * @return The id of the item on the slot. - */ - public int getId(int slot) { - if (slot >= items.length) { - return -1; - } - Item item = items[slot]; - if (item != null) { - return item.getId(); - } - return -1; - } + /** + * Gets the item on the given slot. + * + * @param slot The slot. + * @return The item on the slot, or {@code null} if the item wasn't there. + */ + public Item get(int slot) { + if (slot < 0 || slot >= items.length) { + return null; + } + return items[slot]; + } - /** - * Parses the container data from the byte buffer. - * @param buffer The byte buffer. - * @return The total value of all items (G.E price > Store price > High - * alchemy price). - */ - public int parse(ByteBuffer buffer) { - int slot; - int total = 0; - while ((slot = buffer.getShort()) != -1) { - int id = buffer.getShort() & 0xFFFF; - int amount = buffer.getInt(); - int charge = buffer.getInt(); - if (id >= ItemDefinition.getDefinitions().size() || id < 0 || slot >= items.length || slot < 0) { - continue; - } - Item item = items[slot] = new Item(id, amount, charge); - item.setIndex(slot); - total += item.getValue(); - } - return total; - } + /** + * Gets the item on the given slot. + * + * @param slot The slot. + * @return The item on the slot, or a new constructed item with id 0 if the + * item wasn't there. + */ + public Item getNew(int slot) { + Item item = items[slot]; + if (item != null) { + return item; + } + return new Item(0); + } - /** - * Saves the item data on the byte buffer. - * @param buffer The byte buffer. - * @return The total value of all items (G.E price > Store price > High - * alchemy price). - */ - public long save(ByteBuffer buffer) { - long totalValue = 0; - for (int i = 0; i < items.length; i++) { - Item item = items[i]; - if (item == null) { - continue; - } - buffer.putShort((short) i); - buffer.putShort((short) item.getId()); - buffer.putInt(item.getAmount()); - buffer.putInt(item.getCharge()); - totalValue += item.getValue(); - } - buffer.putShort((short) -1); - return totalValue; - } + /** + * Gets the item id on the given slot. + * + * @param slot The slot. + * @return The id of the item on the slot. + */ + public int getId(int slot) { + if (slot >= items.length) { + return -1; + } + Item item = items[slot]; + if (item != null) { + return item.getId(); + } + return -1; + } - /** - * Copies the container to this container. - * @param c The container to copy. - */ - public void copy(Container c) { - items = new Item[c.items.length]; - for (int i = 0; i < items.length; i++) { - Item it = c.items[i]; - if (it == null) { - continue; - } - items[i] = new Item(it.getId(), it.getAmount(), it.getCharge()); - items[i].setIndex(i); - } - } + /** + * Parses the container data from the byte buffer. + * + * @param buffer The byte buffer. + * @return The total value of all items (G.E price > Store price > High + * alchemy price). + */ + public int parse(ByteBuffer buffer) { + int slot; + int total = 0; + while ((slot = buffer.getShort()) != -1) { + int id = buffer.getShort() & 0xFFFF; + int amount = buffer.getInt(); + int charge = buffer.getInt(); + if (id >= ItemDefinition.getDefinitions().size() || id < 0 || slot >= items.length || slot < 0) { + continue; + } + Item item = items[slot] = new Item(id, amount, charge); + item.setIndex(slot); + total += item.getValue(); + } + return total; + } - /** - * Formats a container for the SQL database. - * @return the string. - */ - public String format() { - String log = ""; - Map map = new HashMap<>(); - Integer old = null; - for (Item item : items) { - if (item != null) { - old = map.get(item.getId()); - map.put(item.getId(), old == null ? item.getAmount() : old + item.getAmount()); + /** + * Saves the item data on the byte buffer. + * + * @param buffer The byte buffer. + * @return The total value of all items (G.E price > Store price > High + * alchemy price). + */ + public long save(ByteBuffer buffer) { + long totalValue = 0; + for (int i = 0; i < items.length; i++) { + Item item = items[i]; + if (item == null) { + continue; + } + buffer.putShort((short) i); + buffer.putShort((short) item.getId()); + buffer.putInt(item.getAmount()); + buffer.putInt(item.getCharge()); + totalValue += item.getValue(); + } + buffer.putShort((short) -1); + return totalValue; + } - } - } - for (int i : map.keySet()) { - log += i + "," + map.get(i) + "|"; - } - if (log.length() > 0 && log.charAt(log.length() - 1) == '|') { - log = log.substring(0, log.length() - 1); - } - return log; - } + /** + * Copies the container to this container. + * + * @param c The container to copy. + */ + public void copy(Container c) { + items = new Item[c.items.length]; + for (int i = 0; i < items.length; i++) { + Item it = c.items[i]; + if (it == null) { + continue; + } + items[i] = new Item(it.getId(), it.getAmount(), it.getCharge()); + items[i].setIndex(i); + } + } - /** - * Checks if the container contains an item. - * @param item the Item - * @return {@code True} if so. - */ - public boolean containsItem(Item item) { - return contains(item.getId(), item.getAmount()); - } + /** + * Formats a container for the SQL database. + * + * @return the string. + */ + public String format() { + String log = ""; + Map map = new HashMap<>(); + Integer old = null; + for (Item item : items) { + if (item != null) { + old = map.get(item.getId()); + map.put(item.getId(), old == null ? item.getAmount() : old + item.getAmount()); - /** - * Checks if the containers contains these items. - * @param items the items. - * @return {@code True} if so. - */ - public boolean containsItems(Item... items) { - for (Item i : items) { - if (!containsItem(i)) { - return false; - } - } - return true; - } + } + } + for (int i : map.keySet()) { + log += i + "," + map.get(i) + "|"; + } + if (log.length() > 0 && log.charAt(log.length() - 1) == '|') { + log = log.substring(0, log.length() - 1); + } + return log; + } - /** - * Checks if the container contains an item. - * @param itemId The item id. - * @param amount The amount. - * @return {@code True} if so. - */ - public boolean contains(int itemId, int amount) { - int count = 0; - for (Item item : items) { - if (item != null && item.getId() == itemId) { - if ((count += item.getAmount()) >= amount) { - return true; - } - } - } - return false; - } + /** + * Checks if the container contains an item. + * + * @param item the Item + * @return {@code True} if so. + */ + public boolean containsItem(Item item) { + return contains(item.getId(), item.getAmount()); + } - /** - * Checks if the containers contains ONE item. - * @param itemId - * @return - */ - public boolean containsOneItem(int itemId) { - for (Item item : items) { - if (item != null && item.getId() == itemId && item.getAmount() == 1) { - return true; - } - } - return false; - } - - /** - * Checks if the container contains all items. - * @param the itemIds to check - * @return {@code True} if so. - */ - public boolean containsAll(int...itemIds) { - for (int i : itemIds) { - if (!containsOneItem(i)) { - return false; - } - } - return true; - } + /** + * Checks if the containers contains these items. + * + * @param items the items. + * @return {@code True} if so. + */ + public boolean containsItems(Item... items) { + for (Item i : items) { + if (!containsItem(i)) { + return false; + } + } + return true; + } - /** - * Adds a container to this container. - * @param container The container. - */ - public void addAll(Container container) { - add(container.items); - } + /** + * Checks if the container contains an item. + * + * @param itemId The item id. + * @param amount The amount. + * @return {@code True} if so. + */ + public boolean contains(int itemId, int amount) { + int count = 0; + for (Item item : items) { + if (item != null && item.getId() == itemId) { + if ((count += item.getAmount()) >= amount) { + return true; + } + } + } + return false; + } - /** - * Checks the maximum amount of this item we can add. - * @param item The item. - * @return The maximum amount we can add. - */ - public int getMaximumAdd(Item item) { - if (type != ContainerType.NEVER_STACK) { - if (item.getDefinition().isStackable() || type == ContainerType.ALWAYS_STACK || type == ContainerType.SHOP) { - if (contains(item.getId(), 1)) { - return Integer.MAX_VALUE - getAmount(item); - } - return freeSlots() > 0 ? Integer.MAX_VALUE : 0; - } - } - return freeSlots(); - } + /** + * Checks if the containers contains ONE item. + * + * @param itemId + * @return + */ + public boolean containsOneItem(int itemId) { + for (Item item : items) { + if (item != null && item.getId() == itemId && item.getAmount() == 1) { + return true; + } + } + return false; + } - /** - * Checks if the container has space for the item. - * @param item The item to check. - * @return {@code True} if so. - */ - public boolean hasSpaceFor(Item item) { - return item.getAmount() <= getMaximumAdd(item); - } + /** + * Checks if the container contains all items. + * + * @param the itemIds to check + * @return {@code True} if so. + */ + public boolean containsAll(int... itemIds) { + for (int i : itemIds) { + if (!containsOneItem(i)) { + return false; + } + } + return true; + } - /** - * Checks if this container has space to add the other container. - * @param c The other container. - * @return {@code True} if so. - */ - public boolean hasSpaceFor(Container c) { - if (c == null) { - return false; - } - Container check = new Container(capacity, type); - check.addAll(this); - for (Item item : c.items) { - if (item != null) { - if (!check.add(item, false)) { - return false; - } - } - } - return true; - } + /** + * Adds a container to this container. + * + * @param container The container. + */ + public void addAll(Container container) { + add(container.items); + } - /** - * Gets the item slot. - * @param item The item. - * @return The slot of the item in this container. - */ - public int getSlot(Item item) { - if (item == null) { - return -1; - } - int id = item.getId(); - for (int i = 0; i < items.length; i++) { - Item it = items[i]; - if (it != null && it.getId() == id) { - return i; - } - } - return -1; - } + /** + * Checks the maximum amount of this item we can add. + * + * @param item The item. + * @return The maximum amount we can add. + */ + public int getMaximumAdd(Item item) { + if (type != ContainerType.NEVER_STACK) { + if (item.getDefinition().isStackable() || type == ContainerType.ALWAYS_STACK || type == ContainerType.SHOP) { + if (contains(item.getId(), 1)) { + return Integer.MAX_VALUE - getAmount(item); + } + return freeSlots() > 0 ? Integer.MAX_VALUE : 0; + } + } + return freeSlots(); + } - /** - * Gets the item instance. - * @param item the item. - * @return the item. - */ - public Item getItem(Item item) { - return get(getSlot(item)); - } + /** + * Checks if the container has space for the item. + * + * @param item The item to check. + * @return {@code True} if so. + */ + public boolean hasSpaceFor(Item item) { + return item.getAmount() <= getMaximumAdd(item); + } - /** - * Gets the next free slot. - * @return The slot, or -1 if there are no available slots. - */ - public int freeSlot() { - for (int i = 0; i < items.length; i++) { - if (items[i] == null) { - return i; - } - } - return -1; - } + /** + * Checks if this container has space to add the other container. + * + * @param c The other container. + * @return {@code True} if so. + */ + public boolean hasSpaceFor(Container c) { + if (c == null) { + return false; + } + Container check = new Container(capacity, type); + check.addAll(this); + for (Item item : c.items) { + if (item != null) { + if (!check.add(item, false)) { + return false; + } + } + } + return true; + } - /** - * Gets the slot of where to add the item. - * @param item The item to add. - * @return The slot where the item will go. - */ - public int getAddSlot(Item item) { - if (type != ContainerType.NEVER_STACK && (item.getDefinition().isStackable() || type.equals(ContainerType.ALWAYS_STACK) || type == ContainerType.SHOP)) { - boolean hashBased = sortType == SortType.HASH; - for (int i = 0; i < items.length; i++) { - if (items[i] != null) { - if ((hashBased && items[i].getIdHash() == item.getIdHash()) || (!hashBased && items[i].getId() == item.getId())) { - return i; - } - } - } - } - return freeSlot(); - } + /** + * Gets the item slot. + * + * @param item The item. + * @return The slot of the item in this container. + */ + public int getSlot(Item item) { + if (item == null) { + return -1; + } + int id = item.getId(); + for (int i = 0; i < items.length; i++) { + Item it = items[i]; + if (it != null && it.getId() == id) { + return i; + } + } + return -1; + } - /** - * Gets the number of free slots. - * @return The number of free slots. - */ - public int freeSlots() { - return capacity - itemCount(); - } + /** + * Gets the item instance. + * + * @param item the item. + * @return the item. + */ + public Item getItem(Item item) { + return get(getSlot(item)); + } - /** - * Gets the size of this container. - * @return The size of this container. - */ - public int itemCount() { - int size = 0; - for (int i = 0; i < items.length; i++) { - if (items[i] != null) { - size++; - } - } - return size; - } + /** + * Gets the next free slot. + * + * @return The slot, or -1 if there are no available slots. + */ + public int freeSlot() { + for (int i = 0; i < items.length; i++) { + if (items[i] == null) { + return i; + } + } + return -1; + } - /** - * Checks if the player has all the item ids in the inventory. - * @param itemIds The item ids. - * @return {@code True} if so. - */ - public boolean containItems(int... itemIds) { - for (int i = 0; i < itemIds.length; i++) { - if (!contains(itemIds[i], 1)) { - return false; - } - } - return true; - } + /** + * Gets the slot of where to add the item. + * + * @param item The item to add. + * @return The slot where the item will go. + */ + public int getAddSlot(Item item) { + if (type != ContainerType.NEVER_STACK && (item.getDefinition().isStackable() || type.equals(ContainerType.ALWAYS_STACK) || type == ContainerType.SHOP)) { + boolean hashBased = sortType == SortType.HASH; + for (int i = 0; i < items.length; i++) { + if (items[i] != null) { + if ((hashBased && items[i].getIdHash() == item.getIdHash()) || (!hashBased && items[i].getId() == item.getId())) { + return i; + } + } + } + } + return freeSlot(); + } - /** - * Gets the amount of an item. - * @param item The item. - * @return The amount of this item in this container. - */ - public int getAmount(Item item) { - if (item == null) { - return 0; - } - int count = 0; - for (Item i : items) { - if (i != null && i.getId() == item.getId()) { - count += i.getAmount(); - } - } - return count; - } + /** + * Gets the number of free slots. + * + * @return The number of free slots. + */ + public int freeSlots() { + return capacity - itemCount(); + } - /** - * Gets the amount. - * @param id the id. - * @return the amount. - */ - public int getAmount(int id) { - return getAmount(new Item(id)); - } + /** + * Gets the size of this container. + * + * @return The size of this container. + */ + public int itemCount() { + int size = 0; + for (int i = 0; i < items.length; i++) { + if (items[i] != null) { + size++; + } + } + return size; + } - /** - * Shifts the elements in the Container to the appropriate position. - */ - public void shift() { - final Item itemss[] = items; - clear(false); - for (Item item : itemss) { - if (item == null) { - continue; - } - add(item, false); - } - refresh(); - } + /** + * Checks if the player has all the item ids in the inventory. + * + * @param itemIds The item ids. + * @return {@code True} if so. + */ + public boolean containItems(int... itemIds) { + for (int i = 0; i < itemIds.length; i++) { + if (!contains(itemIds[i], 1)) { + return false; + } + } + return true; + } - /** - * Checks if the container is empty. - * @return {@code True} if so. - */ - public boolean isEmpty() { - for (Item item : items) { - if (item != null) { - return false; - } - } - return true; - } + /** + * Gets the amount of an item. + * + * @param item The item. + * @return The amount of this item in this container. + */ + public int getAmount(Item item) { + if (item == null) { + return 0; + } + int count = 0; + for (Item i : items) { + if (i != null && i.getId() == item.getId()) { + count += i.getAmount(); + } + } + return count; + } - /** - * Checks if the container is full. - * @return {@code True} if so. - */ - public boolean isFull() { - return freeSlots() < 1; - } - - /** - * Clears and updates the container. - */ - public void clear() { - clear(true); - } + /** + * Gets the amount. + * + * @param id the id. + * @return the amount. + */ + public int getAmount(int id) { + return getAmount(new Item(id)); + } - /** - * Clears the container. - * @param update If the container should be updated. - */ - public void clear(boolean update) { - items = new Item[capacity]; - event.flagEmpty(); - if (update) { - refresh(); - } - } + /** + * Shifts the elements in the Container to the appropriate position. + */ + public void shift() { + final Item itemss[] = items; + clear(false); + for (Item item : itemss) { + if (item == null) { + continue; + } + add(item, false); + } + refresh(); + } - /** - * Gets the wealth. - * @return the wealth. - */ - public int getWealth() { - int wealth = 0; - for (Item i : items) { - if (i == null) { - continue; - } - wealth += i.getDefinition().getValue() * i.getAmount(); - } - return wealth; - } + /** + * Checks if the container is empty. + * + * @return {@code True} if so. + */ + public boolean isEmpty() { + for (Item item : items) { + if (item != null) { + return false; + } + } + return true; + } - /** - * Returns an array representing this container. - * @return The array. - */ - public Item[] toArray() { - return items; - } + /** + * Checks if the container is full. + * + * @return {@code True} if so. + */ + public boolean isFull() { + return freeSlots() < 1; + } - /** - * Gets the listeners. - * @return The listeners. - */ - public List getListeners() { - return listeners; - } + /** + * Clears and updates the container. + */ + public void clear() { + clear(true); + } - /** - * Gets the capacity. - * @return The capacity of this container. - */ - public int capacity() { - return capacity; - } + /** + * Clears the container. + * + * @param update If the container should be updated. + */ + public void clear(boolean update) { + items = new Item[capacity]; + event.flagEmpty(); + if (update) { + refresh(); + } + } - /** - * Gets the event. - * @return the event. - */ - public ContainerEvent getEvent() { - return event; - } + /** + * Gets the wealth. + * + * @return the wealth. + */ + public int getWealth() { + int wealth = 0; + for (Item i : items) { + if (i == null) { + continue; + } + wealth += i.getDefinition().getValue() * i.getAmount(); + } + return wealth; + } + + /** + * Returns an array representing this container. + * + * @return The array. + */ + public Item[] toArray() { + return items; + } + + /** + * Gets the listeners. + * + * @return The listeners. + */ + public List getListeners() { + return listeners; + } + + /** + * Gets the capacity. + * + * @return The capacity of this container. + */ + public int capacity() { + return capacity; + } + + /** + * Gets the event. + * + * @return the event. + */ + public ContainerEvent getEvent() { + return event; + } } \ No newline at end of file diff --git a/Server/src/org/crandor/game/node/entity/player/ai/AIPlayer.java b/Server/src/org/crandor/game/node/entity/player/ai/AIPlayer.java index 893f6dbb0..36d5139d0 100644 --- a/Server/src/org/crandor/game/node/entity/player/ai/AIPlayer.java +++ b/Server/src/org/crandor/game/node/entity/player/ai/AIPlayer.java @@ -184,12 +184,11 @@ public class AIPlayer extends Player { ++n; String line = sc.nextLine(); if (rand.nextInt(n) == 0) { //Chance of overwriting line is lower and lower - OSRScopyLine = line; - if (line.length() < 3) //probably an empty line + if (line.length() < 3 || line.startsWith("#")) //probably an empty line { - System.out.println("Something went wrong reading line [" + line + "] from /data/botdata/" + fileName); - updateRandomOSRScopyLine(fileName); + continue; } + OSRScopyLine = line; } } } catch (FileNotFoundException e) { @@ -199,7 +198,9 @@ public class AIPlayer extends Player { } private static String retrieveRandomName(String fileName) { - updateRandomOSRScopyLine(fileName); + do { + updateRandomOSRScopyLine(fileName); + } while (OSRScopyLine.startsWith("#")); //Comment return OSRScopyLine.split(":")[0]; } diff --git a/Server/src/org/crandor/game/node/entity/player/ai/minigamebots/pestcontrol/CombatState.java b/Server/src/org/crandor/game/node/entity/player/ai/minigamebots/pestcontrol/CombatState.java index 94875e1eb..3c2c76a38 100644 --- a/Server/src/org/crandor/game/node/entity/player/ai/minigamebots/pestcontrol/CombatState.java +++ b/Server/src/org/crandor/game/node/entity/player/ai/minigamebots/pestcontrol/CombatState.java @@ -66,10 +66,12 @@ public class CombatState { bot.tick--; bot.eat(379); - bot.getSkills().setLevel(Skills.PRAYER, 99); - bot.getSkills().setStaticLevel(Skills.PRAYER, 99); - if (!(bot.getPrayer().getActive().contains(PrayerType.PROTECT_FROM_MELEE))) - bot.getPrayer().toggle(PrayerType.PROTECT_FROM_MELEE); + if (bot.randomType < 30) { + bot.getSkills().setLevel(Skills.PRAYER, 99); + bot.getSkills().setStaticLevel(Skills.PRAYER, 99); + if (!(bot.getPrayer().getActive().contains(PrayerType.PROTECT_FROM_MELEE))) + bot.getPrayer().toggle(PrayerType.PROTECT_FROM_MELEE); + } if (!bot.inCombat()) { diff --git a/Server/src/org/crandor/game/node/entity/player/ai/minigamebots/pestcontrol/PestControlTestBot.java b/Server/src/org/crandor/game/node/entity/player/ai/minigamebots/pestcontrol/PestControlTestBot.java index dbe1310ff..e1eb84570 100644 --- a/Server/src/org/crandor/game/node/entity/player/ai/minigamebots/pestcontrol/PestControlTestBot.java +++ b/Server/src/org/crandor/game/node/entity/player/ai/minigamebots/pestcontrol/PestControlTestBot.java @@ -3,6 +3,7 @@ package org.crandor.game.node.entity.player.ai.minigamebots.pestcontrol; import org.crandor.game.node.Node; import org.crandor.game.node.entity.Entity; import org.crandor.game.node.entity.player.ai.pvmbots.PvMBots; +import org.crandor.game.node.entity.player.link.prayer.PrayerType; import org.crandor.game.world.map.Location; import org.crandor.net.packet.in.InteractionPacket; import org.crandor.tools.RandomFunction; @@ -88,6 +89,7 @@ public class PestControlTestBot extends PvMBots { } private void attackNPCs() { + this.getWalkingQueue().setRunning(true); List creatures = FindTargets(this, 15); if (creatures == null || creatures.isEmpty()) { @@ -96,7 +98,11 @@ public class PestControlTestBot extends PvMBots { this.setCustomState("Going to portals"); combathandler.goToPortals(); } else { - randomWalkAroundPoint(getMyPestControlSession(this).getSquire().getLocation(), 3); + try { + randomWalkAroundPoint(getMyPestControlSession(this).getSquire().getLocation(), 3); + } catch (NullPointerException e) { + //Do nothing, game just finished + } movetimer = new Random().nextInt(15) + 6; } } else { @@ -121,6 +127,10 @@ public class PestControlTestBot extends PvMBots { if (new Random().nextInt(insideBoatWalks) <= 1) { insideBoatWalks *= 1.5; + if (new Random().nextInt(4) == 1) + { + this.getWalkingQueue().setRunning(!this.getWalkingQueue().isRunning()); + } if (new Random().nextInt(7) == 1) { this.walkToPosSmart(new Location(2660, 2638)); @@ -136,6 +146,10 @@ public class PestControlTestBot extends PvMBots { } private void enterBoat() { + if (getPrayer().getActive().contains(PrayerType.PROTECT_FROM_MELEE)) { + getPrayer().toggle(PrayerType.PROTECT_FROM_MELEE); + } + if (new Random().nextInt(3) <= 1) //Don't join instantly { return; diff --git a/Server/src/org/crandor/game/node/entity/player/ai/resource/ResourceAIPManager.java b/Server/src/org/crandor/game/node/entity/player/ai/resource/ResourceAIPManager.java index 6356e7433..b44d9d0fe 100644 --- a/Server/src/org/crandor/game/node/entity/player/ai/resource/ResourceAIPManager.java +++ b/Server/src/org/crandor/game/node/entity/player/ai/resource/ResourceAIPManager.java @@ -9,6 +9,7 @@ import org.crandor.game.node.entity.player.ai.resource.task.ResourceTasks; import org.crandor.game.node.entity.player.ai.skillingbot.SkillingBotsBuilder; import org.crandor.game.system.task.Pulse; import org.crandor.game.world.GameWorld; +import org.crandor.game.world.map.Location; import java.sql.ResultSet; import java.sql.Statement; @@ -39,7 +40,9 @@ public class ResourceAIPManager { public void immerseWorld() { //There's probably a better place for this (it adds bot at bootup) PvMBotsBuilder.immersiveSpawns(); LumbridgeBotHandler.immersiveLumbridge(); - //AIPBuilder.immersiveSpawns(); + for (int pestBotsAmount = 0; pestBotsAmount < 20; pestBotsAmount++) { + PvMBotsBuilder.createPestControlTestBot(new Location(2657, 2640)); + } //SkillingBotsBuilder.immersiveSpawnsSkillingBots(); System.out.println("Loaded immerseWorld"); } diff --git a/Server/src/org/crandor/game/node/entity/player/ai/skillingbot/SkillingBot.java b/Server/src/org/crandor/game/node/entity/player/ai/skillingbot/SkillingBot.java index 0b51ee03c..8b62e6567 100644 --- a/Server/src/org/crandor/game/node/entity/player/ai/skillingbot/SkillingBot.java +++ b/Server/src/org/crandor/game/node/entity/player/ai/skillingbot/SkillingBot.java @@ -40,8 +40,6 @@ public class SkillingBot extends AIPlayer { default: break; } - - // TODO Auto-generated constructor stub } @Override diff --git a/Server/src/plugin/command/AIPCommandPlugin.java b/Server/src/plugin/command/AIPCommandPlugin.java index 88b6c54bb..73349214d 100644 --- a/Server/src/plugin/command/AIPCommandPlugin.java +++ b/Server/src/plugin/command/AIPCommandPlugin.java @@ -1,6 +1,7 @@ package plugin.command; import org.crandor.game.container.Container; +import org.crandor.game.container.impl.EquipmentContainer; import org.crandor.game.content.skill.Skills; import org.crandor.game.interaction.Interaction; import org.crandor.game.node.entity.player.Player; @@ -145,7 +146,7 @@ public final class AIPCommandPlugin extends CommandPlugin { player.setAttribute("aip_legion", PVPAIPActions.pvp_players = new ArrayList<>()); } for (int i = 0; i < size; i++) { - final AIPlayer aip = AIPBuilder.create( generateLocation(player)); + final AIPlayer aip = AIPBuilder.create(generateLocation(player)); aip.setControler(player); aip.getAppearance().setGender(RandomFunction.random(3) == 1 ? Gender.FEMALE : Gender.MALE); @@ -216,6 +217,25 @@ public final class AIPCommandPlugin extends CommandPlugin { case "immersiveworld": case "immersive": ResourceAIPManager.get().immerseWorld(); + player.sendMessage("Started immersive world, 2"); + return true; + case "botdataform": + //Dumps your current character info in the form used by data/botdata + //name:cblevel:helmet:cape:neck:weapon:chest:shield:unknown:legs:unknown:gloves:boots: + System.out.println(player.getUsername() + ":" + + player.getProperties().getCurrentCombatLevel() + ":" + + player.getEquipment().getAsId(EquipmentContainer.SLOT_HAT) + ":" + + player.getEquipment().getAsId(EquipmentContainer.SLOT_CAPE) + ":" + + player.getEquipment().getAsId(EquipmentContainer.SLOT_AMULET) + ":" + + player.getEquipment().getAsId(EquipmentContainer.SLOT_WEAPON) + ":" + + player.getEquipment().getAsId(EquipmentContainer.SLOT_CHEST) + ":" + + player.getEquipment().getAsId(EquipmentContainer.SLOT_SHIELD) + ":" + + "0" + ":" + + player.getEquipment().getAsId(EquipmentContainer.SLOT_LEGS) + ":" + + "0" + ":" + + player.getEquipment().getAsId(EquipmentContainer.SLOT_HANDS) + ":" + + player.getEquipment().getAsId(EquipmentContainer.SLOT_FEET) + ":" + ); return true; case "fishtest": SkillingBotsBuilder.spawnTroutLumbridge(new Location(3241, 3242)); @@ -254,7 +274,7 @@ public final class AIPCommandPlugin extends CommandPlugin { try { arg2 = Integer.parseInt(args[1]); } catch (Exception e) { - arg2 = 123; + arg2 = 20; } for (int pestBotsAmount = 0; pestBotsAmount < arg2; pestBotsAmount++) { PvMBotsBuilder.createPestControlTestBot(player.getLocation()); From 8505559acff5a4b61a7395f9219b68816416651f Mon Sep 17 00:00:00 2001 From: dginovker Date: Fri, 27 Mar 2020 23:23:19 -0400 Subject: [PATCH 08/11] Made it so bots don't spawn unless someone tries to play --- .../entity/player/ai/resource/ResourceAIPManager.java | 3 --- .../src/plugin/activity/pestcontrol/PCObjectHandler.java | 8 ++++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Server/src/org/crandor/game/node/entity/player/ai/resource/ResourceAIPManager.java b/Server/src/org/crandor/game/node/entity/player/ai/resource/ResourceAIPManager.java index b44d9d0fe..668ae4817 100644 --- a/Server/src/org/crandor/game/node/entity/player/ai/resource/ResourceAIPManager.java +++ b/Server/src/org/crandor/game/node/entity/player/ai/resource/ResourceAIPManager.java @@ -40,9 +40,6 @@ public class ResourceAIPManager { public void immerseWorld() { //There's probably a better place for this (it adds bot at bootup) PvMBotsBuilder.immersiveSpawns(); LumbridgeBotHandler.immersiveLumbridge(); - for (int pestBotsAmount = 0; pestBotsAmount < 20; pestBotsAmount++) { - PvMBotsBuilder.createPestControlTestBot(new Location(2657, 2640)); - } //SkillingBotsBuilder.immersiveSpawnsSkillingBots(); System.out.println("Loaded immerseWorld"); } diff --git a/Server/src/plugin/activity/pestcontrol/PCObjectHandler.java b/Server/src/plugin/activity/pestcontrol/PCObjectHandler.java index 65a888bc1..ea0fca658 100644 --- a/Server/src/plugin/activity/pestcontrol/PCObjectHandler.java +++ b/Server/src/plugin/activity/pestcontrol/PCObjectHandler.java @@ -5,6 +5,7 @@ import org.crandor.game.content.activity.ActivityManager; import org.crandor.game.interaction.OptionHandler; import org.crandor.game.node.Node; import org.crandor.game.node.entity.player.Player; +import org.crandor.game.node.entity.player.ai.pvmbots.PvMBotsBuilder; import org.crandor.game.node.entity.player.info.Rights; import org.crandor.game.node.item.Item; import org.crandor.game.node.object.GameObject; @@ -21,6 +22,8 @@ import org.crandor.plugin.Plugin; */ public final class PCObjectHandler extends OptionHandler { + public boolean pcbotsSpawned = false; + @Override public Plugin newInstance(Object arg) throws Throwable { // Barricades @@ -91,6 +94,11 @@ public final class PCObjectHandler extends OptionHandler { } switch (object.getId()) { case 14315: // Novice + if (!pcbotsSpawned) { + for (int pestBotsAmount = 0; pestBotsAmount < 20; pestBotsAmount++) { + PvMBotsBuilder.createPestControlTestBot(new Location(2657, 2640)); + } + } startActivity(player, "pest control novice", Location.create(2661, 2639, 0)); return true; case 25631: // Intermediate From 42c6110ad40e50a13ad95682bd621654313eb1a6 Mon Sep 17 00:00:00 2001 From: dginovker Date: Fri, 27 Mar 2020 23:26:48 -0400 Subject: [PATCH 09/11] OHH this is why you test your code. --- Server/src/plugin/activity/pestcontrol/PCObjectHandler.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Server/src/plugin/activity/pestcontrol/PCObjectHandler.java b/Server/src/plugin/activity/pestcontrol/PCObjectHandler.java index ea0fca658..1b8803fff 100644 --- a/Server/src/plugin/activity/pestcontrol/PCObjectHandler.java +++ b/Server/src/plugin/activity/pestcontrol/PCObjectHandler.java @@ -95,6 +95,7 @@ public final class PCObjectHandler extends OptionHandler { switch (object.getId()) { case 14315: // Novice if (!pcbotsSpawned) { + pcbotsSpawned = true; for (int pestBotsAmount = 0; pestBotsAmount < 20; pestBotsAmount++) { PvMBotsBuilder.createPestControlTestBot(new Location(2657, 2640)); } From d5cda179d32ee26b9e1cf1163d45feb85a5517bf Mon Sep 17 00:00:00 2001 From: dginovker Date: Sat, 28 Mar 2020 14:38:47 -0400 Subject: [PATCH 10/11] One more change to PC bots --- .../node/entity/player/ai/skillingbot/SkillingBot.java | 6 +++--- .../player/ai/skillingbot/SkillingBotsBuilder.java | 3 ++- .../plugin/activity/pestcontrol/PCObjectHandler.java | 10 +++++++++- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/Server/src/org/crandor/game/node/entity/player/ai/skillingbot/SkillingBot.java b/Server/src/org/crandor/game/node/entity/player/ai/skillingbot/SkillingBot.java index 8b62e6567..dda95a72d 100644 --- a/Server/src/org/crandor/game/node/entity/player/ai/skillingbot/SkillingBot.java +++ b/Server/src/org/crandor/game/node/entity/player/ai/skillingbot/SkillingBot.java @@ -36,9 +36,9 @@ public class SkillingBot extends AIPlayer { switch (this.skill) { - case Skills.MINING: - default: - break; + case Skills.MINING: + default: + break; } } diff --git a/Server/src/org/crandor/game/node/entity/player/ai/skillingbot/SkillingBotsBuilder.java b/Server/src/org/crandor/game/node/entity/player/ai/skillingbot/SkillingBotsBuilder.java index d828aff8a..978cd7950 100644 --- a/Server/src/org/crandor/game/node/entity/player/ai/skillingbot/SkillingBotsBuilder.java +++ b/Server/src/org/crandor/game/node/entity/player/ai/skillingbot/SkillingBotsBuilder.java @@ -176,7 +176,8 @@ public final class SkillingBotsBuilder extends AIPlayer { bot.getSkills().setLevel(Skills.FISHING, 25); bot.setInteractionRange(25); } - + + //These bots are disabled because they somehow break pets public static void immersiveSpawnsSkillingBots() { // Varrock Mine diff --git a/Server/src/plugin/activity/pestcontrol/PCObjectHandler.java b/Server/src/plugin/activity/pestcontrol/PCObjectHandler.java index 1b8803fff..fd349d3c9 100644 --- a/Server/src/plugin/activity/pestcontrol/PCObjectHandler.java +++ b/Server/src/plugin/activity/pestcontrol/PCObjectHandler.java @@ -16,6 +16,8 @@ import org.crandor.game.world.map.RegionManager; import org.crandor.game.world.update.flag.context.Animation; import org.crandor.plugin.Plugin; +import java.util.ArrayList; + /** * Handles pest control objects. * @author Emperor @@ -23,6 +25,7 @@ import org.crandor.plugin.Plugin; public final class PCObjectHandler extends OptionHandler { public boolean pcbotsSpawned = false; + public ArrayList playersJoined = new ArrayList<>(); @Override public Plugin newInstance(Object arg) throws Throwable { @@ -94,12 +97,17 @@ public final class PCObjectHandler extends OptionHandler { } switch (object.getId()) { case 14315: // Novice - if (!pcbotsSpawned) { + if (!pcbotsSpawned) { //First person to join gets bots to play with pcbotsSpawned = true; for (int pestBotsAmount = 0; pestBotsAmount < 20; pestBotsAmount++) { PvMBotsBuilder.createPestControlTestBot(new Location(2657, 2640)); } } + if (!playersJoined.contains(player.getUsername())) { //You also get +1 bot for every friend + playersJoined.add(player.getUsername()); + PvMBotsBuilder.createPestControlTestBot(new Location(2657, 2640)); + } + startActivity(player, "pest control novice", Location.create(2661, 2639, 0)); return true; case 25631: // Intermediate From 70dddd0e48f8a45ab0e8a53b6e7f25d96c0ac597 Mon Sep 17 00:00:00 2001 From: CSS-Lletya Date: Sat, 28 Mar 2020 18:10:57 -0400 Subject: [PATCH 11/11] Entrana Prayer draining fixed --- Server/src/plugin/dialogue/CaveMonk.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Server/src/plugin/dialogue/CaveMonk.java b/Server/src/plugin/dialogue/CaveMonk.java index 3deb89351..66d1e8453 100644 --- a/Server/src/plugin/dialogue/CaveMonk.java +++ b/Server/src/plugin/dialogue/CaveMonk.java @@ -2,6 +2,7 @@ package plugin.dialogue; import org.crandor.game.content.dialogue.DialoguePlugin; import org.crandor.game.content.dialogue.FacialExpression; +import org.crandor.game.content.skill.Skills; import org.crandor.game.node.entity.npc.NPC; import org.crandor.game.node.entity.player.Player; import org.crandor.game.node.entity.player.link.quest.Quest; @@ -104,6 +105,9 @@ public final class CaveMonk extends DialoguePlugin { end(); break; case 20: + if (player.getSkills().getLevel(Skills.PRAYER) > 2 && player.getSkills().getPrayerPoints() > 2) { + player.getSkills().decrementPrayerPoints(player.getSkills().getLevel(Skills.PRAYER) - 2); + } player.getProperties().setTeleportLocation(DUNGEON); end(); break;