diff --git a/.gitignore b/.gitignore
index b3833c21..33601148 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
2006Redone\ Server/data/characters/
.idea/
+.idea/workspace.xml
diff --git a/.idea/misc.xml b/.idea/misc.xml
index dc3ff854..048d263d 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 588ee8b9..dc16a57c 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -7,13 +7,13 @@
-
-
-
-
-
-
+
+
+
+
+
+
@@ -21,9 +21,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ math.sq
+
+
+
+
+
@@ -44,7 +96,7 @@
-
+
@@ -87,8 +139,8 @@
-
+
@@ -106,17 +158,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/2006Redone Server/data/logs/shopbuying/bot.txt b/2006Redone Server/data/logs/shopbuying/bot.txt
new file mode 100644
index 00000000..a9e6c370
--- /dev/null
+++ b/2006Redone Server/data/logs/shopbuying/bot.txt
@@ -0,0 +1 @@
+[2019/11/08] 19:22 bot bought newcomer map from store id: 88 for 1 coins
diff --git a/2006Redone Server/data/logs/shopselling/bot.txt b/2006Redone Server/data/logs/shopselling/bot.txt
new file mode 100644
index 00000000..3644cbe6
--- /dev/null
+++ b/2006Redone Server/data/logs/shopselling/bot.txt
@@ -0,0 +1 @@
+[2019/11/08] 19:22 bot sold newcomer map to store id: 88 for 1 coins
diff --git a/2006Redone Server/src/redone/game/content/combat/CombatAssistant.java b/2006Redone Server/src/redone/game/content/combat/CombatAssistant.java
index bfdf107b..8d37c187 100644
--- a/2006Redone Server/src/redone/game/content/combat/CombatAssistant.java
+++ b/2006Redone Server/src/redone/game/content/combat/CombatAssistant.java
@@ -2057,20 +2057,20 @@ public class CombatAssistant {
return false;
}
}
- if (CastOnOther.castOnOtherSpells(c)) {
+ if (CastOnOther.castOnOtherSpells(c.castingSpellId)) {
return true;
}
if (!PlayerHandler.players[c.playerIndex].inWild()
&& !PlayerHandler.players[c.playerIndex].inCwGame()
- && !CastOnOther.castOnOtherSpells(c)) {
+ && !CastOnOther.castOnOtherSpells(c.castingSpellId)) {
c.getActionSender().sendMessage(
- "That player is not in the wilderness.");
+ "That player is not in the wilderness." + c.castingSpellId);
c.stopMovement();
resetPlayerAttack();
return false;
}
if (!c.inWild() && !PlayerHandler.players[c.playerIndex].inCwGame()
- && !CastOnOther.castOnOtherSpells(c)) {
+ && !CastOnOther.castOnOtherSpells(c.castingSpellId)) {
c.getActionSender().sendMessage(
"You are not in the wilderness.");
c.stopMovement();
diff --git a/2006Redone Server/src/redone/game/content/combat/magic/CastOnOther.java b/2006Redone Server/src/redone/game/content/combat/magic/CastOnOther.java
index fe7e4bcd..a11107d7 100644
--- a/2006Redone Server/src/redone/game/content/combat/magic/CastOnOther.java
+++ b/2006Redone Server/src/redone/game/content/combat/magic/CastOnOther.java
@@ -8,10 +8,10 @@ import redone.game.players.PlayerHandler;
public class CastOnOther extends CastRequirements {
- public static boolean castOnOtherSpells(Client c) {
+ public static boolean castOnOtherSpells(int castingSpellId) {
int[] spells = { 12435, 12455, 12425, 30298, 30290, 30282, };
for (int spell : spells) {
- if (c.castingSpellId == spell) {
+ if (castingSpellId == spell) {
return true;
}
}
@@ -44,9 +44,9 @@ public class CastOnOther extends CastRequirements {
if (castOn != null) {
if (castOn.distanceToPoint(c.absX, c.absY) <= 15) {
if (c.heightLevel == castOn.heightLevel) {
- c.getPlayerAssistant().sendFrame126(location[type], 12560);
- c.getPlayerAssistant().sendFrame126(c.playerName, 12558);
- c.getPlayerAssistant().showInterface(12468);
+ castOn.getPlayerAssistant().sendFrame126(location[type], 12560);
+ castOn.getPlayerAssistant().sendFrame126(c.playerName, 12558);
+ castOn.getPlayerAssistant().showInterface(12468);
castOn.teleotherType = type;
}
}
@@ -57,7 +57,7 @@ public class CastOnOther extends CastRequirements {
boolean decline) {
c.getPlayerAssistant().removeAllWindows();
final int[][] coords = { { 3222, 3218 }, // LUMBRIDGE
- { 2964, 3378 }, // FALADOR
+ { 2967, 3378 }, // FALADOR
{ 2757, 3477 }, // CAMELOT
};
if (!decline) {
diff --git a/2006Redone Server/src/redone/game/players/Trading.java b/2006Redone Server/src/redone/game/players/Trading.java
index e839a0af..3e434b3a 100644
--- a/2006Redone Server/src/redone/game/players/Trading.java
+++ b/2006Redone Server/src/redone/game/players/Trading.java
@@ -70,9 +70,9 @@ public class Trading {
}
}
public boolean isCloseTo(Client tradedPlayer) {
- ValueRange PlayerCoordRangeX = ValueRange.of(tradedPlayer.currentX - 3, tradedPlayer.currentX + 3);
- ValueRange PlayerCoordRangeY = ValueRange.of(tradedPlayer.currentY - 3, tradedPlayer.currentY + 3);
- if (PlayerCoordRangeX.isValidIntValue(player.currentX) && PlayerCoordRangeY.isValidIntValue(player.currentY)) {
+ ValueRange PlayerCoordRangeX = ValueRange.of(tradedPlayer.absX - 3, tradedPlayer.absX + 3);
+ ValueRange PlayerCoordRangeY = ValueRange.of(tradedPlayer.absY - 3, tradedPlayer.absY + 3);
+ if (PlayerCoordRangeX.isValidIntValue(player.absX) && PlayerCoordRangeY.isValidIntValue(player.absY)) {
return true;
} else {
return false;
@@ -252,9 +252,6 @@ public class Trading {
if (o == null) {
return false;
}
- player.getActionSender().sendMessage("amount: " + amount);
- player.getActionSender().sendMessage("player.playerItems[fromSlot]: " + player.playerItems[fromSlot]);
- player.getActionSender().sendMessage("itemID + 1: " + itemID + 1);
if (!(player.playerItems[fromSlot] == itemID + 1 )){//&& player.playerItemsN[fromSlot] >= amount)) { I removed this check to permit trading max amount of item in inventory even when amount is higher than quantity in inventory.
player.getActionSender().sendMessage("You don't have that amount!");
return false;
diff --git a/2006Redone Server/src/redone/game/shops/ShopAssistant.java b/2006Redone Server/src/redone/game/shops/ShopAssistant.java
index 70a6e08d..c9fc3eaa 100644
--- a/2006Redone Server/src/redone/game/shops/ShopAssistant.java
+++ b/2006Redone Server/src/redone/game/shops/ShopAssistant.java
@@ -394,7 +394,7 @@ public class ShopAssistant {
addShopItem(itemID, amount); //Add item to the shop.
if (player.getPlayerAssistant().isPlayer()) { //Logger
GameLogger.writeLog(player.playerName, "shopselling", player.playerName + " sold " + itemName + " to store id: " + player.myShopId + " for" + GameLogger.formatCurrency(TotPrice2) + " coins");
- player.getActionSender().sendMessage("You sold " + amount + " " +itemName + " for " + TotPrice2 + " gp." );
+ //Remove this later. I added it to push this class because a fuck happened with my last commit.
}
} else {
player.getActionSender().sendMessage("You don't have enough space in your inventory.");
diff --git a/2006Redone Server/src/redone/net/packets/impl/AttackPlayer.java b/2006Redone Server/src/redone/net/packets/impl/AttackPlayer.java
index dd9d721a..7ac21afc 100644
--- a/2006Redone Server/src/redone/net/packets/impl/AttackPlayer.java
+++ b/2006Redone Server/src/redone/net/packets/impl/AttackPlayer.java
@@ -181,6 +181,7 @@ public class AttackPlayer implements PacketType {
* Attack player with magic
**/
case MAGE_PLAYER:
+ c.getActionSender().sendMessage("maging");
if (!c.mageAllowed) {
c.mageAllowed = true;
break;
@@ -195,9 +196,10 @@ public class AttackPlayer implements PacketType {
c.playerIndex = c.getInStream().readSignedWordA();
int castingSpellId = c.getInStream().readSignedWordBigEndian();
+ c.castingSpellId = castingSpellId;
c.usingMagic = false;
- boolean teleother = CastOnOther.castOnOtherSpells(c);
+ boolean teleother = CastOnOther.castOnOtherSpells(castingSpellId);
if (PlayerHandler.players[c.playerIndex] == null) {
break;
@@ -209,11 +211,28 @@ public class AttackPlayer implements PacketType {
if (c.playerRights == 3) {
c.getActionSender().sendMessage(
- "Casting Spell id: " + c.castingSpellId + ".");
+ "Casting Spell id: " + castingSpellId + ".");
}
+
+ if (teleother) {
+ c.stopMovement();
+ c.getCombatAssistant().resetPlayerAttack();
+ if (c.inTrade) {
+ c.getTrading().declineTrade(true);
+ }
+ if (c.inWild()
+ && c.wildLevel > Constants.NO_TELEPORT_WILD_LEVEL) {
+ c.getActionSender().sendMessage(
+ "You can't teleport above level "
+ + Constants.NO_TELEPORT_WILD_LEVEL
+ + " in the wilderness.");
+ break;
+ }
+ }
+
switch (c.castingSpellId) {
case 12425:
- CastOnOther.teleOtherDistance(c, 1, c.playerIndex);
+ CastOnOther.teleOtherDistance(c, 0, c.playerIndex);
break;
case 12435:
CastOnOther.teleOtherDistance(c, 1, c.playerIndex);
@@ -222,12 +241,10 @@ public class AttackPlayer implements PacketType {
CastOnOther.teleOtherDistance(c, 2, c.playerIndex);
break;
}
+
if (teleother) {
c.stopMovement();
c.getCombatAssistant().resetPlayerAttack();
- if (c.inTrade) {
- c.getTrading().declineTrade(true);
- }
}
for (int i = 0; i < MagicData.MAGIC_SPELLS.length; i++) {
@@ -290,9 +307,8 @@ public class AttackPlayer implements PacketType {
}
if (c.usingMagic) {
- if (c.goodDistance(c.getX(), c.getY(),
- PlayerHandler.players[c.playerIndex].getX(),
- PlayerHandler.players[c.playerIndex].getY(), 7)) {
+ if (c.goodDistance(c.getX(), c.getY(), PlayerHandler.players[c.playerIndex].getX(), PlayerHandler.players[c.playerIndex].getY(), 7))
+ {
c.stopMovement();
}
if (c.getCombatAssistant().checkReqs()) {
@@ -302,7 +318,6 @@ public class AttackPlayer implements PacketType {
}
}
break;
-
}
}