private unsafe void CharacterDisableDrawDetour(Character *thisPtr)
        {
            if (thisPtr->GameObject.ObjectKind == (byte)ObjectKind.Player &&
                (thisPtr->StatusFlags & (byte)StatusFlags.PartyMember) > 0)
            {
                _players[ContainerType.Party].Add(thisPtr->GameObject.ObjectID);
                thisPtr->GameObject.RenderFlags &= ~(int)VisibilityFlags.Invisible;
                HiddenObjectIds.Remove(thisPtr->GameObject.ObjectID);
            }

            if (_config.HidePlayer &&
                _config.ShowDeadPlayer &&
                thisPtr->GameObject.ObjectKind == (byte)ObjectKind.Player &&
                thisPtr->CurrentHp == 0 &&
                HiddenObjectIds.Contains(thisPtr->GameObject.ObjectID))
            {
                thisPtr->GameObject.RenderFlags &= ~(int)VisibilityFlags.Invisible;
                HiddenObjectIds.Remove(thisPtr->GameObject.ObjectID);
            }
            else if (ObjectIdsToUnhide.Contains(thisPtr->GameObject.ObjectID))
            {
                thisPtr->GameObject.RenderFlags &= ~(int)VisibilityFlags.Invisible;
                ObjectIdsToUnhide.Remove(thisPtr->GameObject.ObjectID);
            }
            else if (MinionObjectIdsToUnhide.Contains(thisPtr->CompanionOwnerID))
            {
                thisPtr->GameObject.RenderFlags &= ~(int)VisibilityFlags.Invisible;
                MinionObjectIdsToUnhide.Remove(thisPtr->CompanionOwnerID);
            }

            hookCharacterDisableDraw.Original(thisPtr);
        }
Exemplo n.º 2
0
        // clear destroyed characters from our tracking sets
        // this is important when using pointers as a tracker, since pointers get re-used for characters
        private unsafe void CharacterDtorDetour(Character *thisPtr)
        {
            if (thisPtr->GameObject.ObjectKind == 0x1)
            {
                HiddenPlayerObjectIds.Remove(thisPtr->GameObject.ObjectID);
            }

            hookCharacterDtor.Original(thisPtr);
        }
Exemplo n.º 3
0
        private void DestroyCharacterInternal(Character *ptr)
        {
            Signals.OnCharacterDestroy(ptr);
            Signals.OnEntityDestroy(&ptr->_entity);
            var copy = ptr->_entity;

            *ptr = _default_.Character;
            ptr->_entity = copy;
            EntityDestroy(&ptr->_entity);
        }
Exemplo n.º 4
0
 private unsafe void CharacterDisableDrawDetour(Character *thisPtr)
 {
     // again, this will be more complicated when unhiding only friend players or whatever
     if (ObjectIdsToUnhide.Contains(thisPtr->GameObject.ObjectID))
     {
         thisPtr->GameObject.RenderFlags &= ~(1 << 1 | 1 << 11);
         ObjectIdsToUnhide.Remove(thisPtr->GameObject.ObjectID);
     }
     hookCharacterDisableDraw.Original(thisPtr);
 }
Exemplo n.º 5
0
 private unsafe void CharacterEnableDrawDetour(Character *thisPtr)
 {
     // do other checks here etc
     if (thisPtr != (Character *)LocalPlayer && thisPtr->GameObject.ObjectKind == 0x1 && _plugin.config.HidePlayers)
     {
         thisPtr->GameObject.RenderFlags |= (1 << 1 | 1 << 11);
         HiddenPlayerObjectIds.Add(thisPtr->GameObject.ObjectID);
     }
     hookCharacterEnableDraw.Original(thisPtr);
 }
Exemplo n.º 6
0
 public void DestroyCharacter(Character *ptr)
 {
     if (ptr == null)
     {
         return;
     }
     if (ptr->_entity._active == false)
     {
         return;
     }
     _destroy.Enqueue(ptr->EntityRef);
 }
Exemplo n.º 7
0
 public Boolean Next()
 {
     while (++_index < Character.MAX_COUNT)
     {
         if (_ptr[_index]._entity._active)
         {
             Current = &_ptr[_index];
             return(true);
         }
     }
     Current = null;
     return(false);
 }
Exemplo n.º 8
0
            public void OnCharacterDestroy(Character *entity)
            {
                var array   = _f._ISignalOnCharacterDestroySystems;
                var systems = &(_f._globals->Systems);

                for (Int32 i = 0; i < array.Length; ++i)
                {
                    var s = array[i];
                    if (BitSet256.IsSet(systems, s.RuntimeIndex))
                    {
                        s.OnCharacterDestroy(_f, entity);
                    }
                }
            }
        private unsafe void CharacterDtorDetour(Character *thisPtr)
        {
            if (thisPtr->GameObject.ObjectKind == (byte)ObjectKind.Player ||
                thisPtr->GameObject.ObjectKind == (byte)ObjectKind.Companion ||
                (thisPtr->GameObject.ObjectKind == (byte)ObjectKind.BattleNpc &&
                 (thisPtr->GameObject.SubKind == (byte)BattleNpcSubKind.Pet ||
                  thisPtr->GameObject.SubKind == 3)))
            {
                HiddenObjectIds.Remove(thisPtr->GameObject.ObjectID);
                HiddenMinionObjectIds.Remove(thisPtr->GameObject.ObjectID);

                foreach (ContainerType type in Enum.GetValues(typeof(ContainerType)))
                {
                    _players[type].Remove(thisPtr->GameObject.ObjectID);
                    _pets[type].Remove(thisPtr->GameObject.ObjectID);
                    _chocobos[type].Remove(thisPtr->GameObject.ObjectID);
                    _minions[type].Remove(thisPtr->GameObject.ObjectID);
                }
            }

            hookCharacterDtor.Original(thisPtr);
        }
        private unsafe void CharacterEnableDrawDetour(Character *thisPtr)
        {
            var localPlayerAddress = _pluginInterface?.ClientState?.LocalPlayer?.Address;

            if (localPlayerAddress.HasValue && LocalPlayer != (BattleChara *)localPlayerAddress.Value)
            {
                LocalPlayer = (BattleChara *)localPlayerAddress.Value;
            }

            if (_config.Enabled && localPlayerAddress.HasValue && thisPtr != (Character *)LocalPlayer)
            {
                switch (thisPtr->GameObject.ObjectKind)
                {
                case (byte)ObjectKind.Player:
                    if (thisPtr->GameObject.ObjectID == 0xE0000000)
                    {
                        break;
                    }

                    _players[ContainerType.All].Add(thisPtr->GameObject.ObjectID);

                    if ((thisPtr->StatusFlags & (byte)StatusFlags.Friend) > 0)
                    {
                        _players[ContainerType.Friend].Add(thisPtr->GameObject.ObjectID);
                    }
                    else
                    {
                        _players[ContainerType.Friend].Remove(thisPtr->GameObject.ObjectID);
                    }

                    if ((thisPtr->StatusFlags & (byte)StatusFlags.PartyMember) > 0)
                    {
                        _players[ContainerType.Party].Add(thisPtr->GameObject.ObjectID);
                    }
                    else
                    {
                        _players[ContainerType.Party].Remove(thisPtr->GameObject.ObjectID);
                    }

                    if ((_pluginInterface.ClientState.Condition[ConditionFlag.BoundByDuty] ||
                         _pluginInterface.ClientState.Condition[ConditionFlag.BetweenAreas] ||
                         _pluginInterface.ClientState.Condition[ConditionFlag.WatchingCutscene]) &&
                        !(_config.TerritoryTypeWhitelist.Contains(_pluginInterface.ClientState.TerritoryType) && _config.TerryWhiteList))
                    {
                        break;
                    }

                    if (*LocalPlayer->Character.CompanyTag != 0 &&
                        LocalPlayer->Character.CurrentWorld == LocalPlayer->Character.HomeWorld &&
                        UnsafeArrayEqual(thisPtr->CompanyTag, LocalPlayer->Character.CompanyTag, 7))
                    {
                        _players[ContainerType.Company].Add(thisPtr->GameObject.ObjectID);
                    }
                    else
                    {
                        _players[ContainerType.Company].Remove(thisPtr->GameObject.ObjectID);
                    }


                    if (_config.VoidList.Any(x => UnsafeArrayEqual(Encoding.UTF8.GetBytes(x.Name),
                                                                   thisPtr->GameObject.Name) &&
                                             x.HomeworldId == thisPtr->HomeWorld))
                    {
                        thisPtr->GameObject.RenderFlags |= (int)VisibilityFlags.Invisible;
                        HiddenObjectIds.Add(thisPtr->GameObject.ObjectID);
                        break;
                    }

                    if (!_config.HidePlayer ||
                        (_config.ShowDeadPlayer && thisPtr->CurrentHp == 0) ||
                        (_config.ShowFriendPlayer && _players[ContainerType.Friend].Contains(thisPtr->GameObject.ObjectID)) ||
                        (_config.ShowCompanyPlayer && _players[ContainerType.Company].Contains(thisPtr->GameObject.ObjectID)) ||
                        (_config.ShowPartyPlayer && _players[ContainerType.Party].Contains(thisPtr->GameObject.ObjectID)) ||
                        (_config.Whitelist.Any(x => UnsafeArrayEqual(Encoding.UTF8.GetBytes(x.Name),
                                                                     thisPtr->GameObject.Name) &&
                                               x.HomeworldId == thisPtr->HomeWorld)))
                    {
                        break;
                    }
                    else
                    {
                        thisPtr->GameObject.RenderFlags |= (int)VisibilityFlags.Invisible;
                        HiddenObjectIds.Add(thisPtr->GameObject.ObjectID);
                        break;
                    }

                case (byte)ObjectKind.BattleNpc when thisPtr->GameObject.SubKind == (byte)BattleNpcSubKind.Pet && thisPtr->NameID != 6565:
                    if (!_config.HidePet ||
                        thisPtr->GameObject.OwnerID == LocalPlayer->Character.GameObject.ObjectID)
                    {
                        break;
                    }

                    _pets[ContainerType.All].Add(thisPtr->GameObject.ObjectID);

                    if (_players[ContainerType.Friend].Contains(thisPtr->GameObject.OwnerID))
                    {
                        _pets[ContainerType.Friend].Add(thisPtr->GameObject.ObjectID);
                    }

                    if (_players[ContainerType.Party].Contains(thisPtr->GameObject.OwnerID))
                    {
                        _pets[ContainerType.Party].Add(thisPtr->GameObject.ObjectID);
                    }

                    if (_players[ContainerType.Company].Contains(thisPtr->GameObject.OwnerID))
                    {
                        _pets[ContainerType.Company].Add(thisPtr->GameObject.ObjectID);
                    }

                    if ((_config.ShowFriendPet && _players[ContainerType.Friend].Contains(thisPtr->GameObject.OwnerID)) ||
                        (_config.ShowCompanyPet && _players[ContainerType.Company].Contains(thisPtr->GameObject.OwnerID)) ||
                        (_config.ShowPartyPet && _players[ContainerType.Party].Contains(thisPtr->GameObject.OwnerID)))
                    {
                        break;
                    }
                    else
                    {
                        thisPtr->GameObject.RenderFlags |= (int)VisibilityFlags.Invisible;
                        HiddenObjectIds.Add(thisPtr->GameObject.ObjectID);
                        break;
                    }

                case (byte)ObjectKind.BattleNpc
                    when thisPtr->GameObject.SubKind == (byte)BattleNpcSubKind.Pet && thisPtr->NameID == 6565
                    :                             // Earthly Star
                    if (_config.HideStar &&
                        _pluginInterface.ClientState.Condition[ConditionFlag.InCombat] &&
                        thisPtr->GameObject.OwnerID != LocalPlayer->Character.GameObject.ObjectID &&
                        !_players[ContainerType.Party].Contains(thisPtr->GameObject.OwnerID))
                    {
                        thisPtr->GameObject.RenderFlags |= (int)VisibilityFlags.Invisible;
                        HiddenObjectIds.Add(thisPtr->GameObject.ObjectID);
                    }

                    break;

                case (byte)ObjectKind.BattleNpc when thisPtr->GameObject.SubKind == 3:
                    if (!_config.HideChocobo ||
                        thisPtr->GameObject.OwnerID == LocalPlayer->Character.GameObject.ObjectID)
                    {
                        break;
                    }

                    _chocobos[ContainerType.All].Add(thisPtr->GameObject.ObjectID);

                    if (_players[ContainerType.Friend].Contains(thisPtr->GameObject.OwnerID))
                    {
                        _chocobos[ContainerType.Friend].Add(thisPtr->GameObject.ObjectID);
                    }

                    if (_players[ContainerType.Party].Contains(thisPtr->GameObject.OwnerID))
                    {
                        _chocobos[ContainerType.Party].Add(thisPtr->GameObject.ObjectID);
                    }

                    if (_players[ContainerType.Company].Contains(thisPtr->GameObject.OwnerID))
                    {
                        _chocobos[ContainerType.Company].Add(thisPtr->GameObject.ObjectID);
                    }

                    if ((_config.ShowFriendChocobo && _players[ContainerType.Friend].Contains(thisPtr->GameObject.OwnerID)) ||
                        (_config.ShowCompanyChocobo && _players[ContainerType.Company].Contains(thisPtr->GameObject.OwnerID)) ||
                        (_config.ShowPartyChocobo && _players[ContainerType.Party].Contains(thisPtr->GameObject.OwnerID)))
                    {
                        break;
                    }
                    else
                    {
                        thisPtr->GameObject.RenderFlags |= (int)VisibilityFlags.Invisible;
                        HiddenObjectIds.Add(thisPtr->GameObject.ObjectID);
                        break;
                    }
                }
            }

            hookCharacterEnableDraw.Original(thisPtr);
        }
Exemplo n.º 11
0
 public CharacterIterator(Character *ptr)
 {
     _ptr    = ptr;
     _index  = -1;
     Current = null;
 }
Exemplo n.º 12
0
        void ISignalOnDamageBefore.OnDamageBefore(Frame f, DamageData *dmg)
        {
            Character *theChar = f.GetCharacter(dmg->Character);

            theChar->CharacterSpec.ProcessDamage(dmg);
        }