Example #1
0
 public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer)
 {
     if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain)
     {
         LogManager.Log("Receive GCRemovePet Packet");
         GCRemovePet packet  = (GCRemovePet)pPacket;
         PET_GUID_t  guidPet = packet.GUID;
         for (int i = 0; i < GAMEDEFINE.HUMAN_PET_MAX_COUNT; i++)
         {
             SDATA_PET pPetData = CDataPool.Instance.Pet_GetPet(i);
             if (pPetData != null && pPetData.GUID == guidPet)
             {
                 pPetData.CleanUp();
                 CActionSystem.Instance.UpdateToolBarForPetSkill();
                 CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_UPDATE_PET_PAGE);
                 break;
             }
         }
     }
     return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
 }
        //公用函数接口
        public void PET_DETAIL_ATTRIB2SDATA_PAT(_PET_DETAIL_ATTRIB pIn, SDATA_PET pOut)
        {
            if ((object)pIn == null || pOut == null)
            {
                return;
            }

            //清除旧数据
            pOut.CleanUp();
            pOut.IsPresent = 2;
            //基本数据转换
            pOut.GUID     = pIn.m_GUID;                                                 // ID
            pOut.idServer = (uint)pIn.m_ObjID;                                          // 所有Obj类型的ObjID
            pOut.DataID   = pIn.m_nDataID;
            // Data ID,宠物类型
            pOut.Name       = UIString.Instance.GetUnicodeString(pIn.m_szName);
            pOut.AIType     = pIn.m_nAIType;            // 性格
            pOut.SpouseGUID = pIn.m_SpouseGUID;         // 配偶的GUID
            pOut.Level      = pIn.m_nLevel;             // 等级
            pOut.Exp        = pIn.m_nExp;               // 经验
            pOut.HP         = pIn.m_nHP;                // 血当前值
            pOut.HPMax      = pIn.m_nHPMax;             // 血最大值

            pOut.Age       = pIn.m_nLife;               // 当前寿命
            pOut.EraCount  = pIn.m_byGeneration;        // 几代宠
            pOut.Happiness = pIn.m_byHappiness;         // 快乐度

            pOut.AttPhysics = pIn.m_nAtt_Physics;       // 物理攻击力
            pOut.AttMagic   = pIn.m_nAtt_Magic;         // 魔法攻击力
            pOut.DefPhysics = pIn.m_nDef_Physics;       // 物理防御力
            pOut.DefMagic   = pIn.m_nDef_Magic;         // 魔法防御力

            pOut.Hit      = pIn.m_nHit;                 // 命中率
            pOut.Miss     = pIn.m_nMiss;                // 闪避率
            pOut.Critical = pIn.m_nCritical;            // 会心率

            pOut.ModelID = pIn.m_nModelID;              // 外形
            pOut.MountID = pIn.m_nMountID;              // 座骑ID

            pOut.AttrStrApt = pIn.m_StrPerception;      // 力量资质
            pOut.AttrConApt = pIn.m_ConPerception;      // 体力资质
            pOut.AttrDexApt = pIn.m_DexPerception;      // 身法资质
            pOut.AttrSprApt = pIn.m_SprPerception;      // 灵气资质
            pOut.AttrIntApt = pIn.m_IntPerception;      // 定力资质

            pOut.AttrStr = pIn.m_Str;                   // 力量
            pOut.AttrCon = pIn.m_Con;                   // 体力
            pOut.AttrDex = pIn.m_Dex;                   // 身法
            pOut.AttrSpr = pIn.m_Spr;                   // 灵气
            pOut.AttrInt = pIn.m_Int;                   // 定力
            pOut.Basic   = pIn.m_GenGu;                 // 根骨

            pOut.Pot = pIn.m_nRemainPoint;              // 潜能点

            //技能转换
            int minSkill = ((int)ENUM_PET_SKILL_INDEX.PET_SKILL_INDEX_NUMBERS > GAMEDEFINE.MAX_PET_SKILL_COUNT) ? GAMEDEFINE.MAX_PET_SKILL_COUNT : (int)ENUM_PET_SKILL_INDEX.PET_SKILL_INDEX_NUMBERS;

            for (int i = 0; i < minSkill; ++i)
            {
                PET_SKILL       theSkill = pOut[i];
                _DBC_SKILL_DATA pDefine  = CSkillDataMgr.Instance.GetSkillData((uint)pIn.m_aSkill[i].m_nSkillID);

                if (theSkill != null)
                {
                    PET_SKILL newSkill = new PET_SKILL();

                    newSkill.m_pDefine   = pDefine;
                    newSkill.m_nPetNum   = GAMEDEFINE.MENPAI_PETSKILLSTUDY_PETNUM - (i + 1);    //no need to set if only shown.
                    newSkill.m_nPosIndex = i;
                    newSkill.m_bCanUse   = true;
                    pOut[i] = newSkill;
                }
                else
                {
                    theSkill.m_pDefine   = pDefine;
                    theSkill.m_nPetNum   = GAMEDEFINE.MENPAI_PETSKILLSTUDY_PETNUM - (i + 1);    //no need to set if only shown.
                    theSkill.m_bCanUse   = true;
                    theSkill.m_nPosIndex = i;
                }
            }
        }
    public void Pet_CopyToTarget(SDATA_PET pSourcePet)
    {
        SDATA_PET pTargetPet = CDataPool.Instance.TargetPet_GetPet();

        pTargetPet.CleanUp();
        CActionSystem.Instance.CleanInvalidAction();
        pTargetPet.IsPresent    = pSourcePet.IsPresent;
        pTargetPet.GUID         = pSourcePet.GUID;
        pTargetPet.idServer     = pSourcePet.idServer;
        pTargetPet.DataID       = pSourcePet.DataID;
        pTargetPet.AIType       = pSourcePet.AIType;
        pTargetPet.Name         = pSourcePet.Name;
        pTargetPet.Level        = pSourcePet.Level;
        pTargetPet.Exp          = pSourcePet.Exp;
        pTargetPet.HP           = pSourcePet.HP;
        pTargetPet.HPMax        = pSourcePet.HPMax;
        pTargetPet.Age          = pSourcePet.Age;
        pTargetPet.EraCount     = pSourcePet.EraCount;
        pTargetPet.Happiness    = pSourcePet.Happiness;
        pTargetPet.SpouseGUID   = pSourcePet.SpouseGUID;
        pTargetPet.ModelID      = pSourcePet.ModelID;
        pTargetPet.MountID      = pSourcePet.MountID;
        pTargetPet.AttPhysics   = pSourcePet.AttPhysics;
        pTargetPet.AttMagic     = pSourcePet.AttMagic;
        pTargetPet.DefPhysics   = pSourcePet.DefPhysics;
        pTargetPet.DefMagic     = pSourcePet.DefMagic;
        pTargetPet.Hit          = pSourcePet.Hit;
        pTargetPet.Miss         = pSourcePet.Miss;
        pTargetPet.Critical     = pSourcePet.Critical;
        pTargetPet.AttrStrApt   = pSourcePet.AttrStrApt;
        pTargetPet.AttrConApt   = pSourcePet.AttrConApt;
        pTargetPet.AttrDexApt   = pSourcePet.AttrDexApt;
        pTargetPet.AttrSprApt   = pSourcePet.AttrSprApt;
        pTargetPet.AttrIntApt   = pSourcePet.AttrIntApt;
        pTargetPet.AttrStr      = pSourcePet.AttrStr;
        pTargetPet.AttrCon      = pSourcePet.AttrCon;
        pTargetPet.AttrDex      = pSourcePet.AttrDex;
        pTargetPet.AttrSpr      = pSourcePet.AttrSpr;
        pTargetPet.AttrInt      = pSourcePet.AttrInt;
        pTargetPet.Basic        = pSourcePet.Basic;
        pTargetPet.Pot          = pSourcePet.Pot;
        pTargetPet.AttrSprBring = pSourcePet.AttrSprBring;
        pTargetPet.AttrIntBring = pSourcePet.AttrIntBring;
        pTargetPet.AttrStrBring = pSourcePet.AttrStrBring;
        pTargetPet.AttrDexBring = pSourcePet.AttrDexBring;
        pTargetPet.AttrConBring = pSourcePet.AttrConBring;

        PET_SKILL pDestPetSkill   = null;
        PET_SKILL pSourcePetSkill = null;

        for (int i = 0; i < (int)ENUM_PET_SKILL_INDEX.PET_SKILL_INDEX_NUMBERS; i++)
        {
            pSourcePetSkill = pSourcePet[i];
            if (pSourcePetSkill != null)
            {
                pDestPetSkill = pTargetPet[i];
                if (pDestPetSkill == null)
                {
                    pTargetPet[i] = new PET_SKILL();
                    pDestPetSkill = pTargetPet[i];
                }

                pDestPetSkill.m_bCanUse   = pSourcePetSkill.m_bCanUse;
                pDestPetSkill.m_nPetNum   = (int)PET_INDEX.TARGETPET_INDEX; //pPetSourceData->m_aSkill[i]->m_nPetNum;
                pDestPetSkill.m_nPosIndex = i;                              //pPetSourceData->m_aSkill[i]->m_nPosIndex;
                pDestPetSkill.m_pDefine   = pSourcePetSkill.m_pDefine;
            }
        }

        CActionSystem.Instance.UserTargetPetSkill_Update();
    }
 public void                                 TargetPet_Clear()
 {
     m_TargetPet.IsPresent = -1; m_TargetPet.CleanUp();
 }