public static void CreateParty(uint uniqueID, SRParty.Setup setup)
        {
            Packet p = new Packet(Agent.Opcode.CLIENT_PARTY_CREATION_REQUEST);

            p.WriteUInt(uniqueID);
            p.WriteByte(setup);
            Bot.Get.Proxy.Agent.InjectToServer(p);
        }
Esempio n. 2
0
        /// <summary>
        /// Called everytime a party invitation is detected.
        /// </summary>
        public void OnPartyInvitation(uint uniqueID, SRParty.Setup Setup)
        {
            // Check GUI
            Window w = Window.Get;

            // All
            if (w.Party_cbxAcceptAll.Checked)
            {
                if (w.Party_cbxAcceptOnlyPartySetup.Checked)
                {
                    // Exactly same party setup?
                    if (w.GetPartySetup() == Setup)
                    {
                        PacketBuilder.PlayerPetitionResponse(true, SRTypes.PlayerPetition.PartyInvitation);
                    }
                    else if (w.Party_cbxRefuseInvitations.Checked)
                    {
                        PacketBuilder.PlayerPetitionResponse(false, SRTypes.PlayerPetition.PartyInvitation);
                    }
                }
                else
                {
                    PacketBuilder.PlayerPetitionResponse(true, SRTypes.PlayerPetition.PartyInvitation);
                }
                // Highest priority, has no sense continue checking ..
                return;
            }
            // Check party list
            if (w.Party_cbxAcceptPartyList.Checked)
            {
                string playerName = InfoManager.GetEntity(uniqueID).Name.ToUpper();

                bool found = false;
                w.Party_lstvPartyList.InvokeIfRequired(() => {
                    found = w.Party_lstvPartyList.Items.ContainsKey(playerName);
                });
                if (found)
                {
                    if (w.Party_cbxAcceptOnlyPartySetup.Checked)
                    {
                        if (w.GetPartySetup() == Setup)
                        {
                            PacketBuilder.PlayerPetitionResponse(true, SRTypes.PlayerPetition.PartyInvitation);
                            return;
                        }
                    }
                    else
                    {
                        PacketBuilder.PlayerPetitionResponse(true, SRTypes.PlayerPetition.PartyInvitation);
                        return;
                    }
                }
            }
            // Check leader list
            if (w.Party_cbxAcceptLeaderList.Checked)
            {
                string playerName = InfoManager.GetEntity(uniqueID).Name.ToUpper();

                bool found = false;
                w.Party_lstvLeaderList.InvokeIfRequired(() => {
                    w.Party_lstvLeaderList.InvokeIfRequired(() => {
                        found = w.Party_lstvLeaderList.Items.ContainsKey(playerName);
                    });
                });
                if (found)
                {
                    if (w.Party_cbxAcceptOnlyPartySetup.Checked)
                    {
                        if (w.GetPartySetup() == Setup)
                        {
                            PacketBuilder.PlayerPetitionResponse(true, SRTypes.PlayerPetition.PartyInvitation);
                            return;
                        }
                    }
                    else
                    {
                        PacketBuilder.PlayerPetitionResponse(true, SRTypes.PlayerPetition.PartyInvitation);
                        return;
                    }
                }
            }
            if (w.Party_cbxRefuseInvitations.Checked)
            {
                PacketBuilder.PlayerPetitionResponse(false, SRTypes.PlayerPetition.PartyInvitation);
            }
        }