public PET_EXP GetExp(int nPetNum)
        {
            PET_EXP   petExp;
            SDATA_PET My_Pet = CDataPool.Instance.Pet_GetPet(nPetNum);

            if ((My_Pet == null) || (MacroDefine.INVALID_ID == My_Pet.IsPresent))
            {
                throw new NullReferenceException("LUA:Pet GetExp parameter error");
            }

            //DBC_DEFINEHANDLE(s_pPetLevelup, DBC_PET_LEVELUP);
            //const _DBC_PET_LEVELUP* pPetExp = (const _DBC_PET_LEVELUP*)s_pPetLevelup->Search_Index_EQU(My_Pet->m_nLevel);

            petExp.nExp    = My_Pet.Exp;
            petExp.nMaxExp = -1;

            //if(pPetExp)
            //{
            //    petExp.nMaxExp = pPetExp->nExp;
            //}
            //else
            //{
            //    petExp.nMaxExp = INVALID_ID;
            //}
            return(petExp);
        }
        public void Dome(int nPetNum)
        {
            SDATA_PET My_Pet = CDataPool.Instance.Pet_GetPet(nPetNum);

            if ((My_Pet == null) || (MacroDefine.INVALID_ID == My_Pet.IsPresent))
            {
                throw new Exception("LUA:Pet Dome parameter error");
            }

            int          idxPackage = -1;
            CObject_Item pFind      = (CObject_Item)CDataPool.Instance.Pet_GetLowestLevel_Dome_From_Package(My_Pet.GUID, ref idxPackage);

            if (My_Pet.Happiness == 100)
            {
                //    STRING strMsg = "你的宠物无需驯养";//COLORMSGFUNC("GMGameInterface_Script_Pet_NoNeedDemo");
                //    ADDNEWDEBUGMSG(strMsg);
                //    return;
            }

            if (pFind != null || idxPackage < 0)
            {
                //    STRING strMsg = "你没有驯养道具";//COLORMSGFUNC("GMGameInterface_Script_Pet_NoDemoFood");
                //    ADDNEWDEBUGMSG(strMsg);
                //    return;
            }

            CGUseItem pi = new CGUseItem();

            pi.BagIndex      = (byte)idxPackage;
            pi.TargetPetGUID = My_Pet.GUID;
            NetManager.GetNetManager().SendPacket(pi);
        }
Exemplo n.º 3
0
    public bool Pet_SendUseSkillMessage(int petIndex, short idSkill, int idTargetObj, float fTargetX, float fTargetZ)
    {
        SDATA_PET pPetData = Pet_GetPet(petIndex);

        int nPetCount = CDataPool.Instance.Pet_GetCount();

        if (pPetData != null)
        {
            CObject_PlayerNPC pPet = null;
            if (pPetData.idServer != uint.MaxValue)
            {
                pPet = CObjectManager.Instance.FindServerObject((int)pPetData.idServer) as CObject_PlayerNPC;
            }
            if (pPet != null)
            {
                CGCharUseSkill msg = NetManager.GetNetManager().CreatePacket((int)PACKET_DEFINE.PACKET_CG_CHARUSESKILL) as CGCharUseSkill;
                msg.ObjectID    = (int)pPetData.idServer;
                msg.SkillDataID = idSkill * 100;
                msg.TargetID    = idTargetObj;
                WORLD_POS pos = new WORLD_POS();
                pos.m_fX      = fTargetX;
                pos.m_fZ      = fTargetZ;
                msg.PosTarget = pos;
                // msg.PosTarget.m_fZ = fTargetZ;
                msg.Dir        = -1;
                msg.GuidTarget = -1;
                LogManager.LogWarning("Pet_SendUseSkillMessage");
                NetManager.GetNetManager().SendPacket(msg);
            }
        }
        return(true);
    }
Exemplo n.º 4
0
    private void DoAction_PetEquip()
    {
        CObject_Item_Equip pItemEquip = (CObject_Item_Equip)ItemImpl;

        if (pItemEquip.GetItemClass() != ITEM_CLASS.ICLASS_EQUIP)
        {
            return;
        }
        int emptyPlace = CDataPool.Instance.UserBag_FindFirstEmptyPlace();

        if (emptyPlace == -1)
        {
            CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "背包已满,清整理背包后再尝试 ^0^!");
        }
        else
        {
            // 发送卸下宠物装备消息.
            GameObject  roleTip   = UIWindowMng.Instance.GetWindowGo("RoleTipWindow");
            UISelfEquip selfEquip = roleTip.GetComponent <UISelfEquip>();
            SDATA_PET   curPet    = CDataPool.Instance.Pet_GetValidPet(selfEquip.ActivePet);//CDataPool.Instance.Pet_GetPet(selfEquip.ActivePet);
            if (curPet != null)
            {
                CGOperatePetEquip msg = new CGOperatePetEquip();
                msg.OperatorType   = 1;
                msg.GUID           = curPet.GUID;
                msg.DestBagIndex   = (byte)pItemEquip.GetItemType();
                msg.SourecBagIndex = (byte)emptyPlace;
                NetManager.GetNetManager().SendPacket(msg);
            }
        }
    }
    //激活动作
    public override void                    DoAction()
    {
        //检查冷却是否结束
        if (!CoolDownIsOver())
        {
            return;
        }

        PET_SKILL pSkill = GetPetSkillImpl();

        if (pSkill == null)
        {
            return;
        }

        SDATA_PET pThisOwner = CDataPool.Instance.Pet_GetPet(m_nPetNum);

        if (!CObjectManager.Instance.getPlayerMySelf().GetCharacterData().isFightPet(pThisOwner.GUID))
        {
            GameProcedure.s_pEventSystem.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "你不能使用未放出宠物的技能");
            return;
        }

        if (GetPetSkillImpl() != null && GetPetSkillImpl().m_pDefine != null)
        {
            //POINT pt = CGameProcedure::s_pInputSystem->MouseGetPos();
            //fVector3 fvMouseHitPlan;
            //CObjectManager::GetMe()->GetMouseOverObject(pt.x, pt.y, fvMouseHitPlan);

            CObject pTargetObj = CObjectManager.Instance.GetMainTarget();

            //根据操作类型
            switch ((ENUM_SELECT_TYPE)GetPetSkillImpl().m_pDefine.m_nSelectType)
            {
            case ENUM_SELECT_TYPE.SELECT_TYPE_NONE:
            case ENUM_SELECT_TYPE.SELECT_TYPE_CHARACTER:
            {
                CDataPool.Instance.Pet_SendUseSkillMessage(GetPetIndex(), (short)GetPetSkillImpl().m_pDefine.m_nID,
                                                           ((pTargetObj != null)?(pTargetObj.ServerID):(MacroDefine.INVALID_ID)), -1, -1);
                //恢复激活Action
                CActionSystem.Instance.SetDefaultAction(GameProcedure.s_pGameInterface.Skill_GetActive());
            }
            break;

            case ENUM_SELECT_TYPE.SELECT_TYPE_POS:
            {
                CActionSystem.Instance.SetDefaultAction(this);
            }
            break;

            case ENUM_SELECT_TYPE.SELECT_TYPE_SELF:
            default:
            {
                throw new Exception("Invalid pet skill select type:" + GetPetSkillImpl().m_pDefine.m_nSelectType);
            }
            break;
            }
        }
    }
        public string GetConsort(int nPetNum)
        {
            SDATA_PET My_Pet = CDataPool.Instance.Pet_GetPet(nPetNum);

            if ((My_Pet == null) || (MacroDefine.INVALID_ID == My_Pet.IsPresent))
            {
                throw new NullReferenceException("LUA:Pet GetConsort parameter error");
            }

            return(string.Format("%.8X", My_Pet.SpouseGUID.m_uLowSelection));
        }
 public SDATA_PET this[int nIndex]
 {
     get
     {
         SDATA_PET pet = CDataPool.Instance.Pet_GetPet(nIndex);
         if (pet == null || pet.IsPresent == MacroDefine.INVALID_ID)
         {
             throw new NullReferenceException("Pet is not present :" + nIndex);
         }
         return(pet);
     }
 }
        //设置界面上显示的模型
        public void SetPetModel(int nIndex)
        {
            int       lidx    = nIndex - 1; //Lua is begin from 1, but c begin from 0
            SDATA_PET petData = GetPetListData(lidx);

            if (petData != null)
            {
                if (MacroDefine.INVALID_ID != petData.IsPresent)
                {
                    SetPetListFakeObj(lidx, petData.DataID);
                }
            }
        }
Exemplo n.º 9
0
    public CObject_Item GetEquiptItem(PET_GUID_t guid, PET_EQUIP ptEquipt)
    {
        SDATA_PET curPet = Pet_GetPet(guid);

        if (curPet == null)
        {
            return(null);
        }
        if ((int)ptEquipt < 0 || (int)ptEquipt >= (int)PET_EQUIP.PEQUIP_NUMBER)
        {
            return(null);
        }
        return(curPet.Equipts[(int)ptEquipt]);
    }
        //显示相应宠物的详细信息,需要调用TargetPet界面来显示
        public void ShowTargetPet(int nIndex)
        {
            int       lidx    = nIndex - 1; //Lua is begin from 1, but c begin from 0
            SDATA_PET petData = GetPetListData(lidx);

            if (petData != null)
            {
                if (MacroDefine.INVALID_ID != petData.IsPresent)
                {
                    CDataPool.Instance.Pet_CopyToTarget(petData);
                    CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_UPDATE_PETINVITEFRIEND, "target");                 //通知TargetPet显示宠物
                }
            }
        }
        //获得宠物板宠物的信息
        public string GetPetINFO(int nIndex, string lpOp)
        {
            int       lidx    = nIndex - 1; //Lua is begin from 1, but c begin from 0
            SDATA_PET petData = GetPetListData(lidx);

            if (petData != null)
            {
                if (lpOp == "NAME")
                {
                    return(petData.Name);
                }
            }
            return(null);
        }
        ////tolua_end

        //网络处理相关接口
        public void ConvertPlaceCard2PetFriend()
        {
            CleanUpPetList();
            for (int i = 0; i < m_PetList.Count; ++i)
            {
                SDATA_PET         pOut    = GetPetListData(i);
                _PET_PLACARD_ITEM curItem = GetPlaceCardItem(i);
                if (pOut != null && (object)curItem != null)
                {
                    _PET_DETAIL_ATTRIB pIn = curItem.m_PetAttr;
                    PET_DETAIL_ATTRIB2SDATA_PAT(pIn, pOut);
                }
            }
        }
        public PET_TYPE_INFO GetPetTypeName(int nPetNum)
        {
            PET_TYPE_INFO petTypeInfo;
            SDATA_PET     My_Pet = CDataPool.Instance.Pet_GetPet(nPetNum);

            if ((My_Pet == null) || (MacroDefine.INVALID_ID == My_Pet.IsPresent))
            {
                throw new Exception("LUA:Pet GetPetTypeName parameter error");
            }
            petTypeInfo.nGen        = this[nPetNum].EraCount;
            petTypeInfo.strTypeName = GetName(nPetNum).petName;

            return(petTypeInfo);
        }
Exemplo n.º 14
0
    void petWidgetsShow()
    {
        bool bChanged = false;
        int  nCount   = CDataPool.Instance.Pet_GetCount();
        //for (int i = (int)RoleType.ROLE_PET1; i <= (int)RoleType.ROLE_PET6; i++ )
        //{
        //if (i < nCount + (int)RoleType.ROLE_PET1)
        //{
        //    mRoleMenus[i].Hide(false);
        //    SDATA_PET pet = CDataPool.Instance.Pet_GetPet(i - 1);
        //    mRoleMenus[i].Text = pet.Name;
        //}
        //else
        //{
        //    if ((int)mCurrentRoleType == i)
        //        bChanged = true;
        //    mRoleMenus[i].Hide(true);
        //}
        // }
        int count = CDataPool.Instance.Pet_GetCount();

        for (int i = 1; i < mRoleMenus.Count; i++)
        {
            mRoleMenus[i].Hide(true);
        }
        for (int i = 1; i <= count; i++)
        {
            mRoleMenus[i].Hide(false);
            SDATA_PET curPet = CDataPool.Instance.Pet_GetValidPet(i - 1);
            mRoleMenus[i].Text = curPet.Name;
        }

        int nPacketIndex = nCount + 1;

        if (nPacketIndex > (int)RoleType.ROLE_PET6)
        {
            mRoleMenus[(int)RoleType.ROLE_PACKET].gameObject.transform.localPosition = mPacketMenuPos;
        }
        else
        {
            mRoleMenus[(int)RoleType.ROLE_PACKET].gameObject.transform.localPosition = mRoleMenus[nPacketIndex].gameObject.transform.localPosition;
        }

        if (bChanged)
        {
            mCurrentRoleType = RoleType.ROLE_SELF;
            OnChangedRoleType(mCurrentRoleType);
        }
    }
Exemplo n.º 15
0
    //更新宠物冷却组
    public void PetSkillCoolDownGroup_UpdateList(Cooldown_T[] pCoolDownList, int nUpdateNum, PET_GUID_t nPet_GUID)
    {
        if (nUpdateNum <= 0)
        {
            return;
        }
        if (nUpdateNum > (int)COMMONCOOLDOWN.COOLDOWN_LIST_SIZE)
        {
            nUpdateNum = (int)COMMONCOOLDOWN.COOLDOWN_LIST_SIZE;
        }
        int nCooldownID = MacroDefine.INVALID_ID;
        int nFind       = -1;

        for (int i = 0; i < GAMEDEFINE.HUMAN_PET_MAX_COUNT; i++)
        {
            SDATA_PET My_Pet = CDataPool.Instance.Pet_GetPet(i);
            if (My_Pet == null || (MacroDefine.INVALID_ID == My_Pet.IsPresent))
            {
                continue;
            }

            if (CObjectManager.Instance.getPlayerMySelf().GetCharacterData().isFightPet(My_Pet.GUID))
            {
                nFind = i;
                break;
            }
        }
        if (nFind < 0)
        {
            return;
        }
        for (int i = 0; nUpdateNum > i; i++)
        {
            nCooldownID = pCoolDownList[i].m_nID;
            if (0 > nCooldownID || (int)COMMONCOOLDOWN.COOLDOWN_LIST_SIZE <= nCooldownID)
            {
                continue;
            }

            //更新冷却组
            COOLDOWN_GROUP rCooldown = m_vPetSkillCoolDownGroup[(nFind * (int)COMMONCOOLDOWN.COOLDOWN_LIST_SIZE) + nCooldownID];
            rCooldown.nTotalTime   = pCoolDownList[i].m_nCooldown;
            rCooldown.nTimeElapsed = pCoolDownList[i].m_nCooldownElapsed;
            rCooldown.nTime        = rCooldown.nTotalTime - rCooldown.nTimeElapsed;

            //刷新的ActionSystem
            CActionSystem.Instance.UpdateCoolDown(nCooldownID);
        }
    }
Exemplo n.º 16
0
    void RefreshRolePageCaption()
    {
        int count = CDataPool.Instance.Pet_GetCount();

        for (int i = 1; i < mRoleMenus.Count; i++)
        {
            mRoleMenus[i].Hide(true);
        }
        for (int i = 1; i <= count; i++)
        {
            mRoleMenus[i].Hide(false);
            SDATA_PET curPet = CDataPool.Instance.Pet_GetValidPet(i - 1);
            mRoleMenus[i].Text = curPet.Name;
        }
    }
        public void Go_Relax(int nPetNum)
        {
            SDATA_PET My_Pet = CDataPool.Instance.Pet_GetValidPet(nPetNum);//CDataPool.Instance.Pet_GetPet(nPetNum);

            if ((My_Pet == null) || (MacroDefine.INVALID_ID == My_Pet.IsPresent))
            {
                throw new Exception("LUA:Pet Go_Relax parameter error");
            }
            //向服务器发送
            CGManipulatePet Msg = NetManager.GetNetManager().CreatePacket((int)PACKET_DEFINE.PACKET_CG_MANIPULATEPET) as CGManipulatePet;

            Msg.PetGUID = My_Pet.GUID;
            Msg.Type    = (int)ENUM_MANIPULATE_TYPE.MANIPULATE_DELETEPET;
            NetManager.GetNetManager().SendPacket(Msg);
        }
        public bool IsFighting(int nPetIndex)
        {
            SDATA_PET My_Pet = CDataPool.Instance.Pet_GetValidPet(nPetIndex);//CDataPool.Instance.Pet_GetPet(nPetIndex);

            if ((My_Pet == null) || (MacroDefine.INVALID_ID == My_Pet.IsPresent))
            {
                throw new Exception("LUA:Pet GetIsFighting parameter error");
            }
            if (CObjectManager.Instance.getPlayerMySelf().GetCharacterData().isFightPet(My_Pet.GUID))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 19
0
    void RefreshPet()
    {
        RefreshLevelUpButton();
        RefreshPetEquipt();
        SDATA_PET curPet = CDataPool.Instance.Pet_GetValidPet((int)mCurrentRoleType - 1);//Pet_GetPet((int)mCurrentRoleType -1);

        if (curPet != null)
        {
            RefreshPetState();
            RefreshPetAttr(curPet);
            RefreshPetSkill((int)mCurrentRoleType - 1);
        }
        else
        {
            LogManager.LogWarning("PetIndex is wrong,maybe some mistake occur " + mCurrentRoleType);
        }
    }
    public int      GetMyPetLevel()
    {
        if (m_nPetNum == (int)PET_INDEX.TARGETPET_INDEX)
        {
            SDATA_PET MyPet = CDataPool.Instance.TargetPet_GetPet();

            return(MyPet.Level);
        }
        else if (m_nPetNum == PET_SKILL.MENPAI_PETSKILLSTUDY_PETNUM)
        {
            return(-1);
        }
        else
        {
            SDATA_PET MyPet = CDataPool.Instance.Pet_GetPet(m_nPetNum);
            return(MyPet.Level);
        }
    }
Exemplo n.º 21
0
    public SDATA_PET Pet_GetValidPet(int index)
    {
        int petCount = 0;

        for (int i = 0; i < GAMEDEFINE.HUMAN_PET_MAX_COUNT; i++)
        {
            SDATA_PET curPet = Pet_GetPet(i);
            if (curPet != null && MacroDefine.INVALID_ID != curPet.IsPresent)
            {
                if (petCount == index)
                {
                    return(curPet);
                }
                petCount++;
            }
        }
        return(null);
    }
Exemplo n.º 22
0
    void Awake()
    {
        gameObject.SetActiveRecursively(true);

        registerHandler();
        registerWidgets();
        petWidgetsShow();
        //动态加载,初始化
        mCurrentEquipIndex = 0;
        OnChangedRoleType(mCurrentRoleType);
        OnChangedOperator(mCurrentOperate);

        RegisterEnhanceHandle(OperateType.ENCHANCE);
        //查询自己宠物的装备信息
        for (int i = 0; i < GAMEDEFINE.HUMAN_PET_MAX_COUNT; i++)
        {
            SDATA_PET curPet = CDataPool.Instance.Pet_GetPet(i);
            if (!curPet.GUID.IsNull())
            {
                CGAskDetailPetEquipList queryPet = new CGAskDetailPetEquipList();
                queryPet.GUID       = curPet.GUID;
                queryPet.EquiptType = ASK_PET_EQUIP_TYPE.ASK_PET_EQUIP_MYSELF;
                queryPet.ObjID      = -1;//(int)curPet.idServer;
                NetManager.GetNetManager().SendPacket(queryPet);
            }
        }

        if (UIWindowMng.Instance.IsWindowShow("RoleTipWindow"))
        {
            GameObject  selfEquipt          = UIWindowMng.Instance.GetWindowGo("RoleTipWindow");
            UISelfEquip selfEquiptComponent = selfEquipt.GetComponent <UISelfEquip>();
            PET_EQUIP   activePart          = selfEquiptComponent.ActivePetEquiptPart;
            if (activePart != PET_EQUIP.PEQUIP_INVALID)
            {
                int           roleIndex = selfEquiptComponent.ActivePage;
                List <string> Params    = new List <string>();
                Params.Add(roleIndex.ToString());
                int temp = (int)(activePart);
                Params.Add(temp.ToString());
                CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_TOGGLE_PETEQUIPLEVELUP, Params);
            }
        }
    }
Exemplo n.º 23
0
 public void Tick(uint nTickTime)
 {
     // 待优化
     for (int i = 0; i < (int)COMMONCOOLDOWN.COOLDOWN_LIST_SIZE; i++)
     {
         COOLDOWN_GROUP rCoolDown = m_vCoolDownGroup[i];
         if (0 < rCoolDown.nTime)
         {
             rCoolDown.nTime -= (int)nTickTime;
             if (rCoolDown.nTime < 0)
             {
                 rCoolDown.nTime = 0;
             }
         }
         // 有用否? [11/9/2011 Sun]
         //if(i < QUESTTIME_LIST_SIZE &&  m_vQuestTimeGroup[i] > 0 )
         //{
         //    m_vQuestTimeGroup[i] -= nTickTime;
         //    if( m_vQuestTimeGroup[i] <= 0 )
         //        m_vQuestTimeGroup[i] = 0;
         //}
     }
     //宠物冷却组更新
     for (int i = 0; i < GAMEDEFINE.HUMAN_PET_MAX_COUNT; i++)
     {
         SDATA_PET pMyPet = CDataPool.Instance.Pet_GetPet(i);
         if (pMyPet != null && pMyPet.IsPresent != MacroDefine.INVALID_ID)
         {
             for (int j = 0; j < (int)COMMONCOOLDOWN.COOLDOWN_LIST_SIZE; j++)
             {
                 COOLDOWN_GROUP rCoolDown = m_vPetSkillCoolDownGroup[i * (int)COMMONCOOLDOWN.COOLDOWN_LIST_SIZE + j];
                 if (0 < rCoolDown.nTime)
                 {
                     rCoolDown.nTime -= (int)nTickTime;
                     if (rCoolDown.nTime < 0)
                     {
                         rCoolDown.nTime = 0;
                     }
                 }
             }
         }
     }
 }
        public PET_INFO GetID(int nPetNum)
        {
            PET_INFO  petInfo = new PET_INFO();
            SDATA_PET My_Pet  = CDataPool.Instance.Pet_GetPet(nPetNum);

            if ((My_Pet == null) || (MacroDefine.INVALID_ID == My_Pet.IsPresent))
            {
                throw new NullReferenceException("LUA:Pet GetID parameter error");
            }

            petInfo.petName = string.Format("%.8X", My_Pet.GUID.m_uHighSelection);

            petInfo.petName2 = string.Format("%.8X", My_Pet.GUID.m_uLowSelection);

            int sex = (int)My_Pet.GUID.m_uLowSelection % 2;

            petInfo.sex = sex;

            return(petInfo);
        }
Exemplo n.º 25
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 Go_Fight(int nPetNum)
        {
            SDATA_PET My_Pet = CDataPool.Instance.Pet_GetValidPet(nPetNum);//CDataPool.Instance.Pet_GetPet(nPetNum);

            if ((My_Pet == null) || (MacroDefine.INVALID_ID == My_Pet.IsPresent))
            {
                throw new Exception("LUA:Pet Go_Fight parameter error");
            }
            // 如果自己正在摆摊,不能出战
            if (true == CObjectManager.Instance.getPlayerMySelf().GetCharacterData().Get_IsInStall())
            {
                CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "你正在摆摊……");
                return;
            }
            //向服务器发送
            CGManipulatePet Msg = NetManager.GetNetManager().CreatePacket((int)PACKET_DEFINE.PACKET_CG_MANIPULATEPET) as CGManipulatePet;

            Msg.PetGUID = My_Pet.GUID;
            Msg.Type    = (int)ENUM_MANIPULATE_TYPE.MANIPULATE_CREATEPET;
            NetManager.GetNetManager().SendPacket(Msg);
        }
        public void Go_Free(int nPetNum)
        {
            SDATA_PET My_Pet = CDataPool.Instance.Pet_GetValidPet(nPetNum);//CDataPool.Instance.Pet_GetPet(nPetNum);

            if ((My_Pet == null) || (MacroDefine.INVALID_ID == My_Pet.IsPresent))
            {
                throw new Exception("LUA:Pet Go_Free parameter error");
            }
            //if( CGameProcedure::s_pUISystem->IsWindowShow("ProgressBar") )
            //{
            //    STRING strMsg = "你正在进行其他操作,目前不能放生宠物";
            //    ADDNEWDEBUGMSG(strMsg);
            //    return;

            //}
            // 如果自己正在摆摊,不能放生
            //if(TRUE == CObjectManager::GetMe()->GetMySelf()->GetCharacterData()->Get_IsInStall())
            //{
            //    CEventSystem::GetMe()->PushEvent(GE_INFO_SELF,"你正在摆摊……");
            //    return;
            //}

            for (int i = 0; i < (int)PET_EQUIP.PEQUIP_NUMBER; i++)
            {
                if (My_Pet.Equipts[i] != null)
                {
                    CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_INFO_SELF, "宠物身上有装备不能放生");
                    return;
                }
            }

            //向服务器发送
            CGManipulatePet Msg = NetManager.GetNetManager().CreatePacket((int)PACKET_DEFINE.PACKET_CG_MANIPULATEPET) as CGManipulatePet;

            Msg.PetGUID = My_Pet.GUID;
            Msg.Type    = (int)ENUM_MANIPULATE_TYPE.MANIPULATE_FREEPET;
            NetManager.GetNetManager().SendPacket(Msg);
        }
Exemplo n.º 28
0
    void RefreshPetEquipt()
    {
        SDATA_PET curPet = CDataPool.Instance.Pet_GetValidPet(ActivePet);//CDataPool.Instance.Pet_GetPet(this.ActivePet);

        if (curPet == null)
        {
            UpdatePetEquiptActionButton(null, petClaw_);
            UpdatePetEquiptActionButton(null, petHead_);
            UpdatePetEquiptActionButton(null, petSpur_);
            UpdatePetEquiptActionButton(null, petRing_);
            UpdatePetEquiptActionButton(null, petBody_);
            UpdatePetEquiptActionButton(null, petTattoo_);
        }
        else
        {
            UpdatePetEquiptActionButton(curPet.Equipts[(int)PET_EQUIP.PEQUIP_CLAW], petClaw_);
            UpdatePetEquiptActionButton(curPet.Equipts[(int)PET_EQUIP.PEQUIP_HORN], petHead_);
            UpdatePetEquiptActionButton(curPet.Equipts[(int)PET_EQUIP.PEQUIP_SPUR], petSpur_);
            UpdatePetEquiptActionButton(curPet.Equipts[(int)PET_EQUIP.PEQUIP_KNOCKER], petRing_);
            UpdatePetEquiptActionButton(curPet.Equipts[(int)PET_EQUIP.PEQUIP_TRUNK], petBody_);
            UpdatePetEquiptActionButton(curPet.Equipts[(int)PET_EQUIP.PEQUIP_VEINS], petTattoo_);
        }
    }
Exemplo n.º 29
0
    void RefreshLevelUpButton()
    {
        SDATA_PET curPet = CDataPool.Instance.Pet_GetValidPet(ActivePet);//CDataPool.Instance.Pet_GetPet((int)mCurrentRoleType - 1);

        if (curPet == null)
        {
            petHeadLevelUp_.Hide(true);
            petSpurLevelUp_.Hide(true);
            petClawLevelUp_.Hide(true);
            petRingLevelUp_.Hide(true);
            petBodyLevelUp_.Hide(true);
            petTattooLevelUp_.Hide(true);
        }
        else
        {
            HideLevelUpEquiptButton(curPet.Equipts[(int)PET_EQUIP.PEQUIP_CLAW], petClawLevelUp_);
            HideLevelUpEquiptButton(curPet.Equipts[(int)PET_EQUIP.PEQUIP_HORN], petHeadLevelUp_);
            HideLevelUpEquiptButton(curPet.Equipts[(int)PET_EQUIP.PEQUIP_SPUR], petSpurLevelUp_);
            HideLevelUpEquiptButton(curPet.Equipts[(int)PET_EQUIP.PEQUIP_KNOCKER], petRingLevelUp_);
            HideLevelUpEquiptButton(curPet.Equipts[(int)PET_EQUIP.PEQUIP_TRUNK], petBodyLevelUp_);
            HideLevelUpEquiptButton(curPet.Equipts[(int)PET_EQUIP.PEQUIP_VEINS], petTattooLevelUp_);
        }
    }
Exemplo n.º 30
0
    void RefreshPetAttr(SDATA_PET curPet)
    {
        petName_.Text          = curPet.Name + " " + "等级:" + curPet.Level;
        petHP_.Text            = curPet.HP + "/" + curPet.HPMax;
        petHP_.Value           = (float)curPet.HP / (float)curPet.HPMax;
        petStrength_.Text      = curPet.AttrStr + " + " + UnityEngine.Color.green + curPet.AttrStrBring;
        petWisdom_.Text        = curPet.AttrSpr + " + " + UnityEngine.Color.green + curPet.AttrSprBring;
        petConstituition_.Text = curPet.AttrCon + " + " + UnityEngine.Color.green + curPet.AttrConBring;
        petAgility_.Text       = curPet.AttrDex + " + " + UnityEngine.Color.green + curPet.AttrDexBring;
        petToughness_.Text     = curPet.AttrInt + " + " + UnityEngine.Color.green + curPet.AttrIntBring;
        petPhysicAttk_.Text    = curPet.AttPhysics.ToString();
        petMagicAttk_.Text     = curPet.AttMagic.ToString();
        petPhysicDef_.Text     = curPet.DefPhysics.ToString();
        petMagicDef_.Text      = curPet.DefMagic.ToString();
        petHitRate_.Text       = curPet.Hit.ToString();
        petDuck_.Text          = curPet.Miss.ToString();
        petCritical_.Text      = curPet.Critical.ToString();
        petCriticalDef_.Text   = curPet.DefCritical.ToString();
        _DBC_PET_LEVELUP curPetLevelup = CDataBaseSystem.Instance.GetDataBase <_DBC_PET_LEVELUP>((int)DataBaseStruct.DBC_PET_LEVELUP).Search_Index_EQU(curPet.Level);

        petexp_.Text  = curPet.Exp.ToString() + "/" + curPetLevelup.nExp.ToString();
        petexp_.Value = (float)curPet.Exp / (float)curPetLevelup.nExp;
    }