Exemplo n.º 1
0
        public static void Initialize()
        {
            if (SiegeShard)
            {
                CommandSystem.Register("ResetROT", AccessLevel.GameMaster, e =>
                {
                    LastReset = DateTime.Now;

                    e.Mobile.SendMessage("Rate over Time reset!");
                });

                CommandSystem.Register("GetROTInfo", AccessLevel.GameMaster, e =>
                {
                    Mobile m = e.Mobile;

                    foreach (KeyValuePair <PlayerMobile, Dictionary <SkillName, DateTime> > kvp in ROTTable)
                    {
                        Console.WriteLine("Player: {0}", kvp.Key.Name);
                        int stats = 0;

                        if (StatsTable.ContainsKey(kvp.Key))
                        {
                            stats = StatsTable[kvp.Key];
                        }

                        Console.WriteLine("Stats gained today: {0} of {1}", stats, StatsPerDay.ToString());

                        Utility.PushColor(ConsoleColor.Magenta);
                        foreach (KeyValuePair <SkillName, DateTime> kvp2 in kvp.Value)
                        {
                            int pergain   = MinutesPerGain(kvp.Key, kvp.Key.Skills[kvp2.Key]);
                            DateTime last = kvp2.Value;
                            DateTime next = last + TimeSpan.FromMinutes(pergain);

                            string nextg = next < DateTime.Now ? "now" : "in " + ((int)(next - DateTime.Now).TotalMinutes).ToString() + " minutes";

                            Console.WriteLine("   {0}: last gained {1}, can gain {2} (every {3} minutes)", kvp2.Key.ToString(), last.ToShortTimeString(), nextg, pergain.ToString());
                        }
                        Utility.PopColor();
                    }

                    Console.WriteLine("---");
                    Console.WriteLine("Next Reset: {0} minutes", ((LastReset + TimeSpan.FromHours(24) - DateTime.Now)).TotalMinutes.ToString());
                });

                Utility.PushColor(ConsoleColor.Red);
                Console.Write("Initializing Siege Perilous Shard...");

                long tick = Core.TickCount;

                List <XmlSpawner> toReset = new List <XmlSpawner>();

                foreach (var item in World.Items.Values.OfType <XmlSpawner>().Where(sp => sp.Map == Map.Trammel && sp.Running))
                {
                    toReset.Add(item);
                }

                foreach (var item in toReset)
                {
                    item.DoReset = true;
                }

                Console.WriteLine("Reset {1} trammel spawners in {0} milliseconds!", Core.TickCount - tick, toReset.Count);
                Utility.PopColor();

                ColUtility.Free(toReset);
            }
        }