Exemplo n.º 1
0
        public ObjectDesc(XElement e, string id, ushort type)
        {
            Id   = id;
            Type = type;

            DisplayId = e.ParseString("DisplayId", Id);

            Static        = e.ParseBool("Static");
            CaveWall      = e.ParseString("Class") == "CaveWall";
            ConnectedWall = e.ParseString("Class") == "ConnectedWall";
            BlocksSight   = e.ParseBool("BlocksSight");

            OccupySquare      = e.ParseBool("OccupySquare");
            FullOccupy        = e.ParseBool("FullOccupy");
            EnemyOccupySquare = e.ParseBool("EnemyOccupySquare");

            ProtectFromGroundDamage = e.ParseBool("ProtectFromGroundDamage");
            ProtectFromSink         = e.ParseBool("ProtectFromSink");

            Enemy  = e.ParseBool("Enemy");
            Player = e.ParseBool("Player");

            God    = e.ParseBool("God");
            Cube   = e.ParseBool("Cube");
            Quest  = e.ParseBool("Quest");
            Hero   = e.ParseBool("Hero");
            Level  = e.ParseInt("Level", -1);
            Oryx   = e.ParseBool("Oryx");
            XpMult = e.ParseFloat("XpMult", 1);

            Size    = e.ParseInt("Size", 100);
            MinSize = e.ParseInt("MinSize", Size);
            MaxSize = e.ParseInt("MaxSize", Size);

            MaxHP   = e.ParseInt("MaxHitPoints");
            Defense = e.ParseInt("Defense");

            Projectiles = new Dictionary <int, ProjectileDesc>();
            foreach (XElement k in e.Elements("Projectile"))
            {
                ProjectileDesc desc = new ProjectileDesc(k, Type);
#if DEBUG
                if (Projectiles.ContainsKey(desc.BulletType))
                {
                    throw new Exception("Duplicate bullet type");
                }
#endif
                Projectiles[desc.BulletType] = desc;
            }
        }
Exemplo n.º 2
0
        public ItemDesc(XElement e, string id, ushort type)
        {
            Id   = id;
            Type = type;

            SlotType       = e.ParseInt("SlotType");
            Tier           = e.ParseInt("Tier", -1);
            Description    = e.ParseString("Description");
            RateOfFire     = e.ParseFloat("RateOfFire", 1);
            Usable         = e.ParseBool("Usable");
            BagType        = e.ParseInt("BagType");
            MpCost         = e.ParseInt("MpCost");
            FameBonus      = e.ParseInt("FameBonus");
            NumProjectiles = e.ParseInt("NumProjectiles", 1);
            ArcGap         = e.ParseFloat("ArcGap", 11.25f);
            Consumable     = e.ParseBool("Consumable");
            Potion         = e.ParseBool("Potion");
            DisplayId      = e.ParseString("DisplayId", Id);
            Doses          = e.ParseInt("Doses");
            SuccessorId    = e.ParseString("SuccessorId", null);
            Soulbound      = e.ParseBool("Soulbound");
            CooldownMS     = (int)(e.ParseFloat("Cooldown", .2f) * 1000);
            Resurrects     = e.ParseBool("Resurrects");
            Tex1           = (int)e.ParseUInt("Tex1", 0);
            Tex2           = (int)e.ParseUInt("Tex2", 0);

            List <KeyValuePair <int, int> > stats = new List <KeyValuePair <int, int> >();

            foreach (XElement s in e.Elements("ActivateOnEquip"))
            {
                stats.Add(new KeyValuePair <int, int>(
                              s.ParseInt("@stat"),
                              s.ParseInt("@amount")));
            }
            StatBoosts = stats.ToArray();

            List <ActivateEffectDesc> activate = new List <ActivateEffectDesc>();

            foreach (XElement i in e.Elements("Activate"))
            {
                activate.Add(new ActivateEffectDesc(i));
            }
            ActivateEffects = activate.ToArray();

            if (e.Element("Projectile") != null)
            {
                Projectile = new ProjectileDesc(e.Element("Projectile"), Type);
            }
        }