Compare commits

...

7 Commits

Author SHA1 Message Date
yehonal bf139c3d34 Removing multi-vendor Rochet2 patch
It caused compilation errors too
2016-06-27 00:19:46 +02:00
Yehonal f6eefedcd5 converted all tabs to 4 spaces 2016-06-26 19:23:57 +02:00
Yehonal 52f305111c importing changes from callmephil repo
a special thanks to him
2016-06-26 19:22:35 +02:00
Yehonal 5bb70a86be Merge branch 'master' of https://github.com/azerothcore/azerothcore.git 2016-06-26 17:50:05 +02:00
Yehonal 6bc919e7d4 fix compilation 2016-06-26 17:33:35 +02:00
mik1893 0c102b79de Fix MMAPS Generation 2016-06-26 12:51:33 +01:00
mik1893 d8b67c27cc Add GitIgnore 2016-06-26 12:51:16 +01:00
729 changed files with 134712 additions and 133674 deletions
+18
View File
@@ -0,0 +1,18 @@
build*/
.directory
.mailmap
*.orig
*.rej
*~
.hg/
*.kdev*
.DS_Store
CMakeLists.txt.user
*.bak
*.patch
*.diff
*.REMOTE.*
*.BACKUP.*
*.BASE.*
*.LOCAL.*
+5 -52
View File
@@ -171,57 +171,10 @@ ELSE(WIN32 AND NOT CYGWIN)
ENDIF(WIN32 AND NOT CYGWIN)
if (NOT OPENSSL_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OpenSSL DEFAULT_MSG
OPENSSL_LIBRARIES
OPENSSL_INCLUDE_DIR
)
endif()
if (OPENSSL_INCLUDE_DIR)
message( STATUS "Found OpenSSL library: ${OPENSSL_LIBRARIES}")
message( STATUS "Found OpenSSL headers: ${OPENSSL_INCLUDE_DIR}")
if (_OPENSSL_VERSION)
set(OPENSSL_VERSION "${_OPENSSL_VERSION}")
else (_OPENSSL_VERSION)
file(STRINGS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h" openssl_version_str
REGEX "^# *define[\t ]+OPENSSL_VERSION_NUMBER[\t ]+0x[0-9][0-9][0-9][0-9][0-9][0-9].*")
# The version number is encoded as 0xMNNFFPPS: major minor fix patch status
# The status gives if this is a developer or prerelease and is ignored here.
# Major, minor, and fix directly translate into the version numbers shown in
# the string. The patch field translates to the single character suffix that
# indicates the bug fix state, which 00 -> nothing, 01 -> a, 02 -> b and so
# on.
string(REGEX REPLACE "^.*OPENSSL_VERSION_NUMBER[\t ]+0x([0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]).*$"
"\\1;\\2;\\3;\\4;\\5" OPENSSL_VERSION_LIST "${openssl_version_str}")
list(GET OPENSSL_VERSION_LIST 0 OPENSSL_VERSION_MAJOR)
list(GET OPENSSL_VERSION_LIST 1 OPENSSL_VERSION_MINOR)
list(GET OPENSSL_VERSION_LIST 2 OPENSSL_VERSION_FIX)
list(GET OPENSSL_VERSION_LIST 3 OPENSSL_VERSION_PATCH)
string(REGEX REPLACE "^0(.)" "\\1" OPENSSL_VERSION_MINOR "${OPENSSL_VERSION_MINOR}")
string(REGEX REPLACE "^0(.)" "\\1" OPENSSL_VERSION_FIX "${OPENSSL_VERSION_FIX}")
if (NOT OPENSSL_VERSION_PATCH STREQUAL "00")
# 96 is the ASCII code of 'a' minus 1
math(EXPR OPENSSL_VERSION_PATCH_ASCII "${OPENSSL_VERSION_PATCH} + 96")
# Once anyone knows how OpenSSL would call the patch versions beyond 'z'
# this should be updated to handle that, too. This has not happened yet
# so it is simply ignored here for now.
string(ASCII "${OPENSSL_VERSION_PATCH_ASCII}" OPENSSL_VERSION_PATCH_STRING)
endif (NOT OPENSSL_VERSION_PATCH STREQUAL "00")
set(OPENSSL_VERSION "${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}${OPENSSL_VERSION_PATCH_STRING}")
endif (_OPENSSL_VERSION)
include(EnsureVersion)
ENSURE_VERSION( "${OPENSSL_EXPECTED_VERSION}" "${OPENSSL_VERSION}" OPENSSL_VERSION_OK)
if (NOT OPENSSL_VERSION_OK)
message(FATAL_ERROR "SunwellCore needs OpenSSL version ${OPENSSL_EXPECTED_VERSION} but found version ${OPENSSL_VERSION}")
endif()
endif (OPENSSL_INCLUDE_DIR)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(OpenSSL DEFAULT_MSG
OPENSSL_LIBRARIES
OPENSSL_INCLUDE_DIR
)
MARK_AS_ADVANCED(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES)
+3 -3
View File
@@ -24,13 +24,13 @@ set(WITH_FAST_MUTEXES OFF)
# Handle useful options - hardcode to ON/OFF
set(ENABLED_PROFILING OFF)
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS_DEBUG ENABLED_DEBUG_SYNC)
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS $<$<CONFIG:Debug>:ENABLED_DEBUG_SYNC)
# Set DBUG_OFF and other optional release-only flags for non-debug project types
foreach(BUILD_TYPE RELEASE RELWITHDEBINFO MINSIZEREL)
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS_${BUILD_TYPE} DBUG_OFF)
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS_<CONFIG> DBUG_OFF)
if(WITH_FAST_MUTEXES)
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS_${BUILD_TYPE} "MY_PTHREAD_FASTMUTEX=1")
set_directory_properties(PROPERTIES COMPILE_DEFINITIONS_<CONFIG> "MY_PTHREAD_FASTMUTEX=1")
endif()
endforeach()
@@ -60,6 +60,8 @@ struct dtNavMeshCreateParams
float cs; // Cell size (xz) (wu).
float ch; // Cell height (y) (wu).
int tileSize; // Tile size (width & height) (vx).
int tileLayer;
bool buildBvTree;
};
// Build navmesh data from given input data.
+14
View File
@@ -0,0 +1,14 @@
DROP TABLE IF EXISTS `autobroadcast`;
CREATE TABLE `autobroadcast` (
`realmid` int(10) NOT NULL,
`id` int(11) NOT NULL AUTO_INCREMENT,
`weight` tinyint(3) DEFAULT 1,
`text` longtext NOT NULL,
PRIMARY KEY (`id`, `realmid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
ALTER TABLE `autobroadcast`
CHANGE `realmid` `realmid` INT(11) NOT NULL DEFAULT '-1',
CHANGE `id` `id` TINYINT(3) UNSIGNED NOT NULL AUTO_INCREMENT,
CHANGE `weight` `weight` TINYINT(3) UNSIGNED DEFAULT '1',
ENGINE=INNODB;
@@ -0,0 +1,66 @@
UPDATE `creature_template` set `AIName`='SmartAI' where entry in (32451);
UPDATE `creature` set `modelid`=0, movementType=2 where guid in (114330, 114331);
DELETE FROM creature_addon WHERE guid = 114331;
INSERT INTO creature_addon (guid, path_id, mount, bytes1, bytes2, emote,auras) VALUES (114331, 1143310, 0, 0, 1, 0, '');
DELETE FROM `smart_scripts` WHERE `source_type`=0 AND `entryorguid` in (32451);
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
(32451, 0, 0, 0, 1, 0, 100, 0, 5000, 5000, 120000, 120000, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Dalaran Citizen - Ooc - talk');
DELETE FROM waypoint_data WHERE id=1143310;
INSERT INTO waypoint_data (id, point, position_x, position_y, position_z, orientation, delay, move_type, ACTION, action_chance, wpguid)
VALUES
(1143310, 1, 5961.356445, 661.699219, 641.721252, 0, 0, 0, 0, 100, 0),
(1143310, 2, 5954.011230, 657.709167, 641.991577, 0, 0, 0, 0, 100, 0),
(1143310, 3, 5947.983887, 658.844055, 642.101562, 0, 0, 0, 0, 100, 0),
(1143310, 4, 5950.894043, 662.109314, 641.363831, 0, 0, 0, 0, 100, 0),
(1143310, 5, 5959.004395, 674.209778, 640.880432, 0, 0, 0, 0, 100, 0),
(1143310, 6, 5961.065430, 680.407043, 640.494263, 0, 0, 0, 0, 100, 0),
(1143310, 7, 5962.776367, 679.769470, 640.680603, 0, 0, 0, 0, 100, 0),
(1143310, 8, 5963.701172, 675.173035, 640.749817, 0, 0, 0, 0, 100, 0),
(1143310, 9, 5963.879883, 666.781982, 641.512024, 0, 20000, 0, 0, 100, 0);
Delete from creature_text where entry in (32451);
INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`, `TextRange`) VALUES
(32451, 0, 0, 'She said to meet her right here... maybe I''m in the wrong place?', 12, 0, 100, 1, 0, 0, 'Dalaran Citizen', 0),
(32451, 0, 1, 'Luckily, the Lich King''s grasp has not reached Dalaran yet.', 12, 0, 100, 1, 0, 0, 'Dalaran Citizen', 0),
(32451, 0, 2, 'Sometimes it''s nice to get away from the sanctum and get some fresh air.', 12, 0, 100, 1, 0, 0, 'Dalaran Citizen', 0);
UPDATE `creature` set movementType=2 where guid in (28686);
DELETE FROM creature_addon WHERE guid in (28686);
INSERT INTO creature_addon (guid, path_id, mount, bytes1, bytes2, emote,auras)
VALUES (28686, 286860, 0, 0, 0, 0, '');
DELETE FROM waypoint_data WHERE id in (286860);
INSERT INTO waypoint_data (id, point, position_x, position_y, position_z, orientation, delay, move_type, ACTION, action_chance, wpguid)VALUES
(286860, 1, 5960.950195, 598.314026, 650.627014, 0, 0, 0, 0, 100, 0),
(286860, 2, 5957.295898, 617.082153, 650.627258, 0, 0, 0, 0, 100, 0),
(286860, 3, 5894.468262, 657.878052, 644.688843, 0, 0, 0, 0, 100, 0),
(286860, 4, 5823.077637, 714.962402, 641.066895, 0, 0, 0, 0, 100, 0),
(286860, 5, 5799.794922, 719.503174, 640.661865, 0, 0, 0, 0, 100, 0),
(286860, 6, 5770.590820, 703.946777, 641.473755, 0, 0, 0, 0, 100, 0),
(286860, 7, 5728.678223, 659.602661, 645.874878, 0, 0, 0, 0, 100, 0),
(286860, 8, 5716.125977, 657.985718, 646.207947, 0, 0, 0, 0, 100, 0),
(286860, 9, 5701.286621, 654.542480, 646.277710, 0, 0, 0, 0, 100, 0),
(286860, 10, 5697.024902, 648.178040, 646.409180, 0, 0, 0, 0, 100, 0),
(286860, 11, 5728.723633, 617.990295, 647.119080, 0, 0, 0, 0, 100, 0),
(286860, 12, 5764.286621, 595.154358, 649.794617, 0, 0, 0, 0, 100, 0),
(286860, 13, 5771.400391, 598.777588, 650.299805, 0, 0, 0, 0, 100, 0),
(286860, 14, 5798.370605, 631.354919, 647.415161, 0, 20000, 0, 0, 100, 0),
(286860, 15, 5809.011719, 632.435669, 647.466370, 0, 0, 0, 0, 100, 0),
(286860, 16, 5813.840332, 639.437012, 647.445251, 0, 0, 0, 0, 100, 0),
(286860, 17, 5812.633301, 647.708679, 647.411682, 0, 0, 0, 0, 100, 0),
(286860, 18, 5837.737305, 679.004089, 643.481323, 0, 0, 0, 0, 100, 0),
(286860, 19, 5863.233887, 672.251282, 644.026489, 0, 0, 0, 0, 100, 0),
(286860, 20, 5872.090332, 660.963562, 644.639648, 0, 0, 0, 0, 100, 0),
(286860, 21, 5871.882812, 655.302795, 645.210327, 0, 0, 0, 0, 100, 0),
(286860, 22, 5866.628906, 656.807068, 645.358337, 0, 0, 0, 0, 100, 0),
(286860, 23, 5858.618164, 665.766174, 647.507935, 0, 0, 0, 0, 100, 0),
(286860, 24, 5854.410645, 663.378418, 647.491699, 0, 0, 0, 0, 100, 0),
(286860, 25, 5853.316406, 646.056763, 647.511597, 0, 0, 0, 0, 100, 0),
(286860, 26, 5855.305664, 646.037170, 647.511597, 0, 20000, 0, 0, 100, 0),
(286860, 27, 5853.801270, 644.892761, 647.511597, 0, 0, 0, 0, 100, 0),
(286860, 28, 5854.399902, 639.586365, 647.511597, 0, 0, 0, 0, 100, 0),
(286860, 29, 5861.342773, 632.158997, 647.913147, 0, 0, 0, 0, 100, 0),
(286860, 30, 5873.931152, 637.613953, 646.993347, 0, 0, 0, 0, 100, 0),
(286860, 31, 5888.598145, 639.828796, 646.219421, 0, 0, 0, 0, 100, 0),
(286860, 32, 5911.427246, 634.141296, 645.621460, 0, 0, 0, 0, 100, 0),
(286860, 33, 5944.164062, 622.176941, 650.655151, 0, 0, 0, 0, 100, 0),
(286860, 34, 5958.649414, 608.832092, 650.627136, 0, 0, 0, 0, 100, 0),
(286860, 35, 5960.950195, 598.314026, 650.627014, 0, 20000, 0, 0, 100, 0);
+82
View File
@@ -0,0 +1,82 @@
UPDATE `creature_template` SET `AIName`= 'SmartAI',`ScriptName`= '' WHERE `entry` IN(29491,28994,28721,28725,33027,28727,28715,28714,28726,29523,28989,28997,28723,28718);
DELETE FROM `smart_scripts` WHERE `entryorguid` IN(29491,28994,28721,28725,33027,28727,28715,28714,28726,29523,28989,28997,28723,28718) 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
(29491, 0, 0, 0, 10, 0, 100, 0, 1, 20, 30000, 120000, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Karandonna - OOC LOS - Say Line'),
(28994, 0, 0, 0, 10, 0, 100, 0, 1, 20, 30000, 120000, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Abra Cadabra - OOC LOS - Say Line'),
(28721, 0, 0, 0, 10, 0, 100, 0, 1, 20, 30000, 120000, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Tiffany Cartier - OOC LOS - Say Line'),
(28727, 0, 0, 0, 10, 0, 100, 0, 1, 20, 30000, 120000, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Edward Egan - OOC LOS - Say Line'),
(33027, 0, 0, 0, 10, 0, 100, 0, 1, 20, 30000, 120000, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Jessica Sellers - OOC LOS - Say Line'),
(28725, 0, 0, 0, 10, 0, 100, 0, 1, 20, 30000, 120000, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Patricia Egan - OOC LOS - Say Line'),
(28715, 0, 0, 0, 10, 0, 100, 0, 1, 20, 30000, 120000, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Endora Moorehead - OOC LOS - Say Line'),
(28714, 0, 0, 0, 10, 0, 100, 0, 1, 20, 30000, 120000, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Ildine Sorrowspear - OOC LOS - Say Line'),
(28726, 0, 0, 0, 10, 0, 100, 0, 1, 20, 30000, 120000, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Dominique Stefano - OOC LOS - Say Line'),
(29523, 0, 0, 0, 10, 0, 100, 0, 1, 20, 30000, 120000, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Bragund Brightlink - OOC LOS - Say Line'),
(28989, 0, 0, 0, 10, 0, 100, 0, 1, 20, 30000, 120000, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Aemara - OOC LOS - Say Line'),
(28997, 0, 0, 0, 10, 0, 100, 0, 1, 20, 30000, 120000, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Griselda Hunderland - OOC LOS - Say Line'),
(28723, 0, 0, 0, 10, 0, 100, 0, 1, 20, 30000, 120000, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Larana Drome - OOC LOS - Say Line'),
(28718, 0, 0, 0, 10, 0, 100, 0, 1, 20, 30000, 120000, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Ranid Glowergold - OOC LOS - Say Line');
DELETE FROM `creature_text` WHERE `entry` IN(29491,28994,28721,28725,33027,28727,28715,28714,28726,29523,28989,28997,28723,28718);
INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`, `TextRange`) VALUES
(29491, 0, 0, 'Welcome. May I help you find something?', 12, 0, 100, 3, 0, 0, 'Karandonna', 0),
(29491, 0, 1, 'Welcome.', 12, 0, 100, 3, 0, 0, 'Karandonna',0),
(28994, 0, 0, 'Greetings.', 12, 0, 100, 3, 0, 0, 'Abra Cadabra',0),
(28994, 0, 1, 'Welcome. May I help you find something?', 12, 0, 100, 3, 0, 0, 'Abra Cadabra',0),
(28994, 0, 2, 'Welcome.', 12, 0, 100, 3, 0, 0, 'Abra Cadabra',0),
(28994, 0, 3, 'Let me know if you need help finding anything, $c.', 12, 0, 100, 3, 0, 0, 'Abra Cadabra',0),
(28721, 0, 0, 'Greetings! Please have a look around.', 12, 0, 100, 3, 0, 0, 'Tiffany Cartier',0),
(28721, 0, 1, 'Greetings, $c.', 12, 0, 100, 3, 0, 0, 'Tiffany Cartier',0),
(28721, 0, 2, 'Greetings.', 12, 0, 100, 3, 0, 0, 'Tiffany Cartier',0),
(28721, 0, 3, 'Let me know if you need help finding anything, $c.', 12, 0, 100, 3, 0, 0, 'Tiffany Cartier',0),
(28721, 0, 4, 'Welcome.', 12, 0, 100, 3, 0, 0, 'Tiffany Cartier',0),
(28721, 0, 5, 'Welcome. May I help you find something?', 12, 0, 100, 3, 0, 0, 'Tiffany Cartier',0),
(28725, 0, 0, 'Welcome. May I help you find something?', 12, 0, 100, 3, 0, 0, 'Patricia Egan',0),
(28725, 0, 1, 'Welcome.', 12, 0, 100, 3, 0, 0, 'Patricia Egan',0),
(28725, 0, 2, 'Greetings! Please have a look around.', 12, 0, 100, 3, 0, 0, 'Patricia Egan',0),
(28725, 0, 3, 'Welcome!', 12, 0, 100, 3, 0, 0, 'Patricia Egan',0),
(33027, 0, 0, 'Let me know if you need help finding anything, $c.', 12, 0, 100, 3, 0, 0, 'Jessica Sellers',0),
(33027, 0, 1, 'Greetings, $c.', 12, 0, 100, 3, 0, 0, 'Jessica Sellers',0),
(33027, 0, 2, 'Welcome. May I help you find something?', 12, 0, 100, 3, 0, 0, 'Jessica Sellers',0),
(33027, 0, 3, 'Greetings! Please have a look around.', 12, 0, 100, 3, 0, 0, 'Jessica Sellers',0),
(33027, 0, 4, 'Welcome.', 12, 0, 100, 3, 0, 0, 'Jessica Sellers',0),
(28727, 0, 0, 'Welcome!', 12, 0, 100, 3, 0, 0, 'Edward Egan',0),
(28727, 0, 1, 'Greetings.', 12, 0, 100, 3, 0, 0, 'Edward Egan',0),
(28727, 0, 2, 'Welcome. May I help you find something?', 12, 0, 100, 3, 0, 0, 'Edward Egan',0),
(28727, 0, 3, 'Greetings! Please have a look around.', 12, 0, 100, 3, 0, 0, 'Edward Egan', 0),
(28715, 0, 0, 'Greetings! Please have a look around.', 12, 0, 100, 3, 0, 0, 'Endora Moorehead',0),
(28715, 0, 1, 'Greetings, $c.', 12, 0, 100, 3, 0, 0, 'Endora Moorehead',0),
(28715, 0, 2, 'Welcome!', 12, 0, 100, 3, 0, 0, 'Endora Moorehead',0),
(28714, 0, 0, 'Welcome.', 12, 0, 100, 3, 0, 0, 'Ildine Sorrowspear',0),
(28714, 0, 1, 'Greetings.', 12, 0, 100, 3, 0, 0, 'Ildine Sorrowspear',0),
(28714, 0, 2, 'Let me know if you need help finding anything, $c.', 12, 0, 100, 3, 0, 0, 'Ildine Sorrowspear',0),
(28726, 0, 0, 'Greetings! Please have a look around.', 12, 0, 100, 3, 0, 0, 'Dominique Stefano',0),
(28726, 0, 1, 'Welcome!', 12, 0, 100, 3, 0, 0, 'Dominique Stefano',0),
(28726, 0, 2, 'Greetings, $c.', 12, 0, 100, 3, 0, 0, 'Dominique Stefano',0),
(28726, 0, 3, 'Welcome. May I help you find something?', 12, 0, 100, 3, 0, 0, 'Dominique Stefano',0),
(28726, 0, 4, 'Greetings.', 12, 0, 100, 3, 0, 0, 'Dominique Stefano',0),
(28726, 0, 5, 'Let me know if you need help finding anything, $c.', 12, 0, 100, 3, 0, 0, 'Dominique Stefano',0),
(29523, 0, 0, 'Welcome.', 12, 0, 100, 3, 0, 0, 'Bragund Brightlink',0),
(29523, 0, 1, 'Welcome!', 12, 0, 100, 3, 0, 0, 'Bragund Brightlink',0),
(29523, 0, 2, 'Greetings! Please have a look around.', 12, 0, 100, 3, 0, 0, 'Bragund Brightlink',0),
(29523, 0, 3, 'Let me know if you need help finding anything, $c.', 12, 0, 100, 3, 0, 0, 'Bragund Brightlink',0),
(28989, 0, 0, 'Greetings! Please have a look around.', 12, 0, 100, 3, 0, 0, 'Aemara',0),
(28989, 0, 1, 'Greetings.', 12, 0, 100, 3, 0, 0, 'Aemara',0),
(28989, 0, 2, 'Welcome. May I help you find something?', 12, 0, 100, 3, 0, 0, 'Aemara',0),
(28989, 0, 3, 'Greetings, $c.', 12, 0, 100, 3, 0, 0, 'Aemara',0),
(28989, 0, 4, 'Let me know if you need help finding anything, $c.', 12, 0, 100, 3, 0, 0, 'Aemara',0),
(28989, 0, 5, 'Welcome.', 12, 0, 100, 3, 0, 0, 'Aemara',0),
(28997, 0, 0, 'Greetings, $c.', 12, 0, 100, 3, 0, 0, 'Griselda Hunderland',0),
(28997, 0, 1, 'Let me know if you need help finding anything, $c.', 12, 0, 100, 3, 0, 0, 'Griselda Hunderland',0),
(28997, 0, 2, 'Greetings.', 12, 0, 100, 3, 0, 0, 'Griselda Hunderland',0),
(28997, 0, 3, 'Welcome!', 12, 0, 100, 3, 0, 0, 'Griselda Hunderland',0),
(28723, 0, 0, 'Greetings, $c.', 12, 0, 100, 3, 0, 0, 'Larana Drome',0),
(28723, 0, 1, 'Greetings.', 12, 0, 100, 3, 0, 0, 'Larana Drome',0),
(28723, 0, 2, 'Welcome.', 12, 0, 100, 3, 0, 0, 'Larana Drome',0),
(28718, 0, 0, 'Welcome!', 12, 0, 100, 3, 0, 0, 'Ranid Glowergold',0),
(28718, 0, 1, 'Greetings.', 12, 0, 100, 3, 0, 0, 'Ranid Glowergold',0),
(28718, 0, 2, 'Welcome. May I help you find something?', 12, 0, 100, 3, 0, 0, 'Ranid Glowergold',0),
(28718, 0, 3, 'Let me know if you need help finding anything, $c.', 12, 0, 100, 3, 0, 0, 'Ranid Glowergold',0),
(28718, 0, 4, 'Greetings! Please have a look around.', 12, 0, 100, 3, 0, 0, 'Ranid Glowergold',0),
(28718, 0, 5, 'Greetings, $c.', 12, 0, 100, 3, 0, 0, 'Ranid Glowergold',0),
(28718, 0, 6, 'Welcome.', 12, 0, 100, 3, 0, 0, 'Ranid Glowergold',0);
+34
View File
@@ -0,0 +1,34 @@
--
SET @Linda :=32687;
SET @Alec :=32692;
UPDATE creature_template SET `AIName`='SmartAI' WHERE entry IN (@Linda, @Alec);
DELETE FROM `smart_scripts` WHERE `entryorguid` = @Linda AND `source_type` = 0;
DELETE FROM `smart_scripts` WHERE `entryorguid` = @Linda*100 AND `source_type` = 9;
DELETE FROM `smart_scripts` WHERE `entryorguid` = @Linda*100+1 AND `source_type` = 9;
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
(@Linda, 0, 0, 0, 10, 0, 100, 0, 1, 10, 300000, 300000, 87, @Linda*100, @Linda*100+1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 'Linda - OOC_LOS - RANDOM_TIMED_ACTIONLIST'),
(@Linda*100,9,0,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Linda - RANDOM_TIMED_ACTIONLIST - talk'),
(@Linda*100+1,9,0,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,19,@Alec,5,0,0,0,0,0,'Linda - RANDOM_TIMED_ACTIONLIST - talk');
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=22 AND `SourceGroup`=1 AND `SourceEntry`=@Linda;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`, `ErrorTextId`,`ScriptName`,`Comment`) VALUES
(22,1,@Linda,0,5,1090,128,0,0,'','event require Kirin Tor Exalted');
DELETE FROM creature_text WHERE entry IN (@Linda, @Alec);
INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`, `TextRange`) VALUES
(@Linda, 0, 0, 'There goes the finest $c I have the honor of knowing.', 12, 0, 100, 0, 0, 0, 'Linda Ann Kastinglow', 0),
(@Linda, 0, 1, '$n, you''re an inspiration.', 12, 0, 100, 0, 0, 0, 'Linda Ann Kastinglow', 0),
(@Linda, 0, 2, 'A fine example of a $g man:woman;, that $n.', 12, 0, 100, 0, 0, 0, 'Linda Ann Kastinglow', 0),
(@Linda, 0, 3, 'You couldn''t ask for a finer person than $n, I say.', 12, 0, 100, 0, 0, 0, 'Linda Ann Kastinglow', 0),
(@Linda, 0, 4, '$n, wonderful to see you. Wonderful.', 12, 0, 100, 0, 0, 0, 'Linda Ann Kastinglow', 0),
(@Linda, 0, 5, '$n! Ah, fantastic to see you out and about. Busy as always, hm?', 12, 0, 100, 0, 0, 0, 'Linda Ann Kastinglow', 0),
(@Alec, 0, 0, 'There goes the finest $c I have the honor of knowing.', 12, 0, 100, 0, 0, 0, 'Arcanist Alec', 0),
(@Alec, 0, 1, '$n, you''re an inspiration.', 12, 0, 100, 0, 0, 0, 'Arcanist Alec', 0),
(@Alec, 0, 2, 'A fine example of a $g man:woman;, that $n.', 12, 0, 100, 0, 0, 0, 'Arcanist Alec', 0),
(@Alec, 0, 3, 'You couldn''t ask for a finer person than $n, I say.', 12, 0, 100, 0, 0, 0, 'Arcanist Alec', 0),
(@Alec, 0, 4, '$n, wonderful to see you. Wonderful.', 12, 0, 100, 0, 0, 0, 'Arcanist Alec', 0),
(@Alec, 0, 5, '$n! Ah, fantastic to see you out and about. Busy as always, hm?', 12, 0, 100, 0, 0, 0, 'Arcanist Alec', 0);
+24 -24
View File
@@ -234,7 +234,7 @@ void AuthSocket::OnRead()
++challengesInARow;
if (challengesInARow == MAX_AUTH_LOGON_CHALLENGES_IN_A_ROW)
{
sLog->outString("Got %u AUTH_LOGON_CHALLENGE in a row from '%s', possible ongoing DoS", challengesInARow, socket().getRemoteAddress().c_str());
sLog->outString("Got %u AUTH_LOGON_CHALLENGE in a row from '%s', possible ongoing DoS", challengesInARow, socket().getRemoteAddress().c_str());
socket().shutdown();
return;
}
@@ -318,29 +318,29 @@ bool AuthSocket::_HandleLogonChallenge()
if (socket().recv_len() < sizeof(sAuthLogonChallenge_C))
return false;
// pussywizard: logon flood protection:
{
TRINITY_GUARD(ACE_Thread_Mutex, LastLoginAttemptMutex);
std::string ipaddr = socket().getRemoteAddress();
uint32 currTime = time(NULL);
std::map<std::string, uint32>::iterator itr = LastLoginAttemptTimeForIP.find(ipaddr);
if (itr != LastLoginAttemptTimeForIP.end() && itr->second >= currTime)
{
ByteBuffer pkt;
pkt << uint8(AUTH_LOGON_CHALLENGE);
pkt << uint8(0x00);
pkt << uint8(WOW_FAIL_UNKNOWN_ACCOUNT);
socket().send((char const*)pkt.contents(), pkt.size());
return true;
}
if (LastLoginAttemptCleanTime+60 < currTime)
{
LastLoginAttemptTimeForIP.clear();
LastLoginAttemptCleanTime = currTime;
}
else
LastLoginAttemptTimeForIP[ipaddr] = currTime;
}
// pussywizard: logon flood protection:
{
TRINITY_GUARD(ACE_Thread_Mutex, LastLoginAttemptMutex);
std::string ipaddr = socket().getRemoteAddress();
uint32 currTime = time(NULL);
std::map<std::string, uint32>::iterator itr = LastLoginAttemptTimeForIP.find(ipaddr);
if (itr != LastLoginAttemptTimeForIP.end() && itr->second >= currTime)
{
ByteBuffer pkt;
pkt << uint8(AUTH_LOGON_CHALLENGE);
pkt << uint8(0x00);
pkt << uint8(WOW_FAIL_UNKNOWN_ACCOUNT);
socket().send((char const*)pkt.contents(), pkt.size());
return true;
}
if (LastLoginAttemptCleanTime+60 < currTime)
{
LastLoginAttemptTimeForIP.clear();
LastLoginAttemptCleanTime = currTime;
}
else
LastLoginAttemptTimeForIP[ipaddr] = currTime;
}
// Read the first 4 bytes (header) to get the length of the remaining of the packet
std::vector<uint8> buf;
@@ -41,14 +41,14 @@ namespace MMAP
return !forbiddenMaps[map->GetId()] && (sWorld->getBoolConfig(CONFIG_ENABLE_MMAPS) ? true : map->IsBattlegroundOrArena());
}
void MMapFactory::InitializeDisabledMaps()
{
memset(&forbiddenMaps, 0, sizeof(forbiddenMaps));
int32 f[] = {616 /*EoE*/, 649 /*ToC25*/, 650 /*ToC5*/, -1};
uint32 i = 0;
while (f[i] >= 0)
forbiddenMaps[f[i++]] = true;
}
void MMapFactory::InitializeDisabledMaps()
{
memset(&forbiddenMaps, 0, sizeof(forbiddenMaps));
int32 f[] = {616 /*EoE*/, 649 /*ToC25*/, 650 /*ToC5*/, -1};
uint32 i = 0;
while (f[i] >= 0)
forbiddenMaps[f[i++]] = true;
}
void MMapFactory::clear()
{
@@ -311,7 +311,7 @@ namespace MMAP
dtNavMesh const* MMapManager::GetNavMesh(uint32 mapId)
{
// pussywizard: moved to calling function
// pussywizard: moved to calling function
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock);
if (loadedMMaps.find(mapId) == loadedMMaps.end())
@@ -322,18 +322,18 @@ namespace MMAP
dtNavMeshQuery const* MMapManager::GetNavMeshQuery(uint32 mapId, uint32 instanceId)
{
// pussywizard: moved to calling function
// pussywizard: moved to calling function
//TRINITY_READ_GUARD(ACE_RW_Thread_Mutex, MMapManagerLock);
if (loadedMMaps.find(mapId) == loadedMMaps.end())
return NULL;
MMapData* mmap = loadedMMaps[mapId];
if (mmap->navMeshQueries.find(instanceId) == mmap->navMeshQueries.end())
{
// pussywizard: different instances of the same map shouldn't access this simultaneously
TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetMMapLock(mapId));
// check again after acquiring mutex
if (mmap->navMeshQueries.find(instanceId) == mmap->navMeshQueries.end())
{
// pussywizard: different instances of the same map shouldn't access this simultaneously
TRINITY_WRITE_GUARD(ACE_RW_Thread_Mutex, GetMMapLock(mapId));
// check again after acquiring mutex
if (mmap->navMeshQueries.find(instanceId) == mmap->navMeshQueries.end())
{
// allocate mesh query
@@ -349,7 +349,7 @@ namespace MMAP
;//sLog->outDetail("MMAP:GetNavMeshQuery: created dtNavMeshQuery for mapId %03u instanceId %u", mapId, instanceId);
mmap->navMeshQueries.insert(std::pair<uint32, dtNavMeshQuery*>(instanceId, query));
}
}
}
return mmap->navMeshQueries[instanceId];
}
@@ -86,8 +86,8 @@ namespace MMAP
uint32 getLoadedMapsCount() const { return loadedMMaps.size(); }
ACE_RW_Thread_Mutex& GetMMapLock(uint32 mapId);
ACE_RW_Thread_Mutex& GetMMapGeneralLock() { return MMapLock; } // pussywizard: in case a per-map mutex can't be found, should never happen
ACE_RW_Thread_Mutex& GetManagerLock() { return MMapManagerLock; }
ACE_RW_Thread_Mutex& GetMMapGeneralLock() { return MMapLock; } // pussywizard: in case a per-map mutex can't be found, should never happen
ACE_RW_Thread_Mutex& GetManagerLock() { return MMapManagerLock; }
private:
bool loadMapData(uint32 mapId);
uint32 packTileID(int32 x, int32 y);
@@ -96,7 +96,7 @@ namespace MMAP
uint32 loadedTiles;
ACE_RW_Thread_Mutex MMapManagerLock;
ACE_RW_Thread_Mutex MMapLock; // pussywizard: in case a per-map mutex can't be found, should never happen
ACE_RW_Thread_Mutex MMapLock; // pussywizard: in case a per-map mutex can't be found, should never happen
};
}
@@ -96,10 +96,10 @@ namespace VMAP
std::string mapFileName = getMapFileName(mapId);
StaticMapTree* newTree = new StaticMapTree(mapId, basePath);
if (!newTree->InitMap(mapFileName, this))
{
delete newTree;
{
delete newTree;
return false;
}
}
instanceTree = iInstanceMapTrees.insert(InstanceTreeMap::value_type(mapId, newTree)).first;
}
@@ -120,8 +120,8 @@ bool GameObjectModel::initialize(const GameObject& go, const GameObjectDisplayIn
//ID = 0;
iPos = Vector3(go.GetPositionX(), go.GetPositionY(), go.GetPositionZ());
// pussywizard:
phasemask = (go.GetGoState() == GO_STATE_READY || go.IsTransport()) ? go.GetPhaseMask() : 0;
// pussywizard:
phasemask = (go.GetGoState() == GO_STATE_READY || go.IsTransport()) ? go.GetPhaseMask() : 0;
iScale = go.GetFloatValue(OBJECT_FIELD_SCALE_X);
iInvScale = 1.f / iScale;
+46 -46
View File
@@ -13,19 +13,19 @@ template <class Node>
class NodeArray
{
public:
explicit NodeArray() { memset(&_nodes, 0, sizeof(_nodes)); }
void AddNode(Node* n)
{
for (uint8 i=0; i<9; ++i)
if (_nodes[i] == 0)
{
_nodes[i] = n;
return;
}
else if (_nodes[i] == n)
return;
}
Node* _nodes[9];
explicit NodeArray() { memset(&_nodes, 0, sizeof(_nodes)); }
void AddNode(Node* n)
{
for (uint8 i=0; i<9; ++i)
if (_nodes[i] == 0)
{
_nodes[i] = n;
return;
}
else if (_nodes[i] == n)
return;
}
Node* _nodes[9];
};
template<class Node>
@@ -68,47 +68,47 @@ public:
void insert(const T& value)
{
G3D::Vector3 pos[9];
pos[0] = value.getBounds().corner(0);
pos[1] = value.getBounds().corner(1);
pos[2] = value.getBounds().corner(2);
pos[3] = value.getBounds().corner(3);
pos[4] = (pos[0] + pos[1])/2.0f;
pos[5] = (pos[1] + pos[2])/2.0f;
pos[6] = (pos[2] + pos[3])/2.0f;
pos[7] = (pos[3] + pos[0])/2.0f;
pos[8] = (pos[0] + pos[2])/2.0f;
pos[0] = value.getBounds().corner(0);
pos[1] = value.getBounds().corner(1);
pos[2] = value.getBounds().corner(2);
pos[3] = value.getBounds().corner(3);
pos[4] = (pos[0] + pos[1])/2.0f;
pos[5] = (pos[1] + pos[2])/2.0f;
pos[6] = (pos[2] + pos[3])/2.0f;
pos[7] = (pos[3] + pos[0])/2.0f;
pos[8] = (pos[0] + pos[2])/2.0f;
NodeArray<Node> na;
for (uint8 i=0; i<9; ++i)
{
Cell c = Cell::ComputeCell(pos[i].x, pos[i].y);
if (!c.isValid())
continue;
Node& node = getGridFor(pos[i].x, pos[i].y);
na.AddNode(&node);
}
NodeArray<Node> na;
for (uint8 i=0; i<9; ++i)
{
Cell c = Cell::ComputeCell(pos[i].x, pos[i].y);
if (!c.isValid())
continue;
Node& node = getGridFor(pos[i].x, pos[i].y);
na.AddNode(&node);
}
for (uint8 i=0; i<9; ++i)
{
if (na._nodes[i])
na._nodes[i]->insert(value);
else
break;
}
for (uint8 i=0; i<9; ++i)
{
if (na._nodes[i])
na._nodes[i]->insert(value);
else
break;
}
memberTable.set(&value, na);
}
void remove(const T& value)
{
NodeArray<Node>& na = memberTable[&value];
for (uint8 i=0; i<9; ++i)
{
if (na._nodes[i])
na._nodes[i]->remove(value);
else
break;
}
NodeArray<Node>& na = memberTable[&value];
for (uint8 i=0; i<9; ++i)
{
if (na._nodes[i])
na._nodes[i]->remove(value);
else
break;
}
// Remove the member
memberTable.remove(&value);
+2 -2
View File
@@ -274,8 +274,8 @@ void VehicleAI::UpdateAI(uint32 diff)
m_DoDismiss = false;
me->DespawnOrUnsummon();
}
else
m_DismissTimer -= diff;
else
m_DismissTimer -= diff;
}
}
+1 -1
View File
@@ -61,7 +61,7 @@ class GameObjectAI
virtual void OnGameEvent(bool /*start*/, uint16 /*eventId*/) {}
virtual void OnStateChanged(uint32 /*state*/, Unit* /*unit*/) {}
virtual void EventInform(uint32 /*eventId*/) {}
virtual void SpellHit(Unit* unit, const SpellInfo* spellInfo) {}
virtual void SpellHit(Unit* unit, const SpellInfo* spellInfo) {}
};
class NullGameObjectAI : public GameObjectAI
+2 -2
View File
@@ -37,8 +37,8 @@ GuardAI::GuardAI(Creature* creature) : ScriptedAI(creature)
void GuardAI::Reset()
{
ScriptedAI::Reset();
me->CastSpell(me, 18950 /*SPELL_INVISIBILITY_AND_STEALTH_DETECTION*/, true);
ScriptedAI::Reset();
me->CastSpell(me, 18950 /*SPELL_INVISIBILITY_AND_STEALTH_DETECTION*/, true);
}
void GuardAI::EnterEvadeMode()
+1 -1
View File
@@ -30,7 +30,7 @@ class GuardAI : public ScriptedAI
static int Permissible(Creature const* creature);
void Reset();
void Reset();
void EnterEvadeMode();
void JustDied(Unit* killer);
};
+9 -9
View File
@@ -64,7 +64,7 @@ void CritterAI::DamageTaken(Unit*, uint32&, DamageEffectType, SpellSchoolMask)
if (!me->HasUnitState(UNIT_STATE_FLEEING))
me->SetControlled(true, UNIT_STATE_FLEEING);
_combatTimer = 1;
_combatTimer = 1;
}
void CritterAI::EnterEvadeMode()
@@ -72,21 +72,21 @@ void CritterAI::EnterEvadeMode()
if (me->HasUnitState(UNIT_STATE_FLEEING))
me->SetControlled(false, UNIT_STATE_FLEEING);
CreatureAI::EnterEvadeMode();
_combatTimer = 0;
_combatTimer = 0;
}
void CritterAI::UpdateAI(uint32 diff)
{
if (me->IsInCombat())
{
_combatTimer += diff;
if (_combatTimer >= 5000)
EnterEvadeMode();
}
if (me->IsInCombat())
{
_combatTimer += diff;
if (_combatTimer >= 5000)
EnterEvadeMode();
}
}
void TriggerAI::IsSummonedBy(Unit* summoner)
{
if (me->m_spells[0])
me->CastSpell(me, me->m_spells[0], false, 0, 0, summoner ? summoner->GetGUID() : 0);
me->CastSpell(me, me->m_spells[0], false, 0, 0, summoner ? summoner->GetGUID() : 0);
}
+4 -4
View File
@@ -71,11 +71,11 @@ class CritterAI : public PassiveAI
void DamageTaken(Unit* /*done_by*/, uint32& /*damage*/, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask);
void EnterEvadeMode();
void UpdateAI(uint32);
void UpdateAI(uint32);
// Xinef: Added
private:
uint32 _combatTimer;
// Xinef: Added
private:
uint32 _combatTimer;
};
class TriggerAI : public NullCreatureAI
+95 -95
View File
@@ -51,22 +51,22 @@ bool PetAI::_needToStop()
if (me->IsCharmed() && me->GetVictim() == me->GetCharmer())
return true;
// xinef: dont allow to follow targets out of visibility range
if (me->GetExactDist(me->GetVictim()) > me->GetVisibilityRange()-5.0f)
return true;
// xinef: dont allow to follow targets out of visibility range
if (me->GetExactDist(me->GetVictim()) > me->GetVisibilityRange()-5.0f)
return true;
// dont allow pets to follow targets far away from owner
if (Unit* owner = me->GetCharmerOrOwner())
if (owner->GetExactDist(me) >= (owner->GetVisibilityRange()-10.0f))
return true;
// dont allow pets to follow targets far away from owner
if (Unit* owner = me->GetCharmerOrOwner())
if (owner->GetExactDist(me) >= (owner->GetVisibilityRange()-10.0f))
return true;
if (!me->_CanDetectFeignDeathOf(me->GetVictim()))
return true;
if (!me->_CanDetectFeignDeathOf(me->GetVictim()))
return true;
if (me->isTargetNotAcceptableByMMaps(me->GetVictim()->GetGUID(), sWorld->GetGameTime(), me->GetVictim()))
return true;
if (me->isTargetNotAcceptableByMMaps(me->GetVictim()->GetGUID(), sWorld->GetGameTime(), me->GetVictim()))
return true;
return !me->CanCreatureAttack(me->GetVictim());
return !me->CanCreatureAttack(me->GetVictim());
}
void PetAI::_stopAttack()
@@ -90,18 +90,18 @@ void PetAI::_stopAttack()
void PetAI::_doMeleeAttack()
{
// Xinef: Imps cannot attack with melee
if (!_canMeleeAttack())
return;
// Xinef: Imps cannot attack with melee
if (!_canMeleeAttack())
return;
DoMeleeAttackIfReady();
DoMeleeAttackIfReady();
}
bool PetAI::_canMeleeAttack() const
{
return me->GetEntry() != 416 /*ENTRY_IMP*/ &&
me->GetEntry() != 510 /*ENTRY_WATER_ELEMENTAL*/ &&
me->GetEntry() != 37994 /*ENTRY_WATER_ELEMENTAL_PERM*/;
return me->GetEntry() != 416 /*ENTRY_IMP*/ &&
me->GetEntry() != 510 /*ENTRY_WATER_ELEMENTAL*/ &&
me->GetEntry() != 37994 /*ENTRY_WATER_ELEMENTAL_PERM*/;
}
void PetAI::UpdateAI(uint32 diff)
@@ -162,34 +162,34 @@ void PetAI::UpdateAI(uint32 diff)
HandleReturnMovement();
}
// xinef: charm info must be always available
if (!me->GetCharmInfo())
return;
// xinef: charm info must be always available
if (!me->GetCharmInfo())
return;
// Autocast (casted only in combat or persistent spells in any state)
if (!me->HasUnitState(UNIT_STATE_CASTING))
{
if (owner && owner->GetTypeId() == TYPEID_PLAYER && me->GetCharmInfo()->GetForcedSpell() && me->GetCharmInfo()->GetForcedTarget())
{
owner->ToPlayer()->GetSession()->HandlePetActionHelper(me, me->GetGUID(), abs(me->GetCharmInfo()->GetForcedSpell()), ACT_ENABLED, me->GetCharmInfo()->GetForcedTarget());
if (owner && owner->GetTypeId() == TYPEID_PLAYER && me->GetCharmInfo()->GetForcedSpell() && me->GetCharmInfo()->GetForcedTarget())
{
owner->ToPlayer()->GetSession()->HandlePetActionHelper(me, me->GetGUID(), abs(me->GetCharmInfo()->GetForcedSpell()), ACT_ENABLED, me->GetCharmInfo()->GetForcedTarget());
// xinef: if spell was casted properly and we are in passive mode, handle return
if (!me->GetCharmInfo()->GetForcedSpell() && me->HasReactState(REACT_PASSIVE))
{
if (me->HasUnitState(UNIT_STATE_CASTING))
{
me->GetMotionMaster()->Clear(false);
me->StopMoving();
}
else
_stopAttack();
}
return;
}
// xinef: if spell was casted properly and we are in passive mode, handle return
if (!me->GetCharmInfo()->GetForcedSpell() && me->HasReactState(REACT_PASSIVE))
{
if (me->HasUnitState(UNIT_STATE_CASTING))
{
me->GetMotionMaster()->Clear(false);
me->StopMoving();
}
else
_stopAttack();
}
return;
}
// xinef: dont allow ghouls to cast spells below 75 energy
if (me->IsPet() && me->ToPet()->IsPetGhoul() && me->GetPower(POWER_ENERGY) < 75)
return;
// xinef: dont allow ghouls to cast spells below 75 energy
if (me->IsPet() && me->ToPet()->IsPetGhoul() && me->GetPower(POWER_ENERGY) < 75)
return;
typedef std::vector<std::pair<Unit*, Spell*> > TargetSpellList;
TargetSpellList targetSpellStore;
@@ -221,7 +221,7 @@ void PetAI::UpdateAI(uint32 diff)
}
Spell* spell = new Spell(me, spellInfo, TRIGGERED_NONE, 0);
spell->LoadScripts(); // xinef: load for CanAutoCast (calling CheckPetCast)
spell->LoadScripts(); // xinef: load for CanAutoCast (calling CheckPetCast)
bool spellUsed = false;
// Some spells can target enemy or friendly (DK Ghoul's Leap)
@@ -333,7 +333,7 @@ void PetAI::UpdateAllies()
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* Target = itr->GetSource();
if (!Target || !Target->IsInMap(owner) || !group->SameSubGroup(owner->ToPlayer(), Target))
if (!Target || !Target->IsInMap(owner) || !group->SameSubGroup(owner->ToPlayer(), Target))
continue;
if (Target->GetGUID() == owner->GetGUID())
@@ -353,9 +353,9 @@ void PetAI::KilledUnit(Unit* victim)
if (me->GetVictim() && me->GetVictim() != victim)
return;
// Xinef: if pet is channeling a spell and owner killed something different, dont interrupt it
if (me->HasUnitState(UNIT_STATE_CASTING) && me->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT) && me->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT) != victim->GetGUID())
return;
// Xinef: if pet is channeling a spell and owner killed something different, dont interrupt it
if (me->HasUnitState(UNIT_STATE_CASTING) && me->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT) && me->GetUInt64Value(UNIT_FIELD_CHANNEL_OBJECT) != victim->GetGUID())
return;
// Clear target just in case. May help problem where health / focus / mana
// regen gets stuck. Also resets attack command.
@@ -437,35 +437,35 @@ Unit* PetAI::SelectNextTarget(bool allowAutoSelect) const
// Check pet attackers first so we don't drag a bunch of targets to the owner
if (Unit* myAttacker = me->getAttackerForHelper())
if (!myAttacker->HasBreakableByDamageCrowdControlAura() && me->_CanDetectFeignDeathOf(myAttacker) && me->CanCreatureAttack(myAttacker) && !me->isTargetNotAcceptableByMMaps(myAttacker->GetGUID(), sWorld->GetGameTime(), myAttacker))
if (!myAttacker->HasBreakableByDamageCrowdControlAura() && me->_CanDetectFeignDeathOf(myAttacker) && me->CanCreatureAttack(myAttacker) && !me->isTargetNotAcceptableByMMaps(myAttacker->GetGUID(), sWorld->GetGameTime(), myAttacker))
return myAttacker;
// Check pet's attackers first to prevent dragging mobs back to owner
if (me->HasAuraType(SPELL_AURA_MOD_TAUNT))
{
const Unit::AuraEffectList& tauntAuras = me->GetAuraEffectsByType(SPELL_AURA_MOD_TAUNT);
if (!tauntAuras.empty())
for (Unit::AuraEffectList::const_reverse_iterator itr = tauntAuras.rbegin(); itr != tauntAuras.rend(); ++itr)
if (Unit* caster = (*itr)->GetCaster())
if (me->_CanDetectFeignDeathOf(caster) && me->CanCreatureAttack(caster) && !caster->HasAuraTypeWithCaster(SPELL_AURA_IGNORED, me->GetGUID()))
return caster;
}
if (me->HasAuraType(SPELL_AURA_MOD_TAUNT))
{
const Unit::AuraEffectList& tauntAuras = me->GetAuraEffectsByType(SPELL_AURA_MOD_TAUNT);
if (!tauntAuras.empty())
for (Unit::AuraEffectList::const_reverse_iterator itr = tauntAuras.rbegin(); itr != tauntAuras.rend(); ++itr)
if (Unit* caster = (*itr)->GetCaster())
if (me->_CanDetectFeignDeathOf(caster) && me->CanCreatureAttack(caster) && !caster->HasAuraTypeWithCaster(SPELL_AURA_IGNORED, me->GetGUID()))
return caster;
}
// Not sure why we wouldn't have an owner but just in case...
Unit* owner = me->GetCharmerOrOwner();
Unit* owner = me->GetCharmerOrOwner();
if (!owner)
return NULL;
// Check owner attackers
if (Unit* ownerAttacker = owner->getAttackerForHelper())
if (!ownerAttacker->HasBreakableByDamageCrowdControlAura() && me->_CanDetectFeignDeathOf(ownerAttacker) && me->CanCreatureAttack(ownerAttacker) && !me->isTargetNotAcceptableByMMaps(ownerAttacker->GetGUID(), sWorld->GetGameTime(), ownerAttacker))
if (!ownerAttacker->HasBreakableByDamageCrowdControlAura() && me->_CanDetectFeignDeathOf(ownerAttacker) && me->CanCreatureAttack(ownerAttacker) && !me->isTargetNotAcceptableByMMaps(ownerAttacker->GetGUID(), sWorld->GetGameTime(), ownerAttacker))
return ownerAttacker;
// Check owner victim
// 3.0.2 - Pets now start attacking their owners victim in defensive mode as soon as the hunter does
if (Unit* ownerVictim = owner->GetVictim())
if (me->_CanDetectFeignDeathOf(ownerVictim) && me->CanCreatureAttack(ownerVictim) && !me->isTargetNotAcceptableByMMaps(ownerVictim->GetGUID(), sWorld->GetGameTime(), ownerVictim))
return ownerVictim;
if (me->_CanDetectFeignDeathOf(ownerVictim) && me->CanCreatureAttack(ownerVictim) && !me->isTargetNotAcceptableByMMaps(ownerVictim->GetGUID(), sWorld->GetGameTime(), ownerVictim))
return ownerVictim;
// Neither pet or owner had a target and aggressive pets can pick any target
// To prevent aggressive pets from chain selecting targets and running off, we
@@ -509,7 +509,7 @@ void PetAI::HandleReturnMovement()
{
if (!me->GetCharmInfo()->IsFollowing() && !me->GetCharmInfo()->IsReturning())
{
if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE)
if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_CONTROLLED) == NULL_MOTION_TYPE)
{
ClearCharmInfoFlags();
me->GetCharmInfo()->SetIsReturning(true);
@@ -519,23 +519,23 @@ void PetAI::HandleReturnMovement()
}
}
me->GetCharmInfo()->SetForcedSpell(0);
me->GetCharmInfo()->SetForcedTargetGUID(0);
me->GetCharmInfo()->SetForcedSpell(0);
me->GetCharmInfo()->SetForcedTargetGUID(0);
// xinef: remember that npcs summoned by npcs can also be pets
me->DeleteThreatList();
me->ClearInPetCombat();
// xinef: remember that npcs summoned by npcs can also be pets
me->DeleteThreatList();
me->ClearInPetCombat();
}
void PetAI::SpellHit(Unit* caster, const SpellInfo* spellInfo)
{
// Xinef: taunt behavior code
if (spellInfo->HasAura(SPELL_AURA_MOD_TAUNT) && !me->HasReactState(REACT_PASSIVE))
{
me->GetCharmInfo()->SetForcedSpell(0);
me->GetCharmInfo()->SetForcedTargetGUID(0);
AttackStart(caster);
}
// Xinef: taunt behavior code
if (spellInfo->HasAura(SPELL_AURA_MOD_TAUNT) && !me->HasReactState(REACT_PASSIVE))
{
me->GetCharmInfo()->SetForcedSpell(0);
me->GetCharmInfo()->SetForcedTargetGUID(0);
AttackStart(caster);
}
}
void PetAI::DoAttack(Unit* target, bool chase)
@@ -545,11 +545,11 @@ void PetAI::DoAttack(Unit* target, bool chase)
if (me->Attack(target, true))
{
// xinef: properly fix fake combat after pet is sent to attack
if (Unit* owner = me->GetOwner())
owner->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
// xinef: properly fix fake combat after pet is sent to attack
if (Unit* owner = me->GetOwner())
owner->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
// Play sound to let the player know the pet is attacking something it picked on its own
if (me->HasReactState(REACT_AGGRESSIVE) && !me->GetCharmInfo()->IsCommandAttack())
@@ -565,12 +565,12 @@ void PetAI::DoAttack(Unit* target, bool chase)
if (chase)
{
me->GetMotionMaster()->MoveChase(target, !_canMeleeAttack() ? 20.0f: 0.0f, me->GetAngle(target));
me->GetMotionMaster()->MoveChase(target, !_canMeleeAttack() ? 20.0f: 0.0f, me->GetAngle(target));
}
else // (Stay && ((Aggressive || Defensive) && In Melee Range)))
{
me->GetCharmInfo()->SetIsAtStay(true);
me->GetMotionMaster()->MovementExpiredOnSlot(MOTION_SLOT_ACTIVE, false);
me->GetMotionMaster()->MovementExpiredOnSlot(MOTION_SLOT_ACTIVE, false);
me->GetMotionMaster()->MoveIdle();
}
}
@@ -621,34 +621,34 @@ bool PetAI::CanAttack(Unit* target, const SpellInfo* spellInfo)
if (!target->IsAlive())
{
// xinef: if target is invalid, pet should evade automaticly
// xinef: if target is invalid, pet should evade automaticly
// Clear target to prevent getting stuck on dead targets
//me->AttackStop();
//me->InterruptNonMeleeSpells(false);
return false;
}
// xinef: check unit states of pet
if (me->HasUnitState(UNIT_STATE_LOST_CONTROL))
return false;
// xinef: check unit states of pet
if (me->HasUnitState(UNIT_STATE_LOST_CONTROL))
return false;
// xinef: pets of mounted players have stunned flag only, check this also
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED))
return false;
// xinef: pets of mounted players have stunned flag only, check this also
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED))
return false;
// pussywizard: ZOMG! TEMP!
if (!me->GetCharmInfo())
{
sLog->outMisc("PetAI::CanAttack (A1) - %u, %u", me->GetEntry(), GUID_LOPART(me->GetOwnerGUID()));
return false;
}
// pussywizard: ZOMG! TEMP!
if (!me->GetCharmInfo())
{
sLog->outMisc("PetAI::CanAttack (A1) - %u, %u", me->GetEntry(), GUID_LOPART(me->GetOwnerGUID()));
return false;
}
// Passive - passive pets can attack if told to
if (me->HasReactState(REACT_PASSIVE))
return me->GetCharmInfo()->IsCommandAttack();
// CC - mobs under crowd control can be attacked if owner commanded
if (target->HasBreakableByDamageCrowdControlAura() && (!spellInfo || !spellInfo->HasAttribute(SPELL_ATTR4_DAMAGE_DOESNT_BREAK_AURAS)))
if (target->HasBreakableByDamageCrowdControlAura() && (!spellInfo || !spellInfo->HasAttribute(SPELL_ATTR4_DAMAGE_DOESNT_BREAK_AURAS)))
return me->GetCharmInfo()->IsCommandAttack();
// Returning - pets ignore attacks only if owner clicked follow
@@ -658,7 +658,7 @@ bool PetAI::CanAttack(Unit* target, const SpellInfo* spellInfo)
// Stay - can attack if target is within range or commanded to
if (me->GetCharmInfo()->HasCommandState(COMMAND_STAY))
return (me->IsWithinMeleeRange(target) || me->GetCharmInfo()->IsCommandAttack());
// Pets attacking something (or chasing) should only switch targets if owner tells them to
if (me->GetVictim() && me->GetVictim() != target)
{
@@ -668,7 +668,7 @@ bool PetAI::CanAttack(Unit* target, const SpellInfo* spellInfo)
ownerTarget = owner->GetSelectedUnit();
else
ownerTarget = me->GetCharmerOrOwner()->GetVictim();
if (ownerTarget && me->GetCharmInfo()->IsCommandAttack())
return (target->GetGUID() == ownerTarget->GetGUID());
}
+3 -3
View File
@@ -48,14 +48,14 @@ class PetAI : public CreatureAI
void MoveInLineOfSight(Unit* /*who*/) {} // CreatureAI interferes with returning pets
void MoveInLineOfSight_Safe(Unit* /*who*/) {} // CreatureAI interferes with returning pets
void EnterEvadeMode() {} // For fleeing, pets don't use this type of Evade mechanic
void SpellHit(Unit* caster, const SpellInfo* spellInfo);
void SpellHit(Unit* caster, const SpellInfo* spellInfo);
private:
bool _isVisible(Unit*) const;
bool _needToStop(void);
void _stopAttack(void);
void _doMeleeAttack();
bool _canMeleeAttack() const;
void _doMeleeAttack();
bool _canMeleeAttack() const;
void UpdateAllies();
+9 -9
View File
@@ -46,16 +46,16 @@ class TotemAI : public CreatureAI
class KillMagnetEvent : public BasicEvent
{
public:
KillMagnetEvent(Unit& self) : _self(self) { }
bool Execute(uint64 e_time, uint32 p_time)
{
_self.setDeathState(JUST_DIED);
return true;
}
public:
KillMagnetEvent(Unit& self) : _self(self) { }
bool Execute(uint64 e_time, uint32 p_time)
{
_self.setDeathState(JUST_DIED);
return true;
}
protected:
Unit& _self;
protected:
Unit& _self;
};
#endif
+6 -6
View File
@@ -53,10 +53,10 @@ void UnitAI::DoMeleeAttackIfReady()
//Make sure our attack is ready and we aren't currently casting before checking distance
if (me->isAttackReady())
{
// xinef: prevent base and off attack in same time, delay attack at 0.2 sec
if (me->haveOffhandWeapon())
if (me->getAttackTimer(OFF_ATTACK) < ATTACK_DISPLAY_DELAY)
me->setAttackTimer(OFF_ATTACK, ATTACK_DISPLAY_DELAY);
// xinef: prevent base and off attack in same time, delay attack at 0.2 sec
if (me->haveOffhandWeapon())
if (me->getAttackTimer(OFF_ATTACK) < ATTACK_DISPLAY_DELAY)
me->setAttackTimer(OFF_ATTACK, ATTACK_DISPLAY_DELAY);
me->AttackerStateUpdate(victim);
me->resetAttackTimer();
@@ -64,8 +64,8 @@ void UnitAI::DoMeleeAttackIfReady()
if (me->haveOffhandWeapon() && me->isAttackReady(OFF_ATTACK))
{
// xinef: delay main hand attack if both will hit at the same time (players code)
if (me->getAttackTimer(BASE_ATTACK) < ATTACK_DISPLAY_DELAY)
// xinef: delay main hand attack if both will hit at the same time (players code)
if (me->getAttackTimer(BASE_ATTACK) < ATTACK_DISPLAY_DELAY)
me->setAttackTimer(BASE_ATTACK, ATTACK_DISPLAY_DELAY);
me->AttackerStateUpdate(victim, OFF_ATTACK);
+6 -6
View File
@@ -121,7 +121,7 @@ struct PowerUsersSelector : public std::unary_function<Unit*, bool>
Unit const* _me;
float const _dist;
bool const _playerOnly;
Powers const _power;
Powers const _power;
PowerUsersSelector(Unit const* unit, Powers power, float dist, bool playerOnly) : _me(unit), _power(power), _dist(dist), _playerOnly(playerOnly) { }
@@ -131,8 +131,8 @@ struct PowerUsersSelector : public std::unary_function<Unit*, bool>
if (!_me || !target)
return false;
if (target->getPowerType() != _power)
return false;
if (target->getPowerType() != _power)
return false;
if (_playerOnly && target->GetTypeId() != TYPEID_PLAYER)
return false;
@@ -162,8 +162,8 @@ struct FarthestTargetSelector : public std::unary_function<Unit*, bool>
if (_dist > 0.0f && !_me->IsWithinCombatRange(target, _dist))
return false;
if (_inLos && !_me->IsWithinLOSInMap(target))
return false;
if (_inLos && !_me->IsWithinLOSInMap(target))
return false;
return true;
}
@@ -172,7 +172,7 @@ private:
const Unit* _me;
float _dist;
bool _playerOnly;
bool _inLos;
bool _inLos;
};
class UnitAI
+11 -11
View File
@@ -58,8 +58,8 @@ void CreatureAI::DoZoneInCombat(Creature* creature /*= NULL*/, float maxRangeToN
return;
}
// Xinef: Skip creatures in evade mode
if (!creature->HasReactState(REACT_PASSIVE) && !creature->GetVictim() && !creature->IsInEvadeMode())
// Xinef: Skip creatures in evade mode
if (!creature->HasReactState(REACT_PASSIVE) && !creature->GetVictim() && !creature->IsInEvadeMode())
{
if (Unit* nearTarget = creature->SelectNearestTarget(maxRangeToNearestTarget))
creature->AI()->AttackStart(nearTarget);
@@ -128,12 +128,12 @@ void CreatureAI::MoveInLineOfSight(Unit* who)
if (me->GetVictim())
return;
// pussywizard: civilian, non-combat pet or any other NOT HOSTILE TO ANYONE (!)
if (me->IsMoveInLineOfSightDisabled())
if (me->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET || // nothing more to do, return
!who->IsInCombat() || // if not in combat, nothing more to do
!me->IsWithinDist(who, ATTACK_DISTANCE)) // if in combat and in dist - neutral to all can actually assist other creatures
return;
// pussywizard: civilian, non-combat pet or any other NOT HOSTILE TO ANYONE (!)
if (me->IsMoveInLineOfSightDisabled())
if (me->GetCreatureType() == CREATURE_TYPE_NON_COMBAT_PET || // nothing more to do, return
!who->IsInCombat() || // if not in combat, nothing more to do
!me->IsWithinDist(who, ATTACK_DISTANCE)) // if in combat and in dist - neutral to all can actually assist other creatures
return;
if (me->CanStartAttack(who))
AttackStart(who);
@@ -212,9 +212,9 @@ bool CreatureAI::UpdateVictim()
AttackStart(victim);
return me->GetVictim();
}
// xinef: if we have any victim, just return true
else if (me->GetVictim() && me->GetExactDist(me->GetVictim()) < 30.0f)
return true;
// xinef: if we have any victim, just return true
else if (me->GetVictim() && me->GetExactDist(me->GetVictim()) < 30.0f)
return true;
else if (me->getThreatManager().isThreatListEmpty())
{
EnterEvadeMode();
+2 -2
View File
@@ -165,11 +165,11 @@ class CreatureAI : public UnitAI
/// == Fields =======================================
virtual void PassengerBoarded(Unit* /*passenger*/, int8 /*seatId*/, bool /*apply*/) {}
virtual void OnSpellClick(Unit* /*clicker*/, bool& /*result*/) { }
virtual void OnSpellClick(Unit* /*clicker*/, bool& /*result*/) { }
virtual bool CanSeeAlways(WorldObject const* /*obj*/) { return false; }
virtual bool CanBeSeen(Player const* /*seer*/) { return true; }
virtual bool CanBeSeen(Player const* /*seer*/) { return true; }
protected:
virtual void MoveInLineOfSight(Unit* /*who*/);
+4 -4
View File
@@ -33,8 +33,8 @@ namespace FactorySelector
const CreatureAICreator* ai_factory = NULL;
CreatureAIRegistry& ai_registry(*CreatureAIRepository::instance());
// xinef: if we have controlable guardian, define petai for players as they can steer him, otherwise db / normal ai
// xinef: dont remember why i changed this qq commented out as may break some quests
// xinef: if we have controlable guardian, define petai for players as they can steer him, otherwise db / normal ai
// xinef: dont remember why i changed this qq commented out as may break some quests
if (creature->IsPet()/* || (creature->HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN) && ((Guardian*)creature)->GetOwner()->GetTypeId() == TYPEID_PLAYER)*/)
ai_factory = ai_registry.GetRegistryItem("PetAI");
@@ -95,7 +95,7 @@ namespace FactorySelector
}
// select NullCreatureAI if not another cases
// xinef: unused
// xinef: unused
// ainame = (ai_factory == NULL) ? "NullCreatureAI" : ai_factory->key();
;//sLog->outDebug(LOG_FILTER_TSCR, "Creature %u used AI is %s.", creature->GetGUIDLow(), ainame.c_str());
@@ -143,7 +143,7 @@ namespace FactorySelector
//future goAI types go here
// xinef: unused
// xinef: unused
//std::string ainame = (ai_factory == NULL || go->GetScriptId()) ? "NullGameObjectAI" : ai_factory->key();
;//sLog->outDebug(LOG_FILTER_TSCR, "GameObject %u used AI is %s.", go->GetGUIDLow(), ainame.c_str());
@@ -90,7 +90,7 @@ bool SummonList::HasEntry(uint32 entry) const
uint32 SummonList::GetEntryCount(uint32 entry) const
{
uint32 count = 0;
uint32 count = 0;
for (StorageType::const_iterator i = storage_.begin(); i != storage_.end(); ++i)
{
Creature* summon = ObjectAccessor::GetCreature(*me, *i);
@@ -106,10 +106,10 @@ void SummonList::Respawn()
for (StorageType::iterator i = storage_.begin(); i != storage_.end();)
{
if (Creature* summon = ObjectAccessor::GetCreature(*me, *i))
{
summon->Respawn(true);
{
summon->Respawn(true);
++i;
}
}
else
i = storage_.erase(i);
}
@@ -120,8 +120,8 @@ Creature* SummonList::GetCreatureWithEntry(uint32 entry) const
for (StorageType::const_iterator i = storage_.begin(); i != storage_.end(); ++i)
{
if (Creature* summon = ObjectAccessor::GetCreature(*me, *i))
if (summon->GetEntry() == entry)
return summon;
if (summon->GetEntry() == entry)
return summon;
}
return NULL;
@@ -296,7 +296,7 @@ void ScriptedAI::DoResetThreat()
return;
}
me->getThreatManager().resetAllAggro();
me->getThreatManager().resetAllAggro();
}
float ScriptedAI::DoGetThreat(Unit* unit)
@@ -410,20 +410,20 @@ enum eNPCs
NPC_BROODLORD = 12017,
NPC_JAN_ALAI = 23578,
NPC_SARTHARION = 28860,
NPC_FREYA = 32906,
NPC_FREYA = 32906,
};
bool ScriptedAI::EnterEvadeIfOutOfCombatArea()
{
if (me->IsInEvadeMode() || !me->IsInCombat())
if (me->IsInEvadeMode() || !me->IsInCombat())
return false;
if (_evadeCheckCooldown == time(NULL))
return false;
_evadeCheckCooldown = time(NULL);
if (_evadeCheckCooldown == time(NULL))
return false;
_evadeCheckCooldown = time(NULL);
if (!CheckEvadeIfOutOfCombatArea())
return false;
if (!CheckEvadeIfOutOfCombatArea())
return false;
EnterEvadeMode();
return true;
@@ -431,22 +431,22 @@ bool ScriptedAI::EnterEvadeIfOutOfCombatArea()
Player* ScriptedAI::SelectTargetFromPlayerList(float maxdist, uint32 excludeAura, bool mustBeInLOS) const
{
Map::PlayerList const& pList = me->GetMap()->GetPlayers();
std::vector<Player*> tList;
for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
{
if (me->GetDistance(itr->GetSource()) > maxdist || !itr->GetSource()->IsAlive() || itr->GetSource()->IsGameMaster())
continue;
if (excludeAura && itr->GetSource()->HasAura(excludeAura))
continue;
if (mustBeInLOS && !me->IsWithinLOSInMap(itr->GetSource()))
continue;
tList.push_back(itr->GetSource());
}
if (!tList.empty())
return tList[urand(0,tList.size()-1)];
else
return NULL;
Map::PlayerList const& pList = me->GetMap()->GetPlayers();
std::vector<Player*> tList;
for(Map::PlayerList::const_iterator itr = pList.begin(); itr != pList.end(); ++itr)
{
if (me->GetDistance(itr->GetSource()) > maxdist || !itr->GetSource()->IsAlive() || itr->GetSource()->IsGameMaster())
continue;
if (excludeAura && itr->GetSource()->HasAura(excludeAura))
continue;
if (mustBeInLOS && !me->IsWithinLOSInMap(itr->GetSource()))
continue;
tList.push_back(itr->GetSource());
}
if (!tList.empty())
return tList[urand(0,tList.size()-1)];
else
return NULL;
}
// BossAI - for instanced bosses
@@ -79,10 +79,10 @@ public:
return storage_.size();
}
void clear()
{
storage_.clear();
}
void clear()
{
storage_.clear();
}
void Summon(Creature const* summon) { storage_.push_back(summon->GetGUID()); }
void Despawn(Creature const* summon) { storage_.remove(summon->GetGUID()); }
@@ -100,7 +100,7 @@ public:
if (max)
RemoveNotExisting(); // pussywizard: when max is set, non existing can be chosen and nothing will happen
StorageType listCopy = storage_;
StorageType listCopy = storage_;
for (StorageType::const_iterator i = listCopy.begin(); i != listCopy.end(); ++i)
{
if (Creature* summon = ObjectAccessor::GetCreature(*me, *i))
@@ -135,8 +135,8 @@ public:
void RemoveNotExisting();
bool HasEntry(uint32 entry) const;
uint32 GetEntryCount(uint32 entry) const;
void Respawn();
Creature* GetCreatureWithEntry(uint32 entry) const;
void Respawn();
Creature* GetCreatureWithEntry(uint32 entry) const;
private:
Creature* me;
@@ -159,7 +159,7 @@ class PlayerOrPetCheck
bool operator() (WorldObject* unit) const
{
if (unit->GetTypeId() != TYPEID_PLAYER)
if (!IS_PLAYER_GUID(unit->ToUnit()->GetOwnerGUID()))
if (!IS_PLAYER_GUID(unit->ToUnit()->GetOwnerGUID()))
return true;
return false;
@@ -291,7 +291,7 @@ struct ScriptedAI : public CreatureAI
bool IsCombatMovementAllowed() const { return _isCombatMovementAllowed; }
bool EnterEvadeIfOutOfCombatArea();
virtual bool CheckEvadeIfOutOfCombatArea() const { return false; }
virtual bool CheckEvadeIfOutOfCombatArea() const { return false; }
// return true for heroic mode. i.e.
// - for dungeon in mode 10-heroic,
@@ -358,7 +358,7 @@ struct ScriptedAI : public CreatureAI
return heroic25;
}
Player* SelectTargetFromPlayerList(float maxdist, uint32 excludeAura = 0, bool mustBeInLOS = false) const;
Player* SelectTargetFromPlayerList(float maxdist, uint32 excludeAura = 0, bool mustBeInLOS = false) const;
private:
Difficulty _difficulty;
@@ -87,8 +87,8 @@ bool npc_escortAI::AssistPlayerInCombat(Unit* who)
void npc_escortAI::MoveInLineOfSight(Unit* who)
{
if (me->GetVictim())
return;
if (me->GetVictim())
return;
if (!me->HasUnitState(UNIT_STATE_STUNNED) && who->isTargetableForAttack(true, me) && who->isInAccessiblePlaceFor(me))
if (HasEscortState(STATE_ESCORT_ESCORTING) && AssistPlayerInCombat(who))
@@ -122,7 +122,7 @@ void npc_escortAI::JustDied(Unit* /*killer*/)
void npc_escortAI::JustRespawned()
{
RemoveEscortState(STATE_ESCORT_ESCORTING|STATE_ESCORT_RETURNING|STATE_ESCORT_PAUSED);
RemoveEscortState(STATE_ESCORT_ESCORTING|STATE_ESCORT_RETURNING|STATE_ESCORT_PAUSED);
if (!IsCombatMovementAllowed())
SetCombatMovement(true);
@@ -139,7 +139,7 @@ void npc_escortAI::JustRespawned()
void npc_escortAI::ReturnToLastPoint()
{
float x, y, z, o;
me->SetWalk(false);
me->SetWalk(false);
me->GetHomePosition(x, y, z, o);
me->GetMotionMaster()->MovePoint(POINT_LAST_POINT, x, y, z);
}
@@ -213,8 +213,8 @@ void npc_escortAI::UpdateAI(uint32 diff)
me->DespawnOrUnsummon();
}
// xinef: remove escort state, escort was finished (lack of this line resulted in skipping UpdateEscortAI calls after finished escort)
RemoveEscortState(STATE_ESCORT_ESCORTING);
// xinef: remove escort state, escort was finished (lack of this line resulted in skipping UpdateEscortAI calls after finished escort)
RemoveEscortState(STATE_ESCORT_ESCORTING);
return;
}
@@ -239,7 +239,7 @@ void npc_escortAI::UpdateAI(uint32 diff)
//Check if player or any member of his group is within range
if (HasEscortState(STATE_ESCORT_ESCORTING) && m_uiPlayerGUID && !me->GetVictim() && !HasEscortState(STATE_ESCORT_RETURNING))
{
m_uiPlayerCheckTimer += diff;
m_uiPlayerCheckTimer += diff;
if (m_uiPlayerCheckTimer > 1000)
{
if (DespawnAtFar && !IsPlayerOrGroupInRange())
@@ -303,7 +303,7 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId)
{
//Call WP function
me->SetPosition(CurrentWP->x, CurrentWP->y, CurrentWP->z, me->GetOrientation());
me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
WaypointReached(CurrentWP->id);
m_uiWPWaitTimer = CurrentWP->WaitTimeMs + 1;
@@ -495,9 +495,9 @@ bool npc_escortAI::SetNextWaypoint(uint32 pointId, bool setPosition)
size_t const size = WaypointList.size();
Escort_Waypoint waypoint(0, 0, 0, 0, 0);
for (CurrentWP = WaypointList.begin(); CurrentWP != WaypointList.end(); ++CurrentWP)
for (CurrentWP = WaypointList.begin(); CurrentWP != WaypointList.end(); ++CurrentWP)
{
if (CurrentWP->id == pointId)
if (CurrentWP->id == pointId)
{
if (setPosition)
me->UpdatePosition(CurrentWP->x, CurrentWP->y, CurrentWP->z, me->GetOrientation());
@@ -540,7 +540,7 @@ void npc_escortAI::GenerateWaypointArray(Movement::PointsArray* points)
{
// xinef: first point in vector is unit real position
points->clear();
points->push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()));
points->push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()));
for (std::list<Escort_Waypoint>::const_iterator itr = CurrentWP; itr != WaypointList.end(); ++itr)
points->push_back(G3D::Vector3(itr->x, itr->y, itr->z));
}
@@ -35,7 +35,7 @@ void FollowerAI::AttackStart(Unit* who)
if (me->Attack(who, true))
{
// This is done in Unit::Attack function which wont bug npcs by not adding threat upon combat start...
// This is done in Unit::Attack function which wont bug npcs by not adding threat upon combat start...
//me->AddThreat(who, 0.0f);
//me->SetInCombatWith(who);
//who->SetInCombatWith(me);
@@ -80,14 +80,14 @@ bool FollowerAI::AssistPlayerInCombat(Unit* who)
void FollowerAI::MoveInLineOfSight(Unit* who)
{
if (me->GetVictim())
return;
if (me->GetVictim())
return;
if (!me->HasUnitState(UNIT_STATE_STUNNED) && who->isTargetableForAttack(true, me) && who->isInAccessiblePlaceFor(me))
if (HasFollowState(STATE_FOLLOW_INPROGRESS) && AssistPlayerInCombat(who))
return;
if (me->CanStartAttack(who))
if (me->CanStartAttack(who))
AttackStart(who);
}
+161 -161
View File
@@ -39,15 +39,15 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c)
mEscortState = SMART_ESCORT_NONE;
mCurrentWPID = 0;//first wp id is 1 !!
mWPReached = false;
mOOCReached = false;
mOOCReached = false;
mWPPauseTimer = 0;
mLastWP = NULL;
mEscortNPCFlags = 0;
mEscortNPCFlags = 0;
mCanRepeatPath = false;
// spawn in run mode
// Xinef: spawn in run mode and set mRun to run... this overrides SetWalk EVERYWHERE, RETARDS
// Xinef: spawn in run mode and set mRun to run... this overrides SetWalk EVERYWHERE, RETARDS
mRun = true;
mCanAutoAttack = true;
@@ -73,10 +73,10 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c)
mJustReset = false;
// Xinef: Vehicle conditions
m_ConditionsTimer = 0;
if (me->GetVehicleKit())
conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE, me->GetEntry());
// Xinef: Vehicle conditions
m_ConditionsTimer = 0;
if (me->GetVehicleKit())
conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE, me->GetEntry());
}
void SmartAI::UpdateDespawn(const uint32 diff)
@@ -95,8 +95,8 @@ void SmartAI::UpdateDespawn(const uint32 diff)
else
me->DespawnOrUnsummon();
}
else
mDespawnTime -= diff;
else
mDespawnTime -= diff;
}
WayPoint* SmartAI::GetNextWayPoint()
@@ -192,10 +192,10 @@ void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* invoker)
StopPath();
if (path)
{
{
if (!LoadPath(path))
return;
}
}
if (!mWayPoints || mWayPoints->empty())
return;
@@ -206,11 +206,11 @@ void SmartAI::StartPath(bool run, uint32 path, bool repeat, Unit* invoker)
mCanRepeatPath = repeat;
SetRun(run);
if (invoker && invoker->GetTypeId() == TYPEID_PLAYER)
{
mEscortNPCFlags = me->GetUInt32Value(UNIT_NPC_FLAGS);
me->SetUInt32Value(UNIT_NPC_FLAGS, 0);
}
if (invoker && invoker->GetTypeId() == TYPEID_PLAYER)
{
mEscortNPCFlags = me->GetUInt32Value(UNIT_NPC_FLAGS);
me->SetUInt32Value(UNIT_NPC_FLAGS, 0);
}
Movement::PointsArray pathPoints;
GenerateWayPointArray(&pathPoints);
@@ -251,7 +251,7 @@ void SmartAI::PausePath(uint32 delay, bool forced)
mWPPauseTimer = delay;
if (forced && !mWPReached)
{
mForcedPaused = forced;
mForcedPaused = forced;
SetRun(mRun);
if (me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE) == ESCORT_MOTION_TYPE)
me->GetMotionMaster()->MovementExpired();
@@ -288,11 +288,11 @@ void SmartAI::EndPath(bool fail)
mLastWP = NULL;
mWPPauseTimer = 0;
if (mEscortNPCFlags)
{
me->SetUInt32Value(UNIT_NPC_FLAGS, mEscortNPCFlags);
mEscortNPCFlags = 0;
}
if (mEscortNPCFlags)
{
me->SetUInt32Value(UNIT_NPC_FLAGS, mEscortNPCFlags);
mEscortNPCFlags = 0;
}
ObjectList* targets = GetScript()->GetTargetList(SMART_ESCORT_TARGETS);
if (targets && mEscortQuestID)
@@ -305,8 +305,8 @@ void SmartAI::EndPath(bool fail)
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != NULL; groupRef = groupRef->next())
{
Player* groupGuy = groupRef->GetSource();
if (!groupGuy || !player->IsInMap(groupGuy))
continue;
if (!groupGuy || !player->IsInMap(groupGuy))
continue;
if (!fail && groupGuy->IsAtGroupRewardDistance(me) && !groupGuy->GetCorpse())
groupGuy->AreaExploredOrEventHappens(mEscortQuestID);
@@ -314,15 +314,15 @@ void SmartAI::EndPath(bool fail)
groupGuy->FailQuest(mEscortQuestID);
}
}
else
{
if (!fail && player->IsAtGroupRewardDistance(me) && !player->GetCorpse())
player->GroupEventHappens(mEscortQuestID, me);
else if (fail && player->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
player->FailQuest(mEscortQuestID);
}
else
{
if (!fail && player->IsAtGroupRewardDistance(me) && !player->GetCorpse())
player->GroupEventHappens(mEscortQuestID, me);
else if (fail && player->GetQuestStatus(mEscortQuestID) == QUEST_STATUS_INCOMPLETE)
player->FailQuest(mEscortQuestID);
}
}
else
else
{
for (ObjectList::iterator iter = targets->begin(); iter != targets->end(); ++iter)
{
@@ -338,16 +338,16 @@ void SmartAI::EndPath(bool fail)
}
}
// Xinef: if the escort failed - DO NOT PROCESS ANYTHING, ITS RETARDED
// Xinef: End Path events should be only processed if it was SUCCESSFUL stop or stop called by SMART_ACTION_WAYPOINT_STOP
if (fail)
{
mCurrentWPID = 0;
return;
}
// Xinef: if the escort failed - DO NOT PROCESS ANYTHING, ITS RETARDED
// Xinef: End Path events should be only processed if it was SUCCESSFUL stop or stop called by SMART_ACTION_WAYPOINT_STOP
if (fail)
{
mCurrentWPID = 0;
return;
}
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_ENDED, NULL, mCurrentWPID, GetScript()->GetPathId());
mCurrentWPID = 0;
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_ENDED, NULL, mCurrentWPID, GetScript()->GetPathId());
mCurrentWPID = 0;
if (mCanRepeatPath)
StartPath(mRun, GetScript()->GetPathId(), mCanRepeatPath);
@@ -373,8 +373,8 @@ void SmartAI::ResumePath()
void SmartAI::ReturnToLastOOCPos()
{
me->SetWalk(false);
float x, y, z, o;
me->SetWalk(false);
float x, y, z, o;
me->GetHomePosition(x, y, z, o);
me->GetMotionMaster()->MovePoint(SMART_ESCORT_LAST_OOC_POINT, x, y, z);
}
@@ -386,21 +386,21 @@ void SmartAI::UpdatePath(const uint32 diff)
if (mEscortInvokerCheckTimer < diff)
{
// Xinef: Escort failed - no players in range
// Xinef: Despawn immediately
// Xinef: Escort failed - no players in range
// Xinef: Despawn immediately
if (!IsEscortInvokerInRange())
{
StopPath(0, mEscortQuestID, true);
// Xinef: allow to properly hook out of range despawn action, which in most cases should perform the same operation as dying
GetScript()->ProcessEventsFor(SMART_EVENT_DEATH, me);
me->DespawnOrUnsummon(1);
return;
// Xinef: allow to properly hook out of range despawn action, which in most cases should perform the same operation as dying
GetScript()->ProcessEventsFor(SMART_EVENT_DEATH, me);
me->DespawnOrUnsummon(1);
return;
}
mEscortInvokerCheckTimer = 1000;
}
else
mEscortInvokerCheckTimer -= diff;
else
mEscortInvokerCheckTimer -= diff;
// handle pause
if (HasEscortState(SMART_ESCORT_PAUSED))
@@ -415,13 +415,13 @@ void SmartAI::UpdatePath(const uint32 diff)
{
mWPReached = false;
mForcedPaused = false;
ResumePath();
ResumePath();
}
mWPPauseTimer = 0;
mWPPauseTimer = 0;
}
}
else
else
mWPPauseTimer -= diff;
}
@@ -429,7 +429,7 @@ void SmartAI::UpdatePath(const uint32 diff)
{
if (mOOCReached)//reached OOC WP
{
mOOCReached = false;
mOOCReached = false;
RemoveEscortState(SMART_ESCORT_RETURNING);
if (!HasEscortState(SMART_ESCORT_PAUSED))
ResumePath();
@@ -440,13 +440,13 @@ void SmartAI::UpdatePath(const uint32 diff)
return;
// handle next wp
if (!me->HasUnitState(UNIT_STATE_NOT_MOVE) && me->movespline->Finalized())//reached WP
if (!me->HasUnitState(UNIT_STATE_NOT_MOVE) && me->movespline->Finalized())//reached WP
{
if (!mWPReached)
{
ResumePath();
return;
}
if (!mWPReached)
{
ResumePath();
return;
}
mWPReached = false;
if (mCurrentWPID == GetWPCount())
@@ -464,16 +464,16 @@ void SmartAI::UpdatePath(const uint32 diff)
void SmartAI::CheckConditions(const uint32 diff)
{
Vehicle* vehicle = me->GetVehicleKit();
if (!vehicle)
return;
Vehicle* vehicle = me->GetVehicleKit();
if (!vehicle)
return;
if (m_ConditionsTimer < diff)
{
if (!conditions.empty())
{
for (SeatMap::iterator itr = vehicle->Seats.begin(); itr != vehicle->Seats.end(); ++itr)
if (Unit* passenger = ObjectAccessor::GetUnit(*me, itr->second.Passenger.Guid))
if (Unit* passenger = ObjectAccessor::GetUnit(*me, itr->second.Passenger.Guid))
{
if (Player* player = passenger->ToPlayer())
{
@@ -487,13 +487,13 @@ void SmartAI::CheckConditions(const uint32 diff)
}
m_ConditionsTimer = 1000;
}
else
m_ConditionsTimer -= diff;
else
m_ConditionsTimer -= diff;
}
void SmartAI::UpdateAI(uint32 diff)
{
CheckConditions(diff);
CheckConditions(diff);
GetScript()->OnUpdate(diff);
UpdatePath(diff);
UpdateDespawn(diff);
@@ -527,12 +527,12 @@ bool SmartAI::IsEscortInvokerInRange()
ObjectList* targets = GetScript()->GetTargetList(SMART_ESCORT_TARGETS);
if (targets)
{
float checkDist = me->GetInstanceScript() ? SMART_ESCORT_MAX_PLAYER_DIST*2 : SMART_ESCORT_MAX_PLAYER_DIST;
float checkDist = me->GetInstanceScript() ? SMART_ESCORT_MAX_PLAYER_DIST*2 : SMART_ESCORT_MAX_PLAYER_DIST;
if (targets->size() == 1 && GetScript()->IsPlayer((*targets->begin())))
{
Player* player = (*targets->begin())->ToPlayer();
if (me->GetDistance(player) <= checkDist)
return true;
return true;
if (Group* group = player->GetGroup())
{
@@ -540,12 +540,12 @@ bool SmartAI::IsEscortInvokerInRange()
{
Player* groupGuy = groupRef->GetSource();
if (groupGuy && me->IsInMap(groupGuy) && me->GetDistance(groupGuy) <= checkDist)
if (groupGuy && me->IsInMap(groupGuy) && me->GetDistance(groupGuy) <= checkDist)
return true;
}
}
}
else
else
{
for (ObjectList::iterator iter = targets->begin(); iter != targets->end(); ++iter)
{
@@ -557,10 +557,10 @@ bool SmartAI::IsEscortInvokerInRange()
}
}
// Xinef: no valid target found
return false;
// Xinef: no valid target found
return false;
}
// Xinef: no player invoker was stored, just ignore range check
// Xinef: no player invoker was stored, just ignore range check
return true;
}
@@ -571,19 +571,19 @@ void SmartAI::MovepointReached(uint32 id)
// xinef: both point movement and escort generator can enter this function
if (id == SMART_ESCORT_LAST_OOC_POINT)
{
mOOCReached = true;
{
mOOCReached = true;
return;
}
}
mWPReached = true;
mWPReached = true;
GetScript()->ProcessEventsFor(SMART_EVENT_WAYPOINT_REACHED, NULL, mCurrentWPID);
if (mLastWP)
{
{
me->SetPosition(mLastWP->x, mLastWP->y, mLastWP->z, me->GetOrientation());
me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
}
me->SetHomePosition(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(), me->GetOrientation());
}
if (HasEscortState(SMART_ESCORT_PAUSED))
{
@@ -593,20 +593,20 @@ void SmartAI::MovepointReached(uint32 id)
me->StopMovingOnCurrentPos();
me->GetMotionMaster()->MoveIdle();
}
// Xinef: Can be unset in ProcessEvents
else if (HasEscortState(SMART_ESCORT_ESCORTING) && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == ESCORT_MOTION_TYPE)
{
mWPReached = false;
if (mCurrentWPID == GetWPCount())
EndPath();
else if (GetNextWayPoint())
{
SetRun(mRun);
// xinef: if we have reached waypoint, and there is no working spline movement it means our splitted array has ended, make new one
if (me->movespline->Finalized())
ResumePath();
}
}
// Xinef: Can be unset in ProcessEvents
else if (HasEscortState(SMART_ESCORT_ESCORTING) && me->GetMotionMaster()->GetCurrentMovementGeneratorType() == ESCORT_MOTION_TYPE)
{
mWPReached = false;
if (mCurrentWPID == GetWPCount())
EndPath();
else if (GetNextWayPoint())
{
SetRun(mRun);
// xinef: if we have reached waypoint, and there is no working spline movement it means our splitted array has ended, make new one
if (me->movespline->Finalized())
ResumePath();
}
}
}
void SmartAI::MovementInform(uint32 MovementType, uint32 Data)
@@ -624,15 +624,15 @@ void SmartAI::MovementInform(uint32 MovementType, uint32 Data)
void SmartAI::EnterEvadeMode()
{
// xinef: fixes strange jumps when charming SmartAI npc
// xinef: fixes strange jumps when charming SmartAI npc
if (!me->IsAlive() || me->IsInEvadeMode())
return;
if (IS_PLAYER_GUID(me->GetCharmerGUID()) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
{
me->AttackStop();
return;
}
if (IS_PLAYER_GUID(me->GetCharmerGUID()) || me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
{
me->AttackStop();
return;
}
me->RemoveEvadeAuras();
@@ -656,19 +656,19 @@ void SmartAI::EnterEvadeMode()
{
if (Unit* target = ObjectAccessor::GetUnit(*me, mFollowGuid))
me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle);
me->ClearUnitState(UNIT_STATE_EVADE);
me->ClearUnitState(UNIT_STATE_EVADE);
// xinef: do not forget to reset scripts as we wont call reached home
GetScript()->OnReset();
// xinef: do not forget to reset scripts as we wont call reached home
GetScript()->OnReset();
}
else
{
{
me->GetMotionMaster()->MoveTargetedHome();
// xinef: do not forget to reset scripts as we wont call reached home
if (!me->HasUnitState(UNIT_STATE_EVADE))
GetScript()->OnReset();
}
// xinef: do not forget to reset scripts as we wont call reached home
if (!me->HasUnitState(UNIT_STATE_EVADE))
GetScript()->OnReset();
}
}
void SmartAI::MoveInLineOfSight(Unit* who)
@@ -678,8 +678,8 @@ void SmartAI::MoveInLineOfSight(Unit* who)
GetScript()->OnMoveInLineOfSight(who);
if (me->GetVictim())
return;
if (me->GetVictim())
return;
if (me->HasReactState(REACT_PASSIVE) || AssistPlayerInCombat(who))
return;
@@ -697,7 +697,7 @@ bool SmartAI::CanAIAttack(const Unit* /*who*/) const
bool SmartAI::AssistPlayerInCombat(Unit* who)
{
// Xinef: if unit has no victim, or victim is player controlled thing
// Xinef: if unit has no victim, or victim is player controlled thing
if (!who->GetVictim() || IS_PLAYER_GUID(who->GetCharmerOrOwnerOrOwnGUID()))
return false;
@@ -741,7 +741,7 @@ void SmartAI::JustRespawned()
mFollowArrivedTimer = 1000;
mFollowArrivedEntry = 0;
mFollowCreditType = 0;
mFollowArrivedAlive = true;
mFollowArrivedAlive = true;
}
int SmartAI::Permissible(const Creature* creature)
@@ -768,8 +768,8 @@ void SmartAI::JustReachedHome()
void SmartAI::EnterCombat(Unit* enemy)
{
// Xinef: Interrupt channeled spells
me->InterruptSpell(CURRENT_CHANNELED_SPELL, true, true);
// Xinef: Interrupt channeled spells
me->InterruptSpell(CURRENT_CHANNELED_SPELL, true, true);
GetScript()->ProcessEventsFor(SMART_EVENT_AGGRO, enemy);
}
@@ -792,27 +792,27 @@ void SmartAI::JustSummoned(Creature* creature)
void SmartAI::AttackStart(Unit* who)
{
// xinef: dont allow charmed npcs to act on their own
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
{
if (who && mCanAutoAttack)
me->Attack(who, true);
return;
}
// xinef: dont allow charmed npcs to act on their own
if (me->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED))
{
if (who && mCanAutoAttack)
me->Attack(who, true);
return;
}
if (who && me->Attack(who, me->IsWithinMeleeRange(who)))
{
if (mCanCombatMove || GetScript()->GetMaxCombatDist())
{
SetRun(mRun);
MovementGeneratorType type = me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE);
if (type == ESCORT_MOTION_TYPE || type == POINT_MOTION_TYPE)
{
me->GetMotionMaster()->MovementExpired();
me->StopMoving();
}
{
SetRun(mRun);
MovementGeneratorType type = me->GetMotionMaster()->GetMotionSlotType(MOTION_SLOT_ACTIVE);
if (type == ESCORT_MOTION_TYPE || type == POINT_MOTION_TYPE)
{
me->GetMotionMaster()->MovementExpired();
me->StopMoving();
}
me->GetMotionMaster()->MoveChase(who, GetScript()->GetCasterActualDist() ? GetScript()->GetCasterActualDist() : GetScript()->GetActualCombatDist());
}
}
}
}
@@ -831,7 +831,7 @@ void SmartAI::DamageTaken(Unit* doneBy, uint32& damage, DamageEffectType damaget
if (doneBy)
GetScript()->ProcessEventsFor(SMART_EVENT_DAMAGED, doneBy, damage);
// Xinef: skip nodamage type (eg. instakill effect)
// Xinef: skip nodamage type (eg. instakill effect)
if (damagetype != NODAMAGE && mInvincibilityHpLevel && (damage >= me->GetHealth() - mInvincibilityHpLevel))
damage = me->GetHealth() - mInvincibilityHpLevel; // damage should not be nullified, because of player damage req.
}
@@ -869,9 +869,9 @@ void SmartAI::CorpseRemoved(uint32& respawnDelay)
{
GetScript()->ProcessEventsFor(SMART_EVENT_CORPSE_REMOVED, NULL, respawnDelay);
// xinef: end escort upon corpse remove, safe check in case of immediate despawn
if (IsEscorted())
EndPath(true);
// xinef: end escort upon corpse remove, safe check in case of immediate despawn
if (IsEscorted())
EndPath(true);
}
void SmartAI::PassengerBoarded(Unit* who, int8 seatId, bool apply)
@@ -883,11 +883,11 @@ void SmartAI::InitializeAI()
{
GetScript()->OnInitialize(me);
if (!me->isDead())
{
mJustReset = true;
JustReachedHome();
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
}
{
mJustReset = true;
JustReachedHome();
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
}
}
void SmartAI::OnCharmed(bool apply)
@@ -963,18 +963,18 @@ void SmartAI::sQuestReward(Player* player, Quest const* quest, uint32 opt)
void SmartAI::SetForcedCombatMove(float dist)
{
if (!me->GetVictim())
return;
if (!me->GetVictim())
return;
SetRun(mRun);
SetRun(mRun);
me->GetMotionMaster()->MoveChase(me->GetVictim(), dist);
}
void SmartAI::SetCombatMove(bool on)
{
// Xinef: Fix Combat Movement
if (GetScript()->GetMaxCombatDist()/* || GetScript()->GetCasterMaxDist()*/) // Xinef: we only need this hack for old caster movement system
return;
// Xinef: Fix Combat Movement
if (GetScript()->GetMaxCombatDist()/* || GetScript()->GetCasterMaxDist()*/) // Xinef: we only need this hack for old caster movement system
return;
if (mCanCombatMove == on)
return;
@@ -1016,7 +1016,7 @@ void SmartAI::SetFollow(Unit* target, float dist, float angle, uint32 credit, ui
mFollowArrivedTimer = 1000;
mFollowCredit = credit;
mFollowArrivedEntry = end;
mFollowArrivedAlive = !aliveState; // negate - 0 is alive
mFollowArrivedAlive = !aliveState; // negate - 0 is alive
me->GetMotionMaster()->MoveFollow(target, mFollowDist, mFollowAngle);
mFollowCreditType = creditType;
@@ -1036,10 +1036,10 @@ void SmartAI::StopFollow(bool complete)
me->StopMoving();
me->GetMotionMaster()->MoveIdle();
if (!complete)
return;
if (!complete)
return;
if (Player* player = ObjectAccessor::GetPlayer(*me, mFollowGuid))
if (Player* player = ObjectAccessor::GetPlayer(*me, mFollowGuid))
{
if (!mFollowCreditType)
player->RewardPlayerAndGroupAtEvent(mFollowCredit, me);
@@ -1047,10 +1047,10 @@ void SmartAI::StopFollow(bool complete)
player->GroupEventHappens(mFollowCredit, me);
}
SetDespawnTime(5000);
SetDespawnTime(5000);
StartDespawn();
GetScript()->ProcessEventsFor(SMART_EVENT_FOLLOW_COMPLETED);
GetScript()->ProcessEventsFor(SMART_EVENT_FOLLOW_COMPLETED);
}
void SmartAI::SetScript9(SmartScriptHolder& e, uint32 entry, Unit* invoker)
@@ -1067,7 +1067,7 @@ void SmartAI::sOnGameEvent(bool start, uint16 eventId)
void SmartAI::OnSpellClick(Unit* clicker, bool& result)
{
// Xinef: i dont think this is necessery (can be made as event parameter)
// Xinef: i dont think this is necessery (can be made as event parameter)
//if (!result)
// return;
@@ -1090,16 +1090,16 @@ void SmartGameObjectAI::InitializeAI()
{
GetScript()->OnInitialize(go);
// Xinef: do not call respawn event if go is not spawned
if (go->isSpawned())
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
// Xinef: do not call respawn event if go is not spawned
if (go->isSpawned())
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
//Reset();
}
void SmartGameObjectAI::Reset()
{
// Xinef: call respawn event on reset
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
// Xinef: call respawn event on reset
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
GetScript()->OnReset();
}
+10 -10
View File
@@ -39,7 +39,7 @@ enum SmartEscortState
enum SmartEscortVars
{
SMART_ESCORT_MAX_PLAYER_DIST = 60,
SMART_MAX_AID_DIST = SMART_ESCORT_MAX_PLAYER_DIST / 2,
SMART_MAX_AID_DIST = SMART_ESCORT_MAX_PLAYER_DIST / 2,
};
class SmartAI : public CreatureAI
@@ -59,11 +59,11 @@ class SmartAI : public CreatureAI
void GenerateWayPointArray(Movement::PointsArray* points);
bool HasEscortState(uint32 uiEscortState) { return (mEscortState & uiEscortState); }
void AddEscortState(uint32 uiEscortState) { mEscortState |= uiEscortState; }
virtual bool IsEscorted() { return (mEscortState & SMART_ESCORT_ESCORTING); }
virtual bool IsEscorted() { return (mEscortState & SMART_ESCORT_ESCORTING); }
void RemoveEscortState(uint32 uiEscortState) { mEscortState &= ~uiEscortState; }
void SetAutoAttack(bool on) { mCanAutoAttack = on; }
void SetCombatMove(bool on);
bool CanCombatMove() { return mCanCombatMove; }
bool CanCombatMove() { return mCanCombatMove; }
void SetFollow(Unit* target, float dist = 0.0f, float angle = 0.0f, uint32 credit = 0, uint32 end = 0, uint32 creditType = 0, bool aliveState = true);
void StopFollow(bool complete);
@@ -196,16 +196,16 @@ class SmartAI : public CreatureAI
void OnSpellClick(Unit* clicker, bool& result);
// Xinef
void SetWPPauseTimer(uint32 time) { mWPPauseTimer = time; }
void SetForcedCombatMove(float dist);
// Xinef
void SetWPPauseTimer(uint32 time) { mWPPauseTimer = time; }
void SetForcedCombatMove(float dist);
private:
uint32 mFollowCreditType;
uint32 mFollowArrivedTimer;
uint32 mFollowCredit;
uint32 mFollowArrivedEntry;
bool mFollowArrivedAlive;
bool mFollowArrivedAlive;
uint64 mFollowGuid;
float mFollowDist;
float mFollowAngle;
@@ -217,7 +217,7 @@ class SmartAI : public CreatureAI
uint32 mEscortState;
uint32 mCurrentWPID;
bool mWPReached;
bool mOOCReached;
bool mOOCReached;
uint32 mWPPauseTimer;
WayPoint* mLastWP;
uint32 mEscortNPCFlags;
@@ -237,7 +237,7 @@ class SmartAI : public CreatureAI
uint32 mEscortInvokerCheckTimer;
bool mJustReset;
// Xinef: Vehicle conditions
// Xinef: Vehicle conditions
void CheckConditions(const uint32 diff);
ConditionList conditions;
uint32 m_ConditionsTimer;
@@ -266,7 +266,7 @@ class SmartGameObjectAI : public GameObjectAI
void OnGameEvent(bool start, uint16 eventId);
void OnStateChanged(uint32 state, Unit* unit);
void EventInform(uint32 eventId);
void SpellHit(Unit* unit, const SpellInfo* spellInfo);
void SpellHit(Unit* unit, const SpellInfo* spellInfo);
protected:
SmartScript mScript;
File diff suppressed because it is too large Load Diff
+41 -41
View File
@@ -152,11 +152,11 @@ class SmartScript
{
if (reset == 0)
itr->second += value;
else
itr->second = value;
else
itr->second = value;
}
else
mCounterList.insert(std::make_pair(id, value));
else
mCounterList.insert(std::make_pair(id, value));
ProcessEventsFor(SMART_EVENT_COUNTER_SET, NULL, id);
}
@@ -232,42 +232,42 @@ class SmartScript
typedef UNORDERED_MAP<uint32, uint32> CounterMap;
CounterMap mCounterList;
// Xinef: Fix Combat Movement
void SetActualCombatDist(uint32 dist) { mActualCombatDist = dist; }
void RestoreMaxCombatDist() { mActualCombatDist = mMaxCombatDist; }
uint32 GetActualCombatDist() const { return mActualCombatDist; }
uint32 GetMaxCombatDist() const { return mMaxCombatDist; }
// Xinef: Fix Combat Movement
void SetActualCombatDist(uint32 dist) { mActualCombatDist = dist; }
void RestoreMaxCombatDist() { mActualCombatDist = mMaxCombatDist; }
uint32 GetActualCombatDist() const { return mActualCombatDist; }
uint32 GetMaxCombatDist() const { return mMaxCombatDist; }
// Xinef: SmartCasterAI, replace above
void SetCasterActualDist(float dist) { smartCasterActualDist = dist; }
void RestoreCasterMaxDist() { smartCasterActualDist = smartCasterMaxDist; }
Powers GetCasterPowerType() const { return smartCasterPowerType; }
float GetCasterActualDist() const { return smartCasterActualDist; }
float GetCasterMaxDist() const { return smartCasterMaxDist; }
// Xinef: SmartCasterAI, replace above
void SetCasterActualDist(float dist) { smartCasterActualDist = dist; }
void RestoreCasterMaxDist() { smartCasterActualDist = smartCasterMaxDist; }
Powers GetCasterPowerType() const { return smartCasterPowerType; }
float GetCasterActualDist() const { return smartCasterActualDist; }
float GetCasterMaxDist() const { return smartCasterMaxDist; }
bool AllowPhaseReset() const { return _allowPhaseReset; }
void SetPhaseReset(bool allow) { _allowPhaseReset = allow; }
bool AllowPhaseReset() const { return _allowPhaseReset; }
void SetPhaseReset(bool allow) { _allowPhaseReset = allow; }
private:
void IncPhase(uint32 p)
{
// Xinef: protect phase from overflowing
mEventPhase = std::min<uint32>(SMART_EVENT_PHASE_12, mEventPhase + p);
}
{
// Xinef: protect phase from overflowing
mEventPhase = std::min<uint32>(SMART_EVENT_PHASE_12, mEventPhase + p);
}
void DecPhase(uint32 p)
{
if (p >= mEventPhase)
mEventPhase = 0;
else
mEventPhase -= p;
}
{
if (p >= mEventPhase)
mEventPhase = 0;
else
mEventPhase -= p;
}
bool IsInPhase(uint32 p) const
{
if (mEventPhase == 0)
return false;
return (1 << (mEventPhase - 1)) & p;
}
{
if (mEventPhase == 0)
return false;
return (1 << (mEventPhase - 1)) & p;
}
void SetPhase(uint32 p = 0) { mEventPhase = p; }
SmartAIEventList mEvents;
@@ -292,17 +292,17 @@ class SmartScript
uint32 mTalkerEntry;
bool mUseTextTimer;
// Xinef: Fix Combat Movement
uint32 mActualCombatDist;
uint32 mMaxCombatDist;
// Xinef: Fix Combat Movement
uint32 mActualCombatDist;
uint32 mMaxCombatDist;
// Xinef: SmartCasterAI, replace above in future
uint32 smartCasterActualDist;
uint32 smartCasterMaxDist;
Powers smartCasterPowerType;
// Xinef: SmartCasterAI, replace above in future
uint32 smartCasterActualDist;
uint32 smartCasterMaxDist;
Powers smartCasterPowerType;
// Xinef: misc
bool _allowPhaseReset;
// Xinef: misc
bool _allowPhaseReset;
SMARTAI_TEMPLATE mTemplate;
void InstallEvents();
@@ -241,19 +241,19 @@ void SmartAIMgr::LoadSmartAIFromDB()
break;
case SMART_EVENT_VICTIM_CASTING:
case SMART_EVENT_IS_BEHIND_TARGET:
if (temp.event.minMaxRepeat.min == 0 && temp.event.minMaxRepeat.max == 0)
if (temp.event.minMaxRepeat.min == 0 && temp.event.minMaxRepeat.max == 0)
temp.event.event_flags |= SMART_EVENT_FLAG_NOT_REPEATABLE;
break;
case SMART_EVENT_FRIENDLY_IS_CC:
if (temp.event.friendlyCC.repeatMin == 0 && temp.event.friendlyCC.repeatMax == 0)
if (temp.event.friendlyCC.repeatMin == 0 && temp.event.friendlyCC.repeatMax == 0)
temp.event.event_flags |= SMART_EVENT_FLAG_NOT_REPEATABLE;
break;
}
// xinef: rozpierdol tc, niedojeby ze szok
if (temp.action.type == SMART_ACTION_MOVE_TO_POS)
if (temp.target.type == SMART_TARGET_SELF && (fabs(temp.target.x) > 200.0f || fabs(temp.target.y) > 200.0f || fabs(temp.target.z) > 200.0f))
temp.target.type = SMART_TARGET_POSITION;
// xinef: rozpierdol tc, niedojeby ze szok
if (temp.action.type == SMART_ACTION_MOVE_TO_POS)
if (temp.target.type == SMART_TARGET_SELF && (fabs(temp.target.x) > 200.0f || fabs(temp.target.y) > 200.0f || fabs(temp.target.z) > 200.0f))
temp.target.type = SMART_TARGET_POSITION;
// creature entry / guid not found in storage, create empty event list for it and increase counters
if (mEventMap[source_type].find(temp.entryOrGuid) == mEventMap[source_type].end())
@@ -338,7 +338,7 @@ bool SmartAIMgr::IsTargetValid(SmartScriptHolder const& e)
case SMART_TARGET_CLOSEST_ENEMY:
case SMART_TARGET_CLOSEST_FRIENDLY:
case SMART_TARGET_STORED:
case SMART_TARGET_FARTHEST:
case SMART_TARGET_FARTHEST:
break;
default:
sLog->outErrorDb("SmartAIMgr: Not handled target_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetTargetType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
@@ -671,7 +671,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
break;
case SMART_EVENT_GO_STATE_CHANGED:
case SMART_EVENT_GO_EVENT_INFORM:
case SMART_EVENT_GO_EVENT_INFORM:
case SMART_EVENT_TIMED_EVENT_TRIGGERED:
case SMART_EVENT_INSTANCE_PLAYER_ENTER:
case SMART_EVENT_TRANSPORT_RELOCATE:
@@ -702,7 +702,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_EVENT_GOSSIP_HELLO:
case SMART_EVENT_JUST_CREATED:
case SMART_EVENT_FOLLOW_COMPLETED:
case SMART_EVENT_ON_SPELLCLICK:
case SMART_EVENT_ON_SPELLCLICK:
break;
default:
sLog->outErrorDb("SmartAIMgr: Not handled event_type(%u), Entry %d SourceType %u Event %u Action %u, skipped.", e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
@@ -847,7 +847,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
sLog->outErrorDb("SmartAIMgr: Entry %d SourceType %u Event %u Action %u attempts to set invalid phase, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
return false;
}
if (e.action.randomPhase.phase1 == 0 &&
if (e.action.randomPhase.phase1 == 0 &&
e.action.randomPhase.phase2 == 0 &&
e.action.randomPhase.phase3 == 0 &&
e.action.randomPhase.phase4 == 0 &&
@@ -970,13 +970,13 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_REMOVE_POWER:
if (e.action.power.powerType > MAX_POWERS)
{
sLog->outError("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Power %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.power.powerType);
sLog->outError("SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Power %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.action.power.powerType);
return false;
}
break;
case SMART_ACTION_GAME_EVENT_STOP:
{
return false;
return false;
uint32 eventId = e.action.gameEventStop.id;
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
@@ -996,7 +996,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
case SMART_ACTION_GAME_EVENT_START:
{
return false;
return false;
uint32 eventId = e.action.gameEventStart.id;
GameEventMgr::GameEventDataMap const& events = sGameEventMgr->GetEventMap();
@@ -1033,15 +1033,15 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
}
break;
}
case SMART_ACTION_LOAD_GRID:
{
if (!Trinity::IsValidMapCoord(e.target.x, e.target.y))
{
sLog->outError("SmartScript: SMART_ACTION_LOAD_GRID uses invalid map coords: %u, skipped.", e.entryOrGuid);
return false;
}
break;
}
case SMART_ACTION_LOAD_GRID:
{
if (!Trinity::IsValidMapCoord(e.target.x, e.target.y))
{
sLog->outError("SmartScript: SMART_ACTION_LOAD_GRID uses invalid map coords: %u, skipped.", e.entryOrGuid);
return false;
}
break;
}
case SMART_ACTION_START_CLOSEST_WAYPOINT:
case SMART_ACTION_FOLLOW:
case SMART_ACTION_SET_ORIENTATION:
@@ -1105,35 +1105,35 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_SEND_GOSSIP_MENU:
case SMART_ACTION_GO_SET_LOOT_STATE:
case SMART_ACTION_SEND_TARGET_TO_TARGET:
case SMART_ACTION_SET_HOME_POS:
case SMART_ACTION_SET_HOME_POS:
case SMART_ACTION_SET_HEALTH_REGEN:
case SMART_ACTION_SET_ROOT:
case SMART_ACTION_SET_GO_FLAG:
case SMART_ACTION_ADD_GO_FLAG:
case SMART_ACTION_REMOVE_GO_FLAG:
case SMART_ACTION_SUMMON_CREATURE_GROUP:
case SMART_ACTION_RISE_UP:
case SMART_ACTION_RISE_UP:
case SMART_ACTION_MOVE_TO_POS_TARGET:
case SMART_ACTION_SET_GO_STATE:
case SMART_ACTION_EXIT_VEHICLE:
case SMART_ACTION_SET_UNIT_MOVEMENT_FLAGS:
case SMART_ACTION_SET_COMBAT_DISTANCE:
case SMART_ACTION_SET_CASTER_COMBAT_DIST:
case SMART_ACTION_SET_SIGHT_DIST:
case SMART_ACTION_FLEE:
case SMART_ACTION_ADD_THREAT:
case SMART_ACTION_LOAD_EQUIPMENT:
case SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT:
case SMART_ACTION_SET_HOVER:
case SMART_ACTION_ADD_IMMUNITY:
case SMART_ACTION_REMOVE_IMMUNITY:
case SMART_ACTION_SET_COUNTER:
case SMART_ACTION_FALL:
case SMART_ACTION_SET_EVENT_FLAG_RESET:
case SMART_ACTION_REMOVE_ALL_GAMEOBJECTS:
case SMART_ACTION_STOP_MOTION:
case SMART_ACTION_NO_ENVIRONMENT_UPDATE:
case SMART_ACTION_ZONE_UNDER_ATTACK:
case SMART_ACTION_SET_GO_STATE:
case SMART_ACTION_EXIT_VEHICLE:
case SMART_ACTION_SET_UNIT_MOVEMENT_FLAGS:
case SMART_ACTION_SET_COMBAT_DISTANCE:
case SMART_ACTION_SET_CASTER_COMBAT_DIST:
case SMART_ACTION_SET_SIGHT_DIST:
case SMART_ACTION_FLEE:
case SMART_ACTION_ADD_THREAT:
case SMART_ACTION_LOAD_EQUIPMENT:
case SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT:
case SMART_ACTION_SET_HOVER:
case SMART_ACTION_ADD_IMMUNITY:
case SMART_ACTION_REMOVE_IMMUNITY:
case SMART_ACTION_SET_COUNTER:
case SMART_ACTION_FALL:
case SMART_ACTION_SET_EVENT_FLAG_RESET:
case SMART_ACTION_REMOVE_ALL_GAMEOBJECTS:
case SMART_ACTION_STOP_MOTION:
case SMART_ACTION_NO_ENVIRONMENT_UPDATE:
case SMART_ACTION_ZONE_UNDER_ATTACK:
break;
default:
sLog->outErrorDb("SmartAIMgr: Not handled action_type(%u), event_type(%u), Entry %d SourceType %u Event %u, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);
+139 -139
View File
@@ -57,7 +57,7 @@ enum SMART_EVENT_PHASE
SMART_EVENT_PHASE_9 = 9,
SMART_EVENT_PHASE_10 = 10,
SMART_EVENT_PHASE_11 = 11,
SMART_EVENT_PHASE_12 = 12,
SMART_EVENT_PHASE_12 = 12,
SMART_EVENT_PHASE_MAX = 13,
SMART_EVENT_PHASE_COUNT = 12
@@ -390,7 +390,7 @@ struct SmartEvent
uint32 eventId;
} eventInform;
struct
struct
{
uint32 eventId;
} doAction;
@@ -554,43 +554,43 @@ enum SMART_ACTION
SMART_ACTION_GAME_EVENT_START = 112, // GameEventId
SMART_ACTION_START_CLOSEST_WAYPOINT = 113, // wp1, wp2, wp3, wp4, wp5, wp6, wp7
SMART_ACTION_RISE_UP = 114, // distance
// RESERVED = 115,
// RESERVED = 116,
// RESERVED = 117,
// RESERVED = 118,
// RESERVED = 119,
// RESERVED = 120,
// RESERVED = 121,
// RESERVED = 122,
// RESERVED = 123,
// RESERVED = 124,
// RESERVED = 125,
// RESERVED = 126,
// RESERVED = 127,
// RESERVED = 128,
// RESERVED = 129,
// 113!
SMART_ACTION_MOVE_TO_POS_TARGET = 130, // pointId
SMART_ACTION_SET_GO_STATE = 131, // state
SMART_ACTION_EXIT_VEHICLE = 132, // none
SMART_ACTION_SET_UNIT_MOVEMENT_FLAGS = 133, // flags
SMART_ACTION_SET_COMBAT_DISTANCE = 134, // combatDistance
SMART_ACTION_SET_CASTER_COMBAT_DIST = 135, // followDistance, resetToMax
SMART_ACTION_SET_SIGHT_DIST = 136, // sightDistance
SMART_ACTION_FLEE = 137, // fleeTime
SMART_ACTION_ADD_THREAT = 138, // +threat, -threat
SMART_ACTION_LOAD_EQUIPMENT = 139, // id
SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT = 140, // id min range, id max range
SMART_ACTION_SET_HOVER = 141, // 0/1
SMART_ACTION_ADD_IMMUNITY = 142, // type, id, value
SMART_ACTION_REMOVE_IMMUNITY = 143, // type, id, value
SMART_ACTION_FALL = 144, //
SMART_ACTION_SET_EVENT_FLAG_RESET = 145, // 0/1
SMART_ACTION_REMOVE_ALL_GAMEOBJECTS = 146,
SMART_ACTION_STOP_MOTION = 147, // stopMoving, movementExpired
SMART_ACTION_NO_ENVIRONMENT_UPDATE = 148,
SMART_ACTION_ZONE_UNDER_ATTACK = 149,
SMART_ACTION_LOAD_GRID = 150,
// RESERVED = 115,
// RESERVED = 116,
// RESERVED = 117,
// RESERVED = 118,
// RESERVED = 119,
// RESERVED = 120,
// RESERVED = 121,
// RESERVED = 122,
// RESERVED = 123,
// RESERVED = 124,
// RESERVED = 125,
// RESERVED = 126,
// RESERVED = 127,
// RESERVED = 128,
// RESERVED = 129,
// 113!
SMART_ACTION_MOVE_TO_POS_TARGET = 130, // pointId
SMART_ACTION_SET_GO_STATE = 131, // state
SMART_ACTION_EXIT_VEHICLE = 132, // none
SMART_ACTION_SET_UNIT_MOVEMENT_FLAGS = 133, // flags
SMART_ACTION_SET_COMBAT_DISTANCE = 134, // combatDistance
SMART_ACTION_SET_CASTER_COMBAT_DIST = 135, // followDistance, resetToMax
SMART_ACTION_SET_SIGHT_DIST = 136, // sightDistance
SMART_ACTION_FLEE = 137, // fleeTime
SMART_ACTION_ADD_THREAT = 138, // +threat, -threat
SMART_ACTION_LOAD_EQUIPMENT = 139, // id
SMART_ACTION_TRIGGER_RANDOM_TIMED_EVENT = 140, // id min range, id max range
SMART_ACTION_SET_HOVER = 141, // 0/1
SMART_ACTION_ADD_IMMUNITY = 142, // type, id, value
SMART_ACTION_REMOVE_IMMUNITY = 143, // type, id, value
SMART_ACTION_FALL = 144, //
SMART_ACTION_SET_EVENT_FLAG_RESET = 145, // 0/1
SMART_ACTION_REMOVE_ALL_GAMEOBJECTS = 146,
SMART_ACTION_STOP_MOTION = 147, // stopMoving, movementExpired
SMART_ACTION_NO_ENVIRONMENT_UPDATE = 148,
SMART_ACTION_ZONE_UNDER_ATTACK = 149,
SMART_ACTION_LOAD_GRID = 150,
SMART_ACTION_END = 151, // ZOMG!, zmienic w sql
};
@@ -605,7 +605,7 @@ struct SmartAction
{
uint32 textGroupID;
uint32 duration;
uint32 useTalkTarget;
uint32 useTalkTarget;
} talk;
struct
@@ -668,10 +668,10 @@ struct SmartAction
uint32 targetParam3;
} crossCast;
struct
{
uint32 alternative;
} activateObject;
struct
{
uint32 alternative;
} activateObject;
struct
{
@@ -679,7 +679,7 @@ struct SmartAction
uint32 type;
uint32 duration;
uint32 attackInvoker;
uint32 attackScriptOwner;
uint32 attackScriptOwner;
} summonCreature;
struct
@@ -742,7 +742,7 @@ struct SmartAction
uint32 entry;
uint32 credit;
uint32 creditType;
uint32 aliveState;
uint32 aliveState;
} follow;
struct
@@ -781,7 +781,7 @@ struct SmartAction
{
uint32 creature;
uint32 team;
uint32 doNotChangeLevel;
uint32 doNotChangeLevel;
} updateTemplate;
struct
@@ -836,7 +836,7 @@ struct SmartAction
{
uint32 entry;
uint32 despawnTime;
uint32 targetsummon;
uint32 targetsummon;
} summonGO;
struct
@@ -890,8 +890,8 @@ struct SmartAction
struct
{
uint32 fly;
uint32 speed;
uint32 disableGravity;
uint32 speed;
uint32 disableGravity;
} setFly;
struct
@@ -995,13 +995,13 @@ struct SmartAction
{
uint32 speedxy;
uint32 speedz;
uint32 selfJump;
uint32 selfJump;
} jump;
struct
{
uint32 flag;
} movementFlag;
struct
{
uint32 flag;
} movementFlag;
struct
{
@@ -1017,7 +1017,7 @@ struct SmartAction
{
uint32 pointId;
uint32 transport;
uint32 controlled;
uint32 controlled;
} MoveToPos;
struct
@@ -1057,16 +1057,16 @@ struct SmartAction
uint32 flag;
} goFlag;
struct
{
uint32 state;
} goState;
struct
{
uint32 state;
} goState;
struct
{
uint32 group;
uint32 attackInvoker;
uint32 attackScriptOwner;
uint32 attackScriptOwner;
} creatureGroup;
struct
@@ -1095,61 +1095,61 @@ struct SmartAction
uint32 wp6;
} closestWaypointFromList;
struct
{
uint32 dist;
} combatDistance;
struct
{
uint32 dist;
} combatDistance;
struct
{
uint32 dist;
} sightDistance;
struct
{
uint32 dist;
} sightDistance;
struct
{
uint32 dist;
uint32 reset;
} casterDistance;
struct
{
uint32 dist;
uint32 reset;
} casterDistance;
struct
{
uint32 spawnPos;
} setHomePos;
struct
{
uint32 spawnPos;
} setHomePos;
struct
{
uint32 id;
uint32 force;
} loadEquipment;
struct
{
uint32 id;
uint32 force;
} loadEquipment;
struct
{
uint32 minId;
uint32 maxId;
} randomTimedEvent;
struct
{
uint32 minId;
uint32 maxId;
} randomTimedEvent;
struct
{
uint32 state;
} setHover;
struct
{
uint32 state;
} setHover;
struct
{
uint32 type;
uint32 id;
uint32 value;
} immunity;
struct
{
uint32 type;
uint32 id;
uint32 value;
} immunity;
struct
{
uint32 quickChange;
} orientation;
struct
{
uint32 quickChange;
} orientation;
struct
{
uint32 stopMovement;
uint32 movementExpired;
} stopMotion;
struct
{
uint32 stopMovement;
uint32 movementExpired;
} stopMotion;
//! Note for any new future actions
//! All parameters must have type uint32
@@ -1206,20 +1206,20 @@ enum SMARTAI_TARGETS
SMART_TARGET_THREAT_LIST = 24, // All units on creature's threat list, maxdist, playerOnly
SMART_TARGET_CLOSEST_ENEMY = 25, // maxDist, playerOnly
SMART_TARGET_CLOSEST_FRIENDLY = 26, // maxDist, playerOnly
// RESERVED = 27,
// RESERVED = 28,
// RESERVED = 29,
// RESERVED = 30,
// RESERVED = 31,
// RESERVED = 32,
// RESERVED = 33,
// RESERVED = 34,
// RESERVED = 35,
// RESERVED = 36,
// RESERVED = 37,
// RESERVED = 38,
// RESERVED = 39,
SMART_TARGET_FARTHEST = 40,
// RESERVED = 27,
// RESERVED = 28,
// RESERVED = 29,
// RESERVED = 30,
// RESERVED = 31,
// RESERVED = 32,
// RESERVED = 33,
// RESERVED = 34,
// RESERVED = 35,
// RESERVED = 36,
// RESERVED = 37,
// RESERVED = 38,
// RESERVED = 39,
SMART_TARGET_FARTHEST = 40,
SMART_TARGET_END = 41
};
@@ -1232,7 +1232,7 @@ struct SmartTarget
raw.param1 = p1;
raw.param2 = p2;
raw.param3 = p3;
raw.param4 = p4;
raw.param4 = p4;
x = 0.0f;
y = 0.0f;
z = 0.0f;
@@ -1242,19 +1242,19 @@ struct SmartTarget
float x, y, z, o;
union
{
// Xinef: allow random selectors to limit distance
struct
// Xinef: allow random selectors to limit distance
struct
{
uint32 maxDist;
uint32 playerOnly;
uint32 powerType;
uint32 playerOnly;
uint32 powerType;
} hostilRandom;
struct
struct
{
uint32 maxDist;
uint32 playerOnly;
uint32 isInLos;
uint32 playerOnly;
uint32 isInLos;
} farthest;
struct
@@ -1262,21 +1262,21 @@ struct SmartTarget
uint32 creature;
uint32 minDist;
uint32 maxDist;
uint32 livingState;
uint32 livingState;
} unitRange;
struct
{
uint32 dbGuid;
uint32 entry;
uint32 getFromHashMap; // Does not work in instances
uint32 getFromHashMap; // Does not work in instances
} unitGUID;
struct
{
uint32 creature;
uint32 dist;
uint32 livingState;
uint32 livingState;
} unitDistance;
struct
@@ -1307,7 +1307,7 @@ struct SmartTarget
{
uint32 dbGuid;
uint32 entry;
uint32 getFromHashMap; // Does not work in instances
uint32 getFromHashMap; // Does not work in instances
} goGUID;
struct
@@ -1321,10 +1321,10 @@ struct SmartTarget
uint32 map;
} position;
struct
{
uint32 useCharmerOrOwner;
} owner;
struct
{
uint32 useCharmerOrOwner;
} owner;
struct
{
@@ -1350,7 +1350,7 @@ struct SmartTarget
uint32 param1;
uint32 param2;
uint32 param3;
uint32 param4;
uint32 param4;
} raw;
};
};
@@ -1476,7 +1476,7 @@ const uint32 SmartAIEventMask[SMART_EVENT_END][2] =
{SMART_EVENT_JUST_CREATED, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT },
{SMART_EVENT_GOSSIP_HELLO, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT },
{SMART_EVENT_FOLLOW_COMPLETED, SMART_SCRIPT_TYPE_MASK_CREATURE },
{SMART_EVENT_UNUSED_66, 0},
{SMART_EVENT_UNUSED_66, 0},
{SMART_EVENT_IS_BEHIND_TARGET, SMART_SCRIPT_TYPE_MASK_CREATURE },
{SMART_EVENT_GAME_EVENT_START, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT },
{SMART_EVENT_GAME_EVENT_END, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT },
+247 -96
View File
@@ -1,6 +1,6 @@
/*
* Copyright (C)
* Copyright (C)
* Copyright (C)
* Copyright (C)
*
* 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
@@ -27,125 +27,276 @@
namespace AccountMgr
{
uint32 GetId(std::string const& username)
{
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_ACCOUNT_ID_BY_USERNAME);
stmt->setString(0, username);
PreparedQueryResult result = LoginDatabase.Query(stmt);
return (result) ? (*result)[0].GetUInt32() : 0;
}
uint32 GetSecurity(uint32 accountId)
{
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_ACCOUNT_ACCESS_GMLEVEL);
stmt->setUInt32(0, accountId);
PreparedQueryResult result = LoginDatabase.Query(stmt);
return (result) ? (*result)[0].GetUInt8() : uint32(SEC_PLAYER);
}
uint32 GetSecurity(uint32 accountId, int32 realmId)
{
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_GMLEVEL_BY_REALMID);
stmt->setUInt32(0, accountId);
stmt->setInt32(1, realmId);
PreparedQueryResult result = LoginDatabase.Query(stmt);
return (result) ? (*result)[0].GetUInt8() : uint32(SEC_PLAYER);
}
bool GetName(uint32 accountId, std::string& name)
{
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_USERNAME_BY_ID);
stmt->setUInt32(0, accountId);
PreparedQueryResult result = LoginDatabase.Query(stmt);
if (result)
AccountOpResult CreateAccount(std::string username, std::string password)
{
name = (*result)[0].GetString();
return true;
if (utf8length(username) > MAX_ACCOUNT_STR)
return AOR_NAME_TOO_LONG; // username's too long
normalizeString(username);
normalizeString(password);
if (GetId(username))
return AOR_NAME_ALREDY_EXIST; // username does already exist
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT);
stmt->setString(0, username);
stmt->setString(1, CalculateShaPassHash(username, password));
LoginDatabase.Execute(stmt);
stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_REALM_CHARACTERS_INIT);
LoginDatabase.Execute(stmt);
return AOR_OK; // everything's fine
}
return false;
}
AccountOpResult DeleteAccount(uint32 accountId)
{
// Check if accounts exists
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BY_ID);
stmt->setUInt32(0, accountId);
PreparedQueryResult result = LoginDatabase.Query(stmt);
bool CheckPassword(uint32 accountId, std::string password)
{
std::string username;
if (!result)
return AOR_NAME_NOT_EXIST;
// Obtain accounts characters
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARS_BY_ACCOUNT_ID);
stmt->setUInt32(0, accountId);
result = CharacterDatabase.Query(stmt);
if (result)
{
do
{
uint32 guidLow = (*result)[0].GetUInt32();
uint64 guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
// Kick if player is online
if (Player* p = ObjectAccessor::FindPlayer(guid))
{
WorldSession* s = p->GetSession();
s->KickPlayer(); // mark session to remove at next session list update
s->LogoutPlayer(false); // logout player without waiting next session list update
}
Player::DeleteFromDB(guid, accountId, false, true); // no need to update realm characters
} while (result->NextRow());
}
// table realm specific but common for all characters of account for realm
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_TUTORIALS);
stmt->setUInt32(0, accountId);
CharacterDatabase.Execute(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_ACCOUNT_DATA);
stmt->setUInt32(0, accountId);
CharacterDatabase.Execute(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHARACTER_BAN);
stmt->setUInt32(0, accountId);
CharacterDatabase.Execute(stmt);
SQLTransaction trans = LoginDatabase.BeginTransaction();
stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT);
stmt->setUInt32(0, accountId);
trans->Append(stmt);
stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_ACCESS);
stmt->setUInt32(0, accountId);
trans->Append(stmt);
stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_REALM_CHARACTERS);
stmt->setUInt32(0, accountId);
trans->Append(stmt);
stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_BANNED);
stmt->setUInt32(0, accountId);
trans->Append(stmt);
LoginDatabase.CommitTransaction(trans);
return AOR_OK;
}
AccountOpResult ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword)
{
// Check if accounts exists
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BY_ID);
stmt->setUInt32(0, accountId);
PreparedQueryResult result = LoginDatabase.Query(stmt);
if (!result)
return AOR_NAME_NOT_EXIST;
if (utf8length(newUsername) > MAX_ACCOUNT_STR)
return AOR_NAME_TOO_LONG;
if (utf8length(newPassword) > MAX_ACCOUNT_STR)
return AOR_PASS_TOO_LONG;
normalizeString(newUsername);
normalizeString(newPassword);
stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_USERNAME);
stmt->setString(0, newUsername);
stmt->setString(1, CalculateShaPassHash(newUsername, newPassword));
stmt->setUInt32(2, accountId);
LoginDatabase.Execute(stmt);
return AOR_OK;
}
AccountOpResult ChangePassword(uint32 accountId, std::string newPassword)
{
std::string username;
if (!GetName(accountId, username))
return AOR_NAME_NOT_EXIST; // account doesn't exist
if (utf8length(newPassword) > MAX_ACCOUNT_STR)
return AOR_PASS_TOO_LONG;
normalizeString(username);
normalizeString(newPassword);
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_PASSWORD);
stmt->setString(0, CalculateShaPassHash(username, newPassword));
stmt->setUInt32(1, accountId);
LoginDatabase.Execute(stmt);
return AOR_OK;
}
uint32 GetId(std::string const& username)
{
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_ACCOUNT_ID_BY_USERNAME);
stmt->setString(0, username);
PreparedQueryResult result = LoginDatabase.Query(stmt);
return (result) ? (*result)[0].GetUInt32() : 0;
}
uint32 GetSecurity(uint32 accountId)
{
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_ACCOUNT_ACCESS_GMLEVEL);
stmt->setUInt32(0, accountId);
PreparedQueryResult result = LoginDatabase.Query(stmt);
return (result) ? (*result)[0].GetUInt8() : uint32(SEC_PLAYER);
}
uint32 GetSecurity(uint32 accountId, int32 realmId)
{
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_GMLEVEL_BY_REALMID);
stmt->setUInt32(0, accountId);
stmt->setInt32(1, realmId);
PreparedQueryResult result = LoginDatabase.Query(stmt);
return (result) ? (*result)[0].GetUInt8() : uint32(SEC_PLAYER);
}
bool GetName(uint32 accountId, std::string& name)
{
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_USERNAME_BY_ID);
stmt->setUInt32(0, accountId);
PreparedQueryResult result = LoginDatabase.Query(stmt);
if (result)
{
name = (*result)[0].GetString();
return true;
}
if (!GetName(accountId, username))
return false;
}
normalizeString(username);
normalizeString(password);
bool CheckPassword(uint32 accountId, std::string password)
{
std::string username;
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_CHECK_PASSWORD);
stmt->setUInt32(0, accountId);
stmt->setString(1, CalculateShaPassHash(username, password));
PreparedQueryResult result = LoginDatabase.Query(stmt);
if (!GetName(accountId, username))
return false;
return (result) ? true : false;
}
normalizeString(username);
normalizeString(password);
uint32 GetCharactersCount(uint32 accountId)
{
// check character count
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_SUM_CHARS);
stmt->setUInt32(0, accountId);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_CHECK_PASSWORD);
stmt->setUInt32(0, accountId);
stmt->setString(1, CalculateShaPassHash(username, password));
PreparedQueryResult result = LoginDatabase.Query(stmt);
return (result) ? (*result)[0].GetUInt64() : 0;
}
return (result) ? true : false;
}
bool normalizeString(std::string& utf8String)
{
wchar_t buffer[MAX_ACCOUNT_STR+1];
uint32 GetCharactersCount(uint32 accountId)
{
// check character count
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_SUM_CHARS);
stmt->setUInt32(0, accountId);
PreparedQueryResult result = CharacterDatabase.Query(stmt);
size_t maxLength = MAX_ACCOUNT_STR;
if (!Utf8toWStr(utf8String, buffer, maxLength))
return false;
return (result) ? (*result)[0].GetUInt64() : 0;
}
bool normalizeString(std::string& utf8String)
{
wchar_t buffer[MAX_ACCOUNT_STR + 1];
size_t maxLength = MAX_ACCOUNT_STR;
if (!Utf8toWStr(utf8String, buffer, maxLength))
return false;
#ifdef _MSC_VER
#pragma warning(disable: 4996)
#endif
std::transform(&buffer[0], buffer+maxLength, &buffer[0], wcharToUpperOnlyLatin);
std::transform(&buffer[0], buffer + maxLength, &buffer[0], wcharToUpperOnlyLatin);
#ifdef _MSC_VER
#pragma warning(default: 4996)
#endif
return WStrToUtf8(buffer, maxLength, utf8String);
}
return WStrToUtf8(buffer, maxLength, utf8String);
}
std::string CalculateShaPassHash(std::string const& name, std::string const& password)
{
SHA1Hash sha;
sha.Initialize();
sha.UpdateData(name);
sha.UpdateData(":");
sha.UpdateData(password);
sha.Finalize();
std::string CalculateShaPassHash(std::string const& name, std::string const& password)
{
SHA1Hash sha;
sha.Initialize();
sha.UpdateData(name);
sha.UpdateData(":");
sha.UpdateData(password);
sha.Finalize();
return ByteArrayToHexStr(sha.GetDigest(), sha.GetLength());
}
return ByteArrayToHexStr(sha.GetDigest(), sha.GetLength());
}
bool IsPlayerAccount(uint32 gmlevel)
{
return gmlevel == SEC_PLAYER;
}
bool IsPlayerAccount(uint32 gmlevel)
{
return gmlevel == SEC_PLAYER;
}
bool IsGMAccount(uint32 gmlevel)
{
return gmlevel >= SEC_GAMEMASTER && gmlevel <= SEC_CONSOLE;
}
bool IsGMAccount(uint32 gmlevel)
{
return gmlevel >= SEC_GAMEMASTER && gmlevel <= SEC_CONSOLE;
}
bool IsAdminAccount(uint32 gmlevel)
{
return gmlevel >= SEC_ADMINISTRATOR && gmlevel <= SEC_CONSOLE;
}
bool IsAdminAccount(uint32 gmlevel)
{
return gmlevel >= SEC_ADMINISTRATOR && gmlevel <= SEC_CONSOLE;
}
bool IsConsoleAccount(uint32 gmlevel)
{
return gmlevel == SEC_CONSOLE;
}
bool IsConsoleAccount(uint32 gmlevel)
{
return gmlevel == SEC_CONSOLE;
}
} // Namespace AccountMgr
+4
View File
@@ -36,6 +36,10 @@ enum AccountOpResult
namespace AccountMgr
{
AccountOpResult CreateAccount(std::string username, std::string password);
AccountOpResult DeleteAccount(uint32 accountId);
AccountOpResult ChangeUsername(uint32 accountId, std::string newUsername, std::string newPassword);
AccountOpResult ChangePassword(uint32 accountId, std::string newPassword);
bool CheckPassword(uint32 accountId, std::string password);
uint32 GetId(std::string const& username);
+250 -250
View File
@@ -379,14 +379,14 @@ bool AchievementCriteriaData::Meets(uint32 criteria_id, Player const* source, Un
case ACHIEVEMENT_CRITERIA_DATA_TYPE_MAP_PLAYER_COUNT:
return source->GetMap()->GetPlayersCountExceptGMs() <= map_players.maxcount;
case ACHIEVEMENT_CRITERIA_DATA_TYPE_T_TEAM:
{
{
if (!target || target->GetTypeId() != TYPEID_PLAYER)
return false;
// DB data compatibility...
uint32 teamOld = target->ToPlayer()->GetTeamId() == TEAM_ALLIANCE ? ALLIANCE : HORDE;
// DB data compatibility...
uint32 teamOld = target->ToPlayer()->GetTeamId() == TEAM_ALLIANCE ? ALLIANCE : HORDE;
return teamOld == team.team;
}
}
case ACHIEVEMENT_CRITERIA_DATA_TYPE_S_DRUNK:
return Player::GetDrunkenstateByValue(source->GetDrunkValue()) >= DrunkenState(drunk.state);
case ACHIEVEMENT_CRITERIA_DATA_TYPE_HOLIDAY:
@@ -500,8 +500,8 @@ void AchievementMgr::Reset()
void AchievementMgr::ResetAchievementCriteria(AchievementCriteriaCondition condition, uint32 value, bool evenIfCriteriaComplete)
{
AchievementCriteriaEntryList const* achievementCriteriaList = sAchievementMgr->GetAchievementCriteriaByCondition(condition, value);
if (!achievementCriteriaList)
return;
if (!achievementCriteriaList)
return;
for (AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList->begin(); i != achievementCriteriaList->end(); ++i)
{
@@ -569,7 +569,7 @@ void AchievementMgr::SaveToDB(SQLTransaction& trans)
stmt->setUInt16(1, iter->first);
trans->Append(stmt);
// pussywizard: insert only for (counter != 0) is very important! this is how criteria of completed achievements gets deleted from db (by setting counter to 0); if conflicted during merge - contact me
// pussywizard: insert only for (counter != 0) is very important! this is how criteria of completed achievements gets deleted from db (by setting counter to 0); if conflicted during merge - contact me
if (iter->second.counter)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_ACHIEVEMENT_PROGRESS);
@@ -753,62 +753,62 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
if (m_player->IsGameMaster())
return;
AchievementCriteriaEntryList const* achievementCriteriaList = NULL;
AchievementCriteriaEntryList const* achievementCriteriaList = NULL;
switch (type)
{
case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE:
case ACHIEVEMENT_CRITERIA_TYPE_WIN_BG:
case ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL:
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT:
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE:
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND:
case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE:
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST:
case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET:
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL:
case ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE:
case ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA:
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL:
case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL:
case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA:
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION:
case ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS:
case ACHIEVEMENT_CRITERIA_TYPE_HK_RACE:
case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE:
case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT:
case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2:
case ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT:
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS:
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2:
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE:
if (miscValue1)
{
achievementCriteriaList = sAchievementMgr->GetSpecialAchievementCriteriaByType(type, miscValue1);
break;
}
achievementCriteriaList = sAchievementMgr->GetAchievementCriteriaByType(type);
break;
case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM:
if (miscValue2)
{
achievementCriteriaList = sAchievementMgr->GetSpecialAchievementCriteriaByType(type, miscValue2);
break;
}
achievementCriteriaList = sAchievementMgr->GetAchievementCriteriaByType(type);
break;
default:
achievementCriteriaList = sAchievementMgr->GetAchievementCriteriaByType(type);
break;
}
switch (type)
{
case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE:
case ACHIEVEMENT_CRITERIA_TYPE_WIN_BG:
case ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL:
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT:
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE:
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND:
case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE:
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST:
case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET:
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL:
case ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE:
case ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA:
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL:
case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL:
case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA:
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION:
case ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS:
case ACHIEVEMENT_CRITERIA_TYPE_HK_RACE:
case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE:
case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM:
case ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT:
case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2:
case ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT:
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS:
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2:
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE:
if (miscValue1)
{
achievementCriteriaList = sAchievementMgr->GetSpecialAchievementCriteriaByType(type, miscValue1);
break;
}
achievementCriteriaList = sAchievementMgr->GetAchievementCriteriaByType(type);
break;
case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM:
if (miscValue2)
{
achievementCriteriaList = sAchievementMgr->GetSpecialAchievementCriteriaByType(type, miscValue2);
break;
}
achievementCriteriaList = sAchievementMgr->GetAchievementCriteriaByType(type);
break;
default:
achievementCriteriaList = sAchievementMgr->GetAchievementCriteriaByType(type);
break;
}
if (!achievementCriteriaList)
return;
if (!achievementCriteriaList)
return;
for (AchievementCriteriaEntryList::const_iterator i = achievementCriteriaList->begin(); i != achievementCriteriaList->end(); ++i)
{
@@ -848,7 +848,7 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
case ACHIEVEMENT_CRITERIA_TYPE_GOLD_EARNED_BY_AUCTIONS:/* FIXME: for online player only currently */
case ACHIEVEMENT_CRITERIA_TYPE_TOTAL_DAMAGE_RECEIVED:
case ACHIEVEMENT_CRITERIA_TYPE_TOTAL_HEALING_RECEIVED:
case ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS:
case ACHIEVEMENT_CRITERIA_TYPE_USE_LFD_TO_GROUP_WITH_PLAYERS:
// AchievementMgr::UpdateAchievementCriteria might also be called on login - skip in this case
if (!miscValue1)
continue;
@@ -1256,9 +1256,9 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
continue;
// Children's Week achievements have extra requirements
//if (achievement->categoryId == CATEGORY_CHILDRENS_WEEK || achievement->ID == 1291) // Lonely?
//if (achievement->categoryId == CATEGORY_CHILDRENS_WEEK || achievement->ID == 1291) // Lonely?
{
// Xinef: skip progress only if data exists and is not meet
// Xinef: skip progress only if data exists and is not meet
AchievementCriteriaDataSet const* data = sAchievementMgr->GetCriteriaDataSet(achievementCriteria);
if (data && !data->Meets(GetPlayer(), NULL))
continue;
@@ -1448,11 +1448,11 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
for (SkillLineAbilityMap::const_iterator skillIter = bounds.first; skillIter != bounds.second; ++skillIter)
{
if (skillIter->second->skillId == achievementCriteria->learn_skillline_spell.skillLine)
{
// xinef: do not add couter twice if by any chance skill is listed twice in dbc (eg. skill 777 and spell 22717)
{
// xinef: do not add couter twice if by any chance skill is listed twice in dbc (eg. skill 777 and spell 22717)
++spellCount;
break;
}
break;
}
}
}
@@ -1508,14 +1508,14 @@ void AchievementMgr::UpdateAchievementCriteria(AchievementCriteriaTypes type, ui
{
SkillLineAbilityMapBounds bounds = sSpellMgr->GetSkillLineAbilityMapBounds(spellIter->first);
for (SkillLineAbilityMap::const_iterator skillIter = bounds.first; skillIter != bounds.second; ++skillIter)
{
{
if (skillIter->second->skillId == achievementCriteria->learn_skill_line.skillLine)
{
// xinef: do not add couter twice if by any chance skill is listed twice in dbc (eg. skill 777 and spell 22717)
{
// xinef: do not add couter twice if by any chance skill is listed twice in dbc (eg. skill 777 and spell 22717)
++spellCount;
break;
}
}
break;
}
}
}
SetCriteriaProgress(achievementCriteria, spellCount);
@@ -1719,24 +1719,24 @@ bool AchievementMgr::IsCompletedCriteria(AchievementCriteriaEntry const* achieve
return false;
}
// pussywizard: progress will be deleted after getting the achievement (optimization)
// finished achievement should indicate criteria completed, since not finding progress would start some timed achievements and probably other things
if (HasAchieved(achievement->ID))
{
bool completed = true;
// pussywizard: progress will be deleted after getting the achievement (optimization)
// finished achievement should indicate criteria completed, since not finding progress would start some timed achievements and probably other things
if (HasAchieved(achievement->ID))
{
bool completed = true;
// completed only after all referenced achievements are also completed
if (AchievementEntryList const* achRefList = sAchievementMgr->GetAchievementByReferencedId(achievement->ID))
// completed only after all referenced achievements are also completed
if (AchievementEntryList const* achRefList = sAchievementMgr->GetAchievementByReferencedId(achievement->ID))
for (AchievementEntryList::const_iterator itr = achRefList->begin(); itr != achRefList->end(); ++itr)
if (!IsCompletedAchievement(*itr))
{
completed = false;
break;
}
{
completed = false;
break;
}
if (completed)
return true;
}
if (completed)
return true;
}
CriteriaProgress const* progress = GetCriteriaProgress(achievementCriteria);
if (!progress)
@@ -2000,7 +2000,7 @@ void AchievementMgr::SetCriteriaProgress(AchievementCriteriaEntry const* entry,
switch (ptype)
{
case PROGRESS_SET:
case PROGRESS_RESET:
case PROGRESS_RESET:
newValue = changeValue;
break;
case PROGRESS_ACCUMULATE:
@@ -2138,28 +2138,28 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
ca.date = time(NULL);
ca.changed = true;
// pussywizard: set all progress counters to 0, so progress will be deleted from db during save
{
bool allRefsCompleted = true;
uint32 achiCheckId = achievement->refAchievement ? achievement->refAchievement : achievement->ID;
// pussywizard: set all progress counters to 0, so progress will be deleted from db during save
{
bool allRefsCompleted = true;
uint32 achiCheckId = achievement->refAchievement ? achievement->refAchievement : achievement->ID;
if (AchievementEntryList const* achRefList = sAchievementMgr->GetAchievementByReferencedId(achiCheckId))
for (AchievementEntryList::const_iterator itr = achRefList->begin(); itr != achRefList->end(); ++itr)
if (!IsCompletedAchievement(*itr))
{
allRefsCompleted = false;
break;
}
if (AchievementEntryList const* achRefList = sAchievementMgr->GetAchievementByReferencedId(achiCheckId))
for (AchievementEntryList::const_iterator itr = achRefList->begin(); itr != achRefList->end(); ++itr)
if (!IsCompletedAchievement(*itr))
{
allRefsCompleted = false;
break;
}
if (allRefsCompleted)
if (AchievementCriteriaEntryList const* cList = sAchievementMgr->GetAchievementCriteriaByAchievement(achiCheckId))
for (AchievementCriteriaEntryList::const_iterator itr = cList->begin(); itr != cList->end(); ++itr)
if (CriteriaProgress* progress = GetCriteriaProgress(*itr))
{
progress->changed = true;
progress->counter = 0;
}
}
if (allRefsCompleted)
if (AchievementCriteriaEntryList const* cList = sAchievementMgr->GetAchievementCriteriaByAchievement(achiCheckId))
for (AchievementCriteriaEntryList::const_iterator itr = cList->begin(); itr != cList->end(); ++itr)
if (CriteriaProgress* progress = GetCriteriaProgress(*itr))
{
progress->changed = true;
progress->counter = 0;
}
}
// don't insert for ACHIEVEMENT_FLAG_REALM_FIRST_KILL since otherwise only the first group member would reach that achievement
// TODO: where do set this instead?
@@ -2188,10 +2188,10 @@ void AchievementMgr::CompletedAchievement(AchievementEntry const* achievement)
// mail
if (reward->sender)
{
MailDraft draft(reward->mailTemplate);
MailDraft draft(reward->mailTemplate);
if (!reward->mailTemplate)
draft = MailDraft(reward->subject, reward->text);
draft = MailDraft(reward->subject, reward->text);
SQLTransaction trans = CharacterDatabase.BeginTransaction();
@@ -2230,33 +2230,33 @@ void AchievementMgr::SendRespondInspectAchievements(Player* player) const
*/
void AchievementMgr::BuildAllDataPacket(WorldPacket* data, bool inspect) const
{
if (!m_completedAchievements.empty())
{
AchievementEntry const* achievement = NULL;
for (CompletedAchievementMap::const_iterator iter = m_completedAchievements.begin(); iter != m_completedAchievements.end(); ++iter)
{
// Skip hidden achievements
achievement = sAchievementStore.LookupEntry(iter->first);
if (!achievement || achievement->flags & ACHIEVEMENT_FLAG_HIDDEN)
continue;
if (!m_completedAchievements.empty())
{
AchievementEntry const* achievement = NULL;
for (CompletedAchievementMap::const_iterator iter = m_completedAchievements.begin(); iter != m_completedAchievements.end(); ++iter)
{
// Skip hidden achievements
achievement = sAchievementStore.LookupEntry(iter->first);
if (!achievement || achievement->flags & ACHIEVEMENT_FLAG_HIDDEN)
continue;
*data << uint32(iter->first);
data->AppendPackedTime(iter->second.date);
}
}
*data << int32(-1);
*data << uint32(iter->first);
data->AppendPackedTime(iter->second.date);
}
}
*data << int32(-1);
if (!inspect && !m_criteriaProgress.empty())
for (CriteriaProgressMap::const_iterator iter = m_criteriaProgress.begin(); iter != m_criteriaProgress.end(); ++iter)
{
*data << uint32(iter->first);
data->appendPackGUID(iter->second.counter);
data->append(GetPlayer()->GetPackGUID());
*data << uint32(0);
data->AppendPackedTime(iter->second.date);
*data << uint32(0);
*data << uint32(0);
}
if (!inspect && !m_criteriaProgress.empty())
for (CriteriaProgressMap::const_iterator iter = m_criteriaProgress.begin(); iter != m_criteriaProgress.end(); ++iter)
{
*data << uint32(iter->first);
data->appendPackGUID(iter->second.counter);
data->append(GetPlayer()->GetPackGUID());
*data << uint32(0);
data->AppendPackedTime(iter->second.date);
*data << uint32(0);
*data << uint32(0);
}
*data << int32(-1);
}
@@ -2329,122 +2329,122 @@ void AchievementGlobalMgr::LoadAchievementCriteriaList()
m_AchievementCriteriaListByAchievement[criteria->referredAchievement].push_back(criteria);
if (criteria->additionalRequirements[0].additionalRequirement_type != ACHIEVEMENT_CRITERIA_CONDITION_NONE)
m_AchievementCriteriasByCondition[criteria->additionalRequirements[0].additionalRequirement_type][criteria->additionalRequirements[0].additionalRequirement_value].push_back(criteria);
if (criteria->additionalRequirements[1].additionalRequirement_type != ACHIEVEMENT_CRITERIA_CONDITION_NONE &&
criteria->additionalRequirements[1].additionalRequirement_type != criteria->additionalRequirements[0].additionalRequirement_type)
m_AchievementCriteriasByCondition[criteria->additionalRequirements[1].additionalRequirement_type][criteria->additionalRequirements[1].additionalRequirement_value].push_back(criteria);
m_AchievementCriteriasByCondition[criteria->additionalRequirements[0].additionalRequirement_type][criteria->additionalRequirements[0].additionalRequirement_value].push_back(criteria);
if (criteria->additionalRequirements[1].additionalRequirement_type != ACHIEVEMENT_CRITERIA_CONDITION_NONE &&
criteria->additionalRequirements[1].additionalRequirement_type != criteria->additionalRequirements[0].additionalRequirement_type)
m_AchievementCriteriasByCondition[criteria->additionalRequirements[1].additionalRequirement_type][criteria->additionalRequirements[1].additionalRequirement_value].push_back(criteria);
switch (criteria->requiredType)
{
case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE:
m_SpecialList[criteria->requiredType][criteria->kill_creature.creatureID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_WIN_BG:
m_SpecialList[criteria->requiredType][criteria->win_bg.bgMapID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL:
m_SpecialList[criteria->requiredType][criteria->reach_skill_level.skillID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT:
m_SpecialList[criteria->requiredType][criteria->complete_achievement.linkedAchievement].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE:
m_SpecialList[criteria->requiredType][criteria->complete_quests_in_zone.zoneID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND:
m_SpecialList[criteria->requiredType][criteria->complete_battleground.mapID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE:
m_SpecialList[criteria->requiredType][criteria->killed_by_creature.creatureEntry].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST:
m_SpecialList[criteria->requiredType][criteria->complete_quest.questID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET:
m_SpecialList[criteria->requiredType][criteria->be_spell_target.spellID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL:
m_SpecialList[criteria->requiredType][criteria->cast_spell.spellID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE:
m_SpecialList[criteria->requiredType][criteria->bg_objective.objectiveId].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA:
m_SpecialList[criteria->requiredType][criteria->honorable_kill_at_area.areaID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL:
m_SpecialList[criteria->requiredType][criteria->learn_spell.spellID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM:
m_SpecialList[criteria->requiredType][criteria->own_item.itemID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL:
m_SpecialList[criteria->requiredType][criteria->learn_skill_level.skillID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM:
m_SpecialList[criteria->requiredType][criteria->use_item.itemID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM:
m_SpecialList[criteria->requiredType][criteria->own_item.itemID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA:
{
WorldMapOverlayEntry const* worldOverlayEntry = sWorldMapOverlayStore.LookupEntry(criteria->explore_area.areaReference);
if (!worldOverlayEntry)
break;
switch (criteria->requiredType)
{
case ACHIEVEMENT_CRITERIA_TYPE_KILL_CREATURE:
m_SpecialList[criteria->requiredType][criteria->kill_creature.creatureID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_WIN_BG:
m_SpecialList[criteria->requiredType][criteria->win_bg.bgMapID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_REACH_SKILL_LEVEL:
m_SpecialList[criteria->requiredType][criteria->reach_skill_level.skillID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_ACHIEVEMENT:
m_SpecialList[criteria->requiredType][criteria->complete_achievement.linkedAchievement].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUESTS_IN_ZONE:
m_SpecialList[criteria->requiredType][criteria->complete_quests_in_zone.zoneID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_BATTLEGROUND:
m_SpecialList[criteria->requiredType][criteria->complete_battleground.mapID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_KILLED_BY_CREATURE:
m_SpecialList[criteria->requiredType][criteria->killed_by_creature.creatureEntry].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_COMPLETE_QUEST:
m_SpecialList[criteria->requiredType][criteria->complete_quest.questID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET:
m_SpecialList[criteria->requiredType][criteria->be_spell_target.spellID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL:
m_SpecialList[criteria->requiredType][criteria->cast_spell.spellID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE:
m_SpecialList[criteria->requiredType][criteria->bg_objective.objectiveId].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_HONORABLE_KILL_AT_AREA:
m_SpecialList[criteria->requiredType][criteria->honorable_kill_at_area.areaID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SPELL:
m_SpecialList[criteria->requiredType][criteria->learn_spell.spellID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_OWN_ITEM:
m_SpecialList[criteria->requiredType][criteria->own_item.itemID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LEVEL:
m_SpecialList[criteria->requiredType][criteria->learn_skill_level.skillID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_USE_ITEM:
m_SpecialList[criteria->requiredType][criteria->use_item.itemID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM:
m_SpecialList[criteria->requiredType][criteria->own_item.itemID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_EXPLORE_AREA:
{
WorldMapOverlayEntry const* worldOverlayEntry = sWorldMapOverlayStore.LookupEntry(criteria->explore_area.areaReference);
if (!worldOverlayEntry)
break;
for (uint8 j = 0; j < MAX_WORLD_MAP_OVERLAY_AREA_IDX; ++j)
if (worldOverlayEntry->areatableID[j])
{
bool valid = true;
for (uint8 i=0; i<j; ++i)
if (worldOverlayEntry->areatableID[j] == worldOverlayEntry->areatableID[i])
valid = false;
if (valid)
m_SpecialList[criteria->requiredType][worldOverlayEntry->areatableID[j]].push_back(criteria);
}
}
break;
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION:
m_SpecialList[criteria->requiredType][criteria->gain_reputation.factionID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM:
m_SpecialList[criteria->requiredType][criteria->equip_epic_item.itemSlot].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS:
m_SpecialList[criteria->requiredType][criteria->hk_class.classID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_HK_RACE:
m_SpecialList[criteria->requiredType][criteria->hk_race.raceID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE:
m_SpecialList[criteria->requiredType][criteria->do_emote.emoteID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM:
m_SpecialList[criteria->requiredType][criteria->equip_item.itemID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT:
m_SpecialList[criteria->requiredType][criteria->use_gameobject.goEntry].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2:
m_SpecialList[criteria->requiredType][criteria->be_spell_target.spellID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT:
m_SpecialList[criteria->requiredType][criteria->fish_in_gameobject.goEntry].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS:
m_SpecialList[criteria->requiredType][criteria->learn_skillline_spell.skillLine].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
m_SpecialList[criteria->requiredType][criteria->loot_type.lootType].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2:
m_SpecialList[criteria->requiredType][criteria->cast_spell.spellID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE:
m_SpecialList[criteria->requiredType][criteria->learn_skill_line.skillLine].push_back(criteria);
break;
}
for (uint8 j = 0; j < MAX_WORLD_MAP_OVERLAY_AREA_IDX; ++j)
if (worldOverlayEntry->areatableID[j])
{
bool valid = true;
for (uint8 i=0; i<j; ++i)
if (worldOverlayEntry->areatableID[j] == worldOverlayEntry->areatableID[i])
valid = false;
if (valid)
m_SpecialList[criteria->requiredType][worldOverlayEntry->areatableID[j]].push_back(criteria);
}
}
break;
case ACHIEVEMENT_CRITERIA_TYPE_GAIN_REPUTATION:
m_SpecialList[criteria->requiredType][criteria->gain_reputation.factionID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM:
m_SpecialList[criteria->requiredType][criteria->equip_epic_item.itemSlot].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_HK_CLASS:
m_SpecialList[criteria->requiredType][criteria->hk_class.classID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_HK_RACE:
m_SpecialList[criteria->requiredType][criteria->hk_race.raceID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_DO_EMOTE:
m_SpecialList[criteria->requiredType][criteria->do_emote.emoteID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM:
m_SpecialList[criteria->requiredType][criteria->equip_item.itemID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_USE_GAMEOBJECT:
m_SpecialList[criteria->requiredType][criteria->use_gameobject.goEntry].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET2:
m_SpecialList[criteria->requiredType][criteria->be_spell_target.spellID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_FISH_IN_GAMEOBJECT:
m_SpecialList[criteria->requiredType][criteria->fish_in_gameobject.goEntry].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILLLINE_SPELLS:
m_SpecialList[criteria->requiredType][criteria->learn_skillline_spell.skillLine].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE:
m_SpecialList[criteria->requiredType][criteria->loot_type.lootType].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_CAST_SPELL2:
m_SpecialList[criteria->requiredType][criteria->cast_spell.spellID].push_back(criteria);
break;
case ACHIEVEMENT_CRITERIA_TYPE_LEARN_SKILL_LINE:
m_SpecialList[criteria->requiredType][criteria->learn_skill_line.skillLine].push_back(criteria);
break;
}
if (criteria->timeLimit)
m_AchievementCriteriasByTimedType[criteria->timedType].push_back(criteria);
@@ -279,7 +279,7 @@ class AchievementMgr
void StartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry, uint32 timeLost = 0);
void RemoveTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry); // used for quest and scripted timed achievements
void RemoveCriteriaProgress(AchievementCriteriaEntry const* entry);
void RemoveCriteriaProgress(AchievementCriteriaEntry const* entry);
private:
enum ProgressType { PROGRESS_SET, PROGRESS_ACCUMULATE, PROGRESS_HIGHEST, PROGRESS_RESET };
void SendAchievementEarned(AchievementEntry const* achievement) const;
@@ -393,9 +393,9 @@ class AchievementGlobalMgr
AchievementRewards m_achievementRewards;
AchievementRewardLocales m_achievementRewardLocales;
// pussywizard:
std::map<uint32, AchievementCriteriaEntryList> m_SpecialList[ACHIEVEMENT_CRITERIA_TYPE_TOTAL];
std::map<uint32, AchievementCriteriaEntryList> m_AchievementCriteriasByCondition[ACHIEVEMENT_CRITERIA_CONDITION_TOTAL];
// pussywizard:
std::map<uint32, AchievementCriteriaEntryList> m_SpecialList[ACHIEVEMENT_CRITERIA_TYPE_TOTAL];
std::map<uint32, AchievementCriteriaEntryList> m_AchievementCriteriasByCondition[ACHIEVEMENT_CRITERIA_CONDITION_TOTAL];
};
#define sAchievementMgr ACE_Singleton<AchievementGlobalMgr, ACE_Null_Mutex>::instance()
+165 -165
View File
@@ -22,196 +22,196 @@
namespace ArenaSpectator
{
template<class T> inline void SendCommand(T* o, const char* format, ...) ATTR_PRINTF(2, 3);
inline void CreatePacket(WorldPacket& data, const char* m);
inline void SendPacketTo(const Player* p, const char* m);
inline void SendPacketTo(const Map* map, const char* m);
inline void HandleResetCommand(Player* p);
inline bool ShouldSendAura(Aura* aura, uint8 effMask, uint64 targetGUID, bool remove);
template<class T> inline void SendCommand(T* o, const char* format, ...) ATTR_PRINTF(2, 3);
inline void CreatePacket(WorldPacket& data, const char* m);
inline void SendPacketTo(const Player* p, const char* m);
inline void SendPacketTo(const Map* map, const char* m);
inline void HandleResetCommand(Player* p);
inline bool ShouldSendAura(Aura* aura, uint8 effMask, uint64 targetGUID, bool remove);
template<class T> inline void SendCommand_String(T* p, uint64 targetGUID, const char* prefix, const std::string& c);
template<class T> inline void SendCommand_UInt32Value(T* o, uint64 targetGUID, const char* prefix, uint32 t);
template<class T> inline void SendCommand_GUID(T* o, uint64 targetGUID, const char* prefix, uint64 t);
template<class T> inline void SendCommand_Spell(T* o, uint64 targetGUID, const char* prefix, uint32 id, int32 casttime);
template<class T> inline void SendCommand_Cooldown(T* o, uint64 targetGUID, const char* prefix, uint32 id, uint32 dur, uint32 maxdur);
template<class T> inline void SendCommand_Aura(T* o, uint64 targetGUID, const char* prefix, uint64 caster, uint32 id, bool isDebuff, uint32 dispel, int32 dur, int32 maxdur, uint32 stack, bool remove);
template<class T> inline void SendCommand_String(T* p, uint64 targetGUID, const char* prefix, const std::string& c);
template<class T> inline void SendCommand_UInt32Value(T* o, uint64 targetGUID, const char* prefix, uint32 t);
template<class T> inline void SendCommand_GUID(T* o, uint64 targetGUID, const char* prefix, uint64 t);
template<class T> inline void SendCommand_Spell(T* o, uint64 targetGUID, const char* prefix, uint32 id, int32 casttime);
template<class T> inline void SendCommand_Cooldown(T* o, uint64 targetGUID, const char* prefix, uint32 id, uint32 dur, uint32 maxdur);
template<class T> inline void SendCommand_Aura(T* o, uint64 targetGUID, const char* prefix, uint64 caster, uint32 id, bool isDebuff, uint32 dispel, int32 dur, int32 maxdur, uint32 stack, bool remove);
bool HandleSpectatorSpectateCommand(ChatHandler* handler, char const* args);
bool HandleSpectatorWatchCommand(ChatHandler* handler, char const* args);
bool HandleSpectatorSpectateCommand(ChatHandler* handler, char const* args);
bool HandleSpectatorWatchCommand(ChatHandler* handler, char const* args);
// definitions below:
// definitions below:
template<class T>
void SendCommand(T* o, const char* format, ...)
{
if (!format)
return;
template<class T>
void SendCommand(T* o, const char* format, ...)
{
if (!format)
return;
char buffer[SPECTATOR_BUFFER_LEN];
va_list ap;
va_list ap;
va_start(ap, format);
vsnprintf(buffer, SPECTATOR_BUFFER_LEN, format, ap);
va_end(ap);
SendPacketTo(o, buffer);
}
SendPacketTo(o, buffer);
}
void CreatePacket(WorldPacket& data, const char* m)
{
size_t len = strlen(m);
data.Initialize(SMSG_MESSAGECHAT, 1+4+8+4+8+4+1+len+1);
data << uint8(CHAT_MSG_WHISPER);
data << uint32(LANG_ADDON);
data << uint64(0);
data << uint32(0);
data << uint64(0);
data << uint32(len + 1);
data << m;
data << uint8(0);
}
void CreatePacket(WorldPacket& data, const char* m)
{
size_t len = strlen(m);
data.Initialize(SMSG_MESSAGECHAT, 1+4+8+4+8+4+1+len+1);
data << uint8(CHAT_MSG_WHISPER);
data << uint32(LANG_ADDON);
data << uint64(0);
data << uint32(0);
data << uint64(0);
data << uint32(len + 1);
data << m;
data << uint8(0);
}
void SendPacketTo(const Player* p, const char* m)
{
WorldPacket data;
CreatePacket(data, m);
p->GetSession()->SendPacket(&data);
}
void SendPacketTo(const Player* p, const char* m)
{
WorldPacket data;
CreatePacket(data, m);
p->GetSession()->SendPacket(&data);
}
void SendPacketTo(const Map* map, const char* m)
{
if (!map->IsBattleArena())
return;
Battleground* bg = ((BattlegroundMap*)map)->GetBG();
if (!bg || bg->GetStatus() != STATUS_IN_PROGRESS)
return;
WorldPacket data;
CreatePacket(data, m);
bg->SpectatorsSendPacket(data);
}
void SendPacketTo(const Map* map, const char* m)
{
if (!map->IsBattleArena())
return;
Battleground* bg = ((BattlegroundMap*)map)->GetBG();
if (!bg || bg->GetStatus() != STATUS_IN_PROGRESS)
return;
WorldPacket data;
CreatePacket(data, m);
bg->SpectatorsSendPacket(data);
}
template<class T>
void SendCommand_String(T* o, uint64 targetGUID, const char* prefix, const char* c)
{
if (!IS_PLAYER_GUID(targetGUID))
return;
SendCommand(o, "%s0x%016llX;%s=%s;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, c);
}
template<class T>
void SendCommand_String(T* o, uint64 targetGUID, const char* prefix, const char* c)
{
if (!IS_PLAYER_GUID(targetGUID))
return;
SendCommand(o, "%s0x%016llX;%s=%s;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, c);
}
template<class T>
void SendCommand_UInt32Value(T* o, uint64 targetGUID, const char* prefix, uint32 t)
{
if (!IS_PLAYER_GUID(targetGUID))
return;
SendCommand(o, "%s0x%016llX;%s=%u;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, t);
}
template<class T>
void SendCommand_UInt32Value(T* o, uint64 targetGUID, const char* prefix, uint32 t)
{
if (!IS_PLAYER_GUID(targetGUID))
return;
SendCommand(o, "%s0x%016llX;%s=%u;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, t);
}
template<class T>
void SendCommand_GUID(T* o, uint64 targetGUID, const char* prefix, uint64 t)
{
if (!IS_PLAYER_GUID(targetGUID))
return;
SendCommand(o, "%s0x%016llX;%s=0x%016llX;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, t);
}
template<class T>
void SendCommand_GUID(T* o, uint64 targetGUID, const char* prefix, uint64 t)
{
if (!IS_PLAYER_GUID(targetGUID))
return;
SendCommand(o, "%s0x%016llX;%s=0x%016llX;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, t);
}
template<class T>
void SendCommand_Spell(T* o, uint64 targetGUID, const char* prefix, uint32 id, int32 casttime)
{
if (!IS_PLAYER_GUID(targetGUID))
return;
SendCommand(o, "%s0x%016llX;%s=%u,%i;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, id, casttime);
}
template<class T>
void SendCommand_Spell(T* o, uint64 targetGUID, const char* prefix, uint32 id, int32 casttime)
{
if (!IS_PLAYER_GUID(targetGUID))
return;
SendCommand(o, "%s0x%016llX;%s=%u,%i;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, id, casttime);
}
template<class T>
void SendCommand_Cooldown(T* o, uint64 targetGUID, const char* prefix, uint32 id, uint32 dur, uint32 maxdur)
{
if (!IS_PLAYER_GUID(targetGUID))
return;
if (const SpellInfo* si = sSpellMgr->GetSpellInfo(id))
if (si->SpellIconID == 1)
return;
SendCommand(o, "%s0x%016llX;%s=%u,%u,%u;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, id, dur, maxdur);
}
template<class T>
void SendCommand_Cooldown(T* o, uint64 targetGUID, const char* prefix, uint32 id, uint32 dur, uint32 maxdur)
{
if (!IS_PLAYER_GUID(targetGUID))
return;
if (const SpellInfo* si = sSpellMgr->GetSpellInfo(id))
if (si->SpellIconID == 1)
return;
SendCommand(o, "%s0x%016llX;%s=%u,%u,%u;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, id, dur, maxdur);
}
template<class T>
void SendCommand_Aura(T* o, uint64 targetGUID, const char* prefix, uint64 caster, uint32 id, bool isDebuff, uint32 dispel, int32 dur, int32 maxdur, uint32 stack, bool remove)
{
if (!IS_PLAYER_GUID(targetGUID))
return;
SendCommand(o, "%s0x%016llX;%s=%u,%u,%i,%i,%u,%u,%u,0x%016llX;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, remove ? 1 : 0, stack, dur, maxdur, id, dispel, isDebuff ? 1 : 0, caster);
}
template<class T>
void SendCommand_Aura(T* o, uint64 targetGUID, const char* prefix, uint64 caster, uint32 id, bool isDebuff, uint32 dispel, int32 dur, int32 maxdur, uint32 stack, bool remove)
{
if (!IS_PLAYER_GUID(targetGUID))
return;
SendCommand(o, "%s0x%016llX;%s=%u,%u,%i,%i,%u,%u,%u,0x%016llX;", SPECTATOR_ADDON_PREFIX, targetGUID, prefix, remove ? 1 : 0, stack, dur, maxdur, id, dispel, isDebuff ? 1 : 0, caster);
}
void HandleResetCommand(Player* p)
{
if (!p->FindMap() || !p->IsInWorld() || !p->FindMap()->IsBattleArena())
return;
Battleground* bg = ((BattlegroundMap*)p->FindMap())->GetBG();
if (!bg || bg->GetStatus() != STATUS_IN_PROGRESS)
return;
Battleground::BattlegroundPlayerMap const& pl = bg->GetPlayers();
for (Battleground::BattlegroundPlayerMap::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
{
if (p->HasReceivedSpectatorResetFor(GUID_LOPART(itr->first)))
continue;
void HandleResetCommand(Player* p)
{
if (!p->FindMap() || !p->IsInWorld() || !p->FindMap()->IsBattleArena())
return;
Battleground* bg = ((BattlegroundMap*)p->FindMap())->GetBG();
if (!bg || bg->GetStatus() != STATUS_IN_PROGRESS)
return;
Battleground::BattlegroundPlayerMap const& pl = bg->GetPlayers();
for (Battleground::BattlegroundPlayerMap::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
{
if (p->HasReceivedSpectatorResetFor(GUID_LOPART(itr->first)))
continue;
Player* plr = itr->second;
p->AddReceivedSpectatorResetFor(GUID_LOPART(itr->first));
Player* plr = itr->second;
p->AddReceivedSpectatorResetFor(GUID_LOPART(itr->first));
SendCommand_String(p, itr->first, "NME", plr->GetName().c_str());
// Xinef: addon compatibility
SendCommand_UInt32Value(p, itr->first, "TEM", plr->GetBgTeamId() == TEAM_ALLIANCE ? ALLIANCE : HORDE);
SendCommand_UInt32Value(p, itr->first, "CLA", plr->getClass());
SendCommand_UInt32Value(p, itr->first, "MHP", plr->GetMaxHealth());
SendCommand_UInt32Value(p, itr->first, "CHP", plr->GetHealth());
SendCommand_UInt32Value(p, itr->first, "STA", plr->IsAlive() ? 1 : 0);
Powers ptype = plr->getPowerType();
SendCommand_UInt32Value(p, itr->first, "PWT", ptype);
SendCommand_UInt32Value(p, itr->first, "MPW", ptype == POWER_RAGE || ptype == POWER_RUNIC_POWER ? plr->GetMaxPower(ptype)/10 : plr->GetMaxPower(ptype));
SendCommand_UInt32Value(p, itr->first, "CPW", ptype == POWER_RAGE || ptype == POWER_RUNIC_POWER ? plr->GetPower(ptype)/10 : plr->GetPower(ptype));
Pet* pet = plr->GetPet();
SendCommand_UInt32Value(p, itr->first, "PHP", pet && pet->GetCreatureTemplate()->family ? (uint32)pet->GetHealthPct() : 0);
SendCommand_UInt32Value(p, itr->first, "PET", pet ? pet->GetCreatureTemplate()->family : 0);
SendCommand_GUID(p, itr->first, "TRG", plr->GetTarget());
SendCommand_UInt32Value(p, itr->first, "RES", 1);
SendCommand_UInt32Value(p, itr->first, "CDC", 1);
SendCommand_UInt32Value(p, itr->first, "TIM", (bg->GetStartTime() < 46*MINUTE*IN_MILLISECONDS) ? (46*MINUTE*IN_MILLISECONDS-bg->GetStartTime())/IN_MILLISECONDS : 0);
// "SPE" not here (only possible to send starting a new cast)
SendCommand_String(p, itr->first, "NME", plr->GetName().c_str());
// Xinef: addon compatibility
SendCommand_UInt32Value(p, itr->first, "TEM", plr->GetBgTeamId() == TEAM_ALLIANCE ? ALLIANCE : HORDE);
SendCommand_UInt32Value(p, itr->first, "CLA", plr->getClass());
SendCommand_UInt32Value(p, itr->first, "MHP", plr->GetMaxHealth());
SendCommand_UInt32Value(p, itr->first, "CHP", plr->GetHealth());
SendCommand_UInt32Value(p, itr->first, "STA", plr->IsAlive() ? 1 : 0);
Powers ptype = plr->getPowerType();
SendCommand_UInt32Value(p, itr->first, "PWT", ptype);
SendCommand_UInt32Value(p, itr->first, "MPW", ptype == POWER_RAGE || ptype == POWER_RUNIC_POWER ? plr->GetMaxPower(ptype)/10 : plr->GetMaxPower(ptype));
SendCommand_UInt32Value(p, itr->first, "CPW", ptype == POWER_RAGE || ptype == POWER_RUNIC_POWER ? plr->GetPower(ptype)/10 : plr->GetPower(ptype));
Pet* pet = plr->GetPet();
SendCommand_UInt32Value(p, itr->first, "PHP", pet && pet->GetCreatureTemplate()->family ? (uint32)pet->GetHealthPct() : 0);
SendCommand_UInt32Value(p, itr->first, "PET", pet ? pet->GetCreatureTemplate()->family : 0);
SendCommand_GUID(p, itr->first, "TRG", plr->GetTarget());
SendCommand_UInt32Value(p, itr->first, "RES", 1);
SendCommand_UInt32Value(p, itr->first, "CDC", 1);
SendCommand_UInt32Value(p, itr->first, "TIM", (bg->GetStartTime() < 46*MINUTE*IN_MILLISECONDS) ? (46*MINUTE*IN_MILLISECONDS-bg->GetStartTime())/IN_MILLISECONDS : 0);
// "SPE" not here (only possible to send starting a new cast)
// send all "CD"
SpellCooldowns const& sc = plr->GetSpellCooldownMap();
for (SpellCooldowns::const_iterator itrc = sc.begin(); itrc != sc.end(); ++itrc)
if (itrc->second.sendToSpectator && itrc->second.maxduration >= SPECTATOR_COOLDOWN_MIN*IN_MILLISECONDS && itrc->second.maxduration <= SPECTATOR_COOLDOWN_MAX*IN_MILLISECONDS)
if (uint32 cd = (getMSTimeDiff(World::GetGameTimeMS(), itrc->second.end)/1000))
SendCommand_Cooldown(p, itr->first, "ACD", itrc->first, cd, itrc->second.maxduration/1000);
// send all "CD"
SpellCooldowns const& sc = plr->GetSpellCooldownMap();
for (SpellCooldowns::const_iterator itrc = sc.begin(); itrc != sc.end(); ++itrc)
if (itrc->second.sendToSpectator && itrc->second.maxduration >= SPECTATOR_COOLDOWN_MIN*IN_MILLISECONDS && itrc->second.maxduration <= SPECTATOR_COOLDOWN_MAX*IN_MILLISECONDS)
if (uint32 cd = (getMSTimeDiff(World::GetGameTimeMS(), itrc->second.end)/1000))
SendCommand_Cooldown(p, itr->first, "ACD", itrc->first, cd, itrc->second.maxduration/1000);
// send all visible "AUR"
Unit::VisibleAuraMap const *visibleAuras = plr->GetVisibleAuras();
for (Unit::VisibleAuraMap::const_iterator aitr = visibleAuras->begin(); aitr != visibleAuras->end(); ++aitr)
{
Aura *aura = aitr->second->GetBase();
if (ShouldSendAura(aura, aitr->second->GetEffectMask(), plr->GetGUID(), false))
SendCommand_Aura(p, itr->first, "AUR", aura->GetCasterGUID(), aura->GetSpellInfo()->Id, aura->GetSpellInfo()->IsPositive(), aura->GetSpellInfo()->Dispel, aura->GetDuration(), aura->GetMaxDuration(), (aura->GetCharges() > 1 ? aura->GetCharges() : aura->GetStackAmount()), false);
}
}
}
// send all visible "AUR"
Unit::VisibleAuraMap const *visibleAuras = plr->GetVisibleAuras();
for (Unit::VisibleAuraMap::const_iterator aitr = visibleAuras->begin(); aitr != visibleAuras->end(); ++aitr)
{
Aura *aura = aitr->second->GetBase();
if (ShouldSendAura(aura, aitr->second->GetEffectMask(), plr->GetGUID(), false))
SendCommand_Aura(p, itr->first, "AUR", aura->GetCasterGUID(), aura->GetSpellInfo()->Id, aura->GetSpellInfo()->IsPositive(), aura->GetSpellInfo()->Dispel, aura->GetDuration(), aura->GetMaxDuration(), (aura->GetCharges() > 1 ? aura->GetCharges() : aura->GetStackAmount()), false);
}
}
}
bool ShouldSendAura(Aura* aura, uint8 effMask, uint64 targetGUID, bool remove)
{
if (aura->GetSpellInfo()->SpellIconID == 1 || aura->GetSpellInfo()->HasAttribute(SPELL_ATTR1_DONT_DISPLAY_IN_AURA_BAR))
return false;
bool ShouldSendAura(Aura* aura, uint8 effMask, uint64 targetGUID, bool remove)
{
if (aura->GetSpellInfo()->SpellIconID == 1 || aura->GetSpellInfo()->HasAttribute(SPELL_ATTR1_DONT_DISPLAY_IN_AURA_BAR))
return false;
if (remove || aura->GetSpellInfo()->HasAttribute(SPELL_ATTR0_CU_AURA_CC) || aura->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_GENERIC)
return true;
if (remove || aura->GetSpellInfo()->HasAttribute(SPELL_ATTR0_CU_AURA_CC) || aura->GetSpellInfo()->SpellFamilyName == SPELLFAMILY_GENERIC)
return true;
for(uint8 i=EFFECT_0; i<MAX_SPELL_EFFECTS; ++i)
{
if (effMask & (1<<i))
{
AuraType at = aura->GetEffect(i)->GetAuraType();
if (aura->GetEffect(i)->GetAmount() && (aura->GetSpellInfo()->IsPositive() || targetGUID != aura->GetCasterGUID()) ||
at == SPELL_AURA_MECHANIC_IMMUNITY || at == SPELL_AURA_EFFECT_IMMUNITY || at == SPELL_AURA_STATE_IMMUNITY || at == SPELL_AURA_SCHOOL_IMMUNITY || at == SPELL_AURA_DISPEL_IMMUNITY)
return true;
}
}
return false;
}
for(uint8 i=EFFECT_0; i<MAX_SPELL_EFFECTS; ++i)
{
if (effMask & (1<<i))
{
AuraType at = aura->GetEffect(i)->GetAuraType();
if (aura->GetEffect(i)->GetAmount() && (aura->GetSpellInfo()->IsPositive() || targetGUID != aura->GetCasterGUID()) ||
at == SPELL_AURA_MECHANIC_IMMUNITY || at == SPELL_AURA_EFFECT_IMMUNITY || at == SPELL_AURA_STATE_IMMUNITY || at == SPELL_AURA_SCHOOL_IMMUNITY || at == SPELL_AURA_DISPEL_IMMUNITY)
return true;
}
}
return false;
}
}
#endif
@@ -51,6 +51,9 @@ AuctionHouseMgr::~AuctionHouseMgr()
AuctionHouseObject* AuctionHouseMgr::GetAuctionsMap(uint32 factionTemplateId)
{
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
return &mNeutralAuctions;
// team have linked auction houses
FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(factionTemplateId);
if (!u_entry)
@@ -92,13 +95,13 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
if (!pItem)
return;
uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
uint32 bidder_accId = 0;
Player* bidder = ObjectAccessor::FindPlayerInOrOutOfWorld(bidder_guid);
if (bidder)
bidder_accId = bidder->GetSession()->GetAccountId();
else
bidder_accId = sObjectMgr->GetPlayerAccountIdByGUID(bidder_guid);
uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
uint32 bidder_accId = 0;
Player* bidder = ObjectAccessor::FindPlayerInOrOutOfWorld(bidder_guid);
if (bidder)
bidder_accId = bidder->GetSession()->GetAccountId();
else
bidder_accId = sObjectMgr->GetPlayerAccountIdByGUID(bidder_guid);
// receiver exist
if (bidder || bidder_accId)
@@ -122,7 +125,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction, SQLTransaction&
.SendMailTo(trans, MailReceiver(bidder, auction->bidder), auction, MAIL_CHECK_MASK_COPIED);
}
else
sAuctionMgr->RemoveAItem(auction->item_guidlow, true);
sAuctionMgr->RemoveAItem(auction->item_guidlow, true);
}
void AuctionHouseMgr::SendAuctionSalePendingMail(AuctionEntry* auction, SQLTransaction& trans)
@@ -158,20 +161,20 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry* auction, SQLTransa
.AddMoney(profit)
.SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED, sWorld->getIntConfig(CONFIG_MAIL_DELIVERY_DELAY));
if (auction->bid >= 500*GOLD)
if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(auction->bidder))
{
uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
Player* bidder = ObjectAccessor::FindPlayerInOrOutOfWorld(bidder_guid);
std::string owner_name = "";
uint8 owner_level = 0;
if (const GlobalPlayerData* gpd_owner = sWorld->GetGlobalPlayerData(auction->owner))
{
owner_name = gpd_owner->name;
owner_level = gpd_owner->level;
}
CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"<AH> profit: %ug, bidder: %s %u lvl (guid: %u), seller: %s %u lvl (guid: %u), item %u (%u)\", NOW())", gpd->accountId, auction->bidder, gpd->name.c_str(), bidder ? bidder->GetSession()->GetRemoteAddress().c_str() : "", owner_accId, owner_name.c_str(), auction->bid, (profit/GOLD), gpd->name.c_str(), gpd->level, auction->bidder, owner_name.c_str(), owner_level, auction->owner, auction->item_template, auction->itemCount);
}
if (auction->bid >= 500*GOLD)
if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(auction->bidder))
{
uint64 bidder_guid = MAKE_NEW_GUID(auction->bidder, 0, HIGHGUID_PLAYER);
Player* bidder = ObjectAccessor::FindPlayerInOrOutOfWorld(bidder_guid);
std::string owner_name = "";
uint8 owner_level = 0;
if (const GlobalPlayerData* gpd_owner = sWorld->GetGlobalPlayerData(auction->owner))
{
owner_name = gpd_owner->name;
owner_level = gpd_owner->level;
}
CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"<AH> profit: %ug, bidder: %s %u lvl (guid: %u), seller: %s %u lvl (guid: %u), item %u (%u)\", NOW())", gpd->accountId, auction->bidder, gpd->name.c_str(), bidder ? bidder->GetSession()->GetRemoteAddress().c_str() : "", owner_accId, owner_name.c_str(), auction->bid, (profit/GOLD), gpd->name.c_str(), gpd->level, auction->bidder, owner_name.c_str(), owner_level, auction->owner, auction->item_template, auction->itemCount);
}
}
}
@@ -197,8 +200,8 @@ void AuctionHouseMgr::SendAuctionExpiredMail(AuctionEntry* auction, SQLTransacti
.AddItem(pItem)
.SendMailTo(trans, MailReceiver(owner, auction->owner), auction, MAIL_CHECK_MASK_COPIED, 0);
}
else
sAuctionMgr->RemoveAItem(auction->item_guidlow, true);
else
sAuctionMgr->RemoveAItem(auction->item_guidlow, true);
}
//this function sends mail to old bidder
@@ -349,13 +352,13 @@ bool AuctionHouseMgr::RemoveAItem(uint32 id, bool deleteFromDB)
if (i == mAitems.end())
return false;
if (deleteFromDB)
{
SQLTransaction trans = CharacterDatabase.BeginTransaction();
i->second->FSetState(ITEM_REMOVED);
i->second->SaveToDB(trans);
CharacterDatabase.CommitTransaction(trans);
}
if (deleteFromDB)
{
SQLTransaction trans = CharacterDatabase.BeginTransaction();
i->second->FSetState(ITEM_REMOVED);
i->second->SaveToDB(trans);
CharacterDatabase.CommitTransaction(trans);
}
mAitems.erase(i);
return true;
@@ -372,7 +375,7 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(uint32 factionTem
{
uint32 houseid = 7; // goblin auction house
//if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
{
//FIXME: found way for proper auctionhouse selection by another way
// AuctionHouse.dbc have faction field with _player_ factions associated with auction house races.
@@ -440,13 +443,13 @@ void AuctionHouseObject::Update()
SQLTransaction trans = CharacterDatabase.BeginTransaction();
for (AuctionEntryMap::iterator itr, iter = AuctionsMap.begin(); iter != AuctionsMap.end(); )
{
itr = iter++;
AuctionEntry* auction = (*itr).second;
for (AuctionEntryMap::iterator itr, iter = AuctionsMap.begin(); iter != AuctionsMap.end(); )
{
itr = iter++;
AuctionEntry* auction = (*itr).second;
if (auction->expire_time > checkTime)
continue;
if (auction->expire_time > checkTime)
continue;
///- Either cancel the auction if there was no bidder
if (auction->bidder == 0)
@@ -509,34 +512,34 @@ bool AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
uint32 inventoryType, uint32 itemClass, uint32 itemSubClass, uint32 quality,
uint32& count, uint32& totalcount, uint8 getAll)
{
uint32 itrcounter = 0;
uint32 itrcounter = 0;
// pussywizard: optimization, this is a simplified case
if (itemClass == 0xffffffff && itemSubClass == 0xffffffff && inventoryType == 0xffffffff && quality == 0xffffffff && levelmin == 0x00 && levelmax == 0x00 && usable == 0x00 && wsearchedname.empty())
{
totalcount = Getcount();
if (listfrom < totalcount)
{
AuctionEntryMap::iterator itr = AuctionsMap.begin();
std::advance(itr, listfrom);
for (; itr != AuctionsMap.end(); ++itr)
{
itr->second->BuildAuctionInfo(data);
if ((++count) >= 50)
break;
}
}
return true;
}
// pussywizard: optimization, this is a simplified case
if (itemClass == 0xffffffff && itemSubClass == 0xffffffff && inventoryType == 0xffffffff && quality == 0xffffffff && levelmin == 0x00 && levelmax == 0x00 && usable == 0x00 && wsearchedname.empty())
{
totalcount = Getcount();
if (listfrom < totalcount)
{
AuctionEntryMap::iterator itr = AuctionsMap.begin();
std::advance(itr, listfrom);
for (; itr != AuctionsMap.end(); ++itr)
{
itr->second->BuildAuctionInfo(data);
if ((++count) >= 50)
break;
}
}
return true;
}
time_t curTime = sWorld->GetGameTime();
for (AuctionEntryMap::const_iterator itr = AuctionsMap.begin(); itr != AuctionsMap.end(); ++itr)
{
if (AsyncAuctionListingMgr::IsAuctionListingAllowed() == false) // pussywizard: World::Update is waiting for us...
if ((itrcounter++) % 100 == 0) // check condition every 100 iterations
if (avgDiffTracker.getAverage() >= 30 || getMSTimeDiff(World::GetGameTimeMS(), getMSTime()) >= 10) // pussywizard: stop immediately if diff is high or waiting too long
return false;
if (AsyncAuctionListingMgr::IsAuctionListingAllowed() == false) // pussywizard: World::Update is waiting for us...
if ((itrcounter++) % 100 == 0) // check condition every 100 iterations
if (avgDiffTracker.getAverage() >= 30 || getMSTimeDiff(World::GetGameTimeMS(), getMSTime()) >= 10) // pussywizard: stop immediately if diff is high or waiting too long
return false;
AuctionEntry* Aentry = itr->second;
// Skip expired auctions
@@ -556,11 +559,11 @@ bool AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
continue;
if (inventoryType != 0xffffffff && proto->InventoryType != inventoryType)
{
// xinef: exception, robes are counted as chests
if (inventoryType != INVTYPE_CHEST || proto->InventoryType != INVTYPE_ROBE)
continue;
}
{
// xinef: exception, robes are counted as chests
if (inventoryType != INVTYPE_CHEST || proto->InventoryType != INVTYPE_ROBE)
continue;
}
if (quality != 0xffffffff && proto->Quality != quality)
continue;
@@ -569,14 +572,14 @@ bool AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
continue;
if (usable != 0x00)
{
if (player->CanUseItem(item) != EQUIP_ERR_OK)
continue;
{
if (player->CanUseItem(item) != EQUIP_ERR_OK)
continue;
// xinef: check already learded recipes and pets
if (proto->Spells[1].SpellTrigger == ITEM_SPELLTRIGGER_LEARN_SPELL_ID && player->HasSpell(proto->Spells[1].SpellId))
continue;
}
// xinef: check already learded recipes and pets
if (proto->Spells[1].SpellTrigger == ITEM_SPELLTRIGGER_LEARN_SPELL_ID && player->HasSpell(proto->Spells[1].SpellId))
continue;
}
// Allow search by suffix (ie: of the Monkey) or partial name (ie: Monkey)
// No need to do any of this if no search term was entered
@@ -636,7 +639,7 @@ bool AuctionHouseObject::BuildListAuctionItems(WorldPacket& data, Player* player
++totalcount;
}
return true;
return true;
}
//this function inserts to WorldPacket auction's data
+44 -44
View File
@@ -75,30 +75,30 @@ Battlefield::~Battlefield()
// Called when a player enters the zone
void Battlefield::HandlePlayerEnterZone(Player* player, uint32 /*zone*/)
{
// Xinef: do not invite players on taxi
if (!player->IsInFlight())
{
// If battle is started,
// If not full of players > invite player to join the war
// If full of players > announce to player that BF is full and kick him after a few second if he desn't leave
if (IsWarTime())
{
if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) // Vacant spaces
InvitePlayerToWar(player);
else // No more vacant places
{
// TODO: Send a packet to announce it to player
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + (player->IsGameMaster() ? 30*MINUTE : 10);
InvitePlayerToQueue(player);
}
}
else
{
// If time left is < 15 minutes invite player to join queue
if (m_Timer <= m_StartGroupingTimer)
InvitePlayerToQueue(player);
}
}
// Xinef: do not invite players on taxi
if (!player->IsInFlight())
{
// If battle is started,
// If not full of players > invite player to join the war
// If full of players > announce to player that BF is full and kick him after a few second if he desn't leave
if (IsWarTime())
{
if (m_PlayersInWar[player->GetTeamId()].size() + m_InvitedPlayers[player->GetTeamId()].size() < m_MaxPlayer) // Vacant spaces
InvitePlayerToWar(player);
else // No more vacant places
{
// TODO: Send a packet to announce it to player
m_PlayersWillBeKick[player->GetTeamId()][player->GetGUID()] = time(NULL) + (player->IsGameMaster() ? 30*MINUTE : 10);
InvitePlayerToQueue(player);
}
}
else
{
// If time left is < 15 minutes invite player to join queue
if (m_Timer <= m_StartGroupingTimer)
InvitePlayerToQueue(player);
}
}
// Add player in the list of player in zone
m_players[player->GetTeamId()].insert(player->GetGUID());
@@ -116,8 +116,8 @@ void Battlefield::HandlePlayerLeaveZone(Player* player, uint32 /*zone*/)
m_PlayersInWar[player->GetTeamId()].erase(player->GetGUID());
player->GetSession()->SendBfLeaveMessage(m_BattleId);
if (Group* group = player->GetGroup()) // Remove the player from the raid group
if (group->isBFGroup())
group->RemoveMember(player->GetGUID());
if (group->isBFGroup())
group->RemoveMember(player->GetGUID());
OnPlayerLeaveWar(player);
}
@@ -138,12 +138,12 @@ bool Battlefield::Update(uint32 diff)
{
if (m_Timer <= diff)
{
if (!IsEnabled() || (!IsWarTime() && sWorld->GetActiveSessionCount() > 3500)) // if WG is disabled or there is more than 3500 connections, switch automaticly
{
m_isActive = true;
EndBattle(false);
return false;
}
if (!IsEnabled() || (!IsWarTime() && sWorld->GetActiveSessionCount() > 3500)) // if WG is disabled or there is more than 3500 connections, switch automaticly
{
m_isActive = true;
EndBattle(false);
return false;
}
// Battlefield ends on time
if (IsWarTime())
EndBattle(true);
@@ -153,8 +153,8 @@ bool Battlefield::Update(uint32 diff)
else
m_Timer -= diff;
if (!IsEnabled())
return false;
if (!IsEnabled())
return false;
// Invite players a few minutes before the battle's beginning
if (!IsWarTime() && !m_StartGrouping && m_Timer <= m_StartGroupingTimer)
@@ -466,7 +466,7 @@ void Battlefield::SendWarningToAllInZone(uint32 entry)
{
if (Unit* unit = ObjectAccessor::FindUnit(StalkerGuid))
if (Creature* stalker = unit->ToCreature())
sCreatureTextMgr->SendChat(stalker, (uint8)entry, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE);
sCreatureTextMgr->SendChat(stalker, (uint8)entry, NULL, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_ZONE);
}
void Battlefield::SendWarningToPlayer(Player* player, uint32 entry)
@@ -544,11 +544,11 @@ bool Battlefield::AddOrSetPlayerToCorrectBfGroup(Player* player)
if (!player->IsInWorld())
return false;
if (player->GetGroup() && (player->GetGroup()->isBGGroup() || player->GetGroup()->isBFGroup()))
{
sLog->outMisc("Battlefield::AddOrSetPlayerToCorrectBfGroup - player is already in %s group!", (player->GetGroup()->isBGGroup() ? "BG" : "BF"));
return false;
}
if (player->GetGroup() && (player->GetGroup()->isBGGroup() || player->GetGroup()->isBFGroup()))
{
sLog->outMisc("Battlefield::AddOrSetPlayerToCorrectBfGroup - player is already in %s group!", (player->GetGroup()->isBGGroup() ? "BG" : "BF"));
return false;
}
Group* group = GetFreeBfRaid(player->GetTeamId());
if (!group)
@@ -802,7 +802,7 @@ Creature* Battlefield::SpawnCreature(uint32 entry, float x, float y, float z, fl
return NULL;
}
creature->setFaction(BattlefieldFactions[teamId]);
creature->setFaction(BattlefieldFactions[teamId]);
creature->SetHomePosition(x, y, z, o);
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
@@ -841,7 +841,7 @@ GameObject* Battlefield::SpawnGameObject(uint32 entry, float x, float y, float z
// Add to world
map->AddToMap(go);
go->setActive(true);
go->setActive(true);
return go;
}
@@ -890,7 +890,7 @@ GuidSet::iterator BfCapturePoint::HandlePlayerLeave(Player* player)
void BfCapturePoint::SendChangePhase()
{
GameObject* capturePoint = GetCapturePointGo();
GameObject* capturePoint = GetCapturePointGo();
if (!capturePoint)
return;
@@ -957,7 +957,7 @@ bool BfCapturePoint::DelCapturePoint()
bool BfCapturePoint::Update(uint32 diff)
{
GameObject* capturePoint = GetCapturePointGo();
GameObject* capturePoint = GetCapturePointGo();
if (!capturePoint)
return false;
+3 -3
View File
@@ -110,7 +110,7 @@ class BfCapturePoint
bool SetCapturePointData(GameObject* capturePoint);
GameObject* GetCapturePointGo() { return ObjectAccessor::GetObjectInWorld(m_capturePoint, (GameObject*)NULL); }
GameObject* GetCapturePointGo(WorldObject* obj) { return ObjectAccessor::GetGameObject(*obj, m_capturePoint); }
GameObject* GetCapturePointGo(WorldObject* obj) { return ObjectAccessor::GetGameObject(*obj, m_capturePoint); }
TeamId GetTeamId() { return m_team; }
protected:
@@ -183,7 +183,7 @@ class BfGraveyard
if (!m_SpiritGuide[0] && !m_SpiritGuide[1])
return false;
// performance
// performance
/*if (!ObjectAccessor::FindUnit(m_SpiritGuide[0]) &&
!ObjectAccessor::FindUnit(m_SpiritGuide[1]))
return false;*/
@@ -335,7 +335,7 @@ class Battlefield : public ZoneScript
//virtual void DoCompleteOrIncrementAchievement(uint32 /*achievement*/, Player* /*player*/, uint8 /*incrementNumber = 1*/) {};
/// Send all worldstate data to all player in zone.
virtual void SendInitWorldStatesToAll() = 0;
virtual void SendInitWorldStatesToAll() = 0;
virtual void FillInitialWorldStates(WorldPacket& /*data*/) = 0;
/// Return if we can use mount in battlefield
@@ -45,8 +45,8 @@ bool BattlefieldWG::SetupBattlefield()
m_ZoneId = BATTLEFIELD_WG_ZONEID;
m_MapId = BATTLEFIELD_WG_MAPID;
// init stalker AFTER setting map id... we spawn it at map=random memory value?...
InitStalker(BATTLEFIELD_WG_NPC_STALKER, WintergraspStalkerPos[0], WintergraspStalkerPos[1], WintergraspStalkerPos[2], WintergraspStalkerPos[3]);
// init stalker AFTER setting map id... we spawn it at map=random memory value?...
InitStalker(BATTLEFIELD_WG_NPC_STALKER, WintergraspStalkerPos[0], WintergraspStalkerPos[1], WintergraspStalkerPos[2], WintergraspStalkerPos[3]);
m_MaxPlayer = sWorld->getIntConfig(CONFIG_WINTERGRASP_PLR_MAX);
m_IsEnabled = sWorld->getBoolConfig(CONFIG_WINTERGRASP_ENABLE);
@@ -61,7 +61,7 @@ bool BattlefieldWG::SetupBattlefield()
m_StartGrouping = false;
m_tenacityStack = 0;
m_titansRelic = 0;
m_titansRelic = 0;
KickPosition.Relocate(5728.117f, 2714.346f, 697.733f, 0);
KickPosition.m_mapId = m_MapId;
@@ -201,19 +201,19 @@ bool BattlefieldWG::Update(uint32 diff)
else
m_saveTimer -= diff;
// Update Tenacity
if (IsWarTime())
{
if (m_tenacityUpdateTimer <= diff)
{
m_tenacityUpdateTimer = 10000;
if (!m_updateTenacityList.empty())
UpdateTenacity();
m_updateTenacityList.clear();
}
else
m_tenacityUpdateTimer -= diff;
}
// Update Tenacity
if (IsWarTime())
{
if (m_tenacityUpdateTimer <= diff)
{
m_tenacityUpdateTimer = 10000;
if (!m_updateTenacityList.empty())
UpdateTenacity();
m_updateTenacityList.clear();
}
else
m_tenacityUpdateTimer -= diff;
}
return m_return;
}
@@ -229,8 +229,8 @@ void BattlefieldWG::OnBattleStart()
// Set in use (not allow to click on before last door is broken)
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
// save guid
m_titansRelic = go->GetGUID();
// save guid
m_titansRelic = go->GetGUID();
}
else
sLog->outError("WG: Failed to spawn titan relic.");
@@ -259,7 +259,7 @@ void BattlefieldWG::OnBattleStart()
}
}
SetData(BATTLEFIELD_WG_DATA_INTACT_TOWER_ATT, WG_MAX_ATTACKTOWERS);
SetData(BATTLEFIELD_WG_DATA_INTACT_TOWER_ATT, WG_MAX_ATTACKTOWERS);
SetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT, 0);
SetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, 0);
@@ -286,9 +286,9 @@ void BattlefieldWG::OnBattleStart()
// Send start warning to all players
SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_START);
// Xinef: reset tenacity counter
m_tenacityStack = 0;
m_tenacityUpdateTimer = 20000;
// Xinef: reset tenacity counter
m_tenacityStack = 0;
m_tenacityUpdateTimer = 20000;
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_QUEUE_ANNOUNCER_ENABLE))
sWorld->SendWorldText(BATTLEFIELD_WG_WORLD_START_MESSAGE);
@@ -324,29 +324,29 @@ void BattlefieldWG::UpdateVehicleCountWG()
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
{
{
player->SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_VEHICLE_H));
player->SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_H, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_H));
player->SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_VEHICLE_A));
player->SendUpdateWorldState(BATTLEFIELD_WG_WORLD_STATE_MAX_VEHICLE_A, GetData(BATTLEFIELD_WG_DATA_MAX_VEHICLE_A));
}
}
}
void BattlefieldWG::CapturePointTaken(uint32 areaId)
{
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
for (uint8 i = 0; i < BG_TEAMS_COUNT; ++i)
for (GuidSet::iterator itr = m_players[i].begin(); itr != m_players[i].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
if (player->GetAreaId() == areaId)
player->UpdateAreaDependentAuras(areaId);
if (player->GetAreaId() == areaId)
player->UpdateAreaDependentAuras(areaId);
}
void BattlefieldWG::OnBattleEnd(bool endByTimer)
{
// Remove relic
if (GameObject* go = GetRelic())
go->RemoveFromWorld();
m_titansRelic = 0;
// Remove relic
if (GameObject* go = GetRelic())
go->RemoveFromWorld();
m_titansRelic = 0;
// Remove turret
for (GuidSet::const_iterator itr = CanonList.begin(); itr != CanonList.end(); ++itr)
@@ -401,11 +401,11 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
// Saving data
for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
{
(*itr)->Rebuild();
{
(*itr)->Rebuild();
(*itr)->Save();
(*itr)->UpdateTurretAttack(true);
}
(*itr)->UpdateTurretAttack(true);
}
for (Workshop::const_iterator itr = WorkshopsList.begin(); itr != WorkshopsList.end(); ++itr)
(*itr)->Save();
@@ -415,59 +415,59 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
if (Creature* creature = unit->ToCreature())
creature->DespawnOrUnsummon(1);
creature->DespawnOrUnsummon(1);
m_vehicles[team].clear();
}
uint8 damagedTowersDef = GetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT);
uint8 brokenTowersDef = GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT);
uint8 damagedTowersAtt = GetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT);
uint8 brokenTowersAtt = GetData(BATTLEFIELD_WG_DATA_INTACT_TOWER_ATT);
uint32 spellDamagedDef = SPELL_DAMAGED_TOWER;
uint32 spellFullDef = SPELL_DESTROYED_TOWER;
uint32 spellDamagedAtt = SPELL_DAMAGED_BUILDING;
uint32 spellFullAtt = SPELL_INTACT_BUILDING;
uint8 damagedTowersDef = GetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT);
uint8 brokenTowersDef = GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT);
uint8 damagedTowersAtt = GetData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT);
uint8 brokenTowersAtt = GetData(BATTLEFIELD_WG_DATA_INTACT_TOWER_ATT);
uint32 spellDamagedDef = SPELL_DAMAGED_TOWER;
uint32 spellFullDef = SPELL_DESTROYED_TOWER;
uint32 spellDamagedAtt = SPELL_DAMAGED_BUILDING;
uint32 spellFullAtt = SPELL_INTACT_BUILDING;
if (!endByTimer)
{
brokenTowersDef = GetData(BATTLEFIELD_WG_DATA_INTACT_TOWER_ATT);
brokenTowersAtt = GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT);
spellDamagedDef = SPELL_DAMAGED_BUILDING;
spellFullDef = SPELL_INTACT_BUILDING;
spellDamagedAtt = SPELL_DAMAGED_TOWER;
spellFullAtt = SPELL_DESTROYED_TOWER;
}
if (!endByTimer)
{
brokenTowersDef = GetData(BATTLEFIELD_WG_DATA_INTACT_TOWER_ATT);
brokenTowersAtt = GetData(BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT);
spellDamagedDef = SPELL_DAMAGED_BUILDING;
spellFullDef = SPELL_INTACT_BUILDING;
spellDamagedAtt = SPELL_DAMAGED_TOWER;
spellFullAtt = SPELL_DESTROYED_TOWER;
}
for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr)
for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr)
{
if (Player* player = ObjectAccessor::FindPlayer(*itr))
{
// Victory in Wintergrasp
player->AreaExploredOrEventHappens(GetDefenderTeam() ? 13183 : 13181); // HORDE / ALLY win wg quest id
// Victory in Wintergrasp
player->AreaExploredOrEventHappens(GetDefenderTeam() ? 13183 : 13181); // HORDE / ALLY win wg quest id
player->CastSpell(player, SPELL_ESSENCE_OF_WINTERGRASP, true);
player->CastSpell(player, SPELL_ESSENCE_OF_WINTERGRASP, true);
player->CastSpell(player, SPELL_VICTORY_REWARD, true);
RemoveAurasFromPlayer(player);
RemoveAurasFromPlayer(player);
for (uint8 i = 0; i < damagedTowersDef; ++i)
player->CastSpell(player, spellDamagedDef, true);
for (uint8 i = 0; i < brokenTowersDef; ++i)
player->CastSpell(player, spellFullDef, true);
for (uint8 i = 0; i < damagedTowersDef; ++i)
player->CastSpell(player, spellDamagedDef, true);
for (uint8 i = 0; i < brokenTowersDef; ++i)
player->CastSpell(player, spellFullDef, true);
}
}
for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
{
{
player->CastSpell(player, SPELL_DEFEAT_REWARD, true);
RemoveAurasFromPlayer(player);
RemoveAurasFromPlayer(player);
for (uint8 i = 0; i < damagedTowersAtt; ++i)
player->CastSpell(player, spellDamagedAtt, true);
for (uint8 i = 0; i < brokenTowersAtt; ++i)
player->CastSpell(player, spellFullAtt, true);
}
for (uint8 i = 0; i < damagedTowersAtt; ++i)
player->CastSpell(player, spellDamagedAtt, true);
for (uint8 i = 0; i < brokenTowersAtt; ++i)
player->CastSpell(player, spellFullAtt, true);
}
if (!endByTimer)
{
@@ -484,9 +484,9 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
}
}
// Clear players in war list at the end.
m_PlayersInWar[TEAM_ALLIANCE].clear();
m_PlayersInWar[TEAM_HORDE].clear();
// Clear players in war list at the end.
m_PlayersInWar[TEAM_ALLIANCE].clear();
m_PlayersInWar[TEAM_HORDE].clear();
if (!endByTimer) // win alli/horde
SendWarningToAllInZone((GetDefenderTeam() == TEAM_ALLIANCE) ? BATTLEFIELD_WG_TEXT_WIN_KEEP : (BATTLEFIELD_WG_TEXT_WIN_KEEP + 2));
@@ -500,8 +500,8 @@ void BattlefieldWG::OnBattleEnd(bool endByTimer)
void BattlefieldWG::OnStartGrouping()
{
if (!IsWarTime())
SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_WILL_START);
if (!IsWarTime())
SendWarningToAllInZone(BATTLEFIELD_WG_TEXT_WILL_START);
}
uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId) const
@@ -532,16 +532,16 @@ uint8 BattlefieldWG::GetSpiritGraveyardId(uint32 areaId) const
uint32 BattlefieldWG::GetAreaByGraveyardId(uint8 gId) const
{
switch (gId)
switch (gId)
{
case BATTLEFIELD_WG_GY_WORKSHOP_NE:
return AREA_THE_SUNKEN_RING;
case BATTLEFIELD_WG_GY_WORKSHOP_NW:
return AREA_THE_BROKEN_TEMPLE;
case BATTLEFIELD_WG_GY_WORKSHOP_SW:
return AREA_WESTPARK_WORKSHOP;
case BATTLEFIELD_WG_GY_WORKSHOP_SE:
return AREA_EASTPARK_WORKSHOP;
case BATTLEFIELD_WG_GY_WORKSHOP_NE:
return AREA_THE_SUNKEN_RING;
case BATTLEFIELD_WG_GY_WORKSHOP_NW:
return AREA_THE_BROKEN_TEMPLE;
case BATTLEFIELD_WG_GY_WORKSHOP_SW:
return AREA_WESTPARK_WORKSHOP;
case BATTLEFIELD_WG_GY_WORKSHOP_SE:
return AREA_EASTPARK_WORKSHOP;
}
return 0;
@@ -557,9 +557,9 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature)
{
TeamId teamId = (creature->GetEntry() == NPC_DWARVEN_SPIRIT_GUIDE ? TEAM_ALLIANCE : TEAM_HORDE);
uint8 graveyardId = GetSpiritGraveyardId(creature->GetAreaId(true));
// xinef: little workaround, there are 2 spirit guides in same area
if (creature->IsWithinDist2d(5103.0f, 3461.5f, 5.0f))
graveyardId = BATTLEFIELD_WG_GY_WORKSHOP_NW;
// xinef: little workaround, there are 2 spirit guides in same area
if (creature->IsWithinDist2d(5103.0f, 3461.5f, 5.0f))
graveyardId = BATTLEFIELD_WG_GY_WORKSHOP_NW;
if (m_GraveyardList[graveyardId])
m_GraveyardList[graveyardId]->SetSpirit(creature, teamId);
@@ -577,12 +577,12 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature)
case NPC_WINTERGRASP_CATAPULT:
case NPC_WINTERGRASP_DEMOLISHER:
{
if (!creature->IsSummon() || !creature->ToTempSummon()->GetSummonerGUID())
if (!creature->IsSummon() || !creature->ToTempSummon()->GetSummonerGUID())
return;
Player* creator = ObjectAccessor::FindPlayer(creature->ToTempSummon()->GetSummonerGUID());
if (!creator)
return;
Player* creator = ObjectAccessor::FindPlayer(creature->ToTempSummon()->GetSummonerGUID());
if (!creator)
return;
TeamId team = creator->GetTeamId();
if (team == TEAM_HORDE)
@@ -617,16 +617,16 @@ void BattlefieldWG::OnCreatureCreate(Creature* creature)
}
break;
}
case NPC_WINTERGRASP_SIEGE_ENGINE_TURRET_HORDE:
case NPC_WINTERGRASP_SIEGE_ENGINE_TURRET_ALLIANCE:
{
if (!creature->IsSummon() || !creature->ToTempSummon()->GetSummonerGUID())
case NPC_WINTERGRASP_SIEGE_ENGINE_TURRET_HORDE:
case NPC_WINTERGRASP_SIEGE_ENGINE_TURRET_ALLIANCE:
{
if (!creature->IsSummon() || !creature->ToTempSummon()->GetSummonerGUID())
return;
if (Unit* owner = creature->ToTempSummon()->GetSummoner())
creature->setFaction(owner->getFaction());
break;
}
if (Unit* owner = creature->ToTempSummon()->GetSummoner())
creature->setFaction(owner->getFaction());
break;
}
}
}
}
@@ -712,26 +712,26 @@ void BattlefieldWG::HandleKill(Player* killer, Unit* victim)
bool again = false;
TeamId killerTeam = killer->GetTeamId();
// xinef: tower cannons also grant rank
if (victim->GetTypeId() == TYPEID_PLAYER || IsKeepNpc(victim->GetEntry()) || victim->GetEntry() == NPC_WINTERGRASP_TOWER_CANNON)
// xinef: tower cannons also grant rank
if (victim->GetTypeId() == TYPEID_PLAYER || IsKeepNpc(victim->GetEntry()) || victim->GetEntry() == NPC_WINTERGRASP_TOWER_CANNON)
{
for (GuidSet::const_iterator itr = m_PlayersInWar[killerTeam].begin(); itr != m_PlayersInWar[killerTeam].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
if (player->GetDistance2d(killer) < 40)
PromotePlayer(player);
// Xinef: Allow to Skin non-released corpse
if (victim->GetTypeId() == TYPEID_PLAYER)
victim->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
// Xinef: Allow to Skin non-released corpse
if (victim->GetTypeId() == TYPEID_PLAYER)
victim->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
}
else if (victim->IsVehicle() && !killer->IsFriendlyTo(victim))
{
// Quest - Wintergrasp - PvP Kill - Vehicle
for (GuidSet::const_iterator itr = m_PlayersInWar[killerTeam].begin(); itr != m_PlayersInWar[killerTeam].end(); ++itr)
else if (victim->IsVehicle() && !killer->IsFriendlyTo(victim))
{
// Quest - Wintergrasp - PvP Kill - Vehicle
for (GuidSet::const_iterator itr = m_PlayersInWar[killerTeam].begin(); itr != m_PlayersInWar[killerTeam].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
if (player->GetDistance2d(killer) < 40)
player->KilledMonsterCredit(NPC_QUEST_PVP_KILL_VEHICLE, 0);
}
}
}
bool BattlefieldWG::FindAndRemoveVehicleFromList(Unit* vehicle)
@@ -806,7 +806,7 @@ void BattlefieldWG::OnPlayerJoinWar(Player* player)
RemoveAurasFromPlayer(player);
player->CastSpell(player, SPELL_RECRUIT, true);
AddUpdateTenacity(player);
AddUpdateTenacity(player);
if (player->GetTeamId() == GetDefenderTeam())
player->TeleportTo(571, 5345, 2842, 410, 3.14f);
@@ -841,7 +841,7 @@ void BattlefieldWG::OnPlayerLeaveWar(Player* player)
RemoveAurasFromPlayer(player);
}
RemoveUpdateTenacity(player);
RemoveUpdateTenacity(player);
}
void BattlefieldWG::OnPlayerLeaveZone(Player* player)
@@ -864,18 +864,18 @@ void BattlefieldWG::OnPlayerEnterZone(Player* player)
// Send worldstate to player
SendInitWorldStatesTo(player);
// xinef: Attacker, if hidden in relic room kick him out
if (player->GetTeamId() == GetAttackerTeam())
if (player->GetPositionX() > 5400.0f && player->GetPositionX() < 5490.0f && player->GetPositionY() > 2803.0f && player->GetPositionY() < 2878.0f)
KickPlayerFromBattlefield(player->GetGUID());
// xinef: Attacker, if hidden in relic room kick him out
if (player->GetTeamId() == GetAttackerTeam())
if (player->GetPositionX() > 5400.0f && player->GetPositionX() < 5490.0f && player->GetPositionY() > 2803.0f && player->GetPositionY() < 2878.0f)
KickPlayerFromBattlefield(player->GetGUID());
}
uint32 BattlefieldWG::GetData(uint32 data) const
{
// xinef: little hack, same area for default horde graveyard
// this graveyard is the one of broken temple!
if (data == AREA_THE_CHILLED_QUAGMIRE)
data = AREA_THE_BROKEN_TEMPLE;
// xinef: little hack, same area for default horde graveyard
// this graveyard is the one of broken temple!
if (data == AREA_THE_CHILLED_QUAGMIRE)
data = AREA_THE_BROKEN_TEMPLE;
switch (data)
{
@@ -919,15 +919,15 @@ void BattlefieldWG::FillInitialWorldStates(WorldPacket& data)
void BattlefieldWG::SendInitWorldStatesTo(Player* player)
{
WorldPacket data(SMSG_INIT_WORLD_STATES, (4 + 4 + 4 + 2 + (BuildingsInZone.size() * 8) + (WorkshopsList.size() * 8)));
data << uint32(m_MapId);
data << uint32(m_ZoneId);
data << uint32(0);
data << uint32(0);
data << uint16(10 + BuildingsInZone.size() + WorkshopsList.size()); // Number of fields
FillInitialWorldStates(data);
player->GetSession()->SendPacket(&data);
player->GetSession()->SendPacket(&data);
}
void BattlefieldWG::SendInitWorldStatesToAll()
@@ -970,9 +970,9 @@ void BattlefieldWG::UpdatedDestroyedTowerCount(TeamId team, GameObject* go)
for (GuidSet::const_iterator itr = m_PlayersInWar[GetDefenderTeam()].begin(); itr != m_PlayersInWar[GetDefenderTeam()].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
{
// Quest - Wintergrasp - Southern Tower Kill
if (go && player->GetDistance2d(go) < 200.0f)
player->KilledMonsterCredit(NPC_QUEST_SOUTHERN_TOWER_KILL, 0);
// Quest - Wintergrasp - Southern Tower Kill
if (go && player->GetDistance2d(go) < 200.0f)
player->KilledMonsterCredit(NPC_QUEST_SOUTHERN_TOWER_KILL, 0);
player->CastSpell(player, SPELL_TOWER_CONTROL, true);
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, SPELL_LEANING_TOWER_ACHIEVEMENT, 0, 0);
@@ -988,18 +988,18 @@ void BattlefieldWG::UpdatedDestroyedTowerCount(TeamId team, GameObject* go)
SendInitWorldStatesToAll();
}
}
else
{
// Xinef: rest of structures, quest credit
else
{
// Xinef: rest of structures, quest credit
for (GuidSet::const_iterator itr = m_PlayersInWar[GetAttackerTeam()].begin(); itr != m_PlayersInWar[GetAttackerTeam()].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
{
// Quest - Wintergrasp - Vehicle Protected
if (go && player->GetDistance2d(go) < 100.0f)
player->KilledMonsterCredit(NPC_QUEST_VEHICLE_PROTECTED, 0);
}
// Quest - Wintergrasp - Vehicle Protected
if (go && player->GetDistance2d(go) < 100.0f)
player->KilledMonsterCredit(NPC_QUEST_VEHICLE_PROTECTED, 0);
}
}
}
}
void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId)
@@ -1024,19 +1024,19 @@ void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId)
// if destroy or damage event, search the wall/tower and update worldstate/send warning message
for (GameObjectBuilding::const_iterator itr = BuildingsInZone.begin(); itr != BuildingsInZone.end(); ++itr)
{
if (GameObject* build = ObjectAccessor::GetGameObject(*obj, (*itr)->m_Build))
{
if (go->GetEntry() == build->GetEntry())
{
if (build->GetGOInfo()->building.damagedEvent == eventId)
(*itr)->Damaged();
if (GameObject* build = ObjectAccessor::GetGameObject(*obj, (*itr)->m_Build))
{
if (go->GetEntry() == build->GetEntry())
{
if (build->GetGOInfo()->building.damagedEvent == eventId)
(*itr)->Damaged();
if (build->GetGOInfo()->building.destroyedEvent == eventId)
(*itr)->Destroyed();
if (build->GetGOInfo()->building.destroyedEvent == eventId)
(*itr)->Destroyed();
break;
}
}
break;
}
}
}
}
@@ -1044,32 +1044,32 @@ void BattlefieldWG::ProcessEvent(WorldObject *obj, uint32 eventId)
void BattlefieldWG::UpdateDamagedTowerCount(TeamId team)
{
if (team == GetAttackerTeam())
{
{
UpdateData(BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT, 1);
UpdateData(BATTLEFIELD_WG_DATA_INTACT_TOWER_ATT, -1);
}
UpdateData(BATTLEFIELD_WG_DATA_INTACT_TOWER_ATT, -1);
}
}
uint32 BattlefieldWG::GetHonorBuff(int32 stack) const
{
if (stack < 5)
return 0;
if (stack < 10)
return SPELL_GREAT_HONOR;
if (stack < 15)
return SPELL_GREATER_HONOR;
return SPELL_GREATEST_HONOR;
if (stack < 5)
return 0;
if (stack < 10)
return SPELL_GREAT_HONOR;
if (stack < 15)
return SPELL_GREATER_HONOR;
return SPELL_GREATEST_HONOR;
}
void BattlefieldWG::AddUpdateTenacity(Player* player)
{
m_updateTenacityList.insert(player->GetGUID());
m_updateTenacityList.insert(player->GetGUID());
}
void BattlefieldWG::RemoveUpdateTenacity(Player* player)
{
m_updateTenacityList.erase(player->GetGUID());
m_updateTenacityList.insert(0);
m_updateTenacityList.erase(player->GetGUID());
m_updateTenacityList.insert(0);
}
void BattlefieldWG::UpdateTenacity()
@@ -1087,31 +1087,31 @@ void BattlefieldWG::UpdateTenacity()
newStack = int32((1.0f - ((float)alliancePlayers / hordePlayers)) * 4.0f); // negative, should cast on horde
}
// Return if no change in stack and apply tenacity to new player
// Return if no change in stack and apply tenacity to new player
if (newStack == m_tenacityStack)
{
for (GuidSet::const_iterator itr = m_updateTenacityList.begin(); itr != m_updateTenacityList.end(); ++itr)
if (Player* newPlayer = ObjectAccessor::FindPlayer(*itr))
if ((newPlayer->GetTeamId() == TEAM_ALLIANCE && m_tenacityStack > 0) || (newPlayer->GetTeamId() == TEAM_HORDE && m_tenacityStack < 0))
{
newStack = std::min(abs(newStack), 20);
uint32 buff_honor = GetHonorBuff(newStack);
newPlayer->SetAuraStack(SPELL_TENACITY, newPlayer, newStack);
if (buff_honor)
newPlayer->CastSpell(newPlayer, buff_honor, true);
}
{
for (GuidSet::const_iterator itr = m_updateTenacityList.begin(); itr != m_updateTenacityList.end(); ++itr)
if (Player* newPlayer = ObjectAccessor::FindPlayer(*itr))
if ((newPlayer->GetTeamId() == TEAM_ALLIANCE && m_tenacityStack > 0) || (newPlayer->GetTeamId() == TEAM_HORDE && m_tenacityStack < 0))
{
newStack = std::min(abs(newStack), 20);
uint32 buff_honor = GetHonorBuff(newStack);
newPlayer->SetAuraStack(SPELL_TENACITY, newPlayer, newStack);
if (buff_honor)
newPlayer->CastSpell(newPlayer, buff_honor, true);
}
return;
}
}
if (m_tenacityStack != 0)
{
if (m_tenacityStack > 0 && newStack <= 0) // old buff was on alliance
team = TEAM_ALLIANCE;
else if (m_tenacityStack < 0 && newStack >= 0) // old buff was on horde
team = TEAM_HORDE;
}
{
if (m_tenacityStack > 0 && newStack <= 0) // old buff was on alliance
team = TEAM_ALLIANCE;
else if (m_tenacityStack < 0 && newStack >= 0) // old buff was on horde
team = TEAM_HORDE;
}
m_tenacityStack = newStack;
m_tenacityStack = newStack;
// Remove old buff
if (team != TEAM_NEUTRAL)
{
@@ -1128,24 +1128,24 @@ void BattlefieldWG::UpdateTenacity()
if (newStack)
{
team = newStack > 0 ? TEAM_ALLIANCE : TEAM_HORDE;
newStack = std::min(abs(newStack), 20);
newStack = std::min(abs(newStack), 20);
uint32 buff_honor = GetHonorBuff(newStack);
for (GuidSet::const_iterator itr = m_PlayersInWar[team].begin(); itr != m_PlayersInWar[team].end(); ++itr)
if (Player* player = ObjectAccessor::FindPlayer(*itr))
{
{
player->SetAuraStack(SPELL_TENACITY, player, newStack);
if (buff_honor)
player->CastSpell(player, buff_honor, true);
}
if (buff_honor)
player->CastSpell(player, buff_honor, true);
}
for (GuidSet::const_iterator itr = m_vehicles[team].begin(); itr != m_vehicles[team].end(); ++itr)
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
{
{
unit->SetAuraStack(SPELL_TENACITY_VEHICLE, unit, newStack);
if (buff_honor)
unit->CastSpell(unit, buff_honor, true);
}
if (buff_honor)
unit->CastSpell(unit, buff_honor, true);
}
}
}
+116 -116
View File
@@ -80,7 +80,7 @@ enum WintergraspSpells
SPELL_WINTERGRASP_WATER = 36444,
SPELL_ESSENCE_OF_WINTERGRASP = 58045,
SPELL_WINTERGRASP_RESTRICTED_FLIGHT_AREA = 58730,
SPELL_LEANING_TOWER_ACHIEVEMENT = 60676,
SPELL_LEANING_TOWER_ACHIEVEMENT = 60676,
// Phasing spells
SPELL_HORDE_CONTROLS_FACTORY_PHASE_SHIFT = 56618,// ADDS PHASE 16
@@ -92,7 +92,7 @@ enum WintergraspSpells
enum WintergraspData
{
BATTLEFIELD_WG_DATA_INTACT_TOWER_ATT,
BATTLEFIELD_WG_DATA_INTACT_TOWER_ATT,
BATTLEFIELD_WG_DATA_DAMAGED_TOWER_ATT,
BATTLEFIELD_WG_DATA_BROKEN_TOWER_ATT,
BATTLEFIELD_WG_DATA_MAX_VEHICLE_A,
@@ -157,14 +157,14 @@ enum WGGraveyardId
enum eWGGossipText
{
BATTLEFIELD_WG_GOSSIPTEXT_GY_NE = 20071,
BATTLEFIELD_WG_GOSSIPTEXT_GY_NW = 20072,
BATTLEFIELD_WG_GOSSIPTEXT_GY_SE = 20074,
BATTLEFIELD_WG_GOSSIPTEXT_GY_SW = 20073,
BATTLEFIELD_WG_GOSSIPTEXT_GY_KEEP = 20070,
BATTLEFIELD_WG_GOSSIPTEXT_GY_HORDE = 20075,
BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE = 20076,
BATTLEFIELD_WG_WORLD_START_MESSAGE = 20078,
BATTLEFIELD_WG_GOSSIPTEXT_GY_NE = 20071,
BATTLEFIELD_WG_GOSSIPTEXT_GY_NW = 20072,
BATTLEFIELD_WG_GOSSIPTEXT_GY_SE = 20074,
BATTLEFIELD_WG_GOSSIPTEXT_GY_SW = 20073,
BATTLEFIELD_WG_GOSSIPTEXT_GY_KEEP = 20070,
BATTLEFIELD_WG_GOSSIPTEXT_GY_HORDE = 20075,
BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE = 20076,
BATTLEFIELD_WG_WORLD_START_MESSAGE = 20078,
};
enum WintergraspNpcs
@@ -182,19 +182,19 @@ enum WintergraspNpcs
BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF = 31106,
BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT = 31053,
BATTLEFIELD_WG_NPC_LIEUTENANT_MURP = 31107,
BATTLEFIELD_WG_NPC_HORDE_WARBRINGER = 15350,
BATTLEFIELD_WG_NPC_BRIGADIER_GENERAL = 15351,
BATTLEFIELD_WG_NPC_HORDE_WARBRINGER = 15350,
BATTLEFIELD_WG_NPC_BRIGADIER_GENERAL = 15351,
BATTLEFIELD_WG_NPC_AV_PORTAL_HORDE = 32617,
BATTLEFIELD_WG_NPC_AV_PORTAL_ALLY = 32616,
BATTLEFIELD_WG_NPC_AB_PORTAL_HORDE = 32619,
BATTLEFIELD_WG_NPC_AB_PORTAL_ALLY = 32618,
BATTLEFIELD_WG_NPC_EOTS_PORTAL_HORDE = 32620,
BATTLEFIELD_WG_NPC_EOTS_PORTAL_ALLY = 32621,
BATTLEFIELD_WG_NPC_SOTA_PORTAL_HORDE = 32623,
BATTLEFIELD_WG_NPC_SOTA_PORTAL_ALLY = 32622,
BATTLEFIELD_WG_NPC_WG_PORTAL_HORDE = 32625,
BATTLEFIELD_WG_NPC_WG_PORTAL_ALLY = 32624,
BATTLEFIELD_WG_NPC_AV_PORTAL_HORDE = 32617,
BATTLEFIELD_WG_NPC_AV_PORTAL_ALLY = 32616,
BATTLEFIELD_WG_NPC_AB_PORTAL_HORDE = 32619,
BATTLEFIELD_WG_NPC_AB_PORTAL_ALLY = 32618,
BATTLEFIELD_WG_NPC_EOTS_PORTAL_HORDE = 32620,
BATTLEFIELD_WG_NPC_EOTS_PORTAL_ALLY = 32621,
BATTLEFIELD_WG_NPC_SOTA_PORTAL_HORDE = 32623,
BATTLEFIELD_WG_NPC_SOTA_PORTAL_ALLY = 32622,
BATTLEFIELD_WG_NPC_WG_PORTAL_HORDE = 32625,
BATTLEFIELD_WG_NPC_WG_PORTAL_ALLY = 32624,
BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH = 31052,
BATTLEFIELD_WG_NPC_KNIGHT_DAMERON = 32294,// <WINTERGRASP QUARTERMASTER>
@@ -209,17 +209,17 @@ enum WintergraspNpcs
NPC_TAUNKA_SPIRIT_GUIDE = 31841, // Horde spirit guide for Wintergrasp
NPC_DWARVEN_SPIRIT_GUIDE = 31842, // Alliance spirit guide for Wintergrasp
NPC_WINTERGRASP_SIEGE_ENGINE_TURRET_ALLIANCE = 28319,
NPC_WINTERGRASP_SIEGE_ENGINE_TURRET_HORDE = 32629,
NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE = 28312,
NPC_WINTERGRASP_SIEGE_ENGINE_HORDE = 32627,
NPC_WINTERGRASP_SIEGE_ENGINE_TURRET_ALLIANCE = 28319,
NPC_WINTERGRASP_SIEGE_ENGINE_TURRET_HORDE = 32629,
NPC_WINTERGRASP_SIEGE_ENGINE_ALLIANCE = 28312,
NPC_WINTERGRASP_SIEGE_ENGINE_HORDE = 32627,
NPC_WINTERGRASP_CATAPULT = 27881,
NPC_WINTERGRASP_DEMOLISHER = 28094,
NPC_WINTERGRASP_TOWER_CANNON = 28366,
NPC_QUEST_SOUTHERN_TOWER_KILL = 35074,
NPC_QUEST_VEHICLE_PROTECTED = 31284,
NPC_QUEST_PVP_KILL_VEHICLE = 31093,
NPC_QUEST_SOUTHERN_TOWER_KILL = 35074,
NPC_QUEST_VEHICLE_PROTECTED = 31284,
NPC_QUEST_PVP_KILL_VEHICLE = 31093,
};
struct BfWGCoordGY
@@ -385,7 +385,7 @@ class BattlefieldWG : public Battlefield
bool SetupBattlefield();
/// Return pointer to relic object
GameObject* GetRelic() { return ObjectAccessor::GetObjectInWorld(m_titansRelic, (GameObject*)NULL); }
GameObject* GetRelic() { return ObjectAccessor::GetObjectInWorld(m_titansRelic, (GameObject*)NULL); }
/// Define relic object
//void SetRelic(GameObject* relic) { m_titansRelic = relic; }
@@ -398,8 +398,8 @@ class BattlefieldWG : public Battlefield
/// Vehicle world states update
void UpdateCounterVehicle(bool init);
void UpdateVehicleCountWG();
void CapturePointTaken(uint32 areaId);
void UpdateVehicleCountWG();
void CapturePointTaken(uint32 areaId);
void SendInitWorldStatesTo(Player* player);
void SendInitWorldStatesToAll();
@@ -409,17 +409,17 @@ class BattlefieldWG : public Battlefield
void OnUnitDeath(Unit* unit);
void PromotePlayer(Player* killer);
uint32 GetHonorBuff(int32 stack) const;
uint32 GetHonorBuff(int32 stack) const;
void UpdateTenacity();
void AddUpdateTenacity(Player* player);
void RemoveUpdateTenacity(Player* player);
void AddUpdateTenacity(Player* player);
void RemoveUpdateTenacity(Player* player);
void ProcessEvent(WorldObject *obj, uint32 eventId);
bool FindAndRemoveVehicleFromList(Unit* vehicle);
// returns the graveyardId in the specified area.
uint8 GetSpiritGraveyardId(uint32 areaId) const;
uint32 GetAreaByGraveyardId(uint8 gId) const;
uint32 GetAreaByGraveyardId(uint8 gId) const;
uint32 GetData(uint32 data) const;
protected:
@@ -435,10 +435,10 @@ class BattlefieldWG : public Battlefield
GuidSet CanonList;
GuidSet KeepCreature[2];
GuidSet OutsideCreature[2];
GuidSet m_updateTenacityList;
GuidSet m_updateTenacityList;
int32 m_tenacityStack;
uint32 m_tenacityUpdateTimer;
uint32 m_tenacityUpdateTimer;
uint32 m_saveTimer;
uint64 m_titansRelic;
@@ -498,31 +498,31 @@ enum WintergraspWorldstates
// TODO: Handle this with creature_text ?
enum eWGText
{
BATTLEFIELD_WG_TEXT_START = 0,
BATTLEFIELD_WG_TEXT_START = 0,
BATTLEFIELD_WG_TEXT_WORKSHOP_NE_ATTACK = 19, // Ally, horde +2
BATTLEFIELD_WG_TEXT_WORKSHOP_NW_ATTACK = 11, // Ally, horde +2
BATTLEFIELD_WG_TEXT_WORKSHOP_SE_ATTACK = 15, // Ally, horde +2
BATTLEFIELD_WG_TEXT_WORKSHOP_SW_ATTACK = 23, // Ally, horde +2
BATTLEFIELD_WG_TEXT_WORKSHOP_NE_TAKEN = 20, // Ally, horde +2
BATTLEFIELD_WG_TEXT_WORKSHOP_NE_TAKEN = 20, // Ally, horde +2
BATTLEFIELD_WG_TEXT_WORKSHOP_NW_TAKEN = 12, // Ally, horde +2
BATTLEFIELD_WG_TEXT_WORKSHOP_SE_TAKEN = 16, // Ally, horde +2
BATTLEFIELD_WG_TEXT_WORKSHOP_SW_TAKEN = 24, // Ally, horde +2
BATTLEFIELD_WG_TEXT_DEFEND_KEEP = 27, // Ally, horde +2
BATTLEFIELD_WG_TEXT_DEFEND_KEEP = 27, // Ally, horde +2
BATTLEFIELD_WG_TEXT_WIN_KEEP = 28, // Ally, horde +2
BATTLEFIELD_WG_TEXT_WILL_START = 31,
BATTLEFIELD_WG_TEXT_FIRSTRANK = 32,
BATTLEFIELD_WG_TEXT_SECONDRANK = 33,
BATTLEFIELD_WG_TEXT_TOWER_S_DAMAGED = 1,
BATTLEFIELD_WG_TEXT_TOWER_S_DAMAGED = 1,
BATTLEFIELD_WG_TEXT_TOWER_E_DAMAGED = 3,
BATTLEFIELD_WG_TEXT_TOWER_W_DAMAGED = 5,
BATTLEFIELD_WG_TEXT_TOWER_S_DESTROYED = 2,
BATTLEFIELD_WG_TEXT_TOWER_S_DESTROYED = 2,
BATTLEFIELD_WG_TEXT_TOWER_E_DESTROYED = 4,
BATTLEFIELD_WG_TEXT_TOWER_W_DESTROYED = 6,
BATTLEFIELD_WG_TEXT_KEEPTOWER_NE_DAMAGED = 36,
BATTLEFIELD_WG_TEXT_KEEPTOWER_NW_DAMAGED = 34,
BATTLEFIELD_WG_TEXT_KEEPTOWER_SE_DAMAGED = 38,
BATTLEFIELD_WG_TEXT_KEEPTOWER_SW_DAMAGED = 40,
BATTLEFIELD_WG_TEXT_KEEPTOWER_NE_DESTROYED = 37,
BATTLEFIELD_WG_TEXT_KEEPTOWER_NE_DESTROYED = 37,
BATTLEFIELD_WG_TEXT_KEEPTOWER_NW_DESTROYED = 35,
BATTLEFIELD_WG_TEXT_KEEPTOWER_SE_DESTROYED = 39,
BATTLEFIELD_WG_TEXT_KEEPTOWER_SW_DESTROYED = 41,
@@ -571,7 +571,7 @@ struct WintergraspBuildingSpawnData
float o;
uint32 type;
uint32 damageText;
uint32 destroyText;
uint32 destroyText;
};
const WintergraspBuildingSpawnData WGGameObjectBuilding[WG_MAX_OBJ] = {
@@ -637,38 +637,38 @@ const Position WGTurret[WG_MAX_TURRET] = {
{ 5390.95f, 2615.5f, 421.126f, 4.6409f },
{ 5148.8f, 2820.24f, 421.621f, 3.16043f },
{ 5147.98f, 2861.93f, 421.63f, 3.18792f },
{ 5352.22f, 3061.46f, 421.102f, 1.52235f }
{ 5352.22f, 3061.46f, 421.102f, 1.52235f }
};
static bool IsKeepNpc(uint32 entry)
{
switch (entry)
{
case BATTLEFIELD_WG_NPC_GUARD_H:
case BATTLEFIELD_WG_NPC_GUARD_A:
case BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER:
case BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH:
case BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR:
case BATTLEFIELD_WG_NPC_KNIGHT_DAMERON:
case BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN:
case BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA:
case BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI:
case BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER:
case BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH:
case BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH:
case BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH:
case BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS:
case BATTLEFIELD_WG_NPC_HORDE_WARBRINGER:
case BATTLEFIELD_WG_NPC_BRIGADIER_GENERAL:
case BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF:
case BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE:
case BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT:
case BATTLEFIELD_WG_NPC_ANCHORITE_TESSA:
case BATTLEFIELD_WG_NPC_LIEUTENANT_MURP:
case BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO:
return true;
}
return false;
switch (entry)
{
case BATTLEFIELD_WG_NPC_GUARD_H:
case BATTLEFIELD_WG_NPC_GUARD_A:
case BATTLEFIELD_WG_NPC_VIERON_BLAZEFEATHER:
case BATTLEFIELD_WG_NPC_BOWYER_RANDOLPH:
case BATTLEFIELD_WG_NPC_STONE_GUARD_MUKAR:
case BATTLEFIELD_WG_NPC_KNIGHT_DAMERON:
case BATTLEFIELD_WG_NPC_HOODOO_MASTER_FU_JIN:
case BATTLEFIELD_WG_NPC_SORCERESS_KAYLANA:
case BATTLEFIELD_WG_NPC_CHAMPION_ROS_SLAI:
case BATTLEFIELD_WG_NPC_MARSHAL_MAGRUDER:
case BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH:
case BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH:
case BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH:
case BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS:
case BATTLEFIELD_WG_NPC_HORDE_WARBRINGER:
case BATTLEFIELD_WG_NPC_BRIGADIER_GENERAL:
case BATTLEFIELD_WG_NPC_SIEGESMITH_STRONGHOOF:
case BATTLEFIELD_WG_NPC_SIEGE_MASTER_STOUTHANDLE:
case BATTLEFIELD_WG_NPC_PRIMALIST_MULFORT:
case BATTLEFIELD_WG_NPC_ANCHORITE_TESSA:
case BATTLEFIELD_WG_NPC_LIEUTENANT_MURP:
case BATTLEFIELD_WG_NPC_SENIOR_DEMOLITIONIST_LEGOSO:
return true;
}
return false;
}
// Here there is all npc keeper spawn point
@@ -690,13 +690,13 @@ const WintergraspObjectPositionData WGKeepNPC[WG_MAX_KEEP_NPC] =
{ 5388.560059f, 2834.770020f, 418.759003f, 3.071780f, BATTLEFIELD_WG_NPC_GUARD_H, BATTLEFIELD_WG_NPC_GUARD_A }, // Standing Guard
{ 5359.129883f, 2837.989990f, 409.364014f, 4.698930f, BATTLEFIELD_WG_NPC_COMMANDER_DARDOSH, BATTLEFIELD_WG_NPC_COMMANDER_ZANNETH }, // Commander Dardosh
{ 5366.129883f, 2833.399902f, 409.322998f, 3.141590f, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_KILRATH, BATTLEFIELD_WG_NPC_TACTICAL_OFFICER_AHBRAMIS }, // Tactical Officer Kilrath
{ 5467.590000f, 2841.060000f, 418.758000f, 1.396260f, BATTLEFIELD_WG_NPC_HORDE_WARBRINGER, BATTLEFIELD_WG_NPC_BRIGADIER_GENERAL }, // Battlemaster
{ 5467.590000f, 2841.060000f, 418.758000f, 1.396260f, BATTLEFIELD_WG_NPC_HORDE_WARBRINGER, BATTLEFIELD_WG_NPC_BRIGADIER_GENERAL }, // Battlemaster
{ 5415.120000f, 2811.420000f, 418.758000f, 2.321290f, BATTLEFIELD_WG_NPC_AV_PORTAL_HORDE, BATTLEFIELD_WG_NPC_AV_PORTAL_ALLY }, // Portal
{ 5467.560000f, 2810.080000f, 418.758000f, 0.837758f, BATTLEFIELD_WG_NPC_AB_PORTAL_HORDE, BATTLEFIELD_WG_NPC_AB_PORTAL_ALLY }, // Portal
{ 5476.330000f, 2863.210000f, 418.758000f, 0.471239f, BATTLEFIELD_WG_NPC_EOTS_PORTAL_HORDE, BATTLEFIELD_WG_NPC_EOTS_PORTAL_ALLY }, // Portal
{ 5468.270000f, 2871.140000f, 418.758000f, 0.000000f, BATTLEFIELD_WG_NPC_SOTA_PORTAL_HORDE, BATTLEFIELD_WG_NPC_SOTA_PORTAL_ALLY }, // Portal
{ 5476.100000f, 2818.040000f, 418.758000f, 4.380780f, BATTLEFIELD_WG_NPC_WG_PORTAL_HORDE, BATTLEFIELD_WG_NPC_WG_PORTAL_ALLY }, // Portal
{ 5415.120000f, 2811.420000f, 418.758000f, 2.321290f, BATTLEFIELD_WG_NPC_AV_PORTAL_HORDE, BATTLEFIELD_WG_NPC_AV_PORTAL_ALLY }, // Portal
{ 5467.560000f, 2810.080000f, 418.758000f, 0.837758f, BATTLEFIELD_WG_NPC_AB_PORTAL_HORDE, BATTLEFIELD_WG_NPC_AB_PORTAL_ALLY }, // Portal
{ 5476.330000f, 2863.210000f, 418.758000f, 0.471239f, BATTLEFIELD_WG_NPC_EOTS_PORTAL_HORDE, BATTLEFIELD_WG_NPC_EOTS_PORTAL_ALLY }, // Portal
{ 5468.270000f, 2871.140000f, 418.758000f, 0.000000f, BATTLEFIELD_WG_NPC_SOTA_PORTAL_HORDE, BATTLEFIELD_WG_NPC_SOTA_PORTAL_ALLY }, // Portal
{ 5476.100000f, 2818.040000f, 418.758000f, 4.380780f, BATTLEFIELD_WG_NPC_WG_PORTAL_HORDE, BATTLEFIELD_WG_NPC_WG_PORTAL_ALLY }, // Portal
// X Y Z O horde alliance
// North West
@@ -1059,7 +1059,7 @@ struct WGWorkshopData
uint8 id;
uint32 worldstate;
uint8 attackText;
uint8 takenText;
uint8 takenText;
};
const WGWorkshopData WorkshopsData[WG_MAX_WORKSHOP] =
@@ -1093,7 +1093,7 @@ struct BfWGGameObjectBuilding
m_WorldState = 0;
m_State = 0;
m_damagedText = 0;
m_destroyedText = 0;
m_destroyedText = 0;
}
// the team that controls this point
@@ -1116,7 +1116,7 @@ struct BfWGGameObjectBuilding
// Name id for warning text
uint8 m_damagedText;
uint8 m_destroyedText;
uint8 m_destroyedText;
// GameObject associations
GameObjectSet m_GameObjectList[2];
@@ -1145,13 +1145,13 @@ struct BfWGGameObjectBuilding
break;
}
GameObject* go = ObjectAccessor::GetObjectInWorld(m_Build, (GameObject*)NULL);
if (go)
{
// Rebuild gameobject
go->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true);
go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[m_Team]);
}
GameObject* go = ObjectAccessor::GetObjectInWorld(m_Build, (GameObject*)NULL);
if (go)
{
// Rebuild gameobject
go->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true);
go->SetUInt32Value(GAMEOBJECT_FACTION, WintergraspFaction[m_Team]);
}
// Update worldstate
m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT - (m_Team * 3);
@@ -1171,7 +1171,7 @@ struct BfWGGameObjectBuilding
m_WG->SendWarningToAllInZone(m_damagedText);
for (GuidSet::const_iterator itr = m_CreatureTopList[m_WG->GetAttackerTeam()].begin(); itr != m_CreatureTopList[m_WG->GetAttackerTeam()].end(); ++itr)
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
if (Creature* creature = unit->ToCreature())
m_WG->HideNpc(creature);
@@ -1199,8 +1199,8 @@ struct BfWGGameObjectBuilding
{
// Inform the global wintergrasp script of the destruction of this object
case BATTLEFIELD_WG_OBJECTTYPE_TOWER:
m_WG->UpdatedDestroyedTowerCount(TeamId(m_Team), ObjectAccessor::GetObjectInWorld(m_Build, (GameObject*)NULL));
break;
m_WG->UpdatedDestroyedTowerCount(TeamId(m_Team), ObjectAccessor::GetObjectInWorld(m_Build, (GameObject*)NULL));
break;
case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST:
m_WG->SetRelicInteractible(true);
if (GameObject* go = m_WG->GetRelic())
@@ -1208,11 +1208,11 @@ struct BfWGGameObjectBuilding
else
sLog->outError("BattlefieldWG: Relic not found.");
break;
case BATTLEFIELD_WG_OBJECTTYPE_DOOR:
case BATTLEFIELD_WG_OBJECTTYPE_WALL:
case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER:
m_WG->UpdatedDestroyedTowerCount(TeamId(m_Team), ObjectAccessor::GetObjectInWorld(m_Build, (GameObject*)NULL));
break;
case BATTLEFIELD_WG_OBJECTTYPE_DOOR:
case BATTLEFIELD_WG_OBJECTTYPE_WALL:
case BATTLEFIELD_WG_OBJECTTYPE_KEEP_TOWER:
m_WG->UpdatedDestroyedTowerCount(TeamId(m_Team), ObjectAccessor::GetObjectInWorld(m_Build, (GameObject*)NULL));
break;
}
m_WG->BrokenWallOrTower(TeamId(m_Team));
@@ -1231,7 +1231,7 @@ struct BfWGGameObjectBuilding
// NameId for Warning text
m_damagedText = damageText;
m_destroyedText = destroyText;
m_destroyedText = destroyText;
switch (m_Type)
{
@@ -1388,17 +1388,17 @@ struct BfWGGameObjectBuilding
void UpdateTurretAttack(bool disable)
{
GameObject* build = ObjectAccessor::GetObjectInWorld(m_Build, (GameObject*)NULL);
if (!build)
return;
GameObject* build = ObjectAccessor::GetObjectInWorld(m_Build, (GameObject*)NULL);
if (!build)
return;
uint32 faction = 0;
switch (build->GetEntry())
uint32 faction = 0;
switch (build->GetEntry())
{
case GO_WINTERGRASP_FORTRESS_TOWER_1:
case GO_WINTERGRASP_FORTRESS_TOWER_2:
case GO_WINTERGRASP_FORTRESS_TOWER_3:
case GO_WINTERGRASP_FORTRESS_TOWER_4:
case GO_WINTERGRASP_FORTRESS_TOWER_3:
case GO_WINTERGRASP_FORTRESS_TOWER_4:
faction = WintergraspFaction[m_WG->GetDefenderTeam()];
break;
case GO_WINTERGRASP_SHADOWSIGHT_TOWER:
@@ -1408,19 +1408,19 @@ struct BfWGGameObjectBuilding
break;
}
for (GuidSet::const_iterator itr = m_TowerCannonBottomList.begin(); itr != m_TowerCannonBottomList.end(); ++itr)
{
for (GuidSet::const_iterator itr = m_TowerCannonBottomList.begin(); itr != m_TowerCannonBottomList.end(); ++itr)
{
if (Unit* unit = ObjectAccessor::FindUnit(*itr))
{
{
if (Creature* creature = unit->ToCreature())
{
creature->setFaction(faction);
{
creature->setFaction(faction);
if (disable)
m_WG->HideNpc(creature);
else
m_WG->ShowNpc(creature, true);
}
}
}
}
}
for (GuidSet::const_iterator itr = m_TurretTopList.begin(); itr != m_TurretTopList.end(); ++itr)
@@ -1429,7 +1429,7 @@ struct BfWGGameObjectBuilding
{
if (Creature* creature = unit->ToCreature())
{
creature->setFaction(faction);
creature->setFaction(faction);
if (disable)
m_WG->HideNpc(creature);
else
@@ -1499,10 +1499,10 @@ struct WGWorkshop
}
if (!init)
{
{
bf->UpdateCounterVehicle(false);
bf->CapturePointTaken(bf->GetAreaByGraveyardId(workshopId));
}
bf->CapturePointTaken(bf->GetAreaByGraveyardId(workshopId));
}
}
void UpdateGraveyardAndWorkshop()
+31 -31
View File
@@ -94,7 +94,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
if (GetMembersSize() >= GetType() * 2)
return false;
// xinef: Get player name and class from player storage or global data storage
// xinef: Get player name and class from player storage or global data storage
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(playerGuid);
if (player)
{
@@ -103,12 +103,12 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
}
else
{
GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(playerGuid));
if (!playerData)
return false;
GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(playerGuid));
if (!playerData)
return false;
playerName = playerData->name;
playerClass = playerData->playerClass;
playerName = playerData->name;
playerClass = playerData->playerClass;
}
// Check if player is already in a similar arena team
@@ -126,7 +126,7 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
else if (GetRating() >= 1000)
personalRating = 1000;
// xinef: zomg! sync query
// xinef: zomg! sync query
// Try to get player's match maker rating from db and fall back to config setting if not found
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_MATCH_MAKER_RATING);
stmt->setUInt32(0, GUID_LOPART(playerGuid));
@@ -162,10 +162,10 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
newMember.WeekWins = 0;
newMember.PersonalRating = personalRating;
newMember.MatchMakerRating = matchMakerRating;
newMember.MaxMMR = maxMMR;
newMember.MaxMMR = maxMMR;
Members.push_back(newMember);
sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(playerGuid), GetSlot(), GetId());
sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(playerGuid), GetSlot(), GetId());
// Save player's arena team membership to db
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM_MEMBER);
@@ -244,7 +244,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
newMember.Class = fields[7].GetUInt8();
newMember.PersonalRating = fields[8].GetUInt16();
newMember.MatchMakerRating = fields[9].GetUInt16() > 0 ? fields[9].GetUInt16() : sWorld->getIntConfig(CONFIG_ARENA_START_MATCHMAKER_RATING);;
newMember.MaxMMR = std::max(fields[10].GetUInt16(), newMember.MatchMakerRating);
newMember.MaxMMR = std::max(fields[10].GetUInt16(), newMember.MatchMakerRating);
// Delete member if character information is missing
if (fields[6].GetString().empty())
@@ -260,7 +260,7 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult result)
// Put the player in the team
Members.push_back(newMember);
sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(newMember.Guid), GetSlot(), GetId());
sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(newMember.Guid), GetSlot(), GetId());
}
while (result->NextRow());
@@ -310,7 +310,7 @@ void ArenaTeam::DelMember(uint64 guid, bool cleanDb)
if (itr->Guid == guid)
{
Members.erase(itr);
sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(guid), GetSlot(), 0);
sWorld->UpdateGlobalPlayerArenaTeam(GUID_LOPART(guid), GetSlot(), 0);
break;
}
@@ -367,7 +367,7 @@ void ArenaTeam::Roster(WorldSession* session)
Player* player = NULL;
uint8 unk308 = 0;
std::string tempName;
std::string tempName;
WorldPacket data(SMSG_ARENA_TEAM_ROSTER, 100);
data << uint32(GetId()); // team id
@@ -381,9 +381,9 @@ void ArenaTeam::Roster(WorldSession* session)
data << uint64(itr->Guid); // guid
data << uint8((player ? 1 : 0)); // online flag
tempName = "";
sObjectMgr->GetPlayerNameByGUID(itr->Guid, tempName);
data << tempName; // member name
tempName = "";
sObjectMgr->GetPlayerNameByGUID(itr->Guid, tempName);
data << tempName; // member name
data << uint32((itr->Guid == GetCaptain() ? 0 : 1));// captain flag 0 captain 1 member
data << uint8((player ? player->getLevel() : 0)); // unknown, level?
data << uint8(itr->Class); // class
@@ -474,20 +474,20 @@ void ArenaTeamMember::ModifyPersonalRating(Player* player, int32 mod, uint32 typ
void ArenaTeamMember::ModifyMatchmakerRating(int32 mod, uint32 /*slot*/)
{
if (mod < 0)
{
// pussywizard: prevent lowering MMR too much from max achieved MMR
int32 maxAllowedDrop = (int32)sWorld->getIntConfig(CONFIG_MAX_ALLOWED_MMR_DROP);
mod = std::min<int32>(std::max<int32>(-((int32)MatchMakerRating - (int32)MaxMMR + maxAllowedDrop), mod), 0);
}
if (mod < 0)
{
// pussywizard: prevent lowering MMR too much from max achieved MMR
int32 maxAllowedDrop = (int32)sWorld->getIntConfig(CONFIG_MAX_ALLOWED_MMR_DROP);
mod = std::min<int32>(std::max<int32>(-((int32)MatchMakerRating - (int32)MaxMMR + maxAllowedDrop), mod), 0);
}
if (int32(MatchMakerRating) + mod < 0)
MatchMakerRating = 0;
else
MatchMakerRating += mod;
if (MatchMakerRating > MaxMMR)
MaxMMR = MatchMakerRating;
if (MatchMakerRating > MaxMMR)
MaxMMR = MatchMakerRating;
}
void ArenaTeam::BroadcastPacket(WorldPacket* packet)
@@ -785,11 +785,11 @@ void ArenaTeam::MemberWon(Player* player, uint32 againstMatchmakerRating, int32
itr->ModifyPersonalRating(player, mod, GetType());
// update matchmaker rating (pussywizard: but don't allow it to go over team rating)
if (itr->MatchMakerRating < Stats.Rating)
{
mod = std::min(MatchmakerRatingChange, Stats.Rating - itr->MatchMakerRating);
itr->ModifyMatchmakerRating(mod, GetSlot());
}
if (itr->MatchMakerRating < Stats.Rating)
{
mod = std::min(MatchmakerRatingChange, Stats.Rating - itr->MatchMakerRating);
itr->ModifyMatchmakerRating(mod, GetSlot());
}
// update personal stats
itr->WeekGames +=1;
@@ -867,7 +867,7 @@ void ArenaTeam::SaveToDB()
stmt->setUInt32(0, GUID_LOPART(itr->Guid));
stmt->setUInt8(1, GetSlot());
stmt->setUInt16(2, itr->MatchMakerRating);
stmt->setUInt16(3, itr->MaxMMR);
stmt->setUInt16(3, itr->MaxMMR);
trans->Append(stmt);
}
@@ -900,7 +900,7 @@ bool ArenaTeam::IsFighting() const
ArenaTeamMember* ArenaTeam::GetMember(const std::string& name)
{
return GetMember(sObjectMgr->GetPlayerGUIDByName(name));
return GetMember(sObjectMgr->GetPlayerGUIDByName(name));
}
ArenaTeamMember* ArenaTeam::GetMember(uint64 guid)
+1 -1
View File
@@ -97,7 +97,7 @@ struct ArenaTeamMember
uint16 SeasonWins;
uint16 PersonalRating;
uint16 MatchMakerRating;
uint16 MaxMMR;
uint16 MaxMMR;
void ModifyPersonalRating(Player* player, int32 mod, uint32 type);
void ModifyMatchmakerRating(int32 mod, uint32 slot);
@@ -27,7 +27,7 @@
ArenaTeamMgr::ArenaTeamMgr()
{
NextArenaTeamId = 1;
LastArenaLogId = 0;
LastArenaLogId = 0;
}
ArenaTeamMgr::~ArenaTeamMgr()
+3 -3
View File
@@ -45,13 +45,13 @@ public:
uint32 GenerateArenaTeamId();
void SetNextArenaTeamId(uint32 Id) { NextArenaTeamId = Id; }
uint32 GetNextArenaLogId() { return ++LastArenaLogId; }
void SetLastArenaLogId(uint32 id) { LastArenaLogId = id; }
uint32 GetNextArenaLogId() { return ++LastArenaLogId; }
void SetLastArenaLogId(uint32 id) { LastArenaLogId = id; }
protected:
uint32 NextArenaTeamId;
ArenaTeamContainer ArenaTeamStore;
uint32 LastArenaLogId;
uint32 LastArenaLogId;
};
#define sArenaTeamMgr ACE_Singleton<ArenaTeamMgr, ACE_Null_Mutex>::instance()
+234 -234
View File
@@ -175,8 +175,8 @@ Battleground::Battleground()
m_PlayersCount[TEAM_ALLIANCE] = 0;
m_PlayersCount[TEAM_HORDE] = 0;
m_BgInvitedPlayers[TEAM_ALLIANCE]= 0;
m_BgInvitedPlayers[TEAM_HORDE] = 0;
m_BgInvitedPlayers[TEAM_ALLIANCE]= 0;
m_BgInvitedPlayers[TEAM_HORDE] = 0;
m_TeamScores[TEAM_ALLIANCE] = 0;
m_TeamScores[TEAM_HORDE] = 0;
@@ -196,8 +196,8 @@ Battleground::Battleground()
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE;
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
// pussywizard:
m_UpdateTimer = 0;
// pussywizard:
m_UpdateTimer = 0;
}
Battleground::~Battleground()
@@ -228,13 +228,13 @@ Battleground::~Battleground()
void Battleground::Update(uint32 diff)
{
// pussywizard:
m_UpdateTimer += diff;
if (m_UpdateTimer < BATTLEGROUND_UPDATE_INTERVAL)
return;
// pussywizard:
m_UpdateTimer += diff;
if (m_UpdateTimer < BATTLEGROUND_UPDATE_INTERVAL)
return;
diff = BATTLEGROUND_UPDATE_INTERVAL; // just change diff value, no need to replace variable name in many places
m_UpdateTimer -= BATTLEGROUND_UPDATE_INTERVAL;
diff = BATTLEGROUND_UPDATE_INTERVAL; // just change diff value, no need to replace variable name in many places
m_UpdateTimer -= BATTLEGROUND_UPDATE_INTERVAL;
if (!PreUpdateImpl(diff))
return;
@@ -303,7 +303,7 @@ inline void Battleground::_CheckSafePositions(uint32 diff)
float x, y, z, o;
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
{
itr->second->GetPosition(&pos);
itr->second->GetPosition(&pos);
GetTeamStartLoc(itr->second->GetBgTeamId(), x, y, z, o);
if (pos.GetExactDistSq(x, y, z) > maxDist)
{
@@ -468,32 +468,32 @@ inline void Battleground::_ProcessJoin(uint32 diff)
m_Events |= BG_STARTING_EVENT_3;
SendMessageToAll(StartMessageIds[BG_STARTING_EVENT_THIRD], CHAT_MSG_BG_SYSTEM_NEUTRAL);
if (isArena())
switch (GetBgTypeID())
{
case BATTLEGROUND_NA:
DelObject(BG_NA_OBJECT_READY_MARKER_1);
DelObject(BG_NA_OBJECT_READY_MARKER_2);
break;
case BATTLEGROUND_BE:
DelObject(BG_BE_OBJECT_READY_MARKER_1);
DelObject(BG_BE_OBJECT_READY_MARKER_2);
break;
case BATTLEGROUND_RL:
DelObject(BG_RL_OBJECT_READY_MARKER_1);
DelObject(BG_RL_OBJECT_READY_MARKER_2);
break;
case BATTLEGROUND_DS:
DelObject(BG_DS_OBJECT_READY_MARKER_1);
DelObject(BG_DS_OBJECT_READY_MARKER_2);
break;
case BATTLEGROUND_RV:
DelObject(BG_RV_OBJECT_READY_MARKER_1);
DelObject(BG_RV_OBJECT_READY_MARKER_2);
break;
default:
break;
}
if (isArena())
switch (GetBgTypeID())
{
case BATTLEGROUND_NA:
DelObject(BG_NA_OBJECT_READY_MARKER_1);
DelObject(BG_NA_OBJECT_READY_MARKER_2);
break;
case BATTLEGROUND_BE:
DelObject(BG_BE_OBJECT_READY_MARKER_1);
DelObject(BG_BE_OBJECT_READY_MARKER_2);
break;
case BATTLEGROUND_RL:
DelObject(BG_RL_OBJECT_READY_MARKER_1);
DelObject(BG_RL_OBJECT_READY_MARKER_2);
break;
case BATTLEGROUND_DS:
DelObject(BG_DS_OBJECT_READY_MARKER_1);
DelObject(BG_DS_OBJECT_READY_MARKER_2);
break;
case BATTLEGROUND_RV:
DelObject(BG_RV_OBJECT_READY_MARKER_1);
DelObject(BG_RV_OBJECT_READY_MARKER_2);
break;
default:
break;
}
}
// Delay expired (after 2 or 1 minute)
else if (GetStartDelayTime() <= 0 && !(m_Events & BG_STARTING_EVENT_4))
@@ -541,31 +541,31 @@ inline void Battleground::_ProcessJoin(uint32 diff)
player->UpdateObjectVisibility(true);
}
for (SpectatorList::const_iterator itr = m_Spectators.begin(); itr != m_Spectators.end(); ++itr)
ArenaSpectator::HandleResetCommand(*itr);
for (SpectatorList::const_iterator itr = m_Spectators.begin(); itr != m_Spectators.end(); ++itr)
ArenaSpectator::HandleResetCommand(*itr);
CheckArenaWinConditions();
// pussywizard: arena spectator stuff
if (GetStatus() == STATUS_IN_PROGRESS)
{
for (ToBeTeleportedMap::const_iterator itr = m_ToBeTeleported.begin(); itr != m_ToBeTeleported.end(); ++itr)
if (Player* p = ObjectAccessor::GetObjectInOrOutOfWorld(itr->first, (Player*)NULL))
if (Player* t = ObjectAccessor::FindPlayer(itr->second))
{
if (!t->FindMap() || t->FindMap() != GetBgMap())
continue;
// pussywizard: arena spectator stuff
if (GetStatus() == STATUS_IN_PROGRESS)
{
for (ToBeTeleportedMap::const_iterator itr = m_ToBeTeleported.begin(); itr != m_ToBeTeleported.end(); ++itr)
if (Player* p = ObjectAccessor::GetObjectInOrOutOfWorld(itr->first, (Player*)NULL))
if (Player* t = ObjectAccessor::FindPlayer(itr->second))
{
if (!t->FindMap() || t->FindMap() != GetBgMap())
continue;
p->SetSummonPoint(t->GetMapId(), t->GetPositionX(), t->GetPositionY(), t->GetPositionZ(), 15, true);
p->SetSummonPoint(t->GetMapId(), t->GetPositionX(), t->GetPositionY(), t->GetPositionZ(), 15, true);
WorldPacket data(SMSG_SUMMON_REQUEST, 8+4+4);
data << uint64(t->GetGUID());
data << uint32(t->GetZoneId());
data << uint32(15*IN_MILLISECONDS);
p->GetSession()->SendPacket(&data);
}
m_ToBeTeleported.clear();
}
WorldPacket data(SMSG_SUMMON_REQUEST, 8+4+4);
data << uint64(t->GetGUID());
data << uint32(t->GetZoneId());
data << uint32(15*IN_MILLISECONDS);
p->GetSession()->SendPacket(&data);
}
m_ToBeTeleported.clear();
}
}
else
{
@@ -599,7 +599,7 @@ inline void Battleground::_ProcessLeave(uint32 diff)
{
next = itr;
++next;
itr->second->LeaveBattleground(this); //itr is erased here!
itr->second->LeaveBattleground(this); //itr is erased here!
}
}
}
@@ -621,7 +621,7 @@ void Battleground::SendPacketToAll(WorldPacket* packet)
void Battleground::SendPacketToTeam(TeamId teamId, WorldPacket* packet, Player* sender, bool self)
{
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
if (itr->second->GetBgTeamId() == teamId && (self || sender != itr->second))
if (itr->second->GetBgTeamId() == teamId && (self || sender != itr->second))
itr->second->GetSession()->SendPacket(packet);
}
@@ -651,8 +651,8 @@ void Battleground::YellToAll(Creature* creature, char const* text, uint32 langua
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
WorldPacket data;
ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_YELL, Language(language), creature, itr->second, text);
itr->second->SendDirectMessage(&data);
ChatHandler::BuildChatPacket(data, CHAT_MSG_MONSTER_YELL, Language(language), creature, itr->second, text);
itr->second->SendDirectMessage(&data);
}
}
@@ -668,12 +668,12 @@ void Battleground::RewardReputationToTeam(uint32 factionId, uint32 reputation, T
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionId))
for (BattlegroundPlayerMap::const_iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
if (itr->second->GetBgTeamId() == teamId)
{
uint32 repGain = reputation;
AddPct(repGain, itr->second->GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN));
AddPct(repGain, itr->second->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, factionId));
itr->second->GetReputationMgr().ModifyReputation(factionEntry, repGain);
}
{
uint32 repGain = reputation;
AddPct(repGain, itr->second->GetTotalAuraModifier(SPELL_AURA_MOD_REPUTATION_GAIN));
AddPct(repGain, itr->second->GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_FACTION_REPUTATION_GAIN, factionId));
itr->second->GetReputationMgr().ModifyReputation(factionEntry, repGain);
}
}
void Battleground::UpdateWorldState(uint32 Field, uint32 Value)
@@ -692,15 +692,15 @@ void Battleground::UpdateWorldStateForPlayer(uint32 Field, uint32 Value, Player*
void Battleground::EndBattleground(TeamId winnerTeamId)
{
// xinef: if this is true, it means that endbattleground is called second time
// skip to avoid double rating reduce / add
// can bug out due to multithreading ?
// set as fast as possible
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
uint32 startDelay = StartDelayTimes[BG_STARTING_EVENT_FIRST]; // = BG_START_DELAY_1M = 60000 for all arenas
bool bValidArena = isArena() && isRated() && GetStatus() == STATUS_IN_PROGRESS && GetStartTime() >= startDelay+15000; // pussywizard: only if arena lasted at least 15 secs
SetStatus(STATUS_WAIT_LEAVE);
// xinef: if this is true, it means that endbattleground is called second time
// skip to avoid double rating reduce / add
// can bug out due to multithreading ?
// set as fast as possible
if (GetStatus() == STATUS_WAIT_LEAVE)
return;
uint32 startDelay = StartDelayTimes[BG_STARTING_EVENT_FIRST]; // = BG_START_DELAY_1M = 60000 for all arenas
bool bValidArena = isArena() && isRated() && GetStatus() == STATUS_IN_PROGRESS && GetStartTime() >= startDelay+15000; // pussywizard: only if arena lasted at least 15 secs
SetStatus(STATUS_WAIT_LEAVE);
ArenaTeam* winnerArenaTeam = NULL;
ArenaTeam* loserArenaTeam = NULL;
@@ -718,18 +718,18 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
if (winnerTeamId == TEAM_ALLIANCE)
{
SetWinner(TEAM_HORDE); // reversed in packet
SetWinner(TEAM_HORDE); // reversed in packet
winmsg_id = isBattleground() ? LANG_BG_A_WINS : LANG_ARENA_GOLD_WINS;
PlaySoundToAll(SOUND_ALLIANCE_WINS); // alliance wins sound
}
else if (winnerTeamId == TEAM_HORDE)
{
SetWinner(TEAM_ALLIANCE); // reversed in packet
SetWinner(TEAM_ALLIANCE); // reversed in packet
winmsg_id = isBattleground() ? LANG_BG_H_WINS : LANG_ARENA_GREEN_WINS;
PlaySoundToAll(SOUND_HORDE_WINS); // horde wins sound
}
else
SetWinner(TEAM_NEUTRAL);
else
SetWinner(TEAM_NEUTRAL);
//we must set it this way, because end time is sent in packet!
m_EndTime = TIME_TO_AUTOREMOVE;
@@ -756,58 +756,58 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
SetArenaTeamRatingChangeForTeam(GetOtherTeamId(winnerTeamId), loserChange);
// pussywizard: arena logs in database
uint32 fightId = sArenaTeamMgr->GetNextArenaLogId();
uint32 fightId = sArenaTeamMgr->GetNextArenaLogId();
uint32 currOnline = (uint32)(sWorld->GetActiveSessionCount());
SQLTransaction trans = CharacterDatabase.BeginTransaction();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_FIGHT);
stmt->setUInt32(0, fightId);
stmt->setUInt8(1, m_ArenaType);
stmt->setUInt32(2, ((GetStartTime() <= startDelay ? 0 : GetStartTime()-startDelay)/1000));
stmt->setUInt32(3, winnerArenaTeam->GetId());
stmt->setUInt32(4, loserArenaTeam->GetId());
stmt->setUInt16(5, (uint16)winnerTeamRating);
stmt->setUInt16(6, (uint16)winnerMatchmakerRating);
stmt->setInt16(7, (int16)winnerChange);
stmt->setUInt16(8, (uint16)loserTeamRating);
stmt->setUInt16(9, (uint16)loserMatchmakerRating);
stmt->setInt16(10, (int16)loserChange);
stmt->setUInt32(11, currOnline);
trans->Append(stmt);
SQLTransaction trans = CharacterDatabase.BeginTransaction();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_FIGHT);
stmt->setUInt32(0, fightId);
stmt->setUInt8(1, m_ArenaType);
stmt->setUInt32(2, ((GetStartTime() <= startDelay ? 0 : GetStartTime()-startDelay)/1000));
stmt->setUInt32(3, winnerArenaTeam->GetId());
stmt->setUInt32(4, loserArenaTeam->GetId());
stmt->setUInt16(5, (uint16)winnerTeamRating);
stmt->setUInt16(6, (uint16)winnerMatchmakerRating);
stmt->setInt16(7, (int16)winnerChange);
stmt->setUInt16(8, (uint16)loserTeamRating);
stmt->setUInt16(9, (uint16)loserMatchmakerRating);
stmt->setInt16(10, (int16)loserChange);
stmt->setUInt32(11, currOnline);
trans->Append(stmt);
uint8 memberId = 0;
uint8 memberId = 0;
for (Battleground::ArenaLogEntryDataMap::const_iterator itr = ArenaLogEntries.begin(); itr != ArenaLogEntries.end(); ++itr)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_MEMBERSTATS);
stmt->setUInt32(0, fightId);
stmt->setUInt8(1, ++memberId);
stmt->setString(2, itr->second.Name);
stmt->setUInt32(3, itr->second.Guid);
stmt->setUInt32(4, itr->second.ArenaTeamId);
stmt->setUInt32(5, itr->second.Acc);
stmt->setString(6, itr->second.IP);
stmt->setUInt32(7, itr->second.DamageDone);
stmt->setUInt32(8, itr->second.HealingDone);
stmt->setUInt32(9, itr->second.KillingBlows);
trans->Append(stmt);
}
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_MEMBERSTATS);
stmt->setUInt32(0, fightId);
stmt->setUInt8(1, ++memberId);
stmt->setString(2, itr->second.Name);
stmt->setUInt32(3, itr->second.Guid);
stmt->setUInt32(4, itr->second.ArenaTeamId);
stmt->setUInt32(5, itr->second.Acc);
stmt->setString(6, itr->second.IP);
stmt->setUInt32(7, itr->second.DamageDone);
stmt->setUInt32(8, itr->second.HealingDone);
stmt->setUInt32(9, itr->second.KillingBlows);
trans->Append(stmt);
}
CharacterDatabase.CommitTransaction(trans);
}
CharacterDatabase.CommitTransaction(trans);
}
// Deduct 16 points from each teams arena-rating if there are no winners after 45+2 minutes
else
{
// pussywizard: in case of a draw, the following is always true:
// winnerArenaTeam => TEAM_HORDE, loserArenaTeam => TEAM_ALLIANCE
// pussywizard: in case of a draw, the following is always true:
// winnerArenaTeam => TEAM_HORDE, loserArenaTeam => TEAM_ALLIANCE
winnerTeamRating = winnerArenaTeam->GetRating();
winnerMatchmakerRating = GetArenaMatchmakerRating(TEAM_HORDE);
loserTeamRating = loserArenaTeam->GetRating();
loserTeamRating = loserArenaTeam->GetRating();
loserMatchmakerRating = GetArenaMatchmakerRating(TEAM_ALLIANCE);
winnerMatchmakerChange = 0;
winnerMatchmakerChange = 0;
loserMatchmakerChange = 0;
winnerChange = ARENA_TIMELIMIT_POINTS_LOSS;
loserChange = ARENA_TIMELIMIT_POINTS_LOSS;
winnerChange = ARENA_TIMELIMIT_POINTS_LOSS;
loserChange = ARENA_TIMELIMIT_POINTS_LOSS;
SetArenaTeamRatingChangeForTeam(TEAM_ALLIANCE, ARENA_TIMELIMIT_POINTS_LOSS);
SetArenaTeamRatingChangeForTeam(TEAM_HORDE, ARENA_TIMELIMIT_POINTS_LOSS);
@@ -815,43 +815,43 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
loserArenaTeam->FinishGame(ARENA_TIMELIMIT_POINTS_LOSS, GetBgMap());
// pussywizard: arena logs in database
uint32 fightId = sArenaTeamMgr->GetNextArenaLogId();
uint32 fightId = sArenaTeamMgr->GetNextArenaLogId();
uint32 currOnline = (uint32)(sWorld->GetActiveSessionCount());
SQLTransaction trans = CharacterDatabase.BeginTransaction();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_FIGHT);
stmt->setUInt32(0, fightId);
stmt->setUInt8(1, m_ArenaType);
stmt->setUInt32(2, ((GetStartTime() <= startDelay ? 0 : GetStartTime()-startDelay)/1000));
stmt->setUInt32(3, winnerArenaTeam->GetId());
stmt->setUInt32(4, loserArenaTeam->GetId());
stmt->setUInt16(5, (uint16)winnerTeamRating);
stmt->setUInt16(6, (uint16)winnerMatchmakerRating);
stmt->setInt16(7, (int16)winnerChange);
stmt->setUInt16(8, (uint16)loserTeamRating);
stmt->setUInt16(9, (uint16)loserMatchmakerRating);
stmt->setInt16(10, (int16)loserChange);
stmt->setUInt32(11, currOnline);
trans->Append(stmt);
SQLTransaction trans = CharacterDatabase.BeginTransaction();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_FIGHT);
stmt->setUInt32(0, fightId);
stmt->setUInt8(1, m_ArenaType);
stmt->setUInt32(2, ((GetStartTime() <= startDelay ? 0 : GetStartTime()-startDelay)/1000));
stmt->setUInt32(3, winnerArenaTeam->GetId());
stmt->setUInt32(4, loserArenaTeam->GetId());
stmt->setUInt16(5, (uint16)winnerTeamRating);
stmt->setUInt16(6, (uint16)winnerMatchmakerRating);
stmt->setInt16(7, (int16)winnerChange);
stmt->setUInt16(8, (uint16)loserTeamRating);
stmt->setUInt16(9, (uint16)loserMatchmakerRating);
stmt->setInt16(10, (int16)loserChange);
stmt->setUInt32(11, currOnline);
trans->Append(stmt);
uint8 memberId = 0;
uint8 memberId = 0;
for (Battleground::ArenaLogEntryDataMap::const_iterator itr = ArenaLogEntries.begin(); itr != ArenaLogEntries.end(); ++itr)
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_MEMBERSTATS);
stmt->setUInt32(0, fightId);
stmt->setUInt8(1, ++memberId);
stmt->setString(2, itr->second.Name);
stmt->setUInt32(3, itr->second.Guid);
stmt->setUInt32(4, itr->second.ArenaTeamId);
stmt->setUInt32(5, itr->second.Acc);
stmt->setString(6, itr->second.IP);
stmt->setUInt32(7, itr->second.DamageDone);
stmt->setUInt32(8, itr->second.HealingDone);
stmt->setUInt32(9, itr->second.KillingBlows);
trans->Append(stmt);
}
{
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_LOG_MEMBERSTATS);
stmt->setUInt32(0, fightId);
stmt->setUInt8(1, ++memberId);
stmt->setString(2, itr->second.Name);
stmt->setUInt32(3, itr->second.Guid);
stmt->setUInt32(4, itr->second.ArenaTeamId);
stmt->setUInt32(5, itr->second.Acc);
stmt->setString(6, itr->second.IP);
stmt->setUInt32(7, itr->second.DamageDone);
stmt->setUInt32(8, itr->second.HealingDone);
stmt->setUInt32(9, itr->second.KillingBlows);
trans->Append(stmt);
}
CharacterDatabase.CommitTransaction(trans);
CharacterDatabase.CommitTransaction(trans);
}
}
else
@@ -868,7 +868,7 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
for (BattlegroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
{
Player* player = itr->second;
TeamId bgTeamId = player->GetBgTeamId();
TeamId bgTeamId = player->GetBgTeamId();
// should remove spirit of redemption
if (player->HasAuraType(SPELL_AURA_SPIRIT_OF_REDEMPTION))
player->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
@@ -894,15 +894,15 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
{
if (bgTeamId == winnerTeamId)
{
if (bValidArena)
{
// update achievement BEFORE personal rating update
uint32 rating = player->GetArenaPersonalRating(winnerArenaTeam->GetSlot());
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, rating ? rating : 1);
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA, GetMapId());
if (bValidArena)
{
// update achievement BEFORE personal rating update
uint32 rating = player->GetArenaPersonalRating(winnerArenaTeam->GetSlot());
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_RATED_ARENA, rating ? rating : 1);
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_WIN_ARENA, GetMapId());
winnerArenaTeam->MemberWon(player, loserMatchmakerRating, winnerMatchmakerChange);
}
winnerArenaTeam->MemberWon(player, loserMatchmakerRating, winnerMatchmakerChange);
}
}
else
{
@@ -925,7 +925,7 @@ void Battleground::EndBattleground(TeamId winnerTeamId)
UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(winner_kills));
// Xinef: check player level and not bracket level if (CanAwardArenaPoints())
if (player->getLevel() >= BG_AWARD_ARENA_POINTS_MIN_LEVEL)
if (player->getLevel() >= BG_AWARD_ARENA_POINTS_MIN_LEVEL)
player->ModifyArenaPoints(winner_arena);
if (!player->GetRandomWinner())
@@ -983,7 +983,7 @@ void Battleground::BlockMovement(Player* player)
void Battleground::RemovePlayerAtLeave(Player* player)
{
TeamId teamId = player->GetBgTeamId();
TeamId teamId = player->GetBgTeamId();
// check if the player was a participant of the match, or only entered through gm command
bool participant = false;
@@ -995,7 +995,7 @@ void Battleground::RemovePlayerAtLeave(Player* player)
participant = true;
}
// delete player score if exists
// delete player score if exists
BattlegroundScoreMap::iterator itr2 = PlayerScores.find(player->GetGUID());
if (itr2 != PlayerScores.end())
{
@@ -1005,7 +1005,7 @@ void Battleground::RemovePlayerAtLeave(Player* player)
RemovePlayerFromResurrectQueue(player);
// resurrect on exit
// resurrect on exit
if (!player->IsAlive())
{
player->ResurrectPlayer(1.0f);
@@ -1014,10 +1014,10 @@ void Battleground::RemovePlayerAtLeave(Player* player)
player->RemoveAurasByType(SPELL_AURA_MOUNTED);
// BG subclass specific code
// BG subclass specific code
RemovePlayer(player);
// if the player was a match participant
// if the player was a match participant
if (participant)
{
WorldPacket data;
@@ -1038,26 +1038,26 @@ void Battleground::RemovePlayerAtLeave(Player* player)
// remove from raid group if player is member
if (Group* group = GetBgRaid(teamId))
if (group->IsMember(player->GetGUID()))
if (!group->RemoveMember(player->GetGUID())) // group was disbanded
SetBgRaid(teamId, NULL);
if (group->IsMember(player->GetGUID()))
if (!group->RemoveMember(player->GetGUID())) // group was disbanded
SetBgRaid(teamId, NULL);
// let others know
sBattlegroundMgr->BuildPlayerLeftBattlegroundPacket(&data, player->GetGUID());
SendPacketToTeam(teamId, &data, player, false);
// cast deserter
if (isBattleground() && !player->IsGameMaster() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_CAST_DESERTER))
if (GetStatus() == STATUS_IN_PROGRESS || GetStatus() == STATUS_WAIT_JOIN)
player->ScheduleDelayedOperation(DELAYED_SPELL_CAST_DESERTER);
// cast deserter
if (isBattleground() && !player->IsGameMaster() && sWorld->getBoolConfig(CONFIG_BATTLEGROUND_CAST_DESERTER))
if (GetStatus() == STATUS_IN_PROGRESS || GetStatus() == STATUS_WAIT_JOIN)
player->ScheduleDelayedOperation(DELAYED_SPELL_CAST_DESERTER);
}
// Remove shapeshift auras
player->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
// Remove shapeshift auras
player->RemoveAurasByType(SPELL_AURA_MOD_SHAPESHIFT);
player->SetBattlegroundId(0, BATTLEGROUND_TYPE_NONE, PLAYER_MAX_BATTLEGROUND_QUEUES, false, false, TEAM_NEUTRAL);
// Xinef: remove all criterias on bg leave
// Xinef: remove all criterias on bg leave
player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
}
@@ -1073,10 +1073,10 @@ void Battleground::Init()
m_Events = 0;
if (m_BgInvitedPlayers[TEAM_ALLIANCE] > 0 || m_BgInvitedPlayers[TEAM_HORDE] > 0)
{
{
sLog->outError("Battleground::Reset: one of the counters is not 0 (alliance: %u, horde: %u) for BG (map: %u, instance id: %u)!", m_BgInvitedPlayers[TEAM_ALLIANCE], m_BgInvitedPlayers[TEAM_HORDE], m_MapId, m_InstanceID);
ASSERT(false);
}
ASSERT(false);
}
m_BgInvitedPlayers[TEAM_ALLIANCE] = 0;
m_BgInvitedPlayers[TEAM_HORDE] = 0;
@@ -1142,10 +1142,10 @@ void Battleground::AddPlayer(Player* player)
player->CastSpell(player, SPELL_ALLIANCE_GREEN_FLAG, true);
}
// restore pets health before remove
if (Pet* pet = player->GetPet())
if (pet->IsAlive())
pet->SetHealth(pet->GetMaxHealth());
// restore pets health before remove
if (Pet* pet = player->GetPet())
if (pet->IsAlive())
pet->SetHealth(pet->GetMaxHealth());
player->DestroyConjuredItems(true);
player->UnsummonPetTemporaryIfAny();
@@ -1162,7 +1162,7 @@ void Battleground::AddPlayer(Player* player)
player->CastSpell(player, SPELL_PREPARATION, true); // reduces all mana cost of spells.
}
// Xinef: reset all map criterias on map enter
// Xinef: reset all map criterias on map enter
player->ResetAchievementCriteria(ACHIEVEMENT_CRITERIA_CONDITION_BG_MAP, GetMapId(), true);
// setup BG group membership
@@ -1176,11 +1176,11 @@ void Battleground::AddPlayer(Player* player)
// this method adds player to his team's bg group, or sets his correct group if player is already in bg group
void Battleground::AddOrSetPlayerToCorrectBgGroup(Player* player, TeamId teamId)
{
if (player->GetGroup() && (player->GetGroup()->isBGGroup() || player->GetGroup()->isBFGroup()))
{
sLog->outMisc("Battleground::AddOrSetPlayerToCorrectBgGroup - player is already in %s group!", (player->GetGroup()->isBGGroup() ? "BG" : "BF"));
return;
}
if (player->GetGroup() && (player->GetGroup()->isBGGroup() || player->GetGroup()->isBFGroup()))
{
sLog->outMisc("Battleground::AddOrSetPlayerToCorrectBgGroup - player is already in %s group!", (player->GetGroup()->isBGGroup() ? "BG" : "BF"));
return;
}
uint64 playerGuid = player->GetGUID();
Group* group = GetBgRaid(teamId);
@@ -1193,7 +1193,7 @@ void Battleground::AddOrSetPlayerToCorrectBgGroup(Player* player, TeamId teamId)
else if (group->IsMember(playerGuid))
{
uint8 subgroup = group->GetMemberGroup(playerGuid);
player->SetBattlegroundOrBattlefieldRaid(group, subgroup);
player->SetBattlegroundOrBattlefieldRaid(group, subgroup);
}
else
{
@@ -1215,39 +1215,39 @@ uint32 Battleground::GetFreeSlotsForTeam(TeamId teamId) const
uint32 Battleground::GetMaxFreeSlots() const
{
return std::max<uint32>(GetFreeSlotsForTeam(TEAM_ALLIANCE), GetFreeSlotsForTeam(TEAM_HORDE));
return std::max<uint32>(GetFreeSlotsForTeam(TEAM_ALLIANCE), GetFreeSlotsForTeam(TEAM_HORDE));
}
bool Battleground::HasFreeSlots() const
{
if (GetStatus() != STATUS_WAIT_JOIN && GetStatus() != STATUS_IN_PROGRESS)
return false;
for (uint8 i=0; i<BG_TEAMS_COUNT; ++i)
if (GetFreeSlotsForTeam((TeamId)i) > 0)
return true;
return false;
if (GetStatus() != STATUS_WAIT_JOIN && GetStatus() != STATUS_IN_PROGRESS)
return false;
for (uint8 i=0; i<BG_TEAMS_COUNT; ++i)
if (GetFreeSlotsForTeam((TeamId)i) > 0)
return true;
return false;
}
void Battleground::SpectatorsSendPacket(WorldPacket& data)
{
for (SpectatorList::const_iterator itr = m_Spectators.begin(); itr != m_Spectators.end(); ++itr)
(*itr)->GetSession()->SendPacket(&data);
for (SpectatorList::const_iterator itr = m_Spectators.begin(); itr != m_Spectators.end(); ++itr)
(*itr)->GetSession()->SendPacket(&data);
}
void Battleground::ReadyMarkerClicked(Player* p)
{
if (!isArena() || GetStatus() >= STATUS_IN_PROGRESS || GetStartDelayTime() <= BG_START_DELAY_15S || (m_Events & BG_STARTING_EVENT_3) || p->IsSpectator())
return;
readyMarkerClickedSet.insert(p->GetGUIDLow());
uint32 count = readyMarkerClickedSet.size();
uint32 req = GetArenaType()*2;
p->GetSession()->SendNotification("You are marked as ready %u/%u", count, req);
if (count == req)
{
m_Events |= BG_STARTING_EVENT_2;
m_StartTime += GetStartDelayTime()-BG_START_DELAY_15S;
SetStartDelayTime(BG_START_DELAY_15S);
}
if (!isArena() || GetStatus() >= STATUS_IN_PROGRESS || GetStartDelayTime() <= BG_START_DELAY_15S || (m_Events & BG_STARTING_EVENT_3) || p->IsSpectator())
return;
readyMarkerClickedSet.insert(p->GetGUIDLow());
uint32 count = readyMarkerClickedSet.size();
uint32 req = GetArenaType()*2;
p->GetSession()->SendNotification("You are marked as ready %u/%u", count, req);
if (count == req)
{
m_Events |= BG_STARTING_EVENT_2;
m_StartTime += GetStartDelayTime()-BG_START_DELAY_15S;
SetStartDelayTime(BG_START_DELAY_15S);
}
}
void Battleground::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
@@ -1486,10 +1486,10 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, float x, float y,
if (transport)
{
transport->CalculatePassengerPosition(x, y, z, &o);
if (Creature* creature = transport->SummonCreature(entry, x, y, z, o, TEMPSUMMON_MANUAL_DESPAWN))
transport->CalculatePassengerPosition(x, y, z, &o);
if (Creature* creature = transport->SummonCreature(entry, x, y, z, o, TEMPSUMMON_MANUAL_DESPAWN))
{
transport->AddPassenger(creature, true);
transport->AddPassenger(creature, true);
BgCreatures[type] = creature->GetGUID();
return creature;
}
@@ -1531,9 +1531,9 @@ Creature* Battleground::AddCreature(uint32 entry, uint32 type, float x, float y,
if (respawntime)
creature->SetRespawnDelay(respawntime);
// Xinef: Set PVP state for vehicles, should be for all creatures in bg?
if (creature->IsVehicle())
creature->SetPvP(true);
// Xinef: Set PVP state for vehicles, should be for all creatures in bg?
if (creature->IsVehicle())
creature->SetPvP(true);
return creature;
}
@@ -1670,9 +1670,9 @@ char const* Battleground::GetTrinityString(int32 entry)
void Battleground::HandleTriggerBuff(GameObject* gameObject)
{
// Xinef: crash fix?
if (GetStatus() != STATUS_IN_PROGRESS || !GetPlayersSize() || BgObjects.empty())
return;
// Xinef: crash fix?
if (GetStatus() != STATUS_IN_PROGRESS || !GetPlayersSize() || BgObjects.empty())
return;
uint32 index = 0;
for (; index < BgObjects.size() && BgObjects[index] != gameObject->GetGUID(); ++index);
@@ -1680,19 +1680,19 @@ void Battleground::HandleTriggerBuff(GameObject* gameObject)
return;
if (m_BuffChange)
{
uint8 buff = urand(0, 2);
if (gameObject->GetEntry() != Buff_Entries[buff])
{
SpawnBGObject(index, RESPAWN_ONE_DAY);
for (uint8 currBuffTypeIndex = 0; currBuffTypeIndex < 3; ++currBuffTypeIndex)
if (gameObject->GetEntry() == Buff_Entries[currBuffTypeIndex])
{
index -= currBuffTypeIndex;
index += buff;
}
}
}
{
uint8 buff = urand(0, 2);
if (gameObject->GetEntry() != Buff_Entries[buff])
{
SpawnBGObject(index, RESPAWN_ONE_DAY);
for (uint8 currBuffTypeIndex = 0; currBuffTypeIndex < 3; ++currBuffTypeIndex)
if (gameObject->GetEntry() == Buff_Entries[currBuffTypeIndex])
{
index -= currBuffTypeIndex;
index += buff;
}
}
}
SpawnBGObject(index, BUFF_RESPAWN_TIME);
}
@@ -1734,7 +1734,7 @@ void Battleground::HandleKillPlayer(Player* victim, Player* killer)
TeamId Battleground::GetOtherTeamId(TeamId teamId)
{
return teamId != TEAM_NEUTRAL ? (teamId == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE) : TEAM_NEUTRAL;
return teamId != TEAM_NEUTRAL ? (teamId == TEAM_ALLIANCE ? TEAM_HORDE : TEAM_ALLIANCE) : TEAM_NEUTRAL;
}
bool Battleground::IsPlayerInBattleground(uint64 guid) const
+37 -37
View File
@@ -75,7 +75,7 @@ enum BattlegroundMarks
SPELL_AV_MARK_WINNER = 24955,
SPELL_SA_MARK_WINNER = 61160,
SPELL_SA_MARK_LOSER = 61159,
SPELL_WG_MARK_WINNER = 56902,
SPELL_WG_MARK_WINNER = 56902,
ITEM_AV_MARK_OF_HONOR = 20560,
ITEM_WS_MARK_OF_HONOR = 20558,
ITEM_AB_MARK_OF_HONOR = 20559,
@@ -171,7 +171,7 @@ enum BattlegroundStatus
enum BattlegroundTeams
{
BG_TEAMS_COUNT = 2
BG_TEAMS_COUNT = 2
};
struct BattlegroundObjectInfo
@@ -256,30 +256,30 @@ struct BattlegroundScore
uint32 BonusHonor;
uint32 DamageDone;
uint32 HealingDone;
Player* player;
Player* player;
};
class ArenaLogEntryData
{
public:
ArenaLogEntryData() : Guid(0), ArenaTeamId(0), DamageDone(0), HealingDone(0), KillingBlows(0) {}
void Fill(const char* name, uint32 guid, uint32 acc, uint32 arenaTeamId, std::string ip)
{
Name = std::string(name);
Guid = guid;
Acc = acc;
ArenaTeamId = arenaTeamId;
IP = ip;
}
public:
ArenaLogEntryData() : Guid(0), ArenaTeamId(0), DamageDone(0), HealingDone(0), KillingBlows(0) {}
void Fill(const char* name, uint32 guid, uint32 acc, uint32 arenaTeamId, std::string ip)
{
Name = std::string(name);
Guid = guid;
Acc = acc;
ArenaTeamId = arenaTeamId;
IP = ip;
}
std::string Name;
uint32 Guid;
uint32 Acc;
uint32 ArenaTeamId;
std::string IP;
uint32 DamageDone;
uint32 HealingDone;
uint32 KillingBlows;
std::string Name;
uint32 Guid;
uint32 Acc;
uint32 ArenaTeamId;
std::string IP;
uint32 DamageDone;
uint32 HealingDone;
uint32 KillingBlows;
};
enum BGHonorMode
@@ -368,23 +368,23 @@ class Battleground
void SetMaxPlayersPerTeam(uint32 MaxPlayers) { m_MaxPlayersPerTeam = MaxPlayers; }
void SetMinPlayersPerTeam(uint32 MinPlayers) { m_MinPlayersPerTeam = MinPlayers; }
void DecreaseInvitedCount(TeamId teamId) { ASSERT(m_BgInvitedPlayers[teamId] > 0); --m_BgInvitedPlayers[teamId]; }
void IncreaseInvitedCount(TeamId teamId) { ++m_BgInvitedPlayers[teamId]; }
uint32 GetInvitedCount(TeamId teamId) const { return m_BgInvitedPlayers[teamId]; }
void DecreaseInvitedCount(TeamId teamId) { ASSERT(m_BgInvitedPlayers[teamId] > 0); --m_BgInvitedPlayers[teamId]; }
void IncreaseInvitedCount(TeamId teamId) { ++m_BgInvitedPlayers[teamId]; }
uint32 GetInvitedCount(TeamId teamId) const { return m_BgInvitedPlayers[teamId]; }
bool HasFreeSlots() const;
uint32 GetFreeSlotsForTeam(TeamId teamId) const;
uint32 GetMaxFreeSlots() const;
uint32 GetMaxFreeSlots() const;
typedef std::set<Player*> SpectatorList;
typedef std::map<uint64, uint64> ToBeTeleportedMap;
typedef std::map<uint64, uint64> ToBeTeleportedMap;
void AddSpectator(Player* p) { m_Spectators.insert(p); }
void RemoveSpectator(Player* p) { m_Spectators.erase(p); }
bool HaveSpectators() { return !m_Spectators.empty(); }
const SpectatorList& GetSpectators() const { return m_Spectators; }
void AddToBeTeleported(uint64 spectator, uint64 participant) { m_ToBeTeleported[spectator] = participant; }
void RemoveToBeTeleported(uint64 spectator) { ToBeTeleportedMap::iterator itr = m_ToBeTeleported.find(spectator); if (itr != m_ToBeTeleported.end()) m_ToBeTeleported.erase(itr); }
void SpectatorsSendPacket(WorldPacket& data);
const SpectatorList& GetSpectators() const { return m_Spectators; }
void AddToBeTeleported(uint64 spectator, uint64 participant) { m_ToBeTeleported[spectator] = participant; }
void RemoveToBeTeleported(uint64 spectator) { ToBeTeleportedMap::iterator itr = m_ToBeTeleported.find(spectator); if (itr != m_ToBeTeleported.end()) m_ToBeTeleported.erase(itr); }
void SpectatorsSendPacket(WorldPacket& data);
bool isArena() const { return m_IsArena; }
bool isBattleground() const { return !m_IsArena; }
@@ -394,8 +394,8 @@ class Battleground
BattlegroundPlayerMap const& GetPlayers() const { return m_Players; }
uint32 GetPlayersSize() const { return m_Players.size(); }
void ReadyMarkerClicked(Player* p); // pussywizard
std::set<uint32> readyMarkerClickedSet; // pussywizard
void ReadyMarkerClicked(Player* p); // pussywizard
std::set<uint32> readyMarkerClickedSet; // pussywizard
typedef std::map<uint64, BattlegroundScore*> BattlegroundScoreMap;
typedef std::map<uint64, ArenaLogEntryData> ArenaLogEntryDataMap;// pussywizard
@@ -624,8 +624,8 @@ class Battleground
BGHonorMode m_HonorMode;
int32 m_TeamScores[BG_TEAMS_COUNT];
// pussywizard:
uint32 m_UpdateTimer;
// pussywizard:
uint32 m_UpdateTimer;
private:
// Battleground
BattlegroundTypeId m_RealTypeID;
@@ -684,13 +684,13 @@ class Battleground
// Invited counters are useful for player invitation to BG - do not allow, if BG is started to one faction to have 2 more players than another faction
// Invited counters will be changed only when removing already invited player from queue, removing player from battleground and inviting player to BG
// Invited players counters
uint32 m_BgInvitedPlayers[BG_TEAMS_COUNT];
uint32 m_BgInvitedPlayers[BG_TEAMS_COUNT];
// Raid Group
Group* m_BgRaids[BG_TEAMS_COUNT]; // 0 - alliance, 1 - horde
SpectatorList m_Spectators;
ToBeTeleportedMap m_ToBeTeleported;
SpectatorList m_Spectators;
ToBeTeleportedMap m_ToBeTeleported;
// Players count by team
uint32 m_PlayersCount[BG_TEAMS_COUNT];
@@ -54,8 +54,8 @@
BattlegroundMgr::BattlegroundMgr() : m_ArenaTesting(false), m_Testing(false),
m_lastClientVisibleInstanceId(0), m_NextAutoDistributionTime(0), m_NextPeriodicQueueUpdateTime(5*IN_MILLISECONDS), randomBgDifficultyEntry(999, 0, 80, 80, 0)
{
for (uint32 qtype = BATTLEGROUND_QUEUE_NONE; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype)
m_BattlegroundQueues[qtype].SetBgTypeIdAndArenaType(BGTemplateId(BattlegroundQueueTypeId(qtype)), BGArenaType(BattlegroundQueueTypeId(qtype)));
for (uint32 qtype = BATTLEGROUND_QUEUE_NONE; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype)
m_BattlegroundQueues[qtype].SetBgTypeIdAndArenaType(BGTemplateId(BattlegroundQueueTypeId(qtype)), BGArenaType(BattlegroundQueueTypeId(qtype)));
}
BattlegroundMgr::~BattlegroundMgr()
@@ -65,19 +65,19 @@ BattlegroundMgr::~BattlegroundMgr()
void BattlegroundMgr::DeleteAllBattlegrounds()
{
while (!m_Battlegrounds.empty())
delete m_Battlegrounds.begin()->second;
m_Battlegrounds.clear();
while (!m_Battlegrounds.empty())
delete m_Battlegrounds.begin()->second;
m_Battlegrounds.clear();
while (!m_BattlegroundTemplates.empty())
delete m_BattlegroundTemplates.begin()->second;
m_BattlegroundTemplates.clear();
while (!m_BattlegroundTemplates.empty())
delete m_BattlegroundTemplates.begin()->second;
m_BattlegroundTemplates.clear();
}
// used to update running battlegrounds, and delete finished ones
void BattlegroundMgr::Update(uint32 diff)
{
// update all battlegrounds and delete if needed
// update all battlegrounds and delete if needed
for (BattlegroundContainer::iterator itr = m_Battlegrounds.begin(), itrDelete; itr != m_Battlegrounds.end(); )
{
itrDelete = itr++;
@@ -91,8 +91,8 @@ void BattlegroundMgr::Update(uint32 diff)
}
}
// update to change current bg type the random system is trying to create
RandomSystem.Update(diff);
// update to change current bg type the random system is trying to create
RandomSystem.Update(diff);
// update events
for (int qtype = BATTLEGROUND_QUEUE_NONE; qtype < MAX_BATTLEGROUND_QUEUE_TYPES; ++qtype)
@@ -120,19 +120,19 @@ void BattlegroundMgr::Update(uint32 diff)
for (uint32 bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
m_BattlegroundQueues[qtype].BattlegroundQueueUpdate(BattlegroundBracketId(bracket), 0x03, true, 0); // pussywizard: 0 for rated means looking for opponents for every team
// for battlegrounds and not rated arenas
// in first loop try to fill already running battlegrounds, then in a second loop try to create new battlegrounds
for (uint8 action = 1; action <= 2; ++action)
for (uint32 qtype = BATTLEGROUND_QUEUE_AV; qtype <= BATTLEGROUND_QUEUE_5v5; ++qtype)
for (uint32 bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
m_BattlegroundQueues[qtype].BattlegroundQueueUpdate(BattlegroundBracketId(bracket), action, false, 0);
// for battlegrounds and not rated arenas
// in first loop try to fill already running battlegrounds, then in a second loop try to create new battlegrounds
for (uint8 action = 1; action <= 2; ++action)
for (uint32 qtype = BATTLEGROUND_QUEUE_AV; qtype <= BATTLEGROUND_QUEUE_5v5; ++qtype)
for (uint32 bracket = BG_BRACKET_ID_FIRST; bracket < MAX_BATTLEGROUND_BRACKETS; ++bracket)
m_BattlegroundQueues[qtype].BattlegroundQueueUpdate(BattlegroundBracketId(bracket), action, false, 0);
m_NextPeriodicQueueUpdateTime = 5*IN_MILLISECONDS;
}
else
m_NextPeriodicQueueUpdateTime -= diff;
// arena points auto-distribution
// arena points auto-distribution
if (sWorld->getBoolConfig(CONFIG_ARENA_AUTO_DISTRIBUTE_POINTS))
{
if (sWorld->GetGameTime() > m_NextAutoDistributionTime)
@@ -146,8 +146,8 @@ void BattlegroundMgr::Update(uint32 diff)
void BattlegroundMgr::BuildBattlegroundStatusPacket(WorldPacket* data, Battleground* bg, uint8 QueueSlot, uint8 StatusID, uint32 Time1, uint32 Time2, uint8 arenatype, TeamId teamId, bool isRated, BattlegroundTypeId forceBgTypeId)
{
// pussywizard:
ASSERT(QueueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES);
// pussywizard:
ASSERT(QueueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES);
if (StatusID == STATUS_NONE || !bg)
{
@@ -209,7 +209,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
for (TeamId iTeamId = TEAM_ALLIANCE; iTeamId <= TEAM_HORDE; iTeamId = TeamId(iTeamId+1))
{
// Xinef: oryginally this was looping in reverse order, loop order was changed so we have to change checked teamId
int32 rating_change = bg->GetArenaTeamRatingChangeForTeam(Battleground::GetOtherTeamId(iTeamId));
int32 rating_change = bg->GetArenaTeamRatingChangeForTeam(Battleground::GetOtherTeamId(iTeamId));
uint32 pointsLost = rating_change < 0 ? -rating_change : 0;
uint32 pointsGained = rating_change > 0 ? rating_change : 0;
@@ -233,7 +233,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
else
{
*data << uint8(1); // bg ended
*data << uint8(bg->GetWinner()); // who win
*data << uint8(bg->GetWinner()); // who win
}
size_t wpos = data->wpos();
@@ -304,7 +304,7 @@ void BattlegroundMgr::BuildPvpLogDataPacket(WorldPacket* data, Battleground* bg)
*data << uint32(0);
break;
}
break;
break;
case BATTLEGROUND_AV:
*data << uint32(0x00000005); // count of next fields
*data << uint32(((BattlegroundAVScore*)itr2->second)->GraveyardsAssaulted); // GraveyardsAssaulted
@@ -422,12 +422,12 @@ uint32 BattlegroundMgr::GetNextClientVisibleInstanceId()
// create a new battleground that will really be used to play
Battleground* BattlegroundMgr::CreateNewBattleground(BattlegroundTypeId bgTypeId, uint32 minLevel, uint32 maxLevel, uint8 arenaType, bool isRated)
{
// pussywizard: random battleground is chosen before calling this function!
ASSERT(bgTypeId != BATTLEGROUND_RB);
// pussywizard: random battleground is chosen before calling this function!
ASSERT(bgTypeId != BATTLEGROUND_RB);
// pussywizard: randomize for all arena
if (bgTypeId == BATTLEGROUND_AA)
bgTypeId = RAND<BattlegroundTypeId>(BATTLEGROUND_NA, BATTLEGROUND_BE, BATTLEGROUND_RL, BATTLEGROUND_DS, BATTLEGROUND_RV);
// pussywizard: randomize for all arena
if (bgTypeId == BATTLEGROUND_AA)
bgTypeId = RAND<BattlegroundTypeId>(BATTLEGROUND_NA, BATTLEGROUND_BE, BATTLEGROUND_RL, BATTLEGROUND_DS, BATTLEGROUND_RV);
// get the template BG
Battleground* bg_template = GetBattlegroundTemplate(bgTypeId);
@@ -599,7 +599,7 @@ void BattlegroundMgr::CreateInitialBattlegrounds()
uint32 bgTypeId = fields[0].GetUInt32();
// pussywizard: currently not supported
// pussywizard: currently not supported
//if (DisableMgr::IsDisabledFor(DISABLE_TYPE_BATTLEGROUND, bgTypeId, NULL))
// continue;
@@ -889,8 +889,8 @@ void BattlegroundMgr::SetHolidayWeekends(uint32 mask)
{
for (uint32 bgtype = 1; bgtype < MAX_BATTLEGROUND_TYPE_ID; ++bgtype)
{
if (bgtype == BATTLEGROUND_RB)
continue;
if (bgtype == BATTLEGROUND_RB)
continue;
if (Battleground* bgt = GetBattlegroundTemplate(BattlegroundTypeId(bgtype)))
bgt->SetHoliday(mask & (1 << bgtype));
}
@@ -1013,39 +1013,39 @@ bool BattlegroundMgr::IsBGWeekend(BattlegroundTypeId bgTypeId)
void BattlegroundMgr::AddBattleground(Battleground* bg)
{
if (bg->GetInstanceID() == 0)
m_BattlegroundTemplates[bg->GetBgTypeID()] = bg;
else
m_Battlegrounds[bg->GetInstanceID()] = bg;
if (bg->GetInstanceID() == 0)
m_BattlegroundTemplates[bg->GetBgTypeID()] = bg;
else
m_Battlegrounds[bg->GetInstanceID()] = bg;
}
void BattlegroundMgr::RemoveBattleground(BattlegroundTypeId bgTypeId, uint32 instanceId)
{
if (instanceId == 0)
m_BattlegroundTemplates.erase(bgTypeId);
else
m_Battlegrounds.erase(instanceId);
if (instanceId == 0)
m_BattlegroundTemplates.erase(bgTypeId);
else
m_Battlegrounds.erase(instanceId);
}
void BattlegroundMgr::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, TeamId teamId)
{
ASSERT(!ginfo->IsInvitedToBGInstanceGUID);
ASSERT(!ginfo->IsInvitedToBGInstanceGUID);
// set side if needed
if (teamId != TEAM_NEUTRAL)
ginfo->teamId = teamId;
// set side if needed
if (teamId != TEAM_NEUTRAL)
ginfo->teamId = teamId;
// set invitation
ginfo->IsInvitedToBGInstanceGUID = bg->GetInstanceID();
// set invitation
ginfo->IsInvitedToBGInstanceGUID = bg->GetInstanceID();
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(ginfo->BgTypeId, ginfo->ArenaType);
BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
BattlegroundQueueTypeId bgQueueTypeId = BattlegroundMgr::BGQueueTypeId(ginfo->BgTypeId, ginfo->ArenaType);
BattlegroundQueue& bgQueue = sBattlegroundMgr->GetBattlegroundQueue(bgQueueTypeId);
// set ArenaTeamId for rated matches
if (bg->isArena() && bg->isRated())
bg->SetArenaTeamIdForTeam(ginfo->teamId, ginfo->ArenaTeamId);
// set ArenaTeamId for rated matches
if (bg->isArena() && bg->isRated())
bg->SetArenaTeamIdForTeam(ginfo->teamId, ginfo->ArenaTeamId);
ginfo->RemoveInviteTime = World::GetGameTimeMS() + INVITE_ACCEPT_WAIT_TIME;
ginfo->RemoveInviteTime = World::GetGameTimeMS() + INVITE_ACCEPT_WAIT_TIME;
// loop through the players
for (std::set<uint64>::iterator itr = ginfo->Players.begin(); itr != ginfo->Players.end(); ++itr)
@@ -1054,7 +1054,7 @@ void BattlegroundMgr::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, T
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(*itr);
// player is removed from queue when logging out
ASSERT(player);
ASSERT(player);
// update average wait time
bgQueue.PlayerInvitedToBGUpdateAverageWaitTime(ginfo);
@@ -1072,15 +1072,15 @@ void BattlegroundMgr::InviteGroupToBG(GroupQueueInfo* ginfo, Battleground* bg, T
WorldPacket data;
uint32 queueSlot = player->GetBattlegroundQueueIndex(bgQueueTypeId);
ASSERT(queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES);
ASSERT(queueSlot < PLAYER_MAX_BATTLEGROUND_QUEUES);
// send status packet
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType, TEAM_NEUTRAL, bg->isRated(), ginfo->BgTypeId);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_JOIN, INVITE_ACCEPT_WAIT_TIME, 0, ginfo->ArenaType, TEAM_NEUTRAL, bg->isRated(), ginfo->BgTypeId);
player->GetSession()->SendPacket(&data);
// pussywizard:
if (bg->isArena() && bg->isRated())
bg->ArenaLogEntries[player->GetGUID()].Fill(player->GetName().c_str(), player->GetGUIDLow(), player->GetSession()->GetAccountId(), ginfo->ArenaTeamId, player->GetSession()->GetRemoteAddress());
// pussywizard:
if (bg->isArena() && bg->isRated())
bg->ArenaLogEntries[player->GetGUID()].Fill(player->GetName().c_str(), player->GetGUIDLow(), player->GetSession()->GetAccountId(), ginfo->ArenaTeamId, player->GetSession()->GetRemoteAddress());
}
}
@@ -1090,52 +1090,52 @@ RandomBattlegroundSystem::RandomBattlegroundSystem() : m_CurrentRandomBg(BATTLEG
void RandomBattlegroundSystem::Update(uint32 diff)
{
if (m_SwitchTimer <= diff)
{
if (m_BgOrder.empty())
{
// order it like: big, small, big, small, small, small (stored backwards, actually)
if (m_SwitchTimer <= diff)
{
if (m_BgOrder.empty())
{
// order it like: big, small, big, small, small, small (stored backwards, actually)
std::vector<BattlegroundTypeId> big, small;
big.push_back(BATTLEGROUND_AV);
big.push_back(BATTLEGROUND_IC);
small.push_back(BATTLEGROUND_WS);
small.push_back(BATTLEGROUND_EY);
small.push_back(BATTLEGROUND_AB);
small.push_back(BATTLEGROUND_SA);
std::vector<BattlegroundTypeId> big, small;
big.push_back(BATTLEGROUND_AV);
big.push_back(BATTLEGROUND_IC);
small.push_back(BATTLEGROUND_WS);
small.push_back(BATTLEGROUND_EY);
small.push_back(BATTLEGROUND_AB);
small.push_back(BATTLEGROUND_SA);
std::random_shuffle(big.begin(), big.end());
std::random_shuffle(small.begin(), small.end());
std::random_shuffle(big.begin(), big.end());
std::random_shuffle(small.begin(), small.end());
m_BgOrder.push_back(small.back()); small.pop_back();
m_BgOrder.push_back(small.back()); small.pop_back();
m_BgOrder.push_back(small.back()); small.pop_back();
m_BgOrder.push_back(big.back()); big.pop_back();
m_BgOrder.push_back(small.back()); small.pop_back();
m_BgOrder.push_back(big.back()); big.pop_back();
}
m_BgOrder.push_back(small.back()); small.pop_back();
m_BgOrder.push_back(small.back()); small.pop_back();
m_BgOrder.push_back(small.back()); small.pop_back();
m_BgOrder.push_back(big.back()); big.pop_back();
m_BgOrder.push_back(small.back()); small.pop_back();
m_BgOrder.push_back(big.back()); big.pop_back();
}
m_CurrentRandomBg = m_BgOrder.back();
m_BgOrder.pop_back();
m_CurrentRandomBg = m_BgOrder.back();
m_BgOrder.pop_back();
switch (m_CurrentRandomBg)
{
case BATTLEGROUND_AV: m_SwitchTimer = 180*IN_MILLISECONDS; break; // max 40 per team
case BATTLEGROUND_WS: m_SwitchTimer = 30*IN_MILLISECONDS; break; // max 10 per team
case BATTLEGROUND_IC: m_SwitchTimer = 180*IN_MILLISECONDS; break; // max 40 per team
case BATTLEGROUND_EY: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team
case BATTLEGROUND_AB: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team
case BATTLEGROUND_SA: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team
default: ASSERT(false); break;
}
}
else
m_SwitchTimer -= diff;
switch (m_CurrentRandomBg)
{
case BATTLEGROUND_AV: m_SwitchTimer = 180*IN_MILLISECONDS; break; // max 40 per team
case BATTLEGROUND_WS: m_SwitchTimer = 30*IN_MILLISECONDS; break; // max 10 per team
case BATTLEGROUND_IC: m_SwitchTimer = 180*IN_MILLISECONDS; break; // max 40 per team
case BATTLEGROUND_EY: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team
case BATTLEGROUND_AB: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team
case BATTLEGROUND_SA: m_SwitchTimer = 40*IN_MILLISECONDS; break; // max 15 per team
default: ASSERT(false); break;
}
}
else
m_SwitchTimer -= diff;
}
void RandomBattlegroundSystem::BattlegroundCreated(BattlegroundTypeId bgTypeId)
{
// if created current random bg, set current to another one
if (bgTypeId == m_CurrentRandomBg)
Update(0xffffffff);
// if created current random bg, set current to another one
if (bgTypeId == m_CurrentRandomBg)
Update(0xffffffff);
}
+14 -14
View File
@@ -58,15 +58,15 @@ struct GroupQueueInfo;
// pussywizard
class RandomBattlegroundSystem
{
public:
RandomBattlegroundSystem();
void Update(uint32 diff);
BattlegroundTypeId GetCurrentRandomBg() const { return m_CurrentRandomBg; }
void BattlegroundCreated(BattlegroundTypeId bgTypeId);
private:
BattlegroundTypeId m_CurrentRandomBg;
uint32 m_SwitchTimer;
std::vector<BattlegroundTypeId> m_BgOrder;
public:
RandomBattlegroundSystem();
void Update(uint32 diff);
BattlegroundTypeId GetCurrentRandomBg() const { return m_CurrentRandomBg; }
void BattlegroundCreated(BattlegroundTypeId bgTypeId);
private:
BattlegroundTypeId m_CurrentRandomBg;
uint32 m_SwitchTimer;
std::vector<BattlegroundTypeId> m_BgOrder;
};
class BattlegroundMgr
@@ -142,22 +142,22 @@ class BattlegroundMgr
return BATTLEGROUND_TYPE_NONE;
}
const BattlegroundContainer& GetBattlegroundList() { return m_Battlegrounds; } // pussywizard
RandomBattlegroundSystem RandomSystem; // pussywizard
const BattlegroundContainer& GetBattlegroundList() { return m_Battlegrounds; } // pussywizard
RandomBattlegroundSystem RandomSystem; // pussywizard
private:
bool CreateBattleground(CreateBattlegroundData& data);
uint32 GetNextClientVisibleInstanceId();
typedef std::map<BattlegroundTypeId, Battleground*> BattlegroundTemplateContainer;
BattlegroundTemplateContainer m_BattlegroundTemplates;
BattlegroundTemplateContainer m_BattlegroundTemplates;
BattlegroundContainer m_Battlegrounds;
BattlegroundQueue m_BattlegroundQueues[MAX_BATTLEGROUND_QUEUE_TYPES];
std::vector<uint64> m_ArenaQueueUpdateScheduler;
uint32 m_lastClientVisibleInstanceId;
uint32 m_NextPeriodicQueueUpdateTime;
uint32 m_lastClientVisibleInstanceId;
uint32 m_NextPeriodicQueueUpdateTime;
time_t m_NextAutoDistributionTime;
bool m_ArenaTesting;
bool m_Testing;
File diff suppressed because it is too large Load Diff
@@ -44,9 +44,9 @@ struct GroupQueueInfo // stores informatio
uint32 OpponentsTeamRating; // for rated arena matches
uint32 OpponentsMatchmakerRating; // for rated arena matches
// pussywizard: for internal use
uint8 _bracketId;
uint8 _groupType;
// pussywizard: for internal use
uint8 _bracketId;
uint8 _groupType;
};
enum BattlegroundQueueGroupTypes
@@ -81,8 +81,8 @@ class BattlegroundQueue
void PlayerInvitedToBGUpdateAverageWaitTime(GroupQueueInfo* ginfo);
uint32 GetAverageQueueWaitTime(GroupQueueInfo* ginfo) const;
void SetBgTypeIdAndArenaType(BattlegroundTypeId b, uint8 a) { m_bgTypeId = b; m_arenaType = ArenaType(a); } // pussywizard
void AddEvent(BasicEvent* Event, uint64 e_time);
void SetBgTypeIdAndArenaType(BattlegroundTypeId b, uint8 a) { m_bgTypeId = b; m_arenaType = ArenaType(a); } // pussywizard
void AddEvent(BasicEvent* Event, uint64 e_time);
typedef std::map<uint64, GroupQueueInfo*> QueuedPlayersMap;
QueuedPlayersMap m_QueuedPlayers;
@@ -104,24 +104,24 @@ class BattlegroundQueue
// class to select and invite groups to bg
class SelectionPool
{
public:
SelectionPool(): PlayerCount(0) {};
void Init();
bool AddGroup(GroupQueueInfo* ginfo, uint32 desiredCount);
bool KickGroup(const uint32 size);
uint32 GetPlayerCount() const {return PlayerCount;}
public:
GroupsQueueType SelectedGroups;
private:
uint32 PlayerCount;
public:
SelectionPool(): PlayerCount(0) {};
void Init();
bool AddGroup(GroupQueueInfo* ginfo, uint32 desiredCount);
bool KickGroup(const uint32 size);
uint32 GetPlayerCount() const {return PlayerCount;}
public:
GroupsQueueType SelectedGroups;
private:
uint32 PlayerCount;
};
//one selection pool for horde, other one for alliance
SelectionPool m_SelectionPools[BG_TEAMS_COUNT];
private:
BattlegroundTypeId m_bgTypeId;
ArenaType m_arenaType;
BattlegroundTypeId m_bgTypeId;
ArenaType m_arenaType;
uint32 m_WaitTimes[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS][COUNT_OF_PLAYERS_TO_AVERAGE_WAIT_TIME];
uint32 m_WaitTimeLastIndex[BG_TEAMS_COUNT][MAX_BATTLEGROUND_BRACKETS];
@@ -20,12 +20,12 @@ BattlegroundAB::BattlegroundAB()
BgObjects.resize(BG_AB_OBJECT_MAX);
BgCreatures.resize(BG_AB_ALL_NODES_COUNT + BG_AB_DYNAMIC_NODES_COUNT); // xinef: +BG_AB_DYNAMIC_NODES_COUNT buff triggers
_controlledPoints[TEAM_ALLIANCE] = 0;
_controlledPoints[TEAM_HORDE] = 0;
_controlledPoints[TEAM_ALLIANCE] = 0;
_controlledPoints[TEAM_HORDE] = 0;
_teamScores500Disadvantage[TEAM_ALLIANCE] = false;
_teamScores500Disadvantage[TEAM_HORDE] = false;
_honorTics = 0;
_reputationTics = 0;
_teamScores500Disadvantage[TEAM_HORDE] = false;
_honorTics = 0;
_reputationTics = 0;
StartMessageIds[BG_STARTING_EVENT_FIRST] = LANG_BG_AB_START_TWO_MINUTES;
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_AB_START_ONE_MINUTE;
@@ -41,77 +41,77 @@ void BattlegroundAB::PostUpdateImpl(uint32 diff)
{
if (GetStatus() == STATUS_IN_PROGRESS)
{
_bgEvents.Update(diff);
while (uint32 eventId =_bgEvents.ExecuteEvent())
switch (eventId)
{
case BG_AB_EVENT_UPDATE_BANNER_STABLE:
case BG_AB_EVENT_UPDATE_BANNER_FARM:
case BG_AB_EVENT_UPDATE_BANNER_BLACKSMITH:
case BG_AB_EVENT_UPDATE_BANNER_LUMBERMILL:
case BG_AB_EVENT_UPDATE_BANNER_GOLDMINE:
CreateBanner(eventId - BG_AB_EVENT_UPDATE_BANNER_STABLE, false);
break;
case BG_AB_EVENT_CAPTURE_STABLE:
case BG_AB_EVENT_CAPTURE_FARM:
case BG_AB_EVENT_CAPTURE_BLACKSMITH:
case BG_AB_EVENT_CAPTURE_LUMBERMILL:
case BG_AB_EVENT_CAPTURE_GOLDMINE:
{
uint8 node = eventId - BG_AB_EVENT_CAPTURE_STABLE;
TeamId teamId = _capturePointInfo[node]._state == BG_AB_NODE_STATE_ALLY_CONTESTED ? TEAM_ALLIANCE : TEAM_HORDE;
DeleteBanner(node);
_capturePointInfo[node]._ownerTeamId = teamId;
_capturePointInfo[node]._state = teamId == TEAM_ALLIANCE ? BG_AB_NODE_STATE_ALLY_OCCUPIED : BG_AB_NODE_STATE_HORDE_OCCUPIED;
_capturePointInfo[node]._captured = true;
_bgEvents.Update(diff);
while (uint32 eventId =_bgEvents.ExecuteEvent())
switch (eventId)
{
case BG_AB_EVENT_UPDATE_BANNER_STABLE:
case BG_AB_EVENT_UPDATE_BANNER_FARM:
case BG_AB_EVENT_UPDATE_BANNER_BLACKSMITH:
case BG_AB_EVENT_UPDATE_BANNER_LUMBERMILL:
case BG_AB_EVENT_UPDATE_BANNER_GOLDMINE:
CreateBanner(eventId - BG_AB_EVENT_UPDATE_BANNER_STABLE, false);
break;
case BG_AB_EVENT_CAPTURE_STABLE:
case BG_AB_EVENT_CAPTURE_FARM:
case BG_AB_EVENT_CAPTURE_BLACKSMITH:
case BG_AB_EVENT_CAPTURE_LUMBERMILL:
case BG_AB_EVENT_CAPTURE_GOLDMINE:
{
uint8 node = eventId - BG_AB_EVENT_CAPTURE_STABLE;
TeamId teamId = _capturePointInfo[node]._state == BG_AB_NODE_STATE_ALLY_CONTESTED ? TEAM_ALLIANCE : TEAM_HORDE;
DeleteBanner(node);
_capturePointInfo[node]._ownerTeamId = teamId;
_capturePointInfo[node]._state = teamId == TEAM_ALLIANCE ? BG_AB_NODE_STATE_ALLY_OCCUPIED : BG_AB_NODE_STATE_HORDE_OCCUPIED;
_capturePointInfo[node]._captured = true;
CreateBanner(node, false);
NodeOccupied(node);
SendNodeUpdate(node);
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, teamId == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, NULL, teamId == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE, LANG_BG_AB_NODE_STABLES + node);
PlaySoundToAll(teamId == TEAM_ALLIANCE ? BG_AB_SOUND_NODE_CAPTURED_ALLIANCE : BG_AB_SOUND_NODE_CAPTURED_HORDE);
break;
}
case BG_AB_EVENT_ALLIANCE_TICK:
case BG_AB_EVENT_HORDE_TICK:
{
TeamId teamId = TeamId(eventId - BG_AB_EVENT_ALLIANCE_TICK);
uint8 controlledPoints = _controlledPoints[teamId];
if (controlledPoints == 0)
{
_bgEvents.ScheduleEvent(eventId, 3000);
break;
}
SendMessage2ToAll(LANG_BG_AB_NODE_TAKEN, teamId == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, NULL, teamId == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE, LANG_BG_AB_NODE_STABLES + node);
PlaySoundToAll(teamId == TEAM_ALLIANCE ? BG_AB_SOUND_NODE_CAPTURED_ALLIANCE : BG_AB_SOUND_NODE_CAPTURED_HORDE);
break;
}
case BG_AB_EVENT_ALLIANCE_TICK:
case BG_AB_EVENT_HORDE_TICK:
{
TeamId teamId = TeamId(eventId - BG_AB_EVENT_ALLIANCE_TICK);
uint8 controlledPoints = _controlledPoints[teamId];
if (controlledPoints == 0)
{
_bgEvents.ScheduleEvent(eventId, 3000);
break;
}
uint8 honorRewards = uint8(m_TeamScores[teamId] / _honorTics);
uint8 reputationRewards = uint8(m_TeamScores[teamId] / _reputationTics);
uint8 information = uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE);
m_TeamScores[teamId] += BG_AB_TickPoints[controlledPoints];
if (m_TeamScores[teamId] > BG_AB_MAX_TEAM_SCORE)
m_TeamScores[teamId] = BG_AB_MAX_TEAM_SCORE;
uint8 honorRewards = uint8(m_TeamScores[teamId] / _honorTics);
uint8 reputationRewards = uint8(m_TeamScores[teamId] / _reputationTics);
uint8 information = uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE);
m_TeamScores[teamId] += BG_AB_TickPoints[controlledPoints];
if (m_TeamScores[teamId] > BG_AB_MAX_TEAM_SCORE)
m_TeamScores[teamId] = BG_AB_MAX_TEAM_SCORE;
if (honorRewards < uint8(m_TeamScores[teamId] / _honorTics))
RewardHonorToTeam(GetBonusHonorFromKill(1), teamId);
if (reputationRewards < uint8(m_TeamScores[teamId] / _reputationTics))
RewardReputationToTeam(teamId == TEAM_ALLIANCE ? 509 : 510, 10, teamId);
if (information < uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE))
{
SendMessageToAll(teamId == TEAM_ALLIANCE ? LANG_BG_AB_A_NEAR_VICTORY : LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY);
}
if (honorRewards < uint8(m_TeamScores[teamId] / _honorTics))
RewardHonorToTeam(GetBonusHonorFromKill(1), teamId);
if (reputationRewards < uint8(m_TeamScores[teamId] / _reputationTics))
RewardReputationToTeam(teamId == TEAM_ALLIANCE ? 509 : 510, 10, teamId);
if (information < uint8(m_TeamScores[teamId] / BG_AB_WARNING_NEAR_VICTORY_SCORE))
{
SendMessageToAll(teamId == TEAM_ALLIANCE ? LANG_BG_AB_A_NEAR_VICTORY : LANG_BG_AB_H_NEAR_VICTORY, CHAT_MSG_BG_SYSTEM_NEUTRAL);
PlaySoundToAll(BG_AB_SOUND_NEAR_VICTORY);
}
UpdateWorldState(teamId == TEAM_ALLIANCE ? BG_AB_OP_RESOURCES_ALLY : BG_AB_OP_RESOURCES_HORDE, m_TeamScores[teamId]);
if (m_TeamScores[teamId] > m_TeamScores[GetOtherTeamId(teamId)] + 500)
_teamScores500Disadvantage[GetOtherTeamId(teamId)] = true;
if (m_TeamScores[teamId] >= BG_AB_MAX_TEAM_SCORE)
EndBattleground(teamId);
UpdateWorldState(teamId == TEAM_ALLIANCE ? BG_AB_OP_RESOURCES_ALLY : BG_AB_OP_RESOURCES_HORDE, m_TeamScores[teamId]);
if (m_TeamScores[teamId] > m_TeamScores[GetOtherTeamId(teamId)] + 500)
_teamScores500Disadvantage[GetOtherTeamId(teamId)] = true;
if (m_TeamScores[teamId] >= BG_AB_MAX_TEAM_SCORE)
EndBattleground(teamId);
_bgEvents.ScheduleEvent(eventId, BG_AB_TickIntervals[controlledPoints]);
break;
}
}
}
_bgEvents.ScheduleEvent(eventId, BG_AB_TickIntervals[controlledPoints]);
break;
}
}
}
}
void BattlegroundAB::StartingEventCloseDoors()
@@ -140,8 +140,8 @@ void BattlegroundAB::StartingEventOpenDoors()
DoorOpen(BG_AB_OBJECT_GATE_A);
DoorOpen(BG_AB_OBJECT_GATE_H);
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, BG_AB_EVENT_START_BATTLE);
_bgEvents.ScheduleEvent(BG_AB_EVENT_ALLIANCE_TICK, 3000);
_bgEvents.ScheduleEvent(BG_AB_EVENT_HORDE_TICK, 3000);
_bgEvents.ScheduleEvent(BG_AB_EVENT_ALLIANCE_TICK, 3000);
_bgEvents.ScheduleEvent(BG_AB_EVENT_HORDE_TICK, 3000);
}
void BattlegroundAB::AddPlayer(Player* player)
@@ -152,7 +152,7 @@ void BattlegroundAB::AddPlayer(Player* player)
void BattlegroundAB::RemovePlayer(Player* player)
{
player->SetPhaseMask(1, false);
player->SetPhaseMask(1, false);
}
void BattlegroundAB::HandleAreaTrigger(Player* player, uint32 trigger)
@@ -194,26 +194,26 @@ void BattlegroundAB::CreateBanner(uint8 node, bool delay)
return;
}
SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + _capturePointInfo[node]._state, RESPAWN_IMMEDIATELY);
SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + BG_AB_OBJECT_AURA_ALLY + _capturePointInfo[node]._ownerTeamId, RESPAWN_IMMEDIATELY);
SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + _capturePointInfo[node]._state, RESPAWN_IMMEDIATELY);
SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + BG_AB_OBJECT_AURA_ALLY + _capturePointInfo[node]._ownerTeamId, RESPAWN_IMMEDIATELY);
}
void BattlegroundAB::DeleteBanner(uint8 node)
{
SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + _capturePointInfo[node]._state, RESPAWN_ONE_DAY);
SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + BG_AB_OBJECT_AURA_ALLY + _capturePointInfo[node]._ownerTeamId, RESPAWN_ONE_DAY);
SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + _capturePointInfo[node]._state, RESPAWN_ONE_DAY);
SpawnBGObject(node*BG_AB_OBJECTS_PER_NODE + BG_AB_OBJECT_AURA_ALLY + _capturePointInfo[node]._ownerTeamId, RESPAWN_ONE_DAY);
}
void BattlegroundAB::FillInitialWorldStates(WorldPacket& data)
{
for (uint8 node = 0; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
{
if (_capturePointInfo[node]._state == BG_AB_NODE_STATE_NEUTRAL)
data << uint32(_capturePointInfo[node]._iconNone) << uint32(1);
{
if (_capturePointInfo[node]._state == BG_AB_NODE_STATE_NEUTRAL)
data << uint32(_capturePointInfo[node]._iconNone) << uint32(1);
for (uint8 i = BG_AB_NODE_STATE_ALLY_OCCUPIED; i <= BG_AB_NODE_STATE_HORDE_CONTESTED; ++i)
data << uint32(_capturePointInfo[node]._iconCapture + i-1) << uint32(_capturePointInfo[node]._state == i);
}
for (uint8 i = BG_AB_NODE_STATE_ALLY_OCCUPIED; i <= BG_AB_NODE_STATE_HORDE_CONTESTED; ++i)
data << uint32(_capturePointInfo[node]._iconCapture + i-1) << uint32(_capturePointInfo[node]._state == i);
}
data << uint32(BG_AB_OP_OCCUPIED_BASES_ALLY) << uint32(_controlledPoints[TEAM_ALLIANCE]);
data << uint32(BG_AB_OP_OCCUPIED_BASES_HORDE) << uint32(_controlledPoints[TEAM_HORDE]);
@@ -226,9 +226,9 @@ void BattlegroundAB::FillInitialWorldStates(WorldPacket& data)
void BattlegroundAB::SendNodeUpdate(uint8 node)
{
UpdateWorldState(_capturePointInfo[node]._iconNone, 0);
for (uint8 i = BG_AB_NODE_STATE_ALLY_OCCUPIED; i <= BG_AB_NODE_STATE_HORDE_CONTESTED; ++i)
UpdateWorldState(_capturePointInfo[node]._iconCapture + i-1, _capturePointInfo[node]._state == i);
UpdateWorldState(_capturePointInfo[node]._iconNone, 0);
for (uint8 i = BG_AB_NODE_STATE_ALLY_OCCUPIED; i <= BG_AB_NODE_STATE_HORDE_CONTESTED; ++i)
UpdateWorldState(_capturePointInfo[node]._iconCapture + i-1, _capturePointInfo[node]._state == i);
UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_ALLY, _controlledPoints[TEAM_ALLIANCE]);
UpdateWorldState(BG_AB_OP_OCCUPIED_BASES_HORDE, _controlledPoints[TEAM_HORDE]);
@@ -236,16 +236,16 @@ void BattlegroundAB::SendNodeUpdate(uint8 node)
void BattlegroundAB::NodeOccupied(uint8 node)
{
ApplyPhaseMask();
AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], _capturePointInfo[node]._ownerTeamId);
ApplyPhaseMask();
AddSpiritGuide(node, BG_AB_SpiritGuidePos[node][0], BG_AB_SpiritGuidePos[node][1], BG_AB_SpiritGuidePos[node][2], BG_AB_SpiritGuidePos[node][3], _capturePointInfo[node]._ownerTeamId);
++_controlledPoints[_capturePointInfo[node]._ownerTeamId];
++_controlledPoints[_capturePointInfo[node]._ownerTeamId];
if (_controlledPoints[_capturePointInfo[node]._ownerTeamId] >= 5)
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_5_BASES, _capturePointInfo[node]._ownerTeamId);
if (_controlledPoints[_capturePointInfo[node]._ownerTeamId] >= 4)
CastSpellOnTeam(SPELL_AB_QUEST_REWARD_4_BASES, _capturePointInfo[node]._ownerTeamId);
Creature* trigger = GetBgMap()->GetCreature(BgCreatures[BG_AB_ALL_NODES_COUNT + node]);
Creature* trigger = GetBgMap()->GetCreature(BgCreatures[BG_AB_ALL_NODES_COUNT + node]);
if (!trigger)
trigger = AddCreature(WORLD_TRIGGER, BG_AB_ALL_NODES_COUNT + node, BG_AB_NodePositions[node][0], BG_AB_NodePositions[node][1], BG_AB_NodePositions[node][2], BG_AB_NodePositions[node][3]);
@@ -258,10 +258,10 @@ void BattlegroundAB::NodeOccupied(uint8 node)
void BattlegroundAB::NodeDeoccupied(uint8 node)
{
--_controlledPoints[_capturePointInfo[node]._ownerTeamId];
--_controlledPoints[_capturePointInfo[node]._ownerTeamId];
_capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL;
RelocateDeadPlayers(BgCreatures[node]);
_capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL;
RelocateDeadPlayers(BgCreatures[node]);
DelCreature(node); // Delete spirit healer
DelCreature(BG_AB_ALL_NODES_COUNT + node); // Delete aura trigger
@@ -270,90 +270,90 @@ void BattlegroundAB::NodeDeoccupied(uint8 node)
void BattlegroundAB::EventPlayerClickedOnFlag(Player* player, GameObject* gameObject)
{
if (GetStatus() != STATUS_IN_PROGRESS || !player->IsWithinDistInMap(gameObject, 10.0f))
return;
return;
uint8 node = BG_AB_NODE_STABLES;
for (; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
if (player->GetDistance2d(BG_AB_NodePositions[node][0], BG_AB_NodePositions[node][1]) < 10.0f)
break;
for (; node < BG_AB_DYNAMIC_NODES_COUNT; ++node)
if (player->GetDistance2d(BG_AB_NodePositions[node][0], BG_AB_NodePositions[node][1]) < 10.0f)
break;
if (node == BG_AB_DYNAMIC_NODES_COUNT || _capturePointInfo[node]._ownerTeamId == player->GetTeamId() ||
(_capturePointInfo[node]._state == BG_AB_NODE_STATE_ALLY_CONTESTED && player->GetTeamId() == TEAM_ALLIANCE) ||
(_capturePointInfo[node]._state == BG_AB_NODE_STATE_HORDE_CONTESTED && player->GetTeamId() == TEAM_HORDE))
(_capturePointInfo[node]._state == BG_AB_NODE_STATE_ALLY_CONTESTED && player->GetTeamId() == TEAM_ALLIANCE) ||
(_capturePointInfo[node]._state == BG_AB_NODE_STATE_HORDE_CONTESTED && player->GetTeamId() == TEAM_HORDE))
return;
player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
uint32 sound = 0;
uint32 message = 0;
uint32 message2 = 0;
DeleteBanner(node);
uint32 message = 0;
uint32 message2 = 0;
DeleteBanner(node);
CreateBanner(node, true);
if (_capturePointInfo[node]._state == BG_AB_NODE_STATE_NEUTRAL)
if (_capturePointInfo[node]._state == BG_AB_NODE_STATE_NEUTRAL)
{
player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node, 0);
player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node, 0);
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
_capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_CONTESTED + player->GetTeamId();
_capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL;
_bgEvents.RescheduleEvent(BG_AB_EVENT_CAPTURE_STABLE + node, BG_AB_FLAG_CAPTURING_TIME);
_capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_CONTESTED + player->GetTeamId();
_capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL;
_bgEvents.RescheduleEvent(BG_AB_EVENT_CAPTURE_STABLE + node, BG_AB_FLAG_CAPTURING_TIME);
sound = BG_AB_SOUND_NODE_CLAIMED;
message = LANG_BG_AB_NODE_CLAIMED;
message2 = player->GetTeamId() == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE;
message = LANG_BG_AB_NODE_CLAIMED;
message2 = player->GetTeamId() == TEAM_ALLIANCE ? LANG_BG_AB_ALLY : LANG_BG_AB_HORDE;
}
else if (_capturePointInfo[node]._state == BG_AB_NODE_STATE_ALLY_CONTESTED || _capturePointInfo[node]._state == BG_AB_NODE_STATE_HORDE_CONTESTED)
{
if (!_capturePointInfo[node]._captured)
if (!_capturePointInfo[node]._captured)
{
player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node, 0);
player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node, 0);
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
_capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_CONTESTED + player->GetTeamId();
_capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL;
_bgEvents.RescheduleEvent(BG_AB_EVENT_CAPTURE_STABLE + node, BG_AB_FLAG_CAPTURING_TIME);
_capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_CONTESTED + player->GetTeamId();
_capturePointInfo[node]._ownerTeamId = TEAM_NEUTRAL;
_bgEvents.RescheduleEvent(BG_AB_EVENT_CAPTURE_STABLE + node, BG_AB_FLAG_CAPTURING_TIME);
message = LANG_BG_AB_NODE_ASSAULTED;
}
else
{
UpdatePlayerScore(player, SCORE_BASES_DEFENDED, 1);
_capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_OCCUPIED + player->GetTeamId();
_capturePointInfo[node]._ownerTeamId = player->GetTeamId();
_bgEvents.CancelEvent(BG_AB_EVENT_CAPTURE_STABLE + node);
_capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_OCCUPIED + player->GetTeamId();
_capturePointInfo[node]._ownerTeamId = player->GetTeamId();
_bgEvents.CancelEvent(BG_AB_EVENT_CAPTURE_STABLE + node);
NodeOccupied(node); // after setting team owner
message = LANG_BG_AB_NODE_DEFENDED;
}
sound = player->GetTeamId() == TEAM_ALLIANCE ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
sound = player->GetTeamId() == TEAM_ALLIANCE ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
}
else
{
player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node, 0);
player->KilledMonsterCredit(BG_AB_QUEST_CREDIT_BASE + node, 0);
UpdatePlayerScore(player, SCORE_BASES_ASSAULTED, 1);
NodeDeoccupied(node); // before setting team owner to neutral
_capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_CONTESTED + player->GetTeamId();
_capturePointInfo[node]._state = BG_AB_NODE_STATE_ALLY_CONTESTED + player->GetTeamId();
ApplyPhaseMask();
_bgEvents.RescheduleEvent(BG_AB_EVENT_CAPTURE_STABLE + node, BG_AB_FLAG_CAPTURING_TIME);
ApplyPhaseMask();
_bgEvents.RescheduleEvent(BG_AB_EVENT_CAPTURE_STABLE + node, BG_AB_FLAG_CAPTURING_TIME);
message = LANG_BG_AB_NODE_ASSAULTED;
sound = player->GetTeamId() == TEAM_ALLIANCE ? BG_AB_SOUND_NODE_ASSAULTED_ALLIANCE : BG_AB_SOUND_NODE_ASSAULTED_HORDE;
}
SendNodeUpdate(node);
PlaySoundToAll(sound);
SendMessage2ToAll(message, player->GetTeamId() == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, player, LANG_BG_AB_NODE_STABLES + node, message2);
SendMessage2ToAll(message, player->GetTeamId() == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, player, LANG_BG_AB_NODE_STABLES + node, message2);
}
TeamId BattlegroundAB::GetPrematureWinner()
{
if (_controlledPoints[TEAM_ALLIANCE] > _controlledPoints[TEAM_HORDE])
return TEAM_ALLIANCE;
return _controlledPoints[TEAM_HORDE] > _controlledPoints[TEAM_ALLIANCE] ? TEAM_HORDE : Battleground::GetPrematureWinner();
return _controlledPoints[TEAM_HORDE] > _controlledPoints[TEAM_ALLIANCE] ? TEAM_HORDE : Battleground::GetPrematureWinner();
}
bool BattlegroundAB::SetupBattleground()
{
for (uint32 i = 0; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
{
AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
AddObject(BG_AB_OBJECT_BANNER_NEUTRAL + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_NODE_BANNER_0 + i, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
AddObject(BG_AB_OBJECT_BANNER_ALLY + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_BANNER_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
AddObject(BG_AB_OBJECT_BANNER_HORDE + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_BANNER_H, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
AddObject(BG_AB_OBJECT_BANNER_CONT_A + BG_AB_OBJECTS_PER_NODE*i, BG_AB_OBJECTID_BANNER_CONT_A, BG_AB_NodePositions[i][0], BG_AB_NodePositions[i][1], BG_AB_NodePositions[i][2], BG_AB_NodePositions[i][3], 0, 0, sin(BG_AB_NodePositions[i][3]/2), cos(BG_AB_NodePositions[i][3]/2), RESPAWN_ONE_DAY);
@@ -373,22 +373,22 @@ bool BattlegroundAB::SetupBattleground()
AddObject(BG_AB_OBJECT_SPEEDBUFF_STABLES + 3 * i + 2, Buff_Entries[2], BG_AB_BuffPositions[i][0], BG_AB_BuffPositions[i][1], BG_AB_BuffPositions[i][2], BG_AB_BuffPositions[i][3], 0, 0, sin(BG_AB_BuffPositions[i][3]/2), cos(BG_AB_BuffPositions[i][3]/2), RESPAWN_ONE_DAY);
}
AddSpiritGuide(BG_AB_SPIRIT_ALIANCE, BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][0], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][1], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][2], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][3], TEAM_ALLIANCE);
AddSpiritGuide(BG_AB_SPIRIT_HORDE, BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][0], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][1], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][2], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][3], TEAM_HORDE);
AddSpiritGuide(BG_AB_SPIRIT_ALIANCE, BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][0], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][1], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][2], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_ALIANCE][3], TEAM_ALLIANCE);
AddSpiritGuide(BG_AB_SPIRIT_HORDE, BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][0], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][1], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][2], BG_AB_SpiritGuidePos[BG_AB_SPIRIT_HORDE][3], TEAM_HORDE);
for (uint32 i = BG_AB_OBJECT_BANNER_NEUTRAL; i < BG_AB_OBJECT_MAX; ++i)
if (BgObjects[i] == 0)
{
sLog->outErrorDb("BatteGroundAB: Failed to spawn some object Battleground not created!");
return false;
}
for (uint32 i = BG_AB_OBJECT_BANNER_NEUTRAL; i < BG_AB_OBJECT_MAX; ++i)
if (BgObjects[i] == 0)
{
sLog->outErrorDb("BatteGroundAB: Failed to spawn some object Battleground not created!");
return false;
}
for (uint32 i = BG_AB_SPIRIT_ALIANCE; i <= BG_AB_SPIRIT_HORDE; ++i)
if (BgCreatures[i] == 0)
{
sLog->outErrorDb("BatteGroundAB: Failed to spawn spirit guides Battleground not created!");
return false;
}
for (uint32 i = BG_AB_SPIRIT_ALIANCE; i <= BG_AB_SPIRIT_HORDE; ++i)
if (BgCreatures[i] == 0)
{
sLog->outErrorDb("BatteGroundAB: Failed to spawn spirit guides Battleground not created!");
return false;
}
return true;
}
@@ -398,21 +398,21 @@ void BattlegroundAB::Init()
//call parent's class reset
Battleground::Init();
_bgEvents.Reset();
_bgEvents.Reset();
_honorTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID()) ? BG_AB_HONOR_TICK_WEEKEND : BG_AB_HONOR_TICK_NORMAL;
_reputationTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID()) ? BG_AB_REP_TICK_WEEKEND : BG_AB_REP_TICK_NORMAL;
_honorTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID()) ? BG_AB_HONOR_TICK_WEEKEND : BG_AB_HONOR_TICK_NORMAL;
_reputationTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID()) ? BG_AB_REP_TICK_WEEKEND : BG_AB_REP_TICK_NORMAL;
_capturePointInfo[BG_AB_NODE_STABLES]._iconNone = BG_AB_OP_STABLE_ICON;
_capturePointInfo[BG_AB_NODE_FARM]._iconNone = BG_AB_OP_FARM_ICON;
_capturePointInfo[BG_AB_NODE_BLACKSMITH]._iconNone = BG_AB_OP_BLACKSMITH_ICON;
_capturePointInfo[BG_AB_NODE_LUMBER_MILL]._iconNone = BG_AB_OP_LUMBERMILL_ICON;
_capturePointInfo[BG_AB_NODE_GOLD_MINE]._iconNone = BG_AB_OP_GOLDMINE_ICON;
_capturePointInfo[BG_AB_NODE_STABLES]._iconCapture = BG_AB_OP_STABLE_STATE_ALIENCE;
_capturePointInfo[BG_AB_NODE_FARM]._iconCapture = BG_AB_OP_FARM_STATE_ALIENCE;
_capturePointInfo[BG_AB_NODE_BLACKSMITH]._iconCapture = BG_AB_OP_BLACKSMITH_STATE_ALIENCE;
_capturePointInfo[BG_AB_NODE_LUMBER_MILL]._iconCapture = BG_AB_OP_LUMBERMILL_STATE_ALIENCE;
_capturePointInfo[BG_AB_NODE_GOLD_MINE]._iconCapture = BG_AB_OP_GOLDMINE_STATE_ALIENCE;
_capturePointInfo[BG_AB_NODE_STABLES]._iconNone = BG_AB_OP_STABLE_ICON;
_capturePointInfo[BG_AB_NODE_FARM]._iconNone = BG_AB_OP_FARM_ICON;
_capturePointInfo[BG_AB_NODE_BLACKSMITH]._iconNone = BG_AB_OP_BLACKSMITH_ICON;
_capturePointInfo[BG_AB_NODE_LUMBER_MILL]._iconNone = BG_AB_OP_LUMBERMILL_ICON;
_capturePointInfo[BG_AB_NODE_GOLD_MINE]._iconNone = BG_AB_OP_GOLDMINE_ICON;
_capturePointInfo[BG_AB_NODE_STABLES]._iconCapture = BG_AB_OP_STABLE_STATE_ALIENCE;
_capturePointInfo[BG_AB_NODE_FARM]._iconCapture = BG_AB_OP_FARM_STATE_ALIENCE;
_capturePointInfo[BG_AB_NODE_BLACKSMITH]._iconCapture = BG_AB_OP_BLACKSMITH_STATE_ALIENCE;
_capturePointInfo[BG_AB_NODE_LUMBER_MILL]._iconCapture = BG_AB_OP_LUMBERMILL_STATE_ALIENCE;
_capturePointInfo[BG_AB_NODE_GOLD_MINE]._iconCapture = BG_AB_OP_GOLDMINE_STATE_ALIENCE;
}
void BattlegroundAB::EndBattleground(TeamId winnerTeamId)
@@ -421,23 +421,23 @@ void BattlegroundAB::EndBattleground(TeamId winnerTeamId)
RewardHonorToTeam(GetBonusHonorFromKill(1), TEAM_HORDE);
RewardHonorToTeam(GetBonusHonorFromKill(1), TEAM_ALLIANCE);
Battleground::EndBattleground(winnerTeamId);
_bgEvents.Reset();
_bgEvents.Reset();
}
WorldSafeLocsEntry const* BattlegroundAB::GetClosestGraveyard(Player* player)
{
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[BG_AB_SPIRIT_ALIANCE + player->GetTeamId()]);
WorldSafeLocsEntry const* entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[BG_AB_SPIRIT_ALIANCE + player->GetTeamId()]);
WorldSafeLocsEntry const* nearestEntry = entry;
float pX = player->GetPositionX();
float pY = player->GetPositionY();
float dist = (entry->x - pX)*(entry->x - pX)+(entry->y - pY)*(entry->y - pY);
float minDist = dist;
float pX = player->GetPositionX();
float pY = player->GetPositionY();
float dist = (entry->x - pX)*(entry->x - pX)+(entry->y - pY)*(entry->y - pY);
float minDist = dist;
for (uint8 i = BG_AB_NODE_STABLES; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
if (_capturePointInfo[i]._ownerTeamId == player->GetTeamId())
{
entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[i]);
for (uint8 i = BG_AB_NODE_STABLES; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
if (_capturePointInfo[i]._ownerTeamId == player->GetTeamId())
{
entry = sWorldSafeLocsStore.LookupEntry(BG_AB_GraveyardIds[i]);
dist = (entry->x - pX)*(entry->x - pX) + (entry->y - pY)*(entry->y - pY);
if (dist < minDist)
{
@@ -478,15 +478,15 @@ bool BattlegroundAB::AllNodesConrolledByTeam(TeamId teamId) const
void BattlegroundAB::ApplyPhaseMask()
{
uint32 phaseMask = 1;
for (uint32 i = BG_AB_NODE_STABLES; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
if (_capturePointInfo[i]._ownerTeamId != TEAM_NEUTRAL)
phaseMask |= 1 << (i*2+1 + _capturePointInfo[i]._ownerTeamId);
uint32 phaseMask = 1;
for (uint32 i = BG_AB_NODE_STABLES; i < BG_AB_DYNAMIC_NODES_COUNT; ++i)
if (_capturePointInfo[i]._ownerTeamId != TEAM_NEUTRAL)
phaseMask |= 1 << (i*2+1 + _capturePointInfo[i]._ownerTeamId);
const BattlegroundPlayerMap& bgPlayerMap = GetPlayers();
for (BattlegroundPlayerMap::const_iterator itr = bgPlayerMap.begin(); itr != bgPlayerMap.end(); ++itr)
{
itr->second->SetPhaseMask(phaseMask, false);
itr->second->UpdateObjectVisibility(true, false);
}
const BattlegroundPlayerMap& bgPlayerMap = GetPlayers();
for (BattlegroundPlayerMap::const_iterator itr = bgPlayerMap.begin(); itr != bgPlayerMap.end(); ++itr)
{
itr->second->SetPhaseMask(phaseMask, false);
itr->second->UpdateObjectVisibility(true, false);
}
}
@@ -9,20 +9,20 @@ REWRITTEN BY XINEF
enum BG_AB_Events
{
BG_AB_EVENT_UPDATE_BANNER_STABLE = 1,
BG_AB_EVENT_UPDATE_BANNER_FARM = 2,
BG_AB_EVENT_UPDATE_BANNER_BLACKSMITH = 3,
BG_AB_EVENT_UPDATE_BANNER_LUMBERMILL = 4,
BG_AB_EVENT_UPDATE_BANNER_GOLDMINE = 5,
BG_AB_EVENT_UPDATE_BANNER_STABLE = 1,
BG_AB_EVENT_UPDATE_BANNER_FARM = 2,
BG_AB_EVENT_UPDATE_BANNER_BLACKSMITH = 3,
BG_AB_EVENT_UPDATE_BANNER_LUMBERMILL = 4,
BG_AB_EVENT_UPDATE_BANNER_GOLDMINE = 5,
BG_AB_EVENT_CAPTURE_STABLE = 6,
BG_AB_EVENT_CAPTURE_FARM = 7,
BG_AB_EVENT_CAPTURE_BLACKSMITH = 8,
BG_AB_EVENT_CAPTURE_LUMBERMILL = 9,
BG_AB_EVENT_CAPTURE_GOLDMINE = 10,
BG_AB_EVENT_CAPTURE_STABLE = 6,
BG_AB_EVENT_CAPTURE_FARM = 7,
BG_AB_EVENT_CAPTURE_BLACKSMITH = 8,
BG_AB_EVENT_CAPTURE_LUMBERMILL = 9,
BG_AB_EVENT_CAPTURE_GOLDMINE = 10,
BG_AB_EVENT_ALLIANCE_TICK = 11,
BG_AB_EVENT_HORDE_TICK = 12
BG_AB_EVENT_ALLIANCE_TICK = 11,
BG_AB_EVENT_HORDE_TICK = 12
};
enum BG_AB_WorldStates
@@ -67,11 +67,11 @@ enum BG_AB_WorldStates
enum BG_AB_ObjectIds
{
BG_AB_OBJECTID_NODE_BANNER_0 = 180087, // Stables banner
BG_AB_OBJECTID_NODE_BANNER_1 = 180088, // Blacksmith banner
BG_AB_OBJECTID_NODE_BANNER_2 = 180089, // Farm banner
BG_AB_OBJECTID_NODE_BANNER_3 = 180090, // Lumber mill banner
BG_AB_OBJECTID_NODE_BANNER_4 = 180091, // Gold mine banner
BG_AB_OBJECTID_NODE_BANNER_0 = 180087, // Stables banner
BG_AB_OBJECTID_NODE_BANNER_1 = 180088, // Blacksmith banner
BG_AB_OBJECTID_NODE_BANNER_2 = 180089, // Farm banner
BG_AB_OBJECTID_NODE_BANNER_3 = 180090, // Lumber mill banner
BG_AB_OBJECTID_NODE_BANNER_4 = 180091, // Gold mine banner
BG_AB_OBJECTID_BANNER_A = 180058,
BG_AB_OBJECTID_BANNER_CONT_A = 180059,
@@ -96,7 +96,7 @@ enum BG_AB_ObjectType
BG_AB_OBJECT_AURA_ALLY = 5,
BG_AB_OBJECT_AURA_HORDE = 6,
BG_AB_OBJECT_AURA_CONTESTED = 7,
BG_AB_OBJECTS_PER_NODE = 8,
BG_AB_OBJECTS_PER_NODE = 8,
BG_AB_OBJECT_GATE_A = 40,
BG_AB_OBJECT_GATE_H = 41,
@@ -135,11 +135,11 @@ enum BG_AB_BattlegroundNodes
enum BG_AB_NodeStatus
{
BG_AB_NODE_STATE_NEUTRAL = 0,
BG_AB_NODE_STATE_ALLY_OCCUPIED = 1,
BG_AB_NODE_STATE_HORDE_OCCUPIED = 2,
BG_AB_NODE_STATE_ALLY_CONTESTED = 3,
BG_AB_NODE_STATE_HORDE_CONTESTED = 4
BG_AB_NODE_STATE_NEUTRAL = 0,
BG_AB_NODE_STATE_ALLY_OCCUPIED = 1,
BG_AB_NODE_STATE_HORDE_OCCUPIED = 2,
BG_AB_NODE_STATE_ALLY_CONTESTED = 3,
BG_AB_NODE_STATE_HORDE_CONTESTED = 4
};
enum BG_AB_Sounds
@@ -156,19 +156,19 @@ enum BG_AB_Misc
{
BG_AB_OBJECTIVE_ASSAULT_BASE = 122,
BG_AB_OBJECTIVE_DEFEND_BASE = 123,
BG_AB_EVENT_START_BATTLE = 9158, // Achievement: Let's Get This Done
BG_AB_QUEST_CREDIT_BASE = 15001,
BG_AB_EVENT_START_BATTLE = 9158, // Achievement: Let's Get This Done
BG_AB_QUEST_CREDIT_BASE = 15001,
BG_AB_HONOR_TICK_NORMAL = 260,
BG_AB_HONOR_TICK_WEEKEND = 160,
BG_AB_REP_TICK_NORMAL = 160,
BG_AB_REP_TICK_WEEKEND = 120,
BG_AB_HONOR_TICK_NORMAL = 260,
BG_AB_HONOR_TICK_WEEKEND = 160,
BG_AB_REP_TICK_NORMAL = 160,
BG_AB_REP_TICK_WEEKEND = 120,
BG_AB_WARNING_NEAR_VICTORY_SCORE = 1400,
BG_AB_MAX_TEAM_SCORE = 1600,
BG_AB_FLAG_CAPTURING_TIME = 60000,
BG_AB_BANNER_UPDATE_TIME = 2000
BG_AB_BANNER_UPDATE_TIME = 2000
};
const uint32 BG_AB_TickIntervals[BG_AB_DYNAMIC_NODES_COUNT+1] = {0, 12000, 9000, 6000, 3000, 1000};
@@ -250,26 +250,26 @@ class BattlegroundAB : public Battleground
void SendNodeUpdate(uint8 node);
void NodeOccupied(uint8 node);
void NodeDeoccupied(uint8 node);
void ApplyPhaseMask();
void ApplyPhaseMask();
struct CapturePointInfo
{
CapturePointInfo() : _ownerTeamId(TEAM_NEUTRAL), _iconNone(0), _iconCapture(0), _state(BG_AB_NODE_STATE_NEUTRAL), _captured(false)
{
}
struct CapturePointInfo
{
CapturePointInfo() : _ownerTeamId(TEAM_NEUTRAL), _iconNone(0), _iconCapture(0), _state(BG_AB_NODE_STATE_NEUTRAL), _captured(false)
{
}
uint8 _state;
uint32 _iconNone;
uint32 _iconCapture;
TeamId _ownerTeamId;
bool _captured;
};
uint8 _state;
uint32 _iconNone;
uint32 _iconCapture;
TeamId _ownerTeamId;
bool _captured;
};
CapturePointInfo _capturePointInfo[BG_AB_DYNAMIC_NODES_COUNT];
EventMap _bgEvents;
CapturePointInfo _capturePointInfo[BG_AB_DYNAMIC_NODES_COUNT];
EventMap _bgEvents;
uint32 _honorTics;
uint32 _reputationTics;
uint8 _controlledPoints[BG_TEAMS_COUNT];
uint8 _controlledPoints[BG_TEAMS_COUNT];
bool _teamScores500Disadvantage[BG_TEAMS_COUNT];
};
#endif
@@ -736,7 +736,7 @@ void BattlegroundAV::PopulateNode(BG_AV_Nodes node)
creatureid=(ownerId == TEAM_ALLIANCE)?AV_NPC_A_TOWERDEFENSE:AV_NPC_H_TOWERDEFENSE;
else
{
if (m_Team_QuestStatus[ownerId][0] < 500)
if (m_Team_QuestStatus[ownerId][0] < 500)
creatureid = (ownerId == TEAM_ALLIANCE)? AV_NPC_A_GRAVEDEFENSE0 : AV_NPC_H_GRAVEDEFENSE0;
else if (m_Team_QuestStatus[ownerId][0] < 1000)
creatureid = (ownerId == TEAM_ALLIANCE)? AV_NPC_A_GRAVEDEFENSE1 : AV_NPC_H_GRAVEDEFENSE1;
@@ -1008,8 +1008,8 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
}
}
// xinef: moved here, assure that no call to m_Nodes is used in IF statement bellow as it is modified
AssaultNode(node, teamId);
// xinef: moved here, assure that no call to m_Nodes is used in IF statement bellow as it is modified
AssaultNode(node, teamId);
//if snowfall gots capped it can be handled like all other graveyards
if (m_Nodes[node].TotalOwnerId != TEAM_NEUTRAL)
@@ -1134,8 +1134,8 @@ void BattlegroundAV::SendMineWorldStates(uint32 mine)
else if (m_Mine_Owner[mine] == TEAM_HORDE)
owner = 2;
for (uint8 i = 0; i < 3; ++i)
UpdateWorldState(BG_AV_MineWorldStates[mine][i], 0); // Xinef: Clear data for consistency and buglessness
for (uint8 i = 0; i < 3; ++i)
UpdateWorldState(BG_AV_MineWorldStates[mine][i], 0); // Xinef: Clear data for consistency and buglessness
UpdateWorldState(BG_AV_MineWorldStates[mine][owner], 1);
}
@@ -1295,21 +1295,21 @@ bool BattlegroundAV::SetupBattleground()
}
}
// Handpacked snowdrift, only during holiday
if (IsHolidayActive(HOLIDAY_FEAST_OF_WINTER_VEIL))
for (uint16 i= 0 ; i <= (BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX-BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN); i++)
{
if (!AddObject(BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN+i, BG_AV_OBJECTID_HARDPACKED_SNOWDRIFT, BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][3]/2), RESPAWN_ONE_DAY))
return false;
}
// Handpacked snowdrift, only during holiday
if (IsHolidayActive(HOLIDAY_FEAST_OF_WINTER_VEIL))
for (uint16 i= 0 ; i <= (BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX-BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN); i++)
{
if (!AddObject(BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN+i, BG_AV_OBJECTID_HARDPACKED_SNOWDRIFT, BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][0], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][1], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][2], BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN+i][3]/2), RESPAWN_ONE_DAY))
return false;
}
// Quest banners
if (!AddObject(BG_AV_OBJECT_FROSTWOLF_BANNER, BG_AV_OBJECTID_FROSTWOLF_BANNER, BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][0], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][1], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][2], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3]/2), RESPAWN_ONE_DAY))
// Quest banners
if (!AddObject(BG_AV_OBJECT_FROSTWOLF_BANNER, BG_AV_OBJECTID_FROSTWOLF_BANNER, BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][0], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][1], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][2], BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_FROSTWOLF_BANNER][3]/2), RESPAWN_ONE_DAY))
{
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!8");
return false;
}
if (!AddObject(BG_AV_OBJECT_STORMPIKE_BANNER, BG_AV_OBJECTID_STORMPIKE_BANNER, BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][0], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][1], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][2], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3]/2), RESPAWN_ONE_DAY))
if (!AddObject(BG_AV_OBJECT_STORMPIKE_BANNER, BG_AV_OBJECTID_STORMPIKE_BANNER, BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][0], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][1], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][2], BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3], 0, 0, sin(BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3]/2), cos(BG_AV_ObjectPos[AV_OPLACE_STORMPIKE_BANNER][3]/2), RESPAWN_ONE_DAY))
{
sLog->outError("BatteGroundAV: Failed to spawn some object Battleground not created!8");
return false;
@@ -1354,15 +1354,15 @@ bool BattlegroundAV::SetupBattleground()
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
SpawnBGObject(BG_AV_OBJECT_AURA_N_SNOWFALL_GRAVE, RESPAWN_IMMEDIATELY);
// Handpacked snowdrift, only during holiday
if (IsHolidayActive(HOLIDAY_FEAST_OF_WINTER_VEIL))
for (i = BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN ; i <= BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX; i++)
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
// Handpacked snowdrift, only during holiday
if (IsHolidayActive(HOLIDAY_FEAST_OF_WINTER_VEIL))
for (i = BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN ; i <= BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX; i++)
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
// Quest banners
SpawnBGObject(BG_AV_OBJECT_FROSTWOLF_BANNER, RESPAWN_IMMEDIATELY);
SpawnBGObject(BG_AV_OBJECT_STORMPIKE_BANNER, RESPAWN_IMMEDIATELY);
// Quest banners
SpawnBGObject(BG_AV_OBJECT_FROSTWOLF_BANNER, RESPAWN_IMMEDIATELY);
SpawnBGObject(BG_AV_OBJECT_STORMPIKE_BANNER, RESPAWN_IMMEDIATELY);
//creatures
;//sLog->outDebug(LOG_FILTER_BATTLEGROUND, "BG_AV start poputlating nodes");
@@ -1509,7 +1509,7 @@ void BattlegroundAV::ResetBGSubclass()
bool BattlegroundAV::IsBothMinesControlledByTeam(TeamId teamId) const
{
for (uint8 mine = 0; mine < 2; mine++)
if (m_Mine_Owner[mine] != teamId)
if (m_Mine_Owner[mine] != teamId)
return false;
return true;
@@ -1567,8 +1567,8 @@ bool BattlegroundAV::IsAllTowersControlledAndCaptainAlive(TeamId teamId) const
TeamId BattlegroundAV::GetPrematureWinner()
{
if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE))
return TEAM_ALLIANCE;
if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE))
return TEAM_ALLIANCE;
return GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : Battleground::GetPrematureWinner();
return GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : Battleground::GetPrematureWinner();
}
@@ -147,17 +147,17 @@ enum BG_AV_ObjectIds
BG_AV_OBJECTID_GATE_H = 180424,
//mine supplies
BG_AV_OBJECTID_MINE_N = 178785,
BG_AV_OBJECTID_MINE_S = 178784,
BG_AV_OBJECTID_MINE_N = 178785,
BG_AV_OBJECTID_MINE_S = 178784,
BG_AV_OBJECTID_FIRE = 179065,
BG_AV_OBJECTID_SMOKE = 179066,
BG_AV_OBJECTID_FIRE = 179065,
BG_AV_OBJECTID_SMOKE = 179066,
// Winter Veil Hardpacked Snowdrift
BG_AV_OBJECTID_HARDPACKED_SNOWDRIFT = 180654,
// Winter Veil Hardpacked Snowdrift
BG_AV_OBJECTID_HARDPACKED_SNOWDRIFT = 180654,
BG_AV_OBJECTID_FROSTWOLF_BANNER = 179025,
BG_AV_OBJECTID_STORMPIKE_BANNER = 179024,
BG_AV_OBJECTID_FROSTWOLF_BANNER = 179025,
BG_AV_OBJECTID_STORMPIKE_BANNER = 179024,
};
enum BG_AV_Nodes
@@ -310,10 +310,10 @@ enum BG_AV_ObjectTypes
BG_AV_OBJECT_MINE_SUPPLY_N_MAX = 224,
BG_AV_OBJECT_MINE_SUPPLY_S_MIN = 225,
BG_AV_OBJECT_MINE_SUPPLY_S_MAX = 236,
BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN = 237,
BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX = 246,
BG_AV_OBJECT_FROSTWOLF_BANNER = 247,
BG_AV_OBJECT_STORMPIKE_BANNER = 248,
BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MIN = 237,
BG_AV_OBJECT_HANDPACKED_SNOWDRIFT_MAX = 246,
BG_AV_OBJECT_FROSTWOLF_BANNER = 247,
BG_AV_OBJECT_STORMPIKE_BANNER = 248,
BG_AV_OBJECT_MAX = 249
};
@@ -362,10 +362,10 @@ enum BG_AV_OBJECTS
AV_OPLACE_MINE_SUPPLY_N_MAX = 136,
AV_OPLACE_MINE_SUPPLY_S_MIN = 137,
AV_OPLACE_MINE_SUPPLY_S_MAX = 148,
AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN = 149,
AV_OPLACE_HANDPACKED_SNOWDRIFT_MAX = 158,
AV_OPLACE_FROSTWOLF_BANNER = 159,
AV_OPLACE_STORMPIKE_BANNER = 160,
AV_OPLACE_HANDPACKED_SNOWDRIFT_MIN = 149,
AV_OPLACE_HANDPACKED_SNOWDRIFT_MAX = 158,
AV_OPLACE_FROSTWOLF_BANNER = 159,
AV_OPLACE_STORMPIKE_BANNER = 160,
AV_OPLACE_MAX = 161
};
@@ -540,19 +540,19 @@ const float BG_AV_ObjectPos[AV_OPLACE_MAX][4] =
{-820.644f, -136.043f, 63.1977f, 2.40855f},
{-947.642f, -208.807f, 77.0101f, 1.36136f},
{-951.394f, -193.695f, 67.634f, 0.802851f},
// hardpacked snowdrift
{712.1f, -446.49f, 65.74f, 2.13f},
{696.4f, -276.4f, 28.55f, 3.2f},
{74.0f, -313.27f, 31.16f, 0.17f},
{-75.4f, -224.4f, 10.24f, 2.99f},
{-160.9f, -72.1f, 33.36f, 5.5f},
{-255.8f, -217.55f, 7.66f, 2.8f},
{-361.49f, -115.5f, 26.42f, 0.6f},
{-389.5f, -325.0f, 17.98f, 3.89f},
{-919.57f, -362.48f, 52.13f, 3.8f},
{-1259.1f, -500.8f, 50.81f, 1.2f},
{-1552.55f, -359.738f, 66.948f, 2.8875f},
{40.0913f, 0.0153897f, -4.0962f, 0.96131f}
// hardpacked snowdrift
{712.1f, -446.49f, 65.74f, 2.13f},
{696.4f, -276.4f, 28.55f, 3.2f},
{74.0f, -313.27f, 31.16f, 0.17f},
{-75.4f, -224.4f, 10.24f, 2.99f},
{-160.9f, -72.1f, 33.36f, 5.5f},
{-255.8f, -217.55f, 7.66f, 2.8f},
{-361.49f, -115.5f, 26.42f, 0.6f},
{-389.5f, -325.0f, 17.98f, 3.89f},
{-919.57f, -362.48f, 52.13f, 3.8f},
{-1259.1f, -500.8f, 50.81f, 1.2f},
{-1552.55f, -359.738f, 66.948f, 2.8875f},
{40.0913f, 0.0153897f, -4.0962f, 0.96131f}
};
const float BG_AV_DoorPositons[2][4] =
@@ -1593,7 +1593,7 @@ class BattlegroundAV : public Battleground
void HandleKillUnit(Creature* unit, Player* killer);
void HandleQuestComplete(uint32 questid, Player* player);
bool PlayerCanDoMineQuest(int32 GOId, TeamId teamId);
TeamId GetMineOwner(uint8 mine) { return m_Mine_Owner[mine]; }
TeamId GetMineOwner(uint8 mine) { return m_Mine_Owner[mine]; }
void EndBattleground(TeamId winnerTeamId);
@@ -115,27 +115,27 @@ void BattlegroundBE::HandleAreaTrigger(Player* player, uint32 trigger)
case 4539: // buff trigger?
//buff_guid = BgObjects[BG_BE_OBJECT_BUFF_2];
break;
// OUTSIDE OF ARENA, TELEPORT!
case 4919:
player->NearTeleportTo(6220.90f, 318.94f, 5.1f, 5.3f);
break;
case 4921:
player->NearTeleportTo(6250.27f, 208.50f, 4.77f, 1.9f);
break;
case 4922:
player->NearTeleportTo(6214.4f, 227.12f, 4.28f, 0.8f);
break;
case 4923:
player->NearTeleportTo(6180.98f, 265.28f, 4.27f, 6.06f);
break;
case 4924:
player->NearTeleportTo(6269.0f, 295.06f, 4.46f, 3.98f);
break;
case 4944: // under arena -20
case 5039: // under arena -40
case 5040: // under arena -60
player->NearTeleportTo(6238.930176f, 262.963470f, 0.889519f, player->GetOrientation());
break;
// OUTSIDE OF ARENA, TELEPORT!
case 4919:
player->NearTeleportTo(6220.90f, 318.94f, 5.1f, 5.3f);
break;
case 4921:
player->NearTeleportTo(6250.27f, 208.50f, 4.77f, 1.9f);
break;
case 4922:
player->NearTeleportTo(6214.4f, 227.12f, 4.28f, 0.8f);
break;
case 4923:
player->NearTeleportTo(6180.98f, 265.28f, 4.27f, 6.06f);
break;
case 4924:
player->NearTeleportTo(6269.0f, 295.06f, 4.46f, 3.98f);
break;
case 4944: // under arena -20
case 5039: // under arena -40
case 5040: // under arena -60
player->NearTeleportTo(6238.930176f, 262.963470f, 0.889519f, player->GetOrientation());
break;
}
}
@@ -29,8 +29,8 @@ enum BattlegroundBEObjectTypes
BG_BE_OBJECT_DOOR_4 = 3,
BG_BE_OBJECT_BUFF_1 = 4,
BG_BE_OBJECT_BUFF_2 = 5,
BG_BE_OBJECT_READY_MARKER_1 = 6,
BG_BE_OBJECT_READY_MARKER_2 = 7,
BG_BE_OBJECT_READY_MARKER_1 = 6,
BG_BE_OBJECT_READY_MARKER_2 = 7,
BG_BE_OBJECT_MAX = 8
};
@@ -201,24 +201,24 @@ void BattlegroundDS::HandleAreaTrigger(Player* player, uint32 trigger)
if (getPipeKnockBackCount() >= BG_DS_PIPE_KNOCKBACK_TOTAL_COUNT)
setPipeKnockBackCount(0);
break;
// OUTSIDE OF ARENA, TELEPORT!
case 5328:
player->NearTeleportTo(1290.44f, 744.96f, 3.16f, 1.6f);
break;
case 5329:
player->NearTeleportTo(1292.6f, 837.07f, 3.161f, 4.7f);
break;
case 5330:
player->NearTeleportTo(1250.68f, 790.86f, 3.16f, 0.0f);
break;
case 5331:
player->NearTeleportTo(1332.50f, 790.9f, 3.16f, 3.14f);
break;
case 5326: // -10
case 5343: // -40
case 5344: // -60
player->NearTeleportTo(1330.0f, 800.0f, 3.16f, player->GetOrientation());
break;
// OUTSIDE OF ARENA, TELEPORT!
case 5328:
player->NearTeleportTo(1290.44f, 744.96f, 3.16f, 1.6f);
break;
case 5329:
player->NearTeleportTo(1292.6f, 837.07f, 3.161f, 4.7f);
break;
case 5330:
player->NearTeleportTo(1250.68f, 790.86f, 3.16f, 0.0f);
break;
case 5331:
player->NearTeleportTo(1332.50f, 790.9f, 3.16f, 3.14f);
break;
case 5326: // -10
case 5343: // -40
case 5344: // -60
player->NearTeleportTo(1330.0f, 800.0f, 3.16f, player->GetOrientation());
break;
}
}
@@ -29,8 +29,8 @@ enum BattlegroundDSObjectTypes
BG_DS_OBJECT_WATER_2 = 3,
BG_DS_OBJECT_BUFF_1 = 4,
BG_DS_OBJECT_BUFF_2 = 5,
BG_DS_OBJECT_READY_MARKER_1 = 6,
BG_DS_OBJECT_READY_MARKER_2 = 7,
BG_DS_OBJECT_READY_MARKER_1 = 6,
BG_DS_OBJECT_READY_MARKER_2 = 7,
BG_DS_OBJECT_MAX = 8
};
@@ -16,17 +16,17 @@ REWRITTEN BY XINEF
BattlegroundEY::BattlegroundEY()
{
m_BuffChange = true;
m_BuffChange = true;
BgObjects.resize(BG_EY_OBJECT_MAX);
BgCreatures.resize(BG_EY_CREATURES_MAX);
_capturePointInfo[POINT_FEL_REAVER]._areaTrigger = AT_FEL_REAVER_BUFF;
_capturePointInfo[POINT_BLOOD_ELF]._areaTrigger = AT_BLOOD_ELF_BUFF;
_capturePointInfo[POINT_DRAENEI_RUINS]._areaTrigger = AT_DRAENEI_RUINS_BUFF;
_capturePointInfo[POINT_MAGE_TOWER]._areaTrigger = AT_MAGE_TOWER_BUFF;
_honorTics = 0;
_ownedPointsCount[TEAM_ALLIANCE] = 0;
_ownedPointsCount[TEAM_HORDE] = 0;
_capturePointInfo[POINT_FEL_REAVER]._areaTrigger = AT_FEL_REAVER_BUFF;
_capturePointInfo[POINT_BLOOD_ELF]._areaTrigger = AT_BLOOD_ELF_BUFF;
_capturePointInfo[POINT_DRAENEI_RUINS]._areaTrigger = AT_DRAENEI_RUINS_BUFF;
_capturePointInfo[POINT_MAGE_TOWER]._areaTrigger = AT_MAGE_TOWER_BUFF;
_honorTics = 0;
_ownedPointsCount[TEAM_ALLIANCE] = 0;
_ownedPointsCount[TEAM_HORDE] = 0;
_flagKeeperGUID = 0;
_droppedFlagGUID = 0;
_flagState = BG_EY_FLAG_STATE_ON_BASE;
@@ -46,28 +46,28 @@ void BattlegroundEY::PostUpdateImpl(uint32 diff)
{
if (GetStatus() == STATUS_IN_PROGRESS)
{
_bgEvents.Update(diff);
while (uint32 eventId = _bgEvents.ExecuteEvent())
switch (eventId)
{
case BG_EY_EVENT_ADD_POINTS:
if (_ownedPointsCount[TEAM_ALLIANCE] > 0)
AddPoints(TEAM_ALLIANCE, BG_EY_TickPoints[_ownedPointsCount[TEAM_ALLIANCE] - 1]);
if (_ownedPointsCount[TEAM_HORDE] > 0)
AddPoints(TEAM_HORDE, BG_EY_TickPoints[_ownedPointsCount[TEAM_HORDE] - 1]);
_bgEvents.ScheduleEvent(BG_EY_EVENT_ADD_POINTS, BG_EY_FPOINTS_TICK_TIME - (World::GetGameTimeMS() % BG_EY_FPOINTS_TICK_TIME));
break;
case BG_EY_EVENT_FLAG_ON_GROUND:
RespawnFlagAfterDrop();
break;
case BG_EY_EVENT_RESPAWN_FLAG:
RespawnFlag();
break;
case BG_EY_EVENT_CHECK_CPOINTS:
UpdatePointsState();
_bgEvents.ScheduleEvent(BG_EY_EVENT_CHECK_CPOINTS, BG_EY_FPOINTS_CHECK_TIME - (World::GetGameTimeMS() % BG_EY_FPOINTS_CHECK_TIME));
break;
}
_bgEvents.Update(diff);
while (uint32 eventId = _bgEvents.ExecuteEvent())
switch (eventId)
{
case BG_EY_EVENT_ADD_POINTS:
if (_ownedPointsCount[TEAM_ALLIANCE] > 0)
AddPoints(TEAM_ALLIANCE, BG_EY_TickPoints[_ownedPointsCount[TEAM_ALLIANCE] - 1]);
if (_ownedPointsCount[TEAM_HORDE] > 0)
AddPoints(TEAM_HORDE, BG_EY_TickPoints[_ownedPointsCount[TEAM_HORDE] - 1]);
_bgEvents.ScheduleEvent(BG_EY_EVENT_ADD_POINTS, BG_EY_FPOINTS_TICK_TIME - (World::GetGameTimeMS() % BG_EY_FPOINTS_TICK_TIME));
break;
case BG_EY_EVENT_FLAG_ON_GROUND:
RespawnFlagAfterDrop();
break;
case BG_EY_EVENT_RESPAWN_FLAG:
RespawnFlag();
break;
case BG_EY_EVENT_CHECK_CPOINTS:
UpdatePointsState();
_bgEvents.ScheduleEvent(BG_EY_EVENT_CHECK_CPOINTS, BG_EY_FPOINTS_CHECK_TIME - (World::GetGameTimeMS() % BG_EY_FPOINTS_CHECK_TIME));
break;
}
}
}
@@ -93,69 +93,69 @@ void BattlegroundEY::StartingEventOpenDoors()
// Achievement: Flurry
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, BG_EY_EVENT_START_BATTLE);
_bgEvents.ScheduleEvent(BG_EY_EVENT_ADD_POINTS, 0);
_bgEvents.ScheduleEvent(BG_EY_EVENT_CHECK_CPOINTS, 0);
_bgEvents.ScheduleEvent(BG_EY_EVENT_ADD_POINTS, 0);
_bgEvents.ScheduleEvent(BG_EY_EVENT_CHECK_CPOINTS, 0);
}
void BattlegroundEY::AddPoints(TeamId teamId, uint32 points)
{
uint8 honorRewards = uint8(m_TeamScores[teamId] / _honorTics);
uint8 honorRewards = uint8(m_TeamScores[teamId] / _honorTics);
m_TeamScores[teamId] += points;
for (; honorRewards < uint8(m_TeamScores[teamId] / _honorTics); ++honorRewards)
for (; honorRewards < uint8(m_TeamScores[teamId] / _honorTics); ++honorRewards)
RewardHonorToTeam(GetBonusHonorFromKill(1), teamId);
UpdateWorldState(teamId == TEAM_ALLIANCE ? EY_ALLIANCE_RESOURCES : EY_HORDE_RESOURCES, std::min<uint32>(m_TeamScores[teamId], BG_EY_MAX_TEAM_SCORE));
UpdateWorldState(teamId == TEAM_ALLIANCE ? EY_ALLIANCE_RESOURCES : EY_HORDE_RESOURCES, std::min<uint32>(m_TeamScores[teamId], BG_EY_MAX_TEAM_SCORE));
if (m_TeamScores[teamId] >= BG_EY_MAX_TEAM_SCORE)
EndBattleground(teamId);
EndBattleground(teamId);
}
void BattlegroundEY::UpdatePointsState()
{
std::vector<GameObject*> pointsVec;
for (uint8 point = 0; point < EY_POINTS_MAX; ++point)
{
pointsVec.push_back(GetBGObject(BG_EY_OBJECT_TOWER_CAP_FEL_REAVER + point));
_capturePointInfo[point]._playersCount[TEAM_ALLIANCE] = 0;
_capturePointInfo[point]._playersCount[TEAM_HORDE] = 0;
}
std::vector<GameObject*> pointsVec;
for (uint8 point = 0; point < EY_POINTS_MAX; ++point)
{
pointsVec.push_back(GetBGObject(BG_EY_OBJECT_TOWER_CAP_FEL_REAVER + point));
_capturePointInfo[point]._playersCount[TEAM_ALLIANCE] = 0;
_capturePointInfo[point]._playersCount[TEAM_HORDE] = 0;
}
const BattlegroundPlayerMap& bgPlayerMap = GetPlayers();
for (BattlegroundPlayerMap::const_iterator itr = bgPlayerMap.begin(); itr != bgPlayerMap.end(); ++itr)
{
UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW, itr->second);
for (uint8 point = 0; point < EY_POINTS_MAX; ++point)
if (GameObject* pointObject = pointsVec[point])
if (itr->second->CanCaptureTowerPoint() && itr->second->IsWithinDistInMap(pointObject, BG_EY_POINT_RADIUS))
{
UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_SHOW, itr->second);
UpdateWorldStateForPlayer(PROGRESS_BAR_PERCENT_GREY, BG_EY_PROGRESS_BAR_PERCENT_GREY, itr->second);
UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, _capturePointInfo[point]._barStatus, itr->second);
++_capturePointInfo[point]._playersCount[itr->second->GetTeamId()];
const BattlegroundPlayerMap& bgPlayerMap = GetPlayers();
for (BattlegroundPlayerMap::const_iterator itr = bgPlayerMap.begin(); itr != bgPlayerMap.end(); ++itr)
{
UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_DONT_SHOW, itr->second);
for (uint8 point = 0; point < EY_POINTS_MAX; ++point)
if (GameObject* pointObject = pointsVec[point])
if (itr->second->CanCaptureTowerPoint() && itr->second->IsWithinDistInMap(pointObject, BG_EY_POINT_RADIUS))
{
UpdateWorldStateForPlayer(PROGRESS_BAR_SHOW, BG_EY_PROGRESS_BAR_SHOW, itr->second);
UpdateWorldStateForPlayer(PROGRESS_BAR_PERCENT_GREY, BG_EY_PROGRESS_BAR_PERCENT_GREY, itr->second);
UpdateWorldStateForPlayer(PROGRESS_BAR_STATUS, _capturePointInfo[point]._barStatus, itr->second);
++_capturePointInfo[point]._playersCount[itr->second->GetTeamId()];
// Xinef: ugly hax... area trigger is no longer called by client...
if (pointObject->GetEntry() == BG_OBJECT_FR_TOWER_CAP_EY_ENTRY && itr->second->GetDistance2d(2043.96f, 1729.68f) < 3.0f)
HandleAreaTrigger(itr->second, AT_FEL_REAVER_POINT);
}
// Xinef: ugly hax... area trigger is no longer called by client...
if (pointObject->GetEntry() == BG_OBJECT_FR_TOWER_CAP_EY_ENTRY && itr->second->GetDistance2d(2043.96f, 1729.68f) < 3.0f)
HandleAreaTrigger(itr->second, AT_FEL_REAVER_POINT);
}
}
for (uint8 point = 0; point < EY_POINTS_MAX; ++point)
{
_capturePointInfo[point]._barStatus += std::max<int8>(std::min<int8>(_capturePointInfo[point]._playersCount[TEAM_ALLIANCE] - _capturePointInfo[point]._playersCount[TEAM_HORDE], BG_EY_POINT_MAX_CAPTURERS_COUNT), -BG_EY_POINT_MAX_CAPTURERS_COUNT);
_capturePointInfo[point]._barStatus = std::max<int8>(std::min<int8>(_capturePointInfo[point]._barStatus, BG_EY_PROGRESS_BAR_ALI_CONTROLLED), BG_EY_PROGRESS_BAR_HORDE_CONTROLLED);
_capturePointInfo[point]._barStatus += std::max<int8>(std::min<int8>(_capturePointInfo[point]._playersCount[TEAM_ALLIANCE] - _capturePointInfo[point]._playersCount[TEAM_HORDE], BG_EY_POINT_MAX_CAPTURERS_COUNT), -BG_EY_POINT_MAX_CAPTURERS_COUNT);
_capturePointInfo[point]._barStatus = std::max<int8>(std::min<int8>(_capturePointInfo[point]._barStatus, BG_EY_PROGRESS_BAR_ALI_CONTROLLED), BG_EY_PROGRESS_BAR_HORDE_CONTROLLED);
TeamId pointOwnerTeamId = TEAM_NEUTRAL;
if (_capturePointInfo[point]._barStatus <= BG_EY_PROGRESS_BAR_NEUTRAL_LOW)
if (_capturePointInfo[point]._barStatus <= BG_EY_PROGRESS_BAR_NEUTRAL_LOW)
pointOwnerTeamId = TEAM_HORDE;
else if (_capturePointInfo[point]._barStatus >= BG_EY_PROGRESS_BAR_NEUTRAL_HIGH)
else if (_capturePointInfo[point]._barStatus >= BG_EY_PROGRESS_BAR_NEUTRAL_HIGH)
pointOwnerTeamId = TEAM_ALLIANCE;
if (pointOwnerTeamId != _capturePointInfo[point]._ownerTeamId)
{
if (_capturePointInfo[point].IsUncontrolled())
EventTeamCapturedPoint(pointOwnerTeamId, point);
if (pointOwnerTeamId == TEAM_NEUTRAL && _capturePointInfo[point].IsUnderControl())
if (pointOwnerTeamId == TEAM_NEUTRAL && _capturePointInfo[point].IsUnderControl())
EventTeamLostPoint(pointOwnerTeamId, point);
}
}
@@ -177,11 +177,11 @@ void BattlegroundEY::UpdatePointsCount()
void BattlegroundEY::UpdatePointsIcons(uint32 point)
{
if (_capturePointInfo[point].IsUnderControl())
if (_capturePointInfo[point].IsUnderControl())
{
UpdateWorldState(m_PointsIconStruct[point].WorldStateControlIndex, 0);
UpdateWorldState(m_PointsIconStruct[point].WorldStateAllianceControlledIndex, _capturePointInfo[point].IsUnderControl(TEAM_ALLIANCE));
UpdateWorldState(m_PointsIconStruct[point].WorldStateHordeControlledIndex, _capturePointInfo[point].IsUnderControl(TEAM_HORDE));
UpdateWorldState(m_PointsIconStruct[point].WorldStateAllianceControlledIndex, _capturePointInfo[point].IsUnderControl(TEAM_ALLIANCE));
UpdateWorldState(m_PointsIconStruct[point].WorldStateHordeControlledIndex, _capturePointInfo[point].IsUnderControl(TEAM_HORDE));
}
else
{
@@ -199,7 +199,7 @@ void BattlegroundEY::AddPlayer(Player* player)
void BattlegroundEY::RemovePlayer(Player* player)
{
if (GetFlagPickerGUID() == player->GetGUID())
if (GetFlagPickerGUID() == player->GetGUID())
EventPlayerDroppedFlag(player);
}
@@ -211,22 +211,22 @@ void BattlegroundEY::HandleAreaTrigger(Player* player, uint32 trigger)
switch (trigger)
{
case AT_BLOOD_ELF_POINT:
if (_capturePointInfo[POINT_BLOOD_ELF].IsUnderControl(player->GetTeamId()))
if (_capturePointInfo[POINT_BLOOD_ELF].IsUnderControl(player->GetTeamId()))
if (_flagState == BG_EY_FLAG_STATE_ON_PLAYER && GetFlagPickerGUID() == player->GetGUID())
EventPlayerCapturedFlag(player, BG_EY_OBJECT_FLAG_BLOOD_ELF);
break;
case AT_FEL_REAVER_POINT:
if (_capturePointInfo[POINT_FEL_REAVER].IsUnderControl(player->GetTeamId()))
if (_capturePointInfo[POINT_FEL_REAVER].IsUnderControl(player->GetTeamId()))
if (_flagState == BG_EY_FLAG_STATE_ON_PLAYER && GetFlagPickerGUID() == player->GetGUID())
EventPlayerCapturedFlag(player, BG_EY_OBJECT_FLAG_FEL_REAVER);
break;
case AT_MAGE_TOWER_POINT:
if (_capturePointInfo[POINT_MAGE_TOWER].IsUnderControl(player->GetTeamId()))
if (_capturePointInfo[POINT_MAGE_TOWER].IsUnderControl(player->GetTeamId()))
if (_flagState == BG_EY_FLAG_STATE_ON_PLAYER && GetFlagPickerGUID() == player->GetGUID())
EventPlayerCapturedFlag(player, BG_EY_OBJECT_FLAG_MAGE_TOWER);
break;
case AT_DRAENEI_RUINS_POINT:
if (_capturePointInfo[POINT_DRAENEI_RUINS].IsUnderControl(player->GetTeamId()))
if (_capturePointInfo[POINT_DRAENEI_RUINS].IsUnderControl(player->GetTeamId()))
if (_flagState == BG_EY_FLAG_STATE_ON_PLAYER && GetFlagPickerGUID() == player->GetGUID())
EventPlayerCapturedFlag(player, BG_EY_OBJECT_FLAG_DRAENEI_RUINS);
break;
@@ -237,10 +237,10 @@ void BattlegroundEY::HandleAreaTrigger(Player* player, uint32 trigger)
case 4530:
case 4531:
case 5866:
case AT_BLOOD_ELF_BUFF:
case AT_FEL_REAVER_BUFF:
case AT_MAGE_TOWER_BUFF:
case AT_DRAENEI_RUINS_BUFF:
case AT_BLOOD_ELF_BUFF:
case AT_FEL_REAVER_BUFF:
case AT_MAGE_TOWER_BUFF:
case AT_DRAENEI_RUINS_BUFF:
break;
}
}
@@ -303,7 +303,7 @@ bool BattlegroundEY::SetupBattleground()
for (uint8 i = 0; i < EY_POINTS_MAX; ++i)
{
AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(_capturePointInfo[i]._areaTrigger);
AreaTriggerEntry const* at = sAreaTriggerStore.LookupEntry(_capturePointInfo[i]._areaTrigger);
AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 0, Buff_Entries[0], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY);
AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 1, Buff_Entries[1], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY);
AddObject(BG_EY_OBJECT_SPEEDBUFF_FEL_REAVER + i * 3 + 2, Buff_Entries[2], at->x, at->y, at->z, 0.907571f, 0, 0, 0.438371f, 0.898794f, RESPAWN_ONE_DAY);
@@ -316,19 +316,19 @@ bool BattlegroundEY::SetupBattleground()
sg = sWorldSafeLocsStore.LookupEntry(BG_EY_GRAVEYARD_MAIN_HORDE);
AddSpiritGuide(BG_EY_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, TEAM_HORDE);
for (uint32 i = BG_EY_OBJECT_DOOR_A; i < BG_EY_OBJECT_MAX; ++i)
if (BgObjects[i] == 0)
{
sLog->outErrorDb("BatteGroundEY: Failed to spawn some object Battleground not created!");
return false;
}
for (uint32 i = BG_EY_OBJECT_DOOR_A; i < BG_EY_OBJECT_MAX; ++i)
if (BgObjects[i] == 0)
{
sLog->outErrorDb("BatteGroundEY: Failed to spawn some object Battleground not created!");
return false;
}
for (uint32 i = BG_EY_SPIRIT_MAIN_ALLIANCE; i <= BG_EY_SPIRIT_MAIN_HORDE; ++i)
if (BgCreatures[i] == 0)
{
sLog->outErrorDb("BatteGroundEY: Failed to spawn spirit guides Battleground not created!");
return false;
}
for (uint32 i = BG_EY_SPIRIT_MAIN_ALLIANCE; i <= BG_EY_SPIRIT_MAIN_HORDE; ++i)
if (BgCreatures[i] == 0)
{
sLog->outErrorDb("BatteGroundEY: Failed to spawn spirit guides Battleground not created!");
return false;
}
return true;
}
@@ -338,10 +338,10 @@ void BattlegroundEY::Init()
//call parent's class reset
Battleground::Init();
_bgEvents.Reset();
_honorTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID()) ? BG_EY_HONOR_TICK_WEEKEND : BG_EY_HONOR_TICK_NORMAL;
_ownedPointsCount[TEAM_ALLIANCE] = 0;
_ownedPointsCount[TEAM_HORDE] = 0;
_bgEvents.Reset();
_honorTics = BattlegroundMgr::IsBGWeekend(GetBgTypeID()) ? BG_EY_HONOR_TICK_WEEKEND : BG_EY_HONOR_TICK_NORMAL;
_ownedPointsCount[TEAM_ALLIANCE] = 0;
_ownedPointsCount[TEAM_HORDE] = 0;
_flagKeeperGUID = 0;
_droppedFlagGUID = 0;
_flagState = BG_EY_FLAG_STATE_ON_BASE;
@@ -350,8 +350,8 @@ void BattlegroundEY::Init()
void BattlegroundEY::RespawnFlag()
{
if (_flagState != BG_EY_FLAG_STATE_ON_BASE)
return;
if (_flagState != BG_EY_FLAG_STATE_ON_BASE)
return;
if (_flagCapturedObject > 0)
SpawnBGObject(_flagCapturedObject, RESPAWN_ONE_DAY);
@@ -366,12 +366,12 @@ void BattlegroundEY::RespawnFlag()
void BattlegroundEY::RespawnFlagAfterDrop()
{
if (_flagState != BG_EY_FLAG_STATE_ON_GROUND)
return;
if (_flagState != BG_EY_FLAG_STATE_ON_GROUND)
return;
_flagState = BG_EY_FLAG_STATE_ON_BASE;
RespawnFlag();
if (GameObject* flag = ObjectAccessor::GetObjectInMap(GetDroppedFlagGUID(), FindBgMap(), (GameObject*)NULL))
if (GameObject* flag = ObjectAccessor::GetObjectInMap(GetDroppedFlagGUID(), FindBgMap(), (GameObject*)NULL))
flag->Delete();
SetDroppedFlagGUID(0);
}
@@ -387,8 +387,8 @@ void BattlegroundEY::HandleKillPlayer(Player* player, Player* killer)
void BattlegroundEY::EventPlayerDroppedFlag(Player* player)
{
if (GetFlagPickerGUID() != player->GetGUID())
return;
if (GetFlagPickerGUID() != player->GetGUID())
return;
SetFlagPicker(0);
player->RemoveAurasDueToSpell(BG_EY_NETHERSTORM_FLAG_SPELL);
@@ -396,12 +396,12 @@ void BattlegroundEY::EventPlayerDroppedFlag(Player* player)
return;
_flagState = BG_EY_FLAG_STATE_ON_GROUND;
_bgEvents.RescheduleEvent(BG_EY_EVENT_FLAG_ON_GROUND, BG_EY_FLAG_ON_GROUND_TIME);
_bgEvents.RescheduleEvent(BG_EY_EVENT_FLAG_ON_GROUND, BG_EY_FLAG_ON_GROUND_TIME);
player->CastSpell(player, SPELL_RECENTLY_DROPPED_FLAG, true);
player->CastSpell(player, BG_EY_PLAYER_DROPPED_FLAG_SPELL, true);
SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, player->GetTeamId() == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE);
SendMessageToAll(LANG_BG_EY_DROPPED_FLAG, player->GetTeamId() == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE);
}
void BattlegroundEY::EventPlayerClickedOnFlag(Player* player, GameObject* gameObject)
@@ -412,19 +412,19 @@ void BattlegroundEY::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
_flagState = BG_EY_FLAG_STATE_ON_PLAYER;
SpawnBGObject(BG_EY_OBJECT_FLAG_NETHERSTORM, RESPAWN_ONE_DAY);
SetFlagPicker(player->GetGUID());
SetDroppedFlagGUID(0);
SetDroppedFlagGUID(0);
player->CastSpell(player, BG_EY_NETHERSTORM_FLAG_SPELL, true);
player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, player->GetTeamId() == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, NULL, player->GetName().c_str());
PlaySoundToAll(player->GetTeamId() == TEAM_ALLIANCE ? BG_EY_SOUND_FLAG_PICKED_UP_ALLIANCE : BG_EY_SOUND_FLAG_PICKED_UP_HORDE);
PSendMessageToAll(LANG_BG_EY_HAS_TAKEN_FLAG, player->GetTeamId() == TEAM_ALLIANCE ? CHAT_MSG_BG_SYSTEM_ALLIANCE : CHAT_MSG_BG_SYSTEM_HORDE, NULL, player->GetName().c_str());
PlaySoundToAll(player->GetTeamId() == TEAM_ALLIANCE ? BG_EY_SOUND_FLAG_PICKED_UP_ALLIANCE : BG_EY_SOUND_FLAG_PICKED_UP_HORDE);
UpdateWorldState(NETHERSTORM_FLAG, 0);
}
void BattlegroundEY::EventTeamLostPoint(TeamId teamId, uint32 point)
{
TeamId oldTeamId = _capturePointInfo[point]._ownerTeamId;
TeamId oldTeamId = _capturePointInfo[point]._ownerTeamId;
if (oldTeamId == TEAM_ALLIANCE)
{
_ownedPointsCount[TEAM_ALLIANCE]--;
@@ -446,7 +446,7 @@ void BattlegroundEY::EventTeamLostPoint(TeamId teamId, uint32 point)
SpawnBGObject(m_LosingPointTypes[point].SpawnNeutralObjectType + 1, RESPAWN_IMMEDIATELY);
SpawnBGObject(m_LosingPointTypes[point].SpawnNeutralObjectType + 2, RESPAWN_IMMEDIATELY);
_capturePointInfo[point]._ownerTeamId = TEAM_NEUTRAL;
_capturePointInfo[point]._ownerTeamId = TEAM_NEUTRAL;
UpdatePointsIcons(point);
UpdatePointsCount();
@@ -476,7 +476,7 @@ void BattlegroundEY::EventTeamCapturedPoint(TeamId teamId, uint32 point)
SendMessageToAll(m_CapturingPointTypes[point].MessageIdHorde, CHAT_MSG_BG_SYSTEM_HORDE);
}
_capturePointInfo[point]._ownerTeamId = teamId;
_capturePointInfo[point]._ownerTeamId = teamId;
if (BgCreatures[point])
DelCreature(point);
@@ -486,8 +486,8 @@ void BattlegroundEY::EventTeamCapturedPoint(TeamId teamId, uint32 point)
UpdatePointsIcons(point);
UpdatePointsCount();
// Xinef: done this way to avoid errors in console
Creature* trigger = GetBgMap()->GetCreature(BgCreatures[BG_EY_TRIGGER_FEL_REAVER + point]);
// Xinef: done this way to avoid errors in console
Creature* trigger = GetBgMap()->GetCreature(BgCreatures[BG_EY_TRIGGER_FEL_REAVER + point]);
if (!trigger)
trigger = AddCreature(WORLD_TRIGGER, BG_EY_TRIGGER_FEL_REAVER + point, BG_EY_TriggerPositions[point][0], BG_EY_TriggerPositions[point][1], BG_EY_TriggerPositions[point][2], BG_EY_TriggerPositions[point][3]);
@@ -506,19 +506,19 @@ void BattlegroundEY::EventPlayerCapturedFlag(Player* player, uint32 BgObjectType
player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
SpawnBGObject(BgObjectType, RESPAWN_IMMEDIATELY);
_bgEvents.RescheduleEvent(BG_EY_EVENT_RESPAWN_FLAG, BG_EY_FLAG_RESPAWN_TIME);
_bgEvents.RescheduleEvent(BG_EY_EVENT_RESPAWN_FLAG, BG_EY_FLAG_RESPAWN_TIME);
_flagCapturedObject = BgObjectType;
if (player->GetTeamId() == TEAM_ALLIANCE)
{
PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE);
{
PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_ALLIANCE);
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_A, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
}
}
else
{
PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_HORDE);
{
PlaySoundToAll(BG_EY_SOUND_FLAG_CAPTURED_HORDE);
SendMessageToAll(LANG_BG_EY_CAPTURED_FLAG_H, CHAT_MSG_BG_SYSTEM_HORDE, player);
}
}
UpdatePlayerScore(player, SCORE_FLAG_CAPTURES, 1);
if (_ownedPointsCount[player->GetTeamId()] > 0)
@@ -528,41 +528,41 @@ void BattlegroundEY::EventPlayerCapturedFlag(Player* player, uint32 BgObjectType
void BattlegroundEY::UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor)
{
if (type == SCORE_FLAG_CAPTURES)
{
BattlegroundScoreMap::iterator itr = PlayerScores.find(player->GetGUID());
if (itr != PlayerScores.end())
((BattlegroundEYScore*)itr->second)->FlagCaptures += value;
{
BattlegroundScoreMap::iterator itr = PlayerScores.find(player->GetGUID());
if (itr != PlayerScores.end())
((BattlegroundEYScore*)itr->second)->FlagCaptures += value;
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, BG_EY_OBJECTIVE_CAPTURE_FLAG);
return;
}
return;
}
Battleground::UpdatePlayerScore(player, type, value, doAddHonor);
}
void BattlegroundEY::FillInitialWorldStates(WorldPacket& data)
{
data << uint32(EY_HORDE_BASE) << uint32(_ownedPointsCount[TEAM_HORDE]);
data << uint32(EY_ALLIANCE_BASE) << uint32(_ownedPointsCount[TEAM_ALLIANCE]);
data << uint32(DRAENEI_RUINS_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_DRAENEI_RUINS].IsUnderControl(TEAM_HORDE));
data << uint32(DRAENEI_RUINS_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_DRAENEI_RUINS].IsUnderControl(TEAM_ALLIANCE));
data << uint32(DRAENEI_RUINS_UNCONTROL) << uint32(_capturePointInfo[POINT_DRAENEI_RUINS].IsUncontrolled());
data << uint32(MAGE_TOWER_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_MAGE_TOWER].IsUnderControl(TEAM_HORDE));
data << uint32(MAGE_TOWER_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_MAGE_TOWER].IsUnderControl(TEAM_ALLIANCE));
data << uint32(MAGE_TOWER_UNCONTROL) << uint32(_capturePointInfo[POINT_MAGE_TOWER].IsUncontrolled());
data << uint32(FEL_REAVER_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_FEL_REAVER].IsUnderControl(TEAM_HORDE));
data << uint32(FEL_REAVER_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_FEL_REAVER].IsUnderControl(TEAM_ALLIANCE));
data << uint32(FEL_REAVER_UNCONTROL) << uint32(_capturePointInfo[POINT_FEL_REAVER].IsUncontrolled());
data << uint32(BLOOD_ELF_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_BLOOD_ELF].IsUnderControl(TEAM_HORDE));
data << uint32(BLOOD_ELF_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_BLOOD_ELF].IsUnderControl(TEAM_ALLIANCE));
data << uint32(BLOOD_ELF_UNCONTROL) << uint32(_capturePointInfo[POINT_BLOOD_ELF].IsUncontrolled());
data << uint32(EY_HORDE_BASE) << uint32(_ownedPointsCount[TEAM_HORDE]);
data << uint32(EY_ALLIANCE_BASE) << uint32(_ownedPointsCount[TEAM_ALLIANCE]);
data << uint32(DRAENEI_RUINS_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_DRAENEI_RUINS].IsUnderControl(TEAM_HORDE));
data << uint32(DRAENEI_RUINS_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_DRAENEI_RUINS].IsUnderControl(TEAM_ALLIANCE));
data << uint32(DRAENEI_RUINS_UNCONTROL) << uint32(_capturePointInfo[POINT_DRAENEI_RUINS].IsUncontrolled());
data << uint32(MAGE_TOWER_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_MAGE_TOWER].IsUnderControl(TEAM_HORDE));
data << uint32(MAGE_TOWER_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_MAGE_TOWER].IsUnderControl(TEAM_ALLIANCE));
data << uint32(MAGE_TOWER_UNCONTROL) << uint32(_capturePointInfo[POINT_MAGE_TOWER].IsUncontrolled());
data << uint32(FEL_REAVER_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_FEL_REAVER].IsUnderControl(TEAM_HORDE));
data << uint32(FEL_REAVER_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_FEL_REAVER].IsUnderControl(TEAM_ALLIANCE));
data << uint32(FEL_REAVER_UNCONTROL) << uint32(_capturePointInfo[POINT_FEL_REAVER].IsUncontrolled());
data << uint32(BLOOD_ELF_HORDE_CONTROL) << uint32(_capturePointInfo[POINT_BLOOD_ELF].IsUnderControl(TEAM_HORDE));
data << uint32(BLOOD_ELF_ALLIANCE_CONTROL) << uint32(_capturePointInfo[POINT_BLOOD_ELF].IsUnderControl(TEAM_ALLIANCE));
data << uint32(BLOOD_ELF_UNCONTROL) << uint32(_capturePointInfo[POINT_BLOOD_ELF].IsUncontrolled());
data << uint32(NETHERSTORM_FLAG) << uint32(_flagState == BG_EY_FLAG_STATE_ON_BASE);
data << uint32(NETHERSTORM_FLAG_STATE_HORDE) << uint32(1);
data << uint32(NETHERSTORM_FLAG_STATE_HORDE) << uint32(1);
data << uint32(NETHERSTORM_FLAG_STATE_ALLIANCE) << uint32(1);
data << uint32(EY_HORDE_RESOURCES) << uint32(GetTeamScore(TEAM_HORDE));
data << uint32(EY_ALLIANCE_RESOURCES) << uint32(GetTeamScore(TEAM_ALLIANCE));
data << uint32(PROGRESS_BAR_SHOW) << uint32(0);
data << uint32(PROGRESS_BAR_PERCENT_GREY) << uint32(0);
data << uint32(PROGRESS_BAR_STATUS) << uint32(0);
data << uint32(EY_HORDE_RESOURCES) << uint32(GetTeamScore(TEAM_HORDE));
data << uint32(EY_ALLIANCE_RESOURCES) << uint32(GetTeamScore(TEAM_ALLIANCE));
data << uint32(PROGRESS_BAR_SHOW) << uint32(0);
data << uint32(PROGRESS_BAR_PERCENT_GREY) << uint32(0);
data << uint32(PROGRESS_BAR_STATUS) << uint32(0);
}
WorldSafeLocsEntry const* BattlegroundEY::GetClosestGraveyard(Player* player)
@@ -574,10 +574,10 @@ WorldSafeLocsEntry const* BattlegroundEY::GetClosestGraveyard(Player* player)
float pY = player->GetPositionY();
float pZ = player->GetPositionZ();
float dist = (entry->x - pX)*(entry->x - pX) + (entry->y - pY)*(entry->y - pY) + (entry->z - pZ)*(entry->z - pZ);
float minDist = dist;
float minDist = dist;
for (uint8 i = 0; i < EY_POINTS_MAX; ++i)
if (_capturePointInfo[i].IsUnderControl(player->GetTeamId()))
if (_capturePointInfo[i].IsUnderControl(player->GetTeamId()))
{
entry = sWorldSafeLocsStore.LookupEntry(m_CapturingPointTypes[i].GraveYardId);
dist = (entry->x - pX)*(entry->x - pX) + (entry->y - pY)*(entry->y - pY) + (entry->z - pZ)*(entry->z - pZ);
@@ -595,7 +595,7 @@ bool BattlegroundEY::AllNodesConrolledByTeam(TeamId teamId) const
{
uint32 count = 0;
for (uint8 i = 0; i < EY_POINTS_MAX; ++i)
if (_capturePointInfo[i].IsUnderControl(teamId))
if (_capturePointInfo[i].IsUnderControl(teamId))
++count;
return count == EY_POINTS_MAX;
@@ -603,8 +603,8 @@ bool BattlegroundEY::AllNodesConrolledByTeam(TeamId teamId) const
TeamId BattlegroundEY::GetPrematureWinner()
{
if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE))
return TEAM_ALLIANCE;
if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE))
return TEAM_ALLIANCE;
return GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : Battleground::GetPrematureWinner();
return GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : Battleground::GetPrematureWinner();
}
@@ -10,16 +10,16 @@ REWRITTEN BY XINEF
enum BG_EY_Events
{
BG_EY_EVENT_ADD_POINTS = 1,
BG_EY_EVENT_FLAG_ON_GROUND = 2,
BG_EY_EVENT_RESPAWN_FLAG = 3,
BG_EY_EVENT_CHECK_CPOINTS = 4
BG_EY_EVENT_ADD_POINTS = 1,
BG_EY_EVENT_FLAG_ON_GROUND = 2,
BG_EY_EVENT_RESPAWN_FLAG = 3,
BG_EY_EVENT_CHECK_CPOINTS = 4
};
enum BG_EY_Timers
{
BG_EY_FLAG_RESPAWN_TIME = 20*IN_MILLISECONDS,
BG_EY_FLAG_ON_GROUND_TIME = 10*IN_MILLISECONDS,
BG_EY_FLAG_ON_GROUND_TIME = 10*IN_MILLISECONDS,
BG_EY_FPOINTS_CHECK_TIME = 2*IN_MILLISECONDS,
BG_EY_FPOINTS_TICK_TIME = 1*IN_MILLISECONDS
};
@@ -98,14 +98,14 @@ enum BG_EY_ObjectEntry
enum BG_EY_AreaTriggers
{
AT_BLOOD_ELF_POINT = 4476,
AT_FEL_REAVER_POINT = 4514,
AT_MAGE_TOWER_POINT = 4516,
AT_DRAENEI_RUINS_POINT = 4518,
AT_BLOOD_ELF_BUFF = 4568,
AT_FEL_REAVER_BUFF = 4569,
AT_MAGE_TOWER_BUFF = 4570,
AT_DRAENEI_RUINS_BUFF = 4571
AT_BLOOD_ELF_POINT = 4476,
AT_FEL_REAVER_POINT = 4514,
AT_MAGE_TOWER_POINT = 4516,
AT_DRAENEI_RUINS_POINT = 4518,
AT_BLOOD_ELF_BUFF = 4568,
AT_FEL_REAVER_BUFF = 4569,
AT_MAGE_TOWER_BUFF = 4570,
AT_DRAENEI_RUINS_BUFF = 4571
};
enum BG_EY_Graveyards
@@ -120,11 +120,11 @@ enum BG_EY_Graveyards
enum BG_EY_Points
{
POINT_FEL_REAVER = 0,
POINT_BLOOD_ELF = 1,
POINT_DRAENEI_RUINS = 2,
POINT_MAGE_TOWER = 3,
EY_POINTS_MAX = 4
POINT_FEL_REAVER = 0,
POINT_BLOOD_ELF = 1,
POINT_DRAENEI_RUINS = 2,
POINT_MAGE_TOWER = 3,
EY_POINTS_MAX = 4
};
enum BG_EY_CreatureTypes
@@ -214,11 +214,11 @@ enum BG_EY_Score
BG_EY_WARNING_NEAR_VICTORY_SCORE = 1400,
BG_EY_MAX_TEAM_SCORE = 1600,
BG_EY_HONOR_TICK_WEEKEND = 160,
BG_EY_HONOR_TICK_NORMAL = 260,
BG_EY_HONOR_TICK_WEEKEND = 160,
BG_EY_HONOR_TICK_NORMAL = 260,
BG_EY_EVENT_START_BATTLE = 13180, // Achievement: Flurry
BG_EY_OBJECTIVE_CAPTURE_FLAG = 183
BG_EY_EVENT_START_BATTLE = 13180, // Achievement: Flurry
BG_EY_OBJECTIVE_CAPTURE_FLAG = 183
};
enum BG_EY_FlagState
@@ -366,26 +366,26 @@ class BattlegroundEY : public Battleground
/* Scorekeeping */
void AddPoints(TeamId teamId, uint32 points);
struct CapturePointInfo
{
CapturePointInfo() : _ownerTeamId(TEAM_NEUTRAL), _barStatus(BG_EY_PROGRESS_BAR_STATE_MIDDLE), _areaTrigger(0)
{
_playersCount[TEAM_ALLIANCE] = 0;
_playersCount[TEAM_HORDE] = 0;
}
struct CapturePointInfo
{
CapturePointInfo() : _ownerTeamId(TEAM_NEUTRAL), _barStatus(BG_EY_PROGRESS_BAR_STATE_MIDDLE), _areaTrigger(0)
{
_playersCount[TEAM_ALLIANCE] = 0;
_playersCount[TEAM_HORDE] = 0;
}
TeamId _ownerTeamId;
uint32 _areaTrigger;
int8 _barStatus;
int8 _playersCount[BG_TEAMS_COUNT];
TeamId _ownerTeamId;
uint32 _areaTrigger;
int8 _barStatus;
int8 _playersCount[BG_TEAMS_COUNT];
bool IsUnderControl(TeamId teamId) const { return _ownerTeamId == teamId; }
bool IsUnderControl() const { return _ownerTeamId != TEAM_NEUTRAL; }
bool IsUncontrolled() const { return _ownerTeamId == TEAM_NEUTRAL; }
};
bool IsUnderControl(TeamId teamId) const { return _ownerTeamId == teamId; }
bool IsUnderControl() const { return _ownerTeamId != TEAM_NEUTRAL; }
bool IsUncontrolled() const { return _ownerTeamId == TEAM_NEUTRAL; }
};
CapturePointInfo _capturePointInfo[EY_POINTS_MAX];
EventMap _bgEvents;
CapturePointInfo _capturePointInfo[EY_POINTS_MAX];
EventMap _bgEvents;
uint32 _honorTics;
uint8 _ownedPointsCount[BG_TEAMS_COUNT];
uint64 _flagKeeperGUID;
@@ -56,7 +56,7 @@ BattlegroundIC::BattlegroundIC()
gunshipHorde = NULL;
gunshipAlliance = NULL;
respawnMap.clear();
respawnMap.clear();
}
BattlegroundIC::~BattlegroundIC()
@@ -71,14 +71,14 @@ void BattlegroundIC::DoAction(uint32 action, uint64 guid)
if (!gunshipAlliance || !gunshipHorde)
return;
Player* player = ObjectAccessor::GetPlayer(*gunshipAlliance, guid);
Player* player = ObjectAccessor::GetPlayer(*gunshipAlliance, guid);
if (!player)
return;
MotionTransport* transport = player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde;
float x = BG_IC_HangarTrigger[player->GetTeamId()].GetPositionX();
float y = BG_IC_HangarTrigger[player->GetTeamId()].GetPositionY();
float z = BG_IC_HangarTrigger[player->GetTeamId()].GetPositionZ();
MotionTransport* transport = player->GetTeamId() == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde;
float x = BG_IC_HangarTrigger[player->GetTeamId()].GetPositionX();
float y = BG_IC_HangarTrigger[player->GetTeamId()].GetPositionY();
float z = BG_IC_HangarTrigger[player->GetTeamId()].GetPositionZ();
transport->CalculatePassengerPosition(x, y, z);
player->TeleportTo(GetMapId(), x, y, z, player->GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT);
@@ -129,46 +129,46 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
{
if (nodePoint[i].timer <= diff)
{
// we need to confirm this, i am not sure if this every 3 minutes
for (uint8 j = 0; j < MAX_CATAPULTS_SPAWNS_PER_FACTION; ++j)
{
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H)+j;
// we need to confirm this, i am not sure if this every 3 minutes
for (uint8 j = 0; j < MAX_CATAPULTS_SPAWNS_PER_FACTION; ++j)
{
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_CATAPULT_1_A : BG_IC_NPC_CATAPULT_1_H)+j;
if (Creature* catapult = GetBGCreature(type))
if (!catapult->IsAlive())
{
// Check if creature respawn time is properly saved
RespawnMap::iterator itr = respawnMap.find(catapult->GetGUIDLow());
if (itr == respawnMap.end() || time(NULL) < itr->second)
continue;
{
// Check if creature respawn time is properly saved
RespawnMap::iterator itr = respawnMap.find(catapult->GetGUIDLow());
if (itr == respawnMap.end() || time(NULL) < itr->second)
continue;
catapult->Relocate(BG_IC_DocksVehiclesCatapults[j].GetPositionX(), BG_IC_DocksVehiclesCatapults[j].GetPositionY(), BG_IC_DocksVehiclesCatapults[j].GetPositionZ(), BG_IC_DocksVehiclesCatapults[j].GetOrientation());
catapult->Respawn(true);
respawnMap.erase(itr);
}
catapult->Relocate(BG_IC_DocksVehiclesCatapults[j].GetPositionX(), BG_IC_DocksVehiclesCatapults[j].GetPositionY(), BG_IC_DocksVehiclesCatapults[j].GetPositionZ(), BG_IC_DocksVehiclesCatapults[j].GetOrientation());
catapult->Respawn(true);
respawnMap.erase(itr);
}
}
// we need to confirm this is blizzlike, not sure if it is every 3 minutes
for (uint8 j = 0; j < MAX_GLAIVE_THROWERS_SPAWNS_PER_FACTION; ++j)
{
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H)+j;
// we need to confirm this is blizzlike, not sure if it is every 3 minutes
for (uint8 j = 0; j < MAX_GLAIVE_THROWERS_SPAWNS_PER_FACTION; ++j)
{
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_GLAIVE_THROWER_1_A : BG_IC_NPC_GLAIVE_THROWER_1_H)+j;
if (Creature* glaiveThrower = GetBGCreature(type))
if (!glaiveThrower->IsAlive())
{
// Check if creature respawn time is properly saved
RespawnMap::iterator itr = respawnMap.find(glaiveThrower->GetGUIDLow());
if (itr == respawnMap.end() || time(NULL) < itr->second)
continue;
{
// Check if creature respawn time is properly saved
RespawnMap::iterator itr = respawnMap.find(glaiveThrower->GetGUIDLow());
if (itr == respawnMap.end() || time(NULL) < itr->second)
continue;
glaiveThrower->Relocate(BG_IC_DocksVehiclesGlaives[j].GetPositionX(), BG_IC_DocksVehiclesGlaives[j].GetPositionY(), BG_IC_DocksVehiclesGlaives[j].GetPositionZ(), BG_IC_DocksVehiclesGlaives[j].GetOrientation());
glaiveThrower->Relocate(BG_IC_DocksVehiclesGlaives[j].GetPositionX(), BG_IC_DocksVehiclesGlaives[j].GetPositionY(), BG_IC_DocksVehiclesGlaives[j].GetPositionZ(), BG_IC_DocksVehiclesGlaives[j].GetOrientation());
glaiveThrower->Respawn(true);
respawnMap.erase(itr);
}
respawnMap.erase(itr);
}
}
docksTimer = DOCKS_UPDATE_TIME;
}
else
nodePoint[i].timer -= diff;
else
nodePoint[i].timer -= diff;
}
}
@@ -183,39 +183,39 @@ void BattlegroundIC::PostUpdateImpl(uint32 diff)
if (Creature* siege = GetBGCreature(siegeType)) // this always should be true
if (!siege->IsAlive())
{
// Check if creature respawn time is properly saved
RespawnMap::iterator itr = respawnMap.find(siege->GetGUIDLow());
if (itr == respawnMap.end() || time(NULL) < itr->second)
continue;
// Check if creature respawn time is properly saved
RespawnMap::iterator itr = respawnMap.find(siege->GetGUIDLow());
if (itr == respawnMap.end() || time(NULL) < itr->second)
continue;
siege->Relocate(BG_IC_WorkshopVehicles[4].GetPositionX(), BG_IC_WorkshopVehicles[4].GetPositionY(), BG_IC_WorkshopVehicles[4].GetPositionZ(), BG_IC_WorkshopVehicles[4].GetOrientation());
siege->Relocate(BG_IC_WorkshopVehicles[4].GetPositionX(), BG_IC_WorkshopVehicles[4].GetPositionY(), BG_IC_WorkshopVehicles[4].GetPositionZ(), BG_IC_WorkshopVehicles[4].GetOrientation());
siege->Respawn(true);
respawnMap.erase(itr);
}
respawnMap.erase(itr);
}
// we need to confirm this, i am not sure if this every 3 minutes
for (uint8 u = 0; u < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; ++u)
{
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H)+u;
if (Creature* demolisher = GetBGCreature(type))
// we need to confirm this, i am not sure if this every 3 minutes
for (uint8 u = 0; u < MAX_DEMOLISHERS_SPAWNS_PER_FACTION; ++u)
{
uint8 type = (nodePoint[i].faction == TEAM_ALLIANCE ? BG_IC_NPC_DEMOLISHER_1_A : BG_IC_NPC_DEMOLISHER_1_H)+u;
if (Creature* demolisher = GetBGCreature(type))
if (!demolisher->IsAlive())
{
// Check if creature respawn time is properly saved
RespawnMap::iterator itr = respawnMap.find(demolisher->GetGUIDLow());
if (itr == respawnMap.end() || time(NULL) < itr->second)
continue;
{
// Check if creature respawn time is properly saved
RespawnMap::iterator itr = respawnMap.find(demolisher->GetGUIDLow());
if (itr == respawnMap.end() || time(NULL) < itr->second)
continue;
demolisher->Relocate(BG_IC_WorkshopVehicles[u].GetPositionX(), BG_IC_WorkshopVehicles[u].GetPositionY(), BG_IC_WorkshopVehicles[u].GetPositionZ(), BG_IC_WorkshopVehicles[u].GetOrientation());
demolisher->Respawn(true);
respawnMap.erase(itr);
}
demolisher->Relocate(BG_IC_WorkshopVehicles[u].GetPositionX(), BG_IC_WorkshopVehicles[u].GetPositionY(), BG_IC_WorkshopVehicles[u].GetPositionZ(), BG_IC_WorkshopVehicles[u].GetOrientation());
demolisher->Respawn(true);
respawnMap.erase(itr);
}
}
siegeEngineWorkshopTimer = WORKSHOP_UPDATE_TIME;
}
else
siegeEngineWorkshopTimer -= diff;
else
siegeEngineWorkshopTimer -= diff;
}
}
@@ -339,27 +339,27 @@ void BattlegroundIC::HandleAreaTrigger(Player* player, uint32 trigger)
if (GetStatus() != STATUS_IN_PROGRESS)
return;
switch (trigger)
{
case AREA_TRIGGER_HORDE_KEEP:
if (player->GetTeamId() != TEAM_ALLIANCE)
return;
for (uint8 i = BG_IC_H_FRONT; i < BG_IC_A_FRONT; ++i)
if (GateStatus[i] == BG_IC_GATE_DESTROYED)
return;
if (!player->HasAchieved(3854)) // ACHIEVEMENT_BACK_DOOR_JOB
player->CastSpell(player, SPELL_BACK_DOOR_JOB, true);
break;
case AREA_TRIGGER_ALLIANCE_KEEP:
if (player->GetTeamId() != TEAM_HORDE)
return;
for (uint8 i = BG_IC_A_FRONT; i < BG_IC_MAXDOOR; ++i)
if (GateStatus[i] == BG_IC_GATE_DESTROYED)
return;
if (!player->HasAchieved(3854)) // ACHIEVEMENT_BACK_DOOR_JOB
player->CastSpell(player, SPELL_BACK_DOOR_JOB, true);
break;
}
switch (trigger)
{
case AREA_TRIGGER_HORDE_KEEP:
if (player->GetTeamId() != TEAM_ALLIANCE)
return;
for (uint8 i = BG_IC_H_FRONT; i < BG_IC_A_FRONT; ++i)
if (GateStatus[i] == BG_IC_GATE_DESTROYED)
return;
if (!player->HasAchieved(3854)) // ACHIEVEMENT_BACK_DOOR_JOB
player->CastSpell(player, SPELL_BACK_DOOR_JOB, true);
break;
case AREA_TRIGGER_ALLIANCE_KEEP:
if (player->GetTeamId() != TEAM_HORDE)
return;
for (uint8 i = BG_IC_A_FRONT; i < BG_IC_MAXDOOR; ++i)
if (GateStatus[i] == BG_IC_GATE_DESTROYED)
return;
if (!player->HasAchieved(3854)) // ACHIEVEMENT_BACK_DOOR_JOB
player->CastSpell(player, SPELL_BACK_DOOR_JOB, true);
break;
}
}
@@ -373,11 +373,11 @@ void BattlegroundIC::UpdatePlayerScore(Player* player, uint32 type, uint32 value
{
case SCORE_BASES_ASSAULTED:
((BattlegroundICScore*)itr->second)->BasesAssaulted += value;
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, IC_OBJECTIVE_ASSAULT_BASE);
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, IC_OBJECTIVE_ASSAULT_BASE);
break;
case SCORE_BASES_DEFENDED:
((BattlegroundICScore*)itr->second)->BasesDefended += value;
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, IC_OBJECTIVE_DEFEND_BASE);
player->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BG_OBJECTIVE_CAPTURE, IC_OBJECTIVE_DEFEND_BASE);
break;
default:
Battleground::UpdatePlayerScore(player, type, value, doAddHonor);
@@ -412,9 +412,9 @@ bool BattlegroundIC::SetupBattleground()
return false;
}
// Horde / Alliance gates, set active
if (i < 6)
GetBGObject(BG_IC_ObjSpawnlocs[i].type)->setActive(true);
// Horde / Alliance gates, set active
if (i < 6)
GetBGObject(BG_IC_ObjSpawnlocs[i].type)->setActive(true);
}
for (uint8 i = 0; i < MAX_FORTRESS_TELEPORTERS_SPAWNS; ++i)
@@ -470,40 +470,40 @@ bool BattlegroundIC::SetupBattleground()
GetBGCreature(i)->setFaction(BG_IC_Factions[0]);
for (uint8 i = BG_IC_NPC_KEEP_CANNON_13; i <= BG_IC_NPC_KEEP_CANNON_25; ++i)
GetBGCreature(i)->setFaction(BG_IC_Factions[1]);
// Flags
if (GameObject* go = GetBGObject(BG_IC_GO_ALLIANCE_BANNER))
{
go->SetUInt32Value(GAMEOBJECT_FACTION, BG_IC_Factions[1]);
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
}
if (GameObject* go = GetBGObject(BG_IC_GO_HORDE_BANNER))
{
go->SetUInt32Value(GAMEOBJECT_FACTION, BG_IC_Factions[0]);
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
}
// Flags
if (GameObject* go = GetBGObject(BG_IC_GO_ALLIANCE_BANNER))
{
go->SetUInt32Value(GAMEOBJECT_FACTION, BG_IC_Factions[1]);
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
}
if (GameObject* go = GetBGObject(BG_IC_GO_HORDE_BANNER))
{
go->SetUInt32Value(GAMEOBJECT_FACTION, BG_IC_Factions[0]);
go->SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
}
// correcting spawn time for keeps bombs
for (uint8 i = BG_IC_GO_HUGE_SEAFORIUM_BOMBS_A_1; i < BG_IC_GO_HUGE_SEAFORIUM_BOMBS_H_4; ++i)
GetBGObject(i)->SetRespawnTime(10);
TurnBosses(false);
TurnBosses(false);
return true;
}
void BattlegroundIC::TurnBosses(bool on)
{
// Make Bosses invisible and passive
// or visible and active
if (Creature* boss = GetBGCreature(BG_IC_NPC_OVERLORD_AGMAR))
{
boss->SetVisible(on);
boss->SetReactState(on ? REACT_AGGRESSIVE : REACT_PASSIVE);
}
if (Creature* boss = GetBGCreature(BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE))
{
boss->SetVisible(on);
boss->SetReactState(on ? REACT_AGGRESSIVE : REACT_PASSIVE);
}
// Make Bosses invisible and passive
// or visible and active
if (Creature* boss = GetBGCreature(BG_IC_NPC_OVERLORD_AGMAR))
{
boss->SetVisible(on);
boss->SetReactState(on ? REACT_AGGRESSIVE : REACT_PASSIVE);
}
if (Creature* boss = GetBGCreature(BG_IC_NPC_HIGH_COMMANDER_HALFORD_WYRMBANE))
{
boss->SetVisible(on);
boss->SetReactState(on ? REACT_AGGRESSIVE : REACT_PASSIVE);
}
}
void BattlegroundIC::HandleKillUnit(Creature* unit, Player* killer)
@@ -526,14 +526,14 @@ void BattlegroundIC::HandleKillUnit(Creature* unit, Player* killer)
//Achievement Mowed Down
// TO-DO: This should be done on the script of each vehicle of the BG.
if (unit->IsVehicle())
{
{
killer->CastSpell(killer, SPELL_DESTROYED_VEHICLE_ACHIEVEMENT, true);
// Xinef: Add to respawn list
if (entry == NPC_DEMOLISHER || entry == NPC_SIEGE_ENGINE_H || entry == NPC_SIEGE_ENGINE_A ||
entry == NPC_GLAIVE_THROWER_A || entry == NPC_GLAIVE_THROWER_H || entry == NPC_CATAPULT)
respawnMap[unit->GetGUIDLow()] = time(NULL) + VEHICLE_RESPAWN_TIME;
}
// Xinef: Add to respawn list
if (entry == NPC_DEMOLISHER || entry == NPC_SIEGE_ENGINE_H || entry == NPC_SIEGE_ENGINE_A ||
entry == NPC_GLAIVE_THROWER_A || entry == NPC_GLAIVE_THROWER_H || entry == NPC_CATAPULT)
respawnMap[unit->GetGUIDLow()] = time(NULL) + VEHICLE_RESPAWN_TIME;
}
}
void BattlegroundIC::HandleKillPlayer(Player* player, Player* killer)
@@ -572,21 +572,21 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
if (nodePoint[i].faction == player->GetTeamId())
return;
// Prevent capturing of keep if none of gates was destroyed
if (nodePoint[i].gameobject_entry == GO_ALLIANCE_BANNER)
{
if (GateStatus[BG_IC_A_FRONT] != BG_IC_GATE_DESTROYED &&
GateStatus[BG_IC_A_WEST] != BG_IC_GATE_DESTROYED &&
GateStatus[BG_IC_A_EAST] != BG_IC_GATE_DESTROYED)
return;
}
else if (nodePoint[i].gameobject_entry == GO_HORDE_BANNER)
{
if (GateStatus[BG_IC_H_FRONT] != BG_IC_GATE_DESTROYED &&
GateStatus[BG_IC_H_WEST] != BG_IC_GATE_DESTROYED &&
GateStatus[BG_IC_H_EAST] != BG_IC_GATE_DESTROYED)
return;
}
// Prevent capturing of keep if none of gates was destroyed
if (nodePoint[i].gameobject_entry == GO_ALLIANCE_BANNER)
{
if (GateStatus[BG_IC_A_FRONT] != BG_IC_GATE_DESTROYED &&
GateStatus[BG_IC_A_WEST] != BG_IC_GATE_DESTROYED &&
GateStatus[BG_IC_A_EAST] != BG_IC_GATE_DESTROYED)
return;
}
else if (nodePoint[i].gameobject_entry == GO_HORDE_BANNER)
{
if (GateStatus[BG_IC_H_FRONT] != BG_IC_GATE_DESTROYED &&
GateStatus[BG_IC_H_WEST] != BG_IC_GATE_DESTROYED &&
GateStatus[BG_IC_H_EAST] != BG_IC_GATE_DESTROYED)
return;
}
uint32 nextBanner = GetNextBanner(&nodePoint[i], player->GetTeamId(), false);
@@ -601,7 +601,7 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
nodePoint[i].timer = BANNER_STATE_CHANGE_TIME; // 1 minute for last change (real faction banner)
nodePoint[i].needChange = true;
RelocateDeadPlayers(BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1 + nodePoint[i].nodeType - 2]);
RelocateDeadPlayers(BgCreatures[BG_IC_NPC_SPIRIT_GUIDE_1 + nodePoint[i].nodeType - 2]);
// if we are here means that the point has been lost, or it is the first capture
@@ -615,7 +615,7 @@ void BattlegroundIC::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
SendMessage2ToAll(LANG_BG_IC_TEAM_ASSAULTED_NODE_2, CHAT_MSG_BG_SYSTEM_NEUTRAL, player, nodePoint[i].string, (player->GetTeamId() == TEAM_ALLIANCE ? LANG_BG_IC_ALLIANCE : LANG_BG_IC_HORDE));
HandleContestedNodes(&nodePoint[i]);
}
else if (nextBanner == nodePoint[i].banners[BANNER_A_CONTROLLED] || nextBanner == nodePoint[i].banners[BANNER_H_CONTROLLED])
else if (nextBanner == nodePoint[i].banners[BANNER_A_CONTROLLED] || nextBanner == nodePoint[i].banners[BANNER_H_CONTROLLED])
// if we are going to spawn the definitve faction banner, we dont need the timer anymore
{
nodePoint[i].timer = BANNER_STATE_CHANGE_TIME;
@@ -718,7 +718,7 @@ void BattlegroundIC::HandleContestedNodes(ICNodePoint* nodePoint)
else
gunshipHorde->GetCreatureListWithEntryInGrid(cannons, NPC_HORDE_GUNSHIP_CANNON, 150.0f);
for (std::list<Creature*>::const_iterator itr = cannons.begin(); itr != cannons.end(); ++itr)
for (std::list<Creature*>::const_iterator itr = cannons.begin(); itr != cannons.end(); ++itr)
{
(*itr)->GetVehicleKit()->RemoveAllPassengers();
(*itr)->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
@@ -755,26 +755,26 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
else
gunshipHorde->GetCreatureListWithEntryInGrid(cannons, NPC_HORDE_GUNSHIP_CANNON, 150.0f);
for (std::list<Creature*>::const_iterator itr = cannons.begin(); itr != cannons.end(); ++itr)
for (std::list<Creature*>::const_iterator itr = cannons.begin(); itr != cannons.end(); ++itr)
(*itr)->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
for (uint8 u = 0; u < MAX_HANGAR_TELEPORTERS_SPAWNS; ++u)
{
uint8 type = BG_IC_GO_HANGAR_TELEPORTER_1 + u;
if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL : GO_HORDE_GUNSHIP_PORTAL), BG_IC_HangarTeleporters[u].GetPositionX(), BG_IC_HangarTeleporters[u].GetPositionY(), BG_IC_HangarTeleporters[u].GetPositionZ(), BG_IC_HangarTeleporters[u].GetOrientation(), 0, 0, 0, 0, RESPAWN_ONE_DAY))
if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL : GO_HORDE_GUNSHIP_PORTAL), BG_IC_HangarTeleporters[u].GetPositionX(), BG_IC_HangarTeleporters[u].GetPositionY(), BG_IC_HangarTeleporters[u].GetPositionZ(), BG_IC_HangarTeleporters[u].GetOrientation(), 0, 0, 0, 0, RESPAWN_ONE_DAY))
sLog->outError("Isle of Conquest: There was an error spawning a gunship portal. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1 + u);
}
for (uint8 u = 0; u < MAX_HANGAR_TELEPORTER_EFFECTS_SPAWNS; ++u)
{
uint8 type = BG_IC_GO_HANGAR_TELEPORTER_EFFECT_1 + u;
if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL_EFFECTS : GO_HORDE_GUNSHIP_PORTAL_EFFECTS), BG_IC_HangarTeleporterEffects[u].GetPositionX(), BG_IC_HangarTeleporterEffects[u].GetPositionY(), BG_IC_HangarTeleporterEffects[u].GetPositionZ(), BG_IC_HangarTeleporterEffects[u].GetOrientation(), 0, 0, 0, 0, RESPAWN_ONE_DAY, GO_STATE_ACTIVE))
if (!AddObject(type, (nodePoint->faction == TEAM_ALLIANCE ? GO_ALLIANCE_GUNSHIP_PORTAL_EFFECTS : GO_HORDE_GUNSHIP_PORTAL_EFFECTS), BG_IC_HangarTeleporterEffects[u].GetPositionX(), BG_IC_HangarTeleporterEffects[u].GetPositionY(), BG_IC_HangarTeleporterEffects[u].GetPositionZ(), BG_IC_HangarTeleporterEffects[u].GetOrientation(), 0, 0, 0, 0, RESPAWN_ONE_DAY, GO_STATE_ACTIVE))
sLog->outError("Isle of Conquest: There was an error spawning a gunship portal effects. Type: %u", BG_IC_GO_HANGAR_TELEPORTER_1 + u);
}
for (uint8 u = 0; u < MAX_TRIGGER_SPAWNS_PER_FACTION; ++u)
{
if (!AddCreature(NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_HangarTrigger[nodePoint->faction].GetPositionX(), BG_IC_HangarTrigger[nodePoint->faction].GetPositionY(), BG_IC_HangarTrigger[nodePoint->faction].GetPositionZ(), BG_IC_HangarTrigger[nodePoint->faction].GetOrientation(), RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
if (!AddCreature(NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING, BG_IC_HangarTrigger[nodePoint->faction].GetPositionX(), BG_IC_HangarTrigger[nodePoint->faction].GetPositionY(), BG_IC_HangarTrigger[nodePoint->faction].GetPositionZ(), BG_IC_HangarTrigger[nodePoint->faction].GetOrientation(), RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
sLog->outError("Isle of Conquest: There was an error spawning a world trigger. Type: %u", BG_IC_NPC_WORLD_TRIGGER_NOT_FLOATING);
}
@@ -783,11 +783,11 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
uint8 type = BG_IC_NPC_GUNSHIP_CAPTAIN_1 + u;
if (type == BG_IC_NPC_GUNSHIP_CAPTAIN_1)
if (AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionX(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionY(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionZ(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetOrientation(), RESPAWN_ONE_DAY))
if (AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionX(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionY(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetPositionZ(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 2 : 0].GetOrientation(), RESPAWN_ONE_DAY))
GetBGCreature(BG_IC_NPC_GUNSHIP_CAPTAIN_1)->GetAI()->DoAction(ACTION_GUNSHIP_READY);
if (type == BG_IC_NPC_GUNSHIP_CAPTAIN_2)
if (!AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionX(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionY(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionZ(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetOrientation(), RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
if (!AddCreature(nodePoint->faction == TEAM_ALLIANCE ? NPC_ALLIANCE_GUNSHIP_CAPTAIN : NPC_HORDE_GUNSHIP_CAPTAIN, type, BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionX(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionY(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetPositionZ(), BG_IC_HangarCaptains[nodePoint->faction == TEAM_ALLIANCE ? 3 : 1].GetOrientation(), RESPAWN_ONE_DAY, nodePoint->faction == TEAM_ALLIANCE ? gunshipAlliance : gunshipHorde))
sLog->outError("Isle of Conquest: There was an error spawning a world trigger. Type: %u", BG_IC_NPC_GUNSHIP_CAPTAIN_2);
}
@@ -869,17 +869,17 @@ void BattlegroundIC::HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture)
RESPAWN_ONE_DAY);
}
if (Creature* siegeEngine = GetBGCreature(siegeType))
if (Creature* siegeEngine = GetBGCreature(siegeType))
{
siegeEngine->setFaction(BG_IC_Factions[(nodePoint->faction == TEAM_ALLIANCE ? 0 : 1)]);
siegeEngine->SetCorpseDelay(5*MINUTE);
siegeEngine->SetCorpseDelay(5*MINUTE);
if (siegeEngine->IsAlive())
if (Vehicle* siegeVehicle = siegeEngine->GetVehicleKit())
if (!siegeVehicle->IsVehicleInUse())
Unit::Kill(siegeEngine, siegeEngine);
if (siegeEngine->IsAlive())
if (Vehicle* siegeVehicle = siegeEngine->GetVehicleKit())
if (!siegeVehicle->IsVehicleInUse())
Unit::Kill(siegeEngine, siegeEngine);
respawnMap[siegeEngine->GetGUIDLow()] = time(NULL) + VEHICLE_RESPAWN_TIME;
respawnMap[siegeEngine->GetGUIDLow()] = time(NULL) + VEHICLE_RESPAWN_TIME;
}
}
@@ -914,33 +914,33 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go)
UpdateWorldState(uws_open, 1);
}
TeamId teamId = TEAM_ALLIANCE;
TeamId teamId = TEAM_ALLIANCE;
uint32 lang_entry = 0;
switch (go->GetEntry())
{
case GO_HORDE_GATE_1:
lang_entry = LANG_BG_IC_NORTH_GATE_DESTROYED;
break;
case GO_HORDE_GATE_2:
break;
case GO_HORDE_GATE_2:
lang_entry = LANG_BG_IC_EAST_GATE_DESTROYED;
break;
case GO_HORDE_GATE_3:
lang_entry = LANG_BG_IC_WEST_GATE_DESTROYED;
break;
case GO_ALLIANCE_GATE_1:
teamId = TEAM_HORDE;
teamId = TEAM_HORDE;
lang_entry = LANG_BG_IC_WEST_GATE_DESTROYED;
break;
case GO_ALLIANCE_GATE_2:
teamId = TEAM_HORDE;
teamId = TEAM_HORDE;
lang_entry = LANG_BG_IC_EAST_GATE_DESTROYED;
break;
case GO_ALLIANCE_GATE_3:
teamId = TEAM_HORDE;
teamId = TEAM_HORDE;
lang_entry = LANG_BG_IC_SOUTH_GATE_DESTROYED;
break;
default:
break;
default:
break;
}
if (teamId == TEAM_ALLIANCE)
@@ -954,7 +954,7 @@ void BattlegroundIC::DestroyGate(Player* player, GameObject* go)
GetBGObject(BG_IC_GO_ALLIANCE_BANNER)->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE);
}
TurnBosses(true);
TurnBosses(true);
SendMessage2ToAll(lang_entry, CHAT_MSG_BG_SYSTEM_NEUTRAL, NULL, (teamId == TEAM_ALLIANCE ? LANG_BG_IC_HORDE_KEEP : LANG_BG_IC_ALLIANCE_KEEP));
}
@@ -968,7 +968,7 @@ WorldSafeLocsEntry const* BattlegroundIC::GetClosestGraveyard(Player* player)
// Is there any occupied node for this team?
std::vector<uint8> nodes;
for (uint8 i = 0; i < MAX_NODE_TYPES; ++i)
if (nodePoint[i].faction == player->GetTeamId() && !nodePoint[i].needChange) // xinef: controlled by faction and not contested!
if (nodePoint[i].faction == player->GetTeamId() && !nodePoint[i].needChange) // xinef: controlled by faction and not contested!
nodes.push_back(i);
WorldSafeLocsEntry const* good_entry = NULL;
@@ -995,7 +995,7 @@ WorldSafeLocsEntry const* BattlegroundIC::GetClosestGraveyard(Player* player)
}
// If not, place ghost on starting location
if (!good_entry)
good_entry = sWorldSafeLocsStore.LookupEntry(BG_IC_GraveyardIds[player->GetTeamId()+MAX_NODE_TYPES]);
good_entry = sWorldSafeLocsStore.LookupEntry(BG_IC_GraveyardIds[player->GetTeamId()+MAX_NODE_TYPES]);
return good_entry;
}
@@ -36,7 +36,7 @@ enum creaturesIC
NPC_KOR_KRON_GUARD = 34918, // horde guard
NPC_SEVEN_TH_LEGION_INFANTRY = 34919, // alliance guard
NPC_KEEP_CANNON = 34944,
NPC_BROKEN_KEEP_CANNON = 35819,
NPC_BROKEN_KEEP_CANNON = 35819,
NPC_DEMOLISHER = 34775,
NPC_SIEGE_ENGINE_H = 35069,
NPC_SIEGE_ENGINE_A = 34776,
@@ -194,7 +194,7 @@ enum Times
{
WORKSHOP_UPDATE_TIME = 10000, // 10 seconds
DOCKS_UPDATE_TIME = 10000, // 10 seconds
VEHICLE_RESPAWN_TIME = 180, // 3 minutes, not sure
VEHICLE_RESPAWN_TIME = 180, // 3 minutes, not sure
IC_RESOURCE_TIME = 45000, // not sure, need more research
CLOSE_DOORS_TIME = 20000,
BANNER_STATE_CHANGE_TIME = 60000,
@@ -203,11 +203,11 @@ enum Times
enum Actions
{
ACTION_GUNSHIP_READY = 1,
ACTION_TELEPORT_PLAYER_TO_TRANSPORT = 2,
ACTION_GUNSHIP_READY = 1,
ACTION_TELEPORT_PLAYER_TO_TRANSPORT = 2,
AREA_TRIGGER_HORDE_KEEP = 5535,
AREA_TRIGGER_ALLIANCE_KEEP = 5536
AREA_TRIGGER_HORDE_KEEP = 5535,
AREA_TRIGGER_ALLIANCE_KEEP = 5536
};
struct ICNpc
@@ -710,19 +710,19 @@ const Position workshopBombs[2] =
enum Spells
{
SPELL_OIL_REFINERY = 68719,
SPELL_QUARRY = 68720,
SPELL_OIL_REFINERY = 68719,
SPELL_QUARRY = 68720,
SPELL_DESTROYED_VEHICLE_ACHIEVEMENT = 68357,
SPELL_BACK_DOOR_JOB = 68502,
SPELL_DESTROYED_VEHICLE_ACHIEVEMENT = 68357,
SPELL_BACK_DOOR_JOB = 68502,
SPELL_DRIVING_CREDIT_DEMOLISHER = 68365,
SPELL_DRIVING_CREDIT_GLAIVE = 68363,
SPELL_DRIVING_CREDIT_SIEGE = 68364,
SPELL_DRIVING_CREDIT_CATAPULT = 68362,
SPELL_DRIVING_CREDIT_DEMOLISHER = 68365,
SPELL_DRIVING_CREDIT_GLAIVE = 68363,
SPELL_DRIVING_CREDIT_SIEGE = 68364,
SPELL_DRIVING_CREDIT_CATAPULT = 68362,
SPELL_REPAIR_TURRET_CHANNEL = 68077,
SPELL_REPAIR_TURRET_DUMMY = 68078,
SPELL_REPAIR_TURRET_CHANNEL = 68077,
SPELL_REPAIR_TURRET_DUMMY = 68078,
SPELL_SIMPLE_TELEPORT = 12980,
SPELL_TELEPORT_VISUAL_ONLY = 51347,
@@ -932,8 +932,8 @@ class BattlegroundIC : public Battleground
uint32 GetNodeState(uint8 nodeType) const { return (uint8)nodePoint[nodeType].nodeState; }
bool AllNodesConrolledByTeam(TeamId teamId) const; // overwrited
bool IsResourceGlutAllowed(TeamId teamId) const;
void DoAction(uint32 action, uint64 guid);
bool IsResourceGlutAllowed(TeamId teamId) const;
void DoAction(uint32 action, uint64 guid);
private:
uint32 closeFortressDoorsTimer;
bool doorsClosed;
@@ -944,8 +944,8 @@ class BattlegroundIC : public Battleground
BG_IC_GateState GateStatus[6];
ICNodePoint nodePoint[7];
typedef std::map<uint32, uint32> RespawnMap;
RespawnMap respawnMap;
typedef std::map<uint32, uint32> RespawnMap;
RespawnMap respawnMap;
MotionTransport* gunshipAlliance;
MotionTransport* gunshipHorde;
@@ -998,7 +998,7 @@ class BattlegroundIC : public Battleground
void UpdateNodeWorldState(ICNodePoint* nodePoint);
void HandleCapturedNodes(ICNodePoint* nodePoint, bool recapture);
void HandleContestedNodes(ICNodePoint* nodePoint);
void TurnBosses(bool on);
void TurnBosses(bool on);
};
#endif
@@ -108,12 +108,12 @@ void BattlegroundNA::HandleAreaTrigger(Player* player, uint32 trigger)
case 4536: // buff trigger?
case 4537: // buff trigger?
break;
// OUTSIDE OF ARENA, TELEPORT!
case 4917:
case 5006:
case 5008:
player->NearTeleportTo(4054.15f, 2923.7f, 13.4f, player->GetOrientation());
break;
// OUTSIDE OF ARENA, TELEPORT!
case 4917:
case 5006:
case 5008:
player->NearTeleportTo(4054.15f, 2923.7f, 13.4f, player->GetOrientation());
break;
}
}
@@ -28,8 +28,8 @@ enum BattlegroundNAObjectTypes
BG_NA_OBJECT_DOOR_4 = 3,
BG_NA_OBJECT_BUFF_1 = 4,
BG_NA_OBJECT_BUFF_2 = 5,
BG_NA_OBJECT_READY_MARKER_1 = 6,
BG_NA_OBJECT_READY_MARKER_2 = 7,
BG_NA_OBJECT_READY_MARKER_1 = 6,
BG_NA_OBJECT_READY_MARKER_2 = 7,
BG_NA_OBJECT_MAX = 8
};
@@ -63,7 +63,7 @@ void BattlegroundRL::AddPlayer(Player* player)
{
Battleground::AddPlayer(player);
PlayerScores[player->GetGUID()] = new BattlegroundScore(player);
Battleground::UpdateArenaWorldState();
Battleground::UpdateArenaWorldState();
}
void BattlegroundRL::RemovePlayer(Player* /*player*/)
@@ -108,38 +108,38 @@ void BattlegroundRL::HandleAreaTrigger(Player* player, uint32 trigger)
case 4696: // buff trigger?
case 4697: // buff trigger?
break;
// OUTSIDE OF ARENA, TELEPORT!
case 4927:
case 4928:
player->NearTeleportTo(1230.77f, 1662.42f, 34.56f, 0.0f);
break;
case 4929:
case 4930:
player->NearTeleportTo(1341.16f, 1673.52f, 34.43f, 3.5f);
break;
case 4931:
player->NearTeleportTo(1294.74f, 1584.5f, 31.62f, 1.66f);
break;
case 4932:
player->NearTeleportTo(1277.5f, 1751.07f, 31.61f, 4.7f);
break;
case 4933:
player->NearTeleportTo(1269.14f, 1713.85f, 34.46f, 5.23f);
break;
case 4934:
player->NearTeleportTo(1298.14f, 1713.8f, 33.58f, 4.55f);
break;
case 4935:
player->NearTeleportTo(1306.32f, 1620.75f, 34.25f, 1.97f);
break;
case 4936:
player->NearTeleportTo(1277.97f, 1615.51f, 34.56f, 1.15f);
break;
case 4941: // under arena +10
case 5041: // under arena -10
case 5042: // under arena -30
player->NearTeleportTo(1285.810547f, 1667.896851f, 39.957642f, player->GetOrientation());
break;
// OUTSIDE OF ARENA, TELEPORT!
case 4927:
case 4928:
player->NearTeleportTo(1230.77f, 1662.42f, 34.56f, 0.0f);
break;
case 4929:
case 4930:
player->NearTeleportTo(1341.16f, 1673.52f, 34.43f, 3.5f);
break;
case 4931:
player->NearTeleportTo(1294.74f, 1584.5f, 31.62f, 1.66f);
break;
case 4932:
player->NearTeleportTo(1277.5f, 1751.07f, 31.61f, 4.7f);
break;
case 4933:
player->NearTeleportTo(1269.14f, 1713.85f, 34.46f, 5.23f);
break;
case 4934:
player->NearTeleportTo(1298.14f, 1713.8f, 33.58f, 4.55f);
break;
case 4935:
player->NearTeleportTo(1306.32f, 1620.75f, 34.25f, 1.97f);
break;
case 4936:
player->NearTeleportTo(1277.97f, 1615.51f, 34.56f, 1.15f);
break;
case 4941: // under arena +10
case 5041: // under arena -10
case 5042: // under arena -30
player->NearTeleportTo(1285.810547f, 1667.896851f, 39.957642f, player->GetOrientation());
break;
}
}
@@ -26,8 +26,8 @@ enum BattlegroundRLObjectTypes
BG_RL_OBJECT_DOOR_2 = 1,
BG_RL_OBJECT_BUFF_1 = 2,
BG_RL_OBJECT_BUFF_2 = 3,
BG_RL_OBJECT_READY_MARKER_1 = 4,
BG_RL_OBJECT_READY_MARKER_2 = 5,
BG_RL_OBJECT_READY_MARKER_1 = 4,
BG_RL_OBJECT_READY_MARKER_2 = 5,
BG_RL_OBJECT_MAX = 6
};
@@ -46,26 +46,26 @@ BattlegroundRV::~BattlegroundRV() { }
void BattlegroundRV::TeleportUnitToNewZ(Unit* unit, float newZ, bool casting)
{
if (!unit->IsAlive())
return;
if (!unit->IsAlive())
return;
unit->NearTeleportTo(unit->GetPositionX(), unit->GetPositionY(), newZ, unit->GetOrientation(), casting);
unit->m_positionZ = newZ;
}
void BattlegroundRV::CheckPositionForUnit(Unit* unit)
{
// get height at current pos, if something is wrong (below or high above) - teleport
if (!unit->IsFalling() && unit->IsAlive())
{
float groundZ_vmap = unit->GetMap()->GetHeight(unit->GetPositionX(), unit->GetPositionY(), 37.0f, true, 50.0f);
float groundZ_dyntree = unit->GetMap()->GetDynamicMapTree().getHeight(unit->GetPositionX(), unit->GetPositionY(), 37.0f, 50.0f, unit->GetPhaseMask());
if (groundZ_vmap > 28.0f && groundZ_vmap < 29.0f || groundZ_dyntree > 28.0f && groundZ_dyntree < 37.0f)
{
float groundZ = std::max<float>(groundZ_vmap, groundZ_dyntree);
if (unit->GetPositionZ() < groundZ - 0.2f || unit->GetPositionZ() > groundZ + 3.5f)
TeleportUnitToNewZ(unit, groundZ+1.0f, true);
}
}
// get height at current pos, if something is wrong (below or high above) - teleport
if (!unit->IsFalling() && unit->IsAlive())
{
float groundZ_vmap = unit->GetMap()->GetHeight(unit->GetPositionX(), unit->GetPositionY(), 37.0f, true, 50.0f);
float groundZ_dyntree = unit->GetMap()->GetDynamicMapTree().getHeight(unit->GetPositionX(), unit->GetPositionY(), 37.0f, 50.0f, unit->GetPhaseMask());
if (groundZ_vmap > 28.0f && groundZ_vmap < 29.0f || groundZ_dyntree > 28.0f && groundZ_dyntree < 37.0f)
{
float groundZ = std::max<float>(groundZ_vmap, groundZ_dyntree);
if (unit->GetPositionZ() < groundZ - 0.2f || unit->GetPositionZ() > groundZ + 3.5f)
TeleportUnitToNewZ(unit, groundZ+1.0f, true);
}
}
}
void BattlegroundRV::PostUpdateImpl(uint32 diff)
@@ -87,11 +87,11 @@ void BattlegroundRV::PostUpdateImpl(uint32 diff)
if (Player* player = itr->second)
{
// Demonic Circle Summon
if (GameObject* gObj = player->GetGameObject(48018))
{
gObj->Relocate(gObj->GetPositionX(), gObj->GetPositionY(), 28.28f);
gObj->UpdateObjectVisibility(true);
}
if (GameObject* gObj = player->GetGameObject(48018))
{
gObj->Relocate(gObj->GetPositionX(), gObj->GetPositionY(), 28.28f);
gObj->UpdateObjectVisibility(true);
}
if (player->GetPositionZ() < 27.0f)
TeleportUnitToNewZ(player, 28.28f, true);
@@ -103,18 +103,18 @@ void BattlegroundRV::PostUpdateImpl(uint32 diff)
TeleportUnitToNewZ(totem, 28.28f, true);
for (Unit::ControlSet::const_iterator itr = player->m_Controlled.begin(); itr != player->m_Controlled.end(); ++itr)
{
{
if ((*itr)->GetPositionZ() < 28.0f)
TeleportUnitToNewZ((*itr), 28.28f, true);
// Xinef: override stay position
if (CharmInfo* charmInfo = (*itr)->GetCharmInfo())
if (charmInfo->IsAtStay())
{
(*itr)->StopMovingOnCurrentPos();
charmInfo->SaveStayPosition(false);
}
}
// Xinef: override stay position
if (CharmInfo* charmInfo = (*itr)->GetCharmInfo())
if (charmInfo->IsAtStay())
{
(*itr)->StopMovingOnCurrentPos();
charmInfo->SaveStayPosition(false);
}
}
}
// fix ground on elevators (so aoe spells can be casted there)
@@ -141,8 +141,8 @@ void BattlegroundRV::PostUpdateImpl(uint32 diff)
else
setTimer(getTimer() - diff);
if (getState() == BG_RV_STATE_OPEN_FENCES)
return;
if (getState() == BG_RV_STATE_OPEN_FENCES)
return;
if (CheckPlayersTimer <= diff)
{
@@ -150,7 +150,7 @@ void BattlegroundRV::PostUpdateImpl(uint32 diff)
for (BattlegroundPlayerMap::iterator itr = m_Players.begin(); itr != m_Players.end(); ++itr)
CheckPositionForUnit(itr->second);
// maybe for pets and m_Controlled also, but not really necessary
// maybe for pets and m_Controlled also, but not really necessary
}
else
CheckPlayersTimer -= diff;
@@ -179,12 +179,12 @@ void BattlegroundRV::StartingEventOpenDoors()
void BattlegroundRV::AddPlayer(Player* player)
{
if (GetStatus() == STATUS_WAIT_JOIN && player->GetBgTeamId() == TEAM_HORDE)
if (GetStatus() == STATUS_WAIT_JOIN && player->GetBgTeamId() == TEAM_HORDE)
player->SetPhaseMask(2, true);
Battleground::AddPlayer(player);
PlayerScores[player->GetGUID()] = new BattlegroundScore(player);
BattlegroundRV::UpdateArenaWorldState();
BattlegroundRV::UpdateArenaWorldState();
}
void BattlegroundRV::RemovePlayer(Player* player)
@@ -195,7 +195,7 @@ void BattlegroundRV::RemovePlayer(Player* player)
if (GetStatus() == STATUS_WAIT_JOIN)
player->SetPhaseMask(1, true);
BattlegroundRV::UpdateArenaWorldState();
BattlegroundRV::UpdateArenaWorldState();
CheckArenaWinConditions();
}
@@ -208,7 +208,7 @@ void BattlegroundRV::HandleKillPlayer(Player* player, Player* killer)
return;
Battleground::HandleKillPlayer(player, killer);
BattlegroundRV::UpdateArenaWorldState();
BattlegroundRV::UpdateArenaWorldState();
CheckArenaWinConditions();
}
@@ -246,7 +246,7 @@ void BattlegroundRV::HandleAreaTrigger(Player* player, uint32 trigger)
void BattlegroundRV::FillInitialWorldStates(WorldPacket &data)
{
data << uint32(BG_RV_WORLD_STATE) << uint32(1);
BattlegroundRV::UpdateArenaWorldState();
BattlegroundRV::UpdateArenaWorldState();
}
void BattlegroundRV::UpdateArenaWorldState()
@@ -304,27 +304,27 @@ bool BattlegroundRV::SetupBattleground()
void BattlegroundRV::UpdatePillars()
{
GameObject* test = GetBgMap()->GetGameObject(BgObjects[BG_RV_OBJECT_PILAR_1]);
if (!test)
return;
GameObject* test = GetBgMap()->GetGameObject(BgObjects[BG_RV_OBJECT_PILAR_1]);
if (!test)
return;
if (test->GetGoState() == GO_STATE_READY)
if (test->GetGoState() == GO_STATE_READY)
{
for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_GEAR_2; ++i)
if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i]))
go->SetGoState(GO_STATE_ACTIVE);
if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i]))
go->SetGoState(GO_STATE_ACTIVE);
for (uint8 i = BG_RV_OBJECT_PILAR_2; i <= BG_RV_OBJECT_PULLEY_2; ++i)
if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i]))
go->SetGoState(GO_STATE_READY);
if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i]))
go->SetGoState(GO_STATE_READY);
}
else
{
for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_GEAR_2; ++i)
if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i]))
go->SetGoState(GO_STATE_READY);
if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i]))
go->SetGoState(GO_STATE_READY);
for (uint8 i = BG_RV_OBJECT_PILAR_2; i <= BG_RV_OBJECT_PULLEY_2; ++i)
if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i]))
go->SetGoState(GO_STATE_ACTIVE);
if (GameObject* go = GetBgMap()->GetGameObject(BgObjects[i]))
go->SetGoState(GO_STATE_ACTIVE);
}
}
@@ -42,8 +42,8 @@ enum BattlegroundRVObjectTypes
BG_RV_OBJECT_ELEVATOR_1,
BG_RV_OBJECT_ELEVATOR_2,
BG_RV_OBJECT_READY_MARKER_1,
BG_RV_OBJECT_READY_MARKER_2,
BG_RV_OBJECT_READY_MARKER_1,
BG_RV_OBJECT_READY_MARKER_2,
BG_RV_OBJECT_MAX,
};
@@ -99,7 +99,7 @@ class BattlegroundRV : public Battleground
void StartingEventOpenDoors();
void Init();
void FillInitialWorldStates(WorldPacket &d);
void UpdateArenaWorldState();
void UpdateArenaWorldState();
void HandleAreaTrigger(Player* player, uint32 trigger);
bool SetupBattleground();
void HandleKillPlayer(Player* player, Player* killer);
@@ -64,7 +64,7 @@ BattlegroundSA::~BattlegroundSA()
void BattlegroundSA::Init()
{
Battleground::Init();
Battleground::Init();
TotalTime = 0;
Attackers = ((urand(0, 1)) ? TEAM_ALLIANCE : TEAM_HORDE);
@@ -74,7 +74,7 @@ void BattlegroundSA::Init()
_notEvenAScratch[TEAM_ALLIANCE] = true;
_notEvenAScratch[TEAM_HORDE] = true;
Status = BG_SA_WARMUP;
_relicClicked = false;
_relicClicked = false;
}
bool BattlegroundSA::SetupBattleground()
@@ -159,11 +159,11 @@ bool BattlegroundSA::ResetObjs()
{
SpawnBGObject(i, RESPAWN_IMMEDIATELY);
if (GameObject* go = GetBGObject(i))
{
go->setActive(true);
go->SetUInt32Value(GAMEOBJECT_FACTION, defF);
go->SetDestructibleBuildingModifyState(false);
}
{
go->setActive(true);
go->SetUInt32Value(GAMEOBJECT_FACTION, defF);
go->SetDestructibleBuildingModifyState(false);
}
}
GetBGObject(BG_SA_TITAN_RELIC)->SetUInt32Value(GAMEOBJECT_FACTION, atF);
@@ -316,7 +316,7 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
SendMessageToAll(LANG_BG_SA_ROUND_TWO_ONE_MINUTE, CHAT_MSG_BG_SYSTEM_NEUTRAL);
}
}
else
else
{
UpdateWaitTimer -= diff;
return;
@@ -354,7 +354,7 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
DemolisherStartState(false);
Status = BG_SA_ROUND_TWO;
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, (Attackers == TEAM_ALLIANCE)?23748:21702);
// status was set to STATUS_WAIT_JOIN manually for Preparation, set it back now
SetStatus(STATUS_IN_PROGRESS);
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
@@ -377,27 +377,27 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
{
if (TotalTime >= BG_SA_ROUNDLENGTH || _relicClicked)
{
if (_relicClicked)
{
RoundScores[0].winner = Attackers;
RoundScores[0].time = TotalTime;
//Achievement Storm the Beach (1310)
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
if (itr->second->GetTeamId() == Attackers)
itr->second->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246);
}
else
{
// cast this before Attackers variable is switched
// cast this spell only upon timer end, no other ability for defenders to win :)
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
itr->second->CastSpell(itr->second, SPELL_SA_END_OF_ROUND, true);
if (_relicClicked)
{
RoundScores[0].winner = Attackers;
RoundScores[0].time = TotalTime;
//Achievement Storm the Beach (1310)
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
if (itr->second->GetTeamId() == Attackers)
itr->second->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 65246);
}
else
{
// cast this before Attackers variable is switched
// cast this spell only upon timer end, no other ability for defenders to win :)
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
itr->second->CastSpell(itr->second, SPELL_SA_END_OF_ROUND, true);
RoundScores[0].winner = Attackers;
RoundScores[0].time = BG_SA_ROUNDLENGTH;
}
RoundScores[0].winner = Attackers;
RoundScores[0].time = BG_SA_ROUNDLENGTH;
}
_relicClicked = false;
_relicClicked = false;
Attackers = (Attackers == TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE;
Status = BG_SA_SECOND_WARMUP;
TotalTime = 0;
@@ -416,9 +416,9 @@ void BattlegroundSA::PostUpdateImpl(uint32 diff)
{
if (TotalTime >= EndRoundTimer)
{
// cast this spell only upon timer end, no other ability for defenders to win :)
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
itr->second->CastSpell(itr->second, SPELL_SA_END_OF_ROUND, true);
// cast this spell only upon timer end, no other ability for defenders to win :)
for (BattlegroundPlayerMap::const_iterator itr = GetPlayers().begin(); itr != GetPlayers().end(); ++itr)
itr->second->CastSpell(itr->second, SPELL_SA_END_OF_ROUND, true);
RoundScores[1].time = BG_SA_ROUNDLENGTH;
RoundScores[1].winner = GetOtherTeamId(Attackers);
@@ -496,7 +496,7 @@ void BattlegroundSA::AddPlayer(Player* player)
SendTransportInit(player);
PlayerScores[player->GetGUID()] = sc;
TeleportToEntrancePosition(player);
TeleportToEntrancePosition(player);
}
void BattlegroundSA::RemovePlayer(Player* /*player*/)
@@ -540,49 +540,49 @@ void BattlegroundSA::TeleportPlayers()
player->SpawnCorpseBones();
}
if (Status == BG_SA_SECOND_WARMUP)
{
player->CastSpell(player, SPELL_PREPARATION, true);
player->GetMotionMaster()->MovementExpired();
}
if (Status == BG_SA_SECOND_WARMUP)
{
player->CastSpell(player, SPELL_PREPARATION, true);
player->GetMotionMaster()->MovementExpired();
}
player->ResetAllPowers();
player->CombatStopWithPets(true);
TeleportToEntrancePosition(player);
TeleportToEntrancePosition(player);
// xinef: one more time, just to be sure
if (Status == BG_SA_SECOND_WARMUP)
player->GetMotionMaster()->Clear(false);
// xinef: one more time, just to be sure
if (Status == BG_SA_SECOND_WARMUP)
player->GetMotionMaster()->Clear(false);
}
}
}
void BattlegroundSA::TeleportToEntrancePosition(Player* player)
{
if (player->GetTeamId() != Attackers)
{
player->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
}
else
{
if (!ShipsStarted)
{
player->CastSpell(player, 12438, true);//Without this player falls before boat loads...
if (urand(0, 1))
player->TeleportTo(607, 2682.936f, -830.368f, 15.0f, 2.895f, 0);
else
player->TeleportTo(607, 2577.003f, 980.261f, 15.0f, 0.807f, 0);
}
else
player->TeleportTo(607, 1600.381f, -106.263f, 8.8745f, 3.78f, 0);
}
if (player->GetTeamId() != Attackers)
{
player->TeleportTo(607, 1209.7f, -65.16f, 70.1f, 0.0f, 0);
}
else
{
if (!ShipsStarted)
{
player->CastSpell(player, 12438, true);//Without this player falls before boat loads...
if (urand(0, 1))
player->TeleportTo(607, 2682.936f, -830.368f, 15.0f, 2.895f, 0);
else
player->TeleportTo(607, 2577.003f, 980.261f, 15.0f, 0.807f, 0);
}
else
player->TeleportTo(607, 1600.381f, -106.263f, 8.8745f, 3.78f, 0);
}
}
void BattlegroundSA::DefendersPortalTeleport(GameObject* portal, Player* plr)
{
if (plr->GetTeamId() == Attackers)
return;
return;
uint32 portal_num = 0;
//get it via X
@@ -629,29 +629,29 @@ void BattlegroundSA::EventPlayerDamagedGO(Player* /*player*/, GameObject* go, ui
else
SendWarningToAll(LANG_BG_SA_WAS_DESTROYED, go->GetGOInfo()->name.c_str());
uint32 i = GetGateIDFromEntry(go->GetEntry());
switch (i)
{
case BG_SA_BLUE_GATE:
case BG_SA_GREEN_GATE:
{
GameObject* go = NULL;
if (go = GetBGObject(BG_SA_RED_GATE))
go->SetDestructibleBuildingModifyState(true);
if (go = GetBGObject(BG_SA_PURPLE_GATE))
go->SetDestructibleBuildingModifyState(true);
break;
}
case BG_SA_RED_GATE:
case BG_SA_PURPLE_GATE:
if (GameObject* go = GetBGObject(BG_SA_YELLOW_GATE))
go->SetDestructibleBuildingModifyState(true);
break;
case BG_SA_YELLOW_GATE:
if (GameObject* go = GetBGObject(BG_SA_ANCIENT_GATE))
go->SetDestructibleBuildingModifyState(true);
break;
}
uint32 i = GetGateIDFromEntry(go->GetEntry());
switch (i)
{
case BG_SA_BLUE_GATE:
case BG_SA_GREEN_GATE:
{
GameObject* go = NULL;
if (go = GetBGObject(BG_SA_RED_GATE))
go->SetDestructibleBuildingModifyState(true);
if (go = GetBGObject(BG_SA_PURPLE_GATE))
go->SetDestructibleBuildingModifyState(true);
break;
}
case BG_SA_RED_GATE:
case BG_SA_PURPLE_GATE:
if (GameObject* go = GetBGObject(BG_SA_YELLOW_GATE))
go->SetDestructibleBuildingModifyState(true);
break;
case BG_SA_YELLOW_GATE:
if (GameObject* go = GetBGObject(BG_SA_ANCIENT_GATE))
go->SetDestructibleBuildingModifyState(true);
break;
}
}
if (eventType == go->GetGOInfo()->building.damageEvent)
@@ -704,7 +704,7 @@ void BattlegroundSA::DemolisherStartState(bool start)
dem->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
}
for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10;i++)
for (uint8 i = BG_SA_GUN_1; i <= BG_SA_GUN_10;i++)
if (Creature* gun = GetBGCreature(i))
{
if (start)
@@ -713,13 +713,13 @@ void BattlegroundSA::DemolisherStartState(bool start)
gun->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE);
}
// xinef: enable first gates damaging at start
if (!start)
{
// xinef: enable first gates damaging at start
if (!start)
{
if (GameObject* go = GetBGObject(BG_SA_GREEN_GATE))
go->SetDestructibleBuildingModifyState(true);
if (GameObject* go = GetBGObject(BG_SA_BLUE_GATE))
go->SetDestructibleBuildingModifyState(true);
go->SetDestructibleBuildingModifyState(true);
if (GameObject* go = GetBGObject(BG_SA_BLUE_GATE))
go->SetDestructibleBuildingModifyState(true);
}
}
@@ -758,17 +758,17 @@ void BattlegroundSA::DestroyGate(Player* player, GameObject* go)
break;
}
UpdateObjectInteractionFlags();
UpdateObjectInteractionFlags();
if (i < 5)
DelObject(i+9);
if (player)
{
UpdatePlayerScore(player, SCORE_DESTROYED_WALL, 1);
if (rewardHonor)
UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(1));
}
if (player)
{
UpdatePlayerScore(player, SCORE_DESTROYED_WALL, 1);
if (rewardHonor)
UpdatePlayerScore(player, SCORE_BONUS_HONOR, GetBonusHonorFromKill(1));
}
}
}
}
@@ -788,24 +788,24 @@ WorldSafeLocsEntry const* BattlegroundSA::GetClosestGraveyard(Player* player)
continue;
WorldSafeLocsEntry const* ret = sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[i]);
// if on beach
if (i == BG_SA_BEACH_GY)
{
if (x > 1400)
return ret;
continue;
}
// if on beach
if (i == BG_SA_BEACH_GY)
{
if (x > 1400)
return ret;
continue;
}
float dist = sqrt(pow(ret->x - x, 2) * pow(ret->y - y, 2));
float dist = sqrt(pow(ret->x - x, 2) * pow(ret->y - y, 2));
if (dist < mindist)
{
{
mindist = dist;
closest = ret;
}
closest = ret;
}
}
if (!closest && GraveyardStatus[BG_SA_BEACH_GY] == player->GetTeamId())
return sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[BG_SA_BEACH_GY]);
if (!closest && GraveyardStatus[BG_SA_BEACH_GY] == player->GetTeamId())
return sWorldSafeLocsStore.LookupEntry(BG_SA_GYEntries[BG_SA_BEACH_GY]);
return closest;
@@ -891,7 +891,7 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
if (GraveyardStatus[i] == Attackers || Source->GetTeamId() != Attackers)
return;
GraveyardStatus[i] = Source->GetTeamId();
GraveyardStatus[i] = Source->GetTeamId();
// Those who are waiting to resurrect at this node are taken to the closest own node's graveyard
std::vector<uint64> ghost_list = m_ReviveQueue[BgCreatures[BG_SA_MAXNPC + i]];
if (!ghost_list.empty())
@@ -909,8 +909,8 @@ void BattlegroundSA::CaptureGraveyard(BG_SA_Graveyards i, Player *Source)
if (ClosestGrave)
player->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation());
}
// xinef: clear resurrect queue for this creature
m_ReviveQueue[BgCreatures[BG_SA_MAXNPC + i]].clear();
// xinef: clear resurrect queue for this creature
m_ReviveQueue[BgCreatures[BG_SA_MAXNPC + i]].clear();
}
DelCreature(BG_SA_MAXNPC + i);
@@ -1017,7 +1017,7 @@ void BattlegroundSA::EventPlayerUsedGO(Player* Source, GameObject* object)
if (Status == BG_SA_ROUND_ONE)
{
_relicClicked = true;
_relicClicked = true;
}
else if (Status == BG_SA_ROUND_TWO)
{
@@ -1123,14 +1123,14 @@ void BattlegroundSA::SendTransportsRemove(Player* player)
bool BattlegroundSA::AllowDefenseOfTheAncients(Player* source)
{
if (source->GetTeamId() == Attackers)
return false;
if (source->GetTeamId() == Attackers)
return false;
for (uint8 i = 0; i <= 5; i++)
{
for (uint8 i = 0; i <= 5; i++)
{
if (GateStatus[i] == BG_SA_GATE_DESTROYED)
return false;
}
return false;
}
return true;
return true;
}
@@ -487,18 +487,18 @@ class BattlegroundSA : public Battleground
/// Update score board
void UpdatePlayerScore(Player* player, uint32 type, uint32 value, bool doAddHonor = true);
// Teleporters
void DefendersPortalTeleport(GameObject* portal, Player* plr);
// Teleporters
void DefendersPortalTeleport(GameObject* portal, Player* plr);
// Achievements
bool AllowDefenseOfTheAncients(Player* source);
// Achievements
bool AllowDefenseOfTheAncients(Player* source);
// Achievement: Not Even a Scratch
bool notEvenAScratch(TeamId teamId) const { return _notEvenAScratch[teamId]; }
private:
/// Return gate id, relative to bg data, according to gameobject id
/// Return gate id, relative to bg data, according to gameobject id
uint32 GetGateIDFromEntry(uint32 id)
{
uint32 i = 0;
@@ -597,8 +597,8 @@ class BattlegroundSA : public Battleground
bool InitSecondRound;
std::map<uint32/*id*/, uint32/*timer*/> DemoliserRespawnList;
// xinef:
bool _relicClicked;
// xinef:
bool _relicClicked;
// Achievement: Not Even a Scratch
bool _notEvenAScratch[BG_TEAMS_COUNT];
@@ -43,49 +43,49 @@ void BattlegroundWS::PostUpdateImpl(uint32 diff)
{
if (GetStatus() == STATUS_IN_PROGRESS)
{
_bgEvents.Update(diff);
switch (_bgEvents.ExecuteEvent())
{
case BG_WS_EVENT_UPDATE_GAME_TIME:
UpdateWorldState(BG_WS_STATE_TIMER, GetMatchTime());
_bgEvents.ScheduleEvent(BG_WS_EVENT_UPDATE_GAME_TIME, ((BG_WS_TOTAL_GAME_TIME - GetStartTime()) % (MINUTE*IN_MILLISECONDS)) + 1);
break;
case BG_WS_EVENT_NO_TIME_LEFT:
if (GetTeamScore(TEAM_ALLIANCE) == GetTeamScore(TEAM_HORDE))
EndBattleground(_lastFlagCaptureTeam);
else
EndBattleground(GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE);
break;
case BG_WS_EVENT_RESPAWN_BOTH_FLAGS:
_bgEvents.Update(diff);
switch (_bgEvents.ExecuteEvent())
{
case BG_WS_EVENT_UPDATE_GAME_TIME:
UpdateWorldState(BG_WS_STATE_TIMER, GetMatchTime());
_bgEvents.ScheduleEvent(BG_WS_EVENT_UPDATE_GAME_TIME, ((BG_WS_TOTAL_GAME_TIME - GetStartTime()) % (MINUTE*IN_MILLISECONDS)) + 1);
break;
case BG_WS_EVENT_NO_TIME_LEFT:
if (GetTeamScore(TEAM_ALLIANCE) == GetTeamScore(TEAM_HORDE))
EndBattleground(_lastFlagCaptureTeam);
else
EndBattleground(GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : TEAM_ALLIANCE);
break;
case BG_WS_EVENT_RESPAWN_BOTH_FLAGS:
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY);
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY);
SendMessageToAll(LANG_BG_WS_F_PLACED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
break;
case BG_WS_EVENT_ALLIANCE_DROP_FLAG:
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY);
SendMessageToAll(LANG_BG_WS_F_PLACED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
break;
case BG_WS_EVENT_ALLIANCE_DROP_FLAG:
RespawnFlagAfterDrop(TEAM_ALLIANCE);
break;
case BG_WS_EVENT_HORDE_DROP_FLAG:
break;
case BG_WS_EVENT_HORDE_DROP_FLAG:
RespawnFlagAfterDrop(TEAM_HORDE);
break;
case BG_WS_EVENT_BOTH_FLAGS_KEPT10:
break;
case BG_WS_EVENT_BOTH_FLAGS_KEPT10:
if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_ALLIANCE), this->FindBgMap(), (Player*)NULL))
player->CastSpell(player, BG_WS_SPELL_FOCUSED_ASSAULT, true);
if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_HORDE), this->FindBgMap(), (Player*)NULL))
player->CastSpell(player, BG_WS_SPELL_FOCUSED_ASSAULT, true);
break;
case BG_WS_EVENT_BOTH_FLAGS_KEPT15:
if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_ALLIANCE), this->FindBgMap(), (Player*)NULL))
{
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
break;
case BG_WS_EVENT_BOTH_FLAGS_KEPT15:
if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_ALLIANCE), this->FindBgMap(), (Player*)NULL))
{
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
player->CastSpell(player, BG_WS_SPELL_BRUTAL_ASSAULT, true);
}
}
if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_HORDE), this->FindBgMap(), (Player*)NULL))
{
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
{
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
player->CastSpell(player, BG_WS_SPELL_BRUTAL_ASSAULT, true);
}
break;
}
break;
}
}
}
@@ -117,9 +117,9 @@ void BattlegroundWS::StartingEventOpenDoors()
SpawnBGObject(BG_WS_OBJECT_DOOR_H_4, RESPAWN_ONE_DAY);
StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, WS_EVENT_START_BATTLE);
UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 1);
_bgEvents.ScheduleEvent(BG_WS_EVENT_UPDATE_GAME_TIME, 0);
_bgEvents.ScheduleEvent(BG_WS_EVENT_NO_TIME_LEFT, BG_WS_TOTAL_GAME_TIME - 2*MINUTE*IN_MILLISECONDS); // 27 - 2 = 25 minutes
UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 1);
_bgEvents.ScheduleEvent(BG_WS_EVENT_UPDATE_GAME_TIME, 0);
_bgEvents.ScheduleEvent(BG_WS_EVENT_NO_TIME_LEFT, BG_WS_TOTAL_GAME_TIME - 2*MINUTE*IN_MILLISECONDS); // 27 - 2 = 25 minutes
}
void BattlegroundWS::AddPlayer(Player* player)
@@ -133,18 +133,18 @@ void BattlegroundWS::RespawnFlagAfterDrop(TeamId teamId)
if (GetStatus() != STATUS_IN_PROGRESS || GetFlagState(teamId) != BG_WS_FLAG_STATE_ON_GROUND)
return;
UpdateFlagState(teamId, BG_WS_FLAG_STATE_ON_BASE);
SpawnBGObject(teamId == TEAM_ALLIANCE ? BG_WS_OBJECT_A_FLAG : BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY);
SendMessageToAll(teamId == TEAM_ALLIANCE ? LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED : LANG_BG_WS_HORDE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
UpdateFlagState(teamId, BG_WS_FLAG_STATE_ON_BASE);
SpawnBGObject(teamId == TEAM_ALLIANCE ? BG_WS_OBJECT_A_FLAG : BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY);
SendMessageToAll(teamId == TEAM_ALLIANCE ? LANG_BG_WS_ALLIANCE_FLAG_RESPAWNED : LANG_BG_WS_HORDE_FLAG_RESPAWNED, CHAT_MSG_BG_SYSTEM_NEUTRAL);
PlaySoundToAll(BG_WS_SOUND_FLAGS_RESPAWNED);
if (GameObject* flag = GetBgMap()->GetGameObject(GetDroppedFlagGUID(teamId)))
flag->Delete();
SetDroppedFlagGUID(0, teamId);
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10);
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15);
RemoveAssaultAuras();
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10);
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15);
RemoveAssaultAuras();
}
void BattlegroundWS::EventPlayerCapturedFlag(Player* player)
@@ -153,11 +153,11 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player)
return;
player->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT);
RemoveAssaultAuras();
RemoveAssaultAuras();
AddPoints(player->GetTeamId(), 1);
SetFlagPicker(0, GetOtherTeamId(player->GetTeamId()));
UpdateFlagState(GetOtherTeamId(player->GetTeamId()), BG_WS_FLAG_STATE_ON_BASE);
SetFlagPicker(0, GetOtherTeamId(player->GetTeamId()));
UpdateFlagState(GetOtherTeamId(player->GetTeamId()), BG_WS_FLAG_STATE_ON_BASE);
if (player->GetTeamId() == TEAM_ALLIANCE)
{
player->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
@@ -176,30 +176,30 @@ void BattlegroundWS::EventPlayerCapturedFlag(Player* player)
SpawnBGObject(BG_WS_OBJECT_H_FLAG, BG_WS_FLAG_RESPAWN_TIME);
SpawnBGObject(BG_WS_OBJECT_A_FLAG, BG_WS_FLAG_RESPAWN_TIME);
UpdateWorldState(player->GetTeamId() == TEAM_ALLIANCE ? BG_WS_FLAG_CAPTURES_ALLIANCE : BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(player->GetTeamId()));
UpdateWorldState(player->GetTeamId() == TEAM_ALLIANCE ? BG_WS_FLAG_CAPTURES_ALLIANCE : BG_WS_FLAG_CAPTURES_HORDE, GetTeamScore(player->GetTeamId()));
UpdatePlayerScore(player, SCORE_FLAG_CAPTURES, 1); // +1 flag captures
_lastFlagCaptureTeam = player->GetTeamId();
_lastFlagCaptureTeam = player->GetTeamId();
RewardHonorToTeam(GetBonusHonorFromKill(2), player->GetTeamId());
if (GetTeamScore(TEAM_ALLIANCE) == BG_WS_MAX_TEAM_SCORE || GetTeamScore(TEAM_HORDE) == BG_WS_MAX_TEAM_SCORE)
{
UpdateWorldState(BG_WS_STATE_TIMER_ACTIVE, 0);
EndBattleground(GetTeamScore(TEAM_HORDE) == BG_WS_MAX_TEAM_SCORE ? TEAM_HORDE : TEAM_ALLIANCE);
EndBattleground(GetTeamScore(TEAM_HORDE) == BG_WS_MAX_TEAM_SCORE ? TEAM_HORDE : TEAM_ALLIANCE);
}
else
_bgEvents.ScheduleEvent(BG_WS_EVENT_RESPAWN_BOTH_FLAGS, BG_WS_FLAG_RESPAWN_TIME);
_bgEvents.ScheduleEvent(BG_WS_EVENT_RESPAWN_BOTH_FLAGS, BG_WS_FLAG_RESPAWN_TIME);
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10);
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15);
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10);
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15);
}
void BattlegroundWS::EventPlayerDroppedFlag(Player* player)
{
if (GetFlagPickerGUID(TEAM_HORDE) != player->GetGUID() && GetFlagPickerGUID(TEAM_ALLIANCE) != player->GetGUID())
return;
if (GetFlagPickerGUID(TEAM_HORDE) != player->GetGUID() && GetFlagPickerGUID(TEAM_ALLIANCE) != player->GetGUID())
return;
SetFlagPicker(0, GetOtherTeamId(player->GetTeamId()));
SetFlagPicker(0, GetOtherTeamId(player->GetTeamId()));
player->RemoveAurasDueToSpell(BG_WS_SPELL_WARSONG_FLAG);
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
player->RemoveAurasDueToSpell(BG_WS_SPELL_BRUTAL_ASSAULT);
@@ -210,17 +210,17 @@ void BattlegroundWS::EventPlayerDroppedFlag(Player* player)
player->CastSpell(player, SPELL_RECENTLY_DROPPED_FLAG, true);
if (player->GetTeamId() == TEAM_ALLIANCE)
{
UpdateFlagState(TEAM_HORDE, BG_WS_FLAG_STATE_ON_GROUND);
UpdateFlagState(TEAM_HORDE, BG_WS_FLAG_STATE_ON_GROUND);
player->CastSpell(player, BG_WS_SPELL_WARSONG_FLAG_DROPPED, true);
SendMessageToAll(LANG_BG_WS_DROPPED_HF, CHAT_MSG_BG_SYSTEM_HORDE, player);
_bgEvents.RescheduleEvent(BG_WS_EVENT_HORDE_DROP_FLAG, BG_WS_FLAG_DROP_TIME);
_bgEvents.RescheduleEvent(BG_WS_EVENT_HORDE_DROP_FLAG, BG_WS_FLAG_DROP_TIME);
}
else
{
UpdateFlagState(TEAM_ALLIANCE, BG_WS_FLAG_STATE_ON_GROUND);
UpdateFlagState(TEAM_ALLIANCE, BG_WS_FLAG_STATE_ON_GROUND);
player->CastSpell(player, BG_WS_SPELL_SILVERWING_FLAG_DROPPED, true);
SendMessageToAll(LANG_BG_WS_DROPPED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
_bgEvents.RescheduleEvent(BG_WS_EVENT_ALLIANCE_DROP_FLAG, BG_WS_FLAG_DROP_TIME);
_bgEvents.RescheduleEvent(BG_WS_EVENT_ALLIANCE_DROP_FLAG, BG_WS_FLAG_DROP_TIME);
}
}
@@ -243,14 +243,14 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_SILVERWING_FLAG_PICKED);
PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP);
SendMessageToAll(LANG_BG_WS_PICKEDUP_AF, CHAT_MSG_BG_SYSTEM_HORDE, player);
SendMessageToAll(LANG_BG_WS_PICKEDUP_AF, CHAT_MSG_BG_SYSTEM_HORDE, player);
if (GetFlagState(TEAM_HORDE) != BG_WS_FLAG_STATE_ON_BASE)
{
_bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10, BG_WS_SPELL_FORCE_TIME);
_bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15, BG_WS_SPELL_BRUTAL_TIME);
}
return;
if (GetFlagState(TEAM_HORDE) != BG_WS_FLAG_STATE_ON_BASE)
{
_bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10, BG_WS_SPELL_FORCE_TIME);
_bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15, BG_WS_SPELL_BRUTAL_TIME);
}
return;
}
// Horde Flag picked up from base
@@ -263,75 +263,75 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* player, GameObject* gameOb
player->StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_WARSONG_FLAG_PICKED);
PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP);
SendMessageToAll(LANG_BG_WS_PICKEDUP_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
SendMessageToAll(LANG_BG_WS_PICKEDUP_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
if (GetFlagState(TEAM_ALLIANCE) != BG_WS_FLAG_STATE_ON_BASE)
{
_bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10, BG_WS_SPELL_FORCE_TIME);
_bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15, BG_WS_SPELL_BRUTAL_TIME);
}
return;
if (GetFlagState(TEAM_ALLIANCE) != BG_WS_FLAG_STATE_ON_BASE)
{
_bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10, BG_WS_SPELL_FORCE_TIME);
_bgEvents.RescheduleEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15, BG_WS_SPELL_BRUTAL_TIME);
}
return;
}
// Alliance Flag on ground
if (GetFlagState(TEAM_ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && player->IsWithinDistInMap(gameObject, 10.0f) && gameObject->GetEntry() == BG_OBJECT_A_FLAG_GROUND_WS_ENTRY)
{
SetDroppedFlagGUID(0, TEAM_ALLIANCE);
SetDroppedFlagGUID(0, TEAM_ALLIANCE);
if (player->GetTeamId() == TEAM_ALLIANCE)
{
UpdateFlagState(TEAM_ALLIANCE, BG_WS_FLAG_STATE_ON_BASE);
SpawnBGObject(BG_WS_OBJECT_A_FLAG, RESPAWN_IMMEDIATELY);
UpdatePlayerScore(player, SCORE_FLAG_RETURNS, 1);
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
SendMessageToAll(LANG_BG_WS_RETURNED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10);
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15);
RemoveAssaultAuras();
return;
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
SendMessageToAll(LANG_BG_WS_RETURNED_AF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10);
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15);
RemoveAssaultAuras();
return;
}
else
{
SetFlagPicker(player->GetGUID(), TEAM_ALLIANCE);
SetFlagPicker(player->GetGUID(), TEAM_ALLIANCE);
UpdateFlagState(TEAM_ALLIANCE, BG_WS_FLAG_STATE_ON_PLAYER);
player->CastSpell(player, BG_WS_SPELL_SILVERWING_FLAG, true);
if (uint32 assaultSpellId = GetAssaultSpellId())
if (uint32 assaultSpellId = GetAssaultSpellId())
player->CastSpell(player, assaultSpellId, true);
PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP);
SendMessageToAll(LANG_BG_WS_PICKEDUP_AF, CHAT_MSG_BG_SYSTEM_HORDE, player);
return;
PlaySoundToAll(BG_WS_SOUND_ALLIANCE_FLAG_PICKED_UP);
SendMessageToAll(LANG_BG_WS_PICKEDUP_AF, CHAT_MSG_BG_SYSTEM_HORDE, player);
return;
}
}
// Horde Flag on ground
if (GetFlagState(TEAM_HORDE) == BG_WS_FLAG_STATE_ON_GROUND && player->IsWithinDistInMap(gameObject, 10.0f) && gameObject->GetEntry() == BG_OBJECT_H_FLAG_GROUND_WS_ENTRY)
{
SetDroppedFlagGUID(0, TEAM_HORDE);
SetDroppedFlagGUID(0, TEAM_HORDE);
if (player->GetTeamId() == TEAM_HORDE)
{
UpdateFlagState(TEAM_HORDE, BG_WS_FLAG_STATE_ON_BASE);
SpawnBGObject(BG_WS_OBJECT_H_FLAG, RESPAWN_IMMEDIATELY);
UpdatePlayerScore(player, SCORE_FLAG_RETURNS, 1);
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
SendMessageToAll(LANG_BG_WS_RETURNED_HF, CHAT_MSG_BG_SYSTEM_HORDE, player);
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10);
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15);
RemoveAssaultAuras();
return;
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
SendMessageToAll(LANG_BG_WS_RETURNED_HF, CHAT_MSG_BG_SYSTEM_HORDE, player);
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT10);
_bgEvents.CancelEvent(BG_WS_EVENT_BOTH_FLAGS_KEPT15);
RemoveAssaultAuras();
return;
}
else
{
SetFlagPicker(player->GetGUID(), TEAM_HORDE);
SetFlagPicker(player->GetGUID(), TEAM_HORDE);
UpdateFlagState(TEAM_HORDE, BG_WS_FLAG_STATE_ON_PLAYER);
player->CastSpell(player, BG_WS_SPELL_WARSONG_FLAG, true);
if (uint32 assaultSpellId = GetAssaultSpellId())
if (uint32 assaultSpellId = GetAssaultSpellId())
player->CastSpell(player, assaultSpellId, true);
PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP);
SendMessageToAll(LANG_BG_WS_PICKEDUP_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
return;
PlaySoundToAll(BG_WS_SOUND_HORDE_FLAG_PICKED_UP);
SendMessageToAll(LANG_BG_WS_PICKEDUP_HF, CHAT_MSG_BG_SYSTEM_ALLIANCE, player);
return;
}
}
}
@@ -344,8 +344,8 @@ void BattlegroundWS::RemovePlayer(Player* player)
void BattlegroundWS::UpdateFlagState(TeamId teamId, uint32 value)
{
_flagState[teamId] = value;
UpdateWorldState(teamId == TEAM_ALLIANCE ? BG_WS_FLAG_STATE_HORDE : BG_WS_FLAG_STATE_ALLIANCE, value);
_flagState[teamId] = value;
UpdateWorldState(teamId == TEAM_ALLIANCE ? BG_WS_FLAG_STATE_HORDE : BG_WS_FLAG_STATE_ALLIANCE, value);
}
void BattlegroundWS::HandleAreaTrigger(Player* player, uint32 trigger)
@@ -367,13 +367,13 @@ void BattlegroundWS::HandleAreaTrigger(Player* player, uint32 trigger)
case 3688: // Not used
case 4628: // Not used
case 4629: // Not used
case 3686: // Alliance elixir of speed spawn
case 3686: // Alliance elixir of speed spawn
case 3687: // Horde elixir of speed spawn
case 3706: // Alliance elixir of regeneration spawn
case 3708: // Horde elixir of regeneration spawn
case 3707: // Alliance elixir of berserk spawn
case 3709: // Horde elixir of berserk spawn
break;
break;
}
}
@@ -409,19 +409,19 @@ bool BattlegroundWS::SetupBattleground()
sg = sWorldSafeLocsStore.LookupEntry(WS_GRAVEYARD_MAIN_HORDE);
AddSpiritGuide(WS_SPIRIT_MAIN_HORDE, sg->x, sg->y, sg->z, 3.193953f, TEAM_HORDE);
for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i < BG_WS_OBJECT_MAX; ++i)
if (BgObjects[i] == 0)
{
sLog->outErrorDb("BatteGroundWS: Failed to spawn some object Battleground not created!");
return false;
}
for (uint32 i = BG_WS_OBJECT_DOOR_A_1; i < BG_WS_OBJECT_MAX; ++i)
if (BgObjects[i] == 0)
{
sLog->outErrorDb("BatteGroundWS: Failed to spawn some object Battleground not created!");
return false;
}
for (uint32 i = WS_SPIRIT_MAIN_ALLIANCE; i < BG_CREATURES_MAX_WS; ++i)
if (BgCreatures[i] == 0)
{
sLog->outErrorDb("BatteGroundWS: Failed to spawn spirit guides Battleground not created!");
return false;
}
for (uint32 i = WS_SPIRIT_MAIN_ALLIANCE; i < BG_CREATURES_MAX_WS; ++i)
if (BgCreatures[i] == 0)
{
sLog->outErrorDb("BatteGroundWS: Failed to spawn spirit guides Battleground not created!");
return false;
}
return true;
}
@@ -431,7 +431,7 @@ void BattlegroundWS::Init()
//call parent's class reset
Battleground::Init();
_bgEvents.Reset();
_bgEvents.Reset();
_flagKeepers[TEAM_ALLIANCE] = 0;
_flagKeepers[TEAM_HORDE] = 0;
_droppedFlagGUID[TEAM_ALLIANCE] = 0;
@@ -440,7 +440,7 @@ void BattlegroundWS::Init()
_flagState[TEAM_HORDE] = BG_WS_FLAG_STATE_ON_BASE;
_lastFlagCaptureTeam = TEAM_NEUTRAL;
if (sBattlegroundMgr->IsBGWeekend(GetBgTypeID()))
if (sBattlegroundMgr->IsBGWeekend(GetBgTypeID()))
{
_reputationCapture = 45;
_honorWinKills = 3;
@@ -500,9 +500,9 @@ void BattlegroundWS::UpdatePlayerScore(Player* player, uint32 type, uint32 value
WorldSafeLocsEntry const* BattlegroundWS::GetClosestGraveyard(Player* player)
{
if (GetStatus() == STATUS_IN_PROGRESS)
return sWorldSafeLocsStore.LookupEntry(player->GetTeamId() == TEAM_ALLIANCE ? WS_GRAVEYARD_MAIN_ALLIANCE : WS_GRAVEYARD_MAIN_HORDE);
return sWorldSafeLocsStore.LookupEntry(player->GetTeamId() == TEAM_ALLIANCE ? WS_GRAVEYARD_MAIN_ALLIANCE : WS_GRAVEYARD_MAIN_HORDE);
else
return sWorldSafeLocsStore.LookupEntry(player->GetTeamId() == TEAM_ALLIANCE ? WS_GRAVEYARD_FLAGROOM_ALLIANCE : WS_GRAVEYARD_FLAGROOM_HORDE);
return sWorldSafeLocsStore.LookupEntry(player->GetTeamId() == TEAM_ALLIANCE ? WS_GRAVEYARD_FLAGROOM_ALLIANCE : WS_GRAVEYARD_FLAGROOM_HORDE);
}
void BattlegroundWS::FillInitialWorldStates(WorldPacket& data)
@@ -520,32 +520,32 @@ void BattlegroundWS::FillInitialWorldStates(WorldPacket& data)
TeamId BattlegroundWS::GetPrematureWinner()
{
if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE))
return TEAM_ALLIANCE;
if (GetTeamScore(TEAM_ALLIANCE) > GetTeamScore(TEAM_HORDE))
return TEAM_ALLIANCE;
return GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : Battleground::GetPrematureWinner();
return GetTeamScore(TEAM_HORDE) > GetTeamScore(TEAM_ALLIANCE) ? TEAM_HORDE : Battleground::GetPrematureWinner();
}
uint32 BattlegroundWS::GetAssaultSpellId() const
{
if ((GetFlagPickerGUID(TEAM_ALLIANCE) == 0 && GetFlagState(TEAM_ALLIANCE) != BG_WS_FLAG_STATE_ON_GROUND) ||
(GetFlagPickerGUID(TEAM_HORDE) == 0 && GetFlagState(TEAM_HORDE) != BG_WS_FLAG_STATE_ON_GROUND) ||
_bgEvents.GetNextEventTime(BG_WS_EVENT_BOTH_FLAGS_KEPT10) > 0)
return 0;
if ((GetFlagPickerGUID(TEAM_ALLIANCE) == 0 && GetFlagState(TEAM_ALLIANCE) != BG_WS_FLAG_STATE_ON_GROUND) ||
(GetFlagPickerGUID(TEAM_HORDE) == 0 && GetFlagState(TEAM_HORDE) != BG_WS_FLAG_STATE_ON_GROUND) ||
_bgEvents.GetNextEventTime(BG_WS_EVENT_BOTH_FLAGS_KEPT10) > 0)
return 0;
return _bgEvents.GetNextEventTime(BG_WS_EVENT_BOTH_FLAGS_KEPT15) > 0 ? BG_WS_SPELL_FOCUSED_ASSAULT : BG_WS_SPELL_BRUTAL_ASSAULT;
return _bgEvents.GetNextEventTime(BG_WS_EVENT_BOTH_FLAGS_KEPT15) > 0 ? BG_WS_SPELL_FOCUSED_ASSAULT : BG_WS_SPELL_BRUTAL_ASSAULT;
}
void BattlegroundWS::RemoveAssaultAuras()
{
if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_ALLIANCE), this->FindBgMap(), (Player*)NULL))
{
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_ALLIANCE), this->FindBgMap(), (Player*)NULL))
{
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
player->RemoveAurasDueToSpell(BG_WS_SPELL_BRUTAL_ASSAULT);
}
}
if (Player* player = ObjectAccessor::GetObjectInMap(GetFlagPickerGUID(TEAM_HORDE), this->FindBgMap(), (Player*)NULL))
{
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
{
player->RemoveAurasDueToSpell(BG_WS_SPELL_FOCUSED_ASSAULT);
player->RemoveAurasDueToSpell(BG_WS_SPELL_BRUTAL_ASSAULT);
}
}
}
@@ -9,24 +9,24 @@ REWRITTEN BY XINEF
enum BG_WS_Events
{
BG_WS_EVENT_UPDATE_GAME_TIME = 1,
BG_WS_EVENT_NO_TIME_LEFT = 2,
BG_WS_EVENT_RESPAWN_BOTH_FLAGS = 3,
BG_WS_EVENT_ALLIANCE_DROP_FLAG = 4,
BG_WS_EVENT_HORDE_DROP_FLAG = 5,
BG_WS_EVENT_BOTH_FLAGS_KEPT10 = 6,
BG_WS_EVENT_BOTH_FLAGS_KEPT15 = 7
BG_WS_EVENT_UPDATE_GAME_TIME = 1,
BG_WS_EVENT_NO_TIME_LEFT = 2,
BG_WS_EVENT_RESPAWN_BOTH_FLAGS = 3,
BG_WS_EVENT_ALLIANCE_DROP_FLAG = 4,
BG_WS_EVENT_HORDE_DROP_FLAG = 5,
BG_WS_EVENT_BOTH_FLAGS_KEPT10 = 6,
BG_WS_EVENT_BOTH_FLAGS_KEPT15 = 7
};
enum BG_WS_TimerOrScore
{
BG_WS_MAX_TEAM_SCORE = 3,
BG_WS_MAX_TEAM_SCORE = 3,
BG_WS_TOTAL_GAME_TIME = 27*MINUTE*IN_MILLISECONDS,
BG_WS_FLAG_RESPAWN_TIME = 23*IN_MILLISECONDS,
BG_WS_FLAG_DROP_TIME = 10*IN_MILLISECONDS,
BG_WS_SPELL_FORCE_TIME = 10*MINUTE*IN_MILLISECONDS,
BG_WS_SPELL_BRUTAL_TIME = 15*MINUTE*IN_MILLISECONDS
BG_WS_TOTAL_GAME_TIME = 27*MINUTE*IN_MILLISECONDS,
BG_WS_FLAG_RESPAWN_TIME = 23*IN_MILLISECONDS,
BG_WS_FLAG_DROP_TIME = 10*IN_MILLISECONDS,
BG_WS_SPELL_FORCE_TIME = 10*MINUTE*IN_MILLISECONDS,
BG_WS_SPELL_BRUTAL_TIME = 15*MINUTE*IN_MILLISECONDS
};
enum BG_WS_Sound
@@ -133,7 +133,7 @@ enum BG_WS_Objectives
WS_OBJECTIVE_CAPTURE_FLAG = 42,
WS_OBJECTIVE_RETURN_FLAG = 44,
WS_EVENT_START_BATTLE = 8563
WS_EVENT_START_BATTLE = 8563
};
struct BattlegroundWGScore : public BattlegroundScore
@@ -185,12 +185,12 @@ class BattlegroundWS : public Battleground
void AddPoints(TeamId teamId, uint32 points) { m_TeamScores[teamId] += points; }
TeamId GetPrematureWinner();
uint32 GetMatchTime() const { return 1 + (BG_WS_TOTAL_GAME_TIME - GetStartTime()) / (MINUTE*IN_MILLISECONDS); }
uint32 GetAssaultSpellId() const;
void RemoveAssaultAuras();
uint32 GetMatchTime() const { return 1 + (BG_WS_TOTAL_GAME_TIME - GetStartTime()) / (MINUTE*IN_MILLISECONDS); }
uint32 GetAssaultSpellId() const;
void RemoveAssaultAuras();
private:
EventMap _bgEvents;
EventMap _bgEvents;
uint64 _flagKeepers[2];
uint64 _droppedFlagGUID[2];
+1 -1
View File
@@ -69,7 +69,7 @@ void CalendarMgr::LoadFromDB()
uint32 guildId = 0;
if (flags & CALENDAR_FLAG_GUILD_EVENT || flags & CALENDAR_FLAG_WITHOUT_INVITES)
guildId = Player::GetGuildIdFromStorage(GUID_LOPART(creatorGUID));
guildId = Player::GetGuildIdFromStorage(GUID_LOPART(creatorGUID));
CalendarEvent* calendarEvent = new CalendarEvent(eventId, creatorGUID, guildId, type, dungeonId, time_t(eventTime), flags, time_t(timezoneTime), title, description);
_events.insert(calendarEvent);
+240 -235
View File
@@ -34,7 +34,7 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 channelDBId,
_teamId(teamId),
_ownerGUID(0),
_name(name),
_channelDBId(channelDBId),
_channelDBId(channelDBId),
_password("")
{
// set special flags if built-in channel
@@ -73,20 +73,20 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 channelDBId,
_IsSaved = true;
// Xinef: loading
if (channelDBId > 0)
return;
// Xinef: loading
if (channelDBId > 0)
return;
// If storing custom channels in the db is enabled either load or save the channel
if (sWorld->getBoolConfig(CONFIG_PRESERVE_CUSTOM_CHANNELS))
{
_channelDBId = ++ChannelMgr::_channelIdMax;
_channelDBId = ++ChannelMgr::_channelIdMax;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHANNEL);
stmt->setUInt32(0, _channelDBId);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHANNEL);
stmt->setUInt32(0, _channelDBId);
stmt->setString(1, name);
stmt->setUInt32(2, _teamId);
stmt->setUInt8(3, _announce);
stmt->setUInt8(3, _announce);
CharacterDatabase.Execute(stmt);
}
}
@@ -94,8 +94,8 @@ Channel::Channel(std::string const& name, uint32 channelId, uint32 channelDBId,
bool Channel::IsBanned(uint64 guid) const
{
BannedContainer::const_iterator itr = bannedStore.find(GUID_LOPART(guid));
return itr != bannedStore.end() && itr->second > time(NULL);
BannedContainer::const_iterator itr = bannedStore.find(GUID_LOPART(guid));
return itr != bannedStore.end() && itr->second > time(NULL);
}
void Channel::UpdateChannelInDB() const
@@ -105,7 +105,7 @@ void Channel::UpdateChannelInDB() const
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL);
stmt->setBool(0, _announce);
stmt->setString(1, _password);
stmt->setUInt32(2, _channelDBId);
stmt->setUInt32(2, _channelDBId);
CharacterDatabase.Execute(stmt);
;//sLog->outDebug(LOG_FILTER_CHATSYS, "Channel(%s) updated in database", _name.c_str());
@@ -115,24 +115,24 @@ void Channel::UpdateChannelInDB() const
void Channel::UpdateChannelUseageInDB() const
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHANNEL_USAGE);
stmt->setUInt32(0, _channelDBId);
stmt->setUInt32(0, _channelDBId);
CharacterDatabase.Execute(stmt);
}
void Channel::AddChannelBanToDB(uint32 guid, uint32 time) const
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHANNEL_BAN);
stmt->setUInt32(0, _channelDBId);
stmt->setUInt32(1, guid);
stmt->setUInt32(2, time);
stmt->setUInt32(0, _channelDBId);
stmt->setUInt32(1, guid);
stmt->setUInt32(2, time);
CharacterDatabase.Execute(stmt);
}
void Channel::RemoveChannelBanFromDB(uint32 guid) const
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHANNEL_BAN);
stmt->setUInt32(0, _channelDBId);
stmt->setUInt32(1, guid);
stmt->setUInt32(0, _channelDBId);
stmt->setUInt32(1, guid);
CharacterDatabase.Execute(stmt);
}
@@ -140,16 +140,16 @@ void Channel::CleanOldChannelsInDB()
{
if (sWorld->getIntConfig(CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION) > 0)
{
SQLTransaction trans = CharacterDatabase.BeginTransaction();
SQLTransaction trans = CharacterDatabase.BeginTransaction();
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_OLD_CHANNELS);
stmt->setUInt32(0, sWorld->getIntConfig(CONFIG_PRESERVE_CUSTOM_CHANNEL_DURATION) * DAY);
trans->Append(stmt);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_OLD_CHANNELS_BANS);
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_OLD_CHANNELS_BANS);
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
}
}
@@ -289,176 +289,176 @@ void Channel::LeaveChannel(Player* player, bool send)
// If the channel owner left and there are still playersStore inside, pick a new owner
if (changeowner && _ownership)
{
if (!playersStore.empty())
{
uint64 newowner = 0;
for (Channel::PlayerContainer::const_iterator itr = playersStore.begin(); itr != playersStore.end(); ++itr)
{
newowner = itr->second.player;
if (!itr->second.plrPtr->GetSession()->GetSecurity())
break;
}
SetOwner(newowner);
}
else
SetOwner(0);
if (!playersStore.empty())
{
uint64 newowner = 0;
for (Channel::PlayerContainer::const_iterator itr = playersStore.begin(); itr != playersStore.end(); ++itr)
{
newowner = itr->second.player;
if (!itr->second.plrPtr->GetSession()->GetSecurity())
break;
}
SetOwner(newowner);
}
else
SetOwner(0);
}
}
}
void Channel::KickOrBan(Player const* player, std::string const& badname, bool ban)
{
AccountTypes sec = player->GetSession()->GetSecurity();
uint64 good = player->GetGUID();
AccountTypes sec = player->GetSession()->GetSecurity();
uint64 good = player->GetGUID();
if (!IsOn(good))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, good);
return;
}
if (!IsOn(good))
{
WorldPacket data;
MakeNotMember(&data);
SendToOne(&data, good);
return;
}
if (!playersStore[good].IsModerator() && !AccountMgr::IsGMAccount(sec))
{
WorldPacket data;
MakeNotModerator(&data);
SendToOne(&data, good);
return;
}
if (!playersStore[good].IsModerator() && !AccountMgr::IsGMAccount(sec))
{
WorldPacket data;
MakeNotModerator(&data);
SendToOne(&data, good);
return;
}
bool banOffline = false; // pussywizard
bool isGoodConstantModerator = _channelRights.moderators.find(player->GetSession()->GetAccountId()) != _channelRights.moderators.end();
bool banOffline = false; // pussywizard
bool isGoodConstantModerator = _channelRights.moderators.find(player->GetSession()->GetAccountId()) != _channelRights.moderators.end();
uint64 victim = 0;
uint32 badAccId = 0;
uint32 badSecurity = 0;
Player* bad = ObjectAccessor::FindPlayerByName(badname, false);
if (bad)
{
victim = bad->GetGUID();
badAccId = bad->GetSession()->GetAccountId();
badSecurity = bad->GetSession()->GetSecurity();
}
uint64 victim = 0;
uint32 badAccId = 0;
uint32 badSecurity = 0;
Player* bad = ObjectAccessor::FindPlayerByName(badname, false);
if (bad)
{
victim = bad->GetGUID();
badAccId = bad->GetSession()->GetAccountId();
badSecurity = bad->GetSession()->GetSecurity();
}
bool isOnChannel = victim && IsOn(victim);
if (!isOnChannel)
{
if (ban && (AccountMgr::IsGMAccount(sec) || isGoodConstantModerator))
{
if (uint32 lowGuid = sWorld->GetGlobalPlayerGUID(badname))
if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(lowGuid))
{
if (Player::TeamIdForRace(gpd->race) == Player::TeamIdForRace(player->getRace()))
{
banOffline = true;
victim = MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER);
badAccId = gpd->accountId;
}
else
{
ChatHandler(player->GetSession()).PSendSysMessage("Character %s has other faction!", badname.c_str());
return;
}
}
bool isOnChannel = victim && IsOn(victim);
if (!isOnChannel)
{
if (ban && (AccountMgr::IsGMAccount(sec) || isGoodConstantModerator))
{
if (uint32 lowGuid = sWorld->GetGlobalPlayerGUID(badname))
if (const GlobalPlayerData* gpd = sWorld->GetGlobalPlayerData(lowGuid))
{
if (Player::TeamIdForRace(gpd->race) == Player::TeamIdForRace(player->getRace()))
{
banOffline = true;
victim = MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER);
badAccId = gpd->accountId;
}
else
{
ChatHandler(player->GetSession()).PSendSysMessage("Character %s has other faction!", badname.c_str());
return;
}
}
if (!banOffline)
{
WorldPacket data;
MakePlayerNotFound(&data, badname);
SendToOne(&data, good);
return;
}
}
else
{
WorldPacket data;
MakePlayerNotFound(&data, badname);
SendToOne(&data, good);
return;
}
}
if (!banOffline)
{
WorldPacket data;
MakePlayerNotFound(&data, badname);
SendToOne(&data, good);
return;
}
}
else
{
WorldPacket data;
MakePlayerNotFound(&data, badname);
SendToOne(&data, good);
return;
}
}
bool changeowner = _ownerGUID == victim;
bool isBadConstantModerator = _channelRights.moderators.find(badAccId) != _channelRights.moderators.end();
bool changeowner = _ownerGUID == victim;
bool isBadConstantModerator = _channelRights.moderators.find(badAccId) != _channelRights.moderators.end();
if (!AccountMgr::IsGMAccount(sec) && !isGoodConstantModerator)
{
if (changeowner && good != _ownerGUID)
{
WorldPacket data;
MakeNotOwner(&data);
SendToOne(&data, good);
return;
}
if (!AccountMgr::IsGMAccount(sec) && !isGoodConstantModerator)
{
if (changeowner && good != _ownerGUID)
{
WorldPacket data;
MakeNotOwner(&data);
SendToOne(&data, good);
return;
}
if (ban && (_channelRights.flags & CHANNEL_RIGHT_CANT_BAN) || !ban && (_channelRights.flags & CHANNEL_RIGHT_CANT_KICK))
{
WorldPacket data;
MakeNotModerator(&data);
SendToOne(&data, good);
return;
}
if (ban && (_channelRights.flags & CHANNEL_RIGHT_CANT_BAN) || !ban && (_channelRights.flags & CHANNEL_RIGHT_CANT_KICK))
{
WorldPacket data;
MakeNotModerator(&data);
SendToOne(&data, good);
return;
}
if (isBadConstantModerator || AccountMgr::IsGMAccount(badSecurity))
{
WorldPacket data;
MakeNotModerator(&data);
SendToOne(&data, good);
return;
}
}
if (isBadConstantModerator || AccountMgr::IsGMAccount(badSecurity))
{
WorldPacket data;
MakeNotModerator(&data);
SendToOne(&data, good);
return;
}
}
bool notify = !(AccountMgr::IsGMAccount(sec) && sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL));
bool notify = !(AccountMgr::IsGMAccount(sec) && sWorld->getBoolConfig(CONFIG_SILENTLY_GM_JOIN_TO_CHANNEL));
if (ban)
{
if (!IsBanned(victim))
{
bannedStore[GUID_LOPART(victim)] = time(NULL) + CHANNEL_BAN_DURATION;
AddChannelBanToDB(GUID_LOPART(victim), time(NULL) + CHANNEL_BAN_DURATION);
if (ban)
{
if (!IsBanned(victim))
{
bannedStore[GUID_LOPART(victim)] = time(NULL) + CHANNEL_BAN_DURATION;
AddChannelBanToDB(GUID_LOPART(victim), time(NULL) + CHANNEL_BAN_DURATION);
if (notify)
{
WorldPacket data;
MakePlayerBanned(&data, victim, good);
SendToAll(&data);
}
}
}
else if (notify)
{
WorldPacket data;
MakePlayerKicked(&data, victim, good);
SendToAll(&data);
}
if (notify)
{
WorldPacket data;
MakePlayerBanned(&data, victim, good);
SendToAll(&data);
}
}
}
else if (notify)
{
WorldPacket data;
MakePlayerKicked(&data, victim, good);
SendToAll(&data);
}
if (isOnChannel)
{
playersStore.erase(victim);
bad->LeftChannel(this);
RemoveWatching(bad);
LeaveNotify(bad);
}
if (isOnChannel)
{
playersStore.erase(victim);
bad->LeftChannel(this);
RemoveWatching(bad);
LeaveNotify(bad);
}
if (changeowner && _ownership)
{
if (good != victim)
SetOwner(good);
else if (!playersStore.empty())
{
uint64 newowner = 0;
for (Channel::PlayerContainer::const_iterator itr = playersStore.begin(); itr != playersStore.end(); ++itr)
{
newowner = itr->second.player;
if (!itr->second.plrPtr->GetSession()->GetSecurity())
break;
}
SetOwner(newowner);
}
else
SetOwner(0);
}
if (changeowner && _ownership)
{
if (good != victim)
SetOwner(good);
else if (!playersStore.empty())
{
uint64 newowner = 0;
for (Channel::PlayerContainer::const_iterator itr = playersStore.begin(); itr != playersStore.end(); ++itr)
{
newowner = itr->second.player;
if (!itr->second.plrPtr->GetSession()->GetSecurity())
break;
}
SetOwner(newowner);
}
else
SetOwner(0);
}
}
void Channel::UnBan(Player const* player, std::string const& badname)
@@ -482,9 +482,9 @@ void Channel::UnBan(Player const* player, std::string const& badname)
return;
}
uint64 victim = 0;
if (uint32 guidLow = sWorld->GetGlobalPlayerGUID(badname))
victim = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
uint64 victim = 0;
if (uint32 guidLow = sWorld->GetGlobalPlayerGUID(badname))
victim = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
if (!victim || !IsBanned(victim))
{
@@ -510,7 +510,7 @@ void Channel::UnBan(Player const* player, std::string const& badname)
sLog->outCommand(player->GetSession()->GetAccountId(), "Command: /unban %s %s (Moderator %s [guid: %u, account: %u] unbanned %s [guid: %u])", GetName().c_str(), badname.c_str(), player->GetName().c_str(), player->GetGUIDLow(), player->GetSession()->GetAccountId(), badname.c_str(), GUID_LOPART(victim));
bannedStore.erase(GUID_LOPART(victim));
RemoveChannelBanFromDB(GUID_LOPART(victim));
RemoveChannelBanFromDB(GUID_LOPART(victim));
WorldPacket data;
MakePlayerUnbanned(&data, victim, good);
@@ -522,7 +522,7 @@ void Channel::UnBan(uint64 guid)
if (!IsBanned(guid))
return;
bannedStore.erase(GUID_LOPART(guid));
RemoveChannelBanFromDB(GUID_LOPART(guid));
RemoveChannelBanFromDB(GUID_LOPART(guid));
}
void Channel::Password(Player const* player, std::string const& pass)
@@ -594,7 +594,8 @@ void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bo
if (!victim || !IsOn(victim) ||
// allow make moderator from another team only if both is GMs
// at this moment this only way to show channel post for GM from another team
((!AccountMgr::IsGMAccount(sec) || !AccountMgr::IsGMAccount(newp->GetSession()->GetSecurity())) && player->GetTeamId() != newp->GetTeamId()))
((!AccountMgr::IsGMAccount(sec) || !AccountMgr::IsGMAccount(newp->GetSession()->GetSecurity())) && player->GetTeamId() != newp->GetTeamId() &&
!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL)))
{
WorldPacket data;
MakePlayerNotFound(&data, p2n);
@@ -659,7 +660,8 @@ void Channel::SetOwner(Player const* player, std::string const& newname)
Player* newp = ObjectAccessor::FindPlayerByName(newname, false);
uint64 victim = newp ? newp->GetGUID() : 0;
if (!victim || !IsOn(victim) || newp->GetTeamId() != player->GetTeamId())
if (!victim || !IsOn(victim) || newp->GetTeamId() != player->GetTeamId() &&
!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
{
WorldPacket data;
MakePlayerNotFound(&data, newname);
@@ -704,14 +706,14 @@ void Channel::List(Player const* player)
data << uint32(0); // size of list, placeholder
uint32 count = 0;
if (!(_channelRights.flags & CHANNEL_RIGHT_CANT_SPEAK))
for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i)
if (AccountMgr::IsPlayerAccount(i->second.plrPtr->GetSession()->GetSecurity()))
{
data << uint64(i->first);
data << uint8(i->second.flags); // flags seems to be changed...
++count;
}
if (!(_channelRights.flags & CHANNEL_RIGHT_CANT_SPEAK))
for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i)
if (AccountMgr::IsPlayerAccount(i->second.plrPtr->GetSession()->GetSecurity()))
{
data << uint64(i->first);
data << uint8(i->second.flags); // flags seems to be changed...
++count;
}
data.put<uint32>(pos, count);
@@ -764,6 +766,9 @@ void Channel::Say(uint64 guid, std::string const& what, uint32 lang)
if (what.empty())
return;
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
lang = LANG_UNIVERSAL;
if (!IsOn(guid))
{
WorldPacket data;
@@ -785,22 +790,22 @@ void Channel::Say(uint64 guid, std::string const& what, uint32 lang)
Player* player = pinfo.plrPtr;
if (player && !player->GetSession()->GetSecurity()) // pussywizard: prevent spam on populated channels
{
uint32 speakDelay = 0;
if (_channelRights.speakDelay > 0)
speakDelay = _channelRights.speakDelay;
else if (playersStore.size() >= 10)
speakDelay = 5;
{
uint32 speakDelay = 0;
if (_channelRights.speakDelay > 0)
speakDelay = _channelRights.speakDelay;
else if (playersStore.size() >= 10)
speakDelay = 5;
if (!pinfo.IsAllowedToSpeak(speakDelay))
if (!pinfo.IsAllowedToSpeak(speakDelay))
{
std::string timeStr = secsToTimeString(pinfo.lastSpeakTime + speakDelay - sWorld->GetGameTime());
if (_channelRights.speakMessage.length() > 0)
player->GetSession()->SendNotification(_channelRights.speakMessage.c_str());
player->GetSession()->SendNotification("You must wait %s before speaking again.", timeStr.c_str());
std::string timeStr = secsToTimeString(pinfo.lastSpeakTime + speakDelay - sWorld->GetGameTime());
if (_channelRights.speakMessage.length() > 0)
player->GetSession()->SendNotification(_channelRights.speakMessage.c_str());
player->GetSession()->SendNotification("You must wait %s before speaking again.", timeStr.c_str());
return;
}
}
}
WorldPacket data;
if (player)
@@ -813,28 +818,28 @@ void Channel::Say(uint64 guid, std::string const& what, uint32 lang)
void Channel::EveryoneSayToSelf(const char *what)
{
if (!what)
return;
if (!what)
return;
uint32 messageLength = strlen(what) + 1;
uint32 messageLength = strlen(what) + 1;
WorldPacket data(SMSG_MESSAGECHAT, 1+4+8+4+_name.size()+1+8+4+messageLength+1);
data << (uint8)CHAT_MSG_CHANNEL;
data << (uint32)LANG_UNIVERSAL;
data << uint64(0); // put player guid here
data << uint32(0);
data << _name;
data << uint64(0); // put player guid here
data << messageLength;
data << what;
data << uint8(0);
WorldPacket data(SMSG_MESSAGECHAT, 1+4+8+4+_name.size()+1+8+4+messageLength+1);
data << (uint8)CHAT_MSG_CHANNEL;
data << (uint32)LANG_UNIVERSAL;
data << uint64(0); // put player guid here
data << uint32(0);
data << _name;
data << uint64(0); // put player guid here
data << messageLength;
data << what;
data << uint8(0);
for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i)
{
data.put(5, i->first);
data.put(17+_name.size()+1, i->first);
i->second.plrPtr->GetSession()->SendPacket(&data);
}
for (PlayerContainer::const_iterator i = playersStore.begin(); i != playersStore.end(); ++i)
{
data.put(5, i->first);
data.put(17+_name.size()+1, i->first);
i->second.plrPtr->GetSession()->SendPacket(&data);
}
}
void Channel::Invite(Player const* player, std::string const& newname)
@@ -1180,10 +1185,10 @@ void Channel::MakeVoiceOff(WorldPacket* data, uint64 guid)
void Channel::JoinNotify(Player* p)
{
if (_channelRights.flags & CHANNEL_RIGHT_CANT_SPEAK)
return;
if (!AccountMgr::IsPlayerAccount(p->GetSession()->GetSecurity()))
return;
if (_channelRights.flags & CHANNEL_RIGHT_CANT_SPEAK)
return;
if (!AccountMgr::IsPlayerAccount(p->GetSession()->GetSecurity()))
return;
WorldPacket data(SMSG_USERLIST_ADD, 8 + 1 + 1 + 4 + GetName().size());
data << uint64(p->GetGUID());
@@ -1197,10 +1202,10 @@ void Channel::JoinNotify(Player* p)
void Channel::LeaveNotify(Player* p)
{
if (_channelRights.flags & CHANNEL_RIGHT_CANT_SPEAK)
return;
if (!AccountMgr::IsPlayerAccount(p->GetSession()->GetSecurity()))
return;
if (_channelRights.flags & CHANNEL_RIGHT_CANT_SPEAK)
return;
if (!AccountMgr::IsPlayerAccount(p->GetSession()->GetSecurity()))
return;
WorldPacket data(SMSG_USERLIST_REMOVE, 8 + 1 + 4 + GetName().size());
data << uint64(p->GetGUID());
@@ -1213,10 +1218,10 @@ void Channel::LeaveNotify(Player* p)
void Channel::FlagsNotify(Player* p)
{
if (_channelRights.flags & CHANNEL_RIGHT_CANT_SPEAK)
return;
if (!AccountMgr::IsPlayerAccount(p->GetSession()->GetSecurity()))
return;
if (_channelRights.flags & CHANNEL_RIGHT_CANT_SPEAK)
return;
if (!AccountMgr::IsPlayerAccount(p->GetSession()->GetSecurity()))
return;
WorldPacket data(SMSG_USERLIST_UPDATE, 8 + 1 + 1 + 4 + GetName().size());
data << uint64(p->GetGUID());
@@ -1230,14 +1235,14 @@ void Channel::FlagsNotify(Player* p)
void Channel::AddWatching(Player* p)
{
if (!IsOn(p->GetGUID()))
return;
playersWatchingStore.insert(p);
if (!IsOn(p->GetGUID()))
return;
playersWatchingStore.insert(p);
}
void Channel::RemoveWatching(Player* p)
{
PlayersWatchingContainer::iterator itr = playersWatchingStore.find(p);
if (itr != playersWatchingStore.end())
playersWatchingStore.erase(itr);
PlayersWatchingContainer::iterator itr = playersWatchingStore.find(p);
if (itr != playersWatchingStore.end())
playersWatchingStore.erase(itr);
}
+25 -25
View File
@@ -30,7 +30,7 @@
class Player;
#define CHANNEL_BAN_DURATION DAY*60
#define CHANNEL_BAN_DURATION DAY*60
enum ChatNotify
{
@@ -123,26 +123,26 @@ enum ChannelMemberFlags
class ChannelRights
{
public:
ChannelRights() : flags(0), speakDelay(0) {}
ChannelRights(const uint32& f, const uint32& d, const std::string& jm, const std::string& sm, const std::set<uint32>& ml) : flags(f), speakDelay(d), joinMessage(jm), speakMessage(sm), moderators(ml) {}
uint32 flags;
uint32 speakDelay;
std::string joinMessage;
std::string speakMessage;
std::set<uint32> moderators;
ChannelRights() : flags(0), speakDelay(0) {}
ChannelRights(const uint32& f, const uint32& d, const std::string& jm, const std::string& sm, const std::set<uint32>& ml) : flags(f), speakDelay(d), joinMessage(jm), speakMessage(sm), moderators(ml) {}
uint32 flags;
uint32 speakDelay;
std::string joinMessage;
std::string speakMessage;
std::set<uint32> moderators;
};
enum eChannelRights
{
CHANNEL_RIGHT_FORCE_NO_ANNOUNCEMENTS = 0x001,
CHANNEL_RIGHT_FORCE_ANNOUNCEMENTS = 0x002,
CHANNEL_RIGHT_NO_OWNERSHIP = 0x004,
CHANNEL_RIGHT_CANT_SPEAK = 0x008,
CHANNEL_RIGHT_CANT_BAN = 0x010,
CHANNEL_RIGHT_CANT_KICK = 0x020,
CHANNEL_RIGHT_CANT_MUTE = 0x040,
CHANNEL_RIGHT_CANT_CHANGE_PASSWORD = 0x080,
CHANNEL_RIGHT_DONT_PRESERVE = 0x100,
CHANNEL_RIGHT_FORCE_NO_ANNOUNCEMENTS = 0x001,
CHANNEL_RIGHT_FORCE_ANNOUNCEMENTS = 0x002,
CHANNEL_RIGHT_NO_OWNERSHIP = 0x004,
CHANNEL_RIGHT_CANT_SPEAK = 0x008,
CHANNEL_RIGHT_CANT_BAN = 0x010,
CHANNEL_RIGHT_CANT_KICK = 0x020,
CHANNEL_RIGHT_CANT_MUTE = 0x040,
CHANNEL_RIGHT_CANT_CHANGE_PASSWORD = 0x080,
CHANNEL_RIGHT_DONT_PRESERVE = 0x100,
};
class Channel
@@ -204,7 +204,7 @@ class Channel
void KickOrBan(Player const* player, std::string const& badname, bool ban);
void Kick(Player const* player, std::string const& badname) { KickOrBan(player, badname, false); }
void Ban(Player const* player, std::string const& badname) { KickOrBan(player, badname, true); }
void AddBan(uint32 guid, uint32 time) { bannedStore[guid] = time; }
void AddBan(uint32 guid, uint32 time) { bannedStore[guid] = time; }
void UnBan(Player const* player, std::string const& badname);
void UnBan(uint64 guid);
void Password(Player const* player, std::string const& pass);
@@ -219,7 +219,7 @@ class Channel
void List(Player const* player);
void Announce(Player const* player);
void Say(uint64 guid, std::string const& what, uint32 lang);
void EveryoneSayToSelf(const char *what);
void EveryoneSayToSelf(const char *what);
void Invite(Player const* player, std::string const& newp);
void Voice(uint64 guid1, uint64 guid2);
void DeVoice(uint64 guid1, uint64 guid2);
@@ -228,9 +228,9 @@ class Channel
void FlagsNotify(Player* p);
static void CleanOldChannelsInDB();
// pussywizard:
void AddWatching(Player* p);
void RemoveWatching(Player* p);
// pussywizard:
void AddWatching(Player* p);
void RemoveWatching(Player* p);
private:
// initial packet data (notify type and channel name)
@@ -281,8 +281,8 @@ class Channel
void UpdateChannelInDB() const;
void UpdateChannelUseageInDB() const;
void AddChannelBanToDB(uint32 guid, uint32 time) const;
void RemoveChannelBanFromDB(uint32 guid) const;
void AddChannelBanToDB(uint32 guid, uint32 time) const;
void RemoveChannelBanFromDB(uint32 guid) const;
uint8 GetPlayerFlags(uint64 guid) const
{
@@ -329,7 +329,7 @@ class Channel
bool _IsSaved;
uint8 _flags;
uint32 _channelId;
uint32 _channelDBId;
uint32 _channelDBId;
TeamId _teamId;
uint64 _ownerGUID;
std::string _name;
+205 -201
View File
@@ -1,201 +1,205 @@
/*
* Copyright (C)
* Copyright (C)
*
* 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 "ChannelMgr.h"
#include "Player.h"
#include "World.h"
ChannelMgr::~ChannelMgr()
{
for (ChannelMap::iterator itr = channels.begin(); itr != channels.end(); ++itr)
delete itr->second;
channels.clear();
}
ChannelMgr* ChannelMgr::forTeam(TeamId teamId)
{
if (teamId == TEAM_ALLIANCE)
return ACE_Singleton<AllianceChannelMgr, ACE_Null_Mutex>::instance();
if (teamId == TEAM_HORDE)
return ACE_Singleton<HordeChannelMgr, ACE_Null_Mutex>::instance();
return NULL;
}
void ChannelMgr::LoadChannels()
{
uint32 oldMSTime = getMSTime();
uint32 count = 0;
QueryResult result = CharacterDatabase.PQuery("SELECT channelId, name, team, announce, password FROM channels WHERE team = %u ORDER BY channelId ASC", _teamId);
if (!result)
{
sLog->outString(">> Loaded 0 channels for %s", _teamId == TEAM_ALLIANCE ? "Alliance" : "Horde");
sLog->outString();
return;
}
do
{
Field* fields = result->Fetch();
if (!fields)
break;
uint32 channelDBId = fields[0].GetUInt32();
std::string channelName = fields[1].GetString();
std::string password = fields[4].GetString();
std::wstring channelWName;
Utf8toWStr(channelName, channelWName);
Channel* newChannel = new Channel(channelName, 0, channelDBId, TeamId(fields[2].GetUInt32()), fields[3].GetUInt8());
newChannel->SetPassword(password);
channels[channelWName] = newChannel;
if (QueryResult banResult = CharacterDatabase.PQuery("SELECT playerGUID, banTime FROM channels_bans WHERE channelId = %u", channelDBId))
{
do
{
Field* banFields = banResult->Fetch();
if (!banFields)
break;
newChannel->AddBan(banFields[0].GetUInt32(), banFields[1].GetUInt32());
}
while (banResult->NextRow());
}
if (channelDBId > ChannelMgr::_channelIdMax) ChannelMgr::_channelIdMax = channelDBId;
++count;
}
while (result->NextRow());
sLog->outString(">> Loaded %u channels for %s in %ums", count, _teamId == TEAM_ALLIANCE ? "Alliance" : "Horde", GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
Channel* ChannelMgr::GetJoinChannel(std::string const& name, uint32 channelId)
{
std::wstring wname;
Utf8toWStr(name, wname);
wstrToLower(wname);
ChannelMap::const_iterator i = channels.find(wname);
if (i == channels.end())
{
std::string chNameLower = name;
std::transform(chNameLower.begin(), chNameLower.end(), chNameLower.begin(), ::tolower);
Channel* nchan = new Channel(chNameLower, channelId, 0, _teamId);
channels[wname] = nchan;
return nchan;
}
return i->second;
}
Channel* ChannelMgr::GetChannel(std::string const& name, Player* player, bool pkt)
{
std::wstring wname;
Utf8toWStr(name, wname);
wstrToLower(wname);
ChannelMap::const_iterator i = channels.find(wname);
if (i == channels.end())
{
if (pkt)
{
WorldPacket data;
MakeNotOnPacket(&data, name);
player->GetSession()->SendPacket(&data);
}
return NULL;
}
return i->second;
}
uint32 ChannelMgr::_channelIdMax = 0;
ChannelMgr::ChannelRightsMap ChannelMgr::channels_rights;
ChannelRights ChannelMgr::channelRightsEmpty;
void ChannelMgr::LoadChannelRights()
{
uint32 oldMSTime = getMSTime();
channels_rights.clear();
QueryResult result = CharacterDatabase.Query("SELECT name, flags, speakdelay, joinmessage, delaymessage, moderators FROM channels_rights");
if (!result)
{
sLog->outString();
sLog->outString(">> Loaded 0 Channel Rights!");
return;
}
uint32 count = 0;
do
{
Field* fields = result->Fetch();
std::set<uint32> moderators;
const char* moderatorList = fields[5].GetCString();
if (moderatorList)
{
Tokenizer tokens(moderatorList, ' ');
for (Tokenizer::const_iterator i = tokens.begin(); i != tokens.end(); ++i)
{
uint64 moderator_acc = atol(*i);
if (moderator_acc && ((uint32)moderator_acc) == moderator_acc)
moderators.insert((uint32)moderator_acc);
}
}
SetChannelRightsFor(fields[0].GetString(), fields[1].GetUInt32(), fields[2].GetUInt32(), fields[3].GetString(), fields[4].GetString(), moderators);
++count;
} while (result->NextRow());
sLog->outString(">> Loaded %d Channel Rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
const ChannelRights& ChannelMgr::GetChannelRightsFor(const std::string& name)
{
std::string nameStr = name;
std::transform(nameStr.begin(), nameStr.end(), nameStr.begin(), ::tolower);
ChannelRightsMap::const_iterator itr = channels_rights.find(nameStr);
if (itr != channels_rights.end())
return itr->second;
return channelRightsEmpty;
}
void ChannelMgr::SetChannelRightsFor(const std::string& name, const uint32& flags, const uint32& speakDelay, const std::string& joinmessage, const std::string& speakmessage, const std::set<uint32>& moderators)
{
std::string nameStr = name;
std::transform(nameStr.begin(), nameStr.end(), nameStr.begin(), ::tolower);
channels_rights[nameStr] = ChannelRights(flags, speakDelay, joinmessage, speakmessage, moderators);
}
void ChannelMgr::MakeNotOnPacket(WorldPacket* data, std::string const& name)
{
data->Initialize(SMSG_CHANNEL_NOTIFY, 1 + name.size());
(*data) << uint8(5) << name;
}
/*
* Copyright (C)
* Copyright (C)
*
* 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 "ChannelMgr.h"
#include "Player.h"
#include "World.h"
ChannelMgr::~ChannelMgr()
{
for (ChannelMap::iterator itr = channels.begin(); itr != channels.end(); ++itr)
delete itr->second;
channels.clear();
}
ChannelMgr* ChannelMgr::forTeam(TeamId teamId)
{
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
return ACE_Singleton<AllianceChannelMgr, ACE_Null_Mutex>::instance(); // cross-faction
if (teamId == TEAM_ALLIANCE)
return ACE_Singleton<AllianceChannelMgr, ACE_Null_Mutex>::instance();
if (teamId == TEAM_HORDE)
return ACE_Singleton<HordeChannelMgr, ACE_Null_Mutex>::instance();
return NULL;
}
void ChannelMgr::LoadChannels()
{
uint32 oldMSTime = getMSTime();
uint32 count = 0;
QueryResult result = CharacterDatabase.PQuery("SELECT channelId, name, team, announce, password FROM channels WHERE team = %u ORDER BY channelId ASC", _teamId);
if (!result)
{
sLog->outString(">> Loaded 0 channels for %s", _teamId == TEAM_ALLIANCE ? "Alliance" : "Horde");
sLog->outString();
return;
}
do
{
Field* fields = result->Fetch();
if (!fields)
break;
uint32 channelDBId = fields[0].GetUInt32();
std::string channelName = fields[1].GetString();
std::string password = fields[4].GetString();
std::wstring channelWName;
Utf8toWStr(channelName, channelWName);
Channel* newChannel = new Channel(channelName, 0, channelDBId, TeamId(fields[2].GetUInt32()), fields[3].GetUInt8());
newChannel->SetPassword(password);
channels[channelWName] = newChannel;
if (QueryResult banResult = CharacterDatabase.PQuery("SELECT playerGUID, banTime FROM channels_bans WHERE channelId = %u", channelDBId))
{
do
{
Field* banFields = banResult->Fetch();
if (!banFields)
break;
newChannel->AddBan(banFields[0].GetUInt32(), banFields[1].GetUInt32());
}
while (banResult->NextRow());
}
if (channelDBId > ChannelMgr::_channelIdMax)
ChannelMgr::_channelIdMax = channelDBId;
++count;
}
while (result->NextRow());
sLog->outString(">> Loaded %u channels for %s in %ums", count, _teamId == TEAM_ALLIANCE ? "Alliance" : "Horde", GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
Channel* ChannelMgr::GetJoinChannel(std::string const& name, uint32 channelId)
{
std::wstring wname;
Utf8toWStr(name, wname);
wstrToLower(wname);
ChannelMap::const_iterator i = channels.find(wname);
if (i == channels.end())
{
std::string chNameLower = name;
std::transform(chNameLower.begin(), chNameLower.end(), chNameLower.begin(), ::tolower);
Channel* nchan = new Channel(chNameLower, channelId, 0, _teamId);
channels[wname] = nchan;
return nchan;
}
return i->second;
}
Channel* ChannelMgr::GetChannel(std::string const& name, Player* player, bool pkt)
{
std::wstring wname;
Utf8toWStr(name, wname);
wstrToLower(wname);
ChannelMap::const_iterator i = channels.find(wname);
if (i == channels.end())
{
if (pkt)
{
WorldPacket data;
MakeNotOnPacket(&data, name);
player->GetSession()->SendPacket(&data);
}
return NULL;
}
return i->second;
}
uint32 ChannelMgr::_channelIdMax = 0;
ChannelMgr::ChannelRightsMap ChannelMgr::channels_rights;
ChannelRights ChannelMgr::channelRightsEmpty;
void ChannelMgr::LoadChannelRights()
{
uint32 oldMSTime = getMSTime();
channels_rights.clear();
QueryResult result = CharacterDatabase.Query("SELECT name, flags, speakdelay, joinmessage, delaymessage, moderators FROM channels_rights");
if (!result)
{
sLog->outString();
sLog->outString(">> Loaded 0 Channel Rights!");
return;
}
uint32 count = 0;
do
{
Field* fields = result->Fetch();
std::set<uint32> moderators;
const char* moderatorList = fields[5].GetCString();
if (moderatorList)
{
Tokenizer tokens(moderatorList, ' ');
for (Tokenizer::const_iterator i = tokens.begin(); i != tokens.end(); ++i)
{
uint64 moderator_acc = atol(*i);
if (moderator_acc && ((uint32)moderator_acc) == moderator_acc)
moderators.insert((uint32)moderator_acc);
}
}
SetChannelRightsFor(fields[0].GetString(), fields[1].GetUInt32(), fields[2].GetUInt32(), fields[3].GetString(), fields[4].GetString(), moderators);
++count;
} while (result->NextRow());
sLog->outString(">> Loaded %d Channel Rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
const ChannelRights& ChannelMgr::GetChannelRightsFor(const std::string& name)
{
std::string nameStr = name;
std::transform(nameStr.begin(), nameStr.end(), nameStr.begin(), ::tolower);
ChannelRightsMap::const_iterator itr = channels_rights.find(nameStr);
if (itr != channels_rights.end())
return itr->second;
return channelRightsEmpty;
}
void ChannelMgr::SetChannelRightsFor(const std::string& name, const uint32& flags, const uint32& speakDelay, const std::string& joinmessage, const std::string& speakmessage, const std::set<uint32>& moderators)
{
std::string nameStr = name;
std::transform(nameStr.begin(), nameStr.end(), nameStr.begin(), ::tolower);
channels_rights[nameStr] = ChannelRights(flags, speakDelay, joinmessage, speakmessage, moderators);
}
void ChannelMgr::MakeNotOnPacket(WorldPacket* data, std::string const& name)
{
data->Initialize(SMSG_CHANNEL_NOTIFY, 1 + name.size());
(*data) << uint8(5) << name;
}
+2 -2
View File
@@ -44,12 +44,12 @@ class ChannelMgr
Channel* GetJoinChannel(std::string const& name, uint32 channel_id);
Channel* GetChannel(std::string const& name, Player* p, bool pkt = true);
void LoadChannels();
void LoadChannels();
static void LoadChannelRights();
static const ChannelRights& GetChannelRightsFor(const std::string& name);
static void SetChannelRightsFor(const std::string& name, const uint32& flags, const uint32& speakDelay, const std::string& joinmessage, const std::string& speakmessage, const std::set<uint32>& moderators);
static uint32 _channelIdMax;
static uint32 _channelIdMax;
private:
ChannelMap channels;
+8 -8
View File
@@ -347,15 +347,15 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand* table, const char* text, st
SetSentErrorMessage(false);
// table[i].Name == "" is special case: send original command to handler
const char* aText = table[i].Name[0] != '\0' ? text : oldtext;
if (aText)
fullcmd += aText;
if (aText)
fullcmd += aText;
if ((table[i].Handler)(this, aText))
{
// pussywizard: ignore logging spect command
std::string fc = fullcmd;
if (fc.size() >= 5)
std::transform(fc.begin(), fc.end(), fc.begin(), ::tolower);
bool ignore = fc.size() >= 5 && fc.substr(0,5) == "spect";
// pussywizard: ignore logging spect command
std::string fc = fullcmd;
if (fc.size() >= 5)
std::transform(fc.begin(), fc.end(), fc.begin(), ::tolower);
bool ignore = fc.size() >= 5 && fc.substr(0,5) == "spect";
if (!AccountMgr::IsPlayerAccount(table[i].SecurityLevel) && !ignore)
{
@@ -731,7 +731,7 @@ size_t ChatHandler::BuildChatPacket(WorldPacket& data, ChatMsg chatType, Languag
if (Player const* playerSender = sender->ToPlayer())
{
chatTag = playerSender->GetChatTag();
gmMessage = playerSender->IsGameMaster();
gmMessage = playerSender->IsGameMaster();
}
}
+1 -1
View File
@@ -123,7 +123,7 @@ class ChatHandler
static bool LoadCommandTable() { return load_command_table; }
static void SetLoadCommandTable(bool val) { load_command_table = val; }
bool ShowHelpForCommand(ChatCommand* table, const char* cmd);
bool ShowHelpForCommand(ChatCommand* table, const char* cmd);
protected:
explicit ChatHandler() : m_session(NULL), sentErrorMessage(false) {} // for CLI subclass
static bool SetDataForCommandInTable(ChatCommand* table, const char* text, uint32 security, std::string const& help, std::string const& fullcommand);
+2 -2
View File
@@ -207,8 +207,8 @@ void HostileRefManager::UpdateVisibility(bool checkThreat)
while (ref)
{
HostileReference* nextRef = ref->next();
if ((!checkThreat || ref->GetSource()->getThreatList().size() <= 1) &&
!ref->GetSource()->GetOwner()->CanSeeOrDetect(GetOwner()))
if ((!checkThreat || ref->GetSource()->getThreatList().size() <= 1) &&
!ref->GetSource()->GetOwner()->CanSeeOrDetect(GetOwner()))
{
nextRef = ref->next();
ref->removeReference();
+86 -86
View File
@@ -156,10 +156,10 @@ void HostileReference::addThreat(float modThreat)
void HostileReference::addThreatPercent(int32 percent)
{
// Xinef: Do not allow to modify threat by percent if threat is negative (forced to big value < 0 by spells adding temporary threat)
// Xinef: When the temporary effect ends, temporary threat is added back which results in huge additional amount of threat
if (iThreat <= 0)
return;
// Xinef: Do not allow to modify threat by percent if threat is negative (forced to big value < 0 by spells adding temporary threat)
// Xinef: When the temporary effect ends, temporary threat is added back which results in huge additional amount of threat
if (iThreat <= 0)
return;
float tmpThreat = iThreat;
AddPct(tmpThreat, percent);
@@ -302,95 +302,95 @@ void ThreatContainer::update()
HostileReference* ThreatContainer::selectNextVictim(Creature* attacker, HostileReference* currentVictim) const
{
// pussywizard: pretty much remade this whole function
// pussywizard: pretty much remade this whole function
HostileReference* currentRef = NULL;
bool found = false;
bool noPriorityTargetFound = false;
uint32 currTime = sWorld->GetGameTime();
HostileReference* currentRef = NULL;
bool found = false;
bool noPriorityTargetFound = false;
uint32 currTime = sWorld->GetGameTime();
// pussywizard: currentVictim is needed to compare if threat was exceeded by 10%/30% for melee/range targets (only then switching current target)
if (currentVictim)
{
Unit* cvUnit = currentVictim->getTarget();
if (!attacker->_CanDetectFeignDeathOf(cvUnit) || !attacker->CanCreatureAttack(cvUnit) || attacker->isTargetNotAcceptableByMMaps(cvUnit->GetGUID(), currTime, cvUnit)) // pussywizard: if currentVictim is not valid => don't compare the threat with it, just take the highest threat valid target
currentVictim = NULL;
else if (cvUnit->IsImmunedToDamageOrSchool(attacker->GetMeleeDamageSchoolMask()) || cvUnit->HasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE)) // pussywizard: no 10%/30% if currentVictim is immune to damage or has auras breakable by damage
currentVictim = NULL;
}
// pussywizard: currentVictim is needed to compare if threat was exceeded by 10%/30% for melee/range targets (only then switching current target)
if (currentVictim)
{
Unit* cvUnit = currentVictim->getTarget();
if (!attacker->_CanDetectFeignDeathOf(cvUnit) || !attacker->CanCreatureAttack(cvUnit) || attacker->isTargetNotAcceptableByMMaps(cvUnit->GetGUID(), currTime, cvUnit)) // pussywizard: if currentVictim is not valid => don't compare the threat with it, just take the highest threat valid target
currentVictim = NULL;
else if (cvUnit->IsImmunedToDamageOrSchool(attacker->GetMeleeDamageSchoolMask()) || cvUnit->HasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE)) // pussywizard: no 10%/30% if currentVictim is immune to damage or has auras breakable by damage
currentVictim = NULL;
}
ThreatContainer::StorageType::const_iterator lastRef = iThreatList.end();
--lastRef;
ThreatContainer::StorageType::const_iterator lastRef = iThreatList.end();
--lastRef;
// pussywizard: iterate from highest to lowest threat
for (ThreatContainer::StorageType::const_iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found;)
{
currentRef = (*iter);
// pussywizard: iterate from highest to lowest threat
for (ThreatContainer::StorageType::const_iterator iter = iThreatList.begin(); iter != iThreatList.end() && !found;)
{
currentRef = (*iter);
Unit* target = currentRef->getTarget();
ASSERT(target); // if the ref has status online the target must be there !
Unit* target = currentRef->getTarget();
ASSERT(target); // if the ref has status online the target must be there !
// pussywizard: don't go to threat comparison if this ref is immune to damage or has aura breakable on damage (second choice target)
// pussywizard: if this is the last entry on the threat list, then all targets are second choice, set bool to true and loop threat list again, ignoring this section
if (!noPriorityTargetFound && (target->IsImmunedToDamageOrSchool(attacker->GetMeleeDamageSchoolMask()) || target->HasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE) || target->HasAuraTypeWithCaster(SPELL_AURA_IGNORED, attacker->GetGUID())))
{
if (iter != lastRef)
{
++iter;
continue;
}
else
{
noPriorityTargetFound = true;
iter = iThreatList.begin();
continue;
}
}
// pussywizard: don't go to threat comparison if this ref is immune to damage or has aura breakable on damage (second choice target)
// pussywizard: if this is the last entry on the threat list, then all targets are second choice, set bool to true and loop threat list again, ignoring this section
if (!noPriorityTargetFound && (target->IsImmunedToDamageOrSchool(attacker->GetMeleeDamageSchoolMask()) || target->HasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE) || target->HasAuraTypeWithCaster(SPELL_AURA_IGNORED, attacker->GetGUID())))
{
if (iter != lastRef)
{
++iter;
continue;
}
else
{
noPriorityTargetFound = true;
iter = iThreatList.begin();
continue;
}
}
// pussywizard: skip not valid targets
if (attacker->_CanDetectFeignDeathOf(target) && attacker->CanCreatureAttack(target) && !attacker->isTargetNotAcceptableByMMaps(target->GetGUID(), currTime, target))
{
if (currentVictim) // pussywizard: if not NULL then target must have 10%/30% more threat
{
if (currentVictim == currentRef) // pussywizard: nothing found previously was good and enough, currentRef passed all necessary tests, so end now
{
found = true;
break;
}
// pussywizard: skip not valid targets
if (attacker->_CanDetectFeignDeathOf(target) && attacker->CanCreatureAttack(target) && !attacker->isTargetNotAcceptableByMMaps(target->GetGUID(), currTime, target))
{
if (currentVictim) // pussywizard: if not NULL then target must have 10%/30% more threat
{
if (currentVictim == currentRef) // pussywizard: nothing found previously was good and enough, currentRef passed all necessary tests, so end now
{
found = true;
break;
}
// pussywizard: implement 110% threat rule for targets in melee range and 130% rule for targets in ranged distances
if (currentRef->getThreat() > 1.3f * currentVictim->getThreat()) // pussywizard: enough in all cases, end
{
found = true;
break;
}
else if (currentRef->getThreat() > 1.1f * currentVictim->getThreat()) // pussywizard: enought only if target in melee range
{
if (attacker->IsWithinMeleeRange(target))
{
found = true;
break;
}
}
else // pussywizard: nothing found previously was good and enough, this and next entries on the list have less than 110% threat, and currentVictim is present and valid as checked before the loop (otherwise it's NULL), so end now
{
currentRef = currentVictim;
found = true;
break;
}
}
else // pussywizard: no currentVictim, first passing all checks is chosen (highest threat, list is sorted)
{
found = true;
break;
}
}
++iter;
}
if (!found)
currentRef = NULL;
// pussywizard: implement 110% threat rule for targets in melee range and 130% rule for targets in ranged distances
if (currentRef->getThreat() > 1.3f * currentVictim->getThreat()) // pussywizard: enough in all cases, end
{
found = true;
break;
}
else if (currentRef->getThreat() > 1.1f * currentVictim->getThreat()) // pussywizard: enought only if target in melee range
{
if (attacker->IsWithinMeleeRange(target))
{
found = true;
break;
}
}
else // pussywizard: nothing found previously was good and enough, this and next entries on the list have less than 110% threat, and currentVictim is present and valid as checked before the loop (otherwise it's NULL), so end now
{
currentRef = currentVictim;
found = true;
break;
}
}
else // pussywizard: no currentVictim, first passing all checks is chosen (highest threat, list is sorted)
{
found = true;
break;
}
}
++iter;
}
if (!found)
currentRef = NULL;
return currentRef;
return currentRef;
}
//============================================================
@@ -432,8 +432,8 @@ void ThreatManager::doAddThreat(Unit* victim, float threat)
{
float redirectThreat = CalculatePct(threat, redirectThreadPct);
threat -= redirectThreat;
if (ThreatCalcHelper::isValidProcess(redirectTarget, GetOwner()))
_addThreat(redirectTarget, redirectThreat);
if (ThreatCalcHelper::isValidProcess(redirectTarget, GetOwner()))
_addThreat(redirectTarget, redirectThreat);
}
}
+27 -27
View File
@@ -91,11 +91,11 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
case CONDITION_TEAM:
{
if (Player* player = object->ToPlayer())
{
// Xinef: DB Data compatibility...
uint32 teamOld = player->GetTeamId() == TEAM_ALLIANCE ? ALLIANCE : HORDE;
{
// Xinef: DB Data compatibility...
uint32 teamOld = player->GetTeamId() == TEAM_ALLIANCE ? ALLIANCE : HORDE;
condMeets = teamOld == ConditionValue1;
}
}
break;
}
case CONDITION_CLASS:
@@ -155,16 +155,16 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
}
break;
}
case CONDITION_QUEST_SATISFY_EXCLUSIVE:
{
case CONDITION_QUEST_SATISFY_EXCLUSIVE:
{
if (Player* player = object->ToPlayer())
{
// Xinef: cannot be null, checked at loading
const Quest* quest = sObjectMgr->GetQuestTemplate(ConditionValue1);
condMeets = !player->IsQuestRewarded(ConditionValue1) && player->SatisfyQuestExclusiveGroup(quest, false);
// Xinef: cannot be null, checked at loading
const Quest* quest = sObjectMgr->GetQuestTemplate(ConditionValue1);
condMeets = !player->IsQuestRewarded(ConditionValue1) && player->SatisfyQuestExclusiveGroup(quest, false);
}
break;
}
}
case CONDITION_ACTIVE_EVENT:
condMeets = sGameEventMgr->IsActiveEvent(ConditionValue1);
break;
@@ -227,9 +227,9 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
}
case CONDITION_OBJECT_ENTRY_GUID:
{
if (ConditionValue3 == 1 && object->ToUnit()) // pussywizard: if == 1, ignore not attackable/selectable targets
if (object->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
break;
if (ConditionValue3 == 1 && object->ToUnit()) // pussywizard: if == 1, ignore not attackable/selectable targets
if (object->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
break;
if (uint32(object->GetTypeId()) == ConditionValue1)
{
@@ -372,7 +372,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
case CONDITION_HAS_AURA_TYPE:
{
if (Unit* unit = object->ToUnit())
condMeets = unit->HasAuraType(AuraType(ConditionValue1));
condMeets = unit->HasAuraType(AuraType(ConditionValue1));
break;
}
default:
@@ -492,7 +492,7 @@ uint32 Condition::GetSearcherTypeMaskForCondition()
default:
break;
}
break;
break;
case CONDITION_TYPE_MASK:
if (ConditionValue1 & TYPEMASK_UNIT)
mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER;
@@ -535,7 +535,7 @@ uint32 Condition::GetSearcherTypeMaskForCondition()
break;
case CONDITION_GENDER:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
break;
case CONDITION_UNIT_STATE:
mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER;
break;
@@ -563,8 +563,8 @@ uint32 Condition::GetMaxAvailableConditionTargets()
// returns number of targets which are available for given source type
switch(SourceType)
{
case CONDITION_SOURCE_TYPE_SMART_EVENT:
return 3;
case CONDITION_SOURCE_TYPE_SMART_EVENT:
return 3;
case CONDITION_SOURCE_TYPE_SPELL:
case CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET:
case CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE:
@@ -1468,7 +1468,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
case TARGET_SELECT_CATEGORY_NEARBY:
case TARGET_SELECT_CATEGORY_CONE:
case TARGET_SELECT_CATEGORY_AREA:
case TARGET_SELECT_CATEGORY_TRAJ:
case TARGET_SELECT_CATEGORY_TRAJ:
continue;
default:
break;
@@ -1479,15 +1479,15 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
case TARGET_SELECT_CATEGORY_NEARBY:
case TARGET_SELECT_CATEGORY_CONE:
case TARGET_SELECT_CATEGORY_AREA:
case TARGET_SELECT_CATEGORY_TRAJ:
case TARGET_SELECT_CATEGORY_TRAJ:
continue;
default:
break;
}
// Xinef: chain targets are treated as area targets! Apply conditions!
if (spellInfo->Effects[i].ChainTarget > 1)
continue;
// Xinef: chain targets are treated as area targets! Apply conditions!
if (spellInfo->Effects[i].ChainTarget > 1)
continue;
sLog->outErrorDb("SourceEntry %u SourceGroup %u in `condition` table - spell %u does not have implicit targets of types: _AREA_, _CONE_, _NEARBY_ for effect %u, SourceGroup needs correction, ignoring.", cond->SourceEntry, origGroup, cond->SourceEntry, uint32(i));
cond->SourceGroup &= ~(1<<i);
@@ -1720,7 +1720,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
case CONDITION_QUESTTAKEN:
case CONDITION_QUEST_NONE:
case CONDITION_QUEST_COMPLETE:
case CONDITION_QUEST_SATISFY_EXCLUSIVE:
case CONDITION_QUEST_SATISFY_EXCLUSIVE:
{
if (!sObjectMgr->GetQuestTemplate(cond->ConditionValue1))
{
@@ -1944,7 +1944,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
return false;
}
break;
}
}
case CONDITION_TYPE_MASK:
{
if (!cond->ConditionValue1 || (cond->ConditionValue1 & ~(TYPEMASK_UNIT | TYPEMASK_PLAYER | TYPEMASK_GAMEOBJECT | TYPEMASK_CORPSE)))
@@ -2124,9 +2124,9 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
break;
}
case CONDITION_IN_WATER:
{
{
break;
}
}
case CONDITION_HAS_AURA_TYPE:
{
if (cond->ConditionValue1 == SPELL_AURA_NONE || cond->ConditionValue1 >= TOTAL_AURAS)
+10 -10
View File
@@ -74,17 +74,17 @@ enum ConditionTypes
CONDITION_HP_PCT = 38, // hpPct ComparisonType 0 true if unit's hp matches given pct
CONDITION_REALM_ACHIEVEMENT = 39, // achievement_id 0 0 true if realm achievement is complete
CONDITION_IN_WATER = 40, // 0 0 0 true if unit in water
// RESERVED = 41,
// RESERVED = 42,
// RESERVED = 43,
// RESERVED = 44,
// RESERVED = 45,
// RESERVED = 46,
// RESERVED = 47,
// RESERVED = 48,
// RESERVED = 49,
// RESERVED = 41,
// RESERVED = 42,
// RESERVED = 43,
// RESERVED = 44,
// RESERVED = 45,
// RESERVED = 46,
// RESERVED = 47,
// RESERVED = 48,
// RESERVED = 49,
CONDITION_QUEST_SATISFY_EXCLUSIVE = 50, // quest_id 0 0 true if satisfied exclusive group
CONDITION_HAS_AURA_TYPE = 51, // aura_type 0 0 true if has aura type
CONDITION_HAS_AURA_TYPE = 51, // aura_type 0 0 true if has aura type
CONDITION_MAX = 52 // MAX
};
+6 -6
View File
@@ -123,12 +123,12 @@ void LoadDisables()
data.params[1].insert(atoi(tokens[i++]));
}
// xinef: if spell has disabled los, add flag
if (flags & SPELL_DISABLE_LOS)
{
SpellInfo* spellInfo = const_cast<SpellInfo*>(sSpellMgr->GetSpellInfo(entry));
spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS;
}
// xinef: if spell has disabled los, add flag
if (flags & SPELL_DISABLE_LOS)
{
SpellInfo* spellInfo = const_cast<SpellInfo*>(sSpellMgr->GetSpellInfo(entry));
spellInfo->AttributesEx2 |= SPELL_ATTR2_CAN_TARGET_NOT_IN_LOS;
}
break;
// checked later
+1 -1
View File
@@ -32,7 +32,7 @@ enum DisableType
DISABLE_TYPE_ACHIEVEMENT_CRITERIA = 4,
DISABLE_TYPE_OUTDOORPVP = 5,
DISABLE_TYPE_VMAP = 6,
DISABLE_TYPE_GO_LOS = 7,
DISABLE_TYPE_GO_LOS = 7,
};
enum SpellDisableTypes
+14 -14
View File
@@ -368,7 +368,7 @@ void LoadDBCStores(const std::string& dataPath)
LoadDBC(availableDbcLocales, bad_dbc_files, sItemSetStore, dbcPath, "ItemSet.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sLFGDungeonStore, dbcPath, "LFGDungeons.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sLightStore, dbcPath, "Light.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sLightStore, dbcPath, "Light.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sLiquidTypeStore, dbcPath, "LiquidType.dbc");
LoadDBC(availableDbcLocales, bad_dbc_files, sLockStore, dbcPath, "Lock.dbc");
@@ -420,7 +420,7 @@ void LoadDBCStores(const std::string& dataPath)
SpellEntry const* spellInfo = sSpellStore.LookupEntry(skillLine->spellId);
if (spellInfo && (spellInfo->Attributes & SPELL_ATTR0_PASSIVE))
if (spellInfo && (spellInfo->Attributes & SPELL_ATTR0_PASSIVE))
{
for (uint32 i = 1; i < sCreatureFamilyStore.GetNumRows(); ++i)
{
@@ -822,12 +822,12 @@ MapDifficulty const* GetDownscaledMapDifficultyData(uint32 mapId, Difficulty &di
PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 level)
{
if (mapid == sBattlegroundMgr->randomBgDifficultyEntry.mapId)
{
if (level < sBattlegroundMgr->randomBgDifficultyEntry.minLevel)
return NULL;
return &sBattlegroundMgr->randomBgDifficultyEntry;
}
if (mapid == sBattlegroundMgr->randomBgDifficultyEntry.mapId)
{
if (level < sBattlegroundMgr->randomBgDifficultyEntry.minLevel)
return NULL;
return &sBattlegroundMgr->randomBgDifficultyEntry;
}
PvPDifficultyEntry const* maxEntry = NULL; // used for level > max listed level case
for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)
@@ -853,12 +853,12 @@ PvPDifficultyEntry const* GetBattlegroundBracketByLevel(uint32 mapid, uint32 lev
PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattlegroundBracketId id)
{
if (mapid == sBattlegroundMgr->randomBgDifficultyEntry.mapId)
{
if (id != sBattlegroundMgr->randomBgDifficultyEntry.bracketId)
return NULL;
return &sBattlegroundMgr->randomBgDifficultyEntry;
}
if (mapid == sBattlegroundMgr->randomBgDifficultyEntry.mapId)
{
if (id != sBattlegroundMgr->randomBgDifficultyEntry.bracketId)
return NULL;
return &sBattlegroundMgr->randomBgDifficultyEntry;
}
for (uint32 i = 0; i < sPvPDifficultyStore.GetNumRows(); ++i)
if (PvPDifficultyEntry const* entry = sPvPDifficultyStore.LookupEntry(i))
+12 -12
View File
@@ -535,15 +535,15 @@ struct AreaTableEntry
return (flags & AREA_FLAG_SANCTUARY);
}
// Xinef: mark some zones / areas as inns
bool IsInn(TeamId teamId) const
{
if (teamId == TEAM_ALLIANCE)
return flags & AREA_FLAG_REST_ZONE_ALLIANCE;
else if (teamId == TEAM_HORDE)
return flags & AREA_FLAG_REST_ZONE_HORDE;
return false;
}
// Xinef: mark some zones / areas as inns
bool IsInn(TeamId teamId) const
{
if (teamId == TEAM_ALLIANCE)
return flags & AREA_FLAG_REST_ZONE_ALLIANCE;
else if (teamId == TEAM_HORDE)
return flags & AREA_FLAG_REST_ZONE_HORDE;
return false;
}
};
#define MAX_GROUP_AREA_IDS 6
@@ -926,9 +926,9 @@ struct FactionTemplateEntry
// helpers
bool IsFriendlyTo(FactionTemplateEntry const& entry) const
{
// Xinef: Always friendly to self faction
if (faction == entry.faction)
return true;
// Xinef: Always friendly to self faction
if (faction == entry.faction)
return true;
if (entry.faction)
{
+87 -87
View File
@@ -110,93 +110,93 @@ typedef std::map<uint64, uint64> LfgGroupsMap;
class Lfg5Guids
{
public:
uint64 guid[5];
LfgRolesMap* roles;
Lfg5Guids() { memset(&guid, 0, 5*8); roles = NULL; }
Lfg5Guids(uint64 g) { memset(&guid, 0, 5*8); guid[0] = g; roles = NULL; }
Lfg5Guids(Lfg5Guids const& x) { memcpy(guid, x.guid, 5*8); if (x.roles) roles = new LfgRolesMap(*(x.roles)); else roles = NULL; }
Lfg5Guids(Lfg5Guids const& x, bool copyRoles) { memcpy(guid, x.guid, 5*8); roles = NULL; }
~Lfg5Guids() { delete roles; }
void addRoles(LfgRolesMap const& r) { roles = new LfgRolesMap(r); }
void clear() { memset(&guid, 0, 5*8); }
bool empty() const { return guid[0] == 0; }
uint64 front() const { return guid[0]; }
uint8 size() const
{
if (guid[2])
{
if (guid[4]) return 5;
else if (guid[3]) return 4;
return 3;
}
else if (guid[1]) return 2;
else if (guid[0]) return 1;
return 0;
}
void insert(const uint64& g)
{
// avoid loops for performance
if (guid[0] == 0) { guid[0] = g; return; }
else if (g <= guid[0]) { if (guid[3]) guid[4] = guid[3]; if (guid[2]) guid[3] = guid[2]; if (guid[1]) guid[2] = guid[1]; guid[1] = guid[0]; guid[0] = g; return; }
if (guid[1] == 0) { guid[1] = g; return; }
else if (g <= guid[1]) { if (guid[3]) guid[4] = guid[3]; if (guid[2]) guid[3] = guid[2]; guid[2] = guid[1]; guid[1] = g; return; }
if (guid[2] == 0) { guid[2] = g; return; }
else if (g <= guid[2]) { if (guid[3]) guid[4] = guid[3]; guid[3] = guid[2]; guid[2] = g; return; }
if (guid[3] == 0) { guid[3] = g; return; }
else if (g <= guid[3]) { guid[4] = guid[3]; guid[3] = g; return; }
guid[4] = g;
}
void force_insert_front(const uint64& g)
{
if (guid[3]) guid[4] = guid[3]; if (guid[2]) guid[3] = guid[2]; if (guid[1]) guid[2] = guid[1]; guid[1] = guid[0]; guid[0] = g;
}
void remove(const uint64& g)
{
// avoid loops for performance
if (guid[0] == g) { if (guid[1]) guid[0] = guid[1]; else { guid[0] = 0; return; } if (guid[2]) guid[1] = guid[2]; else { guid[1] = 0; return; } if (guid[3]) guid[2] = guid[3]; else { guid[2] = 0; return; } if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; }
if (guid[1] == g) { if (guid[2]) guid[1] = guid[2]; else { guid[1] = 0; return; } if (guid[3]) guid[2] = guid[3]; else { guid[2] = 0; return; } if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; }
if (guid[2] == g) { if (guid[3]) guid[2] = guid[3]; else { guid[2] = 0; return; } if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; }
if (guid[3] == g) { if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; }
if (guid[4] == g) guid[4] = 0;
}
bool hasGuid(const uint64& g) const
{
return g && (guid[0] == g || guid[1] == g || guid[2] == g || guid[3] == g || guid[4] == g);
}
bool operator<(const Lfg5Guids& x) const
{
// not neat, but fast xD
if (guid[0]<=x.guid[0]) {
if (guid[0] == x.guid[0]) {
if (guid[1]<=x.guid[1]) {
if (guid[1] == x.guid[1]) {
if (guid[2]<=x.guid[2]) {
if (guid[2] == x.guid[2]) {
if (guid[3]<=x.guid[3]) {
if (guid[3] == x.guid[3]) {
if (guid[4]<=x.guid[4]) {
if (guid[4] == x.guid[4]) return false; else return true;
} else return false;
} else return true;
} else return false;
} else return true;
} else return false;
} else return true;
} else return false;
} else return true;
} else return false;
}
bool operator==(const Lfg5Guids& x) const
{
return guid[0] == x.guid[0] && guid[1] == x.guid[1] && guid[2] == x.guid[2] && guid[3] == x.guid[3] && guid[4] == x.guid[4];
}
void operator=(const Lfg5Guids& x) { memcpy(guid, x.guid, 5*8); delete roles; if (x.roles) roles = new LfgRolesMap(*(x.roles)); else roles = NULL; }
std::string toString() const // for debugging
{
std::ostringstream o;
o << GUID_LOPART(guid[0]) << "," << GUID_LOPART(guid[1]) << "," << GUID_LOPART(guid[2]) << "," << GUID_LOPART(guid[3]) << "," << GUID_LOPART(guid[4]) << ":" << (roles ? 1 : 0);
return o.str();
}
uint64 guid[5];
LfgRolesMap* roles;
Lfg5Guids() { memset(&guid, 0, 5*8); roles = NULL; }
Lfg5Guids(uint64 g) { memset(&guid, 0, 5*8); guid[0] = g; roles = NULL; }
Lfg5Guids(Lfg5Guids const& x) { memcpy(guid, x.guid, 5*8); if (x.roles) roles = new LfgRolesMap(*(x.roles)); else roles = NULL; }
Lfg5Guids(Lfg5Guids const& x, bool copyRoles) { memcpy(guid, x.guid, 5*8); roles = NULL; }
~Lfg5Guids() { delete roles; }
void addRoles(LfgRolesMap const& r) { roles = new LfgRolesMap(r); }
void clear() { memset(&guid, 0, 5*8); }
bool empty() const { return guid[0] == 0; }
uint64 front() const { return guid[0]; }
uint8 size() const
{
if (guid[2])
{
if (guid[4]) return 5;
else if (guid[3]) return 4;
return 3;
}
else if (guid[1]) return 2;
else if (guid[0]) return 1;
return 0;
}
void insert(const uint64& g)
{
// avoid loops for performance
if (guid[0] == 0) { guid[0] = g; return; }
else if (g <= guid[0]) { if (guid[3]) guid[4] = guid[3]; if (guid[2]) guid[3] = guid[2]; if (guid[1]) guid[2] = guid[1]; guid[1] = guid[0]; guid[0] = g; return; }
if (guid[1] == 0) { guid[1] = g; return; }
else if (g <= guid[1]) { if (guid[3]) guid[4] = guid[3]; if (guid[2]) guid[3] = guid[2]; guid[2] = guid[1]; guid[1] = g; return; }
if (guid[2] == 0) { guid[2] = g; return; }
else if (g <= guid[2]) { if (guid[3]) guid[4] = guid[3]; guid[3] = guid[2]; guid[2] = g; return; }
if (guid[3] == 0) { guid[3] = g; return; }
else if (g <= guid[3]) { guid[4] = guid[3]; guid[3] = g; return; }
guid[4] = g;
}
void force_insert_front(const uint64& g)
{
if (guid[3]) guid[4] = guid[3]; if (guid[2]) guid[3] = guid[2]; if (guid[1]) guid[2] = guid[1]; guid[1] = guid[0]; guid[0] = g;
}
void remove(const uint64& g)
{
// avoid loops for performance
if (guid[0] == g) { if (guid[1]) guid[0] = guid[1]; else { guid[0] = 0; return; } if (guid[2]) guid[1] = guid[2]; else { guid[1] = 0; return; } if (guid[3]) guid[2] = guid[3]; else { guid[2] = 0; return; } if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; }
if (guid[1] == g) { if (guid[2]) guid[1] = guid[2]; else { guid[1] = 0; return; } if (guid[3]) guid[2] = guid[3]; else { guid[2] = 0; return; } if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; }
if (guid[2] == g) { if (guid[3]) guid[2] = guid[3]; else { guid[2] = 0; return; } if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; }
if (guid[3] == g) { if (guid[4]) guid[3] = guid[4]; else { guid[3] = 0; return; } guid[4] = 0; return; }
if (guid[4] == g) guid[4] = 0;
}
bool hasGuid(const uint64& g) const
{
return g && (guid[0] == g || guid[1] == g || guid[2] == g || guid[3] == g || guid[4] == g);
}
bool operator<(const Lfg5Guids& x) const
{
// not neat, but fast xD
if (guid[0]<=x.guid[0]) {
if (guid[0] == x.guid[0]) {
if (guid[1]<=x.guid[1]) {
if (guid[1] == x.guid[1]) {
if (guid[2]<=x.guid[2]) {
if (guid[2] == x.guid[2]) {
if (guid[3]<=x.guid[3]) {
if (guid[3] == x.guid[3]) {
if (guid[4]<=x.guid[4]) {
if (guid[4] == x.guid[4]) return false; else return true;
} else return false;
} else return true;
} else return false;
} else return true;
} else return false;
} else return true;
} else return false;
} else return true;
} else return false;
}
bool operator==(const Lfg5Guids& x) const
{
return guid[0] == x.guid[0] && guid[1] == x.guid[1] && guid[2] == x.guid[2] && guid[3] == x.guid[3] && guid[4] == x.guid[4];
}
void operator=(const Lfg5Guids& x) { memcpy(guid, x.guid, 5*8); delete roles; if (x.roles) roles = new LfgRolesMap(*(x.roles)); else roles = NULL; }
std::string toString() const // for debugging
{
std::ostringstream o;
o << GUID_LOPART(guid[0]) << "," << GUID_LOPART(guid[1]) << "," << GUID_LOPART(guid[2]) << "," << GUID_LOPART(guid[3]) << "," << GUID_LOPART(guid[4]) << ":" << (roles ? 1 : 0);
return o.str();
}
};
/*
File diff suppressed because it is too large Load Diff
+109 -109
View File
@@ -140,86 +140,86 @@ enum LfgUpdateFlag // pussywizard: for raid browser
struct RBEntryInfo
{
RBEntryInfo() {}
RBEntryInfo(uint8 _roles, std::string const& _comment) : roles(_roles), comment(_comment) {}
uint8 roles;
std::string comment;
RBEntryInfo() {}
RBEntryInfo(uint8 _roles, std::string const& _comment) : roles(_roles), comment(_comment) {}
uint8 roles;
std::string comment;
};
struct RBInternalInfo
{
uint64 guid;
std::string comment;
bool isGroupLeader;
uint64 groupGuid;
uint8 roles;
uint32 encounterMask;
uint64 instanceGuid;
uint64 guid;
std::string comment;
bool isGroupLeader;
uint64 groupGuid;
uint8 roles;
uint32 encounterMask;
uint64 instanceGuid;
// additional character info parameters:
uint8 _online;
uint8 _level;
uint8 _class;
uint8 _race;
float _avgItemLevel;
// --
uint8 _talents0;
uint8 _talents1;
uint8 _talents2;
uint32 _area;
uint32 _armor;
uint32 _spellDamage;
uint32 _spellHeal;
// --
uint32 _critRatingMelee;
uint32 _critRatingRanged;
uint32 _critRatingSpell;
float _mp5;
float _mp5combat;
// --
uint32 _attackPower;
uint32 _agility;
uint32 _health;
uint32 _mana;
uint32 _defenseSkill;
// --
uint32 _dodgeRating;
uint32 _blockRating;
uint32 _parryRating;
uint32 _hasteRating;
uint32 _expertiseRating;
// additional character info parameters:
uint8 _online;
uint8 _level;
uint8 _class;
uint8 _race;
float _avgItemLevel;
// --
uint8 _talents0;
uint8 _talents1;
uint8 _talents2;
uint32 _area;
uint32 _armor;
uint32 _spellDamage;
uint32 _spellHeal;
// --
uint32 _critRatingMelee;
uint32 _critRatingRanged;
uint32 _critRatingSpell;
float _mp5;
float _mp5combat;
// --
uint32 _attackPower;
uint32 _agility;
uint32 _health;
uint32 _mana;
uint32 _defenseSkill;
// --
uint32 _dodgeRating;
uint32 _blockRating;
uint32 _parryRating;
uint32 _hasteRating;
uint32 _expertiseRating;
RBInternalInfo() {}
RBInternalInfo(uint64 guid, std::string const& comment, bool isGroupLeader, uint64 groupGuid, uint8 roles, uint32 encounterMask, uint64 instanceGuid,
uint8 _online, uint8 _level, uint8 _class, uint8 _race, float _avgItemLevel,
uint8 (&_talents)[3], uint32 _area, uint32 _armor, uint32 _spellDamage, uint32 _spellHeal,
uint32 _critRatingMelee, uint32 _critRatingRanged, uint32 _critRatingSpell, float _mp5, float _mp5combat,
uint32 _attackPower, uint32 _agility, uint32 _health, uint32 _mana, uint32 _defenseSkill,
uint32 _dodgeRating, uint32 _blockRating, uint32 _parryRating, uint32 _hasteRating, uint32 _expertiseRating)
: guid(guid), comment(comment), isGroupLeader(isGroupLeader), groupGuid(groupGuid), roles(roles), encounterMask(encounterMask), instanceGuid(instanceGuid),
_online(_online), _level(_level), _class(_class), _race(_race), _avgItemLevel(_avgItemLevel),
_talents0(_talents[0]), _talents1(_talents[1]), _talents2(_talents[2]), _area(_area), _armor(_armor), _spellDamage(_spellDamage), _spellHeal(_spellHeal),
_critRatingMelee(_critRatingMelee), _critRatingRanged(_critRatingRanged), _critRatingSpell(_critRatingSpell), _mp5(_mp5), _mp5combat(_mp5combat),
_attackPower(_attackPower), _agility(_agility), _health(_health), _mana(_mana), _defenseSkill(_defenseSkill),
_dodgeRating(_dodgeRating), _blockRating(_blockRating), _parryRating(_parryRating), _hasteRating(_hasteRating), _expertiseRating(_expertiseRating)
{}
bool PlayerSameAs(RBInternalInfo const& i) const
{
return isGroupLeader == i.isGroupLeader && groupGuid == i.groupGuid && roles == i.roles && (isGroupLeader || (comment == i.comment && encounterMask == i.encounterMask && instanceGuid == i.instanceGuid))
&& _online == i._online && _level == i._level && _class == i._class && _race == i._race && fabs(_avgItemLevel-i._avgItemLevel) < 0.01f
&& _talents0 == i._talents0 && _talents1 == i._talents1 && _talents2 == i._talents2 && _area == i._area && _armor == i._armor && _spellDamage == i._spellDamage && _spellHeal == i._spellHeal
&& _critRatingMelee == i._critRatingMelee && _critRatingRanged == i._critRatingRanged && _critRatingSpell == i._critRatingSpell && fabs(_mp5-i._mp5) < 0.01f && fabs(_mp5combat-i._mp5combat) < 0.01f
&& _attackPower == i._attackPower && _agility == i._agility && _health == i._health && _mana == i._mana && _defenseSkill == i._defenseSkill
&& _dodgeRating == i._dodgeRating && _blockRating == i._blockRating && _parryRating == i._parryRating && _hasteRating == i._hasteRating && _expertiseRating == i._expertiseRating;
}
void CopyStats(RBInternalInfo const& i)
{
_avgItemLevel = i._avgItemLevel;
_talents0 = i._talents0; _talents1 = i._talents1; _talents2 = i._talents2; _area = i._area; _armor = i._armor; _spellDamage = i._spellDamage; _spellHeal = i._spellHeal;
_critRatingMelee = i._critRatingMelee; _critRatingRanged = i._critRatingRanged; _critRatingSpell = i._critRatingSpell; _mp5 = i._mp5; _mp5combat = i._mp5combat;
_attackPower = i._attackPower; _agility = i._agility; _health = i._health; _mana = i._mana; _defenseSkill = i._defenseSkill;
_dodgeRating = i._dodgeRating; _blockRating = i._blockRating; _parryRating = i._parryRating; _hasteRating = i._hasteRating; _expertiseRating = i._expertiseRating;
}
RBInternalInfo() {}
RBInternalInfo(uint64 guid, std::string const& comment, bool isGroupLeader, uint64 groupGuid, uint8 roles, uint32 encounterMask, uint64 instanceGuid,
uint8 _online, uint8 _level, uint8 _class, uint8 _race, float _avgItemLevel,
uint8 (&_talents)[3], uint32 _area, uint32 _armor, uint32 _spellDamage, uint32 _spellHeal,
uint32 _critRatingMelee, uint32 _critRatingRanged, uint32 _critRatingSpell, float _mp5, float _mp5combat,
uint32 _attackPower, uint32 _agility, uint32 _health, uint32 _mana, uint32 _defenseSkill,
uint32 _dodgeRating, uint32 _blockRating, uint32 _parryRating, uint32 _hasteRating, uint32 _expertiseRating)
: guid(guid), comment(comment), isGroupLeader(isGroupLeader), groupGuid(groupGuid), roles(roles), encounterMask(encounterMask), instanceGuid(instanceGuid),
_online(_online), _level(_level), _class(_class), _race(_race), _avgItemLevel(_avgItemLevel),
_talents0(_talents[0]), _talents1(_talents[1]), _talents2(_talents[2]), _area(_area), _armor(_armor), _spellDamage(_spellDamage), _spellHeal(_spellHeal),
_critRatingMelee(_critRatingMelee), _critRatingRanged(_critRatingRanged), _critRatingSpell(_critRatingSpell), _mp5(_mp5), _mp5combat(_mp5combat),
_attackPower(_attackPower), _agility(_agility), _health(_health), _mana(_mana), _defenseSkill(_defenseSkill),
_dodgeRating(_dodgeRating), _blockRating(_blockRating), _parryRating(_parryRating), _hasteRating(_hasteRating), _expertiseRating(_expertiseRating)
{}
bool PlayerSameAs(RBInternalInfo const& i) const
{
return isGroupLeader == i.isGroupLeader && groupGuid == i.groupGuid && roles == i.roles && (isGroupLeader || (comment == i.comment && encounterMask == i.encounterMask && instanceGuid == i.instanceGuid))
&& _online == i._online && _level == i._level && _class == i._class && _race == i._race && fabs(_avgItemLevel-i._avgItemLevel) < 0.01f
&& _talents0 == i._talents0 && _talents1 == i._talents1 && _talents2 == i._talents2 && _area == i._area && _armor == i._armor && _spellDamage == i._spellDamage && _spellHeal == i._spellHeal
&& _critRatingMelee == i._critRatingMelee && _critRatingRanged == i._critRatingRanged && _critRatingSpell == i._critRatingSpell && fabs(_mp5-i._mp5) < 0.01f && fabs(_mp5combat-i._mp5combat) < 0.01f
&& _attackPower == i._attackPower && _agility == i._agility && _health == i._health && _mana == i._mana && _defenseSkill == i._defenseSkill
&& _dodgeRating == i._dodgeRating && _blockRating == i._blockRating && _parryRating == i._parryRating && _hasteRating == i._hasteRating && _expertiseRating == i._expertiseRating;
}
void CopyStats(RBInternalInfo const& i)
{
_avgItemLevel = i._avgItemLevel;
_talents0 = i._talents0; _talents1 = i._talents1; _talents2 = i._talents2; _area = i._area; _armor = i._armor; _spellDamage = i._spellDamage; _spellHeal = i._spellHeal;
_critRatingMelee = i._critRatingMelee; _critRatingRanged = i._critRatingRanged; _critRatingSpell = i._critRatingSpell; _mp5 = i._mp5; _mp5combat = i._mp5combat;
_attackPower = i._attackPower; _agility = i._agility; _health = i._health; _mana = i._mana; _defenseSkill = i._defenseSkill;
_dodgeRating = i._dodgeRating; _blockRating = i._blockRating; _parryRating = i._parryRating; _hasteRating = i._hasteRating; _expertiseRating = i._expertiseRating;
}
};
// Forward declaration (just to have all typedef together)
@@ -395,20 +395,20 @@ class LFGMgr
LFGMgr();
~LFGMgr();
// pussywizard: RAIDBROWSER
typedef UNORDERED_MAP<uint32 /*playerGuidLow*/, RBEntryInfo> RBEntryInfoMap;
typedef UNORDERED_MAP<uint32 /*dungeonId*/, RBEntryInfoMap> RBStoreMap;
RBStoreMap RaidBrowserStore[2]; // for 2 factions
typedef UNORDERED_MAP<uint32 /*playerGuidLow*/, uint32 /*dungeonId*/> RBSearchersMap;
RBSearchersMap RBSearchersStore[2]; // for 2 factions
typedef UNORDERED_MAP<uint32 /*dungeonId*/, WorldPacket> RBCacheMap;
RBCacheMap RBCacheStore[2]; // for 2 factions
typedef UNORDERED_MAP<uint32 /*guidLow*/, RBInternalInfo> RBInternalInfoMap;
typedef UNORDERED_MAP<uint32 /*dungeonId*/, RBInternalInfoMap> RBInternalInfoMapMap;
RBInternalInfoMapMap RBInternalInfoStorePrev[2]; // for 2 factions
RBInternalInfoMapMap RBInternalInfoStoreCurr[2]; // for 2 factions
typedef std::set<uint32 /*dungeonId*/> RBUsedDungeonsSet; // needs to be ordered
RBUsedDungeonsSet RBUsedDungeonsStore[2]; // for 2 factions
// pussywizard: RAIDBROWSER
typedef UNORDERED_MAP<uint32 /*playerGuidLow*/, RBEntryInfo> RBEntryInfoMap;
typedef UNORDERED_MAP<uint32 /*dungeonId*/, RBEntryInfoMap> RBStoreMap;
RBStoreMap RaidBrowserStore[2]; // for 2 factions
typedef UNORDERED_MAP<uint32 /*playerGuidLow*/, uint32 /*dungeonId*/> RBSearchersMap;
RBSearchersMap RBSearchersStore[2]; // for 2 factions
typedef UNORDERED_MAP<uint32 /*dungeonId*/, WorldPacket> RBCacheMap;
RBCacheMap RBCacheStore[2]; // for 2 factions
typedef UNORDERED_MAP<uint32 /*guidLow*/, RBInternalInfo> RBInternalInfoMap;
typedef UNORDERED_MAP<uint32 /*dungeonId*/, RBInternalInfoMap> RBInternalInfoMapMap;
RBInternalInfoMapMap RBInternalInfoStorePrev[2]; // for 2 factions
RBInternalInfoMapMap RBInternalInfoStoreCurr[2]; // for 2 factions
typedef std::set<uint32 /*dungeonId*/> RBUsedDungeonsSet; // needs to be ordered
RBUsedDungeonsSet RBUsedDungeonsStore[2]; // for 2 factions
public:
// Functions used outside lfg namespace
@@ -477,10 +477,10 @@ class LFGMgr
uint8 RemovePlayerFromGroup(uint64 gguid, uint64 guid);
/// Adds player to group
void AddPlayerToGroup(uint64 gguid, uint64 guid);
/// Xinef: Set Random Players Count
void SetRandomPlayersCount(uint64 guid, uint8 count);
/// Xinef: Get Random Players Count
uint8 GetRandomPlayersCount(uint64 guid);
/// Xinef: Set Random Players Count
void SetRandomPlayersCount(uint64 guid, uint8 count);
/// Xinef: Get Random Players Count
uint8 GetRandomPlayersCount(uint64 guid);
// LFGHandler
/// Get locked dungeons
@@ -511,21 +511,21 @@ class LFGMgr
void JoinLfg(Player* player, uint8 roles, LfgDungeonSet& dungeons, std::string const& comment);
/// Leaves lfg
void LeaveLfg(uint64 guid);
/// pussywizard: cleans all queues' data
void LeaveAllLfgQueues(uint64 guid, bool allowgroup, uint64 groupguid = 0);
/// pussywizard: Raid Browser
void JoinRaidBrowser(Player* player, uint8 roles, LfgDungeonSet& dungeons, std::string comment);
void LeaveRaidBrowser(uint64 guid);
void LfrSearchAdd(Player* p, uint32 dungeonId);
void LfrSearchRemove(Player* p);
void SendRaidBrowserCachedList(Player* player, uint32 dungeonId);
void UpdateRaidBrowser(uint32 diff);
/// pussywizard: cleans all queues' data
void LeaveAllLfgQueues(uint64 guid, bool allowgroup, uint64 groupguid = 0);
/// pussywizard: Raid Browser
void JoinRaidBrowser(Player* player, uint8 roles, LfgDungeonSet& dungeons, std::string comment);
void LeaveRaidBrowser(uint64 guid);
void LfrSearchAdd(Player* p, uint32 dungeonId);
void LfrSearchRemove(Player* p);
void SendRaidBrowserCachedList(Player* player, uint32 dungeonId);
void UpdateRaidBrowser(uint32 diff);
void LfrSetComment(Player* p, std::string comment);
void SendRaidBrowserJoinedPacket(Player* p, LfgDungeonSet& dungeons, std::string comment);
void RBPacketAppendGroup(const RBInternalInfo& info, ByteBuffer& buffer);
void RBPacketAppendPlayer(const RBInternalInfo& info, ByteBuffer& buffer);
void RBPacketBuildDifference(WorldPacket& differencePacket, uint32 dungeonId, uint32 deletedCounter, ByteBuffer& buffer_deleted, uint32 groupCounter, ByteBuffer& buffer_groups, uint32 playerCounter, ByteBuffer& buffer_players);
void RBPacketBuildFull(WorldPacket& fullPacket, uint32 dungeonId, RBInternalInfoMap& infoMap);
void SendRaidBrowserJoinedPacket(Player* p, LfgDungeonSet& dungeons, std::string comment);
void RBPacketAppendGroup(const RBInternalInfo& info, ByteBuffer& buffer);
void RBPacketAppendPlayer(const RBInternalInfo& info, ByteBuffer& buffer);
void RBPacketBuildDifference(WorldPacket& differencePacket, uint32 dungeonId, uint32 deletedCounter, ByteBuffer& buffer_deleted, uint32 groupCounter, ByteBuffer& buffer_groups, uint32 playerCounter, ByteBuffer& buffer_players);
void RBPacketBuildFull(WorldPacket& fullPacket, uint32 dungeonId, RBInternalInfoMap& infoMap);
// LfgQueue
/// Get last lfg state (NONE, DUNGEON or FINISHED_DUNGEON)
@@ -554,7 +554,7 @@ class LFGMgr
void SetLockedDungeons(uint64 guid, LfgLockMap const& lock);
void DecreaseKicksLeft(uint64 guid);
void SetState(uint64 guid, LfgState state);
void SetCanOverrideRBState(uint64 guid, bool val);
void SetCanOverrideRBState(uint64 guid, bool val);
void GetCompatibleDungeons(LfgDungeonSet& dungeons, LfgGuidSet const& players, LfgLockPartyMap& lockMap);
void _SaveToDB(uint64 guid);
LFGDungeonData const* GetLFGDungeon(uint32 id);
@@ -582,8 +582,8 @@ class LFGMgr
uint32 m_lfgProposalId; ///< used as internal counter for proposals
uint32 m_options; ///< Stores config options
uint32 lastProposalId; ///< pussywizard, store it here because of splitting LFGMgr update into tasks
uint32 m_raidBrowserUpdateTimer[2]; ///< pussywizard
uint32 m_raidBrowserLastUpdatedDungeonId[2]; ///< pussywizard: for 2 factions
uint32 m_raidBrowserUpdateTimer[2]; ///< pussywizard
uint32 m_raidBrowserLastUpdatedDungeonId[2]; ///< pussywizard: for 2 factions
LfgQueueContainer QueuesStore; ///< Queues
LfgCachedDungeonContainer CachedDungeonMapStore; ///< Stores all dungeons by groupType
@@ -31,8 +31,8 @@ LfgPlayerData::~LfgPlayerData()
void LfgPlayerData::SetState(LfgState state)
{
if (m_State == LFG_STATE_RAIDBROWSER && state != LFG_STATE_RAIDBROWSER && !CanOverrideRBState())
return;
if (m_State == LFG_STATE_RAIDBROWSER && state != LFG_STATE_RAIDBROWSER && !CanOverrideRBState())
return;
switch (state)
{
@@ -52,8 +52,8 @@ void LfgPlayerData::SetState(LfgState state)
void LfgPlayerData::RestoreState()
{
if (m_State == LFG_STATE_RAIDBROWSER && m_OldState != LFG_STATE_RAIDBROWSER && !CanOverrideRBState())
return;
if (m_State == LFG_STATE_RAIDBROWSER && m_OldState != LFG_STATE_RAIDBROWSER && !CanOverrideRBState())
return;
if (m_OldState == LFG_STATE_NONE)
{
@@ -95,12 +95,12 @@ void LfgPlayerData::SetSelectedDungeons(LfgDungeonSet const& dungeons)
void LfgPlayerData::SetRandomPlayersCount(uint8 count)
{
m_randomPlayers = count;
m_randomPlayers = count;
}
uint8 LfgPlayerData::GetRandomPlayersCount() const
{
return m_randomPlayers;
return m_randomPlayers;
}
LfgState LfgPlayerData::GetState() const

Some files were not shown because too many files have changed in this diff Show More