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 BaseMonsterStatsModel extractFriendLeader(final JSONArray friendResult, int startPosition) throws JSONException { final BaseMonsterStatsModel leader = new BaseMonsterStatsModel(); // 2, 15, 1, 0, 0, 0, 0 final int origId1 = friendResult.getInt(startPosition++); int idJp1 = -1; try { idJp1 = idConverter.getMonsterRefIdByCapturedId(origId1); } catch (UnknownMonsterException e) { MyLog.warn("leader : " + e.getMessage()); } leader.setIdJp(idJp1); leader.setLevel(friendResult.getInt(startPosition++)); leader.setSkillLevel(friendResult.getInt(startPosition++)); leader.setPlusHp(friendResult.getInt(startPosition++)); leader.setPlusAtk(friendResult.getInt(startPosition++)); leader.setPlusRcv(friendResult.getInt(startPosition++)); leader.setAwakenings(friendResult.getInt(startPosition++)); leader.setLatentAwakeningsFromPackedInt(friendResult.getInt(startPosition++)); // inherited skill id? // inherited skill level? return leader; }
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; }