aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/ArenaTeamHandler.cpp2
-rw-r--r--src/game/Makefile.am2
-rw-r--r--src/game/MiscHandler.cpp3
-rw-r--r--src/game/Opcodes.cpp2
-rw-r--r--src/game/Player.cpp79
-rw-r--r--src/game/Player.h1
-rw-r--r--src/game/Spell.cpp19
-rw-r--r--src/game/SpellAuras.cpp3
-rw-r--r--src/game/SpellHandler.cpp10
-rw-r--r--src/game/Tools.h28
-rw-r--r--src/game/WorldSession.h1
-rw-r--r--src/game/tools.cpp116
-rw-r--r--src/shared/ByteBuffer.h26
-rw-r--r--src/shared/revision_nr.h2
14 files changed, 90 insertions, 204 deletions
diff --git a/src/game/ArenaTeamHandler.cpp b/src/game/ArenaTeamHandler.cpp
index d2c9f54d04b..f48529a3f77 100644
--- a/src/game/ArenaTeamHandler.cpp
+++ b/src/game/ArenaTeamHandler.cpp
@@ -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;
diff --git a/src/game/Makefile.am b/src/game/Makefile.am
index 2708d1d5651..c0eda2ff7ea 100644
--- a/src/game/Makefile.am
+++ b/src/game/Makefile.am
@@ -234,8 +234,6 @@ libmangosgame_a_SOURCES = \
TaxiHandler.cpp \
TemporarySummon.cpp \
TemporarySummon.h \
- tools.cpp \
- Tools.h \
TotemAI.cpp \
TotemAI.h \
Totem.cpp \
diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp
index e52afcb80a9..b6b224a2d6a 100644
--- a/src/game/MiscHandler.cpp
+++ b/src/game/MiscHandler.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);
diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp
index 2120c5dae70..0fa8e9573d0 100644
--- a/src/game/Opcodes.cpp
+++ b/src/game/Opcodes.cpp
@@ -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 },
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 712ecbc59ec..73d6ed1b899 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -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
diff --git a/src/game/Player.h b/src/game/Player.h
index 3b236c5e4e5..d46d6b69aaa 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -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; }
diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp
index f1466566ff1..8d5757595cb 100644
--- a/src/game/Spell.cpp
+++ b/src/game/Spell.cpp
@@ -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.
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 90e67dfe344..67791f825d4 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -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;
}
diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp
index d31c5610ee8..8648e7a76c6 100644
--- a/src/game/SpellHandler.cpp
+++ b/src/game/SpellHandler.cpp
@@ -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);
diff --git a/src/game/Tools.h b/src/game/Tools.h
deleted file mode 100644
index 03b48a7e9a3..00000000000
--- a/src/game/Tools.h
+++ /dev/null
@@ -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
diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h
index 385d37046e2..034036db887 100644
--- a/src/game/WorldSession.h
+++ b/src/game/WorldSession.h
@@ -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);
diff --git a/src/game/tools.cpp b/src/game/tools.cpp
deleted file mode 100644
index 7abc016df48..00000000000
--- a/src/game/tools.cpp
+++ /dev/null
@@ -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);
-}
diff --git a/src/shared/ByteBuffer.h b/src/shared/ByteBuffer.h
index 9bdd6067fbc..efd704a4904 100644
--- a/src/shared/ByteBuffer.h
+++ b/src/shared/ByteBuffer.h
@@ -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(); }
diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h
index ce7f38e6f56..f90b03cc3a6 100644
--- a/src/shared/revision_nr.h
+++ b/src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
- #define REVISION_NR "6949"
+ #define REVISION_NR "6955"
#endif // __REVISION_NR_H__