Exemplo n.º 1
0
        public override eErrorCode Execute()
        {
            if (i_biAccID == 0 || true == string.IsNullOrEmpty(i_strName))
            {
                return(eErrorCode.Query_Params);
            }

            if (true == IsExistsName(i_strName))
            {
                return(eErrorCode.Lord_AlreadyExistName);
            }

            var db = GetDatabase();

            if (null == db)
            {
                return(eErrorCode.Server_Error);
            }

            var trans = GetDatabase().CreateTransaction();

            fmLordBase       lordInfo    = null;
            rdStat           lordStat    = null;
            List <rdItem>    items       = null;
            List <rdMission> missions    = null;
            List <rdMap>     maps        = null;
            fmMissionBase    missionBase = null;
            List <rdInDun>   inDuns      = null;

            if (false == theLordCreater.TryCreate(i_biAccID, i_strName, out o_lord))
            {
                return(eErrorCode.Server_TableError);
            }

            o_lord.TryGetItems(out items);
            o_lord.TryGetLordBase(out lordInfo);
            o_lord.TryGetStat(out lordStat);

            trans.InsertName(i_strName, i_biAccID);
            trans.SetLordBase(i_biAccID, lordInfo);
            trans.SetLordStat(i_biAccID, lordStat);
            trans.SetLordItems(i_biAccID, items);
            trans.SetMissions(i_biAccID, missions);
            trans.SetMaps(i_biAccID, maps);
            trans.SetMissionBase(i_biAccID, missionBase);
            trans.SetLordInDuns(i_biAccID, inDuns);

            if (false == trans.Execute())
            {
                return(eErrorCode.Query_Fail);
            }

            return(eErrorCode.Success);
        }
        public override void Process()
        {
            // 기본 영주 정보 얻어오기
            fmLord lord = null;

            m_session.TryGetLord(out lord);

            // 프로토콜 RQ
            using (var recvfmProtocol = new PT_CG_Item_GetList_RQ())
            {
                // 프로토콜 Read
                recvfmProtocol.Deserialize(m_recvPacket);

                // 프로토콜 RS
                using (var sendfmProtocol = new LZ4_PT_CG_Item_GetList_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.TryGetItems(sendfmProtocol);
                    // 프로토콜 전송
                    m_session.SendPacket(sendfmProtocol);
                }
            }
        }