public static byte[] Create(N3Message messageBody) { IntPtr pEngine = N3Engine_t.GetInstance(); if (pEngine == IntPtr.Zero) { return(null); } int localDynelInstance = N3EngineClient_t.GetClientInst(pEngine); messageBody.Identity = new Identity(IdentityType.SimpleChar, localDynelInstance); var message = new Message { Body = messageBody, Header = new Header { MessageId = BitConverter.ToUInt16(new byte[] { 0xFF, 0xFF }, 0), PacketType = messageBody.PacketType, Unknown = 0x0001, Sender = localDynelInstance, Receiver = 0x02 } }; using (MemoryStream stream = new MemoryStream()) { _serializer.Serialize(stream, message); return(stream.ToArray()); } }
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)); }
private static bool GetIsRaid() { IntPtr pEngine = N3Engine_t.GetInstance(); if (pEngine == IntPtr.Zero) { return(false); } return(N3EngineClientAnarchy_t.IsInRaidTeam(pEngine)); }
public float GetAttackRange() { IntPtr pEngine = N3Engine_t.GetInstance(); if (pEngine == IntPtr.Zero) { return(0f); } return(N3EngineClientAnarchy_t.GetAttackRange(pEngine)); }
private static LocalPlayer GetLocalPlayer() { IntPtr pEngine = N3Engine_t.GetInstance(); if (pEngine == IntPtr.Zero) { return(null); } IntPtr pLocalPlayer = N3EngineClient_t.GetClientControlDynel(pEngine); return(pLocalPlayer == IntPtr.Zero ? null : new LocalPlayer(pLocalPlayer)); }
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; }
public bool IsInTeam() { IntPtr pEngine = N3Engine_t.GetInstance(); if (pEngine == IntPtr.Zero) { return(false); } Identity identity = Identity; return(N3EngineClientAnarchy_t.IsInTeam(pEngine, &identity)); }
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); } }
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()); }
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))); }
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); }
private unsafe bool GetIsLeader() { IntPtr pEngine = N3Engine_t.GetInstance(); if (pEngine == IntPtr.Zero) { return(false); } Identity identity = Identity; return(N3EngineClientAnarchy_t.IsTeamLeader(pEngine, &identity)); }
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); }
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); }
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) { } }
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); }
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)); } }
public void StopAttack() { IntPtr pEngine = N3Engine_t.GetInstance(); if (pEngine == IntPtr.Zero) { return; } N3EngineClientAnarchy_t.StopAttack(pEngine); if (Pets.Length > 0) { Pets.Follow(); } }
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)); }
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); }
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); }
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); }
//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); } }
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)); } }
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 }); } }
private static unsafe List <PerkAction> GetPerkActions() { List <PerkAction> perks = new List <PerkAction>(); IntPtr pEngine = N3Engine_t.GetInstance(); if (pEngine == IntPtr.Zero) { return(perks); } foreach (IntPtr pAction in N3EngineClientAnarchy_t.GetSpecialActionList(pEngine)->ToList()) { SpecialActionMemStruct specialAction = *(SpecialActionMemStruct *)pAction; if (specialAction.Identity.Type != IdentityType.PerkHash) { continue; } perks.Add(new PerkAction(specialAction.TemplateIdentity, specialAction.Identity.Instance)); } return(perks.OrderBy(perk => perk.Identity.Instance).ToList()); }
public bool Remove() { IntPtr pEngine = N3Engine_t.GetInstance(); if (pEngine == IntPtr.Zero) return(false); }