public static final boolean DEVELOPMENT_DEBUGRESOURCES = false;\r
public static final boolean DEVELOPMENT_FORCE_STARTNEWGAME = false;\r
public static final boolean DEVELOPMENT_FORCE_CONTINUEGAME = false;\r
- public static final boolean DEVELOPMENT_DEBUGBUTTONS = true;\r
+ public static final boolean DEVELOPMENT_DEBUGBUTTONS = false;\r
public static final boolean DEVELOPMENT_VALIDATEDATA = true;\r
public static final boolean DEVELOPMENT_DEBUGMESSAGES = true;\r
- public static final int CURRENT_VERSION = 24;\r
- public static final String CURRENT_VERSION_DISPLAY = "0.6.10dev";\r
+ public static final boolean DEVELOPMENT_INCOMPATIBLE_SAVEGAMES = DEVELOPMENT_DEBUGRESOURCES || true;\r
- public static final int CURRENT_VERSION = DEVELOPMENT_INCOMPATIBLE_SAVEGAMES ? 999 : 30;\r
++ public static final int CURRENT_VERSION = DEVELOPMENT_INCOMPATIBLE_SAVEGAMES ? 999 : 31;\r
+ public static final String CURRENT_VERSION_DISPLAY = "0.7.0dev";\r
\r
public final WorldContext world = new WorldContext();\r
public final WorldSetup setup = new WorldSetup(world, this);\r
intent.setData(Uri.parse("content://com.gpl.rpg.AndorsTrail/shop"));
Dialogs.addMonsterIdentifiers(intent, npc);
startActivityForResult(intent, MainActivity.INTENTREQUEST_SHOP);
++ ConversationActivity.this.finish();
return;
} else if (phraseID.equalsIgnoreCase(ConversationCollection.PHRASE_ATTACK)) {
ConversationActivity.this.setResult(ACTIVITYRESULT_ATTACK);
import com.gpl.rpg.AndorsTrail.R;
import com.gpl.rpg.AndorsTrail.context.ViewContext;
import com.gpl.rpg.AndorsTrail.context.WorldContext;
+ import com.gpl.rpg.AndorsTrail.model.map.PredefinedMap;
+@SuppressWarnings("unused")
public final class DebugInterface {
- //private final ViewContext viewContext;
+ private final ViewContext viewContext;
private final MainActivity mainActivity;
private final Resources res;
private final WorldContext world;
mainActivity.showToast("DEBUG: given 10000 exp", Toast.LENGTH_SHORT);
}
})*/
- ,new DebugButton("hp=max", new OnClickListener() {
+ ,new DebugButton("reset", new OnClickListener() {
+ @Override
+ public void onClick(View arg0) {
+ for(PredefinedMap map : world.maps.predefinedMaps) {
+ map.lastVisitTime = 1;
+ map.resetIfNotRecentlyVisited();
+ }
+ mainActivity.showToast("DEBUG: maps respawned", Toast.LENGTH_SHORT);
+ }
+ })
+ ,new DebugButton("hp", new OnClickListener() {
@Override
public void onClick(View arg0) {
- world.model.player.traits.maxHP = 200;
- world.model.player.health.max = world.model.player.traits.maxHP;
+ world.model.player.actorTraits.maxHP = 200;
+ world.model.player.health.max = world.model.player.actorTraits.maxHP;
world.model.player.health.setMax();
world.model.player.conditions.clear();
mainActivity.updateStatus();
import com.gpl.rpg.AndorsTrail.model.actor.Player;
import com.gpl.rpg.AndorsTrail.model.item.ItemContainer;
import com.gpl.rpg.AndorsTrail.model.item.ItemType;
- import com.gpl.rpg.AndorsTrail.model.item.Loot;
+import com.gpl.rpg.AndorsTrail.resource.tiles.TileCollection;
import com.gpl.rpg.AndorsTrail.view.ShopItemContainerAdapter;
import com.gpl.rpg.AndorsTrail.view.ShopItemContainerAdapter.OnContainerItemClickedListener;
shoplist_buy = (ListView) h.findViewById(R.id.shop_buy_list);
shoplist_sell = (ListView) h.findViewById(R.id.shop_sell_list);
- Loot merchantLoot = new Loot();
- npc.dropList.createRandomLoot(merchantLoot, player);
- container_buy = merchantLoot.items;
+ container_buy = npc.getShopItems(player);
- shoplist_buy.setAdapter(new ShopItemContainerAdapter(
- this
- , world.tileStore
- , player
- , container_buy
- , this
- , false));
- shoplist_sell.setAdapter(new ShopItemContainerAdapter(
- this
- , world.tileStore
- , player
- , player.inventory
- , this
- , true));
+ HashSet<Integer> iconIDs = world.tileManager.getTileIDsFor(container_buy);
+ iconIDs.addAll(world.tileManager.getTileIDsFor(player.inventory));
+ TileCollection tiles = world.tileManager.loadTilesFor(iconIDs, res);
+ buyListAdapter = new ShopItemContainerAdapter(this, tiles, world.tileManager, player, container_buy, this, false);
+ sellListAdapter = new ShopItemContainerAdapter(this, tiles, world.tileManager, player, player.inventory, this, true);
+ shoplist_buy.setAdapter(buyListAdapter);
+ shoplist_sell.setAdapter(sellListAdapter);
update();
}
public final String phraseID;
public final int exp;
public final DropList dropList;
+ public final String faction;
+ private ItemContainer shopItems = null;
+ public final int monsterClass;
public Monster(MonsterType monsterType, Coord position) {
- super(monsterType, false);
+ super(monsterType, false, monsterType.isImmuneToCriticalHits());
this.monsterTypeID = monsterType.id;
this.position.set(position);
this.millisecondsPerMove = Constants.MONSTER_MOVEMENT_TURN_DURATION_MS / monsterType.getMovesPerTurn();
monsterTypeId = monsterTypeId.replace(' ', '_').replace("\\'", "").toLowerCase();
}
MonsterType monsterType = world.monsterTypes.getMonsterType(monsterTypeId);
+
+ if (fileversion < 25) return readFromParcel_pre_v0610(src, fileversion, monsterType);
+
+ return new Monster(src, world, fileversion, monsterType);
+ }
+
+ public Monster(DataInputStream src, WorldContext world, int fileversion, MonsterType monsterType) throws IOException {
+ super(src, world, fileversion, false, monsterType.isImmuneToCriticalHits(), monsterType);
+ this.monsterTypeID = monsterType.id;
+ this.millisecondsPerMove = Constants.MONSTER_MOVEMENT_TURN_DURATION_MS / monsterType.getMovesPerTurn();
+ this.nextPosition = new CoordRect(new Coord(), actorTraits.tileSize);
+ this.phraseID = monsterType.phraseID;
+ this.exp = monsterType.exp;
+ this.dropList = monsterType.dropList;
+ this.forceAggressive = src.readBoolean();
+ this.faction = monsterType.faction;
+ this.monsterClass = monsterType.monsterClass;
++ if (fileversion >= 31) {
++ if (src.readBoolean()) {
++ this.shopItems = new ItemContainer(src, world, fileversion);
++ }
++ }
+ }
+
+ private static Monster readFromParcel_pre_v0610(DataInputStream src, int fileversion, MonsterType monsterType) throws IOException {
Coord position = new Coord(src, fileversion);
Monster m = new Monster(monsterType, position);
m.ap.current = src.readInt();
if (fileversion >= 12) {
m.forceAggressive = src.readBoolean();
}
-
- if (fileversion >= 25) {
- if (src.readBoolean()) {
- m.shopItems = new ItemContainer(src, world, fileversion);
- }
- }
return m;
}
-
+
public void writeToParcel(DataOutputStream dest, int flags) throws IOException {
dest.writeUTF(monsterTypeID);
- position.writeToParcel(dest, flags);
- dest.writeInt(ap.current);
- dest.writeInt(health.current);
+ super.writeToParcel(dest, flags);
dest.writeBoolean(forceAggressive);
+ if (shopItems != null) {
+ dest.writeBoolean(true);
+ shopItems.writeToParcel(dest, flags);
+ } else {
+ dest.writeBoolean(false);
+ }
}
}
// We reset all non-unique spawn areas. This keeps the savegame file smaller, thus reducing load and save times. Also keeps the running memory usage slightly lower.
for(MonsterSpawnArea a : spawnAreas) {
- if (!a.isUnique) a.reset();
+ if (a.isUnique) a.resetShops();
+ else a.reset();
}
+ splatters.clear();
lastVisitTime = VISIT_RESET;
}