/// <summary> /// Called everytime a exchange invitation is detected. /// </summary> public void OnExchangeRequest(uint uniqueID) { Window w = Window.Get; if (w.Character_cbxRefuseExchange.Checked) { PacketBuilder.PlayerPetitionResponse(false, SRTypes.PlayerPetition.ExchangeRequest); } else if (w.Character_cbxAcceptExchange.Checked) { SREntity entity = InfoManager.GetEntity(uniqueID); if (w.Character_cbxAcceptExchangeLeaderOnly.Checked) { bool found = false; w.Party_lstvLeaderList.InvokeIfRequired(() => { found = w.Party_lstvLeaderList.Items.ContainsKey(entity.Name.ToUpper()); }); if (found) { PacketBuilder.PlayerPetitionResponse(true, SRTypes.PlayerPetition.ExchangeRequest); } } else { PacketBuilder.PlayerPetitionResponse(true, SRTypes.PlayerPetition.ExchangeRequest); } } }
/// <summary> /// Called when a player is giving you resurrection request /// </summary> public void OnResurrection(uint UniqueID) { Window w = Window.Get; if (w.Character_cbxAcceptRess.Checked) { if (!w.Character_cbxAcceptRessPartyOnly.Checked) { PacketBuilder.PlayerPetitionResponse(true, SRTypes.PlayerPetition.Resurrection); } else { SREntity player = InfoManager.GetEntity(UniqueID); if (player != null) { if (InfoManager.Party.Members.Find(p => p.Name == player.Name) != null) { PacketBuilder.PlayerPetitionResponse(true, SRTypes.PlayerPetition.Resurrection); } } } } }
/// <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); } }