public async Task Marry(SocketUser mentionedUser) { EmbedBuilder eb = new EmbedBuilder(); //Create player folder if it doesn't exist Directory.CreateDirectory(Setup.PlayerSavesPath + "/" + Context.User.Id); Directory.CreateDirectory(Setup.PlayerSavesPath + "/" + Context.User.Id + "/Inventory"); if (Empty.Load(Setup.PlayerSavesPath + "/" + Context.User.Id + "/Inventory/WeddingRing")) { //Create player folder if it doesn't exist Directory.CreateDirectory(Setup.PlayerSavesPath + "/" + mentionedUser.Id); //Loaded data BinaryMarriageNormal userMarriageEntry = new BinaryMarriageNormal(0, Context.Message.Timestamp.Ticks, Context.Message.Timestamp.Offset.Ticks); BinaryMarriageNormal otherUserMarriageEntry = new BinaryMarriageNormal(0, Context.Message.Timestamp.Ticks, Context.Message.Timestamp.Offset.Ticks); //Load bool userMarried = MarriageNormal.Load(Setup.PlayerSavesPath + "/" + Context.User.Id + "/" + "Spouse", ref userMarriageEntry); bool otherUserMarried = MarriageNormal.Load(Setup.PlayerSavesPath + "/" + mentionedUser.Id + "/" + "Spouse", ref otherUserMarriageEntry); if (!userMarried && !otherUserMarried) { //Create player folder if it doesn't exist Directory.CreateDirectory(Setup.PlayerSavesPath + "/" + mentionedUser.Id + "/MarriageProposals"); Empty.Save(Setup.PlayerSavesPath + "/" + mentionedUser.Id + "/MarriageProposals" + "/" + Context.User.Id); eb.Title = "**📝 marriage proposed!**"; string text = mentionedUser.Mention + " you have been proposed to by " + Context.User.Mention + " do you accept?"; string footerText = Tools.GetNickname(Context, Context.User.Id) + " your partner needs to accept the proposal."; eb.WithDescription(text); eb.WithFooter(footerText); eb.WithColor(Color.Green); } else { if (userMarried) { string text = "**⚠️ " + Context.User.Mention + " you are already married to " + Tools.GetMention(Context, userMarriageEntry.SpouseID) + "**"; eb.WithDescription(text); eb.WithColor(Color.Orange); } else { string text = "**⚠️ " + mentionedUser.Mention + " is already married to " + Tools.GetMention(Context, otherUserMarriageEntry.SpouseID) + "**"; eb.WithDescription(text); eb.WithColor(Color.Orange); } } } else { eb.Title = "**🚫 " + Tools.GetNickname(Context, Context.User.Id) + " you don't have a wedding ring please buy one before marrying! Cost: " + Setup.MarriagePrice + " credits**"; eb.WithColor(Color.Red); } await Context.Channel.SendMessageAsync("", false, eb.Build()); await Context.Message.DeleteAsync(); }
public async Task AcceptMarriage(SocketUser mentionedUser) { EmbedBuilder eb = new EmbedBuilder(); //Create player folder if it doesn't exist Directory.CreateDirectory(Setup.PlayerSavesPath + "/" + Context.User.Id); Directory.CreateDirectory(Setup.PlayerSavesPath + "/" + Context.User.Id + "/MarriageProposals"); if (Empty.Load(Setup.PlayerSavesPath + "/" + Context.User.Id + "/MarriageProposals" + "/" + mentionedUser.Id)) { //Create player folder if it doesn't exist Directory.CreateDirectory(Setup.PlayerSavesPath + "/" + mentionedUser.Id); //Loaded data BinaryMarriageNormal userMarriageEntry = new BinaryMarriageNormal(0, Context.Message.Timestamp.Ticks, Context.Message.Timestamp.Offset.Ticks); BinaryMarriageNormal otherUserMarriageEntry = new BinaryMarriageNormal(0, Context.Message.Timestamp.Ticks, Context.Message.Timestamp.Offset.Ticks); //Load MarriageNormal.Load(Setup.PlayerSavesPath + "/" + Context.User.Id + "/" + "Spouse", ref userMarriageEntry); MarriageNormal.Load(Setup.PlayerSavesPath + "/" + mentionedUser.Id + "/" + "Spouse", ref otherUserMarriageEntry); //Modify userMarriageEntry.SpouseID = mentionedUser.Id; userMarriageEntry.DateTimeTicks = Context.Message.Timestamp.Ticks; userMarriageEntry.DateTimeOffsetTicks = Context.Message.Timestamp.Offset.Ticks; otherUserMarriageEntry.SpouseID = Context.User.Id; otherUserMarriageEntry.DateTimeTicks = Context.Message.Timestamp.Ticks; otherUserMarriageEntry.DateTimeOffsetTicks = Context.Message.Timestamp.Offset.Ticks; //Save MarriageNormal.Save(Setup.PlayerSavesPath + "/" + Context.User.Id + "/" + "Spouse", userMarriageEntry); MarriageNormal.Save(Setup.PlayerSavesPath + "/" + mentionedUser.Id + "/" + "Spouse", otherUserMarriageEntry); if (Directory.Exists(Setup.PlayerSavesPath + "/" + Context.User.Id + "/MarriageProposals")) { Directory.Delete(Setup.PlayerSavesPath + "/" + Context.User.Id + "/MarriageProposals", true); } if (Directory.Exists(Setup.PlayerSavesPath + "/" + mentionedUser.Id + "/MarriageProposals")) { Directory.Delete(Setup.PlayerSavesPath + "/" + mentionedUser.Id + "/MarriageProposals", true); } FileInfo itemFile = new FileInfo(Setup.PlayerSavesPath + "/" + mentionedUser.Id + "/Inventory/WeddingRing"); await Tools.DeleteFileAsync(itemFile); eb.Title = "**🎉 Congratulations! " + Tools.GetNickname(Context, Context.User.Id) + " and " + Tools.GetNickname(Context, mentionedUser.Id) + " are now married!**"; string text = Context.User.Mention + " x " + mentionedUser.Mention + " (" + Context.Message.Timestamp.Date.ToShortDateString() + ")"; eb.WithDescription(text); eb.WithColor(255, 192, 203); } else { eb.Title = "**🚫 " + Tools.GetNickname(Context, Context.User.Id) + " you have not been proposed to by " + Tools.GetNickname(Context, mentionedUser.Id) + "**"; eb.WithColor(Color.Red); } await Context.Channel.SendMessageAsync("", false, eb.Build()); await Context.Message.DeleteAsync(); }
public async Task DisplayProfile(ulong userID) { //Create player folder if it doesn't exist Directory.CreateDirectory(Setup.PlayerSavesPath + "/" + userID); //Loaded data BinaryLevelNormal levelEntry = new BinaryLevelNormal(0, 0, 0); BinaryMoneyNormal moneyEntry = new BinaryMoneyNormal(0, 0, Context.Message.Timestamp.Ticks, Context.Message.Timestamp.Offset.Ticks); int repEntry = 0; BinaryMarriageNormal marriageEntry = new BinaryMarriageNormal(0, Context.Message.Timestamp.Ticks, Context.Message.Timestamp.Offset.Ticks); //Load LevelNormal.Load(Setup.PlayerSavesPath + "/" + userID + "/" + "Level", ref levelEntry); MoneyNormal.Load(Setup.PlayerSavesPath + "/" + userID + "/" + "Money", ref moneyEntry); IntNormal.Load(Setup.PlayerSavesPath + "/" + userID + "/" + "Reputation", ref repEntry); MarriageNormal.Load(Setup.PlayerSavesPath + "/" + userID + "/" + "Spouse", ref marriageEntry); EmbedBuilder eb = new EmbedBuilder(); eb.Title = Tools.GetNickname(Context, userID) + "'s Profile"; eb.WithThumbnailUrl(Context.User.GetAvatarUrl()); eb.WithColor(194, 14, 213); string creditsTitle = "Status"; string creditsText = "💰Credits: $" + moneyEntry.Money + "\n" + "✨Reputation: " + repEntry + "\n"; eb.AddField(Tools.CreateEmbedField(creditsTitle, creditsText, true)); string levelFieldTitle = "Level"; string levelFieldText = "🆙Level: " + levelEntry.CurrentLevel + " (" + levelEntry.CurrentExp + "/" + Tools.GetExpForLevel(levelEntry.CurrentLevel, Setup.ExperienceGrowthModifier) + ")" + "\n" + "🛡️Total exp: " + levelEntry.TotalExp; eb.AddField(Tools.CreateEmbedField(levelFieldTitle, levelFieldText, true)); string marriageTitle = "Married to"; string marriageText = "None"; if (marriageEntry.SpouseID != 0) { string dateOfMarriage = new DateTimeOffset(marriageEntry.DateTimeTicks, new TimeSpan(marriageEntry.DateTimeOffsetTicks)).Date.ToShortDateString(); marriageText = "💕" + Tools.GetMention(Context, marriageEntry.SpouseID) + " (" + dateOfMarriage + ")"; } eb.AddField(Tools.CreateEmbedField(marriageTitle, marriageText, false)); await Context.Channel.SendMessageAsync("", false, eb.Build()); }
public async Task Divorce() { EmbedBuilder eb = new EmbedBuilder(); //Create player folder if it doesn't exist Directory.CreateDirectory(Setup.PlayerSavesPath + "/" + Context.User.Id); //Loaded data BinaryMarriageNormal userMarriageEntry = new BinaryMarriageNormal(0, Context.Message.Timestamp.Ticks, Context.Message.Timestamp.Offset.Ticks); //Load bool userMarried = MarriageNormal.Load(Setup.PlayerSavesPath + "/" + Context.User.Id + "/" + "Spouse", ref userMarriageEntry); if (userMarried) { //Modify FileInfo userFile = new FileInfo(Setup.PlayerSavesPath + "/" + Context.User.Id + "/" + "Spouse"); await Tools.DeleteFileAsync(userFile); FileInfo otherUserFile = new FileInfo(Setup.PlayerSavesPath + "/" + userMarriageEntry.SpouseID + "/" + "Spouse"); await Tools.DeleteFileAsync(otherUserFile); eb.Title = "**😔 " + Tools.GetNickname(Context, Context.User.Id) + " and " + Tools.GetNickname(Context, userMarriageEntry.SpouseID) + " are now divorced!**"; string text = "Rip the ship of " + Context.User.Mention + " x " + Tools.GetMention(Context, userMarriageEntry.SpouseID); eb.WithDescription(text); eb.WithColor(Color.DarkBlue); } else { string text = "**⚠️ You are not married to have a divorce!**"; eb.WithDescription(text); eb.WithColor(Color.Orange); } await Context.Channel.SendMessageAsync("", false, eb.Build()); await Context.Message.DeleteAsync(); }