private void OnDeferredLoot(CreatureDeathEventArgs e)
        {
            if (e.Corpse == null || e.Corpse.Deleted || e.ClearCorpse || e.Corpse.Items.IsNullOrEmpty())
            {
                return;
            }

            var dead = e.Creature as BaseCreature;

            if (dead == null)
            {
                return;
            }

            var decay = LootTimeout;

            e.Corpse.Items.ForEachReverse(
                i =>
            {
                if (i != null && !i.Deleted && !Loot.Exists(o => o.Item == i) && ShouldRoll(dead, i))
                {
                    Loot.Add(new DungeonLootEntry(this, i, decay, ActiveGroup));
                }
            });
        }
Example #2
0
        public void GenerateLoot(int roomNum)
        {
            int    i, chance;
            Random rnd = new Random();

            for (i = 0; i < Loot.Capacity; i++)
            {
                chance = rnd.Next(0, 100);
                if (chance >= 45 && chance <= 45 + roomNum && roomNum > 6)//1+roomNum% chance of purple rareness. generates from room 7
                {
                    Loot.Add(MainGame.GetRandomItem("purple"));
                }
                else if (chance > 24 - roomNum / 4 && chance < 29 + roomNum / 2 && roomNum > 4)//4+roomNum% chance of blue rareness. generates from room 5
                {
                    Loot.Add(MainGame.GetRandomItem("blue"));
                }
                else if (chance < 97 && chance < 66)//30% chance of green rareness.
                {
                    Loot.Add(MainGame.GetRandomItem("green"));
                }
                else//others white
                {
                    Loot.Add(MainGame.GetRandomItem("white"));
                }
            }
        }//loot generation
Example #3
0
        /* --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- */

        protected override void generateLoot()
        {
            base.generateLoot();
            var range = 100f;

            if (Rank == RankOfPersonage.Normal)
            {
                range = UnityEngine.Random.Range(0f, 100f);
            }
            if (80f > range)
            {
                return;
            }
            var money = UnityEngine.Random.Range(1, 8);

            if (Rank != RankOfPersonage.Normal)
            {
                money = (( int )Rank) * 10 + money * 10;
                if (Rank == RankOfPersonage.Boss)
                {
                    money += 2500;
                }
            }
            Loot.Add(Generator.CreateMoney(money));
        }
 public GoblinEnemy(string name, int level, Map map, GameItem specialLoot, bool roam = true) : base(name, 4, 10, "Goblin", 'g', ConsoleColor.Red, level, 0, 5, 0, 0, map, roam)
 {
     StandardMove1 = GameData.AllCombatMoves[1];
     StandardMove2 = null;
     PowerMove1    = GameData.AllCombatMoves[0];
     SupportMove1  = null;
     LevelScaler(level);
     Loot.Add(specialLoot);
 }
 public override void ParseFromNetworkMessage(NetworkMessage message)
 {
     CreatureName   = message.ReadString();
     CreatureOutfit = message.ReadCreatureOutfit();
     Loot.Capacity  = message.ReadByte();
     for (var i = 0; i < Loot.Capacity; ++i)
     {
         Loot.Add(message.ReadObjectInstance());
     }
 }
Example #6
0
        // Do damage to enemy unit
        public void DamageEnemy(int dmg)
        {
            this.health -= dmg;
            if (this.health <= 0)
            {
                // Drop loot
                GameObject newLoot = Instantiate(this.loot, this.transform.position, Quaternion.identity);
                allLoot.Add(newLoot);
                OnLootDropedEvent.Raise(newLoot);

                // Destroy enemy
                Destroy(gameObject);
            }
        }
Example #7
0
        public override void Read()
        {
            uint Count = _worldPacket.ReadUInt32();

            Target = _worldPacket.ReadPackedGuid();

            for (uint i = 0; i < Count; ++i)
            {
                LootRequest lootRequest = new LootRequest();
                lootRequest.Object     = _worldPacket.ReadPackedGuid();
                lootRequest.LootListID = _worldPacket.ReadUInt8();
                Loot.Add(lootRequest);
            }
        }
Example #8
0
        public override void Read()
        {
            uint Count = _worldPacket.ReadUInt32();

            for (uint i = 0; i < Count; ++i)
            {
                var loot = new LootRequest()
                {
                    Object     = _worldPacket.ReadPackedGuid(),
                    LootListID = _worldPacket.ReadUInt8()
                };

                Loot.Add(loot);
            }
        }
Example #9
0
        /* --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- --- */

        public Player(string name, int level, int modelId, Vector3 position) : base(level, RankOfPersonage.Normal, modelId, position, -1)
        {
            Name = name;
            if (Current != null)
            {
                throw new System.Exception("Гравець може бути тільки один!");
            }
            gameObject.tag = TAG;
            GameObject.DontDestroyOnLoad(gameObject);
            Current         = this;
            totalExperience = calculateMaxExperience();

            //
            Loot.Add(new Items.TrashItem(1, 0, Sprites.ITEM_GOLD, 1));
            Loot.Add(new Items.ReagentItem(2, 0, Sprites.ITEM_GOLD, 1));
            Loot.Add(new Items.QuestItem(3, 0, Sprites.ITEM_GOLD, 1));
            Loot.Add(new Items.OtherItem(4, 0, Sprites.ITEM_GOLD, 1, -1));
            Loot.Add(new Items.AccessoryEquipment(5, 0, 100, Sprites.ITEM_GOLD, Items.TypeOfItemRarity.Junk, 0, 1));
            Loot.Add(new Items.NeckEquipment(6, 0, 100, Sprites.ITEM_GOLD, Items.TypeOfItemRarity.Normal, 0, 1));
            Loot.Add(new Items.RingEquipment(7, 0, 100, Sprites.ITEM_GOLD, Items.TypeOfItemRarity.Unusual, 0, 1));
            Loot.Add(new Items.BeltEquipment(8, 0, 100, Sprites.ITEM_GOLD, Items.TypeOfItemRarity.Rare, 0, Items.MaterialOfEquipment.Cloth, 1));
            Loot.Add(new Items.FeetEquipment(9, 0, 100, Sprites.ITEM_GOLD, Items.TypeOfItemRarity.Epic, 0, Items.MaterialOfEquipment.Hauberk, 1));
            Loot.Add(new Items.FootwearEquipment(10, 0, 100, Sprites.ITEM_GOLD, Items.TypeOfItemRarity.Legendary, 0, Items.MaterialOfEquipment.Leather, 1));
            Loot.Add(new Items.HandsEquipment(11, 0, 100, Sprites.ITEM_GOLD, Items.TypeOfItemRarity.Junk, 0, Items.MaterialOfEquipment.PlateArmour, 1));
            Loot.Add(new Items.HeadEquipment(12, 0, 100, Sprites.ITEM_GOLD, Items.TypeOfItemRarity.Normal, 0, Items.MaterialOfEquipment.Cloth, 1));
            Loot.Add(new Items.ShouldersEquipment(13, 0, 100, Sprites.ITEM_GOLD, Items.TypeOfItemRarity.Unusual, 0, Items.MaterialOfEquipment.Hauberk, 1));
            Loot.Add(new Items.TorsoEquipment(14, 0, 100, Sprites.ITEM_GOLD, Items.TypeOfItemRarity.Rare, 0, Items.MaterialOfEquipment.Leather, 1));
            Loot.Add(new Items.ShieldSpine(15, 0, 100, Sprites.ITEM_GOLD, Items.TypeOfItemRarity.Epic, 0, 1));
            Loot.Add(new Items.CloakSpine(16, 0, 100, Sprites.ITEM_GOLD, Items.TypeOfItemRarity.Legendary, 0, 1));
            Loot.Add(new Items.AxWeapon(17, 0, 100, Sprites.ITEM_GOLD, Items.TypeOfItemRarity.Junk, 0, 1));
            Loot.Add(new Items.BowWeapon(18, 0, 100, Sprites.ITEM_GOLD, Items.TypeOfItemRarity.Normal, 0, 1));
            Loot.Add(new Items.BrassKnucklesWeapon(19, 0, 100, Sprites.ITEM_GOLD, Items.TypeOfItemRarity.Unusual, 0, 1));
            Loot.Add(new Items.DaggerWeapon(20, 0, 100, Sprites.ITEM_GOLD, Items.TypeOfItemRarity.Rare, 0, 10));
            Loot.Add(new Items.HammerWeapon(21, 0, 100, Sprites.ITEM_GOLD, Items.TypeOfItemRarity.Epic, 0, 1));
            Loot.Add(new Items.StaffWeapon(22, 0, 100, Sprites.ITEM_GOLD, Items.TypeOfItemRarity.Legendary, 0, 1));
            Loot.Add(new Items.SwordWeapon(23, 0, 100, Sprites.ITEM_GOLD, Items.TypeOfItemRarity.Junk, 0, 1));
            Loot.Add(new Items.WandWeapon(24, 0, 100, Sprites.ITEM_GOLD, Items.TypeOfItemRarity.Normal, 0, 1));

            Equipments.Set(Loot[20]);
            Equipments.Set(Loot[16]);
            Equipments.Set(Loot[7]);
            Equipments.Set(Loot[10]);

            //
        }
Example #10
0
 public void StoreItem(Item item)
 {
     Loot.Add(item);
 }
Example #11
0
 // add item to room and add item to room's loot bag
 private void AddItemToRoom(Item item)
 {
     Loot.Add(item);
     item.RoomOccupied = this;
 }