public static void HandlePkStatistic(Character pUser, MsgPkStatistic pMsg) { switch (pMsg.Subtype) { case 0: { pUser.PkExploit.SendAll((int)pMsg.MaxValues); break; } default: { ServerKernel.Log.SaveLog(string.Format("Invalid 2220:{0} type", pMsg.Subtype)); break; } } }
public void SendAll(int nPage) { int maxPerPage = 10; MsgPkStatistic pMsg = new MsgPkStatistic { Subtype = 1, Values = (uint)m_pkExploits.Count }; int nMinValue = maxPerPage * nPage; int nMaxValue = maxPerPage * (nPage + 1); int i = 0; foreach (var obj in m_pkExploits.Values.OrderByDescending(x => x.Amount)) { if (i < nMinValue) { i++; continue; } if (i >= nMaxValue) { break; } string location = "Invalid"; if (ServerKernel.Maps.ContainsKey(obj.Location)) { location = ServerKernel.Maps[obj.Location].Name; } pMsg.AddTarget(obj.TargetName, location, uint.Parse(UnixTimestamp.ToDateTime(obj.LastTime).ToString("ddMMHHmm")), obj.Amount, 0, obj.Level, obj.BattlePower); i++; } m_pOwner.Send(pMsg); }