Ejemplo n.º 1
0
 public PetData(UPXElement element)
 {
     m_Id   = element.GetString("id");
     m_Race = (Race)Enum.Parse(typeof(Race), element.GetString("race"));
     m_Name = element.GetString("name");
     m_Icon = element.GetString("icon");
 }
Ejemplo n.º 2
0
 public WorkshopSkillLeveling(Workshop w, UPXElement element)
 {
     workshop     = w;
     moduleSkills = element.Elements("slot").Select(e => {
         return(new ModuleSkillLeveling(e));
     }).ToDictionary(m => m.slotType, m => m);
 }
Ejemplo n.º 3
0
        public InapObject(UPXElement element)
        {
            m_Id          = element.GetString("id");
            m_Name        = element.GetString("name");
            m_Description = element.GetString("description");
            m_Price       = element.GetInt("price");
            m_Type        = (InapObjectType)System.Enum.Parse(typeof(InapObjectType), element.GetString("type"));
            m_Consumable  = element.GetBool("consumable");
            m_Tag         = element.GetInt("tag");
            m_Icon        = element.GetString("icon");
            m_MailTitle   = element.GetString("mail_title");
            m_MailBody    = element.GetString("mail_body");
            m_Available   = element.GetBool("available");
            m_Detail      = element.GetString("detail");
            m_Visible     = element.GetBool("visible");

            m_Data = new Hashtable();
            var inputsElement = element.Element("inputs");

            if (inputsElement != null)
            {
                var dump = inputsElement.Elements("input").Select(ie => {
                    string key = ie.GetString("key");
                    object val = CommonUtils.ParseValue(ie.GetString("value"), ie.GetString("type"));
                    m_Data.Add(key, val);
                    return(key);
                }).ToList();
            }
        }
Ejemplo n.º 4
0
        public static Location Parse(UPXElement e)
        {
            string    id    = e.GetString("id");
            string    name  = e.GetString("name");
            int       level = e.GetInt("level");
            Race      race  = (Race)(byte)(int)e.GetInt("owned_race");
            WorldType type  = (WorldType)Enum.Parse(typeof(WorldType), e.GetString("world_type"));

            float[] hSP = new float[] { 300, 10, 120 };
            float[] bSP = new float[] { -145, 10, 157 };
            float[] cSP = new float[] { -34, 10, -260 };

            if (e.HasAttribute("h_sp"))
            {
                hSP = e.GetString("h_sp").ToFloatArray3();
            }
            if (e.HasAttribute("b_sp"))
            {
                bSP = e.GetString("b_sp").ToFloatArray3();
            }
            if (e.HasAttribute("c_sp"))
            {
                cSP = e.GetString("c_sp").ToFloatArray3();
            }
            return(new Location {
                id = id,
                level = level,
                name = name,
                startRace = race,
                type = type,
                humansSpawnPoint = hSP,
                borguzandsSpawnPoint = bSP,
                criptizidsSpawnPoint = cSP
            });
        }
Ejemplo n.º 5
0
 public CombatBaseAIComponentData(UPXElement e) : base(e)
 {
     if (e.HasAttribute("use_hit_prob_for_agro"))
     {
         useHitProbForAgro = e.GetBool("use_hit_prob_for_agro");
     }
 }
Ejemplo n.º 6
0
 public NebulaElementData(UPXElement element)
 {
     id          = element.GetString("id");
     name        = element.GetString("name");
     description = element.GetString("description");
     iconPath    = element.GetString("icon");
 }
Ejemplo n.º 7
0
        public static float[] GetFloatArray(this UPXElement element, string name)
        {
            string arrStr = element.GetAttributeString(name);

            string[] arr = arrStr.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            if (arr.Length == 0)
            {
                return(new float[] { 0, 0, 0 });
            }
            else if (arr.Length == 1)
            {
                return(new float[] { float.Parse(arr[0], CultureInfo.InvariantCulture), 0, 0 });
            }
            else if (arr.Length == 2)
            {
                return(new float[] { float.Parse(arr[0], CultureInfo.InvariantCulture), float.Parse(arr[1], CultureInfo.InvariantCulture), 0 });
            }
            else
            {
                return(new float[]
                {
                    float.Parse(arr[0], CultureInfo.InvariantCulture),
                    float.Parse(arr[1], CultureInfo.InvariantCulture),
                    float.Parse(arr[2], CultureInfo.InvariantCulture)
                });
            }
        }
Ejemplo n.º 8
0
 public OrbitAIComponentData(UPXElement e) : base(e)
 {
     phiSpeed         = e.GetFloat("phi_speed");
     thetaSpeed       = e.GetFloat("theta_speed");
     radius           = e.GetFloat("radius");
     battleMovingType = (AttackMovingType)Enum.Parse(typeof(AttackMovingType), e.GetString("attack_moving_type"));
 }
Ejemplo n.º 9
0
        public WanderAIComponentData(UPXElement e) : base(e)
        {
            Vector3 min = e.GetFloatArray("min").ToVector3();
            Vector3 max = e.GetFloatArray("max").ToVector3();

            corners          = new MinMax(min, max);
            battleMovingType = (AttackMovingType)Enum.Parse(typeof(AttackMovingType), e.GetString("attack_moving_type"));
        }
Ejemplo n.º 10
0
 public CraftResourceData(UPXElement element)
 {
     m_Id          = element.GetString("id");
     m_Name        = element.GetString("name");
     m_Description = element.GetString("description");
     m_Color       = (ObjectColor)Enum.Parse(typeof(ObjectColor), element.GetString("color"));
     m_Icon        = element.GetString("icon");
 }
Ejemplo n.º 11
0
 public TipInfo(UPXElement element)
 {
     id        = element.GetString("id");
     textId    = element.GetString("text");
     type      = (TipType)System.Enum.Parse(typeof(TipType), element.GetString("type"));
     image     = element.GetString("image");
     eventName = element.GetString("event_name");
 }
Ejemplo n.º 12
0
 public ModuleSkillLeveling(UPXElement element)
 {
     slotType       = (ShipModelSlotType)Enum.Parse(typeof(ShipModelSlotType), element.GetString("slot_type"));
     levelSkillList = new List <LevelSkillPair>();
     var dmp = element.Elements("level").Select(e => {
         levelSkillList.Add(new LevelSkillPair(e));
         return(e);
     }).ToList();
 }
Ejemplo n.º 13
0
        private KeyValuePair <byte, object> ParseTag(UPXElement element)
        {
            string  value = element.GetString("value");
            TagType type  = (TagType)Enum.Parse(typeof(TagType), element.GetString("type"));
            byte    key   = (byte)element.GetInt("key");
            object  val   = CommonUtils.ParseValue(value, type);

            return(new KeyValuePair <byte, object>(key, val));
        }
Ejemplo n.º 14
0
 public WorkshopStatData(UPXElement e)
 {
     workshop = (Workshop)Enum.Parse(typeof(Workshop), e.GetString("name"));
     damage   = e.GetInt("damage");
     speed    = e.GetInt("speed");
     hp       = e.GetInt("hp");
     //cargo = e.GetInt("cargo");
     optimalDistance = e.GetInt("optimal_distance");
     critChance      = e.GetInt("crit_chance");
 }
Ejemplo n.º 15
0
        public HelpSection(UPXElement element)
        {
            id        = element.GetString("id");
            titleId   = element.GetString("title");
            contentId = element.GetString("content");

            subSections = element.Elements("subsection").Select(e => {
                return(new HelpSubSection(e));
            }).ToList();
        }
Ejemplo n.º 16
0
 public InapItem(UPXElement element)
 {
     m_Id          = element.GetString("id");
     m_Name        = element.GetString("name");
     m_Description = element.GetString("description");
     m_Count       = element.GetInt("count");
     m_Price       = element.GetString("price");
     m_Icon        = element.GetString("icon");
     m_Type        = (InapType)System.Enum.Parse(typeof(InapType), element.GetString("type"));
 }
Ejemplo n.º 17
0
 public ShipDamagableComponentData(UPXElement e)
 {
     if (e.HasAttribute("create_chest_when_killed"))
     {
         createChestOnKilling = e.GetBool("create_chest_when_killed");
     }
     else
     {
         createChestOnKilling = true;
     }
 }
Ejemplo n.º 18
0
 public ResPassiveBonusData(PassiveBonusType inType, UPXElement element)
 {
     type             = inType;
     timeToSingleTier = element.GetFloat("time");
     valueForTier     = element.GetFloat("value");
     elementsForTier  = element.GetInt("elements");
     nebulaElementID  = element.GetString("element_id");
     name             = element.GetString("name");
     description      = element.GetString("description");
     icon             = element.GetString("icon");
 }
Ejemplo n.º 19
0
 public ModelComponentData(UPXElement componentElement)
 {
     if (componentElement.HasAttribute("model"))
     {
         model = componentElement.GetString("model");
     }
     else
     {
         model = string.Empty;
     }
 }
Ejemplo n.º 20
0
 public PetUpgradeRequirement(UPXElement element)
 {
     m_Color   = (PetColor)Enum.Parse(typeof(PetColor), element.GetString("color"));
     m_Entries = element.Elements("element").Select(e => {
         IDCountPair pair = new IDCountPair {
             ID    = e.GetString("id"),
             count = e.GetInt("count")
         };
         return(pair);
     }).ToList();
 }
 public PetMasteryUpgradeRequirement(UPXElement element)
 {
     m_Mastery = element.GetInt("mastery");
     m_Entries = element.Elements("element").Select(e => {
         IDCountPair pair = new IDCountPair {
             ID    = e.GetString("id"),
             count = e.GetInt("count")
         };
         return(pair);
     }).ToList();
 }
Ejemplo n.º 22
0
 public BaseAIComponentData(UPXElement e)
 {
     if (e.HasAttribute("align_with_forward_direction"))
     {
         alignWithForwardDirection = e.GetBool("align_with_forward_direction");
     }
     if (e.HasAttribute("rotation_speed"))
     {
         rotationSpeed = e.GetFloat("rotation_speed");
     }
 }
Ejemplo n.º 23
0
 public BotShipComponentData(UPXElement e)
 {
     if (e.HasAttribute("difficulty"))
     {
         difficulty = (Difficulty)System.Enum.Parse(typeof(Difficulty), e.GetString("difficulty"));
     }
     else
     {
         difficulty = Difficulty.none;
     }
 }
Ejemplo n.º 24
0
        public static List <Vector3> ToVector3List(this UPXElement element, string name)
        {
            string         source = element.GetAttributeString(name);
            List <Vector3> result = new List <Vector3>();

            string[] sourceArr = source.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            foreach (string s in sourceArr)
            {
                result.Add(s.ToFloatArray3().ToVector3());
            }
            return(result);
        }
Ejemplo n.º 25
0
        public override void Load(object elementObj)
        {
#if UP
            UPXElement element = elementObj as UPXElement;
#else
            XElement element = elementObj as XElement;
#endif
            var dump = element.Elements("upgrade").Select(ue => {
                PetMasteryUpgradeRequirement req = new PetMasteryUpgradeRequirement(ue);
                this[req.mastery] = req;
                return(req);
            }).ToList();
        }
Ejemplo n.º 26
0
 public PlanetObjectComponentData(UPXElement element)
 {
     nebulaElement = element.GetString("nebula_element");
     maxSlots      = element.GetInt("max_slots");
     if (element.HasAttribute("planet_type"))
     {
         planetType = (PlanetType)System.Enum.Parse(typeof(PlanetType), element.GetString("planet_type"));
     }
     else
     {
         planetType = PlanetType.Planet;
     }
 }
Ejemplo n.º 27
0
        public SimpleWeaponComponentData(UPXElement e)
        {
            optimalDistance = e.GetFloat("optimal_distance");
            damage          = e.GetFloat("damage");
            cooldown        = e.GetFloat("cooldown");

            if (e.HasAttribute("use_target_hp"))
            {
                useTargetHPForDamage = e.GetBool("use_target_hp");
            }
            if (e.HasAttribute("target_hp_percent"))
            {
                targetHPPercentDamage = e.GetFloat("target_hp_percent");
            }
        }
Ejemplo n.º 28
0
 public RaceableModelComponentData(UPXElement componentElement) :
     base(componentElement)
 {
     if (componentElement.HasAttribute("h"))
     {
         humanModel = componentElement.GetString("h");
     }
     if (componentElement.HasAttribute("b"))
     {
         borguzandModel = componentElement.GetString("b");
     }
     if (componentElement.HasAttribute("c"))
     {
         criptizidModel = componentElement.GetString("c");
     }
 }
        public NotShipDamagableComponentData(UPXElement e)
        {
            maxHealth = e.GetFloat("max_health");


            ignoreDamageAtStart  = e.GetBool("ignore_damage_at_start");
            ignoreDamageInterval = e.GetFloat("ignore_damage_interval");

            if (e.HasAttribute("create_chest_when_killed"))
            {
                createChestOnKilling = e.GetBool("create_chest_when_killed");
            }
            else
            {
                createChestOnKilling = true;
            }
        }
Ejemplo n.º 30
0
 public ShipWeaponComponentData(UPXElement e)
 {
     if (e.HasAttribute("difficulty"))
     {
         difficulty = (Difficulty)System.Enum.Parse(typeof(Difficulty), e.GetString("difficulty"));
     }
     else
     {
         difficulty = Difficulty.none;
     }
     if (e.HasAttribute("cooldown"))
     {
         cooldown = e.GetFloat("cooldown");
     }
     else
     {
         cooldown = 2;
     }
 }