Advertisement
Guest User

Untitled

a guest
Sep 24th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 4.87 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using DOL.Events;
  6. using System.Timers;
  7.  
  8.  
  9. namespace DOL.GS.GameEvents
  10. {
  11.    public class ShatteredRotation
  12.     {
  13.       public static List<Location> Locations = new List<Location>();
  14.       private static readonly short m_interval = 65;
  15.       private static Timer m_timer = null;
  16.       private static Timer m_tempTimer = null;
  17.       private static int m_minutes = 0;
  18.       private static bool temp_ticked = false;
  19.  
  20.         [ScriptLoadedEvent]
  21.         public static void OnScriptCompiled(DOLEvent e, object sender, EventArgs args)
  22.         {
  23.             Init();
  24.         }
  25.         [ScriptUnloadedEvent]
  26.         public static void OnScriptUnloaded(DOLEvent e, object sender, EventArgs args)
  27.         {
  28.        
  29.         }
  30.  
  31.         private static void Init()
  32.         {
  33.             PopulateList();
  34.             StartTimer();
  35.         }
  36.         private static void StartTimer()
  37.         {
  38.             int Interval = TimeSpan.FromMinutes(1).Milliseconds;
  39.             m_timer = new Timer(Interval);
  40.             m_timer.Start();
  41.             m_timer.Elapsed += new ElapsedEventHandler(m_timer_Elapsed);
  42.         }
  43.  
  44.         static void m_timer_Elapsed(object sender, ElapsedEventArgs e)
  45.         {
  46.             if (m_minutes == 60) //5min warning
  47.             {
  48.                
  49.             }
  50.             else if (m_minutes == 64)
  51.             {
  52.                 m_tempTimer = new Timer(TimeSpan.FromSeconds(29).Milliseconds);
  53.                 m_tempTimer.Elapsed += new ElapsedEventHandler(m_tempTimer_Elapsed);
  54.             }
  55.             else if (m_minutes == 65)
  56.             {
  57.             //do teleport
  58.             }
  59.             m_minutes = m_minutes + 1 == 66 ? m_minutes = 0 : m_minutes + 1;
  60.         }
  61.  
  62.         static void m_tempTimer_Elapsed(object sender, ElapsedEventArgs e)
  63.         {
  64.             //Jumping to new zone or skipping
  65.             if (!temp_ticked)
  66.             {
  67.                 temp_ticked = true;
  68.                 //warn 30 secs left
  69.             }
  70.             else
  71.             {
  72.                 m_tempTimer.Stop();
  73.                 //alert zone change
  74.             }
  75.         }
  76.         private static void TeleportPlayers()
  77.         {
  78.        
  79.         }
  80.         private static void PopulateList()
  81.         {
  82.             Location TirNaNog = new Location("Tir Na Nog", 19144, 34186, 6334, 3131, 201);
  83.             Location QueensLab = new Location("Queens Labyrinth", 34755, 22389, 20459, 4034, 94);
  84.             Location HesperosHaven = new Location("",283724, 579165, 8285, 1034, 73);
  85.             Location SummonersHall = new Location("", 25909, 33010, 16064, 3080, 233);
  86.             Location GothwaiteHarbor = new Location("", 515507, 515929, 3424, 3603, 51);
  87.             Location Crater = new Location("", 364801, 324954, 6536, 2261, 151);
  88.             Location MeteorImpact = new Location("", 394252, 208253, 4552, 4095, 181);
  89.             Location Halheim = new Location("", 223348, 251174, 5131, 3077, 27);
  90.             Location Aegir = new Location("", 258222, 359018, 3752, 3054, 151);
  91.             Location Cotswold = new Location("", 583955, 486656, 2184, 6, 1);
  92.             Location MagMell = new Location("", 342187, 592109, 5456, 3396, 200);
  93.             Location Mularn = new Location("", 774606, 54713, 4600, 9, 100);
  94.             Locations.Add(TirNaNog);
  95.             Locations.Add(QueensLab);
  96.             Locations.Add(HesperosHaven);
  97.             Locations.Add(SummonersHall);
  98.             Locations.Add(GothwaiteHarbor);
  99.             Locations.Add(Crater);
  100.             Locations.Add(MeteorImpact);
  101.             Locations.Add(Halheim);
  102.             Locations.Add(Aegir);
  103.             Locations.Add(Cotswold);
  104.             Locations.Add(MagMell);
  105.             Locations.Add(Mularn);
  106.  
  107.         }
  108.     }
  109.    private class Location
  110.    {
  111.        string m_name;
  112.        int m_x;
  113.        int m_y;
  114.        int m_z;
  115.        ushort m_heading;
  116.        ushort m_region;
  117.       public Location(string zoneName, int x, int y, int z, ushort heading, ushort region)
  118.        {
  119.            m_name = zoneName;
  120.            X = x;
  121.            Y = y;
  122.            Z = z;
  123.            Heading = heading;
  124.            Region = region;
  125.        }
  126.       public string Name
  127.       {
  128.           get { return m_name; }
  129.           set { m_name = value; }
  130.       }
  131.        public int X
  132.        {
  133.            get { return m_x; }
  134.            set { m_x = value; }
  135.        }
  136.        public int Y
  137.        {
  138.            get { return m_y; }
  139.            set { m_y = value; }
  140.        }
  141.        public int Z
  142.        {
  143.            get { return m_z; }
  144.            set { m_z = value; }
  145.        }
  146.        public ushort Heading
  147.        {
  148.            get { return m_heading; }
  149.            set { m_heading = value; }
  150.        }
  151.        public ushort Region
  152.        {
  153.            get { return m_region; }
  154.            set { m_region = value; }
  155.        }
  156.  
  157.    }
  158. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement