public static void GetGateEntry(PublicMoongate gate, out PMEntry entry, out PMList list)   // For Old Style Moongates
        {
            int gateCount;
            int gateNum;
            int destNum;

            if (gate.Map == Map.Felucca)
            {
                list = PMList.Felucca;
            }
            else
            {
                list = PMList.Trammel;
            }

            gateCount = list.Entries.Length;
            gateNum   = 0;

            for (int i = 0; i < gateCount; ++i)
            {
                entry = list.Entries[i];
                if (gate.Location == entry.Location)
                {
                    gateNum = i;
                    break;
                }
            }

            destNum = (gateNum + 1) % gateCount;
            entry   = list.Entries[destNum];
        }
Exemple #2
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 0)              // Cancel
            {
                return;
            }
            else if (m_Mobile.Deleted || m_Moongate.Deleted || m_Mobile.Map == null)
            {
                return;
            }

            int[] switches = info.Switches;

            if (switches.Length == 0)
            {
                return;
            }

            int switchID  = switches[0];
            int listIndex = switchID / 100;
            int listEntry = switchID % 100;

            if (listIndex < 0 || listIndex >= m_Lists.Length)
            {
                return;
            }

            PMList list = m_Lists[listIndex];

            if (listEntry < 0 || listEntry >= list.Entries.Length)
            {
                return;
            }

            PMEntry entry = list.Entries[listEntry];

            if (!m_Mobile.InRange(m_Moongate.GetWorldLocation(), 1) || m_Mobile.Map != m_Moongate.Map)
            {
                m_Mobile.SendLocalizedMessage(1019002);                   // You are too far away to use the gate.
            }
            else if (Server.Spells.SpellHelper.CheckCombat(m_Mobile))
            {
                m_Mobile.SendLocalizedMessage(1005564, "", 0x22);                   // Wouldst thou flee during the heat of battle??
            }
            else if (m_Mobile.Map == list.Map && m_Mobile.InRange(entry.Location, 1))
            {
                m_Mobile.SendLocalizedMessage(1019003);                   // You are already there.
            }
            else
            {
                BaseCreature.TeleportPets(m_Mobile, entry.Location, list.Map);

                m_Mobile.Combatant = null;
                m_Mobile.Warmode   = false;
                m_Mobile.Map       = list.Map;
                m_Mobile.Location  = entry.Location;

                Effects.PlaySound(entry.Location, list.Map, 0x1FE);
            }
        }
        public static int IndexOfEntry(PMEntry entry)
        {
            PMList list = null;

            for (var index = 0; index < AllLists.Length; index++)
            {
                var o = AllLists[index];

                bool contains = false;

                for (var i = 0; i < o.Entries.Length; i++)
                {
                    var oEntry = o.Entries[i];

                    if (Equals(oEntry, entry))
                    {
                        contains = true;
                        break;
                    }
                }

                if (contains)
                {
                    list = o;
                    break;
                }
            }

            return(IndexOfEntry(list, entry));
        }
Exemple #4
0
        public static int IndexOfEntry(PMList list, PMEntry entry)
        {
            if (list != null && entry != null)
            {
                return(Array.IndexOf(list.Entries, entry));
            }

            return(-1);
        }
		public static void GetGateEntry(PublicMoongate gate, out PMEntry entry, out PMList list) // For Old Style Moongates
		{
			int hours;
			int minutes;
			int cycle;
			int steps = 0;

			int gateCount;
			int gateNum;
			int destNum;

			if (gate.Map == Map.Felucca)
				list = PMList.Felucca;
			else
				list = PMList.Trammel;

			gateCount = list.Entries.Length;
			gateNum = 0;

			for (int i = 0; i < gateCount; ++i)
			{
				entry = list.Entries[i];
				if (gate.Location == entry.Location)
				{
					gateNum = i;
					break;
				}
			}

			Clock.GetTime(gate.Map, gate.X, gate.Y, out hours, out minutes);

			cycle = (60 * hours + minutes) % 120;
			if (cycle > 7) ++steps;
			if (cycle > 27) ++steps;
			if (cycle > 37) ++steps;
			if (cycle > 57) ++steps;
			if (cycle > 67) ++steps;
			if (cycle > 87) ++steps;
			if (cycle > 97) ++steps;
			if (cycle > 117) steps = 0;

			destNum = (gateNum + steps) % gateCount;
			entry = list.Entries[destNum];


			//{
			//    /* Debugging */            
			//    int generalNum;
			//    string exactTime;
			//    Clock.GetTime(gate.Map, gate.X, gate.Y, out generalNum, out exactTime);
			//    Console.WriteLine("\ngateNum: {0}", gateNum);
			//    Console.WriteLine("steps: {0}", steps);
			//    Console.WriteLine("destNum: {0}", destNum);
			//    Console.WriteLine("destXYZ: {0}, {1}, {2}", entry.Location.X, entry.Location.Y, entry.Location.Z);
			//    Console.WriteLine("Time: " + exactTime);
			//}
		}
        private static int MoonGen(PMList list)
        {
            for (var index = 0; index < list.Entries.Length; index++)
            {
                PMEntry entry = list.Entries[index];

                PublicMoongate o = new PublicMoongate();

                o.MoveToWorld(entry.Location, list.Map);

                if (entry.Number == 1060642) // Umbra
                {
                    o.Hue = 0x497;
                }
            }

            return(list.Entries.Length);
        }
Exemple #7
0
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 0)               // Cancel
            {
                return;
            }
            else if (m_Mobile.Deleted || m_Moongate.Deleted || m_Mobile.Map == null)
            {
                return;
            }

            int[] switches = info.Switches;

            if (switches.Length == 0)
            {
                return;
            }

            int switchID  = switches[0];
            int listIndex = switchID / 100;
            int listEntry = switchID % 100;

            if (listIndex < 0 || listIndex >= m_Lists.Length)
            {
                return;
            }

            PMList list = m_Lists[listIndex];

            if (listEntry < 0 || listEntry >= list.Entries.Length)
            {
                return;
            }

            PMEntry entry = list.Entries[listEntry];

            if (!m_Mobile.InRange(m_Moongate.GetWorldLocation(), 1) || m_Mobile.Map != m_Moongate.Map)
            {
                m_Mobile.SendLocalizedMessage(1019002);                   // You are too far away to use the gate.
            }
            else if (m_Mobile.Player && m_Mobile.Kills >= 5 && list.Map != Map.Felucca)
            {
                m_Mobile.SendLocalizedMessage(1019004);                   // You are not allowed to travel there.
            }
            else if (Factions.Sigil.ExistsOn(m_Mobile) && list.Map != Factions.Faction.Facet)
            {
                m_Mobile.SendLocalizedMessage(1019004);                   // You are not allowed to travel there.
            }
            else if (m_Mobile.Criminal)
            {
                m_Mobile.SendLocalizedMessage(1005561, "", 0x22);                   // Thou'rt a criminal and cannot escape so easily.
            }
            else if (SpellHelper.CheckCombat(m_Mobile))
            {
                m_Mobile.SendLocalizedMessage(1005564, "", 0x22);                   // Wouldst thou flee during the heat of battle??
            }
            else if (m_Mobile.Spell != null)
            {
                m_Mobile.SendLocalizedMessage(1049616);                   // You are too busy to do that at the moment.
            }
            else if (m_Mobile.Map == list.Map && m_Mobile.InRange(entry.Location, 1))
            {
                m_Mobile.SendLocalizedMessage(1019003);                   // You are already there.
            }
            else
            {
                BaseCreature.TeleportPets(m_Mobile, entry.Location, list.Map);

                m_Mobile.Combatant = null;
                m_Mobile.Warmode   = false;
                m_Mobile.Hidden    = true;

                m_Mobile.MoveToWorld(entry.Location, list.Map);

                Effects.PlaySound(entry.Location, list.Map, 0x1FE);
            }
        }
Exemple #8
0
 public PMList(int number, int selNumber, Map map, PMEntry[] entries)
 {
     this.m_Number = number;
     this.m_SelNumber = selNumber;
     this.m_Map = map;
     this.m_Entries = entries;
 }
        public override void OnResponse(NetState state, RelayInfo info)
        {
            if (info.ButtonID == 0)               // Cancel
            {
                return;
            }
            else if (m_Mobile.Deleted || m_Moongate.Deleted || m_Mobile.Map == null)
            {
                return;
            }

            if (info.ButtonID == 2)               //City
            {
                ArrayList a = new ArrayList();

                foreach (Item i in World.Items.Values)
                {
                    if (i is CityManagementStone)
                    {
                        CityManagementStone s = (CityManagementStone)i;

                        if (s.HasMoongate == true && s.IsRegistered == true)
                        {
                            a.Add(i);
                        }
                    }
                }

                if (a.Count == 0)
                {
                    m_Mobile.SendGump(new NoCitiesGump());
                }
                else
                {
                    m_Mobile.SendGump(new PCMoongateGump(m_Moongate, 0, null, null));
                }
            }

            int[] switches = info.Switches;

            if (switches.Length == 0)
            {
                return;
            }

            int switchID  = switches[0];
            int listIndex = switchID / 100;
            int listEntry = switchID % 100;

            if (listIndex < 0 || listIndex >= m_Lists.Length)
            {
                return;
            }

            PMList list = m_Lists[listIndex];

            if (listEntry < 0 || listEntry >= list.Entries.Length)
            {
                return;
            }

            PMEntry entry = list.Entries[listEntry];

            if (!m_Mobile.InRange(m_Moongate.GetWorldLocation(), 1) || m_Mobile.Map != m_Moongate.Map)
            {
                m_Mobile.SendLocalizedMessage(1019002);                   // You are too far away to use the gate.
            }
            else if (m_Mobile.Player && m_Mobile.Kills >= 5 && list.Map != Map.Felucca)
            {
                m_Mobile.SendLocalizedMessage(1019004);                   // You are not allowed to travel there.
            }
            else if (Factions.Sigil.ExistsOn(m_Mobile) && list.Map != Factions.Faction.Facet)
            {
                m_Mobile.SendLocalizedMessage(1019004);                   // You are not allowed to travel there.
            }
            else if (m_Mobile.Criminal)
            {
                m_Mobile.SendLocalizedMessage(1005561, "", 0x22);                   // Thou'rt a criminal and cannot escape so easily.
            }
            else if (Server.Spells.SpellHelper.CheckCombat(m_Mobile))
            {
                m_Mobile.SendLocalizedMessage(1005564, "", 0x22);                   // Wouldst thou flee during the heat of battle??
            }
            else if (m_Mobile.Spell != null)
            {
                m_Mobile.SendLocalizedMessage(1049616);                   // You are too busy to do that at the moment.
            }
            else if (m_Mobile.Map == list.Map && m_Mobile.InRange(entry.Location, 1))
            {
                m_Mobile.SendLocalizedMessage(1019003);                   // You are already there.
            }
            else
            {
                CityManagementStone outgoingCity = null;
                Region currentRegion             = Region.Find(m_Mobile.Location, m_Mobile.Map);

                if (currentRegion != null)
                {
                    if (currentRegion is PlayerCityRegion)
                    {
                        PlayerCityRegion pcr = (PlayerCityRegion)currentRegion;

                        outgoingCity = pcr.Stone;
                    }
                }

                if (outgoingCity != null && outgoingCity.TravelTax >= 1)
                {
                    m_Mobile.SendGump(new PCMoongateToll2Gump(m_Moongate, outgoingCity, entry.Location, list.Map));
                }
                else
                {
                    BaseCreature.TeleportPets(m_Mobile, entry.Location, list.Map);

                    m_Mobile.Combatant = null;
                    m_Mobile.Warmode   = false;
                    m_Mobile.Hidden    = true;

                    m_Mobile.MoveToWorld(entry.Location, list.Map);

                    Effects.PlaySound(entry.Location, list.Map, 0x1FE);
                }
            }
        }
 public PMList( string text, string selText, Map map, PMEntry[] entries ) 
 { 
    m_Text = text; 
    m_SelText = selText; 
    m_Map = map; 
    m_Entries = entries; 
 } 
            public override void OnResponse(NetState state, RelayInfo info)
            {
                if (info.ButtonID == 0) // Cancel
                {
                    return;
                }
                else if (m_Mobile.Deleted || m_Mobile.Map == null)
                {
                    return;
                }

                int[] switches = info.Switches;

                if (switches.Length == 0)
                {
                    return;
                }

                int switchID  = switches[0];
                int listIndex = switchID / 100;
                int listEntry = switchID % 100;

                if (listIndex < 0 || listIndex >= m_Lists.Length)
                {
                    return;
                }

                PMList list = m_Lists[listIndex];

                if (listEntry < 0 || listEntry >= list.Entries.Length)
                {
                    return;
                }

                PMEntry entry = list.Entries[listEntry];

                if (m_Mobile.Player && m_Mobile.Kills >= 5 && list.Map != Map.Trammel)
                {
                    m_Mobile.SendLocalizedMessage(1019004); // You are not allowed to travel there.
                }
                else if (m_Mobile.Criminal)
                {
                    m_Mobile.SendLocalizedMessage(1005561, "", 0x22); // Thou'rt a criminal and cannot escape so easily.
                }
                else if (Server.Spells.SpellHelper.CheckCombat(m_Mobile))
                {
                    m_Mobile.SendLocalizedMessage(1005564, "", 0x22); // Wouldst thou flee during the heat of battle??
                }
                else if (m_Mobile.Spell != null)
                {
                    m_Mobile.SendLocalizedMessage(1049616); // You are too busy to do that at the moment.
                }
                else if (m_Mobile.Map == list.Map && m_Mobile.InRange(entry.Location, 1))
                {
                    m_Mobile.SendLocalizedMessage(1019003); // You are already there.
                }
                else
                {
                    BaseCreature.TeleportPets(m_Mobile, entry.Location, list.Map);

                    m_Mobile.Combatant = null;
                    m_Mobile.Warmode   = false;
                    m_Mobile.Map       = list.Map;
                    m_Mobile.Location  = entry.Location;
                }
            }
Exemple #12
0
        public static int IndexOfEntry(PMEntry entry)
        {
            PMList list = AllLists.FirstOrDefault(o => o.Entries.Contains(entry));

            return(IndexOfEntry(list, entry));
        }
		public PMList( string name, int namehue, int desthue, Map map, PMEntry[] entries )
		{
			m_Map = map;
			m_Entries = entries;
			m_Name = name;
			m_NameHue = namehue;
			m_DestHue = desthue;

		}