public static void SpawnNPC(ushort zoneId, uint templateId, ulong entityId, bool v, bool villager, int remainingEnrageTime) { if (Game.DB.MonsterDatabase.TryGetMonster(templateId, zoneId, out var m)) { if (TccUtils.IsWorldBoss(zoneId, templateId)) { if (m.IsBoss) { var msg = ChatManager.Instance.Factory.CreateMessage(ChatChannel.WorldBoss, "System", $"{ChatUtils.Font(m.Name)}{ChatUtils.Font(" is nearby.", "cccccc", 15)}"); ChatManager.Instance.AddChatMessage(msg); } } Game.NearbyNPC[entityId] = m.Name; FlyingGuardianDataProvider.InvokeProgressChanged(); if (villager) { return; } if (m.IsBoss) { WindowManager.ViewModels.NpcVM.AddOrUpdateNpc(entityId, m.MaxHP, m.MaxHP, m.IsBoss, HpChangeSource.CreatureChangeHp, templateId, zoneId, v, remainingEnrageTime); } else { if (App.Settings.NpcWindowSettings.HideAdds) { return; } WindowManager.ViewModels.NpcVM.AddOrUpdateNpc(entityId, m.MaxHP, m.MaxHP, m.IsBoss, HpChangeSource.CreatureChangeHp, templateId, zoneId, false, remainingEnrageTime); } } }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { var c = (string)value; try { if (string.IsNullOrEmpty(c)) { return(R.Brushes.ChatSystemGenericBrush); } if (targetType == typeof(Brush)) { return(new SolidColorBrush(MiscUtils.ParseColor(c))); } if (targetType == typeof(Color)) { return(MiscUtils.ParseColor(c)); } } catch (FormatException e) { Log.F($"[StringToFillConverter] Failed to parse color from {c}: {e}"); Log.Chat(ChatUtils.Font("An error occured while parsing last chat message. Please report to the deveolper attaching error.log.", R.Colors.HpColor.ToHex())); } return(R.Brushes.ChatSystemGenericBrush); }
public void AddTccMessage(string message) { if (!App.Settings.ChatEnabled) { return; } var msg = Factory.CreateMessage(ChatChannel.TCC, "System", ChatUtils.Font(message)); AddChatMessage(msg); }
private void OnPlayerChangeExp(S_PLAYER_CHANGE_EXP m) { if (Game.Me.Level == 70) { return; } var msg = ChatUtils.Font("You gained ") + ChatUtils.Font($"{m.GainedTotalExp - m.GainedRestedExp:N0}", Colors.GoldColor.ToHex()); if (m.GainedRestedExp > 0) { msg += ChatUtils.Font(" + ") + ChatUtils.Font($"{m.GainedRestedExp:N0}", Colors.ChatMegaphoneColor.ToHex()); } msg += ChatUtils.Font($" ("); msg += ChatUtils.Font($"{m.GainedTotalExp / (double)m.NextLevelExp:P3}", Colors.GoldColor.ToHex()); msg += ChatUtils.Font($") XP. Total: "); msg += ChatUtils.Font($"{m.LevelExp / (double)m.NextLevelExp:P3}", Colors.GoldColor.ToHex()); msg += ChatUtils.Font($"."); AddChatMessage(Factory.CreateMessage(ChatChannel.Exp, "System", msg)); }
private void AddCustom() { // party member login/out ------------------------------------------------------------------------ var guildieLogin = Messages["SMT_GUILD_MEMBER_LOGON_NO_MESSAGE"]; var guildieLogout = Messages["SMT_GUILD_MEMBER_LOGOUT"]; var memberLogin = new SystemMessageData(guildieLogin.Template, (int)ChatChannel.GroupAlerts); var memberLogout = new SystemMessageData(guildieLogout.Template, (int)ChatChannel.GroupAlerts); Messages["TCC_PARTY_MEMBER_LOGON"] = memberLogin; Messages["TCC_PARTY_MEMBER_LOGOUT"] = memberLogout; // damage received ------------------------------------------------------------------------------- var msg = ChatUtils.Font("Received ", "cccccc") + ChatUtils.Font("{Amount}") + ChatUtils.Font(" (", "cccccc") + ChatUtils.Font("{Perc}") + ChatUtils.Font(")", "cccccc") + ChatUtils.Font(" damage from ", "cccccc") + ChatUtils.Font("{Source}") + ChatUtils.Font(".", "cccccc"); var damageReceived = new SystemMessageData(msg, (int)ChatChannel.Damage); Messages["TCC_DAMAGE_RECEIVED"] = damageReceived; // --------------------- var msgCrit = ChatUtils.Font("Received ", "cccccc") + ChatUtils.Font("{Amount}") + ChatUtils.Font(" (", "cccccc") + ChatUtils.Font("{Perc}") + ChatUtils.Font(")", "cccccc") + ChatUtils.Font(" crit", R.Colors.ItemSuperiorColor.ToHex(true)) + ChatUtils.Font(" damage from ", "cccccc") + ChatUtils.Font("{Source}") + ChatUtils.Font(".", "cccccc"); var damageReceivedCrit = new SystemMessageData(msgCrit, (int)ChatChannel.Damage); Messages["TCC_DAMAGE_RECEIVED_CRIT"] = damageReceivedCrit; // --------------------- var msgUnk = ChatUtils.Font("Received ", "cccccc") + ChatUtils.Font("{Amount}") + ChatUtils.Font(" (", "cccccc") + ChatUtils.Font("{Perc}") + ChatUtils.Font(")", "cccccc") + ChatUtils.Font(" damage.", "cccccc"); var damageReceivedUnknown = new SystemMessageData(msgUnk, (int)ChatChannel.Damage); Messages["TCC_DAMAGE_RECEIVED_UNKNOWN"] = damageReceivedUnknown; // --------------------- var msgUnkCrit = ChatUtils.Font("Received ", "cccccc") + ChatUtils.Font("{Amount}") + ChatUtils.Font(" (", "cccccc") + ChatUtils.Font("{Perc}") + ChatUtils.Font(")", "cccccc") + ChatUtils.Font(" crit", R.Colors.ItemSuperiorColor.ToHex(true)) + ChatUtils.Font(" damage.", "cccccc"); var damageReceivedUnknownCrit = new SystemMessageData(msgUnkCrit, (int)ChatChannel.Damage); Messages["TCC_DAMAGE_RECEIVED_UNKNOWN_CRIT"] = damageReceivedUnknownCrit; // --------------------- var ench = Messages["SMT_MAX_ENCHANT_SUCCEED"]; var newEnch = new SystemMessageData(ChatUtils.Font(ench.Template, R.Colors.ChatSystemGenericColor.ToHex()), ench.ChatChannel); Messages["SMT_MAX_ENCHANT_SUCCEED"] = newEnch; }