Exemple #1
0
        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) != 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);
        }
Exemple #2
0
 public MasterRequestResponse(MasterRequest pRequest)
 {
     PRequest       = pRequest;
     ResponseAnswer = CheckRequestBeforSendRequest(pRequest);
 }