public static void SingleClick(Serial serial) { // add request context menu Socket.Send(new PClickRequest(serial)); Entity entity = World.Get(serial); if (entity != null) { entity.IsClicked = true; } }
public static void SendCloseStatus(uint serial, bool force = false) { if (Client.Version >= ClientVersion.CV_200 && World.InGame) { Entity ent = World.Get(serial); if (ent != null && ent.HitsRequest >= HitsRequestStatus.Pending) { ent.HitsRequest = HitsRequestStatus.None; force = true; } if (force && SerialHelper.IsValid(serial)) { //ent = ent ?? World.Player; //ent.AddMessage(MessageType.Regular, $"PACKET REMOVED SENT: 0x{serial:X8}", 3, 0x34 + 10, true, TextType.OBJECT); Socket.Send_CloseStatusBarGump(serial); } } }
public static void RequestMobileStatus(uint serial, bool force = false) { if (World.InGame) { Entity ent = World.Get(serial); if (ent != null && !ent.HitsRequested) { ent.HitsRequested = true; force = true; } if (force && SerialHelper.IsValid(serial)) { //ent = ent ?? World.Player; //ent.AddMessage(MessageType.Regular, $"PACKET SENT: 0x{serial:X8}", 3, 0x34, true, TextType.OBJECT); Socket.Send(new PStatusRequest(serial)); } } }
public static void MessageOverhead(string message, ushort hue, Serial entity) { Print(World.Get(entity), message, hue); }
public static void MessageOverhead(string message, uint entity) { Print(World.Get(entity), message); }
public static void HandleMessage(Entity parent, string text, string name, Hue hue, MessageType type, MessageFont font, bool unicode = false, string lang = null) { switch (type) { case MessageType.Focus: case MessageType.Whisper: case MessageType.Yell: case MessageType.Spell: case MessageType.Regular: case MessageType.Label: if (parent == null) { break; } if (parent is Item it && !it.OnGround) { Gump gump = Engine.UI.GetByLocalSerial <Gump>(it.Container); if (gump is PaperDollGump paperDoll) { var inter = paperDoll .FindControls <PaperDollInteractable>() .FirstOrDefault(); var f = inter?.FindControls <ItemGump>() .SingleOrDefault(s => s.Item == it); if (f != null) { f.AddLabel(text, hue, (byte)font, unicode); } else { paperDoll.FindControls <EquipmentSlot>()? .SelectMany(s => s.Children) .OfType <ItemGump>() .SingleOrDefault(s => s.Item == it)? .AddLabel(text, hue, (byte)font, unicode); } } else if (gump is ContainerGump container) { container .FindControls <ItemGump>()? .SingleOrDefault(s => s.Item == it)? .AddLabel(text, hue, (byte)font, unicode); } else { Entity ent = World.Get(it.RootContainer); if (ent == null || ent.IsDestroyed) { break; } gump = Engine.UI.GetByLocalSerial <TradingGump>(ent); if (gump != null) { gump.FindControls <DataBox>()? .SelectMany(s => s.Children) .OfType <ItemGump>() .SingleOrDefault(s => s.Item == it)? .AddLabel(text, hue, (byte)font, unicode); } else { Item item = ent.Items.FirstOrDefault(s => s.Graphic == 0x1E5E); if (item == null) { break; } gump = Engine.UI.Gumps.OfType <TradingGump>().FirstOrDefault(s => s.ID1 == item || s.ID2 == item); if (gump != null) { gump.FindControls <DataBox>()? .SelectMany(s => s.Children) .OfType <ItemGump>() .SingleOrDefault(s => s.Item == it)? .AddLabel(text, hue, (byte)font, unicode); } else { Log.Message(LogTypes.Warning, "Missing label handler for this control: 'UNKNOWN'. Report it!!"); } } } } else { parent.AddOverhead(type, text, (byte)font, hue, unicode); } break;
public static void HandleMessage(Entity parent, string text, string name, Hue hue, MessageType type, byte font, bool unicode = false, string lang = null) { if (Engine.Profile.Current != null && Engine.Profile.Current.OverrideAllFonts) { font = Engine.Profile.Current.ChatFont; unicode = Engine.Profile.Current.OverrideAllFontsIsUnicode; } switch (type) { case MessageType.Spell: { //server hue color per default if (!string.IsNullOrEmpty(text) && SpellDefinition.WordToTargettype.TryGetValue(text, out SpellDefinition spell)) { if (Engine.Profile.Current != null && Engine.Profile.Current.EnabledSpellFormat && !string.IsNullOrWhiteSpace(Engine.Profile.Current.SpellDisplayFormat)) { StringBuilder sb = new StringBuilder(Engine.Profile.Current.SpellDisplayFormat); sb.Replace("{power}", spell.PowerWords); sb.Replace("{spell}", spell.Name); text = sb.ToString().Trim(); } //server hue color per default if not enabled if (Engine.Profile.Current != null && Engine.Profile.Current.EnabledSpellHue) { if (spell.TargetType == TargetType.Beneficial) { hue = Engine.Profile.Current.BeneficHue; } else if (spell.TargetType == TargetType.Harmful) { hue = Engine.Profile.Current.HarmfulHue; } else { hue = Engine.Profile.Current.NeutralHue; } } } goto case MessageType.Label; } case MessageType.Focus: case MessageType.Whisper: case MessageType.Yell: case MessageType.Regular: case MessageType.Label: if (parent == null) { break; } MessageInfo msg = CreateMessage(text, hue, font, unicode, type); msg.Owner = parent; if (parent is Item it && !it.OnGround) { msg.X = Mouse.LastClickPosition.X; msg.Y = Mouse.LastClickPosition.Y; Gump gump = Engine.UI.GetGump <Gump>(it.Container); if (gump is PaperDollGump paperDoll) { msg.X -= paperDoll.ScreenCoordinateX; msg.Y -= paperDoll.ScreenCoordinateY; paperDoll.AddText(msg); } else if (gump is ContainerGump container) { msg.X -= container.ScreenCoordinateX; msg.Y -= container.ScreenCoordinateY; container.AddText(msg); } else { Entity ent = World.Get(it.RootContainer); if (ent == null || ent.IsDestroyed) { break; } var trade = Engine.UI.GetGump <TradingGump>(ent); if (trade == null) { Item item = ent.Items.FirstOrDefault(s => s.Graphic == 0x1E5E); if (item == null) { break; } trade = Engine.UI.Gumps.OfType <TradingGump>().FirstOrDefault(s => s.ID1 == item || s.ID2 == item); } if (trade != null) { msg.X -= trade.ScreenCoordinateX; msg.Y -= trade.ScreenCoordinateY; trade.AddText(msg); } else { Log.Message(LogTypes.Warning, "Missing label handler for this control: 'UNKNOWN'. Report it!!"); } } } parent.AddMessage(msg); break; case MessageType.Emote: if (parent == null) { break; } msg = CreateMessage($"*{text}*", hue, font, unicode, type); parent.AddMessage(msg); break; case MessageType.Command: case MessageType.Encoded: case MessageType.System: case MessageType.Party: case MessageType.Guild: case MessageType.Alliance: break; default: if (parent == null) { break; } msg = CreateMessage(text, hue, font, unicode, type); parent.AddMessage(msg); break; } MessageReceived.Raise(new UOMessageEventArgs(parent, text, name, hue, type, font, unicode, lang), parent); }
public static void MessageOverhead(string message, Serial entity) => World.Get(entity)?.Print(message);
public static void HandleMessage(Entity parent, string text, string name, Hue hue, MessageType type, byte font, bool unicode = false, string lang = null) { switch (type) { case MessageType.Spell: { //server hue color per default if (!string.IsNullOrEmpty(text) && SpellDefinition.WordToTargettype.TryGetValue(text, out SpellDefinition spell)) { if (Engine.Profile.Current.EnabledSpellFormat && !string.IsNullOrWhiteSpace(Engine.Profile.Current.SpellDisplayFormat)) { StringBuilder sb = new StringBuilder(Engine.Profile.Current.SpellDisplayFormat); sb.Replace("{power}", spell.PowerWords); sb.Replace("{spell}", spell.Name); text = sb.ToString().Trim(); } //server hue color per default if not enabled if (Engine.Profile.Current.EnabledSpellHue) { if (spell.TargetType == TargetType.Beneficial) { hue = Engine.Profile.Current.BeneficHue; } else if (spell.TargetType == TargetType.Harmful) { hue = Engine.Profile.Current.HarmfulHue; } else { hue = Engine.Profile.Current.NeutralHue; } } } goto case MessageType.Label; } case MessageType.Focus: case MessageType.Whisper: case MessageType.Yell: case MessageType.Regular: case MessageType.Label: if (parent == null) { break; } if (parent is Item it && !it.OnGround) { Gump gump = Engine.UI.GetControl <Gump>(it.Container); if (gump is PaperDollGump paperDoll) { paperDoll.AddLabel(text, hue, font, unicode); } else if (gump is ContainerGump container) { container.AddLabel(text, hue, font, unicode); } else { Entity ent = World.Get(it.RootContainer); if (ent == null || ent.IsDestroyed) { break; } var trade = Engine.UI.GetControl <TradingGump>(ent); if (trade == null) { Item item = ent.Items.FirstOrDefault(s => s.Graphic == 0x1E5E); if (item == null) { break; } trade = Engine.UI.Gumps.OfType <TradingGump>().FirstOrDefault(s => s.ID1 == item || s.ID2 == item); } if (trade != null) { trade.AddLabel(text, hue, font, unicode); } else { Log.Message(LogTypes.Warning, "Missing label handler for this control: 'UNKNOWN'. Report it!!"); } } } else { parent.AddOverhead(type, text, font, hue, unicode); } break;