protected override void OnClick() { TroopRoster prisonRoster = MobileParty.MainParty.PrisonRoster; int num = 0; IRecruitPrisonersCampaignBehavior campaignBehavior = Campaign.Current.GetCampaignBehavior <IRecruitPrisonersCampaignBehavior>(); CharacterObject bestPrisoner = null; while ((bestPrisoner = getBestRecruitablePrisoner()) != null) { if (MobileParty.MainParty.Party.PartySizeLimit <= MobileParty.MainParty.MemberRoster.TotalManCount) { break; } int recruitableNumber = Campaign.Current.GetCampaignBehavior <IRecruitPrisonersCampaignBehavior>().GetRecruitableNumber(bestPrisoner); if (recruitableNumber > 0) { int maxRecruitable = MobileParty.MainParty.Party.PartySizeLimit - MobileParty.MainParty.MemberRoster.TotalManCount; recruitableNumber = Math.Min(recruitableNumber, maxRecruitable); num += recruitableNumber; PartyCommand command = new PartyCommand(); command.FillForRecruitTroop(PartyRosterSide.Right, TroopType.Prisoner, bestPrisoner, recruitableNumber); _partyLogic.AddCommand(command); } } InformationManager.DisplayMessage(new InformationMessage("Recruited " + num.ToString() + " prisoners")); }
public void SendPartyResult(ClientClass objCharacter, string name, PartyCommand operation, PartyCommandResult result) { var response = new PacketClass(Opcodes.SMSG_PARTY_COMMAND_RESULT); response.AddInt32((byte)operation); response.AddString(name); response.AddInt32((byte)result); objCharacter.Send(response); response.Dispose(); }