Start mobequip refactor

This commit is contained in:
2024-03-18 10:01:29 -04:00
parent 0590ae64e7
commit 61c4cb1361
56 changed files with 198 additions and 377 deletions
+8 -8
View File
@@ -72,12 +72,12 @@ public class TrainMsg extends ClientNetMsg {
if (origin.trainLock.tryLock()) {
try {
Item gold = playerCharacter.getCharItemManager().getGoldInventory();
Item gold = playerCharacter.charItemManager.getGoldInventory();
if (gold == null)
return;
if (!gold.validForInventory(origin, playerCharacter, playerCharacter.getCharItemManager()))
if (!gold.validForInventory(origin, playerCharacter, playerCharacter.charItemManager))
return;
boolean canTrain = false;
@@ -190,7 +190,7 @@ public class TrainMsg extends ClientNetMsg {
float profitCost = cost * npc.getSellPercent(playerCharacter);
profitCost += .5f;
if (profitCost > playerCharacter.getCharItemManager().getGoldInventory().getNumOfItems())
if (profitCost > playerCharacter.charItemManager.getGoldInventory().getNumOfItems())
return;
Building b = npc.getBuilding();
if (b != null && b.getProtectionState().equals(ProtectionState.NPC))
@@ -201,16 +201,16 @@ public class TrainMsg extends ClientNetMsg {
return;
}
if (playerCharacter.getCharItemManager().getGoldInventory().getNumOfItems() - profitCost < 0)
if (playerCharacter.charItemManager.getGoldInventory().getNumOfItems() - profitCost < 0)
return;
if (playerCharacter.getCharItemManager().getGoldInventory().getNumOfItems() - profitCost > MBServerStatics.PLAYER_GOLD_LIMIT)
if (playerCharacter.charItemManager.getGoldInventory().getNumOfItems() - profitCost > MBServerStatics.PLAYER_GOLD_LIMIT)
return;
//attempt to train
if (sk.train(playerCharacter)) {
playerCharacter.getCharItemManager().buyFromNPC(b, (int) profitCost, (int) (profitCost - cost));
playerCharacter.charItemManager.buyFromNPC(b, (int) profitCost, (int) (profitCost - cost));
dispatch = Dispatch.borrow(playerCharacter, msg);
DispatchMessage.dispatchMsgDispatch(dispatch, Enum.DispatchChannel.SECONDARY);
@@ -253,7 +253,7 @@ public class TrainMsg extends ClientNetMsg {
float cost = (int) cp.getTrainingCost(playerCharacter, npc);
float profitCost = cost * npc.getSellPercent(playerCharacter);
profitCost += .5f;
if (profitCost > playerCharacter.getCharItemManager().getGoldInventory().getNumOfItems()) {
if (profitCost > playerCharacter.charItemManager.getGoldInventory().getNumOfItems()) {
// ChatManager.chatSystemError(pc, "You do not have enough gold to train this skill.");
return;
}
@@ -269,7 +269,7 @@ public class TrainMsg extends ClientNetMsg {
}
if (cp.train(playerCharacter)) {
if (!playerCharacter.getCharItemManager().buyFromNPC(b, (int) profitCost, (int) (profitCost - cost)))
if (!playerCharacter.charItemManager.buyFromNPC(b, (int) profitCost, (int) (profitCost - cost)))
ChatManager.chatSystemError(playerCharacter, "Failed to Withdrawl gold from inventory. Contact CCR");
//train succeeded