private OpRes query(ParamGameHistory param, IMongoQuery imq, GMUser user) { fillData fillFun = null; string tableName = getTableName(param, ref fillFun); if (tableName == "") { return(OpRes.op_res_not_found_data); } user.totalRecord = DBMgr.getInstance().getRecordCount(tableName, imq, user.getDbServerID(), DbName.DB_PUMP); List <Dictionary <string, object> > dataList = DBMgr.getInstance().executeQuery(tableName, user.getDbServerID(), DbName.DB_PUMP, imq, (param.m_curPage - 1) * param.m_countEachPage, param.m_countEachPage); if (dataList == null || dataList.Count == 0) { return(OpRes.op_res_not_found_data); } fillFun(param, user, dataList); return(OpRes.opres_success); }
private static fillData fillAdditions(string songID, fillData d) { SongDataLoader.SongData currentSong = SongDataLoader.AllSongData[songID]; d.easyAdditions = CreateDisplayStringAdditions(currentSong, "customEasyTags"); d.advancedAdditions = CreateDisplayStringAdditions(currentSong, "customAdvancedTags"); d.standardAdditions = CreateDisplayStringAdditions(currentSong, "customStandardTags"); d.expertAdditions = CreateDisplayStringAdditions(currentSong, "customExpertTags"); return(d); }
string getTableName(ParamGameHistory param, ref fillData fillFun) { string tableName = ""; switch (param.m_gameId) { case (int)GameId.crocodile: { fillFun = fillCrocodile; tableName = TableName.HISTORY_CROCODILE; } break; case (int)GameId.dice: { fillFun = fillDice; tableName = TableName.HISTORY_DICE; } break; case (int)GameId.cows: { fillFun = fillCows; tableName = TableName.HISTORY_COWS; } break; case (int)GameId.baccarat: { fillFun = fillBaccarat; tableName = TableName.HISTORY_BACCARAT; } break; case (int)GameId.shcd: { fillFun = fillShcd; tableName = TableName.HISTORY_SHCD; } break; } return(tableName); }
public static string CreateDisplayString(List <CalculatedScoreEntry> scores) { string output = "Difficulty Rating\n"; var songData = SongDataHolder.I.songData; fillData AdditionHolder = new fillData(); AdditionHolder.easyAdditions = new List <string>(); AdditionHolder.advancedAdditions = new List <string>(); AdditionHolder.standardAdditions = new List <string>(); AdditionHolder.expertAdditions = new List <string>(); if (SongBrowser.songDataLoaderInstalled) { //fillAdditions() is separated into its own function to avoid errors if !songDataLoaderInstalled /*Explanation: * When CreateDisplayString() is called the first time it loads in all the functions it needs. * If we include anything from the Song Data Loader utility in CreateDisplayString() it will try to * load from the dll. In the case they dont have the dll, it will throw an exception and the rest of * CreateDisplayString() won't run. Since all mentions of Son Data Loader are in fillAdditions(), which * is behind a conditional we wont have that issue. */ AdditionHolder = fillAdditions(songData.songID, AdditionHolder); } CachedCalculation easy = DifficultyCalculator.GetRating(songData.songID, KataConfig.Difficulty.Easy.ToString()); CachedCalculation normal = DifficultyCalculator.GetRating(songData.songID, KataConfig.Difficulty.Normal.ToString()); CachedCalculation hard = DifficultyCalculator.GetRating(songData.songID, KataConfig.Difficulty.Hard.ToString()); CachedCalculation expert = DifficultyCalculator.GetRating(songData.songID, KataConfig.Difficulty.Expert.ToString()); //add mine tags if it has mines if (songData.hasEasy && easy.hasMines) { AdditionHolder.easyAdditions.Insert(0, "Mines"); } if (songData.hasNormal && normal.hasMines) { AdditionHolder.standardAdditions.Insert(0, "Mines"); } if (songData.hasHard && hard.hasMines) { AdditionHolder.advancedAdditions.Insert(0, "Mines"); } if (songData.hasExpert && expert.hasMines) { AdditionHolder.expertAdditions.Insert(0, "Mines"); } //add 360 if it is if (songData.hasEasy && easy.is360) { AdditionHolder.easyAdditions.Insert(0, "360"); } if (songData.hasNormal && normal.is360) { AdditionHolder.standardAdditions.Insert(0, "360"); } if (songData.hasHard && hard.is360) { AdditionHolder.advancedAdditions.Insert(0, "360"); } if (songData.hasExpert && expert.is360) { AdditionHolder.expertAdditions.Insert(0, "360"); } AdditionHolder.expertAdditions = AdditionHolder.expertAdditions.Distinct().ToList(); AdditionHolder.standardAdditions = AdditionHolder.standardAdditions.Distinct().ToList(); AdditionHolder.advancedAdditions = AdditionHolder.advancedAdditions.Distinct().ToList(); AdditionHolder.easyAdditions = AdditionHolder.easyAdditions.Distinct().ToList(); if (expert.value != 0) { output += $"<color=#b119f7>{expert.value.ToString("n2")} "; output += AdditionHolder.expertAdditions.Count > 0 ? "(" + string.Join(", ", AdditionHolder.expertAdditions.ToArray()) + ")</color> " : "</color> "; } if (hard.value != 0) { output += $"<color=#f7a919>{hard.value.ToString("n2")} "; output += AdditionHolder.advancedAdditions.Count > 0 ? "(" + string.Join(", ", AdditionHolder.advancedAdditions.ToArray()) + ")</color> " : "</color> "; } if (normal.value != 0) { output += $"<color=#19d2f7>{normal.value.ToString("n2")} "; output += AdditionHolder.standardAdditions.Count > 0 ? "(" + string.Join(", ", AdditionHolder.standardAdditions.ToArray()) + ")</color> " : "</color> "; } if (easy.value != 0) { output += $"<color=#54f719>{easy.value.ToString("n2")} "; output += AdditionHolder.easyAdditions.Count > 0 ? "(" + string.Join(", ", AdditionHolder.easyAdditions.ToArray()) + ")</color> " : "</color> "; } return(output); }