Implement Party Room, A bunch of client side changes, Other stuff (#503)

* Fixup Discord links

* Fix required level to chop Dramen tree

* More Discord link fixes

* Show bots as (store)

* Fixup port

move to port 8080 as used by file server

* Fixup report handler

* Some client changes

* minor changes

Show mod status

* Show item value on ground

* Mark stores and players differently on mini map

* Some tidy up

* default to world 1

* Update trade with text

* revert nodeID changes

* Update RS Guide name

* Remove some command aliases

* Log bots and players differently

* Fixup

* minor changes

* Fixup colors

* Update RSInterface.java

* Settings for controlling options

* Add memory command

* Update server skill magic numbers

* Update server skill magic numbers

* Update colors for ground item text

* Update .gitignore

* Update player health value more often

* Add in game item/NPC/object search

* Item amounts and value displayed

* Update examine text

* Start with volume off

* Fixup tab 7 still showing with other interfaces

* Fixup search

* Fixup entering numbers after letter in amounts

* minor fixup

* fix indentation

* change type of value

* Fixup values shown

* Fix when clicking while tab 7 open

* Fixup negative amounts

* Update some method names

* Fixup method name

* tidy up method values

* Initial move for overlays

* Update more method names, variables

* Update debug menu

* Update experience info area

* Update Signlink.java

* more refactoring/deob

* Tidy up

* refresh skills

* Update method name, debug display

* fixup

* Show wrench icon on custom settings tab

* alignment

* Modify zoom

* Use smaller numbers for exp/h

* Update interface command

* tidy up

* Fixup tele location

* Fixup if interface doesn't exist

* Add some interface options

* Update checks

* Open bank interface for item search

TODO:
change title
maybe not display in chat
change options for items?
change command to searchitem - open the bank interface, open a text input interface

* re-fix

* Show open interface ID

* Update bank string shown

* Update search function

* Scroll zooming

* Only fill chat with search if not searching for an item

* add comments

* Change system update message

* Remove fps command

* Increase draw distance

* fixup

* Draw distance option

* [Party Room] Fix party room stairs

* Add new free slots method to check for stackable items counting as a free slot

* [Party Room] Deposit/Withdraw items all working

* [Party Room] Fully working

* [Party Room] Don't spawn balloons on the table

Players cannot pickup the items

* Fixup boundary

* Drop items in random amounts up to 4 stacks

* Update swampy boat to work

* Minor fixup

* Update Game.java

* Move player name up slightly

* Update some naming

* Tidy up

* Add ectoplasm agility shortcuts

* Update ObjectsActions.java

* Ectofuntus stuff

* fixup

* Ectofuntus bone grinder get status

* auto worship

* Allow claiming ecto-tokens

* change variable

* fixup

* Make use of GameConstants.WORLD

* Randomize bot passwords

* Don't show player shops as online

* Update opening oysters

* Update GemCutting.java

* Dragontooth island transport

* Ectofuntus stuff

* More constants

* Bill teach travel to Mos Le'Harmless and back

Also able to explore the whole ship

* Use better looking buttons

* Update .gitignore
This commit is contained in:
Danial
2021-09-29 11:40:34 +13:00
committed by GitHub
parent d30e833dd8
commit 8589277ece
51 changed files with 1756 additions and 717 deletions
@@ -15,8 +15,8 @@ public class GameConstants {
MESSAGE_DELAY = 6000, MAX_PLAYERS = 200, REQ_AMOUNT = 150;
public final static boolean SOUND = true,
GUILDS = true, WORLD_LIST_FIX = false,
PARTY_ROOM_DISABLED = true,
GUILDS = true,
PARTY_ROOM_DISABLED = false,
PRINT_OBJECT_ID = false, EXPERIMENTS = false;
public static int[] SIDEBARS = { 2423, 3917, 638, 3213, 1644, 5608, 1151,
@@ -24,7 +24,7 @@ public class GameConstants {
public static boolean TUTORIAL_ISLAND = false,
MEMBERS_ONLY = false, sendServerPackets = false,
CLUES_ENABLED = false;
CLUES_ENABLED = true;
public final static int[] FUN_WEAPONS = { 2460, 2461, 2462, 2463, 2464,
2465, 2466, 2467, 2468, 2469, 2470, 2471, 2471, 2473, 2474, 2475,
@@ -52,7 +52,7 @@ public class GameConstants {
public final static int CASTLE_WARS_Y = 3087;
public static double XP_RATE = 1;
public static double XP_RATE = 10;
public final static int SAVE_TIMER = 120; // save every x seconds
@@ -231,6 +231,7 @@ public class GameEngine {
CastleWars.process();
FightPits.process();
pestControl.process();
objectHandler.process();
CycleEventHandler.getSingleton().process();
PlayersOnlineWebsite.addUpdatePlayersOnlineTask();
if(GameConstants.WEBSITE_TOTAL_CHARACTERS_INTEGRATION) {
@@ -17,14 +17,13 @@ public class Bot {
public Bot(String username, Integer x, Integer y, Integer z) {
botClient = new Client(null);
botClient.playerName = username;
botClient.playerName = username;
botClient.playerName2 = botClient.playerName;
// TODO: randomize the bot passwords
botClient.playerPass = "bot_password";
botClient.properName = Character.toUpperCase(username.charAt(1)) + username.substring(2);
// TODO: randomize the bot passwords
botClient.playerPass = generatePassword(10);
botClient.saveFile = true;
botClient.saveCharacter = true;
@@ -33,9 +32,11 @@ public class Bot {
botClient.npcCanAttack = false;
botClient.canWalkTutorial = true;
botClient.tutorialProgress = 36;
botClient.privateChat = 2;
GameEngine.playerHandler.newPlayerClient(botClient);
loadPlayerInfo(botClient, username, "bot_password", false);
// password doesn't matter as it's not doing a real login
loadPlayerInfo(botClient, username, botClient.playerPass, false);
if (x != null) {
botClient.getPlayerAssistant().movePlayer(x, y, z);
@@ -96,4 +97,17 @@ public class Bot {
return price + "gp";
}
}
public String generatePassword(int targetStringLength) {
int leftLimit = 97; // letter 'a'
int rightLimit = 122; // letter 'z'
Random random = new Random();
StringBuilder buffer = new StringBuilder(targetStringLength);
for (int i = 0; i < targetStringLength; i++) {
int randomLimitedInt = leftLimit + (int)
(random.nextFloat() * (rightLimit - leftLimit + 1));
buffer.append((char) randomLimitedInt);
}
return buffer.toString();
}
}
@@ -14,7 +14,7 @@ public enum SpellTeleport {
SENNTISTEN(60, 50245, 70, 3321, 3335, 0, new int[][] {{566, 1}, {563, 2}}, "ancient"),
KHARYLL(66, 50253, 76, 3493, 3472, 0, new int[][] {{565, 1}, {563, 2}}, "ancient"),
LASSAR(72, 51005, 82, 3006, 3471, 0, new int[][] {{563, 2}, {555, 4}}, "ancient"),
DAREEYAK(78, 51013, 88, 3161, 3671, 0, new int[][] {{563, 2}, {554, 3}, {556, 2}}, "ancient"),
DAREEYAK(78, 51013, 88, 2966, 3697, 0, new int[][] {{563, 2}, {554, 3}, {556, 2}}, "ancient"),
CARRALLANGAR(84, 51023, 94, 3157, 3669, 0, new int[][] {{566, 2}, {563, 2}}, "ancient"),
ANNAKARL(90, 51031, 100, 3286, 3884, 0, new int[][] {{565, 2}, {563, 2}}, "ancient"),
GHORROCK(96, 51039, 106, 2977, 3873, 0, new int[][] {{563, 2}, {555, 8}}, "ancient");
@@ -1,6 +1,5 @@
package com.rs2.game.content.random;
import java.awt.Point;
import java.util.Random;
import com.rs2.GameEngine;
import com.rs2.game.objects.Objects;
@@ -9,45 +8,61 @@ import com.rs2.game.players.Player;
public class Balloons extends Objects {
static Random r = new Random();
public static int item, amount;
public static int x, y;
public static int minID = 115;
public static int maxID = 120;
public int item, amount;
@SuppressWarnings("static-access")
public Balloons(int id, int x, int y, int height, int face, int type,
int ticks, int item, int amount) {
super(id, x, y, height, face, type, ticks);
this.x = x;
this.y = y;
public Balloons(int x, int y, int height, int face, int type, int ticks, int item, int amount) {
super(getRandomBalloon(), x, y, height, face, type, ticks);
GameEngine.objectHandler.addObject(this);
GameEngine.objectHandler.placeObject(this);
this.item = item;
this.amount = amount;
}
public static void popBalloon(Player player, int x, int y) {
PartyRoom.coords.remove(getCoords());
Balloons empty = remove(x, y);
GameEngine.itemHandler.createGroundItem(player, item, x, y, amount, player.playerId);
item = 0;
amount = 0;
GameEngine.objectHandler.addObject(empty);
GameEngine.objectHandler.placeObject(empty);
public static Balloons getBalloon(int x, int y, int height, int item, int amount) {
return new Balloons(x, y, 0, 0, 10, 0, item, amount);
}
public static Balloons getBalloon(int x, int y, int item, int amount) {
return getBalloon(x, y, 0, item, amount);
}
public static Balloons getEmpty(int x, int y, int height) {
return getBalloon(x, y, height, 0, 0);
}
public static Balloons getEmpty(int x, int y) {
return getEmpty(x, y, 0);
}
public void popBalloon(Player player) {
remove();
if (item > 0 && amount > 0) {
GameEngine.itemHandler.createGroundItem(player, item, objectX, objectY, amount, player.playerId);
item = 0;
amount = 0;
}
player.startAnimation(794);
}
public static Point getCoords() {
return new Point(x, y);
public static int getRandomBalloon() {
// between 115 and 122
return 115 + r.nextInt(8);
}
public static Balloons getBalloon(int item, int amount) {
return new Balloons(115 + r.nextInt(5), 2730 + r.nextInt(13),
3462 + r.nextInt(13), 0, 0, 10, 0, item, amount);
public int getPoppedBalloon() {
// between 115 and 122
return objectId + 8;
}
public static Balloons getEmpty() {
return new Balloons(115 + r.nextInt(5), 2730 + r.nextInt(13),
3462 + r.nextInt(13), 0, 0, 10, 0, 0, 0);
}
public static Balloons remove(int x, int y) {
return new Balloons(-1, x, y, 0, 0, 10, 0, 0, 0);
public void remove() {
// Spawn the popped balloons
Objects poppedBallons = new Objects(getPoppedBalloon(), objectX, objectY, objectHeight, objectFace, objectType, 0);
GameEngine.objectHandler.addObject(poppedBallons);
GameEngine.objectHandler.placeObject(poppedBallons);
// Remove the popped balloons
Objects empty = new Objects(-1, objectX, objectY, objectHeight, objectFace, objectType, 4);
GameEngine.objectHandler.addObject(empty);
}
}
@@ -9,15 +9,18 @@ import com.rs2.game.items.ItemConstants;
import com.rs2.game.items.ItemData;
import com.rs2.game.objects.Objects;
import com.rs2.game.players.Player;
import com.rs2.game.players.PlayerHandler;
import com.rs2.world.Boundary;
public class PartyRoom {
static int mainInterfaceID = 2156;
static Random r = new Random();
static int[] roomItems = new int[50];
static int[] roomItemsN = new int[50];
static int[] roomItems = new int[216];
static int[] roomItemsN = new int[216];
static Balloons[][] balloons = new Balloons[15][14];
static Point corner = new Point(2730, 3462);
static long lastAnnouncment;
static int announcmentFrequency = 1; // announcment frequency in mins
static ArrayList<Point> coords = new ArrayList<Point>();
public static int getAmount() {
int amount = 0;
@@ -37,47 +40,76 @@ public class PartyRoom {
}
public static void dropAll() {
int maxTry = 150;
int trys = 0;
int amount = getAmount();
if (amount < 1) {
return;
}
for (int x = 0; x < roomItems.length; x++) {
if (roomItemsN[x] > 0) {
Balloons b = null;
do {
b = Balloons.getBalloon(roomItems[x], roomItemsN[x]);
for (int i = 0; i < roomItems.length; i++) {
int split = r.nextInt(4);
while (roomItemsN[i] > 0) {
int x = r.nextInt(balloons.length);
int y = r.nextInt(balloons[0].length);
int amt = split > 0 ? Math.max(1, (int) (Math.random() * roomItemsN[i])) : roomItemsN[i];
// If already balloons there, or on the table, retry
while ((balloons[x][y] != null || Boundary.isIn(corner.x + x, corner.y + y, Boundary.PARTY_ROOM_TABLE)) && trys < maxTry) {
x = r.nextInt(balloons.length);
y = r.nextInt(balloons[0].length);
trys++;
} while (coords.contains(Balloons.getCoords()) && trys < 100);
GameEngine.objectHandler.addObject(b);
GameEngine.objectHandler.placeObject(b);
}
if (trys >= maxTry) {
break;
}
balloons[x][y] = Balloons.getBalloon(corner.x + x, corner.y + y, roomItems[i], amt);
GameEngine.objectHandler.addObject(balloons[x][y]);
GameEngine.objectHandler.placeObject(balloons[x][y]);
roomItemsN[i] -= amt;
if (roomItemsN[i] <= 0) {
roomItems[i] = 0;
}
split--;
}
if (trys > 100) {
break;
}
roomItems[x] = 0;
roomItemsN[x] = 0;
}
trys = 0;
for (int x = 0; x < amount * 2; x++) {
Objects o;
do {
o = Balloons.getEmpty();
} while (coords.contains(new Point(o.objectX, o.objectY))
&& trys < 100);
if (trys > 100) {
for (int i = 0; i < amount * 2; i++) {
int x = r.nextInt(balloons.length);
int y = r.nextInt(balloons[0].length);
// If already balloons there, or on the table, retry
while ((balloons[x][y] != null || Boundary.isIn(corner.x + x, corner.y + y, Boundary.PARTY_ROOM_TABLE)) && trys < maxTry) {
x = r.nextInt(balloons.length);
y = r.nextInt(balloons[0].length);
trys++;
}
if (trys >= maxTry) {
break;
}
GameEngine.objectHandler.addObject(o);
GameEngine.objectHandler.placeObject(o);
balloons[x][y] = Balloons.getEmpty(corner.x + x, corner.y + y);
GameEngine.objectHandler.addObject(balloons[x][y]);
GameEngine.objectHandler.placeObject(balloons[x][y]);
}
coords.clear();
}
public static int arraySlot(int[] array, int target) {
public static void popBalloon(Player player, int x, int y) {
x = x - corner.x;
y = y - corner.y;
Balloons balloon = balloons[x][y];
if (balloon != null) {
balloon.popBalloon(player);
}
balloons[x][y] = null;
}
public static int arraySlot(int[] array, int itemID) {
int spare = -1;
for (int x = 0; x < array.length; x++) {
if (array[x] == target) {
if (array[x] == itemID && ItemData.itemStackable[itemID]) {
return x;
} else if (spare == -1 && array[x] <= 0) {
spare = x;
@@ -90,10 +122,10 @@ public class PartyRoom {
if (!GameConstants.PARTY_ROOM_DISABLED) {
updateGlobal(player);
updateDeposit(player);
player.getItemAssistant().resetItems(5064);
player.getPacketSender().sendFrame248(2156, 5063);
player.getItemAssistant().resetItems(5064); // Player inventory
player.getPacketSender().sendFrame248(mainInterfaceID, 5063); // Party Drop Chest interface, Deposit interface
} else {
player.getPacketSender().sendMessage("The partyroom has been disabled.");
player.getPacketSender().sendMessage("The partyroom is currently disabled.");
}
}
@@ -103,8 +135,7 @@ public class PartyRoom {
if (ItemData.itemStackable[c.party[x]]) {
int slot = arraySlot(roomItems, c.party[x]);
if (slot < 0) {
c.getPacketSender().sendMessage(
"Theres not enough space left in the chest.");
c.getPacketSender().sendMessage("Theres not enough space left in the chest.");
break;
}
if (roomItems[slot] != c.party[x]) {
@@ -118,11 +149,9 @@ public class PartyRoom {
} else {
int left = c.partyN[x];
for (int y = 0; y < left; y++) {
int slot = arraySlot(roomItems, -2);
int slot = arraySlot(roomItems, c.party[x]);
if (slot < 0) {
c.getPacketSender()
.sendMessage(
"Theres not enough space left in the chest.");
c.getPacketSender().sendMessage("Theres not enough space left in the chest.");
break;
}
roomItems[slot] = c.party[x];
@@ -136,14 +165,19 @@ public class PartyRoom {
}
}
updateDeposit(c);
updateGlobal(c);
updateAll();
}
// public static void updateAll() {
// for (int x = 0; x < PlayerHandler.getPlayers().length; x++) {
// updateGlobal((Client) PlayerHandler.getPlayers()[x]);
// }
// }
public static void updateAll() {
for (Player p : PlayerHandler.players) {
if (p == null) {
continue;
}
if (p.lastMainFrameInterface == mainInterfaceID) {
updateGlobal(p);
}
}
}
public static void fix(Player c) {
for (int x = 0; x < 8; x++) {
@@ -156,7 +190,6 @@ public class PartyRoom {
}
public static void depositItem(Player player, int id, int amount) {
int slot = arraySlot(player.party, id);
for (int i : ItemConstants.ITEM_TRADEABLE) {
if (i == id) {
player.getPacketSender().sendMessage("You can't deposit this item.");
@@ -167,57 +200,66 @@ public class PartyRoom {
return;
}
}
if (player.getItemAssistant().getItemAmount(id) < amount) {
amount = player.getItemAssistant().getItemAmount(id);
}
amount = Math.min(player.getItemAssistant().getItemAmount(id), amount);
if (!player.getItemAssistant().playerHasItem(id, amount)) {
player.getPacketSender().sendMessage("You don't have that many items!");
return;
}
if (slot == -1) {
player.getPacketSender().sendMessage("You cant deposit more than 8 items at once.");
return;
}
player.getItemAssistant().deleteItem(id, amount);
if (player.party[slot] != id) {
player.party[slot] = id;
player.partyN[slot] = amount;
if (player.getItemAssistant().isStackable(id)) {
int slot = arraySlot(player.party, id);
if (slot == -1) {
player.getPacketSender().sendMessage("You can only deposit up to 8 items at once.");
return;
}
player.getItemAssistant().deleteItem(id, amount);
if (player.party[slot] != id) {
player.party[slot] = id;
player.partyN[slot] = amount;
} else {
player.party[slot] = id;
player.partyN[slot] += amount;
}
} else {
player.party[slot] = id;
player.partyN[slot] += amount;
for (int i = 0; i < amount; i ++) {
int slot = arraySlot(player.party, id);
if (slot == -1) {
player.getPacketSender().sendMessage("You can only deposit up to 8 items at once.");
updateDeposit(player);
return;
}
player.getItemAssistant().deleteItem(id, 1);
player.party[slot] = id;
player.partyN[slot] = 1;
}
}
updateDeposit(player);
}
public static void withdrawItem(Player c, int slot) {
if (c.party[slot] >= 0 && c.getItemAssistant().freeSlots() > 0) {
c.getItemAssistant().addItem(c.party[slot], c.partyN[slot]);
c.party[slot] = 0;
c.partyN[slot] = 0;
public static void withdrawItem(Player c, int slot, int amount) {
int itemID = c.party[slot];
amount = Math.min(c.partyN[slot], amount);
if (c.party[slot] >= 0 && c.getItemAssistant().freeSlots(itemID, amount) > 0) {
c.getItemAssistant().addItem(c.party[slot], amount);
c.partyN[slot] -= amount;
if (c.partyN[slot] <= 0) {
c.party[slot] = 0;
}
}
updateDeposit(c);
updateGlobal(c);
}
public static void updateDeposit(Player player) {
player.getItemAssistant().resetItems(5064);
for (int x = 0; x < 8; x++) {
if (player.partyN[x] <= 0) {
itemOnInterface(player, 2274, x, -1, 0);
} else {
itemOnInterface(player, 2274, x, player.party[x], player.partyN[x]);
}
}
player.getPacketSender().sendUpdateItems(2274, player.party, player.partyN);
}
public static void updateGlobal(Player player) {
for (int x = 0; x < roomItems.length; x++) {
if (roomItemsN[x] <= 0) {
itemOnInterface(player, 2273, x, -1, 0);
} else {
itemOnInterface(player, 2273, x, roomItems[x], roomItemsN[x]);
}
}
player.getPacketSender().sendUpdateItems(2273, roomItems, roomItemsN);
}
public static void itemOnInterface(Player player, int frame, int slot, int id, int amount) {
@@ -10,7 +10,7 @@ import com.rs2.game.players.Player;
public class AgilityShortcut {
private static final int WALK = 1, MOVE = 2, AGILITY = 3;
private static final int WALK = 1, MOVE = 2, AGILITY = 3, DOWN = 4, UP = 5;
private static void handleAgility(Player player, int x, int y, int levelReq, int anim, int walk, String message) {
if (player.playerLevel[GameConstants.AGILITY] < levelReq) {
@@ -18,15 +18,21 @@ public class AgilityShortcut {
return;
}
switch (walk) {
case 1:
case WALK:
player.getPlayerAssistant().walkTo(x, y);
break;
case 2:
case MOVE:
player.getPlayerAssistant().movePlayer(x, y, player.heightLevel);
break;
case 3:
case AGILITY:
player.getAgility().walk(x, y, anim, -1);
break;
case DOWN:
player.getPlayerAssistant().movePlayer(x, y, player.heightLevel - 1);
break;
case UP:
player.getPlayerAssistant().movePlayer(x, y, player.heightLevel + 1);
break;
}
if (anim != 0 && anim != -1) {
player.startAnimation(anim);
@@ -181,6 +187,18 @@ public class AgilityShortcut {
"You pass through the agility shortcut.");
}
break;
case 9307:
if (player.absY == 9888) {
handleAgility(player, 3670, 9888, 58, Agility.CLIMB_UP_EMOTE, UP,
"You jump up the weathered wall.");
}
break;
case 9308:
if (player.absY == 9888) {
handleAgility(player, 3671, 9888, 58, Agility.CLIMB_DOWN_EMOTE, DOWN,
"You jump down the weathered wall.");
}
break;
case 9309:
if (player.absY == 3309) {
handleAgility(player, 2948, 3313, 26, 844, MOVE,
@@ -40,8 +40,7 @@ public class GemCutting extends CraftingData {
public void execute(CycleEventContainer container) {
if (Misc.random(2) == 0 && itemUsed > 1624 && itemUsed < 1630 || usedWith > 1624 && usedWith < 1630 && Misc.random(2) == 0) {
player.getPacketSender().sendMessage("You fail to cut the gem.");
player.getItemAssistant().addItem(1633, 1);
player.getItemAssistant().deleteItem(itemId, 1);
player.getItemAssistant().replaceItem(itemId, 1633);
player.getPlayerAssistant().addSkillXP(1, 12);
}
if (player.isCrafting) {
@@ -4,6 +4,7 @@ import com.rs2.GameConstants;
import com.rs2.event.CycleEvent;
import com.rs2.event.CycleEventContainer;
import com.rs2.event.CycleEventHandler;
import com.rs2.game.items.ItemAssistant;
import com.rs2.game.players.Player;
/**
@@ -18,13 +19,35 @@ public class Ectofuntus {
* Data storage for ectofuntus
*/
public enum EctofuntusData {
BONES(526, 4255, 18), BIG_BONES(532, 4257, 60), BABYDRAGON_BONES(534,
4260, 120), DRAGON_BONES(536, 4261, 288), DAGANNOTH_BONES(6729,
6728, 500);
BONES(526, 4255, 18),
BURNT_BONES(528, 4258, 18),
WOLF_BONES(2859, 4262, 18),
BAT_BONES(530, 4256, 21.2),
BIG_BONES(532, 4257, 60),
JOGRE_BONES(3125, 4271, 60),
BURNT_JOGRE_BONES(3127, 4259, 60),
BABY_DRAGON_BONES(534, 4260, 120),
DRAGON_BONES(536, 4261, 288),
SMALL_NINJA_MONKEY_BONES(3179, 4263, 20),
MEDIUM_NINJA_MONKEY_BONES(3180, 4264, 20),
SMALL_ZOMBIE_MONKEY_BONES(3183, 4268, 20),
LARGE_ZOMBIE_MONKEY_BONES(3181, 4269, 20),
GORILLA_MONKEY_BONES(3182, 4265, 20),
BEARDED_GORILLA_MONKEY_BONES(3182, 4266, 20),
MONKEY_BONES(3185, 4267, 20),
SKELETON_BONES(2530, 4270, 20),
ZOGRE_BONES(4812, 4852, 90),
FAYRG_BONES(4830, 4853, 336),
RAURG_BONES(4832, 4854, 384),
OURG_BONES(4834, 4855, 560),
SHAIKAHAN_BONES(3123, 5615, 100),
DAGANNOTH_BONES(6729, 6728, 500),
WYVERN_BONES(6812, 6810, 200);
int boneId, bonemealId, worshipExperience;
int boneId, bonemealId;
double worshipExperience;
EctofuntusData(int boneId, int bonemealId, int worshipExperience) {
EctofuntusData(int boneId, int bonemealId, double worshipExperience) {
this.boneId = boneId;
this.bonemealId = bonemealId;
this.worshipExperience = worshipExperience;
@@ -38,26 +61,11 @@ public class Ectofuntus {
return bonemealId;
}
public int getWorshipExperience() {
public double getWorshipExperience() {
return worshipExperience;
}
}
/**
* Get the name of the bone used
*
* @param boneId
* @return
*/
public static String getBoneName(int boneId) {
for (EctofuntusData ectofuntus : EctofuntusData.values()) {
if (ectofuntus.boneId == boneId) {
return ectofuntus.name().replaceAll("_", " ").toLowerCase();
}
}
return "";
}
/**
* Put bones in the loader
*
@@ -80,7 +88,7 @@ public class Ectofuntus {
player.getItemAssistant().deleteItem(ectofuntus.getBoneId(), 1);
player.ectofuntusBoneCrusherState = "Loaded";
player.ectofuntusBoneUsed = ectofuntus.getBoneId();
player.getPacketSender().sendMessage("You load the " + getBoneName(ectofuntus.getBoneId()) + " into the loader.");
player.getPacketSender().sendMessage("You load the " + ItemAssistant.getItemName(ectofuntus.getBoneId()) + " into the loader.");
container.stop();
}
@@ -158,18 +166,28 @@ public class Ectofuntus {
* @param objectId
* @param itemId
*/
public static void handleEctofuntus(Player player, int objectId) {
public static void handleEctofuntus(Player player) {
player.turnPlayerTo(3660, 3520);
boolean worshipped = false;
for (final EctofuntusData ectofuntus : EctofuntusData.values()) {
if (objectId == ECTOFUNTUS && player.getItemAssistant().playerHasItem(ectofuntus.getBonemealId()) && player.getItemAssistant().playerHasItem(BUCKET_OF_SLIME)) {
if (!worshipped && player.getItemAssistant().playerHasItem(ectofuntus.getBonemealId()) && player.getItemAssistant().playerHasItem(BUCKET_OF_SLIME)) {
worshipped = true;
CycleEventHandler.getSingleton().addEvent(player, new CycleEvent() {
@Override
public void execute(CycleEventContainer container) {
player.getItemAssistant().deleteItem(ectofuntus.getBonemealId(), 1);
if (player.isMoving || !player.getItemAssistant().playerHasItem(ectofuntus.getBonemealId()) || !player.getItemAssistant().playerHasItem(BUCKET_OF_SLIME)) {
container.stop();
return;
}
player.getItemAssistant().replaceItem(ectofuntus.getBonemealId(), 1931);
player.getItemAssistant().replaceItem(BUCKET_OF_SLIME, 1925);// Bucket
player.startAnimation(WORSHIP);
player.getPlayerAssistant().addSkillXP(ectofuntus.getWorshipExperience(), GameConstants.PRAYER);
player.getPacketSender().sendMessage("You pray to the ectofuntus.");
container.stop();
player.ectofuntusWorshipped++;
if (player.isMoving || !player.getItemAssistant().playerHasItem(ectofuntus.getBonemealId()) || !player.getItemAssistant().playerHasItem(BUCKET_OF_SLIME)) {
container.stop();
}
}
@Override
@@ -180,6 +198,10 @@ public class Ectofuntus {
}, 3);
}
}
if (!worshipped) {
player.getPacketSender().sendMessage("You'll need ectoplasm and bonemeal to worship the Ectofuntus.");
}
}
/**
@@ -217,23 +239,25 @@ public class Ectofuntus {
/**
* item constants
*/
private final static int POT = 1931;
public final static int POT = 1931;
public final static int BUCKET = 1925;
private final static int BUCKET_OF_SLIME = 4286;
public final static int BUCKET_OF_SLIME = 4286;
/**
* object constants
*/
private final static int ECTOFUNTUS = 5282;
private final static int LOADER = 11162;
private final static int[] SLIME = { 5461, 5462 };
public final static int ECTOFUNTUS = 5282;
public final static int LOADER = 11162;
public final static int GRINDER = 11163;
public final static int BIN = 11164;
public final static int[] SLIME = { 5461, 5462 };
/**
* animation constants
*/
private final static int WORSHIP = 1651;
private final static int WHEEL = 1648;
private final static int BONES = 1649;
private final static int BUCKET_FILL = 895;
public final static int WORSHIP = 1651;
public final static int WHEEL = 1648;
public final static int BONES = 1649;
public final static int BUCKET_FILL = 895;
}
@@ -37,7 +37,7 @@ public class Woodcutting {
MAGIC(new int[] {1306}, 7401, 75, 250, 1513, 150, 3),
EVERGREEN(new int[] {1319, 1318, 1315, 1316, 1332}, 1341, 1, 25, 1511, 11, 100),
ACHEY(new int[] {2023}, 3371, 1, 25, 1511, 11, 100),
DRAMEN(new int[] {1292}, 1341, 1, 25, 771, 45, 100);
DRAMEN(new int[] {1292}, 1341, 36, 0, 771, 45, 100);
private int[] treeId;
private int stumpId, levelReq, xpRecieved, logRecieved, respawnTime, cutChance;
@@ -14,6 +14,7 @@ import com.rs2.game.content.skills.slayer.Slayer;
import com.rs2.game.content.traveling.CarpetTravel;
import com.rs2.game.content.traveling.Sailing;
import com.rs2.game.globalworldobjects.PassDoor;
import com.rs2.game.items.ItemConstants;
import com.rs2.game.npcs.NpcHandler;
import com.rs2.game.objects.impl.OtherObjects;
import com.rs2.game.players.Player;
@@ -4912,6 +4913,72 @@ public class DialogueHandler {
player.nextChat = 0;
break;
case 1390:
if (player.getItemAssistant().playerHasEquipped(ItemConstants.AMULET, 552)) {
sendPlayerChat("Can I have the tokens I have earned?");
player.nextChat = 1391;
} else {
sendNpcChat1("Wooooo. Oooooh!", player.talkingNpc, "Ghost disciple");
player.nextChat = 0;
}
break;
case 1391:
int amount = player.ectofuntusWorshipped * 5;
if (amount <= 0) {
sendNpcChat1("You haven't earned any tokens yet.", player.talkingNpc, "Ghost disciple");
} else if (player.getItemAssistant().freeSlots(4278, amount) <= 0) {
sendNpcChat1("You don't have enough space in your inventory.", player.talkingNpc, "Ghost disciple");
} else {
sendNpcChat1("Certainly, mortal. Here's " + amount + " ecto-tokens.", player.talkingNpc, "Ghost disciple");
player.getItemAssistant().addItem(4278, amount);
player.ectofuntusWorshipped = 0;
}
player.nextChat = 0;
break;
case 1400:
if (!player.getItemAssistant().playerHasEquipped(ItemConstants.AMULET, 552)) {
sendNpcChat1("Wooooo. Oooooh!", player.talkingNpc, "Ghost Captain");
player.nextChat = 0;
} else {
if (player.talkingNpc == 1704) {
sendNpcChat1("Would you like a ride to Port Phasmatys?", player.talkingNpc, "Ghost Captain");
} else {
sendNpcChat1("Would you like a ride to Dragontooth Island?", player.talkingNpc, "Ghost Captain");
}
player.nextChat = 1401;
}
break;
case 1401:
sendOption(
"Yes please." + (player.talkingNpc == 1705 ? " (25 Ecto-tokens)" : ""),
"No thanks.");
player.dialogueAction = 185;
break;
case 1402:
sendNpcChat1("You don't have enough Ecto-tokens.", player.talkingNpc, "Ghost Captain");
player.nextChat = 0;
break;
case 1410:
if (player.talkingNpc == 3157) {
sendNpcChat1("Would you like a ride to Port Phasmatys?", player.talkingNpc, "Bill Teach");
} else {
sendNpcChat1("Would you like a ride to Mos Le'Harmless?", player.talkingNpc, "Bill Teach");
}
player.nextChat = 1411;
break;
case 1411:
sendOption(
"Yes please.",
"No thanks.");
player.dialogueAction = 186;
break;
case 2995:
player.canWalkTutorial = false;
sendStatement(
@@ -561,6 +561,22 @@ public class DialogueOptions {
} else if (player.dialogueAction == 184) {
player.getDialogueHandler().sendDialogues(624, player.npcType);
return;
} else if (player.dialogueAction == 185) {
if (player.talkingNpc == 1704) {
player.getPlayerAssistant().movePlayer(3702, 3487, 0);
} else if (player.getItemAssistant().playerHasItem(4278, 25)) {
// if player has enough ecto tokens
player.getItemAssistant().deleteItem(4278, 25);
player.getPlayerAssistant().movePlayer(3791, 3560, 0);
} else {
player.getDialogueHandler().sendDialogues(1402, player.npcType);
}
} else if (player.dialogueAction == 186) {
if (player.talkingNpc == 3157) {
player.getPlayerAssistant().movePlayer(3714, 3499, 1);
} else {
player.getPlayerAssistant().movePlayer(3683, 2948, 1);
}
} else if (player.dialogueAction == 3204) {
player.getItemAssistant().deleteItem(1929, 1);
player.getItemAssistant().deleteItem(1933, 1);
@@ -103,9 +103,13 @@ public class ItemAssistant {
}
public void replaceItem(int itemToReplace, int replaceWith) {
if(playerHasItem(itemToReplace)) {
deleteItem(itemToReplace, 1);
addItem(replaceWith, 1);
replaceItem(itemToReplace, replaceWith, 1);
}
public void replaceItem(int itemToReplace, int replaceWith, int amount) {
if(playerHasItem(itemToReplace, amount)) {
deleteItem(itemToReplace, amount);
addItem(replaceWith, amount);
}
}
@@ -1705,6 +1709,7 @@ public class ItemAssistant {
}
public void resetBank() {
player.getPacketSender().sendString("The Bank of " + GameConstants.SERVER_NAME, 5383, true);
if (player.getOutStream() != null) {
player.getOutStream().createFrameVarSizeWord(53);
player.getOutStream().writeWord(5382); // bank
@@ -2480,6 +2485,18 @@ public class ItemAssistant {
return freeS;
}
public int freeSlots(int itemID, int amount) {
int freeS = 0;
for (int i = 0; i < player.playerItems.length; i ++) {
int _id = player.playerItems[i];
int _amt = player.playerItemsN[i];
if (_id <= 0 || (_id == itemID && isStackable(_id) && _amt + amount <= Integer.MAX_VALUE)) {
freeS++;
}
}
return freeS;
}
public int findItem(int id, int[] items, int[] amounts) {
for (int i = 0; i < player.playerItems.length; i++) {
if (items[i] - 1 == id && amounts[i] > 0) {
@@ -104,7 +104,7 @@ public class ItemConstants {
2416, 2417, 88, 1540, 2714, 432, 433, 1555, 1556, 1557, 1558, 1559,
1560, 1561, 1562, 1563, 1564, 1565, 7585, 7584, 300, 775, 776, 777,
6180, 6181, 6182, 6183, 6184, 6185, 6186, 6187, 6188, 2528, 4447,
290, 666, 667 };
290, 666, 667, 4251, 4252, 4278};
public final static int[] ITEM_TRADEABLE = { 5317, 3842, 3844, 3840, 8844, 8845,
8846, 8847, 8848, 8849, 8850, 10551, 6570, 7462, 7461, 7460, 7459,
@@ -120,15 +120,15 @@ public class ItemConstants {
4218, 4219, 4220, 4221, 4222, 4223, 4224, 1555, 1556, 1557, 1558,
1559, 1560, 1561, 1562, 1563, 1564, 1565, 7585, 7584, 2714, 432,
433, 290, 5075, 5074, 5073, 5071, 5070, 7413, 6529, 4067, 2996, 1464, 666, 667,
2412, 2413, 2414, 771, 772};
2412, 2413, 2414, 771, 772, 4251, 4252, 4278};
public final static int[] ITEM_UNALCHABLE = { 995, 1555, 1556, 1557, 1558,
1559, 1560, 1561, 1562, 1563, 1564, 1565, 7583, 1566, 7585, 2528,
4214, 4212, 2714, 432, 433, 300, 775, 776, 777, 6180, 6181, 6182,
6183, 6184, 6185, 6186, 6187, 6188, 2528, 4447, 290, 666, 667};
6183, 6184, 6185, 6186, 6187, 6188, 2528, 4447, 290, 666, 667, 4278};
public final static int[] ITEM_BANKABLE = {2528, 4447};
public final static int[] DESTROYABLE_ITEMS = {775, 776, 777, 2528, 6570, 2714, 432, 433, 300, 666};
public final static int[] DESTROYABLE_ITEMS = {775, 776, 777, 2528, 6570, 2714, 432, 433, 300, 666, 4251, 4252, 4278};
}
@@ -35,11 +35,11 @@ import com.rs2.util.Misc;
public class UseItem {
public static void itemOnObject(Player c, int objectID, int objectX, int objectY, int itemId) {
final int goodPosXType1 = objectX - 5;
final int goodPosXType2 = objectX + 5;
final int goodPosYType1 = objectY - 5;
final int goodPosYType2 = objectY + 5;
if (c.absX >= goodPosXType1 && c.absX <= goodPosXType2 && c.absY >= goodPosYType1 && c.absY <= goodPosYType2) {
final int minX = objectX - 5;
final int maxX = objectX + 5;
final int minY = objectY - 5;
final int maxY = objectY + 5;
if (c.absX >= minX && c.absX <= maxX && c.absY >= minY && c.absY <= maxY) {
c.turnPlayerTo(objectX, objectY);
} else {
c.getPlayerAssistant().playerWalk(objectX, objectY);
@@ -1,5 +1,7 @@
package com.rs2.game.items.impl;
import com.rs2.game.content.skills.prayer.Ectofuntus;
public class Fillables {
public static boolean canFill(int id, int oid) {
@@ -38,6 +40,8 @@ public class Fillables {
return 1823;
case 6667:
return 6668;
case 4252:
return 4251;
}
return -1;
}
@@ -70,6 +74,8 @@ public class Fillables {
return "waterskin";
case 6667:
return "fishbowl";
case 4252:
return "ectophial";
}
return "There was a problem with your current action, please report this to Mod Andrew.";
}
@@ -108,6 +114,8 @@ public class Fillables {
case 6232:
case 2864:
return "fountain";
case Ectofuntus.ECTOFUNTUS:
return "ectofuntus";
}
return "Error";
}
@@ -56,6 +56,13 @@ public class NpcActions {
case 389 : //thormac
player.getDialogueHandler().sendDialogues(3574, npcType);
break;
case 1686 : // Ghost Desciple
player.getDialogueHandler().sendDialogues(1390, npcType);
break;
case 1704 : // Ghost Captain
case 1705 : // Ghost Captain
player.getDialogueHandler().sendDialogues(1400, npcType);
break;
case 2324 :
case 2323 :
@@ -86,6 +93,11 @@ public class NpcActions {
case 2238:
player.getDialogueHandler().sendDialogues(3214, npcType);
break;
case 3156 : // Bill Teach
case 3157 : // Bill Teach
player.getDialogueHandler().sendDialogues(1410, npcType);
break;
case 958:
player.getDialogueHandler().sendDialogues(3208, npcType);
@@ -12,7 +12,6 @@ import com.rs2.game.content.minigames.PestControl;
import com.rs2.game.content.minigames.castlewars.CastleWarObjects;
import com.rs2.game.content.minigames.castlewars.CastleWars;
import com.rs2.game.content.quests.QuestRewards;
import com.rs2.game.content.random.Balloons;
import com.rs2.game.content.random.PartyRoom;
import com.rs2.game.content.randomevents.FreakyForester;
import com.rs2.game.content.skills.agility.AgilityShortcut;
@@ -30,6 +29,7 @@ import com.rs2.game.content.traveling.DesertCactus;
import com.rs2.game.globalworldobjects.ClimbOther;
import com.rs2.game.globalworldobjects.PassDoor;
import com.rs2.game.globalworldobjects.ClimbOther.ClimbData;
import com.rs2.game.items.ItemAssistant;
import com.rs2.game.items.impl.LightSources;
import com.rs2.game.npcs.NpcHandler;
import com.rs2.game.npcs.impl.MilkCow;
@@ -91,8 +91,8 @@ public class ObjectsActions {
if (player.getWerewolfAgility().werewolfCourse(objectType)) {
return;
}
if (objectType >= 115 && objectType <= 121) {
Balloons.popBalloon(player, objectX, objectY);
if (Boundary.isIn(player, Boundary.PARTY_ROOM) && objectType >= 115 && objectType <= 122) {
PartyRoom.popBalloon(player, objectX, objectY);
return;
}
if (objectType >= 5103 && objectType <= 5107) {
@@ -123,6 +123,14 @@ public class ObjectsActions {
return;
}
switch (objectType) {
case 6969: // Swamp Boaty
if (player.objectX == 3523 && player.objectY == 3284)
player.getPlayerAssistant().movePlayer(3499, 3380, 0);
break;
case 6970: // Swamp Boaty
if (player.objectX == 3498 && player.objectY == 3377)
player.getPlayerAssistant().movePlayer(3522, 3284, 0);
break;
case 6615:
if (player.absY == 2809) {
player.getPlayerAssistant().movePlayer(player.absX, 2810, 0);
@@ -130,11 +138,11 @@ public class ObjectsActions {
player.getPlayerAssistant().movePlayer(player.absX, 2809, 0);
}
break;
case 11163:
case Ectofuntus.GRINDER:
Ectofuntus.useBoneGrinder(player);
break;
case 11164:
case Ectofuntus.BIN:
Ectofuntus.emptyBin(player);
break;
case 6:
@@ -752,21 +760,8 @@ public class ObjectsActions {
case 5281:
player.getPlayerAssistant().movePlayer(3666, 3517, 0);
break;
case 5282: // Ectofuntus Worship
if (player.getItemAssistant().playerHasItem(4286) && player.getItemAssistant().playerHasItem(4255))
{
player.startAnimation(1651);
player.getPacketSender().sendMessage("You put some ectoplasm and bonemeal into the Ectofuntus, and worship it.");
player.getItemAssistant().deleteItem(4286, 1);
player.getItemAssistant().deleteItem(4255, 1);
player.getItemAssistant().addItem(1925, 1);
player.getItemAssistant().addItem(1931, 1);
player.getPlayerAssistant().addSkillXP(18, GameConstants.PRAYER);
}
else
{
player.getPacketSender().sendMessage("You'll need ectoplasm and bonemeal to worship the Ectofuntus.");
}
case Ectofuntus.ECTOFUNTUS: // Ectofuntus Worship
Ectofuntus.handleEctofuntus(player);
break;
case 12982:
@@ -961,6 +956,8 @@ public class ObjectsActions {
case 9326:
case 9321:
case 993:
case 9307:
case 9308:
AgilityShortcut.processAgilityShortcut(player);
break;
@@ -2644,6 +2641,50 @@ public class ObjectsActions {
if (player.getItemAssistant().hasFreeSlots(1))
player.getItemAssistant().addItem(2413, 1);
break;
case 11209:
player.getPlayerAssistant().movePlayer(3712, 3496, 1);
break;
case 11210:
player.getPlayerAssistant().movePlayer(3709, 3496, 0);
break;
case 11211:
player.getPlayerAssistant().movePlayer(3684, 2950, 1);
break;
case 11212:
player.getPlayerAssistant().movePlayer(3684, 2953, 0);
break;
case 11289:
if (objectX == 3686 && objectY == 2946)
player.getPlayerAssistant().movePlayer(3687, 2946, 2);
if (objectX == 3686 && objectY == 2950)
player.getPlayerAssistant().movePlayer(3687, 2950, 2);
if (objectX == 3712 && objectY == 3494)
player.getPlayerAssistant().movePlayer(3712, 3493, 2);
if (objectX == 3716 && objectY == 3494)
player.getPlayerAssistant().movePlayer(3716, 3493, 2);
break;
case 11290:
if (objectX == 3686 && objectY == 2946)
player.getPlayerAssistant().movePlayer(3685, 2946, 1);
if (objectX == 3686 && objectY == 2950)
player.getPlayerAssistant().movePlayer(3685, 2950, 1);
if (objectX == 3712 && objectY == 3494)
player.getPlayerAssistant().movePlayer(3712, 3495, 1);
if (objectX == 3716 && objectY == 3494)
player.getPlayerAssistant().movePlayer(3716, 3495, 1);
break;
case 11308:
if (objectX == 3714 && objectY == 3502)
player.getPlayerAssistant().movePlayer(3714, 3503, 1);
if (objectX == 3678 && objectY == 2948)
player.getPlayerAssistant().movePlayer(3677, 2948, 1);
break;
case 11309:
if (objectX == 3714 && objectY == 3502)
player.getPlayerAssistant().movePlayer(3714, 3503, 0);
if (objectX == 3678 && objectY == 2948)
player.getPlayerAssistant().movePlayer(3677, 2948, 0);
break;
}
}
@@ -2764,6 +2805,18 @@ public class ObjectsActions {
case 12537:
Climbing.climbUp(player);
break;
case Ectofuntus.GRINDER:
if (player.ectofuntusBoneCrusherState.equals("Empty")) {
player.getPacketSender().sendMessage("You need to load some bones.");
} else if (player.ectofuntusBoneCrusherState.equals("Loaded")) {
player.getPacketSender().sendMessage(ItemAssistant.getItemName(player.ectofuntusBoneUsed) + " loaded and ready to be grinded.");
} else if (player.ectofuntusBoneCrusherState.equals("Bin")) {
player.getPacketSender().sendMessage("Bonemeal is ready to be collected from the bin.");
} else {
player.getPacketSender().sendMessage("Ghostly forces are playing with the machinery.");
}
break;
case 14921:
case 9390:
@@ -422,7 +422,7 @@ public class Climbing {
case 1738:
if (client.objectX == 2728 && client.objectY == 3460
&& client.heightLevel == 0) {
client.getPlayerAssistant().movePlayer(2749, 3462, 1);
client.getPlayerAssistant().movePlayer(2729, 3462, 1);
client.resetWalkingQueue();
} else if (client.objectX == 2746 && client.objectY == 3460
&& client.heightLevel == 0) {
@@ -908,17 +908,17 @@ public abstract class Player {
if (System.currentTimeMillis() - restoreStatsDelay > 60000) {
restoreStatsDelay = System.currentTimeMillis();
for (int level = 0; level < playerLevel.length; level++) {
if (playerLevel[level] < getLevelForXP(playerXP[level])) {
if (level != 5) { // prayer doesn't restore
playerLevel[level] += 1;
getPacketSender().setSkillLevel(level, playerLevel[level], playerXP[level]);
getPlayerAssistant().refreshSkill(level);
for (int skill = 0; skill < playerLevel.length; skill++) {
if (playerLevel[skill] < getLevelForXP(playerXP[skill])) {
if (skill != 5) { // prayer doesn't restore
playerLevel[skill] += 1;
getPacketSender().setSkillLevel(skill, playerLevel[skill], playerXP[skill]);
getPlayerAssistant().refreshSkill(skill);
}
} else if (playerLevel[level] > getLevelForXP(playerXP[level])) {
playerLevel[level] -= 1;
getPacketSender().setSkillLevel(level, playerLevel[level], playerXP[level]);
getPlayerAssistant().refreshSkill(level);
} else if (playerLevel[skill] > getLevelForXP(playerXP[skill])) {
playerLevel[skill] -= 1;
getPacketSender().setSkillLevel(skill, playerLevel[skill], playerXP[skill]);
getPlayerAssistant().refreshSkill(skill);
}
}
}
@@ -1632,7 +1632,7 @@ public abstract class Player {
crystalBowArrowCount, playerMagicBook, teleGfx, teleEndAnimation,
teleHeight, teleX, teleY, rangeItemUsed, killingNpcIndex,
totalDamageDealt, globalDamageDealt, oldNpcIndex, fightMode, attackTimer,
bowSpecShot;
bowSpecShot, ectofuntusWorshipped;
public boolean magicFailed, oldMagicFailed;
/**
* End
@@ -2083,6 +2083,11 @@ public abstract class Player {
if (checkRangeDistance()) {
distance = gatherRangeDistance(distance);
}
return ((objectX-playerX <= distance && objectX-playerX >= -distance) && (objectY-playerY <= distance && objectY-playerY >= -distance));
}
public boolean goodObjectDistance(int objectX, int objectY, int playerX, int playerY, int distance) {
return ((objectX-playerX <= distance && objectX-playerX >= -distance) && (objectY-playerY <= distance && objectY-playerY >= -distance));
}
@@ -127,14 +127,14 @@ public class PlayerAssistant {
private String[][] welcomeMessages = {
{"Remember to vote daily to help " + GameConstants.SERVER_NAME + "", "Every vote counts! :)"},
{"Not a member of our discord community?", "Join our discord at: https://discord.gg/Nk9WQUK"},
{"Not a member of our discord community?", "Join our discord at: https://discord.gg/hZ6VfWG"},
{"Do you have any bugs that you would like to report?", "Report them on our discord or message a staff member. :)"},
{"Want to help the server grow?", "Remember to vote daily and invite your friends!"}
};
public void showMap() {
int posisition = (player.getX() / 64 - 46) + (player.getY() / 64 - 49) * 6;
player.getPacketSender().sendConfig(106, posisition);
int position = (player.getX() / 64 - 46) + (player.getY() / 64 - 49) * 6;
player.getPacketSender().sendConfig(106, position);
player.getPacketSender().showInterface(5392);
}
@@ -1019,7 +1019,7 @@ public class PlayerAssistant {
for (Player p : PlayerHandler.players) {
if (p != null && p.isActive) {
Client o = (Client) p;
o.getPlayerAssistant().updatePM(player.playerId, 1);
o.getPlayerAssistant().updatePM(player.playerId, GameConstants.WORLD);
}
}
boolean pmLoaded = false;
@@ -1028,7 +1028,7 @@ public class PlayerAssistant {
if (friend != 0) {
for (int i2 = 1; i2 < PlayerHandler.players.length; i2++) {
Player p = PlayerHandler.players[i2];
if (p != null && p.isActive
if (p != null && !p.isBot && p.isActive
&& Misc.playerNameToInt64(p.playerName) == friend) {
Client o = (Client) p;
if (player.playerRights >= 2
@@ -1037,7 +1037,7 @@ public class PlayerAssistant {
&& o.getPlayerAssistant()
.isInPM(Misc
.playerNameToInt64(player.playerName))) {
player.getPacketSender().loadPM(friend, 1);
player.getPacketSender().loadPM(friend, GameConstants.WORLD);
pmLoaded = true;
}
break;
@@ -1052,7 +1052,7 @@ public class PlayerAssistant {
Player p = PlayerHandler.players[i1];
if (p != null && p.isActive) {
Client o = (Client) p;
o.getPlayerAssistant().updatePM(player.playerId, 1);
o.getPlayerAssistant().updatePM(player.playerId, GameConstants.WORLD);
}
}
}
@@ -1819,7 +1819,7 @@ public class PlayerAssistant {
player.getPacketSender().sendMessage("Welcome to @blu@" + GameConstants.SERVER_NAME + "@bla@ - we are currently in Server Stage v@blu@" + GameConstants.TEST_VERSION + "@bla@.");
player.getPacketSender().sendMessage("@red@Did you know?@bla@ We're open source and pull requests are welcome!");
player.getPacketSender().sendMessage("Source code: github.com/2006-Scape/2006Scape");
player.getPacketSender().sendMessage("Discord: discord.gg/4zrA2Wy");
player.getPacketSender().sendMessage("Discord: https://discord.gg/hZ6VfWG");
player.getDialogueHandler().sendDialogues(3115, 2224);
player.isRunning2 = false;
player.autoRet = 1;
@@ -1972,6 +1972,8 @@ public class PlayerAssistant {
if (skill == 5) {
player.getPacketSender().sendString("" + player.playerLevel[GameConstants.PRAYER] + "/" + getLevelForXP(player.playerXP[GameConstants.PRAYER]) + "", 687);// Prayer
}
// Update skill data
player.getPacketSender().setSkillLevel(skill, player.playerLevel[skill], player.playerXP[skill]);
}
public int getXPForLevel(int level) {
@@ -409,6 +409,9 @@ public class PlayerSave {
case "fightMode":
player.fightMode = Integer.parseInt(token2);
break;
case "ectofuntusWorshipped":
player.ectofuntusWorshipped = Integer.parseInt(token2);
break;
}
break;
case 3:
@@ -777,6 +780,8 @@ public class PlayerSave {
characterfile.newLine();
characterfile.write("fightMode = " + player.fightMode);
characterfile.newLine();
characterfile.write("ectofuntusWorshipped = " + player.ectofuntusWorshipped);
characterfile.newLine();
String voidStatus = "";
for (int voidS : player.voidStatus){
voidStatus += voidS + "\t";
@@ -30,29 +30,48 @@ public class PacketSender {
}
public PacketSender sendUpdateItems(int frame, Item[] items) {
player.getOutStream().createFrameVarSizeWord(53);
player.getOutStream().writeWord(frame);
player.getOutStream().writeWord(items.length);
Item[] var6 = items;
if (player.getOutStream() != null) {
player.getOutStream().createFrameVarSizeWord(53);
player.getOutStream().writeWord(frame);
player.getOutStream().writeWord(items.length);
}
for (int i = 0; i < items.length; i++) {
Item item = var6[i];
if (item == null) {
player.getOutStream().writeByte(0);
player.getOutStream().writeWordBigEndianA(0);
} else {
Item item = items[i];
if (player.getOutStream() != null) {
if (item.getCount() > 254) {
player.getOutStream().writeByte(255);
player.getOutStream().writeDWord_v2(item.getCount());
} else {
player.getOutStream().writeByte(item.getCount());
}
player.getOutStream().writeWordBigEndianA(item.getId());
}
int id = item.getId() + 1;
if (item.getCount() < 1) {
id = 0;
}
if (id > GameConstants.ITEM_LIMIT || id < 0) {
id = GameConstants.ITEM_LIMIT;
}
if (player.getOutStream() != null) {
player.getOutStream().writeWordBigEndianA(id);
}
}
if (player.getOutStream() != null) {
player.getOutStream().endFrameVarSizeWord();
player.flushOutStream();
}
return this;
}
public PacketSender sendUpdateItems(int frame, int[] itemIDs, int[] itemAmounts) {
Item[] items = new Item[itemIDs.length];
for(int i = 0; i < itemIDs.length; i++) {
items[i] = new Item(itemIDs[i], itemAmounts[i]);
}
return sendUpdateItems(frame, items);
}
public PacketSender loginPlayer() {
player.getPlayerAssistant().loginScreen();
@@ -101,7 +120,7 @@ public class PacketSender {
player.getPacketSender().sendMessage("Welcome to @blu@" + GameConstants.SERVER_NAME + "@bla@ - we are currently in Server Stage v@blu@" + GameConstants.TEST_VERSION + "@bla@.");
player.getPacketSender().sendMessage("@red@Did you know?@bla@ We're open source! Pull requests are welcome");
player.getPacketSender().sendMessage("Source code at github.com/2006-Scape/2006Scape");
player.getPacketSender().sendMessage("Join our Discord: discord.gg/4zrA2Wy");
player.getPacketSender().sendMessage("Join our Discord: https://discord.gg/hZ6VfWG");
/*if (!hasBankpin) { //Kind of annoying. Maybe add Random % 10 or something.
getActionSender().sendMessage("You do not have a bank pin it is highly recommended you set one.");
}*/
@@ -146,7 +165,7 @@ public class PacketSender {
player.getPacketSender().sendFrame107(); // reset screen
player.getPacketSender().setChatOptions(0, 0, 0); // reset private messaging options
player.correctCoordinates();
player.getPacketSender().showOption(4, 0, "Trade With", 3);
player.getPacketSender().showOption(4, 0, "Trade with", 3);
player.getPacketSender().showOption(5, 0, "Follow", 4);
player.getItemAssistant().resetItems(3214);
player.getItemAssistant().resetBonus();
@@ -169,7 +188,7 @@ public class PacketSender {
player.getItemAssistant().addSpecialBar(player.playerEquipment[player.playerWeapon]);
player.saveTimer = GameConstants.SAVE_TIMER;
player.saveCharacter = true;
Misc.println("[REGISTERED]: " + player.playerName + "");
Misc.println((player.isBot ? "[BOT-REGISTERED]" : "[REGISTERED]") + ": " + player.playerName + " (level-" + player.calculateCombatLevel() + ")");
player.handler.updatePlayer(player, player.outStream);
player.handler.updateNPC(player, player.outStream);
player.flushOutStream();
@@ -304,8 +323,12 @@ public class PacketSender {
return this;
}
public PacketSender sendString(String s, int id) { //Seems to be about chat messsages
if(!player.checkPacket126Update(s, id)) {
public PacketSender sendString(String s, int id) { // Update string in interfaces etc
return sendString(s, id, false);
}
public PacketSender sendString(String s, int id, boolean forceSend) { // Update string in interfaces etc
if(!forceSend && !player.checkPacket126Update(s, id)) {
return this;
}
if (player.getOutStream() != null && player != null) {
@@ -503,8 +526,6 @@ public class PacketSender {
if (player.getOutStream() != null && player != null) {
if (world != 0) {
world += 9;
} else if (!GameConstants.WORLD_LIST_FIX) {
world += 1;
}
player.getOutStream().createFrame(50);
player.getOutStream().writeQWord(playerName);
@@ -621,11 +642,9 @@ public class PacketSender {
player.getItemAssistant().rearrangeBank();
player.getItemAssistant().resetBank();
player.getItemAssistant().resetTempItems();
player.getOutStream().createFrame(248);
player.getOutStream().writeWordA(5292);
player.lastMainFrameInterface = MainFrameIDs.BANK; //Setting it to 5292, since I *think* that's what interface got opened
player.getOutStream().writeWord(5063);
sendFrame248(5292, 5063);
player.flushOutStream();
player.getPacketSender().sendString("The Bank of " + GameConstants.SERVER_NAME, 5383, true);
player.isBanking = true;
}
return this;
@@ -1172,15 +1191,7 @@ public class PacketSender {
if (player.heightLevel != height) {
return this;
}
player.getOutStream().createFrame(85);
player.getOutStream().writeByteC(itemY - 8 * player.mapRegionY);
player.getOutStream().writeByteC(itemX - 8 * player.mapRegionX);
player.getOutStream().createFrame(44);
player.getOutStream().writeWordBigEndianA(itemID);
player.getOutStream().writeWord(itemAmount);
player.getOutStream().writeByte(0);
player.flushOutStream();
return this;
return createGroundItem(itemID, itemX, itemY, itemAmount);
}
@@ -5,6 +5,7 @@ import com.rs2.game.content.random.PartyRoom;
import com.rs2.game.content.skills.crafting.JewelryMaking;
import com.rs2.game.players.Player;
import com.rs2.net.packets.PacketType;
import com.rs2.world.Boundary;
/**
* Bank 10 Items
@@ -19,6 +20,13 @@ public class Bank10 implements PacketType {
player.endCurrentTask();
switch (interfaceId) {
case 2274:
if (Boundary.isIn(player, Boundary.PARTY_ROOM)) {
PartyRoom.withdrawItem(player, removeSlot, 10);
return;
}
break;
case 4233:
case 4239:
case 4245:
@@ -49,7 +57,7 @@ public class Bank10 implements PacketType {
if(!player.getItemAssistant().playerHasItem(removeId)) {
return;
}
if (player.inPartyRoom) {
if (Boundary.isIn(player, Boundary.PARTY_ROOM)) {
PartyRoom.depositItem(player, removeId, 10);
break;
}
@@ -5,6 +5,7 @@ import com.rs2.game.content.random.PartyRoom;
import com.rs2.game.content.skills.crafting.JewelryMaking;
import com.rs2.game.players.Player;
import com.rs2.net.packets.PacketType;
import com.rs2.world.Boundary;
/**
* Bank 5 Items
@@ -19,6 +20,12 @@ public class Bank5 implements PacketType {
player.endCurrentTask();
switch (interfaceId) {
case 2274:
if (Boundary.isIn(player, Boundary.PARTY_ROOM)) {
PartyRoom.withdrawItem(player, removeSlot, 5);
return;
}
break;
case 4233:
case 4239:
case 4245:
@@ -50,7 +57,7 @@ public class Bank5 implements PacketType {
if(!player.getItemAssistant().playerHasItem(removeId)) {
return;
}
if (player.inPartyRoom) {
if (Boundary.isIn(player, Boundary.PARTY_ROOM)) {
PartyRoom.depositItem(player, removeId, 5);
break;
}
@@ -5,6 +5,7 @@ import com.rs2.game.items.GameItem;
import com.rs2.game.items.ItemData;
import com.rs2.game.players.Player;
import com.rs2.net.packets.PacketType;
import com.rs2.world.Boundary;
/**
* Bank All Items
@@ -18,6 +19,12 @@ public class BankAll implements PacketType {
int removeId = player.getInStream().readUnsignedWordA();
player.endCurrentTask();
switch (interfaceId) {
case 2274:
if (Boundary.isIn(player, Boundary.PARTY_ROOM)) {
PartyRoom.withdrawItem(player, removeSlot, player.partyN[removeSlot]);
return;
}
break;
// buy x
case 3900:
player.outStream.createFrame(27);
@@ -51,7 +58,7 @@ public class BankAll implements PacketType {
if(!player.getItemAssistant().playerHasItem(removeId)) {
return;
}
if (player.inPartyRoom) {
if (Boundary.isIn(player, Boundary.PARTY_ROOM)) {
PartyRoom.depositItem(player, removeId, player.getItemAssistant().itemAmount(player.playerItems[removeSlot]));
break;
}
@@ -76,21 +76,21 @@ public class ClickItem implements PacketType {
return;
}
switch (itemId) {
case 4251:
player.getPlayerAssistant().movePlayer(3661, 3526, 0);
player.getItemAssistant().replaceItem(4251, 4252);
break;
case 4079:
player.startAnimation(1457);
break;
case 407:
if (Misc.random(1) == 0) {
player.getItemAssistant().addItem(409, 1);
player.getItemAssistant().deleteItem(407, 1);
int rand = Misc.random(1, 5);
if (rand <= 2) {
player.getItemAssistant().replaceItem(407, 409);
} else if (rand <= 4) {
player.getItemAssistant().replaceItem(407, 411);
} else {
if (Misc.random(1) == 0) {
player.getItemAssistant().addItem(411, 1);
player.getItemAssistant().deleteItem(409, 1);
} else if (Misc.random(1) == 1) {
player.getItemAssistant().addItem(413, 1);
player.getItemAssistant().deleteItem(407, 1);
}
player.getItemAssistant().replaceItem(407, 413);
}
break;
@@ -481,6 +481,15 @@ public class Commands implements PacketType {
player.getPacketSender().sendMessage("Player Must Be Offline.");
}
break;
case "mem":
Runtime runtime = Runtime.getRuntime();
int totalMemK = (int) (runtime.totalMemory() / 1024L);
int freeMemK = (int) (runtime.freeMemory() / 1024L);
int usedMemK = (int) totalMemK - freeMemK;
player.getPacketSender().sendMessage("Total memory: " + (totalMemK / 1024) + "MB");
player.getPacketSender().sendMessage("Used memory: " + (usedMemK / 1024) + "MB");
player.getPacketSender().sendMessage("Free memory: " + (freeMemK / 1024) + "MB");
break;
case "update":
try {
if (arguments.length == 0) {
@@ -574,9 +583,24 @@ public class Commands implements PacketType {
if (arguments.length == 0) {
player.getPacketSender().sendMessage("You must specify an id: ::interface id");
return;
} else if (arguments.length == 1) {
int interface1 = Integer.parseInt(arguments[0]);
player.getPacketSender().showInterface(interface1);
return;
} else if (arguments.length == 2) {
int interface1 = Integer.parseInt(arguments[0]);
int interface2 = Integer.parseInt(arguments[1]);
player.getPacketSender().sendFrame248(interface1, interface2);
return;
} else if (arguments.length == 2) {
int interface1 = Integer.parseInt(arguments[0]);
int interface2 = Integer.parseInt(arguments[1]);
int interface3 = Integer.parseInt(arguments[2]);
player.getPacketSender().sendFrame246(interface1, interface2, interface3);
return;
} else {
player.getPacketSender().sendMessage("Too many IDs specified, maximum of 3");
}
int interfaceID = Integer.parseInt(arguments[0]);
player.getPacketSender().showInterface(interfaceID);
break;
case "gfx":
if (arguments.length == 0) {
@@ -616,7 +640,6 @@ public class Commands implements PacketType {
case "bank":
player.getPacketSender().openUpBank();
break;
case "xteletome":
case "teletome":
try {
if (arguments.length == 0) {
@@ -637,7 +660,6 @@ public class Commands implements PacketType {
player.getPacketSender().sendMessage("Player is not online.");
}
break;
case "xteleto":
case "teleto":
if (arguments.length == 0) {
player.getPacketSender().sendMessage("You must specify a player name: ::teleto playername");
@@ -5,6 +5,7 @@ import com.rs2.game.content.skills.cooking.Cooking;
import com.rs2.game.content.skills.smithing.Smelting;
import com.rs2.game.players.Player;
import com.rs2.net.packets.PacketType;
import com.rs2.world.Boundary;
public class InterfaceX implements PacketType {
@@ -27,15 +28,21 @@ public class InterfaceX implements PacketType {
}
}
switch (player.xInterfaceId) {
case 5064:
if (player.inPartyRoom) {
PartyRoom.depositItem(player, player.xRemoveId, player.getItemAssistant().itemAmount(player.playerItems[player.xRemoveSlot]));
break;
case 2274:
if (Boundary.isIn(player, Boundary.PARTY_ROOM)) {
PartyRoom.withdrawItem(player, player.xRemoveSlot, Xamount);
return;
}
break;
case 5064:
if (player.inTrade) {
player.getPacketSender().sendMessage("You can't store items while trading!");
return;
}
if (Boundary.isIn(player, Boundary.PARTY_ROOM)) {
PartyRoom.depositItem(player, player.xRemoveId, Xamount);
return;
}
player.getItemAssistant().bankItem(player.playerItems[player.xRemoveSlot], player.xRemoveSlot, Xamount);
break;
@@ -7,6 +7,7 @@ import com.rs2.game.content.skills.cooking.CookingTutorialIsland;
import com.rs2.game.content.skills.crafting.JewelryMaking;
import com.rs2.game.content.skills.crafting.Pottery;
import com.rs2.game.content.skills.crafting.Spinning;
import com.rs2.game.content.skills.prayer.Ectofuntus;
import com.rs2.game.items.UseItem;
import com.rs2.game.items.impl.Fillables;
import com.rs2.game.players.Player;
@@ -28,10 +29,19 @@ public class ItemOnObject implements PacketType {
player.objectX = objectX;
player.objectY = objectY;
player.endCurrentTask();
int distance = 3;
switch (objectId) {
case Ectofuntus.ECTOFUNTUS:
distance = 5;
break;
default:
distance = 3;
break;
}
if (!player.getItemAssistant().playerHasItem(itemId, 1)) {
return;
}
if (!player.goodDistance(player.objectX, player.objectY, player.absX, player.absY, 3)) {
if (!player.goodDistance(player.objectX, player.objectY, player.absX, player.absY, distance)) {
return;
}
if (player.playerRights == 3) {
@@ -1,6 +1,7 @@
package com.rs2.net.packets.impl;
import com.rs2.Connection;
import com.rs2.GameConstants;
import com.rs2.game.players.Client;
import com.rs2.game.players.Player;
import com.rs2.game.players.PlayerHandler;
@@ -41,7 +42,7 @@ public class PrivateMessaging implements PacketType {
Client o = (Client) PlayerHandler.players[i2];
if (o != null) {
if (PlayerHandler.players[i2].privateChat == 0 || PlayerHandler.players[i2].privateChat == 1 && o.getPlayerAssistant().isInPM(Misc.playerNameToInt64(player.playerName))) {
player.getPacketSender().loadPM(friendToAdd, 1);
player.getPacketSender().loadPM(friendToAdd, GameConstants.WORLD);
break;
}
}
@@ -134,7 +135,7 @@ public class PrivateMessaging implements PacketType {
&& PlayerHandler.players[i1].isActive) {
Client o = (Client) PlayerHandler.players[i1];
if (o != null) {
o.getPlayerAssistant().updatePM(player.playerId, 1);
o.getPlayerAssistant().updatePM(player.playerId, GameConstants.WORLD);
}
}
}
@@ -7,6 +7,7 @@ import com.rs2.game.items.Weight;
import com.rs2.game.items.impl.RareProtection;
import com.rs2.game.players.Player;
import com.rs2.net.packets.PacketType;
import com.rs2.world.Boundary;
/**
* Remove Item
@@ -28,6 +29,13 @@ public class RemoveItem implements PacketType {
switch (interfaceId) {
case 2274:
if (Boundary.isIn(player, Boundary.PARTY_ROOM)) {
PartyRoom.withdrawItem(player, removeSlot, 1);
return;
}
break;
case 4233:
case 4239:
case 4245:
@@ -48,7 +56,7 @@ public class RemoveItem implements PacketType {
break;
case 5064:
if (player.inPartyRoom) {
if (Boundary.isIn(player, Boundary.PARTY_ROOM)) {
PartyRoom.depositItem(player, removeId, 1);
} else {
player.getItemAssistant().bankItem(removeId, removeSlot, 1);
@@ -133,9 +133,8 @@ public class ReportHandler {
.format(new Date()));
String day = new SimpleDateFormat("dd").format(new Date());
bw = new BufferedWriter(new FileWriter(
"data/Reportabuses/"
+ file + " month;" + month + " day;" + day
+ " ms-id;" + time + ".txt", true));
"data/logs/reports/"
+ file + ".txt", true));
bw.write(data);
bw.newLine();
bw.write(text);
@@ -14,7 +14,7 @@ import com.rs2.game.players.PlayerHandler;
public class Boundary {
int minX, minY, highX, highY;
int minX, highX, minY, highY;
int height;
/**
@@ -29,11 +29,11 @@ public class Boundary {
* The north-east y coordinate
*/
public Boundary(int minX, int highX, int minY, int highY) {
this.minX = minX;
this.minY = minY;
this.highX = highX;
this.highY = highY;
height = -1;
this.minX = Math.min(minX, highX);
this.highX = Math.max(minX, highX);
this.minY = Math.min(minY, highY);
this.highY = Math.max(minY, highY);
this.height = -1;
}
/**
@@ -50,10 +50,10 @@ public class Boundary {
* The height of the boundary
*/
public Boundary(int minX, int highX, int minY, int highY, int height) {
this.minX = minX;
this.minY = minY;
this.highX = highX;
this.highY = highY;
this.minX = Math.min(minX, highX);
this.highX = Math.max(minX, highX);
this.minY = Math.min(minY, highY);
this.highY = Math.max(minY, highY);
this.height = height;
}
@@ -96,6 +96,20 @@ public class Boundary {
return player.getX() >= boundaries.minX && player.getX() <= boundaries.highX && player.getY() >= boundaries.minY && player.getY() <= boundaries.highY;
}
/**
*
* @param x
* The x position
* @param y
* The y position
* @param boundaries
* The boundary object
* @return
*/
public static boolean isIn(int x, int y, Boundary boundaries) {
return x >= boundaries.minX && x <= boundaries.highX && y >= boundaries.minY && y <= boundaries.highY;
}
/**
*
* @param npc
@@ -287,5 +301,7 @@ public class Boundary {
public static final Boundary FIGHT_CAVES = new Boundary(2360, 2445, 5045, 5125);
public static final Boundary PIRATE_HOUSE = new Boundary(3038, 3044, 3949, 3959);
public static final Boundary[] FIGHT_PITS = new Boundary[] { new Boundary(2378, 3415, 5133, 5167), new Boundary(2394, 2404, 5169, 5174) };
public static final Boundary PARTY_ROOM = new Boundary(2727, 2746, 3460, 3479);
public static final Boundary PARTY_ROOM_TABLE = new Boundary(2735, 2740, 3467, 3468);
}
@@ -165,7 +165,7 @@ public class ItemHandler {
c.getPacketSender().sendMessage("The cape vanishes as it touches the ground.");
return;
}
if (itemId > 4705 && itemId < 4760) {
if (itemId >= 4708 && itemId <= 4759) {
for (int[] brokenBarrow : brokenBarrows) {
if (brokenBarrow[0] == itemId) {
itemId = brokenBarrow[1];