1
0

Fixed LogError for GetSpellInitialTarget to show correct function name, pNumPlayers implemented for ZoneServer, will peer that data as well

This commit is contained in:
Emagi 2024-12-11 08:27:16 -05:00
parent b2a0122814
commit 35bbb09096
3 changed files with 14 additions and 7 deletions

View File

@ -14235,11 +14235,11 @@ int EQ2Emu_lua_GetSpellInitialTarget(lua_State* state) {
lua_interface->ResetFunctionStack(state); lua_interface->ResetFunctionStack(state);
if (spell) { if (spell) {
if(!spell->caster) { if(!spell->caster) {
lua_interface->LogError("%s: LUA GetSpellTarget command error, caster does not exist.", lua_interface->GetScriptName(state)); lua_interface->LogError("%s: LUA GetSpellInitialTarget command error, caster does not exist.", lua_interface->GetScriptName(state));
return 0; return 0;
} }
if(!spell->caster->GetZone()) { if(!spell->caster->GetZone()) {
lua_interface->LogError("%s: LUA GetSpellTarget command error, zone does not exist.", lua_interface->GetScriptName(state)); lua_interface->LogError("%s: LUA GetSpellInitialTarget command error, zone does not exist.", lua_interface->GetScriptName(state));
return 0; return 0;
} }
Spawn* spawn = spell->caster->GetZone()->GetSpawnByID(spell->initial_target); Spawn* spawn = spell->caster->GetZone()->GetSpawnByID(spell->initial_target);
@ -14248,7 +14248,7 @@ int EQ2Emu_lua_GetSpellInitialTarget(lua_State* state) {
return 1; return 1;
} }
else { else {
lua_interface->LogError("%s: LUA GetSpellTarget command error, could not find initial target %u to map to spawn.", lua_interface->GetScriptName(state), spell->initial_target); lua_interface->LogError("%s: LUA GetSpellInitialTarget command error, could not find initial target %u to map to spawn.", lua_interface->GetScriptName(state), spell->initial_target);
} }
} }
return 0; return 0;

View File

@ -3496,9 +3496,12 @@ GroundSpawn* ZoneServer::AddGroundSpawn(SpawnLocation* spawnlocation, SpawnEntry
} }
void ZoneServer::AddSpawn(Spawn* spawn) { void ZoneServer::AddSpawn(Spawn* spawn) {
if(!spawn->IsPlayer()) // we already set it on loadCharacter if(!spawn->IsPlayer()) {
spawn->SetZone(this); spawn->SetZone(this); // we already set it on loadCharacter
}
else {
pNumPlayers++;
}
MIgnoredWidgets.lock_shared(); MIgnoredWidgets.lock_shared();
std::map<int32, bool>::iterator itr; std::map<int32, bool>::iterator itr;
for(itr = ignored_widgets.begin(); itr != ignored_widgets.end(); itr++) { for(itr = ignored_widgets.begin(); itr != ignored_widgets.end(); itr++) {
@ -4654,6 +4657,10 @@ void ZoneServer::RemoveFromRangeMap(Client* client){
void ZoneServer::RemoveSpawn(Spawn* spawn, bool delete_spawn, bool respawn, bool lock, bool erase_from_spawn_list, bool lock_spell_process) void ZoneServer::RemoveSpawn(Spawn* spawn, bool delete_spawn, bool respawn, bool lock, bool erase_from_spawn_list, bool lock_spell_process)
{ {
if(spawn->IsPlayer()) {
if(pNumPlayers > 0)
pNumPlayers--;
}
LogWrite(ZONE__DEBUG, 3, "Zone", "Processing RemoveSpawn function for %s (%i)...", spawn->GetName(),spawn->GetID()); LogWrite(ZONE__DEBUG, 3, "Zone", "Processing RemoveSpawn function for %s (%i)...", spawn->GetName(),spawn->GetID());
PacketStruct* packet = 0; PacketStruct* packet = 0;

View File

@ -936,7 +936,7 @@ private:
bool always_loaded; bool always_loaded;
bool isInstance; bool isInstance;
int32 pNumPlayers; std::atomic<int32> pNumPlayers;
sint16 minimumStatus; sint16 minimumStatus;
int16 minimumLevel; int16 minimumLevel;
int16 maximumLevel; int16 maximumLevel;