Exemple #1
0
    public static EntityCreateData BuildRobotEntityData(uint dwTempID, uint baseID, uint job, uint level, string name = "", uint moveSpeed = 1)
    {
        EntityCreateData entityData = new EntityCreateData();

        entityData.ID = dwTempID;
        table.NpcDataBase npcdb = GameTableManager.Instance.GetTableItem <table.NpcDataBase>(baseID);
        if (npcdb != null)
        {
            if (string.IsNullOrEmpty(name))
            {
                entityData.strName = npcdb.strName;
            }
            else
            {
                entityData.strName = name;
            }
        }
        entityData.PropList = new EntityAttr[(int)RobotProp.End - (int)EntityProp.Begin];
        entityData.ViewList = new EntityViewProp[(int)Client.EquipPos.EquipPos_Max];
        table.RobotDataBase robotdata = GameTableManager.Instance.GetTableItem <table.RobotDataBase>(job, (int)level);
        if (robotdata != null)
        {
            BuildRobotPropList(robotdata, npcdb, moveSpeed, ref entityData.PropList);
            BuildRobotViewProp(robotdata, ref entityData.ViewList);
        }
        return(entityData);
    }
Exemple #2
0
    private static void BuildRobotPropList(table.RobotDataBase data, table.NpcDataBase npcdb, uint moveSpeed, ref EntityAttr[] propList)
    {
        if (propList.Length < 0 || propList.Length > (int)RobotProp.End - (int)EntityProp.Begin)
        {
            Engine.Utility.Log.Error("BuildRobotPropList:属性列表长度非法");
            return;
        }
        int index = 0;

        propList[index++] = new EntityAttr((int)RobotProp.Sex, (int)npcdb.sex);
        propList[index++] = new EntityAttr((int)RobotProp.Job, (int)data.dwJob);
        propList[index++] = new EntityAttr((int)CreatureProp.Level, (int)data.dwLevel);
        propList[index++] = new EntityAttr((int)EntityProp.BaseID, (int)npcdb.dwID); //模型ID 0
        propList[index++] = new EntityAttr((int)CreatureProp.Mp, (int)data.mp);      // 法力值
        propList[index++] = new EntityAttr((int)CreatureProp.MaxMp, (int)data.mp);   // 法力值
        propList[index++] = new EntityAttr((int)CreatureProp.Hp, (int)data.hp);
        propList[index++] = new EntityAttr((int)CreatureProp.MaxHp, (int)data.hp);
        propList[index++] = new EntityAttr((int)FightCreatureProp.Power, (int)data.power);                    // 战斗力
        propList[index++] = new EntityAttr((int)FightCreatureProp.Strength, (int)data.liliang);               // 力量
        propList[index++] = new EntityAttr((int)FightCreatureProp.Corporeity, (int)data.tizhi);               // 体质
        propList[index++] = new EntityAttr((int)FightCreatureProp.Intelligence, (int)data.zhili);             // 智力
        propList[index++] = new EntityAttr((int)FightCreatureProp.Spirit, (int)data.jingshen);                // 精神
        propList[index++] = new EntityAttr((int)FightCreatureProp.Agility, (int)data.minjie);                 // 敏捷
        propList[index++] = new EntityAttr((int)FightCreatureProp.PhysicsAttack, (int)(data.pdam * 0.8));     // 最小物理攻击力
        propList[index++] = new EntityAttr((int)FightCreatureProp.PhysicsDefend, (int)(data.pdef * 0.8));     // 最小物理防御力
        propList[index++] = new EntityAttr((int)FightCreatureProp.MagicAttack, (int)(data.mdam * 0.8));       // 最小法术攻击力
        propList[index++] = new EntityAttr((int)FightCreatureProp.MagicDefend, (int)(data.mdef * 0.8));       // 最小法术防御力
        propList[index++] = new EntityAttr((int)FightCreatureProp.MaxPhysicsAttack, (int)(data.pdam * 1.15)); // 最大物理攻击力
        propList[index++] = new EntityAttr((int)FightCreatureProp.MaxPhysicsDefend, (int)(data.pdef * 1.15)); // 最大物理防御力
        propList[index++] = new EntityAttr((int)FightCreatureProp.MaxMagicAttack, (int)(data.mdam * 1.15));   // 最大法术攻击力
        propList[index++] = new EntityAttr((int)FightCreatureProp.MaxMagicDefend, (int)(data.mdef * 1.15));   // 最大法术防御力
        propList[index++] = new EntityAttr((int)FightCreatureProp.PhysicsCrit, (int)data.lucky);              // 物理致命一击
        propList[index++] = new EntityAttr((int)FightCreatureProp.MagicCrit, (int)data.mlucky);               // 法术致命一击
        propList[index++] = new EntityAttr((int)FightCreatureProp.Hit, (int)data.phit);                       // 命中
        propList[index++] = new EntityAttr((int)FightCreatureProp.Dodge, (int)data.hide_per);                 // 闪避

        propList[index++] = new EntityAttr((int)FightCreatureProp.IceAttack, (int)data.ssdam);                // 冰攻
        propList[index++] = new EntityAttr((int)FightCreatureProp.FireAttack, (int)data.esdam);               // 火攻
        propList[index++] = new EntityAttr((int)FightCreatureProp.EleAttack, (int)data.lsdam);                // 电攻
        propList[index++] = new EntityAttr((int)FightCreatureProp.WitchAttack, (int)data.vsdam);              // 暗攻

        propList[index++] = new EntityAttr((int)FightCreatureProp.IceDefend, (int)data.ssdef);                // 冰防
        propList[index++] = new EntityAttr((int)FightCreatureProp.FireDefend, (int)data.esdef);               // 火防
        propList[index++] = new EntityAttr((int)FightCreatureProp.EleDefend, (int)data.lsdef);                // 电防
        propList[index++] = new EntityAttr((int)FightCreatureProp.WitchDefend, (int)data.vsdef);              // 暗防


        propList[index++] = new EntityAttr((int)FightCreatureProp.PhysicsAbsorb, (int)data.pabs);      // 物伤吸收
        propList[index++] = new EntityAttr((int)FightCreatureProp.MagicAbsorb, (int)data.mabs);        // 法伤吸收
        propList[index++] = new EntityAttr((int)FightCreatureProp.HarmDeepen, (int)data.harm_add_per); // 伤害加深
        propList[index++] = new EntityAttr((int)FightCreatureProp.HarmAbsorb, (int)data.harm_sub_per); // 伤害吸收
        propList[index++] = new EntityAttr((int)FightCreatureProp.CritiRatio, (int)data.criti_ratio);  // 暴击伤害百分比



        propList[index++] = new EntityAttr((int)FightCreatureProp.Cure, (int)data.cure);    // 治疗
        propList[index++] = new EntityAttr((int)WorldObjProp.MoveSpeed, (int)moveSpeed);
        //  propList[index++] = new EntityAttr((int)PlayerProp.LoginOutTime, (int)data.lastofftime); // 最近一次下线时间
    }
Exemple #3
0
    private static void BuildRobotViewProp(table.RobotDataBase robotdata, ref EntityViewProp[] propList)
    {
        if (propList == null)
        {
            return;
        }
        if (propList.Length < 0 || propList.Length > (int)Client.EquipPos.EquipPos_Max)
        {
            Engine.Utility.Log.Error("BuildRobotViewProp:外观列表长度非法");
            return;
        }
        List <uint> equipList = new List <uint>();

        equipList.Add(robotdata.Hat);
        equipList.Add(robotdata.Shoulder);
        equipList.Add(robotdata.Coat);
        equipList.Add(robotdata.Leg);
        equipList.Add(robotdata.Adornl_1);
        equipList.Add(robotdata.Adornl_2);
        equipList.Add(robotdata.Shield);
        equipList.Add(robotdata.Equip);
        equipList.Add(robotdata.Shoes);
        equipList.Add(robotdata.Cuff);
        equipList.Add(robotdata.Belf);
        equipList.Add(robotdata.Necklace);

        int index = 0;

        propList[index++] = new EntityViewProp((int)Client.EquipPos.EquipPos_Body, 0);
        propList[index++] = new EntityViewProp((int)Client.EquipPos.EquipPos_Weapon, 0);

        for (int i = 0; i < equipList.Count; i++)
        {
            if (equipList[i] != 0)
            {
                table.EquipDataBase equipdb = GameTableManager.Instance.GetTableItem <table.EquipDataBase>(equipList[i]);
                if (equipdb != null)
                {
                    if (equipdb.act_show != 0)
                    {
                        table.SuitDataBase suitDb = GameTableManager.Instance.GetTableItem <table.SuitDataBase>(equipdb.act_show, 1);
                        if (suitDb != null)
                        {
                            int pos = GetPropPos((Client.EquipPos)suitDb.base_id, propList);
                            if (pos >= 0)
                            {
                                propList[pos] = new EntityViewProp((int)suitDb.type, (int)suitDb.base_id);
                            }
                            else
                            {
                                propList[index++] = new EntityViewProp((int)suitDb.type, (int)suitDb.base_id);
                            }
                        }
                    }
                }
            }
        }
    }