private MonsterModel parseMonsterFromArray(final JSONArray cardResult) throws JSONException { MyLog.entry(); // [8,190542,30,1,0,1655,0,0,0,0,0] final MonsterModel monster = new MonsterModel(); monster.setCardId(cardResult.getLong(0)); monster.setExp(cardResult.getLong(1)); monster.setLevel(cardResult.getInt(2)); monster.setSkillLevel(cardResult.getInt(3)); final int origId = cardResult.getInt(5); int idJp = -1; try { idJp = idConverter.getMonsterRefIdByCapturedId(origId); } catch (UnknownMonsterException e) { MyLog.warn(e.getMessage()); } monster.setIdJp(idJp); monster.setPlusHp(cardResult.getInt(6)); monster.setPlusAtk(cardResult.getInt(7)); monster.setPlusRcv(cardResult.getInt(8)); monster.setAwakenings(cardResult.getInt(9)); monster.setLatentAwakeningsFromPackedInt(cardResult.getInt(10)); MyLog.exit(); return monster; }
private MonsterModel parseMonsterFromObject(final JSONObject cardResult) throws JSONException { MyLog.entry(); // "cuid": 1, "exp": 15939, "lv": 16, "slv": 1, "mcnt": 11, "no": 3, "plus": [0, 0, 0, 0] final MonsterModel monster = new MonsterModel(); monster.setExp(cardResult.getLong("exp")); monster.setLevel(cardResult.getInt("lv")); monster.setSkillLevel(cardResult.getInt("slv")); final int origId = cardResult.getInt("no"); int idJp = -1; try { idJp = idConverter.getMonsterRefIdByCapturedId(origId); } catch (UnknownMonsterException e) { MyLog.warn(e.getMessage()); } monster.setIdJp(idJp); final JSONArray plusResults = cardResult.getJSONArray("plus"); monster.setPlusHp(plusResults.getInt(0)); monster.setPlusAtk(plusResults.getInt(1)); monster.setPlusRcv(plusResults.getInt(2)); monster.setAwakenings(plusResults.getInt(3)); // TODO set latent awakenings, but I don't know where this type of card data comes up MyLog.exit(); return monster; }