PDA

View Full Version : COMMITTED: Waypoints


joligario
12-19-2009, 06:29 PM
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
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
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
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
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
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

trevius
01-09-2010, 10:20 PM
This is probably a good change, but I would recommend to leave EVENT_WAYPOINT in place as it is and just add it to the cast for EVENT_WAYPOINT_DEPART. This will prevent currently scripts from needing to be adjusted so it will work with the old and new systems for this.

joligario
01-11-2010, 08:46 PM
Just tested this on my personal server. Works good. You could always do a grep replace to change the EVENT_WAYPOINT to EVENT_WAYPOINT_DEPART. Up to you guys, though.

KLS
01-11-2010, 11:40 PM
I disagree with Trev, in the end that will just be annoying and confusing down the line. It's best to just force people to replace their EVENT_WAYPOINTs now and call it a day.

Derision
01-18-2010, 02:55 PM
I've committed this in Rev1118.

As a compromise, I left in the old EVENT_WAYPOINT as well as adding ARRIVE/DEPART to allow server ops some time to change their scripts.

All current occurrences of EVENT_WAYPOINT should be changed to EVENT_WAYPOINT_DEPART to maintain the old functionality.

I expect EVENT_WAYPOINT will be removed in a couple of weeks, so update those scripts now :)