[DiscordArchive] You were searching for a way to handle Map leaving, right?
[DiscordArchive] You were searching for a way to handle Map leaving, right?
Archived author: Hido • Posted: 2019-06-25T14:23:43.783000+00:00
Original source
I just want to set the phase of the player to 1 when he leave a map
Archived author: MR.MUSTACHE • Posted: 2019-06-25T14:25:53.467000+00:00
Original source
Every map?
Archived author: MR.MUSTACHE • Posted: 2019-06-25T14:28:02.377000+00:00
Original source
<@559407472759275540>
1. find the file
``` src\server\game\Maps\Map.cpp ```
2. Find the function ``` void Map::RemovePlayerFromMap(Player* player, bool remove) ```
3. Bellow
```
if (remove)
DeleteFromWorld(player);
```
add
```
if (player)
player->SetPhaseMask(PHASEMASK_NORMAL, true);
```
Archived author: Hido • Posted: 2019-06-25T14:28:30.062000+00:00
Original source
Nop only the map 571
Archived author: MR.MUSTACHE • Posted: 2019-06-25T14:28:35.200000+00:00
Original source
ok sec
Archived author: Hido • Posted: 2019-06-25T14:28:38.536000+00:00
Original source
The best would be only the Area 4254
Archived author: Hido • Posted: 2019-06-25T14:28:41.948000+00:00
Original source
But the map it's great
Archived author: MR.MUSTACHE • Posted: 2019-06-25T14:32:46.009000+00:00
Original source
hmm then you need to check the area before the player is removed from the old map and apply the phase after he is moved to the new map
Archived author: MR.MUSTACHE • Posted: 2019-06-25T14:32:55.105000+00:00
Original source
probably gonna need a boolean here
Archived author: MR.MUSTACHE • Posted: 2019-06-25T14:35:01.686000+00:00
Original source
```cpp
void Map::RemovePlayerFromMap(Player* player, bool remove)
{
// Before leaving map, update zone/area for stats
player->UpdateZone(MAP_INVALID_ZONE, 0);
sScriptMgr->OnPlayerLeaveMap(this, player);
player->CombatStop();
//verify that the player is leaving the area 4254
bool const Normalize = player->GetAreaId() == 4254;
bool const inWorld = player->IsInWorld();
player->RemoveFromWorld();
SendRemoveTransports(player);
if (!inWorld) // if was in world, RemoveFromWorld() called DestroyForNearbyPlayers()
player->DestroyForNearbyPlayers(); // previous player->UpdateObjectVisibility(true)
if (player->IsInGrid())
player->RemoveFromGrid();
else
ASSERT(remove); //maybe deleted in logoutplayer when player is not in a map
if (remove)
DeleteFromWorld(player);
//normalize phase if player is leaving the area 4254
if (player && Normalize)
player->SetPhaseMask(PHASEMASK_NORMAL, true);
}
```