Ejemplo n.º 1
0
    public override void Init(IntVector4 idx, Transform parent = null,
                              int spid    = 0, int pathid       = 0, bool isActive    = true, bool revisePos = true,
                              bool isBoss = false, bool isErode = true, bool isDelete = true, SimplexNoise noise = null,
                              AssetReq.ReqFinishDelegate onSpawned = null, CommonInterface common = null)
    {
        base.Init(idx, parent, spid, pathid, isActive, revisePos, isBoss, isErode, isDelete, noise, onSpawned, common);

        if (pathid > 0)
        {
            AiAsset.AiDataBlock aiData = AiAsset.AiDataBlock.GetAIDataBase(pathid);
            if (aiData != null)
            {
                //mDamage = aiData.damageSimulate;
                mMaxHp = aiData.maxHpSimulate;
                mHp    = mMaxHp;
            }
        }

        if (spid > 0)
        {
            AISpawnPath path = AISpawnPath.GetSpawnPath(spid);
            {
                if (path != null)
                {
                    //mDamage = path.damage;
                    mMaxHp = path.maxHp;
                    mHp    = mMaxHp;
                }
            }
        }
    }
Ejemplo n.º 2
0
        public static void SetHarm(int dataID, int harm)
        {
            AiDataBlock data = GetAIDataBase(dataID);

            if (data != null && data.mHarm != harm)
            {
                data.mHarm = harm;
            }
        }
Ejemplo n.º 3
0
        public static void SetCamp(int dataID, int camp)
        {
            AiDataBlock data = GetAIDataBase(dataID);

            if (data != null && data.mCamp != camp)
            {
                data.mCamp = camp;
            }
        }
Ejemplo n.º 4
0
        public static void LoadData()
        {
            AiHatredData.LoadData();
            AiHarmData.LoadData();
            AiDataBlock.LoadData();
            AiDamageTypeData.LoadData();

            AISpawnDataRepository.LoadData();
        }
Ejemplo n.º 5
0
        public static ItemDrop GetItemDrop(int id)
        {
            AiDataBlock data = GetAIDataBase(id);

            if (data == null)
            {
                return(null);
            }

            return(data.m_ItemDrop);
        }
Ejemplo n.º 6
0
        public static void LoadData()
        {
            SqliteDataReader reader = LocalDatabase.Instance.ReadFullTable("ai_data");

            while (reader.Read())
            {
                AiDataBlock data = new AiDataBlock();

                data.dataId      = Convert.ToInt32(reader.GetString(reader.GetOrdinal("monster_ID")));
                data.uiName      = reader.GetString(reader.GetOrdinal("ui_name"));
                data.name        = PELocalization.GetString(Convert.ToInt32(reader.GetString(reader.GetOrdinal("eng_name"))));
                data.xmlPath     = reader.GetString(reader.GetOrdinal("tree_path"));
                data.model       = Convert.ToInt32(reader.GetString(reader.GetOrdinal("model_ID")));
                data.nature      = (Nature)Convert.ToInt32(reader.GetString(reader.GetOrdinal("environment")));
                data.dietary     = (Dietary)Convert.ToInt32(reader.GetString(reader.GetOrdinal("feeding_habits")));
                data.social      = Convert.ToBoolean(Convert.ToInt32(reader.GetString(reader.GetOrdinal("social"))));
                data.cavern      = Convert.ToBoolean(Convert.ToInt32(reader.GetString(reader.GetOrdinal("cavern"))));
                data.darkness    = Convert.ToBoolean(Convert.ToInt32(reader.GetString(reader.GetOrdinal("darkness"))));
                data.isboss      = Convert.ToBoolean(Convert.ToInt32(reader.GetString(reader.GetOrdinal("isboss"))));
                data.camp        = Convert.ToInt32(reader.GetString(reader.GetOrdinal("camp")));
                data.harm        = Convert.ToInt32(reader.GetString(reader.GetOrdinal("harm")));
                data.damage      = Convert.ToInt32(reader.GetString(reader.GetOrdinal("attack")));
                data.buildDamage = Convert.ToInt32(reader.GetString(reader.GetOrdinal("damage")));
                data.defence     = Convert.ToInt32(reader.GetString(reader.GetOrdinal("defense")));
                data.life        = Convert.ToInt32(reader.GetString(reader.GetOrdinal("hp")));
                data.music       = Convert.ToInt32(reader.GetString(reader.GetOrdinal("music")));
                data.attackType  = Convert.ToInt32(reader.GetString(reader.GetOrdinal("attack_type")));
                data.defenseType = Convert.ToInt32(reader.GetString(reader.GetOrdinal("defense_type")));
                data.walkSpeed   = Convert.ToSingle(reader.GetString(reader.GetOrdinal("walking_speed")));
                data.runSpeed    = Convert.ToSingle(reader.GetString(reader.GetOrdinal("running_speed")));
                data.jumpHeight  = Convert.ToSingle(reader.GetString(reader.GetOrdinal("jump_height")));
                data.alertRange  = Convert.ToSingle(reader.GetString(reader.GetOrdinal("alert_rad")));
                data.wanderRange = Convert.ToSingle(reader.GetString(reader.GetOrdinal("patrol_rad")));
                data.moveRange   = Convert.ToSingle(reader.GetString(reader.GetOrdinal("active_range")));
                //data.chaseRange  = Convert.ToSingle(reader.GetString(reader.GetOrdinal("chase_distance")));
                data.horizonAngle = Convert.ToSingle(reader.GetString(reader.GetOrdinal("horizon_angle")));
                //data.pitchAngle = Convert.ToSingle(reader.GetString(reader.GetOrdinal("pitch_angle")));
                data.horizonRange = Convert.ToSingle(reader.GetString(reader.GetOrdinal("horizon_rad")));
                data.hearRange    = Convert.ToSingle(reader.GetString(reader.GetOrdinal("hear_rad")));
                //data.hearRange = Convert.ToSingle(reader.GetString(reader.GetOrdinal("hear_rad")));
                data.attackRangeMin = Convert.ToSingle(reader.GetString(reader.GetOrdinal("damage_rad_min")));
                data.attackRangeMax = Convert.ToSingle(reader.GetString(reader.GetOrdinal("damage_rad_max")));
                data.attackAngle    = Convert.ToSingle(reader.GetString(reader.GetOrdinal("damage_angle")));
                data.turnSpeed      = Convert.ToSingle(reader.GetString(reader.GetOrdinal("turn_speed")));
                data.escapeRange    = Convert.ToSingle(reader.GetString(reader.GetOrdinal("escape_distance")));
                data.damageSimulate = Convert.ToSingle(reader.GetString(reader.GetOrdinal("dps")));
                data.maxHpSimulate  = Convert.ToSingle(reader.GetString(reader.GetOrdinal("hp_relative")));
                //data.itemDrop = reader.GetString(reader.GetOrdinal("item_drop"));
                //				data.strongWeight = Convert.ToInt32(reader.GetString(reader.GetOrdinal("strong")));
                //				data.normalWeight = Convert.ToInt32(reader.GetString(reader.GetOrdinal("normal")));
                //				data.sickWeight = Convert.ToInt32(reader.GetString(reader.GetOrdinal("sick")));
                //				data.pregnancyWeight = Convert.ToInt32(reader.GetString(reader.GetOrdinal("pregnancy")));
                data.pregnancyTime = Convert.ToSingle(reader.GetString(reader.GetOrdinal("pregnancy_time")));
                data.eggDrop       = Convert.ToSingle(reader.GetString(reader.GetOrdinal("egg_drop")));

                data.restTimeMin     = Convert.ToSingle(reader.GetString(reader.GetOrdinal("_restTimeMin")));
                data.restTimeMax     = Convert.ToSingle(reader.GetString(reader.GetOrdinal("_restTimeMax")));
                data.fatigueMulDay   = Convert.ToSingle(reader.GetString(reader.GetOrdinal("_fatigueMulDaytime")));
                data.fatigueMulNight = Convert.ToSingle(reader.GetString(reader.GetOrdinal("_fatigueMulNight")));
                data.wakeRate        = Convert.ToSingle(reader.GetString(reader.GetOrdinal("_sleepWaked")));
                data.deathSkill      = Convert.ToInt32(reader.GetString(reader.GetOrdinal("_deathSkill")));
                data.colonyLevDamage = Convert.ToInt32(reader.GetString(reader.GetOrdinal("_DSLvInjureEnable")));
                data.colonyLevEscape = Convert.ToInt32(reader.GetString(reader.GetOrdinal("_DSLvEscape")));

                string   colonyString = reader.GetString(reader.GetOrdinal("_DSEscapeInfo"));
                string[] infos        = AiUtil.Split(colonyString, ',');
                if (infos.Length == 2)
                {
                    data.colonyEscapeValue = Convert.ToSingle(infos[0]);
                    data.colonyEscapeRate  = Convert.ToSingle(infos[1]);
                }

                string deathParticleStr = reader.GetString(reader.GetOrdinal("_deathEffect"));
                if (deathParticleStr != "0")
                {
                    string[] deathParticle = deathParticleStr.Split(',');
                    data.deathEffect = new int[deathParticle.Length];
                    for (int i = 0; i < data.deathEffect.Length; i++)
                    {
                        data.deathEffect[i] = Convert.ToInt32(deathParticle[i]);
                    }
                }

                string equipmentStr = reader.GetString(reader.GetOrdinal("_equip"));
                if (!string.IsNullOrEmpty(equipmentStr))
                {
                    string[] equipments = equipmentStr.Split(',');
                    data.equipmentIDs = new int[equipments.Length];
                    for (int i = 0; i < data.equipmentIDs.Length; i++)
                    {
                        data.equipmentIDs[i] = Convert.ToInt32(equipments[i]);
                    }
                }

                data.drinkSkill = Convert.ToInt32(reader.GetString(reader.GetOrdinal("_drinkSkill")));
                data.sleepSkill = Convert.ToInt32(reader.GetString(reader.GetOrdinal("_sleepSkill")));

                string attackStr = reader.GetString(reader.GetOrdinal("_attackSkill"));
                if (attackStr != "0")
                {
                    string[] attackSkills = attackStr.Split(',');

                    data.attackSkill = new SkillData[attackSkills.Length];
                    for (int i = 0; i < data.attackSkill.Length; i++)
                    {
                        //Debug.LogError(attackSkills[i]);
                        string[] skillData = attackSkills[i].Split(':');
                        data.attackSkill[i].id          = Convert.ToInt32(skillData[0]);
                        data.attackSkill[i].probability = Convert.ToSingle(skillData[1]);
                    }
                }

                data.callRate      = Convert.ToSingle(reader.GetString(reader.GetOrdinal("_callProbability")));
                data.calledRate    = Convert.ToSingle(reader.GetString(reader.GetOrdinal("_calledProbability")));
                data.escapePercent = Convert.ToSingle(reader.GetString(reader.GetOrdinal("_escapeHpPercent")));

                string   strTmp   = reader.GetString(reader.GetOrdinal("item_drop"));
                string[] strlist0 = strTmp.Split(';');
                if (strlist0.Length == 2)
                {
                    int count = Convert.ToInt32(strlist0[0]);
                    if (count > 0)
                    {
                        //ItemDrop itemDrop = new ItemDrop();
                        //itemDrop.count = count;

                        //string[] stritemlist = strlist0[1].Split(',');
                        //if(stritemlist.Length > 0)
                        //{
                        //    for (int i = 0; i < stritemlist.Length; i++)
                        //    {
                        //        string[] strlist1 = stritemlist[i].Split('_');
                        //        if (strlist1.Length == 2)
                        //        {
                        //            DropData dropData = new DropData();
                        //            dropData.id = Convert.ToInt32(strlist1[0]);
                        //            dropData.pro = Convert.ToSingle(strlist1[1]);
                        //            itemDrop.DropList.Add(dropData);
                        //        }
                        //    }
                        //}
                        //data.ItemDropMap.Add(data.dataId, itemDrop);

                        data.m_ItemDrop.count = count;

                        string[] stritemlist = strlist0[1].Split(',');
                        if (stritemlist.Length > 0)
                        {
                            for (int i = 0; i < stritemlist.Length; i++)
                            {
                                string[] strlist1 = stritemlist[i].Split('_');
                                if (strlist1.Length == 2)
                                {
                                    DropData dropData = new DropData();
                                    dropData.id  = Convert.ToInt32(strlist1[0]);
                                    dropData.pro = Convert.ToSingle(strlist1[1]);
                                    data.m_ItemDrop.DropList.Add(dropData);
                                }
                            }
                        }
                    }
                }

                //data.MeatDrop = new Min_Max_Int();
                strTmp   = reader.GetString(reader.GetOrdinal("meat_drop"));
                strlist0 = strTmp.Split(';');
                if (strlist0.Length == 2)
                {
                    //data.MeatDrop.m_Min = Convert.ToInt32(strlist0[0]);
                    //data.MeatDrop.m_Max = Convert.ToInt32(strlist0[1]);
                }

                strTmp   = reader.GetString(reader.GetOrdinal("item_carry"));
                strlist0 = strTmp.Split(';');
                for (int i = 0; i < strlist0.Length; i++)
                {
                    string[] strlist1 = strlist0[i].Split(',');
                    if (strlist1.Length == 2)
                    {
                        //ID_Num md = new ID_Num();
                        //md.id = Convert.ToInt32(strlist1[0]);
                        //md.missionId = md.id % 10000 / 10;
                        //md.num = Convert.ToInt32(strlist1[1]);

                        //data.MissDropList.Add(md);
                    }
                }

                string   lifeForms = reader.GetString(reader.GetOrdinal("_lfrList"));
                string[] lifes     = AiUtil.Split(lifeForms, ',');
                data.lifeFormIDs = new int[lifes.Length];
                for (int i = 0; i < data.lifeFormIDs.Length; i++)
                {
                    data.lifeFormIDs[i] = Convert.ToInt32(lifes[i]);
                }

                data.ResetCamp();
                data.ResetHarm();

                m_data.Add(data.dataId, data);
            }
        }