//------------------------------------------------- #region static Method's Region public static async Task <DataBaseDataChangedInfo> CreateLevelRankings(KingdomInfo kingdom) { LevelRankings levelRankings = new LevelRankings() { Kingdom = kingdom, PlayerNames = new StrongString[MAXIMUM_RANKS], PlayerLevels = new uint[MAXIMUM_RANKS], PlayerTotalExp = new Unit[MAXIMUM_RANKS], PlayerUIDs = new UID[MAXIMUM_RANKS], }; for (int i = 0; i < MAXIMUM_RANKS; i++) { levelRankings.PlayerNames[i] = ThereIsConstants.Path.NotSet; levelRankings.PlayerLevels[i] = 0; levelRankings.PlayerTotalExp[i] = Unit.GetBasicUnit(); levelRankings.PlayerUIDs[i] = UID.GenerateNullUID(); } //--------------------------------------------- var _s = ThereIsServer.ServersInfo.ServerManager.Get_Kingdom_Server(levelRankings.Provider); var _target = LevelRankings_LOC; var _req = new DataBaseCreation(MESSAGE, QString.Parse(levelRankings.GetForServer())); return(await ThereIsServer.Actions.CreateData(_s, _target, _req)); //--------------------------------------------- }
public static async Task <bool> CreateKingdomRankings(KingdomInfo kingdom) { await PowerRankings.CreatePowerRankings(kingdom); await LevelRankings.CreateLevelRankings(kingdom); return(true); }
public static async Task <bool> DeleteRankings(LTW_Kingdoms _kingdom_) { var _b1 = await PowerRankings.DeletePowerRankings(_kingdom_); var _b2 = await LevelRankings.DeleteLevelRankings(_kingdom_); return(_b1 && _b2); }
//----------------------------------------- //----------------------------------------- public static async Task <KingdomRankings> GetKingdomRankings(KingdomInfo kingdom) { return(new KingdomRankings() { Kingdom = kingdom, LevelRankings = await LevelRankings.GetLevelRankings(kingdom), PowerRankings = await PowerRankings.GetPowerRankings(kingdom), }); }
public static async Task <LevelRankings> GetLevelRankings(KingdomInfo kingdom) { LevelRankings levelRankings = new LevelRankings() { Kingdom = kingdom, PlayerNames = new StrongString[MAXIMUM_RANKS], PlayerLevels = new uint[MAXIMUM_RANKS], PlayerTotalExp = new Unit[MAXIMUM_RANKS], PlayerUIDs = new UID[MAXIMUM_RANKS], }; //--------------------------------------------- var _s = ThereIsServer.ServersInfo.ServerManager.Get_Kingdom_Server(levelRankings.Provider); var _target = LevelRankings_LOC; var existing = await ThereIsServer.Actions.GetAllContentsByRef(_s, _target); //--------------------------------------------- if (existing.DoesNotExist) { await CreateLevelRankings(kingdom); //--------------------------------------------- existing = await ThereIsServer.Actions.GetAllContentsByRef(_s, _target); //--------------------------------------------- if (existing.IsDeadCallBack || ThereIsServer.ServerSettings.HasConnectionClosed) { NoInternetConnectionSandBox.PrepareConnectionClosedSandBox(); return(null); } } else { if (existing.IsDeadCallBack || ThereIsServer.ServerSettings.HasConnectionClosed) { NoInternetConnectionSandBox.PrepareConnectionClosedSandBox(); return(null); } } StrongString[] myStrings = existing.Decode().Split(OutCharSeparator); StrongString[] InStrings; for (int i = 0; i < MAXIMUM_RANKS; i++) { InStrings = myStrings[i].Split(InCharSeparator); levelRankings.PlayerNames[i] = InStrings[0]; levelRankings.PlayerLevels[i] = InStrings[1].ToUInt16(); levelRankings.PlayerTotalExp[i] = Unit.ConvertToUnit(InStrings[2]); levelRankings.PlayerUIDs[i] = UID.GetUID(InStrings[3]); } return(levelRankings); }