Ejemplo n.º 1
0
        public void LoadFromDef(string id)
        {
            this.id = id;

            Hashtable def = Defs.GetMap(this.id);

            this.name       = def.GetString("name");
            this.model      = def.GetString("model");
            this.bornPos1   = def.GetVec3("born_pos_1");
            this.bornPos2   = def.GetVec3("born_pos_2");
            this.bornDir1   = Vec3.Normalize(def.GetVec3("born_dir_1"));
            this.bornDir2   = Vec3.Normalize(def.GetVec3("born_dir_2"));
            this.basePoint1 = def.GetVec3("base_point_1");
            this.basePoint2 = def.GetVec3("base_point_2");
            this.bornRange  = def.GetFloat("born_rnd");
            this.camera     = new Camera(def.GetMap("camera"));
            Hashtable sDefs = def.GetMap("structures");

            this.structures = new Dictionary <string, Structure>();
            foreach (DictionaryEntry de in sDefs)
            {
                this.structures[( string )de.Key] = new Structure(( Hashtable )de.Value);
            }
            Hashtable nDefs = def.GetMap("neutrals");

            this.neutrals = new Dictionary <string, Neutral>();
            foreach (DictionaryEntry de in nDefs)
            {
                this.neutrals[( string )de.Key] = new Neutral(( Hashtable )de.Value);
            }
            this.script = def.GetString("script");
        }
Ejemplo n.º 2
0
        public void LoadFromDef(string id)
        {
            this.id = id;

            Hashtable def = Defs.GetSkill(this.id);

            this.name            = def.GetString("name");
            this.desc            = def.GetString("desc");
            this.isCommon        = def.GetBoolean("is_common");
            this.castType        = ( CastType )def.GetInt("cast_type");
            this.campType        = ( CampType )def.GetInt("camp_type");
            this.rangeType       = ( RangeType )def.GetInt("range_type");
            this.targetFlag      = ( EntityFlag )def.GetInt("target_flag");
            this.canInterrupt    = def.GetBoolean("can_interrupt");
            this.ignoreObstacles = def.GetBoolean("ignore_obstacles");
            this.icon            = def.GetString("icon");
            this.passiveBuffs    = def.GetStringArray("passive_buffs");
            this.buffs           = def.GetStringArray("buffs");

            ArrayList lvls = def.GetList("level");

            if (lvls != null)
            {
                int count = lvls.Count;
                this.levels = new Level[count];
                for (int i = 0; i < count; i++)
                {
                    Level     lvl  = this.levels[i] = new Level();
                    Hashtable ldef = ( Hashtable )lvls[i];
                    lvl.atkTime        = ldef.GetFloat("atk_time");
                    lvl.sufTime        = ldef.GetFloat("suf_time");
                    lvl.action         = ldef.GetString("action");
                    lvl.actionLength   = ldef.GetFloat("action_length");
                    lvl.dashStartSpeed = ldef.GetFloat("dash_start_speed");
                    float[] c = ldef.GetFloatArray("dash_speed_curve");
                    if (c != null && c.Length > 0)
                    {
                        AnimationCurve curve = new AnimationCurve();
                        for (int j = 0; j < c.Length; j += 4)
                        {
                            curve.AddKey(new Keyframe(c[j + 0], c[j + 1], c[j + 2], c[j + 3]));
                        }
                        lvl.dashSpeedCurve = curve;
                    }
                    lvl.distance   = ldef.GetFloat("distance");
                    lvl.cooldown   = ldef.GetFloat("cooldown");
                    lvl.manaCost   = ldef.GetFloat("mana");
                    lvl.atkFx      = ldef.GetString("atk_fx");
                    lvl.atkFxTime  = ldef.GetFloat("atk_fx_time");
                    lvl.atkSound   = ldef.GetString("atk_sound");
                    lvl.missile    = ldef.GetString("missile");
                    lvl.firingTime = ldef.GetFloat("firing_time");
                }
            }
        }
Ejemplo n.º 3
0
        public void LoadFromDef(string id)
        {
            this.id = id;

            Hashtable def = Defs.GetBuff(this.id);

            this.name = def.GetString("name");

            this.campType        = ( CampType )def.GetInt("camp_type");
            this.targetFlag      = ( EntityFlag )def.GetInt("target_flag");
            this.rangeType       = ( RangeType )def.GetInt("range_type");
            this.spawnPoint      = ( SpawnPoint )def.GetInt("spawn_point");
            this.deadType        = ( DeadType )def.GetInt("dead_type");
            this.orbit           = ( Orbit )def.GetInt("orbit");
            this.autoScaleAreaFx = def.GetBoolean("auto_scale_area_fx");
            this.canInterrupt    = def.GetBoolean("can_interrupt");
            this.enterStates     = def.GetStringArray("enter_states");
            this.triggerStates   = def.GetStringArray("trigger_states");

            ArrayList lvls = def.GetList("level");

            if (lvls != null)
            {
                int count = lvls.Count;
                this.levels = new Level[count];
                for (int i = 0; i < count; i++)
                {
                    Level     lvl  = this.levels[i] = new Level();
                    Hashtable ldef = ( Hashtable )lvls[i];
                    lvl.radius   = ldef.GetFloat("radius");
                    lvl.areaFx   = ldef.GetString("area_fx");
                    lvl.extra    = ldef.GetFloatArray("extra");
                    lvl.extra_s  = ldef.GetStringArray("extra_s");
                    lvl.duration = ldef.GetFloat("duration");
                    lvl.speed    = ldef.GetFloat("speed");
                    int n = ldef.GetInt("max_trigger_targets");
                    lvl.maxTriggerTargets = n == 0 ? int.MaxValue : n;
                    n = ldef.GetInt("per_target_trigger_count");
                    lvl.perTargetTriggerCount = n == 0 ? int.MaxValue : n;
                    lvl.maxTriggerCount       = ldef.GetInt("max_trigger_count");
                    if (ldef.ContainsKey("trigger"))
                    {
                        lvl.trigger = new Trigger(ldef.GetMap("trigger"));
                    }
                    else if (this.triggerStates != null)
                    {
                        lvl.trigger = new Trigger();
                    }
                }
            }
        }
Ejemplo n.º 4
0
        internal void LoadFromDef(string id)
        {
            this.id = id;
            Hashtable def = Defs.GetBuffState(this.id);

            this.type           = ( BuffStateType )def.GetInt("type");
            this.overlapType    = ( BuffStateOverlapType )def.GetInt("overlap_type");
            this.beneficialType = ( BeneficialType )def.GetInt("beneficial_type");

            ArrayList lvls = def.GetList("level");

            if (lvls != null)
            {
                int count = lvls.Count;
                this.levels = new Level[count];
                for (int i = 0; i < count; i++)
                {
                    Level     lvl  = this.levels[i] = new Level();
                    Hashtable ldef = ( Hashtable )lvls[i];

                    int[] attri = ldef.GetIntArray("attrs");
                    if (attri != null)
                    {
                        int c2 = attri.Length;
                        lvl.attrs = new Attr[c2];
                        for (int j = 0; j < c2; j++)
                        {
                            lvl.attrs[j] = ( Attr )attri[j];
                        }
                    }
                    lvl.values = ldef.GetFloatArray("values");
                    if (ldef.ContainsKey("trigger"))
                    {
                        lvl.trigger = new Trigger(ldef.GetMap("trigger"));
                    }
                    lvl.extra    = ldef.GetFloatArray("extra");
                    lvl.extra_s  = ldef.GetStringArray("extra_s");
                    lvl.duration = ldef.GetFloat("duration");
                    lvl.fxs      = ldef.GetStringArray("fxs");
                }
            }
        }
Ejemplo n.º 5
0
        internal void LoadFromDef(string id)
        {
            this.id = id;
            Hashtable def       = Defs.GetEntity(this.id);
            string    reference = def.GetString("ref");

            while (!string.IsNullOrEmpty(reference))
            {
                Hashtable refdef = Defs.GetEntity(reference);
                reference = refdef.GetString("ref");
                def.Concat(refdef);
            }
            this.name       = def.GetString("name");
            this.model      = def.GetString("model");
            this.noShadow   = def.GetBoolean("no_shadow");
            this.flag       = ( EntityFlag )def.GetInt("flag");
            this.size       = def.GetVec3("size");
            this.mass       = def.GetFloat("mass");
            this.volumetric = def.GetBoolean("volumetric");
            this.fov        = def.GetFloat("fov");
            this.speed      = def.GetFloat("speed");
            this.rotSpeed   = def.GetFloat("rot_speed");
            this.scale      = def.GetFloat("scale");
            if (this.scale <= 0)
            {
                this.scale = 1;
            }
            this.trackDistance  = def.GetFloat("track_distance");
            this.goldBase       = def.GetInt("gold_base");
            this.skillPointBase = def.GetInt("skill_point_base");
            if (def.ContainsKey("firing_point"))
            {
                this.firingPoint = def.GetVec3("firing_point");
            }
            if (def.ContainsKey("hit_point"))
            {
                this.hitPoint = def.GetVec3("hit_point");
            }
            this.destructImmediately = def.GetBoolean("destruct_immediately");
            this.lifeTime            = def.GetFloat("life_time");

            this.skills = def.GetStringArray("skills");

            ArrayList lvls = def.GetList("level");

            if (lvls != null)
            {
                int count = lvls.Count;
                this.levels = new Level[count];
                for (int i = 0; i < count; i++)
                {
                    Level     lvl  = this.levels[i] = new Level();
                    Hashtable ldef = ( Hashtable )lvls[i];
                    lvl.mhp                       = ldef.GetFloat("hp");
                    lvl.mmana                     = ldef.GetFloat("mana");
                    lvl.hpRegen                   = ldef.GetFloat("hp_regen");
                    lvl.manaRegen                 = ldef.GetFloat("mana_regen");
                    lvl.ad                        = ldef.GetFloat("ad");
                    lvl.armor                     = ldef.GetFloat("armor");
                    lvl.armorPenFlat              = ldef.GetFloat("armor_pen_flat");
                    lvl.armorPen                  = ldef.GetFloat("armor_pen");
                    lvl.ap                        = ldef.GetFloat("ap");
                    lvl.magicResist               = ldef.GetFloat("magic_resist");
                    lvl.magicPenFlat              = ldef.GetFloat("magic_pen_flat");
                    lvl.magicPen                  = ldef.GetFloat("magic_pen");
                    lvl.reliveTime                = ldef.GetInt("relive_time");
                    lvl.reliveGold                = ldef.GetInt("relive_gold");
                    lvl.goldBountyAwarded         = ldef.GetInt("gold_bounty_awarded");
                    lvl.expBountyAwarded          = ldef.GetInt("exp_bounty_awarded");
                    lvl.upgradeExpNeeded          = ldef.GetInt("upgrade_exp_needed");
                    lvl.upgradeSkillPointObtained = ldef.GetInt("upgrade_skill_point_obtained");
                    lvl.upgradeGoldObtained       = ldef.GetInt("upgrade_gold_obtained");
                }
            }

            this.aiDatas = AIData.Parse(def.GetList("ai"));
            this.script  = def.GetString("script");

            //missile
            this.flightType = ( FlightType )def.GetInt("flight_type");
            this.duration   = def.GetFloat("duration");
            this.arc        = def.GetFloat("arc");
            this.hitFx      = def.GetString("hit_fx");

            //effect
            this.shaderName    = def.GetString("shader_name");
            this.shadowVisible = def.GetBoolean("shadow_visible");
            this.positionType  = ( EffectPositionType )def.GetInt("position_type");
            this.rotationType  = ( EffectRotationType )def.GetInt("rotation_type");
            this.spare         = ( Spare )def.GetInt("spare");
        }