// 1. 매칭을 어떻게 해야 할까? private bool MatchingUser(fmLord lord, out fmLord target) { target = null; int gapLv = 5; int minLv = lord.GetLv() <= gapLv ? 1 : lord.GetLv() - gapLv; int maxLv = lord.GetLv() + gapLv; maxLv = 70 <= maxLv ? 70 : maxLv; DateTime limitTime = fmServerTime.Now.AddMinutes(-20); List <fmLord> rndlist = new List <fmLord>(); int cnt = m_lords.Count; for (int i = cnt - 1; 0 <= i; --i) { fmLord node = m_lords.ElementAt(i).Value; if (lord == node) { continue; } if (node.GetLv() < minLv) { continue; } if (maxLv < node.GetLv()) { continue; } if (node.State == eLordState.Logout) { continue; } if (node.ActTime < limitTime) { continue; } rndlist.Add(node); if (30 < rndlist.Count) { break; } } if (rndlist.Count <= 0) { return(false); } target = rndlist[m_random.Next(0, rndlist.Count)]; rndlist.Clear(); rndlist = null; return(true); }
public override void Process() { // 기본 영주 정보 얻어오기 fmLord lord = null; m_session.TryGetLord(out lord); // 프로토콜 RQ using (var recvfmProtocol = new PT_CG_Item_Equip_RQ()) { // 프로토콜 Read recvfmProtocol.Deserialize(m_recvPacket); // 프로토콜 RS using (var sendfmProtocol = new PT_CG_Item_Equip_RS()) { // check if (null == lord) { sendfmProtocol.m_eErrorCode = eErrorCode.Auth_PleaseLogin; m_session.SendPacket(sendfmProtocol); return; } // check state if (lord.State != eLordState.Normal) { sendfmProtocol.m_eErrorCode = eErrorCode.Auth_PleaseLogin; m_session.SendPacket(sendfmProtocol); return; } // 아이템 장착 lord.TryEquip(recvfmProtocol, sendfmProtocol); // 프로토콜 send m_session.SendPacket(sendfmProtocol); if (sendfmProtocol.m_eErrorCode == eErrorCode.Success) { // 로그 남기기 ArchiveExecuter.Instance.Push(new Msg_Log_Act(m_server.dbLog(), new fmLogAct { Time = fmServerTime.Now, PType = sendfmProtocol.GeteProtocolType(), AccId = lord.AccId, Lv = lord.GetLv(), Gold = lord.GetGold(), C1 = lord.GetRuby(), C2 = lord.GetStone(), } )); } } } }