Browse Source

Merge remote-tracking branch 'origin/refinement-fix' into post-wipe-merge

master
MagicBot 2 years ago
parent
commit
5a19507f53
  1. 1
      src/engine/net/client/msg/RefineMsg.java
  2. 2
      src/engine/net/client/msg/TrainMsg.java
  3. 74
      src/engine/objects/PlayerCharacter.java

1
src/engine/net/client/msg/RefineMsg.java

@ -168,6 +168,7 @@ public class RefineMsg extends ClientNetMsg {
RefinerScreenMsg refinerScreenMsg = new RefinerScreenMsg(skillPower, npc.getSellPercent(pc)); //TODO set npc cost RefinerScreenMsg refinerScreenMsg = new RefinerScreenMsg(skillPower, npc.getSellPercent(pc)); //TODO set npc cost
dispatch = Dispatch.borrow(pc, refinerScreenMsg); dispatch = Dispatch.borrow(pc, refinerScreenMsg);
DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY); DispatchMessage.dispatchMsgDispatch(dispatch, engine.Enum.DispatchChannel.SECONDARY);
pc.recalculate();
} }
} }

2
src/engine/net/client/msg/TrainMsg.java

@ -108,7 +108,7 @@ public class TrainMsg extends ClientNetMsg {
} }
public static void train(TrainMsg msg, ClientConnection origin) throws MsgSendException { public static void train(TrainMsg msg, ClientConnection origin) throws MsgSendException {
origin.getPlayerCharacter().recalculate();
PlayerCharacter playerCharacter = SessionManager.getPlayerCharacter(origin); PlayerCharacter playerCharacter = SessionManager.getPlayerCharacter(origin);
Dispatch dispatch; Dispatch dispatch;

74
src/engine/objects/PlayerCharacter.java

@ -172,7 +172,7 @@ public class PlayerCharacter extends AbstractCharacter {
private int spamCount = 0; private int spamCount = 0;
private boolean initialized = false; private boolean initialized = false;
private boolean enteredWorld = false; private boolean enteredWorld = false;
private boolean canBreathe = true; private boolean canBreathe = true;
@ -191,7 +191,7 @@ public class PlayerCharacter extends AbstractCharacter {
public double timeLoggedIn = 0; public double timeLoggedIn = 0;
public boolean RUN_MAGICTREK = true; public boolean RUN_MAGICTREK = true;
public int spellsCasted = 0; public int spellsCasted = 0;
public int pingCount = 0; public int pingCount = 0;
public long startPing = 0; public long startPing = 0;
@ -199,14 +199,14 @@ public class PlayerCharacter extends AbstractCharacter {
private boolean wasTripped75 = false; private boolean wasTripped75 = false;
private boolean wasTripped50 = false; private boolean wasTripped50 = false;
private boolean wasTripped25 = false; private boolean wasTripped25 = false;
private float characterHeight = 0; private float characterHeight = 0;
public float centerHeight = 0; public float centerHeight = 0;
private boolean lastSwimming = false; private boolean lastSwimming = false;
private boolean isTeleporting = false; private boolean isTeleporting = false;
public float landingAltitude = 0; public float landingAltitude = 0;
public int bindBuilding = 0; public int bindBuilding = 0;
public FriendStatus friendStatus = FriendStatus.Available; public FriendStatus friendStatus = FriendStatus.Available;
@ -338,11 +338,11 @@ public class PlayerCharacter extends AbstractCharacter {
} }
public void setInnerCouncil(boolean value) { public void setInnerCouncil(boolean value) {
// dont update if its the same. // dont update if its the same.
if (GuildStatusController.isInnerCouncil(this.guildStatus) == value) if (GuildStatusController.isInnerCouncil(this.guildStatus) == value)
return; return;
DbManager.PlayerCharacterQueries.SET_INNERCOUNCIL(this, value); DbManager.PlayerCharacterQueries.SET_INNERCOUNCIL(this, value);
GuildStatusController.setInnerCouncil(guildStatus, value); GuildStatusController.setInnerCouncil(guildStatus, value);
} }
@ -350,7 +350,7 @@ public class PlayerCharacter extends AbstractCharacter {
public void setGuildLeader(boolean value) { public void setGuildLeader(boolean value) {
if (GuildStatusController.isGuildLeader(this.guildStatus) == value) if (GuildStatusController.isGuildLeader(this.guildStatus) == value)
return; return;
GuildStatusController.setGuildLeader(guildStatus, value); GuildStatusController.setGuildLeader(guildStatus, value);
if (value == true){ if (value == true){
this.setInnerCouncil(true); this.setInnerCouncil(true);
@ -620,19 +620,19 @@ public class PlayerCharacter extends AbstractCharacter {
private void killCleanup() { private void killCleanup() {
this.stopMovement(this.getLoc()); this.stopMovement(this.getLoc());
this.health.set(-1); this.health.set(-1);
//remove pet //remove pet
if (this.pet != null) if (this.pet != null)
this.dismissPet(); this.dismissPet();
this.dismissNecroPets(); this.dismissNecroPets();
// remove flight job. // remove flight job.
this.setTakeOffTime(0); this.setTakeOffTime(0);
this.setDesiredAltitude(0); this.setDesiredAltitude(0);
this.altitude = (float) 0; this.altitude = (float) 0;
this.getCharItemManager().closeTradeWindow(); this.getCharItemManager().closeTradeWindow();
//increment live counter. This is to prevent double kills from casts //increment live counter. This is to prevent double kills from casts
@ -653,10 +653,10 @@ public class PlayerCharacter extends AbstractCharacter {
// sends a kill message to ensure the Player falls over. // sends a kill message to ensure the Player falls over.
this.respawnLock.writeLock().lock(); this.respawnLock.writeLock().lock();
try{ try{
if (SessionManager.getPlayerCharacterByID(this.getObjectUUID()) == null && !this.enteredWorld){ if (SessionManager.getPlayerCharacterByID(this.getObjectUUID()) == null && !this.enteredWorld){
WorldGrid.RemoveWorldObject(this); WorldGrid.RemoveWorldObject(this);
this.respawn(false, false,true); this.respawn(false, false,true);
}else{ }else{
TargetedActionMsg killmsg = new TargetedActionMsg(this, true); TargetedActionMsg killmsg = new TargetedActionMsg(this, true);
@ -667,7 +667,7 @@ public class PlayerCharacter extends AbstractCharacter {
}finally{ }finally{
this.respawnLock.writeLock().unlock(); this.respawnLock.writeLock().unlock();
} }
// TODO damage equipped items // TODO damage equipped items
if (this.charItemManager != null) if (this.charItemManager != null)
this.charItemManager.damageAllGear(); this.charItemManager.damageAllGear();
@ -724,16 +724,16 @@ public class PlayerCharacter extends AbstractCharacter {
// Recalculate everything // Recalculate everything
this.recalculatePlayerStats(true); this.recalculatePlayerStats(true);
this.setCombat(false); this.setCombat(false);
// Set Health to 1/4 max // Set Health to 1/4 max
Corpse corpse = null; Corpse corpse = null;
if (makeCorpse){ if (makeCorpse){
try { try {
corpse = Corpse.makeCorpse(this, enterWorld); corpse = Corpse.makeCorpse(this, enterWorld);
@ -742,7 +742,7 @@ public class PlayerCharacter extends AbstractCharacter {
} }
//if we're not making corpse, just purge inventory. used for characters dead while logged out. //if we're not making corpse, just purge inventory. used for characters dead while logged out.
} }
if (!setAlive){ if (!setAlive){
if (corpse == null && makeCorpse) { if (corpse == null && makeCorpse) {
Logger.error("Corpse not created."); Logger.error("Corpse not created.");
@ -754,7 +754,7 @@ public class PlayerCharacter extends AbstractCharacter {
} }
return; return;
} }
this.setHealth((float) (healthMax * .25)); this.setHealth((float) (healthMax * .25));
this.isAlive.set(true); this.isAlive.set(true);
@ -762,7 +762,7 @@ public class PlayerCharacter extends AbstractCharacter {
// Put player in safe mode // Put player in safe mode
// Teleport the player to his bind loc // Teleport the player to his bind loc
// or to a ruin as apporpriate. // or to a ruin as apporpriate.
Building bindBuilding = BuildingManager.getBuildingFromCache(this.getBindBuildingID()); Building bindBuilding = BuildingManager.getBuildingFromCache(this.getBindBuildingID());
if (enterWorld) { if (enterWorld) {
@ -778,11 +778,11 @@ public class PlayerCharacter extends AbstractCharacter {
this.lastUpdateTime = System.currentTimeMillis(); this.lastUpdateTime = System.currentTimeMillis();
this.lastStamUpdateTime = System.currentTimeMillis(); this.lastStamUpdateTime = System.currentTimeMillis();
this.update(); this.update();
PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, -1661758934, 40, false); PowersManager.applyPower(this, this, Vector3fImmutable.ZERO, -1661758934, 40, false);
if (corpse == null && makeCorpse) { if (corpse == null && makeCorpse) {
Logger.error("Corpse not created."); Logger.error("Corpse not created.");
} }
@ -870,19 +870,19 @@ public class PlayerCharacter extends AbstractCharacter {
if (ConfigManager.serverType.equals(ServerType.LOGINSERVER)) if (ConfigManager.serverType.equals(ServerType.LOGINSERVER))
return Vector3fImmutable.ZERO; return Vector3fImmutable.ZERO;
Building bindBuilding = PlayerCharacter.getUpdatedBindBuilding(this); Building bindBuilding = PlayerCharacter.getUpdatedBindBuilding(this);
//handle rented room binds. //handle rented room binds.
if (bindBuilding == null){ if (bindBuilding == null){
bindLocation = Enum.Ruins.getRandomRuin().getLocation(); bindLocation = Enum.Ruins.getRandomRuin().getLocation();
return bindLocation; return bindLocation;
} }
bindLocation = BuildingManager.GetBindLocationForBuilding(bindBuilding); bindLocation = BuildingManager.GetBindLocationForBuilding(bindBuilding);
if (bindLocation == null) if (bindLocation == null)
@ -916,14 +916,14 @@ public class PlayerCharacter extends AbstractCharacter {
public boolean setPromotionClass(int value) { public boolean setPromotionClass(int value) {
PromotionClass promotionClass = PromotionClass.GetPromtionClassFromCache(value); PromotionClass promotionClass = PromotionClass.GetPromtionClassFromCache(value);
if (promotionClass == null) if (promotionClass == null)
return false; return false;
if (!DbManager.PlayerCharacterQueries.SET_PROMOTION_CLASS(this, value)) if (!DbManager.PlayerCharacterQueries.SET_PROMOTION_CLASS(this, value))
return false; return false;
this.promotionClass = promotionClass; this.promotionClass = promotionClass;
// Warehouse this event // Warehouse this event
@ -964,7 +964,7 @@ public class PlayerCharacter extends AbstractCharacter {
return 2; return 2;
return 1; return 1;
} }
public final void toggleLFGroup() { public final void toggleLFGroup() {
this.lfGroup = !this.lfGroup; this.lfGroup = !this.lfGroup;
@ -1302,7 +1302,6 @@ public class PlayerCharacter extends AbstractCharacter {
this.calculateSkills(); this.calculateSkills();
return true; return true;
} }
public boolean refineSpi() { public boolean refineSpi() {
boolean worked = false; boolean worked = false;
short newSpi = (short) 0; short newSpi = (short) 0;
@ -1357,6 +1356,7 @@ public class PlayerCharacter extends AbstractCharacter {
} }
} }
} }
return true; return true;
} }

Loading…
Cancel
Save