Update server skill magic numbers (#502)

This commit is contained in:
Danial
2021-09-24 00:34:58 +12:00
committed by GitHub
parent 06b509c4d0
commit d30e833dd8
91 changed files with 856 additions and 794 deletions
@@ -1873,28 +1873,6 @@ public abstract class Player {
public int playerRing = 12;
public int playerArrows = 13;
public int playerAttack = 0;
public int playerDefence = 1;
public int playerStrength = 2;
public int playerHitpoints = 3;
public int playerRanged = 4;
public int playerPrayer = 5;
public int playerMagic = 6;
public int playerCooking = 7;
public int playerWoodcutting = 8;
public int playerFletching = 9;
public int playerFishing = 10;
public int playerFiremaking = 11;
public int playerCrafting = 12;
public int playerSmithing = 13;
public int playerMining = 14;
public int playerHerblore = 15;
public int playerAgility = 16;
public int playerThieving = 17;
public int playerSlayer = 18;
public int playerFarming = 19;
public int playerRunecrafting = 20;
public int[] playerEquipment = new int[14];
public int[] playerEquipmentN = new int[14];
public int[] playerLevel = new int[25];
@@ -2530,13 +2508,13 @@ public abstract class Player {
if (isBot) {
return 0;
}
int j = getLevelForXP(playerXP[playerAttack]);
int k = getLevelForXP(playerXP[playerDefence]);
int l = getLevelForXP(playerXP[playerStrength]);
int i1 = getLevelForXP(playerXP[playerHitpoints]);
int j1 = getLevelForXP(playerXP[playerPrayer]);
int k1 = getLevelForXP(playerXP[playerRanged]);
int l1 = getLevelForXP(playerXP[playerMagic]);
int j = getLevelForXP(playerXP[GameConstants.ATTACK]);
int k = getLevelForXP(playerXP[GameConstants.DEFENCE]);
int l = getLevelForXP(playerXP[GameConstants.STRENGTH]);
int i1 = getLevelForXP(playerXP[GameConstants.HITPOINTS]);
int j1 = getLevelForXP(playerXP[GameConstants.PRAYER]);
int k1 = getLevelForXP(playerXP[GameConstants.RANGED]);
int l1 = getLevelForXP(playerXP[GameConstants.MAGIC]);
int combatLevel = (int) ((k + i1 + Math.floor(j1 / 2)) * 0.25D) + 1;
double d = (j + l) * 0.32500000000000001D;
double d1 = Math.floor(k1 * 1.5D) * 0.32500000000000001D;
@@ -2702,12 +2680,12 @@ public abstract class Player {
} else {
str.writeByteA(0); // 0: red hitting - 1: blue hitting
}
if (playerLevel[3] <= 0) {
playerLevel[3] = 0;
if (playerLevel[GameConstants.HITPOINTS] <= 0) {
playerLevel[GameConstants.HITPOINTS] = 0;
isDead = true;
}
str.writeByteC(playerLevel[3]); // Their current hp, for HP bar
str.writeByte(getLevelForXP(playerXP[3]));
str.writeByteC(playerLevel[GameConstants.HITPOINTS]); // Their current hp, for HP bar
str.writeByte(getLevelForXP(playerXP[GameConstants.HITPOINTS]));
}
protected void appendHitUpdate2(Stream str) {
@@ -2720,12 +2698,12 @@ public abstract class Player {
} else {
str.writeByteS(0); // 0: red hitting - 1: blue hitting
}
if (playerLevel[3] <= 0) {
playerLevel[3] = 0;
if (playerLevel[GameConstants.HITPOINTS] <= 0) {
playerLevel[GameConstants.HITPOINTS] = 0;
isDead = true;
}
str.writeByte(playerLevel[3]); // Their current hp, for HP bar
str.writeByteC(getLevelForXP(playerXP[3])); // Their max hp, for HP
str.writeByte(playerLevel[GameConstants.HITPOINTS]); // Their current hp, for HP bar
str.writeByteC(getLevelForXP(playerXP[GameConstants.HITPOINTS])); // Their max hp, for HP
}
public void appendPlayerUpdateBlock(Stream str) {
@@ -3105,9 +3083,9 @@ public abstract class Player {
public void dealDamage(int damage) {
if (teleTimer <= 0) {
playerLevel[3] -= damage;
int difference = playerLevel[3] - damage;
if (difference <= getLevelForXP(playerXP[3]) / 10 && difference > 0)
playerLevel[GameConstants.HITPOINTS] -= damage;
int difference = playerLevel[GameConstants.HITPOINTS] - damage;
if (difference <= getLevelForXP(playerXP[GameConstants.HITPOINTS]) / 10 && difference > 0)
appendRedemption();
getPlayerAssistant().handleROL();
} else {
@@ -3118,20 +3096,21 @@ public abstract class Player {
hitUpdateRequired2 = false;
}
}
getPlayerAssistant().refreshSkill(GameConstants.HITPOINTS);
}
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]);
int added = c.playerLevel[GameConstants.HITPOINTS] += (int)(c.getLevelForXP(c.playerXP[GameConstants.PRAYER]) * .25);
if (added > c.getLevelForXP(c.playerXP[GameConstants.HITPOINTS])) {
c.playerLevel[GameConstants.HITPOINTS] = c.getLevelForXP(c.playerXP[GameConstants.HITPOINTS]);
} else {
c.playerLevel[3] += (int)(getLevelForXP(c.playerXP[5]) * .25);
c.playerLevel[GameConstants.HITPOINTS] += (int)(getLevelForXP(c.playerXP[GameConstants.PRAYER]) * .25);
}
c.playerLevel[5] = 0;
c.getPlayerAssistant().refreshSkill(3);
c.getPlayerAssistant().refreshSkill(5);
c.playerLevel[GameConstants.PRAYER] = 0;
c.getPlayerAssistant().refreshSkill(GameConstants.HITPOINTS);
c.getPlayerAssistant().refreshSkill(GameConstants.PRAYER);
c.gfx0(436);
PrayerDrain.resetPrayers(c);
}
@@ -41,7 +41,7 @@ public class PlayerAssistant {
}
public boolean savePlayer() {
return (player.wildLevel < 20 && player.playerEquipment[ItemConstants.RING] == 2570 && player.playerLevel[3] > 0 && player.playerLevel[3] <= player.getLevelForXP(player.playerXP[3]) / 10 && player.underAttackBy > 0);
return (player.wildLevel < 20 && player.playerEquipment[ItemConstants.RING] == 2570 && player.playerLevel[GameConstants.HITPOINTS] > 0 && player.playerLevel[GameConstants.HITPOINTS] <= player.getLevelForXP(player.playerXP[GameConstants.HITPOINTS]) / 10 && player.underAttackBy > 0);
}
public void handleROL() {
@@ -98,11 +98,11 @@ public class PlayerAssistant {
player.getPacketSender().sendString("Welcome to " + GameConstants.SERVER_NAME + "\\n", 15257);
int currentDay = player.getLastLogin() - player.lastLoginDate;
if (player.playerLevel[15] < 3) {
if (player.playerLevel[GameConstants.HERBLORE] < 3) {
player.playerLevel[15] = 3;
player.playerXP[15] = 175;
player.getPlayerAssistant().refreshSkill(15);
player.playerLevel[GameConstants.HERBLORE] = 3;
player.playerXP[GameConstants.HERBLORE] = 175;
player.getPlayerAssistant().refreshSkill(GameConstants.HERBLORE);
}
if (player.lastLoginDate <= 0) {
player.getPacketSender().sendString("This is your first time logging in!", 15258);
@@ -178,31 +178,31 @@ public class PlayerAssistant {
int xpToAdd = 0;
if (manta > 0) {
toReturn.add(new GameItem(389, manta));
if (player.playerLevel[player.playerFishing] >= 81) {
if (player.playerLevel[GameConstants.FISHING] >= 81) {
xpToAdd += (manta * 46);
}
}
if (turt > 0) {
toReturn.add(new GameItem(395, turt));
if (player.playerLevel[player.playerFishing] >= 79) {
if (player.playerLevel[GameConstants.FISHING] >= 79) {
xpToAdd += (manta * 38);
}
}
if (lobs > 0) {
toReturn.add(new GameItem(377, lobs));
if (player.playerLevel[player.playerFishing] >= 40) {
if (player.playerLevel[GameConstants.FISHING] >= 40) {
xpToAdd += (manta * 90);
}
}
if (swordFish > 0) {
toReturn.add(new GameItem(371, swordFish));
if (player.playerLevel[player.playerFishing] >= 50) {
if (player.playerLevel[GameConstants.FISHING] >= 50) {
xpToAdd += (manta * 100);
}
}
if (junk > 0)
toReturn.add(new GameItem(685, junk));
player.getPlayerAssistant().addSkillXP(xpToAdd, player.playerFishing);
player.getPlayerAssistant().addSkillXP(xpToAdd, GameConstants.FISHING);
return toReturn;
}
@@ -402,7 +402,7 @@ public class PlayerAssistant {
public int raiseTimer() {
// calculations from https://oldschool.runescape.wiki/w/Energy
double seconds = 60 / (8 + Math.floor(player.playerLevel[player.playerAgility] / 6));
double seconds = 60 / (8 + Math.floor(player.playerLevel[GameConstants.AGILITY] / 6));
return (int) Math.floor(seconds * 1000);
}
@@ -1392,8 +1392,8 @@ public class PlayerAssistant {
player.clickedVamp = false;
} else if (player.isWoodcutting) {
player.isWoodcutting = false;
} else if (player.playerSkilling[10]) {
player.playerSkilling[10] = false;
} else if (player.playerSkilling[GameConstants.FISHING]) {
player.playerSkilling[GameConstants.FISHING] = false;
} else if(player.clickedTree) {
player.clickedTree = false;
}
@@ -1614,7 +1614,7 @@ public class PlayerAssistant {
if (player.freezeTimer > 0) {
return;
}
if (player.isDead || player.playerLevel[3] <= 0) {
if (player.isDead || player.playerLevel[GameConstants.HITPOINTS] <= 0) {
return;
}
@@ -1970,7 +1970,7 @@ public class PlayerAssistant {
player.getPacketSender().sendString("" + player.playerXP[skill] + "", data.get().getFrame6());
player.getPacketSender().sendString("" + getXPForLevel(getLevelForXP(player.playerXP[skill]) + 1) + "", data.get().getFrame7());
if (skill == 5) {
player.getPacketSender().sendString("" + player.playerLevel[5] + "/" + getLevelForXP(player.playerXP[5]) + "", 687);// Prayer
player.getPacketSender().sendString("" + player.playerLevel[GameConstants.PRAYER] + "/" + getLevelForXP(player.playerXP[GameConstants.PRAYER]) + "", 687);// Prayer
}
}