// $1 = 16 credits // Hint = 2 credits // Mega Hint = 16 credits // $1 = 10 Vip Points // $5 = 55 Vip Points // $10 = 125 Vip Points // $25 = 350 Vip Points // $50 = 750 Vip Points // $100 = 1500 Vip Points // $1000 = 20000 Vip Points // Vip Level 1 - 50 Vip Points, $5 // Vip Level 2 - 100 Vip Points, $10 // Vip Level 3 - 250 Vip Points, $25 // Vip Level 4 - 500 Vip Points, $50 // Vip Level 5 - 1000 Vip Points, $100 // Vip Level 6 - 2500 Vip Points, $250 // Vip Level 7 - 10000 Vip Points, $1,000 // Vip Level 8 - 50000 Vip Points, $5,000 // Vip Level 9 - 250000 Vip Points, $25,000 // Vip Level 10 - 1000000 Vip Points, $100,000 // Disable Timer - Vip 1 // Disable Vip Exp Bonus = Vip 2 // Error Detector = Vip 4 // Super Error Detector = Vip 8 public static VipDataArgs Create(int vipPoints) { int level = 0; while (level < VIPLevels.Levels.Length && vipPoints >= VIPLevels.Levels[level]) { level++; } VipDataArgs vda = new VipDataArgs(); vda.Level = level; vda.Points = vipPoints; VIPDetails details = VIPDetails.Levels[level]; vda.Hints = details.Hints; vda.MegaHints = details.MegaHints; vda.UndoSize = details.UndoSize; vda.ExpBonus = details.ExpBonus; return(vda); }
void PuzzleComplete_Validate_Handler(Task t) { HTask task = (HTask)t; GameDataArgs gameData = ReadGameData(t.Query); object[] args = (object[])t.Args; PuzzleCompleteArgs pca = (PuzzleCompleteArgs)args[0]; AuthStringManager.AuthAccountInfo aai = (AuthStringManager.AuthAccountInfo)args[1]; if (pca.TowerIndex < 0 || pca.TowerIndex >= gameData.TowerFloors.Length) { // Invalid tower number RecordError(task.Client.AccountId, "Invalid floor number submitted: " + pca.TowerIndex); } else { if (pca.FloorNumber > gameData.TowerFloors[pca.TowerIndex]) { // Trying to complete a puzzle further ahead than the current progress?! RecordError(task.Client.AccountId, string.Format("Out of order completion - got:{0}, expected{1}", pca.FloorNumber, gameData.TowerFloors[pca.TowerIndex])); } else { // This is the expected puzzle or a repeat of a previous puzzle // Move to the next puzzle on this floor if (pca.FloorNumber == gameData.TowerFloors[pca.TowerIndex]) { gameData.TowerFloors[pca.TowerIndex]++; } VipDataArgs vda = VipData.Create(aai.Vip); float expBonus = pca.NoExpBonus ? 1 : vda.ExpBonus; // Level up? double baseExp = Balance.BaseExp(pca.TowerIndex); double bonusExp = Balance.BonusExp(pca.TowerIndex, pca.CompletionTime); double total = (baseExp + bonusExp) * expBonus; int exp = (int)total; gameData.Exp += exp; int expForNextLevel = Balance.ExpForNextLevel(gameData.Level); while (gameData.Exp >= expForNextLevel) { gameData.Level++; gameData.Exp -= expForNextLevel; expForNextLevel = Balance.ExpForNextLevel(gameData.Level); } // Unlock next tower? if (pca.TowerIndex < (gameData.TowerFloors.Length - 1) && gameData.TowerFloors[pca.TowerIndex + 1] == 0 && gameData.Level >= Balance.UnlockThreshold(pca.TowerIndex)) { gameData.TowerFloors[pca.TowerIndex + 1] = 1; } // Save changes string sql = string.Format("UPDATE game_data SET tower0={0}, tower1={1}, tower2={2}, tower3={3}, tower4={4}, tower5={5}, level={6}, exp={7} WHERE account_id={8};", gameData.TowerFloors[0], gameData.TowerFloors[1], gameData.TowerFloors[2], gameData.TowerFloors[3], gameData.TowerFloors[4], gameData.TowerFloors[5], gameData.Level, gameData.Exp, task.Client.AccountId); AddDBQuery(sql, null, false); task.Client.SendGameData(gameData); // Store this completion record sql = string.Format("SELECT * FROM floor_records WHERE account_id={0} AND tower={1} AND floor={2};", task.Client.AccountId, pca.TowerIndex, pca.FloorNumber); task.Type = (int)HTask.HTaskType.FloorRecord_Process; AddDBQuery(sql, task); } } }