Telekinetic grab and stuff (#508)
* tidy up * Tidy up check for space * Telekinetic base * Don't allow player to pickup statue * Tidy up item pickup * fixup, statue spawn * Update telekinetic grab * 2nd option for guardian statue * handle telegrab on statue * Allow picking up global drops with telekinetic grab * Check if player can see/reach item * Update PickupItem.java * Allow pasting into chatbox * camera stuff * fixup clipboard stuff * Update PlayerAssistant.java * Update Commands.java * Add mazes initial * Tidy up the clipboard pasting * Update mazes * Calculate new position of statue * fixup telegrab * More tidy up, remove constant running of container * more tidy up.. * Handle moving statues * remove the statue from global drops * Update MagicOnFloorItems.java * Show telekinetic interface * Make public accessable * Only show items to player that are on the same height level * Moving statues around, Spawning * Reward exp, points, law runes * Show points, mazes completed * Add comment * Add observable statue (still needs work) * Fixup where camera focuses * Load items when player changes level * Graveyard base * Add a couple more checks * Update Player.java * Update Commands.java * Make sure statue is visible when player appears at maze * [Mage training arena] Graveyard * Update MageTrainingArena.java * Update MageTrainingArena.java * Update ItemHandler.java
This commit is contained in:
1 parent
c526aa5f4d
commit
2d8ae82086
22 files changed
+719
-193
No files matched your search
@@ -14,17 +14,16 @@ import com.rs2.game.players.PlayerHandler;
|
||||
public class Boundary {
|
||||
|
||||
|
||||
int minX, highX, minY, highY;
|
||||
int height;
|
||||
public int minX, highX, minY, highY, height;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param minX
|
||||
* The south-west x coordinate
|
||||
* @param minY
|
||||
* The south-west y coordinate
|
||||
* @param highX
|
||||
* The north-east x coordinate
|
||||
* @param minY
|
||||
* The south-west y coordinate
|
||||
* @param highY
|
||||
* The north-east y coordinate
|
||||
*/
|
||||
@@ -40,10 +39,10 @@ public class Boundary {
|
||||
*
|
||||
* @param minX
|
||||
* The south-west x coordinate
|
||||
* @param minY
|
||||
* The south-west y coordinate
|
||||
* @param highX
|
||||
* The north-east x coordinate
|
||||
* @param minY
|
||||
* The south-west y coordinate
|
||||
* @param highY
|
||||
* The north-east y coordinate
|
||||
* @param height
|
||||
@@ -301,6 +300,8 @@ public class Boundary {
|
||||
new Boundary(3087, 3094, 3251, 3255), new Boundary(3121, 3130, 3240, 3246), new Boundary(3102, 3112, 3162, 3165), new Boundary(3107, 3111, 3166, 3166), new Boundary(3103, 3115, 3157, 3161),
|
||||
new Boundary(3105, 3114, 3156, 3156), new Boundary(3105, 3113, 3155, 3155), new Boundary(3106, 3112, 3154, 3154), new Boundary(3092, 3097, 3240, 3246) };
|
||||
|
||||
public static final Boundary VARROCK_BANK_BASEMENT = new Boundary(3186, 3197, 9817, 9824, 0);
|
||||
public static final Boundary MAGE_TOWER_CAGE = new Boundary(3108, 3112, 3156, 3158, 2);
|
||||
public static final Boundary ARDOUGNE_ZOO = new Boundary(2593, 2639, 3265, 3288);
|
||||
public static final Boundary APE_ATOLL = new Boundary(2694, 2811, 2691, 2805);
|
||||
public static final Boundary BARROWS = new Boundary(3543, 3584, 3265, 3311);
|
||||
@@ -313,7 +314,9 @@ public class Boundary {
|
||||
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);
|
||||
public static final Boundary MAGE_TRAINING_ARENA = new Boundary(3330, 3388, 9614, 9727);
|
||||
public static final Boundary MAGE_TRAINING_ARENA_ALCHEMY = new Boundary(3350, 3379, 9616, 9655, 2);
|
||||
public static final Boundary MAGE_TRAINING_ARENA_ENCHANTING = new Boundary(3341, 3386, 9618, 9662, 0);
|
||||
public static final Boundary MAGE_TRAINING_ARENA_GRAVEYARD = new Boundary(3340, 3386, 9616, 9662, 1);
|
||||
public static final Boundary MAGE_TRAINING_ARENA_ALCHEMY = new Boundary(3350, 3379, 9616, 9655, 2);
|
||||
public static final Boundary MAGE_TRAINING_ARENA_TELEKINETIC = new Boundary(3329, 3390, 9665, 9726);
|
||||
|
||||
}
|
||||
@@ -146,9 +146,9 @@ public class GlobalDropsHandler {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static boolean itemExists(int a, int b, int c, boolean yes) {
|
||||
public static boolean itemExists(int itemID, int itemX, int itemY, boolean yes) {
|
||||
for (GlobalDrop drop : spawnedDrops) {
|
||||
if (drop.getId() == a && drop.getX() == b && drop.getY() == c) {
|
||||
if (drop.getId() == itemID && drop.getX() == itemX && drop.getY() == itemY) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -159,12 +159,12 @@ public class GlobalDropsHandler {
|
||||
* Pick up an item at the given location
|
||||
*
|
||||
* @param player the Player
|
||||
* @param a item id
|
||||
* @param b cord x
|
||||
* @param c cord y
|
||||
* @param itemID item id
|
||||
* @param itemX cord x
|
||||
* @param itemY cord y
|
||||
*/
|
||||
public static void pickup(Player player, int a, int b, int c) {
|
||||
GlobalDrop drop = itemExists(a, b, c);
|
||||
public static void pickup(Player player, int itemID, int itemX, int itemY) {
|
||||
GlobalDrop drop = itemExists(itemID, itemX, itemY);
|
||||
if (drop == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -58,11 +58,7 @@ public class ItemHandler {
|
||||
|
||||
public int itemAmount(String name, int itemId, int itemX, int itemY) {
|
||||
for (GroundItem i : items) {
|
||||
if (i.hideTicks >= 1 && i.getName().equalsIgnoreCase(name)) {
|
||||
if (i.getItemId() == itemId && i.getItemX() == itemX && i.getItemY() == itemY) {
|
||||
return i.getItemAmount();
|
||||
}
|
||||
} else if (i.hideTicks < 1) {
|
||||
if (i.getName().equalsIgnoreCase(name)) {
|
||||
if (i.getItemId() == itemId && i.getItemX() == itemX && i.getItemY() == itemY) {
|
||||
return i.getItemAmount();
|
||||
}
|
||||
@@ -76,25 +72,42 @@ public class ItemHandler {
|
||||
**/
|
||||
public boolean itemExists(int itemId, int itemX, int itemY) {
|
||||
for (GroundItem i : items) {
|
||||
if (i.getItemId() == itemId && i.getItemX() == itemX
|
||||
&& i.getItemY() == itemY) {
|
||||
if (i.getItemId() == itemId && i.getItemX() == itemX && i.getItemY() == itemY) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (GlobalDropsHandler.itemExists(itemId, itemX, itemY, true)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void moveItem(GroundItem item, int itemX, int itemY) {
|
||||
if (items.remove(item)) {
|
||||
int oldX = item.itemX;
|
||||
int oldY = item.itemY;
|
||||
item.itemX = itemX;
|
||||
item.itemY = itemY;
|
||||
items.add(item);
|
||||
for (Player p: PlayerHandler.players) {
|
||||
if (p == null) continue;
|
||||
p.getPacketSender().removeGroundItem(item.itemId, oldX, oldY, item.itemAmount);
|
||||
reloadItems(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reloads any items if you enter a new region
|
||||
**/
|
||||
public void reloadItems(Player c) {
|
||||
for (GroundItem i : items) {
|
||||
if (c != null) {
|
||||
if (c.getItemAssistant().tradeable(i.getItemId())
|
||||
|| i.getName().equalsIgnoreCase(c.playerName)) {
|
||||
if (c.distanceToPoint(i.getItemX(), i.getItemY()) <= 60) {
|
||||
if (i.hideTicks > 0
|
||||
&& i.getName().equalsIgnoreCase(c.playerName)) {
|
||||
// If it's a players item or tradeable
|
||||
if (c.getItemAssistant().tradeable(i.getItemId()) || i.getName().equalsIgnoreCase(c.playerName)) {
|
||||
// Make sure item on the same height and within 60 blocks
|
||||
if (c.getH() == i.getItemH() && c.distanceToPoint(i.getItemX(), i.getItemY()) <= 60) {
|
||||
if (i.hideTicks > 0 && i.getName().equalsIgnoreCase(c.playerName)) {
|
||||
c.getPacketSender().removeGroundItem(
|
||||
i.getItemId(), i.getItemX(), i.getItemY(),
|
||||
i.getItemAmount());
|
||||
@@ -175,7 +188,6 @@ public class ItemHandler {
|
||||
}
|
||||
if (!com.rs2.game.items.ItemData.itemStackable[itemId] && itemAmount > 0) {
|
||||
for (int j = 0; j < itemAmount; j++) {
|
||||
c.getPacketSender().createGroundItem(itemId, itemX, itemY, 1);
|
||||
GroundItem item = new GroundItem(itemId, itemX, itemY, c.getH(), 1, c.playerId, HIDE_TICKS, PlayerHandler.players[playerId].playerName);
|
||||
addItem(item);
|
||||
String itemName = ItemAssistant.getItemName(itemId).toLowerCase();
|
||||
@@ -186,7 +198,6 @@ public class ItemHandler {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
c.getPacketSender().createGroundItem(itemId, itemX, itemY, itemAmount);
|
||||
GroundItem item = new GroundItem(itemId, itemX, itemY, c.getH(), itemAmount, c.playerId, HIDE_TICKS, PlayerHandler.players[playerId].playerName);
|
||||
addItem(item);
|
||||
String itemName = ItemAssistant.getItemName(itemId).toLowerCase();
|
||||
@@ -196,6 +207,7 @@ public class ItemHandler {
|
||||
}
|
||||
}
|
||||
}
|
||||
reloadItems(c);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,6 +215,9 @@ public class ItemHandler {
|
||||
* Shows items for everyone who is within 60 squares
|
||||
**/
|
||||
public void createGlobalItem(GroundItem i) {
|
||||
if (!itemExists(i.getItemId(), i.getItemX(), i.getItemY())) {
|
||||
addItem(i);
|
||||
}
|
||||
for (Player p : PlayerHandler.players) {
|
||||
if (p != null) {
|
||||
Client person = (Client) p;
|
||||
@@ -212,7 +227,7 @@ public class ItemHandler {
|
||||
&& person.playerId != i.getItemController()) {
|
||||
continue;
|
||||
}
|
||||
if (person.distanceToPoint(i.getItemX(), i.getItemY()) <= 60) {
|
||||
if (person.getH() == i.getItemH() && person.distanceToPoint(i.getItemX(), i.getItemY()) <= 60) {
|
||||
person.getPacketSender().createGroundItem(
|
||||
i.getItemId(), i.getItemX(), i.getItemY(),
|
||||
i.getItemAmount());
|
||||
@@ -293,8 +308,7 @@ public class ItemHandler {
|
||||
Client person = (Client) p;
|
||||
if (person != null) {
|
||||
if (person.distanceToPoint(itemX, itemY) <= 60) {
|
||||
person.getPacketSender().removeGroundItem(itemId,
|
||||
itemX, itemY, itemAmount);
|
||||
person.getPacketSender().removeGroundItem(itemId, itemX, itemY, itemAmount);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -460,6 +474,7 @@ public class ItemHandler {
|
||||
try {
|
||||
FileWriter fileWriter = new FileWriter("item-dump.json");
|
||||
fileWriter.write(array.toString());
|
||||
fileWriter.close();
|
||||
characterfile.close();
|
||||
} catch (IOException e) {
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user