public override void OnDoubleClick(Mobile m) { var pm = (PlayerMobile)m; if (TitleHue == null) { pm.SendMessage(0x22, "THIS HUE DOES NOT EXIST, PLEASE PAGE IN."); Delete(); return; } TitleProfile p = CustomTitles.EnsureProfile(pm); if (p == null) { return; } if (p.Contains(TitleHue)) { pm.SendMessage(0x22, "YOU ALREADY OWN THIS HUE. THIS SHOULDN'T HAPPEN. PLEASE PAGE IN."); return; } GrantHue(pm, p); }
public bool AutoConsume(PlayerMobile m) { if (m == null || m.Deleted) { return(false); } if (TitleHue == null) { m.SendMessage(0x22, "This ancient scroll has lost whatever power it once had."); m.PrivateOverheadMessage(MessageType.Label, 1287, true, "*The scroll disintegrates in your hands*", m.NetState); LoggingCustom.Log("HueScrollsInvalid.txt", String.Format("{0} -> {1} ({2})", m, this, TitleHue)); Delete(); return(false); } if (!CanConsume(m, false)) { return(false); } TitleProfile p = CustomTitles.EnsureProfile(m); if (p == null) { return(false); } GrantHue(m, p); return(true); }
public static Title Resolve(string title) { Title t; CustomTitles.TryGetTitle(title, out t); return(t); }
public static TitleHue Resolve(int hue) { TitleHue h; CustomTitles.TryGetHue(hue, out h); return(h); }
public override void OnDoubleClick(Mobile m) { if (!this.CheckDoubleClick(m, true, false, 2, true) || !(m is PlayerMobile)) { return; } if (TitleHue == null) { m.SendMessage(0x22, "This ancient scroll has lost whatever power it once had."); m.PrivateOverheadMessage(MessageType.Label, 1287, true, "*The scroll disintegrates in your hands*", m.NetState); LoggingCustom.Log("HueScrollsInvalid.txt", String.Format("{0} -> {1} ({2})", m, this, TitleHue)); Delete(); return; } if (!CanConsume((PlayerMobile)m, true)) { return; } var pm = (PlayerMobile)m; TitleProfile p = CustomTitles.EnsureProfile(pm); if (p == null) { return; } if (_Gump != null) { _Gump.Close(true); _Gump = null; } _Gump = SuperGump.Send( new ScrollConfirmGump( pm, null, TitleHue, b => GrantHue(pm, p), b => { pm.SendMessage(0x55, "You choose to not use the title hue scroll."); _Gump = null; })); }
public void AddHue() { string result; bool success = CustomTitles.CreateHue(_AddHue, _AddRarity, out result) != null; if (success) { ClearVars(); } Refresh(success); new NoticeDialogGump(User) { Title = "Add Hue Result", Html = result, HtmlColor = success ? Color.LawnGreen : Color.OrangeRed }.Send(); }
public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); switch (version) { case 0: { Owner = reader.ReadMobile <PlayerMobile>(); Titles = reader.ReadBlockList(CustomTitles.ReadTitle); Hues = reader.ReadBlockList(CustomTitles.ReadTitleHue); SelectedTitle = CustomTitles.ReadTitle(reader); SelectedHue = CustomTitles.ReadTitleHue(reader); } break; } }
public override void Serialize(GenericWriter writer) { base.Serialize(writer); int version = writer.SetVersion(0); switch (version) { case 0: { writer.WriteMobile(Owner); writer.WriteBlockList(Titles, CustomTitles.WriteTitle); writer.WriteBlockList(Hues, CustomTitles.WriteTitleHue); CustomTitles.WriteTitle(writer, SelectedTitle); CustomTitles.WriteTitleHue(writer, SelectedHue); } break; } }
public void PurgeHue(TitleHue hue) { if (hue == null) { Refresh(); return; } string result; bool success = CustomTitles.PurgeHue(hue, out result); Refresh(success); new NoticeDialogGump(User) { Title = "Purge Hue Result", Html = result, HtmlColor = success ? Color.LawnGreen : Color.OrangeRed }.Send(); }
public bool CanConsume(PlayerMobile pm, bool message) { if (TitleHue == null) { return(false); } if (BoundToMobile != null && BoundToMobile != pm) { if (message) { pm.SendMessage(54, "This scroll is bound to another entity."); } return(false); } TitleProfile p = CustomTitles.EnsureProfile(pm); if (p == null) { return(false); } if (p.Contains(TitleHue)) { if (message) { pm.SendMessage(0x22, "You already own this title hue."); } return(false); } return(true); }