예제 #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);
            }
예제 #5
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) && !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) });
예제 #11
0
 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[]
 {
 };
예제 #19
0
 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() });