public string PlayStrikeTurn(StrikeType strikeType) { try { if (IsPlayer1Turn) { Player1.Strike(strikeType); IsPlayer1Turn = false; return($"{strikeType.ToString()} from player 1"); } else { Player2.Strike(strikeType); IsPlayer1Turn = true; return($"{strikeType.ToString()} from player 2"); } } catch (Exception exception) { if (exception is NoCoinException) { var output = DeclareWinner(); return(output); } else { throw exception; } } }
internal static void FillNodeInfoDeribit(InteractivePointActive ip, double f, double dT, IOptionStrikePair sInfo, StrikeType optionType, OptionPxMode optPxMode, double optPx, double optQty, double optSigma, DateTime optTime, bool returnPct, double riskfreeRatePct, double scaleMult) { // Вызов базовой реализации FillNodeInfo(ip, f, dT, sInfo, optionType, optPxMode, optPx, optQty, optSigma, optTime, returnPct, riskfreeRatePct); // Заменяю тултип, чтобы в нем были и биткойны и доллары var opTypeStr = String.Intern(optionType.ToString()); var opTypeSpace = String.Intern(new string(' ', opTypeStr.Length)); // Пробелы по виду занимают меньше места, чем буквы, поэтому чуть-чуть подравниваю? opTypeSpace += " "; if (optQty > 0) { ip.Tooltip = String.Format(CultureInfo.InvariantCulture, " K:{0}; IV:{1:###0.00}%\r\n" + " {2} px(B) {3:##0.0000} qty {4}\r\n" + " {5} px($) {6:######0.00} qty {4}", sInfo.Strike, optSigma * Constants.PctMult, opTypeStr, optPx, optQty, opTypeSpace, optPx * scaleMult); } else { ip.Tooltip = String.Format(CultureInfo.InvariantCulture, " K:{0}; IV:{1:###0.00}%\r\n" + " {2} px(B) {3:##0.0000}\r\n" + " {4} px($) {5:######0.00}", sInfo.Strike, optSigma * Constants.PctMult, opTypeStr, optPx, opTypeSpace, optPx * scaleMult); } }
void cmdAirstrike(BasePlayer player, string command, string[] args) { if (args.Length == 0) { SendReply(player, string.Format("Airstrike v.{0}", Version)); if (HasPermission(player, "airstrike.signal.strike")) { SendReply(player, msg("help1", player.UserIDString)); } if (HasPermission(player, "airstrike.signal.squad")) { SendReply(player, msg("help2", player.UserIDString)); } if (HasPermission(player, "airstrike.purchase.strike")) { SendReply(player, msg("help3", player.UserIDString)); } if (HasPermission(player, "airstrike.purchase.squad")) { SendReply(player, msg("help4", player.UserIDString)); } if (HasPermission(player, "airstrike.chat.strike")) { SendReply(player, msg("help5", player.UserIDString)); SendReply(player, msg("help6", player.UserIDString)); SendReply(player, msg("help7", player.UserIDString)); } if (HasPermission(player, "airstrike.chat.squad")) { SendReply(player, msg("help8", player.UserIDString)); SendReply(player, msg("help9", player.UserIDString)); SendReply(player, msg("help10", player.UserIDString)); } return; } if (args.Length >= 2) { var time = GrabCurrentTime(); StrikeType type = args[1].ToLower() == "squad" ? StrikeType.Squad : StrikeType.Strike; if (!HasPermission(player, "airstrike.ignorecooldown")) { if (configData.Cooldown.Enabled) { CooldownData data; if (storedData.cooldowns.TryGetValue(player.userID, out data)) { double nextUse = type == StrikeType.Strike ? data.strikeCd : data.squadCd; if (nextUse > time) { double remaining = nextUse - time; SendReply(player, string.Format(msg("onCooldown", player.UserIDString), FormatTime(remaining))); return; } } } } switch (args[0].ToLower()) { case "signal": if ((type == StrikeType.Strike && configData.Other.SignalStrike) || (type == StrikeType.Squad && configData.Other.SignalSquad)) { if (!HasPermission(player, $"airstrike.signal.{type.ToString().ToLower()}")) { SendReply(player, msg("noPerms", player.UserIDString)); return; } } if (toggleList.ContainsKey(player.userID)) { toggleList[player.userID] = type; } else { toggleList.Add(player.userID, type); } SendReply(player, msg("signalReady", player.UserIDString)); return; case "buy": if ((type == StrikeType.Strike && configData.Buy.PermissionStrike) || (type == StrikeType.Squad && configData.Buy.PermissionSquad)) { if (!HasPermission(player, $"airstrike.purchase.{type.ToString().ToLower()}")) { SendReply(player, msg("noPerms", player.UserIDString)); return; } } if (CanBuyStrike(player, type)) { BuyStrike(player, type); AddCooldownData(player, type); } return; case "call": if (HasPermission(player, $"airstrike.chat.{type.ToString().ToLower()}")) { Vector3 position; if (args.Length == 4) { float x, z; if (!float.TryParse(args[2], out x) || !float.TryParse(args[3], out z)) { SendReply(player, msg("invCoords", player.UserIDString)); return; } else { position = new Vector3(x, 0, z); } } else if (args.Length == 3) { var players = FindPlayer(args[2]); if (players.Count > 1) { SendReply(player, msg("multiplePlayers", player.UserIDString)); return; } else if (players.Count == 0) { SendReply(player, msg("noPlayers", player.UserIDString)); return; } else { position = players[0].transform.position; } } else { position = player.transform.position; } if (type == StrikeType.Strike) { CallStrike(position); SendReply(player, string.Format(msg("strikeConfirmed", player.UserIDString), position)); } else { CallSquad(position); SendReply(player, string.Format(msg("squadConfirmed", player.UserIDString), position)); } AddCooldownData(player, type); } else { SendReply(player, msg("noPerms", player.UserIDString)); } return; default: break; } } }