public virtual string CompletedText(Traitor traitor) => CompletedTextId != null?GetCompletedText(traitor, CompletedTextId, CompletedTextKeys, CompletedTextValues(traitor)) : StatusText(traitor);
public virtual string StatusText(Traitor traitor) => GetStatusText(traitor, StatusTextId, StatusTextKeys, StatusTextValues(traitor));
public virtual string InfoText(Traitor traitor) => GetInfoText(traitor, InfoTextId, InfoTextKeys, InfoTextValues(traitor));
public override bool Start(Traitor traitor) { if (!base.Start(traitor)) { return(false); } if (targetPrefab != null) { return(true); } string targetPrefabTextId; if (percentage > 0f) { spawnAmount = (int)Math.Floor(Character.CharacterList.FindAll(c => c.TeamID == traitor.Character.TeamID && c != traitor.Character && !c.IsDead && (filter == null || filter(c))).Count *percentage); } if (spawnAmount > 1 && allowNew) { containedPrefab = FindItemPrefab(identifier); targetPrefab = FindItemPrefab(itemContainerId); if (containedPrefab == null || targetPrefab == null) { return(false); } targetPrefabTextId = containedPrefab.GetItemNameTextId(); } else { spawnAmount = 1; containedPrefab = null; targetPrefab = FindItemPrefab(identifier); if (targetPrefab == null) { return(false); } targetPrefabTextId = targetPrefab.GetItemNameTextId(); } targetNameText = targetPrefabTextId != null?TextManager.FormatServerMessage(targetPrefabTextId) : targetPrefab.Name; targetContainer = FindTargetContainer(Traitors, targetPrefab); if (targetContainer == null) { targetPrefab = null; targetContainer = null; return(false); } var containerPrefabTextId = targetContainer.Prefab.GetItemNameTextId(); targetContainerNameText = containerPrefabTextId != null?TextManager.FormatServerMessage(containerPrefabTextId) : targetContainer.Prefab.Name; var targetHullTextId = targetContainer.CurrentHull?.prefab.GetHullNameTextId(); targetHullNameText = targetHullTextId != null?TextManager.FormatServerMessage(targetHullTextId) : targetContainer?.CurrentHull?.DisplayName ?? ""; if (allowNew && !targetContainer.OwnInventory.IsFull()) { existingItems.Clear(); foreach (var item in targetContainer.OwnInventory.Items) { existingItems.Add(item); } Entity.Spawner.AddToSpawnQueue(targetPrefab, targetContainer.OwnInventory); target = null; } else if (allowExisting) { target = targetContainer.OwnInventory.FindItemByIdentifier(targetPrefab.Identifier); } else { targetPrefab = null; targetContainer = null; return(false); } return(true); }
protected internal override string GetInfoText(Traitor traitor, string textId, IEnumerable <string> keys, IEnumerable <string> values) { var infoText = base.GetInfoText(traitor, textId, keys, values); return(!string.IsNullOrEmpty(durationInfoTextId) && !infoText.Contains("[duration]") ? TextManager.FormatServerMessage(durationInfoTextId, new[] { "[infotext]", "[duration]" }, new[] { infoText, requiredDuration.ToString() }) : infoText); }
public override IEnumerable <string> InfoTextValues(Traitor traitor) => base.InfoTextValues(traitor).Concat(new string[] { $"{requiredDistance:0.00}" });
public override IEnumerable <string> InfoTextValues(Traitor traitor) => base.InfoTextValues(traitor).Concat(new string[] { string.Format("{0:0}", DestroyPercent * 100.0f), tagPrefabName ?? "" });
public override IEnumerable <string> InfoTextValues(Traitor traitor) => base.InfoTextValues(traitor).Concat(new string[] { string.Format("{0:0}", minimumFloodingAmount * 100.0f) });
public virtual IEnumerable <string> StatusTextValues(Traitor traitor) => new [] { InfoText(traitor), TextManager.FormatServerMessage(StatusValueTextId) };
public override IEnumerable <string> StatusTextValues(Traitor traitor) => base.StatusTextValues(traitor).Concat(new string[] { string.Format("{0:0}", replaceAmount * 100.0f) });
public override IEnumerable <string> InfoTextValues(Traitor traitor) => base.InfoTextValues(traitor).Concat(new string[] { $"{requiredCount - count}", $"{requiredCount}" });
public override IEnumerable <string> InfoTextValues(Traitor traitor) => base.InfoTextValues(traitor).Concat(new string[] { traitor.Mission.GetTargetNames(Targets) ?? "(unknown)", poisonName });
public override IEnumerable <string> InfoTextValues(Traitor traitor) => base.InfoTextValues(traitor).Concat(new string[] { tag ?? "", targetItemPrefabName ?? "", string.Format("{0:0}", conditionThreshold) });
protected internal override string GetInfoText(Traitor traitor, string textId, IEnumerable <string> keys, IEnumerable <string> values) { var infoText = base.GetInfoText(traitor, textId, keys, values); return(!string.IsNullOrEmpty(optionalInfoTextId) ? TextManager.FormatServerMessage(optionalInfoTextId, new[] { "[infotext]" }, new[] { infoText }) : infoText); }
public virtual bool IsStarted(Traitor traitor) => Traitors.Contains(traitor);
public virtual IEnumerable <string> InfoTextValues(Traitor traitor) => new string[] { };
public virtual bool Start(Traitor traitor) { Traitors.Add(traitor); return(true); }
public virtual IEnumerable <string> CompletedTextValues(Traitor traitor) => new string[] { };
public override IEnumerable <string> InfoTextValues(Traitor traitor) => base.InfoTextValues(traitor).Concat(new string[] { targetCharacterName });
protected virtual string FormatText(Traitor traitor, string textId, IEnumerable <string> keys, IEnumerable <string> values) => TextManager.FormatServerMessageWithGenderPronouns(traitor?.Character?.Info?.Gender ?? Gender.None, textId, keys, values);
protected internal override string GetInfoText(Traitor traitor, string textId, IEnumerable <string> keys, IEnumerable <string> values) { var infoText = base.GetInfoText(traitor, textId, keys, values); return(!string.IsNullOrEmpty(durationInfoTextId) ? TextManager.FormatServerMessage(durationInfoTextId, new[] { "[infotext]", "[duration]" }, new[] { infoText, $"{TimeSpan.FromSeconds(requiredDuration):g}" }) : infoText); }
protected internal virtual string GetCompletedText(Traitor traitor, string textId, IEnumerable <string> keys, IEnumerable <string> values) => FormatText(traitor, textId, keys, values);
public override IEnumerable <string> InfoTextValues(Traitor traitor) => base.InfoTextValues(traitor).Concat(new string[] { targetNameText ?? "", targetContainerNameText ?? "", targetHullNameText ?? "" });
public override IEnumerable <string> InfoTextValues(Traitor traitor) => base.InfoTextValues(traitor).Concat(new string[] { requiredDuration.ToString() });