*Update to Mangos 6955.
--HG-- branch : trunk
This commit is contained in:
@@ -173,7 +173,7 @@ void WorldSession::HandleArenaTeamInviteAcceptOpcode(WorldPacket & /*recv_data*/
|
||||
if(!at)
|
||||
return;
|
||||
|
||||
if(_player->GetArenaTeamIdFromDB(_player->GetGUIDLow(), at->GetType()))
|
||||
if(_player->GetArenaTeamId(at->GetType()))
|
||||
{
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S,"","",ERR_ALREADY_IN_ARENA_TEAM); // already in arena team that size
|
||||
return;
|
||||
|
||||
@@ -234,8 +234,6 @@ libmangosgame_a_SOURCES = \
|
||||
TaxiHandler.cpp \
|
||||
TemporarySummon.cpp \
|
||||
TemporarySummon.h \
|
||||
tools.cpp \
|
||||
Tools.h \
|
||||
TotemAI.cpp \
|
||||
TotemAI.h \
|
||||
Totem.cpp \
|
||||
|
||||
@@ -45,7 +45,6 @@
|
||||
#include "Pet.h"
|
||||
#include "SocialMgr.h"
|
||||
#include "CellImpl.h"
|
||||
#include "Tools.h"
|
||||
|
||||
void WorldSession::HandleRepopRequestOpcode( WorldPacket & /*recv_data*/ )
|
||||
{
|
||||
@@ -1677,7 +1676,7 @@ void WorldSession::HandleInspectAchievements( WorldPacket & recv_data )
|
||||
{
|
||||
CHECK_PACKET_SIZE(recv_data, 1);
|
||||
uint64 guid;
|
||||
if(!readGUID(recv_data, guid))
|
||||
if(!recv_data.readPackGUID(guid))
|
||||
return;
|
||||
|
||||
Player *player = objmgr.GetPlayer(guid);
|
||||
|
||||
@@ -1181,7 +1181,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
|
||||
/*0x47E*/ { "CMSG_FORCE_SAY_CHEAT", STATUS_NEVER, &WorldSession::Handle_NULL },
|
||||
/*0x47F*/ { "SMSG_HEALTH_UPDATE", STATUS_NEVER, &WorldSession::Handle_ServerSide },
|
||||
/*0x480*/ { "SMSG_POWER_UPDATE", STATUS_NEVER, &WorldSession::Handle_ServerSide },
|
||||
/*0x481*/ { "CMSG_GAMEOBJ_REPORT_USE", STATUS_NEVER, &WorldSession::Handle_NULL },
|
||||
/*0x481*/ { "CMSG_GAMEOBJ_REPORT_USE", STATUS_LOGGEDIN, &WorldSession::HandleGameobjectReportUse },
|
||||
/*0x482*/ { "SMSG_HIGHEST_THREAT_UPDATE", STATUS_NEVER, &WorldSession::Handle_ServerSide },
|
||||
/*0x483*/ { "SMSG_THREAT_UPDATE", STATUS_NEVER, &WorldSession::Handle_ServerSide },
|
||||
/*0x484*/ { "SMSG_THREAT_REMOVE", STATUS_NEVER, &WorldSession::Handle_ServerSide },
|
||||
|
||||
+34
-45
@@ -3625,27 +3625,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
|
||||
}
|
||||
|
||||
// remove from arena teams
|
||||
uint32 at_id = GetArenaTeamIdFromDB(playerguid,ARENA_TEAM_2v2);
|
||||
if(at_id != 0)
|
||||
{
|
||||
ArenaTeam * at = objmgr.GetArenaTeamById(at_id);
|
||||
if(at)
|
||||
at->DelMember(playerguid);
|
||||
}
|
||||
at_id = GetArenaTeamIdFromDB(playerguid,ARENA_TEAM_3v3);
|
||||
if(at_id != 0)
|
||||
{
|
||||
ArenaTeam * at = objmgr.GetArenaTeamById(at_id);
|
||||
if(at)
|
||||
at->DelMember(playerguid);
|
||||
}
|
||||
at_id = GetArenaTeamIdFromDB(playerguid,ARENA_TEAM_5v5);
|
||||
if(at_id != 0)
|
||||
{
|
||||
ArenaTeam * at = objmgr.GetArenaTeamById(at_id);
|
||||
if(at)
|
||||
at->DelMember(playerguid);
|
||||
}
|
||||
LeaveAllArenaTeams(playerguid);
|
||||
|
||||
// the player was uninvited already on logout so just remove from group
|
||||
QueryResult *resultGroup = CharacterDatabase.PQuery("SELECT leaderGuid FROM group_member WHERE memberGuid='%u'", guid);
|
||||
@@ -6293,24 +6273,18 @@ void Player::ModifyArenaPoints( int32 value )
|
||||
|
||||
uint32 Player::GetGuildIdFromDB(uint64 guid)
|
||||
{
|
||||
std::ostringstream ss;
|
||||
ss<<"SELECT guildid FROM guild_member WHERE guid='"<<guid<<"'";
|
||||
QueryResult *result = CharacterDatabase.Query( ss.str().c_str() );
|
||||
if( result )
|
||||
{
|
||||
uint32 v = result->Fetch()[0].GetUInt32();
|
||||
delete result;
|
||||
return v;
|
||||
}
|
||||
else
|
||||
QueryResult* result = CharacterDatabase.PQuery("SELECT guildid FROM guild_member WHERE guid='%u'", GUID_LOPART(guid));
|
||||
if(!result)
|
||||
return 0;
|
||||
|
||||
uint32 id = result->Fetch()[0].GetUInt32();
|
||||
delete result;
|
||||
return id;
|
||||
}
|
||||
|
||||
uint32 Player::GetRankFromDB(uint64 guid)
|
||||
{
|
||||
std::ostringstream ss;
|
||||
ss<<"SELECT rank FROM guild_member WHERE guid='"<<guid<<"'";
|
||||
QueryResult *result = CharacterDatabase.Query( ss.str().c_str() );
|
||||
QueryResult *result = CharacterDatabase.PQuery( "SELECT rank FROM guild_member WHERE guid='%u'", GUID_LOPART(guid) );
|
||||
if( result )
|
||||
{
|
||||
uint32 v = result->Fetch()[0].GetUInt32();
|
||||
@@ -6334,10 +6308,8 @@ uint32 Player::GetArenaTeamIdFromDB(uint64 guid, uint8 type)
|
||||
|
||||
uint32 Player::GetZoneIdFromDB(uint64 guid)
|
||||
{
|
||||
std::ostringstream ss;
|
||||
|
||||
ss<<"SELECT zone FROM characters WHERE guid='"<<GUID_LOPART(guid)<<"'";
|
||||
QueryResult *result = CharacterDatabase.Query( ss.str().c_str() );
|
||||
uint32 guidLow = GUID_LOPART(guid);
|
||||
QueryResult *result = CharacterDatabase.PQuery( "SELECT zone FROM characters WHERE guid='%u'", guidLow );
|
||||
if (!result)
|
||||
return 0;
|
||||
Field* fields = result->Fetch();
|
||||
@@ -6347,22 +6319,18 @@ uint32 Player::GetZoneIdFromDB(uint64 guid)
|
||||
if (!zone)
|
||||
{
|
||||
// stored zone is zero, use generic and slow zone detection
|
||||
ss.str("");
|
||||
ss<<"SELECT map,position_x,position_y FROM characters WHERE guid='"<<GUID_LOPART(guid)<<"'";
|
||||
result = CharacterDatabase.Query(ss.str().c_str());
|
||||
result = CharacterDatabase.PQuery("SELECT map,position_x,position_y FROM characters WHERE guid='%u'", guidLow);
|
||||
if( !result )
|
||||
return 0;
|
||||
fields = result->Fetch();
|
||||
uint32 map = fields[0].GetUInt32();
|
||||
uint32 map = fields[0].GetUInt32();
|
||||
float posx = fields[1].GetFloat();
|
||||
float posy = fields[2].GetFloat();
|
||||
delete result;
|
||||
|
||||
zone = MapManager::Instance().GetZoneId(map,posx,posy);
|
||||
|
||||
ss.str("");
|
||||
ss << "UPDATE characters SET zone='"<<zone<<"' WHERE guid='"<<GUID_LOPART(guid)<<"'";
|
||||
CharacterDatabase.Execute(ss.str().c_str());
|
||||
CharacterDatabase.PExecute("UPDATE characters SET zone='%u' WHERE guid='%u'", zone, guidLow);
|
||||
}
|
||||
|
||||
return zone;
|
||||
@@ -17048,6 +17016,27 @@ void Player::RemovePetitionsAndSigns(uint64 guid, uint32 type)
|
||||
CharacterDatabase.CommitTransaction();
|
||||
}
|
||||
|
||||
void LeaveAllArenaTeams(uint64 guid)
|
||||
{
|
||||
QueryResult *result = CharacterDatabase.PQuery("SELECT arena_team_member.arenateamid FROM arena_team_member JOIN arena_team ON arena_team_member.arenateamid = arena_team.arenateamid WHERE guid='%u'", GUID_LOPART(guid));
|
||||
if(!result)
|
||||
return;
|
||||
|
||||
do
|
||||
{
|
||||
Field *fields = result->Fetch();
|
||||
uint32 at_id = fields[0].GetUInt32();
|
||||
if(at_id != 0)
|
||||
{
|
||||
ArenaTeam * at = objmgr.GetArenaTeamById(at_id);
|
||||
if(at)
|
||||
at->DelMember(guid);
|
||||
}
|
||||
} while (result->NextRow());
|
||||
|
||||
delete result;
|
||||
}
|
||||
|
||||
void Player::SetRestBonus (float rest_bonus_new)
|
||||
{
|
||||
// Prevent resting on max level
|
||||
|
||||
@@ -1612,6 +1612,7 @@ class TRINITY_DLL_SPEC Player : public Unit
|
||||
static uint32 GetArenaTeamIdFromDB(uint64 guid, uint8 slot);
|
||||
void SetArenaTeamIdInvited(uint32 ArenaTeamId) { m_ArenaTeamIdInvited = ArenaTeamId; }
|
||||
uint32 GetArenaTeamIdInvited() { return m_ArenaTeamIdInvited; }
|
||||
static void LeaveAllArenaTeams(uint64 guid);
|
||||
|
||||
void SetDifficulty(uint32 dungeon_difficulty) { m_dungeonDifficulty = dungeon_difficulty; }
|
||||
uint8 GetDifficulty() { return m_dungeonDifficulty; }
|
||||
|
||||
+11
-8
@@ -43,7 +43,6 @@
|
||||
#include "CellImpl.h"
|
||||
#include "Policies/SingletonImp.h"
|
||||
#include "SharedDefines.h"
|
||||
#include "Tools.h"
|
||||
#include "LootMgr.h"
|
||||
#include "VMapFactory.h"
|
||||
#include "BattleGround.h"
|
||||
@@ -177,16 +176,16 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster )
|
||||
return true;
|
||||
|
||||
// TARGET_FLAG_UNK2 is used for non-combat pets, maybe other?
|
||||
if( m_targetMask & (TARGET_FLAG_UNIT|TARGET_FLAG_UNK2) )
|
||||
if(!readGUID(*data, m_unitTargetGUID))
|
||||
if( m_targetMask & ( TARGET_FLAG_UNIT | TARGET_FLAG_UNK2 ))
|
||||
if(!data->readPackGUID(m_unitTargetGUID))
|
||||
return false;
|
||||
|
||||
if( m_targetMask & ( TARGET_FLAG_OBJECT | TARGET_FLAG_OBJECT_UNK ))
|
||||
if(!readGUID(*data, m_GOTargetGUID))
|
||||
if(!data->readPackGUID(m_GOTargetGUID))
|
||||
return false;
|
||||
|
||||
if(( m_targetMask & ( TARGET_FLAG_ITEM | TARGET_FLAG_TRADE_ITEM )) && caster->GetTypeId() == TYPEID_PLAYER)
|
||||
if(!readGUID(*data, m_itemTargetGUID))
|
||||
if(!data->readPackGUID(m_itemTargetGUID))
|
||||
return false;
|
||||
|
||||
/*if( m_targetMask & TARGET_FLAG_SOURCE_LOCATION )
|
||||
@@ -219,7 +218,7 @@ bool SpellCastTargets::read ( WorldPacket * data, Unit *caster )
|
||||
}
|
||||
|
||||
if( m_targetMask & (TARGET_FLAG_CORPSE | TARGET_FLAG_PVP_CORPSE ) )
|
||||
if(!readGUID(*data, m_CorpseTargetGUID))
|
||||
if(!data->readPackGUID(m_CorpseTargetGUID))
|
||||
return false;
|
||||
|
||||
// find real units/GOs
|
||||
@@ -3663,8 +3662,12 @@ uint8 Spell::CanCast(bool strict)
|
||||
if( m_spellInfo->AttributesEx2 == 0x100000 && (m_spellInfo->AttributesEx & 0x200) == 0x200 && target->HasInArc(M_PI, m_caster)
|
||||
&& (m_spellInfo->SpellFamilyName != SPELLFAMILY_DRUID || m_spellInfo->SpellFamilyFlags != 0x0000000000020000LL))
|
||||
{
|
||||
SendInterrupted(2);
|
||||
return SPELL_FAILED_NOT_BEHIND;
|
||||
//Exclusion for Pounce: Facing Limitation was removed in 2.0.1, but it still uses the same, old Ex-Flags
|
||||
if( m_spellInfo->SpellFamilyName != SPELLFAMILY_DRUID || m_spellInfo->SpellFamilyFlags != 0x0000000000020000LL )
|
||||
{
|
||||
SendInterrupted(2);
|
||||
return SPELL_FAILED_NOT_BEHIND;
|
||||
}
|
||||
}
|
||||
|
||||
//Target must be facing you.
|
||||
|
||||
@@ -1089,7 +1089,10 @@ void Aura::HandleAddModifier(bool apply, bool Real)
|
||||
{
|
||||
case 17941: // Shadow Trance
|
||||
case 22008: // Netherwind Focus
|
||||
case 31834: // Light's Grace
|
||||
case 34754: // Clearcasting
|
||||
case 34936: // Backlash
|
||||
case 48108: // Hot Streak
|
||||
m_procCharges = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -285,6 +285,16 @@ void WorldSession::HandleGameObjectUseOpcode( WorldPacket & recv_data )
|
||||
obj->Use(_player);
|
||||
}
|
||||
|
||||
void WorldSession::HandleGameobjectReportUse(WorldPacket& recvPacket)
|
||||
{
|
||||
CHECK_PACKET_SIZE(recvPacket,8);
|
||||
|
||||
uint64 guid;
|
||||
recvPacket >> guid;
|
||||
|
||||
sLog.outDebug( "WORLD: Recvd CMSG_GAMEOBJ_REPORT_USE Message [in game guid: %u]", GUID_LOPART(guid));
|
||||
}
|
||||
|
||||
void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
|
||||
{
|
||||
CHECK_PACKET_SIZE(recvPacket,1+4+1);
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
|
||||
*
|
||||
* Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#ifndef TRINITY_TOOLS_H
|
||||
#define TRINITY_TOOLS_H
|
||||
|
||||
#include "Common.h"
|
||||
#include "WorldPacket.h"
|
||||
|
||||
bool readGUID(WorldPacket & data, uint64& guid);
|
||||
void writeGUID(WorldPacket & data, uint64 & guid);
|
||||
#endif
|
||||
@@ -326,6 +326,7 @@ class TRINITY_DLL_SPEC WorldSession
|
||||
|
||||
void HandleGameObjectUseOpcode(WorldPacket& recPacket);
|
||||
void HandleMeetingStoneInfo(WorldPacket& recPacket);
|
||||
void HandleGameobjectReportUse(WorldPacket& recvPacket);
|
||||
|
||||
void HandleNameQueryOpcode(WorldPacket& recvPacket);
|
||||
|
||||
|
||||
@@ -1,116 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
|
||||
*
|
||||
* Copyright (C) 2008 Trinity <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "Tools.h"
|
||||
|
||||
// THIS CAN BE A LOT FASTER
|
||||
bool readGUID(WorldPacket & data, uint64& guid)
|
||||
{
|
||||
if(data.rpos()+1 > data.size())
|
||||
return false;
|
||||
|
||||
uint8 guidmark=0;
|
||||
uint8 bit;
|
||||
uint8 shiftdata=0x1;
|
||||
uint64 Temp=0;
|
||||
|
||||
guid = 0;
|
||||
|
||||
data >> guidmark;
|
||||
for(int i=0;i<8;i++)
|
||||
{
|
||||
if(guidmark & shiftdata)
|
||||
{
|
||||
Temp = 0;
|
||||
|
||||
if(data.rpos()+1 > data.size())
|
||||
return false;
|
||||
|
||||
data >> bit;
|
||||
Temp = bit;
|
||||
Temp <<= i*8;
|
||||
guid |= Temp;
|
||||
}
|
||||
shiftdata=shiftdata<<1;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void writeGUID(WorldPacket & data, uint64 & guid)
|
||||
{
|
||||
uint8 RAWmask = 0;
|
||||
uint8 PackedGuid[8] = {0,0,0,0,0,0,0,0};
|
||||
|
||||
int j = 1;
|
||||
uint8 * test = (uint8*)&guid;
|
||||
|
||||
if (*test)
|
||||
{
|
||||
PackedGuid[j] = *test;
|
||||
RAWmask |= 1;
|
||||
++j;
|
||||
}
|
||||
if (*(test+1))
|
||||
{
|
||||
PackedGuid[j] = *(test+1);
|
||||
RAWmask |= 2;
|
||||
++j;
|
||||
}
|
||||
if (*(test+2))
|
||||
{
|
||||
PackedGuid[j] = *(test+2);
|
||||
RAWmask |= 4;
|
||||
++j;
|
||||
}
|
||||
if (*(test+3))
|
||||
{
|
||||
PackedGuid[j] = *(test+3);
|
||||
RAWmask |= 8;
|
||||
++j;
|
||||
}
|
||||
if (*(test+4))
|
||||
{
|
||||
PackedGuid[j] = *(test+4);
|
||||
RAWmask |= 16;
|
||||
++j;
|
||||
}
|
||||
if (*(test+5))
|
||||
{
|
||||
PackedGuid[j] = *(test+5);
|
||||
RAWmask |= 32;
|
||||
++j;
|
||||
}
|
||||
if (*(test+6))
|
||||
{
|
||||
PackedGuid[j] = *(test+6);
|
||||
RAWmask |= 64;
|
||||
++j;
|
||||
}
|
||||
if (*(test+7))
|
||||
{
|
||||
PackedGuid[j] = *(test+7);
|
||||
RAWmask |= 128;
|
||||
++j;
|
||||
}
|
||||
PackedGuid[0] = RAWmask;
|
||||
|
||||
data.append(PackedGuid,j);
|
||||
}
|
||||
@@ -243,6 +243,32 @@ class ByteBuffer
|
||||
_rpos += len;
|
||||
}
|
||||
|
||||
bool readPackGUID(uint64& guid)
|
||||
{
|
||||
if(rpos()+1 > size())
|
||||
return false;
|
||||
|
||||
guid = 0;
|
||||
|
||||
uint8 guidmark=0;
|
||||
(*this) >> guidmark;
|
||||
|
||||
for(int i=0;i<8;i++)
|
||||
{
|
||||
if(guidmark & (uint8(1) << i))
|
||||
{
|
||||
if(rpos()+1 > size())
|
||||
return false;
|
||||
|
||||
uint8 bit;
|
||||
(*this) >> bit;
|
||||
guid |= (uint64(bit) << (i*8));
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const uint8 *contents() const { return &_storage[0]; }
|
||||
|
||||
size_t size() const { return _storage.size(); }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "6949"
|
||||
#define REVISION_NR "6955"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
||||
@@ -928,12 +928,6 @@
|
||||
<File
|
||||
RelativePath="..\..\src\game\PlayerDump.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\tools.cpp">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\Tools.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="References"
|
||||
|
||||
@@ -1374,14 +1374,6 @@
|
||||
RelativePath="..\..\src\game\PlayerDump.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\tools.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\Tools.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="References"
|
||||
|
||||
@@ -1376,14 +1376,6 @@
|
||||
RelativePath="..\..\src\game\PlayerDump.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\tools.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\game\Tools.h"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="References"
|
||||
|
||||
Reference in New Issue
Block a user