public static bool hasCorrectPermission(ïçîìäîóäìïæ.åéðñðçîîïêç info, int requiredPerm) { int playerPermissionLevel; if (GameMode.getPlayerBySocket(info.éäñåíéíìééä).isAdmin) { playerPermissionLevel = 2; } else if (GameMode.getPlayerBySocket(info.éäñåíéíìééä).isMod) { playerPermissionLevel = 1; } else { playerPermissionLevel = 0; } if (playerPermissionLevel >= requiredPerm) { return(true); } else { return(false); } }
// Token: 0x06000005 RID: 5 RVA: 0x000020F0 File Offset: 0x000002F0 private static bool Prefix(int íóóïíðóòêêè, int óîèòèðîðçîì, int íäêìòïçìóòä, int óêóêíðåîóêí, ïçîìäîóäìïæ.åéðñðçîîïêç äíìíëðñïñéè) { return(!MainGameMode.Instance.Loaded); }
// Token: 0x06000008 RID: 8 RVA: 0x000022A8 File Offset: 0x000004A8 private static bool Prefix(int chatType, int senderTeam, string sender, string text, ïçîìäîóäìïæ.åéðñðçîîïêç info) { Log.log("Chat patch called"); PlayerInfo playerBySocket = GameMode.getPlayerBySocket(info.éäñåíéíìééä); text = text.ToLower(); Log.log(text); ulong steamID = GameMode.getPlayerBySocket(info.éäñåíéíìééä).steamPlayer.ðñéèéåóëìêé.m_SteamID; bool isAdmin = éæñêääóîîèò.ðïîñðçòäêëæ(steamID); if (isAdmin) { if (text.StartsWith("!xyz")) { Log.log("xyz command used"); MainGameMode.Instance.wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, new object[] { 1, 1, "game", string.Concat(new object[] { "X: ", playerBySocket.transform.position.x, " Y: ", playerBySocket.transform.position.y, " Z: ", playerBySocket.transform.position.z }) }); MainGameMode.Instance.wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, new object[] { 1, 1, "game", string.Concat(new object[] { "rX: ", playerBySocket.transform.rotation.eulerAngles.x, " rY: ", playerBySocket.transform.rotation.eulerAngles.y, " rZ: ", playerBySocket.transform.rotation.eulerAngles.z }) }); return(false); } else if (text.StartsWith("!force")) { Log.log("force command used"); ModeHandler.vote(sender, info.éäñåíéíìééä, true); return(false); } else if (text.StartsWith("!reload")) { Log.log("Reloading config"); MainGameMode.Instance.loadSettings(); return(false); } else if (text.StartsWith("!location")) { string[] txt = text.Split(' '); if (txt.Length == 2) { Vector3 pos; Vector3 rot; switch (txt[1]) { case "0": pos = GameMode.Instance.teamParents[0].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.position; // Distance from each other, height, distance from center rot = GameMode.Instance.teamParents[0].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.eulerAngles; break; case "1": pos = GameMode.Instance.teamParents[1].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.position; rot = GameMode.Instance.teamParents[1].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.eulerAngles; break; case "2": pos = GameMode.Instance.teamParents[2].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.position; rot = GameMode.Instance.teamParents[2].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.eulerAngles; break; case "4": pos = GameMode.Instance.teamParents[4].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.position; rot = GameMode.Instance.teamParents[4].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.eulerAngles; break; case "5": pos = GameMode.Instance.teamParents[5].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.position; rot = GameMode.Instance.teamParents[5].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.eulerAngles; break; case "6": pos = GameMode.Instance.teamParents[6].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.position; rot = GameMode.Instance.teamParents[6].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.eulerAngles; break; default: pos = new Vector3(0, 0, 0); rot = new Vector3(0, 0, 0); break; } MainGameMode.Instance.wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, new object[] { 1, 1, "game", string.Concat(new object[] { "X: ", pos.x, " Y: ", pos.y, " Z: ", pos.z }) }); MainGameMode.Instance.wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, new object[] { 1, 1, "game", string.Concat(new object[] { "rX: ", rot.x, " rY: ", rot.y, " rZ: ", rot.z }) }); return(false); } } else if (text.StartsWith("!tp")) { string[] txt = text.Split(' '); Vector3 newPos = new Vector3(float.Parse(txt[2]), float.Parse(txt[3]), float.Parse(txt[4])); switch (txt[1]) { case "0": GameMode.Instance.teamParents[0].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.position = newPos; // Distance from each other, height, distance from center break; case "1": GameMode.Instance.teamParents[1].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.position = newPos; break; case "2": GameMode.Instance.teamParents[2].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.position = newPos; break; case "4": GameMode.Instance.teamParents[4].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.position = newPos; break; case "5": GameMode.Instance.teamParents[5].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.position = newPos; break; case "6": GameMode.Instance.teamParents[6].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.position = newPos; break; } Debug.Log($"Set team {txt[1]} to location {txt[2]}:{txt[3]}:{txt[4]}"); } else if (text.StartsWith("!rot")) { string[] txt = text.Split(' '); Vector3 newRot = new Vector3(float.Parse(txt[2]), float.Parse(txt[3]), float.Parse(txt[4])); switch (txt[1]) { case "0": GameMode.Instance.teamParents[0].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.eulerAngles = newRot; // Distance from each other, height, distance from center break; case "1": GameMode.Instance.teamParents[1].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.eulerAngles = newRot; break; case "2": GameMode.Instance.teamParents[2].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.eulerAngles = newRot; break; case "4": GameMode.Instance.teamParents[4].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.eulerAngles = newRot; break; case "5": GameMode.Instance.teamParents[5].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.eulerAngles = newRot; break; case "6": GameMode.Instance.teamParents[6].GetComponent <ShipHealth>().ññçäîèäíñðó.transform.eulerAngles = newRot; break; } Debug.Log($"Set team {txt[1]} to rot {txt[2]}:{txt[3]}:{txt[4]}"); } } if (text.StartsWith("!vote")) { Log.log("Got vote"); ModeHandler.vote(sender, info.éäñåíéíìééä, false); return(false); } return(true); }
// Token: 0x06000002 RID: 2 RVA: 0x00002070 File Offset: 0x00000270 private static void Postfix(PlayerHealth __instance, Vector3 äåòéðññåîòì, int çññíïïíòóêê, bool îðòíæíæïðåê, bool ñïêêðêæíóòê, ïçîìäîóäìïæ.åéðñðçîîïêç äíìíëðñïñéè) { if (MainGameMode.Instance.started) { PlayerInfo plr = __instance.GetComponent <PlayerInfo>(); if (plr != null) { if (GameMode.Instance.teamFactions[plr.team] == "pirates") { GameMode.Instance.pirateTickets--; if (GameMode.Instance.pirateTickets % MainGameMode.Instance.pirateSteps == 0 || GameMode.Instance.pirateTickets < 10) { MainGameMode.updateTickets(); } } else { GameMode.Instance.navyTickets--; if (GameMode.Instance.navyTickets % MainGameMode.Instance.navySteps == 0 || GameMode.Instance.navyTickets < 10) { MainGameMode.updateTickets(); } } } } }
private static bool Prefix(ïçîìäîóäìïæ.åéðñðçîîïêç äíìíëðñïñéè) { return(!MainGameMode.Instance.started); }
// Token: 0x06000003 RID: 3 RVA: 0x000020AC File Offset: 0x000002AC private static void Postfix(string ëëäíêðäóæîó, int íïïìîóðíçëæ, ïçîìäîóäìïæ.åéðñðçîîïêç äíìíëðñïñéè) { MainGameMode.Instance.Loaded = false; MainGameMode.Instance.started = false; }
// Token: 0x06000004 RID: 4 RVA: 0x000020C8 File Offset: 0x000002C8 private static bool Prefix(int îîçêèîëìîæê, ïçîìäîóäìïæ.åéðñðçîîïêç äíìíëðñïñéè) { return(!MainGameMode.Instance.Loaded); }
static bool Prefix(int chatType, int senderTeam, ref string sender, ref string text, ïçîìäîóäìïæ.åéðñðçîîïêç info) { if (text[0] == '!') { //if (GameMode.getPlayerBySocket(info.éäñåíéíìééä).isAdmin) //{ //text = text.ToLower(); //impersonate command if (text.Split()[0] == "!impersonate_perms" && hasCorrectPermission(info, permModeLevel)) { if (text[text.Length - 1].ToString() == "0") { impersonatePermLevel = 0; wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, 1, 1, "game", "impersonate permissions set to user"); writeChangesToConfigFile(configFileName); } else if (text[text.Length - 1].ToString() == "1") { impersonatePermLevel = 1; wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, 1, 1, "game", "impersonate permissions set to moderator"); writeChangesToConfigFile(configFileName); } else if (text[text.Length - 1].ToString() == "2") { impersonatePermLevel = 2; wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, 1, 1, "game", "impersonate permissions set to admin"); writeChangesToConfigFile(configFileName); } else { wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, 1, 1, "game", "Syntax error"); } return(false); } if (text.Split()[0] == "!impersonate" && hasCorrectPermission(info, impersonatePermLevel)) { Impersonate(ref sender, ref text); newLog.Log("running impersonation script"); return(true); } //enable/disable pirate mode command if (text.Split()[0] == "!piratespeak" && hasCorrectPermission(info, pirateModePermLevel)) { if (text[text.Length - 1].ToString() == "0") { pirateModeEnabled = false; wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, 1, 1, "game", "Pirate speak disabled!"); writeChangesToConfigFile(configFileName); } else if (text[text.Length - 1].ToString() == "1") { pirateModeEnabled = true; wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, 1, 1, "game", "Pirate speak enabled!"); writeChangesToConfigFile(configFileName); } else { wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, 1, 1, "game", "Syntax error"); } return(false); } if (text.Split()[0] == "!piratespeak_perms" && hasCorrectPermission(info, permModeLevel)) { if (text[text.Length - 1].ToString() == "0") { pirateModePermLevel = 0; wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, 1, 1, "game", "pirate speak toggle permissions set to user"); writeChangesToConfigFile(configFileName); } else if (text[text.Length - 1].ToString() == "1") { pirateModePermLevel = 1; wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, 1, 1, "game", "pirate speak toggle permissions set to moderator"); writeChangesToConfigFile(configFileName); } else if (text[text.Length - 1].ToString() == "2") { pirateModePermLevel = 2; wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, 1, 1, "game", "pirate speak toggle permissions set to admin"); writeChangesToConfigFile(configFileName); } else { wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, 1, 1, "game", "Syntax error"); } return(false); } if (text.Split()[0] == "!reloaddict" && hasCorrectPermission(info, reloadPermLevel)) { listOfShitAndStuff.Clear(); readDictionaryFile(dictionaryFileName); wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, 1, 1, "game", "Dictionary file reloaded"); return(false); } if (text.Split()[0] == "!reloaddict_perms" && hasCorrectPermission(info, permModeLevel)) { if (text[text.Length - 1].ToString() == "0") { reloadPermLevel = 0; wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, 1, 1, "game", "dictionary reload permissions set to user"); writeChangesToConfigFile(configFileName); } else if (text[text.Length - 1].ToString() == "1") { reloadPermLevel = 1; wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, 1, 1, "game", "dictionary reload permissions set to moderator"); writeChangesToConfigFile(configFileName); } else if (text[text.Length - 1].ToString() == "2") { reloadPermLevel = 2; wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, 1, 1, "game", "dictionary reload permissions set to admin"); writeChangesToConfigFile(configFileName); } else { wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, 1, 1, "game", "Syntax error"); } return(false); } //I'm going to just keep it so admins only can change this if (text.Split()[0] == "!perms" && text.Split()[1] == "BWPirateChat" && GameMode.getPlayerBySocket(info.éäñåíéíìééä).isAdmin) { if (text[text.Length - 1].ToString() == "0") { permModeLevel = 0; wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, 1, 1, "game", "BWPirateChat.dll perm set permissions set to user"); writeChangesToConfigFile(configFileName); } else if (text[text.Length - 1].ToString() == "1") { permModeLevel = 1; wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, 1, 1, "game", "BWPirateChat.dll perm set permissions set to moderator"); writeChangesToConfigFile(configFileName); } else if (text[text.Length - 1].ToString() == "2") { permModeLevel = 2; wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, 1, 1, "game", "BWPirateChat.dll perm set permissions set to admin"); writeChangesToConfigFile(configFileName); } else { wno.òäóæåòîððòä("broadcastChat", info.éäñåíéíìééä, 1, 1, "game", "Syntax error"); } return(false); } //} //return true; } else if (text[0] == '/') { //don't try to convert commands into pirate speak! That shit is irritating! return(true); } else if (pirateModeEnabled) { string changedText = PirateTalkText(text); text = changedText; } //text = "Windows XP is the coolest guy in all of Blackwake"; return(true); }
static void Postfix(ShipConstruction __instance, string shipType, int team, ïçîìäîóäìïæ.åéðñðçîîïêç info) { try { Instance.StartCoroutine("doStuff", team); }catch (Exception e) { debugLog(e.Message); } }