public object Convert(object?value, Type targetType, object parameter, CultureInfo culture) { if (value == null) { return(""); } var id = (ulong)value; return(Game.IsMe(id) ? Game.Me.Name : TccUtils.IsEntitySpawned(id) ? TccUtils.GetEntityName(id) : ""); }
public object?Convert(object?value, Type targetType, object parameter, CultureInfo culture) { if (value == null) { return(null); } var id = (ulong)value; var cl = Game.IsMe(id) ? Game.Me.Class : TccUtils.IsEntitySpawned(id) ? TccUtils.GetEntityClass(id) : Class.None; if (cl == Class.None) { return(null); } return(TccUtils.SvgClass(cl)); }
private void AddDamageReceivedMessage(ulong source, ulong target, long diff, long maxHP, bool crit) { if (!App.Settings.ChatEnabled) { return; } if (!Game.IsMe(target) || diff > 0 || target == source || source == 0 || !TccUtils.IsEntitySpawned(source)) { return; } var srcName = TccUtils.GetEntityName(source); var parameters = $"@0\vAmount\v{-diff}\vPerc\v{-diff / (double) maxHP:P}{(srcName != "" ? $"\vSource\v{srcName}" : "")}"; SystemMessagesProcessor.AnalyzeMessage(parameters, srcName == "" ? !crit ? "TCC_DAMAGE_RECEIVED_UNKNOWN" : "TCC_DAMAGE_RECEIVED_UNKNOWN_CRIT" : !crit ? "TCC_DAMAGE_RECEIVED" : "TCC_DAMAGE_RECEIVED_CRIT"); }