stealing/peeking fix

This commit is contained in:
2025-01-20 16:30:48 -06:00
parent 69bf6ef8cd
commit 7a8a751bca
2 changed files with 17 additions and 3 deletions
@@ -106,7 +106,7 @@ public class PeekPowerAction extends AbstractPowerAction {
if (!tar.isAlive()) if (!tar.isAlive())
return; return;
lwrm = new LootWindowResponseMsg(tar.getObjectType().ordinal(), tar.getObjectUUID(), tar.getInventory(true)); lwrm = new LootWindowResponseMsg(tar.getObjectType().ordinal(), tar.getObjectUUID(), tar.getInventory(false));
} else if (awo.getObjectType().equals(Enum.GameObjectType.Mob)) { } else if (awo.getObjectType().equals(Enum.GameObjectType.Mob)) {
Mob tar = (Mob) awo; Mob tar = (Mob) awo;
@@ -89,6 +89,8 @@ public class StealPowerAction extends AbstractPowerAction {
if (!sourcePlayer.isAlive()) if (!sourcePlayer.isAlive())
return; return;
sourcePlayer.cancelOnAttackSwing();
//prevent stealing no steal mob loot //prevent stealing no steal mob loot
if (awo instanceof MobLoot && ((MobLoot) awo).noSteal()) if (awo instanceof MobLoot && ((MobLoot) awo).noSteal())
return; return;
@@ -173,8 +175,21 @@ public class StealPowerAction extends AbstractPowerAction {
if (tar.getItemBase().getType().equals(ItemType.GOLD)) { if (tar.getItemBase().getType().equals(ItemType.GOLD)) {
//stealing gold //stealing gold
if (!myCIM.transferGoldToMyInventory((AbstractCharacter) owner, amount)) //if (!myCIM.transferGoldToMyInventory((AbstractCharacter) owner, amount))
// return;
int targetGold = ownerCIM.getGoldInventory().getNumOfItems();
int myGold = myCIM.getGoldInventory().getNumOfItems();
if(myGold + amount > 10000000)
return; return;
ownerCIM.getGoldInventory().setNumOfItems(targetGold - amount);
ownerCIM.updateInventory();
myCIM.addGoldToInventory(amount,false);
myCIM.updateInventory();
} else { } else {
//stealing items //stealing items
if (ownerCIM.lootItemFromMe(tar, sourcePlayer, origin, true, amount) == null) if (ownerCIM.lootItemFromMe(tar, sourcePlayer, origin, true, amount) == null)
@@ -189,7 +204,6 @@ public class StealPowerAction extends AbstractPowerAction {
//update thief's inventory //update thief's inventory
if (sourcePlayer.getCharItemManager() != null) { if (sourcePlayer.getCharItemManager() != null) {
sourcePlayer.getCharItemManager().updateInventory(); sourcePlayer.getCharItemManager().updateInventory();
sourcePlayer.cancelOnAttackSwing();
} }
//update victims inventory //update victims inventory