Exemple #1
0
        public static Party GetPartyFromString(string partyString)
        {
            var     partyJson  = JSON.Parse(partyString);
            int     id         = partyJson["id"];
            int     chatId     = partyJson["chat"]["id"];
            string  accessCode = partyJson["access_code"];
            Monster monster    = MonsterManager.GetMonsterFromString(partyJson["monster"].ToString());

            return(new Party(id, chatId, accessCode, monster));
        }
Exemple #2
0
        public static Battle GetBattleFromString(string battleString)
        {
            var       battleJson      = JSON.Parse(battleString);
            int       id              = battleJson["id"];
            DateTime  datetimeCreated = DateTime.Parse(battleJson["datetime_created"]);
            Monster   monster         = MonsterManager.GetMonsterFromString(battleJson["monster"].ToString());
            int       state           = battleJson["state"];
            Equipment equipment       = null;

            if (battleJson["equipment"] != null)
            {
                equipment = EquipmentManager.GetEquipmentFromString(battleJson["equipment"].ToString());
            }
            return(new Battle(id, monster, datetimeCreated, state, equipment));
        }