diff --git a/2006Redone Client/bin/.gitignore b/2006Redone Client/bin/.gitignore new file mode 100644 index 00000000..bd317d51 --- /dev/null +++ b/2006Redone Client/bin/.gitignore @@ -0,0 +1,2 @@ +/Client.class +/LocalGame.class diff --git a/2006Redone Client/bin/ClientSettings.class b/2006Redone Client/bin/ClientSettings.class index 610b1581..7665596e 100644 Binary files a/2006Redone Client/bin/ClientSettings.class and b/2006Redone Client/bin/ClientSettings.class differ diff --git a/2006Redone Client/bin/Game.class b/2006Redone Client/bin/Game.class index d9491f86..ab5b5a7e 100644 Binary files a/2006Redone Client/bin/Game.class and b/2006Redone Client/bin/Game.class differ diff --git a/2006Redone Client/bin/Main.class b/2006Redone Client/bin/Main.class index f44db50b..539079d9 100644 Binary files a/2006Redone Client/bin/Main.class and b/2006Redone Client/bin/Main.class differ diff --git a/2006Redone Client/bin/RSApplet.class b/2006Redone Client/bin/RSApplet.class index 315d3c5f..0684036c 100644 Binary files a/2006Redone Client/bin/RSApplet.class and b/2006Redone Client/bin/RSApplet.class differ diff --git a/2006Redone Client/bin/RSFrame.class b/2006Redone Client/bin/RSFrame.class index 2e9c89eb..15762d83 100644 Binary files a/2006Redone Client/bin/RSFrame.class and b/2006Redone Client/bin/RSFrame.class differ diff --git a/2006Redone Client/bin/RSInterface.class b/2006Redone Client/bin/RSInterface.class index 7aedcbfa..ff4d7b8c 100644 Binary files a/2006Redone Client/bin/RSInterface.class and b/2006Redone Client/bin/RSInterface.class differ diff --git a/2006Redone Client/bin/java.policy.applet b/2006Redone Client/bin/java.policy.applet new file mode 100644 index 00000000..ba9f51db --- /dev/null +++ b/2006Redone Client/bin/java.policy.applet @@ -0,0 +1,7 @@ +/* AUTOMATICALLY GENERATED ON Tue Apr 16 17:20:59 EDT 2002*/ +/* DO NOT EDIT */ + +grant { + permission java.security.AllPermission; +}; + diff --git a/2006Redone Client/src/Game.java b/2006Redone Client/src/Game.java index 7bc6ceb3..557773ae 100644 --- a/2006Redone Client/src/Game.java +++ b/2006Redone Client/src/Game.java @@ -12171,7 +12171,7 @@ public class Game extends RSApplet { this.anInt1187 += (j << 1); } - public final void keyPressed(KeyEvent keyevent) + public void keyPressed(KeyEvent keyevent) { super.keyPressed(keyevent); switch (keyevent.getKeyCode()) diff --git a/2006Redone Client/src/RSApplet.java b/2006Redone Client/src/RSApplet.java index 70e74d03..8c586152 100644 --- a/2006Redone Client/src/RSApplet.java +++ b/2006Redone Client/src/RSApplet.java @@ -284,7 +284,7 @@ public class RSApplet extends Applet implements Runnable, MouseListener, MouseMo } @Override - public final void mouseMoved(MouseEvent mouseevent) { + public void mouseMoved(MouseEvent mouseevent) { int i = mouseevent.getX(); int j = mouseevent.getY(); if (gameFrame != null) { diff --git a/2006Redone Server/data/logs/pickupitem/andrew22.txt b/2006Redone Server/data/logs/pickupitem/andrew22.txt new file mode 100644 index 00000000..1a95fc3f --- /dev/null +++ b/2006Redone Server/data/logs/pickupitem/andrew22.txt @@ -0,0 +1,4 @@ +[2019/11/17] 15:52 andrew22 picked up knife itemX: 3224, itemY: 3202 +[2019/11/17] 15:52 andrew22 picked up knife itemX: 3224, itemY: 3202 +[2019/11/17] 15:54 andrew22 picked up knife itemX: 3224, itemY: 3202 +[2019/11/17] 15:56 andrew22 picked up knife itemX: 3224, itemY: 3202 diff --git a/2006Redone Server/src/redone/game/content/combat/npcs/NpcCombat.java b/2006Redone Server/src/redone/game/content/combat/npcs/NpcCombat.java index bda91294..c7abc84b 100644 --- a/2006Redone Server/src/redone/game/content/combat/npcs/NpcCombat.java +++ b/2006Redone Server/src/redone/game/content/combat/npcs/NpcCombat.java @@ -231,6 +231,14 @@ public class NpcCombat { NpcHandler.npcs[i].projectileId, 43, 31, -c.getId() - 1, 65); } + int random = Misc.random(10); + if (NpcHandler.npcs[i].npcType == 222 && (NpcHandler.npcs[i].killerId > 0 && NpcHandler.npcs[i].underAttack) && !NpcHandler.npcs[i].isDead && (NpcHandler.npcs[i].HP < NpcHandler.npcs[i].MaxHP + 1)) { + if (random < 3) { + NpcHandler.npcs[i].HP += 2; + //NpcHandler.npcs[i].startAnimation(84); + NpcHandler.npcs[i].updateRequired = true; + } + } c.underAttackBy2 = i; c.singleCombatDelay2 = System.currentTimeMillis(); NpcHandler.npcs[i].oldIndex = c.playerId; diff --git a/2006Redone Server/src/redone/game/objects/Objects.java b/2006Redone Server/src/redone/game/objects/Objects.java index 588cd8ac..528e0241 100644 --- a/2006Redone Server/src/redone/game/objects/Objects.java +++ b/2006Redone Server/src/redone/game/objects/Objects.java @@ -42,6 +42,9 @@ public class Objects { ObjectDef def = ObjectDef.getObjectDef(objectId); if (def == null) return new int[] {1, 1}; + if (objectId == 2781) { + return new int[] {3, 3}; + } int xLength; int yLength; if (objectFace != 1 && objectFace != 3) { diff --git a/2006Redone Server/src/redone/game/objects/ObjectsActions.java b/2006Redone Server/src/redone/game/objects/ObjectsActions.java index 59b29e5d..90656a86 100644 --- a/2006Redone Server/src/redone/game/objects/ObjectsActions.java +++ b/2006Redone Server/src/redone/game/objects/ObjectsActions.java @@ -62,8 +62,8 @@ public class ObjectsActions { player.faceUpdate(0); player.clickObjectType = 0; player.turnPlayerTo(objectX, objectY); - if (!Region.objectExists(objectType, objectX, objectY, player.heightLevel)) { - player.getActionSender().sendMessage("This object does not exist. Please report this to a staff member."); + if (!Region.objectExists(objectType, objectX, objectY, player.heightLevel) && player.playerRights > 1) { + player.getActionSender().sendMessage("[DEBUG] This object does not exist."); return; } if (Webs.webs(player, objectType)) { @@ -2562,15 +2562,10 @@ public class ObjectsActions { player.faceUpdate(0); player.clickObjectType = 0; player.turnPlayerTo(obX, obY); - if (!Region.objectExists(objectType, obX, obY, player.heightLevel)) { - player.getActionSender().sendMessage("This object does not exist. Please report this to a staff member."); + if (!Region.objectExists(objectType, obX, obY, player.heightLevel) && player.playerRights > 1) { + player.getActionSender().sendMessage("[DEBUG] This object does not exist."); return; } - if (player.isBotting == true) { - player.getActionSender().sendMessage("You can't click any objects until you confirm you are not botting."); - player.getActionSender().sendMessage("If you need to you can type ::amibotting, to see if your botting."); - return; - } LogCutting.resetFletching(player); switch (objectType) { case 6: @@ -2828,15 +2823,10 @@ public class ObjectsActions { if (player.playerRights == 3) { player.getActionSender().sendMessage("Object type: " + objectType); } - if (!Region.objectExists(objectType, obX, obY, player.heightLevel)) { - player.getActionSender().sendMessage("This object does not exist. Please report this to a staff member."); + if (!Region.objectExists(objectType, obX, obY, player.heightLevel) && player.playerRights > 1) { + player.getActionSender().sendMessage("[DEBUG] This object does not exist."); return; } - if (player.isBotting == true) { - player.getActionSender().sendMessage("You can't click any objects until you confirm you are not botting."); - player.getActionSender().sendMessage("If you need to you can type ::amibotting, to see if your botting."); - return; - } if (Stalls.isObject(objectType)) { Stalls.attemptStall(player, objectType, obX, obY); return; @@ -2879,15 +2869,10 @@ public class ObjectsActions { if (player.playerRights == 3) { player.getActionSender().sendMessage("Object type: " + objectType); } - if (!Region.objectExists(objectType, obX, obY, player.heightLevel)) { - player.getActionSender().sendMessage("This object does not exist. Please report this to a staff member."); + if (!Region.objectExists(objectType, obX, obY, player.heightLevel) && player.playerRights > 1) { + player.getActionSender().sendMessage("[DEBUG] This object does not exist."); return; } - if (player.isBotting == true) { - player.getActionSender().sendMessage("You can't click any objects until you confirm you are not botting."); - player.getActionSender().sendMessage("If you need to you can type ::amibotting, to see if your botting."); - return; - } Farming.openGuide(player, player.objectId); switch (objectType) { diff --git a/2006Redone Server/src/redone/game/players/Player.java b/2006Redone Server/src/redone/game/players/Player.java index 838304db..491fb425 100644 --- a/2006Redone Server/src/redone/game/players/Player.java +++ b/2006Redone Server/src/redone/game/players/Player.java @@ -17,7 +17,7 @@ public abstract class Player { public String currentTime, date, creationAddress = "", slayerMaster; - public boolean lostCannon = false; + public boolean lostCannon = false, refresh = false; public ArrayList killedPlayers = new ArrayList(); public ArrayList attackedPlayers = new ArrayList(); diff --git a/2006Redone Server/src/redone/game/players/PlayerAssistant.java b/2006Redone Server/src/redone/game/players/PlayerAssistant.java index cd218ad2..02892a3a 100644 --- a/2006Redone Server/src/redone/game/players/PlayerAssistant.java +++ b/2006Redone Server/src/redone/game/players/PlayerAssistant.java @@ -776,6 +776,10 @@ public class PlayerAssistant { player.npcIndex = 0; player.playerIndex = 0; player.faceUpdate(0); + player.refresh = false; + if(player.heightLevel != height) { + player.refresh = true; + } player.teleHeight = height; // client.resetShaking(); player.isTeleporting = true; @@ -949,9 +953,13 @@ public class PlayerAssistant { } public void movePlayer(int x, int y, int h) { + player.refresh = false; player.resetWalkingQueue(); player.teleportToX = x; player.teleportToY = y; + if(player.heightLevel != h) { + player.refresh = true; + } player.heightLevel = h; player.getPlayerAssistant().requestUpdates(); } diff --git a/2006Redone Server/src/redone/game/players/PlayerHandler.java b/2006Redone Server/src/redone/game/players/PlayerHandler.java index d9858b19..bbbd0a6b 100644 --- a/2006Redone Server/src/redone/game/players/PlayerHandler.java +++ b/2006Redone Server/src/redone/game/players/PlayerHandler.java @@ -1,7 +1,6 @@ package redone.game.players; import java.net.InetSocketAddress; - import redone.Constants; import redone.Server; import redone.event.CycleEventHandler; @@ -10,6 +9,7 @@ import redone.game.npcs.Npc; import redone.game.npcs.NpcHandler; import redone.util.Misc; import redone.util.Stream; +import redone.world.GlobalDropsHandler; public class PlayerHandler { @@ -365,6 +365,11 @@ public class PlayerHandler { } str.endFrameVarSizeWord(); + + if (plr.refresh) { + GlobalDropsHandler.reset((Client)plr); + plr.refresh = false; + } } private void removePlayer(Player plr) { diff --git a/2006Redone Server/src/redone/net/packets/impl/ChangeRegions.java b/2006Redone Server/src/redone/net/packets/impl/ChangeRegions.java index e1fabfc5..728b91b7 100644 --- a/2006Redone Server/src/redone/net/packets/impl/ChangeRegions.java +++ b/2006Redone Server/src/redone/net/packets/impl/ChangeRegions.java @@ -22,7 +22,7 @@ public class ChangeRegions implements PacketType { Doors.getSingleton().load(); Server.itemHandler.reloadItems(c); Server.objectManager.loadObjects(c); - GlobalDropsHandler.load(c); + GlobalDropsHandler.reset(c); c.getPlayerAssistant().removeObjects();// testing c.saveFile = true; if (c.skullTimer > 0) { diff --git a/2006Redone Server/src/redone/net/packets/impl/Chat.java b/2006Redone Server/src/redone/net/packets/impl/Chat.java index d492ec63..53b7ab35 100644 --- a/2006Redone Server/src/redone/net/packets/impl/Chat.java +++ b/2006Redone Server/src/redone/net/packets/impl/Chat.java @@ -22,7 +22,7 @@ public class Chat implements PacketType { if (AntiSpam.blockedWords(player, word, true) && !Connection.isMuted(player)) { player.setChatTextUpdateRequired(true); } - System.out.println(word); + //System.out.println(word); if (Connection.isMuted(player)) { player.getActionSender().sendMessage("You are muted and can't speak."); player.setChatTextUpdateRequired(false); diff --git a/2006Redone Server/src/redone/world/GlobalDropsHandler.java b/2006Redone Server/src/redone/world/GlobalDropsHandler.java index 70998e77..dcb6931c 100644 --- a/2006Redone Server/src/redone/world/GlobalDropsHandler.java +++ b/2006Redone Server/src/redone/world/GlobalDropsHandler.java @@ -3,8 +3,9 @@ package redone.world; import java.io.BufferedReader; import java.io.FileReader; import java.util.ArrayList; +import java.util.HashSet; import java.util.List; - +import java.util.Set; import redone.event.CycleEvent; import redone.event.CycleEventContainer; import redone.event.CycleEventHandler; @@ -23,12 +24,14 @@ public class GlobalDropsHandler { /** * time in seconds it takes for the item to respawn */ - private static final int TIME_TO_RESPAWN = 30; + private static final int TIME_TO_RESPAWN = 20; /** * holds all the objects */ private static List globalDrops = new ArrayList(); + + private static Set spawnedDrops = new HashSet<>(); /** * loads the items @@ -37,16 +40,17 @@ public class GlobalDropsHandler { String Data; BufferedReader Checker; try { - Checker = new BufferedReader(new FileReader( - "./data/cfg/globaldrops.txt")); + Checker = new BufferedReader(new FileReader("./data/cfg/globaldrops.txt")); while ((Data = Checker.readLine()) != null) { if (Data.startsWith("#")) { continue; } String[] args = Data.split(":"); - globalDrops.add(new GlobalDrop(Integer.parseInt(args[0]), - Integer.parseInt(args[1]), Integer.parseInt(args[2]), - Integer.parseInt(args[3]))); + if(args.length == 5) { + globalDrops.add(new GlobalDrop(Integer.parseInt(args[0]), Integer.parseInt(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3]), Integer.parseInt(args[4]))); + } else { + globalDrops.add(new GlobalDrop(Integer.parseInt(args[0]), Integer.parseInt(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3]))); + } } Checker.close(); } catch (Exception e) { @@ -54,31 +58,55 @@ public class GlobalDropsHandler { } Misc.println("Loaded " + globalDrops.size() + " global drops."); - for (Player player : PlayerHandler.players) { - final Client client = (Client) player; - if (client != null) { - CycleEventHandler.getSingleton().addEvent(client, new CycleEvent() { - @Override - public void execute(CycleEventContainer container) { - for (GlobalDrop drop : globalDrops) { - if (drop.isTaken()) { - if (System.currentTimeMillis() - drop.getTakenAt() >= TIME_TO_RESPAWN * 1000) { - drop.setTaken(false); - if (client.distanceToPoint(drop.getX(), drop.getY()) <= 60) { - client.getActionSender().createGroundItem(drop.getId(), drop.getX(), drop.getY(), drop.getAmount(), 0); + for (Player player : PlayerHandler.players) { + Client player2 = (Client) player; + if(player2 != null) { + CycleEventHandler.getSingleton().addEvent(player, new CycleEvent() { + @Override + public void execute(CycleEventContainer container) { + for (GlobalDrop drop : globalDrops) { + if (drop.isTaken() && drop.isSpawned()) { + if (System.currentTimeMillis() - drop.getTakenAt() >= TIME_TO_RESPAWN * 1000) { + drop.setTaken(false); + if (player2.distanceToPoint(drop.getX(), drop.getY()) <= 60) { + player2.getActionSender().createGroundItem(drop.getId(), drop.getX(), drop.getY(), drop.getAmount(), drop.getHeight()); + spawnedDrops.add(drop); + } + } } } } - } - @Override - public void stop() { - // TODO Auto-generated method stub - } + @Override + public void stop() { + + } }, 1); } } } + + public static void read() { + String Data; + BufferedReader Checker; + try { + Checker = new BufferedReader(new FileReader("./data/cfg/globaldrops.txt")); + while ((Data = Checker.readLine()) != null) { + if (Data.startsWith("#")) { + continue; + } + String[] args = Data.split(":"); + if(args.length == 5) { + globalDrops.add(new GlobalDrop(Integer.parseInt(args[0]), Integer.parseInt(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3]), Integer.parseInt(args[4]))); + } else { + globalDrops.add(new GlobalDrop(Integer.parseInt(args[0]), Integer.parseInt(args[1]), Integer.parseInt(args[2]), Integer.parseInt(args[3]))); + } + } + Checker.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } /** * See if a drop exists at the given place @@ -99,12 +127,21 @@ public class GlobalDropsHandler { } return null; } + + public static boolean itemExists(int a, int b, int c, boolean yes) { + for (GlobalDrop drop : spawnedDrops) { + if (drop.getId() == a && drop.getX() == b && drop.getY() == c) { + return true; + } + } + return false; + } /** * Pick up an item at the given location * - * @param client - * the client + * @param Player + * the Player * @param a * item id * @param b @@ -112,7 +149,7 @@ public class GlobalDropsHandler { * @param c * cord y */ - public static void pickup(Client client, int a, int b, int c) { + public static void pickup(Client Player, int a, int b, int c) { GlobalDrop drop = itemExists(a, b, c); if (drop == null) { return; @@ -120,19 +157,15 @@ public class GlobalDropsHandler { if (drop.isTaken()) { return; } - drop.setTakenAt(System.currentTimeMillis()); - drop.setTaken(true); - if (client.getItemAssistant().freeSlots() > 0) { - client.getItemAssistant().addItem(drop.getId(), drop.getAmount()); - } - // TODO use the region manager for this... - for (Player player : PlayerHandler.players) { - Client cl = (Client) player; - if (cl != null) { - if (cl.distanceToPoint(drop.getX(), drop.getY()) <= 60) { - // cl.getItems().removeGroundItem(drop.getId(), drop.getX(), - // drop.getY(), drop.getAmount()); + if (Player.getItemAssistant().freeSlots() > 0) { + Player.getItemAssistant().addItem(drop.getId(), drop.getAmount()); + drop.setTakenAt(System.currentTimeMillis()); + drop.setTaken(true); + for (Player player : PlayerHandler.players) { + Client cl = (Client) player; + if (cl != null) { cl.getActionSender().removeGroundItem(drop.getId(), drop.getX(), drop.getY(), drop.getAmount()); + spawnedDrops.remove(drop); } } } @@ -141,15 +174,33 @@ public class GlobalDropsHandler { /** * Loads all the items when a player changes region * - * @param client - * the client + * @param Player + * the Player */ - public static void load(Client client) { + public static void load(Client player) { for (GlobalDrop drop : globalDrops) { - if (!drop.isTaken()) { - if (client.distanceToPoint(drop.getX(), drop.getY()) <= 60) { - client.getActionSender().createGroundItem(drop.getId(), drop.getX(), drop.getY(), drop.getAmount(), 0); - } + if (!drop.isTaken() && !drop.isSpawned() && !itemExists(drop.getId(), drop.getX(), drop.getY(), true) && player.distanceToPoint(drop.getX(), drop.getY()) <= 60) { + player.getActionSender().createGroundItem(drop.getId(), drop.getX(), drop.getY(), drop.getAmount(), drop.getHeight()); + spawnedDrops.add(drop); + drop.setSpawned(true); + } + } + } + + public static void reset(Client player) { + for(GlobalDrop drop : globalDrops) { + if(player.distanceToPoint(drop.getX(), drop.getY()) <= 60) { + player.getActionSender().removeGroundItem(drop.getId(), drop.getX(), drop.getY(), drop.getAmount()); + } + } + spawnedDrops.clear(); + globalDrops.clear(); + read(); + for (GlobalDrop drop : globalDrops) { + if (!drop.isTaken() && !drop.isSpawned() && !itemExists(drop.getId(), drop.getX(), drop.getY(), true) && player.distanceToPoint(drop.getX(), drop.getY()) <= 60) { + player.getActionSender().createGroundItem(drop.getId(), drop.getX(), drop.getY(), drop.getAmount(), drop.getHeight()); + spawnedDrops.add(drop); + drop.setSpawned(true); } } } @@ -164,11 +215,13 @@ public class GlobalDropsHandler { /** * cord x */ - int x; + int itemX; /** * cord y */ - int y; + int itemY; + + private int height; /** * item id */ @@ -181,6 +234,9 @@ public class GlobalDropsHandler { * has the item been taken */ boolean taken = false; + + private boolean spawned = false; + /** * Time it was taken at */ @@ -189,20 +245,29 @@ public class GlobalDropsHandler { /** * Sets the drop arguments * - * @param a + * @param pickAxe * item id * @param b * item amount - * @param c + * @param player * cord x * @param d * cord y */ - public GlobalDrop(int a, int b, int c, int d) { - id = a; - amount = b; - x = c; - y = d; + + public GlobalDrop(int id, int amount, int itemX, int itemY) { + this.id = id; + this.amount = amount; + this.itemX = itemX; + this.itemY = itemY; + } + + public GlobalDrop(int id, int amount, int itemX, int itemY, int height) { + this.id = id; + this.amount = amount; + this.itemX = itemX; + this.itemY = itemY; + this.height = height; } /** @@ -211,7 +276,7 @@ public class GlobalDropsHandler { * @return return the statement */ public int getX() { - return x; + return itemX; } /** @@ -220,7 +285,7 @@ public class GlobalDropsHandler { * @return return the statement */ public int getY() { - return y; + return itemY; } /** @@ -279,6 +344,22 @@ public class GlobalDropsHandler { return takenAt; } + public boolean isSpawned() { + return spawned; + } + + public void setSpawned(boolean spawned) { + this.spawned = spawned; + } + + public int getHeight() { + return height; + } + + public void setHeight(int height) { + this.height = height; + } + } } diff --git a/2006Redone Server/src/redone/world/ItemHandler.java b/2006Redone Server/src/redone/world/ItemHandler.java index b1540004..68d8b952 100644 --- a/2006Redone Server/src/redone/world/ItemHandler.java +++ b/2006Redone Server/src/redone/world/ItemHandler.java @@ -406,7 +406,7 @@ public int itemAmount(String name, int itemId, int itemX, int itemY) { if (line.equals("[ENDOFITEMLIST]")) { try { characterfile.close(); - } catch (IOException ಠ_ಠ) {} + } catch (IOException e) {} //return true; } } diff --git a/2006Redone file_server/.classpath b/2006Redone file_server/.classpath index a5008158..c2048816 100644 --- a/2006Redone file_server/.classpath +++ b/2006Redone file_server/.classpath @@ -2,6 +2,6 @@ - + diff --git a/2006Redone file_server/.gitignore b/2006Redone file_server/.gitignore new file mode 100644 index 00000000..ae3c1726 --- /dev/null +++ b/2006Redone file_server/.gitignore @@ -0,0 +1 @@ +/bin/