mirror of
https://github.com/Melledy/Nebula.git
synced 2026-11-04 21:36:51 +01:00
Fix coins not being spent in monolith shops in vita mode
This commit is contained in:
1 parent
b361ee774d
commit
9c0c8b984e
1 file changed
+14
-10
@@ -136,23 +136,17 @@ public class StarTowerHawkerCase extends StarTowerBaseCase {
|
||||
|
||||
if (hawker.hasReRoll()) {
|
||||
// Refresh shop items
|
||||
this.refresh(rsp);
|
||||
this.refresh(hawker.getAuto(), rsp);
|
||||
} else if (hawker.hasSid()) {
|
||||
// Buy shop items
|
||||
this.buy(hawker.getSid(), rsp);
|
||||
}
|
||||
|
||||
// Auto mode consumes vita energy
|
||||
if (hawker.getAuto()) {
|
||||
var change = this.getPlayer().getInventory().removeItem(GameConstants.VITA_ENERGY_ITEM_ID, GameConstants.VITA_ENERGY_COST);
|
||||
rsp.setChange(change.toProto());
|
||||
this.buy(hawker.getSid(), hawker.getAuto(), rsp);
|
||||
}
|
||||
|
||||
// Success
|
||||
return rsp;
|
||||
}
|
||||
|
||||
private void refresh(StarTowerInteractResp rsp) {
|
||||
private void refresh(boolean auto, StarTowerInteractResp rsp) {
|
||||
// Check if we can refresh
|
||||
if (this.getModifiers().getShopRerollCount() <= 0) {
|
||||
return;
|
||||
@@ -179,6 +173,11 @@ public class StarTowerHawkerCase extends StarTowerBaseCase {
|
||||
// Remove coins
|
||||
var change = this.getGame().addItem(GameConstants.TOWER_COIN_ITEM_ID, -price);
|
||||
|
||||
// Auto mode consumes vita energy
|
||||
if (auto) {
|
||||
this.getPlayer().getInventory().removeItem(GameConstants.VITA_ENERGY_ITEM_ID, GameConstants.VITA_ENERGY_COST, change);
|
||||
}
|
||||
|
||||
// Set change info
|
||||
rsp.setChange(change.toProto());
|
||||
|
||||
@@ -186,7 +185,7 @@ public class StarTowerHawkerCase extends StarTowerBaseCase {
|
||||
this.getGame().getPlayer().trigger(QuestCondition.TowerSpecificShopReRollTotal, 1);
|
||||
}
|
||||
|
||||
private void buy(int sid, StarTowerInteractResp rsp) {
|
||||
private void buy(int sid, boolean auto, StarTowerInteractResp rsp) {
|
||||
// Get goods
|
||||
var goods = this.getGoods().get(sid);
|
||||
if (goods == null) {
|
||||
@@ -227,6 +226,11 @@ public class StarTowerHawkerCase extends StarTowerBaseCase {
|
||||
this.getGame().getPlayer().trigger(QuestCondition.TowerSpecificShopBuyDiscountTotal, 1);
|
||||
}
|
||||
|
||||
// Auto mode consumes vita energy
|
||||
if (auto) {
|
||||
this.getPlayer().getInventory().removeItem(GameConstants.VITA_ENERGY_ITEM_ID, GameConstants.VITA_ENERGY_COST, change);
|
||||
}
|
||||
|
||||
// Set change info
|
||||
rsp.setChange(change.toProto());
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user