Core/Misc: 3.3.5a fixes
This commit is contained in:
1 parent
1be34f1d21
commit
5ceb04ed47
10 files changed
+91
-78
No files matched your search
+1
-1
@@ -18,7 +18,7 @@ install:
|
||||
- mysql -uroot -e 'create database test_mysql;'
|
||||
- mkdir bin
|
||||
- cd bin
|
||||
- cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DTOOLS=1 -DSCRIPTS=1 -DSERVERS=1 -DNOJEM=1 -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="-Werror" -DCMAKE_CXX_FLAGS="-Werror"
|
||||
- cmake ../ -DWITH_WARNINGS=1 -DWITH_COREDEBUG=0 -DUSE_COREPCH=1 -DUSE_SCRIPTPCH=1 -DTOOLS=1 -DSCRIPTS=1 -DSERVERS=1 -DNOJEM=1 -DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
script:
|
||||
- cd ..
|
||||
|
||||
@@ -98,6 +98,34 @@ void Position::GetSinCos(const float x, const float y, float &vsin, float &vcos)
|
||||
}
|
||||
}
|
||||
|
||||
bool Position::IsWithinBox(const Position& center, float xradius, float yradius, float zradius) const
|
||||
{
|
||||
// rotate the WorldObject position instead of rotating the whole cube, that way we can make a simplified
|
||||
// is-in-cube check and we have to calculate only one point instead of 4
|
||||
|
||||
// 2PI = 360*, keep in mind that ingame orientation is counter-clockwise
|
||||
double rotation = 2 * M_PI - center.GetOrientation();
|
||||
double sinVal = std::sin(rotation);
|
||||
double cosVal = std::cos(rotation);
|
||||
|
||||
float BoxDistX = GetPositionX() - center.GetPositionX();
|
||||
float BoxDistY = GetPositionY() - center.GetPositionY();
|
||||
|
||||
float rotX = float(center.GetPositionX() + BoxDistX * cosVal - BoxDistY*sinVal);
|
||||
float rotY = float(center.GetPositionY() + BoxDistY * cosVal + BoxDistX*sinVal);
|
||||
|
||||
// box edges are parallel to coordiante axis, so we can treat every dimension independently :D
|
||||
float dz = GetPositionZ() - center.GetPositionZ();
|
||||
float dx = rotX - center.GetPositionX();
|
||||
float dy = rotY - center.GetPositionY();
|
||||
if ((std::fabs(dx) > xradius) ||
|
||||
(std::fabs(dy) > yradius) ||
|
||||
(std::fabs(dz) > zradius))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Position::HasInArc(float arc, const Position* obj, float border) const
|
||||
{
|
||||
// always have self in arc
|
||||
|
||||
@@ -195,6 +195,7 @@ public:
|
||||
return GetExactDistSq(pos) < dist * dist;
|
||||
}
|
||||
|
||||
bool IsWithinBox(const Position& center, float xradius, float yradius, float zradius) const;
|
||||
bool HasInArc(float arcangle, Position const* pos, float border = 2.0f) const;
|
||||
bool HasInLine(Position const* pos, float width) const;
|
||||
std::string ToString() const;
|
||||
|
||||
@@ -801,10 +801,7 @@ Player::Player(WorldSession* session): Unit(true)
|
||||
|
||||
////////////////////Rest System/////////////////////
|
||||
time_inn_enter = 0;
|
||||
inn_pos_mapid = 0;
|
||||
inn_pos_x = 0.0f;
|
||||
inn_pos_y = 0.0f;
|
||||
inn_pos_z = 0.0f;
|
||||
inn_triggerId = 0;
|
||||
m_rest_bonus = 0;
|
||||
rest_type = REST_TYPE_NO;
|
||||
////////////////////Rest System/////////////////////
|
||||
@@ -1759,6 +1756,17 @@ void Player::Update(uint32 p_time)
|
||||
{
|
||||
if (p_time >= m_zoneUpdateTimer)
|
||||
{
|
||||
// On zone update tick check if we are still in an inn if we are supposed to be in one
|
||||
if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) && GetRestType() == REST_TYPE_IN_TAVERN)
|
||||
{
|
||||
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(GetInnTriggerId());
|
||||
if (!atEntry || !IsInAreaTriggerRadius(atEntry))
|
||||
{
|
||||
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
|
||||
SetRestType(REST_TYPE_NO);
|
||||
}
|
||||
}
|
||||
|
||||
uint32 newzone, newarea;
|
||||
GetZoneAndAreaId(newzone, newarea);
|
||||
|
||||
@@ -1949,12 +1957,9 @@ void Player::setDeathState(DeathState s)
|
||||
SetUInt32Value(PLAYER_SELF_RES_SPELL, 0);
|
||||
}
|
||||
|
||||
void Player::InnEnter(time_t time, uint32 mapid, float x, float y, float z)
|
||||
void Player::InnEnter(time_t time, uint32 triggerId)
|
||||
{
|
||||
inn_pos_mapid = mapid;
|
||||
inn_pos_x = x;
|
||||
inn_pos_y = y;
|
||||
inn_pos_z = z;
|
||||
inn_triggerId = triggerId;
|
||||
time_inn_enter = time;
|
||||
}
|
||||
|
||||
@@ -2921,6 +2926,28 @@ void Player::SetInWater(bool apply)
|
||||
getHostileRefManager().updateThreatTables();
|
||||
}
|
||||
|
||||
bool Player::IsInAreaTriggerRadius(const AreaTriggerEntry* trigger) const
|
||||
{
|
||||
if (!trigger || GetMapId() != trigger->mapid)
|
||||
return false;
|
||||
|
||||
if (trigger->radius > 0.f)
|
||||
{
|
||||
// if we have radius check it
|
||||
float dist = GetDistance(trigger->x, trigger->y, trigger->z);
|
||||
if (dist > trigger->radius)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
Position center(trigger->x, trigger->y, trigger->z, trigger->box_orientation);
|
||||
if (!IsWithinBox(center, trigger->box_x / 2.f, trigger->box_y / 2.f, trigger->box_z / 2.f))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Player::SetGameMaster(bool on)
|
||||
{
|
||||
if (on)
|
||||
@@ -7628,7 +7655,7 @@ void Player::UpdateArea(uint32 newArea)
|
||||
{
|
||||
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
|
||||
SetRestType(REST_TYPE_IN_FACTION_AREA);
|
||||
InnEnter(time(0), GetMapId(), 0, 0, 0);
|
||||
InnEnter(time(nullptr), 0);
|
||||
}
|
||||
else if (HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING) && GetRestType() == REST_TYPE_IN_FACTION_AREA)
|
||||
{
|
||||
@@ -7703,7 +7730,7 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
|
||||
{
|
||||
SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
|
||||
SetRestType(REST_TYPE_IN_CITY);
|
||||
InnEnter(time(0), GetMapId(), 0, 0, 0);
|
||||
InnEnter(time(nullptr), 0);
|
||||
}
|
||||
pvpInfo.IsInNoPvPArea = true;
|
||||
}
|
||||
@@ -7713,9 +7740,10 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
|
||||
{
|
||||
if (GetRestType() == REST_TYPE_IN_TAVERN) // Still inside a tavern or has recently left
|
||||
{
|
||||
// Remove rest state if we have recently left a tavern.
|
||||
if (GetMapId() != GetInnPosMapId() || GetExactDist(GetInnPosX(), GetInnPosY(), GetInnPosZ()) > 1.0f)
|
||||
{
|
||||
// check that we are still inside the tavern (in areatrigger radius)
|
||||
|
||||
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(GetInnTriggerId());
|
||||
if (!atEntry || !IsInAreaTriggerRadius(atEntry)) {
|
||||
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
|
||||
SetRestType(REST_TYPE_NO);
|
||||
}
|
||||
|
||||
@@ -1274,6 +1274,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
|
||||
bool IsInWater() const override { return m_isInWater; }
|
||||
bool IsUnderWater() const override;
|
||||
bool IsInAreaTriggerRadius(const AreaTriggerEntry* trigger) const;
|
||||
|
||||
void SendInitialPacketsBeforeAddToMap();
|
||||
void SendInitialPacketsAfterAddToMap();
|
||||
@@ -1334,7 +1335,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
|
||||
void setDeathState(DeathState s) override; // overwrite Unit::setDeathState
|
||||
|
||||
void InnEnter(time_t time, uint32 mapid, float x, float y, float z);
|
||||
void InnEnter(time_t time, uint32 triggerId);
|
||||
|
||||
float GetRestBonus() const { return m_rest_bonus; }
|
||||
void SetRestBonus(float rest_bonus_new);
|
||||
@@ -1342,10 +1343,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
RestType GetRestType() const { return rest_type; }
|
||||
void SetRestType(RestType n_r_type) { rest_type = n_r_type; }
|
||||
|
||||
uint32 GetInnPosMapId() const { return inn_pos_mapid; }
|
||||
float GetInnPosX() const { return inn_pos_x; }
|
||||
float GetInnPosY() const { return inn_pos_y; }
|
||||
float GetInnPosZ() const { return inn_pos_z; }
|
||||
uint32 GetInnTriggerId() const { return inn_triggerId; }
|
||||
|
||||
time_t GetTimeInnEnter() const { return time_inn_enter; }
|
||||
void UpdateInnerTime (time_t time) { time_inn_enter = time; }
|
||||
@@ -2781,10 +2779,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
|
||||
////////////////////Rest System/////////////////////
|
||||
time_t time_inn_enter;
|
||||
uint32 inn_pos_mapid;
|
||||
float inn_pos_x;
|
||||
float inn_pos_y;
|
||||
float inn_pos_z;
|
||||
uint32 inn_triggerId;
|
||||
float m_rest_bonus;
|
||||
RestType rest_type;
|
||||
////////////////////Rest System/////////////////////
|
||||
|
||||
@@ -856,59 +856,13 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
if (player->GetMapId() != atEntry->mapid)
|
||||
if (!player->IsInAreaTriggerRadius(atEntry))
|
||||
{
|
||||
TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (trigger map: %u player map: %u), ignore Area Trigger ID: %u",
|
||||
player->GetName().c_str(), atEntry->mapid, player->GetMapId(), player->GetGUIDLow(), triggerId);
|
||||
TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far, ignore Area Trigger ID: %u",
|
||||
player->GetName().c_str(), player->GetGUIDLow(), triggerId);
|
||||
return;
|
||||
}
|
||||
|
||||
// delta is safe radius
|
||||
const float delta = 5.0f;
|
||||
|
||||
if (atEntry->radius > 0)
|
||||
{
|
||||
// if we have radius check it
|
||||
float dist = player->GetDistance(atEntry->x, atEntry->y, atEntry->z);
|
||||
if (dist > atEntry->radius + delta)
|
||||
{
|
||||
TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (radius: %f distance: %f), ignore Area Trigger ID: %u",
|
||||
player->GetName().c_str(), player->GetGUIDLow(), atEntry->radius, dist, triggerId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// we have only extent
|
||||
|
||||
// rotate the players position instead of rotating the whole cube, that way we can make a simplified
|
||||
// is-in-cube check and we have to calculate only one point instead of 4
|
||||
|
||||
// 2PI = 360°, keep in mind that ingame orientation is counter-clockwise
|
||||
double rotation = 2 * M_PI - atEntry->box_orientation;
|
||||
double sinVal = std::sin(rotation);
|
||||
double cosVal = std::cos(rotation);
|
||||
|
||||
float playerBoxDistX = player->GetPositionX() - atEntry->x;
|
||||
float playerBoxDistY = player->GetPositionY() - atEntry->y;
|
||||
|
||||
float rotPlayerX = float(atEntry->x + playerBoxDistX * cosVal - playerBoxDistY*sinVal);
|
||||
float rotPlayerY = float(atEntry->y + playerBoxDistY * cosVal + playerBoxDistX*sinVal);
|
||||
|
||||
// box edges are parallel to coordiante axis, so we can treat every dimension independently :D
|
||||
float dz = player->GetPositionZ() - atEntry->z;
|
||||
float dx = rotPlayerX - atEntry->x;
|
||||
float dy = rotPlayerY - atEntry->y;
|
||||
if ((std::fabs(dx) > atEntry->box_x / 2 + delta) ||
|
||||
(std::fabs(dy) > atEntry->box_y / 2 + delta) ||
|
||||
(std::fabs(dz) > atEntry->box_z / 2 + delta))
|
||||
{
|
||||
TC_LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (1/2 box X: %f 1/2 box Y: %f 1/2 box Z: %f rotatedPlayerX: %f rotatedPlayerY: %f dZ:%f), ignore Area Trigger ID: %u",
|
||||
player->GetName().c_str(), player->GetGUIDLow(), atEntry->box_x/2, atEntry->box_y/2, atEntry->box_z/2, rotPlayerX, rotPlayerY, dz, triggerId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (player->isDebugAreaTriggers)
|
||||
ChatHandler(player->GetSession()).PSendSysMessage(LANG_DEBUG_AREATRIGGER_REACHED, triggerId);
|
||||
|
||||
@@ -924,7 +878,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recvData)
|
||||
{
|
||||
// set resting flag we are in the inn
|
||||
player->SetFlag(PLAYER_FLAGS, PLAYER_FLAGS_RESTING);
|
||||
player->InnEnter(time(NULL), atEntry->mapid, atEntry->x, atEntry->y, atEntry->z);
|
||||
player->InnEnter(time(nullptr), atEntry->id);
|
||||
player->SetRestType(REST_TYPE_IN_TAVERN);
|
||||
|
||||
if (sWorld->IsFFAPvPRealm())
|
||||
|
||||
@@ -36,7 +36,7 @@ class PointMovementGenerator : public MovementGeneratorMedium< T, PointMovementG
|
||||
|
||||
void MovementInform(T*);
|
||||
|
||||
void unitSpeedChanged() { i_recalculateSpeed = true; }
|
||||
void unitSpeedChanged() override { i_recalculateSpeed = true; }
|
||||
|
||||
MovementGeneratorType GetMovementGeneratorType() const override { return POINT_MOTION_TYPE; }
|
||||
|
||||
|
||||
@@ -3522,6 +3522,13 @@ void SpellMgr::LoadSpellInfoCorrections()
|
||||
case 71415: // Orange Ooze Summon (Professor Putricide)
|
||||
spellInfo->Effects[EFFECT_0].TargetA = SpellImplicitTargetInfo(TARGET_UNIT_TARGET_ANY);
|
||||
break;
|
||||
case 69783: // Ooze flood
|
||||
case 69797: // Ooze flood
|
||||
case 69799: // Ooze flood
|
||||
case 69802: // Ooze flood
|
||||
// Those spells are cast on creatures with same entry as caster while they have TARGET_UNIT_NEARBY_ENTRY.
|
||||
spellInfo->AttributesEx |= SPELL_ATTR1_CANT_TARGET_SELF;
|
||||
break;
|
||||
case 71159: // Awaken Plagued Zombies
|
||||
spellInfo->DurationEntry = sSpellDurationStore.LookupEntry(21);
|
||||
break;
|
||||
|
||||
@@ -205,7 +205,7 @@ struct RotfaceHeightCheck
|
||||
|
||||
bool operator()(Creature* stalker) const
|
||||
{
|
||||
return stalker->GetPositionZ() < _rotface->GetPositionZ() + 5.0f;
|
||||
return stalker->GetPositionZ() > _rotface->GetPositionZ() + 5.0f;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
@@ -480,8 +480,8 @@ class spell_rotface_ooze_flood : public SpellScriptLoader
|
||||
targets.sort(Trinity::ObjectDistanceOrderPred(GetCaster()));
|
||||
|
||||
// .resize() runs pop_back();
|
||||
if (targets.size() > 4)
|
||||
targets.resize(4);
|
||||
if (targets.size() > 5)
|
||||
targets.resize(5);
|
||||
|
||||
while (targets.size() > 2)
|
||||
targets.pop_front();
|
||||
|
||||
Reference in new issue
Block a user