mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-10 10:20:41 -07:00
Rollback uid changes, back to using username hash for uid. Fixes GE offers going missing after update
This commit is contained in:
parent
01428aacd7
commit
bba7c51bb2
8 changed files with 12 additions and 21 deletions
|
|
@ -49,7 +49,7 @@ class CulinomancerShop : LoginListener {
|
|||
|
||||
//Retrieve a player's shop - should generate the shop if it does not exist.
|
||||
fun getShop(player: Player, food: Boolean): Shop {
|
||||
val uid = player.details.uid
|
||||
val uid = player.details.usernameHashcode
|
||||
val points = player.questRepository.points
|
||||
val tier = (points / 18)
|
||||
if (tier != getAttribute(player, "culino-tier", 0)) //If player tier has changed
|
||||
|
|
|
|||
|
|
@ -439,7 +439,7 @@ public class ChristmasEvent extends HolidayEvent {
|
|||
snowman.faceTemporary(player, 2);
|
||||
snowman.setRespawn(false);
|
||||
snowman.setWalks(true);
|
||||
snowman.setAttribute("owner", player.getDetails().getUid());
|
||||
snowman.setAttribute("owner", player.getDetails().getUsernameHashcode());
|
||||
if (!player.getEmoteManager().isUnlocked(Emotes.SNOWMAN_DANCE)) {
|
||||
player.getEmoteManager().unlock(Emotes.SNOWMAN_DANCE);
|
||||
player.sendMessage("<col=FF0000>You've unlocked the snowman dance emote!</col>");
|
||||
|
|
@ -492,7 +492,7 @@ public class ChristmasEvent extends HolidayEvent {
|
|||
@Override
|
||||
public boolean open(Object... args) {
|
||||
npc = (NPC) args[0];
|
||||
if (npc.getAttribute("owner", 0) != player.getDetails().getUid()) {
|
||||
if (npc.getAttribute("owner", 0) != player.getDetails().getUsernameHashcode()) {
|
||||
player.sendMessage("The snowman doesn't seem interested in talking to you.");
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package core.game.node.entity.player.info;
|
||||
|
||||
import core.game.node.entity.player.info.portal.Icon;
|
||||
import core.game.system.communication.CommunicationInfo;
|
||||
import core.net.IoSession;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
|
@ -126,16 +125,8 @@ public class PlayerDetails {
|
|||
* Gets the uid.
|
||||
* @return the uid.
|
||||
*/
|
||||
public int getUid() {
|
||||
return this.accountInfo.getUid();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the uid.
|
||||
* @param uid the uid.
|
||||
*/
|
||||
public void setUid(int uid) {
|
||||
|
||||
public int getUsernameHashcode() { //was getUid, but that was such an amazing and descriptive name for what this method actually does that I just had to change it!
|
||||
return this.getUsername().hashCode(); //this SHOULD return accountInfo.uid BUT Arios is an amazing codebase, and they used username hashcodes when players already had a UID assigned by the DB. Genius!
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -104,7 +104,7 @@ public class GroundItem extends Item {
|
|||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean droppedBy(Player p) {
|
||||
if (dropper != null && p.getDetails().getUid() == dropper.getDetails().getUid()) {
|
||||
if (dropper != null && p.getDetails().getUsernameHashcode() == dropper.getDetails().getUsernameHashcode()) {
|
||||
dropper = p;
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ public class GrandExchangeTab extends ConsoleTab {
|
|||
if (p == null) {
|
||||
continue;
|
||||
}
|
||||
if (p.getDetails().getUid() == offer.getUid()) {
|
||||
if (p.getDetails().getUsernameHashcode() == offer.getUid()) {
|
||||
player = p;
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -244,9 +244,9 @@ class GrandExchange : StartupListener, Commands {
|
|||
}
|
||||
|
||||
if ( player.isArtificial )
|
||||
offer.playerUID = PlayerDetails.getDetails("2009scape").uid.also { offer.isBot = true }
|
||||
offer.playerUID = PlayerDetails.getDetails("2009scape").usernameHashcode.also { offer.isBot = true }
|
||||
else
|
||||
offer.playerUID = player.details.uid
|
||||
offer.playerUID = player.details.usernameHashcode
|
||||
|
||||
offer.offerState = OfferState.REGISTERED
|
||||
//GrandExchangeRecords.getInstance(player).update(offer)
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ class GrandExchangeRecords(private val player: Player? = null) : PersistPlayer,
|
|||
|
||||
GEDB.run { conn ->
|
||||
val stmt = conn.createStatement()
|
||||
val offer_records = stmt.executeQuery("SELECT * from player_offers where player_uid = ${player.details.uid} AND offer_state < 6")
|
||||
val offer_records = stmt.executeQuery("SELECT * from player_offers where player_uid = ${player.details.usernameHashcode} AND offer_state < 6")
|
||||
|
||||
while (offer_records.next()) {
|
||||
val offer = GrandExchangeOffer.fromQuery(offer_records)
|
||||
|
|
|
|||
|
|
@ -134,13 +134,13 @@ object Repository {
|
|||
@JvmStatic
|
||||
fun addPlayer(player: Player){
|
||||
players.add(player)
|
||||
uid_map[player.details.uid] = player
|
||||
uid_map[player.details.usernameHashcode] = player
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun removePlayer(player: Player){
|
||||
players.remove(player)
|
||||
uid_map.remove(player.details.uid)
|
||||
uid_map.remove(player.details.usernameHashcode)
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue