public void EditTM() { var path = Path.Combine(ROM.PathExeFS, "main"); var data = FileMitm.ReadAllBytes(path); var list = new TMEditorGG(data); if (!list.Valid) { WinFormsUtil.Alert("Not able to find tm data in ExeFS."); return; } var moves = list.GetMoves(); var allowed = Legal.GetAllowedMoves(ROM.Game, ROM.Data.MoveData.Length); var names = ROM.GetStrings(TextName.MoveNames); using var editor = new TMList(moves, allowed, names); editor.ShowDialog(); if (!editor.Modified) { return; } list.SetMoves(editor.FinalMoves); data = list.Write(); FileMitm.WriteAllBytes(path, data); }
private void RenderPage(int index, int offset) { TMList list = m_Lists[index]; AddPage(index + 1); AddButton(10, 35 + (offset * 25), 2117, 2118, 0, GumpButtonType.Page, index + 1); AddHtml(30, 35 + (offset * 25), 150, 20, list.SelText, false, false); TMEntry[] entries = list.Entries; for (int i = 0; i < entries.Length; ++i) { AddRadio(200, 35 + (i * 25), 210, 211, false, (index * 100) + i); AddHtml(225, 35 + (i * 25), 150, 20, entries[i].Text, false, false); } }
public override void OnResponse(NetState state, RelayInfo info) { if (info.ButtonID == 0) // Cancel { return; } else if (m_Mobile.Deleted || m_Mobile.Map == null) { return; } else if (info.ButtonID == 2) // Launch Browser { m_Mobile.LaunchBrowser("http://uo.stratics.com/thb/info/maparchive/Archive1.shtml"); } int[] switches = info.Switches; if (switches.Length == 0) { return; } int switchID = switches[0]; int listIndex = switchID / 100; int listEntry = switchID % 100; if (listIndex < 0 || listIndex >= m_Lists.Length) { return; } TMList list = m_Lists[listIndex]; if (listEntry < 0 || listEntry >= list.Entries.Length) { return; } TMEntry entry = list.Entries[listEntry]; if (Server.Spells.SpellHelper.CheckCombat(m_Mobile)) { m_Mobile.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle?? } else if (m_Mobile.Spell != null) { m_Mobile.SendLocalizedMessage(1049616); // You are too busy to do that at the moment. } else if (m_Mobile.Map == list.Map && m_Mobile.InRange(entry.Location, 1)) { m_Mobile.SendLocalizedMessage(1019003); // You are already there. } else { BaseCreature.TeleportPets(m_Mobile, entry.Location, list.Map); m_Mobile.Combatant = null; m_Mobile.Warmode = false; m_Mobile.Map = list.Map; m_Mobile.Location = entry.Location; } }
public MapLocationsGump(Mobile mobile) : base(100, 100) { m_Mobile = mobile; TMList[] checkLists; if (mobile.Player) { if (mobile.Kills >= 999999999) { checkLists = TMList.RedLists; } else { int flags = mobile.NetState == null ? 0 : (int)mobile.NetState.Flags; if (Core.AOS && (flags & 0x8) != 0) { checkLists = TMList.AOSLists; } else if ((flags & 0x4) != 0) { checkLists = TMList.LBRLists; } else { checkLists = TMList.UORLists; } } } else { checkLists = TMList.AOSLists; } m_Lists = new TMList[checkLists.Length]; for (int i = 0; i < m_Lists.Length; ++i) { m_Lists[i] = checkLists[i]; } for (int i = 0; i < m_Lists.Length; ++i) { if (m_Lists[i].Map == mobile.Map) { TMList temp = m_Lists[i]; m_Lists[i] = m_Lists[0]; m_Lists[0] = temp; break; } } AddPage(0); AddBackground(0, 0, 380, 500, 9200); AddButton(10, 345, 4005, 4007, 1, GumpButtonType.Reply, 0); AddHtmlLocalized(45, 345, 140, 25, 1011036, false, false); // OKAY AddButton(10, 370, 4005, 4007, 0, GumpButtonType.Reply, 0); AddHtmlLocalized(45, 370, 140, 25, 1011012, false, false); // CANCEL AddButton(10, 475, 4005, 4007, 2, GumpButtonType.Reply, 0); AddLabel(45, 475, 0x34, "Visit UO.STRATICS.COM Treasure Map Archive"); AddHtmlLocalized(5, 5, 200, 20, 1012011, false, false); // Pick your destination: for (int i = 0; i < checkLists.Length; ++i) { AddButton(10, 35 + (i * 25), 2117, 2118, 0, GumpButtonType.Page, Array.IndexOf(m_Lists, checkLists[i]) + 1); AddHtml(30, 35 + (i * 25), 150, 20, checkLists[i].Text, false, false); } for (int i = 0; i < m_Lists.Length; ++i) { RenderPage(i, Array.IndexOf(checkLists, m_Lists[i])); } }
public override void OnResponse(NetState state, RelayInfo info) { if (info.ButtonID == 0) // Cancel { return; } else if (m_Mobile.Deleted || m_Mobile.Map == null) { return; } int[] switches = info.Switches; if (switches.Length == 0) { return; } int switchID = switches[0]; int listIndex = switchID / 100; int listEntry = switchID % 100; if (listIndex < 0 || listIndex >= m_Lists.Length) { return; } TMList list = m_Lists[listIndex]; if (listEntry < 0 || listEntry >= list.Entries.Length) { return; } TMEntry entry = list.Entries[listEntry]; if (m_Mobile.Player && m_Mobile.Kills >= 5 && list.Map != Map.Trammel) { m_Mobile.SendLocalizedMessage(1019004); // You are not allowed to travel there. } else if (m_Mobile.Criminal) { m_Mobile.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily. } else if (Server.Spells.SpellHelper.CheckCombat(m_Mobile)) { m_Mobile.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle?? } else if (m_Mobile.Spell != null) { m_Mobile.SendLocalizedMessage(1049616); // You are too busy to do that at the moment. } else if (m_Mobile.Map == list.Map && m_Mobile.InRange(entry.Location, 1)) { m_Mobile.SendLocalizedMessage(1019003); // You are already there. } else { BaseCreature.TeleportPets(m_Mobile, entry.Location, list.Map); m_Mobile.Combatant = null; m_Mobile.Warmode = false; m_Mobile.Map = list.Map; m_Mobile.Location = entry.Location; } }