From 8af938548b470ba1a7b77483137bec94f97fb6df Mon Sep 17 00:00:00 2001 From: Mr Extremez Date: Thu, 5 Dec 2019 11:55:25 -0600 Subject: [PATCH] More fixes (#235) - Dwarf cannon can now be seen by anyone and not just the person who sets it down (they can also see the rotation now) - Fixed doors being removed when clicking them - Removed banking command for regular players - Fixed nulodion now only gives if you have space - Updated nulodion message so it doesnt say to find him at home - Npcs wont follow you if you turn on the cantAttack comamand (for admins - Fixed gate at KBD - Fixed the gates at Ice giants in wildy #closes 132 #closes 203 #closes 211 #closes 6 also this one should be closed from previous patch #closes 219 --- .../content/combat/range/DwarfCannon.java | 19 +++++++++---------- .../game/dialogues/DialogueHandler.java | 13 +++++++++---- .../game/globalworldobjects/Doors.java | 4 ++-- .../game/globalworldobjects/DoubleDoors.java | 5 +++-- .../game/globalworldobjects/DoubleGates.java | 12 ++++++++++++ .../com/rebotted/game/npcs/NPCDefinition.java | 2 -- .../com/rebotted/game/npcs/NpcHandler.java | 3 +++ .../game/players/PlayerAssistant.java | 4 ++-- .../com/rebotted/net/packets/impl/Bank10.java | 3 +-- .../net/packets/impl/ClickObject.java | 6 +----- .../rebotted/net/packets/impl/Commands.java | 3 --- 11 files changed, 42 insertions(+), 32 deletions(-) diff --git a/2006Redone Server/src/com/rebotted/game/content/combat/range/DwarfCannon.java b/2006Redone Server/src/com/rebotted/game/content/combat/range/DwarfCannon.java index d655701d..92df80e1 100644 --- a/2006Redone Server/src/com/rebotted/game/content/combat/range/DwarfCannon.java +++ b/2006Redone Server/src/com/rebotted/game/content/combat/range/DwarfCannon.java @@ -7,10 +7,12 @@ import com.rebotted.event.CycleEventHandler; import com.rebotted.game.content.combat.CombatConstants; import com.rebotted.game.npcs.Npc; import com.rebotted.game.npcs.NpcHandler; +import com.rebotted.game.objects.Objects; import com.rebotted.game.players.Client; import com.rebotted.game.players.Player; import com.rebotted.game.players.PlayerHandler; import com.rebotted.util.Misc; +import com.rebotted.world.clip.Region; /** * Cannon @@ -97,7 +99,7 @@ public class DwarfCannon { player.turnPlayerTo(player.absX, player.absY); player.cannonX = player.absX; player.cannonY = player.absY; - placeObject(OBJECT_PARTS[setUpStage], player.absX, player.absY); + placeObject(OBJECT_PARTS[setUpStage], player.absX, player.absY, true); player.getItemAssistant().deleteItem(ITEM_PARTS[setUpStage], 1); setUpStage ++; } @@ -120,7 +122,7 @@ public class DwarfCannon { public void loginCheck() { if (needsCannon()) { - player.getPacketSender().sendMessage("@red@You can collect your cannon at home from Nulodion."); + player.getPacketSender().sendMessage("@red@You can collect your cannon from Nulodion."); } } @@ -342,17 +344,14 @@ public class DwarfCannon { player.cannonY = 0; } - public void placeObject(int id, int x, int y) { - for (int j = 0; j < PlayerHandler.players.length; j++) { - if (PlayerHandler.players[j] != null) { - Client a = (Client)PlayerHandler.players[j]; - a.getPacketSender().object(id, x, y, 516, 10); - } - } + public void placeObject(int id, int x, int y, boolean add) { + GameEngine.objectHandler.placeObject(new Objects(id, x, y, 0, 516, 10, 0)); + if (add) + Region.addObject(id, x, y, 0, 10, 516, true); } public void removeObject(int x, int y) { - placeObject(-1, x, y); + placeObject(-1, x, y, false); } public boolean noSetUpArea() { diff --git a/2006Redone Server/src/com/rebotted/game/dialogues/DialogueHandler.java b/2006Redone Server/src/com/rebotted/game/dialogues/DialogueHandler.java index 7aa49052..40aa59d6 100644 --- a/2006Redone Server/src/com/rebotted/game/dialogues/DialogueHandler.java +++ b/2006Redone Server/src/com/rebotted/game/dialogues/DialogueHandler.java @@ -6854,12 +6854,17 @@ public class DialogueHandler { case 3501: if (player.getCannon().needsCannon()) { - sendNpcChat1("Here is your cannon, try not to lose it again.", player.talkingNpc, "Nulodion"); - for (int i = 0; i < 4; i++) { + if (player.getItemAssistant().freeSlots() >= 4) { + sendNpcChat1("Here is your cannon, try not to lose it again.", player.talkingNpc, "Nulodion"); + for (int i = 0; i < 4; i++) { player.getItemAssistant().addItem(player.getCannon().ITEM_PARTS[i], 1); + } + player.lostCannon = false; + player.nextChat = 0; + } else { + sendNpcChat1("You need at least 4 free inventory spots.", player.talkingNpc, "Nulodion"); + player.nextChat = 0; } - player.lostCannon = false; - player.nextChat = 0; } else { sendNpcChat1("" + Misc.capitalize(player.playerName) + " you do not have a cannon to collect currently.", player.talkingNpc, "Nulodion"); player.nextChat = 0; diff --git a/2006Redone Server/src/com/rebotted/game/globalworldobjects/Doors.java b/2006Redone Server/src/com/rebotted/game/globalworldobjects/Doors.java index be9c9650..c8aeeab4 100644 --- a/2006Redone Server/src/com/rebotted/game/globalworldobjects/Doors.java +++ b/2006Redone Server/src/com/rebotted/game/globalworldobjects/Doors.java @@ -54,12 +54,12 @@ public class Doors { return null; } - public boolean handleDoor(int id, int x, int y, int z, Player player) { + public boolean handleDoor(Player player, int id, int x, int y, int z) { Doors d = getDoor(id, x, y, z); if (d == null) { - if (DoubleDoors.getSingleton().handleDoor(id, x, y, z)) { + if (DoubleDoors.getSingleton().handleDoor(player, id, x, y, z)) { return true; } return false; diff --git a/2006Redone Server/src/com/rebotted/game/globalworldobjects/DoubleDoors.java b/2006Redone Server/src/com/rebotted/game/globalworldobjects/DoubleDoors.java index d56d830a..4de452fd 100644 --- a/2006Redone Server/src/com/rebotted/game/globalworldobjects/DoubleDoors.java +++ b/2006Redone Server/src/com/rebotted/game/globalworldobjects/DoubleDoors.java @@ -9,6 +9,7 @@ import java.util.Scanner; import com.rebotted.GameEngine; import com.rebotted.game.objects.Objects; +import com.rebotted.game.players.Player; /** * @@ -45,11 +46,11 @@ public class DoubleDoors { return null; } - public boolean handleDoor(int id, int x, int y, int z) { + public boolean handleDoor(Player player, int id, int x, int y, int z) { DoubleDoors doorClicked = getDoor(id, x, y, z); if (doorClicked == null) { - GameEngine.objectHandler.placeObject(new Objects(-1, x, y, z, 0, 0, 0)); + //GameEngine.objectHandler.placeObject(new Objects(-1, x, y, z, 0, 0, 0)); return true; } if (doorClicked.doorId > 12000) { diff --git a/2006Redone Server/src/com/rebotted/game/globalworldobjects/DoubleGates.java b/2006Redone Server/src/com/rebotted/game/globalworldobjects/DoubleGates.java index 3bb3043e..a30fb2ad 100644 --- a/2006Redone Server/src/com/rebotted/game/globalworldobjects/DoubleGates.java +++ b/2006Redone Server/src/com/rebotted/game/globalworldobjects/DoubleGates.java @@ -148,6 +148,12 @@ public class DoubleGates extends GateHandler { handleMetalGate(player, 1596, 1597, 2815, 3182, 2815, 3183, 2816, 3182, 2816, 3183, 3); } else if (player.objectY > 3449 && player.objectY < 3452) { handleMetalGate(player, 1596, 1597, 2936, 3451, 2936, 3450, 2935, 3451, 2935, 3450, 7); + } else if (player.objectY > 3848 && player.objectY < 3851) { + handleMetalGate(player, 1596, 1597, 3007, 3849, 3007, 3850, 3008, 3849, 3008, 3850, 3); + } else if (player.objectX > 3223 && player.objectX < 3226) { + handleMetalGate(player, 1596, 1597, 3225, 3903, 3224, 3903, 3225, 3904, 3224, 3904, 0); + } else if (player.objectX > 2946 && player.objectX < 2949) { + handleMetalGate(player, 1596, 1597, 2948, 3903, 2947, 3903, 2948, 3904, 2947, 3904, 0); } break; case 1597: @@ -161,6 +167,12 @@ public class DoubleGates extends GateHandler { handleMetalGate(player, 1597, 1596, 2815, 3183, 2815, 3182, 2816, 3183, 2816, 3182, 1); } else if (player.objectY > 3449 && player.objectY < 3452) { handleMetalGate(player, 1597, 1596, 2936, 3450, 2936, 3451, 2935, 3450, 2935, 3451, 5); + } else if (player.objectY > 3848 && player.objectY < 3851) { + handleMetalGate(player, 1597, 1596, 3007, 3850, 3007, 3849, 3008, 3850, 3008, 3849, 1); + } else if (player.objectX > 3223 && player.objectX < 3226) { + handleMetalGate(player, 1597, 1596, 3224, 3903, 3225, 3903, 3224, 3904, 3225, 3904, 2); + } else if (player.objectX > 2946 && player.objectX < 2949) { + handleMetalGate(player, 1597, 1596, 2947, 3903, 2948, 3903, 2947, 3904, 2948, 3904, 2); } break; case 1557: diff --git a/2006Redone Server/src/com/rebotted/game/npcs/NPCDefinition.java b/2006Redone Server/src/com/rebotted/game/npcs/NPCDefinition.java index 49c2cceb..77ef8721 100644 --- a/2006Redone Server/src/com/rebotted/game/npcs/NPCDefinition.java +++ b/2006Redone Server/src/com/rebotted/game/npcs/NPCDefinition.java @@ -20,9 +20,7 @@ public class NPCDefinition { } public static NPCDefinition forId(int id) { - NPCDefinition d = definitions[id]; - if (d == null) { d = produceDefinition(id); } diff --git a/2006Redone Server/src/com/rebotted/game/npcs/NpcHandler.java b/2006Redone Server/src/com/rebotted/game/npcs/NpcHandler.java index 159bfd88..d4e6b3fc 100644 --- a/2006Redone Server/src/com/rebotted/game/npcs/NpcHandler.java +++ b/2006Redone Server/src/com/rebotted/game/npcs/NpcHandler.java @@ -1010,6 +1010,9 @@ public class NpcHandler { if (PlayerHandler.players[playerId] == null) { return; } + if (PlayerHandler.players[playerId].npcCanAttack == false) { + return; + } if (PlayerHandler.players[playerId].respawnTimer > 0) { npcs[i].facePlayer(0); npcs[i].randomWalk = true; diff --git a/2006Redone Server/src/com/rebotted/game/players/PlayerAssistant.java b/2006Redone Server/src/com/rebotted/game/players/PlayerAssistant.java index 7c80ad70..fbe466c1 100644 --- a/2006Redone Server/src/com/rebotted/game/players/PlayerAssistant.java +++ b/2006Redone Server/src/com/rebotted/game/players/PlayerAssistant.java @@ -40,9 +40,9 @@ public class PlayerAssistant { public void objectAnim(int X, int Y, int animationID, int tileObjectType, int orientation) { for (Player p : PlayerHandler.players) { if(p != null) { - Client players = (Client)p; + Player players = (Player)p; if(players.distanceToPoint(X, Y) <= 25) { - player.getPacketSender().createPlayersObjectAnim(X, Y, animationID, tileObjectType, orientation); + players.getPacketSender().createPlayersObjectAnim(X, Y, animationID, tileObjectType, orientation); } } } diff --git a/2006Redone Server/src/com/rebotted/net/packets/impl/Bank10.java b/2006Redone Server/src/com/rebotted/net/packets/impl/Bank10.java index 2ddb8be4..429da66f 100644 --- a/2006Redone Server/src/com/rebotted/net/packets/impl/Bank10.java +++ b/2006Redone Server/src/com/rebotted/net/packets/impl/Bank10.java @@ -89,8 +89,7 @@ public class Bank10 implements PacketType { case 1121: case 1122: case 1123: - player.getSmithing().readInput(player.playerLevel[player.playerSmithing], - Integer.toString(removeId), player, 10); + player.getSmithing().readInput(player.playerLevel[player.playerSmithing], Integer.toString(removeId), player, 10); break; } diff --git a/2006Redone Server/src/com/rebotted/net/packets/impl/ClickObject.java b/2006Redone Server/src/com/rebotted/net/packets/impl/ClickObject.java index 70c2387d..74fb65b9 100644 --- a/2006Redone Server/src/com/rebotted/net/packets/impl/ClickObject.java +++ b/2006Redone Server/src/com/rebotted/net/packets/impl/ClickObject.java @@ -122,11 +122,7 @@ public class ClickObject implements PacketType { } //todo: check if it's a door before fire handle - Doors.getSingleton().handleDoor(p.objectId, p.objectX, p.objectY, p.heightLevel, p); - - /*if (client.performingAction) { - return; - }*/ + Doors.getSingleton().handleDoor(p, p.objectId, p.objectX, p.objectY, p.heightLevel); if (Stalls.isObject(p.objectId)) { Stalls.attemptStall(p, p.objectId, p.objectX, p.objectX); diff --git a/2006Redone Server/src/com/rebotted/net/packets/impl/Commands.java b/2006Redone Server/src/com/rebotted/net/packets/impl/Commands.java index 1c0e2b02..94d66c4e 100644 --- a/2006Redone Server/src/com/rebotted/net/packets/impl/Commands.java +++ b/2006Redone Server/src/com/rebotted/net/packets/impl/Commands.java @@ -42,9 +42,6 @@ public class Commands implements PacketType { public static void playerCommands(Player player, String playerCommand, String[] arguments) { switch (playerCommand.toLowerCase()) { - case "bank": - player.getPacketSender().openUpBank(); - break; case "claimvote": if(!GameEngine.ersSecret.equals("")) { final String playerName = player.playerName;