public void ProcessSynRecruitAdvertisingList(Client pClient, byte[] pBuffer) { if (pClient == null || pClient.Character == null) { return; } MsgSynRecruitAdvertisingList pMsg = new MsgSynRecruitAdvertisingList(pBuffer); ServerKernel.SyndicateRecruitment.SendSyndicates(pMsg.StartIndex, pMsg, pClient.Character); }
public void SendSyndicates(uint nPage, MsgSynRecruitAdvertisingList pMsg, Character pUser) { uint beginAt = pMsg.StartIndex; pMsg.FirstMatch = 1; pMsg.MaxCount = (uint)m_pSyndicateAdvertisings.Count; int nAmount = 0; foreach (var syn in m_pSyndicateAdvertisings.Values.OrderByDescending(x => x.Donation).ThenBy(x => x.Identity)) { if (nAmount < beginAt) { nAmount++; continue; } if (nAmount >= beginAt + _MAX_PER_PAGE_I) { break; } Syndicate pSyn; if (!ServerKernel.Syndicates.TryGetValue(syn.SyndicateIdentity, out pSyn) || pSyn.Deleted) { continue; } if (pMsg.Count >= 2) { pUser.Send(pMsg); pMsg = new MsgSynRecruitAdvertisingList { StartIndex = nPage, MaxCount = (uint)m_pSyndicateAdvertisings.Count }; } pMsg.Append(syn.SyndicateIdentity, syn.Message, syn.SyndicateName, pSyn.LeaderName, pSyn.Level, pSyn.MemberCount, pSyn.SilverDonation); nAmount++; } pUser.Send(pMsg); }