Exemplo n.º 1
0
 private void AwardSolve(string userNickName, int ComponentValue)
 {
     if (OtherModes.ZenModeOn)
     {
         ComponentValue = (int)Math.Ceiling(ComponentValue * 0.20f);
     }
     if (userNickName == null)
     {
         TwitchPlaySettings.AddRewardBonus(ComponentValue);
     }
     else
     {
         string headerText = UnsupportedModule ? modInfo.moduleDisplayName : BombComponent.GetModuleDisplayName();
         IRCConnection.Instance.SendMessage(TwitchPlaySettings.data.AwardSolve, Code, userNickName, ComponentValue, headerText);
         string RecordMessageTone = $"Module ID: {Code} | Player: {userNickName} | Module Name: {headerText} | Value: {ComponentValue}";
         Leaderboard.Instance?.AddSolve(userNickName);
         if (!UserAccess.HasAccess(userNickName, AccessLevel.NoPoints))
         {
             Leaderboard.Instance?.AddScore(userNickName, ComponentValue);
         }
         else
         {
             TwitchPlaySettings.AddRewardBonus(ComponentValue);
         }
         TwitchPlaySettings.AppendToSolveStrikeLog(RecordMessageTone);
         TwitchPlaySettings.AppendToPlayerLog(userNickName);
     }
     if (OtherModes.TimeModeOn)
     {
         float time = OtherModes.GetAdjustedMultiplier() * ComponentValue;
         if (time < TwitchPlaySettings.data.TimeModeMinimumTimeGained)
         {
             BombCommander.timerComponent.TimeRemaining = BombCommander.CurrentTimer + TwitchPlaySettings.data.TimeModeMinimumTimeGained;
             IRCConnection.Instance.SendMessage("Bomb time increased by the minimum {0} seconds!", TwitchPlaySettings.data.TimeModeMinimumTimeGained);
         }
         else
         {
             BombCommander.timerComponent.TimeRemaining = BombCommander.CurrentTimer + time;
             IRCConnection.Instance.SendMessage("Bomb time increased by {0} seconds!", Math.Round(time, 1));
         }
         OtherModes.SetMultiplier(OtherModes.GetMultiplier() + TwitchPlaySettings.data.TimeModeSolveBonus);
     }
 }
Exemplo n.º 2
0
    private void AwardSolve(string userNickName, ICommandResponseNotifier responseNotifier, int ComponentValue)
    {
        string headerText = UnsupportedModule ? modInfo.moduleDisplayName : BombComponent.GetModuleDisplayName();

        IRCConnection.SendMessage(TwitchPlaySettings.data.AwardSolve, Code, userNickName, ComponentValue, headerText);
        string RecordMessageTone = $"Module ID: {Code} | Player: {userNickName} | Module Name: {headerText} | Value: {ComponentValue}";

        responseNotifier.ProcessResponse(CommandResponse.EndComplete, ComponentValue);
        TwitchPlaySettings.AppendToSolveStrikeLog(RecordMessageTone);
        TwitchPlaySettings.AppendToPlayerLog(userNickName);
        if (OtherModes.timedModeOn)
        {
            float multiplier = OtherModes.getMultiplier();
            float time       = multiplier * ComponentValue;
            BombCommander.timerComponent.TimeRemaining = BombCommander.CurrentTimer + time;
            IRCConnection.SendMessage("Bomb time increased by {0} seconds!", Math.Round(time, 1));
            if (multiplier < 10)
            {
                multiplier = multiplier + 0.1f;
                OtherModes.setMultiplier(multiplier);
            }
        }
    }
Exemplo n.º 3
0
    private void AwardStrikes(string userNickName, int strikeCount)
    {
        BombCommander BombCommander = BombMessageResponder.Instance.BombCommanders[0];
        int           strikePenalty = -5;

        strikePenalty = TwitchPlaySettings.data.EnableRewardMultipleStrikes ? (strikeCount * strikePenalty) : (Math.Min(strikePenalty, strikeCount * strikePenalty));

        IRCConnection.Instance.SendMessage(TwitchPlaySettings.data.AwardHoldableStrike,
                                           HoldableCommander.ID,
                                           strikeCount == 1 ? "a" : strikeCount.ToString(),
                                           strikeCount == 1 ? "" : "s",
                                           strikePenalty,
                                           userNickName,
                                           string.IsNullOrEmpty(StrikeMessage) ? "" : " caused by " + StrikeMessage);
        if (strikeCount <= 0)
        {
            return;
        }

        string RecordMessageTone = $"Holdable ID: {HoldableCommander.ID} | Player: {userNickName} | Strike";

        TwitchPlaySettings.AppendToSolveStrikeLog(RecordMessageTone, TwitchPlaySettings.data.EnableRewardMultipleStrikes ? strikeCount : 1);

        int originalReward = TwitchPlaySettings.GetRewardBonus();
        int currentReward  = Convert.ToInt32(originalReward * TwitchPlaySettings.data.AwardDropMultiplierOnStrike);

        TwitchPlaySettings.AddRewardBonus(currentReward - originalReward);
        if (currentReward != originalReward)
        {
            IRCConnection.Instance.SendMessage($"Reward {(currentReward > 0 ? "reduced" : "increased")} to {currentReward} points.");
        }
        if (OtherModes.TimeModeOn)
        {
            bool   multiDropped = OtherModes.DropMultiplier();
            float  multiplier   = OtherModes.GetMultiplier();
            string tempMessage;
            if (multiDropped)
            {
                tempMessage = "Multiplier reduced to " + Math.Round(multiplier, 1) + " and time";
            }
            else
            {
                tempMessage = $"Multiplier set at {TwitchPlaySettings.data.TimeModeMinMultiplier}, cannot be further reduced.  Time";
            }
            if (BombCommander.CurrentTimer < (TwitchPlaySettings.data.TimeModeMinimumTimeLost / TwitchPlaySettings.data.TimeModeTimerStrikePenalty))
            {
                BombCommander.timerComponent.TimeRemaining = BombCommander.CurrentTimer - TwitchPlaySettings.data.TimeModeMinimumTimeLost;
                tempMessage = tempMessage + $" reduced by {TwitchPlaySettings.data.TimeModeMinimumTimeLost} seconds.";
            }
            else
            {
                float  timeReducer = BombCommander.CurrentTimer * TwitchPlaySettings.data.TimeModeTimerStrikePenalty;
                double easyText    = Math.Round(timeReducer, 1);
                BombCommander.timerComponent.TimeRemaining = BombCommander.CurrentTimer - timeReducer;
                tempMessage = tempMessage + $" reduced by {Math.Round(TwitchPlaySettings.data.TimeModeTimerStrikePenalty * 100, 1)}%. ({easyText} seconds)";
            }
            IRCConnection.Instance.SendMessage(tempMessage);
            BombCommander.StrikeCount = 0;
            BombMessageResponder.moduleCameras?.UpdateStrikes();
        }

        Leaderboard.Instance?.AddScore(userNickName, strikePenalty);
        Leaderboard.Instance?.AddStrike(userNickName, strikeCount);
        StrikeMessage = string.Empty;
    }
Exemplo n.º 4
0
    private void AwardStrikes(string userNickName, ICommandResponseNotifier responseNotifier, int strikeCount)
    {
        string headerText    = BombComponent.GetModuleDisplayName();
        int    strikePenalty = modInfo.strikePenalty * (TwitchPlaySettings.data.EnableRewardMultipleStrikes ? strikeCount : 1);

        IRCConnection.SendMessage(TwitchPlaySettings.data.AwardStrike, Code, strikeCount == 1 ? "a" : strikeCount.ToString(), strikeCount == 1 ? "" : "s", 0, userNickName, string.IsNullOrEmpty(StrikeMessage) ? "" : " caused by " + StrikeMessage, headerText, strikePenalty);
        if (strikeCount <= 0)
        {
            return;
        }

        string RecordMessageTone = $"Module ID: {Code} | Player: {userNickName} | Module Name: {headerText} | Strike";

        TwitchPlaySettings.AppendToSolveStrikeLog(RecordMessageTone, TwitchPlaySettings.data.EnableRewardMultipleStrikes ? strikeCount : 1);

        int currentReward = TwitchPlaySettings.GetRewardBonus();

        currentReward = Convert.ToInt32(currentReward * .80);
        TwitchPlaySettings.SetRewardBonus(currentReward);
        IRCConnection.SendMessage("Reward reduced to " + currentReward + " points.");
        if (OtherModes.timedModeOn)
        {
            bool   multiDropped = OtherModes.dropMultiplier();
            float  multiplier   = OtherModes.getMultiplier();
            string tempMessage;
            if (multiDropped)
            {
                tempMessage = "Multiplier reduced to " + Math.Round(multiplier, 1) + " and time";
            }
            else
            {
                tempMessage = "Mutliplier set at 1, cannot be further reduced.  Time";
            }
            if (BombCommander.CurrentTimer < 60)
            {
                BombCommander.timerComponent.TimeRemaining = BombCommander.CurrentTimer - 15;
                tempMessage = tempMessage + " reduced by 15 seconds.";
            }
            else
            {
                float  timeReducer = BombCommander.CurrentTimer * .25f;
                double easyText    = Math.Round(timeReducer, 1);
                BombCommander.timerComponent.TimeRemaining = BombCommander.CurrentTimer - timeReducer;
                tempMessage = tempMessage + " reduced by 25%. (" + easyText + " seconds)";
            }
            IRCConnection.SendMessage(tempMessage);
        }
        if (responseNotifier != null)
        {
            responseNotifier.ProcessResponse(CommandResponse.EndErrorSubtractScore, strikePenalty);
            responseNotifier.ProcessResponse(CommandResponse.EndError, strikeCount);
        }
        else
        {
            ComponentHandle.leaderboard.AddScore(userNickName, strikePenalty);
            ComponentHandle.leaderboard.AddStrike(userNickName, strikeCount);
        }
        if (OtherModes.timedModeOn)
        {
            BombCommander.StrikeCount = 0;
            BombMessageResponder.moduleCameras.UpdateStrikes();
        }
        StrikeMessage = string.Empty;
    }
Exemplo n.º 5
0
    private void AwardStrikes(string userNickName, int strikeCount)
    {
        string headerText    = UnsupportedModule ? modInfo.moduleDisplayName : BombComponent.GetModuleDisplayName();
        int    strikePenalty = modInfo.strikePenalty * (TwitchPlaySettings.data.EnableRewardMultipleStrikes ? strikeCount : 1);

        if (OtherModes.ZenModeOn)
        {
            strikePenalty = (int)(strikePenalty * 0.20f);
        }
        IRCConnection.Instance.SendMessage(TwitchPlaySettings.data.AwardStrike, Code, strikeCount == 1 ? "a" : strikeCount.ToString(), strikeCount == 1 ? "" : "s", 0, userNickName, string.IsNullOrEmpty(StrikeMessage) ? "" : " caused by " + StrikeMessage, headerText, strikePenalty);
        if (strikeCount <= 0)
        {
            return;
        }

        string RecordMessageTone = $"Module ID: {Code} | Player: {userNickName} | Module Name: {headerText} | Strike";

        TwitchPlaySettings.AppendToSolveStrikeLog(RecordMessageTone, TwitchPlaySettings.data.EnableRewardMultipleStrikes ? strikeCount : 1);

        int originalReward = TwitchPlaySettings.GetRewardBonus();
        int currentReward  = Convert.ToInt32(originalReward * TwitchPlaySettings.data.AwardDropMultiplierOnStrike);

        TwitchPlaySettings.SetRewardBonus(currentReward);
        if (currentReward != originalReward)
        {
            IRCConnection.Instance.SendMessage($"Reward {(currentReward > 0 ? "reduced" : "increased")} to {currentReward} points.");
        }
        if (OtherModes.TimeModeOn)
        {
            float  originalMultiplier = OtherModes.GetAdjustedMultiplier();
            bool   multiDropped       = OtherModes.DropMultiplier();
            float  multiplier         = OtherModes.GetAdjustedMultiplier();
            string tempMessage;
            if (multiDropped)
            {
                if (Mathf.Abs(originalMultiplier - multiplier) >= 0.1)
                {
                    tempMessage = "Multiplier reduced to " + Math.Round(multiplier, 1) + " and time";
                }
                else
                {
                    tempMessage = "Time";
                }
            }
            else
            {
                tempMessage = $"Multiplier set at {TwitchPlaySettings.data.TimeModeMinMultiplier}, cannot be further reduced.  Time";
            }
            if (BombCommander.CurrentTimer < (TwitchPlaySettings.data.TimeModeMinimumTimeLost / TwitchPlaySettings.data.TimeModeTimerStrikePenalty))
            {
                BombCommander.timerComponent.TimeRemaining = BombCommander.CurrentTimer - TwitchPlaySettings.data.TimeModeMinimumTimeLost;
                tempMessage = tempMessage + $" reduced by {TwitchPlaySettings.data.TimeModeMinimumTimeLost} seconds.";
            }
            else
            {
                float  timeReducer = BombCommander.CurrentTimer * TwitchPlaySettings.data.TimeModeTimerStrikePenalty;
                double easyText    = Math.Round(timeReducer, 1);
                BombCommander.timerComponent.TimeRemaining = BombCommander.CurrentTimer - timeReducer;
                tempMessage = tempMessage + $" reduced by {Math.Round(TwitchPlaySettings.data.TimeModeTimerStrikePenalty * 100, 1)}%. ({easyText} seconds)";
            }
            IRCConnection.Instance.SendMessage(tempMessage);
            BombCommander.StrikeCount = 0;
            BombMessageResponder.moduleCameras.UpdateStrikes();
        }
        if (OtherModes.ZenModeOn)
        {
            BombCommander.StrikeLimit += strikeCount;
        }

        Leaderboard.Instance.AddScore(userNickName, strikePenalty);
        Leaderboard.Instance.AddStrike(userNickName, strikeCount);
        StrikeMessage = string.Empty;
    }