mirror of
https://github.com/azerothcore/azerothcore-wotlk.git
synced 2025-12-06 02:30:26 -08:00
importing changes from callmephil repo
a special thanks to him
This commit is contained in:
parent
5bb70a86be
commit
52f305111c
49 changed files with 4333 additions and 3252 deletions
|
|
@ -171,57 +171,10 @@ ELSE(WIN32 AND NOT CYGWIN)
|
||||||
|
|
||||||
ENDIF(WIN32 AND NOT CYGWIN)
|
ENDIF(WIN32 AND NOT CYGWIN)
|
||||||
|
|
||||||
if (NOT OPENSSL_INCLUDE_DIR)
|
include(FindPackageHandleStandardArgs)
|
||||||
include(FindPackageHandleStandardArgs)
|
find_package_handle_standard_args(OpenSSL DEFAULT_MSG
|
||||||
find_package_handle_standard_args(OpenSSL DEFAULT_MSG
|
OPENSSL_LIBRARIES
|
||||||
OPENSSL_LIBRARIES
|
OPENSSL_INCLUDE_DIR
|
||||||
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)
|
|
||||||
|
|
||||||
MARK_AS_ADVANCED(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES)
|
MARK_AS_ADVANCED(OPENSSL_INCLUDE_DIR OPENSSL_LIBRARIES)
|
||||||
|
|
|
||||||
|
|
@ -24,13 +24,13 @@ set(WITH_FAST_MUTEXES OFF)
|
||||||
|
|
||||||
# Handle useful options - hardcode to ON/OFF
|
# Handle useful options - hardcode to ON/OFF
|
||||||
set(ENABLED_PROFILING 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
|
# Set DBUG_OFF and other optional release-only flags for non-debug project types
|
||||||
foreach(BUILD_TYPE RELEASE RELWITHDEBINFO MINSIZEREL)
|
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)
|
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()
|
endif()
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
|
|
|
||||||
14
sql/logon fixes/logon.autobroadcast.sql
Normal file
14
sql/logon fixes/logon.autobroadcast.sql
Normal 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;
|
||||||
66
sql/world updates/creature_text_dalaran_citizen.sql
Normal file
66
sql/world updates/creature_text_dalaran_citizen.sql
Normal file
|
|
@ -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
sql/world updates/invisible_stalker.sql
Normal file
82
sql/world updates/invisible_stalker.sql
Normal 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
sql/world updates/say_text_linda_alec.sql
Normal file
34
sql/world updates/say_text_linda_alec.sql
Normal 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);
|
||||||
|
|
@ -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
|
* 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
|
* under the terms of the GNU General Public License as published by the
|
||||||
|
|
@ -27,125 +27,276 @@
|
||||||
namespace AccountMgr
|
namespace AccountMgr
|
||||||
{
|
{
|
||||||
|
|
||||||
uint32 GetId(std::string const& username)
|
AccountOpResult CreateAccount(std::string username, std::string password)
|
||||||
{
|
{
|
||||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_ACCOUNT_ID_BY_USERNAME);
|
if (utf8length(username) > MAX_ACCOUNT_STR)
|
||||||
stmt->setString(0, username);
|
return AOR_NAME_TOO_LONG; // username's too long
|
||||||
PreparedQueryResult result = LoginDatabase.Query(stmt);
|
|
||||||
|
|
||||||
return (result) ? (*result)[0].GetUInt32() : 0;
|
normalizeString(username);
|
||||||
}
|
normalizeString(password);
|
||||||
|
|
||||||
uint32 GetSecurity(uint32 accountId)
|
if (GetId(username))
|
||||||
{
|
return AOR_NAME_ALREDY_EXIST; // username does already exist
|
||||||
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);
|
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT);
|
||||||
}
|
|
||||||
|
|
||||||
uint32 GetSecurity(uint32 accountId, int32 realmId)
|
stmt->setString(0, username);
|
||||||
{
|
stmt->setString(1, CalculateShaPassHash(username, password));
|
||||||
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);
|
LoginDatabase.Execute(stmt);
|
||||||
}
|
|
||||||
|
|
||||||
bool GetName(uint32 accountId, std::string& name)
|
stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_REALM_CHARACTERS_INIT);
|
||||||
{
|
|
||||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_GET_USERNAME_BY_ID);
|
|
||||||
stmt->setUInt32(0, accountId);
|
|
||||||
PreparedQueryResult result = LoginDatabase.Query(stmt);
|
|
||||||
|
|
||||||
if (result)
|
LoginDatabase.Execute(stmt);
|
||||||
{
|
|
||||||
name = (*result)[0].GetString();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return AOR_OK; // everything's fine
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckPassword(uint32 accountId, std::string password)
|
AccountOpResult DeleteAccount(uint32 accountId)
|
||||||
{
|
{
|
||||||
std::string username;
|
// Check if accounts exists
|
||||||
|
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_BY_ID);
|
||||||
|
stmt->setUInt32(0, accountId);
|
||||||
|
PreparedQueryResult result = LoginDatabase.Query(stmt);
|
||||||
|
|
||||||
if (!GetName(accountId, username))
|
if (!result)
|
||||||
return false;
|
return AOR_NAME_NOT_EXIST;
|
||||||
|
|
||||||
normalizeString(username);
|
// Obtain accounts characters
|
||||||
normalizeString(password);
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARS_BY_ACCOUNT_ID);
|
||||||
|
|
||||||
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_CHECK_PASSWORD);
|
stmt->setUInt32(0, accountId);
|
||||||
stmt->setUInt32(0, accountId);
|
|
||||||
stmt->setString(1, CalculateShaPassHash(username, password));
|
|
||||||
PreparedQueryResult result = LoginDatabase.Query(stmt);
|
|
||||||
|
|
||||||
return (result) ? true : false;
|
result = CharacterDatabase.Query(stmt);
|
||||||
}
|
|
||||||
|
|
||||||
uint32 GetCharactersCount(uint32 accountId)
|
if (result)
|
||||||
{
|
{
|
||||||
// check character count
|
do
|
||||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_SUM_CHARS);
|
{
|
||||||
stmt->setUInt32(0, accountId);
|
uint32 guidLow = (*result)[0].GetUInt32();
|
||||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
uint64 guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
|
||||||
|
|
||||||
return (result) ? (*result)[0].GetUInt64() : 0;
|
// 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
|
||||||
|
}
|
||||||
|
|
||||||
bool normalizeString(std::string& utf8String)
|
Player::DeleteFromDB(guid, accountId, false, true); // no need to update realm characters
|
||||||
{
|
} while (result->NextRow());
|
||||||
wchar_t buffer[MAX_ACCOUNT_STR+1];
|
}
|
||||||
|
|
||||||
size_t maxLength = MAX_ACCOUNT_STR;
|
// table realm specific but common for all characters of account for realm
|
||||||
if (!Utf8toWStr(utf8String, buffer, maxLength))
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_TUTORIALS);
|
||||||
return false;
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool CheckPassword(uint32 accountId, std::string password)
|
||||||
|
{
|
||||||
|
std::string username;
|
||||||
|
|
||||||
|
if (!GetName(accountId, username))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
normalizeString(username);
|
||||||
|
normalizeString(password);
|
||||||
|
|
||||||
|
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) ? true : false;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 GetCharactersCount(uint32 accountId)
|
||||||
|
{
|
||||||
|
// check character count
|
||||||
|
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_SUM_CHARS);
|
||||||
|
stmt->setUInt32(0, accountId);
|
||||||
|
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||||
|
|
||||||
|
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
|
#ifdef _MSC_VER
|
||||||
#pragma warning(disable: 4996)
|
#pragma warning(disable: 4996)
|
||||||
#endif
|
#endif
|
||||||
std::transform(&buffer[0], buffer+maxLength, &buffer[0], wcharToUpperOnlyLatin);
|
std::transform(&buffer[0], buffer + maxLength, &buffer[0], wcharToUpperOnlyLatin);
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning(default: 4996)
|
#pragma warning(default: 4996)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return WStrToUtf8(buffer, maxLength, utf8String);
|
return WStrToUtf8(buffer, maxLength, utf8String);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string CalculateShaPassHash(std::string const& name, std::string const& password)
|
std::string CalculateShaPassHash(std::string const& name, std::string const& password)
|
||||||
{
|
{
|
||||||
SHA1Hash sha;
|
SHA1Hash sha;
|
||||||
sha.Initialize();
|
sha.Initialize();
|
||||||
sha.UpdateData(name);
|
sha.UpdateData(name);
|
||||||
sha.UpdateData(":");
|
sha.UpdateData(":");
|
||||||
sha.UpdateData(password);
|
sha.UpdateData(password);
|
||||||
sha.Finalize();
|
sha.Finalize();
|
||||||
|
|
||||||
return ByteArrayToHexStr(sha.GetDigest(), sha.GetLength());
|
return ByteArrayToHexStr(sha.GetDigest(), sha.GetLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsPlayerAccount(uint32 gmlevel)
|
bool IsPlayerAccount(uint32 gmlevel)
|
||||||
{
|
{
|
||||||
return gmlevel == SEC_PLAYER;
|
return gmlevel == SEC_PLAYER;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsGMAccount(uint32 gmlevel)
|
bool IsGMAccount(uint32 gmlevel)
|
||||||
{
|
{
|
||||||
return gmlevel >= SEC_GAMEMASTER && gmlevel <= SEC_CONSOLE;
|
return gmlevel >= SEC_GAMEMASTER && gmlevel <= SEC_CONSOLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsAdminAccount(uint32 gmlevel)
|
bool IsAdminAccount(uint32 gmlevel)
|
||||||
{
|
{
|
||||||
return gmlevel >= SEC_ADMINISTRATOR && gmlevel <= SEC_CONSOLE;
|
return gmlevel >= SEC_ADMINISTRATOR && gmlevel <= SEC_CONSOLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsConsoleAccount(uint32 gmlevel)
|
bool IsConsoleAccount(uint32 gmlevel)
|
||||||
{
|
{
|
||||||
return gmlevel == SEC_CONSOLE;
|
return gmlevel == SEC_CONSOLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
} // Namespace AccountMgr
|
} // Namespace AccountMgr
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,10 @@ enum AccountOpResult
|
||||||
|
|
||||||
namespace AccountMgr
|
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);
|
bool CheckPassword(uint32 accountId, std::string password);
|
||||||
|
|
||||||
uint32 GetId(std::string const& username);
|
uint32 GetId(std::string const& username);
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,9 @@ AuctionHouseMgr::~AuctionHouseMgr()
|
||||||
|
|
||||||
AuctionHouseObject* AuctionHouseMgr::GetAuctionsMap(uint32 factionTemplateId)
|
AuctionHouseObject* AuctionHouseMgr::GetAuctionsMap(uint32 factionTemplateId)
|
||||||
{
|
{
|
||||||
|
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
|
||||||
|
return &mNeutralAuctions;
|
||||||
|
|
||||||
// team have linked auction houses
|
// team have linked auction houses
|
||||||
FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(factionTemplateId);
|
FactionTemplateEntry const* u_entry = sFactionTemplateStore.LookupEntry(factionTemplateId);
|
||||||
if (!u_entry)
|
if (!u_entry)
|
||||||
|
|
@ -372,7 +375,7 @@ AuctionHouseEntry const* AuctionHouseMgr::GetAuctionHouseEntry(uint32 factionTem
|
||||||
{
|
{
|
||||||
uint32 houseid = 7; // goblin auction house
|
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
|
//FIXME: found way for proper auctionhouse selection by another way
|
||||||
// AuctionHouse.dbc have faction field with _player_ factions associated with auction house races.
|
// AuctionHouse.dbc have faction field with _player_ factions associated with auction house races.
|
||||||
|
|
|
||||||
|
|
@ -594,7 +594,8 @@ void Channel::SetMode(Player const* player, std::string const& p2n, bool mod, bo
|
||||||
if (!victim || !IsOn(victim) ||
|
if (!victim || !IsOn(victim) ||
|
||||||
// allow make moderator from another team only if both is GMs
|
// 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
|
// 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;
|
WorldPacket data;
|
||||||
MakePlayerNotFound(&data, p2n);
|
MakePlayerNotFound(&data, p2n);
|
||||||
|
|
@ -659,7 +660,8 @@ void Channel::SetOwner(Player const* player, std::string const& newname)
|
||||||
Player* newp = ObjectAccessor::FindPlayerByName(newname, false);
|
Player* newp = ObjectAccessor::FindPlayerByName(newname, false);
|
||||||
uint64 victim = newp ? newp->GetGUID() : 0;
|
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;
|
WorldPacket data;
|
||||||
MakePlayerNotFound(&data, newname);
|
MakePlayerNotFound(&data, newname);
|
||||||
|
|
@ -764,6 +766,9 @@ void Channel::Say(uint64 guid, std::string const& what, uint32 lang)
|
||||||
if (what.empty())
|
if (what.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||||
|
lang = LANG_UNIVERSAL;
|
||||||
|
|
||||||
if (!IsOn(guid))
|
if (!IsOn(guid))
|
||||||
{
|
{
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
|
|
|
||||||
|
|
@ -1,201 +1,205 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C)
|
* Copyright (C)
|
||||||
* Copyright (C)
|
* Copyright (C)
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* 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
|
* 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
|
* Free Software Foundation; either version 2 of the License, or (at your
|
||||||
* option) any later version.
|
* option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
* more details.
|
* more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along
|
* You should have received a copy of the GNU General Public License along
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ChannelMgr.h"
|
#include "ChannelMgr.h"
|
||||||
#include "Player.h"
|
#include "Player.h"
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
|
|
||||||
ChannelMgr::~ChannelMgr()
|
ChannelMgr::~ChannelMgr()
|
||||||
{
|
{
|
||||||
for (ChannelMap::iterator itr = channels.begin(); itr != channels.end(); ++itr)
|
for (ChannelMap::iterator itr = channels.begin(); itr != channels.end(); ++itr)
|
||||||
delete itr->second;
|
delete itr->second;
|
||||||
|
|
||||||
channels.clear();
|
channels.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
ChannelMgr* ChannelMgr::forTeam(TeamId teamId)
|
ChannelMgr* ChannelMgr::forTeam(TeamId teamId)
|
||||||
{
|
{
|
||||||
if (teamId == TEAM_ALLIANCE)
|
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL))
|
||||||
return ACE_Singleton<AllianceChannelMgr, ACE_Null_Mutex>::instance();
|
return ACE_Singleton<AllianceChannelMgr, ACE_Null_Mutex>::instance(); // cross-faction
|
||||||
|
|
||||||
if (teamId == TEAM_HORDE)
|
if (teamId == TEAM_ALLIANCE)
|
||||||
return ACE_Singleton<HordeChannelMgr, ACE_Null_Mutex>::instance();
|
return ACE_Singleton<AllianceChannelMgr, ACE_Null_Mutex>::instance();
|
||||||
|
|
||||||
return NULL;
|
if (teamId == TEAM_HORDE)
|
||||||
}
|
return ACE_Singleton<HordeChannelMgr, ACE_Null_Mutex>::instance();
|
||||||
|
|
||||||
|
return NULL;
|
||||||
void ChannelMgr::LoadChannels()
|
}
|
||||||
{
|
|
||||||
uint32 oldMSTime = getMSTime();
|
|
||||||
uint32 count = 0;
|
void ChannelMgr::LoadChannels()
|
||||||
|
{
|
||||||
QueryResult result = CharacterDatabase.PQuery("SELECT channelId, name, team, announce, password FROM channels WHERE team = %u ORDER BY channelId ASC", _teamId);
|
uint32 oldMSTime = getMSTime();
|
||||||
if (!result)
|
uint32 count = 0;
|
||||||
{
|
|
||||||
sLog->outString(">> Loaded 0 channels for %s", _teamId == TEAM_ALLIANCE ? "Alliance" : "Horde");
|
QueryResult result = CharacterDatabase.PQuery("SELECT channelId, name, team, announce, password FROM channels WHERE team = %u ORDER BY channelId ASC", _teamId);
|
||||||
sLog->outString();
|
if (!result)
|
||||||
return;
|
{
|
||||||
}
|
sLog->outString(">> Loaded 0 channels for %s", _teamId == TEAM_ALLIANCE ? "Alliance" : "Horde");
|
||||||
|
sLog->outString();
|
||||||
do
|
return;
|
||||||
{
|
}
|
||||||
Field* fields = result->Fetch();
|
|
||||||
if (!fields)
|
do
|
||||||
break;
|
{
|
||||||
|
Field* fields = result->Fetch();
|
||||||
uint32 channelDBId = fields[0].GetUInt32();
|
if (!fields)
|
||||||
std::string channelName = fields[1].GetString();
|
break;
|
||||||
std::string password = fields[4].GetString();
|
|
||||||
std::wstring channelWName;
|
uint32 channelDBId = fields[0].GetUInt32();
|
||||||
Utf8toWStr(channelName, channelWName);
|
std::string channelName = fields[1].GetString();
|
||||||
|
std::string password = fields[4].GetString();
|
||||||
Channel* newChannel = new Channel(channelName, 0, channelDBId, TeamId(fields[2].GetUInt32()), fields[3].GetUInt8());
|
std::wstring channelWName;
|
||||||
newChannel->SetPassword(password);
|
Utf8toWStr(channelName, channelWName);
|
||||||
channels[channelWName] = newChannel;
|
|
||||||
|
Channel* newChannel = new Channel(channelName, 0, channelDBId, TeamId(fields[2].GetUInt32()), fields[3].GetUInt8());
|
||||||
if (QueryResult banResult = CharacterDatabase.PQuery("SELECT playerGUID, banTime FROM channels_bans WHERE channelId = %u", channelDBId))
|
newChannel->SetPassword(password);
|
||||||
{
|
channels[channelWName] = newChannel;
|
||||||
do
|
|
||||||
{
|
if (QueryResult banResult = CharacterDatabase.PQuery("SELECT playerGUID, banTime FROM channels_bans WHERE channelId = %u", channelDBId))
|
||||||
Field* banFields = banResult->Fetch();
|
{
|
||||||
if (!banFields)
|
do
|
||||||
break;
|
{
|
||||||
newChannel->AddBan(banFields[0].GetUInt32(), banFields[1].GetUInt32());
|
Field* banFields = banResult->Fetch();
|
||||||
}
|
if (!banFields)
|
||||||
while (banResult->NextRow());
|
break;
|
||||||
}
|
newChannel->AddBan(banFields[0].GetUInt32(), banFields[1].GetUInt32());
|
||||||
|
}
|
||||||
if (channelDBId > ChannelMgr::_channelIdMax)
ChannelMgr::_channelIdMax = channelDBId;
|
while (banResult->NextRow());
|
||||||
++count;
|
}
|
||||||
}
|
|
||||||
while (result->NextRow());
|
if (channelDBId > ChannelMgr::_channelIdMax)
|
||||||
|
ChannelMgr::_channelIdMax = channelDBId;
|
||||||
sLog->outString(">> Loaded %u channels for %s in %ums", count, _teamId == TEAM_ALLIANCE ? "Alliance" : "Horde", GetMSTimeDiffToNow(oldMSTime));
|
++count;
|
||||||
sLog->outString();
|
}
|
||||||
}
|
while (result->NextRow());
|
||||||
|
|
||||||
Channel* ChannelMgr::GetJoinChannel(std::string const& name, uint32 channelId)
|
sLog->outString(">> Loaded %u channels for %s in %ums", count, _teamId == TEAM_ALLIANCE ? "Alliance" : "Horde", GetMSTimeDiffToNow(oldMSTime));
|
||||||
{
|
sLog->outString();
|
||||||
std::wstring wname;
|
}
|
||||||
Utf8toWStr(name, wname);
|
|
||||||
wstrToLower(wname);
|
Channel* ChannelMgr::GetJoinChannel(std::string const& name, uint32 channelId)
|
||||||
|
{
|
||||||
ChannelMap::const_iterator i = channels.find(wname);
|
std::wstring wname;
|
||||||
|
Utf8toWStr(name, wname);
|
||||||
if (i == channels.end())
|
wstrToLower(wname);
|
||||||
{
|
|
||||||
std::string chNameLower = name;
|
ChannelMap::const_iterator i = channels.find(wname);
|
||||||
std::transform(chNameLower.begin(), chNameLower.end(), chNameLower.begin(), ::tolower);
|
|
||||||
Channel* nchan = new Channel(chNameLower, channelId, 0, _teamId);
|
if (i == channels.end())
|
||||||
channels[wname] = nchan;
|
{
|
||||||
return nchan;
|
std::string chNameLower = name;
|
||||||
}
|
std::transform(chNameLower.begin(), chNameLower.end(), chNameLower.begin(), ::tolower);
|
||||||
|
Channel* nchan = new Channel(chNameLower, channelId, 0, _teamId);
|
||||||
return i->second;
|
channels[wname] = nchan;
|
||||||
}
|
return nchan;
|
||||||
|
}
|
||||||
Channel* ChannelMgr::GetChannel(std::string const& name, Player* player, bool pkt)
|
|
||||||
{
|
return i->second;
|
||||||
std::wstring wname;
|
}
|
||||||
Utf8toWStr(name, wname);
|
|
||||||
wstrToLower(wname);
|
Channel* ChannelMgr::GetChannel(std::string const& name, Player* player, bool pkt)
|
||||||
|
{
|
||||||
ChannelMap::const_iterator i = channels.find(wname);
|
std::wstring wname;
|
||||||
|
Utf8toWStr(name, wname);
|
||||||
if (i == channels.end())
|
wstrToLower(wname);
|
||||||
{
|
|
||||||
if (pkt)
|
ChannelMap::const_iterator i = channels.find(wname);
|
||||||
{
|
|
||||||
WorldPacket data;
|
if (i == channels.end())
|
||||||
MakeNotOnPacket(&data, name);
|
{
|
||||||
player->GetSession()->SendPacket(&data);
|
if (pkt)
|
||||||
}
|
{
|
||||||
|
WorldPacket data;
|
||||||
return NULL;
|
MakeNotOnPacket(&data, name);
|
||||||
}
|
player->GetSession()->SendPacket(&data);
|
||||||
|
}
|
||||||
return i->second;
|
|
||||||
}
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
uint32 ChannelMgr::_channelIdMax = 0;
|
return i->second;
|
||||||
ChannelMgr::ChannelRightsMap ChannelMgr::channels_rights;
|
}
|
||||||
ChannelRights ChannelMgr::channelRightsEmpty;
|
|
||||||
|
|
||||||
void ChannelMgr::LoadChannelRights()
|
uint32 ChannelMgr::_channelIdMax = 0;
|
||||||
{
|
ChannelMgr::ChannelRightsMap ChannelMgr::channels_rights;
|
||||||
uint32 oldMSTime = getMSTime();
|
ChannelRights ChannelMgr::channelRightsEmpty;
|
||||||
channels_rights.clear();
|
|
||||||
|
void ChannelMgr::LoadChannelRights()
|
||||||
QueryResult result = CharacterDatabase.Query("SELECT name, flags, speakdelay, joinmessage, delaymessage, moderators FROM channels_rights");
|
{
|
||||||
if (!result)
|
uint32 oldMSTime = getMSTime();
|
||||||
{
|
channels_rights.clear();
|
||||||
sLog->outString();
|
|
||||||
sLog->outString(">> Loaded 0 Channel Rights!");
|
QueryResult result = CharacterDatabase.Query("SELECT name, flags, speakdelay, joinmessage, delaymessage, moderators FROM channels_rights");
|
||||||
return;
|
if (!result)
|
||||||
}
|
{
|
||||||
|
sLog->outString();
|
||||||
uint32 count = 0;
|
sLog->outString(">> Loaded 0 Channel Rights!");
|
||||||
do
|
return;
|
||||||
{
|
}
|
||||||
Field* fields = result->Fetch();
|
|
||||||
std::set<uint32> moderators;
|
uint32 count = 0;
|
||||||
const char* moderatorList = fields[5].GetCString();
|
do
|
||||||
if (moderatorList)
|
{
|
||||||
{
|
Field* fields = result->Fetch();
|
||||||
Tokenizer tokens(moderatorList, ' ');
|
std::set<uint32> moderators;
|
||||||
for (Tokenizer::const_iterator i = tokens.begin(); i != tokens.end(); ++i)
|
const char* moderatorList = fields[5].GetCString();
|
||||||
{
|
if (moderatorList)
|
||||||
uint64 moderator_acc = atol(*i);
|
{
|
||||||
if (moderator_acc && ((uint32)moderator_acc) == moderator_acc)
|
Tokenizer tokens(moderatorList, ' ');
|
||||||
moderators.insert((uint32)moderator_acc);
|
for (Tokenizer::const_iterator i = tokens.begin(); i != tokens.end(); ++i)
|
||||||
}
|
{
|
||||||
}
|
uint64 moderator_acc = atol(*i);
|
||||||
|
if (moderator_acc && ((uint32)moderator_acc) == moderator_acc)
|
||||||
SetChannelRightsFor(fields[0].GetString(), fields[1].GetUInt32(), fields[2].GetUInt32(), fields[3].GetString(), fields[4].GetString(), moderators);
|
moderators.insert((uint32)moderator_acc);
|
||||||
|
}
|
||||||
++count;
|
}
|
||||||
} while (result->NextRow());
|
|
||||||
|
SetChannelRightsFor(fields[0].GetString(), fields[1].GetUInt32(), fields[2].GetUInt32(), fields[3].GetString(), fields[4].GetString(), moderators);
|
||||||
sLog->outString(">> Loaded %d Channel Rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
|
||||||
sLog->outString();
|
++count;
|
||||||
}
|
} while (result->NextRow());
|
||||||
|
|
||||||
const ChannelRights& ChannelMgr::GetChannelRightsFor(const std::string& name)
|
sLog->outString(">> Loaded %d Channel Rights in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||||
{
|
sLog->outString();
|
||||||
std::string nameStr = name;
|
}
|
||||||
std::transform(nameStr.begin(), nameStr.end(), nameStr.begin(), ::tolower);
|
|
||||||
ChannelRightsMap::const_iterator itr = channels_rights.find(nameStr);
|
const ChannelRights& ChannelMgr::GetChannelRightsFor(const std::string& name)
|
||||||
if (itr != channels_rights.end())
|
{
|
||||||
return itr->second;
|
std::string nameStr = name;
|
||||||
return channelRightsEmpty;
|
std::transform(nameStr.begin(), nameStr.end(), nameStr.begin(), ::tolower);
|
||||||
}
|
ChannelRightsMap::const_iterator itr = channels_rights.find(nameStr);
|
||||||
|
if (itr != channels_rights.end())
|
||||||
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)
|
return itr->second;
|
||||||
{
|
return channelRightsEmpty;
|
||||||
std::string nameStr = name;
|
}
|
||||||
std::transform(nameStr.begin(), nameStr.end(), nameStr.begin(), ::tolower);
|
|
||||||
channels_rights[nameStr] = ChannelRights(flags, speakDelay, joinmessage, speakmessage, moderators);
|
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;
|
||||||
void ChannelMgr::MakeNotOnPacket(WorldPacket* data, std::string const& name)
|
std::transform(nameStr.begin(), nameStr.end(), nameStr.begin(), ::tolower);
|
||||||
{
|
channels_rights[nameStr] = ChannelRights(flags, speakDelay, joinmessage, speakmessage, moderators);
|
||||||
data->Initialize(SMSG_CHANNEL_NOTIFY, 1 + name.size());
|
}
|
||||||
(*data) << uint8(5) << name;
|
|
||||||
}
|
void ChannelMgr::MakeNotOnPacket(WorldPacket* data, std::string const& name)
|
||||||
|
{
|
||||||
|
data->Initialize(SMSG_CHANNEL_NOTIFY, 1 + name.size());
|
||||||
|
(*data) << uint8(5) << name;
|
||||||
|
}
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1015,8 +1015,6 @@ void Creature::SaveToDB()
|
||||||
|
|
||||||
void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
|
|
||||||
// update in loaded data
|
// update in loaded data
|
||||||
if (!m_DBTableGuid)
|
if (!m_DBTableGuid)
|
||||||
m_DBTableGuid = GetGUIDLow();
|
m_DBTableGuid = GetGUIDLow();
|
||||||
|
|
|
||||||
|
|
@ -813,8 +813,6 @@ void GameObject::SaveToDB()
|
||||||
|
|
||||||
void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
void GameObject::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
|
||||||
{
|
{
|
||||||
return;
|
|
||||||
|
|
||||||
const GameObjectTemplate* goI = GetGOInfo();
|
const GameObjectTemplate* goI = GetGOInfo();
|
||||||
|
|
||||||
if (!goI)
|
if (!goI)
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,7 @@ WorldObject::~WorldObject()
|
||||||
{
|
{
|
||||||
if (GetTypeId() == TYPEID_CORPSE)
|
if (GetTypeId() == TYPEID_CORPSE)
|
||||||
{
|
{
|
||||||
sLog->outCrash("Object::~Object Corpse guid=" UI64FMTD", type=%d, entry=%u deleted but still in map!!", GetGUID(), ((Corpse*)this)->GetType(), GetEntry());
|
sLog->outCrash("Object::~Object Corpse guid="UI64FMTD", type=%d, entry=%u deleted but still in map!!", GetGUID(), ((Corpse*)this)->GetType(), GetEntry());
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
}
|
}
|
||||||
ResetMap();
|
ResetMap();
|
||||||
|
|
@ -104,7 +104,7 @@ Object::~Object()
|
||||||
{
|
{
|
||||||
if (IsInWorld())
|
if (IsInWorld())
|
||||||
{
|
{
|
||||||
sLog->outCrash("Object::~Object - guid=" UI64FMTD", typeid=%d, entry=%u deleted but still in world!!", GetGUID(), GetTypeId(), GetEntry());
|
sLog->outCrash("Object::~Object - guid="UI64FMTD", typeid=%d, entry=%u deleted but still in world!!", GetGUID(), GetTypeId(), GetEntry());
|
||||||
if (isType(TYPEMASK_ITEM))
|
if (isType(TYPEMASK_ITEM))
|
||||||
sLog->outCrash("Item slot %u", ((Item*)this)->GetSlot());
|
sLog->outCrash("Item slot %u", ((Item*)this)->GetSlot());
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
|
|
@ -113,7 +113,7 @@ Object::~Object()
|
||||||
|
|
||||||
if (m_objectUpdated)
|
if (m_objectUpdated)
|
||||||
{
|
{
|
||||||
sLog->outCrash("Object::~Object - guid=" UI64FMTD", typeid=%d, entry=%u deleted but still in update list!!", GetGUID(), GetTypeId(), GetEntry());
|
sLog->outCrash("Object::~Object - guid="UI64FMTD", typeid=%d, entry=%u deleted but still in update list!!", GetGUID(), GetTypeId(), GetEntry());
|
||||||
ASSERT(false);
|
ASSERT(false);
|
||||||
sObjectAccessor->RemoveUpdateObject(this);
|
sObjectAccessor->RemoveUpdateObject(this);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4204,7 +4204,7 @@ void Player::removeSpell(uint32 spellId, uint8 removeSpecMask, bool onlyTemporar
|
||||||
// not reset skills for professions and racial abilities
|
// not reset skills for professions and racial abilities
|
||||||
if ((pSkill->categoryId == SKILL_CATEGORY_SECONDARY || pSkill->categoryId == SKILL_CATEGORY_PROFESSION) && (IsProfessionSkill(pSkill->id) || _spell_idx->second->racemask != 0))
|
if ((pSkill->categoryId == SKILL_CATEGORY_SECONDARY || pSkill->categoryId == SKILL_CATEGORY_PROFESSION) && (IsProfessionSkill(pSkill->id) || _spell_idx->second->racemask != 0))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// pussywizard: this is needed for weapon/armor/language skills to remove them when loosing spell
|
// pussywizard: this is needed for weapon/armor/language skills to remove them when loosing spell
|
||||||
SetSkill(pSkill->id, GetSkillStep(pSkill->id), 0, 0);
|
SetSkill(pSkill->id, GetSkillStep(pSkill->id), 0, 0);
|
||||||
}
|
}
|
||||||
|
|
@ -14584,8 +14584,8 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
|
||||||
break;
|
break;
|
||||||
case GOSSIP_OPTION_VENDOR:
|
case GOSSIP_OPTION_VENDOR:
|
||||||
{
|
{
|
||||||
VendorItemData const* vendorItems = creature->GetVendorItems();
|
VendorItemData const* vendorItems = itr->second.ActionMenuId ? nullptr : creature->GetVendorItems();
|
||||||
if (!vendorItems || vendorItems->Empty())
|
if (!itr->second.ActionMenuId && (!vendorItems || vendorItems->Empty()))
|
||||||
{
|
{
|
||||||
sLog->outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", creature->GetGUIDLow(), creature->GetEntry());
|
sLog->outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", creature->GetGUIDLow(), creature->GetEntry());
|
||||||
canTalk = false;
|
canTalk = false;
|
||||||
|
|
@ -14759,7 +14759,7 @@ void Player::OnGossipSelect(WorldObject* source, uint32 gossipListId, uint32 men
|
||||||
break;
|
break;
|
||||||
case GOSSIP_OPTION_VENDOR:
|
case GOSSIP_OPTION_VENDOR:
|
||||||
case GOSSIP_OPTION_ARMORER:
|
case GOSSIP_OPTION_ARMORER:
|
||||||
GetSession()->SendListInventory(guid);
|
GetSession()->SendListInventory(guid, menuItemData->GossipActionMenuId);
|
||||||
break;
|
break;
|
||||||
case GOSSIP_OPTION_STABLEPET:
|
case GOSSIP_OPTION_STABLEPET:
|
||||||
GetSession()->SendStablePet(guid);
|
GetSession()->SendStablePet(guid);
|
||||||
|
|
@ -20407,7 +20407,7 @@ void Player::TextEmote(const std::string& text)
|
||||||
{
|
{
|
||||||
WorldPacket data;
|
WorldPacket data;
|
||||||
ChatHandler::BuildChatPacket(data, CHAT_MSG_EMOTE, LANG_UNIVERSAL, this, this, text);
|
ChatHandler::BuildChatPacket(data, CHAT_MSG_EMOTE, LANG_UNIVERSAL, this, this, text);
|
||||||
SendMessageToSetInRange_OwnTeam(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), true);
|
SendMessageToSetInRange(&data, sWorld->getFloatConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE), true, !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::Whisper(const std::string& text, uint32 language, uint64 receiver)
|
void Player::Whisper(const std::string& text, uint32 language, uint64 receiver)
|
||||||
|
|
@ -20514,7 +20514,7 @@ void Player::PossessSpellInitialize()
|
||||||
|
|
||||||
if (!charmInfo)
|
if (!charmInfo)
|
||||||
{
|
{
|
||||||
sLog->outError("Player::PossessSpellInitialize(): charm (" UI64FMTD") has no charminfo!", charm->GetGUID());
|
sLog->outError("Player::PossessSpellInitialize(): charm ("UI64FMTD") has no charminfo!", charm->GetGUID());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -20604,7 +20604,7 @@ void Player::CharmSpellInitialize()
|
||||||
CharmInfo* charmInfo = charm->GetCharmInfo();
|
CharmInfo* charmInfo = charm->GetCharmInfo();
|
||||||
if (!charmInfo)
|
if (!charmInfo)
|
||||||
{
|
{
|
||||||
sLog->outError("Player::CharmSpellInitialize(): the player's charm (" UI64FMTD") has no charminfo!", charm->GetGUID());
|
sLog->outError("Player::CharmSpellInitialize(): the player's charm ("UI64FMTD") has no charminfo!", charm->GetGUID());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -21533,8 +21533,9 @@ bool Player::BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
VendorItemData const* vItems = creature->GetVendorItems();
|
|
||||||
if (!vItems || vItems->Empty())
|
VendorItemData const* vItems = GetSession()->GetCurrentVendor() ? sObjectMgr->GetNpcVendorItemList(GetSession()->GetCurrentVendor()) : creature->GetVendorItems();
|
||||||
|
if (!vItems || vItems->Empty())
|
||||||
{
|
{
|
||||||
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0);
|
SendBuyError(BUY_ERR_CANT_FIND_ITEM, creature, item, 0);
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -25555,7 +25556,7 @@ void Player::SetEquipmentSet(uint32 index, EquipmentSet eqset)
|
||||||
|
|
||||||
if (!found) // something wrong...
|
if (!found) // something wrong...
|
||||||
{
|
{
|
||||||
sLog->outError("Player %s tried to save equipment set " UI64FMTD" (index %u), but that equipment set not found!", GetName().c_str(), eqset.Guid, index);
|
sLog->outError("Player %s tried to save equipment set "UI64FMTD" (index %u), but that equipment set not found!", GetName().c_str(), eqset.Guid, index);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -222,6 +222,7 @@ void SocialMgr::GetFriendInfo(Player* player, uint32 friendGUID, FriendInfo &fri
|
||||||
|
|
||||||
TeamId teamId = player->GetTeamId();
|
TeamId teamId = player->GetTeamId();
|
||||||
AccountTypes security = player->GetSession()->GetSecurity();
|
AccountTypes security = player->GetSession()->GetSecurity();
|
||||||
|
bool allowTwoSideWhoList = sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST);
|
||||||
AccountTypes gmLevelInWhoList = AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST));
|
AccountTypes gmLevelInWhoList = AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST));
|
||||||
|
|
||||||
PlayerSocialMap::iterator itr = player->GetSocial()->m_playerSocialMap.find(friendGUID);
|
PlayerSocialMap::iterator itr = player->GetSocial()->m_playerSocialMap.find(friendGUID);
|
||||||
|
|
@ -230,7 +231,7 @@ void SocialMgr::GetFriendInfo(Player* player, uint32 friendGUID, FriendInfo &fri
|
||||||
|
|
||||||
// PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
|
// PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
|
||||||
// MODERATOR, GAME MASTER, ADMINISTRATOR can see all
|
// MODERATOR, GAME MASTER, ADMINISTRATOR can see all
|
||||||
if (pFriend && (!AccountMgr::IsPlayerAccount(security) || (pFriend->GetTeamId() == teamId && pFriend->GetSession()->GetSecurity() <= gmLevelInWhoList)) && pFriend->IsVisibleGloballyFor(player))
|
if (pFriend && (!AccountMgr::IsPlayerAccount(security) || ((pFriend->GetTeamId() == teamId || allowTwoSideWhoList) && pFriend->GetSession()->GetSecurity() <= gmLevelInWhoList)) && pFriend->IsVisibleGloballyFor(player))
|
||||||
{
|
{
|
||||||
friendInfo.Status = FRIEND_STATUS_ONLINE;
|
friendInfo.Status = FRIEND_STATUS_ONLINE;
|
||||||
if (pFriend->isAFK())
|
if (pFriend->isAFK())
|
||||||
|
|
@ -293,7 +294,8 @@ void SocialMgr::BroadcastToFriendListers(Player* player, WorldPacket* packet)
|
||||||
|
|
||||||
TeamId teamId = player->GetTeamId();
|
TeamId teamId = player->GetTeamId();
|
||||||
AccountTypes security = player->GetSession()->GetSecurity();
|
AccountTypes security = player->GetSession()->GetSecurity();
|
||||||
uint32 guid = player->GetGUIDLow();
|
uint32 guid = player->GetGUIDLow();
|
||||||
|
bool allowTwoSideWhoList = sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST);
|
||||||
AccountTypes gmLevelInWhoList = AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST));
|
AccountTypes gmLevelInWhoList = AccountTypes(sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST));
|
||||||
|
|
||||||
for (SocialMap::const_iterator itr = m_socialMap.begin(); itr != m_socialMap.end(); ++itr)
|
for (SocialMap::const_iterator itr = m_socialMap.begin(); itr != m_socialMap.end(); ++itr)
|
||||||
|
|
@ -305,7 +307,7 @@ void SocialMgr::BroadcastToFriendListers(Player* player, WorldPacket* packet)
|
||||||
|
|
||||||
// PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
|
// PLAYER see his team only and PLAYER can't see MODERATOR, GAME MASTER, ADMINISTRATOR characters
|
||||||
// MODERATOR, GAME MASTER, ADMINISTRATOR can see all
|
// MODERATOR, GAME MASTER, ADMINISTRATOR can see all
|
||||||
if (pFriend && (!AccountMgr::IsPlayerAccount(pFriend->GetSession()->GetSecurity()) || (pFriend->GetTeamId() == teamId && security <= gmLevelInWhoList)) && player->IsVisibleGloballyFor(pFriend))
|
if (pFriend && (!AccountMgr::IsPlayerAccount(pFriend->GetSession()->GetSecurity()) || ((pFriend->GetTeamId() == teamId || allowTwoSideWhoList) && security <= gmLevelInWhoList)) && player->IsVisibleGloballyFor(pFriend))
|
||||||
pFriend->GetSession()->SendPacket(packet);
|
pFriend->GetSession()->SendPacket(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10587,6 +10587,10 @@ uint32 Unit::SpellDamageBonusDone(Unit* victim, SpellInfo const* spellProto, uin
|
||||||
float ApCoeffMod = 1.0f;
|
float ApCoeffMod = 1.0f;
|
||||||
int32 DoneTotal = 0;
|
int32 DoneTotal = 0;
|
||||||
float DoneTotalMod = TotalMod ? TotalMod : SpellPctDamageModsDone(victim, spellProto, damagetype);
|
float DoneTotalMod = TotalMod ? TotalMod : SpellPctDamageModsDone(victim, spellProto, damagetype);
|
||||||
|
|
||||||
|
// Config : RATE_CREATURE_X_SPELLDAMAGE & Do Not Modify Pet/Guardian/Mind Controled Damage
|
||||||
|
if (GetTypeId() == TYPEID_UNIT && (!ToCreature()->IsPet() || !ToCreature()->IsGuardian() || !ToCreature()->IsControlledByPlayer()))
|
||||||
|
DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank);
|
||||||
|
|
||||||
// Some spells don't benefit from pct done mods
|
// Some spells don't benefit from pct done mods
|
||||||
if (!spellProto->HasAttribute(SPELL_ATTR6_LIMIT_PCT_DAMAGE_MODS))
|
if (!spellProto->HasAttribute(SPELL_ATTR6_LIMIT_PCT_DAMAGE_MODS))
|
||||||
|
|
@ -17062,7 +17066,7 @@ void Unit::RemoveCharmedBy(Unit* charmer)
|
||||||
if (GetCharmInfo())
|
if (GetCharmInfo())
|
||||||
GetCharmInfo()->SetPetNumber(0, true);
|
GetCharmInfo()->SetPetNumber(0, true);
|
||||||
else
|
else
|
||||||
sLog->outError("Aura::HandleModCharm: target=" UI64FMTD" with typeid=%d has a charm aura but no charm info!", GetGUID(), GetTypeId());
|
sLog->outError("Aura::HandleModCharm: target="UI64FMTD" with typeid=%d has a charm aura but no charm info!", GetGUID(), GetTypeId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -18472,8 +18476,8 @@ void Unit::StopAttackFaction(uint32 faction_id)
|
||||||
void Unit::OutDebugInfo() const
|
void Unit::OutDebugInfo() const
|
||||||
{
|
{
|
||||||
sLog->outError("Unit::OutDebugInfo");
|
sLog->outError("Unit::OutDebugInfo");
|
||||||
sLog->outString("GUID " UI64FMTD", entry %u, type %u, name %s", GetGUID(), GetEntry(), (uint32)GetTypeId(), GetName().c_str());
|
sLog->outString("GUID "UI64FMTD", entry %u, type %u, name %s", GetGUID(), GetEntry(), (uint32)GetTypeId(), GetName().c_str());
|
||||||
sLog->outString("OwnerGUID " UI64FMTD", MinionGUID " UI64FMTD", CharmerGUID " UI64FMTD", CharmedGUID " UI64FMTD, GetOwnerGUID(), GetMinionGUID(), GetCharmerGUID(), GetCharmGUID());
|
sLog->outString("OwnerGUID "UI64FMTD", MinionGUID "UI64FMTD", CharmerGUID "UI64FMTD", CharmedGUID "UI64FMTD, GetOwnerGUID(), GetMinionGUID(), GetCharmerGUID(), GetCharmGUID());
|
||||||
sLog->outString("In world %u, unit type mask %u", (uint32)(IsInWorld() ? 1 : 0), m_unitTypeMask);
|
sLog->outString("In world %u, unit type mask %u", (uint32)(IsInWorld() ? 1 : 0), m_unitTypeMask);
|
||||||
if (IsInWorld())
|
if (IsInWorld())
|
||||||
sLog->outString("Mapid %u", GetMapId());
|
sLog->outString("Mapid %u", GetMapId());
|
||||||
|
|
@ -19190,21 +19194,36 @@ void Unit::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target)
|
||||||
// FG: pretend that OTHER players in own group are friendly ("blue")
|
// FG: pretend that OTHER players in own group are friendly ("blue")
|
||||||
else if (index == UNIT_FIELD_BYTES_2 || index == UNIT_FIELD_FACTIONTEMPLATE)
|
else if (index == UNIT_FIELD_BYTES_2 || index == UNIT_FIELD_FACTIONTEMPLATE)
|
||||||
{
|
{
|
||||||
if (target->IsSpectator() && target->FindMap() && target->FindMap()->IsBattleArena() && (this->GetTypeId() == TYPEID_PLAYER || this->GetTypeId() == TYPEID_UNIT || this->GetTypeId() == TYPEID_DYNAMICOBJECT)) // pussywizard
|
if (IsControlledByPlayer() && target != this && sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && IsInRaidWith(target))
|
||||||
|
{
|
||||||
|
FactionTemplateEntry const* ft1 = GetFactionTemplateEntry();
|
||||||
|
FactionTemplateEntry const* ft2 = target->GetFactionTemplateEntry();
|
||||||
|
if (ft1 && ft2 && !ft1->IsFriendlyTo(*ft2))
|
||||||
|
{
|
||||||
|
if (index == UNIT_FIELD_BYTES_2)
|
||||||
|
// Allow targetting opposite faction in party when enabled in config
|
||||||
|
fieldBuffer << (m_uint32Values[UNIT_FIELD_BYTES_2] & ((UNIT_BYTE2_FLAG_SANCTUARY /*| UNIT_BYTE2_FLAG_AURAS | UNIT_BYTE2_FLAG_UNK5*/) << 8)); // this flag is at uint8 offset 1 !!
|
||||||
|
else
|
||||||
|
// pretend that all other HOSTILE players have own faction, to allow follow, heal, rezz (trade wont work)
|
||||||
|
fieldBuffer << uint32(target->getFaction());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
fieldBuffer << m_uint32Values[index];
|
||||||
|
}// pussywizard / Callmephil
|
||||||
|
else if (target->IsSpectator() && target->FindMap() && target->FindMap()->IsBattleArena() &&
|
||||||
|
(this->GetTypeId() == TYPEID_PLAYER || this->GetTypeId() == TYPEID_UNIT || this->GetTypeId() == TYPEID_DYNAMICOBJECT))
|
||||||
{
|
{
|
||||||
if (index == UNIT_FIELD_BYTES_2)
|
if (index == UNIT_FIELD_BYTES_2)
|
||||||
fieldBuffer << (m_uint32Values[index] & 0xFFFFF2FF); // clear UNIT_BYTE2_FLAG_PVP, UNIT_BYTE2_FLAG_FFA_PVP, UNIT_BYTE2_FLAG_SANCTUARY
|
fieldBuffer << (m_uint32Values[index] & 0xFFFFF2FF); // clear UNIT_BYTE2_FLAG_PVP, UNIT_BYTE2_FLAG_FFA_PVP, UNIT_BYTE2_FLAG_SANCTUARY
|
||||||
else
|
else
|
||||||
fieldBuffer << (uint32)target->getFaction();
|
fieldBuffer << (uint32)target->getFaction();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
fieldBuffer << m_uint32Values[index];
|
fieldBuffer << m_uint32Values[index];
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
|
||||||
// send in current format (float as float, uint32 as uint32)
|
// send in current format (float as float, uint32 as uint32)
|
||||||
fieldBuffer << m_uint32Values[index];
|
fieldBuffer << m_uint32Values[index];
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -8540,8 +8540,9 @@ bool ObjectMgr::RemoveVendorItem(uint32 entry, uint32 item, bool persist /*= tru
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* player, std::set<uint32>* skip_vendors, uint32 ORnpcflag) const
|
bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 maxcount, uint32 incrtime, uint32 ExtendedCost, Player* player, std::set<uint32>* /*skip_vendors*/, uint32 /*ORnpcflag*/) const
|
||||||
{
|
{
|
||||||
|
/*
|
||||||
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(vendor_entry);
|
CreatureTemplate const* cInfo = sObjectMgr->GetCreatureTemplate(vendor_entry);
|
||||||
if (!cInfo)
|
if (!cInfo)
|
||||||
{
|
{
|
||||||
|
|
@ -8566,6 +8567,7 @@ bool ObjectMgr::IsVendorItemValid(uint32 vendor_entry, uint32 item_id, int32 max
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
if (!sObjectMgr->GetItemTemplate(item_id))
|
if (!sObjectMgr->GetItemTemplate(item_id))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1504,11 +1504,12 @@ void Guild::HandleInviteMember(WorldSession* session, std::string const& name)
|
||||||
if (pInvitee->GetSocial()->HasIgnore(player->GetGUIDLow()))
|
if (pInvitee->GetSocial()->HasIgnore(player->GetGUIDLow()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (pInvitee->GetTeamId() != player->GetTeamId())
|
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && pInvitee->GetTeamId() != player->GetTeamId())
|
||||||
{
|
{
|
||||||
SendCommandResult(session, GUILD_COMMAND_INVITE, ERR_GUILD_NOT_ALLIED, name);
|
SendCommandResult(session, GUILD_COMMAND_INVITE, ERR_GUILD_NOT_ALLIED, name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Invited player cannot be in another guild
|
// Invited player cannot be in another guild
|
||||||
if (pInvitee->GetGuildId())
|
if (pInvitee->GetGuildId())
|
||||||
{
|
{
|
||||||
|
|
@ -1545,7 +1546,8 @@ void Guild::HandleInviteMember(WorldSession* session, std::string const& name)
|
||||||
void Guild::HandleAcceptMember(WorldSession* session)
|
void Guild::HandleAcceptMember(WorldSession* session)
|
||||||
{
|
{
|
||||||
Player* player = session->GetPlayer();
|
Player* player = session->GetPlayer();
|
||||||
if (player->GetTeamId() != sObjectMgr->GetPlayerTeamIdByGUID(GetLeaderGUID()))
|
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) &&
|
||||||
|
player->GetTeamId() != sObjectMgr->GetPlayerTeamIdByGUID(GetLeaderGUID()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AddMember(player->GetGUID());
|
AddMember(player->GetGUID());
|
||||||
|
|
@ -1729,7 +1731,7 @@ void Guild::HandleMemberDepositMoney(WorldSession* session, uint32 amount)
|
||||||
_BroadcastEvent(GE_BANK_MONEY_SET, 0, aux.c_str());
|
_BroadcastEvent(GE_BANK_MONEY_SET, 0, aux.c_str());
|
||||||
|
|
||||||
if (amount > 10*GOLD)
|
if (amount > 10*GOLD)
|
||||||
CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"<GB DEPOSIT> %s (guild id: %u, members: %u, new amount: " UI64FMTD", leader guid low: %u, char level: %u)\", NOW())", session->GetAccountId(), player->GetGUIDLow(), player->GetName().c_str(), session->GetRemoteAddress().c_str(), 0, "", amount, GetName().c_str(), GetId(), GetMemberCount(), GetTotalBankMoney(), (uint32)(GetLeaderGUID()&0xFFFFFFFF), player->getLevel());
|
CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"<GB DEPOSIT> %s (guild id: %u, members: %u, new amount: "UI64FMTD", leader guid low: %u, char level: %u)\", NOW())", session->GetAccountId(), player->GetGUIDLow(), player->GetName().c_str(), session->GetRemoteAddress().c_str(), 0, "", amount, GetName().c_str(), GetId(), GetMemberCount(), GetTotalBankMoney(), (uint32)(GetLeaderGUID()&0xFFFFFFFF), player->getLevel());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool repair)
|
bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool repair)
|
||||||
|
|
@ -1772,7 +1774,7 @@ bool Guild::HandleMemberWithdrawMoney(WorldSession* session, uint32 amount, bool
|
||||||
CharacterDatabase.CommitTransaction(trans);
|
CharacterDatabase.CommitTransaction(trans);
|
||||||
|
|
||||||
if (amount > 10*GOLD)
|
if (amount > 10*GOLD)
|
||||||
CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"<GB WITHDRAW> %s (guild id: %u, members: %u, new amount: " UI64FMTD", leader guid low: %u, char level: %u)\", NOW())", session->GetAccountId(), player->GetGUIDLow(), player->GetName().c_str(), session->GetRemoteAddress().c_str(), 0, "", amount, GetName().c_str(), GetId(), GetMemberCount(), GetTotalBankMoney(), (uint32)(GetLeaderGUID()&0xFFFFFFFF), player->getLevel());
|
CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"<GB WITHDRAW> %s (guild id: %u, members: %u, new amount: "UI64FMTD", leader guid low: %u, char level: %u)\", NOW())", session->GetAccountId(), player->GetGUIDLow(), player->GetName().c_str(), session->GetRemoteAddress().c_str(), 0, "", amount, GetName().c_str(), GetId(), GetMemberCount(), GetTotalBankMoney(), (uint32)(GetLeaderGUID()&0xFFFFFFFF), player->getLevel());
|
||||||
|
|
||||||
std::string aux = ByteArrayToHexStr(reinterpret_cast<uint8*>(&m_bankMoney), 8, true);
|
std::string aux = ByteArrayToHexStr(reinterpret_cast<uint8*>(&m_bankMoney), 8, true);
|
||||||
_BroadcastEvent(GE_BANK_MONEY_SET, 0, aux.c_str());
|
_BroadcastEvent(GE_BANK_MONEY_SET, 0, aux.c_str());
|
||||||
|
|
@ -1845,8 +1847,6 @@ void Guild::SendBankTabData(WorldSession* session, uint8 tabId) const
|
||||||
|
|
||||||
void Guild::SendBankTabsInfo(WorldSession* session, bool sendAllSlots /*= false*/) const
|
void Guild::SendBankTabsInfo(WorldSession* session, bool sendAllSlots /*= false*/) const
|
||||||
{
|
{
|
||||||
if (session->GetSecurity())
|
|
||||||
return;
|
|
||||||
_SendBankList(session, 0, sendAllSlots);
|
_SendBankList(session, 0, sendAllSlots);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -123,11 +123,11 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket & recvData)
|
||||||
if (player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
|
if (player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (player->GetTeamId() != GetPlayer()->GetTeamId())
|
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && player->GetTeamId() != GetPlayer()->GetTeamId())
|
||||||
{
|
{
|
||||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
|
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (player->GetArenaTeamId(arenaTeam->GetSlot()))
|
if (player->GetArenaTeamId(arenaTeam->GetSlot()))
|
||||||
{
|
{
|
||||||
|
|
@ -174,12 +174,12 @@ void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket & /*recvData*/)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Only allow members of the other faction to join the team if cross faction interaction is enabled
|
// Only allow members of the other faction to join the team if cross faction interaction is enabled
|
||||||
if (_player->GetTeamId() != sObjectMgr->GetPlayerTeamIdByGUID(arenaTeam->GetCaptain()))
|
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && _player->GetTeamId() != sObjectMgr->GetPlayerTeamIdByGUID(arenaTeam->GetCaptain()))
|
||||||
{
|
{
|
||||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
|
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add player to team
|
// Add player to team
|
||||||
if (!arenaTeam->AddMember(_player->GetGUID()))
|
if (!arenaTeam->AddMember(_player->GetGUID()))
|
||||||
|
|
|
||||||
|
|
@ -265,7 +265,11 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recvData)
|
||||||
|
|
||||||
AuctionEntry* AH = new AuctionEntry;
|
AuctionEntry* AH = new AuctionEntry;
|
||||||
AH->Id = sObjectMgr->GenerateAuctionID();
|
AH->Id = sObjectMgr->GenerateAuctionID();
|
||||||
AH->auctioneer = GUID_LOPART(auctioneer);
|
|
||||||
|
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
|
||||||
|
AH->auctioneer = 23442;
|
||||||
|
else
|
||||||
|
AH->auctioneer = GUID_LOPART(auctioneer);
|
||||||
|
|
||||||
// Required stack size of auction matches to current item stack size, just move item to auctionhouse
|
// Required stack size of auction matches to current item stack size, just move item to auctionhouse
|
||||||
if (itemsCount == 1 && item->GetCount() == count[i])
|
if (itemsCount == 1 && item->GetCount() == count[i])
|
||||||
|
|
|
||||||
|
|
@ -462,7 +462,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_player->GetTeamId() != inviteeTeamId /*&& !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CALENDAR)*/)
|
if (_player->GetTeamId() != inviteeTeamId && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CALENDAR))
|
||||||
{
|
{
|
||||||
sCalendarMgr->SendCalendarCommandResult(playerGuid, CALENDAR_ERROR_NOT_ALLIED);
|
sCalendarMgr->SendCalendarCommandResult(playerGuid, CALENDAR_ERROR_NOT_ALLIED);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -468,7 +468,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || true/*sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS)*/ || !AccountMgr::IsPlayerAccount(GetSecurity());
|
bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || !AccountMgr::IsPlayerAccount(GetSecurity());
|
||||||
uint32 skipCinematics = sWorld->getIntConfig(CONFIG_SKIP_CINEMATICS);
|
uint32 skipCinematics = sWorld->getIntConfig(CONFIG_SKIP_CINEMATICS);
|
||||||
|
|
||||||
_charCreateCallback.FreeResult();
|
_charCreateCallback.FreeResult();
|
||||||
|
|
@ -492,7 +492,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
|
||||||
bool haveSameRace = false;
|
bool haveSameRace = false;
|
||||||
uint32 heroicReqLevel = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_HEROIC_CHARACTER);
|
uint32 heroicReqLevel = sWorld->getIntConfig(CONFIG_CHARACTER_CREATING_MIN_LEVEL_FOR_HEROIC_CHARACTER);
|
||||||
bool hasHeroicReqLevel = (heroicReqLevel == 0);
|
bool hasHeroicReqLevel = (heroicReqLevel == 0);
|
||||||
bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || true/*sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS)*/ || !AccountMgr::IsPlayerAccount(GetSecurity());
|
bool allowTwoSideAccounts = !sWorld->IsPvPRealm() || sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || !AccountMgr::IsPlayerAccount(GetSecurity());
|
||||||
uint32 skipCinematics = sWorld->getIntConfig(CONFIG_SKIP_CINEMATICS);
|
uint32 skipCinematics = sWorld->getIntConfig(CONFIG_SKIP_CINEMATICS);
|
||||||
|
|
||||||
if (result)
|
if (result)
|
||||||
|
|
@ -2327,18 +2327,24 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset guild
|
// Reset guild
|
||||||
if (uint32 guildId = playerData->guildId)
|
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD))
|
||||||
if (Guild* guild = sGuildMgr->GetGuildById(guildId))
|
{
|
||||||
guild->DeleteMember(MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER), false, false, true);
|
if (uint32 guildId = playerData->guildId)
|
||||||
|
if (Guild* guild = sGuildMgr->GetGuildById(guildId))
|
||||||
|
guild->DeleteMember(MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER), false, false, true);
|
||||||
|
}
|
||||||
|
|
||||||
// Delete Friend List
|
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND))
|
||||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_GUID);
|
{
|
||||||
stmt->setUInt32(0, lowGuid);
|
// Delete Friend List
|
||||||
trans->Append(stmt);
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_GUID);
|
||||||
|
stmt->setUInt32(0, lowGuid);
|
||||||
|
trans->Append(stmt);
|
||||||
|
|
||||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_FRIEND);
|
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_SOCIAL_BY_FRIEND);
|
||||||
stmt->setUInt32(0, lowGuid);
|
stmt->setUInt32(0, lowGuid);
|
||||||
trans->Append(stmt);
|
trans->Append(stmt);
|
||||||
|
}
|
||||||
|
|
||||||
// Leave Arena Teams
|
// Leave Arena Teams
|
||||||
Player::LeaveAllArenaTeams(guid);
|
Player::LeaveAllArenaTeams(guid);
|
||||||
|
|
|
||||||
|
|
@ -165,25 +165,38 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData)
|
||||||
lang = LANG_UNIVERSAL;
|
lang = LANG_UNIVERSAL;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
switch (type)
|
// send in universal language in two side iteration allowed mode
|
||||||
{
|
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT))
|
||||||
case CHAT_MSG_PARTY:
|
lang = LANG_UNIVERSAL;
|
||||||
case CHAT_MSG_PARTY_LEADER:
|
else
|
||||||
case CHAT_MSG_RAID:
|
{
|
||||||
case CHAT_MSG_RAID_LEADER:
|
switch (type)
|
||||||
case CHAT_MSG_RAID_WARNING:
|
{
|
||||||
specialMessageLimit = 35;
|
case CHAT_MSG_PARTY:
|
||||||
break;
|
case CHAT_MSG_PARTY_LEADER:
|
||||||
case CHAT_MSG_GUILD:
|
case CHAT_MSG_RAID:
|
||||||
case CHAT_MSG_OFFICER:
|
case CHAT_MSG_RAID_LEADER:
|
||||||
specialMessageLimit = 15;
|
case CHAT_MSG_RAID_WARNING:
|
||||||
break;
|
// allow two side chat at group channel if two side group allowed
|
||||||
case CHAT_MSG_WHISPER:
|
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP))
|
||||||
if (sender->getLevel() >= 80)
|
lang = LANG_UNIVERSAL;
|
||||||
specialMessageLimit = 15;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
specialMessageLimit = 35;
|
||||||
|
break;
|
||||||
|
case CHAT_MSG_GUILD:
|
||||||
|
case CHAT_MSG_OFFICER:
|
||||||
|
// allow two side chat at guild channel if two side guild allowed
|
||||||
|
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD))
|
||||||
|
lang = LANG_UNIVERSAL;
|
||||||
|
|
||||||
|
specialMessageLimit = 15;
|
||||||
|
break;
|
||||||
|
case CHAT_MSG_WHISPER:
|
||||||
|
if (sender->getLevel() >= 80)
|
||||||
|
specialMessageLimit = 15;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
// but overwrite it by SPELL_AURA_MOD_LANGUAGE auras (only single case used)
|
// but overwrite it by SPELL_AURA_MOD_LANGUAGE auras (only single case used)
|
||||||
Unit::AuraEffectList const& ModLangAuras = sender->GetAuraEffectsByType(SPELL_AURA_MOD_LANGUAGE);
|
Unit::AuraEffectList const& ModLangAuras = sender->GetAuraEffectsByType(SPELL_AURA_MOD_LANGUAGE);
|
||||||
if (!ModLangAuras.empty())
|
if (!ModLangAuras.empty())
|
||||||
|
|
@ -335,7 +348,7 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recvData)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (senderIsPlayer && receiverIsPlayer)
|
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) && senderIsPlayer && receiverIsPlayer)
|
||||||
if (GetPlayer()->GetTeamId() != receiver->GetTeamId())
|
if (GetPlayer()->GetTeamId() != receiver->GetTeamId())
|
||||||
{
|
{
|
||||||
SendWrongFactionNotice();
|
SendWrongFactionNotice();
|
||||||
|
|
|
||||||
|
|
@ -97,7 +97,7 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData)
|
||||||
}
|
}
|
||||||
|
|
||||||
// can't group with
|
// can't group with
|
||||||
if (!GetPlayer()->IsGameMaster() && GetPlayer()->GetTeamId() != player->GetTeamId())
|
if (!GetPlayer()->IsGameMaster() && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && GetPlayer()->GetTeamId() != player->GetTeamId())
|
||||||
{
|
{
|
||||||
SendPartyResult(PARTY_OP_INVITE, membername, ERR_PLAYER_WRONG_FACTION);
|
SendPartyResult(PARTY_OP_INVITE, membername, ERR_PLAYER_WRONG_FACTION);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -724,7 +724,7 @@ void WorldSession::HandleListInventoryOpcode(WorldPacket & recvData)
|
||||||
SendListInventory(guid);
|
SendListInventory(guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::SendListInventory(uint64 vendorGuid)
|
void WorldSession::SendListInventory(uint64 vendorGuid, uint32 vendorEntry)
|
||||||
{
|
{
|
||||||
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_LIST_INVENTORY");
|
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Sent SMSG_LIST_INVENTORY");
|
||||||
|
|
||||||
|
|
@ -744,7 +744,9 @@ void WorldSession::SendListInventory(uint64 vendorGuid)
|
||||||
if (vendor->HasUnitState(UNIT_STATE_MOVING))
|
if (vendor->HasUnitState(UNIT_STATE_MOVING))
|
||||||
vendor->StopMoving();
|
vendor->StopMoving();
|
||||||
|
|
||||||
VendorItemData const* items = vendor->GetVendorItems();
|
SetCurrentVendor(vendorEntry);
|
||||||
|
|
||||||
|
VendorItemData const* items = vendorEntry ? sObjectMgr->GetNpcVendorItemList(vendorEntry) : vendor->GetVendorItems();
|
||||||
if (!items)
|
if (!items)
|
||||||
{
|
{
|
||||||
WorldPacket data(SMSG_LIST_INVENTORY, 8 + 1 + 1);
|
WorldPacket data(SMSG_LIST_INVENTORY, 8 + 1 + 1);
|
||||||
|
|
|
||||||
|
|
@ -189,7 +189,7 @@ void WorldSession::HandleSendMail(WorldPacket & recvData)
|
||||||
? receive->GetSession()->GetAccountId()
|
? receive->GetSession()->GetAccountId()
|
||||||
: sObjectMgr->GetPlayerAccountIdByGUID(rc);
|
: sObjectMgr->GetPlayerAccountIdByGUID(rc);
|
||||||
|
|
||||||
if (/*!accountBound*/ GetAccountId() != rc_account && player->GetTeamId() != rc_teamId && AccountMgr::IsPlayerAccount(GetSecurity()))
|
if (/*!accountBound*/ GetAccountId() != rc_account && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL) && player->GetTeamId() != rc_teamId && AccountMgr::IsPlayerAccount(GetSecurity()))
|
||||||
{
|
{
|
||||||
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_YOUR_TEAM);
|
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_NOT_YOUR_TEAM);
|
||||||
return;
|
return;
|
||||||
|
|
|
||||||
|
|
@ -170,193 +170,205 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleWhoOpcode(WorldPacket & recv_data)
|
|
||||||
|
void WorldSession::HandleWhoOpcode(WorldPacket& recvData)
|
||||||
{
|
{
|
||||||
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_WHO Message");
|
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_WHO Message");
|
||||||
|
|
||||||
time_t now = time(NULL);
|
time_t now = time(NULL);
|
||||||
if (now < timeWhoCommandAllowed)
|
if (now < timeWhoCommandAllowed)
|
||||||
return;
|
return;
|
||||||
timeWhoCommandAllowed = now+3;
|
timeWhoCommandAllowed = now + 3;
|
||||||
|
|
||||||
uint32 matchcount = 0;
|
uint32 matchcount = 0;
|
||||||
|
|
||||||
uint32 level_min, level_max, racemask, classmask, zones_count, str_count;
|
uint32 level_min, level_max, racemask, classmask, zones_count, str_count;
|
||||||
uint32 zoneids[10]; // 10 is client limit
|
uint32 zoneids[10]; // 10 is client limit
|
||||||
std::string player_name, guild_name;
|
std::string player_name, guild_name;
|
||||||
|
|
||||||
recv_data >> level_min; // maximal player level, default 0
|
recvData >> level_min; // maximal player level, default 0
|
||||||
recv_data >> level_max; // minimal player level, default 100 (MAX_LEVEL)
|
recvData >> level_max; // minimal player level, default 100 (MAX_LEVEL)
|
||||||
recv_data >> player_name; // player name, case sensitive...
|
recvData >> player_name; // player name, case sensitive...
|
||||||
|
|
||||||
recv_data >> guild_name; // guild name, case sensitive...
|
recvData >> guild_name; // guild name, case sensitive...
|
||||||
|
|
||||||
recv_data >> racemask; // race mask
|
recvData >> racemask; // race mask
|
||||||
recv_data >> classmask; // class mask
|
recvData >> classmask; // class mask
|
||||||
recv_data >> zones_count; // zones count, client limit = 10 (2.0.10)
|
recvData >> zones_count; // zones count, client limit = 10 (2.0.10)
|
||||||
|
|
||||||
if (zones_count > 10)
|
if (zones_count > 10)
|
||||||
return; // can't be received from real client or broken packet
|
return; // can't be received from real client or broken packet
|
||||||
|
|
||||||
for (uint32 i = 0; i < zones_count; ++i)
|
for (uint32 i = 0; i < zones_count; ++i)
|
||||||
{
|
{
|
||||||
uint32 temp;
|
uint32 temp;
|
||||||
recv_data >> temp; // zone id, 0 if zone is unknown...
|
recvData >> temp; // zone id, 0 if zone is unknown...
|
||||||
zoneids[i] = temp;
|
zoneids[i] = temp;
|
||||||
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "Zone %u: %u", i, zoneids[i]);
|
sLog->outDebug(LOG_FILTER_NETWORKIO, "Zone %u: %u", i, zoneids[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
recv_data >> str_count; // user entered strings count, client limit=4 (checked on 2.0.10)
|
recvData >> str_count; // user entered strings count, client limit=4 (checked on 2.0.10)
|
||||||
|
|
||||||
if (str_count > 4)
|
if (str_count > 4)
|
||||||
return; // can't be received from real client or broken packet
|
return; // can't be received from real client or broken packet
|
||||||
|
|
||||||
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "Minlvl %u, maxlvl %u, name %s, guild %s, racemask %u, classmask %u, zones %u, strings %u", level_min, level_max, player_name.c_str(), guild_name.c_str(), racemask, classmask, zones_count, str_count);
|
sLog->outDebug(LOG_FILTER_NETWORKIO, "Minlvl %u, maxlvl %u, name %s, guild %s, racemask %u, classmask %u, zones %u, strings %u", level_min, level_max, player_name.c_str(), guild_name.c_str(), racemask, classmask, zones_count, str_count);
|
||||||
|
|
||||||
std::wstring str[4]; // 4 is client limit
|
std::wstring str[4]; // 4 is client limit
|
||||||
for (uint32 i = 0; i < str_count; ++i)
|
for (uint32 i = 0; i < str_count; ++i)
|
||||||
{
|
{
|
||||||
std::string temp;
|
std::string temp;
|
||||||
recv_data >> temp; // user entered string, it used as universal search pattern(guild+player name)?
|
recvData >> temp; // user entered string, it used as universal search pattern(guild+player name)?
|
||||||
|
|
||||||
if (!Utf8toWStr(temp, str[i]))
|
if (!Utf8toWStr(temp, str[i]))
|
||||||
continue;
|
|
||||||
|
|
||||||
wstrToLower(str[i]);
|
|
||||||
|
|
||||||
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "String %u: %s", i, temp.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
std::wstring wplayer_name;
|
|
||||||
std::wstring wguild_name;
|
|
||||||
if (!(Utf8toWStr(player_name, wplayer_name) && Utf8toWStr(guild_name, wguild_name)))
|
|
||||||
return;
|
|
||||||
wstrToLower(wplayer_name);
|
|
||||||
wstrToLower(wguild_name);
|
|
||||||
|
|
||||||
// client send in case not set max level value 100 but Trinity supports 255 max level,
|
|
||||||
// update it to show GMs with characters after 100 level
|
|
||||||
if (level_max >= MAX_LEVEL)
|
|
||||||
level_max = STRONG_MAX_LEVEL;
|
|
||||||
|
|
||||||
TeamId teamId = _player->GetTeamId();
|
|
||||||
uint32 security = GetSecurity();
|
|
||||||
uint32 gmLevelInWhoList = sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST);
|
|
||||||
uint32 displaycount = 0;
|
|
||||||
|
|
||||||
WorldPacket data(SMSG_WHO, 500); // guess size
|
|
||||||
data << uint32(matchcount); // placeholder, count of players matching criteria
|
|
||||||
data << uint32(displaycount); // placeholder, count of players displayed
|
|
||||||
|
|
||||||
std::vector<WhoListPlayerInfo> * m = WhoListCacheMgr::GetWhoList();
|
|
||||||
for (std::vector<WhoListPlayerInfo>::const_iterator itr = m->begin(); itr != m->end(); ++itr)
|
|
||||||
{
|
|
||||||
if (AccountMgr::IsPlayerAccount(security))
|
|
||||||
{
|
|
||||||
if ((*itr).teamId != teamId)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// player can see MODERATOR, GAME MASTER, ADMINISTRATOR only if CONFIG_GM_IN_WHO_LIST
|
|
||||||
//if ((*itr).security > AccountTypes(gmLevelInWhoList))
|
|
||||||
// continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
//do not process players which are not in world
|
|
||||||
//if (!(itr->second->IsInWorld()))
|
|
||||||
// continue;
|
|
||||||
|
|
||||||
// check if target is globally visible for player
|
|
||||||
//if (!(itr->second->IsVisibleGloballyFor(_player)))
|
|
||||||
// continue;
|
|
||||||
|
|
||||||
// check if target's level is in level range
|
|
||||||
uint8 lvl = (*itr).level;
|
|
||||||
if (lvl < level_min || lvl > level_max)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// check if class matches classmask
|
|
||||||
uint32 class_ = (*itr).clas;
|
|
||||||
if (!(classmask & (1 << class_)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// check if race matches racemask
|
|
||||||
uint32 race = (*itr).race;
|
|
||||||
if (!(racemask & (1 << race)))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
uint32 pzoneid = (*itr).zoneid;
|
|
||||||
uint8 gender = (*itr).gender;
|
|
||||||
|
|
||||||
bool z_show = true;
|
|
||||||
for (uint32 i = 0; i < zones_count; ++i)
|
|
||||||
{
|
|
||||||
if (zoneids[i] == pzoneid)
|
|
||||||
{
|
|
||||||
z_show = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
z_show = false;
|
|
||||||
}
|
|
||||||
if (!z_show)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
std::wstring wpname = (*itr).wpname;
|
|
||||||
|
|
||||||
if (!(wplayer_name.empty() || wpname.find(wplayer_name) != std::wstring::npos))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
std::wstring wgname = (*itr).wgname;
|
|
||||||
|
|
||||||
if (!(wguild_name.empty() || wgname.find(wguild_name) != std::wstring::npos))
|
|
||||||
continue;
|
|
||||||
|
|
||||||
std::string aname = (*itr).aname;
|
|
||||||
|
|
||||||
bool s_show = true;
|
|
||||||
for (uint32 i = 0; i < str_count; ++i)
|
|
||||||
{
|
|
||||||
if (!str[i].empty())
|
|
||||||
{
|
|
||||||
if (wgname.find(str[i]) != std::wstring::npos ||
|
|
||||||
wpname.find(str[i]) != std::wstring::npos ||
|
|
||||||
Utf8FitTo(aname, str[i]))
|
|
||||||
{
|
|
||||||
s_show = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
s_show = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!s_show)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// 50 is maximum player count sent to client
|
|
||||||
if (matchcount >= 50)
|
|
||||||
{
|
|
||||||
++matchcount;
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
wstrToLower(str[i]);
|
||||||
|
|
||||||
|
sLog->outDebug(LOG_FILTER_NETWORKIO, "String %u: %s", i, temp.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
std::wstring wplayer_name;
|
||||||
|
std::wstring wguild_name;
|
||||||
|
if (!(Utf8toWStr(player_name, wplayer_name) && Utf8toWStr(guild_name, wguild_name)))
|
||||||
|
return;
|
||||||
|
wstrToLower(wplayer_name);
|
||||||
|
wstrToLower(wguild_name);
|
||||||
|
|
||||||
|
// client send in case not set max level value 100 but Trinity supports 255 max level,
|
||||||
|
// update it to show GMs with characters after 100 level
|
||||||
|
if (level_max >= MAX_LEVEL)
|
||||||
|
level_max = STRONG_MAX_LEVEL;
|
||||||
|
|
||||||
|
uint32 team = _player->GetTeamId();
|
||||||
|
uint32 security = GetSecurity();
|
||||||
|
bool allowTwoSideWhoList = sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_WHO_LIST);
|
||||||
|
uint32 gmLevelInWhoList = sWorld->getIntConfig(CONFIG_GM_LEVEL_IN_WHO_LIST);
|
||||||
|
uint32 displaycount = 0;
|
||||||
|
|
||||||
|
WorldPacket data(SMSG_WHO, 50); // guess size
|
||||||
|
data << uint32(matchcount); // placeholder, count of players matching criteria
|
||||||
|
data << uint32(displaycount); // placeholder, count of players displayed
|
||||||
|
|
||||||
|
TRINITY_READ_GUARD(HashMapHolder<Player>::LockType, *HashMapHolder<Player>::GetLock());
|
||||||
|
HashMapHolder<Player>::MapType const& m = sObjectAccessor->GetPlayers();
|
||||||
|
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||||
|
{
|
||||||
|
if (AccountMgr::IsPlayerAccount(security))
|
||||||
|
{
|
||||||
|
// player can see member of other team only if CONFIG_ALLOW_TWO_SIDE_WHO_LIST
|
||||||
|
if (itr->second->GetTeamId() != team && !allowTwoSideWhoList)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// player can see MODERATOR, GAME MASTER, ADMINISTRATOR only if CONFIG_GM_IN_WHO_LIST
|
||||||
|
if ((itr->second->GetSession()->GetSecurity() > AccountTypes(gmLevelInWhoList)))
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
data << (*itr).pname; // player name
|
//do not process players which are not in world
|
||||||
data << (*itr).gname; // guild name
|
if (!(itr->second->IsInWorld()))
|
||||||
data << uint32(lvl); // player level
|
continue;
|
||||||
data << uint32(class_); // player class
|
|
||||||
data << uint32(race); // player race
|
|
||||||
data << uint8(gender); // player gender
|
|
||||||
data << uint32(pzoneid); // player zone id
|
|
||||||
|
|
||||||
++matchcount;
|
// check if target is globally visible for player
|
||||||
++displaycount;
|
if (!(itr->second->IsVisibleGloballyFor(_player)))
|
||||||
}
|
continue;
|
||||||
|
|
||||||
data.put(0, displaycount); // insert right count, count displayed
|
// check if target's level is in level range
|
||||||
data.put(4, matchcount); // insert right count, count of matches
|
uint8 lvl = itr->second->getLevel();
|
||||||
|
if (lvl < level_min || lvl > level_max)
|
||||||
|
continue;
|
||||||
|
|
||||||
SendPacket(&data);
|
// check if class matches classmask
|
||||||
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Send SMSG_WHO Message");
|
uint32 class_ = itr->second->getClass();
|
||||||
|
if (!(classmask & (1 << class_)))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// check if race matches racemask
|
||||||
|
uint32 race = itr->second->getRace();
|
||||||
|
if (!(racemask & (1 << race)))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
uint32 pzoneid = itr->second->GetZoneId();
|
||||||
|
uint8 gender = itr->second->getGender();
|
||||||
|
|
||||||
|
bool z_show = true;
|
||||||
|
for (uint32 i = 0; i < zones_count; ++i)
|
||||||
|
{
|
||||||
|
if (zoneids[i] == pzoneid)
|
||||||
|
{
|
||||||
|
z_show = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
z_show = false;
|
||||||
|
}
|
||||||
|
if (!z_show)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
std::string pname = itr->second->GetName();
|
||||||
|
std::wstring wpname;
|
||||||
|
if (!Utf8toWStr(pname, wpname))
|
||||||
|
continue;
|
||||||
|
wstrToLower(wpname);
|
||||||
|
|
||||||
|
if (!(wplayer_name.empty() || wpname.find(wplayer_name) != std::wstring::npos))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
std::string gname = sGuildMgr->GetGuildNameById(itr->second->GetGuildId());
|
||||||
|
std::wstring wgname;
|
||||||
|
if (!Utf8toWStr(gname, wgname))
|
||||||
|
continue;
|
||||||
|
wstrToLower(wgname);
|
||||||
|
|
||||||
|
if (!(wguild_name.empty() || wgname.find(wguild_name) != std::wstring::npos))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
std::string aname;
|
||||||
|
if (AreaTableEntry const* areaEntry = GetAreaEntryByAreaID(itr->second->GetZoneId()))
|
||||||
|
aname = areaEntry->area_name[GetSessionDbcLocale()];
|
||||||
|
|
||||||
|
bool s_show = true;
|
||||||
|
for (uint32 i = 0; i < str_count; ++i)
|
||||||
|
{
|
||||||
|
if (!str[i].empty())
|
||||||
|
{
|
||||||
|
if (wgname.find(str[i]) != std::wstring::npos ||
|
||||||
|
wpname.find(str[i]) != std::wstring::npos ||
|
||||||
|
Utf8FitTo(aname, str[i]))
|
||||||
|
{
|
||||||
|
s_show = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
s_show = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!s_show)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
// 49 is maximum player count sent to client - can be overridden
|
||||||
|
// through config, but is unstable
|
||||||
|
if ((matchcount++) >= 50 /*sWorld->getIntConfig(CONFIG_MAX_WHO)*/)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
data << pname; // player name
|
||||||
|
data << gname; // guild name
|
||||||
|
data << uint32(lvl); // player level
|
||||||
|
data << uint32(class_); // player class
|
||||||
|
data << uint32(race); // player race
|
||||||
|
data << uint8(gender); // player gender
|
||||||
|
data << uint32(pzoneid); // player zone id
|
||||||
|
|
||||||
|
++displaycount;
|
||||||
|
}
|
||||||
|
|
||||||
|
data.put(0, displaycount); // insert right count, count displayed
|
||||||
|
data.put(4, matchcount); // insert right count, count of matches
|
||||||
|
|
||||||
|
SendPacket(&data);
|
||||||
|
;// sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Send SMSG_WHO Message");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/)
|
void WorldSession::HandleLogoutRequestOpcode(WorldPacket & /*recv_data*/)
|
||||||
{
|
{
|
||||||
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_LOGOUT_REQUEST Message, security - %u", GetSecurity());
|
;//sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: Recvd CMSG_LOGOUT_REQUEST Message, security - %u", GetSecurity());
|
||||||
|
|
@ -532,7 +544,7 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket & recv_data)
|
||||||
{
|
{
|
||||||
if (friendGuid == GetPlayer()->GetGUID())
|
if (friendGuid == GetPlayer()->GetGUID())
|
||||||
friendResult = FRIEND_SELF;
|
friendResult = FRIEND_SELF;
|
||||||
else if (GetPlayer()->GetTeamId() != teamId && AccountMgr::IsPlayerAccount(GetSecurity()))
|
else if (GetPlayer()->GetTeamId() != teamId && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND) && AccountMgr::IsPlayerAccount(GetSecurity()))
|
||||||
friendResult = FRIEND_ENEMY;
|
friendResult = FRIEND_ENEMY;
|
||||||
else if (GetPlayer()->GetSocial()->HasFriend(guidLow))
|
else if (GetPlayer()->GetSocial()->HasFriend(guidLow))
|
||||||
friendResult = FRIEND_ALREADY;
|
friendResult = FRIEND_ALREADY;
|
||||||
|
|
|
||||||
|
|
@ -435,7 +435,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket & recvData)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// not let enemies sign guild charter
|
// not let enemies sign guild charter
|
||||||
if (GetPlayer()->GetTeamId() != sObjectMgr->GetPlayerTeamIdByGUID(ownerGuid))
|
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeamId() != sObjectMgr->GetPlayerTeamIdByGUID(ownerGuid))
|
||||||
{
|
{
|
||||||
if (type != GUILD_CHARTER_TYPE)
|
if (type != GUILD_CHARTER_TYPE)
|
||||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
|
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
|
||||||
|
|
|
||||||
|
|
@ -618,11 +618,11 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pOther->GetTeamId() !=_player->GetTeamId())
|
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_TRADE) && pOther->GetTeamId() != _player->GetTeamId())
|
||||||
{
|
{
|
||||||
SendTradeStatus(TRADE_STATUS_WRONG_FACTION);
|
SendTradeStatus(TRADE_STATUS_WRONG_FACTION);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pOther->IsWithinDistInMap(_player, 10.0f, false))
|
if (!pOther->IsWithinDistInMap(_player, 10.0f, false))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -222,7 +222,7 @@ void WorldSession::HandleEjectPassenger(WorldPacket &data)
|
||||||
sLog->outError("Player %u attempted to eject creature GUID %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
|
sLog->outError("Player %u attempted to eject creature GUID %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
sLog->outError("HandleEjectPassenger: Player %u tried to eject invalid GUID " UI64FMTD, GetPlayer()->GetGUIDLow(), guid);
|
sLog->outError("HandleEjectPassenger: Player %u tried to eject invalid GUID "UI64FMTD, GetPlayer()->GetGUIDLow(), guid);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recvData*/)
|
void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recvData*/)
|
||||||
|
|
|
||||||
|
|
@ -192,6 +192,9 @@ class InstanceScript : public ZoneScript
|
||||||
// Cast spell on all players in instance
|
// Cast spell on all players in instance
|
||||||
void DoCastSpellOnPlayers(uint32 spell);
|
void DoCastSpellOnPlayers(uint32 spell);
|
||||||
|
|
||||||
|
// Return wether server allow two side groups or not
|
||||||
|
bool ServerAllowsTwoSideGroups() { return sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP); }
|
||||||
|
|
||||||
virtual bool SetBossState(uint32 id, EncounterState state);
|
virtual bool SetBossState(uint32 id, EncounterState state);
|
||||||
EncounterState GetBossState(uint32 id) const { return id < bosses.size() ? bosses[id].state : TO_BE_DECIDED; }
|
EncounterState GetBossState(uint32 id) const { return id < bosses.size() ? bosses[id].state : TO_BE_DECIDED; }
|
||||||
BossBoundaryMap const* GetBossBoundary(uint32 id) const { return id < bosses.size() ? &bosses[id].boundary : NULL; }
|
BossBoundaryMap const* GetBossBoundary(uint32 id) const { return id < bosses.size() ? &bosses[id].boundary : NULL; }
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ m_inQueue(false), m_playerLoading(false), m_playerLogout(false), m_playerSave(fa
|
||||||
m_sessionDbcLocale(sWorld->GetDefaultDbcLocale()),
|
m_sessionDbcLocale(sWorld->GetDefaultDbcLocale()),
|
||||||
m_sessionDbLocaleIndex(locale),
|
m_sessionDbLocaleIndex(locale),
|
||||||
m_latency(0), m_clientTimeDelay(0), m_TutorialsChanged(false), recruiterId(recruiter),
|
m_latency(0), m_clientTimeDelay(0), m_TutorialsChanged(false), recruiterId(recruiter),
|
||||||
isRecruiter(isARecruiter), m_currentBankerGUID(0), timeWhoCommandAllowed(0), _lastAuctionListItemsMSTime(0), _lastAuctionListOwnerItemsMSTime(0), _skipQueue(skipQueue)
|
isRecruiter(isARecruiter), m_currentVendorEntry(0), m_currentBankerGUID(0), timeWhoCommandAllowed(0), _lastAuctionListItemsMSTime(0), _lastAuctionListOwnerItemsMSTime(0), _skipQueue(skipQueue)
|
||||||
{
|
{
|
||||||
memset(m_Tutorials, 0, sizeof(m_Tutorials));
|
memset(m_Tutorials, 0, sizeof(m_Tutorials));
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -228,6 +228,9 @@ class WorldSession
|
||||||
Player* GetPlayer() const { return _player; }
|
Player* GetPlayer() const { return _player; }
|
||||||
std::string const& GetPlayerName() const;
|
std::string const& GetPlayerName() const;
|
||||||
std::string GetPlayerInfo() const;
|
std::string GetPlayerInfo() const;
|
||||||
|
|
||||||
|
uint32 GetCurrentVendor() const { return m_currentVendorEntry; }
|
||||||
|
void SetCurrentVendor(uint32 vendorEntry) { m_currentVendorEntry = vendorEntry; }
|
||||||
|
|
||||||
uint32 GetGuidLow() const;
|
uint32 GetGuidLow() const;
|
||||||
void SetSecurity(AccountTypes security) { _security = security; }
|
void SetSecurity(AccountTypes security) { _security = security; }
|
||||||
|
|
@ -269,7 +272,7 @@ class WorldSession
|
||||||
|
|
||||||
void SendTrainerList(uint64 guid);
|
void SendTrainerList(uint64 guid);
|
||||||
void SendTrainerList(uint64 guid, std::string const& strTitle);
|
void SendTrainerList(uint64 guid, std::string const& strTitle);
|
||||||
void SendListInventory(uint64 guid);
|
void SendListInventory(uint64 guid, uint32 vendorEntry = 0);
|
||||||
void SendShowBank(uint64 guid);
|
void SendShowBank(uint64 guid);
|
||||||
bool CanOpenMailBox(uint64 guid);
|
bool CanOpenMailBox(uint64 guid);
|
||||||
void SendShowMailBox(uint64 guid);
|
void SendShowMailBox(uint64 guid);
|
||||||
|
|
@ -998,6 +1001,7 @@ class WorldSession
|
||||||
uint32 recruiterId;
|
uint32 recruiterId;
|
||||||
bool isRecruiter;
|
bool isRecruiter;
|
||||||
ACE_Based::LockedQueue<WorldPacket*, ACE_Thread_Mutex> _recvQueue;
|
ACE_Based::LockedQueue<WorldPacket*, ACE_Thread_Mutex> _recvQueue;
|
||||||
|
uint32 m_currentVendorEntry;
|
||||||
uint64 m_currentBankerGUID;
|
uint64 m_currentBankerGUID;
|
||||||
time_t timeWhoCommandAllowed;
|
time_t timeWhoCommandAllowed;
|
||||||
uint32 _offlineTime;
|
uint32 _offlineTime;
|
||||||
|
|
|
||||||
|
|
@ -6139,7 +6139,7 @@ SpellCastResult Spell::CheckCasterAuras(bool preventionOnly) const
|
||||||
if (usableInStun)
|
if (usableInStun)
|
||||||
{
|
{
|
||||||
bool foundNotStun = false;
|
bool foundNotStun = false;
|
||||||
uint32 mask = 1<<MECHANIC_STUN;
|
uint32 mask = (1 << MECHANIC_STUN) | (1 << MECHANIC_FREEZE) | (1 << MECHANIC_HORROR);
|
||||||
// Barkskin should skip sleep effects, sap and fears
|
// Barkskin should skip sleep effects, sap and fears
|
||||||
if (m_spellInfo->Id == 22812)
|
if (m_spellInfo->Id == 22812)
|
||||||
mask |= 1<<MECHANIC_SAPPED | 1<<MECHANIC_HORROR | 1<<MECHANIC_SLEEP;
|
mask |= 1<<MECHANIC_SAPPED | 1<<MECHANIC_HORROR | 1<<MECHANIC_SLEEP;
|
||||||
|
|
|
||||||
|
|
@ -680,7 +680,19 @@ void World::LoadConfigSettings(bool reload)
|
||||||
m_int_configs[CONFIG_STRICT_CHARTER_NAMES] = sConfigMgr->GetIntDefault ("StrictCharterNames", 0);
|
m_int_configs[CONFIG_STRICT_CHARTER_NAMES] = sConfigMgr->GetIntDefault ("StrictCharterNames", 0);
|
||||||
m_int_configs[CONFIG_STRICT_CHANNEL_NAMES] = sConfigMgr->GetIntDefault ("StrictChannelNames", 0);
|
m_int_configs[CONFIG_STRICT_CHANNEL_NAMES] = sConfigMgr->GetIntDefault ("StrictChannelNames", 0);
|
||||||
m_int_configs[CONFIG_STRICT_PET_NAMES] = sConfigMgr->GetIntDefault ("StrictPetNames", 0);
|
m_int_configs[CONFIG_STRICT_PET_NAMES] = sConfigMgr->GetIntDefault ("StrictPetNames", 0);
|
||||||
|
|
||||||
|
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_ACCOUNTS] = sConfigMgr->GetBoolDefault("AllowTwoSide.Accounts", true);
|
||||||
|
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_CALENDAR]= sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Calendar", false);
|
||||||
|
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT] = sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Chat", false);
|
||||||
|
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL] = sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Channel", false);
|
||||||
|
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP] = sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Group", false);
|
||||||
|
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD] = sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Guild", false);
|
||||||
|
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION] = sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Auction", false);
|
||||||
|
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL] = sConfigMgr->GetBoolDefault("AllowTwoSide.Interaction.Mail", false);
|
||||||
|
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_WHO_LIST] = sConfigMgr->GetBoolDefault("AllowTwoSide.WhoList", false);
|
||||||
|
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND] = sConfigMgr->GetBoolDefault("AllowTwoSide.AddFriend", false);
|
||||||
|
m_bool_configs[CONFIG_ALLOW_TWO_SIDE_TRADE] = sConfigMgr->GetBoolDefault("AllowTwoSide.trade", false);
|
||||||
|
|
||||||
m_int_configs[CONFIG_MIN_PLAYER_NAME] = sConfigMgr->GetIntDefault ("MinPlayerName", 2);
|
m_int_configs[CONFIG_MIN_PLAYER_NAME] = sConfigMgr->GetIntDefault ("MinPlayerName", 2);
|
||||||
if (m_int_configs[CONFIG_MIN_PLAYER_NAME] < 1 || m_int_configs[CONFIG_MIN_PLAYER_NAME] > MAX_PLAYER_NAME)
|
if (m_int_configs[CONFIG_MIN_PLAYER_NAME] < 1 || m_int_configs[CONFIG_MIN_PLAYER_NAME] > MAX_PLAYER_NAME)
|
||||||
{
|
{
|
||||||
|
|
@ -1664,6 +1676,10 @@ void World::SetInitialWorldSettings()
|
||||||
///- Handle outdated emails (delete/return)
|
///- Handle outdated emails (delete/return)
|
||||||
sLog->outString("Returning old mails...");
|
sLog->outString("Returning old mails...");
|
||||||
sObjectMgr->ReturnOrDeleteOldMails(false);
|
sObjectMgr->ReturnOrDeleteOldMails(false);
|
||||||
|
|
||||||
|
///- Load AutoBroadCast
|
||||||
|
sLog->outString("Loading Autobroadcasts...");
|
||||||
|
LoadAutobroadcasts();
|
||||||
|
|
||||||
///- Load and initialize scripts
|
///- Load and initialize scripts
|
||||||
sObjectMgr->LoadSpellScripts(); // must be after load Creature/Gameobject(Template/Data)
|
sObjectMgr->LoadSpellScripts(); // must be after load Creature/Gameobject(Template/Data)
|
||||||
|
|
@ -1842,6 +1858,40 @@ void World::DetectDBCLang()
|
||||||
sLog->outString();
|
sLog->outString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void World::LoadAutobroadcasts()
|
||||||
|
{
|
||||||
|
uint32 oldMSTime = getMSTime();
|
||||||
|
|
||||||
|
m_Autobroadcasts.clear();
|
||||||
|
m_AutobroadcastsWeights.clear();
|
||||||
|
|
||||||
|
uint32 realmId = sConfigMgr->GetIntDefault("RealmID", 0);
|
||||||
|
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_AUTOBROADCAST);
|
||||||
|
stmt->setInt32(0, realmId);
|
||||||
|
PreparedQueryResult result = LoginDatabase.Query(stmt);
|
||||||
|
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
sLog->outString(">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty for this realm!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 count = 0;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Field* fields = result->Fetch();
|
||||||
|
uint8 id = fields[0].GetUInt8();
|
||||||
|
|
||||||
|
m_Autobroadcasts[id] = fields[2].GetString();
|
||||||
|
m_AutobroadcastsWeights[id] = fields[1].GetUInt8();
|
||||||
|
|
||||||
|
++count;
|
||||||
|
} while (result->NextRow());
|
||||||
|
|
||||||
|
sLog->outString(">> Loaded %u autobroadcast definitions in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
|
||||||
|
}
|
||||||
|
|
||||||
/// Update the World !
|
/// Update the World !
|
||||||
void World::Update(uint32 diff)
|
void World::Update(uint32 diff)
|
||||||
{
|
{
|
||||||
|
|
@ -2579,10 +2629,37 @@ void World::SendAutoBroadcast()
|
||||||
{
|
{
|
||||||
if (m_Autobroadcasts.empty())
|
if (m_Autobroadcasts.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
uint32 weight = 0;
|
||||||
|
AutobroadcastsWeightMap selectionWeights;
|
||||||
|
|
||||||
std::string msg;
|
std::string msg;
|
||||||
|
|
||||||
msg = Trinity::Containers::SelectRandomContainerElement(m_Autobroadcasts);
|
for (AutobroadcastsWeightMap::const_iterator it = m_AutobroadcastsWeights.begin(); it != m_AutobroadcastsWeights.end(); ++it)
|
||||||
|
{
|
||||||
|
if (it->second)
|
||||||
|
{
|
||||||
|
weight += it->second;
|
||||||
|
selectionWeights[it->first] = it->second;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (weight)
|
||||||
|
{
|
||||||
|
uint32 selectedWeight = urand(0, weight - 1);
|
||||||
|
weight = 0;
|
||||||
|
for (AutobroadcastsWeightMap::const_iterator it = selectionWeights.begin(); it != selectionWeights.end(); ++it)
|
||||||
|
{
|
||||||
|
weight += it->second;
|
||||||
|
if (selectedWeight < weight)
|
||||||
|
{
|
||||||
|
msg = m_Autobroadcasts[it->first];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
msg = m_Autobroadcasts[urand(0, m_Autobroadcasts.size())];
|
||||||
|
|
||||||
uint32 abcenter = sWorld->getIntConfig(CONFIG_AUTOBROADCAST_CENTER);
|
uint32 abcenter = sWorld->getIntConfig(CONFIG_AUTOBROADCAST_CENTER);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,17 @@ enum WorldBoolConfigs
|
||||||
CONFIG_ALLOW_PLAYER_COMMANDS,
|
CONFIG_ALLOW_PLAYER_COMMANDS,
|
||||||
CONFIG_CLEAN_CHARACTER_DB,
|
CONFIG_CLEAN_CHARACTER_DB,
|
||||||
CONFIG_STATS_SAVE_ONLY_ON_LOGOUT,
|
CONFIG_STATS_SAVE_ONLY_ON_LOGOUT,
|
||||||
|
CONFIG_ALLOW_TWO_SIDE_ACCOUNTS,
|
||||||
|
CONFIG_ALLOW_TWO_SIDE_INTERACTION_CALENDAR,
|
||||||
|
CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT,
|
||||||
|
CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHANNEL,
|
||||||
|
CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP,
|
||||||
|
CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD,
|
||||||
|
CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION,
|
||||||
|
CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL,
|
||||||
|
CONFIG_ALLOW_TWO_SIDE_WHO_LIST,
|
||||||
|
CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND,
|
||||||
|
CONFIG_ALLOW_TWO_SIDE_TRADE,
|
||||||
CONFIG_ALL_TAXI_PATHS,
|
CONFIG_ALL_TAXI_PATHS,
|
||||||
CONFIG_INSTANT_TAXI,
|
CONFIG_INSTANT_TAXI,
|
||||||
CONFIG_INSTANCE_IGNORE_LEVEL,
|
CONFIG_INSTANCE_IGNORE_LEVEL,
|
||||||
|
|
@ -741,6 +752,8 @@ class World
|
||||||
void LoadDBVersion();
|
void LoadDBVersion();
|
||||||
char const* GetDBVersion() const { return m_DBVersion.c_str(); }
|
char const* GetDBVersion() const { return m_DBVersion.c_str(); }
|
||||||
|
|
||||||
|
void LoadAutobroadcasts();
|
||||||
|
|
||||||
void UpdateAreaDependentAuras();
|
void UpdateAreaDependentAuras();
|
||||||
|
|
||||||
uint32 GetCleaningFlags() const { return m_CleaningFlags; }
|
uint32 GetCleaningFlags() const { return m_CleaningFlags; }
|
||||||
|
|
@ -841,7 +854,11 @@ class World
|
||||||
// used versions
|
// used versions
|
||||||
std::string m_DBVersion;
|
std::string m_DBVersion;
|
||||||
|
|
||||||
std::list<std::string> m_Autobroadcasts;
|
typedef std::map<uint8, std::string> AutobroadcastsMap;
|
||||||
|
AutobroadcastsMap m_Autobroadcasts;
|
||||||
|
|
||||||
|
typedef std::map<uint8, uint8> AutobroadcastsWeightMap;
|
||||||
|
AutobroadcastsWeightMap m_AutobroadcastsWeights;
|
||||||
|
|
||||||
void ProcessQueryCallbacks();
|
void ProcessQueryCallbacks();
|
||||||
ACE_Future_Set<PreparedQueryResult> m_realmCharCallbacks;
|
ACE_Future_Set<PreparedQueryResult> m_realmCharCallbacks;
|
||||||
|
|
|
||||||
|
|
@ -1,19 +1,19 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C)
|
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify it
|
* 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
|
* 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
|
* Free Software Foundation; either version 2 of the License, or (at your
|
||||||
* option) any later version.
|
* option) any later version.
|
||||||
*
|
*
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||||
* more details.
|
* more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU General Public License along
|
* You should have received a copy of the GNU General Public License along
|
||||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* ScriptData
|
/* ScriptData
|
||||||
Name: account_commandscript
|
Name: account_commandscript
|
||||||
|
|
@ -22,36 +22,581 @@ Comment: All account related commands
|
||||||
Category: commandscripts
|
Category: commandscripts
|
||||||
EndScriptData */
|
EndScriptData */
|
||||||
|
|
||||||
|
#include "ScriptMgr.h"
|
||||||
#include "AccountMgr.h"
|
#include "AccountMgr.h"
|
||||||
#include "Chat.h"
|
#include "Chat.h"
|
||||||
#include "Language.h"
|
#include "Language.h"
|
||||||
#include "Player.h"
|
|
||||||
#include "ScriptMgr.h"
|
|
||||||
|
|
||||||
class account_commandscript : public CommandScript
|
class account_commandscript : public CommandScript
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
account_commandscript() : CommandScript("account_commandscript") { }
|
account_commandscript() : CommandScript("account_commandscript") { }
|
||||||
|
|
||||||
ChatCommand* GetCommands() const
|
ChatCommand* GetCommands() const
|
||||||
{
|
{
|
||||||
static ChatCommand commandTable[] =
|
static ChatCommand accountSetCommandTable[] =
|
||||||
{
|
{
|
||||||
{ "account", SEC_PLAYER, false, &HandleAccountCommand, "", NULL },
|
{ "addon", SEC_ADMINISTRATOR, true, &HandleAccountSetAddonCommand, "", NULL },
|
||||||
{ NULL, 0, false, NULL, "", NULL }
|
{ "gmlevel", SEC_CONSOLE, true, &HandleAccountSetGmLevelCommand, "", NULL },
|
||||||
};
|
{ "password", SEC_CONSOLE, true, &HandleAccountSetPasswordCommand, "", NULL },
|
||||||
return commandTable;
|
{ NULL, SEC_PLAYER, false, NULL, "", NULL }
|
||||||
}
|
};
|
||||||
|
static ChatCommand accountCommandTable[] =
|
||||||
|
{
|
||||||
|
{ "addon", SEC_MODERATOR, false, &HandleAccountAddonCommand, "", NULL },
|
||||||
|
{ "create", SEC_CONSOLE, true, &HandleAccountCreateCommand, "", NULL },
|
||||||
|
{ "delete", SEC_CONSOLE, true, &HandleAccountDeleteCommand, "", NULL },
|
||||||
|
{ "onlinelist", SEC_CONSOLE, true, &HandleAccountOnlineListCommand, "", NULL },
|
||||||
|
{ "lock", SEC_PLAYER, false, &HandleAccountLockCommand, "", NULL },
|
||||||
|
{ "set", SEC_ADMINISTRATOR, true, NULL, "", accountSetCommandTable },
|
||||||
|
{ "password", SEC_PLAYER, false, &HandleAccountPasswordCommand, "", NULL },
|
||||||
|
{ "", SEC_PLAYER, false, &HandleAccountCommand, "", NULL },
|
||||||
|
{ NULL, SEC_PLAYER, false, NULL, "", NULL }
|
||||||
|
};
|
||||||
|
static ChatCommand commandTable[] =
|
||||||
|
{
|
||||||
|
{ "account", SEC_PLAYER, true, NULL, "", accountCommandTable },
|
||||||
|
{ NULL, SEC_PLAYER, false, NULL, "", NULL }
|
||||||
|
};
|
||||||
|
return commandTable;
|
||||||
|
}
|
||||||
|
|
||||||
static bool HandleAccountCommand(ChatHandler* handler, char const* /*args*/)
|
static bool HandleAccountAddonCommand(ChatHandler* handler, char const* args)
|
||||||
{
|
{
|
||||||
AccountTypes gmLevel = handler->GetSession()->GetSecurity();
|
if (!*args)
|
||||||
handler->PSendSysMessage(LANG_ACCOUNT_LEVEL, uint32(gmLevel));
|
{
|
||||||
return true;
|
handler->SendSysMessage(LANG_CMD_SYNTAX);
|
||||||
}
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* exp = strtok((char*)args, " ");
|
||||||
|
|
||||||
|
uint32 accountId = handler->GetSession()->GetAccountId();
|
||||||
|
|
||||||
|
int expansion = atoi(exp); //get int anyway (0 if error)
|
||||||
|
if (expansion < 0 || uint8(expansion) > sWorld->getIntConfig(CONFIG_EXPANSION))
|
||||||
|
{
|
||||||
|
handler->SendSysMessage(LANG_IMPROPER_VALUE);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPANSION);
|
||||||
|
|
||||||
|
stmt->setUInt8(0, uint8(expansion));
|
||||||
|
stmt->setUInt32(1, accountId);
|
||||||
|
|
||||||
|
LoginDatabase.Execute(stmt);
|
||||||
|
|
||||||
|
handler->PSendSysMessage(LANG_ACCOUNT_ADDON, expansion);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Create an account
|
||||||
|
static bool HandleAccountCreateCommand(ChatHandler* handler, char const* args)
|
||||||
|
{
|
||||||
|
if (!*args)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
///- %Parse the command line arguments
|
||||||
|
char* accountName = strtok((char*)args, " ");
|
||||||
|
char* password = strtok(NULL, " ");
|
||||||
|
if (!accountName || !password)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
AccountOpResult result = AccountMgr::CreateAccount(std::string(accountName), std::string(password));
|
||||||
|
switch (result)
|
||||||
|
{
|
||||||
|
case AOR_OK:
|
||||||
|
handler->PSendSysMessage(LANG_ACCOUNT_CREATED, accountName);
|
||||||
|
if (handler->GetSession())
|
||||||
|
{
|
||||||
|
sLog->outDebug(LOG_FILTER_WARDEN, "Account: %d (IP: %s) Character:[%s] (GUID: %u) Change Password.",
|
||||||
|
handler->GetSession()->GetAccountId(), handler->GetSession()->GetRemoteAddress().c_str(),
|
||||||
|
handler->GetSession()->GetPlayer()->GetName().c_str(), handler->GetSession()->GetPlayer()->GetGUIDLow());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case AOR_NAME_TOO_LONG:
|
||||||
|
handler->SendSysMessage(LANG_ACCOUNT_TOO_LONG);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
case AOR_NAME_ALREDY_EXIST:
|
||||||
|
handler->SendSysMessage(LANG_ACCOUNT_ALREADY_EXIST);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
case AOR_DB_INTERNAL_ERROR:
|
||||||
|
handler->PSendSysMessage(LANG_ACCOUNT_NOT_CREATED_SQL_ERROR, accountName);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
handler->PSendSysMessage(LANG_ACCOUNT_NOT_CREATED, accountName);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Delete a user account and all associated characters in this realm
|
||||||
|
/// \todo This function has to be enhanced to respect the login/realm split (delete char, delete account chars in realm then delete account)
|
||||||
|
static bool HandleAccountDeleteCommand(ChatHandler* handler, char const* args)
|
||||||
|
{
|
||||||
|
if (!*args)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
///- Get the account name from the command line
|
||||||
|
char* account = strtok((char*)args, " ");
|
||||||
|
if (!account)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
std::string accountName = account;
|
||||||
|
if (!AccountMgr::normalizeString(accountName))
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 accountId = AccountMgr::GetId(accountName);
|
||||||
|
if (!accountId)
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Commands not recommended call from chat, but support anyway
|
||||||
|
/// can delete only for account with less security
|
||||||
|
/// This is also reject self apply in fact
|
||||||
|
if (handler->HasLowerSecurityAccount(NULL, accountId, true))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
AccountOpResult result = AccountMgr::DeleteAccount(accountId);
|
||||||
|
switch (result)
|
||||||
|
{
|
||||||
|
case AOR_OK:
|
||||||
|
handler->PSendSysMessage(LANG_ACCOUNT_DELETED, accountName.c_str());
|
||||||
|
break;
|
||||||
|
case AOR_NAME_NOT_EXIST:
|
||||||
|
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
case AOR_DB_INTERNAL_ERROR:
|
||||||
|
handler->PSendSysMessage(LANG_ACCOUNT_NOT_DELETED_SQL_ERROR, accountName.c_str());
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
handler->PSendSysMessage(LANG_ACCOUNT_NOT_DELETED, accountName.c_str());
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Display info on users currently in the realm
|
||||||
|
static bool HandleAccountOnlineListCommand(ChatHandler* handler, char const* /*args*/)
|
||||||
|
{
|
||||||
|
///- Get the list of accounts ID logged to the realm
|
||||||
|
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_ONLINE);
|
||||||
|
|
||||||
|
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||||
|
|
||||||
|
if (!result)
|
||||||
|
{
|
||||||
|
handler->SendSysMessage(LANG_ACCOUNT_LIST_EMPTY);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
///- Display the list of account/characters online
|
||||||
|
handler->SendSysMessage(LANG_ACCOUNT_LIST_BAR_HEADER);
|
||||||
|
handler->SendSysMessage(LANG_ACCOUNT_LIST_HEADER);
|
||||||
|
handler->SendSysMessage(LANG_ACCOUNT_LIST_BAR);
|
||||||
|
|
||||||
|
///- Cycle through accounts
|
||||||
|
do
|
||||||
|
{
|
||||||
|
Field* fieldsDB = result->Fetch();
|
||||||
|
std::string name = fieldsDB[0].GetString();
|
||||||
|
uint32 account = fieldsDB[1].GetUInt32();
|
||||||
|
|
||||||
|
///- Get the username, last IP and GM level of each account
|
||||||
|
// No SQL injection. account is uint32.
|
||||||
|
stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_INFO);
|
||||||
|
stmt->setUInt32(0, account);
|
||||||
|
PreparedQueryResult resultLogin = LoginDatabase.Query(stmt);
|
||||||
|
|
||||||
|
if (resultLogin)
|
||||||
|
{
|
||||||
|
Field* fieldsLogin = resultLogin->Fetch();
|
||||||
|
handler->PSendSysMessage(LANG_ACCOUNT_LIST_LINE,
|
||||||
|
fieldsLogin[0].GetCString(), name.c_str(), fieldsLogin[1].GetCString(),
|
||||||
|
fieldsDB[2].GetUInt16(), fieldsDB[3].GetUInt16(), fieldsLogin[3].GetUInt8(),
|
||||||
|
fieldsLogin[2].GetUInt8());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
handler->PSendSysMessage(LANG_ACCOUNT_LIST_ERROR, name.c_str());
|
||||||
|
} while (result->NextRow());
|
||||||
|
|
||||||
|
handler->SendSysMessage(LANG_ACCOUNT_LIST_BAR);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool HandleAccountLockCommand(ChatHandler* handler, char const* args)
|
||||||
|
{
|
||||||
|
if (!*args)
|
||||||
|
{
|
||||||
|
handler->SendSysMessage(LANG_USE_BOL);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string param = (char*)args;
|
||||||
|
|
||||||
|
if (!param.empty())
|
||||||
|
{
|
||||||
|
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_LOCK);
|
||||||
|
|
||||||
|
if (param == "on")
|
||||||
|
{
|
||||||
|
stmt->setBool(0, true); // locked
|
||||||
|
handler->PSendSysMessage(LANG_COMMAND_ACCLOCKLOCKED);
|
||||||
|
}
|
||||||
|
else if (param == "off")
|
||||||
|
{
|
||||||
|
stmt->setBool(0, false); // unlocked
|
||||||
|
handler->PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED);
|
||||||
|
}
|
||||||
|
|
||||||
|
stmt->setUInt32(1, handler->GetSession()->GetAccountId());
|
||||||
|
|
||||||
|
LoginDatabase.Execute(stmt);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
handler->SendSysMessage(LANG_USE_BOL);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool HandleAccountPasswordCommand(ChatHandler* handler, char const* args)
|
||||||
|
{
|
||||||
|
if (!*args)
|
||||||
|
{
|
||||||
|
handler->SendSysMessage(LANG_CMD_SYNTAX);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
char* oldPassword = strtok((char*)args, " ");
|
||||||
|
char* newPassword = strtok(NULL, " ");
|
||||||
|
char* passwordConfirmation = strtok(NULL, " ");
|
||||||
|
|
||||||
|
if (!oldPassword || !newPassword || !passwordConfirmation)
|
||||||
|
{
|
||||||
|
handler->SendSysMessage(LANG_CMD_SYNTAX);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!AccountMgr::CheckPassword(handler->GetSession()->GetAccountId(), std::string(oldPassword)))
|
||||||
|
{
|
||||||
|
handler->SendSysMessage(LANG_COMMAND_WRONGOLDPASSWORD);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp(newPassword, passwordConfirmation) != 0)
|
||||||
|
{
|
||||||
|
handler->SendSysMessage(LANG_NEW_PASSWORDS_NOT_MATCH);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
AccountOpResult result = AccountMgr::ChangePassword(handler->GetSession()->GetAccountId(), std::string(newPassword));
|
||||||
|
switch (result)
|
||||||
|
{
|
||||||
|
case AOR_OK:
|
||||||
|
handler->SendSysMessage(LANG_COMMAND_PASSWORD);
|
||||||
|
break;
|
||||||
|
case AOR_PASS_TOO_LONG:
|
||||||
|
handler->SendSysMessage(LANG_PASSWORD_TOO_LONG);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
handler->SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool HandleAccountCommand(ChatHandler* handler, char const* /*args*/)
|
||||||
|
{
|
||||||
|
AccountTypes gmLevel = handler->GetSession()->GetSecurity();
|
||||||
|
handler->PSendSysMessage(LANG_ACCOUNT_LEVEL, uint32(gmLevel));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Set/Unset the expansion level for an account
|
||||||
|
static bool HandleAccountSetAddonCommand(ChatHandler* handler, char const* args)
|
||||||
|
{
|
||||||
|
///- Get the command line arguments
|
||||||
|
char* account = strtok((char*)args, " ");
|
||||||
|
char* exp = strtok(NULL, " ");
|
||||||
|
|
||||||
|
if (!account)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
std::string accountName;
|
||||||
|
uint32 accountId;
|
||||||
|
|
||||||
|
if (!exp)
|
||||||
|
{
|
||||||
|
Player* player = handler->getSelectedPlayer();
|
||||||
|
if (!player)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
accountId = player->GetSession()->GetAccountId();
|
||||||
|
AccountMgr::GetName(accountId, accountName);
|
||||||
|
exp = account;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
///- Convert Account name to Upper Format
|
||||||
|
accountName = account;
|
||||||
|
if (!AccountMgr::normalizeString(accountName))
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
accountId = AccountMgr::GetId(accountName);
|
||||||
|
if (!accountId)
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Let set addon state only for lesser (strong) security level
|
||||||
|
// or to self account
|
||||||
|
if (handler->GetSession() && handler->GetSession()->GetAccountId() != accountId &&
|
||||||
|
handler->HasLowerSecurityAccount(NULL, accountId, true))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
int expansion = atoi(exp); //get int anyway (0 if error)
|
||||||
|
if (expansion < 0 || uint8(expansion) > sWorld->getIntConfig(CONFIG_EXPANSION))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_EXPANSION);
|
||||||
|
|
||||||
|
stmt->setUInt8(0, expansion);
|
||||||
|
stmt->setUInt32(1, accountId);
|
||||||
|
|
||||||
|
LoginDatabase.Execute(stmt);
|
||||||
|
|
||||||
|
handler->PSendSysMessage(LANG_ACCOUNT_SETADDON, accountName.c_str(), accountId, expansion);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
static bool HandleAccountSetGmLevelCommand(ChatHandler* handler, char const* args)
|
||||||
|
{
|
||||||
|
if (!*args)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
std::string targetAccountName;
|
||||||
|
uint32 targetAccountId = 0;
|
||||||
|
uint32 targetSecurity = 0;
|
||||||
|
uint32 gm = 0;
|
||||||
|
char* arg1 = strtok((char*)args, " ");
|
||||||
|
char* arg2 = strtok(NULL, " ");
|
||||||
|
char* arg3 = strtok(NULL, " ");
|
||||||
|
bool isAccountNameGiven = true;
|
||||||
|
|
||||||
|
if (arg1 && !arg3)
|
||||||
|
{
|
||||||
|
if (!handler->getSelectedPlayer())
|
||||||
|
return false;
|
||||||
|
isAccountNameGiven = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for second parameter
|
||||||
|
if (!isAccountNameGiven && !arg2)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Check for account
|
||||||
|
if (isAccountNameGiven)
|
||||||
|
{
|
||||||
|
targetAccountName = arg1;
|
||||||
|
if (!AccountMgr::normalizeString(targetAccountName))
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, targetAccountName.c_str());
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for invalid specified GM level.
|
||||||
|
gm = (isAccountNameGiven) ? atoi(arg2) : atoi(arg1);
|
||||||
|
if (gm > SEC_CONSOLE)
|
||||||
|
{
|
||||||
|
handler->SendSysMessage(LANG_BAD_VALUE);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// handler->getSession() == NULL only for console
|
||||||
|
targetAccountId = (isAccountNameGiven) ? AccountMgr::GetId(targetAccountName) : handler->getSelectedPlayer()->GetSession()->GetAccountId();
|
||||||
|
int32 gmRealmID = (isAccountNameGiven) ? atoi(arg3) : atoi(arg2);
|
||||||
|
uint32 playerSecurity;
|
||||||
|
if (handler->GetSession())
|
||||||
|
playerSecurity = AccountMgr::GetSecurity(handler->GetSession()->GetAccountId(), gmRealmID);
|
||||||
|
else
|
||||||
|
playerSecurity = SEC_CONSOLE;
|
||||||
|
|
||||||
|
// can set security level only for target with less security and to less security that we have
|
||||||
|
// This is also reject self apply in fact
|
||||||
|
targetSecurity = AccountMgr::GetSecurity(targetAccountId, gmRealmID);
|
||||||
|
if (targetSecurity >= playerSecurity || gm >= playerSecurity)
|
||||||
|
{
|
||||||
|
handler->SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check and abort if the target gm has a higher rank on one of the realms and the new realm is -1
|
||||||
|
if (gmRealmID == -1 && !AccountMgr::IsConsoleAccount(playerSecurity))
|
||||||
|
{
|
||||||
|
PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_ACCOUNT_ACCESS_GMLEVEL_TEST);
|
||||||
|
|
||||||
|
stmt->setUInt32(0, targetAccountId);
|
||||||
|
stmt->setUInt8(1, uint8(gm));
|
||||||
|
|
||||||
|
PreparedQueryResult result = LoginDatabase.Query(stmt);
|
||||||
|
|
||||||
|
if (result)
|
||||||
|
{
|
||||||
|
handler->SendSysMessage(LANG_YOURS_SECURITY_IS_LOW);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if provided realmID has a negative value other than -1
|
||||||
|
if (gmRealmID < -1)
|
||||||
|
{
|
||||||
|
handler->SendSysMessage(LANG_INVALID_REALMID);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// If gmRealmID is -1, delete all values for the account id, else, insert values for the specific realmID
|
||||||
|
PreparedStatement* stmt;
|
||||||
|
|
||||||
|
if (gmRealmID == -1)
|
||||||
|
{
|
||||||
|
stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_ACCESS);
|
||||||
|
|
||||||
|
stmt->setUInt32(0, targetAccountId);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
stmt = LoginDatabase.GetPreparedStatement(LOGIN_DEL_ACCOUNT_ACCESS_BY_REALM);
|
||||||
|
|
||||||
|
stmt->setUInt32(0, targetAccountId);
|
||||||
|
stmt->setUInt32(1, realmID);
|
||||||
|
}
|
||||||
|
|
||||||
|
LoginDatabase.Execute(stmt);
|
||||||
|
|
||||||
|
if (gm != 0)
|
||||||
|
{
|
||||||
|
stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_ACCESS);
|
||||||
|
|
||||||
|
stmt->setUInt32(0, targetAccountId);
|
||||||
|
stmt->setUInt8(1, uint8(gm));
|
||||||
|
stmt->setInt32(2, gmRealmID);
|
||||||
|
|
||||||
|
LoginDatabase.Execute(stmt);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
handler->PSendSysMessage(LANG_YOU_CHANGE_SECURITY, targetAccountName.c_str(), gm);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Set password for account
|
||||||
|
static bool HandleAccountSetPasswordCommand(ChatHandler* handler, char const* args)
|
||||||
|
{
|
||||||
|
if (!*args)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
///- Get the command line arguments
|
||||||
|
char* account = strtok((char*)args, " ");
|
||||||
|
char* password = strtok(NULL, " ");
|
||||||
|
char* passwordConfirmation = strtok(NULL, " ");
|
||||||
|
|
||||||
|
if (!account || !password || !passwordConfirmation)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
std::string accountName = account;
|
||||||
|
if (!AccountMgr::normalizeString(accountName))
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32 targetAccountId = AccountMgr::GetId(accountName);
|
||||||
|
if (!targetAccountId)
|
||||||
|
{
|
||||||
|
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// can set password only for target with less security
|
||||||
|
/// This is also reject self apply in fact
|
||||||
|
if (handler->HasLowerSecurityAccount(NULL, targetAccountId, true))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (strcmp(password, passwordConfirmation))
|
||||||
|
{
|
||||||
|
handler->SendSysMessage(LANG_NEW_PASSWORDS_NOT_MATCH);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
AccountOpResult result = AccountMgr::ChangePassword(targetAccountId, password);
|
||||||
|
|
||||||
|
switch (result)
|
||||||
|
{
|
||||||
|
case AOR_OK:
|
||||||
|
handler->SendSysMessage(LANG_COMMAND_PASSWORD);
|
||||||
|
break;
|
||||||
|
case AOR_NAME_NOT_EXIST:
|
||||||
|
handler->PSendSysMessage(LANG_ACCOUNT_NOT_EXIST, accountName.c_str());
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
case AOR_PASS_TOO_LONG:
|
||||||
|
handler->SendSysMessage(LANG_PASSWORD_TOO_LONG);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
default:
|
||||||
|
handler->SendSysMessage(LANG_COMMAND_NOTCHANGEPASSWORD);
|
||||||
|
handler->SetSentErrorMessage(true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void AddSC_account_commandscript()
|
void AddSC_account_commandscript()
|
||||||
{
|
{
|
||||||
new account_commandscript();
|
new account_commandscript();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,7 @@ public:
|
||||||
{
|
{
|
||||||
std::string name = param1;
|
std::string name = param1;
|
||||||
WorldDatabase.EscapeString(name);
|
WorldDatabase.EscapeString(name);
|
||||||
whereClause << ", creature_template WHERE creature.id = creature_template.entry AND creature_template.name " _LIKE_" '" << name << '\'';
|
whereClause << ", creature_template WHERE creature.id = creature_template.entry AND creature_template.name "_LIKE_" '" << name << '\'';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
whereClause << "WHERE guid = '" << guid << '\'';
|
whereClause << "WHERE guid = '" << guid << '\'';
|
||||||
|
|
|
||||||
|
|
@ -244,7 +244,7 @@ public:
|
||||||
WorldDatabase.EscapeString(name);
|
WorldDatabase.EscapeString(name);
|
||||||
result = WorldDatabase.PQuery(
|
result = WorldDatabase.PQuery(
|
||||||
"SELECT guid, id, position_x, position_y, position_z, orientation, map, phaseMask, (POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ "
|
"SELECT guid, id, position_x, position_y, position_z, orientation, map, phaseMask, (POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ "
|
||||||
"FROM gameobject, gameobject_template WHERE gameobject_template.entry = gameobject.id AND map = %i AND name " _LIKE_" " _CONCAT3_("'%%'", "'%s'", "'%%'")" ORDER BY order_ ASC LIMIT 1",
|
"FROM gameobject, gameobject_template WHERE gameobject_template.entry = gameobject.id AND map = %i AND name "_LIKE_" "_CONCAT3_("'%%'", "'%s'", "'%%'")" ORDER BY order_ ASC LIMIT 1",
|
||||||
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), name.c_str());
|
player->GetPositionX(), player->GetPositionY(), player->GetPositionZ(), player->GetMapId(), name.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -260,7 +260,8 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 vendor_entry = vendor ? vendor->GetEntry() : 0;
|
char* addMulti = strtok(NULL, " ");
|
||||||
|
uint32 vendor_entry = addMulti ? handler->GetSession()->GetCurrentVendor() : vendor ? vendor->GetEntry() : 0;
|
||||||
|
|
||||||
if (!sObjectMgr->IsVendorItemValid(vendor_entry, itemId, maxcount, incrtime, extendedcost, handler->GetSession()->GetPlayer()))
|
if (!sObjectMgr->IsVendorItemValid(vendor_entry, itemId, maxcount, incrtime, extendedcost, handler->GetSession()->GetPlayer()))
|
||||||
{
|
{
|
||||||
|
|
@ -483,7 +484,8 @@ public:
|
||||||
}
|
}
|
||||||
uint32 itemId = atol(pitem);
|
uint32 itemId = atol(pitem);
|
||||||
|
|
||||||
if (!sObjectMgr->RemoveVendorItem(vendor->GetEntry(), itemId))
|
char* addMulti = strtok(NULL, " ");
|
||||||
|
if (!sObjectMgr->RemoveVendorItem(addMulti ? handler->GetSession()->GetCurrentVendor() : vendor->GetEntry(), itemId))
|
||||||
{
|
{
|
||||||
handler->PSendSysMessage(LANG_ITEM_NOT_IN_LIST, itemId);
|
handler->PSendSysMessage(LANG_ITEM_NOT_IN_LIST, itemId);
|
||||||
handler->SetSentErrorMessage(true);
|
handler->SetSentErrorMessage(true);
|
||||||
|
|
|
||||||
|
|
@ -363,7 +363,7 @@ public:
|
||||||
static bool HandleReloadAutobroadcastCommand(ChatHandler* handler, const char* /*args*/)
|
static bool HandleReloadAutobroadcastCommand(ChatHandler* handler, const char* /*args*/)
|
||||||
{
|
{
|
||||||
sLog->outString("Re-Loading Autobroadcasts...");
|
sLog->outString("Re-Loading Autobroadcasts...");
|
||||||
//sWorld->LoadAutobroadcasts();
|
sWorld->LoadAutobroadcasts();
|
||||||
handler->SendGlobalGMSysMessage("DB table `autobroadcast` reloaded.");
|
handler->SendGlobalGMSysMessage("DB table `autobroadcast` reloaded.");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
src/server/scripts/Custom/Multivendor/MultivendorExample.sql
Normal file
10
src/server/scripts/Custom/Multivendor/MultivendorExample.sql
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
SET @ENTRY = (SELECT max(entry)+1 FROM creature_template);
|
||||||
|
SET @MENU_ID = (SELECT max(menu_id)+1 FROM gossip_menu_option);
|
||||||
|
|
||||||
|
INSERT INTO `creature_template` (`entry`, `modelid1`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `dmgschool`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `HoverHeight`, `RacialLeader`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`) VALUES
|
||||||
|
(@ENTRY, 1298, "Herbert", "MultiVendor", NULL, @MENU_ID, 10, 10, 0, 35, 129, 1, 1.14286, 1, 0, 0, 1500, 0, 1, 512, 2048, 8, 0, 0, 0, 0, 0, 7, 138412032, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 1, 0, 0, 1, 0, 2, '');
|
||||||
|
|
||||||
|
INSERT INTO `gossip_menu_option` (`menu_id`, `id`, `option_icon`, `option_text`, `option_id`, `npc_option_npcflag`, `action_menu_id`, `action_poi_id`, `box_coded`, `box_money`, `box_text`) VALUES
|
||||||
|
(@MENU_ID, 0, 4, 'VendorTest 465', 3, 128, 465, 0, 0, 0, ''),
|
||||||
|
(@MENU_ID, 1, 9, 'VendorTest 54', 3, 128, 54, 0, 0, 0, ''),
|
||||||
|
(@MENU_ID, 2, 6, 'VendorTest 35574', 3, 128, 35574, 0, 0, 100, 'These goods are special, so pay up!');
|
||||||
42
src/server/scripts/Custom/Multivendor/README.md
Normal file
42
src/server/scripts/Custom/Multivendor/README.md
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
#Multivendor [](https://travis-ci.org/Rochet2/TrinityCore)
|
||||||
|
|
||||||
|
####About
|
||||||
|
Allows you to show gossip options that show different vendors from npc_vendor.<br />
|
||||||
|
Source: http://rochet2.github.io/Multivendor.html
|
||||||
|
|
||||||
|
####Installation
|
||||||
|
|
||||||
|
Available as:
|
||||||
|
- Direct merge: https://github.com/Rochet2/TrinityCore/tree/multivendor
|
||||||
|
- Diff: https://github.com/Rochet2/TrinityCore/compare/TrinityCore:3.3.5...multivendor.diff
|
||||||
|
- Diff in github view: https://github.com/Rochet2/TrinityCore/compare/TrinityCore:3.3.5...multivendor
|
||||||
|
|
||||||
|
Using direct merge:
|
||||||
|
- open git bash to source location
|
||||||
|
- do `git remote add rochet2 https://github.com/Rochet2/TrinityCore.git`
|
||||||
|
- do `git pull rochet2 multivendor`
|
||||||
|
- use cmake and compile
|
||||||
|
|
||||||
|
Using diff:
|
||||||
|
- DO NOT COPY THE DIFF DIRECTLY! It causes apply to fail.
|
||||||
|
- download the diff by __right clicking__ the link and select __Save link as__
|
||||||
|
- place the downloaded `multivendor.diff` to the source root folder
|
||||||
|
- open git bash to source location
|
||||||
|
- do `git apply multivendor.diff`
|
||||||
|
- use cmake and compile
|
||||||
|
|
||||||
|
####Usage
|
||||||
|
Set your NPC to have gossip and vendor NPCflags (129)<br />
|
||||||
|
Add a gossip menu for him and add a new option to it.<br />
|
||||||
|
The option needs to have option_id set to 3 so it acts as a vendor button,<br />
|
||||||
|
npc_option_npcflag can be 1 or 128 (shows only if the NPC has vendor flag then)<br />
|
||||||
|
and the action_menu_id is the vendor entry from npc_vendor that you want to show to the player.<br />
|
||||||
|
|
||||||
|
YOU CAN also send menus from C++. All you need to do is to provide the vendor entry to the<br />
|
||||||
|
`void WorldSession::SendListInventory(ObjectGuid guid, uint32 vendorEntry)` function.
|
||||||
|
|
||||||
|
The npc add item command was modified so you can add items to multivendors as well.<br />
|
||||||
|
The last vendor window must have been the multivendor you want to add your item to.<br />
|
||||||
|
After opening the window you need to type `.npc add item #itemId <#maxcount><#incrtime><#extendedcost> 1`<br />
|
||||||
|
The 1 in the end specifies that you are adding the item to the multivendor currently open.<br />
|
||||||
|
Same thing works with `.npc delete item #itemId 1`
|
||||||
|
|
@ -55,7 +55,8 @@ void LoginDatabaseConnection::DoPrepareStatements()
|
||||||
PrepareStatement(LOGIN_DEL_REALM_CHARACTERS, "DELETE FROM realmcharacters WHERE acctid = ?", CONNECTION_ASYNC);
|
PrepareStatement(LOGIN_DEL_REALM_CHARACTERS, "DELETE FROM realmcharacters WHERE acctid = ?", CONNECTION_ASYNC);
|
||||||
PrepareStatement(LOGIN_INS_REALM_CHARACTERS, "INSERT INTO realmcharacters (numchars, acctid, realmid) VALUES (?, ?, ?)", CONNECTION_ASYNC);
|
PrepareStatement(LOGIN_INS_REALM_CHARACTERS, "INSERT INTO realmcharacters (numchars, acctid, realmid) VALUES (?, ?, ?)", CONNECTION_ASYNC);
|
||||||
PrepareStatement(LOGIN_SEL_SUM_REALM_CHARACTERS, "SELECT SUM(numchars) FROM realmcharacters WHERE acctid = ?", CONNECTION_ASYNC);
|
PrepareStatement(LOGIN_SEL_SUM_REALM_CHARACTERS, "SELECT SUM(numchars) FROM realmcharacters WHERE acctid = ?", CONNECTION_ASYNC);
|
||||||
PrepareStatement(LOGIN_INS_ACCOUNT, "INSERT INTO account(username, sha_pass_hash, joindate) VALUES(?, ?, NOW())", CONNECTION_SYNCH);
|
PrepareStatement(LOGIN_INS_ACCOUNT, "INSERT INTO account(username, sha_pass_hash, joindate) VALUES(?, ?, NOW())", CONNECTION_ASYNC);
|
||||||
|
PrepareStatement(LOGIN_INS_REALM_CHARACTERS_INIT, "INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist, account LEFT JOIN realmcharacters ON acctid=account.id WHERE acctid IS NULL", CONNECTION_ASYNC);
|
||||||
PrepareStatement(LOGIN_UPD_EXPANSION, "UPDATE account SET expansion = ? WHERE id = ?", CONNECTION_ASYNC);
|
PrepareStatement(LOGIN_UPD_EXPANSION, "UPDATE account SET expansion = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||||
PrepareStatement(LOGIN_UPD_ACCOUNT_LOCK, "UPDATE account SET locked = ? WHERE id = ?", CONNECTION_ASYNC);
|
PrepareStatement(LOGIN_UPD_ACCOUNT_LOCK, "UPDATE account SET locked = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||||
PrepareStatement(LOGIN_UPD_USERNAME, "UPDATE account SET v = 0, s = 0, username = ?, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC);
|
PrepareStatement(LOGIN_UPD_USERNAME, "UPDATE account SET v = 0, s = 0, username = ?, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC);
|
||||||
|
|
@ -84,4 +85,5 @@ void LoginDatabaseConnection::DoPrepareStatements()
|
||||||
PrepareStatement(LOGIN_SEL_ACCOUNT_WHOIS, "SELECT username, email, last_ip FROM account WHERE id = ?", CONNECTION_SYNCH);
|
PrepareStatement(LOGIN_SEL_ACCOUNT_WHOIS, "SELECT username, email, last_ip FROM account WHERE id = ?", CONNECTION_SYNCH);
|
||||||
PrepareStatement(LOGIN_SEL_REALMLIST_SECURITY_LEVEL, "SELECT allowedSecurityLevel from realmlist WHERE id = ?", CONNECTION_SYNCH);
|
PrepareStatement(LOGIN_SEL_REALMLIST_SECURITY_LEVEL, "SELECT allowedSecurityLevel from realmlist WHERE id = ?", CONNECTION_SYNCH);
|
||||||
PrepareStatement(LOGIN_DEL_ACCOUNT, "DELETE FROM account WHERE id = ?", CONNECTION_ASYNC);
|
PrepareStatement(LOGIN_DEL_ACCOUNT, "DELETE FROM account WHERE id = ?", CONNECTION_ASYNC);
|
||||||
|
PrepareStatement(LOGIN_SEL_AUTOBROADCAST, "SELECT id, weight, text FROM autobroadcast WHERE realmid = ? OR realmid = -1", CONNECTION_SYNCH);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,6 +76,7 @@ enum LoginDatabaseStatements
|
||||||
LOGIN_INS_REALM_CHARACTERS,
|
LOGIN_INS_REALM_CHARACTERS,
|
||||||
LOGIN_SEL_SUM_REALM_CHARACTERS,
|
LOGIN_SEL_SUM_REALM_CHARACTERS,
|
||||||
LOGIN_INS_ACCOUNT,
|
LOGIN_INS_ACCOUNT,
|
||||||
|
LOGIN_INS_REALM_CHARACTERS_INIT,
|
||||||
LOGIN_UPD_EXPANSION,
|
LOGIN_UPD_EXPANSION,
|
||||||
LOGIN_UPD_ACCOUNT_LOCK,
|
LOGIN_UPD_ACCOUNT_LOCK,
|
||||||
LOGIN_UPD_USERNAME,
|
LOGIN_UPD_USERNAME,
|
||||||
|
|
@ -104,6 +105,7 @@ enum LoginDatabaseStatements
|
||||||
LOGIN_SEL_ACCOUNT_WHOIS,
|
LOGIN_SEL_ACCOUNT_WHOIS,
|
||||||
LOGIN_SEL_REALMLIST_SECURITY_LEVEL,
|
LOGIN_SEL_REALMLIST_SECURITY_LEVEL,
|
||||||
LOGIN_DEL_ACCOUNT,
|
LOGIN_DEL_ACCOUNT,
|
||||||
|
LOGIN_SEL_AUTOBROADCAST,
|
||||||
|
|
||||||
MAX_LOGINDATABASE_STATEMENTS
|
MAX_LOGINDATABASE_STATEMENTS
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ class MySQL
|
||||||
static void Thread_Init()
|
static void Thread_Init()
|
||||||
{
|
{
|
||||||
mysql_thread_init();
|
mysql_thread_init();
|
||||||
sLog->outSQLDriver("Core thread with ID [" UI64FMTD"] initializing MySQL thread.",
|
sLog->outSQLDriver("Core thread with ID ["UI64FMTD"] initializing MySQL thread.",
|
||||||
(uint64)ACE_Based::Thread::currentId());
|
(uint64)ACE_Based::Thread::currentId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -44,7 +44,7 @@ class MySQL
|
||||||
static void Thread_End()
|
static void Thread_End()
|
||||||
{
|
{
|
||||||
mysql_thread_end();
|
mysql_thread_end();
|
||||||
sLog->outSQLDriver("Core thread with ID [" UI64FMTD"] shutting down MySQL thread.",
|
sLog->outSQLDriver("Core thread with ID ["UI64FMTD"] shutting down MySQL thread.",
|
||||||
(uint64)ACE_Based::Thread::currentId());
|
(uint64)ACE_Based::Thread::currentId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1080,10 +1080,10 @@ PVOID pAddress)
|
||||||
switch (basicType)
|
switch (basicType)
|
||||||
{
|
{
|
||||||
case btChar:
|
case btChar:
|
||||||
pszCurrBuffer += sprintf(pszCurrBuffer, " = \" %s\"", pAddress);
|
pszCurrBuffer += sprintf(pszCurrBuffer, " = \"%s\"", pAddress);
|
||||||
break;
|
break;
|
||||||
case btStdString:
|
case btStdString:
|
||||||
pszCurrBuffer += sprintf(pszCurrBuffer, " = \" %s\"", static_cast<std::string*>(pAddress)->c_str());
|
pszCurrBuffer += sprintf(pszCurrBuffer, " = \"%s\"", static_cast<std::string*>(pAddress)->c_str());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Format appropriately (assuming it's a 1, 2, or 4 bytes (!!!)
|
// Format appropriately (assuming it's a 1, 2, or 4 bytes (!!!)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue