From 3da9f3f4cc17f128a83ada0f0f3782722d9b764f Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Tue, 9 Dec 2008 14:05:23 +0300 Subject: [PATCH] [6889] Backport some not client version specific changes and fixes from 303 branch. --- contrib/extractor/.gitignore | 1 + contrib/extractor/System.cpp | 28 +- contrib/extractor/VC71_ad.vcproj | 4 +- contrib/extractor/VC80_ad.vcproj | 4 +- contrib/extractor/VC90_ad.vcproj | 4 +- contrib/vmap_assembler/.gitignore | 16 + contrib/vmap_assembler/VC71/.gitignore | 13 + contrib/vmap_assembler/VC80/.gitignore | 13 + contrib/vmap_assembler/VC90/.gitignore | 13 + .../vmap_assembler/VC90/vmap_assembler.vcproj | 455 ++++++++ contrib/vmap_assembler/vmap_assemblerVC90.sln | 19 + .../vmap_extractor_v2/vmapExtractor_VC90.sln | 19 + .../vmapExtractor_VC90.vcproj | 999 ++++++++++++++++++ dep/include/mersennetwister/MersenneTwister.h | 4 +- src/game/CharacterHandler.cpp | 1 - src/game/Creature.h | 2 +- src/game/GameObject.cpp | 2 +- src/game/GossipDef.cpp | 26 +- src/game/ItemHandler.cpp | 2 +- src/game/ItemPrototype.h | 20 +- src/game/Level1.cpp | 6 +- src/game/Map.cpp | 8 +- src/game/MiscHandler.cpp | 6 +- src/game/MovementHandler.cpp | 18 +- src/game/NPCHandler.cpp | 12 +- src/game/Object.cpp | 62 +- src/game/Object.h | 20 +- src/game/ObjectAccessor.cpp | 3 +- src/game/ObjectAccessor.h | 2 +- src/game/ObjectGridLoader.cpp | 2 +- src/game/ObjectMgr.h | 1 + src/game/Opcodes.cpp | 2 +- src/game/Pet.cpp | 67 +- src/game/Pet.h | 3 +- src/game/PetHandler.cpp | 10 +- src/game/Player.cpp | 96 +- src/game/Player.h | 13 +- src/game/QuestDef.h | 32 +- src/game/SharedDefines.h | 25 +- src/game/Spell.cpp | 53 +- src/game/SpellAuras.cpp | 27 +- src/game/SpellEffects.cpp | 51 +- src/game/SpellHandler.cpp | 2 +- src/game/StatSystem.cpp | 1 + src/game/TaxiHandler.cpp | 2 +- src/game/Totem.cpp | 7 +- src/game/Traveller.h | 2 +- src/game/Unit.cpp | 70 +- src/game/Unit.h | 26 +- src/game/WaypointMovementGenerator.cpp | 32 +- src/game/WorldSession.cpp | 38 +- src/game/WorldSession.h | 2 +- src/game/WorldSocket.cpp | 10 +- src/game/debugcmds.cpp | 15 +- src/mangosd/RASocket.h | 2 +- src/shared/revision_nr.h | 2 +- 56 files changed, 1998 insertions(+), 377 deletions(-) create mode 100644 contrib/vmap_assembler/.gitignore create mode 100644 contrib/vmap_assembler/VC71/.gitignore create mode 100644 contrib/vmap_assembler/VC80/.gitignore create mode 100644 contrib/vmap_assembler/VC90/.gitignore create mode 100644 contrib/vmap_assembler/VC90/vmap_assembler.vcproj create mode 100644 contrib/vmap_assembler/vmap_assemblerVC90.sln create mode 100644 contrib/vmap_extractor_v2/vmapExtractor_VC90.sln create mode 100644 contrib/vmap_extractor_v2/vmapExtractor_VC90.vcproj diff --git a/contrib/extractor/.gitignore b/contrib/extractor/.gitignore index bbf017c83..908bb677d 100644 --- a/contrib/extractor/.gitignore +++ b/contrib/extractor/.gitignore @@ -17,3 +17,4 @@ debug release *.user +*.ilk diff --git a/contrib/extractor/System.cpp b/contrib/extractor/System.cpp index 39bf1d5b1..19c0e7159 100644 --- a/contrib/extractor/System.cpp +++ b/contrib/extractor/System.cpp @@ -39,7 +39,7 @@ enum Extract }; int extract = EXTRACT_MAP | EXTRACT_DBC; -static char* const langs[]={"enGB", "enUS", "deDE", "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 ADT_RES 64 @@ -55,9 +55,9 @@ void CreateDir( const std::string& Path ) bool FileExists( const char* FileName ) { - if( FILE* fp = fopen( FileName, "rb" ) ) + if(FILE* fp = fopen( FileName, "rb" )) { - fclose( fp ); + fclose(fp); return true; } @@ -222,15 +222,15 @@ void ExtractDBCFiles(int locale, bool basicLocale) string filename = path; filename += (iter->c_str() + strlen("DBFilesClient\\")); - FILE *output=fopen(filename.c_str(),"wb"); + FILE *output=fopen(filename.c_str(), "wb"); if(!output) { - printf("Can't create the output file '%s'\n",filename.c_str()); + printf("Can't create the output file '%s'\n", filename.c_str()); continue; } MPQFile m(iter->c_str()); if(!m.isEof()) - fwrite(m.getPointer(),1,m.getSize(),output); + fwrite(m.getPointer(), 1, m.getSize(), output); fclose(output); ++count; @@ -242,7 +242,7 @@ void LoadLocaleMPQFiles(int const locale) { char filename[512]; - sprintf(filename,"%s/Data/%s/locale-%s.MPQ",input_path,langs[locale],langs[locale]); + sprintf(filename,"%s/Data/%s/locale-%s.MPQ", input_path, langs[locale], langs[locale]); new MPQArchive(filename); for(int i = 1; i < 5; ++i) @@ -251,7 +251,7 @@ void LoadLocaleMPQFiles(int const locale) if(i > 1) 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)) new MPQArchive(filename); } @@ -261,9 +261,9 @@ void LoadCommonMPQFiles() { char filename[512]; - sprintf(filename,"%s/Data/common.MPQ",input_path); + sprintf(filename,"%s/Data/common-2.MPQ", input_path); new MPQArchive(filename); - sprintf(filename,"%s/Data/expansion.MPQ",input_path); + sprintf(filename,"%s/Data/expansion.MPQ", input_path); new MPQArchive(filename); for(int i = 1; i < 5; ++i) @@ -272,7 +272,7 @@ void LoadCommonMPQFiles() if(i > 1) sprintf(ext, "-%i", i); - sprintf(filename,"%s/Data/patch%s.MPQ",input_path,ext); + sprintf(filename,"%s/Data/patch%s.MPQ", input_path, ext); if(FileExists(filename)) new MPQArchive(filename); } @@ -306,12 +306,12 @@ int main(int argc, char * arg[]) if((extract & EXTRACT_DBC) == 0) { - FirstLocale=i; + FirstLocale = i; break; } //Extract DBC files - if(FirstLocale<0) + if(FirstLocale < 0) { ExtractDBCFiles(i, true); FirstLocale = i; @@ -324,7 +324,7 @@ int main(int argc, char * arg[]) } } - if(FirstLocale<0) + if(FirstLocale < 0) { printf("No locales detected\n"); return 0; diff --git a/contrib/extractor/VC71_ad.vcproj b/contrib/extractor/VC71_ad.vcproj index 2bd27e526..fd2d16120 100644 --- a/contrib/extractor/VC71_ad.vcproj +++ b/contrib/extractor/VC71_ad.vcproj @@ -76,7 +76,7 @@ Name="VCLinkerTool" AdditionalDependencies="zlib.lib" OutputFile="ad debug.exe" - LinkIncremental="1" + LinkIncremental="0" SuppressStartupBanner="true" AdditionalLibraryDirectories="./debug/" IgnoreDefaultLibraryNames="LIBCD.lib" @@ -171,7 +171,7 @@ Name="VCLinkerTool" AdditionalDependencies="zlib.lib" OutputFile="./ad.exe" - LinkIncremental="1" + LinkIncremental="0" SuppressStartupBanner="true" AdditionalLibraryDirectories="./release/" IgnoreDefaultLibraryNames="LIBC.lib" diff --git a/contrib/extractor/VC80_ad.vcproj b/contrib/extractor/VC80_ad.vcproj index 30657907f..fedab5b89 100644 --- a/contrib/extractor/VC80_ad.vcproj +++ b/contrib/extractor/VC80_ad.vcproj @@ -79,7 +79,7 @@ Name="VCLinkerTool" AdditionalDependencies="zlib.lib" OutputFile="ad debug.exe" - LinkIncremental="1" + LinkIncremental="0" SuppressStartupBanner="true" AdditionalLibraryDirectories="./debug" IgnoreDefaultLibraryNames="LIBCD.lib" @@ -176,7 +176,7 @@ Name="VCLinkerTool" AdditionalDependencies="zlib.lib" OutputFile="./ad.exe" - LinkIncremental="1" + LinkIncremental="0" SuppressStartupBanner="true" AdditionalLibraryDirectories="./release" IgnoreDefaultLibraryNames="LIBC.lib" diff --git a/contrib/extractor/VC90_ad.vcproj b/contrib/extractor/VC90_ad.vcproj index 14aa824a0..59fdf6d21 100644 --- a/contrib/extractor/VC90_ad.vcproj +++ b/contrib/extractor/VC90_ad.vcproj @@ -80,7 +80,7 @@ Name="VCLinkerTool" AdditionalDependencies="zlib.lib" OutputFile="ad debug.exe" - LinkIncremental="1" + LinkIncremental="0" SuppressStartupBanner="true" AdditionalLibraryDirectories="./debug/" IgnoreDefaultLibraryNames="LIBCD.lib" @@ -175,7 +175,7 @@ Name="VCLinkerTool" AdditionalDependencies="zlib.lib" OutputFile="./ad.exe" - LinkIncremental="1" + LinkIncremental="0" SuppressStartupBanner="true" AdditionalLibraryDirectories="./release/" IgnoreDefaultLibraryNames="LIBC.lib" diff --git a/contrib/vmap_assembler/.gitignore b/contrib/vmap_assembler/.gitignore new file mode 100644 index 000000000..267442f37 --- /dev/null +++ b/contrib/vmap_assembler/.gitignore @@ -0,0 +1,16 @@ +# +# NOTE! Don't add files that are generated in specific +# subdirectories here. Add them in the ".gitignore" file +# in that subdirectory instead. +# +# NOTE! Please use 'git-ls-files -i --exclude-standard' +# command after changing this file, to see if there are +# any tracked files which get ignored after the change. +# +# MaNGOS generated files at Windows build +# + +*.ncb +*.suo +Release +Debug diff --git a/contrib/vmap_assembler/VC71/.gitignore b/contrib/vmap_assembler/VC71/.gitignore new file mode 100644 index 000000000..7835e14b5 --- /dev/null +++ b/contrib/vmap_assembler/VC71/.gitignore @@ -0,0 +1,13 @@ +# +# NOTE! Don't add files that are generated in specific +# subdirectories here. Add them in the ".gitignore" file +# in that subdirectory instead. +# +# NOTE! Please use 'git-ls-files -i --exclude-standard' +# command after changing this file, to see if there are +# any tracked files which get ignored after the change. +# +# MaNGOS generated files at Windows build +# + +*.user diff --git a/contrib/vmap_assembler/VC80/.gitignore b/contrib/vmap_assembler/VC80/.gitignore new file mode 100644 index 000000000..7835e14b5 --- /dev/null +++ b/contrib/vmap_assembler/VC80/.gitignore @@ -0,0 +1,13 @@ +# +# NOTE! Don't add files that are generated in specific +# subdirectories here. Add them in the ".gitignore" file +# in that subdirectory instead. +# +# NOTE! Please use 'git-ls-files -i --exclude-standard' +# command after changing this file, to see if there are +# any tracked files which get ignored after the change. +# +# MaNGOS generated files at Windows build +# + +*.user diff --git a/contrib/vmap_assembler/VC90/.gitignore b/contrib/vmap_assembler/VC90/.gitignore new file mode 100644 index 000000000..7835e14b5 --- /dev/null +++ b/contrib/vmap_assembler/VC90/.gitignore @@ -0,0 +1,13 @@ +# +# NOTE! Don't add files that are generated in specific +# subdirectories here. Add them in the ".gitignore" file +# in that subdirectory instead. +# +# NOTE! Please use 'git-ls-files -i --exclude-standard' +# command after changing this file, to see if there are +# any tracked files which get ignored after the change. +# +# MaNGOS generated files at Windows build +# + +*.user diff --git a/contrib/vmap_assembler/VC90/vmap_assembler.vcproj b/contrib/vmap_assembler/VC90/vmap_assembler.vcproj new file mode 100644 index 000000000..4710f92f1 --- /dev/null +++ b/contrib/vmap_assembler/VC90/vmap_assembler.vcproj @@ -0,0 +1,455 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/contrib/vmap_assembler/vmap_assemblerVC90.sln b/contrib/vmap_assembler/vmap_assemblerVC90.sln new file mode 100644 index 000000000..0aeab053c --- /dev/null +++ b/contrib/vmap_assembler/vmap_assemblerVC90.sln @@ -0,0 +1,19 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vmap_assembler", "VC90\vmap_assembler.vcproj", "{572FFF74-480C-4472-8ABF-81733BB4049D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {572FFF74-480C-4472-8ABF-81733BB4049D}.Debug|Win32.ActiveCfg = Debug|Win32 + {572FFF74-480C-4472-8ABF-81733BB4049D}.Debug|Win32.Build.0 = Debug|Win32 + {572FFF74-480C-4472-8ABF-81733BB4049D}.Release|Win32.ActiveCfg = Release|Win32 + {572FFF74-480C-4472-8ABF-81733BB4049D}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/contrib/vmap_extractor_v2/vmapExtractor_VC90.sln b/contrib/vmap_extractor_v2/vmapExtractor_VC90.sln new file mode 100644 index 000000000..82d3e1509 --- /dev/null +++ b/contrib/vmap_extractor_v2/vmapExtractor_VC90.sln @@ -0,0 +1,19 @@ +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "vmapExtractor", "vmapExtractor_VC90.vcproj", "{87335BBF-5DA8-4FEC-A51E-1FB948F2FFE9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug Ansi Static|Win32 = Debug Ansi Static|Win32 + Release Ansi Static|Win32 = Release Ansi Static|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {87335BBF-5DA8-4FEC-A51E-1FB948F2FFE9}.Debug Ansi Static|Win32.ActiveCfg = Debug Ansi Static|Win32 + {87335BBF-5DA8-4FEC-A51E-1FB948F2FFE9}.Debug Ansi Static|Win32.Build.0 = Debug Ansi Static|Win32 + {87335BBF-5DA8-4FEC-A51E-1FB948F2FFE9}.Release Ansi Static|Win32.ActiveCfg = Release Ansi Static|Win32 + {87335BBF-5DA8-4FEC-A51E-1FB948F2FFE9}.Release Ansi Static|Win32.Build.0 = Release Ansi Static|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/contrib/vmap_extractor_v2/vmapExtractor_VC90.vcproj b/contrib/vmap_extractor_v2/vmapExtractor_VC90.vcproj new file mode 100644 index 000000000..ed75735c4 --- /dev/null +++ b/contrib/vmap_extractor_v2/vmapExtractor_VC90.vcproj @@ -0,0 +1,999 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/dep/include/mersennetwister/MersenneTwister.h b/dep/include/mersennetwister/MersenneTwister.h index 9c6994bdf..af919319a 100644 --- a/dep/include/mersennetwister/MersenneTwister.h +++ b/dep/include/mersennetwister/MersenneTwister.h @@ -86,8 +86,8 @@ public: MTRand( const uint32& oneSeed ); // initialize with a simple uint32 MTRand( uint32 *const bigSeed, uint32 const seedLength = N ); // or an array MTRand(); // auto-initialize with /dev/urandom or time() and clock() - MTRand(const MTRand&); // prevent copy constructor - MTRand& operator=(const MTRand&); // no-op operator= + MTRand(const MTRand&); // prevent copy constructor + MTRand& operator=(const MTRand&); // no-op operator= // Do NOT use for CRYPTOGRAPHY without securely hashing several returned // values together, otherwise the generator state can be learned after diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index cd0b86b0e..a09436590 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -641,7 +641,6 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder) pCurrChar->LoadCorpse(); // setting Ghost+speed if dead - //if ( pCurrChar->m_deathState == DEAD ) if (pCurrChar->m_deathState != ALIVE) { // not blizz like, we must correctly save and load player instead... diff --git a/src/game/Creature.h b/src/game/Creature.h index 3c7825706..01111568a 100644 --- a/src/game/Creature.h +++ b/src/game/Creature.h @@ -218,7 +218,7 @@ struct CreatureInfo bool isTameable() const { - return type == CREATURE_TYPE_BEAST && family != 0 && (type_flags & CREATURE_TYPEFLAGS_TAMEBLE); + return type == CREATURE_TYPE_BEAST && family != 0 && (type_flags & CREATURE_TYPEFLAGS_TAMEABLE); } }; diff --git a/src/game/GameObject.cpp b/src/game/GameObject.cpp index 8a192716a..ab412dcf2 100644 --- a/src/game/GameObject.cpp +++ b/src/game/GameObject.cpp @@ -190,7 +190,7 @@ void GameObject::Update(uint32 /*p_time*/) if(caster && caster->GetTypeId()==TYPEID_PLAYER) { SetGoState(0); - SetUInt32Value(GAMEOBJECT_FLAGS, 32); + SetUInt32Value(GAMEOBJECT_FLAGS, GO_FLAG_NODESPAWN); UpdateData udata; WorldPacket packet; diff --git a/src/game/GossipDef.cpp b/src/game/GossipDef.cpp index fc0671b55..a690254e2 100644 --- a/src/game/GossipDef.cpp +++ b/src/game/GossipDef.cpp @@ -128,26 +128,20 @@ void PlayerMenu::SendGossipMenu( uint32 TitleTextId, uint64 npcGUID ) data << npcGUID; data << uint32(0); // new 2.4.0 data << uint32( TitleTextId ); - data << uint32( mGossipMenu.MenuItemCount() ); // max count 0x0F + data << uint32( mGossipMenu.MenuItemCount() ); // max count 0x0F for ( unsigned int iI = 0; iI < mGossipMenu.MenuItemCount(); iI++ ) { GossipMenuItem const& gItem = mGossipMenu.GetItem(iI); data << uint32( iI ); data << uint8( gItem.m_gIcon ); - // icons: - // 0 unlearn talents/misc - // 1 trader - // 2 taxi - // 3 trainer - // 9 BG/arena data << uint8( gItem.m_gCoded ); // makes pop up box password data << uint32(gItem.m_gBoxMoney); // money required to open menu, 2.0.3 data << gItem.m_gMessage; // text for gossip item data << gItem.m_gBoxMessage; // accept text (related to money) pop up box, 2.0.3 } - data << uint32( mQuestMenu.MenuItemCount() ); // max count 0x20 + data << uint32( mQuestMenu.MenuItemCount() ); // max count 0x20 for ( uint16 iI = 0; iI < mQuestMenu.MenuItemCount(); iI++ ) { @@ -155,7 +149,7 @@ void PlayerMenu::SendGossipMenu( uint32 TitleTextId, uint64 npcGUID ) uint32 questID = qItem.m_qId; Quest const* pQuest = objmgr.GetQuestTemplate(questID); - data << questID; + data << uint32(questID); data << uint32( qItem.m_qIcon ); data << uint32( pQuest ? pQuest->GetQuestLevel() : 0 ); std::string Title = pQuest->GetTitle(); @@ -381,8 +375,7 @@ void PlayerMenu::SendQuestGiverQuestList( QEmote eEmote, std::string Title, uint data << title; } pSession->SendPacket( &data ); - //uint32 fqid=pQuestMenu->GetItem(0).m_qId; - //sLog.outDebug( "WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC Guid=%u, questid-0=%u",npcGUID,fqid); + sLog.outDebug("WORLD: Sent SMSG_QUESTGIVER_QUEST_LIST NPC Guid=%u", GUID_LOPART(npcGUID)); } void PlayerMenu::SendQuestGiverStatus( uint8 questStatus, uint64 npcGUID ) @@ -392,7 +385,7 @@ void PlayerMenu::SendQuestGiverStatus( uint8 questStatus, uint64 npcGUID ) data << uint8(questStatus); pSession->SendPacket( &data ); - sLog.outDebug( "WORLD: Sent SMSG_QUESTGIVER_STATUS NPC Guid=%u, status=%u",GUID_LOPART(npcGUID),questStatus); + sLog.outDebug( "WORLD: Sent SMSG_QUESTGIVER_STATUS NPC Guid=%u, status=%u", GUID_LOPART(npcGUID), questStatus); } void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID, bool ActivateAccept ) @@ -462,6 +455,7 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID else data << uint32(0); } + data << uint32(pQuest->GetRewOrReqMoney()); } @@ -479,7 +473,7 @@ void PlayerMenu::SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID } pSession->SendPacket( &data ); - sLog.outDebug("WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPCGuid=%u, questid=%u",GUID_LOPART(npcGUID),pQuest->GetQuestId()); + sLog.outDebug("WORLD: Sent SMSG_QUESTGIVER_QUEST_DETAILS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), pQuest->GetQuestId()); } void PlayerMenu::SendQuestQueryResponse( Quest const *pQuest ) @@ -760,8 +754,10 @@ void PlayerMenu::SendQuestGiverRequestItems( Quest const *pQuest, uint64 npcGUID else data << uint32(0x03); - data << uint32(0x04) << uint32(0x08) << uint32(0x10); + data << uint32(0x04); + data << uint32(0x08); + data << uint32(0x10); pSession->SendPacket( &data ); - sLog.outDebug( "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPCGuid=%u, questid=%u",GUID_LOPART(npcGUID),pQuest->GetQuestId() ); + sLog.outDebug( "WORLD: Sent SMSG_QUESTGIVER_REQUEST_ITEMS NPCGuid=%u, questid=%u", GUID_LOPART(npcGUID), pQuest->GetQuestId() ); } diff --git a/src/game/ItemHandler.cpp b/src/game/ItemHandler.cpp index 421f6ae53..7d24fd5a2 100644 --- a/src/game/ItemHandler.cpp +++ b/src/game/ItemHandler.cpp @@ -369,7 +369,7 @@ void WorldSession::HandleItemQuerySingleOpcode( WorldPacket & recv_data ) data << pProto->ArcaneRes; data << pProto->Delay; - data << pProto->Ammo_type; + data << pProto->AmmoType; data << pProto->RangedModRange; for(int s = 0; s < 5; s++) diff --git a/src/game/ItemPrototype.h b/src/game/ItemPrototype.h index ba6f50f48..e3dab0d57 100644 --- a/src/game/ItemPrototype.h +++ b/src/game/ItemPrototype.h @@ -443,17 +443,15 @@ inline uint8 ItemSubClassToDurabilityMultiplierId(uint32 ItemClass, uint32 ItemS struct _Damage { - float DamageMin; - float DamageMax; - uint32 DamageType; // id from Resistances.dbc - + float DamageMin; + float DamageMax; + uint32 DamageType; // id from Resistances.dbc }; struct _ItemStat { - uint32 ItemStatType; - int32 ItemStatValue; - + uint32 ItemStatType; + int32 ItemStatValue; }; struct _Spell { @@ -464,7 +462,6 @@ struct _Spell int32 SpellCooldown; uint32 SpellCategory; // id from SpellCategory.dbc int32 SpellCategoryCooldown; - }; struct _Socket @@ -479,7 +476,7 @@ struct ItemPrototype uint32 Class; // id from ItemClass.dbc uint32 SubClass; // id from ItemSubClass.dbc uint32 Unk0; - char* Name1; + char* Name1; uint32 DisplayInfoID; // id from ItemDisplayInfo.dbc uint32 Quality; uint32 Flags; @@ -511,12 +508,11 @@ struct ItemPrototype uint32 ShadowRes; uint32 ArcaneRes; uint32 Delay; - uint32 Ammo_type; + uint32 AmmoType; float RangedModRange; - _Spell Spells[5]; uint32 Bonding; - char* Description; + char* Description; uint32 PageText; uint32 LanguageID; uint32 PageMaterial; diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp index 5730ad1d6..c73231635 100644 --- a/src/game/Level1.cpp +++ b/src/game/Level1.cpp @@ -1028,7 +1028,7 @@ bool ChatHandler::HandleModifyASpeedCommand(const char* args) chr->SetSpeed(MOVE_RUN, ASpeed,true); chr->SetSpeed(MOVE_SWIM, ASpeed,true); //chr->SetSpeed(MOVE_TURN, ASpeed,true); - chr->SetSpeed(MOVE_FLY, ASpeed,true); + chr->SetSpeed(MOVE_FLIGHT, ASpeed,true); return true; } @@ -1144,7 +1144,7 @@ bool ChatHandler::HandleModifyBWalkCommand(const char* args) if (needReportToTarget(chr)) ChatHandler(chr).PSendSysMessage(LANG_YOURS_BACK_SPEED_CHANGED, GetName(), BSpeed); - chr->SetSpeed(MOVE_WALKBACK,BSpeed,true); + chr->SetSpeed(MOVE_RUN_BACK,BSpeed,true); return true; } @@ -1176,7 +1176,7 @@ bool ChatHandler::HandleModifyFlyCommand(const char* args) if (needReportToTarget(chr)) ChatHandler(chr).PSendSysMessage(LANG_YOURS_FLY_SPEED_CHANGED, GetName(), FSpeed); - chr->SetSpeed(MOVE_FLY,FSpeed,true); + chr->SetSpeed(MOVE_FLIGHT,FSpeed,true); return true; } diff --git a/src/game/Map.cpp b/src/game/Map.cpp index d782f6cba..b1cb12720 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -616,7 +616,6 @@ void Map::Update(const uint32 &t_diff) } } - // Don't unload grids if it's battleground, since we may have manually added GOs,creatures, those doesn't load from DB at grid re-load ! // This isn't really bother us, since as soon as we have instanced BG-s, the whole map unloads as the BG gets ended if (IsBattleGroundOrArena()) @@ -697,7 +696,7 @@ Map::Remove(T *obj, bool remove) CellPair p = MaNGOS::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP ) { - sLog.outError("Map::Remove: Object " I64FMTD " have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); + sLog.outError("Map::Remove: Object " I64FMT " have invalid coordinates X:%f Y:%f grid cell [%u:%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); return; } @@ -705,7 +704,7 @@ Map::Remove(T *obj, bool remove) if( !loaded(GridPair(cell.data.Part.grid_x, cell.data.Part.grid_y)) ) return; - DEBUG_LOG("Remove object " I64FMTD " from grid[%u,%u]", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y); + DEBUG_LOG("Remove object " I64FMT " from grid[%u,%u]", obj->GetGUID(), cell.data.Part.grid_x, cell.data.Part.grid_y); NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); assert( grid != NULL ); @@ -959,7 +958,7 @@ bool Map::UnloadGrid(const uint32 &x, const uint32 &y, bool pForce) if (i_InstanceId == 0) { if(GridMaps[gx][gy]) delete (GridMaps[gx][gy]); - // x and y are swaped + // x and y are swapped VMAP::VMapFactory::createOrGetVMapManager()->unloadMap(GetId(), gy, gx); } else @@ -1122,7 +1121,6 @@ uint8 Map::GetTerrainType(float x, float y ) const return GridMaps[gx][gy]->terrain_type[(int)(lx)][(int)(ly)]; else return 0; - } float Map::GetWaterLevel(float x, float y ) const diff --git a/src/game/MiscHandler.cpp b/src/game/MiscHandler.cpp index 2949ceb11..b2c7d7d5a 100644 --- a/src/game/MiscHandler.cpp +++ b/src/game/MiscHandler.cpp @@ -1380,7 +1380,7 @@ void WorldSession::HandleFarSightOpcode( WorldPacket & recv_data ) sLog.outDebug("Removed FarSight from player %u", _player->GetGUIDLow()); break; case 1: - sLog.outDebug("Added FarSight " I64FMTD " to player %u", _player->GetUInt64Value(PLAYER_FARSIGHT), _player->GetGUIDLow()); + sLog.outDebug("Added FarSight " I64FMT " to player %u", _player->GetFarSight(), _player->GetGUIDLow()); break; } } @@ -1395,9 +1395,9 @@ void WorldSession::HandleChooseTitleOpcode( WorldPacket & recv_data ) recv_data >> title; // -1 at none - if(title > 0 && title < 64) + if(title > 0 && title < 128) { - if(!GetPlayer()->HasFlag64(PLAYER__FIELD_KNOWN_TITLES,uint64(1) << title)) + if(!GetPlayer()->HasTitle(title)) return; } else diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp index 448d184e5..55c7e4cf6 100644 --- a/src/game/MovementHandler.cpp +++ b/src/game/MovementHandler.cpp @@ -461,19 +461,19 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data) UnitMoveType move_type; UnitMoveType force_move_type; - static char const* move_type_name[MAX_MOVE_TYPE] = { "Walk", "Run", "Walkback", "Swim", "Swimback", "Turn", "Fly", "Flyback" }; + static char const* move_type_name[MAX_MOVE_TYPE] = { "Walk", "Run", "RunBack", "Swim", "SwimBack", "TurnRate", "Flight", "FlightBack" }; uint16 opcode = recv_data.GetOpcode(); switch(opcode) { - case CMSG_FORCE_WALK_SPEED_CHANGE_ACK: move_type = MOVE_WALK; force_move_type = MOVE_WALK; break; - case CMSG_FORCE_RUN_SPEED_CHANGE_ACK: move_type = MOVE_RUN; force_move_type = MOVE_RUN; break; - case CMSG_FORCE_RUN_BACK_SPEED_CHANGE_ACK: move_type = MOVE_WALKBACK; force_move_type = MOVE_WALKBACK; break; - case CMSG_FORCE_SWIM_SPEED_CHANGE_ACK: move_type = MOVE_SWIM; force_move_type = MOVE_SWIM; break; - case CMSG_FORCE_SWIM_BACK_SPEED_CHANGE_ACK: move_type = MOVE_SWIMBACK; force_move_type = MOVE_SWIMBACK; break; - case CMSG_FORCE_TURN_RATE_CHANGE_ACK: move_type = MOVE_TURN; force_move_type = MOVE_TURN; break; - case CMSG_FORCE_FLIGHT_SPEED_CHANGE_ACK: move_type = MOVE_FLY; force_move_type = MOVE_FLY; break; - case CMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK: move_type = MOVE_FLYBACK; force_move_type = MOVE_FLYBACK; break; + case CMSG_FORCE_WALK_SPEED_CHANGE_ACK: move_type = MOVE_WALK; force_move_type = MOVE_WALK; break; + case CMSG_FORCE_RUN_SPEED_CHANGE_ACK: move_type = MOVE_RUN; force_move_type = MOVE_RUN; break; + case CMSG_FORCE_RUN_BACK_SPEED_CHANGE_ACK: move_type = MOVE_RUN_BACK; force_move_type = MOVE_RUN_BACK; break; + case CMSG_FORCE_SWIM_SPEED_CHANGE_ACK: move_type = MOVE_SWIM; force_move_type = MOVE_SWIM; break; + case CMSG_FORCE_SWIM_BACK_SPEED_CHANGE_ACK: move_type = MOVE_SWIM_BACK; force_move_type = MOVE_SWIM_BACK; break; + case CMSG_FORCE_TURN_RATE_CHANGE_ACK: move_type = MOVE_TURN_RATE; force_move_type = MOVE_TURN_RATE; break; + case CMSG_FORCE_FLIGHT_SPEED_CHANGE_ACK: move_type = MOVE_FLIGHT; force_move_type = MOVE_FLIGHT; break; + case CMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE_ACK: move_type = MOVE_FLIGHT_BACK; force_move_type = MOVE_FLIGHT_BACK; break; default: sLog.outError("WorldSession::HandleForceSpeedChangeAck: Unknown move type opcode: %u", opcode); return; diff --git a/src/game/NPCHandler.cpp b/src/game/NPCHandler.cpp index 46a2b8ebd..4303e1a6c 100644 --- a/src/game/NPCHandler.cpp +++ b/src/game/NPCHandler.cpp @@ -551,9 +551,9 @@ void WorldSession::SendStablePet(uint64 guid ) void WorldSession::HandleStablePet( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8); + CHECK_PACKET_SIZE(recv_data, 8); - sLog.outDebug("WORLD: Recv CMSG_STABLE_PET not dispose."); + sLog.outDebug("WORLD: Recv CMSG_STABLE_PET"); uint64 npcGUID; recv_data >> npcGUID; @@ -614,7 +614,7 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data ) void WorldSession::HandleUnstablePet( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+4); + CHECK_PACKET_SIZE(recv_data, 8+4); sLog.outDebug("WORLD: Recv CMSG_UNSTABLE_PET."); uint64 npcGUID; @@ -674,7 +674,7 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data ) void WorldSession::HandleBuyStableSlot( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8); + CHECK_PACKET_SIZE(recv_data, 8); sLog.outDebug("WORLD: Recv CMSG_BUY_STABLE_SLOT."); uint64 npcGUID; @@ -719,7 +719,7 @@ void WorldSession::HandleStableRevivePet( WorldPacket &/* recv_data */) void WorldSession::HandleStableSwapPet( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+4); + CHECK_PACKET_SIZE(recv_data, 8+4); sLog.outDebug("WORLD: Recv CMSG_STABLE_SWAP_PET."); uint64 npcGUID; @@ -774,7 +774,7 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data ) void WorldSession::HandleRepairItemOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+8+1); + CHECK_PACKET_SIZE(recv_data, 8+8+1); sLog.outDebug("WORLD: CMSG_REPAIR_ITEM"); diff --git a/src/game/Object.cpp b/src/game/Object.cpp index d9c3677cf..b8f758cbd 100644 --- a/src/game/Object.cpp +++ b/src/game/Object.cpp @@ -376,12 +376,12 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2 *data << ((Unit*)this)->GetSpeed( MOVE_WALK ); *data << ((Unit*)this)->GetSpeed( MOVE_RUN ); - *data << ((Unit*)this)->GetSpeed( MOVE_SWIMBACK ); + *data << ((Unit*)this)->GetSpeed( MOVE_SWIM_BACK ); *data << ((Unit*)this)->GetSpeed( MOVE_SWIM ); - *data << ((Unit*)this)->GetSpeed( MOVE_WALKBACK ); - *data << ((Unit*)this)->GetSpeed( MOVE_FLY ); - *data << ((Unit*)this)->GetSpeed( MOVE_FLYBACK ); - *data << ((Unit*)this)->GetSpeed( MOVE_TURN ); + *data << ((Unit*)this)->GetSpeed( MOVE_RUN_BACK ); + *data << ((Unit*)this)->GetSpeed( MOVE_FLIGHT ); + *data << ((Unit*)this)->GetSpeed( MOVE_FLIGHT_BACK ); + *data << ((Unit*)this)->GetSpeed( MOVE_TURN_RATE ); // 0x08000000 if(flags2 & MOVEMENTFLAG_SPLINE2) @@ -625,7 +625,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *data << uint32(1); break; default: - *data << uint32(0); //unknown. not happen. + *data << uint32(0); // unknown. not happen. break; } } @@ -934,6 +934,56 @@ void Object::RemoveFlag( uint16 index, uint32 oldFlag ) } } +void Object::SetByteFlag( uint16 index, uint8 offset, uint8 newFlag ) +{ + ASSERT( index < m_valuesCount || PrintIndexError( index , true ) ); + + if(offset > 4) + { + sLog.outError("Object::SetByteFlag: wrong offset %u", offset); + return; + } + + if(!(uint8(m_uint32Values[ index ] >> (offset * 8)) & newFlag)) + { + m_uint32Values[ index ] |= uint32(uint32(newFlag) << (offset * 8)); + + if(m_inWorld) + { + if(!m_objectUpdated) + { + ObjectAccessor::Instance().AddUpdateObject(this); + m_objectUpdated = true; + } + } + } +} + +void Object::RemoveByteFlag( uint16 index, uint8 offset, uint8 oldFlag ) +{ + ASSERT( index < m_valuesCount || PrintIndexError( index , true ) ); + + if(offset > 4) + { + sLog.outError("Object::RemoveByteFlag: wrong offset %u", offset); + return; + } + + if(uint8(m_uint32Values[ index ] >> (offset * 8)) & oldFlag) + { + m_uint32Values[ index ] &= ~uint32(uint32(oldFlag) << (offset * 8)); + + if(m_inWorld) + { + if(!m_objectUpdated) + { + ObjectAccessor::Instance().AddUpdateObject(this); + m_objectUpdated = true; + } + } + } +} + bool Object::PrintIndexError(uint32 index, bool set) const { sLog.outError("ERROR: Attempt %s non-existed value field: %u (count: %u) for object typeid: %u type mask: %u",(set ? "set value to" : "get value from"),index,m_valuesCount,GetTypeId(),m_objectType); diff --git a/src/game/Object.h b/src/game/Object.h index ae88004dd..16e1fbfdf 100644 --- a/src/game/Object.h +++ b/src/game/Object.h @@ -226,6 +226,24 @@ class MANGOS_DLL_SPEC Object return (m_uint32Values[ index ] & flag) != 0; } + void SetByteFlag( uint16 index, uint8 offset, uint8 newFlag ); + void RemoveByteFlag( uint16 index, uint8 offset, uint8 newFlag ); + + void ToggleFlag( uint16 index, uint8 offset, uint8 flag ) + { + if(HasByteFlag(index, offset, flag)) + RemoveByteFlag(index, offset, flag); + else + SetByteFlag(index, offset, flag); + } + + bool HasByteFlag( uint16 index, uint8 offset, uint8 flag ) const + { + ASSERT( index < m_valuesCount || PrintIndexError( index , false ) ); + ASSERT( offset < 4 ); + return (((uint8*)&m_uint32Values[index])[offset] & flag) != 0; + } + void ApplyModFlag( uint16 index, uint32 flag, bool apply) { if(apply) SetFlag(index,flag); else RemoveFlag(index,flag); @@ -297,7 +315,7 @@ class MANGOS_DLL_SPEC Object { int32 *m_int32Values; uint32 *m_uint32Values; - float *m_floatValues; + float *m_floatValues; }; uint32 *m_uint32Values_mirror; diff --git a/src/game/ObjectAccessor.cpp b/src/game/ObjectAccessor.cpp index 9934b2fe1..5ce16ca3c 100644 --- a/src/game/ObjectAccessor.cpp +++ b/src/game/ObjectAccessor.cpp @@ -45,7 +45,6 @@ INSTANTIATE_CLASS_MUTEX(ObjectAccessor, ZThread::FastMutex); namespace MaNGOS { - struct MANGOS_DLL_DECL BuildUpdateForPlayer { Player &i_player; @@ -551,7 +550,7 @@ void ObjectAccessor::UpdateVisibilityForPlayer( Player* player ) template UNORDERED_MAP< uint64, T* > HashMapHolder::m_objectMap; template ZThread::FastMutex HashMapHolder::i_lock; -/// Global defintions for the hashmap storage +/// Global definitions for the hashmap storage template class HashMapHolder; template class HashMapHolder; diff --git a/src/game/ObjectAccessor.h b/src/game/ObjectAccessor.h index 6b724408a..e5b0f61f7 100644 --- a/src/game/ObjectAccessor.h +++ b/src/game/ObjectAccessor.h @@ -72,7 +72,7 @@ class HashMapHolder static LockType* GetLock() { return &i_lock; } private: - //Non instanciable only static + //Non instanceable only static HashMapHolder() {} static LockType i_lock; diff --git a/src/game/ObjectGridLoader.cpp b/src/game/ObjectGridLoader.cpp index d43296e4c..83bce7171 100644 --- a/src/game/ObjectGridLoader.cpp +++ b/src/game/ObjectGridLoader.cpp @@ -50,7 +50,7 @@ ObjectGridRespawnMover::Visit(CreatureMapType &m) { // creature in unloading grid can have respawn point in another grid // if it will be unloaded then it will not respawn in original grid until unload/load original grid - // move to respwn point to prevent this case. For player view in respawn grid this wll be normal respawn. + // move to respawn point to prevent this case. For player view in respawn grid this will be normal respawn. for(CreatureMapType::iterator iter=m.begin(), next; iter != m.end(); iter = next) { next = iter; ++next; diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index c09daa071..1c408ce63 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -841,6 +841,7 @@ class ObjectMgr int GetOrNewIndexForLocale(LocaleConstant loc); int DBCLocaleIndex; + private: void LoadScripts(ScriptMapMap& scripts, char const* tablename); void CheckScripts(ScriptMapMap const& scripts,std::set& ids); diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp index 06f910d8a..fba347199 100644 --- a/src/game/Opcodes.cpp +++ b/src/game/Opcodes.cpp @@ -138,7 +138,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] = /*0x06D*/ { "CMSG_DEL_IGNORE", STATUS_LOGGEDIN, &WorldSession::HandleDelIgnoreOpcode }, /*0x06E*/ { "CMSG_GROUP_INVITE", STATUS_LOGGEDIN, &WorldSession::HandleGroupInviteOpcode }, /*0x06F*/ { "SMSG_GROUP_INVITE", STATUS_NEVER, &WorldSession::Handle_ServerSide }, - /*0x070*/ { "CMSG_GROUP_CANCEL", STATUS_LOGGEDIN, &WorldSession::Handle_Depricated }, + /*0x070*/ { "CMSG_GROUP_CANCEL", STATUS_LOGGEDIN, &WorldSession::Handle_Deprecated }, /*0x071*/ { "SMSG_GROUP_CANCEL", STATUS_NEVER, &WorldSession::Handle_ServerSide }, /*0x072*/ { "CMSG_GROUP_ACCEPT", STATUS_LOGGEDIN, &WorldSession::HandleGroupAcceptOpcode }, /*0x073*/ { "CMSG_GROUP_DECLINE", STATUS_LOGGEDIN, &WorldSession::HandleGroupDeclineOpcode }, diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 4bd8a1934..04cc6de0b 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -170,7 +170,7 @@ bool Pet::LoadPetFromDB( Unit* owner, uint32 petentry, uint32 petnumber, bool cu } Map *map = owner->GetMap(); - uint32 guid=objmgr.GenerateLowGuid(HIGHGUID_PET); + uint32 guid = objmgr.GenerateLowGuid(HIGHGUID_PET); uint32 pet_number = fields[0].GetUInt32(); if(!Create(guid, map, petentry, pet_number)) { @@ -179,7 +179,7 @@ bool Pet::LoadPetFromDB( Unit* owner, uint32 petentry, uint32 petnumber, bool cu } float px, py, pz; - owner->GetClosePoint(px, py, pz,GetObjectSize(),PET_FOLLOW_DIST,PET_FOLLOW_ANGLE); + owner->GetClosePoint(px, py, pz, GetObjectSize(), PET_FOLLOW_DIST, PET_FOLLOW_ANGLE); Relocate(px, py, pz, owner->GetOrientation()); @@ -351,7 +351,7 @@ bool Pet::LoadPetFromDB( Unit* owner, uint32 petentry, uint32 petnumber, bool cu if(owner->GetTypeId() == TYPEID_PLAYER && getPetType() == HUNTER_PET) { - result = CharacterDatabase.PQuery("SELECT genitive, dative, accusative, instrumental, prepositional FROM character_pet_declinedname WHERE owner = '%u' AND id = '%u'",owner->GetGUIDLow(),GetCharmInfo()->GetPetNumber()); + result = CharacterDatabase.PQuery("SELECT genitive, dative, accusative, instrumental, prepositional FROM character_pet_declinedname WHERE owner = '%u' AND id = '%u'", owner->GetGUIDLow(), GetCharmInfo()->GetPetNumber()); if(result) { @@ -950,14 +950,14 @@ bool Pet::CreateBaseAtCreature(Creature* creature) } SetDisplayId(creature->GetDisplayId()); SetNativeDisplayId(creature->GetNativeDisplayId()); - SetMaxPower(POWER_HAPPINESS,GetCreatePowers(POWER_HAPPINESS)); - SetPower( POWER_HAPPINESS,166500); + SetMaxPower(POWER_HAPPINESS, GetCreatePowers(POWER_HAPPINESS)); + SetPower(POWER_HAPPINESS, 166500); setPowerType(POWER_FOCUS); - SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP,0); - SetUInt32Value(UNIT_FIELD_PETEXPERIENCE,0); + SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0); + SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, uint32((MaNGOS::XP::xp_to_level(creature->getLevel()))/4)); SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE); - SetUInt32Value(UNIT_NPC_FLAGS , 0); + SetUInt32Value(UNIT_NPC_FLAGS, 0); CreatureFamilyEntry const* cFamily = sCreatureFamilyStore.LookupEntry(creature->GetCreatureInfo()->family); if( char* familyname = cFamily->Name[sWorld.GetDefaultDbcLocale()] ) @@ -993,7 +993,7 @@ bool Pet::InitStatsForLevel(uint32 petlevel) uint32 creature_ID = (getPetType() == HUNTER_PET) ? 1 : cinfo->Entry; - SetLevel( petlevel); + SetLevel(petlevel); SetMeleeDamageSchool(SpellSchools(cinfo->dmgschool)); @@ -1082,7 +1082,7 @@ bool Pet::InitStatsForLevel(uint32 petlevel) for(int stat = 0; stat < MAX_STATS; ++stat) { - SetCreateStat(Stats(stat),float(pInfo->stats[stat])); + SetCreateStat(Stats(stat), float(pInfo->stats[stat])); } } else // not exist in DB, use some default fake data @@ -1093,11 +1093,11 @@ bool Pet::InitStatsForLevel(uint32 petlevel) SetCreateHealth(uint32(((float(cinfo->maxhealth) / cinfo->maxlevel) / (1 + 2 * cinfo->rank)) * petlevel) ); SetCreateMana( uint32(((float(cinfo->maxmana) / cinfo->maxlevel) / (1 + 2 * cinfo->rank)) * petlevel) ); - SetCreateStat(STAT_STRENGTH,22); - SetCreateStat(STAT_AGILITY,22); - SetCreateStat(STAT_STAMINA,25); - SetCreateStat(STAT_INTELLECT,28); - SetCreateStat(STAT_SPIRIT,27); + SetCreateStat(STAT_STRENGTH, 22); + SetCreateStat(STAT_AGILITY, 22); + SetCreateStat(STAT_STAMINA, 25); + SetCreateStat(STAT_INTELLECT, 28); + SetCreateStat(STAT_SPIRIT, 27); } break; } @@ -1132,34 +1132,35 @@ bool Pet::InitStatsForLevel(uint32 petlevel) // remove elite bonuses included in DB values SetCreateHealth( uint32(((float(cinfo->maxhealth) / cinfo->maxlevel) / (1 + 2 * cinfo->rank)) * petlevel) ); - SetCreateStat(STAT_STRENGTH,22); - SetCreateStat(STAT_AGILITY,22); - SetCreateStat(STAT_STAMINA,25); - SetCreateStat(STAT_INTELLECT,28); - SetCreateStat(STAT_SPIRIT,27); + SetCreateStat(STAT_STRENGTH, 22); + SetCreateStat(STAT_AGILITY, 22); + SetCreateStat(STAT_STAMINA, 25); + SetCreateStat(STAT_INTELLECT, 28); + SetCreateStat(STAT_SPIRIT, 27); } break; } case GUARDIAN_PET: - SetUInt32Value(UNIT_FIELD_PETEXPERIENCE,0); - SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP,1000); + SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); + SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000); - SetCreateMana( 28 + 10*petlevel ); - SetCreateHealth( 28 + 30*petlevel ); + SetCreateMana(28 + 10*petlevel); + SetCreateHealth(28 + 30*petlevel); // FIXME: this is wrong formula, possible each guardian pet have own damage formula //these formula may not be correct; however, it is designed to be close to what it should be //this makes dps 0.5 of pets level - SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4)) ); + SetBaseWeaponDamage(BASE_ATTACK, MINDAMAGE, float(petlevel - (petlevel / 4))); //damage range is then petlevel / 2 - SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4)) ); + SetBaseWeaponDamage(BASE_ATTACK, MAXDAMAGE, float(petlevel + (petlevel / 4))); break; default: - sLog.outError("Pet have incorrect type (%u) for levelup.",getPetType()); break; + sLog.outError("Pet have incorrect type (%u) for levelup.", getPetType()); + break; } for (int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) - SetModifierValue(UnitMods(UNIT_MOD_RESISTANCE_START + i), BASE_VALUE, float(createResistance[i]) ); + SetModifierValue(UnitMods(UNIT_MOD_RESISTANCE_START + i), BASE_VALUE, float(createResistance[i])); UpdateAllStats(); @@ -1190,7 +1191,7 @@ bool Pet::HaveInDiet(ItemPrototype const* item) const uint32 Pet::GetCurrentFoodBenefitLevel(uint32 itemlevel) { // -5 or greater food level - if(getLevel() <= itemlevel +5) //possible to feed level 60 pet with level 55 level food for full effect + if(getLevel() <= itemlevel + 5) //possible to feed level 60 pet with level 55 level food for full effect return 35000; // -10..-6 else if(getLevel() <= itemlevel + 10) //pure guess, but sounds good @@ -1240,7 +1241,7 @@ void Pet::_LoadSpellCooldowns() _AddCreatureSpellCooldown(spell_id,db_time); - sLog.outDebug("Pet (Number: %u) spell %u cooldown loaded (%u secs).",m_charmInfo->GetPetNumber(),spell_id,uint32(db_time-curTime)); + sLog.outDebug("Pet (Number: %u) spell %u cooldown loaded (%u secs).", m_charmInfo->GetPetNumber(), spell_id, uint32(db_time-curTime)); } while( result->NextRow() ); @@ -1387,7 +1388,7 @@ void Pet::_LoadAuras(uint32 timediff) void Pet::_SaveAuras() { - CharacterDatabase.PExecute("DELETE FROM pet_aura WHERE guid = '%u'",m_charmInfo->GetPetNumber()); + CharacterDatabase.PExecute("DELETE FROM pet_aura WHERE guid = '%u'", m_charmInfo->GetPetNumber()); AuraMap const& auras = GetAuras(); if (auras.empty()) @@ -1762,7 +1763,7 @@ void Pet::CastPetAuras(bool current) if(getPetType() != HUNTER_PET && (getPetType() != SUMMON_PET || owner->getClass() != CLASS_WARLOCK)) return; - for(PetAuraSet::iterator itr = owner->m_petAuras.begin(); itr != owner->m_petAuras.end(); ) + for(PetAuraSet::iterator itr = owner->m_petAuras.begin(); itr != owner->m_petAuras.end();) { PetAura const* pa = *itr; ++itr; @@ -1783,7 +1784,7 @@ void Pet::CastPetAura(PetAura const* aura) if(auraId == 35696) // Demonic Knowledge { int32 basePoints = int32(aura->GetDamage() * (GetStat(STAT_STAMINA) + GetStat(STAT_INTELLECT)) / 100); - CastCustomSpell(this,auraId,&basePoints, NULL, NULL, true ); + CastCustomSpell(this, auraId, &basePoints, NULL, NULL, true); } else CastSpell(this, auraId, true); diff --git a/src/game/Pet.h b/src/game/Pet.h index ca7ccae08..0a8f46767 100644 --- a/src/game/Pet.h +++ b/src/game/Pet.h @@ -78,6 +78,7 @@ struct PetSpell { uint16 slotId; uint16 active; + PetSpellState state : 16; PetSpellType type : 16; }; @@ -144,7 +145,7 @@ class Pet : public Creature bool isTemporarySummoned() const { return m_duration > 0; } bool Create (uint32 guidlow, Map *map, uint32 Entry, uint32 pet_number); - bool CreateBaseAtCreature( Creature* creature ); + bool CreateBaseAtCreature(Creature* creature); bool LoadPetFromDB( Unit* owner,uint32 petentry = 0,uint32 petnumber = 0, bool current = false ); void SavePetToDB(PetSaveMode mode); void Remove(PetSaveMode mode, bool returnreagent = false); diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp index 0ef5f1c01..eb51544d3 100644 --- a/src/game/PetHandler.cpp +++ b/src/game/PetHandler.cpp @@ -34,7 +34,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+2+2+8); + CHECK_PACKET_SIZE(recv_data, 8+2+2+8); uint64 guid1; uint16 spellid; @@ -46,8 +46,8 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data ) recv_data >> guid2; //tag guid // used also for charmed creature - Unit* pet= ObjectAccessor::GetUnit(*_player,guid1); - sLog.outDetail( "HandlePetAction.Pet %u flag is %u, spellid is %u, target %u.\n", uint32(GUID_LOPART(guid1)), flag, spellid, uint32(GUID_LOPART(guid2)) ); + Unit* pet= ObjectAccessor::GetUnit(*_player, guid1); + sLog.outDetail("HandlePetAction.Pet %u flag is %u, spellid is %u, target %u.\n", uint32(GUID_LOPART(guid1)), flag, spellid, uint32(GUID_LOPART(guid2)) ); if(!pet) { sLog.outError( "Pet %u not exist.\n", uint32(GUID_LOPART(guid1)) ); @@ -56,7 +56,7 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data ) if(pet != GetPlayer()->GetPet() && pet != GetPlayer()->GetCharm()) { - sLog.outError( "HandlePetAction.Pet %u isn't pet of player %s .\n", uint32(GUID_LOPART(guid1)),GetPlayer()->GetName() ); + sLog.outError("HandlePetAction.Pet %u isn't pet of player %s.\n", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName() ); return; } @@ -310,7 +310,7 @@ void WorldSession::SendPetNameQuery( uint64 petguid, uint32 petnumber) void WorldSession::HandlePetSetAction( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8+4+2+2); + CHECK_PACKET_SIZE(recv_data, 8+4+2+2); sLog.outDetail( "HandlePetSetAction. CMSG_PET_SET_ACTION\n" ); diff --git a/src/game/Player.cpp b/src/game/Player.cpp index a6989dd82..c2e1d25f5 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -173,7 +173,7 @@ void PlayerTaxi::AppendTaximaskTo( ByteBuffer& data, bool all ) if(all) { for (uint8 i=0; iSendPacket(&data); - //Let other players see that you get damage SendMessageToSet(&data, true); + DealDamage(this, damage, NULL, SELF_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); if(type==DAMAGE_FALL && !isAlive()) // DealDamage not apply item durability loss at self damage @@ -844,7 +836,7 @@ void Player::HandleDrowning() m_isunderwater|= 0x04; StartMirrorTimer(BREATH_TIMER, UnderWaterTime); } - //continius trigger drowning "Damage" + //continuous trigger drowning "Damage" if ((m_breathTimer == 0) && (m_isunderwater & 0x01)) { //TODO: Check this formula @@ -966,7 +958,7 @@ void Player::SetDrunkValue(uint16 newDrunkenValue, uint32 itemId) return; WorldPacket data(SMSG_CROSSED_INEBRIATION_THRESHOLD, (8+4+4)); - data << GetGUID(); + data << uint64(GetGUID()); data << uint32(newDrunkenState); data << uint32(itemId); @@ -1339,7 +1331,7 @@ void Player::BuildEnumData( QueryResult * result, WorldPacket * p_data ) *p_data << uint8(getLevel()); // player level // do not use GetMap! it will spawn a new instance since the bound instances are not loaded uint32 zoneId = MapManager::Instance().GetZoneId(GetMapId(), GetPositionX(),GetPositionY()); - + sLog.outDebug("Player::BuildEnumData: m:%u, x:%f, y:%f, z:%f zone:%u", GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), zoneId); *p_data << zoneId; *p_data << GetMapId(); @@ -2380,7 +2372,6 @@ void Player::SendInitialSpells() continue; data << uint16(itr->first); - //data << uint16(itr->second->slotId); data << uint16(0); // it's not slot id spellCount +=1; @@ -2407,13 +2398,13 @@ void Player::SendInitialSpells() data << uint16(sEntry->Category); // spell category if(sEntry->Category) // may be wrong, but anyway better than nothing... { - data << uint32(0); - data << uint32(cooldown); + data << uint32(0); // cooldown + data << uint32(cooldown); // category cooldown } else { - data << uint32(cooldown); - data << uint32(0); + data << uint32(cooldown); // cooldown + data << uint32(0); // category cooldown } } @@ -3399,7 +3390,6 @@ void Player::DestroyForPlayer( Player *target ) const if(target == this) { - for(int i = INVENTORY_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) { if(m_items[i] == NULL) @@ -6453,23 +6443,23 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto,uint8 slot,bool apply) break; case ITEM_MOD_AGILITY: // modify agility HandleStatModifier(UNIT_MOD_STAT_AGILITY, BASE_VALUE, float(val), apply); - ApplyStatBuffMod(STAT_AGILITY, val, apply); + ApplyStatBuffMod(STAT_AGILITY, float(val), apply); break; case ITEM_MOD_STRENGTH: //modify strength HandleStatModifier(UNIT_MOD_STAT_STRENGTH, BASE_VALUE, float(val), apply); - ApplyStatBuffMod(STAT_STRENGTH, val, apply); + ApplyStatBuffMod(STAT_STRENGTH, float(val), apply); break; case ITEM_MOD_INTELLECT: //modify intellect HandleStatModifier(UNIT_MOD_STAT_INTELLECT, BASE_VALUE, float(val), apply); - ApplyStatBuffMod(STAT_INTELLECT, val, apply); + ApplyStatBuffMod(STAT_INTELLECT, float(val), apply); break; case ITEM_MOD_SPIRIT: //modify spirit HandleStatModifier(UNIT_MOD_STAT_SPIRIT, BASE_VALUE, float(val), apply); - ApplyStatBuffMod(STAT_SPIRIT, val, apply); + ApplyStatBuffMod(STAT_SPIRIT, float(val), apply); break; case ITEM_MOD_STAMINA: //modify stamina HandleStatModifier(UNIT_MOD_STAT_STAMINA, BASE_VALUE, float(val), apply); - ApplyStatBuffMod(STAT_STAMINA, val, apply); + ApplyStatBuffMod(STAT_STAMINA, float(val), apply); break; case ITEM_MOD_DEFENSE_SKILL_RATING: ApplyRatingMod(CR_DEFENSE_SKILL, int32(val), apply); @@ -8847,7 +8837,7 @@ uint8 Player::_CanStoreItem( uint8 bag, uint8 slot, ItemPosCountVec &dest, uint3 } else // equipped bag { - // we need check 2 time (specilized/non_specialized), use NULL_BAG to prevent skipping bag + // we need check 2 time (specialized/non_specialized), use NULL_BAG to prevent skipping bag res = _CanStoreItem_InBag(bag,dest,pProto,count,true,false,pItem,NULL_BAG,slot); if(res!=EQUIP_ERR_OK) res = _CanStoreItem_InBag(bag,dest,pProto,count,true,true,pItem,NULL_BAG,slot); @@ -10305,7 +10295,6 @@ void Player::DestroyItem( uint8 bag, uint8 slot, bool update ) if( bag == INVENTORY_SLOT_BAG_0 ) { - SetUInt64Value((uint16)(PLAYER_FIELD_INV_SLOT_HEAD + (slot*2)), 0); // equipment and equipped bags can have applied bonuses @@ -12136,7 +12125,7 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver if(pQuest->GetCharTitleId()) { if(CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(pQuest->GetCharTitleId())) - SetFlag64(PLAYER__FIELD_KNOWN_TITLES, (uint64(1) << titleEntry->bit_index)); + SetTitle(titleEntry); } // Send reward mail @@ -13153,7 +13142,7 @@ void Player::SendQuestComplete( uint32 quest_id ) if( quest_id ) { WorldPacket data( SMSG_QUESTUPDATE_COMPLETE, 4 ); - data << quest_id; + data << uint32(quest_id); GetSession()->SendPacket( &data ); sLog.outDebug( "WORLD: Sent SMSG_QUESTUPDATE_COMPLETE quest = %u", quest_id ); } @@ -13673,14 +13662,14 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) SetUInt32Value(UNIT_CHANNEL_SPELL,0); // clear charm/summon related fields - SetUInt64Value(UNIT_FIELD_CHARM,0); - SetUInt64Value(UNIT_FIELD_SUMMON,0); - SetUInt64Value(UNIT_FIELD_CHARMEDBY,0); - SetUInt64Value(UNIT_FIELD_SUMMONEDBY,0); - SetUInt64Value(UNIT_FIELD_CREATEDBY,0); + SetCharm(NULL); + SetPet(NULL); + SetCharmerGUID(NULL); + SetOwnerGUID(NULL); + SetCreatorGUID(NULL); // reset some aura modifiers before aura apply - SetUInt64Value(PLAYER_FARSIGHT, 0); + SetFarSight(NULL); SetUInt32Value(PLAYER_TRACK_CREATURES, 0 ); SetUInt32Value(PLAYER_TRACK_RESOURCES, 0 ); @@ -13765,7 +13754,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder ) // note: PLAYER__FIELD_KNOWN_TITLES updated at quest status loaded if(uint32 curTitle = GetUInt32Value(PLAYER_CHOSEN_TITLE)) { - if(!HasFlag64(PLAYER__FIELD_KNOWN_TITLES,uint64(1) << curTitle)) + if(!HasTitle(curTitle)) SetUInt32Value(PLAYER_CHOSEN_TITLE,0); } @@ -14380,7 +14369,7 @@ void Player::_LoadQuestStatus(QueryResult *result) if(pQuest->GetCharTitleId()) { if(CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(pQuest->GetCharTitleId())) - SetFlag64(PLAYER__FIELD_KNOWN_TITLES, (uint64(1) << titleEntry->bit_index)); + SetTitle(titleEntry); } } @@ -15673,8 +15662,8 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent) m_guardianPets.erase(pet->GetGUID()); break; default: - if(GetPetGUID()==pet->GetGUID()) - SetPet(0); + if(GetPetGUID() == pet->GetGUID()) + SetPet(NULL); break; } @@ -18249,7 +18238,7 @@ Player* Player::GetNextRandomRaidMember(float radius) void Player::UpdateUnderwaterState( Map* m, float x, float y, float z ) { float water_z = m->GetWaterLevel(x,y); - float height_z = m->GetHeight(x,y,z, false); // use .map base surface height + float height_z = m->GetHeight(x,y,z, false); // use .map base surface height uint8 flag1 = m->GetTerrainType(x,y); //!Underwater check, not in water if underground or above water level @@ -18292,11 +18281,28 @@ bool ItemPosCount::isContainedIn(ItemPosCountVec const& vec) const bool Player::isAllowUseBattleGroundObject() { - return ( //InBattleGround() && // in battleground - not need, check in other cases - !IsMounted() && // not mounted - !HasStealthAura() && // not stealthed - !HasInvisibilityAura() && // not invisible - !HasAura(SPELL_RECENTLY_DROPPED_FLAG, 0) && // can't pickup - isAlive() // live player + return ( //InBattleGround() && // in battleground - not need, check in other cases + !IsMounted() && // not mounted + !HasStealthAura() && // not stealthed + !HasInvisibilityAura() && // not invisible + !HasAura(SPELL_RECENTLY_DROPPED_FLAG, 0) && // can't pickup + isAlive() // live player ); } + +bool Player::HasTitle(uint32 bitIndex) +{ + if (bitIndex > 128) + return false; + + uint32 fieldIndexOffset = bitIndex/32; + uint32 flag = 1 << (bitIndex%32); + return HasFlag(PLAYER__FIELD_KNOWN_TITLES+fieldIndexOffset, flag); +} + +void Player::SetTitle(CharTitlesEntry const* title) +{ + uint32 fieldIndexOffset = title->bit_index/32; + uint32 flag = 1 << (title->bit_index%32); + SetFlag(PLAYER__FIELD_KNOWN_TITLES+fieldIndexOffset, flag); +} diff --git a/src/game/Player.h b/src/game/Player.h index 88fbe8009..821f3bb6e 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -516,10 +516,10 @@ typedef std::map QuestStatusMap; enum QuestSlotOffsets { - QUEST_ID_OFFSET = 0, - QUEST_STATE_OFFSET = 1, + QUEST_ID_OFFSET = 0, + QUEST_STATE_OFFSET = 1, QUEST_COUNTS_OFFSET = 2, - QUEST_TIME_OFFSET = 3 + QUEST_TIME_OFFSET = 3 }; #define MAX_QUEST_OFFSET 4 @@ -1683,6 +1683,7 @@ class MANGOS_DLL_SPEC Player : public Unit FactionStateList m_factions; ForcedReactions m_forcedReactions; + FactionStateList const& GetFactionStateList() { return m_factions; } uint32 GetDefaultReputationFlags(const FactionEntry *factionEntry) const; int32 GetBaseReputation(const FactionEntry *factionEntry) const; int32 GetReputation(uint32 faction_id) const; @@ -1919,6 +1920,9 @@ class MANGOS_DLL_SPEC Player : public Unit void SetClientControl(Unit* target, uint8 allowMove); + uint64 GetFarSight() const { return GetUInt64Value(PLAYER_FARSIGHT); } + void SetFarSight(uint64 guid) { SetUInt64Value(PLAYER_FARSIGHT, guid); } + // Transports Transport * GetTransport() const { return m_transport; } void SetTransport(Transport * t) { m_transport = t; } @@ -2024,6 +2028,9 @@ class MANGOS_DLL_SPEC Player : public Unit WorldLocation& GetTeleportDest() { return m_teleport_dest; } DeclinedName const* GetDeclinedNames() const { return m_declinedname; } + bool HasTitle(uint32 bitIndex); + bool HasTitle(CharTitlesEntry const* title) { return HasTitle(title->bit_index); } + void SetTitle(CharTitlesEntry const* title); protected: diff --git a/src/game/QuestDef.h b/src/game/QuestDef.h index 551c3dd5f..316209393 100644 --- a/src/game/QuestDef.h +++ b/src/game/QuestDef.h @@ -112,24 +112,24 @@ enum __QuestGiverStatus enum __QuestFlags { - // Flags used at server and sended to client - QUEST_FLAGS_STAY_ALIVE = 1, // Not used currently - QUEST_FLAGS_PARTY_ACCEPT = 2, // Not used currently. If player in party, all players that can accept this quest will receive confirmation box to accept quest CMSG_QUEST_CONFIRM_ACCEPT/SMSG_QUEST_CONFIRM_ACCEPT - QUEST_FLAGS_EXPLORATION = 4, // Not used currently - QUEST_FLAGS_SHARABLE = 8, // Can be shared: Player::CanShareQuest() - //QUEST_FLAGS_NONE2 = 16, // Not used currently - QUEST_FLAGS_EPIC = 32, // Not used currently: Unsure of content - QUEST_FLAGS_RAID = 64, // Not used currently - QUEST_FLAGS_TBC = 128, // Not used currently: Available if TBC expension enabled only - QUEST_FLAGS_UNK2 = 256, // Not used currently: _DELIVER_MORE Quest needs more than normal _q-item_ drops from mobs - QUEST_FLAGS_HIDDEN_REWARDS = 512, // Items and money rewarded only sent in SMSG_QUESTGIVER_OFFER_REWARD (not in SMSG_QUESTGIVER_QUEST_DETAILS or in client quest log(SMSG_QUEST_QUERY_RESPONSE)) - QUEST_FLAGS_AUTO_REWARDED = 1024, // These quests are automatically rewarded on quest complete and they will never appear in quest log client side. - QUEST_FLAGS_TBC_RACES = 2048, // Not used currently: Bloodelf/draenei starting zone quests - QUEST_FLAGS_DAILY = 4096, // Used to know quest is Daily one + // Flags used at server and sent to client + QUEST_FLAGS_STAY_ALIVE = 0x00000001, // Not used currently + QUEST_FLAGS_PARTY_ACCEPT = 0x00000002, // Not used currently. If player in party, all players that can accept this quest will receive confirmation box to accept quest CMSG_QUEST_CONFIRM_ACCEPT/SMSG_QUEST_CONFIRM_ACCEPT + QUEST_FLAGS_EXPLORATION = 0x00000004, // Not used currently + QUEST_FLAGS_SHARABLE = 0x00000008, // Can be shared: Player::CanShareQuest() + //QUEST_FLAGS_NONE2 = 0x00000010, // Not used currently + QUEST_FLAGS_EPIC = 0x00000020, // Not used currently: Unsure of content + QUEST_FLAGS_RAID = 0x00000040, // Not used currently + QUEST_FLAGS_TBC = 0x00000080, // Not used currently: Available if TBC expension enabled only + QUEST_FLAGS_UNK2 = 0x00000100, // Not used currently: _DELIVER_MORE Quest needs more than normal _q-item_ drops from mobs + QUEST_FLAGS_HIDDEN_REWARDS = 0x00000200, // Items and money rewarded only sent in SMSG_QUESTGIVER_OFFER_REWARD (not in SMSG_QUESTGIVER_QUEST_DETAILS or in client quest log(SMSG_QUEST_QUERY_RESPONSE)) + QUEST_FLAGS_AUTO_REWARDED = 0x00000400, // These quests are automatically rewarded on quest complete and they will never appear in quest log client side. + QUEST_FLAGS_TBC_RACES = 0x00000800, // Not used currently: Blood elf/Draenei starting zone quests + QUEST_FLAGS_DAILY = 0x00001000, // Used to know quest is Daily one // Mangos flags for set SpecialFlags in DB if required but used only at server QUEST_MANGOS_FLAGS_REPEATABLE = 0x010000, // Set by 1 in SpecialFlags from DB - QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT = 0x020000, // Set by 2 in SpecialFlags from DB (if reequired area explore, spell SPELL_EFFECT_QUEST_COMPLETE casting, table `*_script` command SCRIPT_COMMAND_QUEST_EXPLORED use, set from script DLL) + QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT = 0x020000, // Set by 2 in SpecialFlags from DB (if required area explore, spell SPELL_EFFECT_QUEST_COMPLETE casting, table `*_script` command SCRIPT_COMMAND_QUEST_EXPLORED use, set from script DLL) QUEST_MANGOS_FLAGS_DB_ALLOWED = 0xFFFF | QUEST_MANGOS_FLAGS_REPEATABLE | QUEST_MANGOS_FLAGS_EXPLORATION_OR_EVENT, // Mangos flags for internal use only @@ -318,7 +318,7 @@ struct QuestStatusData : m_status(QUEST_STATUS_NONE),m_rewarded(false), m_explored(false), m_timer(0), uState(QUEST_NEW) { - memset(m_itemcount, 0, QUEST_OBJECTIVES_COUNT * sizeof(uint32)); + memset(m_itemcount, 0, QUEST_OBJECTIVES_COUNT * sizeof(uint32)); memset(m_creatureOrGOcount, 0, QUEST_OBJECTIVES_COUNT * sizeof(uint32)); } diff --git a/src/game/SharedDefines.h b/src/game/SharedDefines.h index 907cceb2f..8ae1cf27b 100644 --- a/src/game/SharedDefines.h +++ b/src/game/SharedDefines.h @@ -553,7 +553,6 @@ enum SpellEffects SPELL_EFFECT_TRADE_SKILL = 47, SPELL_EFFECT_STEALTH = 48, SPELL_EFFECT_DETECT = 49, - // SPELL_EFFECT_SUMMON_OBJECT = 50, SPELL_EFFECT_TRANS_DOOR = 50, SPELL_EFFECT_FORCE_CRITICAL_HIT = 51, SPELL_EFFECT_GUARANTEE_HIT = 52, @@ -766,7 +765,7 @@ enum SpellImmunity IMMUNITY_MECHANIC = 5 // enum Mechanics }; -#define MAX_SPELL_IMMUNITY 6 +#define MAX_SPELL_IMMUNITY 6 enum Targets { @@ -831,7 +830,7 @@ enum SpellMissInfo SPELL_MISS_IMMUNE2 = 8, SPELL_MISS_DEFLECT = 9, SPELL_MISS_ABSORB = 10, - SPELL_MISS_REFLECT = 11, + SPELL_MISS_REFLECT = 11 }; enum SpellHitType @@ -903,13 +902,13 @@ enum GameobjectTypes enum GameObjectFlags { - GO_FLAG_IN_USE = 0x01, //disables interaction while animated - GO_FLAG_LOCKED = 0x02, //require key, spell, event, etc to be opened. Makes "Locked" appear in tooltip - GO_FLAG_INTERACT_COND = 0x04, //cannot interact (condition to interact) - GO_FLAG_TRANSPORT = 0x08, //any kind of transport? Object can transport (elevator, boat, car) - GO_FLAG_UNK1 = 0x10, // - GO_FLAG_NODESPAWN = 0x20, //never despawn, typically for doors, they just change state - GO_FLAG_TRIGGERED = 0x40, //typically, summoned objects. Triggered by spell or other events + GO_FLAG_IN_USE = 0x00000001, //disables interaction while animated + GO_FLAG_LOCKED = 0x00000002, //require key, spell, event, etc to be opened. Makes "Locked" appear in tooltip + GO_FLAG_INTERACT_COND = 0x00000004, //cannot interact (condition to interact) + GO_FLAG_TRANSPORT = 0x00000008, //any kind of transport? Object can transport (elevator, boat, car) + GO_FLAG_UNK1 = 0x00000010, // + GO_FLAG_NODESPAWN = 0x00000020, //never despawn, typically for doors, they just change state + GO_FLAG_TRIGGERED = 0x00000040 //typically, summoned objects. Triggered by spell or other events }; enum TextEmotes @@ -1503,7 +1502,7 @@ enum CreatureFamily CREATURE_FAMILY_SPIDER = 3, CREATURE_FAMILY_BEAR = 4, CREATURE_FAMILY_BOAR = 5, - CREATURE_FAMILY_CROCILISK = 6, + CREATURE_FAMILY_CROCOLISK = 6, CREATURE_FAMILY_CARRION_BIRD = 7, CREATURE_FAMILY_CRAB = 8, CREATURE_FAMILY_GORILLA = 9, @@ -1533,9 +1532,9 @@ enum CreatureFamily enum CreatureTypeFlags { - CREATURE_TYPEFLAGS_TAMEBLE = 0x0001, + CREATURE_TYPEFLAGS_TAMEABLE = 0x0001, CREATURE_TYPEFLAGS_HERBLOOT = 0x0100, - CREATURE_TYPEFLAGS_MININGLOOT = 0x0200, + CREATURE_TYPEFLAGS_MININGLOOT = 0x0200 }; enum CreatureEliteType diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index f1fa68b8a..458fa8af6 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -270,6 +270,7 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi m_triggeringContainer = triggeringContainer; m_referencedFromCurrentSpell = false; m_executedCurrently = false; + m_delayStart = 0; m_delayAtDamageCount = 0; m_applyMultiplierMask = 0; @@ -2624,17 +2625,13 @@ void Spell::SendSpellStart() if(!IsNeedSendToClient()) return; - sLog.outDebug("Sending SMSG_SPELL_START id=%u",m_spellInfo->Id); + sLog.outDebug("Sending SMSG_SPELL_START id=%u", m_spellInfo->Id); - uint16 castFlags = CAST_FLAG_UNKNOWN1; + uint32 castFlags = CAST_FLAG_UNKNOWN1; if(IsRangedSpell()) castFlags |= CAST_FLAG_AMMO; - Unit * target; - if(!m_targets.getUnitTarget()) - target = m_caster; - else - target = m_targets.getUnitTarget(); + Unit *target = m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster; WorldPacket data(SMSG_SPELL_START, (8+8+4+4+2)); if(m_CastItem) @@ -2662,17 +2659,13 @@ void Spell::SendSpellGo() if(!IsNeedSendToClient()) return; - sLog.outDebug("Sending SMSG_SPELL_GO id=%u",m_spellInfo->Id); + sLog.outDebug("Sending SMSG_SPELL_GO id=%u", m_spellInfo->Id); - Unit * target; - if(!m_targets.getUnitTarget()) - target = m_caster; - else - target = m_targets.getUnitTarget(); + Unit *target = m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster; - uint16 castFlags = CAST_FLAG_UNKNOWN3; + uint32 castFlags = CAST_FLAG_UNKNOWN3; if(IsRangedSpell()) - castFlags |= CAST_FLAG_AMMO; + castFlags |= CAST_FLAG_AMMO; // arrows/bullets visual WorldPacket data(SMSG_SPELL_GO, 50); // guess size if(m_CastItem) @@ -2773,7 +2766,7 @@ void Spell::SendLogExecute() data << uint32(count1); // count1 (effect count?) for(uint32 i = 0; i < count1; ++i) { - data << uint32(m_spellInfo->Effect[0]); // spell effect? + data << uint32(m_spellInfo->Effect[0]); // spell effect uint32 count2 = 1; data << uint32(count2); // count2 (target count?) for(uint32 j = 0; j < count2; ++j) @@ -2897,7 +2890,7 @@ void Spell::SendChannelUpdate(uint32 time) WorldPacket data( MSG_CHANNEL_UPDATE, 8+4 ); data.append(m_caster->GetPackGUID()); - data << time; + data << uint32(time); ((Player*)m_caster)->GetSession()->SendPacket( &data ); } @@ -2934,8 +2927,8 @@ void Spell::SendChannelStart(uint32 duration) { WorldPacket data( MSG_CHANNEL_START, (8+4+4) ); data.append(m_caster->GetPackGUID()); - data << m_spellInfo->Id; - data << duration; + data << uint32(m_spellInfo->Id); + data << uint32(duration); ((Player*)m_caster)->GetSession()->SendPacket( &data ); } @@ -2961,8 +2954,8 @@ void Spell::SendPlaySpellVisual(uint32 SpellID) return; WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 12); - data << m_caster->GetGUID(); - data << SpellID; + data << uint64(m_caster->GetGUID()); + data << uint32(SpellID); // spell visual id? ((Player*)m_caster)->GetSession()->SendPacket(&data); } @@ -3963,7 +3956,9 @@ uint8 Spell::CanCast(bool strict) if(int32(m_targets.getUnitTarget()->getLevel()) > CalculateDamage(i,m_targets.getUnitTarget())) return SPELL_FAILED_HIGHLEVEL; - };break; + + break; + } case SPELL_AURA_MOUNTED: { if (m_caster->IsInWater()) @@ -3996,7 +3991,9 @@ uint8 Spell::CanCast(bool strict) // can be casted at non-friendly unit or own pet/charm if(m_caster->IsFriendlyTo(m_targets.getUnitTarget())) return SPELL_FAILED_TARGET_FRIENDLY; - };break; + + break; + } case SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED: case SPELL_AURA_FLY: { @@ -4007,7 +4004,9 @@ uint8 Spell::CanCast(bool strict) GetVirtualMapForMapAndZone(m_caster->GetMapId(),m_caster->GetZoneId()) != 530) return SPELL_FAILED_NOT_HERE; } - };break; + + break; + } case SPELL_AURA_PERIODIC_MANA_LEECH: { if (!m_targets.getUnitTarget()) @@ -4018,9 +4017,11 @@ uint8 Spell::CanCast(bool strict) if(m_targets.getUnitTarget()->getPowerType()!=POWER_MANA) return SPELL_FAILED_BAD_TARGETS; + break; } - default:break; + default: + break; } } @@ -4143,7 +4144,7 @@ uint8 Spell::CheckCasterAuras() const else if(m_caster->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED) && m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_PACIFY) prevented_reason = SPELL_FAILED_PACIFIED; - // Attr must make flag drop spell totally immuned from all effects + // Attr must make flag drop spell totally immune from all effects if(prevented_reason) { if(school_immune || mechanic_immune || dispel_immune) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 8cb0bcb3c..a9699c70a 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -1975,7 +1975,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real) ( GetSpellProto()->EffectApplyAuraName[0]==1 || GetSpellProto()->EffectApplyAuraName[0]==128 ) ) ) { // spells with SpellEffect=72 and aura=4: 6196, 6197, 21171, 21425 - m_target->SetUInt64Value(PLAYER_FARSIGHT, 0); + ((Player*)m_target)->SetFarSight(NULL); WorldPacket data(SMSG_CLEAR_FAR_SIGHT_IMMEDIATE, 0); ((Player*)m_target)->GetSession()->SendPacket(&data); return; @@ -2844,7 +2844,7 @@ void Aura::HandleBindSight(bool apply, bool Real) if(!caster || caster->GetTypeId() != TYPEID_PLAYER) return; - caster->SetUInt64Value(PLAYER_FARSIGHT,apply ? m_target->GetGUID() : 0); + ((Player*)caster)->SetFarSight(apply ? m_target->GetGUID() : NULL); } void Aura::HandleFarSight(bool apply, bool Real) @@ -2853,7 +2853,7 @@ void Aura::HandleFarSight(bool apply, bool Real) if(!caster || caster->GetTypeId() != TYPEID_PLAYER) return; - caster->SetUInt64Value(PLAYER_FARSIGHT,apply ? m_modifier.m_miscvalue : 0); + ((Player*)caster)->SetFarSight(apply ? m_target->GetGUID() : NULL); } void Aura::HandleAuraTrackCreatures(bool apply, bool Real) @@ -2959,7 +2959,7 @@ void Aura::HandleModPossess(bool apply, bool Real) } } if(caster->GetTypeId() == TYPEID_PLAYER) - caster->SetUInt64Value(PLAYER_FARSIGHT,apply ? m_target->GetGUID() : 0); + ((Player*)caster)->SetFarSight(apply ? m_target->GetGUID() : NULL); } void Aura::HandleModPossessPet(bool apply, bool Real) @@ -3661,7 +3661,7 @@ void Aura::HandleAuraModIncreaseFlightSpeed(bool apply, bool Real) m_target->SetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID,16314); } - m_target->UpdateSpeed(MOVE_FLY, true); + m_target->UpdateSpeed(MOVE_FLIGHT, true); } void Aura::HandleAuraModIncreaseSwimSpeed(bool /*apply*/, bool Real) @@ -3681,7 +3681,7 @@ void Aura::HandleAuraModDecreaseSpeed(bool /*apply*/, bool Real) m_target->UpdateSpeed(MOVE_RUN, true); m_target->UpdateSpeed(MOVE_SWIM, true); - m_target->UpdateSpeed(MOVE_FLY, true); + m_target->UpdateSpeed(MOVE_FLIGHT, true); } void Aura::HandleAuraModUseNormalSpeed(bool /*apply*/, bool Real) @@ -3692,7 +3692,7 @@ void Aura::HandleAuraModUseNormalSpeed(bool /*apply*/, bool Real) m_target->UpdateSpeed(MOVE_RUN, true); m_target->UpdateSpeed(MOVE_SWIM, true); - m_target->UpdateSpeed(MOVE_FLY, true); + m_target->UpdateSpeed(MOVE_FLIGHT, true); } /*********************************************************/ @@ -4681,21 +4681,24 @@ void Aura::HandleAuraModIncreaseEnergy(bool apply, bool Real) if(int32(powerType) != m_modifier.m_miscvalue) return; - m_target->HandleStatModifier(UnitMods(UNIT_MOD_POWER_START + powerType), TOTAL_VALUE, float(m_modifier.m_amount), apply); + UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType); + + m_target->HandleStatModifier(unitMod, TOTAL_VALUE, float(m_modifier.m_amount), apply); } -void Aura::HandleAuraModIncreaseEnergyPercent(bool apply, bool Real) +void Aura::HandleAuraModIncreaseEnergyPercent(bool apply, bool /*Real*/) { Powers powerType = m_target->getPowerType(); if(int32(powerType) != m_modifier.m_miscvalue) return; - m_target->HandleStatModifier(UnitMods(UNIT_MOD_POWER_START + powerType), TOTAL_PCT, float(m_modifier.m_amount), apply); + UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType); + + m_target->HandleStatModifier(unitMod, TOTAL_PCT, float(m_modifier.m_amount), apply); } -void Aura::HandleAuraModIncreaseHealthPercent(bool apply, bool Real) +void Aura::HandleAuraModIncreaseHealthPercent(bool apply, bool /*Real*/) { - //m_target->ApplyMaxHealthPercentMod(m_modifier.m_amount,apply); m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_PCT, float(m_modifier.m_amount), apply); } diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 767cd8ea7..5634cc249 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -887,7 +887,7 @@ void Spell::EffectDummy(uint32 i) if (!m_caster->HasAuraType(SPELL_AURA_MOUNTED)) return; - float flyspeed = m_caster->GetSpeedRate(MOVE_FLY); + float flyspeed = m_caster->GetSpeedRate(MOVE_FLIGHT); float speed = m_caster->GetSpeedRate(MOVE_RUN); m_caster->RemoveSpellsCausingAura(SPELL_AURA_MOUNTED); @@ -3250,17 +3250,17 @@ void Spell::EffectSummon(uint32 i) if(duration > 0) spawnCreature->SetDuration(duration); - spawnCreature->SetUInt64Value(UNIT_FIELD_SUMMONEDBY,m_caster->GetGUID()); - spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS , 0); + spawnCreature->SetOwnerGUID(m_caster->GetGUID()); + spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS, 0); spawnCreature->setPowerType(POWER_MANA); - spawnCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_caster->getFaction()); - spawnCreature->SetUInt32Value(UNIT_FIELD_FLAGS,0); - spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_0,2048); - spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); - spawnCreature->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP,0); - spawnCreature->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE,0); - spawnCreature->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP,1000); - spawnCreature->SetUInt64Value(UNIT_FIELD_CREATEDBY, m_caster->GetGUID()); + spawnCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, m_caster->getFaction()); + spawnCreature->SetUInt32Value(UNIT_FIELD_FLAGS, 0); + spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048); + spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + spawnCreature->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, 0); + spawnCreature->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); + spawnCreature->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000); + spawnCreature->SetCreatorGUID(m_caster->GetGUID()); spawnCreature->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); spawnCreature->InitStatsForLevel(level); @@ -3522,7 +3522,8 @@ void Spell::EffectAddFarsight(uint32 i) dynObj->SetUInt32Value(DYNAMICOBJECT_BYTES, 0x80000002); m_caster->AddDynObject(dynObj); dynObj->GetMap()->Add(dynObj); - m_caster->SetUInt64Value(PLAYER_FARSIGHT, dynObj->GetGUID()); + if(m_caster->GetTypeId() == TYPEID_PLAYER) + ((Player*)m_caster)->SetFarSight(dynObj->GetGUID()); } void Spell::EffectSummonWild(uint32 i) @@ -3679,14 +3680,14 @@ void Spell::EffectSummonGuardian(uint32 i) if(duration > 0) spawnCreature->SetDuration(duration); - spawnCreature->SetUInt64Value(UNIT_FIELD_SUMMONEDBY,m_caster->GetGUID()); + spawnCreature->SetOwnerGUID(m_caster->GetGUID()); spawnCreature->setPowerType(POWER_MANA); spawnCreature->SetUInt32Value(UNIT_NPC_FLAGS , 0); spawnCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_caster->getFaction()); spawnCreature->SetUInt32Value(UNIT_FIELD_FLAGS,0); spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_1,0); spawnCreature->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP,0); - spawnCreature->SetUInt64Value(UNIT_FIELD_CREATEDBY, m_caster->GetGUID()); + spawnCreature->SetCreatorGUID(m_caster->GetGUID()); spawnCreature->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); spawnCreature->InitStatsForLevel(level); @@ -4088,15 +4089,15 @@ void Spell::EffectSummonPet(uint32 i) NewSummon->GetCharmInfo()->SetReactState(REACT_DEFENSIVE); } - NewSummon->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_caster->GetGUID()); - NewSummon->SetUInt64Value(UNIT_FIELD_CREATEDBY, m_caster->GetGUID()); - NewSummon->SetUInt32Value(UNIT_NPC_FLAGS , 0); + NewSummon->SetOwnerGUID(m_caster->GetGUID()); + NewSummon->SetCreatorGUID(m_caster->GetGUID()); + NewSummon->SetUInt32Value(UNIT_NPC_FLAGS, 0); NewSummon->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, faction); - NewSummon->SetUInt32Value(UNIT_FIELD_BYTES_0,2048); - NewSummon->SetUInt32Value(UNIT_FIELD_BYTES_1,0); - NewSummon->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP,time(NULL)); - NewSummon->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE,0); - NewSummon->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP,1000); + NewSummon->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048); + NewSummon->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); + NewSummon->SetUInt32Value(UNIT_FIELD_PET_NAME_TIMESTAMP, time(NULL)); + NewSummon->SetUInt32Value(UNIT_FIELD_PETEXPERIENCE, 0); + NewSummon->SetUInt32Value(UNIT_FIELD_PETNEXTLEVELEXP, 1000); NewSummon->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); NewSummon->GetCharmInfo()->SetPetNumber(pet_number, true); @@ -4105,7 +4106,7 @@ void Spell::EffectSummonPet(uint32 i) // this enables popup window (pet dismiss, cancel), hunter pet additional flags set later NewSummon->SetUInt32Value(UNIT_FIELD_FLAGS,UNIT_FLAG_PVP_ATTACKABLE); - NewSummon->InitStatsForLevel( petlevel); + NewSummon->InitStatsForLevel(petlevel); NewSummon->InitPetCreateSpells(); if(NewSummon->getPetType()==SUMMON_PET) @@ -5703,8 +5704,8 @@ void Spell::EffectSummonCritter(uint32 i) return; } - critter->SetUInt64Value(UNIT_FIELD_SUMMONEDBY,m_caster->GetGUID()); - critter->SetUInt64Value(UNIT_FIELD_CREATEDBY,m_caster->GetGUID()); + critter->SetOwnerGUID(m_caster->GetGUID()); + critter->SetCreatorGUID(m_caster->GetGUID()); critter->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_caster->getFaction()); critter->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp index ecc17cf70..de379d91e 100644 --- a/src/game/SpellHandler.cpp +++ b/src/game/SpellHandler.cpp @@ -260,7 +260,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket) void WorldSession::HandleGameObjectUseOpcode( WorldPacket & recv_data ) { - CHECK_PACKET_SIZE(recv_data,8); + CHECK_PACKET_SIZE(recv_data, 8); uint64 guid; diff --git a/src/game/StatSystem.cpp b/src/game/StatSystem.cpp index f2157017a..d94e68fef 100644 --- a/src/game/StatSystem.cpp +++ b/src/game/StatSystem.cpp @@ -848,6 +848,7 @@ void Pet::UpdateMaxHealth() void Pet::UpdateMaxPower(Powers power) { UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power); + float addValue = (power == POWER_MANA) ? GetStat(STAT_INTELLECT) - GetCreateStat(STAT_INTELLECT) : 0.0f; float value = GetModifierValue(unitMod, BASE_VALUE) + GetCreatePowers(power); diff --git a/src/game/TaxiHandler.cpp b/src/game/TaxiHandler.cpp index 76736227c..30c6df133 100644 --- a/src/game/TaxiHandler.cpp +++ b/src/game/TaxiHandler.cpp @@ -82,7 +82,7 @@ void WorldSession::HandleTaxiQueryAvailableNodesOpcode( WorldPacket & recv_data Creature *unit = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid, UNIT_NPC_FLAG_FLIGHTMASTER); if (!unit) { - sLog.outDebug( "WORLD: HandleTaxiQueryAvailableNodesOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) ); + sLog.outDebug( "WORLD: HandleTaxiQueryAvailableNodes - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) ); return; } diff --git a/src/game/Totem.cpp b/src/game/Totem.cpp index 5c708bf0c..5f21b7cd9 100644 --- a/src/game/Totem.cpp +++ b/src/game/Totem.cpp @@ -128,10 +128,9 @@ void Totem::UnSummon() void Totem::SetOwner(uint64 guid) { - SetUInt64Value(UNIT_FIELD_SUMMONEDBY, guid); - SetUInt64Value(UNIT_FIELD_CREATEDBY, guid); - Unit *owner = GetOwner(); - if (owner) + SetCreatorGUID(guid); + SetOwnerGUID(guid); + if (Unit *owner = GetOwner()) { setFaction(owner->getFaction()); SetLevel(owner->getLevel()); diff --git a/src/game/Traveller.h b/src/game/Traveller.h index 9256b9162..2d112896f 100644 --- a/src/game/Traveller.h +++ b/src/game/Traveller.h @@ -62,7 +62,7 @@ inline float Traveller::Speed() if(i_traveller.HasUnitMovementFlag(MOVEMENTFLAG_WALK_MODE)) return i_traveller.GetSpeed(MOVE_WALK); else if(i_traveller.HasUnitMovementFlag(MOVEMENTFLAG_FLYING2)) - return i_traveller.GetSpeed(MOVE_FLY); + return i_traveller.GetSpeed(MOVE_FLIGHT); else return i_traveller.GetSpeed(MOVE_RUN); } diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index f58e54e7d..0809a6404 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -50,12 +50,12 @@ float baseMoveSpeed[MAX_MOVE_TYPE] = { 2.5f, // MOVE_WALK 7.0f, // MOVE_RUN - 1.25f, // MOVE_WALKBACK + 1.25f, // MOVE_RUN_BACK 4.722222f, // MOVE_SWIM - 4.5f, // MOVE_SWIMBACK - 3.141594f, // MOVE_TURN - 7.0f, // MOVE_FLY - 4.5f, // MOVE_FLYBACK + 4.5f, // MOVE_SWIM_BACK + 3.141594f, // MOVE_TURN_RATE + 7.0f, // MOVE_FLIGHT + 4.5f, // MOVE_FLIGHT_BACK }; // auraTypes contains attacker auras capable of proc'ing cast auras @@ -1462,9 +1462,8 @@ uint32 Unit::SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage void Unit::HandleEmoteCommand(uint32 anim_id) { WorldPacket data( SMSG_EMOTE, 12 ); - data << anim_id << GetGUID(); - WPAssert(data.size() == 12); - + data << uint32(anim_id); + data << uint64(GetGUID()); SendMessageToSet(&data, true); } @@ -2579,8 +2578,8 @@ float Unit::CalculateLevelPenalty(SpellEntry const* spellProto) const void Unit::SendAttackStart(Unit* pVictim) { WorldPacket data( SMSG_ATTACKSTART, 16 ); - data << GetGUID(); - data << pVictim->GetGUID(); + data << uint64(GetGUID()); + data << uint64(pVictim->GetGUID()); SendMessageToSet(&data, true); DEBUG_LOG( "WORLD: Sent SMSG_ATTACKSTART" ); @@ -6901,7 +6900,7 @@ bool Unit::Attack(Unit *victim, bool meleeAttack) if(GetTypeId()==TYPEID_UNIT) { WorldPacket data(SMSG_AI_REACTION, 12); - data << GetGUID(); + data << uint64(GetGUID()); data << uint32(AI_REACTION_AGGRO); // Aggro sound ((WorldObject*)this)->SendMessageToSet(&data, true); @@ -7117,17 +7116,17 @@ Unit* Unit::GetCharm() const void Unit::SetPet(Pet* pet) { - SetUInt64Value(UNIT_FIELD_SUMMON,pet ? pet->GetGUID() : 0); + SetUInt64Value(UNIT_FIELD_SUMMON, pet ? pet->GetGUID() : 0); // FIXME: hack, speed must be set only at follow if(pet) for(int i = 0; i < MAX_MOVE_TYPE; ++i) - pet->SetSpeed(UnitMoveType(i),m_speed_rate[i],true); + pet->SetSpeed(UnitMoveType(i), m_speed_rate[i], true); } -void Unit::SetCharm(Unit* charmed) +void Unit::SetCharm(Unit* pet) { - SetUInt64Value(UNIT_FIELD_CHARM,charmed ? charmed->GetGUID() : 0); + SetUInt64Value(UNIT_FIELD_CHARM, pet ? pet->GetGUID() : 0); } void Unit::UnsummonAllTotems() @@ -7164,7 +7163,6 @@ void Unit::SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage, Po data << uint32(SpellID); data << uint32(powertype); data << uint32(Damage); - //data << uint8(critical ? 1 : 0); // removed in 2.4.0 SendMessageToSet(&data, true); } @@ -7621,7 +7619,7 @@ int32 Unit::SpellBaseDamageBonusForVictim(SpellSchoolMask schoolMask, Unit *pVic bool Unit::isSpellCrit(Unit *pVictim, SpellEntry const *spellProto, SpellSchoolMask schoolMask, WeaponAttackType attackType) { - // not criting spell + // not critting spell if((spellProto->AttributesEx2 & SPELL_ATTR_EX2_CANT_CRIT)) return false; @@ -8809,16 +8807,16 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced) } break; } - case MOVE_WALKBACK: + case MOVE_RUN_BACK: return; case MOVE_SWIM: { main_speed_mod = GetMaxPositiveAuraModifier(SPELL_AURA_MOD_INCREASE_SWIM_SPEED); break; } - case MOVE_SWIMBACK: + case MOVE_SWIM_BACK: return; - case MOVE_FLY: + case MOVE_FLIGHT: { if (IsMounted()) // Use on mount auras main_speed_mod = GetMaxPositiveAuraModifier(SPELL_AURA_MOD_INCREASE_FLIGHT_SPEED); @@ -8828,7 +8826,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced) non_stack_bonus = (100.0 + GetMaxPositiveAuraModifier(SPELL_AURA_MOD_FLIGHT_SPEED_NOT_STACK))/100.0f; break; } - case MOVE_FLYBACK: + case MOVE_FLIGHT_BACK: return; default: sLog.outError("Unit::UpdateSpeed: Unsupported move type (%d)", mtype); @@ -8843,7 +8841,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced) { case MOVE_RUN: case MOVE_SWIM: - case MOVE_FLY: + case MOVE_FLIGHT: { // Normalize speed by 191 aura SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED if need // TODO: possible affect only on MOVE_RUN @@ -8900,22 +8898,22 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) case MOVE_RUN: data.Initialize(MSG_MOVE_SET_RUN_SPEED, 8+4+1+4+4+4+4+4+4+4); break; - case MOVE_WALKBACK: + case MOVE_RUN_BACK: data.Initialize(MSG_MOVE_SET_RUN_BACK_SPEED, 8+4+1+4+4+4+4+4+4+4); break; case MOVE_SWIM: data.Initialize(MSG_MOVE_SET_SWIM_SPEED, 8+4+1+4+4+4+4+4+4+4); break; - case MOVE_SWIMBACK: + case MOVE_SWIM_BACK: data.Initialize(MSG_MOVE_SET_SWIM_BACK_SPEED, 8+4+1+4+4+4+4+4+4+4); break; - case MOVE_TURN: + case MOVE_TURN_RATE: data.Initialize(MSG_MOVE_SET_TURN_RATE, 8+4+1+4+4+4+4+4+4+4); break; - case MOVE_FLY: + case MOVE_FLIGHT: data.Initialize(MSG_MOVE_SET_FLIGHT_SPEED, 8+4+1+4+4+4+4+4+4+4); break; - case MOVE_FLYBACK: + case MOVE_FLIGHT_BACK: data.Initialize(MSG_MOVE_SET_FLIGHT_BACK_SPEED, 8+4+1+4+4+4+4+4+4+4); break; default: @@ -8948,22 +8946,22 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) case MOVE_RUN: data.Initialize(SMSG_FORCE_RUN_SPEED_CHANGE, 17); break; - case MOVE_WALKBACK: + case MOVE_RUN_BACK: data.Initialize(SMSG_FORCE_RUN_BACK_SPEED_CHANGE, 16); break; case MOVE_SWIM: data.Initialize(SMSG_FORCE_SWIM_SPEED_CHANGE, 16); break; - case MOVE_SWIMBACK: + case MOVE_SWIM_BACK: data.Initialize(SMSG_FORCE_SWIM_BACK_SPEED_CHANGE, 16); break; - case MOVE_TURN: + case MOVE_TURN_RATE: data.Initialize(SMSG_FORCE_TURN_RATE_CHANGE, 16); break; - case MOVE_FLY: + case MOVE_FLIGHT: data.Initialize(SMSG_FORCE_FLIGHT_SPEED_CHANGE, 16); break; - case MOVE_FLYBACK: + case MOVE_FLIGHT_BACK: data.Initialize(SMSG_FORCE_FLIGHT_BACK_SPEED_CHANGE, 16); break; default: @@ -8971,7 +8969,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced) return; } data.append(GetPackGUID()); - data << (uint32)0; + data << (uint32)0; // moveEvent, NUM_PMOVE_EVTS = 0x39 if (mtype == MOVE_RUN) data << uint8(0); // new 2.1.0 data << float(GetSpeed(mtype)); @@ -10753,9 +10751,9 @@ Pet* Unit::CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id) return NULL; } - pet->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, GetGUID()); - pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, GetGUID()); - pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,getFaction()); + pet->SetOwnerGUID(GetGUID()); + pet->SetCreatorGUID(GetGUID()); + pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, getFaction()); pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, spell_id); if(!pet->InitStatsForLevel(creatureTarget->getLevel())) diff --git a/src/game/Unit.h b/src/game/Unit.h index e4df75950..45a31f668 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -366,14 +366,14 @@ enum UnitState enum UnitMoveType { - MOVE_WALK = 0, - MOVE_RUN = 1, - MOVE_WALKBACK = 2, - MOVE_SWIM = 3, - MOVE_SWIMBACK = 4, - MOVE_TURN = 5, - MOVE_FLY = 6, - MOVE_FLYBACK = 7 + MOVE_WALK = 0, + MOVE_RUN = 1, + MOVE_RUN_BACK = 2, + MOVE_SWIM = 3, + MOVE_SWIM_BACK = 4, + MOVE_TURN_RATE = 5, + MOVE_FLIGHT = 6, + MOVE_FLIGHT_BACK = 7, }; #define MAX_MOVE_TYPE 8 @@ -948,11 +948,14 @@ class MANGOS_DLL_SPEC Unit : public WorldObject DeathState getDeathState() { return m_deathState; }; virtual void setDeathState(DeathState s); // overwrited in Creature/Player/Pet - uint64 const& GetOwnerGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMONEDBY); } + uint64 GetOwnerGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMONEDBY); } + void SetOwnerGUID(uint64 owner) { SetUInt64Value(UNIT_FIELD_SUMMONEDBY, owner); } + uint64 GetCreatorGUID() const { return GetUInt64Value(UNIT_FIELD_CREATEDBY); } + void SetCreatorGUID(uint64 creator) { SetUInt64Value(UNIT_FIELD_CREATEDBY, creator); } uint64 GetPetGUID() const { return GetUInt64Value(UNIT_FIELD_SUMMON); } uint64 GetCharmerGUID() const { return GetUInt64Value(UNIT_FIELD_CHARMEDBY); } - uint64 GetCharmGUID() const { return GetUInt64Value(UNIT_FIELD_CHARM); } void SetCharmerGUID(uint64 owner) { SetUInt64Value(UNIT_FIELD_CHARMEDBY, owner); } + uint64 GetCharmGUID() const { return GetUInt64Value(UNIT_FIELD_CHARM); } uint64 GetCharmerOrOwnerGUID() const { return GetCharmerGUID() ? GetCharmerGUID() : GetOwnerGUID(); } uint64 GetCharmerOrOwnerOrOwnGUID() const @@ -981,6 +984,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject void SetPet(Pet* pet); void SetCharm(Unit* pet); + bool isCharmed() const { return GetCharmerGUID() != 0; } CharmInfo* GetCharmInfo() { return m_charmInfo; } @@ -1116,7 +1120,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject AuraList const& GetSingleCastAuras() const { return m_scAuras; } SpellImmuneList m_spellImmune[MAX_SPELL_IMMUNITY]; - // Threat related methodes + // Threat related methods bool CanHaveThreatList() const; void AddThreat(Unit* pVictim, float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellEntry const *threatSpell = NULL); float ApplyTotalThreatModifier(float threat, SpellSchoolMask schoolMask = SPELL_SCHOOL_MASK_NORMAL); diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index 77a9a2eb3..64061487c 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -42,8 +42,7 @@ alter table creature_movement add `wpguid` int(11) default '0'; #include //-----------------------------------------------// -void -WaypointMovementGenerator::LoadPath(Creature &c) +void WaypointMovementGenerator::LoadPath(Creature &c) { sLog.outDetail("LoadPath: loading waypoint path for creature %d,%d", c.GetGUIDLow(), c.GetDBTableGUIDLow()); @@ -60,26 +59,23 @@ WaypointMovementGenerator::LoadPath(Creature &c) for(uint32 i = 0; i < node_count-1; i++) i_hasDone[i] = false; - // to prevent a misbehaviour inside "update" + // to prevent a misbehavior inside "update" // update is always called with the next wp - but the wpSys needs the current // so when the routine is called the first time, wpSys gets the last waypoint // and this prevents the system from performing text/emote, etc i_hasDone[node_count - 1] = true; } -void -WaypointMovementGenerator::ClearWaypoints() +void WaypointMovementGenerator::ClearWaypoints() { i_path = NULL; } -void -WaypointMovementGenerator::Initialize() +void WaypointMovementGenerator::Initialize() { } -bool -WaypointMovementGenerator::Update(Creature &creature, const uint32 &diff) +bool WaypointMovementGenerator::Update(Creature &creature, const uint32 &diff) { if(!&creature) return true; @@ -104,7 +100,7 @@ WaypointMovementGenerator::Update(Creature &creature, const uint32 &di i_nextMoveTime.Update(diff); i_destinationHolder.UpdateTraveller(traveller, diff, false, true); - // creature has been stoped in middle of the waypoint segment + // creature has been stopped in middle of the waypoint segment if (!i_destinationHolder.HasArrived() && creature.IsStopped()) { if( i_nextMoveTime.Passed()) // Timer has elapsed, meaning this part controlled it @@ -214,14 +210,12 @@ void WaypointMovementGenerator::MovementInform(Creature &unit) } //----------------------------------------------------// -void -FlightPathMovementGenerator::LoadPath(Player &) +void FlightPathMovementGenerator::LoadPath(Player &) { objmgr.GetTaxiPathNodes(i_pathId, i_path,i_mapIds); } -uint32 -FlightPathMovementGenerator::GetPathAtMapEnd() const +uint32 FlightPathMovementGenerator::GetPathAtMapEnd() const { if(i_currentNode >= i_mapIds.size()) return i_mapIds.size(); @@ -236,8 +230,7 @@ FlightPathMovementGenerator::GetPathAtMapEnd() const return i_mapIds.size(); } -void -FlightPathMovementGenerator::Initialize(Player &player) +void FlightPathMovementGenerator::Initialize(Player &player) { player.getHostilRefManager().setOnlineOfflineState(false); player.addUnitState(UNIT_STAT_IN_FLIGHT); @@ -252,7 +245,6 @@ FlightPathMovementGenerator::Initialize(Player &player) void FlightPathMovementGenerator::Finalize(Player & player) { - float x, y, z; i_destinationHolder.GetLocationNow(player.GetMapId(), x, y, z); player.SetPosition(x, y, z, player.GetOrientation()); @@ -272,8 +264,7 @@ void FlightPathMovementGenerator::Finalize(Player & player) } } -bool -FlightPathMovementGenerator::Update(Player &player, const uint32 &diff) +bool FlightPathMovementGenerator::Update(Player &player, const uint32 &diff) { if( MovementInProgress() ) { @@ -308,8 +299,7 @@ FlightPathMovementGenerator::Update(Player &player, const uint32 &diff) return false; } -void -FlightPathMovementGenerator::SetCurrentNodeAfterTeleport() +void FlightPathMovementGenerator::SetCurrentNodeAfterTeleport() { if(i_mapIds.empty()) return; diff --git a/src/game/WorldSession.cpp b/src/game/WorldSession.cpp index 65b93645a..8371b2596 100644 --- a/src/game/WorldSession.cpp +++ b/src/game/WorldSession.cpp @@ -480,38 +480,38 @@ void WorldSession::Handle_NULL( WorldPacket& recvPacket ) void WorldSession::Handle_EarlyProccess( WorldPacket& recvPacket ) { - sLog.outError( "SESSION: received opcode %s (0x%.4X) that must be proccessed in WorldSocket::OnRead", + sLog.outError( "SESSION: received opcode %s (0x%.4X) that must be processed in WorldSocket::OnRead", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode()); } void WorldSession::Handle_ServerSide( WorldPacket& recvPacket ) { - sLog.outError( "SESSION: received sever-side opcode %s (0x%.4X)", + sLog.outError( "SESSION: received server-side opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode()); } -void WorldSession::Handle_Depricated( WorldPacket& recvPacket ) +void WorldSession::Handle_Deprecated( WorldPacket& recvPacket ) { - sLog.outError( "SESSION: received depricated opcode %s (0x%.4X)", + sLog.outError( "SESSION: received deprecated opcode %s (0x%.4X)", LookupOpcodeName(recvPacket.GetOpcode()), recvPacket.GetOpcode()); } void WorldSession::SendAuthWaitQue(uint32 position) - { - if(position == 0) - { - WorldPacket packet( SMSG_AUTH_RESPONSE, 1 ); - packet << uint8( AUTH_OK ); - SendPacket(&packet); - } - else - { - WorldPacket packet( SMSG_AUTH_RESPONSE, 5 ); - packet << uint8( AUTH_WAIT_QUEUE ); - packet << uint32 (position); - SendPacket(&packet); - } - } +{ + if(position == 0) + { + WorldPacket packet( SMSG_AUTH_RESPONSE, 1 ); + packet << uint8( AUTH_OK ); + SendPacket(&packet); + } + else + { + WorldPacket packet( SMSG_AUTH_RESPONSE, 5 ); + packet << uint8( AUTH_WAIT_QUEUE ); + packet << uint32 (position); + SendPacket(&packet); + } +} diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h index 6bc8fc967..6a8d609d9 100644 --- a/src/game/WorldSession.h +++ b/src/game/WorldSession.h @@ -209,7 +209,7 @@ class MANGOS_DLL_SPEC WorldSession void Handle_NULL(WorldPacket& recvPacket); // not used void Handle_EarlyProccess( WorldPacket& recvPacket);// just mark packets processed in WorldSocket::OnRead void Handle_ServerSide(WorldPacket& recvPacket); // sever side only, can't be accepted from client - void Handle_Depricated(WorldPacket& recvPacket); // never used anymore by client + void Handle_Deprecated(WorldPacket& recvPacket); // never used anymore by client void HandleCharEnumOpcode(WorldPacket& recvPacket); void HandleCharDeleteOpcode(WorldPacket& recvPacket); diff --git a/src/game/WorldSocket.cpp b/src/game/WorldSocket.cpp index df46becc9..e7e0bbc55 100644 --- a/src/game/WorldSocket.cpp +++ b/src/game/WorldSocket.cpp @@ -712,7 +712,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) Field* fields = result->Fetch (); - expansion = fields[8].GetUInt8 () && sWorld.getConfig (CONFIG_EXPANSION) > 0; + expansion = ((sWorld.getConfig(CONFIG_EXPANSION) > fields[8].GetUInt8()) ? fields[8].GetUInt8() : sWorld.getConfig(CONFIG_EXPANSION)); N.SetHexStr ("894B645E89E1535BBDAD5B8B290650530801B18EBFBF5E8FAB3C82872A3E9BB7"); g.SetDword (7); @@ -734,8 +734,8 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) x.SetBinary (sha1.GetDigest (), sha1.GetLength ()); v = g.ModExp (x, N); - const char* sStr = s.AsHexStr (); //Must be freed by OPENSSL_free() - const char* vStr = v.AsHexStr (); //Must be freed by OPENSSL_free() + const char* sStr = s.AsHexStr (); //Must be freed by OPENSSL_free() + const char* vStr = v.AsHexStr (); //Must be freed by OPENSSL_free() const char* vold = fields[6].GetString (); DEBUG_LOG ("WorldSocket::HandleAuthSession: (s,v) check s: %s v_old: %s v_new: %s", @@ -825,7 +825,7 @@ int WorldSocket::HandleAuthSession (WorldPacket& recvPacket) SendPacket (packet); - sLog.outBasic ("WorldSocket::HandleAuthSession: User tryes to login but his security level is not enough"); + sLog.outBasic ("WorldSocket::HandleAuthSession: User tries to login but his security level is not enough"); return -1; } @@ -940,7 +940,7 @@ int WorldSocket::HandlePing (WorldPacket& recvPacket) ACE_GUARD_RETURN (LockType, Guard, m_SessionLock, -1); if (m_Session) - m_Session->SetLatency (latency); + m_Session->SetLatency (latency); else { sLog.outError ("WorldSocket::HandlePing: peer sent CMSG_PING, " diff --git a/src/game/debugcmds.cpp b/src/game/debugcmds.cpp index 4fd1efd80..298411fbd 100644 --- a/src/game/debugcmds.cpp +++ b/src/game/debugcmds.cpp @@ -31,6 +31,7 @@ #include "Language.h" #include "MapManager.h" #include +#include "ObjectMgr.h" bool ChatHandler::HandleDebugInArcCommand(const char* /*args*/) { @@ -59,8 +60,8 @@ bool ChatHandler::HandleDebugSpellFailCommand(const char* args) uint8 failnum = (uint8)atoi(px); WorldPacket data(SMSG_CAST_FAILED, 5); - data << (uint32)133; - data << failnum; + data << uint32(133); + data << uint8(failnum); m_session->SendPacket(&data); return true; @@ -145,11 +146,14 @@ bool ChatHandler::HandleSendOpcodeCommand(const char* /*args*/) std::string type; ifs >> type; + if(type == "") + break; + if(type == "uint8") { - uint8 val1; + uint16 val1; ifs >> val1; - data << val1; + data << uint8(val1); } else if(type == "uint16") { @@ -187,7 +191,8 @@ bool ChatHandler::HandleSendOpcodeCommand(const char* /*args*/) } else { - sLog.outDebug("Sending opcode: unknown type %s", type.c_str()); + sLog.outDebug("Sending opcode: unknown type '%s'", type.c_str()); + break; } } ifs.close(); diff --git a/src/mangosd/RASocket.h b/src/mangosd/RASocket.h index fe539af65..d9acb8284 100644 --- a/src/mangosd/RASocket.h +++ b/src/mangosd/RASocket.h @@ -50,7 +50,7 @@ class RASocket: public TcpSocket bool bLog; bool bSecure; //kick on wrong pass, non exist. user, user with no priv //will protect from DOS, bruteforce attacks - //some 'smart' protection must be added for more scurity + //some 'smart' protection must be added for more security uint8 iMinLevel; enum { diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 934202b1d..23ee369fe 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "6888" + #define REVISION_NR "6889" #endif // __REVISION_NR_H__