aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormegamage <none@none>2009-02-22 17:35:14 -0600
committermegamage <none@none>2009-02-22 17:35:14 -0600
commit107218fe44c5a45023950f11ee3562abfcdd2c95 (patch)
tree5a3aae5c74723b26cd016596199674af81fa1355
parent7190332fcea1dcc6ed8ce59c6bfb542522775e35 (diff)
parent90d5e05aafff0f3dabd294811b4f82b024317a4a (diff)
*Merge.
--HG-- branch : trunk
-rw-r--r--src/bindings/scripts/scripts/guard/guards.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp6
-rw-r--r--src/game/DynamicObject.cpp17
-rw-r--r--src/game/Map.cpp8
-rw-r--r--src/game/Object.cpp2
-rw-r--r--src/game/Player.cpp3
-rw-r--r--src/game/RandomMovementGenerator.cpp194
-rw-r--r--src/game/RandomMovementGenerator.h9
-rw-r--r--src/game/Unit.cpp8
-rw-r--r--src/game/World.cpp26
-rw-r--r--src/game/World.h4
-rw-r--r--src/trinitycore/trinitycore.conf.dist5
12 files changed, 185 insertions, 99 deletions
diff --git a/src/bindings/scripts/scripts/guard/guards.cpp b/src/bindings/scripts/scripts/guard/guards.cpp
index b825c75b6ab..6caa6519c74 100644
--- a/src/bindings/scripts/scripts/guard/guards.cpp
+++ b/src/bindings/scripts/scripts/guard/guards.cpp
@@ -3286,7 +3286,7 @@ void SendClassTrainerMenu_guard_stormwind(Player *player, Creature *_Creature, u
player->SEND_GOSSIP_MENU(900,_Creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF + 3: //Warrior
- player->SEND_POI(-8624.54, 402.61, 7, 6, 0, "Pig and Whistle Tavern");
+ player->SEND_POI(-8690.11, 324.85, 7, 6, 0, "Command Center");
player->SEND_GOSSIP_MENU(901,_Creature->GetGUID());
break;
case GOSSIP_ACTION_INFO_DEF + 4: //Druid
diff --git a/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp b/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp
index 0ae8afd9f6c..36bff1796e6 100644
--- a/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp
+++ b/src/bindings/scripts/scripts/zone/shadowmoon_valley/shadowmoon_valley.cpp
@@ -718,6 +718,12 @@ struct TRINITY_DLL_DECL npc_overlord_morghorAI : public ScriptedAI
Unit* Illi = Unit::GetUnit((*m_creature), IllidanGUID);
+ if(!plr || !Illi)
+ {
+ EnterEvadeMode();
+ return;
+ }
+
switch(Step)
{
case 0: return 0; break;
diff --git a/src/game/DynamicObject.cpp b/src/game/DynamicObject.cpp
index b63928e7278..ddc04d382de 100644
--- a/src/game/DynamicObject.cpp
+++ b/src/game/DynamicObject.cpp
@@ -52,15 +52,18 @@ void DynamicObject::AddToWorld()
void DynamicObject::RemoveFromWorld()
{
- // Make sure the object is back to grid container for removal as farsight targets
- // are switched to world container on creation and they are also set to active
- if (isActive())
+ ///- Remove the dynamicObject from the accessor
+ if(IsInWorld())
{
- GetMap()->SwitchGridContainers(this, false);
- setActive(false);
+ // Make sure the object is back to grid container for removal as farsight targets
+ // are switched to world container on creation and they are also set to active
+ if (isActive())
+ {
+ GetMap()->SwitchGridContainers(this, false);
+ setActive(false);
+ }
+ ObjectAccessor::Instance().RemoveObject(this);
}
- ///- Remove the dynamicObject from the accessor
- if(IsInWorld()) ObjectAccessor::Instance().RemoveObject(this);
WorldObject::RemoveFromWorld();
}
diff --git a/src/game/Map.cpp b/src/game/Map.cpp
index fe060d14dff..06685247688 100644
--- a/src/game/Map.cpp
+++ b/src/game/Map.cpp
@@ -312,16 +312,16 @@ void Map::RemoveFromGrid(Creature* obj, NGridType *grid, Cell const& cell)
}
template<class T>
-void Map::SwitchGridContainers(T* obj, bool active)
+void Map::SwitchGridContainers(T* obj, bool apply)
{
CellPair pair = Trinity::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY());
Cell cell(pair);
NGridType *ngrid = getNGrid(cell.GridX(), cell.GridY());
GridType &grid = (*ngrid)(cell.CellX(), cell.CellY());
- if (active)
+ if(apply)
{
- if (!grid.GetWorldObject(obj->GetGUID(), obj))
+ assert(!grid.GetWorldObject(obj->GetGUID(), obj))
{
grid.RemoveGridObject<T>(obj, obj->GetGUID());
grid.AddWorldObject<T>(obj, obj->GetGUID());
@@ -329,7 +329,7 @@ void Map::SwitchGridContainers(T* obj, bool active)
}
else
{
- if (!grid.GetGridObject(obj->GetGUID(), obj))
+ assert(!grid.GetGridObject(obj->GetGUID(), obj))
{
grid.RemoveWorldObject<T>(obj, obj->GetGUID());
grid.AddGridObject<T>(obj, obj->GetGUID());
diff --git a/src/game/Object.cpp b/src/game/Object.cpp
index 4e000184763..a9534723354 100644
--- a/src/game/Object.cpp
+++ b/src/game/Object.cpp
@@ -1134,7 +1134,7 @@ void WorldObject::AddToWorld()
void WorldObject::RemoveFromWorld()
{
- if(m_isActive && !isType(TYPEMASK_PLAYER))
+ if(m_isActive && IsInWorld() && !isType(TYPEMASK_PLAYER))
GetMap()->RemoveActiveObject(this);
Object::RemoveFromWorld();
}
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 58a6924c874..f63bd1936a7 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -10252,8 +10252,7 @@ uint8 Player::CanEquipItem( uint8 slot, uint16 &dest, Item *pItem, bool swap, bo
{
if( ItemPrototype const* pBagProto = pBag->GetProto() )
{
- if( pBagProto->Class==pProto->Class && pBagProto->SubClass==pProto->SubClass &&
- (!swap || pBag->GetSlot() != eslot ) )
+ if( pBagProto->Class==pProto->Class && (!swap || pBag->GetSlot() != eslot ) )
{
if(pBagProto->SubClass == ITEM_SUBCLASS_AMMO_POUCH)
return EQUIP_ERR_CAN_EQUIP_ONLY1_AMMOPOUCH;
diff --git a/src/game/RandomMovementGenerator.cpp b/src/game/RandomMovementGenerator.cpp
index 3e4912d00cd..2f63b7082ff 100644
--- a/src/game/RandomMovementGenerator.cpp
+++ b/src/game/RandomMovementGenerator.cpp
@@ -22,10 +22,7 @@
#include "MapManager.h"
#include "RandomMovementGenerator.h"
#include "Traveller.h"
-#include "ObjectAccessor.h"
#include "DestinationHolderImp.h"
-#include "Map.h"
-#include "Util.h"
#define RUNNING_CHANCE_RANDOMMV 20 //will be "1 / RUNNING_CHANCE_RANDOMMV"
@@ -34,9 +31,9 @@ bool
RandomMovementGenerator<Creature>::GetDestination(float &x, float &y, float &z) const
{
if(i_destinationHolder.HasArrived())
- return false;
-
- i_destinationHolder.GetDestination(x, y, z);
+ return false;
+
+ i_destinationHolder.GetDestination(x, y, z);
return true;
}
@@ -44,76 +41,96 @@ template<>
void
RandomMovementGenerator<Creature>::_setRandomLocation(Creature &creature)
{
- float X,Y,Z,z,nx,ny,nz,ori,dist;
-
- creature.GetHomePosition(X, Y, Z, ori);
-
- z = creature.GetPositionZ();
- uint32 mapid=creature.GetMapId();
- Map const* map = MapManager::Instance().GetBaseMap(mapid);
-
- // For 2D/3D system selection
- bool is_land_ok = creature.canWalk();
- bool is_water_ok = creature.canSwim();
- bool is_air_ok = creature.canFly();
+ float i_x,i_y,i_z,n_x,n_y,n_z,ori,dist;
+ creature.GetHomePosition(i_x,i_y,i_z,ori);
- const float angle = rand_norm()*(M_PI*2);
- const float range = rand_norm()*wander_distance;
- const float distanceX = range * cos(angle);
- const float distanceY = range * sin(angle);
+ const float angle = 2*M_PI*rand_norm();
+ const float range = rand_norm()*wander_dist;
+ const float distX = range*cos(angle);
+ const float distY = range*sin(angle);
- nx = X + distanceX;
- ny = Y + distanceY;
+ n_x = i_x + distX;
+ n_y = i_y + distY;
- // prevent invalid coordinates generation
- Trinity::NormalizeMapCoord(nx);
- Trinity::NormalizeMapCoord(ny);
+ Trinity::NormalizeMapCoord(n_x);
+ Trinity::NormalizeMapCoord(n_y);
- dist = (nx - X)*(nx - X) + (ny - Y)*(ny - Y);
+ Map const* map = MapManager::Instance().GetBaseMap(creature.GetMapId());
- if (is_air_ok) // 3D system above ground and above water (flying mode)
+ switch(_InhabitType)
{
- const float distanceZ = rand_norm() * sqrtf(dist)/2; // Limit height change
- nz = Z + distanceZ;
- float tz = map->GetHeight(nx, ny, nz-2.0f, false); // Map check only, vmap needed here but need to alter vmaps checks for height.
- float wz = map->GetWaterLevel(nx, ny);
- if (tz >= nz || wz >= nz)
- return; // Problem here, we must fly above the ground and water, not under. Let's try on next tick
+ case INHABIT_AIR:
+ {
+ //don't use normalized n_x, n_y because difference is too small.. and this is random movement
+ dist = sqrtf(distX*distX + distY*distY);
+ const float distanceZ = rand_norm() * dist/2; // Limit height change
+ n_z = i_z + distanceZ;
+ float tz = map->GetHeight(n_x,n_y,n_z - 2.0f,false);
+ if (tz >= n_z || ground >= n_z)
+ return;
+ //creature.AddUnitMovementFlag(MOVEMENTFLAG_FLYING2);
+ break;
}
- //else if (is_water_ok) // 3D system under water and above ground (swimming mode)
- else // 2D only
+ case INHABIT_WATER:
{
+ //some small creatures can swim above water level
+ float water = map->GetWaterLevel(n_x,n_y) - 1.8f;
+ float floor = map->GetHeight(n_x,n_y,i_z,false) + 0.2f;
+ if (water - floor < 0)
+ return;
+ float z_diff = 2 * 1.192*creature.GetDistance2d(n_x,n_y); //1.192 = tan(50)
+ //if(water - floor > z_diff){
+ n_z = z_diff*(1 - 2*rand_norm()) + creature.GetPositionZ();
+ n_z = n_z > water ? water : n_z;
+ n_z = n_z < floor ? floor : n_z;
+ //}else
+ //n_z = floor + rand_norm()*(water - floor);
+ //creature.AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
+ break;
+ }
+ case INHABIT_GROUND:
+ {
+ dist = (distX*distX + distY*distY);
dist = dist>=100.0f ? 10.0f : sqrtf(dist); // 10.0 is the max that vmap high can check (MAX_CAN_FALL_DISTANCE)
- // The fastest way to get an accurate result 90% of the time.
- // Better result can be obtained like 99% accuracy with a ray light, but the cost is too high and the code is too long.
- nz = map->GetHeight(nx,ny,Z+dist-2.0f,false); // Map check
- if (fabs(nz-Z)>dist)
+ n_z = map->GetHeight(n_x,n_y,i_z,false);
+ if (fabs(n_z - i_z) > dist)
{
- nz = map->GetHeight(nx,ny,Z-2.0f,true); // Vmap Horizontal or above
- if (fabs(nz-Z)>dist)
+ n_z = map->GetHeight(n_x,n_y,i_z,true); // Vmap Horizontal or above
+ if (fabs(n_z - i_z) > dist)
{
- nz = map->GetHeight(nx,ny,Z+dist-2.0f,true); // Vmap Higher
- if (fabs(nz-Z)>dist)
- return; // let's forget this bad coords where a z cannot be find and retry at next tick
+ n_z = map->GetHeight(n_x,n_y,i_z + 8.0f,true); // Vmap Higher
+ if (fabs(n_z - i_z) > dist)
+ return;
}
}
+ if (!irand(0,RUNNING_CHANCE_RANDOMMV))
+ creature.RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
+ else
+ creature.AddUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
+ break;
+ }
+ default:
+ n_z = i_z;
+ break;
}
Traveller<Creature> traveller(creature);
- creature.SetOrientation(creature.GetAngle(nx,ny));
- i_destinationHolder.SetDestination(traveller, nx, ny, nz);
+ creature.SetOrientation(creature.GetAngle(n_x,n_y));
+ i_destinationHolder.SetDestination(traveller,n_x,n_y,n_z);
creature.addUnitState(UNIT_STAT_ROAMING);
- if (is_air_ok)
- {
- i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime());
- creature.AddUnitMovementFlag(MOVEMENTFLAG_FLYING2);
- }
- //else if (is_water_ok) // Swimming mode to be done with more than this check
- else
- {
- i_nextMoveTime.Reset(urand(500+i_destinationHolder.GetTotalTravelTime(),5000+i_destinationHolder.GetTotalTravelTime()));
- creature.SetUnitMovementFlags(MOVEMENTFLAG_WALK_MODE);
- }
+
+ switch(_InhabitType)
+ {
+ case INHABIT_AIR:
+ i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime());
+ break;
+ case INHABIT_WATER:
+ i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime() + urand(500,3000));
+ break;
+ default:
+ i_nextMoveTime.Reset(i_destinationHolder.GetTotalTravelTime() + urand(500,5000));
+ break;
+ }
}
template<>
@@ -123,13 +140,47 @@ RandomMovementGenerator<Creature>::Initialize(Creature &creature)
if(!creature.isAlive())
return;
- wander_distance = creature.GetRespawnRadius();
-
- if (creature.canFly())
- creature.AddUnitMovementFlag(MOVEMENTFLAG_FLYING2);
- else
- creature.SetUnitMovementFlags(irand(0,RUNNING_CHANCE_RANDOMMV) > 0 ? MOVEMENTFLAG_WALK_MODE : MOVEMENTFLAG_NONE );
- _setRandomLocation(creature);
+ wander_dist = creature.GetRespawnRadius();
+ Map const* map = MapManager::Instance().GetBaseMap(creature.GetMapId());
+
+ _InhabitType = creature.GetCreatureInfo()->InhabitType;
+
+ // Let's select only one movement type
+ // TODO: make this check more correct
+ float water;
+ if(_InhabitType & (INHABIT_WATER | INHABIT_AIR))
+ water = map->GetWaterLevel(creature.GetPositionX(),creature.GetPositionY());
+ if(_InhabitType & INHABIT_AIR)
+ {
+ float floor = map->GetHeight(creature.GetPositionX(),creature.GetPositionY(),creature.GetPositionZ(),true);
+ ground = floor > water ? floor : water;
+ if(ground + 2.0f < creature.GetPositionZ())
+ {
+ _InhabitType = INHABIT_AIR;
+ creature.addUnitState(UNIT_STAT_IN_FLIGHT);
+ creature.AddUnitMovementFlag(MOVEMENTFLAG_FLYING2);
+ i_nextMoveTime.Reset(urand(0,1000)); //to make them call _setRandomLocation not in one time
+ //_setRandomLocation(creature);
+ return;
+ }else
+ _InhabitType &= ~INHABIT_AIR;
+ }
+ if(_InhabitType & INHABIT_WATER)
+ {
+ if (water > creature.GetPositionZ()) //don't use "+2.0f" because under-water creatures already has height <= -1.9(if water level is 0)
+ {
+ _InhabitType = INHABIT_WATER;
+ creature.addUnitState(UNIT_STAT_IN_FLIGHT);
+ creature.AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
+ i_nextMoveTime.Reset(urand(0,1000));
+ //_setRandomLocation(creature);
+ return;
+ }else
+ _InhabitType &= ~INHABIT_WATER;
+ }
+ if(_InhabitType & INHABIT_GROUND)
+ i_nextMoveTime.Reset(urand(0,1000));
+ //_setRandomLocation(creature);
}
template<>
@@ -156,7 +207,7 @@ RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 &diff
i_nextMoveTime.Update(diff);
- if(i_destinationHolder.HasArrived() && !creature.IsStopped() && !creature.canFly())
+ if(i_destinationHolder.HasArrived() && !creature.IsStopped() && !(_InhabitType & (INHABIT_WATER | INHABIT_AIR)))
creature.clearUnitState(UNIT_STAT_ROAMING);
if(!i_destinationHolder.HasArrived() && creature.IsStopped())
@@ -166,14 +217,8 @@ RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 &diff
if( i_destinationHolder.UpdateTraveller(traveller, diff, false, true) )
{
- if(i_nextMoveTime.Passed())
- {
- if (creature.canFly())
- creature.AddUnitMovementFlag(MOVEMENTFLAG_FLYING2);
- else
- creature.SetUnitMovementFlags(irand(0,RUNNING_CHANCE_RANDOMMV) > 0 ? MOVEMENTFLAG_WALK_MODE : MOVEMENTFLAG_NONE);
+ if(i_nextMoveTime.Passed())
_setRandomLocation(creature);
- }
else if(creature.isPet() && creature.GetOwner() && creature.GetDistance(creature.GetOwner()) > PET_FOLLOW_DIST+2.5f)
{
creature.SetUnitMovementFlags(MOVEMENTFLAG_NONE);
@@ -182,4 +227,3 @@ RandomMovementGenerator<Creature>::Update(Creature &creature, const uint32 &diff
}
return true;
}
-
diff --git a/src/game/RandomMovementGenerator.h b/src/game/RandomMovementGenerator.h
index 20afe23d375..62370ab05fd 100644
--- a/src/game/RandomMovementGenerator.h
+++ b/src/game/RandomMovementGenerator.h
@@ -30,8 +30,8 @@ class TRINITY_DLL_SPEC RandomMovementGenerator
: public MovementGeneratorMedium< T, RandomMovementGenerator<T> >
{
public:
- // Wander dist is related on db spawn dist. So what if we wanna set eandom movement on summoned creature?!
- RandomMovementGenerator(float spawn_dist = 0.0f) : i_nextMoveTime(0), wander_distance(spawn_dist) {}
+ // Wander dist is related on db spawn dist. So what if we wanna set random movement on summoned creature?!
+ RandomMovementGenerator(float spawn_dist = 0.0f) : i_nextMoveTime(0), wander_dist(spawn_dist) {}
void _setRandomLocation(T &);
void Initialize(T &);
@@ -48,8 +48,7 @@ class TRINITY_DLL_SPEC RandomMovementGenerator
TimeTrackerSmall i_nextMoveTime;
DestinationHolder< Traveller<T> > i_destinationHolder;
- float wander_distance;
- uint32 i_nextMove;
+ float wander_dist, ground;
+ uint32 _InhabitType;
};
#endif
-
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 3db5e89e04e..43a8712fcfc 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -3744,7 +3744,8 @@ bool Unit::AddAura(Aura *Aur)
m_interruptableAuras.push_back(Aur);
AddInterruptMask(Aur->GetSpellProto()->AuraInterruptFlags);
}
- if(Aur->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE)
+ if((Aur->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE)
+ && (Aur->GetModifier()->m_auraname != SPELL_AURA_MOD_POSSESS)) //only dummy aura is breakable
{
m_ccAuras.push_back(Aur);
}
@@ -4109,8 +4110,11 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
UpdateInterruptMask();
}
- if(Aur->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE)
+ if((Aur->GetSpellProto()->Attributes & SPELL_ATTR_BREAKABLE_BY_DAMAGE)
+ && (Aur->GetModifier()->m_auraname != SPELL_AURA_MOD_POSSESS)) //only dummy aura is breakable
+ {
m_ccAuras.remove(Aur);
+ }
}
// Set remove mode
diff --git a/src/game/World.cpp b/src/game/World.cpp
index 520749285f8..cb9f2acf396 100644
--- a/src/game/World.cpp
+++ b/src/game/World.cpp
@@ -247,7 +247,7 @@ World::AddSession_ (WorldSession* s)
if(decrease_session)
--Sessions;
- if (pLimit > 0 && Sessions >= pLimit && s->GetSecurity () == SEC_PLAYER )
+ if (pLimit > 0 && Sessions >= pLimit && s->GetSecurity () == SEC_PLAYER && !HasRecentlyDisconnected(s) )
{
AddQueuedPlayer (s);
UpdateMaxSessionCounters ();
@@ -276,6 +276,26 @@ World::AddSession_ (WorldSession* s)
}
}
+bool World::HasRecentlyDisconnected(WorldSession* session)
+{
+ if(!session) return false;
+
+ if(uint32 tolerance = getConfig(CONFIG_INTERVAL_DISCONNECT_TOLERANCE))
+ {
+ for(DisconnectMap::iterator i = m_disconnects.begin(); i != m_disconnects.end(); ++i)
+ {
+ if(difftime(i->second, time(NULL)) < tolerance)
+ {
+ if(i->first == session->GetAccountId())
+ return true;
+ }
+ else
+ m_disconnects.erase(i);
+ }
+ }
+ return false;
+ }
+
int32 World::GetQueuePos(WorldSession* sess)
{
uint32 position = 1;
@@ -544,6 +564,7 @@ void World::LoadConfigSettings(bool reload)
m_configs[CONFIG_ADDON_CHANNEL] = sConfig.GetBoolDefault("AddonChannel", true);
m_configs[CONFIG_GRID_UNLOAD] = sConfig.GetBoolDefault("GridUnload", true);
m_configs[CONFIG_INTERVAL_SAVE] = sConfig.GetIntDefault("PlayerSaveInterval", 900000);
+ m_configs[CONFIG_INTERVAL_DISCONNECT_TOLERANCE] = sConfig.GetIntDefault("DisconnectToleranceInterval", 0);
m_configs[CONFIG_INTERVAL_GRIDCLEAN] = sConfig.GetIntDefault("GridCleanUpDelay", 300000);
if(m_configs[CONFIG_INTERVAL_GRIDCLEAN] < MIN_GRID_DELAY)
@@ -2939,7 +2960,8 @@ void World::UpdateSessions( uint32 diff )
///- and remove not active sessions from the list
if(!itr->second->Update(diff)) // As interval = 0
{
- RemoveQueuedPlayer (itr->second);
+ if(!RemoveQueuedPlayer(itr->second) && itr->second && getConfig(CONFIG_INTERVAL_DISCONNECT_TOLERANCE))
+ m_disconnects[itr->second->GetAccountId()] = time(NULL);
delete itr->second;
m_sessions.erase(itr);
}
diff --git a/src/game/World.h b/src/game/World.h
index b1bdcb0e7b3..8bbbf335625 100644
--- a/src/game/World.h
+++ b/src/game/World.h
@@ -80,6 +80,7 @@ enum WorldConfigs
CONFIG_INTERVAL_GRIDCLEAN,
CONFIG_INTERVAL_MAPUPDATE,
CONFIG_INTERVAL_CHANGEWEATHER,
+ CONFIG_INTERVAL_DISCONNECT_TOLERANCE,
CONFIG_PORT_WORLD,
CONFIG_SOCKET_SELECTTIME,
CONFIG_GROUP_XP_DISTANCE,
@@ -400,6 +401,7 @@ class World
void AddQueuedPlayer(WorldSession*);
bool RemoveQueuedPlayer(WorldSession* session);
int32 GetQueuePos(WorldSession*);
+ bool HasRecentlyDisconnected(WorldSession*);
uint32 GetQueueSize() const { return m_QueuedPlayer.size(); }
/// \todo Actions on m_allowMovement still to be implemented
@@ -558,6 +560,8 @@ class World
WeatherMap m_weathers;
typedef UNORDERED_MAP<uint32, WorldSession*> SessionMap;
SessionMap m_sessions;
+ typedef UNORDERED_MAP<uint32, time_t> DisconnectMap;
+ DisconnectMap m_disconnects;
uint32 m_maxActiveSessionCount;
uint32 m_maxQueuedSessionCount;
diff --git a/src/trinitycore/trinitycore.conf.dist b/src/trinitycore/trinitycore.conf.dist
index 1ceb1ec37df..552e87f34bf 100644
--- a/src/trinitycore/trinitycore.conf.dist
+++ b/src/trinitycore/trinitycore.conf.dist
@@ -127,6 +127,10 @@ EAIErrorLevel = 2
# Player save interval (in milliseconds)
# Default: 900000 (15 min)
#
+# DisconnectToleranceInterval
+# Tolerance for disconnected players before putting in the queue. (in seconds)
+# Default: 0 (disabled)
+#
# vmap.enableLOS
# vmap.enableHeight
# Enable/Disable VMmap support for line of sight and height calculation
@@ -184,6 +188,7 @@ GridCleanUpDelay = 300000
MapUpdateInterval = 100
ChangeWeatherInterval = 600000
PlayerSaveInterval = 900000
+DisconnectToleranceInterval = 0
vmap.enableLOS = 0
vmap.enableHeight = 0
vmap.ignoreMapIds = "369"