Bladeren bron

Grid command lists widget id now. fixed zone script location updates

Emagi 1 jaar geleden
bovenliggende
commit
d436454646
2 gewijzigde bestanden met toevoegingen van 14 en 4 verwijderingen
  1. 3 2
      EQ2/source/WorldServer/Commands/Commands.cpp
  2. 11 2
      EQ2/source/WorldServer/Spawn.cpp

+ 3 - 2
EQ2/source/WorldServer/Commands/Commands.cpp

@@ -6100,10 +6100,11 @@ void Commands::Command_Grid(Client* client)
 	if (client->GetPlayer()->GetMap() != nullptr) {
 			auto loc = glm::vec3(client->GetPlayer()->GetX(), client->GetPlayer()->GetZ(), client->GetPlayer()->GetY());
 			uint32 GridID = 0;
-			float new_z = client->GetPlayer()->GetMap()->FindBestZ(loc, nullptr, &GridID);
+			uint32 WidgetID = 0;
+			float new_z = client->GetPlayer()->GetMap()->FindBestZ(loc, nullptr, &GridID, &WidgetID);
 			float minY = client->GetPlayer()->GetMap()->GetMinY();
 			float maxY = client->GetPlayer()->GetMap()->GetMaxY();
-			client->Message(CHANNEL_COLOR_YELLOW, "Grid result is %u, at EQ2 Y coordinate %f.  Min/Max Y %f/%f", GridID, new_z, minY, maxY);
+			client->Message(CHANNEL_COLOR_YELLOW, "Grid result is %u, at EQ2 Y coordinate %f.  Min/Max Y %f/%f.  Widget ID: %u", GridID, new_z, minY, maxY, WidgetID);
 	}
 }
 

+ 11 - 2
EQ2/source/WorldServer/Spawn.cpp

@@ -3940,9 +3940,18 @@ void Spawn::FixZ(bool forceUpdate) {
 	if(GetMap() != nullptr) {
 		float new_z = GetMap()->FindBestZ(current_loc, nullptr, &GridID, &WidgetID);
 
-		if ((IsTransportSpawn() || !IsFlyingCreature()) && GridID != 0 && GridID != appearance.pos.grid_id)
+		if ((IsTransportSpawn() || !IsFlyingCreature()) && GridID != 0 && GridID != appearance.pos.grid_id) {
+			LogWrite(PLAYER__DEBUG, 0, "Player", "%s left grid %u and entered grid %u", appearance.name, appearance.pos.grid_id, GridID);
+			
+			const char* zone_script = world.GetZoneScript(GetZone()->GetZoneID());
+
+			if (zone_script && lua_interface)
+			{
+				lua_interface->RunZoneScript(zone_script, "enter_location", GetZone(), this, GridID);
+				lua_interface->RunZoneScript(zone_script, "leave_location", GetZone(), this, appearance.pos.grid_id);
+			}
 			SetPos(&(appearance.pos.grid_id), GridID);
-		
+		}
 		trigger_widget_id = WidgetID;
 	}