Browse Source

Add player_loadcomplete lua function for Zone Script in DoneLoadingUIResources

Image 2 years ago
parent
commit
dfb54ed1da
2 changed files with 10 additions and 1 deletions
  1. 9 1
      EQ2/source/WorldServer/client.cpp
  2. 1 0
      EQ2/source/WorldServer/client.h

+ 9 - 1
EQ2/source/WorldServer/client.cpp

@@ -205,6 +205,7 @@ Client::Client(EQStream* ieqs) : pos_update(125), quest_pos_timer(2000), lua_deb
 	MConversation.SetName("Client::MConversation");
 	save_spell_state_timer.Disable();
 	save_spell_state_time_bucket = 0;
+	player_loading_complete = false;
 }
 
 Client::~Client() {
@@ -1388,6 +1389,13 @@ bool Client::HandlePacket(EQApplicationPacket* app) {
 		ClientPacketFunctions::SendUpdateSpellBook(this);
 		EQ2Packet* app = new EQ2Packet(OP_DoneLoadingUIResourcesMsg, 0, 0);
 		QueuePacket(app);
+		if(!player_loading_complete)
+		{
+			const char* zone_script = world.GetZoneScript(GetCurrentZone()->GetZoneID());
+			if (zone_script && lua_interface)
+				lua_interface->RunZoneScript(zone_script, "player_loadcomplete", GetCurrentZone(), GetPlayer());
+			player_loading_complete = true;
+		}
 		break;
 	}
 	case OP_DoneLoadingZoneResourcesMsg: {
@@ -9776,7 +9784,7 @@ void Client::SendSpawnChanges(set<Spawn*>& spawns) {
 
 	for (const auto& spawn : spawns) {
 		int16 index = GetPlayer()->GetIndexForSpawn(spawn);
-		if (index == 0 || !GetPlayer()->WasSentSpawn(spawn->GetID()) || GetPlayer()->NeedsSpawnResent(spawn) || GetPlayer()->GetDistance(spawn) >= SEND_SPAWN_DISTANCE)
+		if (index == 0 || !GetPlayer()->WasSentSpawn(spawn->GetID()) || GetPlayer()->NeedsSpawnResent(spawn))
 			continue;
 
 		if (spawn->vis_changed)

+ 1 - 0
EQ2/source/WorldServer/client.h

@@ -604,6 +604,7 @@ private:
 	Timer save_spell_state_timer; // will be the 're-trigger' to delay
 	int32 save_spell_state_time_bucket; // bucket as we collect over time when timer is reset by new spell effects being casted
 	std::mutex MSaveSpellStateMutex;
+	bool player_loading_complete;
 };
 
 class ClientList {