View Single Post
  #1  
Old 12-19-2009, 06:29 PM
joligario's Avatar
joligario
Developer
 
Join Date: Mar 2003
Posts: 1,490
Default COMMITTED: Waypoints

Some work on adjusting the waypoint code. Obviously we still need to check current scripts/waypoints to adjust for a change like this.

Changed current waypoint event to EVENT_WAYPOINT_DEPART.
Added new waypoint event of EVENT_WAYPOINT_ARRIVE.

/EQEmuServer/zone/embparser.cpp
Code:
Index: /EQEmuServer/zone/embparser.cpp
===================================================================
--- /EQEmuServer/zone/embparser.cpp	(revision 1053)
+++ /EQEmuServer/zone/embparser.cpp	(working copy)
@@ -47,7 +47,8 @@
 	"EVENT_AGGRO",
 	"EVENT_SLAY",
 	"EVENT_NPC_SLAY",
-	"EVENT_WAYPOINT",
+	"EVENT_WAYPOINT_ARRIVE",
+	"EVENT_WAYPOINT_DEPART",
 	"EVENT_TIMER",
 	"EVENT_SIGNAL",
 	"EVENT_HP",
@@ -535,10 +536,14 @@
 			perl->eval(std::string("++$").append(hashname).append("{$").append(packagename).append("::item4};").c_str());
 			break;
 		}
-		case EVENT_WAYPOINT: {
+		case EVENT_WAYPOINT_ARRIVE: {
 			ExportVar(packagename.c_str(), "wp", data);
 			break;
 		}
+		case EVENT_WAYPOINT_DEPART: {
+			ExportVar(packagename.c_str(), "wp", data);
+			break;
+		}
 		case EVENT_HP: {
 			break;
 		}
/EQEmuServer/zone/event_codes.h
Code:
Index: /EQEmuServer/zone/event_codes.h
===================================================================
--- /EQEmuServer/zone/event_codes.h	(revision 1053)
+++ /EQEmuServer/zone/event_codes.h	(working copy)
@@ -11,7 +11,8 @@
 	EVENT_AGGRO,		//entering combat mode due to a PC attack
 	EVENT_SLAY,			//killing a PC
 	EVENT_NPC_SLAY,		//killing an NPC
-	EVENT_WAYPOINT,		//reaching a waypoint on a grid
+	EVENT_WAYPOINT_ARRIVE,		//reaching a waypoint on a grid
+	EVENT_WAYPOINT_DEPART, //departing a waypoint on a grid
 	EVENT_TIMER,
 	EVENT_SIGNAL,
 	EVENT_HP,
/EQEmuServer/zone/parser.cpp
Code:
Index: /EQEmuServer/zone/parser.cpp
===================================================================
--- /EQEmuServer/zone/parser.cpp	(revision 1053)
+++ /EQEmuServer/zone/parser.cpp	(working copy)
@@ -455,12 +455,18 @@
 			SendCommands("event_npc_slay", qstID, npcmob, mob);
 			break;
 		}
-		case EVENT_WAYPOINT: {
+		case EVENT_WAYPOINT_ARRIVE: {
 			temp = "wp." + (string)itoa(npcid);
 			AddVar(temp,data);
-			SendCommands("event_waypoint", qstID, npcmob, mob);
+			SendCommands("event_waypoint_arrive", qstID, npcmob, mob);
 			break;
 		}
+		case EVENT_WAYPOINT_DEPART: {
+			temp = "wp." + (string)itoa(npcid);
+			AddVar(temp,data);
+			SendCommands("event_waypoint_depart", qstID, npcmob, mob);
+			break;
+		}
 		case EVENT_SIGNAL: {
 			SendCommands("event_signal", qstID, npcmob, mob);
 			break;
/EQEmuServer/zone/MobAI.cpp
Code:
Index: /EQEmu/EQEmuServer/zone/MobAI.cpp
===================================================================
--- /EQEmuServer/zone/MobAI.cpp	(revision 1053)
+++ /EQEmuServer/zone/MobAI.cpp	(working copy)
@@ -1591,7 +1591,7 @@
 				} else {
 					movetimercompleted=false; 
 					
-					mlog(QUESTS__PATHING, "We have reached waypoint %d.", cur_wp);
+					mlog(QUESTS__PATHING, "We are departing waypoint %d.", cur_wp);
 
 					if(AggroedAwayFromGrid > 0)
 						--AggroedAwayFromGrid;
@@ -1606,10 +1606,10 @@
 					//not sure why we do this...
 					SetAppearance(eaStanding, false);
 					
-					//kick off event_waypoint
+					//kick off event_waypoint_depart
 					char temp[16]; 
 					sprintf(temp, "%d", cur_wp);
-					parse->Event(EVENT_WAYPOINT,this->GetNPCTypeID(), temp, CastToNPC(), NULL); 
+					parse->Event(EVENT_WAYPOINT_DEPART,this->GetNPCTypeID(), temp, CastToNPC(), NULL); 
 					
 					entity_list.OpenDoorsNear(CastToNPC());
 					//setup our next waypoint, if we are still on our normal grid
@@ -1627,6 +1627,11 @@
 					SetAppearance(eaStanding, false);
 					SetMoving(false);
 					SendPosition();
+
+					//kick off event_waypoint_arrive
+					char temp[16]; 
+					sprintf(temp, "%d", cur_wp);
+					parse->Event(EVENT_WAYPOINT_ARRIVE,this->GetNPCTypeID(), temp, CastToNPC(), NULL); 
 					
 					// EverHood - wipe feign memory since we reached our first waypoint
 					if(cur_wp == 1)
/EQEmuServer/zone/waypoints.cpp
Code:
Index: /EQEmu/EQEmuServer/zone/waypoints.cpp
===================================================================
--- /EQEmuServer/zone/waypoints.cpp	(revision 1053)
+++ /EQEmuServer/zone/waypoints.cpp	(working copy)
@@ -124,7 +124,7 @@
 			itoa(cur_wp,temp,10);	//do this before updating to next waypoint
 			CalculateNewWaypoint(); 
 	        SetAppearance(eaStanding, false); 
-			parse->Event(EVENT_WAYPOINT,this->GetNPCTypeID(), temp, this, NULL); 
+			parse->Event(EVENT_WAYPOINT_DEPART,this->GetNPCTypeID(), temp, this, NULL); 
 		}	// if not currently at a waypoint, we continue on to the one we were headed to before the stop
 	}
 	else

Last edited by Derision; 01-17-2010 at 05:43 PM.. Reason: Stickied for review by me
Reply With Quote