示例#1
0
 public virtual string CompletedText(Traitor traitor) => CompletedTextId != null?GetCompletedText(traitor, CompletedTextId, CompletedTextKeys, CompletedTextValues(traitor)) : StatusText(traitor);
示例#2
0
 public virtual string StatusText(Traitor traitor) => GetStatusText(traitor, StatusTextId, StatusTextKeys, StatusTextValues(traitor));
示例#3
0
 public virtual string InfoText(Traitor traitor) => GetInfoText(traitor, InfoTextId, InfoTextKeys, InfoTextValues(traitor));
示例#4
0
            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}" });
示例#7
0
 public override IEnumerable <string> InfoTextValues(Traitor traitor) => base.InfoTextValues(traitor).Concat(new string[] { string.Format("{0:0}", DestroyPercent * 100.0f), tagPrefabName ?? "" });
示例#8
0
 public override IEnumerable <string> InfoTextValues(Traitor traitor) => base.InfoTextValues(traitor).Concat(new string[] { string.Format("{0:0}", minimumFloodingAmount * 100.0f) });
示例#9
0
 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}" });
示例#12
0
 public override IEnumerable <string> InfoTextValues(Traitor traitor) => base.InfoTextValues(traitor).Concat(new string[] { traitor.Mission.GetTargetNames(Targets) ?? "(unknown)", poisonName });
示例#13
0
 public override IEnumerable <string> InfoTextValues(Traitor traitor) => base.InfoTextValues(traitor).Concat(new string[] { tag ?? "", targetItemPrefabName ?? "", string.Format("{0:0}", conditionThreshold) });
示例#14
0
            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);
            }
示例#15
0
 public virtual bool IsStarted(Traitor traitor) => Traitors.Contains(traitor);
示例#16
0
 public virtual IEnumerable <string> InfoTextValues(Traitor traitor) => new string[]
 {
 };
示例#17
0
 public virtual bool Start(Traitor traitor)
 {
     Traitors.Add(traitor);
     return(true);
 }
示例#18
0
 public virtual IEnumerable <string> CompletedTextValues(Traitor traitor) => new string[]
 {
 };
 public override IEnumerable <string> InfoTextValues(Traitor traitor) => base.InfoTextValues(traitor).Concat(new string[] { targetCharacterName });
示例#20
0
 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);
示例#21
0
            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);
            }
示例#22
0
 protected internal virtual string GetCompletedText(Traitor traitor, string textId, IEnumerable <string> keys, IEnumerable <string> values) => FormatText(traitor, textId, keys, values);
示例#23
0
 public override IEnumerable <string> InfoTextValues(Traitor traitor) => base.InfoTextValues(traitor).Concat(new string[] { targetNameText ?? "", targetContainerNameText ?? "", targetHullNameText ?? "" });
示例#24
0
 public override IEnumerable <string> InfoTextValues(Traitor traitor) => base.InfoTextValues(traitor).Concat(new string[] { requiredDuration.ToString() });