Exemplo n.º 1
0
 public            _OWN_SKILL[] m_aSkill; // 技能列表
 static public int getMaxSize()
 {
     return(sizeof(int) * 29 +
            sizeof(byte) * (2 + GAMEDEFINE.MAX_CHARACTER_NAME) +
            PET_GUID_t.getMaxSize() * 2 +
            _OWN_SKILL.GetMaxSize() * GAMEDEFINE.MAX_PET_SKILL_COUNT);
 }
Exemplo n.º 2
0
    public override bool Equals(object obj)
    {
        if (this.GetType() == obj.GetType())
        {
            PET_GUID_t petID = (PET_GUID_t)obj;
            return(petID == this);
        }

        return(base.Equals(obj));
    }
Exemplo n.º 3
0
 public int Pet_GetPetByGuid(PET_GUID_t PetGuid)
 {
     for (int i = 0; i < GAMEDEFINE.HUMAN_PET_MAX_COUNT; i++)
     {
         if (m_listPet[i].GUID == PetGuid)
         {
             return(i);
         }
     }
     return(-1);
 }
Exemplo n.º 4
0
 public SDATA_PET Pet_GetPet(PET_GUID_t guidPet)
 {
     foreach (SDATA_PET pet in m_listPet)
     {
         if (pet.GUID == guidPet)
         {
             return(pet);
         }
     }
     return(null);
 }
        public override int getSize()
        {
            int uSize = PET_GUID_t.getMaxSize() + sizeof(uint) + sizeof(int);

            for (int i = 0; i < (int)PET_EQUIP.PEQUIP_NUMBER; i++)
            {
                if ((m_wPartFlags & (1 << i)) != 0)
                {
                    uSize += m_ItemList[i].getSize();
                }
            }
            return(uSize);
        }
Exemplo n.º 6
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]);
    }
Exemplo n.º 7
0
        public override int getSize()
        {
            int  uSize = PET_GUID_t.getMaxSize() + sizeof(uint) * 2 + sizeof(int);
            uint i;

            for (i = 0; i < (uint)ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_NUMBERS; i++)
            {
                if (IsSetBit((ENUM_PET_DETAIL_ATTR)i))
                {
                    switch ((ENUM_PET_DETAIL_ATTR)i)
                    {
                    case ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_SPOUSE_GUID:
                        uSize += PET_GUID_t.getMaxSize();
                        break;

                    case ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_OBJ_ID:
                        uSize += sizeof(uint);
                        break;

                    case ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_NAME:
                        uSize += sizeof(byte) + m_byNameSize;
                        break;

                    case ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_GENERATION:
                    case ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_HAPPINESS:
                        uSize += sizeof(byte);
                        break;

                    case ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_SKILL_0:
                    case ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_SKILL_1:
                    case ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_SKILL_2:
                    case ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_SKILL_3:
                    case ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_SKILL_4:
                    case ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_SKILL_5:
                        uSize += _OWN_SKILL.GetMaxSize();
                        break;

                    default:
                        uSize += sizeof(uint);
                        break;
                    }
                }
            }

            uSize += sizeof(byte);
            uSize += m_ExtraInfoLength;
            return(uSize);
        }
Exemplo n.º 8
0
    public int Pet_GetPetFoodType(PET_GUID_t guidPet)   //获得宠物的食物类型
    {
        int nFoodType = (int)ENUM_PET_FOOD_TYPE.PET_FOOD_TYPE_INVALID;

        //获取食物类型
        if (Pet_GetPet(guidPet) != null)
        {
            _DBC_PET_EX_ATT pLine = CDataBaseSystem.Instance.GetDataBase <_DBC_PET_EX_ATT>((int)DataBaseStruct.DBC_PET_EX_ATT).Search_Index_EQU(Pet_GetPet(guidPet).DataID);
            if (pLine != null)
            {
                nFoodType = pLine.m_FoodType;
            }
        }

        return(nFoodType);
    }
Exemplo n.º 9
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);
 }
Exemplo n.º 10
0
    public void SetEquiptItem(PET_GUID_t guid, PET_EQUIP ptEquipt, CObject_Item pEquiptItem, bool bClearOld)
    {
        SDATA_PET curPet = Pet_GetPet(guid);

        if (curPet == null)
        {
            return;
        }
        if ((int)ptEquipt < 0 || (int)ptEquipt >= (int)PET_EQUIP.PEQUIP_NUMBER)
        {
            return;
        }
        if (curPet.Equipts[(int)ptEquipt] != null && bClearOld)
        {
            ObjectSystem.Instance.DestroyItem(curPet.Equipts[(int)ptEquipt]);
        }

        if (pEquiptItem != null)
        {
            PET_EQUIP pointEquip = (PET_EQUIP)((CObject_Item_Equip)pEquiptItem).GetItemType();
            if (pointEquip != ptEquipt)
            {
                return;
            }
            // 设置所属
            pEquiptItem.TypeOwner = ITEM_OWNER.IO_PET_EQUIPT;
            // 设置装备在action item 中的位置.
            pEquiptItem.PosIndex          = (short)ptEquipt;
            curPet.Equipts[(int)ptEquipt] = pEquiptItem;
        }
        else
        {
            // 在装备点清空数据
            curPet.Equipts[(int)ptEquipt] = null;
        }
    }
Exemplo n.º 11
0
 public SDATA_PET Pet_GetPet(PET_GUID_t guidPet)
 {
     return(mPetDataPool.Pet_GetPet(guidPet));
 }
Exemplo n.º 12
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);
        }
    }
        public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer)
        {
            GCDetailAttrib_Pet petAttribPacket = (GCDetailAttrib_Pet)pPacket;
            byte ExtraInfoLength = petAttribPacket.ExtraInfoLength;

            byte[] ExtraInfoData = new byte[GAMEDEFINE.MAX_EXTRAINFO_LENGTH];
            Array.Copy(petAttribPacket.ExtraInfoData, ExtraInfoData, ExtraInfoLength);
            LogManager.Log("RECV GCDetailAttrib_Pet");
            if (ExtraInfoLength == 0)
            {//正常情况下的宠物信息
                //第几只宠物的消息;
                SDATA_PET  My_Pet   = null;
                int        nPet_num = -1;
                PET_GUID_t guidPet  = petAttribPacket.GUID;
                int        i;
                for (i = 0; i < (int)PET_INDEX.PET_INDEX_SELF_NUMBERS; i++)
                {
                    SDATA_PET pPetData = CDataPool.Instance.Pet_GetPet(i);
                    if (pPetData != null && pPetData.GUID == guidPet)
                    {
                        nPet_num = i;
                        My_Pet   = pPetData;
                        break;
                    }
                }

                if (My_Pet == null)
                {
                    for (i = 0; i < (int)PET_INDEX.PET_INDEX_SELF_NUMBERS; i++)
                    {
                        SDATA_PET pPetData = CDataPool.Instance.Pet_GetPet(i);
                        if (pPetData != null && (pPetData.GUID.IsNull()))
                        {
                            nPet_num = i;
                            My_Pet   = pPetData;
                            break;
                        }
                    }
                }

                if (My_Pet == null)
                {
                    return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
                }

                //			My_Pet.m_nIsPresent = 2;
                My_Pet.GUID = petAttribPacket.GUID;

                if (petAttribPacket.HighFlag == 0 && petAttribPacket.LowFlag == 0)
                {
                    return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
                }

                //	收到过宠物详细数据,把标志位置为2;
                My_Pet.IsPresent = 2;

                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_OBJ_ID))                      //0
                {
                    LogManager.LogWarning("PET_DETAIL_ATTR_OBJ_ID idServer " + petAttribPacket.ObjectID);
                    My_Pet.idServer = petAttribPacket.ObjectID;
                }

                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_DATA_ID))                     //0
                {
                    My_Pet.DataID = petAttribPacket.DataID;
                }

                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_NAME))                        //0
                {
                    My_Pet.Name = EncodeUtility.Instance.GetUnicodeString(petAttribPacket.Name);
                }

                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_AI_TYPE))                     //2
                {
                    My_Pet.AIType = petAttribPacket.AiType;
                }

                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_SPOUSE_GUID))         //2
                {
                    My_Pet.SpouseGUID = petAttribPacket.SpouseGUID;
                }

                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_LEVEL))                       //2
                {
                    int oldLv = My_Pet.Level;
                    My_Pet.Level = petAttribPacket.Level;

                    if (My_Pet.Level > oldLv && oldLv != -1)
                    {
                        ////显示宠物升级提示信息
                        //string strTemp = COLORMSGFUNC("GCDetailAttrib_Pet_PetLevelUp", My_Pet->m_szName.c_str(), My_Pet.m_nLevel);
                        //ADDTALKMSG(strTemp);
                    }
                }

                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_LIFE))                        //3
                {
                    My_Pet.Age = petAttribPacket.Life;
                }

                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_GENERATION))          //5
                {
                    My_Pet.EraCount = petAttribPacket.Generation;
                }

                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_HAPPINESS))           //6
                {
                    My_Pet.Happiness = petAttribPacket.Happiness;
                }

                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_HP))                          //7
                {
                    My_Pet.HP = petAttribPacket.HP;
                }
                if (My_Pet.HP < 0)
                {
                    My_Pet.HP = 0;
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_HPMAX))
                {
                    My_Pet.HPMax = petAttribPacket.HPMax;
                }

                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_DEF_CRITICAL))
                {
                    My_Pet.DefCritical = petAttribPacket.DefCritical;
                }

                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_ATT_PHYSICS))
                {
                    My_Pet.AttPhysics = petAttribPacket.AttPhysics;
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_ATT_MAGIC))
                {
                    My_Pet.AttMagic = petAttribPacket.AttMagic;
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_DEF_PHYSICS))
                {
                    My_Pet.DefPhysics = petAttribPacket.DefPhysics;
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_DEF_MAGIC))
                {
                    My_Pet.DefMagic = petAttribPacket.DefMagic;
                }

                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_HIT))
                {
                    My_Pet.Hit = petAttribPacket.Hit;
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_MISS))
                {
                    My_Pet.Miss = petAttribPacket.Miss;
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_CRITICAL))
                {
                    My_Pet.Critical = petAttribPacket.Critical;
                }

                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_MODELID))
                {
                    My_Pet.ModelID = petAttribPacket.ModelID;
                }

                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_MOUNTID))
                {
                    My_Pet.MountID = petAttribPacket.MountID;
                }

                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_EXP))
                {
                    int oldExp = My_Pet.Exp;
                    My_Pet.Exp = petAttribPacket.Exp;

                    if (My_Pet.Exp > oldExp && oldExp != -1 && oldExp != 0)
                    {
                        //CHAR szText[1024] = {0};
                        //_snprintf( szText, 1024, "你的宠物#cCCFFCC%s#W获得了经验奖励#cC8B88E%d#W", My_Pet.m_szName.c_str(), My_Pet.m_nExp-oldExp);
                        //ADDTALKMSG(szText);
                    }
                }
                if (My_Pet.Exp < 0)
                {
                    My_Pet.Exp = 0;
                }

                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_STRPERCEPTION))
                {
                    My_Pet.AttrStrApt = petAttribPacket.StrPerception;
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_CONPERCEPTION))
                {
                    My_Pet.AttrConApt = petAttribPacket.ConPerception;
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_DEXPERCEPTION))
                {
                    My_Pet.AttrDexApt = petAttribPacket.DexPerception;
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_SPRPERCEPTION))
                {
                    My_Pet.AttrSprApt = petAttribPacket.SprPerception;
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_INTPERCEPTION))
                {
                    My_Pet.AttrIntApt = petAttribPacket.IntPerception;
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_GENGU))
                {
                    My_Pet.Basic = petAttribPacket.GenGu;
                }

                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_STR))
                {
                    My_Pet.AttrStr = petAttribPacket.Str;
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_CON))
                {
                    My_Pet.AttrCon = petAttribPacket.Con;
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_DEX))
                {
                    My_Pet.AttrDex = petAttribPacket.Dex;
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_SPR))
                {
                    My_Pet.AttrSpr = petAttribPacket.Spr;
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_INT))
                {
                    My_Pet.AttrInt = petAttribPacket.Int;
                }

                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_RANDOM_STR))                                  //力量
                {
                    My_Pet.AttrStrBring = petAttribPacket.StrBring;
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_RANDOM_SPR))
                {
                    My_Pet.AttrSprBring = (petAttribPacket.SprBring);
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_RANDOM_CON))
                {
                    My_Pet.AttrConBring = (petAttribPacket.ConBring);
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_RANDOM_INT))
                {
                    My_Pet.AttrIntBring = (petAttribPacket.IntBring);
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_RANDOM_DEX))
                {
                    My_Pet.AttrDexBring = (petAttribPacket.DexBring);
                }

                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_POINT_REMAIN))
                {
                    My_Pet.Pot = petAttribPacket.RemainPoint;
                }

                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_SKILL_0))
                {
                    //My_Pet.m_aSkill[0] = petAttribPacket.GetSkill(0);
                    LogManager.Log("Pet_SetSkill " + nPet_num + " " + petAttribPacket.PetSkill[0]);
                    CDataPool.Instance.Pet_SetSkill(nPet_num, 0, ref petAttribPacket.PetSkill[0]);
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_SKILL_1))
                {
                    //My_Pet.m_aSkill[0] = petAttribPacket.GetSkill(0);
                    LogManager.Log("Pet_SetSkill " + nPet_num + " " + petAttribPacket.PetSkill[1]);
                    CDataPool.Instance.Pet_SetSkill(nPet_num, 1, ref petAttribPacket.PetSkill[1]);
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_SKILL_2))
                {
                    //My_Pet.m_aSkill[0] = petAttribPacket.GetSkill(0);
                    LogManager.Log("Pet_SetSkill " + nPet_num + " " + petAttribPacket.PetSkill[2]);
                    CDataPool.Instance.Pet_SetSkill(nPet_num, 2, ref petAttribPacket.PetSkill[2]);
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_SKILL_3))
                {
                    //My_Pet.m_aSkill[0] = petAttribPacket.GetSkill(0);
                    LogManager.Log("Pet_SetSkill " + nPet_num + " " + petAttribPacket.PetSkill[3]);
                    CDataPool.Instance.Pet_SetSkill(nPet_num, 3, ref petAttribPacket.PetSkill[3]);
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_SKILL_4))
                {
                    //My_Pet.m_aSkill[0] = petAttribPacket.GetSkill(0);
                    LogManager.Log("Pet_SetSkill " + nPet_num + " " + petAttribPacket.PetSkill[4]);
                    CDataPool.Instance.Pet_SetSkill(nPet_num, 4, ref petAttribPacket.PetSkill[4]);
                }
                if (petAttribPacket.IsSetBit(ENUM_PET_DETAIL_ATTR.PET_DETAIL_ATTR_SKILL_5))
                {
                    //My_Pet.m_aSkill[0] = petAttribPacket.GetSkill(0);
                    LogManager.Log("Pet_SetSkill " + nPet_num + " " + petAttribPacket.PetSkill[5]);
                    CDataPool.Instance.Pet_SetSkill(nPet_num, 5, ref petAttribPacket.PetSkill[5]);
                }

                CEventSystem.Instance.PushEvent(GAME_EVENT_ID.GE_UPDATE_PET_PAGE);
            }

            return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
        }
Exemplo n.º 14
0
    //该物品是否能够在某对象上使用
    public bool     IsValidTarget(CObject pSelectObj, ref fVector2 fvPos, ref int objID, ref PET_GUID_t petID)
    {
        if (m_theBaseDef == null)
        {
            return(false);
        }
        //玩家自己
        CObject_PlayerMySelf pMySlef = CObjectManager.Instance.getPlayerMySelf();

        ENUM_ITEM_TARGET_TYPE targetType = (ENUM_ITEM_TARGET_TYPE)m_theBaseDef.nTargetType;

        //无需目标
        if (ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_NONE == targetType)
        {
            return(true);
        }

        //需要选择一个场景位置
        if (ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_POS == targetType)
        {
            return(WorldManager.Instance.ActiveScene.IsValidPosition(ref fvPos));
        }

        //目前不支持的方式
        if (ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_DIR == targetType ||         //方向
            ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_ITEM == targetType)          //物品->物品
        {
            return(false);
        }

        switch (targetType)
        {
        case ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_SELF:       //自已
        {
            objID = pMySlef.ServerID;
        }
            return(true);

        case ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_SELF_PET:           //自己的宠物
        {
            //petID = pMySlef.GetCharacterData().Get_CurrentPetGUID();
            ////宠物尚未释放
            //if(petID.IsNull())
            //    return false;

            objID = pMySlef.ServerID;
            return(true);
        }
        //break;

        case ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_FRIEND:     //友好的目标
        case ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_ENEMY:      //敌对目标
        {
            //必须需要一个目标
            if (pSelectObj == null)
            {
                return(false);
            }
            //必须是角色
            if (!(pSelectObj is CObject_Character))
            {
                return(false);
            }

            //检查阵营
            ENUM_RELATION eCampType =
                GameProcedure.s_pGameInterface.GetCampType(pMySlef, pSelectObj);

            //必须是友好目标/敌对目标
            if ((targetType == ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_FRIEND &&
                 (pSelectObj == pMySlef || eCampType == ENUM_RELATION.RELATION_FRIEND)) ||
                (targetType == ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_ENEMY &&
                 (eCampType == ENUM_RELATION.RELATION_ENEMY)))
            {
                objID = pSelectObj.ServerID;
                return(true);
            }
        }
            return(false);

        case ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_FRIEND_PLAYER:     // 友好玩家
        case ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_ENEMY_PLAYER:      //	敌对玩家
        {
            //必须需要一个目标
            if (pSelectObj == null)
            {
                return(false);
            }
            //必须是玩家
            if (!(pSelectObj is CObject_PlayerOther))
            {
                return(false);
            }

            //检查阵营
            ENUM_RELATION eCampType =
                GameProcedure.s_pGameInterface.GetCampType(pMySlef, pSelectObj);

            //必须是友好玩家/敌对玩家
            if ((targetType == ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_FRIEND_PLAYER &&
                 (pSelectObj == pMySlef || eCampType == ENUM_RELATION.RELATION_FRIEND)) ||
                (targetType == ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_ENEMY_PLAYER &&
                 (eCampType == ENUM_RELATION.RELATION_ENEMY)))
            {
                objID = pSelectObj.ServerID;
                return(true);
            }
        }
            return(false);

        case ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_FRIEND_MONSTER:     //友好怪物
        case ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_ENEMY_MONSTER:      //敌对怪物
        {
            //必须需要一个目标
            if (pSelectObj == null)
            {
                return(false);
            }
            //必须是角色
            if (!(pSelectObj is CObject_Character))
            {
                return(false);
            }
            //必须是NPC
            if (((CObject_Character)pSelectObj).GetCharacterType() !=
                CHARACTER_TYPE.CT_MONSTER)
            {
                return(false);
            }

            //检查阵营
            ENUM_RELATION eCampType =
                GameProcedure.s_pGameInterface.GetCampType(pMySlef, pSelectObj);

            //必须是友好NPC
            if ((targetType == ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_FRIEND_MONSTER &&
                 eCampType == ENUM_RELATION.RELATION_FRIEND) ||
                (targetType == ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_ENEMY_MONSTER &&
                 eCampType == ENUM_RELATION.RELATION_ENEMY))
            {
                objID = pSelectObj.ServerID;
                return(true);
            }
        }
            return(false);

        case ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_FRIEND_PET:         //友好宠物
        case ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_ENEMY_PET:          //敌对宠物
        {
            //必须需要一个目标
            if (pSelectObj == null)
            {
                return(false);
            }
            //必须是角色
            if (!(pSelectObj is CObject_Character))
            {
                return(false);
            }
            //必须是NPC
            if (((CObject_Character)pSelectObj).GetCharacterType() !=
                CHARACTER_TYPE.CT_MONSTER)
            {
                return(false);
            }
            //必须是宠物
            if (((CObject_PlayerNPC)pSelectObj).GetNpcType() !=
                ENUM_NPC_TYPE.NPC_TYPE_PET)
            {
                return(false);
            }

            //检查阵营
            ENUM_RELATION eCampType =
                GameProcedure.s_pGameInterface.GetCampType(pMySlef, pSelectObj);

            //必须是友好宠物
            if ((targetType == ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_FRIEND_MONSTER &&
                 eCampType == ENUM_RELATION.RELATION_FRIEND) ||
                (targetType == ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_ENEMY_PET &&
                 eCampType == ENUM_RELATION.RELATION_ENEMY))
            {
                objID = pSelectObj.ServerID;
                return(true);
            }
        }
            return(false);

        case ENUM_ITEM_TARGET_TYPE.ITEM_TARGET_TYPE_ALL_CHARACTER:      //所有角色
        {
            //必须需要一个目标
            if (pSelectObj == null)
            {
                return(false);
            }
            //必须是角色
            if (!(pSelectObj is CObject_Character))
            {
                return(false);
            }

            return(true);
        }
        //return false;

        default:
            break;
        }

        return(false);
    }
Exemplo n.º 15
0
 public override int GetPacketMaxSize()
 {
     return(sizeof(byte) * 3 + PET_GUID_t.getMaxSize());
 }
Exemplo n.º 16
0
 public override int GetPacketMaxSize()
 {
     return(PET_GUID_t.getMaxSize());
 }
Exemplo n.º 17
0
 public override int GetPacketMaxSize()
 {
     return(PET_GUID_t.getMaxSize() + Cooldown_T.getMaxSize() * (int)CHAR_ATTR_CONSTANT1.MAX_COOLDOWN_LIST_SIZE_FOR_HUMAN + sizeof(short));
 }
Exemplo n.º 18
0
 public CObject_Item OtherPlayerPetEquip_GetItem(PET_GUID_t guid, PET_EQUIP ptEquipt)
 {
     return(mOtherPlayerPetDataPool.GetEquiptItem(guid, ptEquipt));
 }
Exemplo n.º 19
0
 public override int GetPacketMaxSize()
 {
     return(sizeof(int) * 2 + PET_GUID_t.getMaxSize());
 }
Exemplo n.º 20
0
 public override int GetPacketMaxSize()
 {
     return(sizeof(int) * 5 + PET_GUID_t.getMaxSize() + sizeof(byte) * (GAMEDEFINE.MAX_CHARACTER_NAME + 1) + sizeof(short));
 }
Exemplo n.º 21
0
 public void OtherPlayerPetEquip_SetItem(PET_GUID_t guid, PET_EQUIP ptEquipt, CObject_Item pEquiptItem, bool bClearOld)
 {
     mOtherPlayerPetDataPool.SetEquiptItem(guid, ptEquipt, pEquiptItem, bClearOld);
 }
 public override int getSize()
 {
     return(sizeof(byte) * 4 + PET_GUID_t.getMaxSize());
 }
 public override int GetPacketMaxSize()
 {
     return(PET_GUID_t.getMaxSize() + sizeof(uint) + _ITEM.GetMaxSize() * (int)PET_EQUIP.PEQUIP_NUMBER + sizeof(int));
 }
Exemplo n.º 24
0
 public void PetSkillCoolDownGroup_UpdateList(Cooldown_T[] pCoolDownList, int nUpdateNum, PET_GUID_t nPet_GUID)
 {
     mCoolDownManager.PetSkillCoolDownGroup_UpdateList(pCoolDownList, nUpdateNum, nPet_GUID);
 }
Exemplo n.º 25
0
 public override int GetPacketMaxSize()
 {
     return(PET_GUID_t.getMaxSize() + sizeof(uint) + sizeof(byte) * (GAMEDEFINE.PET_PLACARD_ITEM_MESSAGE_SIZE + 1));
 }
Exemplo n.º 26
0
 public override int GetPacketMaxSize()
 {
     return(sizeof(byte) + sizeof(uint) + WORLD_POS.GetMaxSize() + sizeof(float) + PET_GUID_t.getMaxSize() + sizeof(byte));
 }
Exemplo n.º 27
0
    public CObject_Item Pet_GetLowestLevel_Dome_From_Package(PET_GUID_t pg, ref int idxPackage) //从背包获得驯养所需最低级的食物
    {
        CObject_Item pFind = null;

        idxPackage = -1;

        //获取食物类型
        int idTableMin = -1, idTableMax = -1, mod = 1000, modold = 0;
        int nFoodType = CDataPool.Instance.Pet_GetPetFoodType(pg);

        int k = (int)ENUM_PET_FOOD_TYPE.PET_FOOD_TYPE_MEAT;

        //根据食物类型来判断循环范围
        if (nFoodType >= 1000)
        {
            k   = (int)ENUM_PET_FOOD_TYPE.PET_FOOD_TYPE_MEAT;
            mod = 1000;
        }
        else if (nFoodType >= 100)
        {
            k   = (int)ENUM_PET_FOOD_TYPE.PET_FOOD_TYPE_GRASS;
            mod = 100;
        }
        else if (nFoodType >= 10)
        {
            k   = (int)ENUM_PET_FOOD_TYPE.PET_FOOD_TYPE_WORM;
            mod = 10;
        }
        else
        {
            k   = (int)ENUM_PET_FOOD_TYPE.PET_FOOD_TYPE_PADDY;
            mod = 1;
        }

        //开始查找物品
        for (; k < (int)ENUM_PET_FOOD_TYPE.PET_FOOD_TYPE_NUMBER; ++k)
        {
            if (0 == mod)
            {
                break;                  //keep loop safe.
            }
            //calculate food type enum
            int q = (nFoodType - modold) / mod;
            idTableMin = -1; idTableMax = -1;
            if (1 == q)
            {
                Pet_GetPetFoodTypeMinMax(k, ref idTableMin, ref idTableMax);
            }
            if (idTableMin < 0 || idTableMax < 0)
            {
                continue;
            }

            //检查背包里等级最低的食物
            for (int i = GAMEDEFINE.BASE_CONTAINER_OFFSET; i < GAMEDEFINE.MAX_BAG_SIZE; ++i)
            {
                CObject_Item pItem = (CObject_Item)CDataPool.Instance.UserBag_GetItemByIndex(i);
                if (pItem != null)
                {
                    int id = pItem.GetIdTable();
                    //id是否是食物
                    if (id > idTableMax || id < idTableMin)
                    {
                        continue;
                    }
                    //道具的使用等级是否合法
                    if (pItem.GetNeedLevel() > Pet_GetPet(pg).Level)
                    {
                        continue;
                    }

                    if (pFind != null)
                    {
                        CObject_Item pOldFind = pFind;
                        pFind = (pItem.GetNeedLevel() > pFind.GetNeedLevel())?pFind:pItem;
                        if (pFind != pOldFind)
                        {
                            idxPackage = i;
                        }
                    }
                    else
                    {
                        pFind      = pItem;
                        idxPackage = i;
                    }
                }            // end of if(pItem)
            }

            //change mod
            modold += mod;
            mod    /= 10;
        }

        return(pFind);
    }
Exemplo n.º 28
0
 public int Pet_GetPetFoodType(PET_GUID_t guidPet)
 {
     return(mPetDataPool.Pet_GetPetFoodType(guidPet));
 }
Exemplo n.º 29
0
 public CObject_Item Pet_GetLowestLevel_Dome_From_Package(PET_GUID_t pg, ref int idxPackage)
 {
     return(mPetDataPool.Pet_GetLowestLevel_Dome_From_Package(pg, ref idxPackage));
 }
Exemplo n.º 30
0
 int                                                     GetPetByGuid(PET_GUID_t PetGuid)
 {
     //Todo:
     return(0);
 }