Пример #1
0
        public static async Task <bool> DeleteRankings(SAO_Kingdoms _kingdom_)
        {
            var _b1 = await PowerRankings.DeletePowerRankings(_kingdom_);

            var _b2 = await LevelRankings.DeleteLevelRankings(_kingdom_);

            return(_b1 && _b2);
        }
Пример #2
0
        public IServerProvider <QString, DataBaseClient> Get_Kingdom_Server(SAO_Kingdoms _kingdom_)
        {
            if (_kingdom_ == SAO_Kingdoms.NotSet)
            {
                return(ServerInfo.GetInvalid());
            }
            var _index = (int)_kingdom_ - 1;

            return(_kingdoms_servers[_index]);
        }
Пример #3
0
        //-------------------------------------------------
        public static async Task <DataBaseDataChangedInfo> CreateKingdomInfo(SAO_Kingdoms index)
        {
            KingdomInfo kingdomInfo = new KingdomInfo(index)
            {
                Index        = (uint)index,
                KingdomName  = index.ToString(),
                KingsPower   = Unit.GetBasicUnit(),
                KingdomLevel = 0,
            };

            return
                (await ThereIsServer.Actions.CreateFile(ThereIsServer.ServersInfo.MyServers[(uint)index],
                                                        KingdomInfoFileName, new DataBaseCreation("Created By SAO_Game",
                                                                                                  QString.Parse(kingdomInfo.GetForServer(), false))));
        }
Пример #4
0
        public static async Task <bool> DeleteLevelRankings(SAO_Kingdoms _kingdom_)
        {
            var _s      = ThereIsServer.ServersInfo.ServerManager.Get_Kingdom_Server(_kingdom_);
            var _target = LevelRankings_LOC;

            if (await ThereIsServer.Actions.Exists(_s, _target))
            {
                var existing = await ThereIsServer.Actions.GetAllContentsByRef(_s, _target);

                var _req = new DataBaseDeleteRequest(MESSAGE, existing.Sha.GetStrong());
                var _del = await ThereIsServer.Actions.DeleteData(_s, _target, _req);

                return(_del);
            }
            return(true);
        }
Пример #5
0
        //-------------------------------------------------
        #region static Method's Region
        public static async Task <DataBaseDataChangedInfo> CreateKingdomInfo(SAO_Kingdoms index)
        {
            KingdomInfo kingdomInfo = new KingdomInfo(index)
            {
                Index        = (uint)index,
                KingdomName  = index.ToString(),
                KingsPower   = Unit.GetBasicUnit(),
                KingdomLevel = 0,
            };
            //---------------------------------------------
            var _s      = ThereIsServer.ServersInfo.ServerManager.Get_Kingdom_Server(index);
            var _target = KingdomInfo_LOC;
            var _req    = new DataBaseCreation(MESSAGE, QString.Parse(kingdomInfo.GetForServer()));

            return(await ThereIsServer.Actions.CreateData(_s, _target, _req));

            //---------------------------------------------
        }
Пример #6
0
        public static async Task <bool> Delete(SAO_Kingdoms _kingdom_)
        {
            var  _s = ThereIsServer.ServersInfo.ServerManager.Get_Kingdom_Server(_kingdom_);
            var  _target = KingdomInfo_LOC;
            bool _del1 = false, _del2, _del3;

            if (await ThereIsServer.Actions.Exists(_s, _target))
            {
                var _existing = await ThereIsServer.Actions.GetAllContentsByRef(_s, _target);

                var _req = new DataBaseDeleteRequest(MESSAGE, _existing.Sha.GetStrong());
                _del1 = await ThereIsServer.Actions.DeleteData(_s, _target, _req);
            }
            _del2 = await KingdomRankings.DeleteRankings(_kingdom_);

            _del3 = await KingdomThrone.DeleteThrone(_kingdom_);

            return(_del1 && _del2 && _del3);
        }
Пример #7
0
        public static async Task <KingdomInfo> GetKingdomInfo(SAO_Kingdoms _kingdom_)
        {
            KingdomInfo kingdomInfo = new KingdomInfo(_kingdom_)
            {
                Index = (uint)_kingdom_,
            };
            //---------------------------------------------
            var _s        = ThereIsServer.ServersInfo.ServerManager.Get_Kingdom_Server(kingdomInfo.Provider);
            var _target   = KingdomInfo_LOC;
            var _existing = await ThereIsServer.Actions.GetAllContentsByRef(_s, _target);

            //---------------------------------------------
            if (_existing.IsDeadCallBack || ThereIsServer.ServerSettings.HasConnectionClosed)
            {
                NoInternetConnectionSandBox.PrepareConnectionClosedSandBox();
                return(null); // don't set ServerSettings.IsWaitingForServerChecking = false;
            }
            kingdomInfo.SetParams(_existing.Decode());
            kingdomInfo.Rankings = await KingdomRankings.GetKingdomRankings(kingdomInfo);

            kingdomInfo.Throne = await KingdomThrone.GetKingdomThrone(kingdomInfo);

            return(kingdomInfo);
        }
Пример #8
0
 //-------------------------------------------------
 #region Constructor's Region
 private KingdomInfo(SAO_Kingdoms provider)
 {
     Provider = provider;
 }
Пример #9
0
 public static async Task <KingdomInfo> GetKingdomInfo(SAO_Kingdoms index)
 {
     return(await GetKingdomInfo((uint)index));
 }
Пример #10
0
 public void SetPlayerKingdom(SAO_Kingdoms playerKingdom)
 {
     PlayerKingdom = playerKingdom;
 }