diff options
author | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-08-28 21:00:53 +0200 |
---|---|---|
committer | Vincent-Michael <Vincent_Michael@gmx.de> | 2014-08-28 21:00:53 +0200 |
commit | 3a248fbfec34fe80170dfb8c50b971858fb1e488 (patch) | |
tree | 4bf46d335d77b77a7abfb5f84f00b2073c6b636b | |
parent | c0c708cf02631118eaab093c43ab8c0b88dcbae2 (diff) | |
parent | d6dbe52e64b1e6421b34877acd14b6008de97fa5 (diff) |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into 4.3.4
Conflicts:
src/server/game/Battlegrounds/BattlegroundScore.h
26 files changed, 382 insertions, 14 deletions
diff --git a/cmake/genrev.cmake b/cmake/genrev.cmake index f4885f53e1c..26c26d8ad62 100644 --- a/cmake/genrev.cmake +++ b/cmake/genrev.cmake @@ -41,7 +41,7 @@ else() OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET ) - + # Also retrieve branch name execute_process( COMMAND "${GIT_EXEC}" rev-parse --abbrev-ref HEAD diff --git a/cmake/macros/ConfigureBoost.cmake b/cmake/macros/ConfigureBoost.cmake index ae5ac633ce2..3d3791b8a93 100644 --- a/cmake/macros/ConfigureBoost.cmake +++ b/cmake/macros/ConfigureBoost.cmake @@ -20,7 +20,7 @@ if(WIN32) set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
-
+
get_WIN32_WINNT(ver)
add_definitions(-D_WIN32_WINNT=${ver})
endif()
diff --git a/cmake/macros/FindMySQL.cmake b/cmake/macros/FindMySQL.cmake index 036b8302c75..7650a83c571 100644 --- a/cmake/macros/FindMySQL.cmake +++ b/cmake/macros/FindMySQL.cmake @@ -1,6 +1,6 @@ # # Find the MySQL client includes and library -# +# # This module defines # MYSQL_INCLUDE_DIR, where to find mysql.h @@ -95,7 +95,7 @@ find_path(MYSQL_INCLUDE_DIR if( UNIX ) foreach(LIB ${MYSQL_ADD_LIBRARIES}) - find_library( MYSQL_LIBRARY + find_library( MYSQL_LIBRARY NAMES mysql libmysql ${LIB} PATHS @@ -111,7 +111,7 @@ if( UNIX ) endif( UNIX ) if( WIN32 ) - find_library( MYSQL_LIBRARY + find_library( MYSQL_LIBRARY NAMES libmysql PATHS diff --git a/cmake/macros/FindReadline.cmake b/cmake/macros/FindReadline.cmake index 07c6b368df8..34af35204b5 100644 --- a/cmake/macros/FindReadline.cmake +++ b/cmake/macros/FindReadline.cmake @@ -5,7 +5,7 @@ # READLINE_FOUND - TRUE if READLINE was found FIND_PATH(READLINE_INCLUDE_DIR readline/readline.h) -FIND_LIBRARY(READLINE_LIBRARY NAMES readline) +FIND_LIBRARY(READLINE_LIBRARY NAMES readline) IF (READLINE_INCLUDE_DIR AND READLINE_LIBRARY) SET(READLINE_FOUND TRUE) diff --git a/cmake/stack_direction.c b/cmake/stack_direction.c index 11bcf803bfa..4797d8e14e7 100644 --- a/cmake/stack_direction.c +++ b/cmake/stack_direction.c @@ -1,5 +1,5 @@ /* Copyright (C) 2009 Sun Microsystems, Inc - + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License. @@ -14,17 +14,17 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ /* Check stack direction (0-down, 1-up) */ -int f(int *a) +int f(int *a) { int b; - return(&b > a)?1:0; + return(&b > a)?1:0; } /* - Prevent compiler optimizations by calling function + Prevent compiler optimizations by calling function through pointer. */ volatile int (*ptr_f)(int *) = f; -int main() +int main() { int a; return ptr_f(&a); diff --git a/sql/base/characters_database.sql b/sql/base/characters_database.sql index 452b5a05b70..f4969ee617e 100644 --- a/sql/base/characters_database.sql +++ b/sql/base/characters_database.sql @@ -2606,6 +2606,66 @@ LOCK TABLES `pool_quest_save` WRITE; UNLOCK TABLES; -- +-- Table structure for table `pvpstats_battlegrounds` +-- + +DROP TABLE IF EXISTS `pvpstats_battlegrounds`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pvpstats_battlegrounds` ( + `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT, + `winner_faction` tinyint(4) NOT NULL, + `bracket_id` tinyint(3) unsigned NOT NULL, + `type` tinyint(3) unsigned NOT NULL, + `date` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `pvpstats_battlegrounds` +-- + +LOCK TABLES `pvpstats_battlegrounds` WRITE; +/*!40000 ALTER TABLE `pvpstats_battlegrounds` DISABLE KEYS */; +/*!40000 ALTER TABLE `pvpstats_battlegrounds` ENABLE KEYS */; +UNLOCK TABLES; + +-- +-- Table structure for table `pvpstats_players` +-- + +DROP TABLE IF EXISTS `pvpstats_players`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `pvpstats_players` ( + `battleground_id` bigint(20) unsigned NOT NULL, + `character_guid` int(10) unsigned NOT NULL, + `score_killing_blows` mediumint(8) unsigned NOT NULL, + `score_deaths` mediumint(8) unsigned NOT NULL, + `score_honorable_kills` mediumint(8) unsigned NOT NULL, + `score_bonus_honor` mediumint(8) unsigned NOT NULL, + `score_damage_done` mediumint(8) unsigned NOT NULL, + `score_healing_done` mediumint(8) unsigned NOT NULL, + `attr_1` mediumint(8) unsigned NOT NULL DEFAULT '0', + `attr_2` mediumint(8) unsigned NOT NULL DEFAULT '0', + `attr_3` mediumint(8) unsigned NOT NULL DEFAULT '0', + `attr_4` mediumint(8) unsigned NOT NULL DEFAULT '0', + `attr_5` mediumint(8) unsigned NOT NULL DEFAULT '0', + PRIMARY KEY (`battleground_id`,`character_guid`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `pvpstats_players` +-- + +LOCK TABLES `pvpstats_players` WRITE; +/*!40000 ALTER TABLE `pvpstats_players` DISABLE KEYS */; +/*!40000 ALTER TABLE `pvpstats_players` ENABLE KEYS */; +UNLOCK TABLES; + +-- -- Table structure for table `reserved_name` -- @@ -2684,4 +2744,4 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; --- Dump completed on 2014-01-26 14:39:20 +-- Dump completed on 2014-08-28 15:30:47 diff --git a/sql/updates/characters/2014_08_28_00_characters_pvpstats.sql b/sql/updates/characters/2014_08_28_00_characters_pvpstats.sql new file mode 100644 index 00000000000..0e3c239f8e6 --- /dev/null +++ b/sql/updates/characters/2014_08_28_00_characters_pvpstats.sql @@ -0,0 +1,28 @@ +DROP TABLE IF EXISTS `pvpstats_battlegrounds`; +CREATE TABLE `pvpstats_battlegrounds` ( + `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, + `winner_faction` TINYINT NOT NULL, + `bracket_id` TINYINT UNSIGNED NOT NULL, + `type` TINYINT UNSIGNED NOT NULL, + `date` DATETIME NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=InnoDB; + +DROP TABLE IF EXISTS `pvpstats_players`; +CREATE TABLE `pvpstats_players` ( + `battleground_id` BIGINT UNSIGNED NOT NULL, + `character_guid` INT UNSIGNED NOT NULL, + `score_killing_blows` MEDIUMINT UNSIGNED NOT NULL, + `score_deaths` MEDIUMINT UNSIGNED NOT NULL, + `score_honorable_kills` MEDIUMINT UNSIGNED NOT NULL, + `score_bonus_honor` MEDIUMINT UNSIGNED NOT NULL, + `score_damage_done` MEDIUMINT UNSIGNED NOT NULL, + `score_healing_done` MEDIUMINT UNSIGNED NOT NULL, + `attr_1` MEDIUMINT UNSIGNED NOT NULL DEFAULT 0, + `attr_2` MEDIUMINT UNSIGNED NOT NULL DEFAULT 0, + `attr_3` MEDIUMINT UNSIGNED NOT NULL DEFAULT 0, + `attr_4` MEDIUMINT UNSIGNED NOT NULL DEFAULT 0, + `attr_5` MEDIUMINT UNSIGNED NOT NULL DEFAULT 0, + PRIMARY KEY (`battleground_id`, `character_guid`) +) ENGINE=InnoDB; + diff --git a/sql/updates/world/2014_08_27_00_world_creature_template.sql b/sql/updates/world/2014_08_27_00_world_creature_template.sql new file mode 100644 index 00000000000..bfc5ed40f4e --- /dev/null +++ b/sql/updates/world/2014_08_27_00_world_creature_template.sql @@ -0,0 +1,2 @@ +-- +UPDATE `creature_template` SET `ScriptName`='' WHERE `ScriptName`='npc_valiant'; diff --git a/sql/updates/world/2014_08_27_00_world_misc.sql b/sql/updates/world/2014_08_27_02_world_misc.sql index d97536a836d..d97536a836d 100644 --- a/sql/updates/world/2014_08_27_00_world_misc.sql +++ b/sql/updates/world/2014_08_27_02_world_misc.sql diff --git a/sql/updates/world/2014_08_28_00_world_misc.sql b/sql/updates/world/2014_08_28_00_world_misc.sql new file mode 100644 index 00000000000..d12d56de004 --- /dev/null +++ b/sql/updates/world/2014_08_28_00_world_misc.sql @@ -0,0 +1,22 @@ +SET @ENTRY := 28511; + +UPDATE `creature_template` SET `spell1`=51859,`spell2`=51904,`spell3`=52006,`spell4`=0,`spell5`=52694,`unit_flags`=16777224,`InhabitType`=5,`ScriptName`='npc_eye_of_acherus' WHERE `entry` = @ENTRY; + +DELETE FROM `creature_template_addon` WHERE`entry`=@ENTRY; +INSERT INTO `creature_template_addon` (`entry`, `path_id`, `mount`, `bytes1`, `bytes2`, `emote`, `auras`) VALUES +(@ENTRY, 0, 0, 0x0, 0x1, 0, '51892'); + +DELETE FROM `waypoint_data` WHERE`id`=@ENTRY * 100; +INSERT INTO `waypoint_data` (`id`, `point`, `position_x`, `position_y`, `position_z`, `orientation`, `delay`, `move_type`, `action`, `action_chance`, `wpguid`) VALUES +(@ENTRY * 100, 0, 2341.571, -5672.797, 538.3942, 0, 0, 1, 0, 100, 0), +(@ENTRY * 100, 1, 1957.396, -5844.105, 273.8667, 0, 0, 1, 0, 100, 0), +(@ENTRY * 100, 2, 1758.007, -5876.785, 166.8667, 0, 0, 1, 0, 100, 0); + +DELETE FROM `creature_text` WHERE`entry`=@ENTRY; +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES +(@ENTRY, 0, 0, 'The Eye of Acherus launches towards its destination.', 42, 0, 100, 0, 0, 0, 'Eye of Acherus'), +(@ENTRY, 1, 0, 'The Eye of Acherus is in your control.', 42, 0, 100, 0, 0, 0, 'Eye of Acherus'); + +DELETE FROM `spell_script_names` WHERE spell_id=52694; +INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES +(52694,'spell_q12641_recall_eye_of_acherus'); diff --git a/src/server/game/Battlegrounds/Battleground.cpp b/src/server/game/Battlegrounds/Battleground.cpp index ed39c3fd6b2..69d43d4f40f 100644 --- a/src/server/game/Battlegrounds/Battleground.cpp +++ b/src/server/game/Battlegrounds/Battleground.cpp @@ -748,6 +748,24 @@ void Battleground::EndBattleground(uint32 winner) int32 winmsg_id = 0; bool guildAwarded = false; + PreparedStatement* stmt; + PreparedQueryResult result; + uint64 battleground_id = 1; + + if (isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE)) + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PVPSTATS_MAXID); + result = CharacterDatabase.Query(stmt); + + if (result) + { + Field* fields = result->Fetch(); + battleground_id = fields[0].GetInt64() + 1; + } + + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PVPSTATS_BATTLEGROUND); + } + if (winner == ALLIANCE) { winmsg_id = isBattleground() ? LANG_BG_A_WINS : LANG_ARENA_GOLD_WINS; @@ -755,6 +773,9 @@ void Battleground::EndBattleground(uint32 winner) PlaySoundToAll(SOUND_ALLIANCE_WINS); // alliance wins sound SetWinner(BG_TEAM_ALLIANCE); + + if (isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE)) + stmt->setUInt8(1, BG_TEAM_ALLIANCE); } else if (winner == HORDE) { @@ -763,10 +784,24 @@ void Battleground::EndBattleground(uint32 winner) PlaySoundToAll(SOUND_HORDE_WINS); // horde wins sound SetWinner(BG_TEAM_HORDE); + + if (isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE)) + stmt->setUInt8(1, BG_TEAM_HORDE); } else { SetWinner(BG_TEAM_NEUTRAL); + + if (isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE)) + stmt->setUInt8(1, BG_TEAM_NEUTRAL); + } + + if (isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE)) + { + stmt->setUInt64(0, battleground_id); + stmt->setUInt8(2, m_BracketId + 1); + stmt->setUInt8(3, GetTypeID()); + CharacterDatabase.Execute(stmt); } SetStatus(STATUS_WAIT_LEAVE); @@ -809,6 +844,30 @@ void Battleground::EndBattleground(uint32 winner) uint32 winnerKills = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_HONOR_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_WINNER_HONOR_FIRST); uint32 loserKills = player->GetRandomWinner() ? sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_LAST) : sWorld->getIntConfig(CONFIG_BG_REWARD_LOSER_HONOR_FIRST); + if (isBattleground() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE)) + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PVPSTATS_PLAYER); + BattlegroundScoreMap::const_iterator score = PlayerScores.find(player->GetGUIDLow()); + + // battleground_id, character_guid, score_killing_blows, score_deaths, score_honorable_kills, score_bonus_honor, score_damage_done, score_healing_done + + stmt->setUInt32(0, battleground_id); + stmt->setUInt32(1, player->GetGUIDLow()); + stmt->setUInt32(2, score->second->GetKillingBlows()); + stmt->setUInt32(3, score->second->GetDeaths()); + stmt->setUInt32(4, score->second->GetHonorableKills()); + stmt->setUInt32(5, score->second->GetBonusHonor()); + stmt->setUInt32(6, score->second->GetDamageDone()); + stmt->setUInt32(7, score->second->GetHealingDone()); + stmt->setUInt32(8, score->second->GetAttr1()); + stmt->setUInt32(9, score->second->GetAttr2()); + stmt->setUInt32(10, score->second->GetAttr3()); + stmt->setUInt32(11, score->second->GetAttr4()); + stmt->setUInt32(12, score->second->GetAttr5()); + + CharacterDatabase.Execute(stmt); + } + // Reward winner team if (team == winner) { diff --git a/src/server/game/Battlegrounds/BattlegroundScore.h b/src/server/game/Battlegrounds/BattlegroundScore.h index 23e06693e56..6cb0aaadb73 100644 --- a/src/server/game/Battlegrounds/BattlegroundScore.h +++ b/src/server/game/Battlegrounds/BattlegroundScore.h @@ -159,6 +159,19 @@ struct BattlegroundScore // For Logging purpose virtual std::string ToString() const { return ""; } + uint32 GetKillingBlows() const { return KillingBlows; } + uint32 GetDeaths() const { return Deaths; } + uint32 GetHonorableKills() const { return HonorableKills; } + uint32 GetBonusHonor() const { return BonusHonor; } + uint32 GetDamageDone() const { return DamageDone; } + uint32 GetHealingDone() const { return HealingDone; } + + virtual uint32 GetAttr1() const { return 0; } + virtual uint32 GetAttr2() const { return 0; } + virtual uint32 GetAttr3() const { return 0; } + virtual uint32 GetAttr4() const { return 0; } + virtual uint32 GetAttr5() const { return 0; } + ObjectGuid PlayerGuid; uint8 TeamId; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h index 91bb7104d66..d99c206e0c8 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAB.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAB.h @@ -267,6 +267,9 @@ struct BattlegroundABScore final : public BattlegroundScore content << uint32(BasesDefended); } + uint32 GetAttr1() const final override { return BasesAssaulted; } + uint32 GetAttr2() const final override { return BasesDefended; } + uint32 BasesAssaulted; uint32 BasesDefended; }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h index a93929672c7..a4f1dddcd2c 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.h @@ -1568,6 +1568,12 @@ struct BattlegroundAVScore final : public BattlegroundScore content << uint32(MinesCaptured); } + uint32 GetAttr1() const final override { return GraveyardsAssaulted; } + uint32 GetAttr2() const final override { return GraveyardsDefended; } + uint32 GetAttr3() const final override { return TowersAssaulted; } + uint32 GetAttr4() const final override { return TowersDefended; } + uint32 GetAttr5() const final override { return MinesCaptured; } + uint32 GraveyardsAssaulted; uint32 GraveyardsDefended; uint32 TowersAssaulted; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h index 9867d878b41..e1eaa6dd5fe 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundEY.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundEY.h @@ -349,6 +349,8 @@ struct BattlegroundEYScore final : public BattlegroundScore content << uint32(FlagCaptures); } + uint32 GetAttr1() const final override { return FlagCaptures; } + uint32 FlagCaptures; }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h index a0f03f5727d..8a7995cf2c1 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundIC.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundIC.h @@ -878,6 +878,9 @@ struct BattlegroundICScore final : public BattlegroundScore content << uint32(BasesDefended); } + uint32 GetAttr1() const final override { return BasesAssaulted; } + uint32 GetAttr2() const final override { return BasesDefended; } + uint32 BasesAssaulted; uint32 BasesDefended; }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h index 7019d785503..6f5363aeaa8 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundSA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundSA.h @@ -538,6 +538,9 @@ struct BattlegroundSAScore final : public BattlegroundScore content << uint32(GatesDestroyed); } + uint32 GetAttr1() const final override { return DemolishersDestroyed; } + uint32 GetAttr2() const final override { return GatesDestroyed; } + uint32 DemolishersDestroyed; uint32 GatesDestroyed; }; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h index 2fdb6dd120e..5691b42d4e9 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.h @@ -177,6 +177,9 @@ struct BattlegroundWGScore final : public BattlegroundScore content << uint32(FlagReturns); } + uint32 GetAttr1() const final override { return FlagCaptures; } + uint32 GetAttr2() const final override { return FlagReturns; } + uint32 FlagCaptures; uint32 FlagReturns; }; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index f66c693098b..5cd9e052e2f 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1055,6 +1055,7 @@ void World::LoadConfigSettings(bool reload) m_bool_configs[CONFIG_BATTLEGROUND_CAST_DESERTER] = sConfigMgr->GetBoolDefault("Battleground.CastDeserter", true); m_bool_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE] = sConfigMgr->GetBoolDefault("Battleground.QueueAnnouncer.Enable", false); m_bool_configs[CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY] = sConfigMgr->GetBoolDefault("Battleground.QueueAnnouncer.PlayerOnly", false); + m_bool_configs[CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE] = sConfigMgr->GetBoolDefault("Battleground.StoreStatistics.Enable", false); m_int_configs[CONFIG_BATTLEGROUND_INVITATION_TYPE] = sConfigMgr->GetIntDefault ("Battleground.InvitationType", 0); m_int_configs[CONFIG_BATTLEGROUND_PREMATURE_FINISH_TIMER] = sConfigMgr->GetIntDefault ("Battleground.PrematureFinishTimer", 5 * MINUTE * IN_MILLISECONDS); m_int_configs[CONFIG_BATTLEGROUND_PREMADE_GROUP_WAIT_FOR_MATCH] = sConfigMgr->GetIntDefault ("Battleground.PremadeGroupWaitForMatch", 30 * MINUTE * IN_MILLISECONDS); diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 51a5f726051..74f10f91d51 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -129,6 +129,7 @@ enum WorldBoolConfigs CONFIG_BATTLEGROUND_CAST_DESERTER, CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE, CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_PLAYERONLY, + CONFIG_BATTLEGROUND_STORE_STATISTICS_ENABLE, CONFIG_BG_XP_FOR_KILL, CONFIG_ARENA_QUEUE_ANNOUNCER_ENABLE, CONFIG_ARENA_QUEUE_ANNOUNCER_PLAYERONLY, diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 0189b6040f7..1f0a58c4cf2 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -26,6 +26,7 @@ #include "Player.h" #include "SpellInfo.h" #include "CreatureTextMgr.h" +#include "MoveSplineInit.h" /*###### ##Quest 12848 @@ -322,6 +323,117 @@ public: }; + /*###### +## npc_eye_of_acherus +######*/ + +enum EyeOfAcherus +{ + SPELL_EYE_VISUAL = 51892, + SPELL_EYE_FLIGHT_BOOST = 51923, + SPELL_EYE_FLIGHT = 51890, + + EVENT_MOVE_START = 1, + + TALK_MOVE_START = 0, + TALK_CONTROL = 1, + + POINT_EYE_FALL = 1, + POINT_EYE_MOVE_END = 3 +}; + +Position const EyeOFAcherusFallPoint = { 2361.21f, -5660.45f, 496.7444f, 0.0f }; + +class npc_eye_of_acherus : public CreatureScript +{ + public: + npc_eye_of_acherus() : CreatureScript("npc_eye_of_acherus") { } + + struct npc_eye_of_acherusAI : public ScriptedAI + { + npc_eye_of_acherusAI(Creature* creature) : ScriptedAI(creature) + { + me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); + if (Player* owner = me->GetCharmerOrOwner()->ToPlayer()) + owner->SendAutoRepeatCancel(me); + + me->SetReactState(REACT_PASSIVE); + + me->GetMotionMaster()->MovePoint(POINT_EYE_FALL, EyeOFAcherusFallPoint, false); + + Movement::MoveSplineInit init(me); + init.MoveTo(EyeOFAcherusFallPoint.GetPositionX(), EyeOFAcherusFallPoint.GetPositionY(), EyeOFAcherusFallPoint.GetPositionZ(), false); + init.SetFall(); + init.Launch(); + } + + void OnCharmed(bool /*apply*/) override { } + + void UpdateAI(uint32 diff) override + { + _events.Update(diff); + + while (uint32 eventId = _events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_MOVE_START: + { + DoCast(me, SPELL_EYE_FLIGHT_BOOST); + + me->SetControlled(false, UNIT_STATE_ROOT); + if (Player* owner = me->GetCharmerOrOwner()->ToPlayer()) + { + for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i) + me->SetSpeed(UnitMoveType(i), owner->GetSpeedRate(UnitMoveType(i)), true); + Talk(TALK_MOVE_START, owner); + } + me->GetMotionMaster()->MovePath(me->GetEntry() * 100, false); + break; + } + default: + break; + } + } + } + + void MovementInform(uint32 movementType, uint32 pointId) override + { + if (movementType == WAYPOINT_MOTION_TYPE && pointId == POINT_EYE_MOVE_END - 1) + { + me->SetByteValue(UNIT_FIELD_BYTES_2, 0, SHEATH_STATE_MELEE); + me->RemoveAllAuras(); + + if (Player* owner = me->GetCharmerOrOwner()->ToPlayer()) + { + owner->RemoveAura(SPELL_EYE_FLIGHT_BOOST); + for (uint8 i = 0; i < MAX_MOVE_TYPE; ++i) + me->SetSpeed(UnitMoveType(i), owner->GetSpeedRate(UnitMoveType(i)), true); + + TalkToMap(TALK_CONTROL, owner); + } + me->SetDisableGravity(false); + DoCast(me, SPELL_EYE_FLIGHT); + } + + if (movementType == POINT_MOTION_TYPE && pointId == POINT_EYE_FALL) + { + me->SetDisableGravity(true); + me->SetControlled(true, UNIT_STATE_ROOT); + _events.ScheduleEvent(EVENT_MOVE_START, 5000); + } + } + + private: + EventMap _events; + }; + + CreatureAI* GetAI(Creature* creature) const override + { + return new npc_eye_of_acherusAI(creature); + } +}; + /*###### ## npc_death_knight_initiate ######*/ @@ -1081,6 +1193,7 @@ void AddSC_the_scarlet_enclave_c1() new npc_unworthy_initiate(); new npc_unworthy_initiate_anchor(); new go_acherus_soul_prison(); + new npc_eye_of_acherus(); new npc_death_knight_initiate(); new npc_salanar_the_horseman(); new npc_dark_rider_of_acherus(); diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 173e03fef7c..f17aac51519 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -2026,7 +2026,6 @@ class spell_q12308_escape_from_silverbrook_summon_worgen : public SpellScriptLoa } }; - enum DeathComesFromOnHigh { SPELL_FORGE_CREDIT = 51974, @@ -2097,6 +2096,37 @@ class spell_q12641_death_comes_from_on_high : public SpellScriptLoader } }; +// 52694 - Recall Eye of Acherus +class spell_q12641_recall_eye_of_acherus : public SpellScriptLoader +{ + public: + spell_q12641_recall_eye_of_acherus() : SpellScriptLoader("spell_q12641_recall_eye_of_acherus") { } + + class spell_q12641_recall_eye_of_acherus_SpellScript : public SpellScript + { + PrepareSpellScript(spell_q12641_recall_eye_of_acherus_SpellScript); + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + if (Player* player = GetCaster()->GetCharmerOrOwner()->ToPlayer()) + { + player->StopCastingCharm(); + player->StopCastingBindSight(); + } + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_q12641_recall_eye_of_acherus_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const override + { + return new spell_q12641_recall_eye_of_acherus_SpellScript(); + } +}; + // 51769 - Emblazon Runeblade class spell_q12619_emblazon_runeblade : public SpellScriptLoader { @@ -2364,6 +2394,7 @@ void AddSC_quest_spell_scripts() new spell_q12308_escape_from_silverbrook_summon_worgen(); new spell_q12308_escape_from_silverbrook(); new spell_q12641_death_comes_from_on_high(); + new spell_q12641_recall_eye_of_acherus(); new spell_q12619_emblazon_runeblade(); new spell_q12619_emblazon_runeblade_effect(); new spell_q12919_gymers_grab(); diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index a8b9e5f8e8e..b9f34bafedf 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -291,7 +291,7 @@ class spell_sha_earth_shield : public SpellScriptLoader amount = GetUnitOwner()->SpellHealingBonusTaken(caster, GetSpellInfo(), amount, HEAL); //! WORKAROUND - // If target is affected by healing reduction, modifier is guaranteed to be negative + // If target is affected by healing reduction, modifier is guaranteed to be negative // value (e.g. -50). To revert the effect, multiply amount with reciprocal of relative value: // (100 / ((-1) * modifier)) * 100 = (-1) * 100 * 100 / modifier = -10000 / modifier if (int32 modifier = GetUnitOwner()->GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT)) diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index f2e9ed88e2e..adde80c7a7f 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -632,4 +632,10 @@ void CharacterDatabaseConnection::DoPrepareStatements() PrepareStatement(CHAR_UPD_CHAR_PET_SLOT_BY_ID, "UPDATE character_pet SET slot = ? WHERE owner = ? AND id = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_DEL_CHAR_PET_BY_ID, "DELETE FROM character_pet WHERE id = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_DEL_CHAR_PET_BY_SLOT, "DELETE FROM character_pet WHERE owner = ? AND (slot = ? OR slot > ?)", CONNECTION_ASYNC); + + // PvPstats + PrepareStatement(CHAR_SEL_PVPSTATS_MAXID, "SELECT MAX(id) FROM pvpstats_battlegrounds", CONNECTION_SYNCH); + PrepareStatement(CHAR_INS_PVPSTATS_BATTLEGROUND, "INSERT INTO pvpstats_battlegrounds (id, winner_faction, bracket_id, type, date) VALUES (?, ?, ?, ?, NOW())", CONNECTION_ASYNC); + PrepareStatement(CHAR_INS_PVPSTATS_PLAYER, "INSERT INTO pvpstats_players (battleground_id, character_guid, score_killing_blows, score_deaths, score_honorable_kills, score_bonus_honor, score_damage_done, score_healing_done, attr_1, attr_2, attr_3, attr_4, attr_5) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); + } diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index 5accf57f132..e2a046ac6e1 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -561,6 +561,10 @@ enum CharacterDatabaseStatements CHAR_DEL_ITEMCONTAINER_MONEY, CHAR_INS_ITEMCONTAINER_MONEY, + CHAR_SEL_PVPSTATS_MAXID, + CHAR_INS_PVPSTATS_BATTLEGROUND, + CHAR_INS_PVPSTATS_PLAYER, + MAX_CHARACTERDATABASE_STATEMENTS }; diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index a6cdd2037b5..66141d1b297 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2028,6 +2028,14 @@ Battleground.QueueAnnouncer.Enable = 0 Battleground.QueueAnnouncer.PlayerOnly = 0 # +# Battleground.StoreStatistics.Enable +# Description: Store Battleground scores in the database. +# Default: 0 - (Disabled) +# 1 - (Enabled) + +Battleground.StoreStatistics.Enable = 0 + +# # Battleground.InvitationType # Description: Set Battleground invitation type. # Default: 0 - (Normal, Invite as much players to battlegrounds as queued, |