mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-21 20:56:23 +00:00
Add (core\db): Support for Homebind Orientation (#13389)
Add (core\db) Support for Homebind Orientation
This commit is contained in:
@@ -349,6 +349,7 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this)
|
||||
m_homebindX = 0;
|
||||
m_homebindY = 0;
|
||||
m_homebindZ = 0;
|
||||
m_homebindO = 0;
|
||||
|
||||
m_contestedPvPTimer = 0;
|
||||
|
||||
@@ -1585,7 +1586,7 @@ bool Player::TeleportToEntryPoint()
|
||||
|
||||
if (loc.m_mapId == MAPID_INVALID)
|
||||
{
|
||||
return TeleportTo(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, GetOrientation());
|
||||
return TeleportTo(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, m_homebindO);
|
||||
}
|
||||
|
||||
return TeleportTo(loc);
|
||||
@@ -4851,7 +4852,7 @@ void Player::RepopAtGraveyard()
|
||||
}
|
||||
}
|
||||
else if (GetPositionZ() < GetMap()->GetMinHeight(GetPositionX(), GetPositionY()))
|
||||
TeleportTo(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, GetOrientation());
|
||||
TeleportTo(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, m_homebindO);
|
||||
|
||||
RemovePlayerFlag(PLAYER_FLAGS_IS_OUT_OF_BOUNDS);
|
||||
}
|
||||
@@ -11054,7 +11055,7 @@ void Player::SetEntryPoint()
|
||||
}
|
||||
|
||||
if (m_entryPointData.joinPos.m_mapId == MAPID_INVALID)
|
||||
m_entryPointData.joinPos = WorldLocation(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, 0.0f);
|
||||
m_entryPointData.joinPos = WorldLocation(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, m_homebindO);
|
||||
}
|
||||
|
||||
void Player::LeaveBattleground(Battleground* bg)
|
||||
@@ -11293,7 +11294,7 @@ void Player::SendInitialPacketsBeforeAddToMap()
|
||||
|
||||
// Homebind
|
||||
WorldPacket data(SMSG_BINDPOINTUPDATE, 5 * 4);
|
||||
data << m_homebindX << m_homebindY << m_homebindZ;
|
||||
data << m_homebindX << m_homebindY << m_homebindZ << m_homebindO;
|
||||
data << (uint32) m_homebindMapId;
|
||||
data << (uint32) m_homebindAreaId;
|
||||
GetSession()->SendPacket(&data);
|
||||
|
||||
@@ -2319,6 +2319,7 @@ public:
|
||||
float m_homebindX;
|
||||
float m_homebindY;
|
||||
float m_homebindZ;
|
||||
float m_homebindO;
|
||||
|
||||
[[nodiscard]] WorldLocation GetStartPosition() const;
|
||||
|
||||
|
||||
@@ -4922,7 +4922,7 @@ bool Player::LoadPositionFromDB(uint32& mapid, float& x, float& y, float& z, flo
|
||||
|
||||
void Player::SetHomebind(WorldLocation const& loc, uint32 areaId)
|
||||
{
|
||||
loc.GetPosition(m_homebindX, m_homebindY, m_homebindZ);
|
||||
loc.GetPosition(m_homebindX, m_homebindY, m_homebindZ, m_homebindO);
|
||||
m_homebindMapId = loc.GetMapId();
|
||||
m_homebindAreaId = areaId;
|
||||
|
||||
@@ -4930,10 +4930,11 @@ void Player::SetHomebind(WorldLocation const& loc, uint32 areaId)
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_PLAYER_HOMEBIND);
|
||||
stmt->SetData(0, m_homebindMapId);
|
||||
stmt->SetData(1, m_homebindAreaId);
|
||||
stmt->SetData (2, m_homebindX);
|
||||
stmt->SetData (3, m_homebindY);
|
||||
stmt->SetData (4, m_homebindZ);
|
||||
stmt->SetData(5, GetGUID().GetCounter());
|
||||
stmt->SetData(2, m_homebindX);
|
||||
stmt->SetData(3, m_homebindY);
|
||||
stmt->SetData(4, m_homebindZ);
|
||||
stmt->SetData(5, m_homebindO);
|
||||
stmt->SetData(6, GetGUID().GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
@@ -5104,7 +5105,7 @@ bool Player::LoadFromDB(ObjectGuid playerGuid, CharacterDatabaseQueryHolder cons
|
||||
|
||||
std::string taxi_nodes = fields[42].Get<std::string>();
|
||||
|
||||
auto RelocateToHomebind = [this, &mapId, &instanceId]() { mapId = m_homebindMapId; instanceId = 0; Relocate(m_homebindX, m_homebindY, m_homebindZ); };
|
||||
auto RelocateToHomebind = [this, &mapId, &instanceId]() { mapId = m_homebindMapId; instanceId = 0; Relocate(m_homebindX, m_homebindY, m_homebindZ, m_homebindO); };
|
||||
|
||||
_LoadGroup();
|
||||
|
||||
@@ -7004,7 +7005,7 @@ bool Player::_LoadHomeBind(PreparedQueryResult result)
|
||||
}
|
||||
|
||||
bool ok = false;
|
||||
// SELECT mapId, zoneId, posX, posY, posZ FROM character_homebind WHERE guid = ?
|
||||
// SELECT mapId, zoneId, posX, posY, posZ, pozO FROM character_homebind WHERE guid = ?
|
||||
if (result)
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
@@ -7014,11 +7015,12 @@ bool Player::_LoadHomeBind(PreparedQueryResult result)
|
||||
m_homebindX = fields[2].Get<float>();
|
||||
m_homebindY = fields[3].Get<float>();
|
||||
m_homebindZ = fields[4].Get<float>();
|
||||
m_homebindO = fields[5].Get<float>();
|
||||
|
||||
MapEntry const* bindMapEntry = sMapStore.LookupEntry(m_homebindMapId);
|
||||
|
||||
// accept saved data only for valid position (and non instanceable), and accessable
|
||||
if (MapMgr::IsValidMapCoord(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ) &&
|
||||
if (MapMgr::IsValidMapCoord(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, m_homebindO) &&
|
||||
!bindMapEntry->Instanceable() && GetSession()->Expansion() >= bindMapEntry->Expansion())
|
||||
ok = true;
|
||||
else
|
||||
@@ -7036,19 +7038,20 @@ bool Player::_LoadHomeBind(PreparedQueryResult result)
|
||||
m_homebindX = info->positionX;
|
||||
m_homebindY = info->positionY;
|
||||
m_homebindZ = info->positionZ;
|
||||
|
||||
m_homebindO = info->orientation;
|
||||
CharacterDatabasePreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PLAYER_HOMEBIND);
|
||||
stmt->SetData(0, GetGUID().GetCounter());
|
||||
stmt->SetData(1, m_homebindMapId);
|
||||
stmt->SetData(2, m_homebindAreaId);
|
||||
stmt->SetData (3, m_homebindX);
|
||||
stmt->SetData (4, m_homebindY);
|
||||
stmt->SetData (5, m_homebindZ);
|
||||
stmt->SetData(3, m_homebindX);
|
||||
stmt->SetData(4, m_homebindY);
|
||||
stmt->SetData(5, m_homebindZ);
|
||||
stmt->SetData(6, m_homebindO);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
LOG_DEBUG("entities.player", "Setting player home position - mapid: {}, areaid: {}, X: {}, Y: {}, Z: {}",
|
||||
m_homebindMapId, m_homebindAreaId, m_homebindX, m_homebindY, m_homebindZ);
|
||||
LOG_DEBUG("entities.player", "Setting player home position - mapid: {}, areaid: {}, X: {}, Y: {}, Z: {}, O: {}",
|
||||
m_homebindMapId, m_homebindAreaId, m_homebindX, m_homebindY, m_homebindZ, m_homebindO);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1017,7 +1017,7 @@ void Player::UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool def
|
||||
|
||||
chance = chance < 1.0f ? 1.0f : chance; // minimum chance to increase skill is 1%
|
||||
|
||||
LOG_DEBUG("entities.player", "Player::UpdateCombatSkills(defence:{}, playerLevel:{}, moblevel:{}) -> ({}/{}) chance to increase skill is {}\%", defence, playerLevel, moblevel, currentSkillValue, currentSkillMax, chance);
|
||||
LOG_DEBUG("entities.player", "Player::UpdateCombatSkills(defence:{}, playerLevel:{}, moblevel:{}) -> ({}/{}) chance to increase skill is {}%", defence, playerLevel, moblevel, currentSkillValue, currentSkillMax, chance);
|
||||
|
||||
if (roll_chance_f(chance))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user