Exemplo n.º 1
0
        public override void Execute(ITwitchCommand chatCommand)
        {
            if (_target == null)
            {
                return;
            }

            var response = $"@{chatCommand.ChatMessage.Username} → ";
            var query    = chatCommand.Message.Split(' ').Skip(1).FirstOrDefault();

            if (!query.NullOrEmpty())
            {
                var result =
                    DefDatabase <PawnCapacityDef> .AllDefsListForReading.FirstOrDefault(
                        d => d.defName.EqualsIgnoreCase(query)
                        );

                response += result == null
                    ? $"No capacity named \"{query}\" could be found."
                    : GetCapacityReport(_target, result);
            }
            else
            {
                response += GetHealthReport(_target);
            }

            TwitchWrapper.SendChatMessage(response);
        }
Exemplo n.º 2
0
        public override void Execute(ITwitchCommand chatCommand)
        {
            if (_target == null)
            {
                return;
            }

            var response = $"@{chatCommand.ChatMessage.Username} → ";

            if (!_target.workSettings?.EverWork ?? true)
            {
                TwitchWrapper.SendChatMessage($"{response}Your pawn is incapable of work.");
                return;
            }

            var naturalOrder = WorkTypeDefsUtility.WorkTypeDefsInPriorityOrder;
            var priorities   = naturalOrder.OrderByDescending(p => _target.workSettings.GetPriority(p))
                               .ThenBy(p => p.naturalPriority)
                               .Reverse()
                               .Where(p => _target.workSettings.GetPriority(p) > 0)
                               .Select(p => $"{p}: {_target.workSettings.GetPriority(p).ToString()}");

            response += "Your work priorities are: ";
            response += string.Join(", ", priorities.ToArray());

            TwitchWrapper.SendChatMessage(response);
        }
        public override void Execute(ITwitchCommand chatCommand)
        {
            if (_target == null)
            {
                return;
            }

            var response = $"@{chatCommand.ChatMessage.Username} → Backstory: ";

            response += string.Join(", ", _target.story.AllBackstories.Select(s => s.title).ToArray()).CapitalizeFirst();
            response += " | ";

            switch (_target.gender)
            {
            case Gender.Female:
                response += "♀";
                break;

            case Gender.Male:
                response += "♂";
                break;

            case Gender.None:
                response += "⚪";
                break;
            }

            var workContainer = new StringBuilder();
            var workTags      = _target.story.DisabledWorkTagsBackstoryAndTraits;

            if (workTags == WorkTags.None)
            {
                workContainer.Append("(" + "NoneLower".Translate() + " ), ");
            }
            else
            {
                var tags  = GetWorkTags(workTags);
                var start = true;

                foreach (var tag in tags)
                {
                    workContainer.Append(start ? tag.LabelTranslated().CapitalizeFirst() : tag.LabelTranslated());
                    workContainer.Append(", ");
                    start = false;
                }
            }

            var result = workContainer.ToString();

            result = result.Substring(0, result.Length - 2);

            response += $" | Incapable of: {result}";
            response += " | Traits: ";
            response += string.Join(", ", _target.story.traits.allTraits.Select(t => t.LabelCap));

            TwitchWrapper.SendChatMessage(response);
        }
Exemplo n.º 4
0
        public override bool CanExecute(ITwitchCommand twitchCommand)
        {
            if (!base.CanExecute(twitchCommand))
            {
                return(false);
            }

            return(true);
        }
        public override bool CanExecute(ITwitchCommand twitchCommand)
        {
            if (!base.CanExecute(twitchCommand) || !PawnQueueSettings.joinableQueue)
            {
                return(false);
            }

            return(true);
        }
        public override void Execute(ITwitchCommand twitchCommand)
        {
            GameComponentPawnTracking component = Current.Game.GetComponent <GameComponentPawnTracking>();

            if (component.TryAddUsernameToQueue(twitchCommand.Username))
            {
                TwitchWrapper.SendChatMessage($"@{twitchCommand.Username} → You've joined the pawn queue.");
            }
            else
            {
                TwitchWrapper.SendChatMessage($"@{twitchCommand.Username} unable to join pawn queue.");
            }
        }
Exemplo n.º 7
0
        public override void Execute(ITwitchCommand chatCommand)
        {
            if (_target == null)
            {
                return;
            }

            var response = $"@{chatCommand.ChatMessage.Username} → ";

            if (!_target.health.hediffSet?.hediffs?.Any() ?? true)
            {
                response += "No health conditions.";
                TwitchWrapper.SendChatMessage(response);
                return;
            }

            var grouped = GetVisibleHediffGroupsInOrder(_target);
            var tMin    = _target.GetStatValue(StatDefOf.ComfyTemperatureMin).ToStringTemperature();
            var tMax    = _target.GetStatValue(StatDefOf.ComfyTemperatureMax).ToStringTemperature();

            response += $"🌡️{tMin}~{tMax}";

            foreach (var group in grouped)
            {
                var part      = group.Key?.LabelCap ?? "WholeBody".Translate();
                var container = new List <string>();

                foreach (var pGrouped in group.GroupBy(p => p.UIGroupKey))
                {
                    var segment    = pGrouped.First().LabelCap;
                    var bleedCount = pGrouped.Count(i => i.Bleeding);
                    var total      = pGrouped.Count();

                    if (total != 1)
                    {
                        segment += $" x{total.ToString()}";
                    }

                    if (bleedCount > 0)
                    {
                        segment = "🩸" + segment;
                    }

                    container.Add(segment);
                }

                response += " | " + part + ": " + string.Join(", ", container.ToArray());
            }

            TwitchWrapper.SendChatMessage(response);
        }
Exemplo n.º 8
0
        public override bool CanExecute(ITwitchCommand chatCommand)
        {
            if (!base.CanExecute(chatCommand))
            {
                return(false);
            }

            var component = Current.Game.GetComponent <GameComponentPawnTracking>();

            if (component.TryGetPawnAssignedToUser(chatCommand.ChatMessage.Username, out _target))
            {
                return(true);
            }

            TwitchWrapper.SendChatMessage($"@{chatCommand.ChatMessage.Username} → You're already in this colony.");
            return(false);
        }
        public override bool CanExecute(ITwitchCommand chatCommand)
        {
            if (!base.CanExecute(chatCommand) || !PawnQueueSettings.pawnStoryCommand)
            {
                return(false);
            }

            var component = Current.Game.GetComponent <GameComponentPawnTracking>();

            if (component?.TryGetPawnAssignedToUser(chatCommand.ChatMessage.Username, out _target) == true)
            {
                return(true);
            }

            TwitchWrapper.SendChatMessage($"@{chatCommand.ChatMessage.Username} → You're not in the colony.");
            return(false);
        }
Exemplo n.º 10
0
        public bool TryExecute(ITwitchCommand twitchCommand)
        {
            try
            {
                CommandMethod method = (CommandMethod)Activator.CreateInstance(commandClass, this);

                if (!method.CanExecute(twitchCommand))
                {
                    return(false);
                }

                method.Execute(twitchCommand);
            }
            catch (Exception e)
            {
                Log.Error(e.Message);
            }

            return(true);
        }
Exemplo n.º 11
0
        public virtual bool CanExecute(ITwitchCommand twitchCommand)
        {
            // If command not enabled
            if (!command.enabled)
            {
                return(false);
            }

            // If command requires broadcaster status and message not from broadcaster
            if (command.requiresBroadcaster && twitchCommand.ChatMessage != null && !twitchCommand.ChatMessage.IsBroadcaster)
            {
                return(false);
            }

            // If command requires moderator status and message not from broadcaster or moderator
            if (command.requiresMod && twitchCommand.ChatMessage != null && (!twitchCommand.ChatMessage.IsBroadcaster && !twitchCommand.ChatMessage.IsModerator))
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 12
0
        public override void Execute(ITwitchCommand chatCommand)
        {
            if (_target == null)
            {
                return;
            }

            var payload = "";
            var sharp   = CalculateArmorRating(_target, StatDefOf.ArmorRating_Sharp);
            var blunt   = CalculateArmorRating(_target, StatDefOf.ArmorRating_Blunt);
            var heat    = CalculateArmorRating(_target, StatDefOf.ArmorRating_Heat);

            if (sharp > 0)
            {
                payload += $"🗡️ {sharp.ToStringPercent()}";
            }

            if (blunt > 0)
            {
                payload += $"🧱 {blunt.ToStringPercent()}";
            }

            if (heat > 0)
            {
                payload += $"🔥 {heat.ToStringPercent()}";
            }

            var e = _target.equipment;

            if (e?.AllEquipmentListForReading?.Count > 0)
            {
                payload += "|";

                var equipment = e.AllEquipmentListForReading;
                payload += string.Join(", ", equipment.Select(item => item.LabelCap).ToArray());
            }

            TwitchWrapper.SendChatMessage(payload);
        }
        public override void Execute(ITwitchCommand chatCommand)
        {
            if (_target == null)
            {
                return;
            }

            var response = $"@{chatCommand.ChatMessage.Username} → Your skill levels are: ";

            var skills = _target.skills.skills;

            for (var i = 0; i < skills.Count; i++)
            {
                var skill = skills[i];
                response += $"{skill.def.LabelCap.RawText}: ";
                response += skill.TotallyDisabled ? "-" : skill.levelInt.ToString();

                switch (skill.passion)
                {
                case Passion.Major:
                    response += "🔥🔥";
                    break;

                case Passion.Minor:
                    response += "🔥";
                    break;
                }

                if (i != skills.Count - 1)
                {
                    response += ", ";
                }
            }

            TwitchWrapper.SendChatMessage(response);
        }
Exemplo n.º 14
0
        public override void Execute(ITwitchCommand chatCommand)
        {
            if (_target == null)
            {
                return;
            }

            var response = $"@{chatCommand.ChatMessage.Username} → Your needs are: ";

            var container = new StringBuilder();
            var needs     = _target.needs.AllNeeds;

            foreach (var need in needs)
            {
                container.Append($"{need.LabelCap}: {need.CurLevelPercentage.ToStringPercent()}");
                container.Append(", ");
            }

            var result = container.ToString();

            response += result.Substring(0, result.Length - 2);

            TwitchWrapper.SendChatMessage(response);
        }
Exemplo n.º 15
0
 public virtual void Execute(ITwitchCommand twitchCommand)
 {
 }
Exemplo n.º 16
0
 public override void Execute(ITwitchCommand twitchCommand)
 {
     TwitchWrapper.SendChatMessage("Hello World!");
 }