mirror of
https://github.com/2006-Scape/2006Scape.git
synced 2026-07-03 00:31:51 +00:00
Some quick patches (#398)
- Bank all should now work for all items again - Fixed al kharid gate not functioning - Added unique cabbage pickable for Falador - Fixed desert disguise wrongly being noted - Reformatted some of the food code Closes #397 Closes #395 (I also included @Qweqker changes so that will fix lumbridge bank boundary and adds his new cabbage effect) Co-authored-by: Daniel Ginovker <dcress01@uoguelph.ca>
This commit is contained in:
@@ -8,3 +8,9 @@
|
||||
[2020/01/03] 07:00 andrew5 used command: bank
|
||||
[2020/01/03] 07:00 andrew5 used command: bank
|
||||
[2020/01/03] 07:02 andrew5 used command: bank
|
||||
[2020/03/13] 04:15 andrew5 used command: bank
|
||||
[2020/03/13] 04:17 andrew5 used command: bank
|
||||
[2020/03/13] 04:21 andrew5 used command: bank
|
||||
[2020/03/13] 04:25 andrew5 used command: bank
|
||||
[2020/03/13] 04:25 andrew5 used command: bank
|
||||
[2020/03/13] 04:29 andrew5 used command: bank
|
||||
|
||||
@@ -8,94 +8,90 @@ import com.rebotted.util.Misc;
|
||||
|
||||
public class Food {
|
||||
|
||||
private final Player c;
|
||||
|
||||
public Food(Player player) {
|
||||
this.c = player;
|
||||
}
|
||||
|
||||
public static enum FoodToEat {
|
||||
Easter_Egg(1961, 12, "Easter Egg", 0, "Food", false), Pumpkin(1959, 14,
|
||||
"Pumpkin", 0, "Food", false), Half_Jug_of_Wine(1989, 7,
|
||||
"Half Full Wine Jug", 1935, "Drink", false),
|
||||
//GROG(1915, 3, "Grog", 1919, "Drink", true),
|
||||
CUP_OF_TEA(1978, 2 + Misc.random(1), "Cup of Tea", 1980, "Drink", true), CUP_OF_TEA2(
|
||||
712, 2 + Misc.random(1), "Cup of Tea", 1980, "Drink", true),
|
||||
//WIZARD_MIND(1907, 0, "Wizard Mind Bomb", 0, "Drink", true),
|
||||
LEMON(2102, 2,"Lemon", 0, "Food", false), LIME(2120, 2, "Lime", 0, "Food",
|
||||
false), PINEAPPLE(2114, 2, "Pineapple", 0, "Food", false), CHOCOLATE_BAR(
|
||||
1973, 2, "Chocolate Bar", 0, "Food", false), Wine(1993, 11,
|
||||
"Wine", 1935, "Drink", false), MACKERAL(355, 6, "Mackeral", 0,
|
||||
"Food", false), MANTA(391, 22, "Manta Ray", 0, "Food", false), SHARK(
|
||||
385, 20, "Shark", 0, "Food", false), LOBSTER(379, 12,
|
||||
"Lobster", 0, "Food", false), KARAMBWAN(3144, 2 + Misc.random(4), "Karambwan", 0, "Food", false),
|
||||
//BEER(1917, 1, "Beer", 1919, "Drink", true),
|
||||
//GREENMANS_ALE(1909, 1, "Greenman's Ale", 1919, "Drink", true),
|
||||
TROUT(333, 7, "Trout",
|
||||
0, "Food", false), SALMON(329, 9, "Salmon", 0, "Food", false), SWORDFISH(
|
||||
373, 14, "Swordfish", 0, "Food", false), TUNA(361, 10, "Tuna",
|
||||
0, "Food", false),
|
||||
//MOONLIGHT_MEAD(2955, 4, "Moonlight mead", 1919, "Drink", false),
|
||||
MONKFISH(7946, 16, "Monkfish", 0,
|
||||
"Food", false), SEA_TURTLE(397, 21, "Sea Turtle", 0, "Food",
|
||||
false), CABBAGE(1965, 1, "Cabbage", 0, "Food", false), CABBAGE_SOUTH_OF_FALADOR(1967, 1, "Cabbage", 0, "Food", false), SPINACH(
|
||||
1969, 2, "Spinach Roll", 0, "Food", false), CAKE(1891, 4,
|
||||
"Cake", 1893, "Food", false), CAKE2(1893, 4, "2/3 Cake", 1895,
|
||||
"Food", false), SLICE_OF_CAKE(1895, 4, "2/3 Cake", 0, "Food",
|
||||
false), BASS(365, 13, "Bass", 0, "Food", false), COD(339, 7,
|
||||
"Cod", 0, "Food", false), POTATO(1942, 1, "Potato", 0, "Food",
|
||||
false), BAKED_POTATO(6701, 4, "Baked Potato", 0, "Food", false), POTATO_WITH_CHEESE(
|
||||
6705, 16, "Potato with Cheese", 0, "Food", false), EGG_POTATO(
|
||||
7056, 16, "Egg Potato", 0, "Food", false), CHILLI_POTATO(7054,
|
||||
14, "Chilli Potato", 0, "Food", false), MUSHROOM_POTATO(7058,
|
||||
20, "Mushroom Potato", 0, "Food", false), TUNA_POTATO(7060, 22,
|
||||
"Tuna Potato", 0, "Food", false), SHRIMPS(315, 3, "Shrimps", 0,
|
||||
"Food", false), HERRING(347, 5, "Herring", 0, "Food", false), SARDINE(
|
||||
325, 4, "Sardine", 0, "Food", false), CHOCOLATE_CAKE(1897, 5,
|
||||
"Chocolate Cake", 1899, "Food", false), HALF_CHOCOLATE_CAKE(
|
||||
1899, 5, "2/3 Chocolate Cake", 1901, "Food", false), CHOCOLATE_SLICE(
|
||||
1901, 5, "Chocolate Slice", 0, "Food", false), ANCHOVIES(319,
|
||||
2, "Anchovies", 0, "Food", false), PLAIN_PIZZA(2289, 7,
|
||||
"Plain Pizza", 2291, "Food", false), HALF_PLAIN_PIZZA(2291, 7,
|
||||
"1/2 Plain pizza", 0, "Food", false), MEAT_PIZZA(2293, 8,
|
||||
"Meat Pizza", 2295, "Food", false), CHICKEN(2140, 3, "Chicken",
|
||||
0, "Food", false), MEAT(2142, 2, "Meat", 0, "Food", false), HALF_MEAT_PIZZA(
|
||||
2295, 8, "1/2 Meat Pizza", 0, "Food", false), ANCHOVY_PIZZA(
|
||||
2297, 9, "Anchovy Pizza", 2299, "Food", false), HALF_ANCHOVY_PIZZA(
|
||||
2299, 9, "1/2 Anchovy Pizza", 0, "Food", false), PINEAPPLE_PIZZA(
|
||||
2301, 11, "Pineapple Pizza", 2303, "Food", false), HALF_PINEAPPLE_PIZZA(
|
||||
2303, 11, "1/2 Pineapple Pizza", 0, "Food", false), BREAD(2309,
|
||||
5, "Bread", 0, "Food", false), APPLE_PIE(2323, 7, "Apple Pie",
|
||||
2335, "Food", false), HALF_APPLE_PIE(2335, 7, "Half Apple Pie",
|
||||
2313, "Food", false), REDBERRY_PIE(2325, 5, "Redberry Pie",
|
||||
2333, "Food", false), HALF_REDBERRY_PIE(2333, 5,
|
||||
"Half Redberry Pie", 2313, "Food", false), Ugthanki_kebab(1883,
|
||||
2, "Ugthanki kebab", 0, "Food", false),
|
||||
// Kebab(1971, 2, "kebab", 0, "food", false),
|
||||
SEAWEED(403, 4, "Edible Seaweed", 0, "Food", false),
|
||||
MEAT_PIE(2327, 6, "Meat Pie", 2331, "Food", false), HALF_MEAT_PIE(2331,
|
||||
6, "Half Meat Pie", 2313, "Food", false), SUMMER_PIE(7218, 11,
|
||||
"Summer Pie", 7220, "Food", false), HALF_SUMMER_PIE(7220, 11,
|
||||
"Half Summer Pie", 2313, "Food", false), PIKE(351, 8, "Pike",
|
||||
0, "Food", false), POTATO_WITH_BUTTER(6703, 14,
|
||||
"Potato with Butter", 0, "Food", false),
|
||||
SLICED_BANANA(3162, 2, "Sliced Banana", 0, "Food", false),
|
||||
BANANA(1963, 2, "Banana", 0, "Food", false), PEACH(6883, 8, "Peach", 0, "Food",
|
||||
false), ORANGE(2108, 2, "Orange", 0, "Food", false), PINEAPPLE_RINGS(
|
||||
2118, 2, "Pineapple Rings", 0, "Food", false), PINEAPPLE_CHUNKS(
|
||||
2116, 2, "Pineapple Chunks", 0, "Food", false), EASTER_EGG(
|
||||
7928, 1, "Easter Egg", 0, "Food", false), EASTER_EGG2(7929, 1,
|
||||
"Easter Egg", 0, "Food", false), EASTER_EGG3(7930, 1,
|
||||
"Easter Egg", 0, "Food", false), EASTER_EGG4(7931, 1,
|
||||
"Easter Egg", 0, "Food", false), EASTER_EGG5(7932, 1,
|
||||
"Easter Egg", 0, "Food", false), EASTER_EGG6(7933, 1,
|
||||
"Easter Egg", 0, "Food", false), PURPLE_SWEETS(10476, 9,
|
||||
"Purple Sweets", 0, "Food", false), POT_OF_CREAM(2130, 1,
|
||||
"Pot of cream", 0, "Food", false),
|
||||
FILED_RATION(7934, 9, "Field Ration", 0, "Food", false),
|
||||
STEW(2003, 11, "Stew", 1923, "Food", false),
|
||||
CURRY(2011, 19, "Curry", 1923, "Drink", false),
|
||||
BANDAGES(4049, 3, "Bandages", 0, "Food", false);
|
||||
Easter_Egg(1961, 12, "Easter Egg", 0, "Food", false),
|
||||
Pumpkin(1959, 14, "Pumpkin", 0, "Food", false),
|
||||
Half_Jug_of_Wine(1989, 7, "Half Full Wine Jug", 1935, "Drink", false),
|
||||
CUP_OF_TEA(1978, 2 + Misc.random(1), "Cup of Tea", 1980, "Drink", true),
|
||||
CUP_OF_TEA2(712, 2 + Misc.random(1), "Cup of Tea", 1980, "Drink", true),
|
||||
LEMON(2102, 2,"Lemon", 0, "Food", false), LIME(2120, 2, "Lime", 0, "Food", false),
|
||||
PINEAPPLE(2114, 2, "Pineapple", 0, "Food", false),
|
||||
CHOCOLATE_BAR(1973, 2, "Chocolate Bar", 0, "Food", false),
|
||||
Wine(1993, 11, "Wine", 1935, "Drink", false),
|
||||
MACKERAL(355, 6, "Mackeral", 0, "Food", false),
|
||||
MANTA(391, 22, "Manta Ray", 0, "Food", false),
|
||||
SHARK(385, 20, "Shark", 0, "Food", false),
|
||||
LOBSTER(379, 12, "Lobster", 0, "Food", false),
|
||||
KARAMBWAN(3144, 2 + Misc.random(4), "Karambwan", 0, "Food", false),
|
||||
TROUT(333, 7, "Trout", 0, "Food", false),
|
||||
SALMON(329, 9, "Salmon", 0, "Food", false),
|
||||
SWORDFISH(373, 14, "Swordfish", 0, "Food", false),
|
||||
TUNA(361, 10, "Tuna", 0, "Food", false),
|
||||
MONKFISH(7946, 16, "Monkfish", 0, "Food", false),
|
||||
SEA_TURTLE(397, 21, "Sea Turtle", 0, "Food", false),
|
||||
CABBAGE(1965, 1, "Cabbage", 0, "Food", false),
|
||||
CABBAGE_SOUTH_OF_FALADOR(1967, 1, "Cabbage", 0, "Food", false),
|
||||
SPINACH(1969, 2, "Spinach Roll", 0, "Food", false),
|
||||
CAKE(1891, 4, "Cake", 1893, "Food", false),
|
||||
CAKE2(1893, 4, "2/3 Cake", 1895, "Food", false),
|
||||
SLICE_OF_CAKE(1895, 4, "2/3 Cake", 0, "Food", false),
|
||||
BASS(365, 13, "Bass", 0, "Food", false),
|
||||
COD(339, 7, "Cod", 0, "Food", false),
|
||||
POTATO(1942, 1, "Potato", 0, "Food", false),
|
||||
BAKED_POTATO(6701, 4, "Baked Potato", 0, "Food", false),
|
||||
POTATO_WITH_CHEESE(6705, 16, "Potato with Cheese", 0, "Food", false),
|
||||
EGG_POTATO(7056, 16, "Egg Potato", 0, "Food", false),
|
||||
CHILLI_POTATO(7054, 14, "Chilli Potato", 0, "Food", false),
|
||||
MUSHROOM_POTATO(7058, 20, "Mushroom Potato", 0, "Food", false),
|
||||
TUNA_POTATO(7060, 22, "Tuna Potato", 0, "Food", false),
|
||||
SHRIMPS(315, 3, "Shrimps", 0, "Food", false),
|
||||
HERRING(347, 5, "Herring", 0, "Food", false),
|
||||
SARDINE(325, 4, "Sardine", 0, "Food", false),
|
||||
CHOCOLATE_CAKE(1897, 5, "Chocolate Cake", 1899, "Food", false),
|
||||
HALF_CHOCOLATE_CAKE(1899, 5, "2/3 Chocolate Cake", 1901, "Food", false),
|
||||
CHOCOLATE_SLICE(1901, 5, "Chocolate Slice", 0, "Food", false),
|
||||
ANCHOVIES(319, 2, "Anchovies", 0, "Food", false),
|
||||
PLAIN_PIZZA(2289, 7, "Plain Pizza", 2291, "Food", false),
|
||||
HALF_PLAIN_PIZZA(2291, 7, "1/2 Plain pizza", 0, "Food", false),
|
||||
MEAT_PIZZA(2293, 8, "Meat Pizza", 2295, "Food", false),
|
||||
CHICKEN(2140, 3, "Chicken", 0, "Food", false),
|
||||
MEAT(2142, 2, "Meat", 0, "Food", false),
|
||||
HALF_MEAT_PIZZA(2295, 8, "1/2 Meat Pizza", 0, "Food", false),
|
||||
ANCHOVY_PIZZA(2297, 9, "Anchovy Pizza", 2299, "Food", false),
|
||||
HALF_ANCHOVY_PIZZA(2299, 9, "1/2 Anchovy Pizza", 0, "Food", false),
|
||||
PINEAPPLE_PIZZA(2301, 11, "Pineapple Pizza", 2303, "Food", false),
|
||||
HALF_PINEAPPLE_PIZZA(2303, 11, "1/2 Pineapple Pizza", 0, "Food", false),
|
||||
BREAD(2309, 5, "Bread", 0, "Food", false),
|
||||
APPLE_PIE(2323, 7, "Apple Pie", 2335, "Food", false),
|
||||
HALF_APPLE_PIE(2335, 7, "Half Apple Pie", 2313, "Food", false),
|
||||
REDBERRY_PIE(2325, 5, "Redberry Pie", 2333, "Food", false),
|
||||
HALF_REDBERRY_PIE(2333, 5, "Half Redberry Pie", 2313, "Food", false),
|
||||
Ugthanki_kebab(1883, 2, "Ugthanki kebab", 0, "Food", false),
|
||||
SEAWEED(403, 4, "Edible Seaweed", 0, "Food", false),
|
||||
MEAT_PIE(2327, 6, "Meat Pie", 2331, "Food", false),
|
||||
HALF_MEAT_PIE(2331, 6, "Half Meat Pie", 2313, "Food", false),
|
||||
SUMMER_PIE(7218, 11, "Summer Pie", 7220, "Food", false),
|
||||
HALF_SUMMER_PIE(7220, 11, "Half Summer Pie", 2313, "Food", false),
|
||||
PIKE(351, 8, "Pike", 0, "Food", false),
|
||||
POTATO_WITH_BUTTER(6703, 14, "Potato with Butter", 0, "Food", false),
|
||||
SLICED_BANANA(3162, 2, "Sliced Banana", 0, "Food", false),
|
||||
BANANA(1963, 2, "Banana", 0, "Food", false),
|
||||
PEACH(6883, 8, "Peach", 0, "Food", false),
|
||||
ORANGE(2108, 2, "Orange", 0, "Food", false),
|
||||
PINEAPPLE_RINGS(2118, 2, "Pineapple Rings", 0, "Food", false),
|
||||
PINEAPPLE_CHUNKS(2116, 2, "Pineapple Chunks", 0, "Food", false),
|
||||
EASTER_EGG(7928, 1, "Easter Egg", 0, "Food", false),
|
||||
EASTER_EGG2(7929, 1, "Easter Egg", 0, "Food", false),
|
||||
EASTER_EGG3(7930, 1, "Easter Egg", 0, "Food", false),
|
||||
EASTER_EGG4(7931, 1, "Easter Egg", 0, "Food", false),
|
||||
EASTER_EGG5(7932, 1, "Easter Egg", 0, "Food", false),
|
||||
EASTER_EGG6(7933, 1, "Easter Egg", 0, "Food", false),
|
||||
PURPLE_SWEETS(10476, 9, "Purple Sweets", 0, "Food", false),
|
||||
POT_OF_CREAM(2130, 1, "Pot of cream", 0, "Food", false),
|
||||
FILED_RATION(7934, 9, "Field Ration", 0, "Food", false),
|
||||
STEW(2003, 11, "Stew", 1923, "Food", false),
|
||||
CURRY(2011, 19, "Curry", 1923, "Drink", false),
|
||||
BANDAGES(4049, 3, "Bandages", 0, "Food", false);
|
||||
|
||||
private int id;
|
||||
private int heal;
|
||||
@@ -151,111 +147,101 @@ public class Food {
|
||||
return Misc.random(r);
|
||||
}
|
||||
|
||||
public void eat(int id, int slot) {
|
||||
if (c.isDead || c.playerLevel[3] <= 0) {
|
||||
public static void eat(Player player, int id, int slot) {
|
||||
if (player.isDead || player.playerLevel[3] <= 0) {
|
||||
return;
|
||||
}
|
||||
if (c.duelRule[6]) {
|
||||
c.getPacketSender()
|
||||
.sendMessage("You may not eat in this duel.");
|
||||
if (player.duelRule[6]) {
|
||||
player.getPacketSender().sendMessage("You may not eat in this duel.");
|
||||
return;
|
||||
}
|
||||
if (!RareProtection.eatDupedItem(c, id)) {
|
||||
if (!RareProtection.eatDupedItem(player, id)) {
|
||||
return;
|
||||
}
|
||||
if (System.currentTimeMillis() - c.foodDelay >= 1800
|
||||
&& c.playerLevel[3] > 0) {
|
||||
c.getCombatAssistant().resetPlayerAttack();
|
||||
c.attackTimer += 2;
|
||||
c.startAnimation(829);
|
||||
c.getItemAssistant().deleteItem(id, slot, 1);
|
||||
if (System.currentTimeMillis() - player.foodDelay >= 1800 && player.playerLevel[3] > 0) {
|
||||
player.getCombatAssistant().resetPlayerAttack();
|
||||
player.attackTimer += 2;
|
||||
player.startAnimation(829);
|
||||
player.getItemAssistant().deleteItem(id, slot, 1);
|
||||
FoodToEat f = FoodToEat.food.get(id);
|
||||
if (f.hasEffect()) {
|
||||
foodEffect(id);
|
||||
foodEffect(player, id);
|
||||
}
|
||||
if (f.replaceWith() > 0) {
|
||||
c.getItemAssistant().addItem(f.replaceWith(), 1);
|
||||
player.getItemAssistant().addItem(f.replaceWith(), 1);
|
||||
}
|
||||
if (f.getType().equalsIgnoreCase("Food")) {
|
||||
if (id == 1965) {
|
||||
c.getPacketSender().sendMessage(
|
||||
"You eat the cabbage. Yuck!");
|
||||
}
|
||||
else if (id == 1967){
|
||||
c.getPacketSender().sendMessage(
|
||||
"You eat the cabbage. It seems to taste nicer than normal.");
|
||||
player.getPacketSender().sendMessage("You eat the cabbage. Yuck!");
|
||||
} else if (id == 1967){
|
||||
player.getPacketSender().sendMessage("You eat the cabbage. It seems to taste nicer than normal.");
|
||||
} else {
|
||||
c.getPacketSender().sendMessage(
|
||||
"You eat the " + f.getName() + ".");
|
||||
player.getPacketSender().sendMessage("You eat the " + f.getName() + ".");
|
||||
}
|
||||
}
|
||||
else if (f.getType().equalsIgnoreCase("Drink")) {
|
||||
} else if (f.getType().equalsIgnoreCase("Drink")) {
|
||||
if (id == 2955) {
|
||||
c.getPacketSender().sendMessage("It tastes like something just died in your mouth.");
|
||||
player.getPacketSender().sendMessage("It tastes like something just died in your mouth.");
|
||||
} else {
|
||||
c.getPacketSender().sendMessage(
|
||||
"You drink the " + f.getName() + ".");
|
||||
player.getPacketSender().sendMessage("You drink the " + f.getName() + ".");
|
||||
}
|
||||
}
|
||||
|
||||
if (f.getType().equalsIgnoreCase("Food")) {
|
||||
c.getPacketSender().sendSound(SoundList.FOOD_EAT, 100, 0);
|
||||
player.getPacketSender().sendSound(SoundList.FOOD_EAT, 100, 0);
|
||||
} else if (f.getType().equalsIgnoreCase("Drink")) {
|
||||
c.getPacketSender().sendSound(SoundList.DRINK, 100, 0);
|
||||
player.getPacketSender().sendSound(SoundList.DRINK, 100, 0);
|
||||
}
|
||||
c.foodDelay = System.currentTimeMillis();
|
||||
if (c.playerLevel[3] < c.getLevelForXP(c.playerXP[3])) {
|
||||
c.playerLevel[3] += f.getHeal();
|
||||
c.getPacketSender().sendMessage("It heals some health.");
|
||||
if (c.playerLevel[3] > c.getLevelForXP(c.playerXP[3])) {
|
||||
c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
|
||||
player.foodDelay = System.currentTimeMillis();
|
||||
if (player.playerLevel[3] < player.getLevelForXP(player.playerXP[3])) {
|
||||
player.playerLevel[3] += f.getHeal();
|
||||
player.getPacketSender().sendMessage("It heals some health.");
|
||||
if (player.playerLevel[3] > player.getLevelForXP(player.playerXP[3])) {
|
||||
player.playerLevel[3] = player.getLevelForXP(player.playerXP[3]);
|
||||
}
|
||||
}
|
||||
c.getPlayerAssistant().refreshSkill(3);
|
||||
player.getPlayerAssistant().refreshSkill(3);
|
||||
}
|
||||
}
|
||||
|
||||
public void foodEffect(int id) {
|
||||
public static void foodEffect(Player player, int id) {
|
||||
switch (id) {
|
||||
case 1978:
|
||||
case 712:
|
||||
c.forcedChat("Aaah, nothing like a nice cuppa tea!");
|
||||
player.forcedChat("Aaah, nothing like a nice cuppa tea!");
|
||||
break;
|
||||
case 1907:
|
||||
if (c.playerLevel[6] < 50) {
|
||||
c.playerLevel[6] = c.getPlayerAssistant().getLevelForXP(
|
||||
c.playerXP[6]) + 2;
|
||||
if (player.playerLevel[6] < 50) {
|
||||
player.playerLevel[6] = player.getPlayerAssistant().getLevelForXP(player.playerXP[6]) + 2;
|
||||
} else {
|
||||
c.playerLevel[6] = c.getPlayerAssistant().getLevelForXP(
|
||||
c.playerXP[6]) + 3;
|
||||
player.playerLevel[6] = player.getPlayerAssistant().getLevelForXP(player.playerXP[6]) + 3;
|
||||
}
|
||||
if (c.playerLevel[2] < 4) {
|
||||
c.playerLevel[2] = 1;
|
||||
if (player.playerLevel[2] < 4) {
|
||||
player.playerLevel[2] = 1;
|
||||
}
|
||||
if (c.playerLevel[0] < 5) {
|
||||
c.playerLevel[0] = 1;
|
||||
if (player.playerLevel[0] < 5) {
|
||||
player.playerLevel[0] = 1;
|
||||
} else {
|
||||
c.playerLevel[0] = c.getPlayerAssistant().getLevelForXP(c.playerXP[0]) - 4;
|
||||
player.playerLevel[0] = player.getPlayerAssistant().getLevelForXP(player.playerXP[0]) - 4;
|
||||
}
|
||||
if (c.playerLevel[1] < 4) {
|
||||
c.playerLevel[1] = 1;
|
||||
if (player.playerLevel[1] < 4) {
|
||||
player.playerLevel[1] = 1;
|
||||
} else {
|
||||
c.playerLevel[1] = c.getPlayerAssistant().getLevelForXP(c.playerXP[1]) - 3;
|
||||
player.playerLevel[1] = player.getPlayerAssistant().getLevelForXP(player.playerXP[1]) - 3;
|
||||
}
|
||||
if (c.playerLevel[2] < 4) {
|
||||
c.playerLevel[2] = 1;
|
||||
if (player.playerLevel[2] < 4) {
|
||||
player.playerLevel[2] = 1;
|
||||
} else {
|
||||
c.playerLevel[2] = c.getPlayerAssistant().getLevelForXP(c.playerXP[2]) - 3;
|
||||
player.playerLevel[2] = player.getPlayerAssistant().getLevelForXP(player.playerXP[2]) - 3;
|
||||
}
|
||||
c.getPlayerAssistant().refreshSkill(0);
|
||||
c.getPlayerAssistant().refreshSkill(1);
|
||||
c.getPlayerAssistant().refreshSkill(2);
|
||||
c.getPlayerAssistant().refreshSkill(6);
|
||||
player.getPlayerAssistant().refreshSkill(0);
|
||||
player.getPlayerAssistant().refreshSkill(1);
|
||||
player.getPlayerAssistant().refreshSkill(2);
|
||||
player.getPlayerAssistant().refreshSkill(6);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isFood(int id) {
|
||||
public static boolean isFood(int id) {
|
||||
return FoodToEat.food.containsKey(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -152,7 +152,7 @@ public class CombatSounds {
|
||||
}
|
||||
|
||||
public static String getItemName(int ItemID) {
|
||||
return GameEngine.itemHandler.ItemList[ItemID].itemName;
|
||||
return GameEngine.itemHandler.itemList[ItemID].itemName;
|
||||
}
|
||||
|
||||
public static int getMagicSound(Player c, int spellId) {
|
||||
|
||||
+1
-1
@@ -195,7 +195,7 @@ public class Pickpocket extends SkillHandler {
|
||||
}
|
||||
|
||||
public static int getItemId(String itemName) {
|
||||
for (ItemList i : GameEngine.itemHandler.ItemList) {
|
||||
for (ItemList i : GameEngine.itemHandler.itemList) {
|
||||
if (i != null) {
|
||||
if (i.itemName.equalsIgnoreCase(itemName)) {
|
||||
return i.itemId;
|
||||
|
||||
+1
-1
@@ -83,7 +83,7 @@ public class Stalls {
|
||||
}
|
||||
|
||||
public static int getItemId(String itemName) {
|
||||
for (ItemList i : GameEngine.itemHandler.ItemList) {
|
||||
for (ItemList i : GameEngine.itemHandler.itemList) {
|
||||
if (i != null) {
|
||||
if (i.itemName.equalsIgnoreCase(itemName)) {
|
||||
return i.itemId;
|
||||
|
||||
@@ -4023,8 +4023,7 @@ public class DialogueHandler {
|
||||
break;
|
||||
|
||||
case 1027:
|
||||
player.getDialogueHandler().sendStatement(
|
||||
"10 coins are removed from your inventory.");
|
||||
player.getDialogueHandler().sendStatement("10 coins are removed from your inventory.");
|
||||
OtherObjects.initKharid(player, player.objectId);
|
||||
player.nextChat = 0;
|
||||
break;
|
||||
|
||||
@@ -128,8 +128,8 @@ public class Inventory {
|
||||
|
||||
public boolean ownsItem(String itemName) {
|
||||
for (int i = 0; i < GameConstants.ITEM_LIMIT; i++) {
|
||||
if (GameEngine.itemHandler.ItemList[i] != null) {
|
||||
if (GameEngine.itemHandler.ItemList[i].itemName
|
||||
if (GameEngine.itemHandler.itemList[i] != null) {
|
||||
if (GameEngine.itemHandler.itemList[i].itemName
|
||||
.equalsIgnoreCase(itemName)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -100,6 +100,6 @@ public class Item {
|
||||
}
|
||||
|
||||
public ItemList getDefinition() {
|
||||
return GameEngine.itemHandler.ItemList[id];
|
||||
return GameEngine.itemHandler.itemList[id];
|
||||
}
|
||||
}
|
||||
@@ -208,6 +208,7 @@ public class ItemAssistant {
|
||||
}
|
||||
}
|
||||
|
||||
//for inv
|
||||
public int getItemAmount(int itemID) {
|
||||
int itemCount = 0;
|
||||
for (int i = 0; i < c.playerItems.length; i++) {
|
||||
@@ -217,6 +218,17 @@ public class ItemAssistant {
|
||||
}
|
||||
return itemCount;
|
||||
}
|
||||
|
||||
//for bank
|
||||
public int itemAmount(int itemID) {
|
||||
int tempAmount = 0;
|
||||
for (int i = 0; i < c.playerItems.length; i++) {
|
||||
if (c.playerItems[i] == itemID) {
|
||||
tempAmount += c.playerItemsN[i];
|
||||
}
|
||||
}
|
||||
return tempAmount;
|
||||
}
|
||||
|
||||
|
||||
public void writeBonus() {
|
||||
@@ -540,10 +552,10 @@ public class ItemAssistant {
|
||||
for (int element : c.playerEquipment) {
|
||||
if (element > -1) {
|
||||
for (int j = 0; j < GameConstants.ITEM_LIMIT; j++) {
|
||||
if (GameEngine.itemHandler.ItemList[j] != null) {
|
||||
if (GameEngine.itemHandler.ItemList[j].itemId == element) {
|
||||
if (GameEngine.itemHandler.itemList[j] != null) {
|
||||
if (GameEngine.itemHandler.itemList[j].itemId == element) {
|
||||
for (int k = 0; k < c.playerBonus.length; k++) {
|
||||
c.playerBonus[k] += GameEngine.itemHandler.ItemList[j].Bonuses[k];
|
||||
c.playerBonus[k] += GameEngine.itemHandler.itemList[j].Bonuses[k];
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -2035,22 +2047,17 @@ public class ItemAssistant {
|
||||
}
|
||||
if (amount > 0) {
|
||||
if (c.bankItems[fromSlot] > 0) {
|
||||
if (c.getItemAssistant().playerHasItem(itemID))
|
||||
{
|
||||
for (int i = 0; i <= 27;i++)
|
||||
{
|
||||
if (itemID == c.playerItems[i] || (itemID == 995 && c.playerItems[i] - 1 == 995))
|
||||
{
|
||||
if ((c.playerItemsN[i] + amount + 1) < -1)
|
||||
{
|
||||
if (c.getItemAssistant().playerHasItem(itemID)) {
|
||||
for (int i = 0; i <= 27; i++) {
|
||||
if (itemID == c.playerItems[i] || (itemID == 995 && c.playerItems[i] - 1 == 995)) {
|
||||
if ((c.playerItemsN[i] + amount + 1) < -1) {
|
||||
cantWithdrawCuzMaxStack = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!cantWithdrawCuzMaxStack)
|
||||
{
|
||||
if (!cantWithdrawCuzMaxStack) {
|
||||
if (!c.takeAsNote) {
|
||||
if (ItemData.itemStackable[c.bankItems[fromSlot] - 1]) {
|
||||
if (c.bankItemsN[fromSlot] > amount) {
|
||||
@@ -2060,8 +2067,7 @@ public class ItemAssistant {
|
||||
resetItems(5064);
|
||||
}
|
||||
} else {
|
||||
if (addItem(c.bankItems[fromSlot] - 1,
|
||||
c.bankItemsN[fromSlot])) {
|
||||
if (addItem(c.bankItems[fromSlot] - 1, c.bankItemsN[fromSlot])) {
|
||||
c.bankItems[fromSlot] = 0;
|
||||
c.bankItemsN[fromSlot] = 0;
|
||||
resetBank();
|
||||
@@ -2109,8 +2115,7 @@ public class ItemAssistant {
|
||||
resetItems(5064);
|
||||
}
|
||||
} else {
|
||||
if (addItem(c.bankItems[fromSlot] - 1,
|
||||
c.bankItemsN[fromSlot])) {
|
||||
if (addItem(c.bankItems[fromSlot] - 1, c.bankItemsN[fromSlot])) {
|
||||
c.bankItems[fromSlot] = 0;
|
||||
c.bankItemsN[fromSlot] = 0;
|
||||
resetBank();
|
||||
@@ -2134,9 +2139,7 @@ public class ItemAssistant {
|
||||
resetItems(5064);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
c.getPacketSender().sendMessage("Can't withdraw more of that item!");
|
||||
}
|
||||
}
|
||||
@@ -2450,9 +2453,9 @@ public class ItemAssistant {
|
||||
|
||||
public static String getItemName(int ItemID) {
|
||||
for (int i = 0; i < GameConstants.ITEM_LIMIT; i++) {
|
||||
if (GameEngine.itemHandler.ItemList[i] != null) {
|
||||
if (GameEngine.itemHandler.ItemList[i].itemId == ItemID) {
|
||||
return GameEngine.itemHandler.ItemList[i].itemName;
|
||||
if (GameEngine.itemHandler.itemList[i] != null) {
|
||||
if (GameEngine.itemHandler.itemList[i].itemId == ItemID) {
|
||||
return GameEngine.itemHandler.itemList[i].itemName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2461,10 +2464,10 @@ public class ItemAssistant {
|
||||
|
||||
public int getItemId(String itemName) {
|
||||
for (int i = 0; i < GameConstants.ITEM_LIMIT; i++) {
|
||||
if (GameEngine.itemHandler.ItemList[i] != null) {
|
||||
if (GameEngine.itemHandler.ItemList[i].itemName
|
||||
if (GameEngine.itemHandler.itemList[i] != null) {
|
||||
if (GameEngine.itemHandler.itemList[i].itemName
|
||||
.equalsIgnoreCase(itemName)) {
|
||||
return GameEngine.itemHandler.ItemList[i].itemId;
|
||||
return GameEngine.itemHandler.itemList[i].itemId;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2530,26 +2533,26 @@ public class ItemAssistant {
|
||||
}
|
||||
|
||||
public int getUnnotedItem(int ItemID) {
|
||||
int NewID = ItemID - 1;
|
||||
int newId = ItemID - 1;
|
||||
String NotedName = "";
|
||||
for (int i = 0; i < GameConstants.ITEM_LIMIT; i++) {
|
||||
if (GameEngine.itemHandler.ItemList[i] != null) {
|
||||
if (GameEngine.itemHandler.ItemList[i].itemId == ItemID) {
|
||||
NotedName = GameEngine.itemHandler.ItemList[i].itemName;
|
||||
if (GameEngine.itemHandler.itemList[i] != null) {
|
||||
if (GameEngine.itemHandler.itemList[i].itemId == ItemID) {
|
||||
NotedName = GameEngine.itemHandler.itemList[i].itemName;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < GameConstants.ITEM_LIMIT; i++) {
|
||||
if (GameEngine.itemHandler.ItemList[i] != null) {
|
||||
if (GameEngine.itemHandler.ItemList[i].itemName == NotedName) {
|
||||
if (GameEngine.itemHandler.ItemList[i].itemDescription.startsWith("Swap this note at any bank for a") == false) {
|
||||
NewID = GameEngine.itemHandler.ItemList[i].itemId;
|
||||
if (GameEngine.itemHandler.itemList[i] != null) {
|
||||
if (GameEngine.itemHandler.itemList[i].itemName == NotedName) {
|
||||
if (GameEngine.itemHandler.itemList[i].itemDescription.startsWith("Swap this note at any bank for a") == false) {
|
||||
newId = GameEngine.itemHandler.itemList[i].itemId;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return NewID;
|
||||
return newId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -187,7 +187,7 @@ public class ItemData {
|
||||
}
|
||||
|
||||
public static String getItemName(int id) {
|
||||
for (ItemList element : GameEngine.itemHandler.ItemList) {
|
||||
for (ItemList element : GameEngine.itemHandler.itemList) {
|
||||
if (element != null) {
|
||||
if (element.itemId == id) {
|
||||
return element.itemName;
|
||||
@@ -225,7 +225,12 @@ public class ItemData {
|
||||
try {
|
||||
FileInputStream dataIn = new FileInputStream(new File("./data/data/notes.dat"));
|
||||
while ((c = dataIn.read()) != -1) {
|
||||
itemIsNote[counter] = c == 0;
|
||||
if (c == 0) {
|
||||
itemIsNote[counter] = false;
|
||||
itemIsNote[4611] = false;
|
||||
} else {
|
||||
itemIsNote[counter] = true;
|
||||
}
|
||||
counter++;
|
||||
}
|
||||
dataIn.close();
|
||||
|
||||
@@ -227,7 +227,7 @@ public class NPCDropsHandler {
|
||||
* @return
|
||||
*/
|
||||
public static int getItemId(String itemName) {
|
||||
for (ItemList i : GameEngine.itemHandler.ItemList) {
|
||||
for (ItemList i : GameEngine.itemHandler.itemList) {
|
||||
if (i != null) {
|
||||
if (i.itemName.equalsIgnoreCase(itemName)) {
|
||||
return i.itemId;
|
||||
|
||||
@@ -48,7 +48,7 @@ public class OtherObjects {
|
||||
return;
|
||||
}
|
||||
if (openKharid(player, objectId)) {
|
||||
GameEngine.objectHandler.createAnObject(player, -1, player.objectX, player.objectY, -1);
|
||||
//GameEngine.objectHandler.createAnObject(player, -1, player.objectX, player.objectY, -1);
|
||||
final int[] coords = new int[2];
|
||||
if (player.getX() == 3267) {
|
||||
player.getPlayerAssistant().movePlayer(player.getX() + 1, player.getY(), 0);
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.rebotted.event.CycleEventContainer;
|
||||
import com.rebotted.event.CycleEventHandler;
|
||||
import com.rebotted.game.content.music.sound.SoundList;
|
||||
import com.rebotted.game.players.Player;
|
||||
import com.rebotted.world.Boundary;
|
||||
|
||||
/**
|
||||
* Pickables
|
||||
@@ -18,7 +19,10 @@ public class Pickable {
|
||||
{ 1161, 1965 }, // Cabbage
|
||||
{ 2646, 1779 }, // Flax
|
||||
{ 313, 1947 }, // Wheat
|
||||
{ 5585, 1947 }, { 5584, 1947 }, { 5585, 1947 }, { 312, 1942 }, // Potato
|
||||
{ 5585, 1947 }, // Wheat
|
||||
{ 5584, 1947 }, // Wheat
|
||||
{ 5585, 1947 }, // Wheat
|
||||
{ 312, 1942 }, // Potato
|
||||
{ 3366, 1957 }, // Onion
|
||||
};
|
||||
|
||||
@@ -30,7 +34,11 @@ public class Pickable {
|
||||
final int objectId = data[0];
|
||||
int itemId = data[1];
|
||||
if (objectType == objectId) {
|
||||
player.getItemAssistant().addItem(itemId, 1);
|
||||
if (objectType == 1161 && Boundary.isIn(player, Boundary.FALADOR)) {//Cabbage falador
|
||||
player.getItemAssistant().addItem(1967, 1);
|
||||
} else {
|
||||
player.getItemAssistant().addItem(itemId, 1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,7 +120,6 @@ public abstract class Player {
|
||||
private final Queue<Packet> queuedPackets = new LinkedList<Packet>();
|
||||
private final Potions potions = new Potions(this);
|
||||
private final PotionMixing potionMixing = new PotionMixing(this);
|
||||
private final Food food = new Food(this);
|
||||
private final EmoteHandler emoteHandler = new EmoteHandler(this);
|
||||
private final SkillInterfaces skillInterfaces = new SkillInterfaces(this);
|
||||
private final Enchanting enchanting = new Enchanting(this);
|
||||
@@ -434,11 +433,6 @@ public abstract class Player {
|
||||
return potionMixing;
|
||||
}
|
||||
|
||||
public Food getFood() {
|
||||
return food;
|
||||
}
|
||||
|
||||
|
||||
public Inventory getInventory() {
|
||||
return inventory;
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ public class BankAll implements PacketType {
|
||||
return;
|
||||
}
|
||||
if (player.inPartyRoom) {
|
||||
PartyRoom.depositItem(player, removeId, player.getItemAssistant().getItemAmount(player.playerItems[removeSlot]));
|
||||
PartyRoom.depositItem(player, removeId, player.getItemAssistant().itemAmount(player.playerItems[removeSlot]));
|
||||
break;
|
||||
}
|
||||
if (player.inTrade) {
|
||||
@@ -62,7 +62,7 @@ public class BankAll implements PacketType {
|
||||
if (ItemData.itemStackable[removeId]) {
|
||||
player.getItemAssistant().bankItem(player.playerItems[removeSlot], removeSlot, player.playerItemsN[removeSlot]);
|
||||
} else {
|
||||
player.getItemAssistant().bankItem(player.playerItems[removeSlot], removeSlot, player.getItemAssistant().getItemAmount(player.playerItems[removeSlot]));
|
||||
player.getItemAssistant().bankItem(player.playerItems[removeSlot], removeSlot, player.getItemAssistant().itemAmount(player.playerItems[removeSlot]));
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.rebotted.GameEngine;
|
||||
import com.rebotted.game.content.consumables.Beverages;
|
||||
import com.rebotted.game.content.consumables.Kebabs;
|
||||
import com.rebotted.game.content.consumables.Beverages.beverageData;
|
||||
import com.rebotted.game.content.consumables.Food;
|
||||
import com.rebotted.game.content.minigames.TreasureTrails;
|
||||
import com.rebotted.game.content.minigames.castlewars.CastleWars;
|
||||
import com.rebotted.game.content.skills.herblore.Herblore;
|
||||
@@ -291,8 +292,8 @@ public class ClickItem implements PacketType {
|
||||
}
|
||||
}
|
||||
|
||||
if (player.getFood().isFood(itemId)) {
|
||||
player.getFood().eat(itemId, itemSlot);
|
||||
if (Food.isFood(itemId)) {
|
||||
Food.eat(player, itemId, itemSlot);
|
||||
}
|
||||
if (Prayer.playerBones(player, itemId)) {
|
||||
Prayer.buryBones(player, itemId, itemSlot);
|
||||
|
||||
@@ -18,16 +18,18 @@ public class InterfaceX implements PacketType {
|
||||
if (Xamount == 0) {
|
||||
Xamount = 1;
|
||||
}
|
||||
if (player.playerIsCooking && player.doAmount > 0) {
|
||||
Cooking.cookItem(player, player.cookingItem, Xamount, player.cookingObject);
|
||||
}
|
||||
if (player.isSmelting && player.doAmount > 0) {
|
||||
Smelting.smeltBar(player, player.smeltingItem);
|
||||
if (!player.isBanking) {
|
||||
if (player.playerIsCooking && player.doAmount > 0) {
|
||||
Cooking.cookItem(player, player.cookingItem, Xamount, player.cookingObject);
|
||||
}
|
||||
if (player.isSmelting && player.doAmount > 0) {
|
||||
Smelting.smeltBar(player, player.smeltingItem);
|
||||
}
|
||||
}
|
||||
switch (player.xInterfaceId) {
|
||||
case 5064:
|
||||
if (player.inPartyRoom) {
|
||||
PartyRoom.depositItem(player, player.xRemoveId, player.getItemAssistant().getItemAmount(player.playerItems[player.xRemoveSlot]));
|
||||
PartyRoom.depositItem(player, player.xRemoveId, player.getItemAssistant().itemAmount(player.playerItems[player.xRemoveSlot]));
|
||||
break;
|
||||
}
|
||||
if (player.inTrade) {
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.rebotted.world;
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
|
||||
import com.rebotted.game.npcs.Npc;
|
||||
import com.rebotted.game.players.Player;
|
||||
import com.rebotted.game.players.PlayerHandler;
|
||||
|
||||
@@ -30,7 +30,7 @@ public class ItemHandler {
|
||||
|
||||
public ItemHandler() {
|
||||
for (int i = 0; i < GameConstants.ITEM_LIMIT; i++) {
|
||||
ItemList[i] = null;
|
||||
itemList[i] = null;
|
||||
}
|
||||
loadItemList("item.cfg");
|
||||
}
|
||||
@@ -302,13 +302,13 @@ public int itemAmount(String name, int itemId, int itemX, int itemY) {
|
||||
* Item List
|
||||
**/
|
||||
|
||||
public ItemList ItemList[] = new ItemList[GameConstants.ITEM_LIMIT];
|
||||
public ItemList itemList[] = new ItemList[GameConstants.ITEM_LIMIT];
|
||||
|
||||
public void newItemList(int ItemId, String ItemName, String ItemDescription, double ShopValue, double LowAlch, double HighAlch, int Bonuses[]) {
|
||||
// first, search for a free slot
|
||||
int slot = -1;
|
||||
for (int i = 0; i < 11740; i++) {
|
||||
if (ItemList[i] == null) {
|
||||
if (itemList[i] == null) {
|
||||
slot = i;
|
||||
break;
|
||||
}
|
||||
@@ -324,7 +324,7 @@ public int itemAmount(String name, int itemId, int itemX, int itemY) {
|
||||
newItemList.LowAlch = LowAlch;
|
||||
newItemList.HighAlch = HighAlch;
|
||||
newItemList.Bonuses = Bonuses;
|
||||
ItemList[slot] = newItemList;
|
||||
itemList[slot] = newItemList;
|
||||
}
|
||||
|
||||
public void loadItemPrices(String filename) {
|
||||
@@ -344,7 +344,7 @@ public int itemAmount(String name, int itemId, int itemX, int itemY) {
|
||||
}
|
||||
|
||||
public ItemList getItemList(int i) {
|
||||
for (com.rebotted.game.items.ItemList element : ItemList) {
|
||||
for (com.rebotted.game.items.ItemList element : itemList) {
|
||||
if (element != null) {
|
||||
if (element.itemId == i) {
|
||||
return element;
|
||||
|
||||
Reference in New Issue
Block a user