Пример #1
0
        public void ResetLevel3Spawners(Map map)
        {
            Server.Region r = Server.Region.Find(new Point3D(5574, 1859, 0), map);

            foreach (Item item in r.GetEnumeratedItems().Where(i => i is ISpawner &&
                                                               i.X >= 5501 && i.X <= 5627 && i.Y >= 1799 && i.Y <= 1927))
            {
                if (item is XmlSpawner)
                {
                    ((XmlSpawner)item).DoReset = true;
                }
                else if (item is Spawner)
                {
                    ((Spawner)item).RemoveSpawned();
                    ((Spawner)item).Running = false;
                }
            }
        }
Пример #2
0
        public static void CheckDrop(BaseCreature bc, Container c)
        {
            if (m_IngredientTable != null)
            {
                foreach (IngredientDropEntry entry in m_IngredientTable)
                {
                    if (entry == null)
                    {
                        continue;
                    }

                    if (entry.Region != null)
                    {
                        string reg = entry.Region;

                        if (reg == "TerMur" && c.Map != Map.TerMur)
                        {
                            continue;
                        }
                        else if (reg == "Abyss" && (c.Map != Map.TerMur || c.X < 235 || c.X > 1155 || c.Y < 40 || c.Y > 1040))
                        {
                            continue;
                        }
                        else if (reg != "TerMur" && reg != "Abyss")
                        {
                            Server.Region r = Server.Region.Find(c.Location, c.Map);

                            if (r == null || !r.IsPartOf(entry.Region))
                            {
                                continue;
                            }
                        }
                    }

                    if (bc.GetType() != entry.CreatureType && !bc.GetType().IsSubclassOf(entry.CreatureType))
                    {
                        continue;
                    }

                    double      toBeat = entry.Chance;
                    List <Item> drops  = new List <Item>();

                    if (bc is BaseVoidCreature)
                    {
                        toBeat *= ((BaseVoidCreature)bc).Stage + 1;
                    }

                    if (entry.DropMultiples)
                    {
                        foreach (Type type in entry.Ingredients)
                        {
                            if (toBeat >= Utility.RandomDouble())
                            {
                                Item drop = Loot.Construct(type);

                                if (drop != null)
                                {
                                    drops.Add(drop);
                                }
                            }
                        }
                    }
                    else if (toBeat >= Utility.RandomDouble())
                    {
                        Item drop = Loot.Construct(entry.Ingredients);

                        if (drop != null)
                        {
                            drops.Add(drop);
                        }
                    }

                    foreach (Item item in drops)
                    {
                        c.DropItem(item);
                    }

                    ColUtility.Free(drops);
                }
            }
        }