mirror of
https://github.com/OMGeeky/andors-trail.git
synced 2026-02-23 15:38:29 +01:00
Minor fixes for reading slightly borked resource files.
This commit is contained in:
@@ -203,6 +203,11 @@ public final class PredefinedMap {
|
||||
public void readFromParcel(DataInputStream src, WorldContext world, ControllerContext controllers, int fileversion) throws IOException {
|
||||
final int loadedSpawnAreas = src.readInt();
|
||||
for(int i = 0; i < loadedSpawnAreas; ++i) {
|
||||
if (AndorsTrailApplication.DEVELOPMENT_VALIDATEDATA) {
|
||||
if (i >= this.spawnAreas.length) {
|
||||
L.log("WARNING: Trying to load monsters in map " + this.name + " for spawn #" + i + ". This will totally fail.");
|
||||
}
|
||||
}
|
||||
this.spawnAreas[i].readFromParcel(src, world, fileversion);
|
||||
}
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ public final class TMXMapFileParser {
|
||||
private static void readTMXMapLayerData(XmlResourceParser xrp, final TMXLayer layer) throws XmlPullParserException, IOException {
|
||||
String compressionMethod = xrp.getAttributeValue(null, "compression");
|
||||
xrp.next();
|
||||
String data = xrp.getText().trim();
|
||||
String data = xrp.getText().replaceAll("\\s", "");
|
||||
final int len = layer.width * layer.height * 4;
|
||||
|
||||
ByteArrayInputStream bi = new ByteArrayInputStream(Base64.decode(data));
|
||||
|
||||
@@ -29,7 +29,7 @@ public final class ConversationListParser extends JsonCollectionParserFor<Phrase
|
||||
if (requiresItem != null) {
|
||||
requiresItemTypeID = requiresItem.getString(JsonFieldNames.ReplyRequiresItem.itemID);
|
||||
requiresItemQuantity = requiresItem.getInt(JsonFieldNames.ReplyRequiresItem.quantity);
|
||||
itemRequirementType = requiresItem.getInt(JsonFieldNames.ReplyRequiresItem.requireType);
|
||||
itemRequirementType = requiresItem.optInt(JsonFieldNames.ReplyRequiresItem.requireType, Reply.ITEM_REQUIREMENT_TYPE_INVENTORY_REMOVE);
|
||||
}
|
||||
}
|
||||
return new Reply(
|
||||
@@ -47,7 +47,7 @@ public final class ConversationListParser extends JsonCollectionParserFor<Phrase
|
||||
@Override
|
||||
protected Reward parseObject(JSONObject o) throws JSONException {
|
||||
return new Reward(
|
||||
o.getInt(JsonFieldNames.PhraseReward.rewardType)
|
||||
o.optInt(JsonFieldNames.PhraseReward.rewardType, Reward.REWARD_TYPE_QUEST_PROGRESS)
|
||||
,o.getString(JsonFieldNames.PhraseReward.rewardID)
|
||||
,o.optInt(JsonFieldNames.PhraseReward.value, 0)
|
||||
);
|
||||
|
||||
@@ -48,7 +48,7 @@ public final class MonsterTypeParser extends JsonCollectionParserFor<MonsterType
|
||||
return new Pair<String, MonsterType>(monsterTypeID, new MonsterType(
|
||||
monsterTypeID
|
||||
, o.getString(JsonFieldNames.Monster.name)
|
||||
, o.getString(JsonFieldNames.Monster.spawnGroup)
|
||||
, o.optString(JsonFieldNames.Monster.spawnGroup, monsterTypeID)
|
||||
, exp
|
||||
, droplists.getDropList(o.optString(JsonFieldNames.Monster.droplistID, null))
|
||||
, o.optString(JsonFieldNames.Monster.phraseID, null)
|
||||
|
||||
Reference in New Issue
Block a user