Skip to content

Commit

Permalink
Add xpRate Var & Include With XPRate Calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
Dark98 committed Nov 23, 2021
1 parent 8ab3177 commit bdd5297
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 37 deletions.
4 changes: 3 additions & 1 deletion 2006Scape Server/src/main/java/com/rs2/GameConstants.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.rs2;

import com.rs2.game.players.Player;

public class GameConstants {

/**
Expand Down Expand Up @@ -31,7 +33,7 @@ public class GameConstants {
public static boolean FILE_SERVER = true, SERVER_DEBUG = false, MEMBERS_ONLY = false, TUTORIAL_ISLAND = false,
PARTY_ROOM_DISABLED = false, CLUES_ENABLED = true, ITEM_REQUIREMENTS = true,
ADMIN_CAN_TRADE = false, ADMIN_DROP_ITEMS = false, ADMIN_CAN_SELL_ITEMS = false;
public static double XP_RATE = 1;
public static double XP_RATE = 1 * Player.xpRate;


/**
Expand Down
77 changes: 41 additions & 36 deletions 2006Scape Server/src/main/java/com/rs2/game/players/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ public abstract class Player {

public byte buffer[] = null;
public String lastConnectedFrom;
private Compost compost = new Compost(this);
public static int xpRate;
private Compost compost = new Compost(this);
private Allotments allotment = new Allotments(this);
private Flowers flower = new Flowers(this);
private Herbs herb = new Herbs(this);
Expand Down Expand Up @@ -166,16 +167,20 @@ public abstract class Player {
private DoubleGates doubleGates = new DoubleGates();
public int lastMainFrameInterface = -1; //Possibly used in future to prevent packet exploits

public int getXPRate() { return xpRate; }

public void setXPRate(int xpRate) { this.xpRate = xpRate; }

public boolean isPreaching() {
return preaching;
}

public void setPreaching(boolean preaching) {
this.preaching = preaching;
}

public boolean preaching;

public Compost getCompost() {
return compost;
}
Expand Down Expand Up @@ -223,12 +228,12 @@ public SpecialPlantTwo getSpecialPlantTwo() {
public ToolLeprechaun getFarmingTools() {
return toolLeprechaun;
}


public LogCuttingInterface getFletching() {
return fletching;
}

public SingleGates getSingleGates() {
return singleGates;
}
Expand Down Expand Up @@ -404,7 +409,7 @@ public ShopAssistant getShopAssistant() {
public MageTrainingArena getMageTrainingArena() {
return mageArena;
}

public Trading getTrading() {
return trading;
}
Expand Down Expand Up @@ -444,13 +449,13 @@ public PotionMixing getPotMixing() {
public Inventory getInventory() {
return inventory;
}

private Inventory inventory = new Inventory(this);


private int tempInteger;
public boolean tempBoolean;

public void setTempInteger(int tempInteger) {
this.tempInteger = tempInteger;
}
Expand All @@ -460,17 +465,17 @@ public int getTempInteger() {
}

public int totalShopItems;

public boolean stopPlayer(boolean stop) {
return (stop ? stopPlayerPacket == true : stopPlayerPacket == false);
}

public long objectDelay;

public long getObjectDelay() {
return (objectDelay);
}

public long setObjectDelay(long delay) {
return (objectDelay = delay);
}
Expand Down Expand Up @@ -981,7 +986,7 @@ public void process() {
if (System.currentTimeMillis() - singleCombatDelay2 > 3300) {
underAttackBy2 = 0;
}

if (System.currentTimeMillis() - restoreStatsDelay > 60000) {
restoreStatsDelay = System.currentTimeMillis();
for (int skill = 0; skill < playerLevel.length; skill++) {
Expand Down Expand Up @@ -1398,20 +1403,20 @@ public void setStatedInterface(String statedInterface) {
restoreStatsDelay, logoutDelay, buryDelay, foodDelay, potDelay,
doorDelay, doubleDoorDelay, buySlayerTimer, lastIncrease,
boneDelay, leverDelay = 0, searchObjectDelay = 0, clickDelay = 0;

public boolean hideYell;


private Npc specialTarget = null;

public void setSpecialTarget(Npc target) {
this.specialTarget = target;
}

public Npc getSpecialTarget() {
return specialTarget;
}

public int miningAxe = -1, woodcuttingAxe = -1;

public boolean initialized, musicOn = true, luthas,
Expand Down Expand Up @@ -1695,7 +1700,7 @@ public void gameInterface(int id) {
4096, 8192, 16384, 32768, 65536, 131072, 262144, 524288, 2097152,
8388608, 16777216, 67108864, 134217728 };


/**
* Combat variables
*/
Expand All @@ -1713,7 +1718,7 @@ public void gameInterface(int id) {
/**
* End
*/

public int clickNpcType, clickObjectType, objectId, objectX,
objectY, npcIndex, npcClickIndex, npcType;
public int pItemX, pItemY, pItemId;
Expand Down Expand Up @@ -2130,11 +2135,11 @@ public void addToWalkingQueue(int x, int y) {
walkingQueueY[wQueueWritePtr] = y;
wQueueWritePtr = next;
}

public boolean checkRangeDistance() {
return (usingRangeWeapon || usingBow);
}

public int gatherRangeDistance(int distance) {
//dart (non long range)
if (usingRangeWeapon && RangeData.usingDart(this) && fightMode != 3) {
Expand All @@ -2148,7 +2153,7 @@ public int gatherRangeDistance(int distance) {
//dart, knife, throwing axe (long range)
} else if (usingRangeWeapon && fightMode == 3) {
distance = RangeData.usingDart(this) ? 5 : 6;
//short bow
//short bow
} else if (usingBow && !RangeData.usingLongbow(this)) {
distance = fightMode == 3 ? 7 : 9;
}
Expand Down Expand Up @@ -2507,74 +2512,74 @@ protected void appendPlayerAppearance(Stream str) {
} else {
playerProps.writeByte(0);
}

if (playerEquipment[ItemConstants.CAPE] > 1) {
playerProps.writeWord(0x200 + playerEquipment[ItemConstants.CAPE]);
} else {
playerProps.writeByte(0);
}

if (playerEquipment[ItemConstants.AMULET] > 1) {
playerProps.writeWord(0x200 + playerEquipment[ItemConstants.AMULET]);
} else {
playerProps.writeByte(0);
}

if (playerEquipment[ItemConstants.WEAPON] > 1) {
playerProps.writeWord(0x200 + playerEquipment[ItemConstants.WEAPON]);
} else {
playerProps.writeByte(0);
}

if (playerEquipment[ItemConstants.CHEST] > 1) {
playerProps.writeWord(0x200 + playerEquipment[ItemConstants.CHEST]);
} else {
playerProps.writeWord(0x100 + playerAppearance[2]);
}

if (playerEquipment[ItemConstants.SHIELD] > 1) {
playerProps.writeWord(0x200 + playerEquipment[ItemConstants.SHIELD]);
} else {
playerProps.writeByte(0);
}

if (!ItemData.isFullBody(playerEquipment[ItemConstants.CHEST])) {
playerProps.writeWord(0x100 + playerAppearance[3]);
} else {
playerProps.writeByte(0);
}

if (playerEquipment[ItemConstants.LEGS] > 1) {
playerProps.writeWord(0x200 + playerEquipment[ItemConstants.LEGS]);
} else {
playerProps.writeWord(0x100 + playerAppearance[5]);
}

if (!ItemData.isFullHelm(playerEquipment[ItemConstants.HAT])
&& !ItemData.isFullMask(playerEquipment[ItemConstants.HAT])) {
playerProps.writeWord(0x100 + playerAppearance[1]);
} else {
playerProps.writeByte(0);
}

if (playerEquipment[ItemConstants.HANDS] > 1) {
playerProps.writeWord(0x200 + playerEquipment[ItemConstants.HANDS]);
} else {
playerProps.writeWord(0x100 + playerAppearance[4]);
}

if (playerEquipment[ItemConstants.FEET] > 1) {
playerProps.writeWord(0x200 + playerEquipment[ItemConstants.FEET]);
} else {
playerProps.writeWord(0x100 + playerAppearance[6]);
}

if (playerAppearance[0] != 1 && !ItemData.isFullMask(playerEquipment[ItemConstants.HAT])) {
playerProps.writeWord(0x100 + playerAppearance[7]);
} else {
playerProps.writeByte(0);
}

} else {//send npc data
playerProps.writeWord(-1);//Tells client that were being a npc
playerProps.writeWord(npcId2);//send NpcID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ public static int loadPlayerInfo(Client player, String playerName, String player
case "character-rights":
player.playerRights = Integer.parseInt(token2);
break;
case "xp-rate":
player.xpRate = Integer.parseInt(token2);
case "last-ip":
player.lastConnectedFrom = token2;
break;
Expand Down Expand Up @@ -593,6 +595,8 @@ public static boolean saveGame(Player player) {
characterfile.newLine();
characterfile.write("character-rights = " + player.playerRights);
characterfile.newLine();
characterfile.write("xp-rate = " + player.xpRate);
characterfile.newLine();
characterfile.write("last-ip = " + player.connectedFrom);
characterfile.newLine();
characterfile.write("isBot = " + player.isBot);
Expand Down

0 comments on commit bdd5297

Please sign in to comment.