public override void Draw()
        {
            if (groupManager == null)
            {
                groupManager = (GroupManager *)Service.SigScanner.GetStaticAddressFromSig("48 8D 0D ?? ?? ?? ?? 44 8B E7");
            }

            DebugManager.ClickToCopyText($"{(ulong) groupManager:X}"); ImGui.SameLine();

            DebugManager.PrintOutObject(*groupManager, (ulong)groupManager, new List <string>());


            if (groupManager->MemberCount < 1)
            {
                ImGui.Text("Not in a party");
            }
            else
            {
                ImGui.Text($"Party Member Count: {groupManager->MemberCount}");

                var partyMembers = (PartyMember *)groupManager->PartyMembers;

                for (var i = 0; i < 8 && i < groupManager->MemberCount; i++)
                {
                    var partyMember = partyMembers[i];
                    var name        = Marshal.PtrToStringAnsi(new IntPtr(partyMember.Name));
                    ImGui.Text($"[{(ulong)&partyMember:X}] Lv {partyMember.Level}, {partyMember.ObjectID:X}, {name}");

                    PlayerCharacter chara = null;

                    for (var a = 0; a < Service.Objects.Length; a += 2)
                    {
                        var actor = Service.Objects[a];
                        if (actor == null)
                        {
                            continue;
                        }
                        if ((uint)actor.ObjectId == partyMember.ObjectID && actor is PlayerCharacter pc)
                        {
                            chara = pc;
                        }
                    }

                    if (chara != null)
                    {
                        DebugManager.PrintOutObject(chara, (ulong)chara.Address.ToInt64(), new List <string>());
                    }
                }
            }
        }
示例#2
0
        private void Chat_OnChatMessage(XivChatType type, uint senderId, ref SeString sender, ref SeString message, ref bool isHandled)
        {
            if (!Config.Enable)
            {
                return;
            }
            if (!Enum.IsDefined(typeof(XivChatType), type))
            {
                return;
            }
            if (Config.FilteredChannels.IndexOf((ushort)type) != -1)
            {
                return;
            }
            if (Config.HiddenChatType.IndexOf(type) != -1)
            {
                return;
            }
            if (Condition[ConditionFlag.BetweenAreas] || Condition[ConditionFlag.BetweenAreas51])
            {
                return;
            }
            var  pattern = Config.TextPattern;
            bool matched = false;

            if (!Config.RegexMatch)
            {
                matched = (message.TextValue.IndexOf(pattern) != -1);
            }
            else
            {
                Regex rx = new Regex(pattern, RegexOptions.IgnoreCase);
                matched = rx.Matches(message.TextValue).Count > 0;
            }
            if (matched)
            {
                var senderPayload = sender.Payloads.Where(payload => payload is PlayerPayload).FirstOrDefault();
                if (senderPayload != default(Payload) && senderPayload is PlayerPayload playerPayload)
                {
                    if (groupManagerAddress != IntPtr.Zero)
                    {
                        unsafe
                        {
                            GroupManager *groupManager = (GroupManager *)groupManagerAddress;
                            if (groupManager->MemberCount >= 8)
                            {
                                Log($"Full party, won't invite.");
                                if (timedRecruitment.isRunning)
                                {
                                    timedRecruitment.runUntil = 0;
                                }
                                return;
                            }
                            else
                            {
                                if (groupManager->MemberCount > 0)
                                {
                                    var    partyMembers = (PartyMember *)groupManager->PartyMembers;
                                    var    leader       = partyMembers[groupManager->PartyLeaderIndex];
                                    string leaderName   = StringFromNativeUtf8(new IntPtr(leader.Name));

                                    if (ClientState.LocalPlayer.Name.ToString() != leaderName)
                                    {
                                        Log($"Not leader, won't invite. (Leader: {leaderName})");
                                        return;
                                    }
                                }
                                Log($"Party Count:{groupManager->MemberCount}");
                            }
                        }
                    }
                    var tc64 = Native.GetTickCount64();
                    if (tc64 > NextInviteAt)
                    {
                        if (timedRecruitment.isRunning && timedRecruitment.MaxInvitations > 0)
                        {
                            if (timedRecruitment.InvitationAttempts >= timedRecruitment.MaxInvitations)
                            {
                                Log($"Reached target amound of invitations, won't invite {timedRecruitment.InvitationAttempts}/{timedRecruitment.MaxInvitations}");
                                timedRecruitment.runUntil = 0;
                                return;
                            }
                            else
                            {
                                timedRecruitment.InvitationAttempts++;
                                Log($"Invitation {timedRecruitment.InvitationAttempts} out of {timedRecruitment.MaxInvitations}");
                            }
                        }
                        NextInviteAt = tc64 + (uint)Config.Ratelimit;
                        if (Config.Eureka)
                        {
                            Task.Run(() =>
                            {
                                ProcessEurekaInvite(playerPayload);
                            });
                        }
                        else
                        {
                            Task.Run(() =>
                            {
                                ProcessInvite(playerPayload);
                            });
                        }
                    }
                    else
                    {
                        Log($"Rate limiting invitation (next invite in {NextInviteAt - tc64} ms)");
                    }
                }
            }
        }