[9496] HomeBind fixes.

* Use area id instead zone id for home bind zone info as expected.
  This will for example proper show capital name in area himebinding for capital; tavern.
* Clarify that player create zone in fact is area (subzone)
* Implement SPELL_EFFECT_BIND for normal homebinding.
  Also support spell target position mode used in 53823/53821 spells
* Add Spell::EffectEmpty for mark spell effects that used but not expect any code in handler.
  Example weapon spells that used just as known spell markers for client.

Original patch idea inspirit by Sadikum patch suggestion.
This commit is contained in:
VladimirMangos 2010-03-01 12:52:59 +03:00
parent aa13458b69
commit 4a051e2443
9 changed files with 116 additions and 66 deletions

View file

@ -16095,7 +16095,7 @@ bool Player::_LoadHomeBind(QueryResult *result)
{
Field *fields = result->Fetch();
m_homebindMapId = fields[0].GetUInt32();
m_homebindZoneId = fields[1].GetUInt16();
m_homebindAreaId = fields[1].GetUInt16();
m_homebindX = fields[2].GetFloat();
m_homebindY = fields[3].GetFloat();
m_homebindZ = fields[4].GetFloat();
@ -16116,16 +16116,16 @@ bool Player::_LoadHomeBind(QueryResult *result)
if(!ok)
{
m_homebindMapId = info->mapId;
m_homebindZoneId = info->zoneId;
m_homebindAreaId = info->areaId;
m_homebindX = info->positionX;
m_homebindY = info->positionY;
m_homebindZ = info->positionZ;
CharacterDatabase.PExecute("INSERT INTO character_homebind (guid,map,zone,position_x,position_y,position_z) VALUES ('%u', '%u', '%u', '%f', '%f', '%f')", GetGUIDLow(), m_homebindMapId, (uint32)m_homebindZoneId, m_homebindX, m_homebindY, m_homebindZ);
CharacterDatabase.PExecute("INSERT INTO character_homebind (guid,map,zone,position_x,position_y,position_z) VALUES ('%u', '%u', '%u', '%f', '%f', '%f')", GetGUIDLow(), m_homebindMapId, (uint32)m_homebindAreaId, m_homebindX, m_homebindY, m_homebindZ);
}
DEBUG_LOG("Setting player home position: mapid is: %u, zoneid is %u, X is %f, Y is %f, Z is %f",
m_homebindMapId, m_homebindZoneId, m_homebindX, m_homebindY, m_homebindZ);
m_homebindMapId, m_homebindAreaId, m_homebindX, m_homebindY, m_homebindZ);
return true;
}
@ -18901,7 +18901,7 @@ void Player::SendInitialPacketsBeforeAddToMap()
WorldPacket data(SMSG_BINDPOINTUPDATE, 5*4);
data << m_homebindX << m_homebindY << m_homebindZ;
data << (uint32) m_homebindMapId;
data << (uint32) m_homebindZoneId;
data << (uint32) m_homebindAreaId;
GetSession()->SendPacket(&data);
// SMSG_SET_PROFICIENCY
@ -21549,16 +21549,17 @@ bool Player::IsImmunedToSpellEffect(SpellEntry const* spellInfo, SpellEffectInde
return Unit::IsImmunedToSpellEffect(spellInfo, index);
}
void Player::SetHomebindToCurrentPos()
void Player::SetHomebindToLocation(WorldLocation const& loc, uint32 area_id)
{
m_homebindMapId = GetMapId();
m_homebindZoneId = GetZoneId();
m_homebindX = GetPositionX();
m_homebindY = GetPositionY();
m_homebindZ = GetPositionZ();
m_homebindMapId = loc.mapid;
m_homebindAreaId = area_id;
m_homebindX = loc.coord_x;
m_homebindY = loc.coord_y;
m_homebindZ = loc.coord_z;
// update sql homebind
CharacterDatabase.PExecute("UPDATE character_homebind SET map = '%u', zone = '%u', position_x = '%f', position_y = '%f', position_z = '%f' WHERE guid = '%u'",
m_homebindMapId, m_homebindZoneId, m_homebindX, m_homebindY, m_homebindZ, GetGUIDLow());
m_homebindMapId, m_homebindAreaId, m_homebindX, m_homebindY, m_homebindZ, GetGUIDLow());
}