示例#1
0
        public override bool TakeAction()
        {
            PlayerEpigraphLogic pe = new PlayerEpigraphLogic();

            pe.SetUser(m_UserId);
            PlayerPackageLogic pp = new PlayerPackageLogic();

            pp.SetUser(m_UserId);
            if (m_RequestPacket.DressedEpigraph != null)
            {
                int type  = m_RequestPacket.DressedEpigraph.Type;
                int level = m_RequestPacket.DressedEpigraph.Level;
                if (!pp.DeductEpigraph(type, level))
                {
                    ErrorCode = (int)ErrorType.RequireNotMet;
                    ErrorInfo = "you do not have this epigraph";
                    return(false);
                }
                pe.DressEpigraph(type, level, m_RequestPacket.Index);
                m_ResponsePacket.Index           = m_RequestPacket.Index;
                m_ResponsePacket.DressedEpigraph = m_RequestPacket.DressedEpigraph;
                return(true);
            }
            else if (m_RequestPacket.UndressedEpigraph != null)
            {
                int type  = m_RequestPacket.UndressedEpigraph.Type;
                int level = m_RequestPacket.UndressedEpigraph.Level;
                if (!pe.UndressEpigraph(type, level, m_RequestPacket.Index))
                {
                    ErrorCode = (int)ErrorType.RequireNotMet;
                    ErrorInfo = "you do not have this epigraph";
                    return(false);
                }
                pp.AddEpigraph(type, level);
                m_ResponsePacket.Index             = m_RequestPacket.Index;
                m_ResponsePacket.UndressedEpigraph = m_RequestPacket.UndressedEpigraph;
                return(true);
            }
            else
            {
                int type  = m_RequestPacket.UndressedEpigraph.Type;
                int level = m_RequestPacket.UndressedEpigraph.Level;
                if (!pe.UndressEpigraph(type, level, m_RequestPacket.Index))
                {
                    ErrorCode = (int)ErrorType.RequireNotMet;
                    ErrorInfo = "you do not have this epigraph";
                    return(false);
                }
                pe.DressEpigraph(type, level, m_RequestPacket.Index);
                m_ResponsePacket.Index             = m_RequestPacket.Index;
                m_ResponsePacket.DressedEpigraph   = m_RequestPacket.DressedEpigraph;
                m_ResponsePacket.UndressedEpigraph = m_RequestPacket.UndressedEpigraph;
                return(true);
            }
        }