private bool CheckRequestBeforSendRequest(MasterRequest pRequest) { if (pRequest.InvitedClient.Character.MasterList.Find(m => m.pMemberName == pRequest.InviterClient.Character.Character.Name) != null) { RequestResponse(pRequest.InviterClient, 0x174E, pRequest.InviterClient.Character.Character.MasterJoin); return(false); } if (pRequest.InvitedClient.Character.MasterList.Find(d => d.IsMaster == true) != null) { RequestResponse(pRequest.InviterClient, 0x1749, pRequest.InviterClient.Character.Character.MasterJoin); return(false); } if (pRequest.InviterClient.Character.Character.CharLevel + 5 >= pRequest.InvitedClient.Character.Character.CharLevel) { RequestResponse(pRequest.InviterClient, 0x174C, pRequest.InviterClient.Character.Character.MasterJoin); return(false); } if (DateTime.Now.Subtract(pRequest.InviterClient.Character.Character.MasterJoin).TotalHours < 24) { RequestResponse(pRequest.InviterClient, 0x174A, pRequest.InviterClient.Character.Character.MasterJoin);//24 hours must pass before a master can receive a new apprentice. return(false); } if (pRequest.InviterClient.Character.MasterList.Count >= 20) { RequestResponse(pRequest.InviterClient, 0x174D, pRequest.InviterClient.Character.Character.MasterJoin); return(false); } return(true); }
public void AddMasterRequest(WorldClient pClient,string target) { MasterRequest Request = new MasterRequest(target,pClient); MasterRequestResponse response = new MasterRequestResponse(Request); if(response.responseAnswer) { response.SendMasterRequest(); pMasterRequests.Add(Request); } }
public MasterRequestResponse(MasterRequest pRequest) { this.pRequest = pRequest; this.responseAnswer = this.CheckRequestBeforSendRequest(pRequest); }