private static void SendUpdateMsg(Mobile m) { if (!File.Exists("update.txt")) { return; } Accounting.Account a = m.Account as Accounting.Account; DateTime time = File.GetLastWriteTime("update.txt"); /*if ( a.AccessLevel >= AccessLevel.Administrator ) * m.SendMessage( "Updates: LastUpdate={0}, LastLogin={1}, Cmp={2}", * time.Ticks, a.LastLogin.Ticks, ( time.Ticks >= a.LastLogin.Ticks ) );*/ if (time.Ticks >= a.LastLogin.Ticks) { if (time != m_FileTime || m_Packet == null) { m_FileTime = time; Packet.Release(ref m_Packet); m_Packet = new ScrollMessage(0x02, (int)time.Ticks, ReadFile("update.txt")); m_Packet.SetStatic(); } m.Send(m_Packet); } }
protected override void OnTarget(Mobile from, object targeted) { if (targeted is PlayerMobile) { if (m_bWatch) { from.SendGump(new WatchListChooserGump(from, targeted as Mobile)); } else { //unwatch PlayerMobile targ = (PlayerMobile)targeted; Accounting.Account targaccount = targ.Account as Accounting.Account; if (targ.WatchList) { targ.WatchList = false; from.SendMessage("Unwatching character {0}", targ.Name); } else if (targaccount != null && targaccount.Watched) { targaccount.Watched = false; from.SendMessage("Unwatching account {0}", targaccount.Username); } else { from.SendMessage("Character and account already unwatched"); } } } else { from.SendMessage("You must target a player."); } }
public override bool CanEquip(Mobile m) { if (!RaceDefinitions.ValidateEquipment(m, this)) { return(false); } if (m.IsPlayer()) { if (_Owner != null && m != _Owner) { m.SendLocalizedMessage(501023); // You must be the owner to use this item. return(false); } if (this is IAccountRestricted && ((IAccountRestricted)this).Account != null) { Accounting.Account acct = m.Account as Accounting.Account; if (acct == null || acct.Username != ((IAccountRestricted)this).Account) { m.SendLocalizedMessage(1071296); // This item is Account Bound and your character is not bound to it. You cannot use this item. return(false); } } if (IsVvVItem && !Engines.VvV.ViceVsVirtueSystem.IsVvV(m)) { m.SendLocalizedMessage(1155496); // This item can only be used by VvV participants! return(false); } } return(true); }
public override void OnDoubleClick(Mobile from) { //check database for this player's account Accounting.Account account = from.Account as Accounting.Account; string accountName = account.Username; from.SendGump(new DonationStoreGump(from)); }
public static void CheckDonations_OnCommand(CommandEventArgs e) { Mobile from = e.Mobile; Accounting.Account account = from.Account as Accounting.Account; string accountName = account.Username; from.SendGump(new DonationStoreGump(from)); }
private static void ParseAccount(Accounting.Account acc, ref int gold) { List <BaseHouse> checked_houses = new List <BaseHouse>(); for (int i = 0; i < acc.accountMobiles.Length; ++i) { ParseCharacter(acc.accountMobiles[i] as PlayerMobile, ref gold, ref checked_houses); } }
public override void OnResponse(NetState sender, RelayInfo info) { PlayerMobile pm = from as PlayerMobile; if (info.ButtonID == 1) { BankBox bank = from.BankBox; if (bank == null) { return; } Accounting.Account acct = from.Account as Accounting.Account; switch (token.Type) { case PromotionalType.SoulStone: { SoulStone ss = new SoulStone(acct.Username); bank.DropItem(ss); from.SendLocalizedMessage(1070743); // A Soulstone has been created in your bank box! break; } case PromotionalType.SoulStoneFragment: { int offset = Utility.Random(0, 8); SoulStoneFragment ssf = new SoulStoneFragment(0x2AA1 + offset, acct.Username); bank.DropItem(ssf); from.SendLocalizedMessage(1070976); // A soulstone fragment has been created in your bank box. break; } case PromotionalType.AdvancedCharacter: { pm.SendGump(new AdvancedCharacterChoiceGump()); pm.ACState = AdvancedCharacterState.InUse; break; } // TODO: character transfer, seventh anniversary } token.Delete(); } }
public static void On_Login(LoginEventArgs args) { Accounting.Account a = args.Mobile.Account as Accounting.Account; SendUpdateMsg((PlayerMobile)args.Mobile); if (SendAdMessage && a.LastLogin + Ad_Time < DateTime.Now && a.LastLogin != DateTime.MinValue) { args.Mobile.SendGump(new WarningGump(1060637, 30720, Ad_Prompt, 0xFFFFFF, 320, 240, new WarningGumpCallback(OpenBrowser_Callback), null)); } }
public static string GetAccount(Mobile mob) { if (mob == null) { return(null); } Accounting.Account acct = mob.Account as Accounting.Account; if (acct == null) { return(null); } return(acct.Username); }
public WatchListChooserGump(Mobile owner, Mobile target) : base(50, 50) { owner.CloseGump(typeof(WatchListChooserGump)); m_Owner = owner; m_Target = target; m_AccountTarget = target.Account as Accounting.Account; AddPage(0); AddBackground(0, 0, 500, 370, 5054); AddBackground(10, 10, 480, 350, 3000); //AddHtml(20, 15, 300, 30, "Watchlisting character or account:", true, false); AddLabelCropped(20, 15, 300, 20, LabelHue, "Watchlisting Character or Account"); AddLabelCropped(20, 50, 60, 20, LabelHue, "Reason:"); AddTextField(70, 50, 400, 20, 0, ""); AddCheck(20, 80, 210, 211, true, (int)Buttons.AccountCheck); AddLabelCropped(50, 80, 250, 20, LabelHue, "Watchlist Account"); //--------------------------------------------------------- AddLabelCropped(50, 120, 300, 20, LabelHue, "Duration:"); AddRadio(50, 140, 0x25F8, 0x25FB, false, 100); AddLabelCropped(80, 140, 250, 20, LabelHue, "Permanent"); AddRadio(50, 170, 0x25F8, 0x25FB, false, 101); AddLabelCropped(80, 170, 250, 20, LabelHue, "One Month"); AddRadio(50, 200, 0x25F8, 0x25FB, true, 102); AddLabelCropped(80, 200, 250, 20, LabelHue, "One Week"); AddRadio(50, 230, 0x25F8, 0x25FB, false, 103); AddLabelCropped(80, 230, 250, 20, LabelHue, "24 Hours"); //---------------------------------------------------------- AddButton(20, 320, 4005, 4007, (int)Buttons.Proceed, GumpButtonType.Reply, 0); AddHtml(55, 320, 75, 20, "Proceed", false, false); AddButton(135, 320, 4005, 4007, (int)Buttons.Cancel, GumpButtonType.Reply, 0); AddHtml(170, 320, 75, 20, "Cancel", false, false); }
protected override void OnTarget(Mobile from, object targ) { PlayerMobile pm = targ as PlayerMobile; if (pm == null) { from.SendMessage("You must target a player"); return; } int total_gold = 0; // foreach character on account Accounting.Account acc = (Accounting.Account)pm.Account; ParseAccount(acc, ref total_gold); from.SendMessage(String.Format("Total for the Account \"{0}\":", acc.Username)); from.SendMessage(String.Format("Gold: {0}", total_gold)); }
public override bool CanEquip(Mobile m) { #region Stygian Abyss if (m.Race == Race.Gargoyle) { m.SendLocalizedMessage(1111708); // Gargoyles can't wear return(false); } #endregion if (m.IsPlayer()) { if (_Owner != null && m != _Owner) { m.SendLocalizedMessage(501023); // You must be the owner to use this item. return(false); } if (this is IAccountRestricted && ((IAccountRestricted)this).Account != null) { Accounting.Account acct = m.Account as Accounting.Account; if (acct == null || acct.Username != ((IAccountRestricted)this).Account) { m.SendLocalizedMessage(1071296); // This item is Account Bound and your character is not bound to it. You cannot use this item. return(false); } } if (IsVvVItem && !Engines.VvV.ViceVsVirtueSystem.IsVvV(m)) { m.SendLocalizedMessage(1155496); // This item can only be used by VvV participants! return(false); } } if (m.NetState != null && !m.NetState.SupportsExpansion(Expansion.ML)) { m.SendLocalizedMessage(1072791); // You must upgrade to Mondain's Legacy in order to use that item. return(false); } return(true); }
public override bool CanEquip(Mobile from) { if (BlessedBy != null && BlessedBy != from) { from.SendLocalizedMessage(1075277); // That item is blessed by another player. return(false); } if (from.IsPlayer()) { if (_Owner != null && _Owner != from) { from.SendLocalizedMessage(501023); // You must be the owner to use this item. return(false); } if (this is IAccountRestricted && ((IAccountRestricted)this).Account != null) { Accounting.Account acct = from.Account as Accounting.Account; if (acct == null || acct.Username != ((IAccountRestricted)this).Account) { from.SendLocalizedMessage(1071296); // This item is Account Bound and your character is not bound to it. You cannot use this item. return(false); } } if (IsVvVItem && !Engines.VvV.ViceVsVirtueSystem.IsVvV(from)) { from.SendLocalizedMessage(1155496); // This item can only be used by VvV participants! return(false); } } if (from.AccessLevel < AccessLevel.GameMaster && !RaceDefinitions.ValidateEquipment(from, this)) { return(false); } return(base.CanEquip(from)); }
public static bool SharedAccount(Mobile dead, Mobile collector) { if (dead != null && dead.Account != null && collector != null && collector.Account != null) { Accounting.Account acct1 = collector.Account as Accounting.Account; Accounting.Account acct2 = dead.Account as Accounting.Account; if (acct1 != null && acct2 != null && acct1.LoginIPs != null && acct2.LoginIPs != null && acct1.LoginIPs.Length > 0 && acct2.LoginIPs.Length > 0) { foreach (IPAddress ip1 in acct1.LoginIPs) { foreach (IPAddress ip2 in acct2.LoginIPs) { if (ip1.Equals(ip2)) { return(true); } } } } } return(false); }
void LinkAccountIngame(Server.Commands.CommandEventArgs e) { if (string.IsNullOrWhiteSpace(e.ArgString) || !_verificationCodes.TryGetValue(e.ArgString, out ulong userId)) { e.Mobile.SendMessage($"Verification code {e.ArgString} not found!"); return; } Accounting.Account acc = e.Mobile.Account as Accounting.Account; DiscordUserLink dul = DClient.UserManager[acc]; if (dul != null && dul.DiscordUserId == 0) { dul.DiscordUserId = userId; } else if (dul == null) { dul = new DiscordUserLink(acc, userId); } DClient.UserManager.AddOrUpdate(dul); e.Mobile.SendMessage("You successfully linked your account to user discord account"); }
private void NewPlayerGuild(Mobile from) { // sanity if (from == null || from.Deleted == true || from.NetState == null) { return; } Accounting.Account a = from.Account as Accounting.Account; if (a != null && a.AccessLevel == AccessLevel.Player) { // 30 days young TimeSpan delta = DateTime.Now - a.Created; if (delta.TotalDays <= 30 && Accounting.Accounts.IPLookup(from.NetState.Address) == false) { // unconditional add // from.SendGump(new JoinNEWGuildGump(from)); Guildstone stone = FindGuild("new"); if (stone != null && stone.Guild != null) { // log it LogHelper logger = new LogHelper("PlayerAddedToNEWGuild.log", false, true); logger.Log(LogType.Mobile, from); logger.Finish(); // do it stone.Guild.AddMember(from); from.DisplayGuildTitle = true; DateTime tx = DateTime.Now.AddDays(14); string title = String.Format("{0}/{1}", tx.Month, tx.Day); from.GuildTitle = title; from.GuildFealty = stone.Guild.Leader != null ? stone.Guild.Leader : from; stone.Guild.GuildMessage(String.Format("{0} has just joined {1}.", from.Name, stone.Guild.Abbreviation == null ? "your guild" : stone.Guild.Abbreviation)); } else { from.SendMessage("We're sorry, but the new player guild is temporarily unavailable."); } } } }
public override void OnResponse(GameClient sender, RelayInfo info) { PlayerMobile pm = from as PlayerMobile; if (info.ButtonID == 1) { BankBox bank = from.BankBox; if (bank == null) { return; } Accounting.Account acct = from.Account as Accounting.Account; switch (token.Type) { case PromotionalType.SoulStone: { SoulStone ss = new SoulStone(acct.Username); bank.DropItem(ss); from.SendLocalizedMessage(1070743); // A Soulstone has been created in your bank box! break; } case PromotionalType.BlueSoulstone: { SoulStone ss = new BlueSoulstone(acct.Username); bank.DropItem(ss); from.SendMessage("A Blue Soulstone has been created in your bank box!"); break; } case PromotionalType.SoulStoneFragment: { int offset = Utility.Random(0, 8); SoulStoneFragment ssf = new SoulStoneFragment(0x2AA1 + offset, acct.Username); bank.DropItem(ssf); from.SendLocalizedMessage(1070976); // A soulstone fragment has been created in your bank box. break; } case PromotionalType.AdvancedCharacter: { pm.SendGump(new AdvancedCharacterChoiceGump()); pm.ACState = AdvancedCharacterState.InUse; break; } case PromotionalType.SeventhAnniversary: { //Cerramos algún posible gump abierto (exploit arreglado) if (!pm.HasGump(typeof(SeventhAniversaryGump))) { pm.SendGump(new SeventhAniversaryGump(token)); } break; } case PromotionalType.EighthAnniversary: { //Cerramos algún posible gump abierto (exploit arreglado) if (!pm.HasGump(typeof(EighthAnniversaryGump))) { pm.SendGump(new EighthAnniversaryGump(token)); } break; } case PromotionalType.BrokenFurniture: { //Cerramos algún posible gump abierto (exploit arreglado) if (!pm.HasGump(typeof(BrokenFurnitureGump))) { pm.SendGump(new BrokenFurnitureConfirmGump(token)); } break; } case PromotionalType.HeritageItems: { //Cerramos algún posible gump abierto (exploit arreglado) if (!pm.HasGump(typeof(HeritageItemsGump))) { pm.SendGump(new HeritageItemsConfirmGump(token)); } break; } case PromotionalType.EvilHomeDecoration: { //Cerramos algún posible gump abierto (exploit arreglado) if (!pm.HasGump(typeof(EvilHomeDecorationGump))) { pm.SendGump(new EvilHomeDecorationConfirmGump(token)); } break; } // TODO: character transfer } if (token.Type != PromotionalType.SeventhAnniversary && token.Type != PromotionalType.EighthAnniversary) { token.Delete(); } } }
public override void OnResponse(Server.Network.NetState sender, RelayInfo info) { int val = info.ButtonID; if (val <= 0) { return; } Mobile from = m_From; switch (val) { case 1: string accountname = info.GetTextEntry(0).Text; m_From.SendMessage("You entered [{0}]", accountname); foreach (Accounting.Account a in Accounting.Accounts.Table.Values) { if (a != null) { if (a.Username.ToLower() == accountname.ToLower()) { if (a.AccountActivated) { if ((DateTime.Now - a.ResetPasswordRequestedTime) < TimeSpan.FromDays(1.0)) { m_From.SendMessage("Reset password already requested."); } else { string newResetPassword = Server.Gumps.ProfileGump.CreateActivationKey(8); if (SmtpDirect.CheckEmailAddy(a.EmailAddress, false) == true) { string subject = "Angel Island Account password reset request"; string body = "\nSomeone has requested a password reset for your account.\n"; body += "A new password has been generated for your account.\n"; body += "It is: " + newResetPassword; body += "\n\nIf you did not request this reset password, log onto Angel Island with your normal "; body += "password and the reset request will be cancelled. Also, please report this "; body += "to the staff of Angel Island."; body += "\n\nYou can change your password using the [profile command.\n\n"; body += "Regards,\n The Angel Island Team\n\n"; Emailer mail = new Emailer(); if (mail.SendEmail(a.EmailAddress, subject, body, false)) { string regSubject = "Password reset request"; string regBody = "Password reset reqest made.\n"; regBody += "Info of from: \n"; regBody += "\n"; Accounting.Account from_account = m_From.Account as Accounting.Account; regBody += "Account: " + (from_account == null ? "<unknown>" : from_account.Username) + "\n"; regBody += "Character: " + from.Name + "\n"; regBody += "IP: " + sender.Address.ToString() + "\n"; regBody += "\n"; regBody += "Account requested for: " + a.Username + "\n"; regBody += "Email: " + a.EmailAddress + "\n"; regBody += "Reset password: "******"\n"; regBody += "\n"; mail.SendEmail("*****@*****.**", regSubject, regBody, false); a.ResetPassword = newResetPassword; m_From.SendMessage("Password reset request generated."); m_From.SendMessage("Email sent to account's email address."); } else { m_From.SendMessage("Error sending email to account's email."); } } else { m_From.SendMessage("Account email invalid, unable to reset password."); } } } else { m_From.SendMessage("Account not activated, unable to reset password."); } break; } } } break; default: break; } }
public WatchListChooserGump(Mobile owner, Mobile target) : base( 50, 50 ) { owner.CloseGump(typeof(WatchListChooserGump)); m_Owner = owner; m_Target = target; m_AccountTarget = target.Account as Accounting.Account; AddPage(0); AddBackground(0, 0, 500, 370, 5054); AddBackground(10, 10, 480, 350, 3000); //AddHtml(20, 15, 300, 30, "Watchlisting character or account:", true, false); AddLabelCropped(20, 15, 300, 20, LabelHue, "Watchlisting Character or Account"); AddLabelCropped(20, 50, 60, 20, LabelHue, "Reason:"); AddTextField(70, 50, 400, 20, 0, ""); AddCheck(20, 80, 210, 211, true, (int)Buttons.AccountCheck); AddLabelCropped(50, 80, 250, 20, LabelHue, "Watchlist Account"); //--------------------------------------------------------- AddLabelCropped(50, 120, 300, 20, LabelHue, "Duration:"); AddRadio(50, 140, 0x25F8, 0x25FB, false, 100); AddLabelCropped(80, 140, 250, 20, LabelHue, "Permanent"); AddRadio(50, 170, 0x25F8, 0x25FB, false, 101); AddLabelCropped(80, 170, 250, 20, LabelHue, "One Month"); AddRadio(50, 200, 0x25F8, 0x25FB, true, 102); AddLabelCropped(80, 200, 250, 20, LabelHue, "One Week"); AddRadio(50, 230, 0x25F8, 0x25FB, false, 103); AddLabelCropped(80, 230, 250, 20, LabelHue, "24 Hours"); //---------------------------------------------------------- AddButton(20, 320, 4005, 4007, (int)Buttons.Proceed, GumpButtonType.Reply, 0); AddHtml(55, 320, 75, 20, "Proceed", false, false); AddButton(135, 320, 4005, 4007, (int)Buttons.Cancel, GumpButtonType.Reply, 0); AddHtml(170, 320, 75, 20, "Cancel", false, false); }
public override bool CanEquip(Mobile from) { if (BlessedBy != null && BlessedBy != from) { from.SendLocalizedMessage(1075277); // That item is blessed by another player. return(false); } if (from.IsPlayer()) { if (_Owner != null && _Owner != from) { from.SendLocalizedMessage(501023); // You must be the owner to use this item. return(false); } if (this is IAccountRestricted && ((IAccountRestricted)this).Account != null) { Accounting.Account acct = from.Account as Accounting.Account; if (acct == null || acct.Username != ((IAccountRestricted)this).Account) { from.SendLocalizedMessage(1071296); // This item is Account Bound and your character is not bound to it. You cannot use this item. return(false); } } if (IsVvVItem && !Engines.VvV.ViceVsVirtueSystem.IsVvV(from)) { from.SendLocalizedMessage(1155496); // This item can only be used by VvV participants! return(false); } } if (from.AccessLevel < AccessLevel.GameMaster) { bool morph = from.FindItemOnLayer(Layer.Earrings) is MorphEarrings; if (from.Race == Race.Gargoyle && !CanBeWornByGargoyles) { from.SendLocalizedMessage(1111708); // Gargoyles can't wear return(false); } else if (RequiredRace != null && from.Race != RequiredRace && !morph) { if (RequiredRace == Race.Elf) { from.SendLocalizedMessage(1072203); // Only Elves may use } else if (RequiredRace == Race.Gargoyle) { from.SendLocalizedMessage(1111707); // Only gargoyles can wear } else { from.SendMessage("Only {0} may use ", RequiredRace.PluralName); } return(false); } } return(base.CanEquip(from)); }
public static void Initialize() { var entry = Config.Find("Discord.Token"); if (entry == null) { Utility.PushColor(ConsoleColor.Red); Console.WriteLine("Discord: Config not found, autogenerating..."); Utility.PopColor(); Config.Set("Discord.Token", "Your Discord Bot Token"); Config.Set("Discord.GuildId", 0ul); Config.Set("Discord.CommandPrefix", "!"); Config.Set("Discord.CommandChannelId", 0ul); Config.Set("Discord.ForceSocket", 0); Config.Save(); Utility.PushColor(ConsoleColor.Red); Console.WriteLine("Discord: Config generated, disabling discord for this run..."); Utility.PopColor(); IsDisabled = true; return; } string token = Config.Get("Discord.Token", string.Empty); if (string.IsNullOrEmpty(token) || token.Equals("Your Discord Bot Token")) { Utility.PushColor(ConsoleColor.Red); Console.WriteLine("Discord: Invalid token, disabling discord..."); Utility.PopColor(); IsDisabled = true; return; } ulong guildId = Config.Get("Discord.GuildId", 0ul); if (guildId == 0) { Utility.PushColor(ConsoleColor.Red); Console.WriteLine("Discord: Invalid guild id, disabling discord..."); Utility.PopColor(); IsDisabled = true; return; } char cmdPrefix = Config.Get("Discord.CommandPrefix", "!")[0]; if (cmdPrefix == char.MinValue || cmdPrefix == char.MaxValue || char.IsLetterOrDigit(cmdPrefix)) { Utility.PushColor(ConsoleColor.Red); Console.WriteLine("Discord: Invalid command prefix, disabling discord..."); Utility.PopColor(); IsDisabled = true; return; } ulong commandChannelId = Config.Get("Discord.CommandChannelId", 0ul); if (commandChannelId == 0) { Utility.PushColor(ConsoleColor.Red); Console.WriteLine("Discord: Invalid command channel id, disabling discord..."); Utility.PopColor(); IsDisabled = true; return; } ulong logChannelId = Config.Get("Discord.LogChannelId", 0ul); if (logChannelId == 0) { Utility.PushColor(ConsoleColor.Yellow); Console.WriteLine("Discord: Warning no log channel id found, no logging will happen"); Utility.PopColor(); } int forceSocket = Config.Get("Discord.ForceSocket", 0); Settings = new DClientSettings(token, guildId, commandChannelId, logChannelId, cmdPrefix, forceSocket); _userMgr = new DiscordUserManager(); _cmdHandler = new CommandHandler(cmdPrefix); Start(); Server.Commands.CommandSystem.Register("discordlink", AccessLevel.GameMaster, new Server.Commands.CommandEventHandler(e => { if (!ulong.TryParse(e.ArgString, out ulong id)) { e.Mobile.SendMessage("Unable to parse id"); return; } Accounting.Account acc = e.Mobile.Account as Accounting.Account; DiscordUserLink dul = UserManager[acc]; if (dul == null) { dul = new DiscordUserLink(acc, id); } else { dul.DiscordUserId = id; } UserManager.AddOrUpdate(dul); })); //I don't know any other way to load this after the accounts have been loaded //so we will load this after the world has been loaded Load(); _dclient.ConnectAsync().ConfigureAwait(false).GetAwaiter().GetResult(); }