public void saveShip() { if (myTutorialManager != null) return; HullConfig hull; float money; ArrayList<SolItem> items; if (myHero != null) { hull = myHero.getHull().config; money = myHero.getMoney(); items = new ArrayList<SolItem>(); for (List<SolItem> group : myHero.getItemContainer()) { for (SolItem i : group) { items.add(0, i); } } } else if (myTranscendentHero != null) { FarShip farH = myTranscendentHero.getShip(); hull = farH.getHullConfig(); money = farH.getMoney(); items = new ArrayList<SolItem>(); for (List<SolItem> group : farH.getIc()) { for (SolItem i : group) { items.add(0, i); } } } else { hull = myRespawnHull; money = myRespawnMoney; items = myRespawnItems; } SaveManager.writeShip(hull, money, items, this); }
public void beforeHeroDeath() { if (myHero == null) return; float money = myHero.getMoney(); ItemContainer ic = myHero.getItemContainer(); setRespawnState(money, ic, myHero.getHull().config); myHero.setMoney(money - myRespawnMoney); for (SolItem item : myRespawnItems) { ic.remove(item); } }