mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 15:40:45 +01:00
Line ending fix, sorry.
This commit is contained in:
@@ -1,60 +1,60 @@
|
||||
macro(get_WIN32_WINNT version)
|
||||
if (WIN32 AND CMAKE_SYSTEM_VERSION)
|
||||
set(ver ${CMAKE_SYSTEM_VERSION})
|
||||
string(REPLACE "." "" ver ${ver})
|
||||
string(REGEX REPLACE "([0-9])" "0\\1" ver ${ver})
|
||||
|
||||
set(${version} "0x${ver}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
if(WIN32)
|
||||
set(BOOST_DEBUG ON)
|
||||
if(DEFINED ENV{BOOST_ROOT})
|
||||
set(BOOST_ROOT $ENV{BOOST_ROOT})
|
||||
set(BOOST_LIBRARYDIR ${BOOST_ROOT}/lib${PLATFORM}-msvc-12.0)
|
||||
else()
|
||||
message(FATAL_ERROR "No BOOST_ROOT environment variable could be found! Please make sure it is set and the points to your Boost installation.")
|
||||
endif()
|
||||
|
||||
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()
|
||||
|
||||
find_package(Boost 1.49 REQUIRED system filesystem thread program_options)
|
||||
add_definitions(-DBOOST_DATE_TIME_NO_LIB)
|
||||
add_definitions(-DBOOST_REGEX_NO_LIB)
|
||||
add_definitions(-DBOOST_CHRONO_NO_LIB)
|
||||
|
||||
# Find if Boost was compiled in C++03 mode because it requires -DBOOST_NO_CXX11_SCOPED_ENUMS
|
||||
|
||||
include (CheckCXXSourceCompiles)
|
||||
|
||||
set(CMAKE_REQUIRED_INCLUDES ${Boost_INCLUDE_DIR})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})
|
||||
set(CMAKE_REQUIRED_FLAGS "-std=c++11")
|
||||
unset(boost_filesystem_copy_links_without_NO_SCOPED_ENUM CACHE)
|
||||
check_cxx_source_compiles("
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
int main() { boost::filesystem::copy_file(boost::filesystem::path(), boost::filesystem::path()); }"
|
||||
boost_filesystem_copy_links_without_NO_SCOPED_ENUM)
|
||||
unset(CMAKE_REQUIRED_INCLUDES CACHE)
|
||||
unset(CMAKE_REQUIRED_LIBRARIES CACHE)
|
||||
unset(CMAKE_REQUIRED_FLAGS CACHE)
|
||||
|
||||
if (NOT boost_filesystem_copy_links_without_NO_SCOPED_ENUM)
|
||||
if (Boost_VERSION LESS 105100) # 1.51
|
||||
add_definitions(-DBOOST_NO_SCOPED_ENUMS)
|
||||
else()
|
||||
add_definitions(-DBOOST_NO_CXX11_SCOPED_ENUMS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(Boost_FOUND)
|
||||
include_directories(${Boost_INCLUDE_DIRS})
|
||||
endif()
|
||||
macro(get_WIN32_WINNT version)
|
||||
if (WIN32 AND CMAKE_SYSTEM_VERSION)
|
||||
set(ver ${CMAKE_SYSTEM_VERSION})
|
||||
string(REPLACE "." "" ver ${ver})
|
||||
string(REGEX REPLACE "([0-9])" "0\\1" ver ${ver})
|
||||
|
||||
set(${version} "0x${ver}")
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
if(WIN32)
|
||||
set(BOOST_DEBUG ON)
|
||||
if(DEFINED ENV{BOOST_ROOT})
|
||||
set(BOOST_ROOT $ENV{BOOST_ROOT})
|
||||
set(BOOST_LIBRARYDIR ${BOOST_ROOT}/lib${PLATFORM}-msvc-12.0)
|
||||
else()
|
||||
message(FATAL_ERROR "No BOOST_ROOT environment variable could be found! Please make sure it is set and the points to your Boost installation.")
|
||||
endif()
|
||||
|
||||
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()
|
||||
|
||||
find_package(Boost 1.49 REQUIRED system filesystem thread program_options)
|
||||
add_definitions(-DBOOST_DATE_TIME_NO_LIB)
|
||||
add_definitions(-DBOOST_REGEX_NO_LIB)
|
||||
add_definitions(-DBOOST_CHRONO_NO_LIB)
|
||||
|
||||
# Find if Boost was compiled in C++03 mode because it requires -DBOOST_NO_CXX11_SCOPED_ENUMS
|
||||
|
||||
include (CheckCXXSourceCompiles)
|
||||
|
||||
set(CMAKE_REQUIRED_INCLUDES ${Boost_INCLUDE_DIR})
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${Boost_SYSTEM_LIBRARY} ${Boost_FILESYSTEM_LIBRARY})
|
||||
set(CMAKE_REQUIRED_FLAGS "-std=c++11")
|
||||
unset(boost_filesystem_copy_links_without_NO_SCOPED_ENUM CACHE)
|
||||
check_cxx_source_compiles("
|
||||
#include <boost/filesystem/path.hpp>
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
int main() { boost::filesystem::copy_file(boost::filesystem::path(), boost::filesystem::path()); }"
|
||||
boost_filesystem_copy_links_without_NO_SCOPED_ENUM)
|
||||
unset(CMAKE_REQUIRED_INCLUDES CACHE)
|
||||
unset(CMAKE_REQUIRED_LIBRARIES CACHE)
|
||||
unset(CMAKE_REQUIRED_FLAGS CACHE)
|
||||
|
||||
if (NOT boost_filesystem_copy_links_without_NO_SCOPED_ENUM)
|
||||
if (Boost_VERSION LESS 105100) # 1.51
|
||||
add_definitions(-DBOOST_NO_SCOPED_ENUMS)
|
||||
else()
|
||||
add_definitions(-DBOOST_NO_CXX11_SCOPED_ENUMS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(Boost_FOUND)
|
||||
include_directories(${Boost_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
@@ -1,3 +1,3 @@
|
||||
DELETE FROM `spell_script_names` WHERE `spell_id` = 38194;
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(38194, 'spell_talon_king_ikiss_blink');
|
||||
DELETE FROM `spell_script_names` WHERE `spell_id` = 38194;
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(38194, 'spell_talon_king_ikiss_blink');
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
-- SWP: Move Muru summons to database
|
||||
SET @MURU := 25741;
|
||||
DELETE FROM `creature_summon_groups` WHERE `summonerId` = @MURU AND `entry` IN (25798, 25799, 25744);
|
||||
INSERT INTO `creature_summon_groups` (`summonerId`, `summonerType`, `groupId`, `entry`, `position_x`, `position_y`, `position_z`, `orientation`, `summonType`, `summonTime`) VALUES
|
||||
(@MURU, 0, 0, 25799, 1780.16, 666.83, 71.19, 5.21, 5, 0), -- Shadowsword Fury Mage
|
||||
(@MURU, 0, 0, 25799, 1847.93, 600.30, 71.30, 2.57, 5, 0),
|
||||
(@MURU, 0, 0, 25798, 1779.97, 660.64, 71.19, 5.28, 5, 0), -- Shadowsword Berserker
|
||||
(@MURU, 0, 0, 25798, 1786.20, 661.01, 71.19, 4.51, 5, 0),
|
||||
(@MURU, 0, 0, 25798, 1845.17, 602.63, 71.28, 2.43, 5, 0),
|
||||
(@MURU, 0, 0, 25798, 1842.91, 599.93, 71.23, 2.44, 5, 0),
|
||||
(@MURU, 0, 1, 25744, 1819.90, 609.80, 69.74, 1.94, 5, 0), -- Darkfiend
|
||||
(@MURU, 0, 1, 25744, 1829.39, 617.89, 69.73, 2.61, 5, 0),
|
||||
(@MURU, 0, 1, 25744, 1801.98, 633.62, 69.74, 5.71, 5, 0),
|
||||
(@MURU, 0, 1, 25744, 1830.88, 629.99, 69.73, 3.52, 5, 0),
|
||||
(@MURU, 0, 1, 25744, 1800.38, 621.41, 69.74, 0.22, 5, 0),
|
||||
(@MURU, 0, 1, 25744, 1808.30, 612.45, 69.73, 1.02, 5, 0),
|
||||
(@MURU, 0, 1, 25744, 1823.90, 639.69, 69.74, 4.12, 5, 0),
|
||||
(@MURU, 0, 1, 25744, 1811.85, 640.46, 69.73, 4.97, 5, 0);
|
||||
-- SWP: Move Muru summons to database
|
||||
SET @MURU := 25741;
|
||||
DELETE FROM `creature_summon_groups` WHERE `summonerId` = @MURU AND `entry` IN (25798, 25799, 25744);
|
||||
INSERT INTO `creature_summon_groups` (`summonerId`, `summonerType`, `groupId`, `entry`, `position_x`, `position_y`, `position_z`, `orientation`, `summonType`, `summonTime`) VALUES
|
||||
(@MURU, 0, 0, 25799, 1780.16, 666.83, 71.19, 5.21, 5, 0), -- Shadowsword Fury Mage
|
||||
(@MURU, 0, 0, 25799, 1847.93, 600.30, 71.30, 2.57, 5, 0),
|
||||
(@MURU, 0, 0, 25798, 1779.97, 660.64, 71.19, 5.28, 5, 0), -- Shadowsword Berserker
|
||||
(@MURU, 0, 0, 25798, 1786.20, 661.01, 71.19, 4.51, 5, 0),
|
||||
(@MURU, 0, 0, 25798, 1845.17, 602.63, 71.28, 2.43, 5, 0),
|
||||
(@MURU, 0, 0, 25798, 1842.91, 599.93, 71.23, 2.44, 5, 0),
|
||||
(@MURU, 0, 1, 25744, 1819.90, 609.80, 69.74, 1.94, 5, 0), -- Darkfiend
|
||||
(@MURU, 0, 1, 25744, 1829.39, 617.89, 69.73, 2.61, 5, 0),
|
||||
(@MURU, 0, 1, 25744, 1801.98, 633.62, 69.74, 5.71, 5, 0),
|
||||
(@MURU, 0, 1, 25744, 1830.88, 629.99, 69.73, 3.52, 5, 0),
|
||||
(@MURU, 0, 1, 25744, 1800.38, 621.41, 69.74, 0.22, 5, 0),
|
||||
(@MURU, 0, 1, 25744, 1808.30, 612.45, 69.73, 1.02, 5, 0),
|
||||
(@MURU, 0, 1, 25744, 1823.90, 639.69, 69.74, 4.12, 5, 0),
|
||||
(@MURU, 0, 1, 25744, 1811.85, 640.46, 69.73, 4.97, 5, 0);
|
||||
|
||||
@@ -1 +1 @@
|
||||
UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=6 WHERE `entry` IN (34566, 35216, 35268, 35269, 35347, 35348, 35349, 35350, 35351, 35352, 35447, 35448, 35449, 35615, 35616) AND `item`=3;
|
||||
UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=6 WHERE `entry` IN (34566, 35216, 35268, 35269, 35347, 35348, 35349, 35350, 35351, 35352, 35447, 35448, 35449, 35615, 35616) AND `item`=3;
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
-- Remove no longer used script
|
||||
UPDATE `creature_template` SET `ScriptName` = '' WHERE `entry` = 17662; -- Broggok Poison Cloud
|
||||
-- Remove no longer used script
|
||||
UPDATE `creature_template` SET `ScriptName` = '' WHERE `entry` = 17662; -- Broggok Poison Cloud
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
-- Corrects unit_flags and sets AI for Illusion of Jandice Barov (11439)
|
||||
SET @ENTRY := 11439;
|
||||
UPDATE `creature_template` SET `ScriptName` = '', `AIName` = 'SmartAI', `unit_flags` = `unit_flags` &~4194304 WHERE `entry` = @ENTRY;
|
||||
DELETE FROM `smart_scripts` WHERE `entryorguid` = @ENTRY AND `source_type` = 0;
|
||||
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
|
||||
(@ENTRY, 0, 0, 0, 0, 0, 100, 2, 2000, 8000, 5000, 8000, 11, 15284, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, "Illusion of Jandice Barov - In Combat - Cast 'Cleave' (Normal Dungeon)");
|
||||
-- Corrects unit_flags and sets AI for Illusion of Jandice Barov (11439)
|
||||
SET @ENTRY := 11439;
|
||||
UPDATE `creature_template` SET `ScriptName` = '', `AIName` = 'SmartAI', `unit_flags` = `unit_flags` &~4194304 WHERE `entry` = @ENTRY;
|
||||
DELETE FROM `smart_scripts` WHERE `entryorguid` = @ENTRY AND `source_type` = 0;
|
||||
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
|
||||
(@ENTRY, 0, 0, 0, 0, 0, 100, 2, 2000, 8000, 5000, 8000, 11, 15284, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, "Illusion of Jandice Barov - In Combat - Cast 'Cleave' (Normal Dungeon)");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
DELETE FROM `spell_script_names` WHERE `spell_id` IN (27695, 27687);
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(27695, 'spell_kormok_summon_bone_mages'),
|
||||
(27687, 'spell_kormok_summon_bone_minions');
|
||||
DELETE FROM `spell_script_names` WHERE `spell_id` IN (27695, 27687);
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(27695, 'spell_kormok_summon_bone_mages'),
|
||||
(27687, 'spell_kormok_summon_bone_minions');
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
SET @ENTRY := 11136; -- Freed Soul
|
||||
UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE `entry` = @ENTRY;
|
||||
DELETE FROM `smart_scripts` WHERE `entryorguid` = @ENTRY AND `source_type` = 0;
|
||||
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
|
||||
(@ENTRY, 0, 0, 0, 11, 0, 100, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Freed Soul - On Respawn - Say Line 0');
|
||||
SET @ENTRY := 11136; -- Freed Soul
|
||||
UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE `entry` = @ENTRY;
|
||||
DELETE FROM `smart_scripts` WHERE `entryorguid` = @ENTRY AND `source_type` = 0;
|
||||
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
|
||||
(@ENTRY, 0, 0, 0, 11, 0, 100, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Freed Soul - On Respawn - Say Line 0');
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
SET @ENTRY := 25040; -- Greater Water Elemental
|
||||
UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE `entry` = @ENTRY;
|
||||
DELETE FROM `smart_scripts` WHERE `entryorguid` = @ENTRY AND `source_type` = 0;
|
||||
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
|
||||
(@ENTRY, 0, 1, 0, 0, 0, 100, 0, 3000, 3000, 5000, 5000, 11, 46983, 64, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 'Greater Water Elemental - In Combat CMC - Cast Waterbolt');
|
||||
|
||||
SET @ENTRY := 25040; -- Greater Water Elemental
|
||||
UPDATE `creature_template` SET `AIName` = 'SmartAI', `ScriptName` = '' WHERE `entry` = @ENTRY;
|
||||
DELETE FROM `smart_scripts` WHERE `entryorguid` = @ENTRY AND `source_type` = 0;
|
||||
INSERT INTO `smart_scripts` (`entryorguid`, `source_type`, `id`, `link`, `event_type`, `event_phase_mask`, `event_chance`, `event_flags`, `event_param1`, `event_param2`, `event_param3`, `event_param4`, `action_type`, `action_param1`, `action_param2`, `action_param3`, `action_param4`, `action_param5`, `action_param6`, `target_type`, `target_param1`, `target_param2`, `target_param3`, `target_x`, `target_y`, `target_z`, `target_o`, `comment`) VALUES
|
||||
(@ENTRY, 0, 1, 0, 0, 0, 100, 0, 3000, 3000, 5000, 5000, 11, 46983, 64, 0, 0, 0, 0, 5, 0, 0, 0, 0, 0, 0, 0, 'Greater Water Elemental - In Combat CMC - Cast Waterbolt');
|
||||
|
||||
|
||||
@@ -1 +1 @@
|
||||
UPDATE `conditions` SET `ConditionValue1` = 46 WHERE `SourceEntry` IN (63989, 63997, 63998) AND `SourceTypeOrReferenceId` = 18;
|
||||
UPDATE `conditions` SET `ConditionValue1` = 46 WHERE `SourceEntry` IN (63989, 63997, 63998) AND `SourceTypeOrReferenceId` = 18;
|
||||
|
||||
@@ -1 +1 @@
|
||||
UPDATE `creature_template` SET `ScriptName` = '' WHERE `entry` = 29920;
|
||||
UPDATE `creature_template` SET `ScriptName` = '' WHERE `entry` = 29920;
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
DELETE FROM `spell_script_names` WHERE `spell_id` = 48292;
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(48292, 'spell_gen_50pct_count_pct_from_max_hp');
|
||||
DELETE FROM `spell_script_names` WHERE `spell_id` = 48292;
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(48292, 'spell_gen_50pct_count_pct_from_max_hp');
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
DELETE FROM `achievement_criteria_data` WHERE `criteria_id` = 7361 AND `type` = 12;
|
||||
INSERT INTO `achievement_criteria_data`(`criteria_id`, `type`, `value1`, `value2`, `ScriptName`) VALUES
|
||||
(7361, 12, 1, 0, '');
|
||||
DELETE FROM `achievement_criteria_data` WHERE `criteria_id` = 7361 AND `type` = 12;
|
||||
INSERT INTO `achievement_criteria_data`(`criteria_id`, `type`, `value1`, `value2`, `ScriptName`) VALUES
|
||||
(7361, 12, 1, 0, '');
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
--
|
||||
DELETE FROM `spell_script_names` WHERE `spell_id` = 39238;
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(39238, 'spell_q10929_fumping');
|
||||
--
|
||||
DELETE FROM `spell_script_names` WHERE `spell_id` = 39238;
|
||||
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
|
||||
(39238, 'spell_q10929_fumping');
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
@@ -1,3 +1,3 @@
|
||||
-- Ungroup some improperly grouped texts and set their text range
|
||||
UPDATE `creature_text` SET `groupid` = 5, `TextRange` = 3 WHERE `entry` IN (16065, 16064, 30549, 16063) AND `groupid` = 1 AND `id` = 0;
|
||||
UPDATE `creature_text` SET `groupid` = 6, `TextRange` = 3, `id` = 0 WHERE `entry` IN (16065, 16064, 30549, 16063) AND `groupid` = 1 AND `id` = 1;
|
||||
UPDATE `creature_text` SET `groupid` = 6, `TextRange` = 3, `id` = 0 WHERE `entry` IN (16065, 16064, 30549, 16063) AND `groupid` = 1 AND `id` = 1;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
-- Replace the previously spawned chests with sniffed ones
|
||||
DELETE FROM `gameobject` WHERE `id` IN (185168, 185169) AND `guid` IN (20499, 20496);
|
||||
INSERT INTO `gameobject` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`, `VerifiedBuild`) VALUES
|
||||
(20496, 185168, 543, 3, 1, -1429.81, 1772.916, 82.0765, 5.044002, 0, 0, 0, 1, 7200, 255, 1, 19243), -- 185168 (Area: 3562)
|
||||
(20499, 185169, 543, 3, 1, -1429.81, 1772.916, 82.0765, 5.044002, 0, 0, 0, 1, 7200, 255, 1, 19243); -- 185169 (Area: 3562)
|
||||
-- Replace the previously spawned chests with sniffed ones
|
||||
DELETE FROM `gameobject` WHERE `id` IN (185168, 185169) AND `guid` IN (20499, 20496);
|
||||
INSERT INTO `gameobject` (`guid`, `id`, `map`, `spawnMask`, `phaseMask`, `position_x`, `position_y`, `position_z`, `orientation`, `rotation0`, `rotation1`, `rotation2`, `rotation3`, `spawntimesecs`, `animprogress`, `state`, `VerifiedBuild`) VALUES
|
||||
(20496, 185168, 543, 3, 1, -1429.81, 1772.916, 82.0765, 5.044002, 0, 0, 0, 1, 7200, 255, 1, 19243), -- 185168 (Area: 3562)
|
||||
(20499, 185169, 543, 3, 1, -1429.81, 1772.916, 82.0765, 5.044002, 0, 0, 0, 1, 7200, 255, 1, 19243); -- 185169 (Area: 3562)
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
--
|
||||
UPDATE `gameobject` SET `spawnMask` = 1 WHERE `guid` = 20496 AND `id` = 185168;
|
||||
UPDATE `gameobject` SET `spawnMask` = 2 WHERE `guid` = 20499 AND `id` = 185169;
|
||||
--
|
||||
UPDATE `gameobject` SET `spawnMask` = 1 WHERE `guid` = 20496 AND `id` = 185168;
|
||||
UPDATE `gameobject` SET `spawnMask` = 2 WHERE `guid` = 20499 AND `id` = 185169;
|
||||
|
||||
@@ -1,265 +1,265 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "RBAC.h"
|
||||
#include "AccountMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Log.h"
|
||||
|
||||
namespace rbac
|
||||
{
|
||||
|
||||
std::string GetDebugPermissionString(RBACPermissionContainer const& perms)
|
||||
{
|
||||
std::string str = "";
|
||||
if (!perms.empty())
|
||||
{
|
||||
std::ostringstream o;
|
||||
RBACPermissionContainer::const_iterator itr = perms.begin();
|
||||
o << (*itr);
|
||||
for (++itr; itr != perms.end(); ++itr)
|
||||
o << ", " << uint32(*itr);
|
||||
str = o.str();
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
RBACCommandResult RBACData::GrantPermission(uint32 permissionId, int32 realmId /* = 0*/)
|
||||
{
|
||||
// Check if permission Id exists
|
||||
RBACPermission const* perm = sAccountMgr->GetRBACPermission(permissionId);
|
||||
if (!perm)
|
||||
{
|
||||
TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission does not exists",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
return RBAC_ID_DOES_NOT_EXISTS;
|
||||
}
|
||||
|
||||
// Check if already added in denied list
|
||||
if (HasDeniedPermission(permissionId))
|
||||
{
|
||||
TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission in deny list",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
return RBAC_IN_DENIED_LIST;
|
||||
}
|
||||
|
||||
// Already added?
|
||||
if (HasGrantedPermission(permissionId))
|
||||
{
|
||||
TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission already granted",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
return RBAC_CANT_ADD_ALREADY_ADDED;
|
||||
}
|
||||
|
||||
AddGrantedPermission(permissionId);
|
||||
|
||||
// Do not save to db when loading data from DB (realmId = 0)
|
||||
if (realmId)
|
||||
{
|
||||
TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok and DB updated",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
SavePermission(permissionId, true, realmId);
|
||||
CalculateNewPermissions();
|
||||
}
|
||||
else
|
||||
TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
|
||||
return RBAC_OK;
|
||||
}
|
||||
|
||||
RBACCommandResult RBACData::DenyPermission(uint32 permissionId, int32 realmId /* = 0*/)
|
||||
{
|
||||
// Check if permission Id exists
|
||||
RBACPermission const* perm = sAccountMgr->GetRBACPermission(permissionId);
|
||||
if (!perm)
|
||||
{
|
||||
TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission does not exists",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
return RBAC_ID_DOES_NOT_EXISTS;
|
||||
}
|
||||
|
||||
// Check if already added in granted list
|
||||
if (HasGrantedPermission(permissionId))
|
||||
{
|
||||
TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission in grant list",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
return RBAC_IN_GRANTED_LIST;
|
||||
}
|
||||
|
||||
// Already added?
|
||||
if (HasDeniedPermission(permissionId))
|
||||
{
|
||||
TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission already denied",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
return RBAC_CANT_ADD_ALREADY_ADDED;
|
||||
}
|
||||
|
||||
AddDeniedPermission(permissionId);
|
||||
|
||||
// Do not save to db when loading data from DB (realmId = 0)
|
||||
if (realmId)
|
||||
{
|
||||
TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok and DB updated",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
SavePermission(permissionId, false, realmId);
|
||||
CalculateNewPermissions();
|
||||
}
|
||||
else
|
||||
TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
|
||||
return RBAC_OK;
|
||||
}
|
||||
|
||||
void RBACData::SavePermission(uint32 permission, bool granted, int32 realmId)
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_RBAC_ACCOUNT_PERMISSION);
|
||||
stmt->setUInt32(0, GetId());
|
||||
stmt->setUInt32(1, permission);
|
||||
stmt->setBool(2, granted);
|
||||
stmt->setInt32(3, realmId);
|
||||
LoginDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
RBACCommandResult RBACData::RevokePermission(uint32 permissionId, int32 realmId /* = 0*/)
|
||||
{
|
||||
// Check if it's present in any list
|
||||
if (!HasGrantedPermission(permissionId) && !HasDeniedPermission(permissionId))
|
||||
{
|
||||
TC_LOG_TRACE("rbac", "RBACData::RevokePermission [Id: %u Name: %s] (Permission %u, RealmId %d). Not granted or revoked",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
return RBAC_CANT_REVOKE_NOT_IN_LIST;
|
||||
}
|
||||
|
||||
RemoveGrantedPermission(permissionId);
|
||||
RemoveDeniedPermission(permissionId);
|
||||
|
||||
// Do not save to db when loading data from DB (realmId = 0)
|
||||
if (realmId)
|
||||
{
|
||||
TC_LOG_TRACE("rbac", "RBACData::RevokePermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok and DB updated",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_RBAC_ACCOUNT_PERMISSION);
|
||||
stmt->setUInt32(0, GetId());
|
||||
stmt->setUInt32(1, permissionId);
|
||||
stmt->setInt32(2, realmId);
|
||||
LoginDatabase.Execute(stmt);
|
||||
|
||||
CalculateNewPermissions();
|
||||
}
|
||||
else
|
||||
TC_LOG_TRACE("rbac", "RBACData::RevokePermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
|
||||
return RBAC_OK;
|
||||
}
|
||||
|
||||
void RBACData::LoadFromDB()
|
||||
{
|
||||
ClearData();
|
||||
|
||||
TC_LOG_DEBUG("rbac", "RBACData::LoadFromDB [Id: %u Name: %s]: Loading permissions", GetId(), GetName().c_str());
|
||||
// Load account permissions (granted and denied) that affect current realm
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_RBAC_ACCOUNT_PERMISSIONS);
|
||||
stmt->setUInt32(0, GetId());
|
||||
stmt->setInt32(1, GetRealmId());
|
||||
|
||||
PreparedQueryResult result = LoginDatabase.Query(stmt);
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
if (fields[1].GetBool())
|
||||
GrantPermission(fields[0].GetUInt32());
|
||||
else
|
||||
DenyPermission(fields[0].GetUInt32());
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
|
||||
// Add default permissions
|
||||
RBACPermissionContainer const& permissions = sAccountMgr->GetRBACDefaultPermissions(_secLevel);
|
||||
for (RBACPermissionContainer::const_iterator itr = permissions.begin(); itr != permissions.end(); ++itr)
|
||||
GrantPermission(*itr);
|
||||
|
||||
// Force calculation of permissions
|
||||
CalculateNewPermissions();
|
||||
}
|
||||
|
||||
void RBACData::CalculateNewPermissions()
|
||||
{
|
||||
TC_LOG_TRACE("rbac", "RBACData::CalculateNewPermissions [Id: %u Name: %s]", GetId(), GetName().c_str());
|
||||
|
||||
// Get the list of granted permissions
|
||||
_globalPerms = GetGrantedPermissions();
|
||||
ExpandPermissions(_globalPerms);
|
||||
RBACPermissionContainer revoked = GetDeniedPermissions();
|
||||
ExpandPermissions(revoked);
|
||||
RemovePermissions(_globalPerms, revoked);
|
||||
}
|
||||
|
||||
void RBACData::AddPermissions(RBACPermissionContainer const& permsFrom, RBACPermissionContainer& permsTo)
|
||||
{
|
||||
for (RBACPermissionContainer::const_iterator itr = permsFrom.begin(); itr != permsFrom.end(); ++itr)
|
||||
permsTo.insert(*itr);
|
||||
}
|
||||
|
||||
void RBACData::RemovePermissions(RBACPermissionContainer const& permsFrom, RBACPermissionContainer& permsTo)
|
||||
{
|
||||
for (RBACPermissionContainer::const_iterator itr = permsFrom.begin(); itr != permsFrom.end(); ++itr)
|
||||
permsTo.erase(*itr);
|
||||
}
|
||||
|
||||
void RBACData::ExpandPermissions(RBACPermissionContainer& permissions)
|
||||
{
|
||||
RBACPermissionContainer toCheck = permissions;
|
||||
permissions.clear();
|
||||
|
||||
while (!toCheck.empty())
|
||||
{
|
||||
// remove the permission from original list
|
||||
uint32 permissionId = *toCheck.begin();
|
||||
toCheck.erase(toCheck.begin());
|
||||
|
||||
RBACPermission const* permission = sAccountMgr->GetRBACPermission(permissionId);
|
||||
if (!permission)
|
||||
continue;
|
||||
|
||||
// insert into the final list (expanded list)
|
||||
permissions.insert(permissionId);
|
||||
|
||||
// add all linked permissions (that are not already expanded) to the list of permissions to be checked
|
||||
RBACPermissionContainer const& linkedPerms = permission->GetLinkedPermissions();
|
||||
for (RBACPermissionContainer::const_iterator itr = linkedPerms.begin(); itr != linkedPerms.end(); ++itr)
|
||||
if (permissions.find(*itr) == permissions.end())
|
||||
toCheck.insert(*itr);
|
||||
}
|
||||
|
||||
TC_LOG_DEBUG("rbac", "RBACData::ExpandPermissions: Expanded: %s", GetDebugPermissionString(permissions).c_str());
|
||||
}
|
||||
|
||||
void RBACData::ClearData()
|
||||
{
|
||||
_grantedPerms.clear();
|
||||
_deniedPerms.clear();
|
||||
_globalPerms.clear();
|
||||
}
|
||||
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "RBAC.h"
|
||||
#include "AccountMgr.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Log.h"
|
||||
|
||||
namespace rbac
|
||||
{
|
||||
|
||||
std::string GetDebugPermissionString(RBACPermissionContainer const& perms)
|
||||
{
|
||||
std::string str = "";
|
||||
if (!perms.empty())
|
||||
{
|
||||
std::ostringstream o;
|
||||
RBACPermissionContainer::const_iterator itr = perms.begin();
|
||||
o << (*itr);
|
||||
for (++itr; itr != perms.end(); ++itr)
|
||||
o << ", " << uint32(*itr);
|
||||
str = o.str();
|
||||
}
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
RBACCommandResult RBACData::GrantPermission(uint32 permissionId, int32 realmId /* = 0*/)
|
||||
{
|
||||
// Check if permission Id exists
|
||||
RBACPermission const* perm = sAccountMgr->GetRBACPermission(permissionId);
|
||||
if (!perm)
|
||||
{
|
||||
TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission does not exists",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
return RBAC_ID_DOES_NOT_EXISTS;
|
||||
}
|
||||
|
||||
// Check if already added in denied list
|
||||
if (HasDeniedPermission(permissionId))
|
||||
{
|
||||
TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission in deny list",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
return RBAC_IN_DENIED_LIST;
|
||||
}
|
||||
|
||||
// Already added?
|
||||
if (HasGrantedPermission(permissionId))
|
||||
{
|
||||
TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission already granted",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
return RBAC_CANT_ADD_ALREADY_ADDED;
|
||||
}
|
||||
|
||||
AddGrantedPermission(permissionId);
|
||||
|
||||
// Do not save to db when loading data from DB (realmId = 0)
|
||||
if (realmId)
|
||||
{
|
||||
TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok and DB updated",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
SavePermission(permissionId, true, realmId);
|
||||
CalculateNewPermissions();
|
||||
}
|
||||
else
|
||||
TC_LOG_TRACE("rbac", "RBACData::GrantPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
|
||||
return RBAC_OK;
|
||||
}
|
||||
|
||||
RBACCommandResult RBACData::DenyPermission(uint32 permissionId, int32 realmId /* = 0*/)
|
||||
{
|
||||
// Check if permission Id exists
|
||||
RBACPermission const* perm = sAccountMgr->GetRBACPermission(permissionId);
|
||||
if (!perm)
|
||||
{
|
||||
TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission does not exists",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
return RBAC_ID_DOES_NOT_EXISTS;
|
||||
}
|
||||
|
||||
// Check if already added in granted list
|
||||
if (HasGrantedPermission(permissionId))
|
||||
{
|
||||
TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission in grant list",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
return RBAC_IN_GRANTED_LIST;
|
||||
}
|
||||
|
||||
// Already added?
|
||||
if (HasDeniedPermission(permissionId))
|
||||
{
|
||||
TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Permission already denied",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
return RBAC_CANT_ADD_ALREADY_ADDED;
|
||||
}
|
||||
|
||||
AddDeniedPermission(permissionId);
|
||||
|
||||
// Do not save to db when loading data from DB (realmId = 0)
|
||||
if (realmId)
|
||||
{
|
||||
TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok and DB updated",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
SavePermission(permissionId, false, realmId);
|
||||
CalculateNewPermissions();
|
||||
}
|
||||
else
|
||||
TC_LOG_TRACE("rbac", "RBACData::DenyPermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
|
||||
return RBAC_OK;
|
||||
}
|
||||
|
||||
void RBACData::SavePermission(uint32 permission, bool granted, int32 realmId)
|
||||
{
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_RBAC_ACCOUNT_PERMISSION);
|
||||
stmt->setUInt32(0, GetId());
|
||||
stmt->setUInt32(1, permission);
|
||||
stmt->setBool(2, granted);
|
||||
stmt->setInt32(3, realmId);
|
||||
LoginDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
RBACCommandResult RBACData::RevokePermission(uint32 permissionId, int32 realmId /* = 0*/)
|
||||
{
|
||||
// Check if it's present in any list
|
||||
if (!HasGrantedPermission(permissionId) && !HasDeniedPermission(permissionId))
|
||||
{
|
||||
TC_LOG_TRACE("rbac", "RBACData::RevokePermission [Id: %u Name: %s] (Permission %u, RealmId %d). Not granted or revoked",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
return RBAC_CANT_REVOKE_NOT_IN_LIST;
|
||||
}
|
||||
|
||||
RemoveGrantedPermission(permissionId);
|
||||
RemoveDeniedPermission(permissionId);
|
||||
|
||||
// Do not save to db when loading data from DB (realmId = 0)
|
||||
if (realmId)
|
||||
{
|
||||
TC_LOG_TRACE("rbac", "RBACData::RevokePermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok and DB updated",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_RBAC_ACCOUNT_PERMISSION);
|
||||
stmt->setUInt32(0, GetId());
|
||||
stmt->setUInt32(1, permissionId);
|
||||
stmt->setInt32(2, realmId);
|
||||
LoginDatabase.Execute(stmt);
|
||||
|
||||
CalculateNewPermissions();
|
||||
}
|
||||
else
|
||||
TC_LOG_TRACE("rbac", "RBACData::RevokePermission [Id: %u Name: %s] (Permission %u, RealmId %d). Ok",
|
||||
GetId(), GetName().c_str(), permissionId, realmId);
|
||||
|
||||
return RBAC_OK;
|
||||
}
|
||||
|
||||
void RBACData::LoadFromDB()
|
||||
{
|
||||
ClearData();
|
||||
|
||||
TC_LOG_DEBUG("rbac", "RBACData::LoadFromDB [Id: %u Name: %s]: Loading permissions", GetId(), GetName().c_str());
|
||||
// Load account permissions (granted and denied) that affect current realm
|
||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_RBAC_ACCOUNT_PERMISSIONS);
|
||||
stmt->setUInt32(0, GetId());
|
||||
stmt->setInt32(1, GetRealmId());
|
||||
|
||||
PreparedQueryResult result = LoginDatabase.Query(stmt);
|
||||
if (result)
|
||||
{
|
||||
do
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
if (fields[1].GetBool())
|
||||
GrantPermission(fields[0].GetUInt32());
|
||||
else
|
||||
DenyPermission(fields[0].GetUInt32());
|
||||
}
|
||||
while (result->NextRow());
|
||||
}
|
||||
|
||||
// Add default permissions
|
||||
RBACPermissionContainer const& permissions = sAccountMgr->GetRBACDefaultPermissions(_secLevel);
|
||||
for (RBACPermissionContainer::const_iterator itr = permissions.begin(); itr != permissions.end(); ++itr)
|
||||
GrantPermission(*itr);
|
||||
|
||||
// Force calculation of permissions
|
||||
CalculateNewPermissions();
|
||||
}
|
||||
|
||||
void RBACData::CalculateNewPermissions()
|
||||
{
|
||||
TC_LOG_TRACE("rbac", "RBACData::CalculateNewPermissions [Id: %u Name: %s]", GetId(), GetName().c_str());
|
||||
|
||||
// Get the list of granted permissions
|
||||
_globalPerms = GetGrantedPermissions();
|
||||
ExpandPermissions(_globalPerms);
|
||||
RBACPermissionContainer revoked = GetDeniedPermissions();
|
||||
ExpandPermissions(revoked);
|
||||
RemovePermissions(_globalPerms, revoked);
|
||||
}
|
||||
|
||||
void RBACData::AddPermissions(RBACPermissionContainer const& permsFrom, RBACPermissionContainer& permsTo)
|
||||
{
|
||||
for (RBACPermissionContainer::const_iterator itr = permsFrom.begin(); itr != permsFrom.end(); ++itr)
|
||||
permsTo.insert(*itr);
|
||||
}
|
||||
|
||||
void RBACData::RemovePermissions(RBACPermissionContainer const& permsFrom, RBACPermissionContainer& permsTo)
|
||||
{
|
||||
for (RBACPermissionContainer::const_iterator itr = permsFrom.begin(); itr != permsFrom.end(); ++itr)
|
||||
permsTo.erase(*itr);
|
||||
}
|
||||
|
||||
void RBACData::ExpandPermissions(RBACPermissionContainer& permissions)
|
||||
{
|
||||
RBACPermissionContainer toCheck = permissions;
|
||||
permissions.clear();
|
||||
|
||||
while (!toCheck.empty())
|
||||
{
|
||||
// remove the permission from original list
|
||||
uint32 permissionId = *toCheck.begin();
|
||||
toCheck.erase(toCheck.begin());
|
||||
|
||||
RBACPermission const* permission = sAccountMgr->GetRBACPermission(permissionId);
|
||||
if (!permission)
|
||||
continue;
|
||||
|
||||
// insert into the final list (expanded list)
|
||||
permissions.insert(permissionId);
|
||||
|
||||
// add all linked permissions (that are not already expanded) to the list of permissions to be checked
|
||||
RBACPermissionContainer const& linkedPerms = permission->GetLinkedPermissions();
|
||||
for (RBACPermissionContainer::const_iterator itr = linkedPerms.begin(); itr != linkedPerms.end(); ++itr)
|
||||
if (permissions.find(*itr) == permissions.end())
|
||||
toCheck.insert(*itr);
|
||||
}
|
||||
|
||||
TC_LOG_DEBUG("rbac", "RBACData::ExpandPermissions: Expanded: %s", GetDebugPermissionString(permissions).c_str());
|
||||
}
|
||||
|
||||
void RBACData::ClearData()
|
||||
{
|
||||
_grantedPerms.clear();
|
||||
_deniedPerms.clear();
|
||||
_globalPerms.clear();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -173,9 +173,9 @@ void WorldSession::HandleQueryCorpseLocation(WorldPackets::Query::QueryCorpseLoc
|
||||
|
||||
if (!corpse)
|
||||
{
|
||||
WorldPackets::Query::CorpseLocation packet;
|
||||
packet.Valid = false; // corpse not found
|
||||
SendPacket(packet.Write());
|
||||
WorldPackets::Query::CorpseLocation packet;
|
||||
packet.Valid = false; // corpse not found
|
||||
SendPacket(packet.Write());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -205,12 +205,12 @@ void WorldSession::HandleQueryCorpseLocation(WorldPackets::Query::QueryCorpseLoc
|
||||
}
|
||||
}
|
||||
|
||||
WorldPackets::Query::CorpseLocation packet;
|
||||
packet.Valid = true;
|
||||
packet.MapID = corpseMapID;
|
||||
packet.ActualMapID = mapID;
|
||||
packet.Position = G3D::Vector3(x, y, z);
|
||||
packet.Transport = ObjectGuid::Empty; // NYI
|
||||
WorldPackets::Query::CorpseLocation packet;
|
||||
packet.Valid = true;
|
||||
packet.MapID = corpseMapID;
|
||||
packet.ActualMapID = mapID;
|
||||
packet.Position = G3D::Vector3(x, y, z);
|
||||
packet.Transport = ObjectGuid::Empty; // NYI
|
||||
SendPacket(packet.Write());
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ WorldPacket const* WorldPackets::Loot::LootResponse::Write()
|
||||
_worldPacket << Coins;
|
||||
_worldPacket << uint32(Items.size());
|
||||
_worldPacket << uint32(Currencies.size());
|
||||
|
||||
|
||||
for (LootItem const& item : Items)
|
||||
{
|
||||
_worldPacket.WriteBits(item.Type, 2);
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace WorldPackets
|
||||
ObjectGuid Owner;
|
||||
uint8 LootListID = 0;
|
||||
};
|
||||
|
||||
|
||||
class LootRelease final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
@@ -114,7 +114,7 @@ namespace WorldPackets
|
||||
|
||||
ObjectGuid Unit;
|
||||
};
|
||||
|
||||
|
||||
class LootMoney final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
@@ -122,7 +122,7 @@ namespace WorldPackets
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
|
||||
class LootMoneyNotify final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
@@ -133,7 +133,7 @@ namespace WorldPackets
|
||||
uint32 Money = 0;
|
||||
bool SoleLooter = false;
|
||||
};
|
||||
|
||||
|
||||
class CoinRemoved final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -1,261 +1,261 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "MiscPackets.h"
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::BindPointUpdate::Write()
|
||||
{
|
||||
_worldPacket << float(BindPosition.x);
|
||||
_worldPacket << float(BindPosition.y);
|
||||
_worldPacket << float(BindPosition.z);
|
||||
_worldPacket << uint32(BindMapID);
|
||||
_worldPacket << uint32(BindAreaID);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::InvalidatePlayer::Write()
|
||||
{
|
||||
_worldPacket << Guid;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::LoginSetTimeSpeed::Write()
|
||||
{
|
||||
_worldPacket.AppendPackedTime(ServerTime);
|
||||
_worldPacket.AppendPackedTime(GameTime);
|
||||
_worldPacket << float(NewSpeed);
|
||||
_worldPacket << uint32(ServerTimeHolidayOffset);
|
||||
_worldPacket << uint32(GameTimeHolidayOffset);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::SetCurrency::Write()
|
||||
{
|
||||
_worldPacket << uint32(Type);
|
||||
_worldPacket << uint32(Quantity);
|
||||
_worldPacket << uint32(Flags);
|
||||
_worldPacket.WriteBit(WeeklyQuantity.HasValue);
|
||||
_worldPacket.WriteBit(TrackedQuantity.HasValue);
|
||||
_worldPacket.WriteBit(SuppressChatLog);
|
||||
|
||||
if (WeeklyQuantity.HasValue)
|
||||
_worldPacket << uint32(WeeklyQuantity.Value);
|
||||
|
||||
if (TrackedQuantity.HasValue)
|
||||
_worldPacket << uint32(TrackedQuantity.Value);
|
||||
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::SetSelection::Read()
|
||||
{
|
||||
_worldPacket >> Selection;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::SetupCurrency::Write()
|
||||
{
|
||||
_worldPacket << uint32(Data.size());
|
||||
|
||||
for (Record const& data : Data)
|
||||
{
|
||||
_worldPacket << uint32(data.Type);
|
||||
_worldPacket << uint32(data.Quantity);
|
||||
|
||||
_worldPacket.WriteBit(data.WeeklyQuantity.HasValue);
|
||||
_worldPacket.WriteBit(data.MaxWeeklyQuantity.HasValue);
|
||||
_worldPacket.WriteBit(data.TrackedQuantity.HasValue);
|
||||
|
||||
_worldPacket.WriteBits(data.Flags, 5);
|
||||
|
||||
if (data.WeeklyQuantity.HasValue)
|
||||
_worldPacket << uint32(data.WeeklyQuantity.Value);
|
||||
if (data.MaxWeeklyQuantity.HasValue)
|
||||
_worldPacket << uint32(data.MaxWeeklyQuantity.Value);
|
||||
if (data.TrackedQuantity.HasValue)
|
||||
_worldPacket << uint32(data.TrackedQuantity.Value);
|
||||
}
|
||||
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::ViolenceLevel::Read()
|
||||
{
|
||||
_worldPacket >> ViolenceLvl;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::TimeSyncRequest::Write()
|
||||
{
|
||||
_worldPacket << SequenceIndex;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::TimeSyncResponse::Read()
|
||||
{
|
||||
_worldPacket >> SequenceIndex;
|
||||
_worldPacket >> ClientTime;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::UITime::Write()
|
||||
{
|
||||
_worldPacket << Time;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::TriggerMovie::Write()
|
||||
{
|
||||
_worldPacket << uint32(MovieID);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
WorldPacket const* WorldPackets::Misc::TriggerCinematic::Write()
|
||||
{
|
||||
_worldPacket << uint32(CinematicID);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::TutorialFlags::Write()
|
||||
{
|
||||
_worldPacket.append(TutorialData, MAX_ACCOUNT_TUTORIAL_VALUES);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::TutorialSetFlag::Read()
|
||||
{
|
||||
Action = _worldPacket.ReadBits(2);
|
||||
_worldPacket >> TutorialBit;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::WorldServerInfo::Write()
|
||||
{
|
||||
_worldPacket << uint32(DifficultyID);
|
||||
_worldPacket << uint8(IsTournamentRealm);
|
||||
_worldPacket << uint32(WeeklyReset);
|
||||
_worldPacket.WriteBit(RestrictedAccountMaxLevel.HasValue);
|
||||
_worldPacket.WriteBit(RestrictedAccountMaxMoney.HasValue);
|
||||
_worldPacket.WriteBit(IneligibleForLootMask.HasValue);
|
||||
_worldPacket.WriteBit(InstanceGroupSize.HasValue);
|
||||
|
||||
if (RestrictedAccountMaxLevel.HasValue)
|
||||
_worldPacket << uint32(RestrictedAccountMaxLevel.Value);
|
||||
|
||||
if (RestrictedAccountMaxMoney.HasValue)
|
||||
_worldPacket << uint32(RestrictedAccountMaxMoney.Value);
|
||||
|
||||
if (IneligibleForLootMask.HasValue)
|
||||
_worldPacket << uint32(IneligibleForLootMask.Value);
|
||||
|
||||
if (InstanceGroupSize.HasValue)
|
||||
_worldPacket << uint32(InstanceGroupSize.Value);
|
||||
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::AreaTrigger::Read()
|
||||
{
|
||||
_worldPacket >> AreaTriggerID;
|
||||
Entered = _worldPacket.ReadBit();
|
||||
FromClient = _worldPacket.ReadBit();
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::SetDungeonDifficulty::Read()
|
||||
{
|
||||
_worldPacket >> DifficultyID;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::SetRaidDifficulty::Read()
|
||||
{
|
||||
_worldPacket >> DifficultyID;
|
||||
_worldPacket >> Legacy;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::DungeonDifficultySet::Write()
|
||||
{
|
||||
_worldPacket << int32(DifficultyID);
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::RaidDifficultySet::Write()
|
||||
{
|
||||
_worldPacket << int32(DifficultyID);
|
||||
_worldPacket << uint8(Legacy);
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::CorpseReclaimDelay::Write()
|
||||
{
|
||||
_worldPacket << Remaining;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::DeathReleaseLoc::Write()
|
||||
{
|
||||
_worldPacket << MapID;
|
||||
_worldPacket << float(Loc.x);
|
||||
_worldPacket << float(Loc.y);
|
||||
_worldPacket << float(Loc.z);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::PreRessurect::Write()
|
||||
{
|
||||
_worldPacket << PlayerGUID;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::ReclaimCorpse::Read()
|
||||
{
|
||||
_worldPacket >> CorpseGUID;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::RepopRequest::Read()
|
||||
{
|
||||
CheckInstance = _worldPacket.ReadBit();
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::RequestCemeteryListResponse::Write()
|
||||
{
|
||||
_worldPacket.WriteBit(IsGossipTriggered);
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
_worldPacket << uint32(CemeteryID.size());
|
||||
for (uint32 cemetery : CemeteryID)
|
||||
_worldPacket << cemetery;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::ResurrectResponse::Read()
|
||||
{
|
||||
_worldPacket >> Resurrecter;
|
||||
_worldPacket >> Response;
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "MiscPackets.h"
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::BindPointUpdate::Write()
|
||||
{
|
||||
_worldPacket << float(BindPosition.x);
|
||||
_worldPacket << float(BindPosition.y);
|
||||
_worldPacket << float(BindPosition.z);
|
||||
_worldPacket << uint32(BindMapID);
|
||||
_worldPacket << uint32(BindAreaID);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::InvalidatePlayer::Write()
|
||||
{
|
||||
_worldPacket << Guid;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::LoginSetTimeSpeed::Write()
|
||||
{
|
||||
_worldPacket.AppendPackedTime(ServerTime);
|
||||
_worldPacket.AppendPackedTime(GameTime);
|
||||
_worldPacket << float(NewSpeed);
|
||||
_worldPacket << uint32(ServerTimeHolidayOffset);
|
||||
_worldPacket << uint32(GameTimeHolidayOffset);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::SetCurrency::Write()
|
||||
{
|
||||
_worldPacket << uint32(Type);
|
||||
_worldPacket << uint32(Quantity);
|
||||
_worldPacket << uint32(Flags);
|
||||
_worldPacket.WriteBit(WeeklyQuantity.HasValue);
|
||||
_worldPacket.WriteBit(TrackedQuantity.HasValue);
|
||||
_worldPacket.WriteBit(SuppressChatLog);
|
||||
|
||||
if (WeeklyQuantity.HasValue)
|
||||
_worldPacket << uint32(WeeklyQuantity.Value);
|
||||
|
||||
if (TrackedQuantity.HasValue)
|
||||
_worldPacket << uint32(TrackedQuantity.Value);
|
||||
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::SetSelection::Read()
|
||||
{
|
||||
_worldPacket >> Selection;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::SetupCurrency::Write()
|
||||
{
|
||||
_worldPacket << uint32(Data.size());
|
||||
|
||||
for (Record const& data : Data)
|
||||
{
|
||||
_worldPacket << uint32(data.Type);
|
||||
_worldPacket << uint32(data.Quantity);
|
||||
|
||||
_worldPacket.WriteBit(data.WeeklyQuantity.HasValue);
|
||||
_worldPacket.WriteBit(data.MaxWeeklyQuantity.HasValue);
|
||||
_worldPacket.WriteBit(data.TrackedQuantity.HasValue);
|
||||
|
||||
_worldPacket.WriteBits(data.Flags, 5);
|
||||
|
||||
if (data.WeeklyQuantity.HasValue)
|
||||
_worldPacket << uint32(data.WeeklyQuantity.Value);
|
||||
if (data.MaxWeeklyQuantity.HasValue)
|
||||
_worldPacket << uint32(data.MaxWeeklyQuantity.Value);
|
||||
if (data.TrackedQuantity.HasValue)
|
||||
_worldPacket << uint32(data.TrackedQuantity.Value);
|
||||
}
|
||||
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::ViolenceLevel::Read()
|
||||
{
|
||||
_worldPacket >> ViolenceLvl;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::TimeSyncRequest::Write()
|
||||
{
|
||||
_worldPacket << SequenceIndex;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::TimeSyncResponse::Read()
|
||||
{
|
||||
_worldPacket >> SequenceIndex;
|
||||
_worldPacket >> ClientTime;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::UITime::Write()
|
||||
{
|
||||
_worldPacket << Time;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::TriggerMovie::Write()
|
||||
{
|
||||
_worldPacket << uint32(MovieID);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
WorldPacket const* WorldPackets::Misc::TriggerCinematic::Write()
|
||||
{
|
||||
_worldPacket << uint32(CinematicID);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::TutorialFlags::Write()
|
||||
{
|
||||
_worldPacket.append(TutorialData, MAX_ACCOUNT_TUTORIAL_VALUES);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::TutorialSetFlag::Read()
|
||||
{
|
||||
Action = _worldPacket.ReadBits(2);
|
||||
_worldPacket >> TutorialBit;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::WorldServerInfo::Write()
|
||||
{
|
||||
_worldPacket << uint32(DifficultyID);
|
||||
_worldPacket << uint8(IsTournamentRealm);
|
||||
_worldPacket << uint32(WeeklyReset);
|
||||
_worldPacket.WriteBit(RestrictedAccountMaxLevel.HasValue);
|
||||
_worldPacket.WriteBit(RestrictedAccountMaxMoney.HasValue);
|
||||
_worldPacket.WriteBit(IneligibleForLootMask.HasValue);
|
||||
_worldPacket.WriteBit(InstanceGroupSize.HasValue);
|
||||
|
||||
if (RestrictedAccountMaxLevel.HasValue)
|
||||
_worldPacket << uint32(RestrictedAccountMaxLevel.Value);
|
||||
|
||||
if (RestrictedAccountMaxMoney.HasValue)
|
||||
_worldPacket << uint32(RestrictedAccountMaxMoney.Value);
|
||||
|
||||
if (IneligibleForLootMask.HasValue)
|
||||
_worldPacket << uint32(IneligibleForLootMask.Value);
|
||||
|
||||
if (InstanceGroupSize.HasValue)
|
||||
_worldPacket << uint32(InstanceGroupSize.Value);
|
||||
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::AreaTrigger::Read()
|
||||
{
|
||||
_worldPacket >> AreaTriggerID;
|
||||
Entered = _worldPacket.ReadBit();
|
||||
FromClient = _worldPacket.ReadBit();
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::SetDungeonDifficulty::Read()
|
||||
{
|
||||
_worldPacket >> DifficultyID;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::SetRaidDifficulty::Read()
|
||||
{
|
||||
_worldPacket >> DifficultyID;
|
||||
_worldPacket >> Legacy;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::DungeonDifficultySet::Write()
|
||||
{
|
||||
_worldPacket << int32(DifficultyID);
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::RaidDifficultySet::Write()
|
||||
{
|
||||
_worldPacket << int32(DifficultyID);
|
||||
_worldPacket << uint8(Legacy);
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::CorpseReclaimDelay::Write()
|
||||
{
|
||||
_worldPacket << Remaining;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::DeathReleaseLoc::Write()
|
||||
{
|
||||
_worldPacket << MapID;
|
||||
_worldPacket << float(Loc.x);
|
||||
_worldPacket << float(Loc.y);
|
||||
_worldPacket << float(Loc.z);
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::PreRessurect::Write()
|
||||
{
|
||||
_worldPacket << PlayerGUID;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::ReclaimCorpse::Read()
|
||||
{
|
||||
_worldPacket >> CorpseGUID;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::RepopRequest::Read()
|
||||
{
|
||||
CheckInstance = _worldPacket.ReadBit();
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Misc::RequestCemeteryListResponse::Write()
|
||||
{
|
||||
_worldPacket.WriteBit(IsGossipTriggered);
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
_worldPacket << uint32(CemeteryID.size());
|
||||
for (uint32 cemetery : CemeteryID)
|
||||
_worldPacket << cemetery;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Misc::ResurrectResponse::Read()
|
||||
{
|
||||
_worldPacket >> Resurrecter;
|
||||
_worldPacket >> Response;
|
||||
}
|
||||
|
||||
@@ -1,366 +1,366 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MiscPackets_h__
|
||||
#define MiscPackets_h__
|
||||
|
||||
#include "Packet.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "WorldSession.h"
|
||||
#include "G3D/Vector3.h"
|
||||
#include "Object.h"
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
namespace Misc
|
||||
{
|
||||
class BindPointUpdate final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
BindPointUpdate() : ServerPacket(SMSG_BINDPOINTUPDATE, 20) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 BindMapID = MAPID_INVALID;
|
||||
G3D::Vector3 BindPosition;
|
||||
uint32 BindAreaID = 0;
|
||||
};
|
||||
|
||||
class InvalidatePlayer final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
InvalidatePlayer() : ServerPacket(SMSG_INVALIDATE_PLAYER, 18) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
ObjectGuid Guid;
|
||||
};
|
||||
|
||||
class LoginSetTimeSpeed final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
LoginSetTimeSpeed() : ServerPacket(SMSG_LOGIN_SETTIMESPEED, 20) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
float NewSpeed = 0.0f;
|
||||
int32 ServerTimeHolidayOffset = 0;
|
||||
uint32 GameTime = 0;
|
||||
uint32 ServerTime = 0;
|
||||
int32 GameTimeHolidayOffset = 0;
|
||||
};
|
||||
|
||||
class SetCurrency final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
SetCurrency() : ServerPacket(SMSG_SET_CURRENCY, 12) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
bool SuppressChatLog = false;
|
||||
Optional<int32> TrackedQuantity;
|
||||
int32 Quantity = 0;
|
||||
uint32 Flags = 0;
|
||||
int32 Type = 0;
|
||||
Optional<int32> WeeklyQuantity;
|
||||
};
|
||||
|
||||
class SetSelection final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
SetSelection(WorldPacket&& packet) : ClientPacket(CMSG_SET_SELECTION, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid Selection; ///< Target
|
||||
};
|
||||
|
||||
class SetupCurrency final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
struct Record
|
||||
{
|
||||
int32 Type = 0; // ID from CurrencyTypes.dbc
|
||||
int32 Quantity = 0;
|
||||
Optional<int32> WeeklyQuantity; // Currency count obtained this Week.
|
||||
Optional<int32> MaxWeeklyQuantity; // Weekly Currency cap.
|
||||
Optional<int32> TrackedQuantity;
|
||||
uint8 Flags = 0; // 0 = none,
|
||||
};
|
||||
|
||||
SetupCurrency() : ServerPacket(SMSG_SETUP_CURRENCY, 22) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
std::vector<Record> Data;
|
||||
};
|
||||
|
||||
class ViolenceLevel final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
ViolenceLevel(WorldPacket&& packet) : ClientPacket(CMSG_VIOLENCE_LEVEL, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
int8 ViolenceLvl = -1; ///< 0 - no combat effects, 1 - display some combat effects, 2 - blood, 3 - bloody, 4 - bloodier, 5 - bloodiest
|
||||
};
|
||||
|
||||
class TimeSyncRequest final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
TimeSyncRequest() : ServerPacket(SMSG_TIME_SYNC_REQ, 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 SequenceIndex = 0;
|
||||
};
|
||||
|
||||
class TimeSyncResponse final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
TimeSyncResponse(WorldPacket&& packet) : ClientPacket(CMSG_TIME_SYNC_RESPONSE, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
uint32 ClientTime = 0; // Client ticks in ms
|
||||
uint32 SequenceIndex = 0; // Same index as in request
|
||||
};
|
||||
|
||||
class TriggerCinematic final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
TriggerCinematic() : ServerPacket(SMSG_TRIGGER_CINEMATIC, 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 CinematicID = 0;
|
||||
};
|
||||
|
||||
class TriggerMovie final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
TriggerMovie() : ServerPacket(SMSG_TRIGGER_MOVIE, 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 MovieID = 0;
|
||||
};
|
||||
|
||||
class UITime final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
UITime() : ServerPacket(SMSG_WORLD_STATE_UI_TIMER_UPDATE, 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 Time = 0;
|
||||
};
|
||||
|
||||
class TutorialFlags : public ServerPacket
|
||||
{
|
||||
public:
|
||||
TutorialFlags() : ServerPacket(SMSG_TUTORIAL_FLAGS, 32)
|
||||
{
|
||||
std::memset(TutorialData, 0, sizeof(TutorialData));
|
||||
}
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 TutorialData[MAX_ACCOUNT_TUTORIAL_VALUES];
|
||||
};
|
||||
|
||||
class TutorialSetFlag final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
TutorialSetFlag(WorldPacket&& packet) : ClientPacket(CMSG_TUTORIAL_FLAG, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
uint8 Action = 0;
|
||||
uint32 TutorialBit = 0;
|
||||
};
|
||||
|
||||
class WorldServerInfo final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
WorldServerInfo() : ServerPacket(SMSG_WORLD_SERVER_INFO, 26) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
Optional<uint32> IneligibleForLootMask; ///< Encountermask?
|
||||
uint32 WeeklyReset = 0; ///< UnixTime of last Weekly Reset Time
|
||||
Optional<uint32> InstanceGroupSize;
|
||||
uint8 IsTournamentRealm = 0;
|
||||
Optional<uint32> RestrictedAccountMaxLevel;
|
||||
Optional<uint32> RestrictedAccountMaxMoney;
|
||||
uint32 DifficultyID = 0;
|
||||
};
|
||||
|
||||
class AreaTrigger final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
AreaTrigger(WorldPacket&& packet) : ClientPacket(CMSG_AREATRIGGER, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
int32 AreaTriggerID = 0;
|
||||
bool Entered = false;
|
||||
bool FromClient = false;
|
||||
};
|
||||
|
||||
class SetDungeonDifficulty final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
SetDungeonDifficulty(WorldPacket&& packet) : ClientPacket(CMSG_SET_DUNGEON_DIFFICULTY, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
int32 DifficultyID;
|
||||
};
|
||||
|
||||
class SetRaidDifficulty final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
SetRaidDifficulty(WorldPacket&& packet) : ClientPacket(CMSG_SET_RAID_DIFFICULTY, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
int32 DifficultyID;
|
||||
uint8 Legacy;
|
||||
};
|
||||
|
||||
class DungeonDifficultySet final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
DungeonDifficultySet() : ServerPacket(SMSG_SET_DUNGEON_DIFFICULTY, 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
int32 DifficultyID;
|
||||
};
|
||||
|
||||
class RaidDifficultySet final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
RaidDifficultySet() : ServerPacket(SMSG_SET_RAID_DIFFICULTY, 4 + 1) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
int32 DifficultyID;
|
||||
uint8 Legacy;
|
||||
};
|
||||
|
||||
class CorpseReclaimDelay : public ServerPacket
|
||||
{
|
||||
public:
|
||||
CorpseReclaimDelay() : ServerPacket(SMSG_CORPSE_RECLAIM_DELAY, 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 Remaining = 0;
|
||||
};
|
||||
|
||||
class DeathReleaseLoc : public ServerPacket
|
||||
{
|
||||
public:
|
||||
DeathReleaseLoc() : ServerPacket(SMSG_DEATH_RELEASE_LOC, 4 + (3 * 4)) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
int32 MapID = 0;
|
||||
G3D::Vector3 Loc;
|
||||
};
|
||||
|
||||
class PortGraveyard final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
PortGraveyard(WorldPacket&& packet) : ClientPacket(CMSG_PORT_GRAVEYARD, std::move(packet)) { }
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
class PreRessurect : public ServerPacket
|
||||
{
|
||||
public:
|
||||
PreRessurect() : ServerPacket(SMSG_PRE_RESSURECT, 18) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
ObjectGuid PlayerGUID;
|
||||
};
|
||||
|
||||
class ReclaimCorpse final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
ReclaimCorpse(WorldPacket&& packet) : ClientPacket(CMSG_RECLAIM_CORPSE, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid CorpseGUID;
|
||||
};
|
||||
|
||||
class RepopRequest final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
RepopRequest(WorldPacket&& packet) : ClientPacket(CMSG_REPOP_REQUEST, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
bool CheckInstance = false;
|
||||
};
|
||||
|
||||
class RequestCemeteryList final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
RequestCemeteryList(WorldPacket&& packet) : ClientPacket(CMSG_REQUEST_CEMETERY_LIST, std::move(packet)) { }
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
class RequestCemeteryListResponse : public ServerPacket
|
||||
{
|
||||
public:
|
||||
RequestCemeteryListResponse() : ServerPacket(SMSG_REQUEST_CEMETERY_LIST_RESPONSE, 1) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
bool IsGossipTriggered = false;
|
||||
std::vector<uint32> CemeteryID;
|
||||
};
|
||||
|
||||
class ResurrectResponse final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
ResurrectResponse(WorldPacket&& packet) : ClientPacket(CMSG_RESURRECT_RESPONSE, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid Resurrecter;
|
||||
uint32 Response = 0;
|
||||
};
|
||||
|
||||
class AreaTriggerNoCorpse : public ServerPacket
|
||||
{
|
||||
public:
|
||||
AreaTriggerNoCorpse() : ServerPacket(SMSG_AREA_TRIGGER_NO_CORPSE, 0) { }
|
||||
|
||||
WorldPacket const* Write() override { return &_worldPacket; }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // MiscPackets_h__
|
||||
/*
|
||||
* Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef MiscPackets_h__
|
||||
#define MiscPackets_h__
|
||||
|
||||
#include "Packet.h"
|
||||
#include "ObjectGuid.h"
|
||||
#include "WorldSession.h"
|
||||
#include "G3D/Vector3.h"
|
||||
#include "Object.h"
|
||||
|
||||
namespace WorldPackets
|
||||
{
|
||||
namespace Misc
|
||||
{
|
||||
class BindPointUpdate final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
BindPointUpdate() : ServerPacket(SMSG_BINDPOINTUPDATE, 20) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 BindMapID = MAPID_INVALID;
|
||||
G3D::Vector3 BindPosition;
|
||||
uint32 BindAreaID = 0;
|
||||
};
|
||||
|
||||
class InvalidatePlayer final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
InvalidatePlayer() : ServerPacket(SMSG_INVALIDATE_PLAYER, 18) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
ObjectGuid Guid;
|
||||
};
|
||||
|
||||
class LoginSetTimeSpeed final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
LoginSetTimeSpeed() : ServerPacket(SMSG_LOGIN_SETTIMESPEED, 20) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
float NewSpeed = 0.0f;
|
||||
int32 ServerTimeHolidayOffset = 0;
|
||||
uint32 GameTime = 0;
|
||||
uint32 ServerTime = 0;
|
||||
int32 GameTimeHolidayOffset = 0;
|
||||
};
|
||||
|
||||
class SetCurrency final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
SetCurrency() : ServerPacket(SMSG_SET_CURRENCY, 12) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
bool SuppressChatLog = false;
|
||||
Optional<int32> TrackedQuantity;
|
||||
int32 Quantity = 0;
|
||||
uint32 Flags = 0;
|
||||
int32 Type = 0;
|
||||
Optional<int32> WeeklyQuantity;
|
||||
};
|
||||
|
||||
class SetSelection final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
SetSelection(WorldPacket&& packet) : ClientPacket(CMSG_SET_SELECTION, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid Selection; ///< Target
|
||||
};
|
||||
|
||||
class SetupCurrency final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
struct Record
|
||||
{
|
||||
int32 Type = 0; // ID from CurrencyTypes.dbc
|
||||
int32 Quantity = 0;
|
||||
Optional<int32> WeeklyQuantity; // Currency count obtained this Week.
|
||||
Optional<int32> MaxWeeklyQuantity; // Weekly Currency cap.
|
||||
Optional<int32> TrackedQuantity;
|
||||
uint8 Flags = 0; // 0 = none,
|
||||
};
|
||||
|
||||
SetupCurrency() : ServerPacket(SMSG_SETUP_CURRENCY, 22) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
std::vector<Record> Data;
|
||||
};
|
||||
|
||||
class ViolenceLevel final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
ViolenceLevel(WorldPacket&& packet) : ClientPacket(CMSG_VIOLENCE_LEVEL, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
int8 ViolenceLvl = -1; ///< 0 - no combat effects, 1 - display some combat effects, 2 - blood, 3 - bloody, 4 - bloodier, 5 - bloodiest
|
||||
};
|
||||
|
||||
class TimeSyncRequest final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
TimeSyncRequest() : ServerPacket(SMSG_TIME_SYNC_REQ, 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 SequenceIndex = 0;
|
||||
};
|
||||
|
||||
class TimeSyncResponse final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
TimeSyncResponse(WorldPacket&& packet) : ClientPacket(CMSG_TIME_SYNC_RESPONSE, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
uint32 ClientTime = 0; // Client ticks in ms
|
||||
uint32 SequenceIndex = 0; // Same index as in request
|
||||
};
|
||||
|
||||
class TriggerCinematic final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
TriggerCinematic() : ServerPacket(SMSG_TRIGGER_CINEMATIC, 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 CinematicID = 0;
|
||||
};
|
||||
|
||||
class TriggerMovie final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
TriggerMovie() : ServerPacket(SMSG_TRIGGER_MOVIE, 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 MovieID = 0;
|
||||
};
|
||||
|
||||
class UITime final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
UITime() : ServerPacket(SMSG_WORLD_STATE_UI_TIMER_UPDATE, 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 Time = 0;
|
||||
};
|
||||
|
||||
class TutorialFlags : public ServerPacket
|
||||
{
|
||||
public:
|
||||
TutorialFlags() : ServerPacket(SMSG_TUTORIAL_FLAGS, 32)
|
||||
{
|
||||
std::memset(TutorialData, 0, sizeof(TutorialData));
|
||||
}
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 TutorialData[MAX_ACCOUNT_TUTORIAL_VALUES];
|
||||
};
|
||||
|
||||
class TutorialSetFlag final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
TutorialSetFlag(WorldPacket&& packet) : ClientPacket(CMSG_TUTORIAL_FLAG, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
uint8 Action = 0;
|
||||
uint32 TutorialBit = 0;
|
||||
};
|
||||
|
||||
class WorldServerInfo final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
WorldServerInfo() : ServerPacket(SMSG_WORLD_SERVER_INFO, 26) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
Optional<uint32> IneligibleForLootMask; ///< Encountermask?
|
||||
uint32 WeeklyReset = 0; ///< UnixTime of last Weekly Reset Time
|
||||
Optional<uint32> InstanceGroupSize;
|
||||
uint8 IsTournamentRealm = 0;
|
||||
Optional<uint32> RestrictedAccountMaxLevel;
|
||||
Optional<uint32> RestrictedAccountMaxMoney;
|
||||
uint32 DifficultyID = 0;
|
||||
};
|
||||
|
||||
class AreaTrigger final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
AreaTrigger(WorldPacket&& packet) : ClientPacket(CMSG_AREATRIGGER, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
int32 AreaTriggerID = 0;
|
||||
bool Entered = false;
|
||||
bool FromClient = false;
|
||||
};
|
||||
|
||||
class SetDungeonDifficulty final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
SetDungeonDifficulty(WorldPacket&& packet) : ClientPacket(CMSG_SET_DUNGEON_DIFFICULTY, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
int32 DifficultyID;
|
||||
};
|
||||
|
||||
class SetRaidDifficulty final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
SetRaidDifficulty(WorldPacket&& packet) : ClientPacket(CMSG_SET_RAID_DIFFICULTY, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
int32 DifficultyID;
|
||||
uint8 Legacy;
|
||||
};
|
||||
|
||||
class DungeonDifficultySet final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
DungeonDifficultySet() : ServerPacket(SMSG_SET_DUNGEON_DIFFICULTY, 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
int32 DifficultyID;
|
||||
};
|
||||
|
||||
class RaidDifficultySet final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
RaidDifficultySet() : ServerPacket(SMSG_SET_RAID_DIFFICULTY, 4 + 1) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
int32 DifficultyID;
|
||||
uint8 Legacy;
|
||||
};
|
||||
|
||||
class CorpseReclaimDelay : public ServerPacket
|
||||
{
|
||||
public:
|
||||
CorpseReclaimDelay() : ServerPacket(SMSG_CORPSE_RECLAIM_DELAY, 4) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
uint32 Remaining = 0;
|
||||
};
|
||||
|
||||
class DeathReleaseLoc : public ServerPacket
|
||||
{
|
||||
public:
|
||||
DeathReleaseLoc() : ServerPacket(SMSG_DEATH_RELEASE_LOC, 4 + (3 * 4)) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
int32 MapID = 0;
|
||||
G3D::Vector3 Loc;
|
||||
};
|
||||
|
||||
class PortGraveyard final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
PortGraveyard(WorldPacket&& packet) : ClientPacket(CMSG_PORT_GRAVEYARD, std::move(packet)) { }
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
class PreRessurect : public ServerPacket
|
||||
{
|
||||
public:
|
||||
PreRessurect() : ServerPacket(SMSG_PRE_RESSURECT, 18) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
ObjectGuid PlayerGUID;
|
||||
};
|
||||
|
||||
class ReclaimCorpse final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
ReclaimCorpse(WorldPacket&& packet) : ClientPacket(CMSG_RECLAIM_CORPSE, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid CorpseGUID;
|
||||
};
|
||||
|
||||
class RepopRequest final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
RepopRequest(WorldPacket&& packet) : ClientPacket(CMSG_REPOP_REQUEST, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
bool CheckInstance = false;
|
||||
};
|
||||
|
||||
class RequestCemeteryList final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
RequestCemeteryList(WorldPacket&& packet) : ClientPacket(CMSG_REQUEST_CEMETERY_LIST, std::move(packet)) { }
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
class RequestCemeteryListResponse : public ServerPacket
|
||||
{
|
||||
public:
|
||||
RequestCemeteryListResponse() : ServerPacket(SMSG_REQUEST_CEMETERY_LIST_RESPONSE, 1) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
bool IsGossipTriggered = false;
|
||||
std::vector<uint32> CemeteryID;
|
||||
};
|
||||
|
||||
class ResurrectResponse final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
ResurrectResponse(WorldPacket&& packet) : ClientPacket(CMSG_RESURRECT_RESPONSE, std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid Resurrecter;
|
||||
uint32 Response = 0;
|
||||
};
|
||||
|
||||
class AreaTriggerNoCorpse : public ServerPacket
|
||||
{
|
||||
public:
|
||||
AreaTriggerNoCorpse() : ServerPacket(SMSG_AREA_TRIGGER_NO_CORPSE, 0) { }
|
||||
|
||||
WorldPacket const* Write() override { return &_worldPacket; }
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif // MiscPackets_h__
|
||||
|
||||
@@ -265,33 +265,33 @@ WorldPacket const* WorldPackets::Query::QueryGameObjectResponse::Write()
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Query::CorpseLocation::Write()
|
||||
{
|
||||
_worldPacket.WriteBit(Valid);
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
_worldPacket << ActualMapID;
|
||||
_worldPacket << Position.x;
|
||||
_worldPacket << Position.y;
|
||||
_worldPacket << Position.z;
|
||||
_worldPacket << MapID;
|
||||
_worldPacket << Transport;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Query::CorpseLocation::Write()
|
||||
{
|
||||
_worldPacket.WriteBit(Valid);
|
||||
_worldPacket.FlushBits();
|
||||
|
||||
_worldPacket << ActualMapID;
|
||||
_worldPacket << Position.x;
|
||||
_worldPacket << Position.y;
|
||||
_worldPacket << Position.z;
|
||||
_worldPacket << MapID;
|
||||
_worldPacket << Transport;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
void WorldPackets::Query::QueryCorpseTransport::Read()
|
||||
{
|
||||
_worldPacket >> Transport;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Query::CorpseTransportQuery::Write()
|
||||
{
|
||||
_worldPacket << Position.x;
|
||||
_worldPacket << Position.y;
|
||||
_worldPacket << Position.z;
|
||||
_worldPacket << Facing;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
WorldPacket const* WorldPackets::Query::CorpseTransportQuery::Write()
|
||||
{
|
||||
_worldPacket << Position.x;
|
||||
_worldPacket << Position.y;
|
||||
_worldPacket << Position.z;
|
||||
_worldPacket << Facing;
|
||||
|
||||
return &_worldPacket;
|
||||
}
|
||||
|
||||
@@ -254,48 +254,48 @@ namespace WorldPackets
|
||||
bool Allow = false;
|
||||
GameObjectStats Stats;
|
||||
};
|
||||
|
||||
class QueryCorpseLocationFromClient final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
QueryCorpseLocationFromClient(WorldPacket&& packet) : ClientPacket(CMSG_QUERY_CORPSE_LOCATION_FROM_CLIENT, std::move(packet)) { }
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
class CorpseLocation final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
CorpseLocation() : ServerPacket(SMSG_CORPSE_LOCATION, 1 + (5 * 4) + 16) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
ObjectGuid Transport;
|
||||
G3D::Vector3 Position;
|
||||
int32 ActualMapID = 0;
|
||||
int32 MapID = 0;
|
||||
bool Valid = false;
|
||||
|
||||
class QueryCorpseLocationFromClient final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
QueryCorpseLocationFromClient(WorldPacket&& packet) : ClientPacket(CMSG_QUERY_CORPSE_LOCATION_FROM_CLIENT, std::move(packet)) { }
|
||||
|
||||
void Read() override { }
|
||||
};
|
||||
|
||||
class QueryCorpseTransport final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
QueryCorpseTransport(WorldPacket&& packet) : ClientPacket(CMSG_QUERY_CORPSE_TRANSPORT , std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid Transport;
|
||||
class CorpseLocation final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
CorpseLocation() : ServerPacket(SMSG_CORPSE_LOCATION, 1 + (5 * 4) + 16) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
ObjectGuid Transport;
|
||||
G3D::Vector3 Position;
|
||||
int32 ActualMapID = 0;
|
||||
int32 MapID = 0;
|
||||
bool Valid = false;
|
||||
};
|
||||
|
||||
class CorpseTransportQuery final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
CorpseTransportQuery() : ServerPacket(SMSG_CORPSE_TRANSPORT_QUERY, 16) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
G3D::Vector3 Position;
|
||||
float Facing = 0.0f;
|
||||
class QueryCorpseTransport final : public ClientPacket
|
||||
{
|
||||
public:
|
||||
QueryCorpseTransport(WorldPacket&& packet) : ClientPacket(CMSG_QUERY_CORPSE_TRANSPORT , std::move(packet)) { }
|
||||
|
||||
void Read() override;
|
||||
|
||||
ObjectGuid Transport;
|
||||
};
|
||||
|
||||
class CorpseTransportQuery final : public ServerPacket
|
||||
{
|
||||
public:
|
||||
CorpseTransportQuery() : ServerPacket(SMSG_CORPSE_TRANSPORT_QUERY, 16) { }
|
||||
|
||||
WorldPacket const* Write() override;
|
||||
|
||||
G3D::Vector3 Position;
|
||||
float Facing = 0.0f;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,383 +1,383 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* ScriptData
|
||||
Name: rbac_commandscript
|
||||
%Complete: 100
|
||||
Comment: All role based access control related commands (including account related)
|
||||
Category: commandscripts
|
||||
EndScriptData */
|
||||
|
||||
#include "AccountMgr.h"
|
||||
#include "Config.h"
|
||||
#include "Chat.h"
|
||||
#include "Language.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
struct RBACCommandData
|
||||
{
|
||||
RBACCommandData(): id(0), realmId(0), rbac(NULL), needDelete(false) { }
|
||||
~RBACCommandData()
|
||||
{
|
||||
if (needDelete)
|
||||
delete rbac;
|
||||
}
|
||||
|
||||
uint32 id;
|
||||
int32 realmId;
|
||||
rbac::RBACData* rbac;
|
||||
bool needDelete;
|
||||
};
|
||||
|
||||
class rbac_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
rbac_commandscript() : CommandScript("rbac_commandscript") { }
|
||||
|
||||
ChatCommand* GetCommands() const
|
||||
{
|
||||
static ChatCommand rbacAccountCommandTable[] =
|
||||
{
|
||||
{ "list", rbac::RBAC_PERM_COMMAND_RBAC_ACC_PERM_LIST, true, &HandleRBACPermListCommand, "", NULL },
|
||||
{ "grant", rbac::RBAC_PERM_COMMAND_RBAC_ACC_PERM_GRANT, true, &HandleRBACPermGrantCommand, "", NULL },
|
||||
{ "deny", rbac::RBAC_PERM_COMMAND_RBAC_ACC_PERM_DENY, true, &HandleRBACPermDenyCommand, "", NULL },
|
||||
{ "revoke", rbac::RBAC_PERM_COMMAND_RBAC_ACC_PERM_REVOKE, true, &HandleRBACPermRevokeCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand rbacCommandTable[] =
|
||||
{
|
||||
{ "account", rbac::RBAC_PERM_COMMAND_RBAC_ACC, true, NULL, "", rbacAccountCommandTable },
|
||||
{ "list", rbac::RBAC_PERM_COMMAND_RBAC_LIST, true, &HandleRBACListPermissionsCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "rbac", rbac::RBAC_PERM_COMMAND_RBAC, true, NULL, "", rbacCommandTable },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
static RBACCommandData* ReadParams(ChatHandler* handler, char const* args, bool checkParams = true)
|
||||
{
|
||||
if (!args)
|
||||
return NULL;
|
||||
|
||||
char* param1 = strtok((char*)args, " ");
|
||||
char* param2 = strtok(NULL, " ");
|
||||
char* param3 = strtok(NULL, " ");
|
||||
|
||||
int32 realmId = -1;
|
||||
uint32 accountId = 0;
|
||||
std::string accountName;
|
||||
uint32 id = 0;
|
||||
RBACCommandData* data = NULL;
|
||||
rbac::RBACData* rdata = NULL;
|
||||
bool useSelectedPlayer = false;
|
||||
|
||||
if (checkParams)
|
||||
{
|
||||
if (!param3)
|
||||
{
|
||||
if (param2)
|
||||
realmId = atoi(param2);
|
||||
|
||||
if (param1)
|
||||
id = atoi(param1);
|
||||
|
||||
useSelectedPlayer = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
id = atoi(param2);
|
||||
realmId = atoi(param3);
|
||||
}
|
||||
|
||||
if (!id)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, id);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (realmId < -1 || !realmId)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_REALM, realmId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else if (!param1)
|
||||
useSelectedPlayer = true;
|
||||
|
||||
if (useSelectedPlayer)
|
||||
{
|
||||
Player* player = handler->getSelectedPlayer();
|
||||
if (!player)
|
||||
return NULL;
|
||||
|
||||
rdata = player->GetSession()->GetRBACData();
|
||||
accountId = rdata->GetId();
|
||||
AccountMgr::GetName(accountId, accountName);
|
||||
}
|
||||
else
|
||||
{
|
||||
accountName = param1;
|
||||
|
||||
if (Utf8ToUpperOnlyLatin(accountName))
|
||||
accountId = AccountMgr::GetId(accountName);
|
||||
|
||||
if (!accountId)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
|
||||
handler->SetSentErrorMessage(true);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (checkParams && handler->HasLowerSecurityAccount(NULL, accountId, true))
|
||||
return NULL;
|
||||
|
||||
data = new RBACCommandData();
|
||||
|
||||
if (!rdata)
|
||||
{
|
||||
data->rbac = new rbac::RBACData(accountId, accountName, realmHandle.Index, AccountMgr::GetSecurity(accountId, realmHandle.Index));
|
||||
data->rbac->LoadFromDB();
|
||||
data->needDelete = true;
|
||||
}
|
||||
else
|
||||
data->rbac = rdata;
|
||||
|
||||
data->id = id;
|
||||
data->realmId = realmId;
|
||||
return data;
|
||||
}
|
||||
|
||||
static bool HandleRBACPermGrantCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
RBACCommandData* command = ReadParams(handler, args);
|
||||
|
||||
if (!command)
|
||||
{
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
rbac::RBACCommandResult result = command->rbac->GrantPermission(command->id, command->realmId);
|
||||
rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(command->id);
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case rbac::RBAC_CANT_ADD_ALREADY_ADDED:
|
||||
handler->PSendSysMessage(LANG_RBAC_PERM_GRANTED_IN_LIST, command->id, permission->GetName().c_str(),
|
||||
command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
|
||||
break;
|
||||
case rbac::RBAC_IN_DENIED_LIST:
|
||||
handler->PSendSysMessage(LANG_RBAC_PERM_GRANTED_IN_DENIED_LIST, command->id, permission->GetName().c_str(),
|
||||
command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
|
||||
break;
|
||||
case rbac::RBAC_OK:
|
||||
handler->PSendSysMessage(LANG_RBAC_PERM_GRANTED, command->id, permission->GetName().c_str(),
|
||||
command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
|
||||
break;
|
||||
case rbac::RBAC_ID_DOES_NOT_EXISTS:
|
||||
handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
delete command;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleRBACPermDenyCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
RBACCommandData* command = ReadParams(handler, args);
|
||||
|
||||
if (!command)
|
||||
{
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
rbac::RBACCommandResult result = command->rbac->DenyPermission(command->id, command->realmId);
|
||||
rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(command->id);
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case rbac::RBAC_CANT_ADD_ALREADY_ADDED:
|
||||
handler->PSendSysMessage(LANG_RBAC_PERM_DENIED_IN_LIST, command->id, permission->GetName().c_str(),
|
||||
command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
|
||||
break;
|
||||
case rbac::RBAC_IN_GRANTED_LIST:
|
||||
handler->PSendSysMessage(LANG_RBAC_PERM_DENIED_IN_GRANTED_LIST, command->id, permission->GetName().c_str(),
|
||||
command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
|
||||
break;
|
||||
case rbac::RBAC_OK:
|
||||
handler->PSendSysMessage(LANG_RBAC_PERM_DENIED, command->id, permission->GetName().c_str(),
|
||||
command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
|
||||
break;
|
||||
case rbac::RBAC_ID_DOES_NOT_EXISTS:
|
||||
handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
delete command;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleRBACPermRevokeCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
RBACCommandData* command = ReadParams(handler, args);
|
||||
|
||||
if (!command)
|
||||
{
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
rbac::RBACCommandResult result = command->rbac->RevokePermission(command->id, command->realmId);
|
||||
rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(command->id);
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case rbac::RBAC_CANT_REVOKE_NOT_IN_LIST:
|
||||
handler->PSendSysMessage(LANG_RBAC_PERM_REVOKED_NOT_IN_LIST, command->id, permission->GetName().c_str(),
|
||||
command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
|
||||
break;
|
||||
case rbac::RBAC_OK:
|
||||
handler->PSendSysMessage(LANG_RBAC_PERM_REVOKED, command->id, permission->GetName().c_str(),
|
||||
command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
|
||||
break;
|
||||
case rbac::RBAC_ID_DOES_NOT_EXISTS:
|
||||
handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
delete command;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleRBACPermListCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
RBACCommandData* command = ReadParams(handler, args, false);
|
||||
|
||||
if (!command)
|
||||
{
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_RBAC_LIST_HEADER_GRANTED, command->rbac->GetId(), command->rbac->GetName().c_str());
|
||||
rbac::RBACPermissionContainer const& granted = command->rbac->GetGrantedPermissions();
|
||||
if (granted.empty())
|
||||
handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
|
||||
else
|
||||
{
|
||||
for (rbac::RBACPermissionContainer::const_iterator itr = granted.begin(); itr != granted.end(); ++itr)
|
||||
{
|
||||
rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(*itr);
|
||||
handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_RBAC_LIST_HEADER_DENIED, command->rbac->GetId(), command->rbac->GetName().c_str());
|
||||
rbac::RBACPermissionContainer const& denied = command->rbac->GetDeniedPermissions();
|
||||
if (denied.empty())
|
||||
handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
|
||||
else
|
||||
{
|
||||
for (rbac::RBACPermissionContainer::const_iterator itr = denied.begin(); itr != denied.end(); ++itr)
|
||||
{
|
||||
rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(*itr);
|
||||
handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
|
||||
}
|
||||
}
|
||||
handler->PSendSysMessage(LANG_RBAC_LIST_HEADER_BY_SEC_LEVEL, command->rbac->GetId(), command->rbac->GetName().c_str(), command->rbac->GetSecurityLevel());
|
||||
rbac::RBACPermissionContainer const& defaultPermissions = sAccountMgr->GetRBACDefaultPermissions(command->rbac->GetSecurityLevel());
|
||||
if (defaultPermissions.empty())
|
||||
handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
|
||||
else
|
||||
{
|
||||
for (rbac::RBACPermissionContainer::const_iterator itr = defaultPermissions.begin(); itr != defaultPermissions.end(); ++itr)
|
||||
{
|
||||
rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(*itr);
|
||||
handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
delete command;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleRBACListPermissionsCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
uint32 id = 0;
|
||||
if (char* param1 = strtok((char*)args, " "))
|
||||
id = atoi(param1);
|
||||
|
||||
if (!id)
|
||||
{
|
||||
rbac::RBACPermissionsContainer const& permissions = sAccountMgr->GetRBACPermissionList();
|
||||
handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_PERMISSIONS_HEADER));
|
||||
for (rbac::RBACPermissionsContainer::const_iterator it = permissions.begin(); it != permissions.end(); ++it)
|
||||
{
|
||||
rbac::RBACPermission const* permission = it->second;
|
||||
handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(id);
|
||||
if (!permission)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, id);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_PERMISSIONS_HEADER));
|
||||
handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
|
||||
handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_PERMS_LINKED_HEADER));
|
||||
rbac::RBACPermissionContainer const& permissions = permission->GetLinkedPermissions();
|
||||
for (rbac::RBACPermissionContainer::const_iterator it = permissions.begin(); it != permissions.end(); ++it)
|
||||
if (rbac::RBACPermission const* rbacPermission = sAccountMgr->GetRBACPermission(*it))
|
||||
handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, rbacPermission->GetId(), rbacPermission->GetName().c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_rbac_commandscript()
|
||||
{
|
||||
new rbac_commandscript();
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* ScriptData
|
||||
Name: rbac_commandscript
|
||||
%Complete: 100
|
||||
Comment: All role based access control related commands (including account related)
|
||||
Category: commandscripts
|
||||
EndScriptData */
|
||||
|
||||
#include "AccountMgr.h"
|
||||
#include "Config.h"
|
||||
#include "Chat.h"
|
||||
#include "Language.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
struct RBACCommandData
|
||||
{
|
||||
RBACCommandData(): id(0), realmId(0), rbac(NULL), needDelete(false) { }
|
||||
~RBACCommandData()
|
||||
{
|
||||
if (needDelete)
|
||||
delete rbac;
|
||||
}
|
||||
|
||||
uint32 id;
|
||||
int32 realmId;
|
||||
rbac::RBACData* rbac;
|
||||
bool needDelete;
|
||||
};
|
||||
|
||||
class rbac_commandscript : public CommandScript
|
||||
{
|
||||
public:
|
||||
rbac_commandscript() : CommandScript("rbac_commandscript") { }
|
||||
|
||||
ChatCommand* GetCommands() const
|
||||
{
|
||||
static ChatCommand rbacAccountCommandTable[] =
|
||||
{
|
||||
{ "list", rbac::RBAC_PERM_COMMAND_RBAC_ACC_PERM_LIST, true, &HandleRBACPermListCommand, "", NULL },
|
||||
{ "grant", rbac::RBAC_PERM_COMMAND_RBAC_ACC_PERM_GRANT, true, &HandleRBACPermGrantCommand, "", NULL },
|
||||
{ "deny", rbac::RBAC_PERM_COMMAND_RBAC_ACC_PERM_DENY, true, &HandleRBACPermDenyCommand, "", NULL },
|
||||
{ "revoke", rbac::RBAC_PERM_COMMAND_RBAC_ACC_PERM_REVOKE, true, &HandleRBACPermRevokeCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand rbacCommandTable[] =
|
||||
{
|
||||
{ "account", rbac::RBAC_PERM_COMMAND_RBAC_ACC, true, NULL, "", rbacAccountCommandTable },
|
||||
{ "list", rbac::RBAC_PERM_COMMAND_RBAC_LIST, true, &HandleRBACListPermissionsCommand, "", NULL },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
static ChatCommand commandTable[] =
|
||||
{
|
||||
{ "rbac", rbac::RBAC_PERM_COMMAND_RBAC, true, NULL, "", rbacCommandTable },
|
||||
{ NULL, 0, false, NULL, "", NULL }
|
||||
};
|
||||
|
||||
return commandTable;
|
||||
}
|
||||
|
||||
static RBACCommandData* ReadParams(ChatHandler* handler, char const* args, bool checkParams = true)
|
||||
{
|
||||
if (!args)
|
||||
return NULL;
|
||||
|
||||
char* param1 = strtok((char*)args, " ");
|
||||
char* param2 = strtok(NULL, " ");
|
||||
char* param3 = strtok(NULL, " ");
|
||||
|
||||
int32 realmId = -1;
|
||||
uint32 accountId = 0;
|
||||
std::string accountName;
|
||||
uint32 id = 0;
|
||||
RBACCommandData* data = NULL;
|
||||
rbac::RBACData* rdata = NULL;
|
||||
bool useSelectedPlayer = false;
|
||||
|
||||
if (checkParams)
|
||||
{
|
||||
if (!param3)
|
||||
{
|
||||
if (param2)
|
||||
realmId = atoi(param2);
|
||||
|
||||
if (param1)
|
||||
id = atoi(param1);
|
||||
|
||||
useSelectedPlayer = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
id = atoi(param2);
|
||||
realmId = atoi(param3);
|
||||
}
|
||||
|
||||
if (!id)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, id);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (realmId < -1 || !realmId)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_REALM, realmId);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
else if (!param1)
|
||||
useSelectedPlayer = true;
|
||||
|
||||
if (useSelectedPlayer)
|
||||
{
|
||||
Player* player = handler->getSelectedPlayer();
|
||||
if (!player)
|
||||
return NULL;
|
||||
|
||||
rdata = player->GetSession()->GetRBACData();
|
||||
accountId = rdata->GetId();
|
||||
AccountMgr::GetName(accountId, accountName);
|
||||
}
|
||||
else
|
||||
{
|
||||
accountName = param1;
|
||||
|
||||
if (Utf8ToUpperOnlyLatin(accountName))
|
||||
accountId = AccountMgr::GetId(accountName);
|
||||
|
||||
if (!accountId)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
|
||||
handler->SetSentErrorMessage(true);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
if (checkParams && handler->HasLowerSecurityAccount(NULL, accountId, true))
|
||||
return NULL;
|
||||
|
||||
data = new RBACCommandData();
|
||||
|
||||
if (!rdata)
|
||||
{
|
||||
data->rbac = new rbac::RBACData(accountId, accountName, realmHandle.Index, AccountMgr::GetSecurity(accountId, realmHandle.Index));
|
||||
data->rbac->LoadFromDB();
|
||||
data->needDelete = true;
|
||||
}
|
||||
else
|
||||
data->rbac = rdata;
|
||||
|
||||
data->id = id;
|
||||
data->realmId = realmId;
|
||||
return data;
|
||||
}
|
||||
|
||||
static bool HandleRBACPermGrantCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
RBACCommandData* command = ReadParams(handler, args);
|
||||
|
||||
if (!command)
|
||||
{
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
rbac::RBACCommandResult result = command->rbac->GrantPermission(command->id, command->realmId);
|
||||
rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(command->id);
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case rbac::RBAC_CANT_ADD_ALREADY_ADDED:
|
||||
handler->PSendSysMessage(LANG_RBAC_PERM_GRANTED_IN_LIST, command->id, permission->GetName().c_str(),
|
||||
command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
|
||||
break;
|
||||
case rbac::RBAC_IN_DENIED_LIST:
|
||||
handler->PSendSysMessage(LANG_RBAC_PERM_GRANTED_IN_DENIED_LIST, command->id, permission->GetName().c_str(),
|
||||
command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
|
||||
break;
|
||||
case rbac::RBAC_OK:
|
||||
handler->PSendSysMessage(LANG_RBAC_PERM_GRANTED, command->id, permission->GetName().c_str(),
|
||||
command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
|
||||
break;
|
||||
case rbac::RBAC_ID_DOES_NOT_EXISTS:
|
||||
handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
delete command;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleRBACPermDenyCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
RBACCommandData* command = ReadParams(handler, args);
|
||||
|
||||
if (!command)
|
||||
{
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
rbac::RBACCommandResult result = command->rbac->DenyPermission(command->id, command->realmId);
|
||||
rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(command->id);
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case rbac::RBAC_CANT_ADD_ALREADY_ADDED:
|
||||
handler->PSendSysMessage(LANG_RBAC_PERM_DENIED_IN_LIST, command->id, permission->GetName().c_str(),
|
||||
command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
|
||||
break;
|
||||
case rbac::RBAC_IN_GRANTED_LIST:
|
||||
handler->PSendSysMessage(LANG_RBAC_PERM_DENIED_IN_GRANTED_LIST, command->id, permission->GetName().c_str(),
|
||||
command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
|
||||
break;
|
||||
case rbac::RBAC_OK:
|
||||
handler->PSendSysMessage(LANG_RBAC_PERM_DENIED, command->id, permission->GetName().c_str(),
|
||||
command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
|
||||
break;
|
||||
case rbac::RBAC_ID_DOES_NOT_EXISTS:
|
||||
handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
delete command;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleRBACPermRevokeCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
RBACCommandData* command = ReadParams(handler, args);
|
||||
|
||||
if (!command)
|
||||
{
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
rbac::RBACCommandResult result = command->rbac->RevokePermission(command->id, command->realmId);
|
||||
rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(command->id);
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case rbac::RBAC_CANT_REVOKE_NOT_IN_LIST:
|
||||
handler->PSendSysMessage(LANG_RBAC_PERM_REVOKED_NOT_IN_LIST, command->id, permission->GetName().c_str(),
|
||||
command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
|
||||
break;
|
||||
case rbac::RBAC_OK:
|
||||
handler->PSendSysMessage(LANG_RBAC_PERM_REVOKED, command->id, permission->GetName().c_str(),
|
||||
command->realmId, command->rbac->GetId(), command->rbac->GetName().c_str());
|
||||
break;
|
||||
case rbac::RBAC_ID_DOES_NOT_EXISTS:
|
||||
handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, command->id);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
delete command;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleRBACPermListCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
RBACCommandData* command = ReadParams(handler, args, false);
|
||||
|
||||
if (!command)
|
||||
{
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_RBAC_LIST_HEADER_GRANTED, command->rbac->GetId(), command->rbac->GetName().c_str());
|
||||
rbac::RBACPermissionContainer const& granted = command->rbac->GetGrantedPermissions();
|
||||
if (granted.empty())
|
||||
handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
|
||||
else
|
||||
{
|
||||
for (rbac::RBACPermissionContainer::const_iterator itr = granted.begin(); itr != granted.end(); ++itr)
|
||||
{
|
||||
rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(*itr);
|
||||
handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
handler->PSendSysMessage(LANG_RBAC_LIST_HEADER_DENIED, command->rbac->GetId(), command->rbac->GetName().c_str());
|
||||
rbac::RBACPermissionContainer const& denied = command->rbac->GetDeniedPermissions();
|
||||
if (denied.empty())
|
||||
handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
|
||||
else
|
||||
{
|
||||
for (rbac::RBACPermissionContainer::const_iterator itr = denied.begin(); itr != denied.end(); ++itr)
|
||||
{
|
||||
rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(*itr);
|
||||
handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
|
||||
}
|
||||
}
|
||||
handler->PSendSysMessage(LANG_RBAC_LIST_HEADER_BY_SEC_LEVEL, command->rbac->GetId(), command->rbac->GetName().c_str(), command->rbac->GetSecurityLevel());
|
||||
rbac::RBACPermissionContainer const& defaultPermissions = sAccountMgr->GetRBACDefaultPermissions(command->rbac->GetSecurityLevel());
|
||||
if (defaultPermissions.empty())
|
||||
handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_EMPTY));
|
||||
else
|
||||
{
|
||||
for (rbac::RBACPermissionContainer::const_iterator itr = defaultPermissions.begin(); itr != defaultPermissions.end(); ++itr)
|
||||
{
|
||||
rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(*itr);
|
||||
handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
delete command;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool HandleRBACListPermissionsCommand(ChatHandler* handler, char const* args)
|
||||
{
|
||||
uint32 id = 0;
|
||||
if (char* param1 = strtok((char*)args, " "))
|
||||
id = atoi(param1);
|
||||
|
||||
if (!id)
|
||||
{
|
||||
rbac::RBACPermissionsContainer const& permissions = sAccountMgr->GetRBACPermissionList();
|
||||
handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_PERMISSIONS_HEADER));
|
||||
for (rbac::RBACPermissionsContainer::const_iterator it = permissions.begin(); it != permissions.end(); ++it)
|
||||
{
|
||||
rbac::RBACPermission const* permission = it->second;
|
||||
handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rbac::RBACPermission const* permission = sAccountMgr->GetRBACPermission(id);
|
||||
if (!permission)
|
||||
{
|
||||
handler->PSendSysMessage(LANG_RBAC_WRONG_PARAMETER_ID, id);
|
||||
handler->SetSentErrorMessage(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_PERMISSIONS_HEADER));
|
||||
handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, permission->GetId(), permission->GetName().c_str());
|
||||
handler->PSendSysMessage("%s", handler->GetTrinityString(LANG_RBAC_LIST_PERMS_LINKED_HEADER));
|
||||
rbac::RBACPermissionContainer const& permissions = permission->GetLinkedPermissions();
|
||||
for (rbac::RBACPermissionContainer::const_iterator it = permissions.begin(); it != permissions.end(); ++it)
|
||||
if (rbac::RBACPermission const* rbacPermission = sAccountMgr->GetRBACPermission(*it))
|
||||
handler->PSendSysMessage(LANG_RBAC_LIST_ELEMENT, rbacPermission->GetId(), rbacPermission->GetName().c_str());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_rbac_commandscript()
|
||||
{
|
||||
new rbac_commandscript();
|
||||
}
|
||||
|
||||
@@ -1,215 +1,215 @@
|
||||
/*
|
||||
* Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "black_temple.h"
|
||||
#include "Player.h"
|
||||
#include "SpellInfo.h"
|
||||
|
||||
enum Texts
|
||||
{
|
||||
SAY_AGGRO = 0,
|
||||
SAY_NEEDLE = 1,
|
||||
SAY_SLAY = 2,
|
||||
SAY_SPECIAL = 3,
|
||||
SAY_ENRAGE = 4,
|
||||
SAY_DEATH = 5
|
||||
};
|
||||
|
||||
enum Spells
|
||||
{
|
||||
SPELL_NEEDLE_SPINE = 39992,
|
||||
SPELL_TIDAL_BURST = 39878,
|
||||
SPELL_TIDAL_SHIELD = 39872,
|
||||
SPELL_IMPALING_SPINE = 39837,
|
||||
SPELL_CREATE_NAJENTUS_SPINE = 39956,
|
||||
SPELL_HURL_SPINE = 39948,
|
||||
SPELL_BERSERK = 26662
|
||||
|
||||
};
|
||||
|
||||
enum Events
|
||||
{
|
||||
EVENT_BERSERK = 1,
|
||||
EVENT_YELL = 2,
|
||||
EVENT_NEEDLE = 3,
|
||||
EVENT_SPINE = 4,
|
||||
EVENT_SHIELD = 5
|
||||
};
|
||||
|
||||
enum EventGroups
|
||||
{
|
||||
GCD_CAST = 1,
|
||||
GCD_YELL = 2
|
||||
};
|
||||
|
||||
class boss_najentus : public CreatureScript
|
||||
{
|
||||
public:
|
||||
boss_najentus() : CreatureScript("boss_najentus") { }
|
||||
|
||||
struct boss_najentusAI : public BossAI
|
||||
{
|
||||
boss_najentusAI(Creature* creature) : BossAI(creature, DATA_HIGH_WARLORD_NAJENTUS)
|
||||
{
|
||||
}
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
_Reset();
|
||||
SpineTargetGUID.Clear();
|
||||
}
|
||||
|
||||
void KilledUnit(Unit* /*victim*/) override
|
||||
{
|
||||
Talk(SAY_SLAY);
|
||||
events.DelayEvents(5000, GCD_YELL);
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
{
|
||||
_JustDied();
|
||||
Talk(SAY_DEATH);
|
||||
}
|
||||
|
||||
void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
|
||||
{
|
||||
if (spell->Id == SPELL_HURL_SPINE && me->HasAura(SPELL_TIDAL_SHIELD))
|
||||
{
|
||||
me->RemoveAurasDueToSpell(SPELL_TIDAL_SHIELD);
|
||||
DoCast(me, SPELL_TIDAL_BURST, true);
|
||||
ResetTimer();
|
||||
}
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/) override
|
||||
{
|
||||
_EnterCombat();
|
||||
Talk(SAY_AGGRO);
|
||||
events.ScheduleEvent(EVENT_BERSERK, 480000, GCD_CAST);
|
||||
events.ScheduleEvent(EVENT_YELL, 45000 + (rand32() % 76) * 1000, GCD_YELL);
|
||||
ResetTimer();
|
||||
}
|
||||
|
||||
bool RemoveImpalingSpine()
|
||||
{
|
||||
if (!SpineTargetGUID)
|
||||
return false;
|
||||
|
||||
Unit* target = ObjectAccessor::GetUnit(*me, SpineTargetGUID);
|
||||
if (target && target->HasAura(SPELL_IMPALING_SPINE))
|
||||
target->RemoveAurasDueToSpell(SPELL_IMPALING_SPINE);
|
||||
SpineTargetGUID.Clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
void ResetTimer(uint32 inc = 0)
|
||||
{
|
||||
events.RescheduleEvent(EVENT_NEEDLE, 10000 + inc, GCD_CAST);
|
||||
events.RescheduleEvent(EVENT_SPINE, 20000 + inc, GCD_CAST);
|
||||
events.RescheduleEvent(EVENT_SHIELD, 60000 + inc);
|
||||
}
|
||||
|
||||
void ExecuteEvent(uint32 eventId) override
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_SHIELD:
|
||||
DoCast(me, SPELL_TIDAL_SHIELD, true);
|
||||
ResetTimer(45000);
|
||||
break;
|
||||
case EVENT_BERSERK:
|
||||
Talk(SAY_ENRAGE);
|
||||
DoCast(me, SPELL_BERSERK, true);
|
||||
events.DelayEvents(15000, GCD_YELL);
|
||||
break;
|
||||
case EVENT_SPINE:
|
||||
{
|
||||
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
|
||||
|
||||
if (!target)
|
||||
target = me->GetVictim();
|
||||
|
||||
if (target)
|
||||
{
|
||||
DoCast(target, SPELL_IMPALING_SPINE, true);
|
||||
SpineTargetGUID = target->GetGUID();
|
||||
//must let target summon, otherwise you cannot click the spine
|
||||
target->SummonGameObject(GO_NAJENTUS_SPINE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), me->GetOrientation(), 0, 0, 0, 0, 30);
|
||||
Talk(SAY_NEEDLE);
|
||||
events.DelayEvents(1500, GCD_CAST);
|
||||
events.DelayEvents(15000, GCD_YELL);
|
||||
}
|
||||
events.ScheduleEvent(EVENT_SPINE, 21000, GCD_CAST);
|
||||
return;
|
||||
}
|
||||
case EVENT_NEEDLE:
|
||||
{
|
||||
//DoCast(me, SPELL_NEEDLE_SPINE, true);
|
||||
std::list<Unit*> targets;
|
||||
SelectTargetList(targets, 3, SELECT_TARGET_RANDOM, 80, true);
|
||||
for (std::list<Unit*>::const_iterator i = targets.begin(); i != targets.end(); ++i)
|
||||
DoCast(*i, 39835, true);
|
||||
events.ScheduleEvent(EVENT_NEEDLE, urand(15000, 25000), GCD_CAST);
|
||||
events.DelayEvents(1500, GCD_CAST);
|
||||
return;
|
||||
}
|
||||
case EVENT_YELL:
|
||||
Talk(SAY_SPECIAL);
|
||||
events.ScheduleEvent(EVENT_YELL, urand(25000, 100000), GCD_YELL);
|
||||
events.DelayEvents(15000, GCD_YELL);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
ObjectGuid SpineTargetGUID;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return GetBlackTempleAI<boss_najentusAI>(creature);
|
||||
}
|
||||
};
|
||||
|
||||
class go_najentus_spine : public GameObjectScript
|
||||
{
|
||||
public:
|
||||
go_najentus_spine() : GameObjectScript("go_najentus_spine") { }
|
||||
|
||||
bool OnGossipHello(Player* player, GameObject* go) override
|
||||
{
|
||||
if (InstanceScript* instance = go->GetInstanceScript())
|
||||
if (Creature* Najentus = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_HIGH_WARLORD_NAJENTUS)))
|
||||
if (ENSURE_AI(boss_najentus::boss_najentusAI, Najentus->AI())->RemoveImpalingSpine())
|
||||
{
|
||||
player->CastSpell(player, SPELL_CREATE_NAJENTUS_SPINE, true);
|
||||
go->Delete();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void AddSC_boss_najentus()
|
||||
{
|
||||
new boss_najentus();
|
||||
new go_najentus_spine();
|
||||
}
|
||||
/*
|
||||
* Copyright (C) 2008-2015 TrinityCore <http://www.trinitycore.org/>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation; either version 2 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "ScriptMgr.h"
|
||||
#include "ScriptedCreature.h"
|
||||
#include "black_temple.h"
|
||||
#include "Player.h"
|
||||
#include "SpellInfo.h"
|
||||
|
||||
enum Texts
|
||||
{
|
||||
SAY_AGGRO = 0,
|
||||
SAY_NEEDLE = 1,
|
||||
SAY_SLAY = 2,
|
||||
SAY_SPECIAL = 3,
|
||||
SAY_ENRAGE = 4,
|
||||
SAY_DEATH = 5
|
||||
};
|
||||
|
||||
enum Spells
|
||||
{
|
||||
SPELL_NEEDLE_SPINE = 39992,
|
||||
SPELL_TIDAL_BURST = 39878,
|
||||
SPELL_TIDAL_SHIELD = 39872,
|
||||
SPELL_IMPALING_SPINE = 39837,
|
||||
SPELL_CREATE_NAJENTUS_SPINE = 39956,
|
||||
SPELL_HURL_SPINE = 39948,
|
||||
SPELL_BERSERK = 26662
|
||||
|
||||
};
|
||||
|
||||
enum Events
|
||||
{
|
||||
EVENT_BERSERK = 1,
|
||||
EVENT_YELL = 2,
|
||||
EVENT_NEEDLE = 3,
|
||||
EVENT_SPINE = 4,
|
||||
EVENT_SHIELD = 5
|
||||
};
|
||||
|
||||
enum EventGroups
|
||||
{
|
||||
GCD_CAST = 1,
|
||||
GCD_YELL = 2
|
||||
};
|
||||
|
||||
class boss_najentus : public CreatureScript
|
||||
{
|
||||
public:
|
||||
boss_najentus() : CreatureScript("boss_najentus") { }
|
||||
|
||||
struct boss_najentusAI : public BossAI
|
||||
{
|
||||
boss_najentusAI(Creature* creature) : BossAI(creature, DATA_HIGH_WARLORD_NAJENTUS)
|
||||
{
|
||||
}
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
_Reset();
|
||||
SpineTargetGUID.Clear();
|
||||
}
|
||||
|
||||
void KilledUnit(Unit* /*victim*/) override
|
||||
{
|
||||
Talk(SAY_SLAY);
|
||||
events.DelayEvents(5000, GCD_YELL);
|
||||
}
|
||||
|
||||
void JustDied(Unit* /*killer*/) override
|
||||
{
|
||||
_JustDied();
|
||||
Talk(SAY_DEATH);
|
||||
}
|
||||
|
||||
void SpellHit(Unit* /*caster*/, const SpellInfo* spell) override
|
||||
{
|
||||
if (spell->Id == SPELL_HURL_SPINE && me->HasAura(SPELL_TIDAL_SHIELD))
|
||||
{
|
||||
me->RemoveAurasDueToSpell(SPELL_TIDAL_SHIELD);
|
||||
DoCast(me, SPELL_TIDAL_BURST, true);
|
||||
ResetTimer();
|
||||
}
|
||||
}
|
||||
|
||||
void EnterCombat(Unit* /*who*/) override
|
||||
{
|
||||
_EnterCombat();
|
||||
Talk(SAY_AGGRO);
|
||||
events.ScheduleEvent(EVENT_BERSERK, 480000, GCD_CAST);
|
||||
events.ScheduleEvent(EVENT_YELL, 45000 + (rand32() % 76) * 1000, GCD_YELL);
|
||||
ResetTimer();
|
||||
}
|
||||
|
||||
bool RemoveImpalingSpine()
|
||||
{
|
||||
if (!SpineTargetGUID)
|
||||
return false;
|
||||
|
||||
Unit* target = ObjectAccessor::GetUnit(*me, SpineTargetGUID);
|
||||
if (target && target->HasAura(SPELL_IMPALING_SPINE))
|
||||
target->RemoveAurasDueToSpell(SPELL_IMPALING_SPINE);
|
||||
SpineTargetGUID.Clear();
|
||||
return true;
|
||||
}
|
||||
|
||||
void ResetTimer(uint32 inc = 0)
|
||||
{
|
||||
events.RescheduleEvent(EVENT_NEEDLE, 10000 + inc, GCD_CAST);
|
||||
events.RescheduleEvent(EVENT_SPINE, 20000 + inc, GCD_CAST);
|
||||
events.RescheduleEvent(EVENT_SHIELD, 60000 + inc);
|
||||
}
|
||||
|
||||
void ExecuteEvent(uint32 eventId) override
|
||||
{
|
||||
switch (eventId)
|
||||
{
|
||||
case EVENT_SHIELD:
|
||||
DoCast(me, SPELL_TIDAL_SHIELD, true);
|
||||
ResetTimer(45000);
|
||||
break;
|
||||
case EVENT_BERSERK:
|
||||
Talk(SAY_ENRAGE);
|
||||
DoCast(me, SPELL_BERSERK, true);
|
||||
events.DelayEvents(15000, GCD_YELL);
|
||||
break;
|
||||
case EVENT_SPINE:
|
||||
{
|
||||
Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
|
||||
|
||||
if (!target)
|
||||
target = me->GetVictim();
|
||||
|
||||
if (target)
|
||||
{
|
||||
DoCast(target, SPELL_IMPALING_SPINE, true);
|
||||
SpineTargetGUID = target->GetGUID();
|
||||
//must let target summon, otherwise you cannot click the spine
|
||||
target->SummonGameObject(GO_NAJENTUS_SPINE, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), me->GetOrientation(), 0, 0, 0, 0, 30);
|
||||
Talk(SAY_NEEDLE);
|
||||
events.DelayEvents(1500, GCD_CAST);
|
||||
events.DelayEvents(15000, GCD_YELL);
|
||||
}
|
||||
events.ScheduleEvent(EVENT_SPINE, 21000, GCD_CAST);
|
||||
return;
|
||||
}
|
||||
case EVENT_NEEDLE:
|
||||
{
|
||||
//DoCast(me, SPELL_NEEDLE_SPINE, true);
|
||||
std::list<Unit*> targets;
|
||||
SelectTargetList(targets, 3, SELECT_TARGET_RANDOM, 80, true);
|
||||
for (std::list<Unit*>::const_iterator i = targets.begin(); i != targets.end(); ++i)
|
||||
DoCast(*i, 39835, true);
|
||||
events.ScheduleEvent(EVENT_NEEDLE, urand(15000, 25000), GCD_CAST);
|
||||
events.DelayEvents(1500, GCD_CAST);
|
||||
return;
|
||||
}
|
||||
case EVENT_YELL:
|
||||
Talk(SAY_SPECIAL);
|
||||
events.ScheduleEvent(EVENT_YELL, urand(25000, 100000), GCD_YELL);
|
||||
events.DelayEvents(15000, GCD_YELL);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
ObjectGuid SpineTargetGUID;
|
||||
};
|
||||
|
||||
CreatureAI* GetAI(Creature* creature) const override
|
||||
{
|
||||
return GetBlackTempleAI<boss_najentusAI>(creature);
|
||||
}
|
||||
};
|
||||
|
||||
class go_najentus_spine : public GameObjectScript
|
||||
{
|
||||
public:
|
||||
go_najentus_spine() : GameObjectScript("go_najentus_spine") { }
|
||||
|
||||
bool OnGossipHello(Player* player, GameObject* go) override
|
||||
{
|
||||
if (InstanceScript* instance = go->GetInstanceScript())
|
||||
if (Creature* Najentus = ObjectAccessor::GetCreature(*go, instance->GetGuidData(DATA_HIGH_WARLORD_NAJENTUS)))
|
||||
if (ENSURE_AI(boss_najentus::boss_najentusAI, Najentus->AI())->RemoveImpalingSpine())
|
||||
{
|
||||
player->CastSpell(player, SPELL_CREATE_NAJENTUS_SPINE, true);
|
||||
go->Delete();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
void AddSC_boss_najentus()
|
||||
{
|
||||
new boss_najentus();
|
||||
new go_najentus_spine();
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ class spell_dk_anti_magic_shell : public SpellScriptLoader
|
||||
PrepareAuraScript(spell_dk_anti_magic_shell_AuraScript);
|
||||
|
||||
public:
|
||||
spell_dk_anti_magic_shell_AuraScript()
|
||||
spell_dk_anti_magic_shell_AuraScript()
|
||||
{
|
||||
absorbPct = 0;
|
||||
maxHealth = 0;
|
||||
|
||||
Reference in New Issue
Block a user