Example #1
0
        private void OnEatTURD(void *pPlayer, void *pTURD)
        {
            CNWSPlayer     player = CNWSPlayer.FromPointer(pPlayer);
            CNWSPlayerTURD turd   = CNWSPlayerTURD.FromPointer(pTURD);

            ICGameObject?playerObj = player.m_oidNWSObject.ToNwObject()?.Object;

            if (playerObj != null)
            {
                objectStorage[playerObj.Pointer] = GetObjectStorage(turd).Clone();
            }

            eatTURDHook.CallOriginal(pPlayer, pTURD);
        }
Example #2
0
        private void OnDropTURD(void *pPlayer)
        {
            dropTURDHook.CallOriginal(pPlayer);

            // Be very, very paranoid. Bad things happen when the TURD list doesn't exist
            // This can happen when you BootPC() the very first PC to connect to your sever
            //     https://github.com/nwnxee/unified/issues/319
            CExoLinkedListInternal turdList = NwModule.Instance.Module.m_lstTURDList.m_pcExoLinkedListInternal;
            CExoLinkedListNode     pHead;

            if (turdList != null && (pHead = turdList.pHead) != null && pHead.pObject != null)
            {
                CNWSPlayer     player = CNWSPlayer.FromPointer(pPlayer);
                CNWSPlayerTURD turd   = CNWSPlayerTURD.FromPointer(pHead.pObject);

                ICGameObject?playerObj = player.m_oidNWSObject.ToNwObject()?.Object;
                if (playerObj != null)
                {
                    objectStorage[turd.Pointer] = GetObjectStorage(playerObj).Clone();
                }
            }
        }