private async Task AddStats(ChatInfo chat, PlayerInfo player, VoteMode vote) { Log($"{player.playerName}/{player.steamId} claimed a voting reward for {vote}"); var found = Configuration.Current.StatsRewards.FirstOrDefault(S => S.Type == vote); bool getsome = false; switch (vote) { case VoteMode.Health: getsome = found?.MaxCount > player.healthMax; if (getsome) { await Request_Player_SetPlayerInfo(new PlayerInfoSet() { entityId = player.entityId, healthMax = (int)player.healthMax + found.AddCount }); } break; case VoteMode.Food: getsome = found?.MaxCount > player.foodMax; if (getsome) { await Request_Player_SetPlayerInfo(new PlayerInfoSet() { entityId = player.entityId, foodMax = (int)player.foodMax + found.AddCount }); } break; case VoteMode.Stamina: getsome = found?.MaxCount > player.staminaMax; if (getsome) { await Request_Player_SetPlayerInfo(new PlayerInfoSet() { entityId = player.entityId, staminaMax = (int)player.staminaMax + found.AddCount }); } break; } if (getsome) { Log($"{player.playerName}/{player.steamId} boost for {vote}"); await MarkRewardClaimed(player); await ShowDialog(chat.playerId, player, "Congratulation", $"Your reward has been boosted your {vote} stats about {found.AddCount}."); } else { await ShowDialog(chat.playerId, player, "Sorry", $"Sorry your {vote} stats is at maxium {found.MaxCount} please choose another reward."); } }
private async Task VoteReward(ChatInfo chat, Dictionary <string, string> args, VoteMode mode) { var player = await Request_Player_Info(new Id(chat.playerId)); Log($"{player.playerName} is trying to claim a voting reward."); if (await DoesPlayerHaveAUnclaimedVote(player)) { switch (mode) { case VoteMode.Voting: await AddVote(chat, player, GetPlayerVote(player)); break; case VoteMode.Lottery: await PlayLottery(chat, player, GetPlayerVote(player)); break; default: await AddStats(chat, player, mode); break; } } else { Log($"No unclaimed voting reward found for {player.playerName}."); MessagePlayer(chat.playerId, "No unclaimed/new voting found.", MessagePriorityType.Alarm); } }