static void Postfix(PLInGameUI __instance) { if (DebugModeCommand.DebugMode && PLServer.Instance != null && PLEncounterManager.Instance != null && PLNetworkManager.Instance != null && GameVersion.Version != string.Empty) { Vector3 pos; if (PLNetworkManager.Instance.LocalPlayer != null) { PLPawn localPawn = PLNetworkManager.Instance.LocalPlayer.GetPawn(); pos = localPawn != null ? localPawn.transform.position : Vector3.zero; } else { pos = Vector3.zero; } PLPersistantEncounterInstance encounter = PLEncounterManager.Instance.GetCurrentPersistantEncounterInstance(); int levelID = encounter != null?encounter.LevelID.GetDecrypted() : -1; PLSectorInfo sectorInfo = PLServer.GetCurrentSector(); string visualType = sectorInfo != null?sectorInfo.VisualIndication.ToString() : "--"; int sector = sectorInfo != null ? sectorInfo.ID : -1; PLGlobal.SafeLabelSetText(__instance.CurrentVersionLabel, $"{GameVersion.Version}\nPOS: {pos}, Level ID: {levelID}, Sector: {sector}, Visual: {visualType}"); } }
public override void HandleRPC(object[] arguments, PhotonMessageInfo sender) { PLPlayer player = PLServer.GetPlayerForPhotonPlayer(sender.sender); string name = player.GetPlayerName(); string message = (string)arguments[0]; Messaging.Echo(PLNetworkManager.Instance.LocalPlayer.GetPhotonPlayer(), $"[&%~[C{player.GetClassID()} {name} ]&%~] <color=#a0a0a0>whispers to you: {message}</color>"); }
static void Postfix(PLServer __instance, int inID) { if (PhotonNetwork.isMasterClient && ChatCommandRouter.Instance.getPublicCommandAliases().Length > 1) { PLPlayer player = __instance.GetPlayerFromPlayerID(inID); if (player != null && player.GetPhotonPlayer() != null) { Messaging.Echo(player, $"[&%~[C0 Welcome ]&%~] {player.GetPlayerName()}!"); Messaging.Echo(player, "This game has some commands available."); Messaging.Echo(player, "Type [&%~[C2 !help ]&%~] for more information."); } } }
static void Postfix(PLServer __instance, int inID) { if (PhotonNetwork.isMasterClient) { var player = (from a in __instance.AllPlayers where a.GetPlayerID() == inID select a).First(); PlayerPos info; if (Plugin.pos.TryGetValue(player.GetClassID(), out info)) { __instance.StartCoroutine(Patch.instance.TeleportWithWait(player, info, inID)); } #if DEBUG else { PulsarPluginLoader.Utilities.Logger.Info($"Error for {inID}"); } #endif } }
static void Postfix(PLServer __instance) { __instance.IsReflection = false; }
static void Prefix(PLServer __instance) { __instance.gameObject.AddComponent(typeof(ModMessageHelper)); }
private static bool Prefix(PLServer __instance, ref int playerID, ref int classID, PhotonMessageInfo pmi) { //runs vanilla if client isn't hosting if (!PhotonNetwork.isMasterClient) { return(true); } //fails if client not trying to be class -1 through 4 if (classID < -1 || classID > 4) { return(false); } //Protect Players from bad actors changing other player's classes. PLPlayer playerForPhotonPlayer = PLServer.GetPlayerForPhotonPlayer(pmi.sender); if (playerForPhotonPlayer != null && playerForPhotonPlayer.GetPlayerID() != playerID) { return(false); } PLPlayer PlayerFromID = __instance.GetPlayerFromPlayerID(playerID); if (PlayerFromID != null) { //stop if player is already in the specified class if (PlayerFromID.GetClassID() == classID) { return(false); } Global.Generateplayercount(); if (CanJoinClass(classID)) { //sends the classchangemessage, sets the player to the class id PlayerFromID.SetClassID(classID); AccessTools.Method(__instance.GetType(), "ClassChangeMessage", null, null).Invoke(__instance, new object[] { PlayerFromID.GetPlayerName(false), classID }); } else //Couldn't become role, send available options. { string options = ""; for (int classid = 0; classid < 5; classid++) { if (CanJoinClass(classid)) { options += $"{PLPlayer.GetClassNameFromID(classid)}\n"; } } if (string.IsNullOrEmpty(options)) { Messaging.Centerprint("There are no slots available. Ask the host to change this or leave.", PlayerFromID, "ROL", PLPlayer.GetClassColorFromID(classID), EWarningType.E_NORMAL); Messaging.Notification($"Player {PlayerFromID.GetPlayerName()} Is trying to join as {PLPlayer.GetClassNameFromID(classID)}. There are no Roles available."); } else { Messaging.Centerprint("That slot is full, choose another one. options on the left", PlayerFromID, "ROL", PLPlayer.GetClassColorFromID(classID), EWarningType.E_NORMAL); Messaging.Notification(options, PlayerFromID, playerID, 10000 + PLServer.Instance.GetEstimatedServerMs()); Messaging.Notification($"Player {PlayerFromID.GetPlayerName()} Is trying to join as {PLPlayer.GetClassNameFromID(classID)}"); } } } return(false); }