Merge branch 'master' into 303

Conflicts:
	src/game/Player.h
This commit is contained in:
tomrus88 2008-12-12 18:14:49 +03:00
commit 5d4d7292b9
47 changed files with 244 additions and 209 deletions

View file

@ -190,7 +190,7 @@ void PlayerTaxi::AppendTaximaskTo( ByteBuffer& data, bool all )
}
}
bool PlayerTaxi::LoadTaxiDestinationsFromString( std::string values )
bool PlayerTaxi::LoadTaxiDestinationsFromString( const std::string& values )
{
ClearTaxiDestinations();
@ -488,7 +488,7 @@ void Player::CleanupsBeforeDelete()
Unit::CleanupsBeforeDelete();
}
bool Player::Create( uint32 guidlow, std::string name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId )
bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId )
{
//FIXME: outfitId not used in player creating
@ -1549,6 +1549,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
else
// this will be used instead of the current location in SaveToDB
m_teleport_dest = WorldLocation(mapid, x, y, z, orientation);
SetFallInformation(0, z);
//BuildHeartBeatMsg(&data);
//SendMessageToSet(&data, true);
@ -1696,6 +1697,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
}
m_teleport_dest = WorldLocation(mapid, final_x, final_y, final_z, final_o);
SetFallInformation(0, final_z);
// if the player is saved before worldportack (at logout for example)
// this will be used instead of the current location in SaveToDB
@ -2033,23 +2035,23 @@ bool Player::IsInSameGroupWith(Player const* p) const
/// \todo Shouldn't we also check if there is no other invitees before disbanding the group?
void Player::UninviteFromGroup()
{
if(GetGroupInvite()) // uninvited invitee
Group* group = GetGroupInvite();
if(!group)
return;
group->RemoveInvite(this);
if(group->GetMembersCount() <= 1) // group has just 1 member => disband
{
Group* group = GetGroupInvite();
group->RemoveInvite(this);
if(group->GetMembersCount() <= 1) // group has just 1 member => disband
if(group->IsCreated())
{
if(group->IsCreated())
{
group->Disband(true);
objmgr.RemoveGroup(group);
}
else
group->RemoveAllInvites();
delete group;
group->Disband(true);
objmgr.RemoveGroup(group);
}
else
group->RemoveAllInvites();
delete group;
}
}
@ -13811,6 +13813,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
uint32 transGUID = fields[24].GetUInt32();
Relocate(fields[6].GetFloat(),fields[7].GetFloat(),fields[8].GetFloat(),fields[10].GetFloat());
SetFallInformation(0, fields[8].GetFloat());
SetMapId(fields[9].GetUInt32());
SetDifficulty(fields[32].GetUInt32()); // may be changed in _LoadGroup
@ -16111,7 +16114,7 @@ void Player::Uncharm()
charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS);
}
void Player::BuildPlayerChat(WorldPacket *data, uint8 msgtype, std::string text, uint32 language) const
void Player::BuildPlayerChat(WorldPacket *data, uint8 msgtype, const std::string& text, uint32 language) const
{
*data << (uint8)msgtype;
*data << (uint32)language;
@ -16123,28 +16126,28 @@ void Player::BuildPlayerChat(WorldPacket *data, uint8 msgtype, std::string text,
*data << (uint8)chatTag();
}
void Player::Say(const std::string text, const uint32 language)
void Player::Say(const std::string& text, const uint32 language)
{
WorldPacket data(SMSG_MESSAGECHAT, 200);
BuildPlayerChat(&data, CHAT_MSG_SAY, text, language);
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),true);
}
void Player::Yell(const std::string text, const uint32 language)
void Player::Yell(const std::string& text, const uint32 language)
{
WorldPacket data(SMSG_MESSAGECHAT, 200);
BuildPlayerChat(&data, CHAT_MSG_YELL, text, language);
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL),true);
}
void Player::TextEmote(const std::string text)
void Player::TextEmote(const std::string& text)
{
WorldPacket data(SMSG_MESSAGECHAT, 200);
BuildPlayerChat(&data, CHAT_MSG_EMOTE, text, LANG_UNIVERSAL);
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),true, !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) );
}
void Player::Whisper(std::string text, uint32 language,uint64 receiver)
void Player::Whisper(const std::string& text, uint32 language,uint64 receiver)
{
if (language != LANG_ADDON) // if not addon data
language = LANG_UNIVERSAL; // whispers should always be readable
@ -18630,6 +18633,21 @@ Player* Player::GetNextRandomRaidMember(float radius)
return nearMembers[randTarget];
}
PartyResult Player::CanUninviteFromGroup() const
{
const Group* grp = GetGroup();
if(!grp)
return PARTY_RESULT_YOU_NOT_IN_GROUP;
if(!grp->IsLeader(GetGUID()) && !grp->IsAssistant(GetGUID()))
return PARTY_RESULT_YOU_NOT_LEADER;
if(InBattleGround())
return PARTY_RESULT_INVITE_RESTRICTED;
return PARTY_RESULT_OK;
}
void Player::UpdateUnderwaterState( Map* m, float x, float y, float z )
{
float water_z = m->GetWaterLevel(x,y);