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