Merge branch 'master' into 303

Conflicts:
	contrib/extractor/System.cpp
	contrib/extractor/ad.exe
	src/game/WorldSocket.cpp
This commit is contained in:
tomrus88 2008-11-06 15:50:47 +03:00
commit 78ec66babc
78 changed files with 510 additions and 752 deletions

View file

@ -12,6 +12,7 @@
*.bsc *.bsc
*.ncb *.ncb
*.pdb
*.suo *.suo
debug debug
release release

View file

@ -39,7 +39,7 @@ enum Extract
}; };
int extract = EXTRACT_MAP | EXTRACT_DBC; int extract = EXTRACT_MAP | EXTRACT_DBC;
static char* const langs[]={"deDE", "enGB", "enUS", "esES", "frFR", "koKR", "zhCN", "zhTW", "enCN", "enTW", "esMX", "ruRU" }; static char* const langs[]={"enGB", "enUS", "deDE", "esES", "frFR", "koKR", "zhCN", "zhTW", "enCN", "enTW", "esMX", "ruRU" };
#define LANG_COUNT 12 #define LANG_COUNT 12
#define ADT_RES 64 #define ADT_RES 64
@ -167,11 +167,11 @@ void ExtractMapsFromMpq()
path += "/maps/"; path += "/maps/";
CreateDir(path); CreateDir(path);
for(int x = 0; x < ADT_RES; ++x) for(unsigned int x = 0; x < ADT_RES; ++x)
{ {
for(int y = 0; y < ADT_RES; ++y) for(unsigned int y = 0; y < ADT_RES; ++y)
{ {
for(int z = 0; z < map_count; ++z) for(unsigned int z = 0; z < map_count; ++z)
{ {
sprintf(mpq_filename,"World\\Maps\\%s\\%s_%u_%u.adt",map_ids[z].name,map_ids[z].name,x,y); sprintf(mpq_filename,"World\\Maps\\%s\\%s_%u_%u.adt",map_ids[z].name,map_ids[z].name,x,y);
sprintf(output_filename,"%s/maps/%03u%02u%02u.map",output_path,map_ids[z].id,y,x); sprintf(output_filename,"%s/maps/%03u%02u%02u.map",output_path,map_ids[z].id,y,x);
@ -189,7 +189,7 @@ void ExtractMapsFromMpq()
//bool WMO(char* filename); //bool WMO(char* filename);
void ExtractDBCFiles() void ExtractDBCFiles(int locale, bool basicLocale)
{ {
printf("Extracting dbc files...\n"); printf("Extracting dbc files...\n");
@ -198,26 +198,30 @@ void ExtractDBCFiles()
// get DBC file list // get DBC file list
for(ArchiveSet::iterator i = gOpenArchives.begin(); i != gOpenArchives.end();++i) for(ArchiveSet::iterator i = gOpenArchives.begin(); i != gOpenArchives.end();++i)
{ {
vector<string> files = (*i)->GetFileList(); vector<string> files;
(*i)->GetFileListTo(files);
for (vector<string>::iterator iter = files.begin(); iter != files.end(); ++iter) for (vector<string>::iterator iter = files.begin(); iter != files.end(); ++iter)
if (iter->rfind(".dbc") == iter->length() - strlen(".dbc")) if (iter->rfind(".dbc") == iter->length() - strlen(".dbc"))
dbcfiles.insert(*iter); dbcfiles.insert(*iter);
} }
std::string path = output_path; string path = output_path;
path += "/dbc/"; path += "/dbc/";
CreateDir(path); CreateDir(path);
if(!basicLocale)
{
path += langs[locale];
path += "/";
CreateDir(path);
}
// extract DBCs // extract DBCs
int count = 0; int count = 0;
for (set<string>::iterator iter = dbcfiles.begin(); iter != dbcfiles.end(); ++iter) for (set<string>::iterator iter = dbcfiles.begin(); iter != dbcfiles.end(); ++iter)
{ {
string filename = output_path; string filename = path;
filename += "/dbc/";
filename += (iter->c_str() + strlen("DBFilesClient\\")); filename += (iter->c_str() + strlen("DBFilesClient\\"));
//cout << filename << endl;
FILE *output=fopen(filename.c_str(),"wb"); FILE *output=fopen(filename.c_str(),"wb");
if(!output) if(!output)
{ {
@ -231,27 +235,10 @@ void ExtractDBCFiles()
fclose(output); fclose(output);
++count; ++count;
} }
printf("Extracted %u DBC files\n", count); printf("Extracted %u DBC files\n\n", count);
} }
int GetLocale() void LoadLocaleMPQFiles(int const locale)
{
for (int i = 0; i < LANG_COUNT; i++)
{
char tmp1[512];
sprintf(tmp1, "%s/Data/%s/locale-%s.MPQ", input_path, langs[i], langs[i]);
if (FileExists(tmp1))
{
printf("Detected locale: %s\n", langs[i]);
return i;
}
}
printf("Could not detect locale.\n");
return -1;
}
void LoadMPQFiles(int const locale)
{ {
char filename[512]; char filename[512];
@ -265,58 +252,100 @@ void LoadMPQFiles(int const locale)
sprintf(ext, "-%i", i); sprintf(ext, "-%i", i);
sprintf(filename,"%s/Data/%s/patch-%s%s.MPQ",input_path,langs[locale],langs[locale],ext); sprintf(filename,"%s/Data/%s/patch-%s%s.MPQ",input_path,langs[locale],langs[locale],ext);
if(!FileExists(filename)) if(FileExists(filename))
break;
new MPQArchive(filename);
}
//need those files only if extract maps
if(extract & EXTRACT_MAP)
{
sprintf(filename,"%s/Data/common-2.MPQ",input_path);
new MPQArchive(filename);
sprintf(filename,"%s/Data/lichking.MPQ",input_path);
new MPQArchive(filename);
sprintf(filename,"%s/Data/expansion.MPQ",input_path);
new MPQArchive(filename);
for(int i = 1; i < 5; ++i)
{
char ext[3] = "";
if(i > 1)
sprintf(ext, "-%i", i);
sprintf(filename,"%s/Data/patch%s.MPQ",input_path,ext);
if(!FileExists(filename))
break;
new MPQArchive(filename); new MPQArchive(filename);
}
} }
} }
void LoadCommonMPQFiles()
{
char filename[512];
sprintf(filename,"%s/Data/common-2.MPQ",input_path);
new MPQArchive(filename);
sprintf(filename,"%s/Data/lichking.MPQ",input_path);
new MPQArchive(filename);
sprintf(filename,"%s/Data/expansion.MPQ",input_path);
new MPQArchive(filename);
for(int i = 1; i < 5; ++i)
{
char ext[3] = "";
if(i > 1)
sprintf(ext, "-%i", i);
sprintf(filename,"%s/Data/patch%s.MPQ",input_path,ext);
if(FileExists(filename))
new MPQArchive(filename);
}
}
inline void CloseMPQFiles()
{
for(ArchiveSet::iterator j = gOpenArchives.begin(); j != gOpenArchives.end();++j) (*j)->close();
gOpenArchives.clear();
}
int main(int argc, char * arg[]) int main(int argc, char * arg[])
{ {
printf("Map & DBC Extractor\n"); printf("Map & DBC Extractor\n");
printf("===================\n"); printf("===================\n\n");
HandleArgs(argc, arg); HandleArgs(argc, arg);
int const locale = GetLocale(); int FirstLocale = -1;
if(locale < 0)
return 1;
LoadMPQFiles(locale); for (int i = 0; i < LANG_COUNT; i++)
{
char tmp1[512];
sprintf(tmp1, "%s/Data/%s/locale-%s.MPQ", input_path, langs[i], langs[i]);
if (FileExists(tmp1))
{
printf("Detected locale: %s\n", langs[i]);
if(extract & EXTRACT_DBC) //Open MPQs
ExtractDBCFiles(); LoadLocaleMPQFiles(i);
if(extract & EXTRACT_MAP) if((extract & EXTRACT_DBC) == 0)
{
FirstLocale=i;
break;
}
//Extract DBC files
if(FirstLocale<0)
{
ExtractDBCFiles(i, true);
FirstLocale = i;
}
else
ExtractDBCFiles(i, false);
//Close MPQs
CloseMPQFiles();
}
}
if(FirstLocale<0)
{
printf("No locales detected\n");
return 0;
}
if (extract & EXTRACT_MAP)
{
printf("Using locale: %s\n", langs[FirstLocale]);
// Open MPQs
LoadLocaleMPQFiles(FirstLocale);
LoadCommonMPQFiles();
// Extract maps
ExtractMapsFromMpq(); ExtractMapsFromMpq();
//Close MPQs // Close MPQs
for(ArchiveSet::iterator i = gOpenArchives.begin(); i != gOpenArchives.end();++i) CloseMPQFiles();
(*i)->close(); }
gOpenArchives.clear();
return 0; return 0;
} }

View file

@ -52,10 +52,10 @@
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
PrecompiledHeaderFile="c:\windows\temp/ad.pch" PrecompiledHeaderFile="$(IntDir)ad.pch"
AssemblerListingLocation="c:\windows\temp/" AssemblerListingLocation="$(IntDir)\"
ObjectFile="c:\windows\temp/" ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="c:\windows\temp/" ProgramDataBaseFileName="$(IntDir)\"
BrowseInformation="1" BrowseInformation="1"
WarningLevel="3" WarningLevel="3"
SuppressStartupBanner="true" SuppressStartupBanner="true"
@ -149,10 +149,10 @@
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0" RuntimeLibrary="0"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
PrecompiledHeaderFile="c:\windows\temp/ad.pch" PrecompiledHeaderFile="$(IntDir)ad.pch"
AssemblerListingLocation="c:\windows\temp/" AssemblerListingLocation="$(IntDir)\"
ObjectFile="c:\windows\temp/" ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="c:\windows\temp/" ProgramDataBaseFileName="$(IntDir)\"
WarningLevel="3" WarningLevel="3"
SuppressStartupBanner="true" SuppressStartupBanner="true"
/> />

View file

@ -54,10 +54,11 @@
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
PrecompiledHeaderFile="c:\windows\temp/ad.pch" PrecompiledHeaderFile="$(IntDir)ad.pch"
AssemblerListingLocation="c:\windows\temp/" AssemblerListingLocation="$(IntDir)\"
ObjectFile="c:\windows\temp/" ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="c:\windows\temp/" ProgramDataBaseFileName="$(IntDir)\"
XMLDocumentationFileName="$(IntDir)\"
BrowseInformation="1" BrowseInformation="1"
WarningLevel="3" WarningLevel="3"
SuppressStartupBanner="true" SuppressStartupBanner="true"
@ -80,7 +81,7 @@
OutputFile="ad debug.exe" OutputFile="ad debug.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
AdditionalLibraryDirectories="./debug/" AdditionalLibraryDirectories="./debug"
IgnoreDefaultLibraryNames="LIBCD.lib" IgnoreDefaultLibraryNames="LIBCD.lib"
GenerateDebugInformation="true" GenerateDebugInformation="true"
ProgramDatabaseFile="./ad debug.pdb" ProgramDatabaseFile="./ad debug.pdb"
@ -153,9 +154,10 @@
RuntimeLibrary="0" RuntimeLibrary="0"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
PrecompiledHeaderFile="c:\windows\temp/ad.pch" PrecompiledHeaderFile="c:\windows\temp/ad.pch"
AssemblerListingLocation="c:\windows\temp/" AssemblerListingLocation="$(IntDir)\"
ObjectFile="c:\windows\temp/" ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="c:\windows\temp/" ProgramDataBaseFileName="$(IntDir)\"
XMLDocumentationFileName="$(IntDir)\"
WarningLevel="3" WarningLevel="3"
SuppressStartupBanner="true" SuppressStartupBanner="true"
/> />
@ -176,7 +178,7 @@
OutputFile="./ad.exe" OutputFile="./ad.exe"
LinkIncremental="1" LinkIncremental="1"
SuppressStartupBanner="true" SuppressStartupBanner="true"
AdditionalLibraryDirectories="./release/" AdditionalLibraryDirectories="./release"
IgnoreDefaultLibraryNames="LIBC.lib" IgnoreDefaultLibraryNames="LIBC.lib"
ProgramDatabaseFile="./ad.pdb" ProgramDatabaseFile="./ad.pdb"
SubSystem="1" SubSystem="1"

View file

@ -4,6 +4,7 @@
Version="9,00" Version="9,00"
Name="ad" Name="ad"
ProjectGUID="{D7552D4F-408F-4F8E-859B-366659150CF4}" ProjectGUID="{D7552D4F-408F-4F8E-859B-366659150CF4}"
RootNamespace="ad"
TargetFrameworkVersion="131072" TargetFrameworkVersion="131072"
> >
<Platforms> <Platforms>
@ -53,11 +54,13 @@
BasicRuntimeChecks="3" BasicRuntimeChecks="3"
RuntimeLibrary="1" RuntimeLibrary="1"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
PrecompiledHeaderFile="c:\windows\temp/ad.pch" PrecompiledHeaderFile="$(IntDir)ad.pch"
AssemblerListingLocation="c:\windows\temp/" AssemblerListingLocation="$(IntDir)\"
ObjectFile="c:\windows\temp/" ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="c:\windows\temp/" ProgramDataBaseFileName="$(IntDir)\"
XMLDocumentationFileName="$(IntDir)\"
BrowseInformation="1" BrowseInformation="1"
BrowseInformationFile="$(IntDir)"
WarningLevel="3" WarningLevel="3"
SuppressStartupBanner="true" SuppressStartupBanner="true"
DebugInformationFormat="4" DebugInformationFormat="4"
@ -149,10 +152,11 @@
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
RuntimeLibrary="0" RuntimeLibrary="0"
UsePrecompiledHeader="0" UsePrecompiledHeader="0"
PrecompiledHeaderFile="c:\windows\temp/ad.pch" PrecompiledHeaderFile="$(IntDir)ad.pch"
AssemblerListingLocation="c:\windows\temp/" AssemblerListingLocation="$(IntDir)\"
ObjectFile="c:\windows\temp/" ObjectFile="$(IntDir)\"
ProgramDataBaseFileName="c:\windows\temp/" ProgramDataBaseFileName="$(IntDir)\"
XMLDocumentationFileName="$(IntDir)\"
WarningLevel="3" WarningLevel="3"
SuppressStartupBanner="true" SuppressStartupBanner="true"
/> />

View file

@ -199,7 +199,7 @@ int libmpq_archive_info(mpq_archive *mpq_a, unsigned int infotype) {
/* /*
* This function returns some useful file information. * This function returns some useful file information.
*/ */
int libmpq_file_info(mpq_archive *mpq_a, unsigned int infotype, const int number) { int libmpq_file_info(mpq_archive *mpq_a, unsigned int infotype, const unsigned int number) {
int blockindex = number; //-1; int blockindex = number; //-1;
int i = 0; int i = 0;
mpq_block *mpq_b = NULL; mpq_block *mpq_b = NULL;

View file

@ -198,7 +198,7 @@ extern int libmpq_archive_open(mpq_archive *mpq_a, unsigned char *mpq_filename);
extern int libmpq_archive_close(mpq_archive *mpq_a); extern int libmpq_archive_close(mpq_archive *mpq_a);
extern int libmpq_archive_info(mpq_archive *mpq_a, unsigned int infotype); extern int libmpq_archive_info(mpq_archive *mpq_a, unsigned int infotype);
//extern int libmpq_file_extract(mpq_archive *mpq_a, const int number); //extern int libmpq_file_extract(mpq_archive *mpq_a, const int number);
extern int libmpq_file_info(mpq_archive *mpq_a, unsigned int infotype, const int number); extern int libmpq_file_info(mpq_archive *mpq_a, unsigned int infotype, const unsigned int number);
extern char *libmpq_file_name(mpq_archive *mpq_a, const int number); extern char *libmpq_file_name(mpq_archive *mpq_a, const int number);
extern int libmpq_file_number(mpq_archive *mpq_a, const char *name); extern int libmpq_file_number(mpq_archive *mpq_a, const char *name);
extern int libmpq_file_check(mpq_archive *mpq_a, void *file, int type); extern int libmpq_file_check(mpq_archive *mpq_a, void *file, int type);

View file

@ -79,7 +79,7 @@ int libmpq_conf_parse_line(char *line, char *search_value, char *return_value, i
} }
/* now search for comment in this line */ /* now search for comment in this line */
for (i = 0; i < strlen(line); i++) { for (i = 0; i < int(strlen(line)); i++) {
if (line[i] == '#') { if (line[i] == '#') {
pos = i - 1; pos = i - 1;
break; break;

View file

@ -71,7 +71,7 @@ MPQFile::MPQFile(const char* filename):
continue; //file not found continue; //file not found
} }
int fileno = blockindex; uint32 fileno = blockindex;
//int fileno = libmpq_file_number(&mpq_a, filename); //int fileno = libmpq_file_number(&mpq_a, filename);
//if(fileno == LIBMPQ_EFILE_NOT_FOUND) //if(fileno == LIBMPQ_EFILE_NOT_FOUND)

View file

@ -51,14 +51,12 @@ public:
return nullhash; return nullhash;
} }
vector<string> GetFileList() { void GetFileListTo(vector<string>& filelist) {
vector<string> filelist;
mpq_hash hash = GetHashEntry("(listfile)"); mpq_hash hash = GetHashEntry("(listfile)");
uint32 blockindex = hash.blockindex; uint32 blockindex = hash.blockindex;
if ((blockindex == 0xFFFFFFFF) || (blockindex == 0)) if ((blockindex == 0xFFFFFFFF) || (blockindex == 0))
return filelist; return;
uint32 size = libmpq_file_info(&mpq_a, LIBMPQ_FILE_UNCOMPRESSED_SIZE, blockindex); uint32 size = libmpq_file_info(&mpq_a, LIBMPQ_FILE_UNCOMPRESSED_SIZE, blockindex);
char *buffer = new char[size]; char *buffer = new char[size];
@ -79,8 +77,7 @@ public:
token = strtok(NULL, seps); token = strtok(NULL, seps);
} }
delete buffer; delete[] buffer;
return filelist;
} }
}; };
typedef std::deque<MPQArchive*> ArchiveSet; typedef std::deque<MPQArchive*> ArchiveSet;

View file

@ -24,6 +24,7 @@
#include "Policies/Singleton.h" #include "Policies/Singleton.h"
#include <string> #include <string>
#include <vector>
#include <map> #include <map>
/** ObjectRegistry holds all registry item of the same type /** ObjectRegistry holds all registry item of the same type

View file

@ -140,7 +140,7 @@ namespace MaNGOS
void _Execute() { (*m_method)(m_param1, m_param2, m_param3); } void _Execute() { (*m_method)(m_param1, m_param2, m_param3); }
public: public:
_SCallback(Method method, ParamType1 param1, ParamType2 param2, ParamType3 param3) _SCallback(Method method, ParamType1 param1, ParamType2 param2, ParamType3 param3)
: m_method(method), m_param1(param1), m_param2(param2) {} : m_method(method), m_param1(param1), m_param2(param2), m_param3(param3) {}
_SCallback(_SCallback < ParamType1, ParamType2, ParamType3 > const& cb) _SCallback(_SCallback < ParamType1, ParamType2, ParamType3 > const& cb)
: m_method(cb.m_method), m_param1(cb.m_param1), m_param2(cb.m_param2), m_param3(cb.m_param3) {} : m_method(cb.m_method), m_param1(cb.m_param1), m_param2(cb.m_param2), m_param3(cb.m_param3) {}
}; };

View file

@ -57,13 +57,7 @@ bool ArenaTeam::create(uint64 captainGuid, uint32 type, std::string ArenaTeamNam
Name = ArenaTeamName; Name = ArenaTeamName;
Type = type; Type = type;
QueryResult *result = CharacterDatabase.Query("SELECT MAX(arenateamid) FROM arena_team"); Id = objmgr.GenerateArenaTeamId();
if( result )
{
Id = (*result)[0].GetUInt32()+1;
delete result;
}
else Id = 1;
// ArenaTeamName already assigned to ArenaTeam::name, use it to encode string for DB // ArenaTeamName already assigned to ArenaTeam::name, use it to encode string for DB
CharacterDatabase.escape_string(ArenaTeamName); CharacterDatabase.escape_string(ArenaTeamName);

View file

@ -674,7 +674,7 @@ void BattleGround::Reset()
m_PlayerScores.clear(); m_PlayerScores.clear();
// reset BGSubclass // reset BGSubclass
this->ResetBGSubclass(); ResetBGSubclass();
} }
void BattleGround::StartBattleGround() void BattleGround::StartBattleGround()
@ -1034,7 +1034,7 @@ bool BattleGround::AddSpiritGuide(uint32 type, float x, float y, float z, float
if(!pCreature) if(!pCreature)
{ {
sLog.outError("Can't create Spirit guide. BattleGround not created!"); sLog.outError("Can't create Spirit guide. BattleGround not created!");
this->EndNow(); EndNow();
return false; return false;
} }

View file

@ -133,10 +133,10 @@ void BattleGroundEY::Update(time_t diff)
/*I used this order of calls, because although we will check if one player is in gameobject's distance 2 times /*I used this order of calls, because although we will check if one player is in gameobject's distance 2 times
but we can count of players on current point in CheckSomeoneLeftPoint but we can count of players on current point in CheckSomeoneLeftPoint
*/ */
this->CheckSomeoneJoinedPoint(); CheckSomeoneJoinedPoint();
//check if player left point //check if player left point
this->CheckSomeoneLeftPoint(); CheckSomeoneLeftPoint();
this->UpdatePointStatuses(); UpdatePointStatuses();
m_TowerCapCheckTimer = BG_EY_FPOINTS_TICK_TIME; m_TowerCapCheckTimer = BG_EY_FPOINTS_TICK_TIME;
} }
} }
@ -221,7 +221,7 @@ void BattleGroundEY::CheckSomeoneLeftPoint()
{ {
m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]); m_PlayersNearPoint[EY_POINTS_MAX].push_back(m_PlayersNearPoint[i][j]);
m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j); m_PlayersNearPoint[i].erase(m_PlayersNearPoint[i].begin() + j);
this->UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW, plr); UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW, plr);
} }
else else
{ {
@ -264,17 +264,17 @@ void BattleGroundEY::UpdatePointStatuses()
Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[point][i]); Player *plr = objmgr.GetPlayer(m_PlayersNearPoint[point][i]);
if (plr) if (plr)
{ {
this->UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[point], plr); UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, m_PointBarStatus[point], plr);
//if point owner changed we must evoke event! //if point owner changed we must evoke event!
if (pointOwnerTeamId != m_PointOwnedByTeam[point]) if (pointOwnerTeamId != m_PointOwnedByTeam[point])
{ {
//point was uncontrolled and player is from team which captured point //point was uncontrolled and player is from team which captured point
if (m_PointState[point] == EY_POINT_STATE_UNCONTROLLED && plr->GetTeam() == pointOwnerTeamId) if (m_PointState[point] == EY_POINT_STATE_UNCONTROLLED && plr->GetTeam() == pointOwnerTeamId)
this->EventTeamCapturedPoint(plr, point); EventTeamCapturedPoint(plr, point);
//point was under control and player isn't from team which controlled it //point was under control and player isn't from team which controlled it
if (m_PointState[point] == EY_POINT_UNDER_CONTROL && plr->GetTeam() != m_PointOwnedByTeam[point]) if (m_PointState[point] == EY_POINT_UNDER_CONTROL && plr->GetTeam() != m_PointOwnedByTeam[point])
this->EventTeamLostPoint(plr, point); EventTeamLostPoint(plr, point);
} }
} }
} }
@ -350,7 +350,7 @@ void BattleGroundEY::RemovePlayer(Player *plr, uint64 guid)
if(m_FlagKeeper == guid) if(m_FlagKeeper == guid)
{ {
if(plr) if(plr)
this->EventPlayerDroppedFlag(plr); EventPlayerDroppedFlag(plr);
else else
{ {
SetFlagPicker(0); SetFlagPicker(0);
@ -610,7 +610,7 @@ void BattleGroundEY::EventPlayerDroppedFlag(Player *Source)
void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj) void BattleGroundEY::EventPlayerClickedOnFlag(Player *Source, GameObject* target_obj)
{ {
if(GetStatus() != STATUS_IN_PROGRESS || this->IsFlagPickedup() || !Source->IsWithinDistInMap(target_obj, 10)) if(GetStatus() != STATUS_IN_PROGRESS || IsFlagPickedup() || !Source->IsWithinDistInMap(target_obj, 10))
return; return;
const char *message; const char *message;
@ -750,7 +750,7 @@ void BattleGroundEY::EventTeamCapturedPoint(Player *Source, uint32 Point)
void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType) void BattleGroundEY::EventPlayerCapturedFlag(Player *Source, uint32 BgObjectType)
{ {
if(GetStatus() != STATUS_IN_PROGRESS || this->GetFlagPickerGUID() != Source->GetGUID()) if(GetStatus() != STATUS_IN_PROGRESS || GetFlagPickerGUID() != Source->GetGUID())
return; return;
uint8 type = 0; uint8 type = 0;

View file

@ -310,7 +310,7 @@ void WorldSession::HandleBattleGroundPlayerPortOpcode( WorldPacket &recv_data )
// if the player is dead, resurrect him before teleport // if the player is dead, resurrect him before teleport
if(!_player->isAlive()) if(!_player->isAlive())
{ {
_player->ResurrectPlayer(1.0f,false); _player->ResurrectPlayer(1.0f);
_player->SpawnCorpseBones(); _player->SpawnCorpseBones();
} }

View file

@ -80,7 +80,7 @@ void BattleGroundQueue::AddPlayer(Player *plr, uint32 bgTypeId)
else else
++m_QueuedPlayers[queue_id].Horde; ++m_QueuedPlayers[queue_id].Horde;
this->Update(bgTypeId, queue_id); Update(bgTypeId, queue_id);
if( sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE) ) if( sWorld.getConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE) )
{ {
@ -183,7 +183,7 @@ void BattleGroundQueue::Update(uint32 bgTypeId, uint32 queue_id)
} }
//if no players in queue ... do nothing //if no players in queue ... do nothing
if (this->m_QueuedPlayers[queue_id].Alliance == 0 && this->m_QueuedPlayers[queue_id].Horde == 0) if (m_QueuedPlayers[queue_id].Alliance == 0 && m_QueuedPlayers[queue_id].Horde == 0)
return; return;
//battleground with free slot for player should be always the last in this queue //battleground with free slot for player should be always the last in this queue
@ -628,7 +628,7 @@ void BattleGroundMgr::BuildPlayerJoinedBattleGroundPacket(WorldPacket *data, Pla
void BattleGroundMgr::InvitePlayer(Player* plr, uint32 bgInstanceGUID) void BattleGroundMgr::InvitePlayer(Player* plr, uint32 bgInstanceGUID)
{ {
// set invited player counters: // set invited player counters:
BattleGround* bg = this->GetBattleGround(bgInstanceGUID); BattleGround* bg = GetBattleGround(bgInstanceGUID);
if(!bg) if(!bg)
return; return;

View file

@ -217,7 +217,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT); Source->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
if(Source->GetTeam() == ALLIANCE) if(Source->GetTeam() == ALLIANCE)
{ {
if (!this->IsHordeFlagPickedup()) if (!IsHordeFlagPickedup())
return; return;
SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time SetHordeFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// horde flag in base (but not respawned yet) // horde flag in base (but not respawned yet)
@ -234,7 +234,7 @@ void BattleGroundWS::EventPlayerCapturedFlag(Player *Source)
} }
else else
{ {
if (!this->IsAllianceFlagPickedup()) if (!IsAllianceFlagPickedup())
return; return;
SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time SetAllianceFlagPicker(0); // must be before aura remove to prevent 2 events (drop+capture) at the same time
// alliance flag in base (but not respawned yet) // alliance flag in base (but not respawned yet)
@ -293,7 +293,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
if(Source->GetTeam() == ALLIANCE) if(Source->GetTeam() == ALLIANCE)
{ {
if(!this->IsHordeFlagPickedup()) if(!IsHordeFlagPickedup())
return; return;
if(GetHordeFlagPickerGUID() == Source->GetGUID()) if(GetHordeFlagPickerGUID() == Source->GetGUID())
{ {
@ -308,7 +308,7 @@ void BattleGroundWS::EventPlayerDroppedFlag(Player *Source)
} }
else else
{ {
if(!this->IsAllianceFlagPickedup()) if(!IsAllianceFlagPickedup())
return; return;
if(GetAllianceFlagPickerGUID() == Source->GetGUID()) if(GetAllianceFlagPickerGUID() == Source->GetGUID())
{ {
@ -345,12 +345,12 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
if(GetStatus() != STATUS_IN_PROGRESS) if(GetStatus() != STATUS_IN_PROGRESS)
return; return;
const char *message; const char *message = NULL;
uint8 type = 0; uint8 type = 0;
//alliance flag picked up from base //alliance flag picked up from base
if(Source->GetTeam() == HORDE && this->GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE if(Source->GetTeam() == HORDE && GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE
&& this->m_BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID()) && m_BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID())
{ {
message = GetMangosString(LANG_BG_WS_PICKEDUP_AF); message = GetMangosString(LANG_BG_WS_PICKEDUP_AF);
type = CHAT_MSG_BG_SYSTEM_HORDE; type = CHAT_MSG_BG_SYSTEM_HORDE;
@ -365,8 +365,8 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
} }
//horde flag picked up from base //horde flag picked up from base
if (Source->GetTeam() == ALLIANCE && this->GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE if (Source->GetTeam() == ALLIANCE && GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE
&& this->m_BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID()) && m_BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID())
{ {
message = GetMangosString(LANG_BG_WS_PICKEDUP_HF); message = GetMangosString(LANG_BG_WS_PICKEDUP_HF);
type = CHAT_MSG_BG_SYSTEM_ALLIANCE; type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
@ -381,7 +381,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
} }
//Alliance flag on ground(not in base) (returned or picked up again from ground!) //Alliance flag on ground(not in base) (returned or picked up again from ground!)
if(this->GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10)) if(GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10))
{ {
if(Source->GetTeam() == ALLIANCE) if(Source->GetTeam() == ALLIANCE)
{ {
@ -410,7 +410,7 @@ void BattleGroundWS::EventPlayerClickedOnFlag(Player *Source, GameObject* target
} }
//Horde flag on ground(not in base) (returned or picked up again) //Horde flag on ground(not in base) (returned or picked up again)
if(this->GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10)) if(GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10))
{ {
if(Source->GetTeam() == HORDE) if(Source->GetTeam() == HORDE)
{ {
@ -455,22 +455,22 @@ void BattleGroundWS::RemovePlayer(Player *plr, uint64 guid)
if(!plr) if(!plr)
{ {
sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!"); sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!");
this->SetAllianceFlagPicker(0); SetAllianceFlagPicker(0);
this->RespawnFlag(ALLIANCE, false); RespawnFlag(ALLIANCE, false);
} }
else else
this->EventPlayerDroppedFlag(plr); EventPlayerDroppedFlag(plr);
} }
if(IsHordeFlagPickedup() && m_FlagKeepers[BG_TEAM_HORDE] == guid) if(IsHordeFlagPickedup() && m_FlagKeepers[BG_TEAM_HORDE] == guid)
{ {
if(!plr) if(!plr)
{ {
sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!"); sLog.outError("BattleGroundWS: Removing offline player who has the FLAG!!");
this->SetHordeFlagPicker(0); SetHordeFlagPicker(0);
this->RespawnFlag(HORDE, false); RespawnFlag(HORDE, false);
} }
else else
this->EventPlayerDroppedFlag(plr); EventPlayerDroppedFlag(plr);
} }
} }

View file

@ -119,7 +119,7 @@ struct MANGOS_DLL_DECL Cell
Cell& operator=(const Cell &cell) Cell& operator=(const Cell &cell)
{ {
this->data.All = cell.data.All; data.All = cell.data.All;
return *this; return *this;
} }
@ -154,7 +154,7 @@ struct MANGOS_DLL_DECL CellLock
operator const Cell &(void) const { return i_cell; } operator const Cell &(void) const { return i_cell; }
CellLock<T>& operator=(const CellLock<T> &cell) CellLock<T>& operator=(const CellLock<T> &cell)
{ {
this->~CellLock(); ~CellLock();
new (this) CellLock<T>(cell); new (this) CellLock<T>(cell);
return *this; return *this;
} }

View file

@ -137,7 +137,7 @@ void Corpse::DeleteFromDB()
CharacterDatabase.PExecute("DELETE FROM corpse WHERE player = '%d' AND corpse_type <> '0'", GUID_LOPART(GetOwnerGUID())); CharacterDatabase.PExecute("DELETE FROM corpse WHERE player = '%d' AND corpse_type <> '0'", GUID_LOPART(GetOwnerGUID()));
} }
bool Corpse::LoadFromDB(uint32 guid, QueryResult *result, uint32 InstanceId) bool Corpse::LoadFromDB(uint32 guid, QueryResult *result)
{ {
bool external = (result != NULL); bool external = (result != NULL);
if (!external) if (!external)

View file

@ -59,7 +59,7 @@ class Corpse : public WorldObject
bool Create( uint32 guidlow, Player *owner, uint32 mapid, float x, float y, float z, float ang ); bool Create( uint32 guidlow, Player *owner, uint32 mapid, float x, float y, float z, float ang );
void SaveToDB(); void SaveToDB();
bool LoadFromDB(uint32 guid, QueryResult *result, uint32 InstanceId); bool LoadFromDB(uint32 guid, QueryResult *result);
bool LoadFromDB(uint32 guid, Field *fields); bool LoadFromDB(uint32 guid, Field *fields);
void DeleteBonesFromWorld(); void DeleteBonesFromWorld();

View file

@ -17,10 +17,7 @@
*/ */
#include "CreatureAI.h" #include "CreatureAI.h"
#include "HateMatrix.h"
CreatureAI::~CreatureAI() CreatureAI::~CreatureAI()
{ {
} }
uint32 HateBinder::si_noHateValue=0;

View file

@ -105,7 +105,7 @@ void WorldSession::HandleGMTicketCreateOpcode( WorldPacket & recv_data )
CharacterDatabase.escape_string(ticketText); CharacterDatabase.escape_string(ticketText);
if(GMTicket* ticket = ticketmgr.GetGMTicket(GetPlayer()->GetGUIDLow())) if(ticketmgr.GetGMTicket(GetPlayer()->GetGUIDLow()))
{ {
WorldPacket data( SMSG_GMTICKET_CREATE, 4 ); WorldPacket data( SMSG_GMTICKET_CREATE, 4 );
data << uint32(1); data << uint32(1);

View file

@ -423,7 +423,7 @@ void GameObject::Update(uint32 /*p_time*/)
//burning flags in some battlegrounds, if you find better condition, just add it //burning flags in some battlegrounds, if you find better condition, just add it
if (GetGoAnimProgress() > 0) if (GetGoAnimProgress() > 0)
{ {
SendObjectDeSpawnAnim(this->GetGUID()); SendObjectDeSpawnAnim(GetGUID());
//reset flags //reset flags
SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags); SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags);
} }
@ -571,7 +571,7 @@ bool GameObject::LoadFromDB(uint32 guid, Map *map)
} }
uint32 entry = data->id; uint32 entry = data->id;
uint32 map_id = data->mapid; //uint32 map_id = data->mapid; // already used before call
float x = data->posX; float x = data->posX;
float y = data->posY; float y = data->posY;
float z = data->posZ; float z = data->posZ;

View file

@ -472,7 +472,7 @@ namespace MaNGOS
return false; return false;
} }
template<class NOT_INTERESTED> bool operator()(NOT_INTERESTED* u) { return false; } template<class NOT_INTERESTED> bool operator()(NOT_INTERESTED*) { return false; }
private: private:
Unit* const i_funit; Unit* const i_funit;
float i_range; float i_range;

View file

@ -48,7 +48,7 @@ ActiveState::Update(Map &m, NGridType &grid, GridInfo & info, const uint32 &x, c
} }
void void
IdleState::Update(Map &m, NGridType &grid, GridInfo &info, const uint32 &x, const uint32 &y, const uint32 &) const IdleState::Update(Map &m, NGridType &grid, GridInfo &, const uint32 &x, const uint32 &y, const uint32 &) const
{ {
m.ResetGridExpiry(grid); m.ResetGridExpiry(grid);
grid.SetGridState(GRID_STATE_REMOVAL); grid.SetGridState(GRID_STATE_REMOVAL);

View file

@ -1305,7 +1305,7 @@ void Group::UpdateLooterGuid( Creature* creature, bool ifneed )
void Roll::targetObjectBuildLink() void Roll::targetObjectBuildLink()
{ {
// called from link() // called from link()
this->getTarget()->addLootValidatorRef(this); getTarget()->addLootValidatorRef(this);
} }
void Group::SetDifficulty(uint8 difficulty) void Group::SetDifficulty(uint8 difficulty)

View file

@ -636,7 +636,7 @@ void WorldSession::HandleRaidReadyCheckOpcode( WorldPacket & recv_data )
} }
} }
void WorldSession::HandleRaidReadyCheckFinishOpcode( WorldPacket & recv_data ) void WorldSession::HandleRaidReadyCheckFinishOpcode( WorldPacket & /*recv_data*/ )
{ {
//Group* group = GetPlayer()->GetGroup(); //Group* group = GetPlayer()->GetGroup();
//if(!group) //if(!group)

View file

@ -69,13 +69,7 @@ bool Guild::create(uint64 lGuid, std::string gname)
guildbank_money = 0; guildbank_money = 0;
purchased_tabs = 0; purchased_tabs = 0;
QueryResult *result = CharacterDatabase.Query( "SELECT MAX(guildid) FROM guild" ); Id = objmgr.GenerateGuildId();
if( result )
{
Id = (*result)[0].GetUInt32()+1;
delete result;
}
else Id = 1;
// gname already assigned to Guild::name, use it to encode string for DB // gname already assigned to Guild::name, use it to encode string for DB
CharacterDatabase.escape_string(gname); CharacterDatabase.escape_string(gname);
@ -110,8 +104,17 @@ bool Guild::create(uint64 lGuid, std::string gname)
bool Guild::AddMember(uint64 plGuid, uint32 plRank) bool Guild::AddMember(uint64 plGuid, uint32 plRank)
{ {
if(Player::GetGuildIdFromDB(plGuid) != 0) // player already in guild Player* pl = objmgr.GetPlayer(plGuid);
return false; if(pl)
{
if(pl->GetGuildId() != 0)
return false;
}
else
{
if(Player::GetGuildIdFromDB(plGuid) != 0) // player already in guild
return false;
}
// remove all player signs from another petitions // remove all player signs from another petitions
// this will be prevent attempt joining player to many guilds and corrupt guild data integrity // this will be prevent attempt joining player to many guilds and corrupt guild data integrity
@ -140,7 +143,6 @@ bool Guild::AddMember(uint64 plGuid, uint32 plRank)
CharacterDatabase.PExecute("INSERT INTO guild_member (guildid,guid,rank,pnote,offnote) VALUES ('%u', '%u', '%u','%s','%s')", CharacterDatabase.PExecute("INSERT INTO guild_member (guildid,guid,rank,pnote,offnote) VALUES ('%u', '%u', '%u','%s','%s')",
Id, GUID_LOPART(plGuid), newmember.RankId, dbPnote.c_str(), dbOFFnote.c_str()); Id, GUID_LOPART(plGuid), newmember.RankId, dbPnote.c_str(), dbOFFnote.c_str());
Player* pl = objmgr.GetPlayer(plGuid);
if(pl) if(pl)
{ {
pl->SetInGuild(Id); pl->SetInGuild(Id);
@ -410,18 +412,16 @@ void Guild::LoadPlayerStatsByGuid(uint64 guid)
void Guild::SetLeader(uint64 guid) void Guild::SetLeader(uint64 guid)
{ {
leaderGuid = guid; leaderGuid = guid;
this->ChangeRank(guid, GR_GUILDMASTER); ChangeRank(guid, GR_GUILDMASTER);
CharacterDatabase.PExecute("UPDATE guild SET leaderguid='%u' WHERE guildid='%u'", GUID_LOPART(guid), Id); CharacterDatabase.PExecute("UPDATE guild SET leaderguid='%u' WHERE guildid='%u'", GUID_LOPART(guid), Id);
} }
void Guild::DelMember(uint64 guid, bool isDisbanding) void Guild::DelMember(uint64 guid, bool isDisbanding)
{ {
if(this->leaderGuid == guid && !isDisbanding) if(leaderGuid == guid && !isDisbanding)
{ {
std::ostringstream ss; QueryResult *result = CharacterDatabase.PQuery("SELECT guid FROM guild_member WHERE guildid='%u' AND guid != '%u' ORDER BY rank ASC LIMIT 1", Id, GUID_LOPART(leaderGuid));
ss<<"SELECT guid FROM guild_member WHERE guildid='"<<Id<<"' AND guid!='"<<this->leaderGuid<<"' ORDER BY rank ASC LIMIT 1";
QueryResult *result = CharacterDatabase.Query( ss.str().c_str() );
if( result ) if( result )
{ {
uint64 newLeaderGUID; uint64 newLeaderGUID;
@ -431,7 +431,7 @@ void Guild::DelMember(uint64 guid, bool isDisbanding)
newLeaderGUID = (*result)[0].GetUInt64(); newLeaderGUID = (*result)[0].GetUInt64();
delete result; delete result;
this->SetLeader(newLeaderGUID); SetLeader(newLeaderGUID);
newLeader = objmgr.GetPlayer(newLeaderGUID); newLeader = objmgr.GetPlayer(newLeaderGUID);
if(newLeader) if(newLeader)
@ -453,20 +453,20 @@ void Guild::DelMember(uint64 guid, bool isDisbanding)
data << (uint8)2; data << (uint8)2;
data << oldLeaderName; data << oldLeaderName;
data << newLeaderName; data << newLeaderName;
this->BroadcastPacket(&data); BroadcastPacket(&data);
data.Initialize(SMSG_GUILD_EVENT, (1+1+oldLeaderName.size()+1)); data.Initialize(SMSG_GUILD_EVENT, (1+1+oldLeaderName.size()+1));
data << (uint8)GE_LEFT; data << (uint8)GE_LEFT;
data << (uint8)1; data << (uint8)1;
data << oldLeaderName; data << oldLeaderName;
this->BroadcastPacket(&data); BroadcastPacket(&data);
} }
sLog.outDebug( "WORLD: Sent (SMSG_GUILD_EVENT)" ); sLog.outDebug( "WORLD: Sent (SMSG_GUILD_EVENT)" );
} }
else else
{ {
this->Disband(); Disband();
return; return;
} }
} }
@ -658,11 +658,20 @@ void Guild::SetRankRights(uint32 rankId, uint32 rights)
CharacterDatabase.PExecute("UPDATE guild_rank SET rights='%u' WHERE rid='%u' AND guildid='%u'", rights, (rankId+1), Id); CharacterDatabase.PExecute("UPDATE guild_rank SET rights='%u' WHERE rid='%u' AND guildid='%u'", rights, (rankId+1), Id);
} }
int32 Guild::GetRank(uint32 LowGuid)
{
MemberList::iterator itr = members.find(LowGuid);
if (itr==members.end())
return -1;
return itr->second.RankId;
}
void Guild::Disband() void Guild::Disband()
{ {
WorldPacket data(SMSG_GUILD_EVENT, 1); WorldPacket data(SMSG_GUILD_EVENT, 1);
data << (uint8)GE_DISBANDED; data << (uint8)GE_DISBANDED;
this->BroadcastPacket(&data); BroadcastPacket(&data);
while (!members.empty()) while (!members.empty())
{ {
@ -763,11 +772,11 @@ void Guild::Query(WorldSession *session)
void Guild::SetEmblem(uint32 emblemStyle, uint32 emblemColor, uint32 borderStyle, uint32 borderColor, uint32 backgroundColor) void Guild::SetEmblem(uint32 emblemStyle, uint32 emblemColor, uint32 borderStyle, uint32 borderColor, uint32 backgroundColor)
{ {
this->EmblemStyle = emblemStyle; EmblemStyle = emblemStyle;
this->EmblemColor = emblemColor; EmblemColor = emblemColor;
this->BorderStyle = borderStyle; BorderStyle = borderStyle;
this->BorderColor = borderColor; BorderColor = borderColor;
this->BackgroundColor = backgroundColor; BackgroundColor = backgroundColor;
CharacterDatabase.PExecute("UPDATE guild SET EmblemStyle=%u, EmblemColor=%u, BorderStyle=%u, BorderColor=%u, BackgroundColor=%u WHERE guildid = %u", EmblemStyle, EmblemColor, BorderStyle, BorderColor, BackgroundColor, Id); CharacterDatabase.PExecute("UPDATE guild SET EmblemStyle=%u, EmblemColor=%u, BorderStyle=%u, BorderColor=%u, BackgroundColor=%u WHERE guildid = %u", EmblemStyle, EmblemColor, BorderStyle, BorderColor, BackgroundColor, Id);
} }
@ -951,15 +960,10 @@ void Guild::DisplayGuildBankMoneyUpdate()
WorldPacket data(SMSG_GUILD_BANK_LIST, 8+1+4+1+1); WorldPacket data(SMSG_GUILD_BANK_LIST, 8+1+4+1+1);
data << uint64(GetGuildBankMoney()); data << uint64(GetGuildBankMoney());
data << uint8(0); data << uint8(0); // TabId, default 0
// remaining slots for today data << uint32(0); // slot withdrow, default 0
size_t rempos = data.wpos();
data << uint32(0); // will be filled later
data << uint8(0); // Tell client this is a tab content packet data << uint8(0); // Tell client this is a tab content packet
data << uint8(0); // not send items data << uint8(0); // not send items
BroadcastPacket(&data); BroadcastPacket(&data);
sLog.outDebug("WORLD: Sent (SMSG_GUILD_BANK_LIST)"); sLog.outDebug("WORLD: Sent (SMSG_GUILD_BANK_LIST)");
@ -1981,7 +1985,7 @@ void Guild::SendGuildBankTabText(WorldSession *session, uint8 TabId)
bool GuildItemPosCount::isContainedIn(GuildItemPosCountVec const &vec) const bool GuildItemPosCount::isContainedIn(GuildItemPosCountVec const &vec) const
{ {
for(GuildItemPosCountVec::const_iterator itr = vec.begin(); itr != vec.end();++itr) for(GuildItemPosCountVec::const_iterator itr = vec.begin(); itr != vec.end();++itr)
if(itr->slot == this->slot) if(itr->slot == slot)
return true; return true;
return false; return false;

View file

@ -327,6 +327,11 @@ class Guild
{ {
return ((GetRankRights(rankId) & right) != GR_RIGHT_EMPTY) ? true : false; return ((GetRankRights(rankId) & right) != GR_RIGHT_EMPTY) ? true : false;
} }
int32 GetRank(uint32 LowGuid);
bool IsMember(uint32 LowGuid)
{
return (members.find(LowGuid) != members.end());
}
void Roster(WorldSession *session); void Roster(WorldSession *session);
void Query(WorldSession *session); void Query(WorldSession *session);

View file

@ -150,10 +150,6 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket)
CHECK_PACKET_SIZE(recvPacket, 1); CHECK_PACKET_SIZE(recvPacket, 1);
std::string plName; std::string plName;
uint64 plGuid;
uint32 plGuildId;
Guild *guild;
Player *player;
//sLog.outDebug("WORLD: Received CMSG_GUILD_REMOVE"); //sLog.outDebug("WORLD: Received CMSG_GUILD_REMOVE");
@ -162,45 +158,34 @@ void WorldSession::HandleGuildRemoveOpcode(WorldPacket& recvPacket)
if(!normalizePlayerName(plName)) if(!normalizePlayerName(plName))
return; return;
player = ObjectAccessor::Instance().FindPlayerByName(plName.c_str()); Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
if(player)
{
plGuid = player->GetGUID();
plGuildId = player->GetGuildId();
}
else
{
plGuid = objmgr.GetPlayerGUIDByName(plName);
plGuildId = Player::GetGuildIdFromDB(plGuid);
}
if(!guild) if(!guild)
{ {
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return; return;
} }
if(!plGuid)
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_FOUND);
return;
}
if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_REMOVE)) if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_REMOVE))
{ {
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS); SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return; return;
} }
uint64 plGuid = objmgr.GetPlayerGUIDByName(plName);
if(!plGuid)
{
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_FOUND);
return;
}
if(plGuid == guild->GetLeader()) if(plGuid == guild->GetLeader())
{ {
SendGuildCommandResult(GUILD_QUIT_S, "", GUILD_LEADER_LEAVE); SendGuildCommandResult(GUILD_QUIT_S, "", GUILD_LEADER_LEAVE);
return; return;
} }
if(GetPlayer()->GetGuildId() != plGuildId) if(!guild->IsMember(GUID_LOPART(plGuid)))
{ {
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S); SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S);
return; return;
@ -294,11 +279,6 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket)
CHECK_PACKET_SIZE(recvPacket, 1); CHECK_PACKET_SIZE(recvPacket, 1);
std::string plName; std::string plName;
uint64 plGuid;
uint32 plGuildId;
uint32 plRankId;
Player *player;
Guild *guild;
//sLog.outDebug("WORLD: Received CMSG_GUILD_PROMOTE"); //sLog.outDebug("WORLD: Received CMSG_GUILD_PROMOTE");
@ -307,27 +287,21 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket)
if(!normalizePlayerName(plName)) if(!normalizePlayerName(plName))
return; return;
player = ObjectAccessor::Instance().FindPlayerByName(plName.c_str()); Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
if(player)
{
plGuid = player->GetGUID();
plGuildId = player->GetGuildId();
plRankId = player->GetRank();
}
else
{
plGuid = objmgr.GetPlayerGUIDByName(plName);
plGuildId = Player::GetGuildIdFromDB(plGuid);
plRankId = Player::GetRankFromDB(plGuid);
}
if(!guild) if(!guild)
{ {
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return; return;
} }
else if(!plGuid) if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_PROMOTE))
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
}
uint64 plGuid = objmgr.GetPlayerGUIDByName(plName);
if(!plGuid)
{ {
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_FOUND); SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_FOUND);
return; return;
@ -337,24 +311,15 @@ void WorldSession::HandleGuildPromoteOpcode(WorldPacket& recvPacket)
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_NAME_INVALID); SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_NAME_INVALID);
return; return;
} }
else if(GetPlayer()->GetGuildId() != plGuildId)
int32 plRankId = guild->GetRank(GUID_LOPART(plGuid));
if(plRankId == -1)
{ {
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S); SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S);
return; return;
} }
else if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_PROMOTE)) if(plRankId < 2 || (plRankId-1) < GetPlayer()->GetRank())
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return; return;
}
else if((plRankId-1) == 0 || (plRankId-1) < this->GetPlayer()->GetRank())
return;
if(plRankId < 1)
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_INTERNAL);
return;
}
uint32 newRankId = plRankId < guild->GetNrRanks() ? plRankId-1 : guild->GetNrRanks()-1; uint32 newRankId = plRankId < guild->GetNrRanks() ? plRankId-1 : guild->GetNrRanks()-1;
@ -376,11 +341,6 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket)
CHECK_PACKET_SIZE(recvPacket, 1); CHECK_PACKET_SIZE(recvPacket, 1);
std::string plName; std::string plName;
uint64 plGuid;
uint32 plGuildId;
uint32 plRankId;
Player *player;
Guild *guild;
//sLog.outDebug("WORLD: Received CMSG_GUILD_DEMOTE"); //sLog.outDebug("WORLD: Received CMSG_GUILD_DEMOTE");
@ -389,20 +349,7 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket)
if(!normalizePlayerName(plName)) if(!normalizePlayerName(plName))
return; return;
player = ObjectAccessor::Instance().FindPlayerByName(plName.c_str()); Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
if(player)
{
plGuid = player->GetGUID();
plGuildId = player->GetGuildId();
plRankId = player->GetRank();
}
else
{
plGuid = objmgr.GetPlayerGUIDByName(plName);
plGuildId = Player::GetGuildIdFromDB(plGuid);
plRankId = Player::GetRankFromDB(plGuid);
}
if(!guild) if(!guild)
{ {
@ -410,6 +357,14 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket)
return; return;
} }
if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_DEMOTE))
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
}
uint64 plGuid = objmgr.GetPlayerGUIDByName(plName);
if( !plGuid ) if( !plGuid )
{ {
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_FOUND); SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_FOUND);
@ -422,19 +377,13 @@ void WorldSession::HandleGuildDemoteOpcode(WorldPacket& recvPacket)
return; return;
} }
if(GetPlayer()->GetGuildId() != plGuildId) int32 plRankId = guild->GetRank(GUID_LOPART(plGuid));
if(plRankId == -1)
{ {
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S); SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S);
return; return;
} }
if((plRankId+1) >= guild->GetNrRanks() || plRankId <= GetPlayer()->GetRank())
if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_DEMOTE))
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
}
if((plRankId+1) >= guild->GetNrRanks() || plRankId <= this->GetPlayer()->GetRank())
return; return;
guild->ChangeRank(plGuid, (plRankId+1)); guild->ChangeRank(plGuid, (plRankId+1));
@ -521,9 +470,6 @@ void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket)
CHECK_PACKET_SIZE(recvPacket, 1); CHECK_PACKET_SIZE(recvPacket, 1);
std::string name; std::string name;
Player *newLeader;
uint64 newLeaderGUID;
uint32 newLeaderGuild;
Player *oldLeader = GetPlayer(); Player *oldLeader = GetPlayer();
Guild *guild; Guild *guild;
@ -534,39 +480,32 @@ void WorldSession::HandleGuildLeaderOpcode(WorldPacket& recvPacket)
if(!normalizePlayerName(name)) if(!normalizePlayerName(name))
return; return;
newLeader = ObjectAccessor::Instance().FindPlayerByName(name.c_str());
if(newLeader)
{
newLeaderGUID = newLeader->GetGUID();
newLeaderGuild = newLeader->GetGuildId();
}
else
{
newLeaderGUID = objmgr.GetPlayerGUIDByName(name);
newLeaderGuild = Player::GetGuildIdFromDB(newLeaderGUID);
}
guild = objmgr.GetGuildById(oldLeader->GetGuildId()); guild = objmgr.GetGuildById(oldLeader->GetGuildId());
if(!guild) if (!guild)
{ {
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return; return;
} }
else if(!newLeaderGUID)
if (oldLeader->GetGUID() != guild->GetLeader())
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
}
uint64 newLeaderGUID = objmgr.GetPlayerGUIDByName(name);
if (!newLeaderGUID)
{ {
SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_FOUND); SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_FOUND);
return; return;
} }
if(oldLeader->GetGuildId() != newLeaderGuild) if (!guild->IsMember(GUID_LOPART(newLeaderGUID)))
{ {
SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_IN_GUILD_S); SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_IN_GUILD_S);
return; return;
} }
if(oldLeader->GetGUID() != guild->GetLeader())
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
}
guild->SetLeader(newLeaderGUID); guild->SetLeader(newLeaderGUID);
guild->ChangeRank(oldLeader->GetGUID(), GR_OFFICER); guild->ChangeRank(oldLeader->GetGUID(), GR_OFFICER);
@ -620,10 +559,6 @@ void WorldSession::HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket)
{ {
CHECK_PACKET_SIZE(recvPacket, 1); CHECK_PACKET_SIZE(recvPacket, 1);
Guild *guild;
Player *player;
uint64 plGuid;
uint32 plGuildId;
std::string name,PNOTE; std::string name,PNOTE;
//sLog.outDebug("WORLD: Received CMSG_GUILD_SET_PUBLIC_NOTE"); //sLog.outDebug("WORLD: Received CMSG_GUILD_SET_PUBLIC_NOTE");
@ -633,39 +568,33 @@ void WorldSession::HandleGuildSetPublicNoteOpcode(WorldPacket& recvPacket)
if(!normalizePlayerName(name)) if(!normalizePlayerName(name))
return; return;
player = ObjectAccessor::Instance().FindPlayerByName(name.c_str()); Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
if(player)
{
plGuid = player->GetGUID();
plGuildId = player->GetGuildId();
}
else
{
plGuid = objmgr.GetPlayerGUIDByName(name);
plGuildId = Player::GetGuildIdFromDB(plGuid);
}
if(!guild) if (!guild)
{ {
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return; return;
} }
else if(!plGuid)
if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_EPNOTE))
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
}
uint64 plGuid = objmgr.GetPlayerGUIDByName(name);
if (!plGuid)
{ {
SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_FOUND); SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_FOUND);
return; return;
} }
else if(GetPlayer()->GetGuildId() != plGuildId)
if (!guild->IsMember(GUID_LOPART(plGuid)))
{ {
SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_IN_GUILD_S); SendGuildCommandResult(GUILD_INVITE_S, name, GUILD_PLAYER_NOT_IN_GUILD_S);
return; return;
} }
if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_EPNOTE))
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
}
recvPacket >> PNOTE; recvPacket >> PNOTE;
guild->SetPNOTE(plGuid, PNOTE); guild->SetPNOTE(plGuid, PNOTE);
@ -677,52 +606,41 @@ void WorldSession::HandleGuildSetOfficerNoteOpcode(WorldPacket& recvPacket)
{ {
CHECK_PACKET_SIZE(recvPacket, 1); CHECK_PACKET_SIZE(recvPacket, 1);
Guild *guild;
Player *player;
uint64 plGuid;
uint32 plGuildId;
std::string plName, OFFNOTE; std::string plName, OFFNOTE;
//sLog.outDebug("WORLD: Received CMSG_GUILD_SET_OFFICER_NOTE"); //sLog.outDebug("WORLD: Received CMSG_GUILD_SET_OFFICER_NOTE");
recvPacket >> plName; recvPacket >> plName;
if(!normalizePlayerName(plName)) if (!normalizePlayerName(plName))
return; return;
player = ObjectAccessor::Instance().FindPlayerByName(plName.c_str()); Guild* guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
guild = objmgr.GetGuildById(GetPlayer()->GetGuildId());
if(player)
{
plGuid = player->GetGUID();
plGuildId = player->GetGuildId();
}
else
{
plGuid = objmgr.GetPlayerGUIDByName(plName);
plGuildId = Player::GetGuildIdFromDB(plGuid);
}
if(!guild) if (!guild)
{ {
SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD); SendGuildCommandResult(GUILD_CREATE_S, "", GUILD_PLAYER_NOT_IN_GUILD);
return; return;
} }
else if( !plGuid ) if (!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_EOFFNOTE))
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
}
uint64 plGuid = objmgr.GetPlayerGUIDByName(plName);
if (!plGuid)
{ {
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_FOUND); SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_FOUND);
return; return;
} }
else if(GetPlayer()->GetGuildId() != plGuildId)
if (!guild->IsMember(GUID_LOPART(plGuid)))
{ {
SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S); SendGuildCommandResult(GUILD_INVITE_S, plName, GUILD_PLAYER_NOT_IN_GUILD_S);
return; return;
} }
if(!guild->HasRankRight(GetPlayer()->GetRank(), GR_RIGHT_EOFFNOTE))
{
SendGuildCommandResult(GUILD_INVITE_S, "", GUILD_PERMISSIONS);
return;
}
recvPacket >> OFFNOTE; recvPacket >> OFFNOTE;
guild->SetOFFNOTE(plGuid, OFFNOTE); guild->SetOFFNOTE(plGuid, OFFNOTE);
@ -1168,7 +1086,6 @@ void WorldSession::HandleGuildBankDepositItem( WorldPacket & recv_data )
uint8 BankTab, BankTabSlot, AutoStore, AutoStoreCount, PlayerSlot, PlayerBag, SplitedAmount = 0; uint8 BankTab, BankTabSlot, AutoStore, AutoStoreCount, PlayerSlot, PlayerBag, SplitedAmount = 0;
uint8 BankTabDst, BankTabSlotDst, unk2, ToChar = 1; uint8 BankTabDst, BankTabSlotDst, unk2, ToChar = 1;
uint32 ItemEntry, unk1; uint32 ItemEntry, unk1;
bool BankToChar = false;
CHECK_PACKET_SIZE(recv_data,8+1); CHECK_PACKET_SIZE(recv_data,8+1);
recv_data >> GoGuid >> BankToBank; recv_data >> GoGuid >> BankToBank;

View file

@ -1,84 +0,0 @@
/*
* Copyright (C) 2005-2008 MaNGOS <http://getmangos.com/>
*
* 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 MANGOS_HATEMATRIX_H
#define MANGOS_HATEMATRIX_H
#include "Utilities/HashMap.h"
#include <cassert>
class Unit;
struct MANGOS_DLL_DECL HateMatrix
{
typedef hash_map<Unit *, uint32> HateMatrixMapType;
inline uint32 operator[](Unit *unit) const
{
HateMatrixMapType::const_iterator iter = i_hateValues.find(unit);
return (iter == i_hateValues.end() ? 0 : iter->second);
}
inline uint32& operator[](Unit *unit)
{
HateMatrixMapType::iterator iter = i_hateValues.find(unit);
if( iter == i_hateValues.end() )
{
std::pair<HateMatrixMapType::iterator, bool> p = i_hateValues.insert( HateMatrixMapType::value_type(unit, 0) );
assert(p.second);
iter = p.first;
}
return iter->second;
}
inline void ClearMatrix(void) { i_hateValues.clear(); }
inline void RemoveValue(Unit *unit)
{
HateMatrixMapType::iterator iter = i_hateValues.find(unit);
if( iter != i_hateValues.end() )
i_hateValues.erase( iter );
}
inline void AddValue(Unit *unit, uint32 val)
{
(*this)[unit] += val;
}
private:
HateMatrixMapType i_hateValues;
};
struct HateBinder
{
static uint32 si_noHateValue;
uint32 &i_hateValue;
Unit *i_unit;
HateBinder(uint32 &val, Unit *u) : i_hateValue(val), i_unit(u) {}
HateBinder() : i_hateValue(si_noHateValue), i_unit(NULL) {}
HateBinder(const HateBinder &obj) : i_hateValue(obj.i_hateValue), i_unit(obj.i_unit) {}
HateBinder& operator=(const HateBinder &obj)
{
i_hateValue = obj.i_hateValue;
i_unit = obj.i_unit;
return *this;
}
};
#endif

View file

@ -39,7 +39,7 @@ DistractMovementGenerator::Finalize(Unit& owner)
} }
bool bool
DistractMovementGenerator::Update(Unit& owner, const uint32& time_diff) DistractMovementGenerator::Update(Unit& /*owner*/, const uint32& time_diff)
{ {
if(time_diff > m_timer) if(time_diff > m_timer)
return false; return false;

View file

@ -222,7 +222,7 @@ void InstanceSaveManager::_DelHelper(DatabaseType &db, const char *fields, const
va_list ap; va_list ap;
char szQueryTail [MAX_QUERY_LEN]; char szQueryTail [MAX_QUERY_LEN];
va_start(ap, queryTail); va_start(ap, queryTail);
int res = vsnprintf( szQueryTail, MAX_QUERY_LEN, queryTail, ap ); vsnprintf( szQueryTail, MAX_QUERY_LEN, queryTail, ap );
va_end(ap); va_end(ap);
QueryResult *result = db.PQuery("SELECT %s FROM %s %s", fields, table, szQueryTail); QueryResult *result = db.PQuery("SELECT %s FROM %s %s", fields, table, szQueryTail);
@ -246,8 +246,6 @@ void InstanceSaveManager::_DelHelper(DatabaseType &db, const char *fields, const
void InstanceSaveManager::CleanupInstances() void InstanceSaveManager::CleanupInstances()
{ {
uint64 now = (uint64)time(NULL);
barGoLink bar(2); barGoLink bar(2);
bar.step(); bar.step();

View file

@ -49,7 +49,7 @@ bool ChatHandler::HandleHelpCommand(const char* args)
return true; return true;
} }
bool ChatHandler::HandleCommandsCommand(const char* args) bool ChatHandler::HandleCommandsCommand(const char* /*args*/)
{ {
ShowHelpForCommand(getCommandTable(), ""); ShowHelpForCommand(getCommandTable(), "");
return true; return true;

View file

@ -438,8 +438,6 @@ bool ChatHandler::HandleGonameCommand(const char* args)
Map* cMap = MapManager::Instance().GetMap(chr->GetMapId(),chr); Map* cMap = MapManager::Instance().GetMap(chr->GetMapId(),chr);
if(cMap->Instanceable()) if(cMap->Instanceable())
{ {
Map* pMap = MapManager::Instance().GetMap(_player->GetMapId(),_player);
// we have to go to instance, and can go to player only if: // we have to go to instance, and can go to player only if:
// 1) we are in his group (either as leader or as member) // 1) we are in his group (either as leader or as member)
// 2) we are not bound to any group and have GM mode on // 2) we are not bound to any group and have GM mode on
@ -1932,7 +1930,6 @@ bool ChatHandler::HandleSendMailCommand(const char* args)
return false; return false;
} }
uint32 mailId = objmgr.GenerateMailID();
uint32 sender_guidlo = m_session->GetPlayer()->GetGUIDLow(); uint32 sender_guidlo = m_session->GetPlayer()->GetGUIDLow();
uint32 messagetype = MAIL_NORMAL; uint32 messagetype = MAIL_NORMAL;
uint32 stationery = MAIL_STATIONERY_GM; uint32 stationery = MAIL_STATIONERY_GM;

View file

@ -749,7 +749,7 @@ bool ChatHandler::HandleModifyRepCommand(const char * args)
return true; return true;
} }
bool ChatHandler::HandleNameCommand(const char* args) bool ChatHandler::HandleNameCommand(const char* /*args*/)
{ {
/* Temp. disabled /* Temp. disabled
if(!*args) if(!*args)
@ -3591,7 +3591,7 @@ bool ChatHandler::HandleLookupEventCommand(const char* args)
return true; return true;
} }
bool ChatHandler::HandleEventActiveListCommand(const char* args) bool ChatHandler::HandleEventActiveListCommand(const char* /*args*/)
{ {
uint32 counter = 0; uint32 counter = 0;
@ -3850,8 +3850,6 @@ bool ChatHandler::HandleLearnAllRecipesCommand(const char* args)
if(!Utf8toWStr(args,wnamepart)) if(!Utf8toWStr(args,wnamepart))
return false; return false;
uint32 counter = 0; // Counter for figure out that we found smth.
// converting string that we try to find to lower case // converting string that we try to find to lower case
wstrToLower( wnamepart ); wstrToLower( wnamepart );
@ -4117,7 +4115,7 @@ bool ChatHandler::HandleNpcUnFollowCommand(const char* /*args*/)
return true; return true;
} }
bool ChatHandler::HandleNpcTameCommand(const char* args) bool ChatHandler::HandleNpcTameCommand(const char* /*args*/)
{ {
Creature *creatureTarget = getSelectedCreature (); Creature *creatureTarget = getSelectedCreature ();
if (!creatureTarget || creatureTarget->isPet ()) if (!creatureTarget || creatureTarget->isPet ())

View file

@ -159,7 +159,7 @@ bool ChatHandler::HandleReloadAllItemCommand(const char*)
return true; return true;
} }
bool ChatHandler::HandleReloadAllLocalesCommand(const char* args) bool ChatHandler::HandleReloadAllLocalesCommand(const char* /*args*/)
{ {
HandleReloadLocalesCreatureCommand("a"); HandleReloadLocalesCreatureCommand("a");
HandleReloadLocalesGameobjectCommand("a"); HandleReloadLocalesGameobjectCommand("a");
@ -170,7 +170,7 @@ bool ChatHandler::HandleReloadAllLocalesCommand(const char* args)
return true; return true;
} }
bool ChatHandler::HandleReloadConfigCommand(const char* arg) bool ChatHandler::HandleReloadConfigCommand(const char* /*args*/)
{ {
sLog.outString( "Re-Loading config settings..." ); sLog.outString( "Re-Loading config settings..." );
sWorld.LoadConfigSettings(true); sWorld.LoadConfigSettings(true);
@ -5756,7 +5756,7 @@ bool ChatHandler::HandleCastBackCommand(const char* args)
caster->BuildHeartBeatMsg(&data); caster->BuildHeartBeatMsg(&data);
caster->SendMessageToSet(&data,true); caster->SendMessageToSet(&data,true);
caster->CastSpell(m_session->GetPlayer(),spell,false); caster->CastSpell(m_session->GetPlayer(),spell,triggered);
return true; return true;
} }
@ -5847,7 +5847,7 @@ bool ChatHandler::HandleCastTargetCommand(const char* args)
caster->BuildHeartBeatMsg(&data); caster->BuildHeartBeatMsg(&data);
caster->SendMessageToSet(&data,true); caster->SendMessageToSet(&data,true);
caster->CastSpell(caster->getVictim(),spell,false); caster->CastSpell(caster->getVictim(),spell,triggered);
return true; return true;
} }

View file

@ -58,7 +58,7 @@ class LootTemplate::LootGroup // A set of loot def
void Verify(LootStore const& lootstore, uint32 id, uint32 group_id) const; void Verify(LootStore const& lootstore, uint32 id, uint32 group_id) const;
void CollectLootIds(LootIdSet& set) const; void CollectLootIds(LootIdSet& set) const;
void CheckLootRefs(LootTemplateMap const& store, LootIdSet* ref_set) const; void CheckLootRefs(LootIdSet* ref_set) const;
private: private:
LootStoreItemList ExplicitlyChanced; // Entries with chances defined in DB LootStoreItemList ExplicitlyChanced; // Entries with chances defined in DB
LootStoreItemList EqualChanced; // Zero chances - every entry takes the same chance LootStoreItemList EqualChanced; // Zero chances - every entry takes the same chance
@ -206,7 +206,7 @@ void LootStore::LoadAndCollectLootIds(LootIdSet& ids_set)
void LootStore::CheckLootRefs(LootIdSet* ref_set) const void LootStore::CheckLootRefs(LootIdSet* ref_set) const
{ {
for(LootTemplateMap::const_iterator ltItr = m_LootTemplates.begin(); ltItr != m_LootTemplates.end(); ++ltItr) for(LootTemplateMap::const_iterator ltItr = m_LootTemplates.begin(); ltItr != m_LootTemplates.end(); ++ltItr)
ltItr->second->CheckLootRefs(m_LootTemplates,ref_set); ltItr->second->CheckLootRefs(ref_set);
} }
void LootStore::ReportUnusedIds(LootIdSet const& ids_set) const void LootStore::ReportUnusedIds(LootIdSet const& ids_set) const
@ -855,7 +855,7 @@ void LootTemplate::LootGroup::Verify(LootStore const& lootstore, uint32 id, uint
} }
} }
void LootTemplate::LootGroup::CheckLootRefs(LootTemplateMap const& store, LootIdSet* ref_set) const void LootTemplate::LootGroup::CheckLootRefs(LootIdSet* ref_set) const
{ {
for (LootStoreItemList::const_iterator ieItr=ExplicitlyChanced.begin(); ieItr != ExplicitlyChanced.end(); ++ieItr) for (LootStoreItemList::const_iterator ieItr=ExplicitlyChanced.begin(); ieItr != ExplicitlyChanced.end(); ++ieItr)
{ {
@ -1009,7 +1009,7 @@ void LootTemplate::Verify(LootStore const& lootstore, uint32 id) const
// TODO: References validity checks // TODO: References validity checks
} }
void LootTemplate::CheckLootRefs(LootTemplateMap const& store, LootIdSet* ref_set) const void LootTemplate::CheckLootRefs(LootIdSet* ref_set) const
{ {
for(LootStoreItemList::const_iterator ieItr = Entries.begin(); ieItr != Entries.end(); ++ieItr) for(LootStoreItemList::const_iterator ieItr = Entries.begin(); ieItr != Entries.end(); ++ieItr)
{ {
@ -1023,7 +1023,7 @@ void LootTemplate::CheckLootRefs(LootTemplateMap const& store, LootIdSet* ref_se
} }
for(LootGroups::const_iterator grItr = Groups.begin(); grItr != Groups.end(); ++grItr) for(LootGroups::const_iterator grItr = Groups.begin(); grItr != Groups.end(); ++grItr)
grItr->CheckLootRefs(store,ref_set); grItr->CheckLootRefs(ref_set);
} }
void LoadLootTemplates_Creature() void LoadLootTemplates_Creature()

View file

@ -172,7 +172,7 @@ class LootTemplate
// Checks integrity of the template // Checks integrity of the template
void Verify(LootStore const& store, uint32 Id) const; void Verify(LootStore const& store, uint32 Id) const;
void CheckLootRefs(LootTemplateMap const& store, LootIdSet* ref_set) const; void CheckLootRefs(LootIdSet* ref_set) const;
private: private:
LootStoreItemList Entries; // not grouped only LootStoreItemList Entries; // not grouped only
LootGroups Groups; // groups have own (optimised) processing, grouped entries go there LootGroups Groups; // groups have own (optimised) processing, grouped entries go there

View file

@ -346,13 +346,13 @@ void WorldSession::HandleReturnToSender(WorldPacket & recv_data )
} }
} }
SendReturnToSender(MAIL_NORMAL, GetAccountId(), m->receiver, m->sender, m->subject, m->itemTextId, &mi, m->money, 0, m->mailTemplateId); SendReturnToSender(MAIL_NORMAL, GetAccountId(), m->receiver, m->sender, m->subject, m->itemTextId, &mi, m->money, m->mailTemplateId);
delete m; //we can deallocate old mail delete m; //we can deallocate old mail
pl->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, 0); pl->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, 0);
} }
void WorldSession::SendReturnToSender(uint8 messageType, uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, std::string subject, uint32 itemTextId, MailItemsInfo *mi, uint32 money, uint32 COD, uint16 mailTemplateId ) void WorldSession::SendReturnToSender(uint8 messageType, uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, std::string subject, uint32 itemTextId, MailItemsInfo *mi, uint32 money, uint16 mailTemplateId )
{ {
if(messageType != MAIL_NORMAL) // return only to players if(messageType != MAIL_NORMAL) // return only to players
{ {

View file

@ -127,7 +127,6 @@ libmangosgame_a_SOURCES = \
Guild.cpp \ Guild.cpp \
Guild.h \ Guild.h \
GuildHandler.cpp \ GuildHandler.cpp \
HateMatrix.h \
HomeMovementGenerator.cpp \ HomeMovementGenerator.cpp \
HomeMovementGenerator.h \ HomeMovementGenerator.h \
HostilRefManager.cpp \ HostilRefManager.cpp \

View file

@ -418,7 +418,7 @@ Map::LoadGrid(const Cell& cell, bool no_unload)
bool Map::Add(Player *player) bool Map::Add(Player *player)
{ {
player->SetInstanceId(this->GetInstanceId()); player->SetInstanceId(GetInstanceId());
// update player state for other player and visa-versa // update player state for other player and visa-versa
CellPair p = MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY()); CellPair p = MaNGOS::ComputeCellPair(player->GetPositionX(), player->GetPositionY());

View file

@ -24,7 +24,7 @@
#include "InstanceSaveMgr.h" #include "InstanceSaveMgr.h"
#include "World.h" #include "World.h"
MapInstanced::MapInstanced(uint32 id, time_t expiry, uint32 aInstanceId) : Map(id, expiry, 0, 0) MapInstanced::MapInstanced(uint32 id, time_t expiry) : Map(id, expiry, 0, 0)
{ {
// initialize instanced maps list // initialize instanced maps list
m_InstancedMaps.clear(); m_InstancedMaps.clear();

View file

@ -28,7 +28,7 @@ class MANGOS_DLL_DECL MapInstanced : public Map
public: public:
typedef HM_NAMESPACE::hash_map< uint32, Map* > InstancedMaps; typedef HM_NAMESPACE::hash_map< uint32, Map* > InstancedMaps;
MapInstanced(uint32 id, time_t, uint32 aInstanceId); MapInstanced(uint32 id, time_t expiry);
~MapInstanced() {} ~MapInstanced() {}
// functions overwrite Map versions // functions overwrite Map versions

View file

@ -109,7 +109,7 @@ MapManager::_GetBaseMap(uint32 id)
const MapEntry* entry = sMapStore.LookupEntry(id); const MapEntry* entry = sMapStore.LookupEntry(id);
if (entry && entry->IsDungeon()) if (entry && entry->IsDungeon())
{ {
m = new MapInstanced(id, i_gridCleanUpDelay, 0); m = new MapInstanced(id, i_gridCleanUpDelay);
} }
else else
{ {
@ -221,7 +221,7 @@ bool MapManager::CanPlayerEnter(uint32 mapid, Player* player)
return true; return true;
} }
void MapManager::DeleteInstance(uint32 mapid, uint32 instanceId, uint8 mode) void MapManager::DeleteInstance(uint32 mapid, uint32 instanceId)
{ {
Map *m = _GetBaseMap(mapid); Map *m = _GetBaseMap(mapid);
if (m && m->Instanceable()) if (m && m->Instanceable())

View file

@ -43,7 +43,7 @@ class MANGOS_DLL_DECL MapManager : public MaNGOS::Singleton<MapManager, MaNGOS::
// only const version for outer users // only const version for outer users
Map const* GetBaseMap(uint32 id) const { return const_cast<MapManager*>(this)->_GetBaseMap(id); } Map const* GetBaseMap(uint32 id) const { return const_cast<MapManager*>(this)->_GetBaseMap(id); }
void DeleteInstance(uint32 mapid, uint32 instanceId, uint8 mode); void DeleteInstance(uint32 mapid, uint32 instanceId);
inline uint16 GetAreaFlag(uint32 mapid, float x, float y) const inline uint16 GetAreaFlag(uint32 mapid, float x, float y) const
{ {

View file

@ -110,7 +110,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
{ {
if( mEntry->IsDungeon() ) if( mEntry->IsDungeon() )
{ {
GetPlayer()->ResurrectPlayer(0.5f,false); GetPlayer()->ResurrectPlayer(0.5f);
GetPlayer()->SpawnCorpseBones(); GetPlayer()->SpawnCorpseBones();
GetPlayer()->SaveToDB(); GetPlayer()->SaveToDB();
} }

View file

@ -372,7 +372,7 @@ void WorldSession::HandleSpiritHealerActivateOpcode( WorldPacket & recv_data )
void WorldSession::SendSpiritResurrect() void WorldSession::SendSpiritResurrect()
{ {
_player->ResurrectPlayer(0.5f,false, true); _player->ResurrectPlayer(0.5f, true);
_player->DurabilityLossAll(0.25f,true); _player->DurabilityLossAll(0.25f,true);

View file

@ -98,8 +98,8 @@ struct WorldLocation
float y; float y;
float z; float z;
float o; float o;
explicit WorldLocation(uint32 mapid = 0, float x = 0, float y = 0, float z = 0, float o = 0) explicit WorldLocation(uint32 _mapid = 0, float _x = 0, float _y = 0, float _z = 0, float _o = 0)
: mapid(mapid), x(x), y(y), z(z), o(o) {} : mapid(_mapid), x(_x), y(_y), z(_z), o(_o) {}
WorldLocation(WorldLocation const &loc) WorldLocation(WorldLocation const &loc)
: mapid(loc.mapid), x(loc.x), y(loc.y), z(loc.z), o(loc.o) {} : mapid(loc.mapid), x(loc.x), y(loc.y), z(loc.z), o(loc.o) {}
}; };

View file

@ -355,7 +355,7 @@ void ObjectMgr::SendAuctionWonMail( AuctionEntry *auction )
sLog.outDebug( "AuctionWon body string : %s", msgAuctionWonBody.str().c_str() ); sLog.outDebug( "AuctionWon body string : %s", msgAuctionWonBody.str().c_str() );
//prepare mail data... : //prepare mail data... :
uint32 itemTextId = this->CreateItemText( msgAuctionWonBody.str() ); uint32 itemTextId = CreateItemText( msgAuctionWonBody.str() );
// set owner to bidder (to prevent delete item with sender char deleting) // set owner to bidder (to prevent delete item with sender char deleting)
// owner in `data` will set at mail receive and item extracting // owner in `data` will set at mail receive and item extracting
@ -406,7 +406,7 @@ void ObjectMgr::SendAuctionSalePendingMail( AuctionEntry * auction )
sLog.outDebug("AuctionSalePending body string : %s", msgAuctionSalePendingBody.str().c_str()); sLog.outDebug("AuctionSalePending body string : %s", msgAuctionSalePendingBody.str().c_str());
uint32 itemTextId = this->CreateItemText( msgAuctionSalePendingBody.str() ); uint32 itemTextId = CreateItemText( msgAuctionSalePendingBody.str() );
WorldSession::SendMailTo(owner, MAIL_AUCTION, MAIL_STATIONERY_AUCTION, auction->location, auction->owner, msgAuctionSalePendingSubject.str(), itemTextId, NULL, 0, 0, MAIL_CHECK_MASK_AUCTION); WorldSession::SendMailTo(owner, MAIL_AUCTION, MAIL_STATIONERY_AUCTION, auction->location, auction->owner, msgAuctionSalePendingSubject.str(), itemTextId, NULL, 0, 0, MAIL_CHECK_MASK_AUCTION);
} }
@ -438,7 +438,7 @@ void ObjectMgr::SendAuctionSuccessfulMail( AuctionEntry * auction )
sLog.outDebug("AuctionSuccessful body string : %s", auctionSuccessfulBody.str().c_str()); sLog.outDebug("AuctionSuccessful body string : %s", auctionSuccessfulBody.str().c_str());
uint32 itemTextId = this->CreateItemText( auctionSuccessfulBody.str() ); uint32 itemTextId = CreateItemText( auctionSuccessfulBody.str() );
uint32 profit = auction->bid + auction->deposit - auctionCut; uint32 profit = auction->bid + auction->deposit - auctionCut;
@ -1470,7 +1470,7 @@ void ObjectMgr::LoadAuctions()
aItem->deposit = fields[10].GetUInt32(); aItem->deposit = fields[10].GetUInt32();
aItem->location = fields[11].GetUInt8(); aItem->location = fields[11].GetUInt8();
//check if sold item exists //check if sold item exists
if ( this->GetAItem( aItem->item_guidlow ) ) if ( GetAItem( aItem->item_guidlow ) )
{ {
GetAuctionsMap( aItem->location )->AddAuction(aItem); GetAuctionsMap( aItem->location )->AddAuction(aItem);
} }
@ -5068,13 +5068,8 @@ void ObjectMgr::SetHighestGuids()
delete result; delete result;
} }
result = CharacterDatabase.Query( "SELECT MAX(id) FROM character_pet" ); // pet guids are not saved to DB, set to 0 (pet guid != pet id)
if( result ) m_hiPetGuid = 0;
{
m_hiPetGuid = (*result)[0].GetUInt32()+1;
delete result;
}
result = CharacterDatabase.Query( "SELECT MAX(guid) FROM item_instance" ); result = CharacterDatabase.Query( "SELECT MAX(guid) FROM item_instance" );
if( result ) if( result )
@ -5137,6 +5132,44 @@ void ObjectMgr::SetHighestGuids()
delete result; delete result;
} }
result = CharacterDatabase.Query("SELECT MAX(arenateamid) FROM arena_team");
if (result)
{
m_arenaTeamId = (*result)[0].GetUInt32()+1;
delete result;
}
result = CharacterDatabase.Query( "SELECT MAX(guildid) FROM guild" );
if (result)
{
m_guildId = (*result)[0].GetUInt32()+1;
delete result;
}
}
uint32 ObjectMgr::GenerateArenaTeamId()
{
++m_arenaTeamId;
if(m_arenaTeamId>=0xFFFFFFFF)
{
sLog.outError("Arena team ids overflow!! Can't continue, shuting down server. ");
sWorld.m_stopEvent = true;
}
return m_arenaTeamId;
}
uint32 ObjectMgr::GenerateGuildId()
{
++m_guildId;
if(m_guildId>=0xFFFFFFFF)
{
sLog.outError("Guild ids overflow!! Can't continue, shuting down server. ");
sWorld.m_stopEvent = true;
}
return m_guildId;
} }
uint32 ObjectMgr::GenerateAuctionID() uint32 ObjectMgr::GenerateAuctionID()

View file

@ -572,6 +572,8 @@ class ObjectMgr
uint32 GenerateMailID(); uint32 GenerateMailID();
uint32 GenerateItemTextID(); uint32 GenerateItemTextID();
uint32 GeneratePetNumber(); uint32 GeneratePetNumber();
uint32 GenerateArenaTeamId();
uint32 GenerateGuildId();
uint32 CreateItemText(std::string text); uint32 CreateItemText(std::string text);
std::string GetItemText( uint32 id ) std::string GetItemText( uint32 id )
@ -764,6 +766,8 @@ class ObjectMgr
uint32 m_auctionid; uint32 m_auctionid;
uint32 m_mailid; uint32 m_mailid;
uint32 m_ItemTextId; uint32 m_ItemTextId;
uint32 m_arenaTeamId;
uint32 m_guildId;
uint32 m_hiCharGuid; uint32 m_hiCharGuid;
uint32 m_hiCreatureGuid; uint32 m_hiCreatureGuid;

View file

@ -449,7 +449,6 @@ void Pet::SavePetToDB(PetSaveMode mode)
case PET_SAVE_AS_DELETED: case PET_SAVE_AS_DELETED:
{ {
RemoveAllAuras(); RemoveAllAuras();
uint32 owner = GUID_LOPART(GetOwnerGUID());
DeleteFromDB(m_charmInfo->GetPetNumber()); DeleteFromDB(m_charmInfo->GetPetNumber());
break; break;
} }

View file

@ -37,7 +37,7 @@ class MANGOS_DLL_DECL PetAI : public CreatureAI
void DamageTaken(Unit *done_by, uint32& /*damage*/) { AttackedBy(done_by); } void DamageTaken(Unit *done_by, uint32& /*damage*/) { AttackedBy(done_by); }
void AttackedBy(Unit*); void AttackedBy(Unit*);
bool IsVisible(Unit *) const; bool IsVisible(Unit *) const;
void JustDied(Unit* who) { _stopAttack(); } void JustDied(Unit* /*who*/) { _stopAttack(); }
void UpdateAI(const uint32); void UpdateAI(const uint32);
static int Permissible(const Creature *); static int Permissible(const Creature *);

View file

@ -479,6 +479,8 @@ void Player::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, 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
Object::_Create(guidlow, 0, HIGHGUID_PLAYER); Object::_Create(guidlow, 0, HIGHGUID_PLAYER);
m_name = name; m_name = name;
@ -1489,7 +1491,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
// The player was ported to another map and looses the duel immediatly. // The player was ported to another map and looses the duel immediatly.
// We have to perform this check before the teleport, otherwise the // We have to perform this check before the teleport, otherwise the
// ObjectAccessor won't find the flag. // ObjectAccessor won't find the flag.
if (duel && this->GetMapId()!=mapid) if (duel && GetMapId()!=mapid)
{ {
GameObject* obj = ObjectAccessor::GetGameObject(*this, GetUInt64Value(PLAYER_DUEL_ARBITER)); GameObject* obj = ObjectAccessor::GetGameObject(*this, GetUInt64Value(PLAYER_DUEL_ARBITER));
if (obj) if (obj)
@ -1499,7 +1501,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
// reset movement flags at teleport, because player will continue move with these flags after teleport // reset movement flags at teleport, because player will continue move with these flags after teleport
SetUnitMovementFlags(0); SetUnitMovementFlags(0);
if ((this->GetMapId() == mapid) && (!m_transport)) if ((GetMapId() == mapid) && (!m_transport))
{ {
// prepare zone change detect // prepare zone change detect
uint32 old_zone = GetZoneId(); uint32 old_zone = GetZoneId();
@ -3526,7 +3528,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC
uint32 pl_account = objmgr.GetPlayerAccountIdByGUID(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER)); uint32 pl_account = objmgr.GetPlayerAccountIdByGUID(MAKE_NEW_GUID(guid, 0, HIGHGUID_PLAYER));
WorldSession::SendReturnToSender(MAIL_NORMAL, pl_account, guid, sender, subject, itemTextId, &mi, money, 0, mailTemplateId); WorldSession::SendReturnToSender(MAIL_NORMAL, pl_account, guid, sender, subject, itemTextId, &mi, money, mailTemplateId);
} }
while (resultMail->NextRow()); while (resultMail->NextRow());
@ -3655,13 +3657,14 @@ void Player::BuildPlayerRepop()
void Player::SendDelayResponse(const uint32 ml_seconds) void Player::SendDelayResponse(const uint32 ml_seconds)
{ {
//FIXME: is this delay time arg really need? 50msec by default in code
WorldPacket data( SMSG_QUERY_TIME_RESPONSE, 4+4 ); WorldPacket data( SMSG_QUERY_TIME_RESPONSE, 4+4 );
data << (uint32)time(NULL); data << (uint32)time(NULL);
data << (uint32)0; data << (uint32)0;
GetSession()->SendPacket( &data ); GetSession()->SendPacket( &data );
} }
void Player::ResurrectPlayer(float restore_percent, bool updateToWorld, bool applySickness) void Player::ResurrectPlayer(float restore_percent, bool applySickness)
{ {
WorldPacket data(SMSG_DEATH_RELEASE_LOC, 4*4); // remove spirit healer position WorldPacket data(SMSG_DEATH_RELEASE_LOC, 4*4); // remove spirit healer position
data << uint32(-1); data << uint32(-1);
@ -4192,7 +4195,7 @@ void Player::UpdateDefense()
} }
} }
void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply, bool affectStats) void Player::HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply)
{ {
if(modGroup >= BASEMOD_END || modType >= MOD_END) if(modGroup >= BASEMOD_END || modType >= MOD_END)
{ {
@ -5880,7 +5883,6 @@ bool Player::RewardHonor(Unit *uVictim, uint32 groupsize, float honor)
uint64 victim_guid = 0; uint64 victim_guid = 0;
uint32 victim_rank = 0; uint32 victim_rank = 0;
time_t now = time(NULL);
// need call before fields update to have chance move yesterday data to appropriate fields before today data change. // need call before fields update to have chance move yesterday data to appropriate fields before today data change.
UpdateHonorFields(); UpdateHonorFields();
@ -6840,7 +6842,7 @@ void Player::CastItemCombatSpell(Item *item,Unit* Target, WeaponAttackType attTy
} }
if (roll_chance_f(chance)) if (roll_chance_f(chance))
this->CastSpell(Target, spellInfo->Id, true, item); CastSpell(Target, spellInfo->Id, true, item);
} }
// item combat enchantments // item combat enchantments
@ -10510,8 +10512,6 @@ void Player::DestroyItem( uint8 bag, uint8 slot, bool update )
if(pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED)) if(pItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED))
CharacterDatabase.PExecute("DELETE FROM character_gifts WHERE item_guid = '%u'", pItem->GetGUIDLow()); CharacterDatabase.PExecute("DELETE FROM character_gifts WHERE item_guid = '%u'", pItem->GetGUIDLow());
ItemPrototype const *pProto = pItem->GetProto();
RemoveEnchantmentDurations(pItem); RemoveEnchantmentDurations(pItem);
RemoveItemDurations(pItem); RemoveItemDurations(pItem);
@ -17725,7 +17725,7 @@ void Player::learnSkillRewardedSpells(uint32 skill_id )
if (pAbility->classmask && !(pAbility->classmask & classMask)) if (pAbility->classmask && !(pAbility->classmask & classMask))
continue; continue;
if (SpellEntry const* spellentry = sSpellStore.LookupEntry(pAbility->spellId)) if (sSpellStore.LookupEntry(pAbility->spellId))
{ {
// Ok need learn spell // Ok need learn spell
learnSpell(pAbility->spellId); learnSpell(pAbility->spellId);
@ -18495,7 +18495,7 @@ void Player::SetCanBlock( bool value )
bool ItemPosCount::isContainedIn(ItemPosCountVec const& vec) const bool ItemPosCount::isContainedIn(ItemPosCountVec const& vec) const
{ {
for(ItemPosCountVec::const_iterator itr = vec.begin(); itr != vec.end();++itr) for(ItemPosCountVec::const_iterator itr = vec.begin(); itr != vec.end();++itr)
if(itr->pos == this->pos) if(itr->pos == pos)
return true; return true;
return false; return false;

View file

@ -1539,8 +1539,8 @@ class MANGOS_DLL_SPEC Player : public Unit
void RemoveFromGroup() { RemoveFromGroup(GetGroup(),GetGUID()); } void RemoveFromGroup() { RemoveFromGroup(GetGroup(),GetGUID()); }
void SendUpdateToOutOfRangeGroupMembers(); void SendUpdateToOutOfRangeGroupMembers();
void SetInGuild(uint32 GuildId) { SetUInt32Value(PLAYER_GUILDID, GuildId); Player::SetUInt32ValueInDB(PLAYER_GUILDID, GuildId, this->GetGUID()); } void SetInGuild(uint32 GuildId) { SetUInt32Value(PLAYER_GUILDID, GuildId); Player::SetUInt32ValueInDB(PLAYER_GUILDID, GuildId, GetGUID()); }
void SetRank(uint32 rankId){ SetUInt32Value(PLAYER_GUILDRANK, rankId); Player::SetUInt32ValueInDB(PLAYER_GUILDRANK, rankId, this->GetGUID()); } void SetRank(uint32 rankId){ SetUInt32Value(PLAYER_GUILDRANK, rankId); Player::SetUInt32ValueInDB(PLAYER_GUILDRANK, rankId, GetGUID()); }
void SetGuildIdInvited(uint32 GuildId) { m_GuildIdInvited = GuildId; } void SetGuildIdInvited(uint32 GuildId) { m_GuildIdInvited = GuildId; }
uint32 GetGuildId() { return GetUInt32Value(PLAYER_GUILDID); } uint32 GetGuildId() { return GetUInt32Value(PLAYER_GUILDID); }
static uint32 GetGuildIdFromDB(uint64 guid); static uint32 GetGuildIdFromDB(uint64 guid);
@ -1553,7 +1553,7 @@ class MANGOS_DLL_SPEC Player : public Unit
void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot) void SetInArenaTeam(uint32 ArenaTeamId, uint8 slot)
{ {
SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 6), ArenaTeamId); SetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 6), ArenaTeamId);
SetUInt32ValueInDB(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 6), ArenaTeamId, this->GetGUID()); SetUInt32ValueInDB(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 6), ArenaTeamId, GetGUID());
} }
uint32 GetArenaTeamId(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 6)); } uint32 GetArenaTeamId(uint8 slot) { return GetUInt32Value(PLAYER_FIELD_ARENA_TEAM_INFO_1_1 + (slot * 6)); }
static uint32 GetArenaTeamIdFromDB(uint64 guid, uint8 slot); static uint32 GetArenaTeamIdFromDB(uint64 guid, uint8 slot);
@ -1662,7 +1662,7 @@ class MANGOS_DLL_SPEC Player : public Unit
void CreateCorpse(); void CreateCorpse();
void KillPlayer(); void KillPlayer();
uint32 GetResurrectionSpellId(); uint32 GetResurrectionSpellId();
void ResurrectPlayer(float restore_percent, bool updateToWorld = true, bool applySickness = false); void ResurrectPlayer(float restore_percent, bool applySickness = false);
void BuildPlayerRepop(); void BuildPlayerRepop();
void RepopAtGraveyard(); void RepopAtGraveyard();
@ -1786,7 +1786,7 @@ class MANGOS_DLL_SPEC Player : public Unit
void SetRegularAttackTime(); void SetRegularAttackTime();
void SetBaseModValue(BaseModGroup modGroup, BaseModType modType, float value) { m_auraBaseMod[modGroup][modType] = value; } void SetBaseModValue(BaseModGroup modGroup, BaseModType modType, float value) { m_auraBaseMod[modGroup][modType] = value; }
void HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply, bool affectStats = true); void HandleBaseModValue(BaseModGroup modGroup, BaseModType modType, float amount, bool apply);
float GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const; float GetBaseModValue(BaseModGroup modGroup, BaseModType modType) const;
float GetTotalBaseModValue(BaseModGroup modGroup) const; float GetTotalBaseModValue(BaseModGroup modGroup) const;
float GetTotalPercentageModValue(BaseModGroup modGroup) const { return m_auraBaseMod[modGroup][FLAT_MOD] + m_auraBaseMod[modGroup][PCT_MOD]; } float GetTotalPercentageModValue(BaseModGroup modGroup) const { return m_auraBaseMod[modGroup][FLAT_MOD] + m_auraBaseMod[modGroup][PCT_MOD]; }

View file

@ -59,7 +59,7 @@ bool PointMovementGenerator<T>::Update(T &unit, const uint32 &diff)
} }
template<class T> template<class T>
void PointMovementGenerator<T>::MovementInform(T &unit) void PointMovementGenerator<T>::MovementInform(T& /*unit*/)
{ {
} }

View file

@ -38,8 +38,8 @@ RandomMovementGenerator<Creature>::_setRandomLocation(Creature &creature)
Map const* map = MapManager::Instance().GetBaseMap(mapid); Map const* map = MapManager::Instance().GetBaseMap(mapid);
// For 2D/3D system selection // For 2D/3D system selection
bool is_land_ok = creature.canWalk(); //bool is_land_ok = creature.canWalk(); // not used?
bool is_water_ok = creature.canSwim(); //bool is_water_ok = creature.canSwim(); // not used?
bool is_air_ok = creature.canFly(); bool is_air_ok = creature.canFly();
const float angle = rand_norm()*(M_PI*2); const float angle = rand_norm()*(M_PI*2);

View file

@ -653,7 +653,7 @@ void Spell::FillTargetMap()
for (std::list<Unit*>::iterator itr = tmpUnitMap.begin() ; itr != tmpUnitMap.end();) for (std::list<Unit*>::iterator itr = tmpUnitMap.begin() ; itr != tmpUnitMap.end();)
{ {
if(!CheckTarget(*itr, i, false )) if (!CheckTarget (*itr, i))
{ {
itr = tmpUnitMap.erase(itr); itr = tmpUnitMap.erase(itr);
continue; continue;
@ -3199,7 +3199,7 @@ void Spell::TriggerSpell()
{ {
for(TriggerSpells::iterator si=m_TriggerSpells.begin(); si!=m_TriggerSpells.end(); ++si) for(TriggerSpells::iterator si=m_TriggerSpells.begin(); si!=m_TriggerSpells.end(); ++si)
{ {
Spell* spell = new Spell(m_caster, (*si), true, m_originalCasterGUID, this->m_selfContainer); Spell* spell = new Spell(m_caster, (*si), true, m_originalCasterGUID, m_selfContainer);
spell->prepare(&m_targets); // use original spell original targets spell->prepare(&m_targets); // use original spell original targets
} }
} }
@ -3399,8 +3399,6 @@ uint8 Spell::CanCast(bool strict)
m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES || m_spellInfo->EffectImplicitTargetA[j] == TARGET_SCRIPT_COORDINATES ||
m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT_COORDINATES ) m_spellInfo->EffectImplicitTargetB[j] == TARGET_SCRIPT_COORDINATES )
{ {
bool okDoo = false;
SpellScriptTarget::const_iterator lower = spellmgr.GetBeginSpellScriptTarget(m_spellInfo->Id); SpellScriptTarget::const_iterator lower = spellmgr.GetBeginSpellScriptTarget(m_spellInfo->Id);
SpellScriptTarget::const_iterator upper = spellmgr.GetEndSpellScriptTarget(m_spellInfo->Id); SpellScriptTarget::const_iterator upper = spellmgr.GetEndSpellScriptTarget(m_spellInfo->Id);
if(lower==upper) if(lower==upper)
@ -4888,7 +4886,7 @@ CurrentSpellTypes Spell::GetCurrentContainer()
return(CURRENT_GENERIC_SPELL); return(CURRENT_GENERIC_SPELL);
} }
bool Spell::CheckTarget( Unit* target, uint32 eff, bool hitPhase ) bool Spell::CheckTarget( Unit* target, uint32 eff )
{ {
// Check targets for creature type mask and remove not appropriate (skip explicit self target case, maybe need other explicit targets) // Check targets for creature type mask and remove not appropriate (skip explicit self target case, maybe need other explicit targets)
if(m_spellInfo->EffectImplicitTargetA[eff]!=TARGET_SELF ) if(m_spellInfo->EffectImplicitTargetA[eff]!=TARGET_SELF )

View file

@ -348,7 +348,7 @@ class Spell
void SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap); void SetTargetMap(uint32 i,uint32 cur,std::list<Unit*> &TagUnitMap);
Unit* SelectMagnetTarget(); Unit* SelectMagnetTarget();
bool CheckTarget( Unit* target, uint32 eff, bool hitPhase ); bool CheckTarget( Unit* target, uint32 eff );
void SendCastResult(uint8 result); void SendCastResult(uint8 result);
void SendSpellStart(); void SendSpellStart();

View file

@ -165,10 +165,10 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleNoImmediateEffect, //112 SPELL_AURA_OVERRIDE_CLASS_SCRIPTS &Aura::HandleNoImmediateEffect, //112 SPELL_AURA_OVERRIDE_CLASS_SCRIPTS
&Aura::HandleNoImmediateEffect, //113 SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus &Aura::HandleNoImmediateEffect, //113 SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN implemented in Unit::MeleeDamageBonus
&Aura::HandleNoImmediateEffect, //114 SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT implemented in Unit::MeleeDamageBonus &Aura::HandleNoImmediateEffect, //114 SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN_PCT implemented in Unit::MeleeDamageBonus
&Aura::HandleAuraHealing, //115 SPELL_AURA_MOD_HEALING &Aura::HandleNoImmediateEffect, //115 SPELL_AURA_MOD_HEALING implemented in Unit::SpellBaseHealingBonusForVictim
&Aura::HandleNoImmediateEffect, //116 SPELL_AURA_MOD_REGEN_DURING_COMBAT &Aura::HandleNoImmediateEffect, //116 SPELL_AURA_MOD_REGEN_DURING_COMBAT
&Aura::HandleNoImmediateEffect, //117 SPELL_AURA_MOD_MECHANIC_RESISTANCE implemented in Unit::MagicSpellHitResult &Aura::HandleNoImmediateEffect, //117 SPELL_AURA_MOD_MECHANIC_RESISTANCE implemented in Unit::MagicSpellHitResult
&Aura::HandleAuraHealingPct, //118 SPELL_AURA_MOD_HEALING_PCT &Aura::HandleNoImmediateEffect, //118 SPELL_AURA_MOD_HEALING_PCT implemented in Unit::SpellHealingBonus
&Aura::HandleUnused, //119 SPELL_AURA_SHARE_PET_TRACKING useless &Aura::HandleUnused, //119 SPELL_AURA_SHARE_PET_TRACKING useless
&Aura::HandleAuraUntrackable, //120 SPELL_AURA_UNTRACKABLE &Aura::HandleAuraUntrackable, //120 SPELL_AURA_UNTRACKABLE
&Aura::HandleAuraEmpathy, //121 SPELL_AURA_EMPATHY &Aura::HandleAuraEmpathy, //121 SPELL_AURA_EMPATHY
@ -186,7 +186,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleAuraModIncreaseHealthPercent, //133 SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT &Aura::HandleAuraModIncreaseHealthPercent, //133 SPELL_AURA_MOD_INCREASE_HEALTH_PERCENT
&Aura::HandleAuraModRegenInterrupt, //134 SPELL_AURA_MOD_MANA_REGEN_INTERRUPT &Aura::HandleAuraModRegenInterrupt, //134 SPELL_AURA_MOD_MANA_REGEN_INTERRUPT
&Aura::HandleModHealingDone, //135 SPELL_AURA_MOD_HEALING_DONE &Aura::HandleModHealingDone, //135 SPELL_AURA_MOD_HEALING_DONE
&Aura::HandleAuraHealingPct, //136 SPELL_AURA_MOD_HEALING_DONE_PERCENT implemented in Unit::SpellHealingBonus &Aura::HandleNoImmediateEffect, //136 SPELL_AURA_MOD_HEALING_DONE_PERCENT implemented in Unit::SpellHealingBonus
&Aura::HandleModTotalPercentStat, //137 SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE &Aura::HandleModTotalPercentStat, //137 SPELL_AURA_MOD_TOTAL_STAT_PERCENTAGE
&Aura::HandleHaste, //138 SPELL_AURA_MOD_HASTE &Aura::HandleHaste, //138 SPELL_AURA_MOD_HASTE
&Aura::HandleForceReaction, //139 SPELL_AURA_FORCE_REACTION &Aura::HandleForceReaction, //139 SPELL_AURA_FORCE_REACTION
@ -215,7 +215,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleAuraPowerBurn, //162 SPELL_AURA_POWER_BURN_MANA &Aura::HandleAuraPowerBurn, //162 SPELL_AURA_POWER_BURN_MANA
&Aura::HandleNoImmediateEffect, //163 SPELL_AURA_MOD_CRIT_DAMAGE_BONUS_MELEE &Aura::HandleNoImmediateEffect, //163 SPELL_AURA_MOD_CRIT_DAMAGE_BONUS_MELEE
&Aura::HandleUnused, //164 useless, only one test spell &Aura::HandleUnused, //164 useless, only one test spell
&Aura::HandleAuraAttackPowerAttacker, //165 SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS implemented in Unit::MeleeDamageBonus &Aura::HandleNoImmediateEffect, //165 SPELL_AURA_MELEE_ATTACK_POWER_ATTACKER_BONUS implemented in Unit::MeleeDamageBonus
&Aura::HandleAuraModAttackPowerPercent, //166 SPELL_AURA_MOD_ATTACK_POWER_PCT &Aura::HandleAuraModAttackPowerPercent, //166 SPELL_AURA_MOD_ATTACK_POWER_PCT
&Aura::HandleAuraModRangedAttackPowerPercent, //167 SPELL_AURA_MOD_RANGED_ATTACK_POWER_PCT &Aura::HandleAuraModRangedAttackPowerPercent, //167 SPELL_AURA_MOD_RANGED_ATTACK_POWER_PCT
&Aura::HandleNoImmediateEffect, //168 SPELL_AURA_MOD_DAMAGE_DONE_VERSUS implemented in Unit::SpellDamageBonus, Unit::MeleeDamageBonus &Aura::HandleNoImmediateEffect, //168 SPELL_AURA_MOD_DAMAGE_DONE_VERSUS implemented in Unit::SpellDamageBonus, Unit::MeleeDamageBonus
@ -2257,6 +2257,10 @@ void Aura::HandleAuraPeriodicDummy(bool apply, bool Real)
void Aura::HandleAuraMounted(bool apply, bool Real) void Aura::HandleAuraMounted(bool apply, bool Real)
{ {
// only at real add/remove aura
if(!Real)
return;
if(apply) if(apply)
{ {
CreatureInfo const* ci = objmgr.GetCreatureTemplate(m_modifier.m_miscvalue); CreatureInfo const* ci = objmgr.GetCreatureTemplate(m_modifier.m_miscvalue);
@ -3579,7 +3583,7 @@ void Aura::HandleModTaunt(bool apply, bool Real)
/*********************************************************/ /*********************************************************/
/*** MODIFY SPEED ***/ /*** MODIFY SPEED ***/
/*********************************************************/ /*********************************************************/
void Aura::HandleAuraModIncreaseSpeed(bool apply, bool Real) void Aura::HandleAuraModIncreaseSpeed(bool /*apply*/, bool Real)
{ {
// all applied/removed only at real aura add/remove // all applied/removed only at real aura add/remove
if(!Real) if(!Real)
@ -3588,7 +3592,7 @@ void Aura::HandleAuraModIncreaseSpeed(bool apply, bool Real)
m_target->UpdateSpeed(MOVE_RUN, true); m_target->UpdateSpeed(MOVE_RUN, true);
} }
void Aura::HandleAuraModIncreaseMountedSpeed(bool apply, bool Real) void Aura::HandleAuraModIncreaseMountedSpeed(bool /*apply*/, bool Real)
{ {
// all applied/removed only at real aura add/remove // all applied/removed only at real aura add/remove
if(!Real) if(!Real)
@ -3627,7 +3631,7 @@ void Aura::HandleAuraModIncreaseFlightSpeed(bool apply, bool Real)
m_target->UpdateSpeed(MOVE_FLY, true); m_target->UpdateSpeed(MOVE_FLY, true);
} }
void Aura::HandleAuraModIncreaseSwimSpeed(bool apply, bool Real) void Aura::HandleAuraModIncreaseSwimSpeed(bool /*apply*/, bool Real)
{ {
// all applied/removed only at real aura add/remove // all applied/removed only at real aura add/remove
if(!Real) if(!Real)
@ -3636,7 +3640,7 @@ void Aura::HandleAuraModIncreaseSwimSpeed(bool apply, bool Real)
m_target->UpdateSpeed(MOVE_SWIM, true); m_target->UpdateSpeed(MOVE_SWIM, true);
} }
void Aura::HandleAuraModDecreaseSpeed(bool apply, bool Real) void Aura::HandleAuraModDecreaseSpeed(bool /*apply*/, bool Real)
{ {
// all applied/removed only at real aura add/remove // all applied/removed only at real aura add/remove
if(!Real) if(!Real)
@ -3647,7 +3651,7 @@ void Aura::HandleAuraModDecreaseSpeed(bool apply, bool Real)
m_target->UpdateSpeed(MOVE_FLY, true); m_target->UpdateSpeed(MOVE_FLY, true);
} }
void Aura::HandleAuraModUseNormalSpeed(bool apply, bool Real) void Aura::HandleAuraModUseNormalSpeed(bool /*apply*/, bool Real)
{ {
// all applied/removed only at real aura add/remove // all applied/removed only at real aura add/remove
if(!Real) if(!Real)
@ -4327,7 +4331,7 @@ void Aura::HandleModPercentStat(bool apply, bool Real)
} }
} }
void Aura::HandleModSpellDamagePercentFromStat(bool apply, bool Real) void Aura::HandleModSpellDamagePercentFromStat(bool /*apply*/, bool Real)
{ {
if(m_target->GetTypeId() != TYPEID_PLAYER) if(m_target->GetTypeId() != TYPEID_PLAYER)
return; return;
@ -4338,7 +4342,7 @@ void Aura::HandleModSpellDamagePercentFromStat(bool apply, bool Real)
((Player*)m_target)->UpdateSpellDamageAndHealingBonus(); ((Player*)m_target)->UpdateSpellDamageAndHealingBonus();
} }
void Aura::HandleModSpellHealingPercentFromStat(bool apply, bool Real) void Aura::HandleModSpellHealingPercentFromStat(bool /*apply*/, bool Real)
{ {
if(m_target->GetTypeId() != TYPEID_PLAYER) if(m_target->GetTypeId() != TYPEID_PLAYER)
return; return;
@ -4356,7 +4360,7 @@ void Aura::HandleAuraModDispelResist(bool apply, bool Real)
m_target->CastSpell(m_target,44416,true,NULL,this,GetCasterGUID()); m_target->CastSpell(m_target,44416,true,NULL,this,GetCasterGUID());
} }
void Aura::HandleModSpellDamagePercentFromAttackPower(bool apply, bool Real) void Aura::HandleModSpellDamagePercentFromAttackPower(bool /*apply*/, bool Real)
{ {
if(m_target->GetTypeId() != TYPEID_PLAYER) if(m_target->GetTypeId() != TYPEID_PLAYER)
return; return;
@ -4367,7 +4371,7 @@ void Aura::HandleModSpellDamagePercentFromAttackPower(bool apply, bool Real)
((Player*)m_target)->UpdateSpellDamageAndHealingBonus(); ((Player*)m_target)->UpdateSpellDamageAndHealingBonus();
} }
void Aura::HandleModSpellHealingPercentFromAttackPower(bool apply, bool Real) void Aura::HandleModSpellHealingPercentFromAttackPower(bool /*apply*/, bool Real)
{ {
if(m_target->GetTypeId() != TYPEID_PLAYER) if(m_target->GetTypeId() != TYPEID_PLAYER)
return; return;
@ -4376,7 +4380,7 @@ void Aura::HandleModSpellHealingPercentFromAttackPower(bool apply, bool Real)
((Player*)m_target)->UpdateSpellDamageAndHealingBonus(); ((Player*)m_target)->UpdateSpellDamageAndHealingBonus();
} }
void Aura::HandleModHealingDone(bool apply, bool Real) void Aura::HandleModHealingDone(bool /*apply*/, bool Real)
{ {
if(m_target->GetTypeId() != TYPEID_PLAYER) if(m_target->GetTypeId() != TYPEID_PLAYER)
return; return;
@ -4416,7 +4420,7 @@ void Aura::HandleModTotalPercentStat(bool apply, bool Real)
} }
} }
void Aura::HandleAuraModResistenceOfStatPercent(bool apply, bool Real) void Aura::HandleAuraModResistenceOfStatPercent(bool /*apply*/, bool Real)
{ {
if(m_target->GetTypeId() != TYPEID_PLAYER) if(m_target->GetTypeId() != TYPEID_PLAYER)
return; return;
@ -4551,7 +4555,7 @@ void Aura::HandleModPowerRegen(bool apply, bool Real) // drinking
((Player*)m_target)->UpdateManaRegen(); ((Player*)m_target)->UpdateManaRegen();
} }
void Aura::HandleModPowerRegenPCT(bool apply, bool Real) void Aura::HandleModPowerRegenPCT(bool /*apply*/, bool Real)
{ {
// spells required only Real aura add/remove // spells required only Real aura add/remove
if(!Real) if(!Real)
@ -4565,7 +4569,7 @@ void Aura::HandleModPowerRegenPCT(bool apply, bool Real)
((Player*)m_target)->UpdateManaRegen(); ((Player*)m_target)->UpdateManaRegen();
} }
void Aura::HandleModManaRegen(bool apply, bool Real) void Aura::HandleModManaRegen(bool /*apply*/, bool Real)
{ {
// spells required only Real aura add/remove // spells required only Real aura add/remove
if(!Real) if(!Real)
@ -4666,7 +4670,7 @@ void Aura::HandleAuraModIncreaseHealthPercent(bool apply, bool Real)
/*** FIGHT ***/ /*** FIGHT ***/
/********************************/ /********************************/
void Aura::HandleAuraModParryPercent(bool apply, bool Real) void Aura::HandleAuraModParryPercent(bool /*apply*/, bool Real)
{ {
if(m_target->GetTypeId()!=TYPEID_PLAYER) if(m_target->GetTypeId()!=TYPEID_PLAYER)
return; return;
@ -4674,7 +4678,7 @@ void Aura::HandleAuraModParryPercent(bool apply, bool Real)
((Player*)m_target)->UpdateParryPercentage(); ((Player*)m_target)->UpdateParryPercentage();
} }
void Aura::HandleAuraModDodgePercent(bool apply, bool Real) void Aura::HandleAuraModDodgePercent(bool /*apply*/, bool Real)
{ {
if(m_target->GetTypeId()!=TYPEID_PLAYER) if(m_target->GetTypeId()!=TYPEID_PLAYER)
return; return;
@ -4683,7 +4687,7 @@ void Aura::HandleAuraModDodgePercent(bool apply, bool Real)
//sLog.outError("BONUS DODGE CHANCE: + %f", float(m_modifier.m_amount)); //sLog.outError("BONUS DODGE CHANCE: + %f", float(m_modifier.m_amount));
} }
void Aura::HandleAuraModBlockPercent(bool apply, bool Real) void Aura::HandleAuraModBlockPercent(bool /*apply*/, bool Real)
{ {
if(m_target->GetTypeId()!=TYPEID_PLAYER) if(m_target->GetTypeId()!=TYPEID_PLAYER)
return; return;
@ -4692,7 +4696,7 @@ void Aura::HandleAuraModBlockPercent(bool apply, bool Real)
//sLog.outError("BONUS BLOCK CHANCE: + %f", float(m_modifier.m_amount)); //sLog.outError("BONUS BLOCK CHANCE: + %f", float(m_modifier.m_amount));
} }
void Aura::HandleAuraModRegenInterrupt(bool apply, bool Real) void Aura::HandleAuraModRegenInterrupt(bool /*apply*/, bool Real)
{ {
// spells required only Real aura add/remove // spells required only Real aura add/remove
if(!Real) if(!Real)
@ -4760,7 +4764,7 @@ void Aura::HandleModSpellCritChance(bool apply, bool Real)
} }
} }
void Aura::HandleModSpellCritChanceShool(bool apply, bool Real) void Aura::HandleModSpellCritChanceShool(bool /*apply*/, bool Real)
{ {
// spells required only Real aura add/remove // spells required only Real aura add/remove
if(!Real) if(!Real)
@ -4842,39 +4846,6 @@ void Aura::HandleAuraModRangedAttackPower(bool apply, bool Real)
m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(m_modifier.m_amount), apply); m_target->HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(m_modifier.m_amount), apply);
} }
void Aura::HandleAuraAttackPowerAttacker(bool apply, bool Real)
{
// spells required only Real aura add/remove
if(!Real)
return;
Unit *caster = GetCaster();
if (!caster)
return;
// Hunter's Mark
if (m_spellProto->SpellFamilyName == SPELLFAMILY_HUNTER && m_spellProto->SpellFamilyFlags & 0x0000000000000400LL)
{
// Check Improved Hunter's Mark bonus on caster
Unit::AuraList const& mOverrideClassScript = caster->GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
for(Unit::AuraList::const_iterator i = mOverrideClassScript.begin(); i != mOverrideClassScript.end(); ++i)
{
Modifier* mod = (*i)->GetModifier();
// mproved Hunter's Mark script from 5236 to 5240
if (mod->m_miscvalue >= 5236 && mod->m_miscvalue <= 5240)
{
// Get amount of ranged bonus for this spell..
int32 ranged_bonus = caster->CalculateSpellDamage(m_spellProto, 1, m_spellProto->EffectBasePoints[1], m_target);
// Set melee attack power bonus % from ranged depends from Improved mask aura
m_modifier.m_amount = mod->m_amount * ranged_bonus / 100;
m_currentBasePoints = m_modifier.m_amount;
break;
}
}
return;
}
}
void Aura::HandleAuraModAttackPowerPercent(bool apply, bool Real) void Aura::HandleAuraModAttackPowerPercent(bool apply, bool Real)
{ {
//UNIT_FIELD_ATTACK_POWER_MULTIPLIER = multiplier - 1 //UNIT_FIELD_ATTACK_POWER_MULTIPLIER = multiplier - 1
@ -5322,7 +5293,7 @@ void Aura::HandleForceMoveForward(bool apply, bool Real)
m_target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE); m_target->RemoveFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FORCE_MOVE);
} }
void Aura::HandleAuraModExpertise(bool apply, bool Real) void Aura::HandleAuraModExpertise(bool /*apply*/, bool Real)
{ {
if(m_target->GetTypeId() != TYPEID_PLAYER) if(m_target->GetTypeId() != TYPEID_PLAYER)
return; return;
@ -5347,17 +5318,6 @@ void Aura::HandleModTargetResistance(bool apply, bool Real)
m_target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE,m_modifier.m_amount, apply); m_target->ApplyModInt32Value(PLAYER_FIELD_MOD_TARGET_RESISTANCE,m_modifier.m_amount, apply);
} }
//HandleNoImmediateEffect auras implementation to support new stat system
void Aura::HandleAuraHealing(bool apply, bool Real)
{
//m_target->HandleStatModifier(UNIT_MOD_HEALING, TOTAL_VALUE, float(m_modifier.m_amount), apply);
}
void Aura::HandleAuraHealingPct(bool apply, bool Real)
{
//m_target->HandleStatModifier(UNIT_MOD_HEALING, TOTAL_PCT, float(m_modifier.m_amount), apply);
}
void Aura::HandleShieldBlockValue(bool apply, bool Real) void Aura::HandleShieldBlockValue(bool apply, bool Real)
{ {
BaseModType modType = FLAT_MOD; BaseModType modType = FLAT_MOD;

View file

@ -183,15 +183,12 @@ class MANGOS_DLL_SPEC Aura
void HandleAuraAllowFlight(bool Apply, bool Real); void HandleAuraAllowFlight(bool Apply, bool Real);
void HandleModRating(bool apply, bool Real); void HandleModRating(bool apply, bool Real);
void HandleModTargetResistance(bool apply, bool Real); void HandleModTargetResistance(bool apply, bool Real);
void HandleAuraAttackPowerAttacker(bool apply, bool Real);
void HandleAuraModAttackPowerPercent(bool apply, bool Real); void HandleAuraModAttackPowerPercent(bool apply, bool Real);
void HandleAuraModRangedAttackPowerPercent(bool apply, bool Real); void HandleAuraModRangedAttackPowerPercent(bool apply, bool Real);
void HandleAuraModRangedAttackPowerOfStatPercent(bool apply, bool Real); void HandleAuraModRangedAttackPowerOfStatPercent(bool apply, bool Real);
void HandleSpiritOfRedemption(bool apply, bool Real); void HandleSpiritOfRedemption(bool apply, bool Real);
void HandleAuraHealingPct(bool apply, bool Real);
void HandleModManaRegen(bool apply, bool Real); void HandleModManaRegen(bool apply, bool Real);
void HandleComprehendLanguage(bool apply, bool Real); void HandleComprehendLanguage(bool apply, bool Real);
void HandleAuraHealing(bool apply, bool Real);
void HandleShieldBlockValue(bool apply, bool Real); void HandleShieldBlockValue(bool apply, bool Real);
void HandleModSpellCritChanceShool(bool apply, bool Real); void HandleModSpellCritChanceShool(bool apply, bool Real);
void HandleAuraRetainComboPoints(bool apply, bool Real); void HandleAuraRetainComboPoints(bool apply, bool Real);

View file

@ -2218,7 +2218,7 @@ void Spell::EffectPowerDrain(uint32 i)
m_caster->ModifyPower(POWER_MANA,gain); m_caster->ModifyPower(POWER_MANA,gain);
//send log //send log
m_caster->SendEnergizeSpellLog(m_caster, m_spellInfo->Id,gain,POWER_MANA,false); m_caster->SendEnergizeSpellLog(m_caster, m_spellInfo->Id,gain,POWER_MANA);
} }
} }
@ -2234,7 +2234,7 @@ void Spell::EffectSendEvent(uint32 EffectIndex)
case 23333: // Pickup Horde Flag case 23333: // Pickup Horde Flag
/*do not uncomment . /*do not uncomment .
if(bg->GetTypeID()==BATTLEGROUND_WS) if(bg->GetTypeID()==BATTLEGROUND_WS)
bg->EventPlayerClickedOnFlag((Player*)m_caster, this->gameObjTarget); bg->EventPlayerClickedOnFlag((Player*)m_caster, gameObjTarget);
sLog.outDebug("Send Event Horde Flag Picked Up"); sLog.outDebug("Send Event Horde Flag Picked Up");
break; break;
/* not used : /* not used :
@ -2247,7 +2247,7 @@ void Spell::EffectSendEvent(uint32 EffectIndex)
case 23335: // Pickup Alliance Flag case 23335: // Pickup Alliance Flag
/*do not uncomment ... (it will cause crash, because of null targetobject!) anyway this is a bad way to call that event, because it would cause recursion /*do not uncomment ... (it will cause crash, because of null targetobject!) anyway this is a bad way to call that event, because it would cause recursion
if(bg->GetTypeID()==BATTLEGROUND_WS) if(bg->GetTypeID()==BATTLEGROUND_WS)
bg->EventPlayerClickedOnFlag((Player*)m_caster, this->gameObjTarget); bg->EventPlayerClickedOnFlag((Player*)m_caster, gameObjTarget);
sLog.outDebug("Send Event Alliance Flag Picked Up"); sLog.outDebug("Send Event Alliance Flag Picked Up");
break; break;
/* not used : /* not used :
@ -2258,18 +2258,18 @@ void Spell::EffectSendEvent(uint32 EffectIndex)
break; break;
case 23385: // Alliance Flag Returns case 23385: // Alliance Flag Returns
if(bg->GetTypeID()==BATTLEGROUND_WS) if(bg->GetTypeID()==BATTLEGROUND_WS)
bg->EventPlayerClickedOnFlag((Player*)m_caster, this->gameObjTarget); bg->EventPlayerClickedOnFlag((Player*)m_caster, gameObjTarget);
sLog.outDebug("Alliance Flag Returned"); sLog.outDebug("Alliance Flag Returned");
break; break;
case 23386: // Horde Flag Returns case 23386: // Horde Flag Returns
if(bg->GetTypeID()==BATTLEGROUND_WS) if(bg->GetTypeID()==BATTLEGROUND_WS)
bg->EventPlayerClickedOnFlag((Player*)m_caster, this->gameObjTarget); bg->EventPlayerClickedOnFlag((Player*)m_caster, gameObjTarget);
sLog.outDebug("Horde Flag Returned"); sLog.outDebug("Horde Flag Returned");
break;*/ break;*/
case 34976: case 34976:
/* /*
if(bg->GetTypeID()==BATTLEGROUND_EY) if(bg->GetTypeID()==BATTLEGROUND_EY)
bg->EventPlayerClickedOnFlag((Player*)m_caster, this->gameObjTarget); bg->EventPlayerClickedOnFlag((Player*)m_caster, gameObjTarget);
*/ */
break; break;
default: default:
@ -3691,13 +3691,13 @@ void Spell::EffectAddHonor(uint32 /*i*/)
if(unitTarget->GetTypeId() != TYPEID_PLAYER) if(unitTarget->GetTypeId() != TYPEID_PLAYER)
return; return;
sLog.outDebug("SpellEffect::AddHonor called for spell_id %u , that rewards %d honor points to player: %u", m_spellInfo->Id, this->damage, ((Player*)unitTarget)->GetGUIDLow()); sLog.outDebug("SpellEffect::AddHonor called for spell_id %u , that rewards %d honor points to player: %u", m_spellInfo->Id, damage, ((Player*)unitTarget)->GetGUIDLow());
// TODO: find formula for honor reward based on player's level! // TODO: find formula for honor reward based on player's level!
// now fixed only for level 70 players: // now fixed only for level 70 players:
if (((Player*)unitTarget)->getLevel() == 70) if (((Player*)unitTarget)->getLevel() == 70)
((Player*)unitTarget)->RewardHonor(NULL, 1, this->damage); ((Player*)unitTarget)->RewardHonor(NULL, 1, damage);
} }
void Spell::EffectTradeSkill(uint32 /*i*/) void Spell::EffectTradeSkill(uint32 /*i*/)
@ -5383,7 +5383,7 @@ void Spell::EffectSummonObject(uint32 i)
m_caster->m_ObjectSlot[slot] = pGameObj->GetGUID(); m_caster->m_ObjectSlot[slot] = pGameObj->GetGUID();
} }
void Spell::EffectResurrect(uint32 i) void Spell::EffectResurrect(uint32 /*effIndex*/)
{ {
if(!unitTarget) if(!unitTarget)
return; return;

View file

@ -1648,8 +1648,6 @@ void SpellMgr::LoadSpellLearnSkills()
dbc_node.value = (entry->EffectBasePoints[i]+1)*75; dbc_node.value = (entry->EffectBasePoints[i]+1)*75;
dbc_node.maxvalue = (entry->EffectBasePoints[i]+1)*75; dbc_node.maxvalue = (entry->EffectBasePoints[i]+1)*75;
SpellLearnSkillNode const* db_node = GetSpellLearnSkill(spell);
mSpellLearnSkills[spell] = dbc_node; mSpellLearnSkills[spell] = dbc_node;
++dbc_count; ++dbc_count;
break; break;

View file

@ -35,7 +35,7 @@ Totem::Totem() : Creature()
void Totem::Update( uint32 time ) void Totem::Update( uint32 time )
{ {
Unit *owner = GetOwner(); Unit *owner = GetOwner();
if (!owner || !owner->isAlive() || !this->isAlive()) if (!owner || !owner->isAlive() || !isAlive())
{ {
UnSummon(); // remove self UnSummon(); // remove self
return; return;
@ -89,7 +89,7 @@ void Totem::UnSummon()
CombatStop(); CombatStop();
RemoveAurasDueToSpell(GetSpell()); RemoveAurasDueToSpell(GetSpell());
Unit *owner = this->GetOwner(); Unit *owner = GetOwner();
if (owner) if (owner)
{ {
// clear owenr's totem slot // clear owenr's totem slot
@ -130,11 +130,11 @@ void Totem::SetOwner(uint64 guid)
{ {
SetUInt64Value(UNIT_FIELD_SUMMONEDBY, guid); SetUInt64Value(UNIT_FIELD_SUMMONEDBY, guid);
SetUInt64Value(UNIT_FIELD_CREATEDBY, guid); SetUInt64Value(UNIT_FIELD_CREATEDBY, guid);
Unit *owner = this->GetOwner(); Unit *owner = GetOwner();
if (owner) if (owner)
{ {
this->setFaction(owner->getFaction()); setFaction(owner->getFaction());
this->SetLevel(owner->getLevel()); SetLevel(owner->getLevel());
} }
} }

View file

@ -465,7 +465,7 @@ bool Transport::AddPassenger(Player* passenger)
{ {
if (m_passengers.find(passenger) == m_passengers.end()) if (m_passengers.find(passenger) == m_passengers.end())
{ {
sLog.outDetail("Player %s boarded transport %s.", passenger->GetName(), this->m_name.c_str()); sLog.outDetail("Player %s boarded transport %s.", passenger->GetName(), m_name.c_str());
m_passengers.insert(passenger); m_passengers.insert(passenger);
} }
return true; return true;
@ -475,7 +475,7 @@ bool Transport::RemovePassenger(Player* passenger)
{ {
if (m_passengers.find(passenger) != m_passengers.end()) if (m_passengers.find(passenger) != m_passengers.end())
{ {
sLog.outDetail("Player %s removed from transport %s.", passenger->GetName(), this->m_name.c_str()); sLog.outDetail("Player %s removed from transport %s.", passenger->GetName(), m_name.c_str());
m_passengers.erase(passenger); m_passengers.erase(passenger);
} }
return true; return true;
@ -499,7 +499,7 @@ void Transport::Update(uint32 /*p_time*/)
} }
else else
{ {
//MapManager::Instance().GetMap(m_curr->second.mapid)->GameobjectRelocation((GameObject *)this, m_curr->second.x, m_curr->second.y, m_curr->second.z, this->m_orientation); //MapManager::Instance().GetMap(m_curr->second.mapid)->GameobjectRelocation((GameObject *)this, m_curr->second.x, m_curr->second.y, m_curr->second.z, m_orientation);
Relocate(m_curr->second.x, m_curr->second.y, m_curr->second.z); Relocate(m_curr->second.x, m_curr->second.y, m_curr->second.z);
} }
@ -515,13 +515,13 @@ void Transport::Update(uint32 /*p_time*/)
m_nextNodeTime = m_curr->first; m_nextNodeTime = m_curr->first;
if (m_curr == m_WayPoints.begin() && (sLog.getLogFilter() & LOG_FILTER_TRANSPORT_MOVES)==0) if (m_curr == m_WayPoints.begin() && (sLog.getLogFilter() & LOG_FILTER_TRANSPORT_MOVES)==0)
sLog.outDetail(" ************ BEGIN ************** %s", this->m_name.c_str()); sLog.outDetail(" ************ BEGIN ************** %s", m_name.c_str());
// MapManager::Instance().GetMap(m_curr->second.mapid)->Add(&this); // -> // ->Add(t); // MapManager::Instance().GetMap(m_curr->second.mapid)->Add(&this); // -> // ->Add(t);
//MapManager::Instance().GetMap(m_curr->second.mapid)->Remove((GameObject *)this, false); // -> // ->Add(t); //MapManager::Instance().GetMap(m_curr->second.mapid)->Remove((GameObject *)this, false); // -> // ->Add(t);
//MapManager::Instance().GetMap(m_curr->second.mapid)->Add((GameObject *)this); // -> // ->Add(t); //MapManager::Instance().GetMap(m_curr->second.mapid)->Add((GameObject *)this); // -> // ->Add(t);
if ((sLog.getLogFilter() & LOG_FILTER_TRANSPORT_MOVES)==0) if ((sLog.getLogFilter() & LOG_FILTER_TRANSPORT_MOVES)==0)
sLog.outDetail("%s moved to %f %f %f %d", this->m_name.c_str(), m_curr->second.x, m_curr->second.y, m_curr->second.z, m_curr->second.mapid); sLog.outDetail("%s moved to %f %f %f %d", m_name.c_str(), m_curr->second.x, m_curr->second.y, m_curr->second.z, m_curr->second.mapid);
} }
} }

View file

@ -37,7 +37,7 @@ struct MANGOS_DLL_DECL Traveller
Traveller(const Traveller &obj) : i_traveller(obj) {} Traveller(const Traveller &obj) : i_traveller(obj) {}
Traveller& operator=(const Traveller &obj) Traveller& operator=(const Traveller &obj)
{ {
this->~Traveller(); ~Traveller();
new (this) Traveller(obj); new (this) Traveller(obj);
return *this; return *this;
} }

View file

@ -1102,8 +1102,6 @@ void Unit::DealFlatDamage(Unit *pVictim, SpellEntry const *spellInfo, uint32 *da
// Physical Damage // Physical Damage
if ( GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_NORMAL ) if ( GetSpellSchoolMask(spellInfo) & SPELL_SCHOOL_MASK_NORMAL )
{ {
uint32 modDamage=*damage;
// apply spellmod to Done damage // apply spellmod to Done damage
if(Player* modOwner = GetSpellModOwner()) if(Player* modOwner = GetSpellModOwner())
modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_DAMAGE, *damage); modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_DAMAGE, *damage);
@ -1388,7 +1386,7 @@ uint32 Unit::SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage
{ {
if(!this || !pVictim) if(!this || !pVictim)
return 0; return 0;
if(!this->isAlive() || !pVictim->isAlive()) if(!isAlive() || !pVictim->isAlive())
return 0; return 0;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellID); SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellID);
@ -4589,7 +4587,7 @@ void Unit::CastMeleeProcDamageAndSpell(Unit* pVictim, uint32 damage, SpellSchool
ProcDamageAndSpell(pVictim, procAttacker, procVictim, damage, damageSchoolMask, spellCasted, isTriggeredSpell, attType); ProcDamageAndSpell(pVictim, procAttacker, procVictim, damage, damageSchoolMask, spellCasted, isTriggeredSpell, attType);
} }
bool Unit::HandleHasteAuraProc(Unit *pVictim, SpellEntry const *hasteSpell, uint32 /*effIndex*/, uint32 damage, Aura* triggeredByAura, SpellEntry const * procSpell, uint32 /*procFlag*/, uint32 cooldown) bool Unit::HandleHasteAuraProc(Unit *pVictim, SpellEntry const *hasteSpell, uint32 /*effIndex*/, uint32 damage, Aura* triggeredByAura, SpellEntry const * /*procSpell*/, uint32 /*procFlag*/, uint32 cooldown)
{ {
Item* castItem = triggeredByAura->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER Item* castItem = triggeredByAura->GetCastItemGUID() && GetTypeId()==TYPEID_PLAYER
? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGUID()) : NULL; ? ((Player*)this)->GetItemByGuid(triggeredByAura->GetCastItemGUID()) : NULL;
@ -6237,7 +6235,6 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
if(!pVictim || !pVictim->isAlive()) if(!pVictim || !pVictim->isAlive())
return false; return false;
uint32 spell = 0;
switch(triggeredByAura->GetSpellProto()->Id) switch(triggeredByAura->GetSpellProto()->Id)
{ {
case 20186: case 20186:
@ -6267,7 +6264,6 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
return false; return false;
// overwrite non existing triggered spell call in spell.dbc // overwrite non existing triggered spell call in spell.dbc
uint32 spell = 0;
switch(triggeredByAura->GetSpellProto()->Id) switch(triggeredByAura->GetSpellProto()->Id)
{ {
case 20185: case 20185:
@ -6467,7 +6463,7 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, Aura* triggeredB
return true; return true;
} }
bool Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, int32 scriptId, uint32 damage, Aura *triggeredByAura, SpellEntry const *procSpell, uint32 cooldown) bool Unit::HandleOverrideClassScriptAuraProc(Unit *pVictim, int32 scriptId, uint32 /*damage*/, Aura *triggeredByAura, SpellEntry const *procSpell, uint32 cooldown)
{ {
if(!pVictim || !pVictim->isAlive()) if(!pVictim || !pVictim->isAlive())
return false; return false;
@ -7180,7 +7176,7 @@ void Unit::SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, bool c
SendMessageToSet(&data, true); SendMessageToSet(&data, true);
} }
void Unit::SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, Powers powertype, bool critical) void Unit::SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, Powers powertype)
{ {
WorldPacket data(SMSG_SPELLENERGIZELOG, (8+8+4+4+4+1)); WorldPacket data(SMSG_SPELLENERGIZELOG, (8+8+4+4+4+1));
data.append(pVictim->GetPackGUID()); data.append(pVictim->GetPackGUID());
@ -8125,7 +8121,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT
int32 TakenFlatBenefit = 0; int32 TakenFlatBenefit = 0;
// ..done (for creature type by mask) in taken // ..done (for creature type by mask) in taken
AuraList const& mDamageDoneCreature = this->GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE); AuraList const& mDamageDoneCreature = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_CREATURE);
for(AuraList::const_iterator i = mDamageDoneCreature.begin();i != mDamageDoneCreature.end(); ++i) for(AuraList::const_iterator i = mDamageDoneCreature.begin();i != mDamageDoneCreature.end(); ++i)
if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue)) if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue))
DoneFlatBenefit += (*i)->GetModifier()->m_amount; DoneFlatBenefit += (*i)->GetModifier()->m_amount;
@ -8193,7 +8189,7 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage,WeaponAttackType attT
// SPELL_AURA_MOD_DAMAGE_PERCENT_DONE included in weapon damage // SPELL_AURA_MOD_DAMAGE_PERCENT_DONE included in weapon damage
// SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT included in weapon damage // SPELL_AURA_MOD_OFFHAND_DAMAGE_PCT included in weapon damage
AuraList const& mDamageDoneVersus = this->GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS); AuraList const& mDamageDoneVersus = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE_VERSUS);
for(AuraList::const_iterator i = mDamageDoneVersus.begin();i != mDamageDoneVersus.end(); ++i) for(AuraList::const_iterator i = mDamageDoneVersus.begin();i != mDamageDoneVersus.end(); ++i)
if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue)) if(creatureTypeMask & uint32((*i)->GetModifier()->m_miscvalue))
DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f; DoneTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;
@ -8733,7 +8729,7 @@ bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList)
//Visible distance is modified by //Visible distance is modified by
//-Level Diff (every level diff = 1.0f in visible distance) //-Level Diff (every level diff = 1.0f in visible distance)
visibleDistance += int32(u->getLevelForTarget(this)) - int32(this->getLevelForTarget(u)); visibleDistance += int32(u->getLevelForTarget(this)) - int32(getLevelForTarget(u));
//This allows to check talent tree and will add addition stealth dependent on used points) //This allows to check talent tree and will add addition stealth dependent on used points)
int32 stealthMod = GetTotalAuraModifier(SPELL_AURA_MOD_STEALTH_LEVEL); int32 stealthMod = GetTotalAuraModifier(SPELL_AURA_MOD_STEALTH_LEVEL);
@ -10407,7 +10403,7 @@ void Unit::StopMoving()
// send explicit stop packet // send explicit stop packet
// rely on vmaps here because for exemple stormwind is in air // rely on vmaps here because for exemple stormwind is in air
float z = MapManager::Instance().GetBaseMap(GetMapId())->GetHeight(GetPositionX(), GetPositionY(), GetPositionZ(), true); //float z = MapManager::Instance().GetBaseMap(GetMapId())->GetHeight(GetPositionX(), GetPositionY(), GetPositionZ(), true);
//if (fabs(GetPositionZ() - z) < 2.0f) //if (fabs(GetPositionZ() - z) < 2.0f)
// Relocate(GetPositionX(), GetPositionY(), z); // Relocate(GetPositionX(), GetPositionY(), z);
Relocate(GetPositionX(), GetPositionY(),GetPositionZ()); Relocate(GetPositionX(), GetPositionY(),GetPositionZ());
@ -10889,9 +10885,9 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id)
return NULL; return NULL;
} }
pet->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, this->GetGUID()); pet->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, GetGUID());
pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, this->GetGUID()); pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, GetGUID());
pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,this->getFaction()); pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,getFaction());
pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id); pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id);
uint32 level = (creatureTarget->getLevel() < (getLevel() - 5)) ? (getLevel() - 5) : creatureTarget->getLevel(); uint32 level = (creatureTarget->getLevel() < (getLevel() - 5)) ? (getLevel() - 5) : creatureTarget->getLevel();

View file

@ -946,7 +946,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
bool isInAccessablePlaceFor(Creature const* c) const; bool isInAccessablePlaceFor(Creature const* c) const;
void SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, bool critical = false); void SendHealSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, bool critical = false);
void SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage,Powers powertype, bool critical = false); void SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage,Powers powertype);
uint32 SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage, bool isTriggeredSpell = false, bool useSpellDamage = true); uint32 SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage, bool isTriggeredSpell = false, bool useSpellDamage = true);
void CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem = NULL, Aura* triggredByAura = NULL, uint64 originalCaster = 0); void CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem = NULL, Aura* triggredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, Item *castItem= NULL, Aura* triggredByAura = NULL, uint64 originalCaster = 0); void CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, Item *castItem= NULL, Aura* triggredByAura = NULL, uint64 originalCaster = 0);

View file

@ -209,7 +209,6 @@ World::AddSession_ (WorldSession* s)
uint32 Sessions = GetActiveAndQueuedSessionCount (); uint32 Sessions = GetActiveAndQueuedSessionCount ();
uint32 pLimit = GetPlayerAmountLimit (); uint32 pLimit = GetPlayerAmountLimit ();
uint32 QueueSize = GetQueueSize (); //number of players in the queue uint32 QueueSize = GetQueueSize (); //number of players in the queue
bool inQueue = false;
//so we don't count the user trying to //so we don't count the user trying to
//login as a session and queue the socket that we are using //login as a session and queue the socket that we are using
--Sessions; --Sessions;

View file

@ -165,7 +165,7 @@ class MANGOS_DLL_SPEC WorldSession
//mail //mail
//used with item_page table //used with item_page table
bool SendItemInfo( uint32 itemid, WorldPacket data ); bool SendItemInfo( uint32 itemid, WorldPacket data );
static void SendReturnToSender(uint8 messageType, uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, std::string subject, uint32 itemTextId, MailItemsInfo *mi, uint32 money, uint32 COD, uint16 mailTemplateId = 0); static void SendReturnToSender(uint8 messageType, uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, std::string subject, uint32 itemTextId, MailItemsInfo *mi, uint32 money, uint16 mailTemplateId = 0);
static void SendMailTo(Player* receiver, uint8 messageType, uint8 stationery, uint32 sender_guidlow_or_entry, uint32 received_guidlow, std::string subject, uint32 itemTextId, MailItemsInfo* mi, uint32 money, uint32 COD, uint32 checked, uint32 deliver_delay = 0, uint16 mailTemplateId = 0); static void SendMailTo(Player* receiver, uint8 messageType, uint8 stationery, uint32 sender_guidlow_or_entry, uint32 received_guidlow, std::string subject, uint32 itemTextId, MailItemsInfo* mi, uint32 money, uint32 COD, uint32 checked, uint32 deliver_delay = 0, uint16 mailTemplateId = 0);
//auction //auction

View file

@ -81,7 +81,7 @@ m_Seed (static_cast<uint32> (rand32 ())),
m_OverSpeedPings (0), m_OverSpeedPings (0),
m_LastPingTime (ACE_Time_Value::zero) m_LastPingTime (ACE_Time_Value::zero)
{ {
this->reference_counting_policy ().value (ACE_Event_Handler::Reference_Counting_Policy::ENABLED); reference_counting_policy ().value (ACE_Event_Handler::Reference_Counting_Policy::ENABLED);
} }
WorldSocket::~WorldSocket (void) WorldSocket::~WorldSocket (void)
@ -92,9 +92,9 @@ WorldSocket::~WorldSocket (void)
if (m_OutBuffer) if (m_OutBuffer)
m_OutBuffer->release (); m_OutBuffer->release ();
this->closing_ = true; closing_ = true;
this->peer ().close (); peer ().close ();
WorldPacket* pct; WorldPacket* pct;
while (m_PacketQueue.dequeue_head (pct) == 0) while (m_PacketQueue.dequeue_head (pct) == 0)
@ -103,7 +103,7 @@ WorldSocket::~WorldSocket (void)
bool WorldSocket::IsClosed (void) const bool WorldSocket::IsClosed (void) const
{ {
return this->closing_; return closing_;
} }
void WorldSocket::CloseSocket (void) void WorldSocket::CloseSocket (void)
@ -111,12 +111,12 @@ void WorldSocket::CloseSocket (void)
{ {
ACE_GUARD (LockType, Guard, m_OutBufferLock); ACE_GUARD (LockType, Guard, m_OutBufferLock);
if (this->closing_) if (closing_)
return; return;
this->closing_ = true; closing_ = true;
this->peer ().close_writer (); peer ().close_writer ();
} }
{ {
@ -135,7 +135,7 @@ int WorldSocket::SendPacket (const WorldPacket& pct)
{ {
ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1); ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1);
if (this->closing_) if (closing_)
return -1; return -1;
// Dump outgoing packet. // Dump outgoing packet.
@ -180,12 +180,12 @@ int WorldSocket::SendPacket (const WorldPacket& pct)
long WorldSocket::AddReference (void) long WorldSocket::AddReference (void)
{ {
return static_cast<long> (this->add_reference ()); return static_cast<long> (add_reference ());
} }
long WorldSocket::RemoveReference (void) long WorldSocket::RemoveReference (void)
{ {
return static_cast<long> (this->remove_reference ()); return static_cast<long> (remove_reference ());
} }
int WorldSocket::open (void *a) int WorldSocket::open (void *a)
@ -210,7 +210,7 @@ int WorldSocket::open (void *a)
// Store peer address. // Store peer address.
ACE_INET_Addr remote_addr; ACE_INET_Addr remote_addr;
if (this->peer ().get_remote_addr (remote_addr) == -1) if (peer ().get_remote_addr (remote_addr) == -1)
{ {
sLog.outError ("WorldSocket::open: peer ().get_remote_addr errno = %s", ACE_OS::strerror (errno)); sLog.outError ("WorldSocket::open: peer ().get_remote_addr errno = %s", ACE_OS::strerror (errno));
return -1; return -1;
@ -226,42 +226,42 @@ int WorldSocket::open (void *a)
return -1; return -1;
// Register with ACE Reactor // Register with ACE Reactor
if (this->reactor ()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1) if (reactor ()->register_handler(this, ACE_Event_Handler::READ_MASK | ACE_Event_Handler::WRITE_MASK) == -1)
{ {
sLog.outError ("WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno)); sLog.outError ("WorldSocket::open: unable to register client handler errno = %s", ACE_OS::strerror (errno));
return -1; return -1;
} }
// reactor takes care of the socket from now on // reactor takes care of the socket from now on
this->remove_reference (); remove_reference ();
return 0; return 0;
} }
int WorldSocket::close (int) int WorldSocket::close (int)
{ {
this->shutdown (); shutdown ();
this->closing_ = true; closing_ = true;
this->remove_reference (); remove_reference ();
return 0; return 0;
} }
int WorldSocket::handle_input (ACE_HANDLE) int WorldSocket::handle_input (ACE_HANDLE)
{ {
if (this->closing_) if (closing_)
return -1; return -1;
switch (this->handle_input_missing_data ()) switch (handle_input_missing_data ())
{ {
case -1 : case -1 :
{ {
if ((errno == EWOULDBLOCK) || if ((errno == EWOULDBLOCK) ||
(errno == EAGAIN)) (errno == EAGAIN))
{ {
return this->Update (); // interesting line ,isnt it ? return Update (); // interesting line ,isnt it ?
} }
DEBUG_LOG ("WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno)); DEBUG_LOG ("WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno));
@ -279,7 +279,7 @@ int WorldSocket::handle_input (ACE_HANDLE)
case 1: case 1:
return 1; return 1;
default: default:
return this->Update (); // another interesting line ;) return Update (); // another interesting line ;)
} }
ACE_NOTREACHED(return -1); ACE_NOTREACHED(return -1);
@ -289,18 +289,18 @@ int WorldSocket::handle_output (ACE_HANDLE)
{ {
ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1); ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1);
if (this->closing_) if (closing_)
return -1; return -1;
const size_t send_len = m_OutBuffer->length (); const size_t send_len = m_OutBuffer->length ();
if (send_len == 0) if (send_len == 0)
return this->cancel_wakeup_output (Guard); return cancel_wakeup_output (Guard);
#ifdef MSG_NOSIGNAL #ifdef MSG_NOSIGNAL
ssize_t n = this->peer ().send (m_OutBuffer->rd_ptr (), send_len, MSG_NOSIGNAL); ssize_t n = peer ().send (m_OutBuffer->rd_ptr (), send_len, MSG_NOSIGNAL);
#else #else
ssize_t n = this->peer ().send (m_OutBuffer->rd_ptr (), send_len); ssize_t n = peer ().send (m_OutBuffer->rd_ptr (), send_len);
#endif // MSG_NOSIGNAL #endif // MSG_NOSIGNAL
if (n == 0) if (n == 0)
@ -308,7 +308,7 @@ int WorldSocket::handle_output (ACE_HANDLE)
else if (n == -1) else if (n == -1)
{ {
if (errno == EWOULDBLOCK || errno == EAGAIN) if (errno == EWOULDBLOCK || errno == EAGAIN)
return this->schedule_wakeup_output (Guard); return schedule_wakeup_output (Guard);
return -1; return -1;
} }
@ -319,16 +319,16 @@ int WorldSocket::handle_output (ACE_HANDLE)
// move the data to the base of the buffer // move the data to the base of the buffer
m_OutBuffer->crunch (); m_OutBuffer->crunch ();
return this->schedule_wakeup_output (Guard); return schedule_wakeup_output (Guard);
} }
else //now n == send_len else //now n == send_len
{ {
m_OutBuffer->reset (); m_OutBuffer->reset ();
if (!iFlushPacketQueue ()) if (!iFlushPacketQueue ())
return this->cancel_wakeup_output (Guard); return cancel_wakeup_output (Guard);
else else
return this->schedule_wakeup_output (Guard); return schedule_wakeup_output (Guard);
} }
ACE_NOTREACHED (return 0); ACE_NOTREACHED (return 0);
@ -340,10 +340,10 @@ int WorldSocket::handle_close (ACE_HANDLE h, ACE_Reactor_Mask)
{ {
ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1); ACE_GUARD_RETURN (LockType, Guard, m_OutBufferLock, -1);
this->closing_ = true; closing_ = true;
if (h == ACE_INVALID_HANDLE) if (h == ACE_INVALID_HANDLE)
this->peer ().close_writer (); peer ().close_writer ();
} }
// Critical section // Critical section
@ -358,13 +358,13 @@ int WorldSocket::handle_close (ACE_HANDLE h, ACE_Reactor_Mask)
int WorldSocket::Update (void) int WorldSocket::Update (void)
{ {
if (this->closing_) if (closing_)
return -1; return -1;
if (m_OutActive || m_OutBuffer->length () == 0) if (m_OutActive || m_OutBuffer->length () == 0)
return 0; return 0;
return this->handle_output (this->get_handle ()); return handle_output (get_handle ());
} }
int WorldSocket::handle_input_header (void) int WorldSocket::handle_input_header (void)
@ -416,7 +416,7 @@ int WorldSocket::handle_input_payload (void)
ACE_ASSERT (m_Header.space () == 0); ACE_ASSERT (m_Header.space () == 0);
ACE_ASSERT (m_RecvWPct != NULL); ACE_ASSERT (m_RecvWPct != NULL);
const int ret = this->ProcessIncoming (m_RecvWPct); const int ret = ProcessIncoming (m_RecvWPct);
m_RecvPct.base (NULL, 0); m_RecvPct.base (NULL, 0);
m_RecvPct.reset (); m_RecvPct.reset ();
@ -448,7 +448,7 @@ int WorldSocket::handle_input_missing_data (void)
const size_t recv_size = message_block.space (); const size_t recv_size = message_block.space ();
const ssize_t n = this->peer ().recv (message_block.wr_ptr (), const ssize_t n = peer ().recv (message_block.wr_ptr (),
recv_size); recv_size);
if (n <= 0) if (n <= 0)
@ -474,7 +474,7 @@ int WorldSocket::handle_input_missing_data (void)
} }
//we just recieved nice new header //we just recieved nice new header
if (this->handle_input_header () == -1) if (handle_input_header () == -1)
{ {
ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN)); ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN));
return -1; return -1;
@ -509,7 +509,7 @@ int WorldSocket::handle_input_missing_data (void)
} }
//just recieved fresh new payload //just recieved fresh new payload
if (this->handle_input_payload () == -1) if (handle_input_payload () == -1)
{ {
ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN)); ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN));
return -1; return -1;
@ -528,7 +528,7 @@ int WorldSocket::cancel_wakeup_output (GuardType& g)
g.release (); g.release ();
if (this->reactor ()->cancel_wakeup if (reactor ()->cancel_wakeup
(this, ACE_Event_Handler::WRITE_MASK) == -1) (this, ACE_Event_Handler::WRITE_MASK) == -1)
{ {
// would be good to store errno from reactor with errno guard // would be good to store errno from reactor with errno guard
@ -548,7 +548,7 @@ int WorldSocket::schedule_wakeup_output (GuardType& g)
g.release (); g.release ();
if (this->reactor ()->schedule_wakeup if (reactor ()->schedule_wakeup
(this, ACE_Event_Handler::WRITE_MASK) == -1) (this, ACE_Event_Handler::WRITE_MASK) == -1)
{ {
sLog.outError ("WorldSocket::schedule_wakeup_output"); sLog.outError ("WorldSocket::schedule_wakeup_output");
@ -567,7 +567,7 @@ int WorldSocket::ProcessIncoming (WorldPacket* new_pct)
const ACE_UINT16 opcode = new_pct->GetOpcode (); const ACE_UINT16 opcode = new_pct->GetOpcode ();
if (this->closing_) if (closing_)
return -1; return -1;
// dump recieved packet // dump recieved packet
@ -854,7 +854,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
return -1; return -1;
} }
std::string address = this->GetRemoteAddress (); std::string address = GetRemoteAddress ();
DEBUG_LOG ("WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.", DEBUG_LOG ("WorldSocket::HandleAuthSession: Client '%s' authenticated successfully from %s.",
account.c_str (), account.c_str (),
@ -881,7 +881,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket)
// In case needed sometime the second arg is in microseconds 1 000 000 = 1 sec // In case needed sometime the second arg is in microseconds 1 000 000 = 1 sec
ACE_OS::sleep (ACE_Time_Value (0, 10000)); ACE_OS::sleep (ACE_Time_Value (0, 10000));
sWorld.AddSession (this->m_Session); sWorld.AddSession (m_Session);
// Create and send the Addon packet // Create and send the Addon packet
if (sAddOnHandler.BuildAddonPacket (&recvPacket, &SendAddonPacked)) if (sAddOnHandler.BuildAddonPacket (&recvPacket, &SendAddonPacked))
@ -949,14 +949,14 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket)
sLog.outError ("WorldSocket::HandlePing: peer sent CMSG_PING, " sLog.outError ("WorldSocket::HandlePing: peer sent CMSG_PING, "
"but is not authenticated or got recently kicked," "but is not authenticated or got recently kicked,"
" address = %s", " address = %s",
this->GetRemoteAddress ().c_str ()); GetRemoteAddress ().c_str ());
return -1; return -1;
} }
} }
WorldPacket packet (SMSG_PONG, 4); WorldPacket packet (SMSG_PONG, 4);
packet << ping; packet << ping;
return this->SendPacket (packet); return SendPacket (packet);
} }
int WorldSocket::iSendPacket (const WorldPacket& pct) int WorldSocket::iSendPacket (const WorldPacket& pct)

View file

@ -79,8 +79,8 @@ class ReactorRunnable : protected ACE_Task_Base
virtual ~ReactorRunnable () virtual ~ReactorRunnable ()
{ {
this->Stop (); Stop ();
this->Wait (); Wait ();
if (m_Reactor) if (m_Reactor)
delete m_Reactor; delete m_Reactor;
@ -96,7 +96,7 @@ class ReactorRunnable : protected ACE_Task_Base
if (m_ThreadId != -1) if (m_ThreadId != -1)
return -1; return -1;
return (m_ThreadId = this->activate ()); return (m_ThreadId = activate ());
} }
void Wait () { ACE_Task_Base::wait (); } void Wait () { ACE_Task_Base::wait (); }
@ -278,7 +278,7 @@ WorldSocketMgr::StartNetwork (ACE_UINT16 port, const char* address)
if (!sLog.IsOutDebug ()) if (!sLog.IsOutDebug ())
ACE_Log_Msg::instance ()->priority_mask (LM_ERROR, ACE_Log_Msg::PROCESS); ACE_Log_Msg::instance ()->priority_mask (LM_ERROR, ACE_Log_Msg::PROCESS);
if (this->StartReactiveIO (port, address) == -1) if (StartReactiveIO (port, address) == -1)
return -1; return -1;
return 0; return 0;
@ -301,7 +301,7 @@ WorldSocketMgr::StopNetwork ()
m_NetThreads[i].Stop (); m_NetThreads[i].Stop ();
} }
this->Wait (); Wait ();
} }
void void

View file

@ -126,7 +126,7 @@ bool ChatHandler::HandleBuyErrorCommand(const char* args)
return true; return true;
} }
bool ChatHandler::HandleSendOpcodeCommand(const char* args) bool ChatHandler::HandleSendOpcodeCommand(const char* /*args*/)
{ {
Unit *unit = getSelectedUnit(); Unit *unit = getSelectedUnit();
if (!unit || (unit->GetTypeId() != TYPEID_PLAYER)) if (!unit || (unit->GetTypeId() != TYPEID_PLAYER))
@ -267,7 +267,7 @@ bool ChatHandler::HandleSendQuestPartyMsgCommand(const char* args)
return true; return true;
} }
bool ChatHandler::HandleGetLootRecipient(const char* args) bool ChatHandler::HandleGetLootRecipient(const char* /*args*/)
{ {
Creature* target = getSelectedCreature(); Creature* target = getSelectedCreature();
if(!target) if(!target)

View file

@ -1538,80 +1538,6 @@ public:
members.append(temp[i].handle->value); members.append(temp[i].handle->value);
} }
} }
/**
C++ STL style iterator variable. See begin().
Overloads the -> (dereference) operator, so this acts like a pointer
to the current member.
*/
class Iterator {
private:
friend class AABSPTree<T>;
Iterator(const typename Table<Member, Node*>::Iterator& it) : it(it) {}
public:
inline bool operator!=(const Iterator& other) const {
return !(*this == other);
}
bool operator==(const Iterator& other) const {
return it == other.it;
}
/**
Pre increment.
*/
Iterator& operator++() {
++it;
return *this;
}
private:
/**
Post increment (slower than preincrement). Intentionally unimplemented to prevent slow code.
*/
Iterator operator++(int);/* {
Iterator old = *this;
++(*this);
return old;
}*/
public:
const T& operator*() const {
return it->key.handle->value;
}
T* operator->() const {
return &(it->key.handle->value);
}
operator T*() const {
return &(it->key.handle->value);
}
};
/**
C++ STL style iterator method. Returns the first member.
Use preincrement (++entry) to get to the next element (iteration
order is arbitrary).
Do not modify the set while iterating.
*/
Iterator begin() const {
return Iterator(memberTable.begin());
}
/**
C++ STL style iterator method. Returns one after the last iterator
element.
*/
Iterator end() const {
return Iterator(memberTable.end());
}
}; };
} }

View file

@ -587,9 +587,6 @@
<File <File
RelativePath="..\..\src\game\Guild.h"> RelativePath="..\..\src\game\Guild.h">
</File> </File>
<File
RelativePath="..\..\src\game\HateMatrix.h">
</File>
<File <File
RelativePath="..\..\src\game\HomeMovementGenerator.cpp"> RelativePath="..\..\src\game\HomeMovementGenerator.cpp">
</File> </File>

View file

@ -954,10 +954,6 @@
RelativePath="..\..\src\game\Guild.h" RelativePath="..\..\src\game\Guild.h"
> >
</File> </File>
<File
RelativePath="..\..\src\game\HateMatrix.h"
>
</File>
<File <File
RelativePath="..\..\src\game\HomeMovementGenerator.cpp" RelativePath="..\..\src\game\HomeMovementGenerator.cpp"
> >

View file

@ -956,10 +956,6 @@
RelativePath="..\..\src\game\Guild.h" RelativePath="..\..\src\game\Guild.h"
> >
</File> </File>
<File
RelativePath="..\..\src\game\HateMatrix.h"
>
</File>
<File <File
RelativePath="..\..\src\game\HomeMovementGenerator.cpp" RelativePath="..\..\src\game\HomeMovementGenerator.cpp"
> >