예제 #1
0
        private void HandleHookStateChangeEvent(Provider sender, RKNTracker.AoHook.Events.HookStateChangeEventArgs e)
        {
            lock (this.ProcessCharacterMap)
            {
                // We don't have anything to do if we're hooking.
                if (e.IsHooked) { return; }
                // We can't do anything if we don't know about the process
                if (!this.ProcessCharacterMap.ContainsKey(e.ProcessID)) { return; }

                // Update status of whether or not a player character is hooked.
                API.State.PlayerInfo[this.ProcessCharacterMap[e.ProcessID]].IsHooked = false;
                this.ProcessCharacterMap.Remove(e.ProcessID);
            }
        }
예제 #2
0
        private void HandleDynelNameEvent(Provider sender, RKNTracker.AoHook.Events.DynelNameEventArgs e)
        {
            if (!e.IsSelf) { return; }
            bool changed = false;
            PlayerInfoKey key = new PlayerInfoKey(e.ServerID, e.DynelID);

            lock (API.State.PlayerInfo)
            {
                if (!API.State.PlayerInfo.ContainsKey(key))
                {
                    API.State.PlayerInfo[key] = new PlayerInfo();
                }

                var info = API.State.PlayerInfo[key];

                if (e.DynelID != uint.MinValue && e.DynelID != uint.MaxValue)
                {
                    if (info.ID != e.DynelID)
                    {
                        changed = true;
                    }
                    info.ID = e.DynelID;
                }
                if (e.DynelName != "NoName")
                {
                    if (e.DynelName != info.Name)
                    {
                        changed = true;
                    }
                    info.Name = e.DynelName;
                }
                if (e.ServerID != 0)
                {
                    if (e.ServerID != info.ServerID)
                    {
                        changed = true;
                    }
                    info.ServerID = e.ServerID;
                    info.Identity.Dimension = PlayerInfoKey.GetDimension(e.ServerID);
                }
            }
            if (changed)
            {
            }
        }
예제 #3
0
 private void HandleCharacterLogoutEvent(Provider sender, AoHook.Events.CharacterLogoutEventArgs e)
 {
     PlayerInfoKey key = new PlayerInfoKey(e.ServerID, e.CharacterID);
     lock (this.ProcessCharacterMap)
     {
         if (!this.ProcessCharacterMap.ContainsKey(e.ProcessID))
         {
             return;
         }
         else
         {
             if (API.State.PlayerInfo.ContainsKey(this.ProcessCharacterMap[e.ProcessID]))
             {
                 API.State.PlayerInfo[this.ProcessCharacterMap[e.ProcessID]].IsHooked = false;
             }
             this.ProcessCharacterMap.Remove(e.ProcessID);
         }
     }
 }
예제 #4
0
        private void HandleCharacterPositionEvent(Provider sender, RKNTracker.AoHook.Events.CharacterPositionEventArgs e)
        {
            // Ignore anything which isn't player characters.
            if (e.DynelType != 50000) { return; }

            // Don't update if we have invalid data (such as while zoning)
            if (e.ZoneID == 0) { return; }

            var update = false;
            var fireEvent = false;

            lock (API.State.PlayerInfo)
            {
                PlayerInfoKey key = new PlayerInfoKey(e.ServerID, e.DynelID);
                var info = API.State.PlayerInfo[key];

                if (info.Position.X != e.X || info.Position.Y != e.Y || info.Position.Z != e.Z)
                {
                    fireEvent = true;
                }

                info.Position = new Vector3(e.X, e.Y, e.Z);
                info.Zone.ID = e.ZoneID;
                info.Zone.Name = e.ZoneName;

                if (info.InShadowlands != e.InShadowlands)
                {
                    update = true;
                }

                info.InShadowlands = e.InShadowlands;

                if (info.ServerID != e.ServerID)
                {
                    info.ServerID = e.ServerID;
                    update = true;
                    this.UpdateTrackedDimension();
                }

                if (!info.IsHooked)
                {
                    info.IsHooked = true;
                    update = true;
                }
            }
            if (update)
            {
            }

            if (fireEvent)
            {
                FireDisplayEvent();
            }
        }
예제 #5
0
        private void HandleCharacterLoginEvent(Provider sender, RKNTracker.AoHook.Events.CharacterLoginEventArgs e)
        {
            PlayerInfoKey key = new PlayerInfoKey(e.ServerID, e.CharacterID);

            lock (this.ProcessCharacterMap)
            {
                if (!this.ProcessCharacterMap.ContainsKey(e.ProcessID))
                {
                    this.ProcessCharacterMap[e.ProcessID] = key;
                }
                else if (this.ProcessCharacterMap[e.ProcessID] != key)
                {
                    API.State.PlayerInfo[this.ProcessCharacterMap[e.ProcessID]].IsHooked = false;
                    this.ProcessCharacterMap[e.ProcessID] = key;
                }
            }

            lock(API.State.PlayerInfo)
            {
                if (API.State.PlayerInfo.ContainsKey(key))
                {
                    API.State.PlayerInfo[key].IsHooked = true;
                }
            }
        }