public static async Task OctoGameLogs(SocketReaction reaction, RestUserMessage socketMsg) { var globalAccount = Global.Client.GetUser(reaction.UserId); var account = GameUserAccounts.GetAccount(globalAccount); if (account.CurrentLogString.Length >= 1400) { account.CurrentLogString = "New page."; GameUserAccounts.SaveAccounts(); } var log = account.CurrentLogString ?? "No logs yet"; var logPage = new EmbedBuilder(); logPage.WithAuthor(globalAccount); logPage.WithFooter($"Log Fight Page"); logPage.WithColor(Color.DarkGreen); logPage.AddField("Logs", $"{log}"); await socketMsg.ModifyAsync(message => { message.Embed = logPage.Build(); // This somehow can't be empty or it won't update the // embed propperly sometimes... I don't know why // message.Content = Constants.InvisibleString; }); }
async Task HuntTraining() { var user = GameUserAccounts.GetAccount(Context.User.Id); var huntLevel = user.HuntingLevel; switch (user.HuntingLevel) { case HuntingLevel.Noob: if (user.HuntingXP < 0) { await ReplyAsync("Hunt training started."); await Task.Delay(50000); Console.WriteLine("Delay 1 is done."); await Task.Delay(50000); user.HuntingXP -= NoviceFloat; user.HuntingLevel = HuntingLevel.Novice; GameUserAccounts.SaveAccounts(); await Context.Channel.SendMessageAsync($"{Context.User} has advanced to the next Hunting Level: {user.HuntingLevel.ToString()}"); } break; } }
public async Task JoinHunt() { Console.WriteLine("Join command recived " + Context.User.Username + " has used the Hunt Join command."); GameUserAccounts.GetAccount(Context.User.Id); GameUserAccounts.SaveAccounts(); await ReplyAsync($"{Context.User.Username} has been added to the hunt! Enjoy the hunt!"); }
public async Task EndOctoGameCommand() { var account = GameUserAccounts.GetAccount(Context.User); account.OctopusFightPlayingStatus = 0; GameUserAccounts.SaveAccounts(); await ReplyAsync("Мы закончили твою игру, можешь начинать другую"); }
public static async Task EndGame(SocketReaction reaction, RestUserMessage socketMsg) { var globalAccount = Global.Client.GetUser(reaction.UserId); var account = GameUserAccounts.GetAccount(globalAccount); account.OctopusFightPlayingStatus = 0; GameUserAccounts.SaveAccounts(); await socketMsg.DeleteAsync(); }
public static async Task WaitMess(SocketReaction reaction, RestUserMessage socketMsg) { var globalAccount = Global.Client.GetUser(reaction.UserId); var account = GameUserAccounts.GetAccount(globalAccount); var mainPage = new EmbedBuilder(); mainPage.WithAuthor(globalAccount); mainPage.WithFooter($"Preparation time..."); mainPage.WithColor(Color.DarkGreen); mainPage.AddField("Game is being ready", $"**Please wait until you will see emoji** {new Emoji("❌")}"); await socketMsg.ModifyAsync(message => { message.Embed = mainPage.Build(); // This somehow can't be empty or it won't update the // embed propperly sometimes... I don't know why // message.Content = Constants.InvisibleString; }); await socketMsg.RemoveAllReactionsAsync(); await socketMsg.AddReactionAsync(new Emoji("⬅")); await socketMsg.AddReactionAsync(new Emoji("➡")); await socketMsg.AddReactionAsync(new Emoji("📖")); await socketMsg.AddReactionAsync(new Emoji("1⃣")); await socketMsg.AddReactionAsync(new Emoji("2⃣")); await socketMsg.AddReactionAsync(new Emoji("3⃣")); /*await socketMsg.AddReactionAsync(new Emoji("4⃣")); * await socketMsg.AddReactionAsync(new Emoji("5⃣")); * await socketMsg.AddReactionAsync(new Emoji("6⃣")); * await socketMsg.AddReactionAsync(new Emoji("7⃣")); * await socketMsg.AddReactionAsync(new Emoji("8⃣")); */ await socketMsg.AddReactionAsync(new Emoji("❌")); account.OctopusFightPlayingStatus = 2; GameUserAccounts.SaveAccounts(); await MainPage(reaction, socketMsg); }
public async Task CehckOctopusFighter() { var account = GameUserAccounts.GetAccount(Context.User); if (account.OctopusFighterInfo == null) { await ReplyAsync("У тебя нет осьминожки все ещё! Чтобы создать, впиши команду **CreateOcto**"); return; } var octoInfoArray = account.OctopusFighterInfo.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); if (octoInfoArray[0] == null) { octoInfoArray[0] = "Тут ничего нет. Что-то пошло не так, когда ты создавал Осьминога"; } if (octoInfoArray[1] == null) { octoInfoArray[1] = "Тут ничего нет. Что-то пошло не так, когда ты создавал Осьминога"; } if (octoInfoArray[2] == null) { octoInfoArray[2] = "Тут ничего нет. Что-то пошло не так, когда ты создавал Осьминога"; } if (octoInfoArray[3] == null) { octoInfoArray[3] = "Тут ничего нет. Что-то пошло не так, когда ты создавал Осьминога"; } var embed = new EmbedBuilder(); embed.WithAuthor(Context.User); embed.WithColor(Color.Blue); embed.AddField($"Твой осьминожка!", $"**Имя:** {octoInfoArray[0]}\n**Цвет:** {octoInfoArray[1]}\n**Характер** {octoInfoArray[2]}\n**Лор:** {octoInfoArray[3]}"); await CommandHandeling.ReplyAsync(Context, embed); }
public async Task HuntCommand() { Console.WriteLine("Searching for prey." + Context.User.Username + " The Hunt Search command was used."); if (!RoleCheck.HasClerkRole((SocketGuildUser)Context.User)) { await ReplyAsync(RoleWarning); return; } var user = GameUserAccounts.GetAccount(Context.User.Id); var interaction = interactionChance.Next(1, 3); if (interaction == 3) { await Context.Channel.SendMessageAsync($"{Context.User} failed to find anything."); return; } MonsterInfo huntingResult; Random xpGained = new Random(); float xp = (float)xpGained.Next(1, 20) * 0.9251f; var embed = new EmbedBuilder(); if (interaction == 1 || interaction == 2) { string monster = "null", mHP = "null", pHP = "null"; if (user.HuntingLevel.ToString() == "Noob") { Console.WriteLine("In Noob if statment"); huntingResult = HuntLogic.HuntingLogic(user, 0); monster = huntingResult.MonsterName; mHP = huntingResult.MonsterHP.ToString(); pHP = user.PlayerHp.ToString(); embed.WithTitle("Hunting Results") .AddField("Monster:", monster) .AddField("Monster HP:", mHP) .AddField("Player HP:", pHP) .AddField("XP gained:", xp); mHP = huntingResult.MonsterHP.ToString(); pHP = user.PlayerHp.ToString(); await Context.Channel.SendMessageAsync(Context.User.ToString(), false, embed.Build()); user.PlayerHp = user.PlayerMaxHp; user.HuntingXP += xp; user.AttributeXP += xp; GameUserAccounts.SaveAccounts(); } else if (user.HuntingLevel.ToString() == "Novice") { huntingResult = HuntLogic.HuntingLogic(user, 1); monster = huntingResult.MonsterName; mHP = huntingResult.MonsterHP.ToString(); pHP = user.PlayerHp.ToString(); embed.WithTitle("Hunting Results") .AddField("Monster:", monster) .AddField("Monster HP:", mHP) .AddField("Player HP:", pHP) .AddField("XP gained:", xp); mHP = huntingResult.MonsterHP.ToString(); pHP = user.PlayerHp.ToString(); await Context.Channel.SendMessageAsync(Context.User.ToString(), false, embed.Build()); user.PlayerHp = user.PlayerMaxHp; user.HuntingXP += xp; user.AttributeXP += xp; GameUserAccounts.SaveAccounts(); } else if (user.HuntingLevel.ToString() == "Intermediate") { huntingResult = HuntLogic.HuntingLogic(user, 2); monster = huntingResult.MonsterName; mHP = huntingResult.MonsterHP.ToString(); pHP = user.PlayerHp.ToString(); embed.WithTitle("Hunting Results") .AddField("Monster:", monster) .AddField("Monster HP:", mHP) .AddField("Player HP:", pHP) .AddField("XP gained:", xp); mHP = huntingResult.MonsterHP.ToString(); pHP = user.PlayerHp.ToString(); await Context.Channel.SendMessageAsync(Context.User.ToString(), false, embed.Build()); user.PlayerHp = user.PlayerMaxHp; user.HuntingXP += xp; user.AttributeXP += xp; GameUserAccounts.SaveAccounts(); } else if (user.HuntingLevel.ToString() == "Master") { huntingResult = HuntLogic.HuntingLogic(user, 3); monster = huntingResult.MonsterName; mHP = huntingResult.MonsterHP.ToString(); pHP = user.PlayerHp.ToString(); embed.WithTitle("Hunting Results") .AddField("Monster:", monster) .AddField("Monster HP:", mHP) .AddField("Player HP:", pHP) .AddField("XP gained:", xp); mHP = huntingResult.MonsterHP.ToString(); pHP = user.PlayerHp.ToString(); await Context.Channel.SendMessageAsync(Context.User.ToString(), false, embed.Build()); user.PlayerHp = user.PlayerMaxHp; user.HuntingXP += xp; user.AttributeXP += xp; GameUserAccounts.SaveAccounts(); } else if (user.HuntingLevel.ToString() == "GrandMaster") { huntingResult = HuntLogic.HuntingLogic(user, 4); monster = huntingResult.MonsterName; mHP = huntingResult.MonsterHP.ToString(); pHP = user.PlayerHp.ToString(); embed.WithTitle("Hunting Results") .AddField("Monster:", monster) .AddField("Monster HP:", mHP) .AddField("Player HP:", pHP) .AddField("XP gained:", xp); mHP = huntingResult.MonsterHP.ToString(); pHP = user.PlayerHp.ToString(); await Context.Channel.SendMessageAsync(Context.User.ToString(), false, embed.Build()); user.PlayerHp = user.PlayerMaxHp; user.HuntingXP += xp; user.AttributeXP += xp; GameUserAccounts.SaveAccounts(); } else if (user.HuntingLevel.ToString() == "Phoenix") { huntingResult = HuntLogic.HuntingLogic(user, 5); monster = huntingResult.MonsterName; mHP = huntingResult.MonsterHP.ToString(); pHP = user.PlayerHp.ToString(); embed.WithTitle("Hunting Results") .AddField("Monster:", monster) .AddField("Monster HP:", mHP) .AddField("Player HP:", pHP) .AddField("XP gained:", xp); mHP = huntingResult.MonsterHP.ToString(); pHP = user.PlayerHp.ToString(); await Context.Channel.SendMessageAsync(Context.User.ToString(), false, embed.Build()); user.PlayerHp = user.PlayerMaxHp; user.HuntingXP += xp; user.AttributeXP += xp; GameUserAccounts.SaveAccounts(); } else { // Failed hunt (precaution for future updates) await Context.Channel.SendMessageAsync("You found nothing"); } } }
public static async Task MainPage(SocketReaction reaction, RestUserMessage socketMsg) { var globalAccount = Global.Client.GetUser(reaction.UserId); var account = GameUserAccounts.GetAccount(globalAccount); string[] skills; // var tree = ""; double dmg; var skillString = "You dont have any skills here."; if (account.MoveListPage == 1 && account.CurrentOctopusFighterSkillSetAd != null) { skillString = null; skills = account.CurrentOctopusFighterSkillSetAd.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); // tree = "AD"; for (var i = 0; i < skills.Length; i++) { var ski = Convert.ToUInt64(skills[i]); var skill = SpellUserAccounts.GetAccount(ski); dmg = GameSpellHandeling.AdSkills(skill.SpellId, account); if (skill.SpellDmgType == "PASS") { skillString += $"{i + 1}. {skill.SpellName} ({skill.SpellDmgType}): {skill.SpellDescriptionRu} **{Math.Ceiling(dmg)}**\n"; } else { skillString += $"{i + 1}. {skill.SpellName} ({skill.SpellDmgType}): **{Math.Ceiling(dmg)}** \n"; } } } else if (account.MoveListPage == 2 && account.CurrentOctopusFighterSkillSetDef != null) { skillString = null; skills = account.CurrentOctopusFighterSkillSetDef.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); //tree = "DEF"; for (var i = 0; i < skills.Length; i++) { var ski = Convert.ToUInt64(skills[i]); var skill = SpellUserAccounts.GetAccount(ski); dmg = GameSpellHandeling.DefdSkills(skill.SpellId, account); if (skill.SpellDmgType == "PASS") { skillString += $"{i + 1}. {skill.SpellName} ({skill.SpellDmgType}): {skill.SpellDescriptionRu} **{Math.Ceiling(dmg)}**\n"; } else { skillString += $"{i + 1}. {skill.SpellName} ({skill.SpellDmgType}): **{Math.Ceiling(dmg)}** \n"; } } } else if (account.MoveListPage == 3 && account.CurrentOctopusFighterSkillSetAgi != null) { skillString = null; skills = account.CurrentOctopusFighterSkillSetAgi.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); // tree = "AGI"; for (var i = 0; i < skills.Length; i++) { var ski = Convert.ToUInt64(skills[i]); var skill = SpellUserAccounts.GetAccount(ski); dmg = GameSpellHandeling.AgiSkills(skill.SpellId, account); if (skill.SpellDmgType == "PASS") { skillString += $"{i + 1}. {skill.SpellName} ({skill.SpellDmgType}): {skill.SpellDescriptionRu} **{Math.Ceiling(dmg)}**\n"; } else { skillString += $"{i + 1}. {skill.SpellName} ({skill.SpellDmgType}): **{Math.Ceiling(dmg)}** \n"; } } } else if (account.MoveListPage == 4 && account.CurrentOctopusFighterSkillSetAp != null) { skillString = null; skills = account.CurrentOctopusFighterSkillSetAp.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries); //tree = "AP"; for (var i = 0; i < skills.Length; i++) { var ski = Convert.ToUInt64(skills[i]); var skill = SpellUserAccounts.GetAccount(ski); dmg = GameSpellHandeling.ApSkills(skill.SpellId, account); if (skill.SpellDmgType == "PASS") { skillString += $"{i + 1}. {skill.SpellName} ({skill.SpellDmgType}): {skill.SpellDescriptionRu} **{Math.Ceiling(dmg)}**\n"; } else { skillString += $"{i + 1}. {skill.SpellName} ({skill.SpellDmgType}): **{Math.Ceiling(dmg)}** \n"; } } } var mainPage = new EmbedBuilder(); mainPage.WithAuthor(globalAccount); mainPage.WithFooter($"Move List Page {account.MoveListPage} from 4"); mainPage.WithColor(Color.DarkGreen); mainPage.AddField("Enemy:", $"**LVL:** {account.CurrentEnemyLvl}\n" + $"**Strength:** {account.CurrentEnemyStrength}\n" + $"**AD:** {account.CurrentEnemyAd + account.CurrentEnemyStrength} **AP:** {account.CurrentEnemyAp}\n" + $"**Health:** {account.CurrentEnemyHealth}\n" + $"**Stamina:** {account.CurrentEnemyStamina}\n" + $"**Armor:** {account.CurrentEnemyArmor} LVL **MagRes:** {account.CurrentEnemyMagicResist} LVL\n" + $"**ArmPen:** {account.CurrentEnemyArmPen} LVL **MagPen:** {account.CurrentEnemyMagPen}\n" + $"**Agility:** {account.CurrentEnemyAgility}\n" + "**________________**"); mainPage.AddField($"Your octopus:", $"**LVL:** {account.CurrentOctopusFighterLvl}\n" + $"**Strength:** {account.CurrentOctopusFighterStrength}\n" + $"**AD:** {account.CurrentOctopusFighterAd + account.CurrentOctopusFighterStrength} **AP:** {account.CurrentOctopusFighterAp}\n" + $"**Health:** {account.CurrentOctopusFighterHealth}\n" + $"**Stamina:** {account.CurrentOctopusFighterStamina}\n" + $"**Armor:** {account.CurrentOctopusFighterArmor} LVL **MagRes:** {account.CurrentOctopusFighterMagicResist} LVL\n" + $"**ArmPen:** {account.CurrentOctopusFighterArmPen} **MagPen:** {account.CurrentOctopusFighterMagPen}\n" + $"**Agility:** {account.CurrentOctopusFighterAgility}\n" + $"**________________**\n" + $"{new Emoji("⬅")} - Move List Page Left , {new Emoji("➡")} - Move List Page Right {new Emoji("📖")} - History, {new Emoji("❌")} - **END GAME**"); mainPage.AddField($"(Move List", $"{skillString}"); await socketMsg.ModifyAsync(message => { message.Embed = mainPage.Build(); // This somehow can't be empty or it won't update the // embed propperly sometimes... I don't know why // message.Content = Constants.InvisibleString; }); }
public async Task CreateOctopusFighter() { var account = GameUserAccounts.GetAccount(Context.User); var response = "бу"; if (account.OctopusFighterInfo != null) { await ReplyAsync( "У тебя уже есть осьминожка! Если ты хочешь ПОЛНОСТЬЮ обновить информацию осьминожки напиши **да**"); var res = await AwaitForUserMessage.AwaitMessage(Context.User.Id, Context.Channel.Id, 6000); response = res.Content; } if (account.OctopusFighterInfo == null || response == "да") { account.OctopusFighterInfo = null; await Context.Channel.SendMessageAsync("Введи имя своего осьминожка, у тебя 1 минута."); var res = await AwaitForUserMessage.AwaitMessage(Context.User.Id, Context.Channel.Id, 60000); account.OctopusFighterInfo += res.Content + "|"; account.OctopusFighterName = res.Content; await Context.Channel.SendMessageAsync("Введи цвет своего осьминожка, у тебя 1 минута."); res = await AwaitForUserMessage.AwaitMessage(Context.User.Id, Context.Channel.Id, 60000); account.OctopusFighterInfo += res.Content + "|"; await Context.Channel.SendMessageAsync("Введи характер своего осьминожка, у тебя 2 минуты."); res = await AwaitForUserMessage.AwaitMessage(Context.User.Id, Context.Channel.Id, 120000); account.OctopusFighterInfo += res.Content + "|"; await Context.Channel.SendMessageAsync("Введи Лор своего осьминожка, у тебя 2 минуты."); res = await AwaitForUserMessage.AwaitMessage(Context.User.Id, Context.Channel.Id, 120000); account.OctopusFighterInfo += res.Content + "|"; account.OctopusFighterStrength = 20; account.OctopusFighterAd = 0; account.OctopusFighterAp = 0; account.OctopusFighterAgility = 0; account.OctopusFighterCritDmg = 1.5; account.OctopusFighterDodge = 0; account.OctopusFighterArmor = 1; account.OctopusFighterMagicResist = 1; account.OctopusFighterHealth = 100; account.OctopusFighterStamina = 200; account.OctopusFighterLvl = 1; account.OctopusFighterArmPen = 0; account.OctopusFighterMagPen = 0; GameUserAccounts.SaveAccounts(); await Context.Channel.SendMessageAsync("Готово! Ты создал или обновил информацию о своем осьминоге!"); } }
public async Task CreateFight() { var account = GameUserAccounts.GetAccount(Context.User); account.CurrentOctopusFighterStrength = account.OctopusFighterStrength; account.CurrentOctopusFighterAd = account.OctopusFighterAd; account.CurrentOctopusFighterAp = account.OctopusFighterAp; account.CurrentOctopusFighterAgility = account.OctopusFighterAgility; account.CurrentOctopusFighterCritDmg = account.OctopusFighterCritDmg; account.CurrentOctopusFighterDodge = account.OctopusFighterDodge; account.CurrentOctopusFighterArmor = account.OctopusFighterArmor; account.CurrentOctopusFighterMagicResist = account.OctopusFighterMagicResist; account.CurrentOctopusFighterHealth = account.OctopusFighterHealth; account.CurrentOctopusFighterStamina = account.OctopusFighterStamina; account.CurrentOctopusFighterLvl = account.OctopusFighterLvl; account.CurrentOctopusFighterArmPen = account.OctopusFighterArmPen; account.CurrentOctopusFighterMagPen = account.OctopusFighterMagPen; account.CurrentOctopusFighterSkillSetAd = account.OctopusFighterSkillSetAd; account.CurrentOctopusFighterSkillSetDef = account.OctopusFighterSkillSetDef; account.CurrentOctopusFighterSkillSetAgi = account.OctopusFighterSkillSetAgi; account.CurrentOctopusFighterSkillSetAp = account.OctopusFighterSkillSetAp; account.CurrentLogString = null; GameUserAccounts.SaveAccounts(); if (account.OctopusFightPlayingStatus >= 1) { await ReplyAsync("you are already playing"); return; } if (account.CurrentOctopusFighterSkillSetAp == null && account.CurrentOctopusFighterSkillSetAd == null && account.CurrentOctopusFighterSkillSetDef == null && account.CurrentOctopusFighterSkillSetAgi == null) { await ReplyAsync("You dont have any moves. You can get them using **boole** command"); return; } if (account.OctopusFighterInfo != null) { var embed = new EmbedBuilder(); embed.WithAuthor(Context.User); embed.WithFooter($"Enemy choice"); embed.WithColor(Color.DarkGreen); embed.AddField("Choose enemy lvl : ", $"{new Emoji("1⃣")} Enemy {account.CurrentOctopusFighterLvl - 1} LvL\n" + $"{new Emoji("2⃣")} Enemy {account.CurrentOctopusFighterLvl} LvL\n" + $"{new Emoji("3⃣")} Enemy {account.CurrentOctopusFighterLvl + 1} LvL\n" + $"{new Emoji("❌")} - End Fight."); var message = await Context.Channel.SendMessageAsync("", false, embed.Build()); await message.AddReactionAsync(new Emoji("1⃣")); await message.AddReactionAsync(new Emoji("2⃣")); await message.AddReactionAsync(new Emoji("3⃣")); await message.AddReactionAsync(new Emoji("❌")); var newOctoGame = new Global.OctoGameMessAndUserTrack(message.Id, Context.User.Id, message, Context.User); Global.OctopusGameMessIdList.Add(newOctoGame); Global.OctoGamePlaying += 1; account.OctopusFightPlayingStatus = 1; GameUserAccounts.SaveAccounts(); } else { await ReplyAsync("У тебя нет осьминога! создай его командой **CreateOcto**"); } }