Esempio n. 1
0
 private void Awake()
 {
     Weapons       = new List <Weapon>();
     Items         = new List <ItemEntity>();
     EquippedItems = new EquipmentSet();
     UpdateInventory();
 }
        public async Task <IActionResult> Edit(int id, [Bind("Id,Name")] EquipmentSet equipmentSet)
        {
            if (id != equipmentSet.Id)
            {
                return(View("Error"));
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(equipmentSet);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!EquipmentSetExists(equipmentSet.Id))
                    {
                        return(View("Error"));
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index"));
            }
            return(View(equipmentSet));
        }
Esempio n. 3
0
 private void Awake()
 {
     EquipmentSet   = new EquipmentSet();
     AbilitySet     = new AbilitySet();
     CharacterSheet = new CharacterSheet();
     Resistances    = new Resistance();
     DamageReceiver = GetComponent <DamageReceiver>();
     Inventory      = new Inventory();
 }
        public async Task <IActionResult> Create([Bind("Id,Name")] EquipmentSet equipmentSet)
        {
            if (ModelState.IsValid)
            {
                _context.Add(equipmentSet);
                await _context.SaveChangesAsync();

                return(RedirectToAction("Index"));
            }
            return(View(equipmentSet));
        }
Esempio n. 5
0
 public static void SendEquipmentSetSaved(IPacketReceiver client, EquipmentSet set)
 {
     if (set == null)
     {
         return;
     }
     using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_EQUIPMENT_SET_SAVED))
     {
         packet.Write(set.Id);
         packet.Write((ulong)set.SetGuid);
         client.Send(packet, false);
     }
 }
Esempio n. 6
0
        public void SetUpEquipment()
        {
            var set        = new EquipmentSet();
            var weaponSlot = new EquipmentSlot()
            {
                CanHold = EquipmentSlotType.Weapon1H,
                Holds   = new TestWeapon(),
                Name    = EquipmentSlotName.Weapon1HRight
            };

            set.Slots.Add(EquipmentSlotName.Weapon1HRight, weaponSlot);

            character.EquipmentSet = set;
        }
Esempio n. 7
0
 /// <summary>
 /// Creates a fightable character from a given lvl
 /// </summary>
 /// <param name="name"> See Character</param>
 /// <param name="description">See Character</param>
 /// <param name="id">See Character</param>
 /// <param name="f">Fighting Class of the character(can't be null)</param>
 /// <param name="l">Level of the character see the Level Class (can't be null)</param>
 /// <param name="s">Stats of the character (can't be null)</param>
 public FightableC(string name, string description, int id, FClass f, Race r, Level l, Stats s) : base(name, description, id)
 {
     if (!f.Equals(null) && !l.Equals(null) && !s.Equals(null) && !r.Equals(null))
     {
         Inventory   = new Inventory();
         Equipment   = new EquipmentSet();
         FClass      = f;
         LVL         = l;
         Stats       = s;
         Race        = r;
         currentHP   = GetMaxHP();
         resistances = new List <TypeDamages>();
         weaknesses  = new List <TypeDamages>();
     }
     else
     {
         throw new System.ArgumentNullException("This fightable character can't be constructed because one of your argument is null");
     }
 }
Esempio n. 8
0
        public void AllModifiersTest()
        {
            var modifiers = new List <IItemModifier>();
            var mockMod   = new Mock <IItemDamageModifier>();

            mockMod.Setup(x => x.DamageType).Returns(DamageType.Chaos);
            mockMod.Setup(x => x.Amount).Returns(.1f);
            modifiers.Add(mockMod.Object);
            var mods = new ItemModifierCollection(Rarity.Magic, modifiers);

            var amulet = new JadeAmulet(Rarity.Magic, mods);

            var target = new EquipmentSet
            {
                Amulet = amulet,
            };

            var mod = target.AllModifiers.First();

            Assert.AreEqual(mockMod.Object, mod);
        }
Esempio n. 9
0
        /// <summary>
        /// Sends SwitchExtraEquipmentR to creature's client.
        /// </summary>
        /// <param name="creature"></param>
        /// <param name="newSet"></param>
        public static void SwitchExtraEquipmentR(Creature creature, EquipmentSet newSet)
        {
            var packet = new Packet(Op.SwitchExtraEquipmentR, creature.EntityId);

            packet.PutByte(true);             // success? false doesn't seem to do anything

            if (newSet != EquipmentSet.Original)
            {
                packet.PutInt((int)newSet);                 // selected slot: 0=tab1, 1=tab2
                packet.PutByte(0);
                packet.PutInt(-1);
            }
            else
            {
                packet.PutInt(0);
                packet.PutByte(1);                 // 1 = back to original?
                packet.PutInt(0);
            }

            creature.Client.Send(packet);
        }
Esempio n. 10
0
        public void VipersSet_HasExpectedValues()
        {
            // Arrange
            var attributes = new List <ItemStatAttribute>
            {
                new ItemStatAttribute("Power", .3m),
                new ItemStatAttribute("ConditionDamage", .3m),
                new ItemStatAttribute("Precision", .165m),
                new ItemStatAttribute("Expertise", .165m)
            };

            // Act
            var equipmentSet = new EquipmentSet
            {
                HeadSlot       = new HeadArmor(attributes),
                ShoulderSlot   = new ShoulderArmor(attributes),
                ChestSlot      = new ChestArmor(attributes),
                HandSlot       = new HandArmor(attributes),
                LegSlot        = new LegArmor(attributes),
                FeetSlot       = new FeetArmor(attributes),
                BackSlot       = new BackItem(attributes),
                AccessorySlot1 = new Accessory(attributes),
                AccessorySlot2 = new Accessory(attributes),
                AmuletSlot     = new Amulet(attributes),
                RingSlot1      = new Ring(attributes),
                RingSlot2      = new Ring(attributes)
            };

            // Assert
            const int expectedPower           = 957;
            const int expectedConditionDamage = 957;
            const int expectedPrecision       = 515;
            const int expectedExpertise       = 515;

            Assert.AreEqual(expectedPower, equipmentSet.Power);
            Assert.AreEqual(expectedConditionDamage, equipmentSet.ConditionDamage);
            Assert.AreEqual(expectedPrecision, equipmentSet.Precision);
            Assert.AreEqual(expectedExpertise, equipmentSet.Expertise);
        }
Esempio n. 11
0
        public void BerserkersSet_HasExpectedValues()
        {
            // Arrange
            var attributes = new List <ItemStatAttribute>
            {
                new ItemStatAttribute("Power", .35m),
                new ItemStatAttribute("Precision", .25m),
                new ItemStatAttribute("Ferocity", .25m)
            };

            // Act
            var equipmentSet = new EquipmentSet
            {
                HeadSlot       = new HeadArmor(attributes),
                ShoulderSlot   = new ShoulderArmor(attributes),
                ChestSlot      = new ChestArmor(attributes),
                HandSlot       = new HandArmor(attributes),
                LegSlot        = new LegArmor(attributes),
                FeetSlot       = new FeetArmor(attributes),
                BackSlot       = new BackItem(attributes),
                AccessorySlot1 = new Accessory(attributes),
                AccessorySlot2 = new Accessory(attributes),
                AmuletSlot     = new Amulet(attributes),
                RingSlot1      = new Ring(attributes),
                RingSlot2      = new Ring(attributes)
            };

            // Assert
            const int expectedPower     = 1131;
            const int expectedPrecision = 781;
            const int expectedFerocity  = 781;

            Assert.AreEqual(expectedPower, equipmentSet.Power);
            Assert.AreEqual(expectedPrecision, equipmentSet.Precision);
            Assert.AreEqual(expectedFerocity, equipmentSet.Ferocity);
        }
Esempio n. 12
0
        public static void SendEquipmentSetSaved(IPacketReceiver client, EquipmentSet set)
        {
            if (set == null) return;

            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_EQUIPMENT_SET_SAVED))
            {
                packet.Write(set.Id);
                packet.Write(set.SetGuid);

                client.Send(packet);
            }
        }
Esempio n. 13
0
        public static PropertiesEnchantmentRegistry GetEnchantmentBySpellSet(this ICollection <PropertiesEnchantmentRegistry> value, int spellId, EquipmentSet spellSetId, ReaderWriterLockSlim rwLock)
        {
            if (value == null)
            {
                return(null);
            }

            rwLock.EnterReadLock();
            try
            {
                return(value.FirstOrDefault(e => e.SpellId == spellId && e.SpellSetId == spellSetId));
            }
            finally
            {
                rwLock.ExitReadLock();
            }
        }
Esempio n. 14
0
 public Player(ClientProcess process)
 {
     this.process = process;
       accessor = new ProcessMemoryAccessor(process.ProcessId, ProcessAccess.Read);
       inventory = new Inventory(this);
       equipment = new EquipmentSet(this);
       skillbook = new Skillbook(this);
       spellbook = new Spellbook(this);
       stats = new PlayerStats(this);
       modifiers = new PlayerModifiers(this);
       location = new MapLocation(this);
       gameClient = new ClientState(this);
 }