Example #1
0
		public WaypointFigurine(MapEditor editor, NPCSpawnPoint spawnPoint, WaypointEntry wp)
			: base(editor, spawnPoint)
		{	
			m_Waypoint = wp;

			//GossipMenu = m_SpawnPoint.GossipMenu;
			NPCFlags = NPCFlags.Gossip;
		}
Example #2
0
		/// <summary>
		/// Returns the GossipMenuItem of the given Waypoint from this menu
		/// </summary>
		/// <param name="wp"></param>
		public void RemoveWPItem(WaypointEntry wp)
		{
			foreach (var item in WPMenu.GossipItems)
			{
				if (item is WPItem && ((WPItem)item).Wp == wp)
				{
					WPMenu.GossipItems.Remove(item);
					return;
				}
			}
		}
Example #3
0
		/// <summary>
		/// Adds a new WP after the given oldWp or at the end if its new with 
		/// the given position and orientation.
		/// </summary>
		/// <param name="oldWp">May be null</param>
		internal WaypointEntry InsertAfter(WaypointEntry oldWp, Vector3 pos, float orientation)
		{
			var newWp = m_spawnEntry.CreateWP(pos, orientation);

			LinkedListNode<WaypointEntry> newNode;
			LinkedListNode<WaypointFigurine> oldFigNode;
			if (oldWp != null)
			{
				oldFigNode = GetWPFigurineNode(oldWp);
				var oldNode = oldWp.Node;
				var fig = oldNode.Value;
				newNode = oldNode.List.AddAfter(oldNode, newWp);
			}
			else
			{
				newNode = m_spawnEntry.Waypoints.AddLast(newWp);
				oldFigNode = null;
			}
			newWp.Node = newNode;

			var newFig = InsertFigurine(oldFigNode, newWp);
			newFig.Highlight();
			return newWp;
		}
Example #4
0
		/// <summary>
		/// Moves the WP to the given new Position
		/// </summary>
		/// <param name="wp"></param>
		internal void MoveWP(WaypointEntry wp, Vector3 pos)
		{
			wp.Position = pos;

			var node = GetWPFigurineNode(wp);
			if (node != null)
			{
				var fig = node.Value;

				// update orientations
				var next = node.Next;
				if (next != null)
				{
					fig.SetOrientationTowards(next.Value);
				}
				if (node.Previous != null)
				{
					node.Previous.Value.SetOrientationTowards(fig);
				}

				// move over
				MovementHandler.SendMoveToPacket(fig, ref pos, fig.Orientation, 1000, MonsterMoveFlags.DefaultMask);
				fig.TeleportTo(ref pos);
			}
		}
Example #5
0
		/// <summary>
		/// Removes the given WP from this SpawnPoint's SpawnEntry
		/// </summary>
		/// <param name="wp"></param>
		internal void RemoveWP(WaypointEntry wp)
		{
			// remove from List
			m_spawnEntry.Waypoints.Remove(wp);

			if (m_GossipMenu != null)
			{
				// remove item from Gossip menu
				m_GossipMenu.RemoveWPItem(wp);
			}

			// figure out the figurines
			var figNode = GetWPFigurineNode(wp);
			if (figNode != null)
			{
				// delete
				figNode.Value.Delete();

				// update orientation
				var prev = figNode.Previous;
				figNode.List.Remove(figNode);
				if (prev != null)
				{
					var next = prev.Next;
					if (next != null)
					{
						prev.Value.Face(next.Value);
						prev.Value.ChannelObject = next.Value;
					}
					else
					{
						prev.Value.ChannelObject = null;
					}
				}
			}
		}
Example #6
0
		WaypointFigurine InsertFigurine(LinkedListNode<WaypointFigurine> last, WaypointEntry wp)
		{
			Figurine lastFig;
			Figurine nextFig;
			var newFig = new WaypointFigurine(this, wp);
			if (last == null)
			{
				// first WP
				lastFig = m_figurine;
				nextFig = m_wpFigurines.First.Value;
			}
			else
			{
				lastFig = last.Value;
				nextFig = last.Next.Value;
			}

			if (lastFig != null)
			{
				lastFig.SetOrientationTowards(newFig);
				lastFig.ChannelObject = newFig;
				lastFig.ChannelSpell = ConnectingSpell;
			}
			if (nextFig != null)
			{
				newFig.SetOrientationTowards(nextFig);
				newFig.ChannelObject = nextFig;
				newFig.ChannelSpell = ConnectingSpell;
			}

			m_wpFigurines.AddLast(newFig);
			Region.AddObjectLater(newFig);
			return newFig;
		}
Example #7
0
		public LinkedListNode<WaypointFigurine> GetWPFigurineNode(WaypointEntry entry)
		{
			if (m_wpFigurines == null)
			{
				return null;
			}
			var node = m_wpFigurines.First;
			while (node != null)
			{
				if (node.Value.Waypoint == entry)
				{
					return node;
				}
				node = node.Next;
			}
			return node;
		}
Example #8
0
		public WaypointFigurine GetWPFigurine(WaypointEntry entry)
		{
			if (m_wpFigurines == null)
			{
				return null;
			}
			foreach (var fig in m_wpFigurines)
			{
				if (fig.Waypoint == entry)
				{
					return fig;
				}
			}
			return null;
		}
Example #9
0
		public void GoToWaypoint(WaypointEntry waypointEntry)
		{
			m_owner.Movement.MoveTo(waypointEntry.Position, false);
		}
Example #10
0
			public WPItem(SpawnPoint point, WaypointEntry wp)
			{
				m_Point = point;
				m_wp = wp;
				Text = "WP #" + wp.Id;

				SubMenu = new GossipMenu(point.SpawnEntry.Entry.NameGossipId);
				SubMenu.AddGoBackItem();
				SubMenu.AddRange(
					new GossipMenuItem("Go to " + Text, HandleGoto),
					new GossipMenuItem("Remove", HandleRemove),
					new GossipMenuItem("Move here", HandleMoveOver),
					new GossipMenuItem("Insert New", HandleInsert));
			}
Example #11
0
		public LinkedListNode<WaypointEntry> InsertWPBefore(WaypointEntry entry, Vector3 pos, float orientation)
		{
			var newWp = CreateWP(pos, orientation);
			return Waypoints.AddBefore(entry.Node, newWp);
		}
Example #12
0
		public WaypointEntry CreateWP(Vector3 pos, float orientation)
		{
			var last = Waypoints.Last;
			WaypointEntry entry;
			if (last != null)
			{
				entry = new WaypointEntry
				{
					Id = last.Value.Id + 1,
					SpawnEntry = this,
				};
			}
			else
			{
				entry = new WaypointEntry
				{
					Id = 1,
					SpawnEntry = this,
				};
			}

			entry.Position = pos;
			entry.Orientation = orientation;
			return entry;
		}