public bool Drop(Mobile m, RuneCodexEntry entry, bool message) { if (m == null || m.Deleted || entry == null) { return(false); } if (!ConsumeCharges(CloneEntryChargeCost)) { m.SendMessage( "This action requires {0:#,0} charge{1}.", CloneEntryChargeCost, CloneEntryChargeCost != 1 ? "s" : String.Empty); return(false); } m.AddToBackpack( new RecallRune { Marked = true, Target = entry.Location, TargetMap = entry.Location, Description = entry.Name, House = BaseHouse.FindHouseAt(entry.Location, entry.Location, 16) }); if (message) { m.SendMessage( "You create a recall rune and consume {0:#,0} charge{1} from the codex.", CloneEntryChargeCost, CloneEntryChargeCost != 1 ? "s" : String.Empty); } return(true); }
protected virtual void SelectEntry(int gx, int gy, int idx, RuneCodexEntry entry) { UI.EntryPoint = new Point2D(gx, gy); UI.Entry = entry; OnSelected(gx, gy, idx, entry); }
protected virtual void OnSelected(int gx, int gy, int idx, RuneCodexEntry entry) { if (DoubleClicked && Codex.Recall(User, entry, true)) { Minimized = true; Refresh(true); return; } Refresh(true); }
public bool Remove(RuneCodexEntry entry) { for (int x = 0; x < Entries.Width; x++) { for (int y = 0; y < Entries.Height; y++) { if (Entries[x, y] != entry) { continue; } Entries[x, y] = null; return(true); } } return(false); }
public bool Gate(Mobile m, RuneCodexEntry entry, bool message) { if (m == null || m.Deleted || entry == null) { return(false); } if (!ConsumeCharges(GateChargeCost)) { m.SendMessage("This action requires {0:#,0} charge{1}.", GateChargeCost, GateChargeCost != 1 ? "s" : String.Empty); return(false); } if (!entry.Gate(m)) { Charges += GateChargeCost; return(false); } return(true); }
protected virtual void CompileEntry(SuperGumpLayout layout, int x, int y, int idx, RuneCodexEntry entry) { var ui = UI; if (x >= ui.Category.Entries.Width || y >= ui.Category.Entries.Height) { return; } layout.Add( "entry/" + idx, () => { ui = UI; var xOffset = 220 + (x * 70); var yOffset = 50 + (y * 70); var gx = x + ui.EntryScroll.X; var gy = y + ui.EntryScroll.Y; const int itemID = 7956; var s = entry != null && ui.Entry == entry; if (entry != null) { AddButton(xOffset + 5, yOffset + 5, 24024, 24024, b => SelectEntry(gx, gy, idx, entry)); } else if (Codex.CanAddEntries(User)) { AddButton(xOffset + 5, yOffset + 5, 24024, 24024, b => AddEntry(gx, gy, idx)); } AddImageTiled(xOffset, yOffset, 60, 60, 2702); if (s) { AddItem(xOffset + 10, yOffset + 4, itemID, 2050); AddItem(xOffset + 10, yOffset + 2, itemID, 1); } if (entry != null) { AddItem(xOffset + 10, yOffset, itemID, ui.Category.Hue); AddHtml( xOffset, yOffset + 25, 60, 40, GetEntryLabel(entry).WrapUOHtmlTag("center").WrapUOHtmlColor(Color.LawnGreen, false), false, false); } else if (Codex.CanAddEntries(User)) { AddImage(xOffset + 25, yOffset, 2511, HighlightHue); AddHtml( xOffset, yOffset + 25, 60, 40, "Add".WrapUOHtmlTag("center").WrapUOHtmlColor(Color.Yellow, false), false, false); } }); }
public virtual string GetEntryLabel(RuneCodexEntry entry) { return(entry != null ? entry.Name : String.Empty); }
protected virtual void SelectEntry(int gx, int gy, int idx, RuneCodexEntry entry) { var ui = UI; ui.EntryPoint = new Point2D(gx, gy); ui.Entry = entry; OnSelected(gx, gy, idx, entry); }
protected virtual void CompileEntry(SuperGumpLayout layout, int x, int y, int idx, RuneCodexEntry entry) { var ui = UI; if (x >= ui.Category.Entries.Width || y >= ui.Category.Entries.Height) { return; } layout.Add( "entry/" + idx, () => { ui = UI; int xOffset = 220 + (x * 70); int yOffset = 50 + (y * 70); int gx = x + ui.EntryScroll.X; int gy = y + ui.EntryScroll.Y; const int itemID = 7956; bool s = entry != null && ui.Entry == entry; if (entry != null) { AddButton(xOffset + 5, yOffset + 5, 24024, 24024, b => SelectEntry(gx, gy, idx, entry)); } else if (Codex.CanAddEntries(User)) { AddButton(xOffset + 5, yOffset + 5, 24024, 24024, b => AddEntry(gx, gy, idx)); } AddImageTiled(xOffset, yOffset, 60, 60, 2702); if (s) { AddItem(xOffset + 10, yOffset + 4, itemID, 2050); AddItem(xOffset + 10, yOffset + 2, itemID, 1); } if (entry != null) { AddItem(xOffset + 10, yOffset, itemID, ui.Category.Hue); AddHtml( xOffset, yOffset + 25, 60, 40, GetEntryLabel(entry).WrapUOHtmlTag("center").WrapUOHtmlColor(Color.LawnGreen, false), false, false); } else if (Codex.CanAddEntries(User)) { AddImage(xOffset + 25, yOffset, 2511, HighlightHue); AddHtml( xOffset, yOffset + 25, 60, 40, "Add".WrapUOHtmlTag("center").WrapUOHtmlColor(Color.Yellow, false), false, false); } }); }
public virtual string GetEntryLabel(RuneCodexEntry entry) { return entry != null ? entry.Name : String.Empty; }
public override void OnAfterDuped(Item newItem) { base.OnAfterDuped(newItem); var c = newItem as RuneCodex; if (c == null) { return; } c.AddLocked = AddLocked; c.EditLocked = EditLocked; c.RemoveLocked = RemoveLocked; c.CloneEntryChargeCost = CloneEntryChargeCost; c.RecallChargeCost = RecallChargeCost; c.GateChargeCost = GateChargeCost; c.Charges = Charges; c.Descripton = Descripton; c.Categories = new RuneCodexCategoryGrid(); c.ChargeTypes = new Dictionary <Type, int>(ChargeTypes); c.Users = new List <UICache>(); RuneCodexCategory cata, catb; RuneCodexEntry entrya, entryb; for (var cx = 0; cx < Categories.Width; cx++) { for (var cy = 0; cy < Categories.Height; cy++) { cata = Categories[cx, cy]; if (cata == null) { continue; } catb = new RuneCodexCategory(cata.Name, cata.Description, cata.Hue); c.Categories.SetContent(cx, cy, catb); for (var ex = 0; ex < cata.Entries.Width; ex++) { for (var ey = 0; ey < cata.Entries.Width; ey++) { entrya = cata.Entries[ex, ey]; if (entrya == null) { continue; } entryb = new RuneCodexEntry(entrya.Name, entrya.Description, entrya.Location); catb.Entries.SetContent(ex, ey, entryb); } } } } }
public override void OnAfterDuped(Item newItem) { base.OnAfterDuped(newItem); RuneCodex c = newItem as RuneCodex; if (c == null) { return; } c.AddLocked = AddLocked; c.EditLocked = EditLocked; c.RemoveLocked = RemoveLocked; c.CloneEntryChargeCost = CloneEntryChargeCost; c.RecallChargeCost = RecallChargeCost; c.GateChargeCost = GateChargeCost; c.Charges = Charges; c.Descripton = Descripton; c.Categories = new RuneCodexCategoryGrid(); c.ChargeTypes = new Dictionary<Type, int>(ChargeTypes); c.Users = new Dictionary<PlayerMobile, UICache>(); RuneCodexCategory cata, catb; RuneCodexEntry entrya, entryb; for (int cx = 0; cx < Categories.Width; cx++) { for (int cy = 0; cy < Categories.Height; cy++) { cata = Categories[cx, cy]; if (cata == null) { continue; } catb = new RuneCodexCategory(cata.Name, cata.Description, cata.Hue); c.Categories.SetContent(cx, cy, catb); for (int ex = 0; ex < cata.Entries.Width; ex++) { for (int ey = 0; ey < cata.Entries.Width; ey++) { entrya = cata.Entries[ex, ey]; if (entrya == null) { continue; } entryb = new RuneCodexEntry(entrya.Name, entrya.Description, entrya.Location); catb.Entries.SetContent(ex, ey, entryb); } } } } }
public bool Gate(Mobile m, RuneCodexEntry entry, bool message) { if (m == null || m.Deleted || entry == null) { return false; } if (!ConsumeCharges(GateChargeCost)) { m.SendMessage("This action requires {0:#,0} charge{1}.", GateChargeCost, GateChargeCost != 1 ? "s" : String.Empty); return false; } if (!entry.Gate(m)) { Charges += GateChargeCost; return false; } return true; }
public bool Drop(Mobile m, RuneCodexEntry entry, bool message) { if (m == null || m.Deleted || entry == null) { return false; } if (!ConsumeCharges(CloneEntryChargeCost)) { m.SendMessage( "This action requires {0:#,0} charge{1}.", CloneEntryChargeCost, CloneEntryChargeCost != 1 ? "s" : String.Empty); return false; } m.AddToBackpack( new RecallRune { Marked = true, Target = entry.Location, TargetMap = entry.Location, Description = entry.Name, House = BaseHouse.FindHouseAt(entry.Location, entry.Location, 16) }); if (message) { m.SendMessage( "You create a recall rune and consume {0:#,0} charge{1} from the codex.", CloneEntryChargeCost, CloneEntryChargeCost != 1 ? "s" : String.Empty); } return true; }
public bool Remove(RuneCodexEntry entry) { for (int x = 0; x < Entries.Width; x++) { for (int y = 0; y < Entries.Height; y++) { if (Entries[x, y] != entry) { continue; } Entries[x, y] = null; return true; } } return false; }