protected void CopyDicts(RulesetTemplate copyFrom)
 {
     if (copyFrom.Realm.PropertyCountRandomized.HasValue)
     {
         var count = copyFrom.Realm.PropertyCountRandomized.Value;
         var props = TakeRandomProperties(count, copyFrom);
         foreach (var prop in props)
         {
             if (prop is AppliedRealmProperty <bool> a)
             {
                 PropertiesBool.Add((RealmPropertyBool)a.PropertyKey, new AppliedRealmProperty <bool>(a));
             }
             else if (prop is AppliedRealmProperty <int> b)
             {
                 PropertiesInt.Add((RealmPropertyInt)b.PropertyKey, new AppliedRealmProperty <int>(b));
             }
             else if (prop is AppliedRealmProperty <double> c)
             {
                 PropertiesFloat.Add((RealmPropertyFloat)c.PropertyKey, new AppliedRealmProperty <double>(c));
             }
             else if (prop is AppliedRealmProperty <long> d)
             {
                 PropertiesInt64.Add((RealmPropertyInt64)d.PropertyKey, new AppliedRealmProperty <long>(d));
             }
             else if (prop is AppliedRealmProperty <string> e)
             {
                 PropertiesString.Add((RealmPropertyString)e.PropertyKey, new AppliedRealmProperty <string>(e));
             }
         }
     }
     else
     {
         foreach (var item in copyFrom.PropertiesBool)
         {
             PropertiesBool.Add(item.Key, new AppliedRealmProperty <bool>(item.Value));
         }
         foreach (var item in copyFrom.PropertiesFloat)
         {
             PropertiesFloat.Add(item.Key, new AppliedRealmProperty <double>(item.Value));
         }
         foreach (var item in copyFrom.PropertiesInt)
         {
             PropertiesInt.Add(item.Key, new AppliedRealmProperty <int>(item.Value));
         }
         foreach (var item in copyFrom.PropertiesInt64)
         {
             PropertiesInt64.Add(item.Key, new AppliedRealmProperty <long>(item.Value));
         }
         foreach (var item in copyFrom.PropertiesString)
         {
             PropertiesString.Add(item.Key, new AppliedRealmProperty <string>(item.Value));
         }
     }
 }
        public int GetProperty(RealmPropertyInt property)
        {
            var att = RealmConverter.PropertyDefinitionsInt[property];

            if (PropertiesInt.TryGetValue(property, out var result))
            {
                var val = result.Value;
                val = Math.Max(val, att.MinValue);
                val = Math.Min(val, att.MaxValue);
                return(val);
            }
            return(att.DefaultValue);
        }
Beispiel #3
0
        public Coin(AceObject aceObject)
            : base(aceObject)
        {
            CoinPropertiesInt = PropertiesInt.Where(x => x.PropertyId == (uint)PropertyInt.Value ||
                                                    x.PropertyId == (uint)PropertyInt.EncumbranceVal).ToList();

            StackSize = (base.StackSize ?? 1);

            Value = (Weenie.Value ?? 0) * (StackSize ?? 1);

            if (StackSize == null)
            {
                StackSize = 1;
            }
        }
Beispiel #4
0
        public Coin(AceObject aceObject)
            : base(aceObject)
        {
            Attackable = true;

            SetObjectDescriptionBools();

            CoinPropertiesInt = PropertiesInt.Where(x => x.PropertyId == (uint)PropertyInt.Value ||
                                                    x.PropertyId == (uint)PropertyInt.EncumbranceVal).ToList();

            StackSize = (base.StackSize ?? 1);

            Value = (Weenie.Value ?? 0) * (StackSize ?? 1);

            if (StackSize == null)
            {
                StackSize = 1;
            }
        }
Beispiel #5
0
        public Scroll(AceObject aceObject)
            : base(aceObject)
        {
            Attackable = true;

            SetObjectDescriptionBools();

            var table = DatManager.PortalDat.SpellTable;

            Use  = $"Inscribed spell: {table.Spells[SpellId].Name}\n";
            Use += $"{table.Spells[SpellId].Desc}";

            LongDesc = "Use this item to attempt to learn its spell.";

            Power  = table.Spells[SpellId].Power;
            School = table.Spells[SpellId].School;

            Burden = 30;

            switch (Power)
            {
            case spellLevel1:
                Value = 1;
                break;

            case spellLevel2:
                Value = 5;
                break;

            case spellLevel3:
                Value = 20;
                break;

            case spellLevel4:
                Value = 100;
                break;

            case spellLevel5:
                Value = 200;
                break;

            case spellLevel6:
                Value = 1000;
                break;

            case spellLevel7:
                Value = 2000;
                break;

            case spellLevel8:
                Value = 60000;
                break;
            }

            ScrollPropertiesInt = PropertiesInt.Where(x => x.PropertyId == (uint)PropertyInt.Value ||
                                                      x.PropertyId == (uint)PropertyInt.EncumbranceVal).ToList();

            if (ScrollPropertiesString == null)
            {
                ScrollPropertiesString = new List <AceObjectPropertiesString>();
            }
            if (ScrollPropertiesSpellId == null)
            {
                ScrollPropertiesSpellId = new List <AceObjectPropertiesSpell>();
            }

            var useString = new AceObjectPropertiesString();

            useString.AceObjectId   = Guid.Full;
            useString.PropertyId    = (ushort)PropertyString.Use;
            useString.PropertyValue = Use;
            ScrollPropertiesString.Add(useString);

            var longDescString = new AceObjectPropertiesString();

            longDescString.AceObjectId   = Guid.Full;
            longDescString.PropertyId    = (ushort)PropertyString.LongDesc;
            longDescString.PropertyValue = LongDesc;
            ScrollPropertiesString.Add(longDescString);

            var propSpell = new AceObjectPropertiesSpell();

            propSpell.AceObjectId = Guid.Full;
            propSpell.SpellId     = SpellId;
            ScrollPropertiesSpellId.Add(propSpell);
        }