示例#1
0
 void OnDestroy()
 {
     Log.Info($"Player record destroy for {this.hub.nicknameSync._firstNickname} ({this.hub.characterClassManager.UserId}) ({this.hub.queryProcessor.PlayerId})");
     RecorderCore.OnReceiveEvent(new LeaveData()
     {
         PlayerID = (sbyte)this.hub.queryProcessor.PlayerId
     });
     RecorderCore.OnRegisterRecordPlayer(this);
 }
 void OnDestroy()
 {
     Log.Info($"Pickup record destroy for {pickup.ItemId} ({uniqueId})");
     RecorderCore.recordPickups.Remove(uniqueId);
     RecorderCore.OnReceiveEvent(new RemovePickupData()
     {
         ItemID = uniqueId
     });
     RecorderCore.OnUnRegisterRecordPickup(this);
 }
示例#3
0
 private void Player_Shot(Exiled.Events.EventArgs.ShotEventArgs ev)
 {
     if (!RecorderCore.isRecording)
     {
         return;
     }
     RecorderCore.OnReceiveEvent(new ShotWeaponData()
     {
         PlayerID = (sbyte)ev.Shooter.Id
     });
 }
示例#4
0
 private void Player_ReloadingWeapon(Exiled.Events.EventArgs.ReloadingWeaponEventArgs ev)
 {
     if (!RecorderCore.isRecording)
     {
         return;
     }
     RecorderCore.OnReceiveEvent(new ReloadWeaponData()
     {
         PlayerID = (sbyte)ev.Player.Id
     });
 }
示例#5
0
 void Awake()
 {
     Log.Info($"Player record init for {this.hub.nicknameSync._firstNickname} ({this.hub.characterClassManager.UserId}) ({this.hub.queryProcessor.PlayerId})");
     RecorderCore.OnReceiveEvent(new PlayerInfoData()
     {
         PlayerID = (sbyte)this.hub.queryProcessor.PlayerId,
         UserID   = this.hub.characterClassManager.UserId,
         UserName = this.hub.nicknameSync._firstNickname
     });
     RecorderCore.OnRegisterRecordPlayer(this);
 }
示例#6
0
 private void Player_Died(Exiled.Events.EventArgs.DiedEventArgs ev)
 {
     if (!RecorderCore.isRecording)
     {
         return;
     }
     RecorderCore.OnReceiveEvent(new UpdateRoleData()
     {
         PlayerID = (sbyte)ev.Target.Id,
         RoleID   = (sbyte)RoleType.Spectator
     });
 }
示例#7
0
 private void Player_ChangingRole(Exiled.Events.EventArgs.ChangingRoleEventArgs ev)
 {
     if (!RecorderCore.isRecording)
     {
         return;
     }
     RecorderCore.OnReceiveEvent(new UpdateRoleData()
     {
         PlayerID = (sbyte)ev.Player.Id,
         RoleID   = (sbyte)ev.NewRole
     });
 }
示例#8
0
 private void Player_InteractingDoor(Exiled.Events.EventArgs.InteractingDoorEventArgs ev)
 {
     if (!RecorderCore.isRecording)
     {
         return;
     }
     RecorderCore.OnReceiveEvent(new DoorData()
     {
         State    = !ev.Door.TargetState,
         Position = ev.Door.transform.position.GetData()
     });
 }
示例#9
0
 private void Player_InteractingElevator(Exiled.Events.EventArgs.InteractingElevatorEventArgs ev)
 {
     if (!RecorderCore.isRecording)
     {
         return;
     }
     if (ev.Status == Lift.Status.Moving)
     {
         return;
     }
     RecorderCore.OnReceiveEvent(new LiftData()
     {
         Elevatorname = ev.Lift.elevatorName
     });
 }
示例#10
0
 public EventHandlers(RecorderCore core)
 {
     this.core = core;
     Exiled.Events.Handlers.Server.WaitingForPlayers         += WaitingForPlayers;
     Exiled.Events.Handlers.Player.ChangingRole              += Player_ChangingRole;
     Exiled.Events.Handlers.Player.ItemDropped               += Player_ItemDropped;
     Exiled.Events.Handlers.Server.RestartingRound           += Server_RestartingRound1;
     Exiled.Events.Handlers.Server.SendingRemoteAdminCommand += Server_SendingRemoteAdminCommand;
     Exiled.Events.Handlers.Player.InteractingDoor           += Player_InteractingDoor;
     Exiled.Events.Handlers.Player.InteractingElevator       += Player_InteractingElevator;
     Exiled.Events.Handlers.Player.Died            += Player_Died;
     Exiled.Events.Handlers.Player.Shot            += Player_Shot;
     Exiled.Events.Handlers.Player.ReloadingWeapon += Player_ReloadingWeapon;
     Exiled.Events.Handlers.Player.Verified        += Player_Verified;
     Exiled.Events.Handlers.Map.SpawnedItem        += Map_SpawnedItem;
     Exiled.Events.Handlers.Server.RoundStarted    += Server_RoundStarted;
     firstrun = true;
 }
示例#11
0
 public void Update()
 {
     if (!RecorderCore.isRecording || pickup?.ItemId == ItemType.None)
     {
         return;
     }
     if (currentPosition != transform.position || currentRotation != transform.rotation)
     {
         currentPosition = transform.position;
         currentRotation = transform.rotation;
         RecorderCore.OnReceiveEvent(new UpdatePickupData()
         {
             ItemID   = uniqueId,
             ItemType = (int)pickup.itemId,
             Position = transform.position.GetData(),
             Rotation = transform.rotation.GetData()
         });
     }
 }
示例#12
0
 public void Update()
 {
     if (hub?.characterClassManager.NetworkCurClass == RoleType.Spectator || hub?.characterClassManager.NetworkCurClass == RoleType.None || !RecorderCore.isRecording)
     {
         return;
     }
     if (currentPosition != hub.transform.position || currentRotation != hub.playerMovementSync.Rotations)
     {
         currentPosition = hub.transform.position;
         currentRotation = hub.playerMovementSync.Rotations;
         RecorderCore.OnReceiveEvent(new UpdatePlayerData()
         {
             PlayerID    = (sbyte)hub.queryProcessor.NetworkPlayerId,
             MoveState   = (byte)hub.animationController.Network_curMoveState,
             HoldingItem = (sbyte)hub.inventory.Network_curItemSynced,
             CurrentAnim = hub.animationController.NetworkcurAnim,
             Speed       = hub.animationController.Networkspeed.GetData(),
             Position    = hub.transform.position.GetData(),
             Rotation    = hub.playerMovementSync.Rotations.GetData()
         });
     }
 }
示例#13
0
 public override void OnEnabled()
 {
     foreach (MethodBase bas in Evs.Events.Instance.Harmony.GetPatchedMethods())
     {
         if (bas.Name.Equals("TransmitData"))
         {
             Exiled.Events.Events.DisabledPatchesHashSet.Add(bas);
         }
     }
     Evs.Events.Instance.ReloadDisabledPatches();
     pluginDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "EXILED", "Plugins", "PlayerRecorder");
     if (!Directory.Exists(pluginDir))
     {
         Directory.CreateDirectory(pluginDir);
     }
     singleton     = this;
     core          = CustomNetworkManager.singleton.gameObject.AddComponent <RecorderCore>();
     eventHandlers = new EventHandlers(core);
     core.handler  = eventHandlers;
     HarmonyLib.Harmony hrm = new HarmonyLib.Harmony("Patcher.recorder");
     hrm.PatchAll();
     base.OnEnabled();
 }
示例#14
0
        void Awake()
        {
            for (int i = 1; i < int.MaxValue; i++)
            {
                if (RecorderCore.recordPickups.Keys.Any(p => p == i))
                {
                    continue;
                }

                uniqueId = i;
                break;
            }
            RecorderCore.recordPickups.Add(uniqueId, this);
            RecorderCore.OnReceiveEvent(new CreatePickupData()
            {
                ItemID   = uniqueId,
                ItemType = (int)pickup.ItemId,
                Position = pickup.position.GetData(),
                Rotation = pickup.rotation.GetData()
            });
            Log.Info($"Pickup record init for {pickup.ItemId} ({uniqueId})");
            RecorderCore.OnRegisterRecordPickup(this);
        }
示例#15
0
 void OnDestroy()
 {
     RecorderCore.replayPlayers.Remove(uniqueId);
     Log.Info($"Player replay destroy for {this.hub.nicknameSync.Network_myNickSync} ({this.hub.characterClassManager.UserId}) ({this.hub.queryProcessor.PlayerId})");
     RecorderCore.OnUnRegisterReplayPlayer(this);
 }
示例#16
0
 void Awake()
 {
     Log.Info($"Player replay init for {this.hub.nicknameSync.Network_myNickSync} ({this.hub.characterClassManager.UserId}) ({this.hub.queryProcessor.PlayerId})");
     RecorderCore.OnRegisterReplayPlayer(this);
 }
示例#17
0
 void OnDestroy()
 {
     Log.Info($"Pickup replay destroy for {pickup.ItemId} ({uniqueId})");
     RecorderCore.replayPickups.Remove(uniqueId);
     RecorderCore.OnUnRegisterReplayPickup(this);
 }
示例#18
0
 void Awake()
 {
     Log.Info($"Pickup replay init for {pickup.ItemId}");
     RecorderCore.OnRegisterReplayPickup(this);
 }
示例#19
0
 void Start()
 {
     singleton     = this;
     ReceiveEvent += EventReceived;
 }