diff --git a/2006Redone Server/src/com/rebotted/game/content/skills/thieving/Stalls.java b/2006Redone Server/src/com/rebotted/game/content/skills/thieving/Stalls.java index 286070f6..b2830ab2 100644 --- a/2006Redone Server/src/com/rebotted/game/content/skills/thieving/Stalls.java +++ b/2006Redone Server/src/com/rebotted/game/content/skills/thieving/Stalls.java @@ -10,7 +10,6 @@ import com.rebotted.game.content.skills.SkillHandler; import com.rebotted.game.items.ItemAssistant; import com.rebotted.game.items.ItemList; import com.rebotted.game.npcs.NpcHandler; -import com.rebotted.game.objects.Object; import com.rebotted.game.players.Player; import com.rebotted.util.Misc; @@ -18,30 +17,30 @@ public class Stalls { public static enum stallData { - VEGETABLE_STALL(4706, 2, 10, 0, new int[] { 1965, 1 }), - BAKER_STALL(2561, 5, 16, 3, new int[] { 2309, 1 }, new int[] { 1891, 1 }, new int[] { 1895, 1 }), - TEA_STALL(635, 5, 16, 0, new int[] {712, 1 }), - SILK_STALL(2560, 20, 24, 2, new int[] { 950, 1 }), - WINE_STALL(14011, 22, 27, 0, new int[] { 1935, 1 }, new int[] {i("jug of water"), 1 }, new int[] { i("jug of wine"), 1 }, - new int[] { i("grapes"), 1 }), SEED_STALL(7053, 27, 10, 0, new int[] { i("potato seed"), 1 }, new int[] {i("onion seed"), 1 }, - new int[] { i("cabbage seed"), 1 }, new int[] {i("tomato seed"), 1 }, new int[] { i("sweetcorn seed"), 1 }, new int[] { i("strawberry seed"), 1 }, - new int[] {i("watermelon seed"), 1 }, new int[] {i("barley seed"), 1 }, new int[] { i("jute seed"), 1 }, new int[] { i("marigold seed"), 1 }, - new int[] {i("rosemary seed"), 1 }, new int[] {i("hammerstone seed"), 1 }, new int[] {i("asgarnain seed"), 1 }, new int[] {i("yanillian seed"), 1 }, - new int[] {i("krandorian seed"), 1 }, new int[] {i("wildblood seed"), 1 }), FUR_STALL(2563, 35, 36, 0, new int[] { 6814, 1 }, new int[] { 958, 1 }), - FUR_STALL2(4278, 35, 36, 0, new int[] { 6814, 1 }, new int[] { 958, 1 }), - FISH_STALL(4705, 42, 42, 0, new int[] { 359, 1 }), - FISH_STALL2(4277, 42, 42, 0, new int[] { 359, 1 }), - SILVER_STALL(2565, 50, 54, 2, new int[] { 442, 1 }, new int[] { 2355, 1 }), + VEGETABLE_STALL(4706, 2, 10, 0, new int[] { 1965, 1 }), + BAKER_STALL(2561, 5, 16, 3, new int[] { 2309, 1 }, new int[] { 1891, 1 }, new int[] { 1895, 1 }), + TEA_STALL(635, 5, 16, 0, new int[] {712, 1 }), + SILK_STALL(2560, 20, 24, 2, new int[] { 950, 1 }), + WINE_STALL(14011, 22, 27, 0, new int[] { 1935, 1 }, new int[] {i("jug of water"), 1 }, new int[] { i("jug of wine"), 1 }, + new int[] { i("grapes"), 1 }), SEED_STALL(7053, 27, 10, 0, new int[] { i("potato seed"), 1 }, new int[] {i("onion seed"), 1 }, + new int[] { i("cabbage seed"), 1 }, new int[] {i("tomato seed"), 1 }, new int[] { i("sweetcorn seed"), 1 }, new int[] { i("strawberry seed"), 1 }, + new int[] {i("watermelon seed"), 1 }, new int[] {i("barley seed"), 1 }, new int[] { i("jute seed"), 1 }, new int[] { i("marigold seed"), 1 }, + new int[] {i("rosemary seed"), 1 }, new int[] {i("hammerstone seed"), 1 }, new int[] {i("asgarnain seed"), 1 }, new int[] {i("yanillian seed"), 1 }, + new int[] {i("krandorian seed"), 1 }, new int[] {i("wildblood seed"), 1 }), FUR_STALL(2563, 35, 36, 0, new int[] { 6814, 1 }, new int[] { 958, 1 }), + FUR_STALL2(4278, 35, 36, 0, new int[] { 6814, 1 }, new int[] { 958, 1 }), + FISH_STALL(4705, 42, 42, 0, new int[] { 359, 1 }), + FISH_STALL2(4277, 42, 42, 0, new int[] { 359, 1 }), + SILVER_STALL(2565, 50, 54, 2, new int[] { 442, 1 }, new int[] { 2355, 1 }), SPICE_STALL(2564, 65, 81.3, 0, new int[] { 2007, 1 }, new int[] { 946, 1 }, new int[] { 1550, 1 }), GEM_STALL(2562, 75, 160, 3, - new int[] { 1617, 1 }, new int[] { 1619, 1 }, new int[] { 1621, 1 }, new int[] { 1623, 1 }), + new int[] { 1617, 1 }, new int[] { 1619, 1 }, new int[] { 1621, 1 }, new int[] { 1623, 1 }), MAGIC_STALL(4877, 65, 100, 0, new int[] {i("air rune"), 1}, new int[] {i("water rune"), 1}, new int[] {i("fire rune"), 1}, new int[] {i("law rune"), 1}), SCIMITAR_STALL(4878, 65, 100, 0, new int[] {i("iron scimitar"), 1}, new int[] {i("steel scimitar"), 1}); - + private int objectId, levelReq, face; private int[][] stalls; private double xp; private long respawnTime; - + private stallData(final int objectId, final int levelReq, final double xp, final int face, final int[]... stalls) { this.objectId = objectId; this.levelReq = levelReq; @@ -72,7 +71,7 @@ public class Stalls { } } - + public static int r(int random) { return Misc.random(random); } @@ -121,8 +120,13 @@ public class Stalls { if(objectId == s.getObject()) { // Wait for respawn if (System.currentTimeMillis() < s.respawnTime) { - p.getPacketSender().sendMessage("You need to wait longer before you can thieve this stall!"); - return; + long timeFirstStealFromStall = s.respawnTime - (GameConstants.CYCLE_TIME * getRespawnTime(s.objectId)); + + // If stealing from stall at the same tick as another player + if(p.hasThievedStall() || System.currentTimeMillis() - timeFirstStealFromStall >= GameConstants.CYCLE_TIME) { + p.getPacketSender().sendMessage("You need to wait longer before you can thieve this stall!"); + return; + } } // Thieving level too low if (p.playerLevel[p.playerThieving] < s.getLevel()) { @@ -144,11 +148,13 @@ public class Stalls { s.respawnTime = System.currentTimeMillis() + (respawnTime * GameConstants.CYCLE_TIME); p.getPacketSender().sendMessage("You steal a " + ItemAssistant.getItemName(random[0]) + " from the stall."); p.getItemAssistant().addItem(random[0], random[1]); + p.setHasThievedStall(true); CycleEventHandler.getSingleton().addEvent(p, new CycleEvent() { @Override public void execute(CycleEventContainer container) { GameEngine.objectHandler.createAnObject(p, s.getObject(), x, y, s.getFace()); //new Object(objectId, x, y, 0, s.getFace(), 10, j, getRespawnTime(objectId)); + p.setHasThievedStall(false); container.stop(); } @Override @@ -194,7 +200,7 @@ public class Stalls { if (NpcHandler.npcs[i] != null) { if (NpcHandler.npcs[i].npcType == 32 || NpcHandler.npcs[i].npcType == 1317 || NpcHandler.npcs[i].npcType == 2236 || NpcHandler.npcs[i].npcType == 2571) { if (p.goodDistance(p.absX, p.absY, NpcHandler.npcs[i].absX, NpcHandler.npcs[i].absY, 7) - && p.heightLevel == NpcHandler.npcs[i].heightLevel) { + && p.heightLevel == NpcHandler.npcs[i].heightLevel) { if (!NpcHandler.npcs[i].underAttack) { NpcHandler.npcs[i].forceChat("What do you think you're doing?!?"); NpcHandler.npcs[i].underAttack = true; diff --git a/2006Redone Server/src/com/rebotted/game/players/Player.java b/2006Redone Server/src/com/rebotted/game/players/Player.java index e56b1cdc..da8346ab 100644 --- a/2006Redone Server/src/com/rebotted/game/players/Player.java +++ b/2006Redone Server/src/com/rebotted/game/players/Player.java @@ -75,7 +75,7 @@ import com.rebotted.util.Stream; import com.rebotted.world.ObjectManager; public abstract class Player { - + public byte buffer[] = null; public Stream inStream = null, outStream = null; public IoSession session; @@ -135,11 +135,11 @@ public abstract class Player { public SingleGates getSingleGates() { return singleGates; } - + public DoubleGates getDoubleGates() { return doubleGates; } - + public GateHandler getGateHandler() { return gateHandler; } @@ -155,19 +155,19 @@ public abstract class Player { public Mining getMining() { return mining; } - + public Barrows getBarrows() { return barrows; } - + public GlassBlowing getGlassBlowing() { return glassBlowing; } - + public RangersGuild getRangersGuild() { return rangersGuild; } - + public ObjectManager getObjectManager() { return objectManager; } @@ -251,7 +251,7 @@ public abstract class Player { public PlayerAction getPlayerAction() { return playeraction; } - + public Desert getDesert() { return desert; } @@ -365,16 +365,16 @@ public abstract class Player { } private Map interfaceText = new HashMap(); - + public class TinterfaceText { public int id; public String currentState; - + public TinterfaceText(String s, int id) { this.currentState = s; this.id = id; } - + } public boolean checkPacket126Update(String text, int id) { @@ -626,7 +626,7 @@ public abstract class Player { } @Override public void stop() { - + } }, 200); } @@ -644,7 +644,7 @@ public abstract class Player { public boolean isBusy() { return isBusy; } - + public int getLastLogin() { Calendar cal = new GregorianCalendar(); int day = cal.get(Calendar.DAY_OF_MONTH); @@ -974,7 +974,7 @@ public abstract class Player { /** * Outputs a send packet which is built from the data params provided * towards a connected user client channel. - * + * * @param id * The identification number of the sound. * @param volume @@ -1000,7 +1000,7 @@ public abstract class Player { /** * Outputs a send packet which is built from the data params provided * towards a connected user client channel. - * + * * @param id * The identification number of the sound. * @param volume @@ -1013,7 +1013,7 @@ public abstract class Player { /** * Outputs a send packet which is built from the data params provided * towards a connected user client channel. - * + * * @param id * The identification number of the sound. */ @@ -1023,7 +1023,7 @@ public abstract class Player { /** * Play sounds - * + * * @param SOUNDID * : ID * @param delay @@ -1074,14 +1074,14 @@ public abstract class Player { } @Override public void stop() { - + } }, 16); } } } } - + public void trawlerFade(final int x, final int y, final int height) { if (System.currentTimeMillis() - lastAction > 5000) { lastAction = System.currentTimeMillis(); @@ -1115,7 +1115,7 @@ public abstract class Player { }, 1); } } - + public void fade(final int x, final int y, final int height) { if (System.currentTimeMillis() - lastAction > 5000) { lastAction = System.currentTimeMillis(); @@ -1166,7 +1166,7 @@ public abstract class Player { /** * Sets the option clicked - * + * * @param i * the option clicked */ @@ -1174,19 +1174,19 @@ public abstract class Player { public void setOptionClicked(int i) { optionClicked = i; } - + public String statedInterface = ""; - + public String getStatedInterface() { return statedInterface; } - + public void setStatedInterface(String statedInterface) { this.statedInterface = statedInterface; } public String slayerMaster; - + public boolean lostCannon = false, refresh = false, isBot = false; public int CannonSetupStage; @@ -1194,7 +1194,7 @@ public abstract class Player { public ArrayList killedPlayers = new ArrayList(); public ArrayList attackedPlayers = new ArrayList(); public ArrayList lastKilledPlayers = new ArrayList(); - + public int[][] barrowCrypt = { {4921, 0}, {2035, 0} @@ -1242,7 +1242,7 @@ public abstract class Player { canWalkTutorial, closeTutorialInterface, isCrafting, showedUnfire, showedFire, isPotCrafting, isFiremaking, playerIsFletching, milking, stopPlayerPacket, spiritTree = false, isSmelting, - isSmithing, hasPaid, canTeleport, magicCharge, + isSmithing, hasPaid, canTeleport, magicCharge, clickedVamp = false, allowFading, otherBank = false, recievedReward = false, poison, golemSpawned = false, zombieSpawned = false, shadeSpawned = false, treeSpiritSpawned = false, chickenSpawned = false, clickedTree = false, filter = true, @@ -1273,7 +1273,7 @@ public abstract class Player { rememberNpcIndex, ratsCaught, lastLoginDate, selectedSkill, newHerb, newItem, newXp, doingHerb, herbAmount, treeX, treeY, lastH, cookingItem, cookingObject, summonId, npcId2 = 0, leatherType = -1, - weightCarried, teleotherType, rockX, rockY, itemUsing, tzKekTimer, + weightCarried, teleotherType, rockX, rockY, itemUsing, tzKekTimer, bananas, flourAmount, grain, questPoints, questStages, teleGrabItem, teleGrabX, teleGrabY, duelCount, underAttackBy, underAttackBy2, wildLevel, teleTimer, respawnTimer, saveTimer = 0, @@ -1381,11 +1381,11 @@ public abstract class Player { public boolean[] killedPheasant = new boolean[5]; public boolean playerHasRandomEvent; public boolean canLeaveArea; - + public int pieSelect = 0, getPheasent, kebabSelect = 0, breadID, chocSelect = 0, bagelSelect = 0, triangleSandwich = 0, squareSandwich = 0, breadSelect = 0; - + public String properName; public int lastX, lastY; public int[] voidStatus = new int[5]; @@ -1582,8 +1582,18 @@ public abstract class Player { public int XremoveSlot, XinterfaceID, XremoveID, Xamount; public boolean isMining; + public boolean hasThievedStall; + + public boolean hasThievedStall() { + return hasThievedStall; + } + + public void setHasThievedStall(boolean hasThievedStall) { + this.hasThievedStall = hasThievedStall; + } + public boolean antiFirePot = false; - + public boolean underWater = false; public boolean prevRunning2; public int prevPrevPlayerRunIndex; @@ -1597,7 +1607,7 @@ public abstract class Player { public Client asClient() { return (Client) this; } - + private Player player; public Player asPlayer() { return (Player) player; @@ -1609,7 +1619,7 @@ public abstract class Player { } return false; } - + public boolean inTrawlerGame() { if(inArea(2808, 2811,3415,3425)) { return true; @@ -1712,7 +1722,7 @@ public abstract class Player { } return false; } - + public boolean inKqArea() { if (absX >= 3467 && absX <= 3506 && absY >= 9477 && absY <= 9513) { return true; @@ -1803,23 +1813,23 @@ public abstract class Player { } return false; } - - + + public boolean playerIsBusy() { if(isShopping || inTrade || openDuel || isBanking || duelStatus == 1) { return true; } return false; } - - public boolean isInBarrows() { + + public boolean isInBarrows() { if(absX > 3543 && absX < 3584 && absY > 3265 && absY < 3311) { return true; } return false; } - - public boolean isInBarrows2() { + + public boolean isInBarrows2() { if(absX > 3529 && absX < 3581 && absY > 9673 && absY < 9722) { return true; } @@ -1845,7 +1855,7 @@ public abstract class Player { return isInAreaxxyy(3090, 3099, 3487, 3500) || isInAreaxxyy(3089, 3090, 3492, 3498) || isInAreaxxyy(3249, 3258, 3413, 3428) || isInAreaxxyy(3180, 3191, 3432, 3448) || isInAreaxxyy(2945, 2948, 3365, 3374) || isInAreaxxyy(2943, 2948, 3367, 3374) || isInAreaxxyy(2945, 2950, 3365, 3370) || isInAreaxxyy(3009, 3018, 3352, 3359) || isInAreaxxyy(3017, 3022, 3353, 3357); } - + public boolean inLumbBuilding() { return isInAreaxxyy(3205, 3216, 3209, 3228) || isInAreaxxyy(3229, 3233, 3206, 3208) || isInAreaxxyy(3228, 3233, 3201, 3205) || isInAreaxxyy(3230, 3237, 3195, 3198) || isInAreaxxyy(3238, 3229, 3209, 3211) || isInAreaxxyy(3240, 3247, 3204, 3215) || isInAreaxxyy(3247, 3252, 3190, 3195) || isInAreaxxyy(3227, 3230, 3212, 3216) || isInAreaxxyy(3227, 3230, 3221, 3225) || isInAreaxxyy(3229, 3232, 3236, 3241) || @@ -2125,7 +2135,7 @@ public abstract class Player { walkingQueueY[wQueueWritePtr] = y; wQueueWritePtr = next; } - + public boolean goodDistance(int objectX, int objectY, int playerX, int playerY, int distance) { return ((objectX-playerX <= distance && objectX-playerX >= -distance) && (objectY-playerY <= distance && objectY-playerY >= -distance)); } @@ -3088,11 +3098,11 @@ public abstract class Player { } public void setInStreamDecryption(ISAACRandomGen inStreamDecryption) { - + } public void setOutStreamDecryption(ISAACRandomGen outStreamDecryption) { - + } public boolean samePlayer() { @@ -3115,7 +3125,7 @@ public abstract class Player { logoutDelay = System.currentTimeMillis(); singleCombatDelay = System.currentTimeMillis(); } - + public void dealDamage(int damage) { if (teleTimer <= 0) { @@ -3133,7 +3143,7 @@ public abstract class Player { } } } - + public void appendRedemption() { Client c = (Client) PlayerHandler.players[playerId]; if (c.getPrayer().prayerActive[22]) {