Browse Source

Spawn quest flag now set automatically for AddQuestStepKill spawn id scenario

Fixes #112
Image 4 years ago
parent
commit
1fbda69511

+ 4 - 4
EQ2/source/WorldServer/Entity.cpp

@@ -1764,7 +1764,7 @@ void Entity::AddStealthSpell(LuaSpell* spell) {
 		if (IsPlayer())
 		{
 			((Player*)this)->SetCharSheetChanged(true);
-			GetZone()->SendAllSpawnsForInvisChange(GetZone()->GetClientBySpawn(this));
+			GetZone()->SendAllSpawnsForVisChange(GetZone()->GetClientBySpawn(this));
 		}
 	}
 }
@@ -1784,7 +1784,7 @@ void Entity::AddInvisSpell(LuaSpell* spell) {
 		if (IsPlayer())
 		{
 			((Player*)this)->SetCharSheetChanged(true);
-			GetZone()->SendAllSpawnsForInvisChange(GetZone()->GetClientBySpawn(this));
+			GetZone()->SendAllSpawnsForVisChange(GetZone()->GetClientBySpawn(this));
 		}
 	}
 }
@@ -1803,7 +1803,7 @@ void Entity::RemoveInvisSpell(LuaSpell* spell) {
 		if (IsPlayer())
 		{
 			((Player*)this)->SetCharSheetChanged(true);
-			GetZone()->SendAllSpawnsForInvisChange(GetZone()->GetClientBySpawn(this));
+			GetZone()->SendAllSpawnsForVisChange(GetZone()->GetClientBySpawn(this));
 		}
 	}
 }
@@ -1822,7 +1822,7 @@ void Entity::RemoveStealthSpell(LuaSpell* spell) {
 		if (IsPlayer())
 		{
 			((Player*)this)->SetCharSheetChanged(true);
-			GetZone()->SendAllSpawnsForInvisChange(GetZone()->GetClientBySpawn(this));
+			GetZone()->SendAllSpawnsForVisChange(GetZone()->GetClientBySpawn(this));
 		}
 	}
 }

+ 1 - 1
EQ2/source/WorldServer/LuaFunctions.cpp

@@ -9390,7 +9390,7 @@ int EQ2Emu_lua_SetSeeHide(lua_State* state) {
 		{
 			Client* client = spawn->GetZone()->GetClientBySpawn((Player*)spawn);
 			if (client)
-				((Player*)spawn)->GetZone()->SendAllSpawnsForInvisChange(client);
+				((Player*)spawn)->GetZone()->SendAllSpawnsForVisChange(client);
 		}
 	}
 

+ 12 - 0
EQ2/source/WorldServer/client.cpp

@@ -4461,19 +4461,28 @@ void Client::AddStepProgress(int32 quest_id, int32 step, int32 progress) {
 }
 
 void Client::CheckPlayerQuestsKillUpdate(Spawn* spawn) {
+	bool hadUpdates = false;
 	vector<Quest*>* quest_updates = player->CheckQuestsKillUpdate(spawn);
 	if (quest_updates) {
 		for (int32 i = 0; i < quest_updates->size(); i++)
+		{
 			SendQuestUpdate(quest_updates->at(i));
+			hadUpdates = true;
+		}
 	}
 	safe_delete(quest_updates);
 	vector<Quest*>* quest_failures = player->CheckQuestsFailures();
 	if (quest_failures) {
 		for (int32 i = 0; i < quest_failures->size(); i++)
+		{
 			SendQuestFailure(quest_failures->at(i));
+			hadUpdates = true;
+		}
 	}
 	safe_delete(quest_failures);
 
+	if (hadUpdates)
+		GetCurrentZone()->SendAllSpawnsForVisChange(this);
 }
 
 void Client::CheckPlayerQuestsChatUpdate(Spawn* spawn) {
@@ -4599,6 +4608,8 @@ void Client::AddPlayerQuest(Quest* quest, bool call_accepted, bool send_packets)
 		QueuePacket(quest->QuestJournalReply(GetVersion(), GetNameCRC(), player));
 		quest->SetTracked(true);
 		QueuePacket(quest->QuestJournalReply(GetVersion(), GetNameCRC(), player));
+
+		GetCurrentZone()->SendAllSpawnsForVisChange(this);
 	}
 	//This isn't during a load screen, so update spawns with required quests
 	if (call_accepted)
@@ -4624,6 +4635,7 @@ void Client::RemovePlayerQuest(int32 id, bool send_update, bool delete_quest) {
 		if (send_update) {
 			LogWrite(CCLIENT__DEBUG, 0, "Client", "Send Quest Journal...");
 			SendQuestJournal();
+			GetCurrentZone()->SendAllSpawnsForVisChange(this);
 		}
 	}
 

+ 1 - 1
EQ2/source/WorldServer/zoneserver.cpp

@@ -3997,7 +3997,7 @@ void ZoneServer::SendAllSpawnsForSeeInvisChange(Client* client) {
 }
 
 
-void ZoneServer::SendAllSpawnsForInvisChange(Client* client) {
+void ZoneServer::SendAllSpawnsForVisChange(Client* client) {
 	Spawn* spawn = 0;
 	if (spawn_range_map.count(client) > 0) {
 		MutexMap<int32, float >::iterator itr = spawn_range_map.Get(client)->begin();

+ 1 - 1
EQ2/source/WorldServer/zoneserver.h

@@ -328,7 +328,7 @@ public:
 	void	ReloadClientQuests();
 	void	SendAllSpawnsForLevelChange(Client* client);
 	void	SendAllSpawnsForSeeInvisChange(Client* client);
-	void	SendAllSpawnsForInvisChange(Client* client);
+	void	SendAllSpawnsForVisChange(Client* client);
 	
 	void	AddLocationGrid(LocationGrid* grid);
 	void	RemoveLocationGrids();