public void Dequip() { Mobile player = World.Player; if (player != null) { if (player.Ghost) { Engine.AddTextMessage("You are dead."); } else if ((Gumps.Drag != null) && (Gumps.Drag.GetType() == typeof(GDraggedItem))) { Engine.AddTextMessage("You are already dragging an item."); } else { Item item = player.FindEquip(Layer.TwoHanded); if (item == null) { item = player.FindEquip(Layer.OneHanded); } if (item == null) { Engine.AddTextMessage("You are not holding anything."); } else { Network.Send(new PPickupItem(item, item.Amount)); Network.Send(new PDropItem(item.Serial, -1, -1, 0, player.Serial)); } } } }
public void AutoUse() { ArrayList autoUse = World.CharData.AutoUse; if (autoUse.Count <= 0) { Engine.AddTextMessage("There are no items in your use-once list."); } else { Mobile player = World.Player; if (player != null) { Item backpack = player.Backpack; if (backpack != null) { for (int i = 0; i < autoUse.Count; i++) { Engine.m_AutoUseIndex++; Engine.m_AutoUseIndex = Engine.m_AutoUseIndex % autoUse.Count; Item check = (Item)autoUse[Engine.m_AutoUseIndex]; if (backpack.ContainsItem(check) || (check.IsEquip && (check.EquipParent == player))) { check.Use(); return; } } Engine.AddTextMessage("No use-once items were found on your person."); } } } }
public void Equip(int index) { Mobile player = World.Player; if (player != null) { if (player.Ghost) { Engine.AddTextMessage("You are dead."); } else if ((Gumps.Drag != null) && (Gumps.Drag.GetType() == typeof(GDraggedItem))) { Engine.AddTextMessage("You are already dragging an item."); } else { object obj2 = this.m_AutoEquip[index]; if (obj2 != null) { Item check = World.FindItem((int)obj2); if (check == null) { Engine.AddTextMessage("Equipment not found."); } else if (!check.IsEquip || !player.HasEquip(check)) { Network.Send(new PPickupItem(check, check.Amount)); Network.Send(new PEquipItem(check, World.Player)); } } } } }
public void OnCancel(PromptCancelType type) { if (type == PromptCancelType.UserCancel) { Engine.AddTextMessage("Hue creation canceled."); } }
private void StatChange(string name, int oldValue, int newValue) { int num = newValue - oldValue; if (num != 0) { Engine.AddTextMessage(string.Format("Your {0} has {1} by {2}. It is now {3}.", new object[] { name, (num > 0) ? "increased" : "decreased", Math.Abs(num), newValue }), Engine.GetFont(3), Hues.Load(0x170)); } }
public bool UsePotion(PotionType type) { bool flag = Engine.UsePotion(type); if (!flag) { Engine.AddTextMessage(string.Format("You do not have any {0} potions!", type.ToString().ToLower()), Engine.DefaultFont, Hues.Load(0x22)); } return(flag); }
public void UseSkill(string Name) { Skill skill = Engine.Skills[Engine.Skills.GetSkill(Name)]; if (skill != null) { skill.Use(); } else { Engine.AddTextMessage(string.Format("Unknown skill '{0}'", Name)); } }
public void OnReturn(string message) { QuickHueEntry e = new QuickHueEntry { Name = message, Hue = this.m_Hue }; QuickHues.Add(e); Gumps.Destroy(this.m_Target); GQuickHues toAdd = new GQuickHues(this.m_Target.m_Picker, this.m_Target.m_Brightness, this.m_Target.m_Okay); if (this.m_Target.m_Expanded) { toAdd.m_Expanded = true; toAdd.Height = toAdd.m_ExpandedHeight; } this.m_Target.m_Parent.Children.Add(toAdd); Engine.AddTextMessage(string.Format("Hue created under name '{0}'.", message)); }
public void Trace() { Engine.AddTextMessage(string.Format("Tracing packet 0x{0:X2} '{1}' of length {2} ( 0x{2:X} )", this.m_Command, this.m_Name, this.m_Count)); StreamWriter tw = new StreamWriter("PacketTrace.log", true); if (this.m_Count < 0x10) { tw.WriteLine("Packet Server->Client '{0}' ( {1} bytes )", this.m_ReturnName, this.m_Count); } else { tw.WriteLine("Packet Server->Client '{0}' ( {1} [0x{1:X}] bytes )", this.m_ReturnName, this.m_Count); } tw.WriteLine(); Network.Log(tw, this.m_Data, this.m_Start, this.m_Count); tw.WriteLine(); tw.Flush(); tw.Close(); }
private void InternalOnFlagsChanged(MobileFlags flags) { if (!this.m_Refresh && (this.m_StatusBar != null)) { this.m_StatusBar.OnFlagsChange(flags); } this.m_Flags = flags; if ((this.m_Flags.Value & -223) != 0) { this.Trace(); string message = string.Format("Unknown mobile flags: 0x{0:X2}", this.m_Flags.Value); Debug.Error(message); Engine.AddTextMessage(message); } if (this.m_Player && ((this.m_Flags.Value & 0x80) == 0)) { Engine.m_Stealth = false; Engine.m_StealthSteps = 0; } }
public static void DoChat(UOAMPacketReader reader) { try { int num = reader.ReadInt32(); for (int i = 0; i < num; i++) { if (reader.ReadInt32() == 0) { return; } int length = reader.ReadInt32(); if (reader.ReadInt32() != 0) { m_Log = true; } if (reader.ReadInt32() != length) { m_Log = true; } string str = reader.ReadString(length); reader.Align(4); length = reader.ReadInt32(); int num3 = reader.ReadInt32(); if (reader.ReadInt32() != length) { m_Log = true; } string str2 = reader.ReadString(length); if ((str.Length > 0) && (str2.Length > 0)) { Engine.AddTextMessage(string.Format("{0}: {1}", str, str2), Engine.DefaultFont, Hues.Load(0x59)); } } } catch { Disconnect(); } }
public static void Disconnect() { if (m_Socket != null) { Engine.AddTextMessage("UOAM: Disconnected", Engine.DefaultFont, Hues.Load(0x59)); try { m_Socket.Shutdown(SocketShutdown.Both); } catch { } try { m_Socket.Close(); } catch { } m_Socket = null; } }
public static bool Connect(string username, string password, IPAddress ipaddr, int port) { Disconnect(); m_Username = username; m_Password = password; m_Address = ipaddr; try { m_Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); m_Socket.Connect(new IPEndPoint(ipaddr, port)); m_Socket.SetSocketOption(SocketOptionLevel.Tcp, SocketOptionName.Debug, 1); } catch { m_Socket = null; return(false); } if (!DoConnectSequence()) { return(false); } Engine.AddTextMessage(string.Format("UOAM: Connected to {0}.", ipaddr), Engine.DefaultFont, Hues.Load(0x59)); return(true); }
public void AddTextMessage(string msg, TimeSpan ts, int font) { Engine.AddTextMessage(msg, (float)ts.TotalSeconds, Engine.GetFont(font)); }
public void AddTextMessage(string msg, TimeSpan ts) { Engine.AddTextMessage(msg, (float)ts.TotalSeconds); }
private void Add_OnClick(Gump g) { Engine.AddTextMessage("Enter hue name:"); Engine.Prompt = new HuePrompt(this.m_Picker.Hue, this); }
private void ProcessLayout(LayoutEntry[] list, string[] text) { int page = 0; int num2 = 0; bool flag = false; for (int i = 0; i < list.Length; i++) { string str; IHue hue; int num5; string str3; int num6; IFont uniFont; GLabel label; object obj2; LayoutEntry le = list[i]; if (((obj2 = le.Name) != null) && ((obj2 = < PrivateImplementationDetails >.$$method0x60000f4 - 1[obj2]) != null)) { switch (((int)obj2)) { case 0: case 1: { continue; } case 2: goto Label_020B; case 3: goto Label_0243; case 4: { this.m_CanClose = false; continue; } case 5: { this.m_CanMove = false; continue; } case 6: { this.Pages(page).Add(new GServerBackground(this, le[0], le[1], le[3], le[4], le[2] + 4, true)); continue; } case 7: { this.Pages(page).Add(new GServerBackground(this, le[0], le[1], le[2], le[3], le[4], false)); continue; } case 8: goto Label_0301; case 9: { this.Pages(page).Add(new GServerTextBox(text[le[6]], le)); continue; } case 10: { this.Pages(page).Add(new GItemArt(le[0], le[1], le[2])); continue; } case 11: { this.Pages(page).Add(new GServerButton(this, le)); continue; } case 12: { this.Pages(page).Add(new GServerRadio(this, le)); continue; } case 13: { this.Pages(page).Add(new GServerCheckBox(this, le)); continue; } case 14: { int num4 = le[2]; this.Pages(page).Add(new GLabel(text[le[3]], Engine.GetUniFont(1), Hues.Load(num4 + 1), le[0] - 1, le[1])); continue; } case 15: num5 = le[4]; str3 = text[le[5]]; num6 = le[2]; uniFont = Engine.GetUniFont(1); if (uniFont.GetStringWidth(str3) <= num6) { goto Label_051A; } goto Label_04EB; case 0x10: { this.ProcessHtmlGump(page, le[0], le[1], le[2], le[3], Localization.GetString(le[4]), le[5] != 0, le[6] != 0, ((le[5] == 0) && (le[6] != 0)) ? 0xffffff : 0); continue; } case 0x11: { this.ProcessHtmlGump(page, le[0], le[1], le[2], le[3], Localization.GetString(le[4]), le[5] != 0, le[6] != 0, Engine.C16232(le[7])); continue; } case 0x12: { this.ProcessHtmlGump(page, le[0], le[1], le[2], le[3], text[le[4]], le[5] != 0, le[6] != 0, ((le[5] == 0) && (le[6] != 0)) ? 0xffffff : 0); continue; } } } goto Label_06A2; Label_020B: this.Pages(page).Add(new GTransparentRegion(this, le[0], le[1], le[2], le[3])); continue; Label_0243: page = le[0]; if (page == 0) { flag = false; num2 = 0; } else if (!flag || (page < num2)) { num2 = page; flag = true; } continue; Label_0301: str = le.GetAttribute("hue"); if (str != null) { try { hue = Hues.Load(Convert.ToInt32(str) + 1); } catch { hue = Hues.Default; } } else { hue = Hues.Default; } if (le.GetAttribute("class") == "VirtueGumpItem") { this.Pages(page).Add(new GVirtueItem(this, le[0], le[1], le[2], hue)); } else { this.Pages(page).Add(new GServerImage(this, le[0], le[1], le[2], hue)); } continue; Label_04D8: str3 = str3.Substring(0, str3.Length - 1); Label_04EB: if ((str3.Length > 0) && (uniFont.GetStringWidth(str3 + "...") > num6)) { goto Label_04D8; } str3 = str3 + "..."; Label_051A: label = new GLabel(str3, uniFont, Hues.Load(num5 + 1), le[0] - 1, le[1]); label.Scissor(0, 0, num6, le[3]); this.Pages(page).Add(label); continue; Label_06A2: Engine.AddTextMessage(le.Name); } this.Page = (num2 == 0) ? 1 : num2; }
public void AddTextMessage(string msg) { Engine.AddTextMessage(msg); }