Redemption Prayer/Fixes/Clues/Tidying up/Rares (#207)

- closes #205
- closes #197
- closes #145

Does the followiwng
- Adds functional redemption prayer
- Fixes max stack deletion when trading
- Adds toggle for clue scrolls, currently set on disabled until someone gets the time to finish clue scrolls
- Cleans up a few minor things
- Removes a few bits of dead code
- Re enables rare detection
This commit is contained in:
Mr Extremez
2019-11-21 20:09:17 -06:00
committed by Daniel Ginovker
parent 4b3bb7ade7
commit 34f2665858
10 changed files with 45 additions and 47 deletions
@@ -0,0 +1,2 @@
[2019/11/21] 18:52 andrew5 used command: bank
[2019/11/21] 19:04 andrew5 used command: bank
@@ -0,0 +1 @@
[2019/11/21] 19:51 andrew5 was killed by andrew44 absX: 3104 absY: 3898
+2 -1
View File
@@ -17,7 +17,8 @@ public class Constants {
public static int[] SIDEBARS = { 2423, 3917, 638, 3213, 1644, 5608, 1151,
18128, 5065, 5715, 2449, 904, 147, 962 };
public static boolean TUTORIAL_ISLAND = false, HOLIDAYS = true,
MEMBERS_ONLY = false, sendServerPackets = false, HALLOWEEN = false;
MEMBERS_ONLY = false, sendServerPackets = false, HALLOWEEN = false,
CLUES_ENABLED = false;
public final static int HAT = 0, CAPE = 1, AMULET = 2, WEAPON = 3,
CHEST = 4, SHIELD = 5, LEGS = 7, HANDS = 9, FEET = 10, RING = 12,
@@ -572,11 +572,6 @@ public class CombatAssistant {
resetPlayerAttack();
return;
}
if (NpcHandler.npcs[i].npcType == 134 || NpcHandler.npcs[i].npcType == 1267 || NpcHandler.npcs[i].npcType == 1265) {
if (Misc.random(350) == 0) {
AntiBotting.botCheckInterface(c);
}
}
if (NpcHandler.npcs[i].npcType == 757 && c.vampSlayer > 2) {
if (!c.getItemAssistant().playerHasItem(1549, 1) || !c.getItemAssistant().playerHasItem(2347, 1)) {
c.getActionSender().sendMessage("You need a stake and hammer to attack count draynor.");
@@ -598,9 +593,6 @@ public class CombatAssistant {
c.getActionSender().sendMessage("You can't attack a swarm!");
resetPlayerAttack();
return;
}
if (!c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 1)) {
}
if (NpcHandler.npcs[i].underAttackBy > 0 && NpcHandler.npcs[i].underAttackBy != c.playerId && !NpcHandler.npcs[i].inMulti()) {
c.npcIndex = 0;
@@ -677,7 +669,7 @@ public class CombatAssistant {
if (!c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 2) && RangeData.usingHally(c) && !c.usingRangeWeapon && !c.usingBow && !c.usingMagic
|| !c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 4) && c.usingRangeWeapon && !c.usingBow && !c.usingMagic
|| !c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 1)&& !c.usingRangeWeapon && !RangeData.usingHally(c) && !c.usingBow && !c.usingMagic
|| !c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 1) && !c.usingRangeWeapon && !RangeData.usingHally(c) && !c.usingBow && !c.usingMagic
|| !c.goodDistance(c.getX(), c.getY(), NpcHandler.npcs[i].getX(), NpcHandler.npcs[i].getY(), 8) && (c.usingBow || c.usingMagic)) {
return;
} else {
@@ -4,7 +4,7 @@ import redone.game.players.Client;
/**
* Rare Protection
* @author Andrew (I'm A Boss on Rune-Server, Mr Extremez on Moparscape & Runelocus)
* @author Andrew (Mr Extremez)
*/
public class RareProtection {
@@ -12,10 +12,9 @@ public class RareProtection {
public static final boolean RARES = false, CRACKERS = false;
private static final int[] RARE_ITEMS = { 1037, 1038, 1039, 1040, 1041,
1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 962, 963, 1959, 1961, 1989 };
private static final int[] EATABLE_RARES = { 1959, 1961, 1989 };
private static final int[] EDIBLE_RARES = { 1959, 1961, 1989 };
public static boolean equipItem(Client c) {// check when wearing, removing
/* Allow rares
for (int element : RARE_ITEMS) {
if (!RARES && c.wearId == element && c.playerRights < 3) {
c.getActionSender().sendMessage("You shouldn't have that item!");
@@ -24,13 +23,10 @@ public class RareProtection {
return false;
}
}
*/
return true;
}
public static boolean removeItem(Client c, int itemId) {// check when
// wearing, removing
/* Allow rares
public static boolean removeItem(Client c, int itemId) {
for (int element : RARE_ITEMS) {
if (!RARES && itemId == element && c.playerRights < 3) {
c.getActionSender().sendMessage("You shouldn't have that item!");
@@ -38,12 +34,10 @@ public class RareProtection {
return false;
}
}
*/
return true;
}
public static boolean hasDupedItem(Client c) {// check on login
/* Allow rares
for (int element : RARE_ITEMS) {
if (!RARES && c.getItemAssistant().playerHasItem(element)
&& c.playerRights < 3) {
@@ -53,14 +47,11 @@ public class RareProtection {
return false;
}
}
*/
return true;
}
public static boolean eatDupedItem(Client c, int itemId) {// check when
// eating
/* Allow rares
for (int element : EATABLE_RARES) {
public static boolean eatDupedItem(Client c, int itemId) {
for (int element : EDIBLE_RARES) {
if (!RARES && itemId == element && c.playerRights < 3) {
c.getActionSender().sendMessage("You can't eat that item!");
int amountToDelete = c.getItemAssistant().getItemCount(element);
@@ -68,26 +59,18 @@ public class RareProtection {
return false;
}
}
*/
return true;
}
public static boolean doOtherDupe(Client c, int itemId) {// check when
// dropping,
// trading,
// staking,
// dropping
/* Allow rares
public static boolean doOtherDupe(Client c, int itemId) {
for (int element : RARE_ITEMS) {
if (!RARES && c.getItemAssistant().playerHasItem(element)
&& c.playerRights < 3) {
if (!RARES && c.getItemAssistant().playerHasItem(element) && c.playerRights < 3) {
c.getActionSender().sendMessage("You shouldnt have that item!");
int amountToDelete = c.getItemAssistant().getItemCount(element);
c.getItemAssistant().deleteItem(element, amountToDelete);
return false;
}
}
*/
return true;
}
}
@@ -961,7 +961,7 @@ public class NpcHandler {
scroll = 2678 + Misc.random(0, 1);
else if (level > 150)// hard
scroll = 2679;
if (scroll >= 0)
if (scroll >= 0 && Constants.CLUES_ENABLED)
Server.itemHandler.createGroundItem(c, scroll, npcs[i].absX, npcs[i].absY, 1, c.playerId);
}
}
@@ -3,6 +3,8 @@ package redone.game.players;
import java.util.ArrayList;
import redone.Constants;
import redone.Server;
import redone.game.content.combat.prayer.PrayerDrain;
import redone.game.content.minigames.castlewars.CastleWars;
import redone.game.items.Item;
import redone.game.items.ItemAssistant;
@@ -1935,10 +1937,14 @@ public boolean goodDistance(int objectX, int objectY, int playerX, int playerY,
logoutDelay = System.currentTimeMillis();
singleCombatDelay = System.currentTimeMillis();
}
public void dealDamage(int damage) {
if (teleTimer <= 0) {
playerLevel[3] -= damage;
int difference = playerLevel[3] - damage;
if (difference <= getLevelForXP(playerXP[3]) / 10 && difference > 0)
appendRedemption();
} else {
if (hitUpdateRequired) {
hitUpdateRequired = false;
@@ -1947,8 +1953,25 @@ public boolean goodDistance(int objectX, int objectY, int playerX, int playerY,
hitUpdateRequired2 = false;
}
}
}
public void appendRedemption() {
Client c = (Client) PlayerHandler.players[playerId];
if (c.getPrayer().prayerActive[22]) {
int added = c.playerLevel[3] += (int)(c.getLevelForXP(c.playerXP[5]) * .25);
if (added > c.getLevelForXP(c.playerXP[3])) {
c.playerLevel[3] = c.getLevelForXP(c.playerXP[3]);
} else {
c.playerLevel[3] += (int)(getLevelForXP(c.playerXP[5]) * .25);
}
c.playerLevel[5] = 0;
c.getPlayerAssistant().refreshSkill(3);
c.getPlayerAssistant().refreshSkill(5);
c.gfx0(436);
PrayerDrain.resetPrayers(c);
}
}
public int[] damageTaken = new int[PlayerHandler.players.length];
@@ -257,7 +257,7 @@ public class Trading {
return false;
}
if (amount >= 1000000000) {
if (amount >= Integer.MAX_VALUE) {
player.getActionSender().sendMessage("You can't possibly have that much of that item!");
player.getItemAssistant().deleteItem(itemID, fromSlot, amount);
return false;
@@ -270,14 +270,6 @@ public class Trading {
return false;
}
}
if (!RareProtection.doOtherDupe(player, itemID)) {
return false;
}
// /if (!((c.playerItems[fromSlot] == itemID + 1) &&
// (c.playerItemsN[fromSlot] >= amount))) {
// c.getPacketDispatcher().sendMessage("You don't have that amount!");
// return false;
// }
player.tradeConfirmed = false;
o.tradeConfirmed = false;
if (!Item.itemStackable[itemID] && !Item.itemIsNote[itemID]) {
@@ -355,9 +355,9 @@ public class ShopAssistant {
if(!player.isShopping) {
return false;
}
if (player.TotalShopItems >= 39)
{
if (player.TotalShopItems >= 39) {
player.getActionSender().sendMessage("If you sell more individuals items in this shop, they won't be displayed.");
return false;
}
if (amount > 0 && itemID == (player.playerItems[fromSlot] - 1)) {
@@ -1,5 +1,6 @@
package redone.net.packets.impl;
import redone.Constants;
import redone.Server;
import redone.game.content.consumables.Beverages;
import redone.game.content.consumables.Kebabs;
@@ -143,16 +144,19 @@ public class ClickItem implements PacketType {
break;
case 2677:
if (Constants.CLUES_ENABLED)
player.getItemAssistant().deleteItem(itemId, 1);
TreasureTrails.addClueReward(player, 0);
break;
case 2678:
if (Constants.CLUES_ENABLED)
player.getItemAssistant().deleteItem(itemId, 1);
TreasureTrails.addClueReward(player, 1);
break;
case 2679:
if (Constants.CLUES_ENABLED)
player.getItemAssistant().deleteItem(itemId, 1);
TreasureTrails.addClueReward(player, 2);
break;