public static void WriteLine(TEXT_TYPE Type, string Text) { if (Type == TEXT_TYPE.INFO) Console.ForegroundColor = ConsoleColor.White; else if (Type == TEXT_TYPE.WARNING) Console.ForegroundColor = ConsoleColor.Yellow; else Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("[" + DateTime.Now.ToString() + "] " + Type.ToString() + ": " + Text); }
public UOMessageEventArgs(Entity parent, string text, string name, ushort hue, MessageType type, byte font, TEXT_TYPE text_type, bool unicode = false, string lang = null) { Parent = parent; Text = text; Name = name; Hue = hue; Type = type; Font = font; Language = lang; AffixType = AffixType.None; IsUnicode = unicode; TextType = text_type; }
public static void WriteLine(TEXT_TYPE Type, string Text) { if (Type == TEXT_TYPE.INFO) { Console.ForegroundColor = ConsoleColor.White; } else if (Type == TEXT_TYPE.WARNING) { Console.ForegroundColor = ConsoleColor.Yellow; } else { Console.ForegroundColor = ConsoleColor.Red; } Console.WriteLine("[" + DateTime.Now.ToString() + "] " + Type.ToString() + ": " + Text); }
public static void WriteLine(TEXT_TYPE Type, string Text) { if (Type == TEXT_TYPE.INFO) { Console.ForegroundColor = ConsoleColor.White; } else if (Type == TEXT_TYPE.WARNING) { Console.ForegroundColor = ConsoleColor.Yellow; } else { Console.ForegroundColor = ConsoleColor.Red; } NiceHashMarket.Logger.MarketLogger.Information($"NICEHASHBOT: {Type} : {Text}"); }
public void Add(string text, ushort hue, string name, TEXT_TYPE type, bool isunicode = true) { JournalEntry entry = Entries.Count >= Constants.MAX_JOURNAL_HISTORY_COUNT ? Entries.RemoveFromFront() : new JournalEntry(); byte font = (byte)(isunicode ? 0 : 9); if (ProfileManager.Current != null && ProfileManager.Current.OverrideAllFonts) { font = ProfileManager.Current.ChatFont; isunicode = ProfileManager.Current.OverrideAllFontsIsUnicode; } DateTime timeNow = DateTime.Now; entry.Text = text; entry.Font = font; entry.Hue = hue; entry.Name = name; entry.IsUnicode = isunicode; entry.Time = timeNow; entry.TextType = type; if (ProfileManager.Current != null && ProfileManager.Current.ForceUnicodeJournal) { entry.Font = 0; entry.IsUnicode = true; } Entries.AddToBack(entry); EntryAdded.Raise(entry); if (_fileWriter == null && !_writerHasException) { CreateWriter(); } _fileWriter?.WriteLine($"[{timeNow:g}] {name}: {text}"); }
public static void HandleMessage(Entity parent, string text, string name, ushort hue, MessageType type, byte font, TEXT_TYPE text_type, bool unicode = false, string lang = null) { if (string.IsNullOrEmpty(text)) { return; } if (ProfileManager.Current != null && ProfileManager.Current.OverrideAllFonts) { font = ProfileManager.Current.ChatFont; unicode = ProfileManager.Current.OverrideAllFontsIsUnicode; } switch (type) { case MessageType.Command: case MessageType.Encoded: case MessageType.System: case MessageType.Party: case MessageType.Guild: case MessageType.Alliance: break; case MessageType.Spell: { //server hue color per default if (!string.IsNullOrEmpty(text) && SpellDefinition.WordToTargettype.TryGetValue(text, out SpellDefinition spell)) { if (ProfileManager.Current != null && ProfileManager.Current.EnabledSpellFormat && !string.IsNullOrWhiteSpace(ProfileManager.Current.SpellDisplayFormat)) { StringBuilder sb = new StringBuilder(ProfileManager.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 (ProfileManager.Current != null && ProfileManager.Current.EnabledSpellHue) { if (spell.TargetType == TargetType.Beneficial) { hue = ProfileManager.Current.BeneficHue; } else if (spell.TargetType == TargetType.Harmful) { hue = ProfileManager.Current.HarmfulHue; } else { hue = ProfileManager.Current.NeutralHue; } } } goto case MessageType.Label; } default: case MessageType.Focus: case MessageType.Whisper: case MessageType.Yell: case MessageType.Regular: case MessageType.Label: case MessageType.Limit3Spell: if (parent == null) { break; } TextObject msg = CreateMessage(text, hue, font, unicode, type, text_type); msg.Owner = parent; if (parent is Item it && !it.OnGround) { msg.X = DelayedObjectClickManager.X; msg.Y = DelayedObjectClickManager.Y; msg.IsTextGump = true; bool found = false; for (var gump = UIManager.Gumps.Last; gump != null; gump = gump.Previous) { var g = gump.Value; if (!g.IsDisposed) { switch (g) { case PaperDollGump paperDoll when g.LocalSerial == it.Container: paperDoll.AddText(msg); found = true; break; case ContainerGump container when g.LocalSerial == it.Container: container.AddText(msg); found = true; break; case TradingGump trade when g.LocalSerial == it.Container || trade.ID1 == it.Container || trade.ID2 == it.Container: trade.AddText(msg); found = true; break; } } if (found) { break; } } } parent.AddMessage(msg); break; //default: // if (parent == null) // break; // parent.AddMessage(type, text, font, hue, unicode); // break; } MessageReceived.Raise(new UOMessageEventArgs(parent, text, name, hue, type, font, text_type, unicode, lang), parent); }
public static TextObject CreateMessage(string msg, ushort hue, byte font, bool isunicode, MessageType type, TEXT_TYPE text_type) { if (ProfileManager.Current != null && ProfileManager.Current.OverrideAllFonts) { font = ProfileManager.Current.ChatFont; isunicode = ProfileManager.Current.OverrideAllFontsIsUnicode; } int width = isunicode ? FontsLoader.Instance.GetWidthUnicode(font, msg) : FontsLoader.Instance.GetWidthASCII(font, msg); if (width > 200) { width = isunicode ? FontsLoader.Instance.GetWidthExUnicode(font, msg, 200, TEXT_ALIGN_TYPE.TS_LEFT, (ushort)FontStyle.BlackBorder) : FontsLoader.Instance.GetWidthExASCII(font, msg, 200, TEXT_ALIGN_TYPE.TS_LEFT, (ushort)FontStyle.BlackBorder); } else { width = 0; } TextObject text_obj = TextObject.Create(); text_obj.Alpha = 0xFF; text_obj.Type = type; text_obj.Hue = hue; if (!isunicode && text_type == TEXT_TYPE.OBJECT) { hue = 0; } text_obj.RenderedText = RenderedText.Create(msg, hue, font, isunicode, FontStyle.BlackBorder, TEXT_ALIGN_TYPE.TS_LEFT, width, 30, false, false, text_type == TEXT_TYPE.OBJECT); text_obj.Time = CalculateTimeToLive(text_obj.RenderedText); text_obj.RenderedText.Hue = text_obj.Hue; return(text_obj); }