From 4658b2b38e9c92ce6277cf535887278b2b5d64b8 Mon Sep 17 00:00:00 2001 From: ApoC Date: Sun, 26 Oct 2008 12:26:22 +0100 Subject: [PATCH 1/9] Fixed ticket reading when using PGSQL Optimized ticket deleting by its position Signed-off-by: ApoC --- src/game/Level2.cpp | 9 +++------ src/shared/Database/DatabaseEnv.h | 10 ++++++---- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/game/Level2.cpp b/src/game/Level2.cpp index 8fa4b219c..81ac177d8 100644 --- a/src/game/Level2.cpp +++ b/src/game/Level2.cpp @@ -1950,7 +1950,7 @@ bool ChatHandler::HandleTicketCommand(const char* args) int num = atoi(px); if(num > 0) { - QueryResult *result = CharacterDatabase.PQuery("SELECT guid,ticket_text,ticket_lastchange FROM character_ticket ORDER BY ticket_id ASC LIMIT %d,1",num-1); + QueryResult *result = CharacterDatabase.PQuery("SELECT guid,ticket_text,ticket_lastchange FROM character_ticket ORDER BY ticket_id ASC "_OFFSET_, num-1); if(!result) { @@ -2062,9 +2062,9 @@ bool ChatHandler::HandleDelTicketCommand(const char *args) // delticket #num if(num > 0) { - QueryResult *result = CharacterDatabase.PQuery("SELECT ticket_id,guid FROM character_ticket LIMIT %i",num); + QueryResult *result = CharacterDatabase.PQuery("SELECT ticket_id,guid FROM character_ticket ORDER BY ticket_id ASC "_OFFSET_,num-1); - if(!result || uint64(num) > result->GetRowCount()) + if(!result) { PSendSysMessage(LANG_COMMAND_TICKENOTEXIST, num); delete result; @@ -2072,9 +2072,6 @@ bool ChatHandler::HandleDelTicketCommand(const char *args) return false; } - for(int i = 1; i < num; ++i) - result->NextRow(); - Field* fields = result->Fetch(); uint32 id = fields[0].GetUInt32(); diff --git a/src/shared/Database/DatabaseEnv.h b/src/shared/Database/DatabaseEnv.h index 286e3a830..88cb05710 100644 --- a/src/shared/Database/DatabaseEnv.h +++ b/src/shared/Database/DatabaseEnv.h @@ -32,9 +32,10 @@ #include "Database/Database.h" #include "Database/DatabasePostgre.h" typedef DatabasePostgre DatabaseType; -#define _LIKE_ "ILIKE" -#define _TABLE_SIM_ "\"" +#define _LIKE_ "ILIKE" +#define _TABLE_SIM_ "\"" #define _CONCAT3_(A,B,C) "( " A " || " B " || " C " )" +#define _OFFSET_ "LIMIT 1 OFFSET %d" #else #include "Database/QueryResultMysql.h" #include "Database/QueryResultSqlite.h" @@ -42,9 +43,10 @@ typedef DatabasePostgre DatabaseType; #include "Database/DatabaseMysql.h" #include "Database/DatabaseSqlite.h" typedef DatabaseMysql DatabaseType; -#define _LIKE_ "LIKE" -#define _TABLE_SIM_ "`" +#define _LIKE_ "LIKE" +#define _TABLE_SIM_ "`" #define _CONCAT3_(A,B,C) "CONCAT( " A " , " B " , " C " )" +#define _OFFSET_ "LIMIT %d,1" #endif extern DatabaseType WorldDatabase; From 24549669a90bd071f0bebefa69777fa0671a9bc7 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 26 Oct 2008 16:10:16 +0300 Subject: [PATCH 2/9] Add lost .c_str() call at send std::string content to ".pdump write" command output. --- src/game/Level3.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 4e8431618..fbf235738 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -5448,7 +5448,7 @@ bool ChatHandler::HandleLoadPDumpCommand(const char *args) SetSentErrorMessage(true); return false; case DUMP_TOO_MANY_CHARS: - PSendSysMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL,account_name,account_id); + PSendSysMessage(LANG_ACCOUNT_CHARACTER_LIST_FULL,account_name.c_str(),account_id); SetSentErrorMessage(true); return false; default: From 6f190fedd4026716c16402f0493085df675bd8a6 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 26 Oct 2008 16:17:33 +0300 Subject: [PATCH 3/9] Output DB/ScriptLib versions in ".server info" command. Required support by used scripting library. --- sql/mangos.sql | 2 ++ sql/updates/2008_10_26_01_mangos_mangos_string.sql | 5 +++++ sql/updates/Makefile.am | 2 ++ src/bindings/universal/ScriptMgr.cpp | 6 ++++++ src/bindings/universal/ScriptMgr.h | 4 ++-- src/game/Chat.cpp | 2 +- src/game/Chat.h | 2 +- src/game/Language.h | 4 +++- src/game/Level0.cpp | 6 ++++-- src/game/ObjectMgr.h | 1 + src/game/ScriptCalls.cpp | 4 ++++ src/game/ScriptCalls.h | 2 ++ src/game/World.cpp | 14 ++++++++++++++ src/game/World.h | 13 +++++++++++++ src/mangosd/Master.cpp | 12 ++---------- 15 files changed, 62 insertions(+), 17 deletions(-) create mode 100644 sql/updates/2008_10_26_01_mangos_mangos_string.sql diff --git a/sql/mangos.sql b/sql/mangos.sql index e8a59be7c..c320c9169 100644 --- a/sql/mangos.sql +++ b/sql/mangos.sql @@ -2158,6 +2158,8 @@ INSERT INTO `mangos_string` VALUES (54,'The new passwords do not match',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (55,'Your password can\'t be longer than 16 characters (client limit), password not changed!',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (56,'Current Message of the day: \r\n%s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(57,'Using World DB: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(58,'Using script library: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (100,'Global notify: ',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (101,'Map: %u (%s) Zone: %u (%s) Area: %u (%s)\nX: %f Y: %f Z: %f Orientation: %f\ngrid[%u,%u]cell[%u,%u] InstanceID: %u\n ZoneX: %f ZoneY: %f\nGroundZ: %f FloorZ: %f Have height data (Map: %u VMap: %u)',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), (102,'%s is already being teleported.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), diff --git a/sql/updates/2008_10_26_01_mangos_mangos_string.sql b/sql/updates/2008_10_26_01_mangos_mangos_string.sql new file mode 100644 index 000000000..2cdf5e294 --- /dev/null +++ b/sql/updates/2008_10_26_01_mangos_mangos_string.sql @@ -0,0 +1,5 @@ +DELETE FROM mangos_string WHERE entry IN (57,58); + +INSERT INTO mangos_string VALUES +(57,'Using World DB: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL), +(58,'Using script library: %s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL); diff --git a/sql/updates/Makefile.am b/sql/updates/Makefile.am index 5c10eed8a..da45d285a 100644 --- a/sql/updates/Makefile.am +++ b/sql/updates/Makefile.am @@ -106,6 +106,7 @@ pkgdata_DATA = \ 2008_10_23_03_mangos_mangos_string.sql \ 2008_10_23_04_mangos_command.sql \ 2008_10_23_05_mangos_command.sql \ + 2008_10_26_01_mangos_mangos_string.sql \ README ## Additional files to include when running 'make dist' @@ -193,4 +194,5 @@ EXTRA_DIST = \ 2008_10_23_03_mangos_mangos_string.sql \ 2008_10_23_04_mangos_command.sql \ 2008_10_23_05_mangos_command.sql \ + 2008_10_26_01_mangos_mangos_string.sql \ README diff --git a/src/bindings/universal/ScriptMgr.cpp b/src/bindings/universal/ScriptMgr.cpp index edbdaa3f5..3e2a557db 100644 --- a/src/bindings/universal/ScriptMgr.cpp +++ b/src/bindings/universal/ScriptMgr.cpp @@ -64,6 +64,12 @@ void ScriptsInit() } +MANGOS_DLL_EXPORT +char const* ScriptsVersion() +{ + return "Default MaNGOS scripting library"; +} + Script* GetScriptByName(std::string Name) { if(Name.empty()) diff --git a/src/bindings/universal/ScriptMgr.h b/src/bindings/universal/ScriptMgr.h index 414da1614..f374f1db9 100644 --- a/src/bindings/universal/ScriptMgr.h +++ b/src/bindings/universal/ScriptMgr.h @@ -38,11 +38,11 @@ class Map; struct Script { Script() : - pGossipHello(NULL), pQuestAccept(NULL), pGossipSelect(NULL), pGossipSelectWithCode(NULL), + pGossipHello(NULL), pQuestAccept(NULL), pGossipSelect(NULL), pGossipSelectWithCode(NULL), pQuestSelect(NULL), pQuestComplete(NULL), pNPCDialogStatus(NULL), pGODialogStatus(NULL), pChooseReward(NULL), pItemHello(NULL), pGOHello(NULL), pAreaTrigger(NULL), pItemQuestAccept(NULL), pGOQuestAccept(NULL), pGOChooseReward(NULL), pReceiveEmote(NULL), pItemUse(NULL), GetAI(NULL) - {} + {} std::string Name; diff --git a/src/game/Chat.cpp b/src/game/Chat.cpp index 355f24650..86e96d5bf 100644 --- a/src/game/Chat.cpp +++ b/src/game/Chat.cpp @@ -67,7 +67,7 @@ ChatCommand * ChatHandler::getCommandTable() { "exit", SEC_CONSOLE, true, &ChatHandler::HandleServerExitCommand, "", NULL }, { "idlerestart", SEC_ADMINISTRATOR, true, &ChatHandler::HandleIdleRestartCommand, "", NULL }, { "idleshutdown", SEC_ADMINISTRATOR, true, &ChatHandler::HandleIdleShutDownCommand, "", NULL }, - { "info", SEC_PLAYER, true, &ChatHandler::HandleInfoCommand, "", NULL }, + { "info", SEC_PLAYER, true, &ChatHandler::HandleServerInfoCommand, "", NULL }, { "motd", SEC_PLAYER, true, &ChatHandler::HandleServerMotdCommand, "", NULL }, { "restart", SEC_ADMINISTRATOR, true, &ChatHandler::HandleRestartCommand, "", NULL }, { "shutdown", SEC_ADMINISTRATOR, true, &ChatHandler::HandleShutDownCommand, "", NULL }, diff --git a/src/game/Chat.h b/src/game/Chat.h index 6ab125f1a..c91f0b673 100644 --- a/src/game/Chat.h +++ b/src/game/Chat.h @@ -95,7 +95,6 @@ class ChatHandler bool HandleHelpCommand(const char* args); bool HandleCommandsCommand(const char* args); bool HandleStartCommand(const char* args); - bool HandleInfoCommand(const char* args); bool HandleDismountCommand(const char* args); bool HandleSaveCommand(const char* args); bool HandleGMListIngameCommand(const char* args); @@ -220,6 +219,7 @@ class ChatHandler bool HandleServerCorpsesCommand(const char* args); bool HandleServerExitCommand(const char* args); + bool HandleServerInfoCommand(const char* args); bool HandleServerMotdCommand(const char* args); bool HandleServerSetMotdCommand(const char* args); bool HandleServerSetLogLevelCommand(const char* args); diff --git a/src/game/Language.h b/src/game/Language.h index 093c6b57e..e512d297b 100644 --- a/src/game/Language.h +++ b/src/game/Language.h @@ -80,7 +80,9 @@ enum MangosStrings LANG_NEW_PASSWORDS_NOT_MATCH = 54, LANG_PASSWORD_TOO_LONG = 55, LANG_MOTD_CURRENT = 56, - // Room for more level 0 57-99 not used + LANG_USING_WORLD_DB = 57, + LANG_USING_SCRIPT_LIB = 58, + // Room for more level 0 59-99 not used // level 1 chat LANG_GLOBAL_NOTIFY = 100, diff --git a/src/game/Level0.cpp b/src/game/Level0.cpp index a4c82c3de..49cfb3ed5 100644 --- a/src/game/Level0.cpp +++ b/src/game/Level0.cpp @@ -85,7 +85,7 @@ bool ChatHandler::HandleStartCommand(const char* /*args*/) return true; } -bool ChatHandler::HandleInfoCommand(const char* /*args*/) +bool ChatHandler::HandleServerInfoCommand(const char* /*args*/) { uint32 activeClientsNum = sWorld.GetActiveSessionCount(); uint32 queuedClientsNum = sWorld.GetQueuedSessionCount(); @@ -99,7 +99,9 @@ bool ChatHandler::HandleInfoCommand(const char* /*args*/) else full = _FULLVERSION(REVISION_DATE,REVISION_TIME,REVISION_ID); - PSendSysMessage(full); + SendSysMessage(full); + PSendSysMessage(LANG_USING_SCRIPT_LIB,sWorld.GetScriptsVersion()); + PSendSysMessage(LANG_USING_WORLD_DB,sWorld.GetDBVersion()); PSendSysMessage(LANG_CONNECTED_USERS, activeClientsNum, maxActiveClientsNum, queuedClientsNum, maxQueuedClientsNum); PSendSysMessage(LANG_UPTIME, str.c_str()); diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index b6997a99f..d5391c464 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -739,6 +739,7 @@ class ObjectMgr void AddVendorItem(uint32 entry,uint32 item, uint32 maxcount, uint32 incrtime, uint32 ExtendedCost); bool RemoveVendorItem(uint32 entry,uint32 item); bool IsVendorItemValid( uint32 vendor_entry, uint32 item, uint32 maxcount, uint32 ptime, uint32 ExtendedCost, Player* pl = NULL, std::set* skip_vendors = NULL ) const; + protected: uint32 m_auctionid; uint32 m_mailid; diff --git a/src/game/ScriptCalls.cpp b/src/game/ScriptCalls.cpp index 2a744e437..00435fa8f 100644 --- a/src/game/ScriptCalls.cpp +++ b/src/game/ScriptCalls.cpp @@ -22,6 +22,7 @@ #include "Platform/Define.h" #include "ScriptCalls.h" +#include "World.h" ScriptsSet Script=NULL; @@ -55,6 +56,7 @@ bool LoadScriptingModule(char const* libName) if( !(testScript->ScriptsInit =(scriptCallScriptsInit )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsInit" )) ||!(testScript->ScriptsFree =(scriptCallScriptsFree )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsFree" )) + ||!(testScript->ScriptsVersion =(scriptCallScriptsVersion )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"ScriptsVersion" )) ||!(testScript->GossipHello =(scriptCallGossipHello )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GossipHello" )) ||!(testScript->GOChooseReward =(scriptCallGOChooseReward )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"GOChooseReward" )) ||!(testScript->QuestAccept =(scriptCallQuestAccept )MANGOS_GET_PROC_ADDR(testScript->hScriptsLib,"QuestAccept" )) @@ -91,5 +93,7 @@ bool LoadScriptingModule(char const* libName) Script=testScript; Script->ScriptsInit(); + sWorld.SetScriptsVersion(Script->ScriptsVersion()); + return true; } diff --git a/src/game/ScriptCalls.h b/src/game/ScriptCalls.h index 0b8b58344..bab186187 100644 --- a/src/game/ScriptCalls.h +++ b/src/game/ScriptCalls.h @@ -37,6 +37,7 @@ void UnloadScriptingModule(); typedef void(MANGOS_IMPORT * scriptCallScriptsInit) (); typedef void(MANGOS_IMPORT * scriptCallScriptsFree) (); +typedef char const* (MANGOS_IMPORT * scriptCallScriptsVersion) (); typedef bool(MANGOS_IMPORT * scriptCallGossipHello) (Player *player, Creature *_Creature ); typedef bool(MANGOS_IMPORT * scriptCallQuestAccept) (Player *player, Creature *_Creature, Quest const *); @@ -62,6 +63,7 @@ typedef struct { scriptCallScriptsInit ScriptsInit; scriptCallScriptsFree ScriptsFree; + scriptCallScriptsVersion ScriptsVersion; scriptCallGossipHello GossipHello; scriptCallGOChooseReward GOChooseReward; diff --git a/src/game/World.cpp b/src/game/World.cpp index 5c0d0b61e..1496e7be3 100644 --- a/src/game/World.cpp +++ b/src/game/World.cpp @@ -2551,3 +2551,17 @@ void World::UpdateMaxSessionCounters() m_maxActiveSessionCount = std::max(m_maxActiveSessionCount,uint32(m_sessions.size()-m_QueuedPlayer.size())); m_maxQueuedSessionCount = std::max(m_maxQueuedSessionCount,uint32(m_QueuedPlayer.size())); } + +void World::LoadDBVersion() +{ + QueryResult* result = WorldDatabase.Query("SELECT version FROM db_version LIMIT 1"); + if(result) + { + Field* fields = result->Fetch(); + + m_DBVersion = fields[0].GetString(); + delete result; + } + else + m_DBVersion = "unknown world database"; +} diff --git a/src/game/World.h b/src/game/World.h index 2dad31440..108b1bb86 100644 --- a/src/game/World.h +++ b/src/game/World.h @@ -449,6 +449,15 @@ class World void UpdateRealmCharCount(uint32 accid); LocaleConstant GetAvailableDbcLocale(LocaleConstant locale) const { if(m_availableDbcLocaleMask & (1 << locale)) return locale; else return m_defaultDbcLocale; } + + //used World DB version + void LoadDBVersion(); + char const* GetDBVersion() { return m_DBVersion.c_str(); } + + //used Script version + void SetScriptsVersion(char const* version) { m_ScriptsVersion = version ? version : "unknown scripting library"; } + char const* GetScriptsVersion() { return m_ScriptsVersion.c_str(); } + protected: void _UpdateGameTime(); void ScriptsProcess(); @@ -508,6 +517,10 @@ class World //sessions that are added async void AddSession_(WorldSession* s); ZThread::LockedQueue addSessQueue; + + //used versions + std::string m_DBVersion; + std::string m_ScriptsVersion; }; extern uint32 realmID; diff --git a/src/mangosd/Master.cpp b/src/mangosd/Master.cpp index c902e44af..6435d8dfc 100644 --- a/src/mangosd/Master.cpp +++ b/src/mangosd/Master.cpp @@ -458,17 +458,9 @@ bool Master::_StartDB() ///- Clean the database before starting clearOnlineAccounts(); - QueryResult* result = WorldDatabase.Query("SELECT version FROM db_version LIMIT 1"); - if(result) - { - Field* fields = result->Fetch(); - - sLog.outString("Using %s", fields[0].GetString()); - delete result; - } - else - sLog.outString("Using unknown world database."); + sWorld.LoadDBVersion(); + sLog.outString("Using %s", sWorld.GetDBVersion()); return true; } From 8a16fc4117f83ab58f537169f7f5aeafe230dcc9 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 26 Oct 2008 18:03:43 +0300 Subject: [PATCH 4/9] Better revison data extraction for revison in case remote repo with branches --- src/tools/genrevision/genrevision.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/tools/genrevision/genrevision.cpp b/src/tools/genrevision/genrevision.cpp index 6ce5850c0..23cf1a360 100644 --- a/src/tools/genrevision/genrevision.cpp +++ b/src/tools/genrevision/genrevision.cpp @@ -56,12 +56,28 @@ void extractDataFromSvn(FILE* EntriesFile, bool url, RawData& data) void extractDataFromGit(FILE* EntriesFile, std::string path, bool url, RawData& data) { char buf[200]; - fgets(buf,200,EntriesFile); char hash_str[200]; char branch_str[200]; char url_str[200]; - sscanf(buf,"%s branch %s of %s",hash_str,branch_str,url_str); + + bool found = false; + while(fgets(buf,200,EntriesFile)) + { + if(sscanf(buf,"%s branch %s of %s",hash_str,branch_str,url_str)==3) + { + found = true; + break; + } + } + + if(!found) + { + strcpy(data.rev_str,"Unknown"); + strcpy(data.date_str,"Unknown"); + strcpy(data.time_str,"Unknown"); + return; + } if(url) { From f8a94b84c3164a464bb0f65a6c0f5eba43ad010c Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Sun, 26 Oct 2008 18:18:20 +0300 Subject: [PATCH 5/9] Use 0.12.0-DEV instead 0.12.0-SVN for mark MaNGOS version in development. --- src/shared/SystemConfig.h.in | 2 +- win/VC71/mangosd.vcproj | 4 ++-- win/VC71/realmd.vcproj | 4 ++-- win/VC71/shared.vcproj | 4 ++-- win/VC80/mangosd.vcproj | 8 ++++---- win/VC80/realmd.vcproj | 8 ++++---- win/VC80/shared.vcproj | 8 ++++---- win/VC90/mangosd.vcproj | 8 ++++---- win/VC90/shared.vcproj | 8 ++++---- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/src/shared/SystemConfig.h.in b/src/shared/SystemConfig.h.in index 7a19c1dc4..863fab1e5 100644 --- a/src/shared/SystemConfig.h.in +++ b/src/shared/SystemConfig.h.in @@ -27,7 +27,7 @@ #ifndef _VERSION #if PLATFORM == PLATFORM_WINDOWS -# define _VERSION(REVD,REVT,REV) "0.12.0-SVN" " (" REVD " " REVT " Revision " REV ")" +# define _VERSION(REVD,REVT,REV) "0.12.0-DEV" " (" REVD " " REVT " Revision " REV ")" #else # define _VERSION(REVD,REVT,REV) "@VERSION@" " (" REVD " " REVT " Revision " REV ")" #endif diff --git a/win/VC71/mangosd.vcproj b/win/VC71/mangosd.vcproj index 7d86059ec..a8c650864 100644 --- a/win/VC71/mangosd.vcproj +++ b/win/VC71/mangosd.vcproj @@ -23,7 +23,7 @@ Name="VCCLCompilerTool" InlineFunctionExpansion="1" AdditionalIncludeDirectories="..\..\dep\include,..\..\src\framework,..\..\src\shared,..\..\src\game,..\..\src\mangosd;..\..\dep\ACE_wrappers" - PreprocessorDefinitions="VERSION="0.12.0-SVN";WIN32;NDEBUG;_CONSOLE;ENABLE_CLI" + PreprocessorDefinitions="VERSION="0.12.0-DEV";WIN32;NDEBUG;_CONSOLE;ENABLE_CLI" StringPooling="TRUE" RuntimeLibrary="0" EnableFunctionLevelLinking="TRUE" @@ -92,7 +92,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\dep\include,..\..\src\framework,..\..\src\shared,..\..\src\game,..\..\src\mangosd;..\..\dep\ACE_wrappers" - PreprocessorDefinitions="VERSION="0.12.0-SVN";WIN32;_DEBUG;MANGOS_DEBUG;_CONSOLE;ENABLE_CLI" + PreprocessorDefinitions="VERSION="0.12.0-DEV";WIN32;_DEBUG;MANGOS_DEBUG;_CONSOLE;ENABLE_CLI" IgnoreStandardIncludePath="FALSE" BasicRuntimeChecks="3" RuntimeLibrary="1" diff --git a/win/VC71/realmd.vcproj b/win/VC71/realmd.vcproj index 64b48d8b3..91e8546ad 100644 --- a/win/VC71/realmd.vcproj +++ b/win/VC71/realmd.vcproj @@ -24,7 +24,7 @@ Name="VCCLCompilerTool" InlineFunctionExpansion="1" AdditionalIncludeDirectories="..\..\dep\include;..\..\src\framework;..\..\src\shared;..\..\src\realmd;..\..\dep\ACE_wrappers" - PreprocessorDefinitions="VERSION="0.12.0-SVN",WIN32,NDEBUG,_CONSOLE" + PreprocessorDefinitions="VERSION="0.12.0-DEV",WIN32,NDEBUG,_CONSOLE" StringPooling="TRUE" RuntimeLibrary="0" EnableFunctionLevelLinking="TRUE" @@ -91,7 +91,7 @@ Name="VCCLCompilerTool" Optimization="0" AdditionalIncludeDirectories="..\..\dep\include;..\..\src\framework;..\..\src\shared;..\..\src\realmd;..\..\dep\ACE_wrappers" - PreprocessorDefinitions="VERSION="0.12.0-SVN";WIN32;_DEBUG;MANGOS_DEBUG;_CONSOLE" + PreprocessorDefinitions="VERSION="0.12.0-DEV";WIN32;_DEBUG;MANGOS_DEBUG;_CONSOLE" IgnoreStandardIncludePath="FALSE" BasicRuntimeChecks="3" RuntimeLibrary="1" diff --git a/win/VC71/shared.vcproj b/win/VC71/shared.vcproj index 83c509a8c..1e5d5c3e1 100644 --- a/win/VC71/shared.vcproj +++ b/win/VC71/shared.vcproj @@ -437,7 +437,7 @@ Description="Extract revision" CommandLine="cd "$(SolutionDir)..\src\shared" "$(TargetDir)\..\genrevision__$(PlatformName)_$(ConfigurationName)\genrevision.exe" "..\.." " - AdditionalDependencies="$(SolutionDir)../.svn/entries;$(SolutionDir)../.git/FETCH_HEAD" + AdditionalDependencies="$(SolutionDir)../.svn/entries;$(SolutionDir)../_svn/entries;$(SolutionDir)../.git/FETCH_HEAD" Outputs="revision.h"/> diff --git a/win/VC80/mangosd.vcproj b/win/VC80/mangosd.vcproj index 0acbf84eb..17e9c4791 100644 --- a/win/VC80/mangosd.vcproj +++ b/win/VC80/mangosd.vcproj @@ -48,7 +48,7 @@ AdditionalOptions="/MP" InlineFunctionExpansion="1" AdditionalIncludeDirectories="..\..\dep\include,..\..\src\framework,..\..\src\shared,..\..\src\game,..\..\src\mangosd;..\..\dep\ACE_wrappers" - PreprocessorDefinitions="VERSION="0.12.0-SVN";WIN32;NDEBUG;_CONSOLE;ENABLE_CLI" + PreprocessorDefinitions="VERSION="0.12.0-DEV";WIN32;NDEBUG;_CONSOLE;ENABLE_CLI" StringPooling="true" RuntimeLibrary="0" EnableFunctionLevelLinking="true" @@ -150,7 +150,7 @@ AdditionalOptions="/MP" InlineFunctionExpansion="1" AdditionalIncludeDirectories="..\..\dep\include,..\..\src\framework,..\..\src\shared,..\..\src\game,..\..\src\mangosd;..\..\dep\ACE_wrappers" - PreprocessorDefinitions="VERSION="0.12.0-SVN";WIN32;NDEBUG;_CONSOLE;ENABLE_CLI" + PreprocessorDefinitions="VERSION="0.12.0-DEV";WIN32;NDEBUG;_CONSOLE;ENABLE_CLI" StringPooling="true" RuntimeLibrary="0" EnableFunctionLevelLinking="true" @@ -250,7 +250,7 @@ AdditionalOptions="/MP" Optimization="0" AdditionalIncludeDirectories="..\..\dep\include,..\..\src\framework,..\..\src\shared,..\..\src\game,..\..\src\mangosd;..\..\dep\ACE_wrappers" - PreprocessorDefinitions="VERSION="0.12.0-SVN";WIN32;_DEBUG;MANGOS_DEBUG;_CONSOLE;ENABLE_CLI" + PreprocessorDefinitions="VERSION="0.12.0-DEV";WIN32;_DEBUG;MANGOS_DEBUG;_CONSOLE;ENABLE_CLI" IgnoreStandardIncludePath="false" BasicRuntimeChecks="3" RuntimeLibrary="1" @@ -352,7 +352,7 @@ AdditionalOptions="/MP" Optimization="0" AdditionalIncludeDirectories="..\..\dep\include,..\..\src\framework,..\..\src\shared,..\..\src\game,..\..\src\mangosd;..\..\dep\ACE_wrappers" - PreprocessorDefinitions="VERSION="0.12.0-SVN";WIN32;_DEBUG;MANGOS_DEBUG;_CONSOLE;ENABLE_CLI" + PreprocessorDefinitions="VERSION="0.12.0-DEV";WIN32;_DEBUG;MANGOS_DEBUG;_CONSOLE;ENABLE_CLI" IgnoreStandardIncludePath="false" BasicRuntimeChecks="3" RuntimeLibrary="1" diff --git a/win/VC80/realmd.vcproj b/win/VC80/realmd.vcproj index d04196574..3a39a6750 100644 --- a/win/VC80/realmd.vcproj +++ b/win/VC80/realmd.vcproj @@ -48,7 +48,7 @@ AdditionalOptions="/MP" InlineFunctionExpansion="1" AdditionalIncludeDirectories="..\..\dep\include;..\..\src\framework;..\..\src\shared;..\..\src\realmd;..\..\dep\ACE_wrappers" - PreprocessorDefinitions="VERSION="0.12.0-SVN",WIN32,NDEBUG,_CONSOLE" + PreprocessorDefinitions="VERSION="0.12.0-DEV",WIN32,NDEBUG,_CONSOLE" StringPooling="true" RuntimeLibrary="0" EnableFunctionLevelLinking="true" @@ -147,7 +147,7 @@ AdditionalOptions="/MP" InlineFunctionExpansion="1" AdditionalIncludeDirectories="..\..\dep\include;..\..\src\framework;..\..\src\shared;..\..\src\realmd;..\..\dep\ACE_wrappers" - PreprocessorDefinitions="VERSION="0.12.0-SVN",WIN32,NDEBUG,_CONSOLE" + PreprocessorDefinitions="VERSION="0.12.0-DEV",WIN32,NDEBUG,_CONSOLE" StringPooling="true" RuntimeLibrary="0" EnableFunctionLevelLinking="true" @@ -244,7 +244,7 @@ AdditionalOptions="/MP" Optimization="0" AdditionalIncludeDirectories="..\..\dep\include;..\..\src\framework;..\..\src\shared;..\..\src\realmd;..\..\dep\ACE_wrappers" - PreprocessorDefinitions="VERSION="0.12.0-SVN";WIN32;_DEBUG;MANGOS_DEBUG;_CONSOLE" + PreprocessorDefinitions="VERSION="0.12.0-DEV";WIN32;_DEBUG;MANGOS_DEBUG;_CONSOLE" IgnoreStandardIncludePath="false" BasicRuntimeChecks="3" RuntimeLibrary="1" @@ -343,7 +343,7 @@ AdditionalOptions="/MP" Optimization="0" AdditionalIncludeDirectories="..\..\dep\include;..\..\src\framework;..\..\src\shared;..\..\src\realmd;..\..\dep\ACE_wrappers" - PreprocessorDefinitions="VERSION="0.12.0-SVN";WIN32;_DEBUG;MANGOS_DEBUG;_CONSOLE" + PreprocessorDefinitions="VERSION="0.12.0-DEV";WIN32;_DEBUG;MANGOS_DEBUG;_CONSOLE" IgnoreStandardIncludePath="false" BasicRuntimeChecks="3" RuntimeLibrary="1" diff --git a/win/VC80/shared.vcproj b/win/VC80/shared.vcproj index 5a9f4ae4f..8e6afd50c 100644 --- a/win/VC80/shared.vcproj +++ b/win/VC80/shared.vcproj @@ -771,7 +771,7 @@ Name="VCCustomBuildTool" Description="Extract revision" CommandLine="cd "$(SolutionDir)..\src\shared" "$(TargetDir)\..\genrevision__$(PlatformName)_$(ConfigurationName)\genrevision.exe" "..\.." " - AdditionalDependencies="$(SolutionDir)../.svn/entries;$(SolutionDir)../.git/FETCH_HEAD" + AdditionalDependencies="$(SolutionDir)../.svn/entries;$(SolutionDir)../_svn/entries;$(SolutionDir)../.git/FETCH_HEAD" Outputs="revision.h" /> @@ -782,7 +782,7 @@ Name="VCCustomBuildTool" Description="Extract revision" CommandLine="cd "$(SolutionDir)..\src\shared" "$(TargetDir)\..\genrevision__$(PlatformName)_$(ConfigurationName)\genrevision.exe" "..\.." " - AdditionalDependencies="$(SolutionDir)../.svn/entries;$(SolutionDir)../.git/FETCH_HEAD" + AdditionalDependencies="$(SolutionDir)../.svn/entries;$(SolutionDir)../_svn/entries;$(SolutionDir)../.git/FETCH_HEAD" Outputs="revision.h" /> @@ -793,7 +793,7 @@ Name="VCCustomBuildTool" Description="Extract revision" CommandLine="cd "$(SolutionDir)..\src\shared" "$(TargetDir)\..\genrevision__$(PlatformName)_$(ConfigurationName)\genrevision.exe" "..\.." " - AdditionalDependencies="$(SolutionDir)../.svn/entries;$(SolutionDir)../.git/FETCH_HEAD" + AdditionalDependencies="$(SolutionDir)../.svn/entries;$(SolutionDir)../_svn/entries;$(SolutionDir)../.git/FETCH_HEAD" Outputs="revision.h" /> @@ -804,7 +804,7 @@ Name="VCCustomBuildTool" Description="Extract revision" CommandLine="cd "$(SolutionDir)..\src\shared" "$(TargetDir)\..\genrevision__$(PlatformName)_$(ConfigurationName)\genrevision.exe" "..\.." " - AdditionalDependencies="$(SolutionDir)../.svn/entries;$(SolutionDir)../.git/FETCH_HEAD" + AdditionalDependencies="$(SolutionDir)../.svn/entries;$(SolutionDir)../_svn/entries;$(SolutionDir)../.git/FETCH_HEAD" Outputs="revision.h" /> diff --git a/win/VC90/mangosd.vcproj b/win/VC90/mangosd.vcproj index 6282ba9d3..f6ae56d33 100644 --- a/win/VC90/mangosd.vcproj +++ b/win/VC90/mangosd.vcproj @@ -49,7 +49,7 @@ AdditionalOptions="/MP" InlineFunctionExpansion="1" AdditionalIncludeDirectories="..\..\dep\include,..\..\src\framework,..\..\src\shared,..\..\src\game,..\..\src\mangosd;..\..\dep\ACE_wrappers" - PreprocessorDefinitions="VERSION="0.12.0-SVN";WIN32;NDEBUG;_CONSOLE;ENABLE_CLI" + PreprocessorDefinitions="VERSION="0.12.0-DEV";WIN32;NDEBUG;_CONSOLE;ENABLE_CLI" StringPooling="true" RuntimeLibrary="2" EnableFunctionLevelLinking="true" @@ -150,7 +150,7 @@ AdditionalOptions="/MP" InlineFunctionExpansion="1" AdditionalIncludeDirectories="..\..\dep\include,..\..\src\framework,..\..\src\shared,..\..\src\game,..\..\src\mangosd;..\..\dep\ACE_wrappers" - PreprocessorDefinitions="VERSION="0.12.0-SVN";WIN32;NDEBUG;_CONSOLE;ENABLE_CLI" + PreprocessorDefinitions="VERSION="0.12.0-DEV";WIN32;NDEBUG;_CONSOLE;ENABLE_CLI" StringPooling="true" RuntimeLibrary="2" EnableFunctionLevelLinking="true" @@ -249,7 +249,7 @@ AdditionalOptions="/MP" Optimization="0" AdditionalIncludeDirectories="..\..\dep\include,..\..\src\framework,..\..\src\shared,..\..\src\game,..\..\src\mangosd;..\..\dep\ACE_wrappers" - PreprocessorDefinitions="VERSION="0.12.0-SVN";WIN32;_DEBUG;MANGOS_DEBUG;_CONSOLE;ENABLE_CLI" + PreprocessorDefinitions="VERSION="0.12.0-DEV";WIN32;_DEBUG;MANGOS_DEBUG;_CONSOLE;ENABLE_CLI" IgnoreStandardIncludePath="false" BasicRuntimeChecks="3" RuntimeLibrary="3" @@ -351,7 +351,7 @@ AdditionalOptions="/MP" Optimization="0" AdditionalIncludeDirectories="..\..\dep\include,..\..\src\framework,..\..\src\shared,..\..\src\game,..\..\src\mangosd;..\..\dep\ACE_wrappers" - PreprocessorDefinitions="VERSION="0.12.0-SVN";WIN32;_DEBUG;MANGOS_DEBUG;_CONSOLE;ENABLE_CLI" + PreprocessorDefinitions="VERSION="0.12.0-DEV";WIN32;_DEBUG;MANGOS_DEBUG;_CONSOLE;ENABLE_CLI" IgnoreStandardIncludePath="false" BasicRuntimeChecks="3" RuntimeLibrary="3" diff --git a/win/VC90/shared.vcproj b/win/VC90/shared.vcproj index cb0b6e01a..de3fa88df 100644 --- a/win/VC90/shared.vcproj +++ b/win/VC90/shared.vcproj @@ -767,7 +767,7 @@ Name="VCCustomBuildTool" Description="Extract revision" CommandLine="cd "$(SolutionDir)..\src\shared" "$(TargetDir)\..\genrevision__$(PlatformName)_$(ConfigurationName)\genrevision.exe" "..\.." " - AdditionalDependencies="$(SolutionDir)../.svn/entries;$(SolutionDir)../.git/FETCH_HEAD" + AdditionalDependencies="$(SolutionDir)../.svn/entries;$(SolutionDir)../_svn/entries;$(SolutionDir)../.git/FETCH_HEAD" Outputs="revision.h" /> @@ -778,7 +778,7 @@ Name="VCCustomBuildTool" Description="Extract revision" CommandLine="cd "$(SolutionDir)..\src\shared" "$(TargetDir)\..\genrevision__$(PlatformName)_$(ConfigurationName)\genrevision.exe" "..\.." " - AdditionalDependencies="$(SolutionDir)../.svn/entries;$(SolutionDir)../.git/FETCH_HEAD" + AdditionalDependencies="$(SolutionDir)../.svn/entries;$(SolutionDir)../_svn/entries;$(SolutionDir)../.git/FETCH_HEAD" Outputs="revision.h" /> @@ -789,7 +789,7 @@ Name="VCCustomBuildTool" Description="Extract revision" CommandLine="cd "$(SolutionDir)..\src\shared" "$(TargetDir)\..\genrevision__$(PlatformName)_$(ConfigurationName)\genrevision.exe" "..\.." " - AdditionalDependencies="$(SolutionDir)../.svn/entries;$(SolutionDir)../.git/FETCH_HEAD" + AdditionalDependencies="$(SolutionDir)../.svn/entries;$(SolutionDir)../_svn/entries;$(SolutionDir)../.git/FETCH_HEAD" Outputs="revision.h" /> @@ -800,7 +800,7 @@ Name="VCCustomBuildTool" Description="Extract revision" CommandLine="cd "$(SolutionDir)..\src\shared" "$(TargetDir)\..\genrevision__$(PlatformName)_$(ConfigurationName)\genrevision.exe" "..\.." " - AdditionalDependencies="$(SolutionDir)../.svn/entries;$(SolutionDir)../.git/FETCH_HEAD" + AdditionalDependencies="$(SolutionDir)../.svn/entries;$(SolutionDir)../_svn/entries;$(SolutionDir)../.git/FETCH_HEAD" Outputs="revision.h" /> From 6f6a1a760803cfbc20e40f462f84701eee96e29d Mon Sep 17 00:00:00 2001 From: ApoC Date: Sun, 26 Oct 2008 18:24:45 +0100 Subject: [PATCH 6/9] Default behaviour of pets for creatures changed to REACT_DEFENSIVE Fixed typo: changed m_ReactSate to m_reactState Signed-off-by: ApoC --- src/game/SpellEffects.cpp | 8 ++++++-- src/game/Unit.cpp | 2 +- src/game/Unit.h | 8 ++++---- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 614d6d2f3..263988d73 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -4038,12 +4038,16 @@ void Spell::EffectSummonPet(uint32 i) NewSummon->setPetType(SUMMON_PET); uint32 faction = m_caster->getFaction(); - if(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->isTotem()) + if(m_caster->GetTypeId() == TYPEID_UNIT) { Unit* owner = ((Totem*)m_caster)->GetOwner(); if(owner) faction = owner->getFaction(); - NewSummon->GetCharmInfo()->SetReactState(REACT_AGGRESSIVE); + + if ( ((Creature*)m_caster)->isTotem() ) + NewSummon->GetCharmInfo()->SetReactState(REACT_AGGRESSIVE); + else + NewSummon->GetCharmInfo()->SetReactState(REACT_DEFENSIVE); } NewSummon->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_caster->GetGUID()); diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 339a59079..aaf107d4e 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -9808,7 +9808,7 @@ CharmInfo* Unit::InitCharmInfo(Unit *charm) } CharmInfo::CharmInfo(Unit* unit) -: m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_ReactSate(REACT_PASSIVE), m_petnumber(0) +: m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_reactState(REACT_PASSIVE), m_petnumber(0) { for(int i =0; i<4; ++i) { diff --git a/src/game/Unit.h b/src/game/Unit.h index 6eb643843..99d6b61f2 100644 --- a/src/game/Unit.h +++ b/src/game/Unit.h @@ -643,9 +643,9 @@ struct CharmInfo void SetCommandState(CommandStates st) { m_CommandState = st; } CommandStates GetCommandState() { return m_CommandState; } bool HasCommandState(CommandStates state) { return (m_CommandState == state); } - void SetReactState(ReactStates st) { m_ReactSate = st; } - ReactStates GetReactState() { return m_ReactSate; } - bool HasReactState(ReactStates state) { return (m_ReactSate == state); } + void SetReactState(ReactStates st) { m_reactState = st; } + ReactStates GetReactState() { return m_reactState; } + bool HasReactState(ReactStates state) { return (m_reactState == state); } void InitPossessCreateSpells(); void InitCharmCreateSpells(); @@ -662,7 +662,7 @@ struct CharmInfo UnitActionBarEntry PetActionBar[10]; CharmSpellEntry m_charmspells[4]; CommandStates m_CommandState; - ReactStates m_ReactSate; + ReactStates m_reactState; uint32 m_petnumber; }; From 687a9bc8ce3da5e24e9cbc6ad8038782564f9d43 Mon Sep 17 00:00:00 2001 From: "@" <@> Date: Sun, 26 Oct 2008 21:10:08 +0300 Subject: [PATCH 7/9] Fixed genrevision tool build at FreeBSD and maybe some other plafroms. Signed-off-by: VladimirMangos --- src/tools/genrevision/genrevision.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/tools/genrevision/genrevision.cpp b/src/tools/genrevision/genrevision.cpp index 23cf1a360..aa893d57c 100644 --- a/src/tools/genrevision/genrevision.cpp +++ b/src/tools/genrevision/genrevision.cpp @@ -19,6 +19,8 @@ #include #include #include +#include +#include #pragma warning(disable:4996) From 4482593653dc52a0f97e4a3ffcc472c6e71156a2 Mon Sep 17 00:00:00 2001 From: ApoC Date: Sun, 26 Oct 2008 21:07:02 +0100 Subject: [PATCH 8/9] Fixed posible crash in my prev. commit thx. to Hanuza who point it out. Signed-off-by: ApoC --- src/game/SpellEffects.cpp | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 263988d73..6525efecf 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -4040,10 +4040,6 @@ void Spell::EffectSummonPet(uint32 i) uint32 faction = m_caster->getFaction(); if(m_caster->GetTypeId() == TYPEID_UNIT) { - Unit* owner = ((Totem*)m_caster)->GetOwner(); - if(owner) - faction = owner->getFaction(); - if ( ((Creature*)m_caster)->isTotem() ) NewSummon->GetCharmInfo()->SetReactState(REACT_AGGRESSIVE); else From e96fedc97c621be29f4ded43ce2f0838fafb91aa Mon Sep 17 00:00:00 2001 From: "@" <@> Date: Sun, 26 Oct 2008 23:38:45 +0300 Subject: [PATCH 9/9] Implement new player conditions CONDITION_NO_AURA, CONDITION_ACTIVE_EVENT. Signed-off-by: VladimirMangos Currently can be used in loot conditions, later possible in gossip options show. --- src/game/ObjectMgr.cpp | 28 ++++++++++++++++++++++++++++ src/game/ObjectMgr.h | 4 +++- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index 9ce7fad75..9720564bf 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -6381,6 +6381,10 @@ bool PlayerCondition::Meets(Player const * player) const return true; return false; } + case CONDITION_NO_AURA: + return !player->HasAura(value1, value2); + case CONDITION_ACTIVE_EVENT: + return gameeventmgr.IsActiveEvent(value1); default: return false; } @@ -6501,6 +6505,30 @@ bool PlayerCondition::IsValid(ConditionType condition, uint32 value1, uint32 val sLog.outErrorDb("Quest condition has useless data in value2 (%u)!", value2); break; } + case CONDITION_NO_AURA: + { + if(!sSpellStore.LookupEntry(value1)) + { + sLog.outErrorDb("Aura condition requires to have non existing spell (Id: %d), skipped", value1); + return false; + } + if(value2 > 2) + { + sLog.outErrorDb("Aura condition requires to have non existing effect index (%u) (must be 0..2), skipped", value2); + return false; + } + break; + } + case CONDITION_ACTIVE_EVENT: + { + GameEvent::GameEventDataMap const& events = gameeventmgr.GetEventMap(); + if(value1 >=events.size() || !events[value1].isValid()) + { + sLog.outErrorDb("Active event condition requires existed event id (%u), skipped", value1); + return false; + } + break; + } } return true; } diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index d5391c464..982b9a4a9 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -203,9 +203,11 @@ enum ConditionType CONDITION_QUESTREWARDED = 8, // quest_id 0 CONDITION_QUESTTAKEN = 9, // quest_id 0, for condition true while quest active. CONDITION_AD_COMMISSION_AURA = 10, // 0 0, for condition true while one from AD ñommission aura active + CONDITION_NO_AURA = 11, // spell_id effindex + CONDITION_ACTIVE_EVENT = 12, // event_id }; -#define MAX_CONDITION 11 // maximum value in ConditionType enum +#define MAX_CONDITION 13 // maximum value in ConditionType enum struct PlayerCondition {