Beispiel #1
0
        public static void Suck()
        {
            foreach (var entity in Entities)
            {
                var amount    = 0;
                var GoldDrops = new List <FloorItem>();
                foreach (var item in ScreenSystem.GetEntities(entity.Value))
                {
                    if (item is FloorItem)
                    {
                        var floorItem = item as FloorItem;

                        if (floorItem.Amount > 0)
                        {
                            GoldDrops.Add(floorItem);
                        }
                    }
                }
                foreach (var floorItem in GoldDrops)
                {
                    amount += floorItem.Amount;
                    floorItem.Jobs.Clear();
                    floorItem.Destroy();
                }
                FloorItemSystem.DropMoney(entity.Value, entity.Value, amount);
            }
        }
Beispiel #2
0
        public static void Drop(YiObj attacker, Monster mob)
        {
            var rand = SafeRandom.Next(1, 1000);

            Item created = default(Item);

            switch (mob.Id)
            {
            case 3131:
            case 3135:
                created = ItemFactory.Create(ItemNames.ExpPotion); break;    //exp potion from titan and gano

            default:
            {
                if (!GenerateDrop(attacker, mob, rand, ref created))        //YOU FORGOT TO ADD THE ! SO NOTHING WAS DROPPING
                {
                    return;
                }
                break;
            }
            }

            if (created.Valid())
            {
                FloorItemSystem.Drop(attacker, mob, created);
            }

            if (YiCore.Success(5)) //5% chance to drop more than one item.
            {
                Drop(attacker, mob);
            }
        }
Beispiel #3
0
        private static bool GenerateDrop(YiObj attacker, Monster mob, int rand, ref Item created)
        {
            if (YiCore.Success(50) && Drops.TryGetValue(mob.UniqueId, out var dropList))
            {
                foreach (var item in dropList.Items)
                {
                    if (attacker.Level < item.ReqLevel)
                    {
                        continue;
                    }

                    switch (WeatherSystem.CurrentWeatherType)
                    {
                    case WeatherType.Rain:
                    {
                        if (!YiCore.Success(item.RainChance))
                        {
                            break;
                        }

                        created = ItemFactory.Create(item.ItemId);
                        return(true);
                    }

                    case WeatherType.Snow:
                    {
                        if (!YiCore.Success(item.SnowChance))
                        {
                            break;
                        }

                        created = ItemFactory.Create(item.ItemId);
                        return(true);
                    }
                    }

                    if (DayNightSystem.IsDay() && YiCore.Success(item.DayChance))
                    {
                        created = ItemFactory.Create(item.ItemId);
                        return(true);
                    }
                    if (DayNightSystem.IsNight() && YiCore.Success(item.NightChance))
                    {
                        created = ItemFactory.Create(item.ItemId);
                        return(true);
                    }
                }
            }

            if (rand < 200)
            {
                FloorItemSystem.DropMoney(attacker, mob, mob.Drops.Money + mob.Level * SafeRandom.Next(1, 10));
            }
            else if (rand < 250)
            {
                created = ItemFactory.Create(mob.Drops.Hp); //HP POTS
            }
            else if (rand < 300)
            {
                created = ItemFactory.Create(mob.Drops.Mp); //MP POTS
            }
            else if (rand < 550)                            //REGULAR ITEMS
            {
                created = ItemFactory.Create(GenerateItemId(mob));

                if (!created.Valid())
                {
                    return(false);
                }

                var plus  = GeneratePurity(mob.Level);
                var bless = GenerateBless();

                if (plus == 0)
                {
                    created.Bless = bless;
                }
                if (bless == 0)
                {
                    created.Plus = plus;
                }

                var sockets = GenerateSocketCount(created.ItemId, mob.Level);

                if (sockets != 0)
                {
                    Output.WriteLine($"Dropped {sockets} item.");
                }

                switch (sockets)
                {
                case 1:
                    created.Gem1 = 255;
                    break;

                case 2:
                    created.Gem1 = 255;
                    created.Gem2 = 255;
                    break;
                }
            }
            return(created.Valid());
        }