Esempio n. 1
0
        private static unsafe List <TeamMember> GetMemberList()
        {
            List <TeamMember> teamMembers = new List <TeamMember>();

            if (!IsInTeam)
            {
                return(teamMembers);
            }

            IntPtr pEngine = N3Engine_t.GetInstance();

            if (pEngine == IntPtr.Zero)
            {
                return(teamMembers);
            }


            for (int i = 0; i < (IsRaid ? 6 : 1); i++)
            {
                StdObjVector *pMemberList = N3EngineClientAnarchy_t.GetTeamMemberList(pEngine, i);

                if (pMemberList == null)
                {
                    continue;
                }

                foreach (IntPtr pMember in pMemberList->ToList())
                {
                    teamMembers.Add(new TeamMember(pMember, i));
                }
            }

            return(teamMembers);
        }
        public static void UseItem(Identity identity, bool unknown = false)
        {
            IntPtr pEngine = N3Engine_t.GetInstance();

            if (pEngine != IntPtr.Zero)
            {
                N3EngineClientAnarchy_t.UseItem(pEngine, ref identity, unknown);
            }
        }
        public static void UseItemOnCharacter(Identity source, Identity target)
        {
            IntPtr pEngine = N3Engine_t.GetInstance();

            if (pEngine != IntPtr.Zero)
            {
                N3EngineClientAnarchy_t.UseItemOnCharacter(pEngine, ref source, ref target);
            }
        }
        public static bool HasPerk(int perkId)
        {
            IntPtr pEngine = N3Engine_t.GetInstance();

            if (pEngine == IntPtr.Zero)
            {
                throw new NullReferenceException("Could not get N3Engine instance");
            }

            return(N3EngineClientAnarchy_t.HasPerk(pEngine, perkId));
        }
Esempio n. 5
0
        public float GetAttackRange()
        {
            IntPtr pEngine = N3Engine_t.GetInstance();

            if (pEngine == IntPtr.Zero)
            {
                return(0f);
            }

            return(N3EngineClientAnarchy_t.GetAttackRange(pEngine));
        }
Esempio n. 6
0
        private static bool GetIsRaid()
        {
            IntPtr pEngine = N3Engine_t.GetInstance();

            if (pEngine == IntPtr.Zero)
            {
                return(false);
            }

            return(N3EngineClientAnarchy_t.IsInRaidTeam(pEngine));
        }
Esempio n. 7
0
        private unsafe bool GetIsLeader()
        {
            IntPtr pEngine = N3Engine_t.GetInstance();

            if (pEngine == IntPtr.Zero)
            {
                return(false);
            }

            Identity identity = Identity;

            return(N3EngineClientAnarchy_t.IsTeamLeader(pEngine, &identity));
        }
Esempio n. 8
0
        private bool GetIsAvailable()
        {
            IntPtr pEngine = N3Engine_t.GetInstance();

            if (pEngine == IntPtr.Zero)
            {
                return(false);
            }

            Identity identity = Identity;

            return(N3EngineClientAnarchy_t.GetSpecialActionState(pEngine, ref identity) == SpecialActionState.Ready);
        }
Esempio n. 9
0
        private Buff[] GetBuffs()
        {
            IntPtr pEngine = N3Engine_t.GetInstance();

            if (pEngine == IntPtr.Zero)
            {
                return(new Buff[0]);
            }

            Identity identity = Identity;

            return(N3EngineClientAnarchy_t.GetNanoTemplateInfoList(pEngine, &identity)->ToList().Select(x => new Buff(Identity, (*(NanoTemplateInfoMemStruct *)x).Identity)).ToArray());
        }
Esempio n. 10
0
        public bool IsInTeam()
        {
            IntPtr pEngine = N3Engine_t.GetInstance();

            if (pEngine == IntPtr.Zero)
            {
                return(false);
            }

            Identity identity = Identity;

            return(N3EngineClientAnarchy_t.IsInTeam(pEngine, &identity));
        }
Esempio n. 11
0
        private unsafe float GetTotalTime()
        {
            IntPtr pEngine = N3Engine_t.GetInstance();

            if (pEngine == IntPtr.Zero)
                return(0);

            fixed(Identity *pIdentity = &Identity)
            fixed(Identity * pOwner = &Owner)
            {
                return(N3EngineClientAnarchy_t.GetBuffTotalTime(pEngine, pIdentity, pOwner) / 100f);
            }
        }
Esempio n. 12
0
        public static string GetName(Identity identity)
        {
            IntPtr pEngine = N3Engine_t.GetInstance();

            if (pEngine == IntPtr.Zero)
            {
                return(null);
            }

            Identity garbage = new Identity();

            return(Utils.UnsafePointerToString(N3EngineClientAnarchy_t.GetName(pEngine, ref identity, ref garbage)));
        }
Esempio n. 13
0
        public void Attack(Identity target)
        {
            IntPtr pEngine = N3Engine_t.GetInstance();

            if (pEngine == IntPtr.Zero)
            {
                return;
            }

            N3EngineClientAnarchy_t.DefaultAttack(pEngine, &target, true);

            _nextAttack = Time.NormalTime + AttackAttemptDelay;
        }
Esempio n. 14
0
        public void N3EngineClientAnarchy_PlayfieldInit_Hook(IntPtr pThis, uint id)
        {
            N3EngineClientAnarchy_t.PlayfieldInit(pThis, id);

            try
            {
                if (_pluginProxy != null)
                {
                    _pluginProxy.PlayfieldInit(id);
                }
            }
            catch (Exception) { }
        }
Esempio n. 15
0
        public bool N3EngineClientAnarchy_SendInPlayMessage_Hook(IntPtr pThis)
        {
            try
            {
                if (_pluginProxy != null)
                {
                    _pluginProxy.TeleportEnded();
                }
            }
            catch (Exception) { }

            return(N3EngineClientAnarchy_t.SendInPlayMessage(pThis));
        }
Esempio n. 16
0
        private bool GetIsOpen()
        {
            IntPtr pEngine = N3Engine_t.GetInstance();

            if (pEngine == IntPtr.Zero)
            {
                return(false);
            }

            Identity identity = Identity;
            IntPtr   pItems   = N3EngineClientAnarchy_t.GetInventoryVec(pEngine, ref identity);

            return(pItems != IntPtr.Zero);
        }
Esempio n. 17
0
        public static unsafe List <Item> GetContainerItems(Identity identity)
        {
            List <Item> items = new List <Item>();

            IntPtr pEngine = N3Engine_t.GetInstance();

            if (pEngine == IntPtr.Zero)
            {
                return(items);
            }

            IntPtr pInvList = N3EngineClientAnarchy_t.GetContainerInventoryList(pEngine, &identity);

            if (pInvList == IntPtr.Zero)
            {
                return(items);
            }

            IntPtr pItems = N3EngineClientAnarchy_t.GetInventoryVec(pEngine, ref identity);

            if (pItems == IntPtr.Zero)
            {
                return(items);
            }

            List <IntPtr> containerInvList = (*(StdObjList *)pInvList).ToList();

            int i = 0;

            foreach (IntPtr pItem in (*(StdStructVector *)pItems).ToList(sizeof(IntPtr)))
            {
                IntPtr pActualItem = *(IntPtr *)pItem;

                if (pActualItem != IntPtr.Zero)
                {
                    try
                    {
                        int      lowId          = (*(ItemMemStruct *)pActualItem).LowId;
                        int      highId         = (*(ItemMemStruct *)pActualItem).HighId;
                        int      ql             = (*(ItemMemStruct *)pActualItem).QualityLevel;
                        Identity unqiueIdentity = (*(ItemMemStruct *)pActualItem).UniqueIdentity;
                        Identity slot           = *((Identity *)(containerInvList[i] + 0x8));
                        items.Add(new Item(lowId, highId, ql, unqiueIdentity, slot));
                    } catch {}
                    i++;
                }
            }
            return(items);
        }
Esempio n. 18
0
        internal unsafe DummyItem(Identity identity)
        {
            Identity none    = Identity.None;
            IntPtr   pEngine = N3Engine_t.GetInstance();
            IntPtr   pItem   = N3EngineClientAnarchy_t.GetItemByTemplate(pEngine, identity, &none);

            if (pItem == IntPtr.Zero)
            {
                throw new Exception($"DummyItem::DummyItem - Unable to locate item {identity}");
            }

            Pointer  = pItem;
            Identity = (*(MemStruct *)pItem).Identity;
            Name     = Utils.UnsafePointerToString((*(MemStruct *)pItem).Name);
        }
Esempio n. 19
0
        private unsafe void TeamViewModule_SlotJoinTeamRequestFailed_Hook(IntPtr pThis, ref Identity identity)
        {
            try
            {
                IntPtr pEngine = N3Engine_t.GetInstance();

                if (pEngine == IntPtr.Zero)
                {
                    return;
                }

                N3EngineClientAnarchy_t.TeamJoinRequest(pEngine, ref identity, true);
            }
            catch (Exception) { }
        }
Esempio n. 20
0
        public void StopAttack()
        {
            IntPtr pEngine = N3Engine_t.GetInstance();

            if (pEngine == IntPtr.Zero)
            {
                return;
            }

            N3EngineClientAnarchy_t.StopAttack(pEngine);

            if (Pets.Length > 0)
            {
                Pets.Follow();
            }
        }
Esempio n. 21
0
        public static unsafe bool CreateDummyItemID(int lowId, int highId, int ql, out Identity dummyItemId)
        {
            ACGItem itemInfo = new ACGItem
            {
                LowId  = lowId,
                HighId = highId,
                QL     = ql
            };

            IntPtr pEngine = N3Engine_t.GetInstance();

            fixed(Identity *pDummyItemId = &dummyItemId)
            {
                return(N3EngineClientAnarchy_t.CreateDummyItemID(pEngine, pDummyItemId, &itemInfo));
            }
        }
Esempio n. 22
0
        public void N3EngineClientAnarchy_RunEngine_Hook(IntPtr pThis, float deltaTime)
        {
            try
            {
                if (_pluginProxy != null)
                {
                    _pluginProxy.RunPendingPluginInitializations();

                    _pluginProxy.EarlyUpdate(deltaTime);

                    N3EngineClientAnarchy_t.RunEngine(pThis, deltaTime);

                    _pluginProxy.Update(deltaTime);
                }
            }
            catch (Exception) { }
        }
Esempio n. 23
0
        public bool IsAvailable()
        {
            if (Time.NormalTime < _nextAttack)
            {
                return(false);
            }

            IntPtr pEngine = N3Engine_t.GetInstance();

            if (pEngine == IntPtr.Zero)
            {
                return(false);
            }

            //Why is this inverted lol?
            return(!N3EngineClientAnarchy_t.IsSecondarySpecialAttackAvailable(pEngine, _stat));
        }
Esempio n. 24
0
        private unsafe bool N3EngineClientAnarchy_PerformSpecialAction_Hook(IntPtr pThis, IntPtr identity)
        {
            bool specialActionResult = N3EngineClientAnarchy_t.PerformSpecialAction(pThis, ref *(Identity *)identity);

            try
            {
                if (_pluginProxy != null)
                {
                    if (specialActionResult)
                    {
                        _pluginProxy.ClientPerformedSpecialAction(identity);
                    }
                }
            }
            catch (Exception) { }

            return(specialActionResult);
        }
Esempio n. 25
0
        public unsafe bool UseOn(Identity target)
        {
            IntPtr pEngine = N3Engine_t.GetInstance();

            if (pEngine == IntPtr.Zero)
            {
                return(false);
            }

            bool successful = N3EngineClientAnarchy_t.SecondarySpecialAttack(pEngine, &target, _stat);

            if (successful)
            {
                _nextAttack = Time.NormalTime + ATTACK_DELAY_BUFFER;
            }

            return(successful);
        }
Esempio n. 26
0
        private static unsafe List <Perk> GetFullPerkMap()
        {
            List <Perk> perks = new List <Perk>();

            IntPtr pEngine = N3Engine_t.GetInstance();

            if (pEngine == IntPtr.Zero)
            {
                return(perks);
            }

            foreach (PerkMemStruct perkMemStruct in N3EngineClientAnarchy_t.GetFullPerkMap(pEngine)->ToList <PerkMemStruct>())
            {
                Perk perk = new Perk(perkMemStruct.Instance, perkMemStruct.TemplateInstance,
                                     perkMemStruct.PrerequisitePerkInstance, perkMemStruct.PerkType, perkMemStruct.AllowedProfessions,
                                     perkMemStruct.ActionInstance, perkMemStruct.RequiredExperience);

                perks.Add(perk);
            }

            // I'm not doing the following in the Perk constructor because we need the full perk
            // map to do it and querying the entire perk map again in the constructor is too expensive

            string currentName  = "NoName";
            int    currentLevel = 1;

            foreach (Perk perk in perks.OrderBy(perk => perk.Instance))
            {
                if (perk.Name != currentName)
                {
                    currentName  = perk.Name;
                    currentLevel = 1;
                }

                perk.Level = currentLevel;

                currentLevel++;
            }

            return(perks);
        }
Esempio n. 27
0
        internal unsafe DummyItem(int lowId, int highId, int ql)
        {
            Identity none    = Identity.None;
            IntPtr   pEngine = N3Engine_t.GetInstance();

            if (!CreateDummyItemID(lowId, highId, ql, out Identity dummyItemId))
            {
                throw new Exception($"Failed to create dummy item. LowId: {lowId}\tLowId: {highId}\tLowId: {ql}");
            }

            IntPtr pItem = N3EngineClientAnarchy_t.GetItemByTemplate(pEngine, dummyItemId, &none);

            if (pItem == IntPtr.Zero)
            {
                throw new Exception($"DummyItem::DummyItem - Unable to locate item. LowId: {lowId}\tLowId: {highId}\tLowId: {ql}");
            }

            Pointer  = pItem;
            Identity = (*(MemStruct *)pItem).Identity;
            Name     = Utils.UnsafePointerToString((*(MemStruct *)pItem).Name);
        }
Esempio n. 28
0
        //Must be called from game loop!
        private static void ChangeMovement(MovementAction action)
        {
            if (action == MovementAction.LeaveSit)
            {
                Network.Send(new CharacterActionMessage()
                {
                    Action = CharacterActionType.StandUp
                });
            }
            else
            {
                IntPtr pEngine = N3Engine_t.GetInstance();

                if (pEngine == IntPtr.Zero)
                {
                    return;
                }

                N3EngineClientAnarchy_t.MovementChanged(pEngine, action, 0, 0, true);
            }
        }
Esempio n. 29
0
        public unsafe bool Use(SimpleChar target, bool setTarget = false, bool packetOnly = false)
        {
            if (target == null)
            {
                target = DynelManager.LocalPlayer;
            }

            if (setTarget)
            {
                target.Target();
            }

            if (packetOnly)
            {
                Network.Send(new CharacterActionMessage()
                {
                    Action     = CharacterActionType.UsePerk,
                    Target     = target.Identity,
                    Parameter1 = Identity.Instance,
                    Parameter2 = (int)Hash
                });

                EnqueuePendingPerk(this);

                return(true);
            }
            else
            {
                IntPtr pEngine = N3Engine_t.GetInstance();

                if (pEngine == IntPtr.Zero)
                {
                    return(false);
                }

                Identity identity = Identity;
                return(N3EngineClientAnarchy_t.PerformSpecialAction(pEngine, ref identity));
            }
        }
Esempio n. 30
0
        public static unsafe void SetTarget(Identity target, bool packetOnly = false)
        {
            if (!packetOnly)
            {
                TargetingModule_t.SetTarget(ref target, false);

                IntPtr pEngine = N3Engine_t.GetInstance();

                if (pEngine == IntPtr.Zero)
                {
                    return;
                }

                N3EngineClientAnarchy_t.SelectedTarget(pEngine, ref target);
            }
            else
            {
                Network.Send(new LookAtMessage()
                {
                    Target = target
                });
            }
        }