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); } } }
public void UpdateConfidence() { if (OtherModes.timedModeOn) { float timedMultiplier = OtherModes.getMultiplier(); confidencePrefab.color = Color.yellow; string conf = "x" + String.Format("{0:0.0}", timedMultiplier); string pts = "+" + String.Format("{0:0}", TwitchPlaySettings.GetRewardBonus()); confidencePrefab.text = pts; strikesPrefab.color = Color.yellow; strikeLimitPrefab.color = Color.yellow; strikesPrefab.text = conf; strikeLimitPrefab.text = ""; } // if (OtherModes.vsModeOn) // { // int bossHealth = OtherModes.getBossHealth(); // int teamHealth = OtherModes.getTeamHealth(); // // } else { confidencePrefab.color = Color.yellow; string pts = "+" + String.Format("{0:0}", TwitchPlaySettings.GetRewardBonus()); confidencePrefab.text = pts; // int previousSuccess = (int)(currentSuccess * 100); // currentSuccess = PlayerSuccessRating; // // if (previousSuccess != (int)(currentSuccess * 100)) // { // float minHue = 0.0f; // red (0deg) // float maxHue = (float)1 / 3; // green (120deg) // float minBeforeValueDown = 0.25f; // float maxBeforeSaturationDown = 0.75f; // float minValue = 0.25f; // float minSaturation = 0.0f; // float lowSuccessDesaturationSpeed = 3.0f; // // float hueSuccessRange = maxBeforeSaturationDown - minBeforeValueDown; // float hueRange = maxHue - minHue; // float valueRange = 1.0f - minValue; // float saturationRange = 1.0f - minSaturation; // // float hue, pointOnScale; // float saturation = 1.0f; // float value = 1.0f; // // if (currentSuccess < minBeforeValueDown) // { // // At very low ratings, move from red to dark grey // hue = minHue; // pointOnScale = (currentSuccess - (minBeforeValueDown / lowSuccessDesaturationSpeed)) * lowSuccessDesaturationSpeed; // pointOnScale = Math.Max(pointOnScale, 0.0f) / minBeforeValueDown; // saturation = minSaturation + (saturationRange * pointOnScale); // pointOnScale = currentSuccess / maxBeforeSaturationDown; // value = minValue + (valueRange * pointOnScale); // } // else if (currentSuccess > maxBeforeSaturationDown) // { // // At very high ratings, move from green to white // hue = maxHue; // pointOnScale = ((1.0f - currentSuccess) / (1.0f - maxBeforeSaturationDown)); // saturation = minSaturation + (saturationRange * pointOnScale); // } // else // { // // At moderate ratings, move between red and green // pointOnScale = ((currentSuccess - minBeforeValueDown) / hueSuccessRange); // hue = minHue + (hueRange * pointOnScale); // } // // confidencePrefab.color = Color.HSVToRGB(hue, saturation, value); // } // // // string conf = string.Format("{0:00}%", currentSuccess * 100); // confidencePrefab.text = conf; } }
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; }