Ejemplo n.º 1
0
        public static void Add(string InputKey, string InputString, List <Player> _players)
        {
            JObject j1 = JObject.Parse(InputString);
            JArray  myna;
            JArray  myfl;
            string  myplayertype;

            if (j1.SelectToken("na") != null && j1.SelectToken("na").HasValues)
            {
                myna = (JArray)j1.SelectToken("na");
            }
            else
            {
                myna = null;
            }
            if (j1.SelectToken("firstline") != null && j1.SelectToken("firstline").HasValues)
            {
                myfl = (JArray)j1.SelectToken("firstline");
                string[] type_array = myfl[0].ToString().Split(default(string[]), StringSplitOptions.RemoveEmptyEntries);
                myplayertype = type_array[2];
            }
            else
            {
                myfl         = null;
                myplayertype = null;
            }

            _players.Add(new Player
            {
                _FactionId          = Convert.ToInt32(InputKey),
                _FactionId_Conv     = Utilities.To_Oid(InputKey),
                _First_Line         = myfl[0].ToString(),
                _Name               = myna[0].ToString(),
                _Player_Type        = myplayertype,
                _Email_Address      = JSON.string_Token(j1, "PL.em"),
                _Fast_Study_Points  = JSON.int_Token(j1, "PL.fs"),
                _First_Turn         = JSON.int_Token(j1, "PL.ft"),
                _Full_Name          = JSON.string_Token(j1, "PL.fn"),
                _Known              = JSON.list_Token(j1, "PL.kn"),
                _Last_Turn          = JSON.int_Token(j1, "PL.lt"),
                _Noble_Points       = JSON.int_Token(j1, "PL.np"),
                _Password           = JSON.string_Token(j1, "PL.pw"),
                _Unformed_Unit_List = JSON.list_Token(j1, "PL.uf"),
                _Unit_List          = JSON.list_Token(j1, "PL.un")
            });
        }
Ejemplo n.º 2
0
        public static void Add(string InputKey, string InputString, List <Ship> _ships)
        {
            JObject j1 = JObject.Parse(InputString);
            JArray  myfl;
            JArray  myna;
            string  mychartype;

            if (j1.SelectToken("na") != null && j1.SelectToken("na").HasValues)
            {
                myna = (JArray)j1.SelectToken("na");
            }
            else
            {
                myna = null;
            }
            if (j1.SelectToken("firstline") != null && j1.SelectToken("firstline").HasValues)
            {
                myfl = (JArray)j1.SelectToken("firstline");
                string[] type_array = myfl[0].ToString().Split(default(string[]), StringSplitOptions.RemoveEmptyEntries);
                mychartype = type_array[2];
            }
            else
            {
                myfl       = null;
                mychartype = null;
            }
            _ships.Add(new Ship
            {
                _ShipId             = Convert.ToInt32(InputKey),
                _First_Line         = myfl[0].ToString(),
                _Name               = myna[0].ToString(),
                _Ship_Type          = mychartype,
                _LI_Here_List       = JSON.list_Token(j1, "LI.hl"),
                _LI_Where           = JSON.int_Token(j1, "LI.wh"),
                _SL_Bound_Storm     = JSON.int_Token(j1, "SL.bs"),
                _SL_Capacity        = JSON.int_Token(j1, "SL.ca"),
                _SL_Damage          = JSON.int_Token(j1, "SL.da"),
                _SL_Defense         = JSON.int_Token(j1, "SL.de"),
                _SL_Effort_Given    = JSON.int_Token(j1, "SL.eg"),
                _SL_Effort_Required = JSON.int_Token(j1, "SL.er"),
                _SL_Moving          = JSON.int_Token(j1, "SL.mo")
            });
        }
Ejemplo n.º 3
0
        public static void Add(string InputKey, string InputString, List <Location> _locations)
        {
            JObject j1 = JObject.Parse(InputString);
            JArray  myna;
            JArray  myfl;

            if (j1.SelectToken("na") != null && j1.SelectToken("na").HasValues)
            {
                myna = (JArray)j1.SelectToken("na");
            }
            else
            {
                myna = null;
            }
            string myloctype;

            if (j1.SelectToken("firstline") != null && j1.SelectToken("firstline").HasValues)
            {
                myfl = (JArray)j1.SelectToken("firstline");
                string[] type_array = myfl[0].ToString().Split(default(string[]), StringSplitOptions.RemoveEmptyEntries);
                myloctype = type_array[2];
                if (type_array.Count() > 3)
                {
                    for (int i = 0; i < (type_array.Count() - 3); i++)
                    {
                        myloctype += " " + type_array[3 + i];
                    }
                }
            }
            else
            {
                myfl      = null;
                myloctype = null;
            }
            _locations.Add(new Location
            {
                _LocId                   = Convert.ToInt32(InputKey),
                _LocId_Conv              = Utilities.To_Oid(InputKey),
                _First_Line              = myfl[0].ToString(),
                _Loc_Type                = myloctype,
                _Name                    = myna[0].ToString(),
                _Item_List               = JSON.list_Token(j1, "il"),
                _Trade_List              = JSON.list_Token(j1, "tl"),
                _nbr_men                 = 0,
                _LI_Here_List            = JSON.list_Token(j1, "LI.hl"),
                _LI_Where                = JSON.int_Token(j1, "LI.wh"),
                _LO_Barrier              = JSON.int_Token(j1, "LO.ba"),
                _LO_Hidden               = JSON.int_Token(j1, "LO.hi"),
                _LO_Civ_Level            = JSON.int_Token(j1, "LO.lc"),
                _LO_Province_Destination = JSON.list_Token(j1, "LO.pd"),
                _LO_Shrouded             = JSON.int_Token(j1, "LO.sh"),
                _SL_Building_Materials   = JSON.int_Token(j1, "SL.bm"),
                _SL_Capacity             = JSON.int_Token(j1, "SL.ca"),
                _SL_Castle_Level         = JSON.int_Token(j1, "SL.cl"),
                _SL_Damage               = JSON.int_Token(j1, "SL.da"),
                _SL_Defense              = JSON.int_Token(j1, "SL.de"),
                _SL_Effort_Given         = JSON.int_Token(j1, "SL.eg"),
                _SL_Effort_Required      = JSON.int_Token(j1, "SL.er"),
                _SL_Moving               = JSON.int_Token(j1, "SL.mo"),
                _SL_Near_Cities          = JSON.list_Token(j1, "SL.nc"),
                _SL_Safe                 = JSON.int_Token(j1, "SL.sh"),
                _SL_Shaft_Depth          = JSON.int_Token(j1, "SL.sd"),
                _SL_Teaches              = JSON.list_Token(j1, "SL.te")
            });
        }
Ejemplo n.º 4
0
        public static void Add(string InputKey, string InputString, List <Character> _characters)
        {
            JObject j1 = JObject.Parse(InputString);
            JArray  myfl;
            string  mychartype;

            if (j1.SelectToken("firstline") != null && j1.SelectToken("firstline").HasValues)
            {
                myfl = (JArray)j1.SelectToken("firstline");
                string[] type_array = myfl[0].ToString().Split(default(string[]), StringSplitOptions.RemoveEmptyEntries);
                mychartype = type_array[2];
            }
            else
            {
                myfl       = null;
                mychartype = null;
            }
            _characters.Add(new Character
            {
                _CharId                = Convert.ToInt32(InputKey),
                _First_Line            = myfl[0].ToString(),
                _Char_Type             = mychartype,
                _PlayerId              = 0,
                _Item_List             = JSON.list_Token(j1, "il"),
                _Defend_List           = JSON.list_Token(j1, "ad"),
                _Hostile_List          = JSON.list_Token(j1, "ah"),
                _Neutral_List          = JSON.list_Token(j1, "an"),
                Accumulated_Weight     = 0,
                Accumulated_Riding_Cap = 0,
                Accumulated_Men        = 0,
                Accumulated_Land_Cap   = 0,
                Accumulated_Flying_Cap = 0,
                Ultimate_Lord          = 0,
                _CH_Attack             = JSON.int_Token(j1, "CH.at"),
                _CH_Behind             = JSON.int_Token(j1, "CH.bh"),
                _CH_Break_Point        = JSON.int_Token(j1, "CH.bp"),
                _CH_Contact            = JSON.list_Token(j1, "CH.ct"),
                _CH_Defense            = JSON.int_Token(j1, "CH.df"),
                _CH_Guard              = JSON.int_Token(j1, "CH.gu"),
                _CH_Health             = JSON.int_Token(j1, "CH.he"),
                _CH_LOY_Kind           = JSON.int_Token(j1, "CH.lk", -2),
                _CH_Lord               = JSON.int_Token(j1, "CH.lo"),
                _CH_LOY_Rate           = JSON.int_Token(j1, "CH.lr"),
                _CH_Missile            = JSON.int_Token(j1, "CH.mi"),
                _CH_NPC_Unit_Type      = JSON.int_Token(j1, "CH.ni"),
                _CH_Prisoner           = JSON.int_Token(j1, "CH.pr"),
                _CH_Rank               = JSON.int_Token(j1, "CH.ra"),
                _CH_Sick               = JSON.int_Token(j1, "CH.si"),
                _CH_Skills_List        = JSON.list_Token(j1, "CH.sl"),
                _CM_Appear_Common      = JSON.int_Token(j1, "CM.cm"),
                _CM_Auraculum          = JSON.list_Token(j1, "CM.ar"),
                _CM_Cur_Aura           = JSON.int_Token(j1, "CM.ca"),
                _CM_Hide_Self          = JSON.int_Token(j1, "CM.hs"),
                _CM_Magician           = JSON.int_Token(j1, "CM.im"),
                _CM_Max_Aura           = JSON.int_Token(j1, "CM.ma"),
                _CM_Pledged_To         = JSON.int_Token(j1, "CM.pl"),
                _CM_Already_Visioned   = JSON.list_Token(j1, "CM.vi"),
                _CM_Vision_Protect     = JSON.int_Token(j1, "CM.vp"),
                _LI_Here_List          = JSON.list_Token(j1, "LI.hl"),
                _LI_Where              = JSON.int_Token(j1, "LI.wh"),
                _MI_Cmd_Allow          = JSON.string_Token(j1, "MI.ca"),
                _MI_Garrison_Castle    = JSON.int_Token(j1, "MI.gc")
            });
            var Character = (_characters.Find(x => x._CharId == Convert.ToInt32(InputKey)));

            if (Character != null)
            {
                if (Character._CharId.Equals(Convert.ToInt32(InputKey)))
                {
                    if (j1.SelectToken("na") != null && j1.SelectToken("na").HasValues)
                    {
                        JArray myna;
                        myna            = (JArray)j1.SelectToken("na");
                        Character._Name = myna[0].ToString();
                    }
                    else
                    {
                        if (Character._Char_Type.Equals("garrison"))
                        {
                            Character._Name = Character._Char_Type.First().ToString().ToUpper() + Character._Char_Type.Substring(1);
                        }
                    }
                }
                if (j1.SelectToken("tl") != null && j1.SelectToken("tl").HasValues)
                {
                    JArray     mytl;
                    List <int> mytla;
                    mytl  = (JArray)j1.SelectToken("tl");
                    mytla = mytl.ToObject <List <int> >();
                    Character._Trade_List = mytla.ToList();
                }
            }
        }