Ejemplo n.º 1
0
    public bool m_bCanUse;                                      //是否可用,开关被动技能

    public void CleanUp( )
    {
        m_pDefine   = null;
        m_nPetNum   = -1;
        m_nPosIndex = -1;
        m_bCanUse   = false;
    }
Ejemplo n.º 2
0
        public override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer)
        {
            if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain)
            {
                LogManager.Log("Receive GCDetailHealsAndDamages Packet");
                GCDetailHealsAndDamages Packet = (GCDetailHealsAndDamages)pPacket;
                CObject pObj = CObjectManager.Instance.FindServerObject((int)Packet.RecieverID);
                if (pObj != null)
                {
                    _DAMAGE_INFO infoDamage = new _DAMAGE_INFO();
                    infoDamage.m_nSkillID = Packet.SkillID;

                    if (infoDamage.m_nSkillID != MacroDefine.INVALID_ID)
                    {
                        _DBC_SKILL_DATA skillData = CSkillDataMgr.Instance.GetSkillData((uint)infoDamage.m_nSkillID);
                        if (skillData != null)
                        {
                            infoDamage.m_nBulletID = skillData.m_nBulletID;
                        }
                    }

                    infoDamage.m_nTargetID         = (uint)Packet.RecieverID;
                    infoDamage.m_nSenderID         = (uint)Packet.SenderID;
                    infoDamage.m_nSenderLogicCount = Packet.SenderLogicCount;
                    infoDamage.m_nImpactID         = MacroDefine.INVALID_ID;
                    infoDamage.m_nType             = _DAMAGE_INFO.DAMAGETYPE.TYPE_HEAL_AND_DAMAGE;
                    if (Packet.IsHpModificationDirty())
                    {
                        infoDamage.m_bHealthDirty     = true;
                        infoDamage.m_nHealthIncrement = Packet.HPModification;
                    }
                    if (Packet.IsMpModificationDirty())
                    {
                        infoDamage.m_bManaDirty     = true;
                        infoDamage.m_nManaIncrement = Packet.MPModification;
                    }
                    if (Packet.IsRageModificationDirty())
                    {
                        infoDamage.m_bRageDirty     = true;
                        infoDamage.m_nRageIncrement = Packet.RageModification;
                    }
                    if (Packet.IsStrikePointModificationDirty())
                    {
                        infoDamage.m_bStrikePointDirty     = true;
                        infoDamage.m_nStrikePointIncrement = Packet.StrikePointModification;
                    }
                    infoDamage.m_bIsCriticalHit = Packet.CriticalHit;

                    _LOGIC_EVENT logicEvent = new _LOGIC_EVENT();
                    logicEvent.Init((uint)Packet.SenderID, Packet.SenderLogicCount, infoDamage);

                    SCommand_Object cmdTemp = new SCommand_Object();
                    cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_LOGIC_EVENT;
                    cmdTemp.SetValue <object>(0, logicEvent);
                    pObj.PushCommand(cmdTemp);
                }
            }
            return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
        }
Ejemplo n.º 3
0
    public List <int> GetAnimList(uint skillID, bool bSendAnim)
    {
        Dictionary <uint, List <int> > skillAnimMap;

        if (bSendAnim)
        {
            skillAnimMap = m_mapSkillSendAnim;
        }
        else
        {
            skillAnimMap = m_mapSkillLeadAnim;
        }

        if (skillAnimMap.ContainsKey(skillID))
        {
            return(skillAnimMap[skillID]);
        }
        else
        {
            _DBC_SKILL_DATA skillData = GetSkillData(skillID);
            if (skillData == null)
            {
                return(null);
            }

            string[] vAnim;
            char[]   splitter = new char[1] {
                ';'
            };
            if (bSendAnim)
            {
                vAnim = skillData.m_lpszSendActionSetID.Split(splitter, StringSplitOptions.RemoveEmptyEntries);
            }
            else
            {
                vAnim = skillData.m_lpszGatherLeadActionSetID.Split(splitter, StringSplitOptions.RemoveEmptyEntries);
            }

            if (vAnim.Length == 0)
            {
                LogManager.Log("CSkillDataMgr::GetAnimList Invalid skill anim set");
                return(null);
            }

            List <int> animateIndexes = new List <int>();
            foreach (string animateIndex in vAnim)
            {
                animateIndexes.Add(System.Convert.ToInt32(animateIndex));
            }
            skillAnimMap.Add(skillID, animateIndexes);
            return(skillAnimMap[skillID]);
        }
    }
Ejemplo n.º 4
0
    //宠物五行属性技能学习数据访问
    public void PetSkillStudy_MenPaiList_AddSkill(int skillId)
    {
        PET_SKILL sk = new PET_SKILL();

        sk.m_bCanUse   = false;
        sk.m_nPetNum   = GAMEDEFINE.MENPAI_PETSKILLSTUDY_PETNUM;
        sk.m_nPosIndex = m_petSkillStudyList.Count;
        _DBC_SKILL_DATA pDefine = CSkillDataMgr.Instance.GetSkillData((uint)skillId);

        if (pDefine != null)
        {
            sk.m_pDefine = pDefine;
            m_petSkillStudyList.Add(sk);
        }
    }
Ejemplo n.º 5
0
    public void Pet_SetSkill(int nIndex, int nSkillIndex, ref _OWN_SKILL Skill)
    {
        if (nIndex < 0 || nIndex >= (int)PET_INDEX.PET_INDEX_SELF_NUMBERS)
        {
            return;
        }
        PET_SKILL       theSkill = (m_listPet[nIndex])[nSkillIndex];
        _DBC_SKILL_DATA pDefine  = CDataBaseSystem.Instance.GetDataBase <_DBC_SKILL_DATA>((int)DataBaseStruct.DBC_SKILL_DATA).Search_Index_EQU(Skill.m_nSkillID);

        LogManager.LogWarning("Pet_SetSkill index " + nIndex + " SkillIndex " + nSkillIndex + " SkillID " + Skill.m_nSkillID);
        if (theSkill == null)
        {
            if (pDefine != null)
            {
                PET_SKILL newSkill = new PET_SKILL();

                newSkill.m_pDefine   = pDefine;
                newSkill.m_nPetNum   = nIndex;
                newSkill.m_nPosIndex = nSkillIndex;
                newSkill.m_bCanUse   = true;

                (m_listPet[nIndex])[nSkillIndex] = newSkill;
            }
        }
        else
        {
            if (pDefine != null)
            {
                theSkill.m_pDefine   = pDefine;
                theSkill.m_nPetNum   = nIndex;
                theSkill.m_nPosIndex = nSkillIndex;
                theSkill.m_bCanUse   = true;
            }
            else
            {
                (m_listPet[nIndex])[nSkillIndex] = null;
            }
        }
        //通知ActionSystem。
        CActionSystem.Instance.UserPetSkill_Update(nIndex);
    }
Ejemplo n.º 6
0
    public void TargetPet_SetSkill(int nSkillIndex, ref _OWN_SKILL Skill)
    {
        PET_SKILL theSkill = m_TargetPet[nSkillIndex];
        int       nIndex   = (int)PET_INDEX.TARGETPET_INDEX;

        _DBC_SKILL_DATA pDefine = CDataBaseSystem.Instance.GetDataBase <_DBC_SKILL_DATA>((int)DataBaseStruct.DBC_SKILL_DATA).Search_Index_EQU(Skill.m_nSkillID);

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

                newSkill.m_pDefine   = pDefine;
                newSkill.m_nPetNum   = nIndex;
                newSkill.m_nPosIndex = nSkillIndex;
                newSkill.m_bCanUse   = true;

                m_TargetPet[nSkillIndex] = newSkill;
            }
        }
        else
        {
            if (pDefine != null)
            {
                theSkill.m_pDefine = pDefine;
                theSkill.m_nPetNum = nIndex;
                theSkill.m_bCanUse = true;
            }
            else
            {
                m_TargetPet[nSkillIndex] = null;
            }
        }
        //通知ActionSystem。
        CActionSystem.Instance.UserTargetPetSkill_Update();
    }
        //公用函数接口
        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 override NET_RESULT_DEFINE.PACKET_EXE Execute(PacketBase pPacket, ref Peer pPlayer)
        {
            if (GameProcedure.GetActiveProcedure() == (GameProcedure)GameProcedure.s_ProcMain)
            {
                GCTargetListAndHitFlags Packet = (GCTargetListAndHitFlags)pPacket;
                CObject pObj = CObjectManager.Instance.FindServerObject(Packet.ObjID);
                LogManager.Log("Receive GCTargetListAndHitFlags Packet " + Packet.ObjID + " BulletID: " + Packet.SkillOrSpecialObjDataID + " TargetID: " + Packet.TargetID);
                if (pObj == null)
                {
                    return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
                }

                string pszSenderLocator = "";
                bool   bHitCharacter    = false;
                int    nBulletID        = MacroDefine.INVALID_ID;
                if ((byte)GCTargetListAndHitFlags.TARGETTYPE.SPECIAL_OBJ_ACTIVATE == Packet.DataType)
                {
                    _DBC_SPECIAL_OBJ_DATA pSpecialObjData = CDataBaseSystem.Instance.GetDataBase <_DBC_SPECIAL_OBJ_DATA>((int)DataBaseStruct.DBC_SPECIAL_OBJ_DATA).Search_Index_EQU((int)Packet.SkillOrSpecialObjDataID);
                    if (pSpecialObjData != null)
                    {
                        nBulletID        = pSpecialObjData.m_nBulletID;
                        bHitCharacter    = true;
                        pszSenderLocator = "";
                    }
                }
                else
                {
                    _DBC_SKILL_DATA skillData = CSkillDataMgr.Instance.GetSkillData((uint)Packet.SkillOrSpecialObjDataID);
                    if (skillData != null)
                    {
                        nBulletID        = skillData.m_nBulletID;
                        pszSenderLocator = skillData.m_pszBulletSendLocator;
                        switch ((ENUM_SELECT_TYPE)skillData.m_nSelectType)
                        {
                        case ENUM_SELECT_TYPE.SELECT_TYPE_POS:
                        case ENUM_SELECT_TYPE.SELECT_TYPE_DIR:
                            bHitCharacter = false;
                            break;

                        case ENUM_SELECT_TYPE.SELECT_TYPE_NONE:
                        case ENUM_SELECT_TYPE.SELECT_TYPE_CHARACTER:
                        case ENUM_SELECT_TYPE.SELECT_TYPE_SELF:
                        default:
                            bHitCharacter = true;
                            break;
                        }
                    }
                }

                if (nBulletID != MacroDefine.INVALID_ID)
                {
                    _LOGIC_EVENT_BULLET infoBullet = null;
                    if (bHitCharacter)
                    {
                        CObject_Character pCharacter = (CObject_Character)pObj;
                        // CObject_Special   pSpecial = (CObject_Special)pObj;
                        if (pCharacter != null)
                        {
                            for (byte i = 0; i < Packet.TargetNum; i++)
                            {
                                infoBullet                    = new _LOGIC_EVENT_BULLET();
                                infoBullet.m_nBulletID        = nBulletID;
                                infoBullet.m_pszSenderLocator = pszSenderLocator;
                                infoBullet.m_bHitTargetObj    = bHitCharacter;
                                _LOGIC_EVENT logicEvent = new _LOGIC_EVENT();
                                logicEvent.Init((uint)Packet.ObjID, Packet.LogicCount, infoBullet);
                                SCommand_Object cmdTemp = new SCommand_Object();
                                cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_LOGIC_EVENT;
                                logicEvent.m_bullet.m_nTargetID = (uint)Packet.TargetList[i];
                                cmdTemp.SetValue <object>(0, (object)logicEvent);
                                pCharacter.PushCommand(cmdTemp);
                            }
                        }
                        //else if(pSpecial != null)
                        //{

                        //}
                    }
                    else
                    {
                        infoBullet                    = new _LOGIC_EVENT_BULLET();
                        infoBullet.m_nBulletID        = nBulletID;
                        infoBullet.m_pszSenderLocator = pszSenderLocator;
                        infoBullet.m_bHitTargetObj    = bHitCharacter;

                        infoBullet.m_fTargetX = Packet.PosTarget.m_fX;
                        infoBullet.m_fTargetZ = Packet.PosTarget.m_fZ;
                        _LOGIC_EVENT logicEvent = new _LOGIC_EVENT();
                        logicEvent.Init((uint)Packet.ObjID, Packet.LogicCount, infoBullet);
                        SCommand_Object cmdTemp = new SCommand_Object();
                        cmdTemp.m_wID = (int)OBJECTCOMMANDDEF.OC_LOGIC_EVENT;
                        cmdTemp.SetValue <object>(0, (object)logicEvent);

                        CObject_Character pCharacter = (CObject_Character)pObj;
                        // CObject_Special   pSpecial   = (CObject_Special)pObj;
                        if (pCharacter != null)
                        {
                            pCharacter.PushCommand(cmdTemp);
                        }
                        //  else if(pSpecial != null)
                        // {
                        // CObject_Special *pSpecial = (CObject_Special*)pObj;
                        // }
                    }
                }
                pObj.SetMsgTime(GameProcedure.s_pTimeSystem.GetTimeNow());
            }

            return(NET_RESULT_DEFINE.PACKET_EXE.PACKET_EXE_CONTINUE);
        }