Merge branch 'master' into wintergrasp_cleanup

This commit is contained in:
Kandera
2012-03-01 10:59:02 -05:00
231 changed files with 11430 additions and 4887 deletions
+48 -1
View File
@@ -39,6 +39,7 @@
#include <emmintrin.h> // Define SSE2 intrinsics
#include "randomc.h" // Define integer types etc
#include <time.h>
#include <new>
// Choose one of the possible Mersenne exponents.
// Higher values give longer cycle length and use more memory:
@@ -149,8 +150,14 @@ __m128i const &c, __m128i const &d, __m128i const &mask) {
// Class for SFMT generator
class SFMTRand { // Encapsulate random number generator
friend class ACE_TSS<SFMTRand>;
public:
SFMTRand() { LastInterval = 0; RandomInit((int)(time(0))); }
SFMTRand()
{
LastInterval = 0;
RandomInit((int)(time(0)));
}
void RandomInit(int seed) // Re-seed
{
@@ -298,6 +305,46 @@ private:
ix = 0;
}
void* operator new(size_t size, std::nothrow_t const&)
{
return _mm_malloc(size, 16);
}
void operator delete(void* ptr, std::nothrow_t const&)
{
_mm_free(ptr);
}
void* operator new(size_t size)
{
return _mm_malloc(size, 16);
}
void operator delete(void* ptr)
{
_mm_free(ptr);
}
void* operator new[](size_t size, std::nothrow_t const&)
{
return _mm_malloc(size, 16);
}
void operator delete[](void* ptr, std::nothrow_t const&)
{
_mm_free(ptr);
}
void* operator new[](size_t size)
{
return _mm_malloc(size, 16);
}
void operator delete[](void* ptr)
{
_mm_free(ptr);
}
uint32_t ix; // Index into state array
uint32_t LastInterval; // Last interval length for IRandom
uint32_t RLimit; // Rejection limit used by IRandom
@@ -4,4 +4,4 @@ CREATE TABLE `warden_action` (
`wardenId` smallint(5) unsigned NOT NULL,
`action` tinyint(3) unsigned DEFAULT NULL,
PRIMARY KEY (`wardenId`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
@@ -0,0 +1 @@
DELETE FROM `character_queststatus` WHERE `status`=0;
@@ -0,0 +1,78 @@
-- Loot for Hellfire 5-man dungeons Trash (heroic and normal) --
-- -------------------------------------------------------------
-- Hellfire Citadel: Ramparts
SET @Lootid := 17259;
-- set all lootids to same entry (normal and heroic)
UPDATE `creature_template` SET `lootid`=@Lootid WHERE `entry` IN
(17259,17264,17269,17270,17271,17280,17281,17309,17455,17478,17517,18048,18049,18050,18051,18052,18053,18054,18055,18057,18058,18059);
-- populate trashloot table
DELETE FROM `creature_loot_template` WHERE `entry` IN
(17259,17264,17269,17270,17271,17280,17281,17309,17455,17478,17517,18048,18049,18050,18051,18052,18053,18054,18055,18057,18058,18059);
DELETE FROM `creature_loot_template` WHERE `entry`=@Lootid;
INSERT INTO `creature_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES
-- rough indication based on wowhead data of ALL mobs in the dungeon
(@Lootid,14047,40,1,0,1,4), -- Runecloth
(@Lootid,21877,20,1,0,1,4), -- Netherweave Cloth
(@Lootid, 8952,10,1,0,1,4), -- Roasted Quail
(@Lootid, 8766, 5,1,0,1,3), -- Morning Glory Dew
-- references for worldgreys
(@Lootid,1,5,1,0,-24000,1), -- Outland Grey Item Reference1
(@Lootid,2,5,1,0,-24002,1), -- Outland Grey Item Reference2
(@Lootid,3,5,1,0,-24003,1), -- Outland Grey Item Reference3
(@Lootid,4,5,1,0,-24011,1), -- Outland Grey Item Reference4
(@Lootid,5,5,1,0,-24022,1), -- Outland Grey Item Reference5
(@Lootid,6,5,1,0,-24023,1), -- Outland Grey Item Reference6
-- specifics
(@Lootid,5759,0.25,1,0,1,1), -- Thorium Lockbox
(@Lootid,5760,0.30,1,0,1,1), -- Eternium Lockbox
-- Scrolls
(@Lootid,7,5,1,0,-24724,1); -- Scroll of <stat> IV
-- -----------------------------------------
-- -- Hellfire Citadel: The Blood Furnace --
-- -----------------------------------------
SET @Lootid := 17370;
UPDATE `creature_template` SET `lootid`=@Lootid WHERE `entry` IN (17256,17370,17371,17395,17397,17398,17399,17414,17429,17477,17491,17624,17626,17653,18894,19016,18608,18619,18617,18615,18612,18614,18618,18603,18606,18610,18611,18609,18620,21645,21646);
DELETE FROM `creature_loot_template` WHERE `entry` IN (17370,17371,17395,17397,17398,17414,17429,17491,17624,17626,18894);
INSERT INTO `creature_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES
(@Lootid,23894,-100,1,0,1,1), -- Fel Orc Blood (quest)
-- most common items
(@Lootid,14047,40,1,0,1,4), -- Runecloth
(@Lootid,21877,20,1,0,1,4), -- Netherweave Cloth
(@Lootid, 8952,10,1,0,1,4), -- Roasted Quail
(@Lootid, 8766, 5,1,0,1,3), -- Morning Glory Dew
-- references for worldgreys
(@Lootid,1,5,1,0,-24000,1), -- Outland Grey Item Reference1
(@Lootid,2,5,1,0,-24002,1), -- Outland Grey Item Reference2
(@Lootid,3,5,1,0,-24003,1), -- Outland Grey Item Reference3
(@Lootid,4,5,1,0,-24011,1), -- Outland Grey Item Reference4
(@Lootid,5,5,1,0,-24022,1), -- Outland Grey Item Reference5
(@Lootid,6,5,1,0,-24023,1), -- Outland Grey Item Reference6
-- specifics
(@Lootid,5759,0.25,1,0,1,1), -- Thorium Lockbox
(@Lootid,5760,0.30,1,0,1,1), -- Eternium Lockbox
-- Scrolls
(@Lootid,7,5,1,0,-24724,1); -- Scroll of <stat> IV
-- -------------------------------------------
-- -- Hellfire Citadel: The Shattered Halls --
-- -------------------------------------------
SET @Lootid := 16507;
UPDATE `creature_template` SET `lootid`=@Lootid WHERE `entry` IN (17669,16507,17622,17462,17427,17420,17083,16699,16704,17695,17670,16700,16593,16594,17464,17694,17465,17461,17671,20593,20582,20576,20590,20589,20594,20567,20587,20579,20581,20595,20586,20583,20578,20574,20588,20584,20577,20580);
DELETE FROM `creature_loot_template` WHERE `entry` IN (16507,16593,16594,16699,16700,16704,17083,17420,17427,17461,17462,17464,17465,17669,17670,17671,17694,17695,17669,16594,17694,17427,17695,17461,16593,17465,17671,17464,17420,17670,16700,16699,16507,16704,17462);
INSERT INTO `creature_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES
(@Lootid,21877,40,1,0,2,3), -- Netherweave Cloth
(@Lootid,27854,20,1,0,1,1), -- Smoked Talbuk Venison
(@Lootid,27860,20,1,0,1,1), -- Purified Draenic Water
(@Lootid,31952,2.5,1,0,1,1), -- Khorium Lockbox
-- references
(@Lootid,1,5,1,1,-24002,1), -- Outland Grey Item Reference1
(@Lootid,2,2,1,1,-24009,1), -- Outland Green Reference1
(@Lootid,3,5,1,1,-24011,1), -- Outland Grey Item Reference2
(@Lootid,4,1,1,1,-24012,1), -- Outland Blue Reference1
(@Lootid,5,5,1,1,-24093,1), -- Outland Plans & patterns
-- Scrolls
(@Lootid,6,5,1,0,-24724,1); -- Scroll of <stat> IV
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,11 @@
UPDATE `creature_template` SET `lootid`=`entry` WHERE `entry` IN (38032,37917,38016,38023,37214,38030,38006,37984);
DELETE FROM `creature_loot_template` WHERE `entry`IN (38032,37917,38016,38023,37214,38030,38006,37984);
INSERT INTO `creature_loot_template` (`entry`, `item`, `ChanceOrQuestChance`, `lootmode`, `groupid`, `mincountOrRef`, `maxcount`) VALUES
(38032,1,100,1,0,-45009,1), -- Crown Sprayer
(37917,1,100,1,0,-45009,1), -- Crown Thug
(38016,1,100,1,0,-45009,1), -- Crown Agent
(38023,1,100,1,0,-45009,1), -- Crown Sprinkler
(37214,1,100,1,0,-45009,1), -- Crown Lackey
(38030,1,100,1,0,-45009,1), -- Crown Underling
(38006,1,100,1,0,-45009,1), -- Crown Hoodlum (level 1??)
(37984,1,100,1,0,-45009,1); -- Crown Duster (level 1??)
@@ -0,0 +1,26 @@
-- Razormane Hunter Warrior's Boots 32% to 3.2%
UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=3.2996 WHERE `entry`=3265 AND `item`=2967;
-- Razormane Hunter Hunting Cloak 11% to 1.1%
UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=1.1855 WHERE `entry`=3265 AND `item`=4689;
-- Razormane Defender Pioneer Buckler 87% to 0.8%
UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=0.8789 WHERE `entry`=3266 AND `item`=7109;
-- Razormane Defender Spellbinder Belt 77% to 0.7%
UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=0.7717 WHERE `entry`=3266 AND `item`=4684;
-- Razormane Geomancer Simple Shoes 77% to 0.7%
UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=0.7791 WHERE `entry`=3269 AND `item`=9743;
-- Razormane Geomancer Veteran Bracers 73% to 0.7%
UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=0.7364 WHERE `entry`=3269 AND `item`=3213;
-- Venture Co. Supervisor Burnt Leather Belt 85% to 0.8%
UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=0.8511 WHERE `entry`=2979 AND `item`=4666;
-- Venture Co. Supervisor Warrior's Gloves 74% to 0.7%
UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=0.7433 WHERE `entry`=2979 AND `item`=2968;
-- Venture Co. Supervisor Pioneer Bracers 55% to 0.5%
UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=0.5593 WHERE `entry`=2979 AND `item`=6519;
-- Venture Co. Supervisor Journeyman's Gloves 43% to 0.4%
UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=0.4348 WHERE `entry`=2979 AND `item`=2960;
-- Venture Co. Worker Warrior's Bracers 72% to 0.7%
UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=0.7226 WHERE `entry`=2978 AND `item`=3214;
-- Venture Co. Worker Fine Scimitar 64% to 0.6%
UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=0.6492 WHERE `entry`=2978 AND `item`=4560;
-- Venture Co. Worker Warrior's Girdle 24% to 0.2%
UPDATE `creature_loot_template` SET `ChanceOrQuestChance`=0.2458 WHERE `entry`=2978 AND `item`=4659;
@@ -0,0 +1,16 @@
SET @ENTRY := 30409; -- Apprentice Osterkilgr
DELETE FROM `creature_loot_template` WHERE entry=@ENTRY;
INSERT INTO `creature_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES
-- Quest related Items
(@ENTRY,43089,-100,1,0,1,1), -- Vrykul Bones
(@ENTRY,42772,-100,1,0,1,1), -- Dr Terrible's "Building a Better Flesh Giant"
(@ENTRY,42422,-50,1,0,1,1), -- Jotunheim Cage Key
-- Other random stuff
(@ENTRY,33470,20,1,0,1,4), -- Frostweave Cloth
(@ENTRY,43851,20,1,0,1,1), -- Fur Clothing Scraps
(@ENTRY,43852,20,1,0,1,1), -- Thick Fur Clothing Scraps
-- References for world drops
(@ENTRY,1,10,1,0,-35063,1), -- Northrend Grey Items
(@ENTRY,2,5,1,0,-35066,1), -- Northrend Green Items
-- hatebook
(@ENTRY,45912,0.1,1,0,1,1); -- Book Glyph of Mastery (honestly screw that thing)
@@ -0,0 +1,39 @@
-- SAI for Lothos Riftwaker
SET @ENTRY=14387;
UPDATE `creature_template` SET `AIName`='SmartAI',`ScriptName`='' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE (`entryorguid`=@ENTRY AND `source_type`=0);
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,1,62,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Lothos Riftwaker - On Gossip Option select - close gossip'),
(@ENTRY,0,1,0,61,0,100,0,5750,0,0,0,62,409,0,0,0,0,0,7,0,0,0,1096,-467,-104.6,3.64,'Lothos Riftwaker - On Gossip Option select - teleport player');
DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (5750);
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
(5750,0,0,'Teleport me to the Molten Core, Lothos.',1,1,0,0,0,0,'');
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup` IN (5750);
INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
(15,5750,0,0,0,8,7848,0,0,0,0,'','Show gossip option if player has quest 7848 completed');
-- SAI for Zamael Lunthistle
SET @ENTRY=8436;
UPDATE `creature_template` SET `AIName`='SmartAI',`ScriptName`='' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE (`entryorguid`=@ENTRY AND `source_type`=0);
INSERT INTO `smart_scripts` (`entryorguid`,`source_type`,`id`,`link`,`event_type`,`event_phase_mask`,`event_chance`,`event_flags`,`event_param1`,`event_param2`,`event_param3`,`event_param4`,`action_type`,`action_param1`,`action_param2`,`action_param3`,`action_param4`,`action_param5`,`action_param6`,`target_type`,`target_param1`,`target_param2`,`target_param3`,`target_x`,`target_y`,`target_z`,`target_o`,`comment`) VALUES
(@ENTRY,0,0,1,62,0,100,0,1285,0,0,0,26,3377,0,0,0,0,0,7,0,0,0,0,0,0,0,'Zamael Lunthistle - On Gossip Option select - quest credit'),
(@ENTRY,0,1,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Zamael Lunthistle - On Gossip Option select - close gossip');
DELETE FROM `gossip_menu` WHERE `entry`=1285 AND `text_id`=1920;
INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (1285,1920);
DELETE FROM `gossip_menu` WHERE `entry`=1286 AND `text_id`=1922;
INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (1286,1922);
DELETE FROM `gossip_menu` WHERE `entry`=1287 AND `text_id`=1921;
INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (1287,1921);
DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (1285,1286,1287);
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
(1285,0,0,'I wish to hear your tale.',1,1,1287,0,0,0,''),
(1286,0,0,'Let me think about it, Zamael.',1,1,1285,0,0,0,''),
(1287,0,0,'Please continue, Zamael.',1,1,1286,0,0,0,'');
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup` IN (1285);
INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
(15,1285,0,0,0,9,3377,0,0,0,0,'','Show gossip option if player has quest 3377 but not complete');
@@ -0,0 +1,184 @@
-- Gossip Update from Pitcrawler
-- Creature Gossip_menu_id Update from sniff
UPDATE `creature_template` SET `gossip_menu_id`=7692 WHERE `entry`=18424;
UPDATE `creature_template` SET `gossip_menu_id`=9033 WHERE `entry`=24838;
UPDATE `creature_template` SET `gossip_menu_id`=9038 WHERE `entry`=24833;
UPDATE `creature_template` SET `gossip_menu_id`=9066 WHERE `entry`=25011;
UPDATE `creature_template` SET `gossip_menu_id`=9067 WHERE `entry`=25015;
UPDATE `creature_template` SET `gossip_menu_id`=9068 WHERE `entry`=25009;
UPDATE `creature_template` SET `gossip_menu_id`=9069 WHERE `entry`=25017;
UPDATE `creature_template` SET `gossip_menu_id`=9070 WHERE `entry`=25018;
UPDATE `creature_template` SET `gossip_menu_id`=9071 WHERE `entry`=25016;
UPDATE `creature_template` SET `gossip_menu_id`=9072 WHERE `entry` IN (25013,25014);
UPDATE `creature_template` SET `gossip_menu_id`=9091 WHERE `entry`=25076;
UPDATE `creature_template` SET `gossip_menu_id`=9107 WHERE `entry`=24929;
UPDATE `creature_template` SET `gossip_menu_id`=9109 WHERE `entry`=24927;
UPDATE `creature_template` SET `gossip_menu_id`=9110 WHERE `entry`=24924;
UPDATE `creature_template` SET `gossip_menu_id`=9116 WHERE `entry`=25105;
UPDATE `creature_template` SET `gossip_menu_id`=9117 WHERE `entry`=25100;
UPDATE `creature_template` SET `gossip_menu_id`=9118 WHERE `entry`=25104;
UPDATE `creature_template` SET `gossip_menu_id`=9120 WHERE `entry`=25107;
UPDATE `creature_template` SET `gossip_menu_id`=9121 WHERE `entry` IN (25101,25102,25103);
UPDATE `creature_template` SET `gossip_menu_id`=9122 WHERE `entry`=25106;
UPDATE `creature_template` SET `gossip_menu_id`=9349 WHERE `entry`=26539;
UPDATE `creature_template` SET `gossip_menu_id`=10120 WHERE `entry` IN (31704,31705,31706,31720,31723,31724);
UPDATE `creature_template` SET `gossip_menu_id`=10259 WHERE `entry`=31716;
-- Gossip Menu insert from sniff
DELETE FROM `gossip_menu` WHERE `entry`=7692 AND `text_id`=9383;
DELETE FROM `gossip_menu` WHERE `entry`=7696 AND `text_id`=9444;
DELETE FROM `gossip_menu` WHERE `entry`=7704 AND `text_id`=9425;
DELETE FROM `gossip_menu` WHERE `entry`=7726 AND `text_id`=9437;
DELETE FROM `gossip_menu` WHERE `entry`=7727 AND `text_id`=9438;
DELETE FROM `gossip_menu` WHERE `entry`=7728 AND `text_id`=9439;
DELETE FROM `gossip_menu` WHERE `entry`=9033 AND `text_id`=12211;
DELETE FROM `gossip_menu` WHERE `entry`=9038 AND `text_id`=12216;
DELETE FROM `gossip_menu` WHERE `entry`=9040 AND `text_id`=12217;
DELETE FROM `gossip_menu` WHERE `entry`=9041 AND `text_id`=12218;
DELETE FROM `gossip_menu` WHERE `entry`=9042 AND `text_id`=12219;
DELETE FROM `gossip_menu` WHERE `entry`=9043 AND `text_id`=12220;
DELETE FROM `gossip_menu` WHERE `entry`=9066 AND `text_id`=12262;
DELETE FROM `gossip_menu` WHERE `entry`=9067 AND `text_id`=12263;
DELETE FROM `gossip_menu` WHERE `entry`=9068 AND `text_id`=12264;
DELETE FROM `gossip_menu` WHERE `entry`=9069 AND `text_id`=12266;
DELETE FROM `gossip_menu` WHERE `entry`=9070 AND `text_id`=12267;
DELETE FROM `gossip_menu` WHERE `entry`=9091 AND `text_id`=12292;
DELETE FROM `gossip_menu` WHERE `entry`=9109 AND `text_id`=12317;
DELETE FROM `gossip_menu` WHERE `entry`=9110 AND `text_id`=12318;
DELETE FROM `gossip_menu` WHERE `entry`=9116 AND `text_id`=12327;
DELETE FROM `gossip_menu` WHERE `entry`=9117 AND `text_id`=12328;
DELETE FROM `gossip_menu` WHERE `entry`=9118 AND `text_id`=12329;
DELETE FROM `gossip_menu` WHERE `entry`=9120 AND `text_id`=12331;
DELETE FROM `gossip_menu` WHERE `entry`=9121 AND `text_id`=12332;
DELETE FROM `gossip_menu` WHERE `entry`=9122 AND `text_id`=12333;
DELETE FROM `gossip_menu` WHERE `entry`=9349 AND `text_id`=12649;
DELETE FROM `gossip_menu` WHERE `entry`=10120 AND `text_id`=14047;
DELETE FROM `gossip_menu` WHERE `entry`=10259 AND `text_id`=14248;
INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES
(7692,9383),
(7696,9444),
(7704,9425),
(7726,9437),
(7727,9438),
(7728,9439),
(9033,12211),
(9038,12216),
(9040,12217),
(9041,12218),
(9042,12219),
(9043,12220),
(9066,12262),
(9067,12263),
(9068,12264),
(9069,12266),
(9070,12267),
(9091,12292),
(9109,12317),
(9110,12318),
(9116,12327),
(9117,12328),
(9118,12329),
(9120,12331),
(9121,12332),
(9122,12333),
(9349,12649),
(10120,14047),
(10259,14248);
-- Insert npc_text from sniff
DELETE FROM `npc_text` WHERE `ID` IN (9437,9438,9439,12211,12266);
INSERT INTO `npc_text` (`ID`,`text0_0`,`text0_1`,`lang0`,`prob0`,`em0_0`,`em0_1`,`em0_2`,`em0_3`,`em0_4`,`em0_5`,`text1_0`,`text1_1`,`lang1`,`prob1`,`em1_0`,`em1_1`,`em1_2`,`em1_3`,`em1_4`,`em1_5`,`text2_0`,`text2_1`,`lang2`,`prob2`,`em2_0`,`em2_1`,`em2_2`,`em2_3`,`em2_4`,`em2_5`,`text3_0`,`text3_1`,`lang3`,`prob3`,`em3_0`,`em3_1`,`em3_2`,`em3_3`,`em3_4`,`em3_5`,`text4_0`,`text4_1`,`lang4`,`prob4`,`em4_0`,`em4_1`,`em4_2`,`em4_3`,`em4_4`,`em4_5`,`text5_0`,`text5_1`,`lang5`,`prob5`,`em5_0`,`em5_1`,`em5_2`,`em5_3`,`em5_4`,`em5_5`,`text6_0`,`text6_1`,`lang6`,`prob6`,`em6_0`,`em6_1`,`em6_2`,`em6_3`,`em6_4`,`em6_5`,`text7_0`,`text7_1`,`lang7`,`prob7`,`em7_0`,`em7_1`,`em7_2`,`em7_3`,`em7_4`,`em7_5`,`WDBVerified`) VALUES
(9437,'<Warden Treelos looks at you funny and then pauses a moment, clearly struggling.>$B$BZangarmarsh... too close to truth.$B$B<His face goes crazy again.>$B$BIs he still watching!?','',0,1,1000,1,1000,6,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,12340),
(9438,'What''s that? Zangarmarsh? Why would I want to go there?$B$B<Treelos looks thoughtful.>$B$BYes, Zangarmarsh... we... the druids there are getting close to figuring out why the water level is dropping. It''s destroying everything!$B$B<You can see the insanity creep back in behind the warden''s eyes.>$B$BDestroyed us all! Bright light! BOOM!!','',0,1,0,6,1000,1,1000,5,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,12340),
(9439,'The Firewing blood elves... for some reason they want to stop us.$B$B<Warden Treelos visibly struggles to keep his wits about him for a few more seconds.>$B$BThey... they sent one of the Broken as ... as an emissary.... But he had a bomb!$B$BThey died, they all died! They tried to run away! The lucky ones didn''t even know.$B$BI must have been at the edge of the blast. It was horr...IT''S WATCHING US AGAIN!$B$B<Treelos becomes despondent and looks straight through you as if you''re not there.>','',0,1,0,18,1000,18,1000,5,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,12340),
(12211,'Fine day fer sailin'', innit?','',7,1,0,1,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,12340),
(12266,'','I''m almost jealous of our Mr. Wavesinger. Why, he may well be prettier than me!',7,1,0,1,3,11,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,'','',0,0,0,0,0,0,0,0,12340);
-- Creature Gossip_menu_option insert from sniff
DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (7692,7726,7727) AND `id`=0;
DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (9038,9040,9041,9042,9043) AND `id` IN (0,1,2);
DELETE FROM `gossip_menu_option` WHERE `menu_id`=9038 AND `id`=3;
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
(7692,0,0,'Treelos, I know that the truth is somewhere inside you. Tell me what it is.',1,1,7726,0,0,0,''),
(7726,0,0,'Keep it together man! What about Zangarmarsh?',1,1,7727,0,0,0,''),
(7727,0,0,'I don''t have time for this! Warden, what happened?!',1,1,7728,0,0,0,''),
(9038,0,0,'The Lady Mehley',1,1,9040,0,0,0,''),
(9038,1,0,'Food & Drink',1,1,9041,0,0,0,''),
(9038,2,0,'Goods & Gear',1,1,9042,0,0,0,''),
(9038,3,0,'"Stash?"',1,1,9043,0,0,0,''),
(9040,0,0,'Food & Drink',1,1,9041,0,0,0,''),
(9040,1,0,'Goods & Gear',1,1,9042,0,0,0,''),
(9040,2,0,'"Stash?',1,1,9043,0,0,0,''),
(9041,0,0,'The Lady Mehley',1,1,9040,0,0,0,''),
(9041,1,0,'Goods & Gear',1,1,9042,0,0,0,''),
(9041,2,0,'"Stash?',1,1,9043,0,0,0,''),
(9042,0,0,'The Lady Mehley',1,1,9040,0,0,0,''),
(9042,1,0,'Food & Drink',1,1,9041,0,0,0,''),
(9042,2,0,'"Stash?',1,1,9043,0,0,0,''),
(9043,0,0,'The Lady Mehley',1,1,9040,0,0,0,''),
(9043,1,0,'Food & Drink',1,1,9041,0,0,0,''),
(9043,2,0,'Goods & Gear',1,1,9042,0,0,0,'');
-- Conditions
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=7704 AND `SourceEntry`=9425;
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=14 AND `SourceGroup`=7696 AND `SourceEntry`=9444;
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup` IN (7704,7692);
INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
(14,7696,9444,0,0,8,10005,0,0,0,0,'','Show different gossip if player has rewarded quest 10005'),
(14,7696,9444,0,1,8,10006,0,0,0,0,'','Show different gossip if player has rewarded quest 10006'),
(14,7704,9425,0,0,8,9978,0,0,0,0,'','Show different gossip if player has rewarded quest 9978'),
(15,7704,0,0,0,9,9978,0,0,0,0,'','Show gossip option if player has quest 9978 but not complete'),
(15,7692,0,0,0,8,10006,0,0,0,0,'','Show gossip option if player has rewarded quest 10006'),
(15,7692,0,0,1,8,10005,0,0,0,0,'','Show gossip option if player has rewarded quest 10005');
-- Gossip Update from Malcrom
DELETE FROM `gossip_menu` WHERE `entry` IN (1042,1043,1044,1045,1046,1047,1048,1049,1050,1052,1053);
INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES
(1042,1635),(1043,1640),(1044,1644),(1045,1643),(1045,1753),
(1046,1648),(1047,1754),(1048,1650),(1049,1755),
(1050,1651),(1050,1756),(1052,1652),(1053,1653);
DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (1045,1047,1049,1050);
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
(1045,0,0,'Acquire Higher Level Access Card',1,1,0,0,0,0,''),
(1047,0,0,'Acquire Higher Level Access Card',1,1,0,0,0,0,''),
(1049,0,0,'Acquire Higher Level Access Card',1,1,0,0,0,0,''),
(1050,0,0,'Acquire high level data card.',1,1,0,0,0,0,'');
DELETE FROM `gossip_menu` WHERE `entry`=1080 AND `text_id`=1693;
INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (1080,1693);
DELETE FROM `gossip_menu` WHERE `entry`=1100 AND `text_id`=1713;
INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (1100,1713);
DELETE FROM `gossip_menu` WHERE `entry`=1143 AND `text_id`=1759;
INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (1143,1759);
DELETE FROM `gossip_menu` WHERE `entry`=1161 AND `text_id`=1793;
INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (1161,1793);
DELETE FROM `gossip_menu` WHERE `entry`=1162 AND `text_id`=1794;
INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (1162,1794);
DELETE FROM `gossip_menu` WHERE `entry`=1201 AND `text_id`=1833;
INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (1201,1833);
DELETE FROM `gossip_menu` WHERE `entry`=1281 AND `text_id`=1916;
INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (1281,1916);
DELETE FROM `gossip_menu` WHERE `entry`=1282 AND `text_id`=1918;
INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (1282,1918);
DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (1282);
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
(1282,0,0,'Touch the Suntara stone and call forth Lathoric the Black and his guardian, Obsidion.',1,1,0,0,0,0,'');
DELETE FROM `gossip_menu` WHERE `entry`=1301 AND `text_id`=1933;
INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (1301,1933);
DELETE FROM `gossip_menu` WHERE `entry`=1301 AND `text_id`=1934;
INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (1301,1934);
DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (1301);
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
(1301,0,0,'I wish to browse your wares.',3,128,0,0,0,0,'');
DELETE FROM `gossip_menu` WHERE `entry`=1302 AND `text_id`=1935;
INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (1302,1935);
DELETE FROM `gossip_menu` WHERE `entry`=1321 AND `text_id`=1955;
INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (1321,1955);
DELETE FROM `gossip_menu` WHERE `entry`=1322 AND `text_id`=1954;
INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (1322,1954);
DELETE FROM `gossip_menu` WHERE `entry`=1362 AND `text_id`=1994;
INSERT INTO `gossip_menu` (`entry`,`text_id`) VALUES (1362,1994);
@@ -0,0 +1,39 @@
-- SAI for Kalaran Windblade
SET @ENTRY=8479;
UPDATE `creature_template` SET `AIName`='SmartAI',`ScriptName`='' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE (`entryorguid`=@ENTRY AND `source_type`=0);
DELETE FROM `smart_scripts` WHERE (`entryorguid`=@ENTRY*100 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
-- AI
(@ENTRY,0,0,1,62,0,100,0,1321,0,0,0,26,3441,0,0,0,0,0,7,0,0,0,0,0,0,0,'Kalaran Windblade - On Gossip Option select - quest credit'),
(@ENTRY,0,1,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Kalaran Windblade - On Gossip Option select - close gossip'),
(@ENTRY,0,2,3,62,0,100,0,1323,2,0,0,11,19797,0,0,0,0,0,7,0,0,0,0,0,0,0,'Kalaran Windblade - On Gossip Option select - cast 19797'),
(@ENTRY,0,3,0,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Kalaran Windblade - On Gossip Option select - close gossip'),
(@ENTRY,0,4,0,62,0,100,0,1323,3,0,0,80,@ENTRY*100,0,0,0,0,0,1,0,0,0,0,0,0,0,'Kalaran Windblade - On Gossip Option select - run script'),
-- Script
(@ENTRY*100,9,0,0,0,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Kalaran Windblade - script - close gossip'),
(@ENTRY*100,9,1,0,0,0,100,0,0,0,0,0,83,3,0,0,0,0,0,1,0,0,0,0,0,0,0,'Kalaran Windblade - script - remove npc flags'),
(@ENTRY*100,9,2,0,0,0,100,0,1000,1000,1000,1000,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Kalaran Windblade - script - say 0'),
(@ENTRY*100,9,3,0,0,0,100,0,1000,1000,1000,1000,17,69,0,0,0,0,0,1,0,0,0,0,0,0,0,'Kalaran Windblade - script - emotestate usestanding'),
(@ENTRY*100,9,4,0,0,0,100,0,60000,60000,60000,60000,17,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Kalaran Windblade - script - emotestate none'),
(@ENTRY*100,9,5,0,0,0,100,0,1000,1000,1000,1000,26,3453,0,0,0,0,0,7,0,0,0,0,0,0,0,'Kalaran Windblade - script - give quest credit'),
(@ENTRY*100,9,6,0,0,0,100,0,1000,1000,1000,1000,82,3,0,0,0,0,0,1,0,0,0,0,0,0,0,'Kalaran Windblade - script - add npc flags');
-- npc text
DELETE FROM `creature_text` WHERE `entry`=@ENTRY;
INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES
(@ENTRY,0,0,'Please be patient, $N',12,0,100,0,0,0,'Kalaran Windblade');
-- Gossip options
DELETE FROM `gossip_menu_option` WHERE `menu_id` IN (1321,1322,1323);
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
(1321,0,0,'Let me confer with my colleagues.',1,1,0,0,0,0,''),
(1322,0,0,'Continue please.',1,1,1321,0,0,0,''),
(1323,0,0,'Tell me what drives this vengeance?',1,1,1322,0,0,0,''),
(1323,2,0,'Kalaran, I have misplaced my torch. I require another.',1,1,0,0,0,0,''),
(1323,3,0,'Kalaran, please enchant the torch.',1,1,0,0,0,0,'');
-- Gossip option conditions
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup` IN (1323);
INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
(15,1323,0,0,0,9,3441,0,0,0,0,'','Show gossip option if player has quest 3441 but not complete'),
(15,1323,2,0,0,8,3454,0,0,0,0,'','Show gossip option if player has quest 3441 complete'),
(15,1323,2,0,0,2,10515,0,1,0,0,'','Show gossip option if player does not have item 10515'),
(15,1323,3,0,0,9,3453,0,0,0,0,'','Show gossip option if player has quest 3453 but not complete');
@@ -0,0 +1,34 @@
-- Invisible Stalker text for Wintergrasp from sniff
DELETE FROM `creature_text` WHERE `entry`=15214;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(15214,0,0, 'Let the battle begin!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,1,0, 'The Broken Temple siege workshop has been attacked by the Horde!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,2,0, 'The Broken Temple siege workshop has been captured by the Horde!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,3,0, 'The Broken Temple siege workshop has been attacked by the Alliance!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,4,0, 'The Broken Temple siege workshop has been captured by the Alliance!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,5,0, 'The Sunken Ring siege workshop has been attacked by the Horde!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,6,0, 'The Sunken Ring siege workshop has been captured by the Horde!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,7,0, 'The Sunken Ring siege workshop has been attacked by the Alliance!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,8,0, 'The Sunken Ring siege workshop has been captured by the Alliance!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,9,0, 'The Eastspark siege workshop has been attacked by the Horde!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,10,0, 'The Eastspark siege workshop has been captured by the Horde!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,11,0, 'The Eastspark siege workshop has been attacked by the Alliance!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,12,0, 'The Eastspark siege workshop has been captured by the Alliance!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,13,0, 'The Westspark siege workshop has been attacked by the Horde!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,14,0, 'The Westspark siege workshop has been captured by the Horde!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,15,0, 'The Westspark siege workshop has been attacked by the Alliance!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,16,0, 'The Westspark siege workshop has been captured by the Alliance!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,17,0, 'The north-western keep tower has been damaged!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,18,0, 'The north-western keep tower has been destroyed!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,19,0, 'The south-eastern keep tower has been damaged!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,20,0, 'The south-eastern keep tower has been destroyed!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,21,0, 'The western tower has been damaged!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,22,0, 'The western tower has been destroyed!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,23,0, 'The southern tower has been damaged!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,24,0, 'The southern tower has been destroyed!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,25,0, 'The eastern tower has been damaged!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,26,0, 'The eastern tower has been destroyed!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,27,0, 'The Horde has defended Wintergrasp Fortress!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,28,0, 'The Horde has captured Wintergrasp Fortress!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,29,0, 'The Alliance has defended Wintergrasp Fortress!',41,0,100,0,0,0, 'Invisible Stalker'),
(15214,30,0, 'The Alliance has captured Wintergrasp Fortress!',41,0,100,0,0,0, 'Invisible Stalker');
@@ -0,0 +1,57 @@
-- Mounting Hodir's Helm (12987)
-- cleanup after Discovered
-- clean all related to npc Hodir's Helm KC Bunny
DELETE FROM `smart_scripts` WHERE `entryorguid`=30210 AND `source_type`=0;
DELETE FROM `creature` WHERE `id`=30210;
DELETE FROM `creature_text` WHERE `entry`=30210;
SET @HELM := 192080; -- Hodir's Helm
SET @TEMP := 300230; -- TEMP Northern Ice Spike
SET @BUNNY_TARGET := 30215; -- Ice Spike Target Bunny
SET @GUID_GO := 270; -- set by TDB
SET @GUID_NPC := 40514; -- set by TDB
SET @SPELL_READ_PRONOUNCEMENT := 56278;
SET @QUEST := 12987;
SET @AREA := 4438; -- Dun Niffelem
SET @SPELL_AREA := 56305; -- See Quest Invisibility 1 (Ice Spike Bunny)
SET @QUEST := 13006; -- Polishing the Helm
UPDATE `creature_template` SET `unit_flags`=`unit_flags`|33554432|256,`InhabitType`=7,`flags_extra`=`flags_extra`|128 WHERE `entry`=@BUNNY_TARGET;
UPDATE `gameobject_template` SET `flags`=`flags`|32 WHERE `entry`=@HELM;
UPDATE `gameobject` SET `phaseMask`=4 WHERE `id`=@TEMP;
DELETE FROM `gameobject` WHERE `guid`=@GUID_GO;
INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES
(@GUID_GO,@HELM,571,1,4,7390.143,-2725.382,874.2561,-3.089183,0,0,-0.9996567,0.02620165,600,255,1);
DELETE FROM `creature` WHERE `guid` BETWEEN @GUID_NPC+0 AND @GUID_NPC+1;
INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`,`npcflag`,`unit_flags`,`dynamicflags`) VALUES
(@GUID_NPC+0,@BUNNY_TARGET,571,1,4,0,0,7386.51,-2726.489,872.5089,5.88176,300,0,0,4979,0,0,0,0,0),
(@GUID_NPC+1,@BUNNY_TARGET,571,1,4,0,0,7388.424,-2724.909,869.8643,0.5934119,300,0,0,4979,0,0,0,0,0);
DELETE FROM `creature_template_addon` WHERE `entry`=@BUNNY_TARGET;
INSERT INTO `creature_template_addon` (`entry`,`path_id`,`mount`,`bytes1`,`bytes2`,`emote`,`auras`) VALUES
(@BUNNY_TARGET,0,0,65536,1,0, '61333 56304 61334'); -- Gigantic Helm Sparkle / Hodir's Helm Bunny: Invisibility / Extra Large Helm Sparkle
DELETE FROM `spell_script_names` WHERE `spell_id`=@SPELL_READ_PRONOUNCEMENT;
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(@SPELL_READ_PRONOUNCEMENT, 'spell_q12987_read_pronouncement');
DELETE FROM `spell_area` WHERE `spell`=@SPELL_AREA;
INSERT INTO `spell_area` (`spell`,`area`,`quest_start`,`quest_start_active`,`quest_end`,`aura_spell`,`racemask`,`gender`,`autocast`) VALUES
(@SPELL_AREA,@AREA,@QUEST,1,@QUEST,0,0,2,1);
-- relation for the daily quest that should be available after finishing Mounting Hodir's Helm
-- removing flag 4 or else player can't interract with Q giver
UPDATE `gameobject_template` SET `flags`=`flags`&~4 WHERE `entry`=@HELM;
DELETE FROM `gameobject_questrelation` WHERE `id`=@HELM;
INSERT INTO `gameobject_questrelation` (`id`,`quest`) VALUES
(@HELM,@QUEST);
DELETE FROM `gameobject_involvedrelation` WHERE `id`=@HELM;
INSERT INTO `gameobject_involvedrelation` (`id`,`quest`) VALUES
(@HELM,@QUEST);
@@ -0,0 +1,3 @@
UPDATE `conditions` SET `SourceTypeOrReferenceId`=13 WHERE `SourceTypeOrReferenceId`=17 AND `SourceGroup`=1;
UPDATE `conditions` SET `ConditionValue2`=1 WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=1323 AND `SourceEntry`=2 AND `ConditionTypeOrReference`=2;
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=1 AND `SourceGroup`=17465 AND `SourceEntry`=22554 AND `ConditionTypeOrReference`=7;
@@ -0,0 +1,7 @@
DELETE FROM `spell_script_names` WHERE `spell_id` in (11885,11886,11887,11888,11889);
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(11885,'spell_item_muisek_vessel'),
(11886,'spell_item_muisek_vessel'),
(11887,'spell_item_muisek_vessel'),
(11888,'spell_item_muisek_vessel'),
(11889,'spell_item_muisek_vessel');
@@ -0,0 +1,10 @@
DELETE FROM `gameobject_loot_template` WHERE `entry` IN (28058,28074,28088,28064,28082,28096) AND `item`=49908;
INSERT INTO `reference_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES
-- Deathbringer's Cache
(28058,49908,20,1,0,1,1), -- Primordial Saronite 10H
(28074,49908,20,1,0,1,1), -- Primordial Saronite 25N
(28088,49908,20,1,0,1,1), -- Primordial Saronite 25H
-- Cache of the Dreamwalker
(28064,49908,20,1,0,1,1), -- Primordial Saronite 10H
(28082,49908,20,1,0,1,1), -- Primordial Saronite 25N
(28096,49908,20,1,0,1,1); -- Primordial Saronite 25H
@@ -0,0 +1,44 @@
-- Fix for quest "You've Really Done It This Time, Kul" 14096 Alliance / 14142 Horde
-- SAI for Black Cage
SET @ENTRY=195310;
UPDATE `gameobject_template` SET `AIName`='SmartGameObjectAI',`ScriptName`='' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE (`entryorguid`=@ENTRY AND `source_type`=1);
DELETE FROM `smart_scripts` WHERE (`entryorguid`=@ENTRY*100 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
(@ENTRY,1,0,0,70,0,100,0,2,0,0,0,80,@ENTRY*100,0,0,0,0,0,1,0,0,0,0,0,0,0,'Black Cage - On activate - Run Script'),
(@ENTRY*100,9,0,0,0,0,100,0,6000,6000,6000,6000,32,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Black Cage - Script - set go state');
-- SAI for Captive Aspirant
SET @ENTRY=34716;
UPDATE `creature_template` SET `AIName`='SmartAI',`ScriptName`='' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE (`entryorguid`=@ENTRY AND `source_type`=0);
DELETE FROM `smart_scripts` WHERE (`entryorguid`=@ENTRY*100 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
(@ENTRY,0,0,0,8,0,100,0,66531,0,0,0,80,@ENTRY*100,0,0,0,0,0,1,0,0,0,0,0,0,0,'Captive Aspirant - On spellhit - Run Script'),
(@ENTRY*100,9,0,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Captive Aspirant - Script - Say random text'),
(@ENTRY*100,9,1,0,0,0,100,0,2000,2000,2000,2000,33,@ENTRY,0,0,0,0,0,7,0,0,0,0,0,0,0,'Captive Aspirant - Script - Kill credit'),
(@ENTRY*100,9,2,0,0,0,100,0,2000,2000,2000,2000,46,10,0,0,0,0,0,1,0,0,0,0,0,0,0,'Captive Aspirant - Script - move 10 yards'),
(@ENTRY*100,9,3,0,0,0,100,0,4000,4000,4000,4000,41,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Captive Aspirant - Script - despawn');
-- SAI for Kul the Reckless
SET @ENTRY=34956;
UPDATE `creature_template` SET `AIName`='SmartAI',`ScriptName`='' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE (`entryorguid`=@ENTRY AND `source_type`=0);
DELETE FROM `smart_scripts` WHERE (`entryorguid`=@ENTRY*100 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
(@ENTRY,0,0,0,8,0,100,0,66531,0,0,0,80,@ENTRY*100,0,0,0,0,0,1,0,0,0,0,0,0,0,'Kul the Reckless - On spellhit - Run Script'),
(@ENTRY*100,9,0,0,0,0,100,0,0,0,0,0,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Kul the Reckless - Script - Say random text'),
(@ENTRY*100,9,1,0,0,0,100,0,2000,2000,2000,2000,33,@ENTRY,0,0,0,0,0,7,0,0,0,0,0,0,0,'Kul the Reckless - Script - Kill credit'),
(@ENTRY*100,9,2,0,0,0,100,0,2000,2000,2000,2000,46,10,0,0,0,0,0,1,0,0,0,0,0,0,0,'Kul the Reckless - Script - move 10 yards'),
(@ENTRY*100,9,3,0,0,0,100,0,4000,4000,4000,4000,41,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Kul the Reckless - Script - despawn');
-- Captive Aspirant & Kul the Reckless text from sniff
DELETE FROM `creature_text` WHERE `entry` IN (34716,34956);
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(34716,0,0, 'Thank you, $c.',12,0,100,5,0,0, 'Captive Aspirant'),
(34716,0,1, 'They''re killing the prisoners! Hurry, help the others.',12,0,100,5,0,0, 'Captive Aspirant'),
(34716,0,2, 'I knew I shouldn''t have come to the tournament!',12,0,100,5,0,0, 'Captive Aspirant'),
(34716,0,3, 'I thought I was going to die in there!',12,0,100,5,0,0, 'Captive Aspirant'),
(34956,0,0, 'They were seconds from strapping me to one of those altars and sucking my soul out. Let''s get out of here!',12,0,100,5,0,0, 'Kul the Reckless');
-- Target conditions for spell 66531
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=13 AND `SourceEntry`=66531;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES
(13,2,66531,0,0,31,3,34716,0,0,0,'','Spell 66531 targets npc 34716 or npc 34956'),
(13,2,66531,0,1,31,3,34956,0,0,0,'','Spell 66531 targets npc 34716 or npc 34956');
@@ -0,0 +1 @@
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_sindragosa_collision_filter';
@@ -0,0 +1,6 @@
DELETE FROM `command` WHERE `name` IN ('group','group leader','group disband','group remove');
INSERT INTO `command` (`name`,`security`,`help`) VALUES
('group', 3, 'Syntax: .group $subcommand\nType .group to see the list of possible subcommands or .help group $subcommand to see info on subcommands'),
('group leader', 3, 'Syntax: .group leader [$characterName]\n\nSets the given character as his group''s leader.'),
('group disband', 3, 'Syntax: .group disband [$characterName]\n\nDisbands the given character''s group.'),
('group remove', 3, 'Syntax: .group remove [$characterName]\n\nRemoves the given character from his group.');
@@ -0,0 +1,28 @@
-- Fix for Quest: 12843 "They Took Our Men!"
-- SAI for Rusty Cage
SET @ENTRY=191544;
UPDATE `gameobject_template` SET `AIName`='SmartGameObjectAI',`ScriptName`='' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE (`entryorguid`=@ENTRY AND `source_type`=1);
DELETE FROM `smart_scripts` WHERE (`entryorguid`=@ENTRY*100 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
(@ENTRY,1,0,1,70,0,100,0,2,0,0,0,45,0,1,0,0,0,0,11,29466,5,0,0,0,0,0,'Rusty Cage - On activate - set data on Goblin Prisoner'),
(@ENTRY,1,1,0,61,0,100,0,0,0,0,0,33,29466,0,0,0,0,0,7,0,0,0,0,0,0,0,'Rusty Cage - On activate - quest credit');
-- SAI for Goblin Prisoner
SET @ENTRY=29466;
UPDATE `creature` SET `modelid`=0,`spawntimesecs`=120,`curhealth`=1 WHERE `id`=29466;
UPDATE `creature_template` SET `AIName`='SmartAI',`ScriptName`='' WHERE `entry`=@ENTRY;
DELETE FROM `smart_scripts` WHERE (`entryorguid`=@ENTRY AND `source_type`=0);
DELETE FROM `smart_scripts` WHERE (`entryorguid`=@ENTRY*100 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
(@ENTRY,0,0,0,11,0,100,1,0,0,0,0,32,0,0,0,0,0,0,15,191544,5,0,0,0,0,0,'Goblin Prisoner - On respawn - reset cage'),
(@ENTRY,0,1,0,38,0,100,0,0,1,0,0,80,@ENTRY*100,0,0,0,0,0,1,0,0,0,0,0,0,0,'Goblin Prisoner - On dataset - Run Script'),
(@ENTRY*100,9,0,0,0,0,100,0,0,0,0,0,45,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Goblin Prisoner - Script - set data 0'),
(@ENTRY*100,9,1,0,0,0,100,0,1000,1000,1000,1000,1,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Goblin Prisoner - Script - Say random text'),
(@ENTRY*100,9,2,0,0,0,100,0,2000,2000,2000,2000,46,10,0,0,0,0,0,1,0,0,0,0,0,0,0,'Goblin Prisoner - Script - move 10 yards'),
(@ENTRY*100,9,3,0,0,0,100,0,4000,4000,4000,4000,41,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Goblin Prisoner - Script - despawn');
-- Goblin Prisoner
DELETE FROM `creature_text` WHERE `entry`=@ENTRY;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(@ENTRY,0,0, 'I can''t believe it! I''m free to go!',12,0,100,5,0,0, 'Goblin Prisoner'),
(@ENTRY,0,1, 'I''m free? I''m free!',12,0,100,5,0,0, 'Goblin Prisoner'),
(@ENTRY,0,2, 'Time to hightail it! Thanks, friend!',12,0,100,5,0,0, 'Goblin Prisoner');
@@ -0,0 +1,13 @@
UPDATE `spell_area` SET `quest_start`=12987,`quest_end`=12987 WHERE `spell`=56305;
DELETE FROM `reference_loot_template` WHERE `entry` IN (28058,28074,28088,28064,28082,28096) AND `item`=49908; -- bad data
DELETE FROM `gameobject_loot_template` WHERE `entry` IN (28058,28074,28088,28064,28082,28096) AND `item`=49908;
INSERT INTO `gameobject_loot_template` (`entry`,`item`,`ChanceOrQuestChance`,`lootmode`,`groupid`,`mincountOrRef`,`maxcount`) VALUES
-- Deathbringer's Cache
(28058,49908,20,1,0,1,1), -- Primordial Saronite 10H
(28074,49908,20,1,0,1,1), -- Primordial Saronite 25N
(28088,49908,20,1,0,1,1), -- Primordial Saronite 25H
-- Cache of the Dreamwalker
(28064,49908,20,1,0,1,1), -- Primordial Saronite 10H
(28082,49908,20,1,0,1,1), -- Primordial Saronite 25N
(28096,49908,20,1,0,1,1); -- Primordial Saronite 25H
@@ -0,0 +1,4 @@
DELETE FROM `spell_script_names` WHERE `spell_id` IN (48018, 48020);
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(48018,'spell_warl_demonic_circle_summon'),
(48020,'spell_warl_demonic_circle_teleport');
@@ -0,0 +1,8 @@
-- Update gold drops in ICC bosses based on old.wowhead.com data
UPDATE `creature_template` SET `mingold`=250000,`maxgold`=300000 WHERE `entry` IN(36612,37957,37958,37959); -- Lord Marrowgar
UPDATE `creature_template` SET `mingold`=175000,`maxgold`=225000 WHERE `entry` IN (36626,37504,37505,37506); -- Festergut
UPDATE `creature_template` SET `mingold`=400000,`maxgold`=500000 WHERE `entry` IN (36627,38390,38549,38550); -- Rotface
UPDATE `creature_template` SET `mingold`=400000,`maxgold`=500000 WHERE `entry` IN (36678,38431,38585,38586); -- Professor Putricide
UPDATE `creature_template` SET `mingold`=300000,`maxgold`=350000 WHERE `entry` IN (37955,38434,38435,38436); -- Blood-Queen Lana'thel
UPDATE `creature_template` SET `mingold`=1330000,`maxgold`=1400000 WHERE `entry` IN (36853,38265,38266,38267); -- Sindragosa
UPDATE `creature_template` SET `mingold`=1300000,`maxgold`=1500000 WHERE `entry` IN (36597,39166,39167,39168); -- The Lich King
@@ -0,0 +1,366 @@
-- Delete unused creature_data rows
DELETE FROM `creature_addon` WHERE `guid` IN (131728,131282,131283,131284,131285,131286,131287,131288,131289,131290,131291,131292,131293,131294,131295,131296,131297,131298,131299,131300,131301,131302,131303,131304,131305,131306,131307,131308,131309,131310,131311,131312,131313,131314,131315,131316,131317,131318,131319,131320,131321,131322,131326,131327,131328,131350,131351,131352,131353,131354,131376,131377,131378,131379,131380,131392,131437,131458,131631,131632,131633,131634,131635,131636,131706,131727,13128,131729,131730,131731);
-- Replace Wintergrasp spawns with properly phased spawns
SET @GUID := 88310;
DELETE FROM `creature` WHERE `id` IN (31841,31842,30400,30499,30489,30869,31036,31051,31052,31054,31108,31109,31153,39172,30870,31053,31091,31101,31102,31106,31107,31151,32294,39173,32296,30488);
INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`) VALUES
-- Taunka Spirit Guide (Horde)
(@GUID+0,31841,571,1,0x00000010,0,0,4318.436,2408.06738,392.675751,6.23082542,120,0,0,1,0,0), -- Eastspark Workshop
(@GUID+1,31841,571,1,0x00000010,0,0,4336.25439,3235.51978,390.334,0.628318548,120,0,0,1,0,0), -- Westspark Workshop
(@GUID+2,31841,571,1,0x00000010,0,0,5104.753,2300.9458,368.568054,0.7330383,120,0,0,1,0,0), -- The Sunken Ring
(@GUID+3,31841,571,1,0x00000010,0,0,5103.133,3462.128,368.568054,5.270895,120,0,0,1,0,0), -- The Chilled Quagmire "Outside broker Temple"
(@GUID+4,31841,571,1,0x00000040,0,0,5537.482,2898.90674,517.2589,4.86946869,120,0,0,1,0,0), -- Fortress
(@GUID+5,31841,571,1,0x00000001,0,0,5031.84131,3710.74878,372.4835,0,120,5,0,1,0,0), -- Horde Landing Zone
-- Dwarven Spirit Guide (Alliance)
(@GUID+6,31842,571,1,0x00000020,0,0,4318.436,2408.06738,392.675751,6.23082542,120,0,0,1,0,0), -- Eastspark Workshop
(@GUID+7,31842,571,1,0x00000020,0,0,4336.25439,3235.51978,390.334,0.628318548,120,0,0,1,0,0), -- Westspark Workshop
(@GUID+8,31842,571,1,0x00000020,0,0,5104.753,2300.9458,368.568054,0.7330383,120,0,0,1,0,0), -- The Sunken Ring
(@GUID+9,31842,571,1,0x00000020,0,0,5103.133,3462.128,368.568054,5.270895,120,0,0,1,0,0), -- The Chilled Quagmire "Outside The Broken Temple"
(@GUID+10,31842,571,1,0x00000080,0,0,5537.482,2898.90674,517.2589,4.86946869,120,0,0,1,0,0), -- Fortress
(@GUID+11,31842,571,1,0x00000001,0,0,5140.7876,2179.12451,390.9512,1.97222209,120,0,0,1,0,0), -- Aliance Landing Zone
-- Goblin Mechanic <Demolisher Engineer> (Horde)
(@GUID+12,30400,571,1,0x00000010,0,0,4964.89,3383.06,382.911,6.12611,180,0,0,1,0,0), -- The Broken Temple
(@GUID+13,30400,571,1,0x00000010,0,0,4939.76,2389.06,326.153,3.26377,180,0,0,1,0,0), -- The Sunken Ring
(@GUID+14,30400,571,1,0x00000010,0,0,4357.67,2357.99,382.007,1.67552,180,0,0,1,0,0), -- Eastspark Workshop
(@GUID+15,30400,571,1,0x00000010,0,0,4354.15,3312.82,378.046,1.67552,180,0,0,1,0,0), -- Westspark Workshop
(@GUID+16,30400,571,1,0x00000040,0,0,5391.61,2707.72,415.051,4.55531,180,0,0,1,0,0), -- Wintergrasp Fortress
(@GUID+17,30400,571,1,0x00000040,0,0,5392.91,2975.26,415.223,4.55531,180,0,0,1,0,0), -- Wintergrasp Fortress
-- Gnomish Engineer <Demolisher Engineer> (Alliance)
(@GUID+18,30499,571,1,0x00000020,0,0,4964.89,3383.06,382.911,6.12611,180,0,0,1,0,0), -- The Broken Temple
(@GUID+19,30499,571,1,0x00000020,0,0,4939.76,2389.06,326.153,3.26377,180,0,0,1,0,0), -- The Sunken Ring
(@GUID+20,30499,571,1,0x00000020,0,0,4357.67,2357.99,382.007,1.67552,180,0,0,1,0,0), -- Eastspark Workshop
(@GUID+21,30499,571,1,0x00000020,0,0,4354.15,3312.82,378.046,1.67552,180,0,0,1,0,0), -- Westspark Workshop
(@GUID+22,30499,571,1,0x00000080,0,0,5391.61,2707.72,415.051,4.55531,180,0,0,1,0,0), -- Wintergrasp Fortress
(@GUID+23,30499,571,1,0x00000080,0,0,5392.91,2975.26,415.223,4.55531,180,0,0,1,0,0), -- Wintergrasp Fortress
-- Alliance NPC's
(@GUID+24,30489,571,1,0x00000080,0,0,5369.973,2874.83081,409.3225,3.12413931,120,0,0,1,0,0), -- Morgan Day <Jewelcrafter>
(@GUID+25,30869,571,1,0x00000001,0,0,5102.75049,2187.82837,365.707855,3.996804,120,0,0,1,0,0), -- Arzo Safeflight <Flight Master>
(@GUID+26,31036,571,1,0x00000040,0,0,5078.281,2183.704,365.028564,1.46607661,120,0,0,1,0,0), -- Commander Zanneth
(@GUID+27,31036,571,1,0x00000080,0,0,5358.641,2841.76416,409.3225,1.13262534,120,0,0,1,0,0),
(@GUID+28,31051,571,1,0x00000040,0,0,5081.697,2173.73,365.8777,0.8552113,120,0,0,1,0,0), -- Sorceress Kaylana <Enchantress>
(@GUID+29,31051,571,1,0x00000080,0,0,5296.869,2887.67114,409.274658,5.60250664,120,0,0,1,0,0),
(@GUID+30,31052,571,1,0x00000040,0,0,5100.06543,2168.89,365.7788,1.97222209,120,0,0,1,0,0), -- Bowyer Randolph
(@GUID+31,31052,571,1,0x00000080,0,0,5302.57373,2750.40332,409.274658,5.46288061,120,0,0,1,0,0),
(@GUID+32,31054,571,1,0x00000040,0,0,5088.611,2167.66235,365.688751,0.6806784,120,0,0,1,0,0), -- Anchorite Tessa
(@GUID+33,31054,571,1,0x00000080,0,0,5372.05859,3028.33618,409.206024,0.012565271,120,0,0,1,0,0),
(@GUID+34,31108,571,1,0x00000040,0,0,5095.673,2193.284,365.9236,4.939282,120,0,0,1,0,0), -- Siege Master Stouthandle
(@GUID+35,31108,571,1,0x00000080,0,0,5298.267,2924.97632,409.274658,0.9075712,120,0,0,1,0,0),
(@GUID+36,31109,571,1,0x00000040,0,0,5080.403,2199.00244,359.4894,2.96705961,120,0,0,1,0,0), -- Senior Demolitionist Legoso
(@GUID+37,31109,571,1,0x00000080,0,0,5228.2915,2809.888,409.274658,3.19395256,120,0,0,1,0,0),
(@GUID+38,31153,571,1,0x00000040,0,0,5088.48633,2188.17871,365.646973,5.253441,120,0,0,1,0,0), -- Tactical Officer Ahbramis
(@GUID+39,31153,571,1,0x00000080,0,0,5364.784,2835.135,409.3225,3.12413931,120,0,0,1,0,0),
(@GUID+40,32294,571,1,0x00000080,0,0,5374.568,2790.784,409.3225,2.72271371,120,0,0,1,0,0), -- Knight Dameron <Wintergrasp Quartermaster>
(@GUID+41,39172,571,1,0x00000080,0,0,5372.672,2786.74048,409.4423,2.80998015,120,0,0,1,0,0), -- Marshal Magruder <Wintergrasp Quartermaster>
(@GUID+42,30488,571,1,0x00000080,0,0,5370.428,2814.274,409.3225,3.054326,120,0,0,1,0,0), -- Travis Day <Legacy Weaponsmith>
-- Horde NPC's
(@GUID+43,30870,571,1,0x00000001,0,0,5023.4043,3686.03345,363.1192,5.131268,120,0,0,1,0,0), -- Herzo Safeflight <Flight Master>
(@GUID+44,31053,571,1,0x00000040,0,0,5379.875,3027.43359,409.206024,0,120,0,0,1,0,0), -- Primalist Mulfort
(@GUID+45,31053,571,1,0x00000080,0,0,5034.703125,3666.703125,363.273865,4.310963,120,0,0,1,0,0),
(@GUID+46,31091,571,1,0x00000040,0,0,5347.7915,2837.38574,409.3466,2.62603331,120,0,0,1,0,0), -- Commander Dardosh
(@GUID+47,31091,571,1,0x00000080,0,0,5018.662109,3672.279541,362.862885,2.209141,120,0,0,1,0,0),
(@GUID+48,31101,571,1,0x00000040,0,0,5296.564,2789.87378,409.274658,0.7330383,120,0,0,1,0,0), -- Hoodoo Master Fu'jin <Master Hexxer>
(@GUID+49,31101,571,1,0x00000080,0,0,5014.065430,3678.846436,362.995575,5.096361,120,0,0,1,0,0),
(@GUID+50,31102,571,1,0x00000040,0,0,5295.455,2732.87549,409.274658,4.7211113,120,0,0,1,0,0), -- Vieron Blazefeather
(@GUID+51,31102,571,1,0x00000080,0,0,5031.676270,3655.820801,362.234558,5.131268,120,0,0,1,0,0),
(@GUID+52,31106,571,1,0x00000040,0,0,5295.56348,2926.67188,409.274658,0.87266463,120,0,0,1,0,0), -- Siegesmith Stronghoof
(@GUID+53,31106,571,1,0x00000080,0,0,5037.602051,3675.459717,363.147888,3.176499,120,0,0,1,0,0),
(@GUID+54,31107,571,1,0x00000040,0,0,5230.09033,2876.635,409.316254,-2.19854617,120,0,0,1,0,0), -- Lieutenant Murp
(@GUID+55,31107,571,1,0x00000080,0,0,5004.455078,3661.089111,361.335785,3.979351,120,0,0,1,0,0),
(@GUID+56,31151,571,1,0x00000040,0,0,5363.2876,2834.52954,409.3606,2.76273036,120,0,0,1,0,0), -- Tactical Officer Kilrath
(@GUID+57,31151,571,1,0x00000080,0,0,5034.698242,3683.268799,363.129120,4.310963,120,0,0,1,0,0),
(@GUID+58,32296,571,1,0x00000040,0,0,5374.568,2790.784,409.3225,2.60054,120,0,0,1,0,0), -- Stone Guard Mukar <Wintergrasp Quartermaster>
-- Missing noc in fortress
(@GUID+60,39173,571,1,0x00000040,0,0,5372.672,2786.74048,409.4423,2.80998015,120,0,0,1,0,0); -- Champion Ros'slai <Wintergrasp Quartermaster>
-- corrects previously inserted creature
UPDATE `creature` SET `spawndist`=0 WHERE `guid`=88315;
-- Pathing for Anchorite Tessa Entry: 31054
SET @NPC := @GUID+33;
SET @PATH := @NPC * 10;
UPDATE `creature` SET `MovementType`=2 WHERE `guid`=@NPC;
DELETE FROM `creature_addon` WHERE `guid`=@NPC;
INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,1,0, '');
DELETE FROM `waypoint_data` WHERE `id`=@PATH;
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES
(@PATH,1,5382.507,3028.468,409.206,0,0,0,100,0),
(@PATH,2,5392.744,3028.737,409.206,0,0,0,100,0),
(@PATH,3,5382.507,3028.468,409.206,0,0,0,100,0),
(@PATH,4,5371.491,3028.329,409.206,0,0,0,100,0),
(@PATH,5,5360.032,3028.516,409.3161,0,0,0,100,0),
(@PATH,6,5371.491,3028.329,409.206,0,0,0,100,0);
-- Pathing for Commander Zanneth Entry: 31036
SET @NPC := @GUID+27;
SET @PATH := @NPC * 10;
UPDATE `creature` SET `spawndist`=0,`MovementType`=2,`position_x`=5358.854,`position_y`=2859.232,`position_z`=409.5425 WHERE `guid`=@NPC;
DELETE FROM `creature_addon` WHERE `guid`=@NPC;
INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,1,14337, '');
DELETE FROM `waypoint_data` WHERE `id`=@PATH;
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES
(@PATH,1,5359.788,2846.359,409.3642,0,0,0,100,0),
(@PATH,2,5359.187,2839.211,409.3642,0,0,0,100,0),
(@PATH,3,5360.083,2823.116,409.5381,0,0,0,100,0),
(@PATH,4,5359.187,2839.211,409.3642,0,0,0,100,0),
(@PATH,5,5359.788,2846.359,409.3642,0,0,0,100,0),
(@PATH,6,5358.854,2859.232,409.5425,0,0,0,100,0);
-- Pathing for Commander Dardosh Entry: 31091
SET @NPC := @GUID+46;
SET @PATH := @NPC * 10;
UPDATE `creature` SET `MovementType`=2,`position_x`=5359.546,`position_y`=2858.049,`position_z`=409.3642 WHERE `guid`=@NPC;
DELETE FROM `creature_addon` WHERE `guid`=@NPC;
INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,257,0, '');
DELETE FROM `waypoint_data` WHERE `id`=@PATH;
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES
(@PATH,1,5359.202,2843.208,409.3642,0,0,0,100,0),
(@PATH,2,5358.997,2827.974,409.3639,0,0,0,100,0),
(@PATH,3,5359.202,2843.208,409.3642,0,0,0,100,0),
(@PATH,4,5359.546,2858.049,409.3642,0,0,0,100,0);
-- Pathing for Commander Dardosh Entry: 31091
SET @NPC := @GUID+47;
SET @PATH := @NPC * 10;
UPDATE `creature` SET `MovementType`=2,`position_x`=5018.411133,`position_y`=3672.615967,`position_z`=362.863525 WHERE `guid`=@NPC;
DELETE FROM `creature_addon` WHERE `guid`=@NPC;
INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,257,0, '');
DELETE FROM `waypoint_data` WHERE `id`=@PATH;
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES
(@PATH,1,5022.827637,3666.665771,362.205750,0,0,0,100,0),
(@PATH,2,5024.270508,3658.739258,361.705750,0,0,0,100,0),
(@PATH,3,5022.827637,3666.665771,362.205750,0,0,0,100,0),
(@PATH,4,5018.411133,3672.615967,362.863525,0,0,0,100,0);
-- Pathing for Primalist Mulfort Entry: 31053
SET @NPC := @GUID+44;
SET @PATH := @NPC * 10;
UPDATE `creature` SET `MovementType`=2 WHERE `guid`=@NPC;
DELETE FROM `creature_addon` WHERE `guid`=@NPC;
INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,257,0, '');
DELETE FROM `waypoint_data` WHERE `id`=@PATH;
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES
(@PATH,1,5390.624,3027.994,409.206,0,0,0,100,0),
(@PATH,2,5379.875,3027.434,409.206,0,0,0,100,0),
(@PATH,3,5371.404,3026.511,409.206,0,0,0,100,0),
(@PATH,4,5379.875,3027.434,409.206,0,0,0,100,0);
-- Pathing for Vieron Blazefeather Entry: 31102
SET @NPC := @GUID+50;
SET @PATH := @NPC * 10;
UPDATE `creature` SET `MovementType`=2,`position_x`=5296.644,`position_y`=2731.107,`position_z`=409.3163 WHERE `guid`=@NPC;
DELETE FROM `creature_addon` WHERE `guid`=@NPC;
INSERT INTO `creature_addon` (`guid`,`path_id`,`bytes2`,`mount`,`auras`) VALUES (@NPC,@PATH,1,0, '');
DELETE FROM `waypoint_data` WHERE `id`=@PATH;
INSERT INTO `waypoint_data` (`id`,`point`,`position_x`,`position_y`,`position_z`,`delay`,`move_flag`,`action`,`action_chance`,`wpguid`) VALUES
(@PATH,1,5295.544,2722.631,409.3163,0,0,0,100,0),
(@PATH,2,5296.644,2731.107,409.3163,0,0,0,100,0),
(@PATH,3,5297.874,2738.155,409.3163,0,0,0,100,0),
(@PATH,4,5305.192,2746.161,409.3061,0,0,0,100,0),
(@PATH,5,5297.874,2738.155,409.3163,0,0,0,100,0),
(@PATH,6,5296.644,2731.107,409.3163,0,0,0,100,0);
-- Guards "Alliance" (Valiance Expedition Champion)
SET @GUID := 88371;
DELETE FROM `creature` WHERE `id`=30740;
INSERT INTO `creature` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`modelid`,`equipment_id`,`position_x`,`position_y`,`position_z`,`orientation`,`spawntimesecs`,`spawndist`,`currentwaypoint`,`curhealth`,`curmana`,`MovementType`) VALUES
-- Fortress
(@GUID+0,30740,571,1,0x00000080,0,0,5150.26855,2786.02173,409.5469,3.22885919,120,0,0,1,0,0),
(@GUID+1,30740,571,1,0x00000080,0,0,5150.657,2777.9502,409.4053,2.94960642,120,0,0,1,0,0),
(@GUID+2,30740,571,1,0x00000080,0,0,5193.632,2734.172,409.272552,4.694936,120,0,0,1,0,0),
(@GUID+3,30740,571,1,0x00000080,0,0,5200.497,2733.88843,409.272552,4.677482,120,0,0,1,0,0),
(@GUID+4,30740,571,1,0x00000080,0,0,5264.64648,2670.1936,409.1819,3.07177949,120,0,0,1,0,0),
(@GUID+5,30740,571,1,0x00000080,0,0,5265.30566,2663.15381,409.1819,3.12413931,120,0,0,1,0,0),
(@GUID+6,30740,571,1,0x00000080,0,0,5307.02051,2613.89771,409.172363,4.694936,120,0,0,1,0,0),
(@GUID+7,30740,571,1,0x00000080,0,0,5311.133,3061.04248,408.809937,1.50098312,120,0,0,1,0,0),
(@GUID+8,30740,571,1,0x00000080,0,0,5315.87354,2614.21924,408.972748,4.677482,120,0,0,1,0,0),
(@GUID+9,30740,571,1,0x00000080,0,0,5318.09,3060.634,408.882782,1.62315619,120,0,0,1,0,0),
(@GUID+10,30740,571,1,0x00000080,0,0,5149.395,2897.044,409.304443,3.03687286,120,0,0,1,0,0),
(@GUID+11,30740,571,1,0x00000080,0,0,5149.51953,2904.19336,409.276062,3.07177949,120,0,0,1,0,0),
(@GUID+12,30740,571,1,0x00000080,0,0,5192.79248,2948.454,409.2746,1.50098312,120,0,0,1,0,0),
(@GUID+13,30740,571,1,0x00000080,0,0,5201.645,2948.77612,409.2746,1.62315619,120,0,0,1,0,0),
(@GUID+14,30740,571,1,0x00000080,0,0,5265.28,3010.10083,408.895782,2.82743335,120,0,0,1,0,0),
(@GUID+15,30740,571,1,0x00000080,0,0,5265.47559,3017.39941,408.582977,3.07177949,120,0,0,1,0,0),
(@GUID+16,30740,571,1,0x00000080,0,0,5367.91455,2826.52026,409.3225,3.33357882,120,0,0,1,0,0),
(@GUID+17,30740,571,1,0x00000080,0,0,5368.71338,2856.36035,409.3225,2.94960642,120,0,0,1,0,0),
(@GUID+18,30740,571,1,0x00000080,0,0,5388.56,2834.76782,418.7585,3.07177949,120,0,0,1,0,0),
(@GUID+19,30740,571,1,0x00000080,0,0,5389.272,2847.36816,418.7585,3.106686,120,0,0,1,0,0),
(@GUID+20,30740,571,1,0x00000080,0,0,4684.475,2414.28979,369.9621,-2.85779858,120,0,0,1,0,0),
(@GUID+21,30740,571,1,0x00000080,0,0,4692.75635,2392.88574,369.0177,-2.82921553,120,0,0,1,0,0),
(@GUID+22,30740,571,1,0x00000080,0,0,5327.264648,2659.455322,409.178711,3.069901,120,0,0,1,0,0), -- F1307814000A2DAD path
(@GUID+23,30740,571,1,0x00000080,0,0,5154.225586,2833.824219,409.262451,3.124139,120,0,0,1,0,0),
(@GUID+24,30740,571,1,0x00000080,0,0,5154.119629,2847.892822,409.247559,3.071779,120,0,0,1,0,0),
(@GUID+25,30740,571,1,0x00000080,0,0,5179.111328,2837.129639,409.274658,3.211406,120,0,0,1,0,0),
(@GUID+26,30740,571,1,0x00000080,0,0,5179.666504,2846.597900,409.274658,3.089233,120,0,0,1,0,0),
(@GUID+27,30740,571,1,0x00000080,0,0,5270.163086,2833.479248,409.274658,3.124139,120,0,0,1,0,0),
(@GUID+28,30740,571,1,0x00000080,0,0,5270.057129,2847.547607,409.274658,3.071779,120,0,0,1,0,0),
(@GUID+29,30740,571,1,0x00000080,0,0,5307.750000,3008.872559,409.193024,4.781681,120,0,0,1,0,0), -- F1307814000A43AE path
(@GUID+30,30740,571,1,0x00000080,0,0,5335.117188,2916.802002,409.443756,1.500983,120,0,0,1,0,0),
(@GUID+31,30740,571,1,0x00000080,0,0,5350.681152,2917.011719,409.274658,1.466077,120,0,0,1,0,0),
(@GUID+32,30740,571,1,0x00000080,0,0,5335.306152,2764.110352,409.274567,4.834562,120,0,0,1,0,0),
(@GUID+33,30740,571,1,0x00000080,0,0,5349.811523,2763.634766,409.333374,4.660029,120,0,0,1,0,0),
-- Eastspark Workshop
(@GUID+34,30740,571,1,0x00000080,0,0,4349.537,2411.25781,374.743317,2.05948853,120,0,0,1,0,0),
(@GUID+35,30740,571,1,0x00000080,0,0,4388.13135,2411.97827,374.743317,1.6406095,120,0,0,1,0,0),
(@GUID+36,30740,571,1,0x00000080,0,0,4391.6665,2300.60913,374.7433,4.92182827,120,0,0,1,0,0),
(@GUID+37,30740,571,1,0x00000080,0,0,4413.42969,2393.44946,376.3599,1.06465089,120,0,0,1,0,0),
(@GUID+38,30740,571,1,0x00000080,0,0,4417.92,2331.237,370.9189,5.846853,120,0,0,1,0,0),
(@GUID+39,30740,571,1,0x00000080,0,0,4349.11768,2299.27954,374.7433,4.904375,120,0,0,1,0,0),
(@GUID+40,30740,571,1,0x00000080,0,0,4418.608,2355.28735,372.4907,6.02138567,120,0,0,1,0,0);
-- banners
SET @OGUID := 75939;
DELETE FROM `gameobject` WHERE `id` IN (192254,192255,192269,192284,192285,192286,192287,192292,192299,192304,192305,192306,192307,192308,192309,192310,192312,192313,192314,192316,192317,192318,192319,192320,192321,
192322,192323,192324,192325,192326,192327,192328,192329,192330,192331,192332,192333,192334,192335,192336,192338,192339,192349,192350,192351,192352,192353,192354,192355,192356,
192357,192358,192359,192360,192361,192362,192363,192364,192366,192367,192368,192369,192370,192371,192372,192373,192374,192375,192376,192377,192378,192379,192487,192488,192501,
192502);
DELETE FROM `gameobject` WHERE `guid` BETWEEN @OGUID AND @OGUID+115;
INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES
-- Fortress Banners "Alliance"
(@OGUID+0,192286,571,1,128,5371.44873,2820.79346,409.426575,3.124123,0,0,0,0,120,0,1),
(@OGUID+1,192287,571,1,128,5372.42432,2862.47925,409.3659,3.14159274,0,0,0,0,120,0,1),
(@OGUID+2,192292,571,1,128,5154.35059,2862.08423,445.0105,3.14159274,0,0,0,0,120,0,1),
(@OGUID+3,192299,571,1,128,5155.21631,2820.63013,444.9789,-3.115388,0,0,0,0,120,0,1),
(@OGUID+4,192304,571,1,128,5398.03564,2873.013,455.203552,3.132858,0,0,0,0,120,0,1),
(@OGUID+5,192305,571,1,128,5397.31348,2809.264,455.101624,3.132858,0,0,0,0,120,0,1),
(@OGUID+6,192306,571,1,128,5270.55469,2861.68237,444.917236,-3.124123,0,0,0,0,120,0,1),
(@OGUID+7,192307,571,1,128,5271.16064,2820.10864,445.109,-3.132858,0,0,0,0,120,0,1),
(@OGUID+8,192308,571,1,128,5235.12744,2942.12329,444.2792,1.58824873,0,0,0,0,120,0,1),
(@OGUID+9,192309,571,1,128,5272.549,2976.54175,444.493,3.132858,0,0,0,0,120,0,1),
(@OGUID+10,192310,571,1,128,5352.19775,3055.0166,444.5646,1.57952213,0,0,0,0,120,0,1),
(@OGUID+11,192312,571,1,128,5236.315,2739.21533,444.992828,-1.60570168,0,0,0,0,120,0,1),
(@OGUID+12,192313,571,1,128,5271.634,2704.829,445.182617,-3.124123,0,0,0,0,120,0,1),
(@OGUID+13,192314,571,1,128,5350.905,2622.48,444.649323,-1.56206989,0,0,0,0,120,0,1),
(@OGUID+14,192316,571,1,128,5322.013,2781.13281,435.6727,1.57952213,0,0,0,0,120,0,1),
(@OGUID+15,192317,571,1,128,5363.387,2781.27856,435.634125,1.58824873,0,0,0,0,120,0,1),
(@OGUID+16,192318,571,1,128,5322.24854,2898.94629,435.642975,-1.57952213,0,0,0,0,120,0,1),
(@OGUID+17,192319,571,1,128,5364.30371,2899.216,435.690826,-1.55334139,0,0,0,0,120,0,1),
(@OGUID+18,192320,571,1,128,5289.048,2820.22656,435.6738,0,0,0,0,0,120,0,1),
(@OGUID+19,192321,571,1,128,5288.847,2861.82128,435.590485,0.0261791088,0,0,0,0,120,0,1),
(@OGUID+20,192322,571,1,128,5322.89258,2917.14233,445.1543,1.56206989,0,0,0,0,120,0,1),
(@OGUID+21,192323,571,1,128,5364.283,2917.264,445.332184,1.58824611,0,0,0,0,120,0,1),
(@OGUID+22,192324,571,1,128,5290.514,2976.56177,435.087463,0.008724241,0,0,0,0,120,0,1),
(@OGUID+23,192325,571,1,128,5352.37744,3036.95483,435.111053,-1.56206989,0,0,0,0,120,0,1),
(@OGUID+24,192326,571,1,128,5392.64063,3036.967,433.648682,-1.51843357,0,0,0,0,120,0,1),
(@OGUID+25,192327,571,1,128,5172.336,2862.57544,435.65802,0,0,0,0,0,120,0,1),
(@OGUID+26,192328,571,1,128,5173.12842,2820.95654,435.657623,0.0261791088,0,0,0,0,120,0,1),
(@OGUID+27,192329,571,1,128,5235.32227,2924.31079,434.8981,-1.56206989,0,0,0,0,120,0,1),
(@OGUID+28,192330,571,1,128,5237.02344,2757.35669,435.625641,1.55334139,0,0,0,0,120,0,1),
(@OGUID+29,192331,571,1,128,5289.78125,2704.62158,435.714325,0.008724241,0,0,0,0,120,0,1),
(@OGUID+30,192332,571,1,128,5350.93945,2640.43066,435.2642,1.56206989,0,0,0,0,120,0,1),
(@OGUID+31,192333,571,1,128,5392.28027,2639.84033,435.207916,1.52716041,0,0,0,0,120,0,1),
(@OGUID+32,192334,571,1,128,5322.17041,2763.20142,444.9744,-1.56206715,0,0,0,0,120,0,1),
(@OGUID+33,192335,571,1,128,5363.71631,2763.24731,445.023132,-1.54461551,0,0,0,0,120,0,1),
(@OGUID+34,192487,571,1,128,5145.11133,2934.948,433.254852,-3.10665226,0,0,0,0,120,0,1),
(@OGUID+35,192487,571,1,128,5146.04443,2747.30249,433.527039,3.124123,0,0,0,0,120,0,1),
(@OGUID+36,192487,571,1,128,5158.71,2882.90161,431.27417,3.14159274,0,0,0,0,120,0,1),
(@OGUID+37,192487,571,1,128,5160.28369,2798.59766,430.6037,-3.124123,0,0,0,0,120,0,1),
(@OGUID+38,192487,571,1,128,5162.90674,2952.59766,433.368,1.57079577,0,0,0,0,120,0,1),
(@OGUID+39,192487,571,1,128,5163.85,2729.677,433.327545,-1.60570168,0,0,0,0,120,0,1),
(@OGUID+40,192487,571,1,128,5260.82471,2631.81763,433.181061,3.124123,0,0,0,0,120,0,1),
(@OGUID+41,192487,571,1,128,5262.544,3047.93018,431.96524,3.124123,0,0,0,0,120,0,1),
(@OGUID+42,192487,571,1,128,5278.43066,2613.83276,433.294434,-1.62315571,0,0,0,0,120,0,1),
(@OGUID+43,192487,571,1,128,5280.894,3064.95386,431.9758,1.55334139,0,0,0,0,120,0,1),
-- Fortress Banners "Horde"
(@OGUID+44,192269,571,1,64,4526.46,2810.18,391.2,-2.99322,0,0,0,1,180,0,1),
(@OGUID+45,192284,571,1,64,5372.48,2862.5,409.049,3.14159,0,0,0,1,180,0,1),
(@OGUID+46,192285,571,1,64,5371.49,2820.8,409.177,3.14159,0,0,0,1,180,0,1),
(@OGUID+47,192338,571,1,64,5397.76,2873.08,455.461,3.10665,0,0,0,1,180,0,1),
(@OGUID+48,192339,571,1,64,5397.39,2809.33,455.344,3.10665,0,0,0,1,180,0,1),
(@OGUID+49,192349,571,1,64,5155.31,2820.74,444.979,-3.13286,0,0,0,1,180,0,1),
(@OGUID+50,192350,571,1,64,5270.69,2861.78,445.058,-3.11539,0,0,0,1,180,0,1),
(@OGUID+51,192351,571,1,64,5271.28,2820.16,445.201,-3.13286,0,0,0,1,180,0,1),
(@OGUID+52,192352,571,1,64,5173.02,2820.93,435.72,0.017452,0,0,0,1,180,0,1),
(@OGUID+53,192353,571,1,64,5172.11,2862.57,435.721,0.017452,0,0,0,1,180,0,1),
(@OGUID+54,192354,571,1,64,5288.41,2861.79,435.721,0.017452,0,0,0,1,180,0,1),
(@OGUID+55,192355,571,1,64,5288.92,2820.22,435.721,0.017452,0,0,0,1,180,0,1),
(@OGUID+56,192356,571,1,64,5237.07,2757.03,435.796,1.51844,0,0,0,1,180,0,1),
(@OGUID+57,192357,571,1,64,5235.34,2924.34,435.04,-1.5708,0,0,0,1,180,0,1),
(@OGUID+58,192358,571,1,64,5322.23,2899.43,435.808,-1.58825,0,0,0,1,180,0,1),
(@OGUID+59,192359,571,1,64,5364.35,2899.4,435.839,-1.5708,0,0,0,1,180,0,1),
(@OGUID+60,192360,571,1,64,5352.37,3037.09,435.252,-1.5708,0,0,0,1,180,0,1),
(@OGUID+61,192361,571,1,64,5392.65,3037.11,433.713,-1.52716,0,0,0,1,180,0,1),
(@OGUID+62,192362,571,1,64,5322.12,2763.61,444.974,-1.55334,0,0,0,1,180,0,1),
(@OGUID+63,192363,571,1,64,5363.61,2763.39,445.024,-1.54462,0,0,0,1,180,0,1),
(@OGUID+64,192364,571,1,64,5350.88,2622.72,444.686,-1.5708,0,0,0,1,180,0,1),
(@OGUID+65,192366,571,1,64,5236.27,2739.46,444.992,-1.59698,0,0,0,1,180,0,1),
(@OGUID+66,192367,571,1,64,5271.8,2704.87,445.183,-3.13286,0,0,0,1,180,0,1),
(@OGUID+67,192368,571,1,64,5289.46,2704.68,435.875,-0.017451,0,0,0,1,180,0,1),
(@OGUID+68,192369,571,1,64,5350.95,2640.36,435.408,1.5708,0,0,0,1,180,0,1),
(@OGUID+69,192370,571,1,64,5392.27,2639.74,435.331,1.50971,0,0,0,1,180,0,1),
(@OGUID+70,192371,571,1,64,5364.29,2916.94,445.331,1.57952,0,0,0,1,180,0,1),
(@OGUID+71,192372,571,1,64,5322.86,2916.95,445.154,1.56207,0,0,0,1,180,0,1),
(@OGUID+72,192373,571,1,64,5290.35,2976.56,435.221,0.017452,0,0,0,1,180,0,1),
(@OGUID+73,192374,571,1,64,5272.94,2976.55,444.492,3.12412,0,0,0,1,180,0,1),
(@OGUID+74,192375,571,1,64,5235.19,2941.9,444.278,1.58825,0,0,0,1,180,0,1),
(@OGUID+75,192376,571,1,64,5352.19775,3055.0166,444.5646,1.57952,0,0,0,0,120,0,1),
(@OGUID+76,192377,571,1,64,5414.19,3069.8,415.187,1.64061,0,0,0,1,180,0,1),
(@OGUID+77,192378,571,1,64,5322.02,2781.13,435.811,1.5708,0,0,0,1,180,0,1),
(@OGUID+78,192379,571,1,64,5363.42,2781.03,435.763,1.5708,0,0,0,1,180,0,1),
(@OGUID+79,192254,571,1,64,5154.46,2828.94,409.189,3.14159,0,0,0,1,180,0,1),
(@OGUID+80,192255,571,1,64,5154.52,2853.31,409.183,3.14159,0,0,0,1,180,0,1),
(@OGUID+81,192336,571,1,64,5154.49,2862.15,445.012,3.14159,0,0,0,1,180,0,1),
(@OGUID+82,192488,571,1,64,5160.34,2798.61,430.769,3.14159,0,0,0,1,180,0,1),
(@OGUID+83,192488,571,1,64,5158.81,2883.13,431.618,3.14159,0,0,0,1,180,0,1),
(@OGUID+84,192488,571,1,64,5278.38,2613.83,433.409,-1.58825,0,0,0,1,180,0,1),
(@OGUID+85,192488,571,1,64,5260.82,2631.8,433.324,3.05433,0,0,0,1,180,0,1),
(@OGUID+86,192488,571,1,64,5163.13,2952.59,433.503,1.53589,0,0,0,1,180,0,1),
(@OGUID+87,192488,571,1,64,5145.11,2935,433.386,3.14159,0,0,0,1,180,0,1),
(@OGUID+88,192488,571,1,64,5262.54,3047.95,432.055,3.10665,0,0,0,1,180,0,1),
(@OGUID+89,192488,571,1,64,5146.04,2747.21,433.584,3.07177,0,0,0,1,180,0,1),
(@OGUID+90,192488,571,1,64,5163.78,2729.68,433.394,-1.58825,0,0,0,1,180,0,1),
(@OGUID+91,192488,571,1,64,5280.894,3064.95386,431.9758,1.55334139,0,0,0,0,120,0,1),
-- Tower Banners "Alliance"
(@OGUID+92,192501,571,1,64,4398.82,2804.7,429.792,-1.58825,0,0,0,1,180,0,1),
(@OGUID+93,192501,571,1,64,4416,2822.67,429.851,-0.017452,0,0,0,1,180,0,1),
(@OGUID+94,192501,571,1,64,4559.11,3606.22,419.999,-1.48353,0,0,0,1,180,0,1),
(@OGUID+95,192501,571,1,64,4539.42,3622.49,420.034,-3.07177,0,0,0,1,180,0,1),
(@OGUID+96,192501,571,1,64,4555.26,3641.65,419.974,1.67551,0,0,0,1,180,0,1),
(@OGUID+97,192501,571,1,64,4574.87,3625.91,420.079,0.087266,0,0,0,1,180,0,1),
(@OGUID+98,192501,571,1,64,4466.79,1960.42,459.144,1.15192,0,0,0,1,180,0,1),
(@OGUID+99,192501,571,1,64,4475.35,1937.03,459.07,-0.436332,0,0,0,1,180,0,1),
(@OGUID+100,192501,571,1,64,4451.76,1928.1,459.076,-2.00713,0,0,0,1,180,0,1),
(@OGUID+101,192501,571,1,64,4442.99,1951.9,459.093,2.74016,0,0,0,1,180,0,1),
(@OGUID+102,192501,571,1,64,4380.36328,2822.38013,429.8818,-3.106652,0,0,0,0,120,0,1),
(@OGUID+103,192501,571,1,64,4397.6626,2840.299,429.921661,1.58824873,0,0,0,0,120,0,1),
-- Tower Banners "Horde"
(@OGUID+104,192502,571,1,128,4398.82,2804.7,429.792,-1.58825,0,0,0,1,180,0,1),
(@OGUID+105,192502,571,1,128,4416,2822.67,429.851,-0.017452,0,0,0,1,180,0,1),
(@OGUID+106,192502,571,1,128,4559.11,3606.22,419.999,-1.48353,0,0,0,1,180,0,1),
(@OGUID+107,192502,571,1,128,4539.42,3622.49,420.034,-3.07177,0,0,0,1,180,0,1),
(@OGUID+108,192502,571,1,128,4555.26,3641.65,419.974,1.67551,0,0,0,1,180,0,1),
(@OGUID+109,192502,571,1,128,4574.87,3625.91,420.079,0.087266,0,0,0,1,180,0,1),
(@OGUID+110,192502,571,1,128,4466.79,1960.42,459.144,1.15192,0,0,0,1,180,0,1),
(@OGUID+111,192502,571,1,128,4475.35,1937.03,459.07,-0.436332,0,0,0,1,180,0,1),
(@OGUID+112,192502,571,1,128,4451.76,1928.1,459.076,-2.00713,0,0,0,1,180,0,1),
(@OGUID+113,192502,571,1,128,4442.99,1951.9,459.093,2.74016,0,0,0,1,180,0,1),
(@OGUID+114,192502,571,1,128,4380.36328,2822.38013,429.8818,-3.106652,0,0,0,0,120,0,1),
(@OGUID+115,192502,571,1,128,4397.6626,2840.299,429.921661,1.58824873,0,0,0,0,120,0,1);
SET @OGUID := 17780;
DELETE FROM `gameobject` WHERE `id` IN (192458,192459,192460,192461,192289,192290,192434,192435,192280,192283,192425,192426,192427,192428,192288,192291,192400,192401,192281,192282);
INSERT INTO `gameobject` (`guid`,`id`,`map`,`spawnMask`,`phaseMask`,`position_x`,`position_y`,`position_z`,`orientation`,`rotation0`,`rotation1`,`rotation2`,`rotation3`,`spawntimesecs`,`animprogress`,`state`) VALUES
-- The Sunken Ring "Horde"
(@OGUID+0,192458,571,1,16,4811.4,2441.9,358.207,-2.0333,0,0,0,1,180,0,1),
(@OGUID+1,192459,571,1,16,4805.67,2407.48,358.191,1.78023,0,0,0,1,180,0,1),
(@OGUID+2,192460,571,1,16,5004.35,2486.36,358.449,2.17294,0,0,0,1,180,0,1),
(@OGUID+3,192461,571,1,16,4983.28,2503.09,358.177,-0.427603,0,0,0,1,180,0,1),
(@OGUID+4,192289,571,1,16,4778.19,2438.06,345.644,-2.94088,0,0,0,1,180,0,1),
(@OGUID+5,192290,571,1,16,5024.57,2532.75,344.023,-1.93732,0,0,0,1,180,0,1),
-- The Sunken Ring "Alliance"
(@OGUID+6,192425,571,1,32,4811.435,2441.84546,357.982483,-2.02457881,0,0,0,0,120,0,1),
(@OGUID+7,192426,571,1,32,4805.514,2407.84375,357.940765,1.7715075,0,0,0,0,120,0,1),
(@OGUID+8,192427,571,1,32,5004.35,2486.36,358.449,2.17294,0,0,0,1,180,0,1),
(@OGUID+9,192428,571,1,32,4983.221,2503.27271,357.959534,-0.43633157,0,0,0,0,120,0,1),
(@OGUID+10,192288,571,1,32,4778.065,2438.02441,345.7063,-2.932139,0,0,0,0,120,0,1),
(@OGUID+11,192291,571,1,32,5024.608,2532.72583,344.4308,-1.94604158,0,0,0,0,120,0,1),
-- The Broken Temple "Horde"
(@OGUID+12,192434,571,1,16,5041.61,3294.4,382.15,-1.63188,0,0,0,1,180,0,1),
(@OGUID+13,192435,571,1,16,4855.63,3297.62,376.739,-3.13286,0,0,0,1,180,0,1),
(@OGUID+14,192280,571,1,16,4857.97,3335.44,368.881,-2.94959,0,0,0,1,180,0,1),
(@OGUID+15,192283,571,1,16,5006.34,3280.4,371.163,2.22529,0,0,0,1,180,0,1),
-- The Broken Temple "Alliance"
(@OGUID+16,192400,571,1,32,5041.650879,3294.318604,381.919952,-1.605702,0,0,0,1,180,0,1),
(@OGUID+17,192401,571,1,32,4855.444336,3297.600830,376.495758,-3.115388,0,0,0,1,180,0,1),
(@OGUID+18,192281,571,1,32,4857.971191,3335.415771,369.291901,-2.888511,0,0,0,1,180,0,1),
(@OGUID+19,192282,571,1,32,5006.322754,3280.362061,371.242249,2.242746,0,0,0,1,180,0,1);
@@ -0,0 +1,126 @@
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=18 AND `SourceGroup` IN(34125,33796,33798,33799,33791,33792,33790,
33795,33793,33800,33794,33843,33842,26421,26477,28161,29856,32788,32790);
INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,
`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`Comment`) VALUES
-- Stabled Campagin Warhorse Requires Any of the Dailies
(18,34125,63215,1,9,0,13847,0,0,0,'Required quest active for spellclick'),
(18,34125,63215,2,9,0,13851,0,0,0,'Required quest active for spellclick'),
(18,34125,63215,3,9,0,13852,0,0,0,'Required quest active for spellclick'),
(18,34125,63215,4,9,0,13854,0,0,0,'Required quest active for spellclick'),
(18,34125,63215,5,9,0,13855,0,0,0,'Required quest active for spellclick'),
(18,34125,63215,6,9,0,13856,0,0,0,'Required quest active for spellclick'),
(18,34125,63215,7,9,0,13857,0,0,0,'Required quest active for spellclick'),
(18,34125,63215,8,9,0,13858,0,0,0,'Required quest active for spellclick'),
(18,34125,63215,9,9,0,13859,0,0,0,'Required quest active for spellclick'),
(18,34125,63215,10,9,0,13860,0,0,0,'Required quest active for spellclick'),
(18,34125,63215,11,9,0,13861,0,0,0,'Required quest active for spellclick'),
(18,34125,63215,12,9,0,13862,0,0,0,'Required quest active for spellclick'),
(18,34125,63215,13,9,0,13863,0,0,0,'Required quest active for spellclick'),
(18,34125,63215,14,9,0,13864,0,0,0,'Required quest active for spellclick'),
-- Raptor requires (A) Valiant of Sen'Jin
(18,33796,62784,1,8,0,13693,0,0,0,'Required quest rewarded for spellclick'),
(18,33796,62784,2,8,0,13708,0,0,0,'Required quest rewarded for spellclick'),
-- Forsaken Warhorse requires (A) Valiant of Undercity
(18,33798,62787,1,8,0,13695,0,0,0,'Required quest rewarded for spellclick'),
(18,33798,62787,2,8,0,13710,0,0,0,'Required quest rewarded for spellclick'),
-- Orgrimmar Wolf requires (A) Valiant of Orgrimmar
(18,33799,62783,1,8,0,13691,0,0,0,'Required quest rewarded for spellclick'),
(18,33799,62783,2,8,0,13707,0,0,0,'Required quest rewarded for spellclick'),
-- Silvermoon Hawkstrider requires (A) Valiant of Silvermoon
(18,33791,62786,1,8,0,13696,0,0,0,'Required quest rewarded for spellclick'),
(18,33791,62786,2,8,0,13711,0,0,0,'Required quest rewarded for spellclick'),
-- Thunder Bluff Kodo requires (A) Valiant of Thunder Bluff
(18,33792,62785,1,8,0,13694,0,0,0,'Required quest rewarded for spellclick'),
(18,33792,62785,2,8,0,13709,0,0,0,'Required quest rewarded for spellclick'),
-- Exodar Elekk requires (A) Valiant of the Exodar
(18,33790,62781,1,8,0,13690,0,0,0,'Required quest rewarded for spellclick'),
(18,33790,62781,2,8,0,13705,0,0,0,'Required quest rewarded for spellclick'),
-- Ironforge Ram requires (A) Valiant of Ironforge
(18,33795,62779,1,8,0,13685,0,0,0,'Required quest rewarded for spellclick'),
(18,33795,62779,2,8,0,13703,0,0,0,'Required quest rewarded for spellclick'),
-- Gnomeregan Mechanostrider requires (A) Valiant of Gnomeregan
(18,33793,62780,1,8,0,13688,0,0,0,'Required quest rewarded for spellclick'),
(18,33793,62780,2,8,0,13704,0,0,0,'Required quest rewarded for spellclick'),
-- Stormwind Steed requires (A) Valiant of Stormwind
(18,33800,62774,1,8,0,13593,0,0,0,'Required quest rewarded for spellclick'),
(18,33800,62774,2,8,0,13684,0,0,0,'Required quest rewarded for spellclick'),
-- Darnassian Nightsaber requires (A) Valiant of Darnassus
(18,33794,62782,1,8,0,13689,0,0,0,'Required quest rewarded for spellclick'),
(18,33794,62782,2,8,0,13706,0,0,0,'Required quest rewarded for spellclick'),
-- Stabled Quel'Dorei steeds requires The Argent Tournament rewarded
(18,33843,63792,0,8,0,13667,0,0,0,'Required quest rewarded for spellclick'),
-- Stabled Quel'Dorei steed forbids Alliance Eligibility Marker rewarded
(18,33843,63792,0,8,0,13686,0,0,1,'Forbidden rewarded quest for spellclick'),
-- Sunreaver Hawkstrider requires The Argent Tournament rewarded
(18,33842,63791,0,8,0,13668,0,0,0,'Required quest rewarded for spellclick'),
-- Sunreaver Hawkstrider forbids Horde Eligibility Marker rewarded
(18,33842,63791,0,8,0,13687,0,0,1,'Forbidden rewarded quest for spellclick'),
-- Misc
(18,26421,47575,0,8,0,12092,0,0,1,'Forbidden rewarded quest for spellclick'),
(18,26421,47575,0,8,0,12096,0,0,1,'Forbidden rewarded quest for spellclick'),
(18,26421,47575,1,9,0,12092,0,0,0,'Required quest active for spellclick'),
(18,26421,47575,2,9,0,12096,0,0,0,'Required quest active for spellclick'),
(18,26477,47096,0,8,0,11999,0,0,1,'Forbidden rewarded quest for spellclick'),
(18,26477,47096,0,8,0,12000,0,0,1,'Forbidden rewarded quest for spellclick'),
(18,26477,61286,0,8,0,11999,0,0,1,'Forbidden rewarded quest for spellclick'),
(18,26477,61286,0,8,0,12000,0,0,1,'Forbidden rewarded quest for spellclick'),
(18,26477,61832,0,8,0,11999,0,0,1,'Forbidden rewarded quest for spellclick'),
(18,26477,61832,0,8,0,12000,0,0,1,'Forbidden rewarded quest for spellclick'),
(18,26477,61286,1,9,0,11999,0,0,0,'Required quest active for spellclick'),
(18,26477,61286,2,9,0,12000,0,0,0,'Required quest active for spellclick'),
(18,26477,47096,1,9,0,11999,0,0,0,'Required quest active for spellclick'),
(18,26477,47096,2,9,0,12000,0,0,0,'Required quest active for spellclick'),
(18,26477,61832,1,9,0,11999,0,0,0,'Required quest active for spellclick'),
(18,26477,61832,2,9,0,12000,0,0,0,'Required quest active for spellclick'),
(18,28161,39996,0,8,0,12532,0,0,1,'Forbidden rewarded quest for spellclick'),
(18,28161,39996,0,8,0,12702,0,0,1,'Forbidden rewarded quest for spellclick'),
(18,28161,39996,1,9,0,12532,0,0,0,'Required quest active for spellclick'),
(18,28161,39996,2,9,0,12702,0,0,0,'Required quest active for spellclick'),
(18,28161,51037,0,8,0,12532,0,0,1,'Forbidden rewarded quest for spellclick'),
(18,28161,51037,0,8,0,12702,0,0,1,'Forbidden rewarded quest for spellclick'),
(18,28161,51037,1,9,0,12532,0,0,0,'Required quest active for spellclick'),
(18,28161,51037,2,9,0,12702,0,0,0,'Required quest active for spellclick'),
(18,28161,51961,0,8,0,12532,0,0,1,'Forbidden rewarded quest for spellclick'),
(18,28161,51961,0,8,0,12702,0,0,1,'Forbidden rewarded quest for spellclick'),
(18,28161,51961,1,9,0,12532,0,0,0,'Required quest active for spellclick'),
(18,28161,51961,2,9,0,12702,0,0,0,'Required quest active for spellclick'),
(18,29856,55363,0,8,0,12629,0,0,1,'Forbidden rewarded quest for spellclick'),
(18,29856,55363,0,8,0,12643,0,0,1,'Forbidden rewarded quest for spellclick'),
(18,29856,55363,1,9,0,12629,0,0,0,'Required quest active for spellclick'),
(18,29856,55363,2,9,0,12643,0,0,0,'Required quest active for spellclick'),
(18,32788,57539,1,8,0,13075,0,0,0,'Required quest rewarded for spellclick'),
(18,32788,57539,2,9,0,13075,0,0,0,'Required quest active for spellclick'),
(18,32790,57654,1,8,0,13073,0,0,0,'Required quest rewarded for spellclick'),
(18,32790,57654,2,9,0,13073,0,0,0,'Required quest active for spellclick');
-- Remove duplicate entries in npc_spellclick_spells (leave 1)
DELETE FROM `npc_spellclick_spells` WHERE `npc_entry` IN(34125,26421,26477,28161,
31157,33790,33791,33792,33793,33794,33795,33796,33798,33799,33800,34944,29856,30564,29414,31269);
INSERT INTO `npc_spellclick_spells` (`npc_entry`, `spell_id`, `cast_flags`, `user_type`) VALUES
(26477,47096,2,0),
(26477,61286,2,0),
(26477,61832,0,0),
(29414,18277,1,0),
(29856,55363,2,0),
(31269,46598,1,0),
(33794,62782,1,0),
(28161,51037,2,0),
(28161,39996,1,0),
(30564,57401,1,0),
(34125,63215,1,0),
(34944,68458,1,0),
(33790,62781,1,0),
(33793,62780,1,0),
(33795,62779,1,0),
(33800,62774,1,0),
(33798,62787,1,0),
(31157,46598,1,0),
(26421,47575,1,0),
(28161,51961,1,0),
(33791,62786,1,0),
(33792,62785,1,0),
(33796,62784,1,0),
(33799,62783,1,0);
-- If this query fails, fix your custom content
ALTER TABLE `npc_spellclick_spells` ADD PRIMARY KEY(`npc_entry`,`spell_id`);
@@ -0,0 +1,5 @@
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=18 AND `SourceGroup`=29488 AND `SourceEntry`=54568;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,
`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`Comment`) VALUES
(18,29488,54568,15,8,0,12670,0,0,0,'Required quest rewarded for spellclick'),
(18,29488,54568,15,9,0,12670,0,0,0,'Required quest active for spellclick');
@@ -0,0 +1,5 @@
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=18 AND `SourceGroup`=29488 AND `SourceEntry`=54568;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,
`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`Comment`) VALUES
(18,29488,54568,1,8,0,12670,0,0,0,'Required quest rewarded for spellclick'),
(18,29488,54568,2,9,0,12670,0,0,0,'Required quest active for spellclick');
@@ -0,0 +1,18 @@
-- NPC talk text insert from sniff
DELETE FROM `script_texts` WHERE `npc_entry`=28923;
DELETE FROM `creature_text` WHERE `entry`=28923;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(28923,0,0, 'I have witnessed the rise and fall of empires... the birth and extinction of entire species... Over countless millennia the foolishness of mortals has remained the only constant. Your presence here confirms this.',14,0,100,0,0,14160, 'Loken'),
(28923,1,0, 'My master has shown me the future, and you have no place in it. Azeroth will be reborn in darkness. Yogg-Saron shall be released! The Pantheon shall fall!',14,0,100,0,0,14161, 'Loken'),
(28923,2,0, 'What hope is there for you? None!',14,0,100,0,0,14162, 'Loken'),
(28923,3,0, 'You cannot hide from fate!',14,0,100,0,0,14163, 'Loken'),
(28923,3,1, 'Come closer. I will make it quick.',14,0,100,0,0,14164, 'Loken'),
(28923,3,2, 'Your flesh cannot hold out for long.',14,0,100,0,0,14165, 'Loken'),
(28923,4,0, 'Only mortal...',14,0,100,0,0,14166, 'Loken'),
(28923,4,1, 'I... am... FOREVER!',14,0,100,0,0,14167, 'Loken'),
(28923,4,2, 'What little time you had, you wasted!',14,0,100,0,0,14168, 'Loken'),
(28923,5,0, 'You stare blindly into the abyss!',14,0,100,0,0,14169, 'Loken'),
(28923,6,0, 'Your ignorance is profound. Can you not see where this path leads?',14,0,100,0,0,14170, 'Loken'),
(28923,7,0, 'You cross the precipice of oblivion!',14,0,100,0,0,14171, 'Loken'),
(28923,8,0, 'My death... heralds the end of this world.',14,0,100,0,0,14172, 'Loken'),
(28923,9,0, '%s begins to cast Lightning Nova!',41,0,100,0,0,0, 'Loken');
@@ -0,0 +1,11 @@
-- NPC talk text insert from sniff
DELETE FROM `script_texts` WHERE `npc_entry`=28546;
DELETE FROM `creature_text` WHERE `entry`=28546;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(28546,0,0, 'You wish to confront the master? You must first weather the storm!',14,0,100,0,0,14453, 'Ionar'),
(28546,1,0, 'The slightest spark shall be your undoing.',14,0,100,0,0,14454, 'Ionar'),
(28546,1,1, 'No one is safe!',14,0,100,0,0,14455, 'Ionar'),
(28546,2,0, 'Shocking ... I know!',14,0,100,0,0,14456, 'Ionar'),
(28546,2,1, 'You atempt the unpossible.',14,0,100,0,0,14457, 'Ionar'),
(28546,2,2, 'Your spark of light is ... extinguish.',14,0,100,0,0,14458, 'Ionar'),
(28546,3,0, 'Master... you have guests.',14,0,100,0,0,14459, 'Ionar');
@@ -0,0 +1,15 @@
-- NPC talk text insert from sniff
DELETE FROM `script_texts` WHERE `npc_entry`=28587;
DELETE FROM `creature_text` WHERE `entry`=28587;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(28587,0,0, 'It is you who have destroyed my children? You... shall... pay!',14,0,100,0,0,13960, 'Volkhan'),
(28587,1,0, 'Life from lifelessness... death for you.',14,0,100,0,0,13961, 'Volkhan'),
(28587,1,1, 'Nothing is wasted in the process. You will see....',14,0,100,0,0,13962, 'Volkhan'),
(28587,2,0, 'I will crush you beneath my boots!',14,0,100,0,0,13963, 'Volkhan'),
(28587,2,1, 'All my work... undone!',14,0,100,0,0,13964, 'Volkhan'),
(28587,3,0, 'The armies of iron will conquer all!',14,0,100,0,0,13965, 'Volkhan'),
(28587,3,1, 'Ha, pathetic!',14,0,100,0,0,13966, 'Volkhan'),
(28587,3,2, 'You have cost me too much work!',14,0,100,0,0,13967, 'Volkhan'),
(28587,4,0, 'The master was right... to be concerned.',14,0,100,0,0,13968, 'Volkhan'),
(28587,5,0, '%s runs to his anvil!',41,0,100,0,0,0, 'Volkhan'),
(28587,6,0, '%s prepares to shatter his Brittle Golems!',41,0,100,0,0,0, 'Volkhan');
@@ -0,0 +1,5 @@
DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=18 AND `SourceGroup`=29488 AND `SourceEntry`=54568;
INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,
`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`Comment`) VALUES
(18,29488,54568,1,8,0,12670,0,0,0,'Required quest rewarded for spellclick'),
(18,29488,54568,2,28,0,12670,0,0,0,'Required quest completed for spellclick');
@@ -33,6 +33,8 @@ using G3D::Vector3;
using G3D::Ray;
using G3D::AABox;
#ifndef NO_CORE_FUNCS
struct GameobjectModelData
{
GameobjectModelData(const std::string& name_, const AABox& box) :
@@ -47,23 +49,30 @@ ModelList model_list;
void LoadGameObjectModelList()
{
uint32 oldMSTime = getMSTime();
FILE* model_list_file = fopen((sWorld->GetDataPath() + "vmaps/" + VMAP::GAMEOBJECT_MODELS).c_str(), "rb");
if (!model_list_file)
{
sLog->outError("Unable to open '%s' file.", VMAP::GAMEOBJECT_MODELS);
return;
}
uint32 name_length, displayId;
char buff[500];
while (!feof(model_list_file))
while (true)
{
Vector3 v1, v2;
if (fread(&displayId, sizeof(uint32), 1, model_list_file) != 1
|| fread(&name_length, sizeof(uint32), 1, model_list_file) != 1
if (fread(&displayId, sizeof(uint32), 1, model_list_file) != 1)
if (feof(model_list_file)) // EOF flag is only set after failed reading attempt
break;
if (fread(&name_length, sizeof(uint32), 1, model_list_file) != 1
|| name_length >= sizeof(buff)
|| fread(&buff, sizeof(char), name_length, model_list_file) != name_length
|| fread(&v1, sizeof(Vector3), 1, model_list_file) != 1
|| fread(&v2, sizeof(Vector3), 1, model_list_file) != 1)
{
printf("\nFile '%s' seems to be corrupted", VMAP::GAMEOBJECT_MODELS);
sLog->outError("File '%s' seems to be corrupted!", VMAP::GAMEOBJECT_MODELS);
break;
}
@@ -72,7 +81,10 @@ void LoadGameObjectModelList()
ModelList::value_type( displayId, GameobjectModelData(std::string(buff,name_length),AABox(v1,v2)) )
);
}
fclose(model_list_file);
sLog->outString(">> Loaded %u GameObject models in %u ms", uint32(model_list.size()), GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
}
GameObjectModel::~GameObjectModel()
@@ -91,7 +103,7 @@ bool GameObjectModel::initialize(const GameObject& go, const GameObjectDisplayIn
// ignore models with no bounds
if (mdl_box == G3D::AABox::zero())
{
std::cout << "Model " << it->second.name << " has zero bounds, loading skipped" << std::endl;
sLog->outError("GameObject model %s has zero bounds, loading skipped", it->second.name.c_str());
return false;
}
@@ -171,3 +183,5 @@ bool GameObjectModel::intersectRay(const G3D::Ray& ray, float& MaxDist, bool Sto
}
return hit;
}
#endif
+1 -1
View File
@@ -102,7 +102,7 @@ namespace FactorySelector
MovementGenerator* selectMovementGenerator(Creature* creature)
{
MovementGeneratorRegistry& mv_registry(*MovementGeneratorRepository::instance());
ASSERT(creature->GetCreatureInfo() != NULL);
ASSERT(creature->GetCreatureTemplate() != NULL);
const MovementGeneratorCreator* mv_factory = mv_registry.GetRegistryItem(creature->GetDefaultMovementType());
/* if (mv_factory == NULL)
@@ -57,7 +57,7 @@ bool npc_escortAI::AssistPlayerInCombat(Unit* who)
return false;
//experimental (unknown) flag not present
if (!(me->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS))
if (!(me->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS))
return false;
//not a player
@@ -150,7 +150,7 @@ void npc_escortAI::JustRespawned()
//add a small delay before going to first waypoint, normal in near all cases
m_uiWPWaitTimer = 2500;
if (me->getFaction() != me->GetCreatureInfo()->faction_A)
if (me->getFaction() != me->GetCreatureTemplate()->faction_A)
me->RestoreFaction();
Reset();
@@ -307,11 +307,7 @@ void npc_escortAI::MovementInform(uint32 moveType, uint32 pointId)
{
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI has returned to original position before combat");
if (m_bIsRunning && me->HasUnitMovementFlag(MOVEMENTFLAG_WALKING))
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
else if (!m_bIsRunning && !me->HasUnitMovementFlag(MOVEMENTFLAG_WALKING))
me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
me->SetWalk(!m_bIsRunning);
RemoveEscortState(STATE_ESCORT_RETURNING);
if (!m_uiWPWaitTimer)
@@ -400,14 +396,14 @@ void npc_escortAI::SetRun(bool on)
if (on)
{
if (!m_bIsRunning)
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
me->SetWalk(false);
else
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI attempt to set run mode, but is already running.");
}
else
{
if (m_bIsRunning)
me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
me->SetWalk(true);
else
sLog->outDebug(LOG_FILTER_TSCR, "TSCR: EscortAI attempt to set walk mode, but is already walking.");
}
@@ -473,9 +469,9 @@ void npc_escortAI::Start(bool isActiveAttacker /* = true*/, bool run /* = false
//Set initial speed
if (m_bIsRunning)
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
me->SetWalk(false);
else
me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
me->SetWalk(true);
AddEscortState(STATE_ESCORT_ESCORTING);
}
@@ -55,7 +55,7 @@ bool FollowerAI::AssistPlayerInCombat(Unit* who)
return false;
//experimental (unknown) flag not present
if (!(me->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS))
if (!(me->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS))
return false;
//not a player
@@ -150,8 +150,8 @@ void FollowerAI::JustRespawned()
if (!IsCombatMovementAllowed())
SetCombatMovement(true);
if (me->getFaction() != me->GetCreatureInfo()->faction_A)
me->setFaction(me->GetCreatureInfo()->faction_A);
if (me->getFaction() != me->GetCreatureTemplate()->faction_A)
me->setFaction(me->GetCreatureTemplate()->faction_A);
Reset();
}
+7 -7
View File
@@ -45,7 +45,7 @@ SmartAI::SmartAI(Creature* c) : CreatureAI(c)
mCanRepeatPath = false;
// spawn in run mode
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
me->SetWalk(false);
mRun = false;
me->GetPosition(&mLastOOCPos);
@@ -524,7 +524,7 @@ bool SmartAI::AssistPlayerInCombat(Unit* who)
return false;
//experimental (unknown) flag not present
if (!(me->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS))
if (!(me->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS))
return false;
//not a player
@@ -561,7 +561,7 @@ void SmartAI::JustRespawned()
mDespawnState = 0;
mEscortState = SMART_ESCORT_NONE;
me->SetVisible(true);
if (me->getFaction() != me->GetCreatureInfo()->faction_A)
if (me->getFaction() != me->GetCreatureTemplate()->faction_A)
me->RestoreFaction();
GetScript()->ProcessEventsFor(SMART_EVENT_RESPAWN);
Reset();
@@ -720,9 +720,9 @@ uint64 SmartAI::GetGUID(int32 /*id*/)
void SmartAI::SetRun(bool run)
{
if (run)
me->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
me->SetWalk(false);
else
me->AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
me->SetWalk(true);
mRun = run;
}
@@ -731,12 +731,12 @@ void SmartAI::SetFly(bool fly)
{
if (fly)
{
me->AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
me->SetLevitate(true);
me->SetByteFlag(UNIT_FIELD_BYTES_1, 3, 0x01);
}
else
{
me->RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
me->SetLevitate(false);
me->RemoveByteFlag(UNIT_FIELD_BYTES_1, 3, 0x01);
}
me->SetFlying(fly);
@@ -482,7 +482,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!(e.action.cast.flags & SMARTCAST_AURA_NOT_PRESENT) || !(*itr)->ToUnit()->HasAura(e.action.cast.spell))
me->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) ? true : false);
else
sLog->outDebug(LOG_FILTER_DATABASE_AI, "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: %u Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId()));
sLog->outDebug(LOG_FILTER_DATABASE_AI, "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId()));
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_CAST:: Creature %u casts spell %u on target %u with castflags %u",
me->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags);
}
@@ -511,7 +511,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!(e.action.cast.flags & SMARTCAST_AURA_NOT_PRESENT) || !(*itr)->ToUnit()->HasAura(e.action.cast.spell))
tempLastInvoker->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) ? true : false);
else
sLog->outDebug(LOG_FILTER_DATABASE_AI, "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: %u Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId()));
sLog->outDebug(LOG_FILTER_DATABASE_AI, "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*itr)->GetGUID(), (*itr)->GetEntry(), uint32((*itr)->GetTypeId()));
sLog->outDebug(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_INVOKER_CAST: Invoker %u casts spell %u on target %u with castflags %u",
tempLastInvoker->GetGUIDLow(), e.action.cast.spell, (*itr)->GetGUIDLow(), e.action.cast.flags);
@@ -1576,7 +1576,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
if (!(e.action.cast.flags & SMARTCAST_AURA_NOT_PRESENT) || !(*it)->ToUnit()->HasAura(e.action.cast.spell))
(*itr)->ToUnit()->CastSpell((*it)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) ? true : false);
else
sLog->outDebug(LOG_FILTER_DATABASE_AI, "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: %u Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*it)->GetGUID(), (*it)->GetEntry(), uint32((*it)->GetTypeId()));
sLog->outDebug(LOG_FILTER_DATABASE_AI, "Spell %u not casted because it has flag SMARTCAST_AURA_NOT_PRESENT and the target (Guid: " UI64FMTD " Entry: %u Type: %u) already has the aura", e.action.cast.spell, (*it)->GetGUID(), (*it)->GetEntry(), uint32((*it)->GetTypeId()));
}
}
}
@@ -48,7 +48,6 @@ void SmartWaypointMgr::LoadFromDB()
uint32 count = 0;
uint32 total = 0;
WPPath* path = NULL;
uint32 last_entry = 0;
uint32 last_id = 1;
@@ -62,27 +61,19 @@ void SmartWaypointMgr::LoadFromDB()
y = fields[3].GetFloat();
z = fields[4].GetFloat();
WayPoint* wp = new WayPoint(id, x, y, z);
if (last_entry != entry)
{
path = new WPPath;
waypoint_map[entry] = new WPPath();
last_id = 1;
count++;
}
if (last_id != id)
{
sLog->outErrorDb("SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, last_id);
}
last_id++;
(*path)[id] = wp;
(*waypoint_map[entry])[id] = new WayPoint(id, x, y, z);
if (last_entry != entry)
{
count++;
waypoint_map[entry] = path;
}
last_entry = entry;
total++;
}
+14 -12
View File
@@ -154,18 +154,18 @@ bool ArenaTeam::AddMember(uint64 playerGuid)
Player::RemovePetitionsAndSigns(playerGuid, GetType());
// Feed data to the struct
ArenaTeamMember newmember;
newmember.Name = playerName;
newmember.Guid = playerGuid;
newmember.Class = playerClass;
newmember.SeasonGames = 0;
newmember.WeekGames = 0;
newmember.SeasonWins = 0;
newmember.WeekWins = 0;
newmember.PersonalRating = personalRating;
newmember.MatchMakerRating = matchMakerRating;
ArenaTeamMember newMember;
newMember.Name = playerName;
newMember.Guid = playerGuid;
newMember.Class = playerClass;
newMember.SeasonGames = 0;
newMember.WeekGames = 0;
newMember.SeasonWins = 0;
newMember.WeekWins = 0;
newMember.PersonalRating = personalRating;
newMember.MatchMakerRating = matchMakerRating;
Members.push_back(newmember);
Members.push_back(newMember);
// Save player's arena team membership to db
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_ARENA_TEAM_MEMBER);
@@ -295,8 +295,10 @@ void ArenaTeam::SetCaptain(uint64 guid)
if (newCaptain)
{
newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0);
char const* oldCaptainName = oldCaptain ? oldCaptain->GetName() : "";
uint32 oldCaptainLowGuid = oldCaptain ? oldCaptain->GetGUIDLow() : 0;
sLog->outArena("Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].",
oldCaptain->GetName(), oldCaptain->GetGUIDLow(), newCaptain->GetName(), newCaptain->GetGUIDLow(), GetId(), GetType());
oldCaptainName, oldCaptainLowGuid, newCaptain->GetName(), newCaptain->GetGUIDLow(), GetId(), GetType());
}
}
@@ -1032,17 +1032,18 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)
std::vector<uint64> ghost_list = m_ReviveQueue[BgCreatures[node]];
if (!ghost_list.empty())
{
Player* player;
WorldSafeLocsEntry const* ClosestGrave = NULL;
Player* waitingPlayer; // player waiting at graveyard for resurrection
WorldSafeLocsEntry const* closestGrave = NULL;
for (std::vector<uint64>::iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr)
{
player = ObjectAccessor::FindPlayer(*ghost_list.begin());
if (!player)
waitingPlayer = ObjectAccessor::FindPlayer(*ghost_list.begin());
if (!waitingPlayer)
continue;
if (!ClosestGrave)
ClosestGrave = GetClosestGraveYard(player);
if (!closestGrave)
closestGrave = GetClosestGraveYard(waitingPlayer);
else
player->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation());
waitingPlayer->TeleportTo(GetMapId(), closestGrave->x, closestGrave->y, closestGrave->z, player->GetOrientation());
}
m_ReviveQueue[BgCreatures[node]].clear();
}
@@ -51,6 +51,7 @@ BattlegroundWS::BattlegroundWS()
StartMessageIds[BG_STARTING_EVENT_SECOND] = LANG_BG_WS_START_ONE_MINUTE;
StartMessageIds[BG_STARTING_EVENT_THIRD] = LANG_BG_WS_START_HALF_MINUTE;
StartMessageIds[BG_STARTING_EVENT_FOURTH] = LANG_BG_WS_HAS_BEGUN;
_flagDebuffState = 0;
}
BattlegroundWS::~BattlegroundWS()
@@ -434,7 +435,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
int32 message_id = 0;
ChatMsg type = CHAT_MSG_BG_SYSTEM_NEUTRAL;
bool flagHandled = false;
//alliance flag picked up from base
if (Source->GetTeam() == HORDE && this->GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_BASE
&& this->BgObjects[BG_WS_OBJECT_A_FLAG] == target_obj->GetGUID())
@@ -452,11 +453,12 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
Source->GetAchievementMgr().StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_SILVERWING_FLAG_PICKED);
if (_flagState[1] == BG_WS_FLAG_STATE_ON_PLAYER)
_bothFlagsKept = true;
flagHandled = true;
}
//horde flag picked up from base
if (Source->GetTeam() == ALLIANCE && this->GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_BASE
&& this->BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID())
&& this->BgObjects[BG_WS_OBJECT_H_FLAG] == target_obj->GetGUID() && !flagHandled)
{
message_id = LANG_BG_WS_PICKEDUP_HF;
type = CHAT_MSG_BG_SYSTEM_ALLIANCE;
@@ -471,10 +473,11 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
Source->GetAchievementMgr().StartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_SPELL_TARGET, BG_WS_SPELL_WARSONG_FLAG_PICKED);
if (_flagState[0] == BG_WS_FLAG_STATE_ON_PLAYER)
_bothFlagsKept = true;
flagHandled = true;
}
//Alliance flag on ground(not in base) (returned or picked up again from ground!)
if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10))
if (GetFlagState(ALLIANCE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && !flagHandled)
{
if (Source->GetTeam() == ALLIANCE)
{
@@ -486,6 +489,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
UpdatePlayerScore(Source, SCORE_FLAG_RETURNS, 1);
_bothFlagsKept = false;
flagHandled = true;
}
else
{
@@ -502,13 +506,14 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
if (_flagDebuffState == 2)
Source->CastSpell(Source, WS_SPELL_BRUTAL_ASSAULT, true);
UpdateWorldState(BG_WS_FLAG_UNK_ALLIANCE, 1);
flagHandled = true;
}
//called in HandleGameObjectUseOpcode:
//target_obj->Delete();
}
//Horde flag on ground(not in base) (returned or picked up again)
if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10))
if (GetFlagState(HORDE) == BG_WS_FLAG_STATE_ON_GROUND && Source->IsWithinDistInMap(target_obj, 10) && !flagHandled)
{
if (Source->GetTeam() == HORDE)
{
@@ -520,6 +525,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
PlaySoundToAll(BG_WS_SOUND_FLAG_RETURNED);
UpdatePlayerScore(Source, SCORE_FLAG_RETURNS, 1);
_bothFlagsKept = false;
flagHandled = true;
}
else
{
@@ -536,6 +542,7 @@ void BattlegroundWS::EventPlayerClickedOnFlag(Player* Source, GameObject* target
if (_flagDebuffState == 2)
Source->CastSpell(Source, WS_SPELL_BRUTAL_ASSAULT, true);
UpdateWorldState(BG_WS_FLAG_UNK_HORDE, 1);
flagHandled = true;
}
//called in HandleGameObjectUseOpcode:
//target_obj->Delete();
+82
View File
@@ -15,3 +15,85 @@
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "Player.h"
#include "Calendar.h"
std::string CalendarInvite::GetDebugString() const
{
std::ostringstream data;
data << "CalendarInvite::"
<< " inviteId: " << _inviteId
<< " EventId: " << _eventId
<< " Status: " << uint32(_status)
<< " Invitee: " << _invitee
<< " Sender: " << _senderGUID
<< " Rank: " << uint32(_rank)
<< " Text: " << _text;
return data.str();
}
void CalendarInvite::Init()
{
_eventId = 0;
_invitee = 0;
_senderGUID = 0;
_statusTime = 0;
_status = CALENDAR_STATUS_INVITED; // default (0)?
_rank = CALENDAR_RANK_PLAYER;
_text = "";
}
std::string CalendarEvent::GetDebugString() const
{
std::ostringstream data;
data << "CalendarEvent::"
<< " EventId: " << _eventId
<< " Title: " << _title
<< " Description" << _description
<< " Type: " << uint32(_type)
<< " Max Invites: " << _maxInvites
<< " Creator: " << _creatorGUID
<< " Flags: " << _flags
<< " Guild: " << _guildId
<< " Time: " << _eventTime
<< " Time2: " << _timezoneTime
<< " Repeatable: " << uint32(_repeatable)
<< " DungeonId: " << _dungeonId;
return data.str();
}
void CalendarEvent::Init()
{
_creatorGUID = 0;
_guildId = 0;
_type = CALENDAR_TYPE_OTHER;
_dungeonId = -1;
_maxInvites = 0;
_eventTime = 0;
_flags = 0;
_repeatable = false;
_timezoneTime = 0;
_title = "";
_description = "";
}
std::string CalendarAction::GetDebugString() const
{
std::ostringstream data;
data << "CalendarAction::"
<< " Action: " << GetAction()
<< " Guid: " << GetPlayer()->GetGUID()
<< " Invite Id: " << GetInviteId()
<< " Extra data: " << GetExtraData()
<< " Event: " << Event.GetDebugString()
<< " Invite: " << Invite.GetDebugString();
return data.str();
}
+165 -2
View File
@@ -19,8 +19,171 @@
#ifndef TRINITY_CALENDAR_H
#define TRINITY_CALENDAR_H
class Calendar
{
#include "Errors.h"
#include "SharedDefines.h"
#include <map>
class CalendarInvite
{
public:
CalendarInvite() : _inviteId(0) { Init(); }
explicit CalendarInvite(uint64 inviteId) : _inviteId(inviteId) { Init(); }
~CalendarInvite() { }
void SetInviteId(uint64 inviteId) { _inviteId = inviteId; }
uint64 GetInviteId() const { return _inviteId; }
void SetEventId(uint64 eventId) { _eventId = eventId; }
uint64 GetEventId() const { return _eventId; }
void SetSenderGUID(uint64 guid) { _senderGUID = guid; }
uint64 GetSenderGUID() const { return _senderGUID; }
void SetInvitee(uint64 guid) { _invitee = guid; }
uint64 GetInvitee() const { return _invitee; }
void SetStatusTime(uint32 statusTime) { _statusTime = statusTime; }
uint32 GetStatusTime() const { return _statusTime; }
void SetText(std::string text) { _text = text; }
std::string GetText() const { return _text; }
void SetStatus(CalendarInviteStatus status) { _status = status; }
CalendarInviteStatus GetStatus() const { return _status; }
void SetRank(CalendarModerationRank rank) { _rank = rank; }
CalendarModerationRank GetRank() const { return _rank; }
std::string GetDebugString() const;
private:
void Init();
uint64 _inviteId;
uint64 _eventId;
uint64 _invitee;
uint64 _senderGUID;
uint32 _statusTime;
CalendarInviteStatus _status;
CalendarModerationRank _rank;
std::string _text;
};
typedef std::set<uint64> CalendarInviteIdList;
class CalendarEvent
{
public:
CalendarEvent() : _eventId(0) { Init(); }
explicit CalendarEvent(uint64 eventId) : _eventId(eventId) { Init(); }
~CalendarEvent() { }
void SetEventId(uint64 eventId) { _eventId = eventId; }
uint64 GetEventId() const { return _eventId; }
void SetCreatorGUID(uint64 guid) { _creatorGUID = guid; }
uint64 GetCreatorGUID() const { return _creatorGUID; }
void SetGuildId(uint32 guildId) { _guildId = guildId; }
uint32 GetGuildId() const { return _guildId; }
void SetTitle(std::string title) { _title = title; }
std::string GetTitle() const { return _title; }
void SetDescription(std::string description) { _description = description; }
std::string GetDescription() const { return _description; }
void SetType(CalendarEventType type) { _type = type; }
CalendarEventType GetType() const { return _type; }
void SetMaxInvites(uint32 limit) { _maxInvites = limit; }
uint32 GetMaxInvites() const { return _maxInvites; }
void SetDungeonId(int32 dungeonId) { _dungeonId = dungeonId; }
int32 GetDungeonId() const { return _dungeonId; }
void SetTime(uint32 eventTime) { _eventTime = eventTime; }
uint32 GetTime() const { return _eventTime; }
void SetFlags(uint32 flags) { _flags = flags; }
uint32 GetFlags() const { return _flags; }
void SetRepeatable(bool repeatable) { _repeatable = repeatable; }
bool GetRepeatable() const { return _repeatable; }
void SetTimeZoneTime(uint32 timezoneTime) { _timezoneTime = timezoneTime; }
uint32 GetTimeZoneTime() const { return _timezoneTime; }
void AddInvite(uint64 inviteId)
{
if (inviteId)
_invites.insert(inviteId);
}
void RemoveInvite(uint64 inviteId) { _invites.erase(inviteId); }
bool HasInvite(uint64 inviteId) const { return _invites.find(inviteId) != _invites.end(); }
CalendarInviteIdList const& GetInviteIdList() const { return _invites; }
void SetInviteIdList(CalendarInviteIdList const& list) { _invites = list; }
void ClearInviteIdList() { _invites.clear(); }
std::string GetDebugString() const;
private:
void Init();
uint64 _eventId;
uint64 _creatorGUID;
uint32 _guildId;
CalendarEventType _type;
int32 _dungeonId;
uint32 _maxInvites;
uint32 _eventTime;
uint32 _flags;
bool _repeatable;
uint32 _timezoneTime;
std::string _title;
std::string _description;
CalendarInviteIdList _invites;
};
typedef std::set<uint64> CalendarEventIdList;
typedef std::map<uint64, CalendarInviteIdList> CalendarPlayerInviteIdMap;
typedef std::map<uint64, CalendarEventIdList> CalendarPlayerEventIdMap;
typedef std::map<uint64, CalendarInvite> CalendarInviteMap;
typedef std::map<uint64, CalendarEvent> CalendarEventMap;
class Player;
struct CalendarAction
{
CalendarAction(): _action(CALENDAR_ACTION_NONE), _player(NULL), _inviteId(0), _data(0)
{
}
void SetAction(CalendarActionData data) { _action = data; }
CalendarActionData GetAction() const { return _action; }
void SetPlayer(Player* player) { ASSERT(player); _player = player; }
Player* GetPlayer() const { return _player; }
void SetInviteId(uint64 id) { _inviteId = id; }
uint64 GetInviteId() const { return _inviteId; }
void SetExtraData(uint32 data) { _data = data; }
uint32 GetExtraData() const { return _data; }
CalendarEvent Event;
CalendarInvite Invite;
std::string GetDebugString() const;
private:
CalendarActionData _action;
Player* _player;
uint64 _inviteId;
uint32 _data;
};
#endif
+592
View File
@@ -0,0 +1,592 @@
/*
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
DROP TABLE IF EXISTS `calendar_events`;
CREATE TABLE IF NOT EXISTS `calendar_events` (
`id` int(11) unsigned NOT NULL DEFAULT '0',
`creator` int(11) unsigned NOT NULL DEFAULT '0',
`title` varchar(255) NOT NULL DEFAULT '',
`description` varchar(255) NOT NULL DEFAULT '',
`type` tinyint(1) unsigned NOT NULL DEFAULT '4',
`dungeon` tinyint(3) NOT NULL DEFAULT '-1',
`eventtime` int(10) unsigned NOT NULL DEFAULT '0',
`flags` int(10) unsigned NOT NULL DEFAULT '0',
`repeatable` tinyint(1) unsigned NOT NULL DEFAULT '0',
`time2` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
);
DROP TABLE IF EXISTS `calendar_invites`;
CREATE TABLE IF NOT EXISTS `calendar_invites` (
`id` int(11) unsigned NOT NULL DEFAULT '0',
`event` int(11) unsigned NOT NULL DEFAULT '0',
`invitee` int(11) unsigned NOT NULL DEFAULT '0',
`sender` int(11) unsigned NOT NULL DEFAULT '0',
`status` tinyint(1) unsigned NOT NULL DEFAULT '0',
`statustime` int(10) unsigned NOT NULL DEFAULT '0',
`rank` tinyint(1) unsigned NOT NULL DEFAULT '0',
`text` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`)
);
*/
#include "CalendarMgr.h"
#include "QueryResult.h"
#include "DatabaseEnv.h"
#include "Log.h"
#include "Player.h"
#include "ObjectAccessor.h"
CalendarMgr::CalendarMgr() :
_eventNum(0), _inviteNum(0)
{
}
CalendarMgr::~CalendarMgr()
{
}
uint32 CalendarMgr::GetPlayerNumPending(uint64 guid)
{
if (!guid)
return 0;
CalendarPlayerInviteIdMap::const_iterator itr = _playerInvites.find(guid);
if (itr == _playerInvites.end())
return 0;
uint32 pendingNum = 0;
for (CalendarInviteIdList::const_iterator it = itr->second.begin(); it != itr->second.end(); ++it)
if (CalendarInvite* invite = GetInvite(*it))
if (invite->GetRank() != CALENDAR_RANK_OWNER
&& invite->GetStatus() != CALENDAR_STATUS_CONFIRMED
&& invite->GetStatus() != CALENDAR_STATUS_8
&& invite->GetStatus() != CALENDAR_STATUS_9) // FIXME Check the proper value
++pendingNum;
return pendingNum;
}
CalendarInviteIdList const& CalendarMgr::GetPlayerInvites(uint64 guid)
{
return _playerInvites[guid];
}
CalendarEventIdList const& CalendarMgr::GetPlayerEvents(uint64 guid)
{
return _playerEvents[guid];
}
CalendarInvite* CalendarMgr::GetInvite(uint64 inviteId)
{
CalendarInviteMap::iterator it = _invites.find(inviteId);
if (it != _invites.end())
return &(it->second);
sLog->outError("CalendarMgr::GetInvite: [" UI64FMTD "] not found!", inviteId);
return NULL;
}
CalendarEvent* CalendarMgr::GetEvent(uint64 eventId)
{
CalendarEventMap::iterator it = _events.find(eventId);
if (it != _events.end())
return &(it->second);
sLog->outError("CalendarMgr::GetEvent: [" UI64FMTD "] not found!", eventId);
return NULL;
}
uint64 CalendarMgr::GetFreeEventId()
{
return ++_eventNum;
}
uint64 CalendarMgr::GetFreeInviteId()
{
return ++_inviteNum;
}
void CalendarMgr::LoadFromDB()
{
/*
uint32 count = 0;
// 0 1 2 3 4 5 6 7 8 9
if (QueryResult result = CharacterDatabase.Query("SELECT id, creator, title, description, type, dungeon, eventtime, flags, repeatable, time2 FROM calendar_events"))
do
{
Field * fields = result->Fetch();
uint64 eventId = fields[0].GetUInt64();
CalendarEvent& calendarEvent = _events[eventId];
calendarEvent.SetEventId(eventId);
calendarEvent.SetCreatorGUID(fields[1].GetUInt64());
calendarEvent.SetTitle(fields[2].GetString());
calendarEvent.SetDescription(fields[3].GetString());
calendarEvent.SetType(fields[4].GetUInt8());
calendarEvent.SetDungeonId(fields[5].GetInt32());
calendarEvent.SetTime(fields[6].GetUInt32());
calendarEvent.SetFlags(fields[7].GetUInt32());
calendarEvent.SetRepeatable(fields[8].GetBool());
calendarEvent.SetTimeZoneTime(fields[9].GetUInt32());
++count;
}
while (result->NextRow());
sLog->outString(">> Loaded %u calendar events", count);
count = 0;
// 0 1 2 3 4 5 6 7
if (QueryResult result = CharacterDatabase.Query("SELECT id, event, invitee, sender, status, statustime, rank, text FROM calendar_invites"))
do
{
Field * fields = result->Fetch();
uint64 inviteId = fields[0].GetUInt64();
uint64 eventId = fields[1].GetUInt64();
CalendarInvite& invite = _invites[inviteId];
invite.SetEventId(eventId);
invite.SetInvitee(fields[2].GetUInt64());
invite.SetSenderGUID(fields[3].GetUInt64());
invite.SetStatus(fields[4].GetUInt8());
invite.SetStatusTime(fields[5].GetUInt32());
invite.SetRank(fields[6].GetUInt8());
invite.SetText(fields[7].GetString());
CalendarEvent& calendarEvent = _events[eventId];
calendarEvent.AddInvite(inviteId);
}
while (result->NextRow());
sLog->outString(">> Loaded %u calendar Invites", count);
*/
}
CalendarEvent* CalendarMgr::CheckPermisions(uint64 eventId, Player* player, uint64 inviteId, CalendarModerationRank minRank)
{
if (!player)
return NULL; // CALENDAR_ERROR_INTERNAL
CalendarEvent* calendarEvent = GetEvent(eventId);
if (!calendarEvent)
{
player->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_EVENT_INVALID);
return NULL;
}
CalendarInvite* invite = GetInvite(inviteId);
if (!invite)
{
player->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_NO_INVITE);
return NULL;
}
if (!calendarEvent->HasInvite(inviteId))
{
player->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_NOT_INVITED);
return NULL;
}
if (invite->GetEventId() != calendarEvent->GetEventId() || invite->GetInvitee() != player->GetGUID())
{
player->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_INTERNAL);
return NULL;
}
if (invite->GetRank() < minRank)
{
player->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_PERMISSIONS);
return NULL;
}
return calendarEvent;
}
void CalendarMgr::AddAction(CalendarAction const& action)
{
switch (action.GetAction())
{
case CALENDAR_ACTION_ADD_EVENT:
{
if (AddEvent(action.Event) && AddInvite(action.Invite))
{
SendCalendarEventInviteAlert(action.Event, action.Invite);
SendCalendarEvent(action.Event, CALENDAR_SENDTYPE_ADD);
}
break;
}
case CALENDAR_ACTION_MODIFY_EVENT:
{
uint64 eventId = action.Event.GetEventId();
CalendarEvent* calendarEvent = CheckPermisions(eventId, action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_MODERATOR);
if (!calendarEvent)
return;
calendarEvent->SetEventId(action.Event.GetEventId());
calendarEvent->SetType(action.Event.GetType());
calendarEvent->SetFlags(action.Event.GetFlags());
calendarEvent->SetTime(action.Event.GetTime());
calendarEvent->SetTimeZoneTime(action.Event.GetTimeZoneTime());
calendarEvent->SetRepeatable(action.Event.GetRepeatable());
calendarEvent->SetDungeonId(action.Event.GetDungeonId());
calendarEvent->SetTitle(action.Event.GetTitle());
calendarEvent->SetDescription(action.Event.GetDescription());
calendarEvent->SetMaxInvites(action.Event.GetMaxInvites());
CalendarInviteIdList const& invites = calendarEvent->GetInviteIdList();
for (CalendarInviteIdList::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
if (CalendarInvite* invite = GetInvite(*itr))
SendCalendarEventUpdateAlert(invite->GetInvitee(), *calendarEvent, CALENDAR_SENDTYPE_ADD);
break;
}
case CALENDAR_ACTION_COPY_EVENT:
{
CalendarEvent* calendarEvent = CheckPermisions(action.Event.GetEventId(), action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_OWNER);
if (!calendarEvent)
return;
uint64 eventId = GetFreeEventId();
CalendarEvent newEvent(eventId);
newEvent.SetType(calendarEvent->GetType());
newEvent.SetFlags(calendarEvent->GetFlags());
newEvent.SetTime(action.Event.GetTime());
newEvent.SetTimeZoneTime(calendarEvent->GetTimeZoneTime());
newEvent.SetRepeatable(calendarEvent->GetRepeatable());
newEvent.SetDungeonId(calendarEvent->GetDungeonId());
newEvent.SetTitle(calendarEvent->GetTitle());
newEvent.SetDescription(calendarEvent->GetDescription());
newEvent.SetMaxInvites(calendarEvent->GetMaxInvites());
newEvent.SetCreatorGUID(calendarEvent->GetCreatorGUID());
newEvent.SetGuildId(calendarEvent->GetGuildId());
CalendarInviteIdList const invites = calendarEvent->GetInviteIdList();
for (CalendarInviteIdList::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
{
if (CalendarInvite* invite = GetInvite(*itr))
{
uint64 inviteId = GetFreeInviteId();
CalendarInvite newInvite(inviteId);
newInvite.SetEventId(eventId);
newInvite.SetSenderGUID(action.GetPlayer()->GetGUID());
newInvite.SetInvitee(invite->GetInvitee());
newInvite.SetStatus(invite->GetStatus());
newInvite.SetStatusTime(invite->GetStatusTime());
newInvite.SetText(invite->GetText());
newInvite.SetRank(invite->GetRank());
if (AddInvite(newInvite))
{
SendCalendarEventInviteAlert(newEvent, newInvite);
newEvent.AddInvite(inviteId);
}
}
}
if (AddEvent(newEvent))
SendCalendarEvent(newEvent, CALENDAR_SENDTYPE_COPY);
break;
}
case CALENDAR_ACTION_REMOVE_EVENT:
{
uint64 eventId = action.Event.GetEventId();
//uint32 flags = action.Event.GetFlags();
// FIXME - Use of Flags here!
CalendarEvent* calendarEvent = CheckPermisions(eventId, action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_OWNER);
if (!calendarEvent)
return;
CalendarInviteIdList const& inviteIds = calendarEvent->GetInviteIdList();
for (CalendarInviteIdList::const_iterator it = inviteIds.begin(); it != inviteIds.end(); ++it)
if (uint64 invitee = RemoveInvite(*it))
SendCalendarEventRemovedAlert(invitee, *calendarEvent);
RemoveEvent(eventId);
break;
}
case CALENDAR_ACTION_ADD_EVENT_INVITE:
{
uint64 eventId = action.Invite.GetEventId();
CalendarEvent* calendarEvent = CheckPermisions(eventId, action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_MODERATOR);
if (!calendarEvent)
return;
if (AddInvite(action.Invite))
{
calendarEvent->AddInvite(action.Invite.GetInviteId());
SendCalendarEventInvite(action.Invite, (!(calendarEvent->GetFlags() & CALENDAR_FLAG_INVITES_LOCKED) &&
!action.Invite.GetStatusTime()));
SendCalendarEventInviteAlert(*calendarEvent, action.Invite);
}
break;
}
case CALENDAR_ACTION_SIGNUP_TO_EVENT:
{
uint64 eventId = action.Event.GetEventId();
CalendarEvent* calendarEvent = GetEvent(eventId);
CheckPermisions(eventId, action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_MODERATOR);
if (!calendarEvent || !(calendarEvent->GetFlags() & CALENDAR_FLAG_GUILD_ONLY)
|| !calendarEvent->GetGuildId() || calendarEvent->GetGuildId() != action.GetExtraData())
return;
CalendarInviteStatus status = action.Invite.GetStatus();
if (status == CALENDAR_STATUS_INVITED)
status = CALENDAR_STATUS_CONFIRMED;
else if (status == CALENDAR_STATUS_ACCEPTED)
status = CALENDAR_STATUS_8;
CalendarInvite newInvite(GetFreeInviteId());
newInvite.SetStatus(status);
newInvite.SetStatusTime(uint32(time(NULL)));
newInvite.SetEventId(eventId);
newInvite.SetInvitee(action.GetPlayer()->GetGUID());
newInvite.SetSenderGUID(action.GetPlayer()->GetGUID());
if (AddInvite(newInvite))
SendCalendarEventInvite(newInvite, false);
break;
}
case CALENDAR_ACTION_MODIFY_EVENT_INVITE:
{
uint64 eventId = action.Invite.GetEventId();
uint64 inviteId = action.Invite.GetInviteId();
CalendarEvent* calendarEvent;
if (action.GetInviteId() != action.Invite.GetInviteId())
calendarEvent = CheckPermisions(eventId, action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_MODERATOR);
else
calendarEvent = GetEvent(eventId);
CalendarInvite* invite = GetInvite(inviteId);
if (!calendarEvent || !invite || !calendarEvent->HasInvite(inviteId))
return;
invite->SetStatus(action.Invite.GetStatus());
SendCalendarEventStatus(invite->GetSenderGUID(), *calendarEvent, *invite);
break;
}
case CALENDAR_ACTION_MODIFY_MODERATOR_EVENT_INVITE:
{
uint64 eventId = action.Invite.GetEventId();
uint64 inviteId = action.Invite.GetInviteId();
CalendarEvent* calendarEvent;
if (action.GetInviteId() != action.Invite.GetInviteId())
calendarEvent = CheckPermisions(eventId, action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_OWNER);
else
calendarEvent = GetEvent(eventId);
CalendarInvite* invite = GetInvite(inviteId);
if (!calendarEvent || !invite || !calendarEvent->HasInvite(inviteId))
return;
invite->SetStatus(action.Invite.GetStatus());
SendCalendarEventModeratorStatusAlert(*invite);
break;
}
case CALENDAR_ACTION_REMOVE_EVENT_INVITE:
{
uint64 eventId = action.Invite.GetEventId();
uint64 inviteId = action.Invite.GetInviteId();
CalendarEvent* calendarEvent = CheckPermisions(eventId, action.GetPlayer(), action.GetInviteId(), CALENDAR_RANK_MODERATOR);
if (!calendarEvent)
return;
// already checked in CheckPermisions
CalendarInvite* invite = GetInvite(inviteId);
if (calendarEvent->GetCreatorGUID() == invite->GetInvitee())
{
action.GetPlayer()->GetSession()->SendCalendarCommandResult(CALENDAR_ERROR_DELETE_CREATOR_FAILED);
return;
}
if (uint64 invitee = RemoveInvite(inviteId))
{
SendCalendarEventInviteRemoveAlert(invitee, *calendarEvent, CALENDAR_STATUS_9);
SendCalendarEventInviteRemove(action.GetPlayer()->GetGUID(), action.Invite, calendarEvent->GetFlags());
}
break;
}
default:
break;
}
}
bool CalendarMgr::AddEvent(CalendarEvent const& newEvent)
{
uint64 eventId = newEvent.GetEventId();
if (_events.find(eventId) != _events.end())
{
sLog->outError("CalendarMgr::AddEvent: Event [" UI64FMTD "] exists", eventId);
return false;
}
_events[eventId] = newEvent;
return true;
}
bool CalendarMgr::RemoveEvent(uint64 eventId)
{
CalendarEventMap::iterator itr = _events.find(eventId);
if (itr == _events.end())
{
sLog->outError("CalendarMgr::RemoveEvent: Event [" UI64FMTD "] does not exist", eventId);
return false;
}
_events.erase(itr);
bool val = true;
CalendarInviteIdList const& invites = itr->second.GetInviteIdList();
for (CalendarInviteIdList::const_iterator itr = invites.begin(); itr != invites.end(); ++itr)
{
CalendarInvite* invite = GetInvite(*itr);
if (!invite || !RemovePlayerEvent(invite->GetInvitee(), eventId))
val = false;
}
return val;
}
bool CalendarMgr::AddPlayerEvent(uint64 guid, uint64 eventId)
{
_playerEvents[guid].insert(eventId);
return true;
}
bool CalendarMgr::RemovePlayerEvent(uint64 guid, uint64 eventId)
{
_playerEvents[guid].erase(eventId);
return true;
}
bool CalendarMgr::AddInvite(CalendarInvite const& newInvite)
{
uint64 inviteId = newInvite.GetInviteId();
if (!inviteId)
{
sLog->outError("CalendarMgr::AddInvite: Cant add Invite 0");
return false;
}
if (_invites.find(inviteId) != _invites.end())
{
sLog->outError("CalendarMgr::AddInvite: Invite [" UI64FMTD "] exists", inviteId);
return false;
}
_invites[inviteId] = newInvite;
uint64 guid = newInvite.GetInvitee();
bool inviteAdded = AddPlayerInvite(guid, inviteId);
bool eventAdded = AddPlayerEvent(guid, newInvite.GetEventId());
return eventAdded && inviteAdded;
}
uint64 CalendarMgr::RemoveInvite(uint64 inviteId)
{
CalendarInviteMap::iterator itr = _invites.find(inviteId);
if (itr == _invites.end())
{
sLog->outError("CalendarMgr::RemoveInvite: Invite [" UI64FMTD "] does not exist", inviteId);
return 0;
}
uint64 invitee = itr->second.GetInvitee();
_invites.erase(itr);
return RemovePlayerInvite(invitee, inviteId) ? invitee : 0;
}
bool CalendarMgr::AddPlayerInvite(uint64 guid, uint64 inviteId)
{
_playerInvites[guid].insert(inviteId);
return true;
}
bool CalendarMgr::RemovePlayerInvite(uint64 guid, uint64 inviteId)
{
_playerInvites[guid].erase(inviteId);
return true;
}
void CalendarMgr::SendCalendarEvent(CalendarEvent const& calendarEvent, CalendarSendEventType type)
{
if (Player* player = ObjectAccessor::FindPlayer(calendarEvent.GetCreatorGUID()))
player->GetSession()->SendCalendarEvent(calendarEvent, type);
}
void CalendarMgr::SendCalendarEventInvite(CalendarInvite const& invite, bool pending)
{
if (Player* player = ObjectAccessor::FindPlayer(invite.GetSenderGUID()))
player->GetSession()->SendCalendarEventInvite(invite, pending);
}
void CalendarMgr::SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite)
{
if (Player* player = ObjectAccessor::FindPlayer(invite.GetInvitee()))
player->GetSession()->SendCalendarEventInviteAlert(calendarEvent, invite);
}
void CalendarMgr::SendCalendarEventUpdateAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType type)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
player->GetSession()->SendCalendarEventUpdateAlert(calendarEvent, type);
}
void CalendarMgr::SendCalendarEventStatus(uint64 guid, CalendarEvent const& calendarEvent, CalendarInvite const& invite)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
player->GetSession()->SendCalendarEventStatus(calendarEvent, invite);
}
void CalendarMgr::SendCalendarEventRemovedAlert(uint64 guid, CalendarEvent const& calendarEvent)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
player->GetSession()->SendCalendarEventRemovedAlert(calendarEvent);
}
void CalendarMgr::SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
player->GetSession()->SendCalendarEventInviteRemoveAlert(calendarEvent, status);
}
void CalendarMgr::SendCalendarEventInviteRemove(uint64 guid, CalendarInvite const& invite, uint32 flags)
{
if (Player* player = ObjectAccessor::FindPlayer(guid))
player->GetSession()->SendCalendarEventInviteRemove(invite, flags);
}
void CalendarMgr::SendCalendarEventModeratorStatusAlert(CalendarInvite const& invite)
{
if (Player* player = ObjectAccessor::FindPlayer(invite.GetInvitee()))
player->GetSession()->SendCalendarEventModeratorStatusAlert(invite);
}
+80
View File
@@ -0,0 +1,80 @@
/*
* Copyright (C) 2008-2012 TrinityCore <http://www.trinitycore.org/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef TRINITY_CALENDARMGR_H
#define TRINITY_CALENDARMGR_H
#include <ace/Singleton.h>
#include "Calendar.h"
class CalendarMgr
{
friend class ACE_Singleton<CalendarMgr, ACE_Null_Mutex>;
CalendarMgr();
~CalendarMgr();
public:
void LoadFromDB();
CalendarInvite* GetInvite(uint64 inviteId);
CalendarEvent* GetEvent(uint64 eventId);
CalendarInviteIdList const& GetPlayerInvites(uint64 guid);
CalendarEventIdList const& GetPlayerEvents(uint64 guid);
uint32 GetPlayerNumPending(uint64 guid);
uint64 GetFreeEventId();
uint64 GetFreeInviteId();
void AddAction(CalendarAction const& action);
void SendCalendarEvent(CalendarEvent const& calendarEvent, CalendarSendEventType type);
void SendCalendarEventInvite(CalendarInvite const& invite, bool pending);
void SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite);
void SendCalendarEventInviteRemove(uint64 guid, CalendarInvite const& invite, uint32 flags);
void SendCalendarEventInviteRemoveAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarInviteStatus status);
void SendCalendarEventUpdateAlert(uint64 guid, CalendarEvent const& calendarEvent, CalendarSendEventType type);
void SendCalendarEventStatus(uint64 guid, CalendarEvent const& calendarEvent, CalendarInvite const& invite);
void SendCalendarEventRemovedAlert(uint64 guid, CalendarEvent const& calendarEvent);
void SendCalendarEventModeratorStatusAlert(CalendarInvite const& invite);
private:
CalendarEvent* CheckPermisions(uint64 eventId, Player* player, uint64 inviteId, CalendarModerationRank minRank);
bool AddEvent(CalendarEvent const& calendarEvent);
bool RemoveEvent(uint64 eventId);
bool AddPlayerEvent(uint64 guid, uint64 eventId);
bool RemovePlayerEvent(uint64 guid, uint64 eventId);
bool AddInvite(CalendarInvite const& invite);
uint64 RemoveInvite(uint64 inviteId);
bool AddPlayerInvite(uint64 guid, uint64 inviteId);
bool RemovePlayerInvite(uint64 guid, uint64 inviteId);
CalendarEventMap _events;
CalendarInviteMap _invites;
CalendarPlayerInviteIdMap _playerInvites;
CalendarPlayerEventIdMap _playerEvents;
uint64 _eventNum;
uint64 _inviteNum;
};
#define sCalendarMgr ACE_Singleton<CalendarMgr, ACE_Null_Mutex>::instance()
#endif
+1 -1
View File
@@ -671,7 +671,7 @@ void Channel::Invite(uint64 p, const char *newname)
}
Player* newp = sObjectAccessor->FindPlayerByName(newname);
if (!newp)
if (!newp || !newp->isGMVisible())
{
WorldPacket data;
MakePlayerNotFound(&data, newname);
+6 -5
View File
@@ -140,10 +140,10 @@ ChatCommand* ChatHandler::getCommandTable()
static ChatCommand groupCommandTable[] =
{
{ "leader", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGroupLeaderCommand>, "", NULL },
{ "disband", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGroupDisbandCommand>, "", NULL },
{ "remove", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGroupRemoveCommand>, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
{ "leader", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGroupLeaderCommand>, "", NULL },
{ "disband", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGroupDisbandCommand>, "", NULL },
{ "remove", SEC_ADMINISTRATOR, false, OldHandler<&ChatHandler::HandleGroupRemoveCommand>, "", NULL },
{ NULL, 0, false, NULL, "", NULL }
};
static ChatCommand guildCommandTable[] =
@@ -281,7 +281,7 @@ ChatCommand* ChatHandler::getCommandTable()
{ "corpses", SEC_GAMEMASTER, true, OldHandler<&ChatHandler::HandleServerCorpsesCommand>, "", NULL },
{ "exit", SEC_CONSOLE, true, OldHandler<&ChatHandler::HandleServerExitCommand>, "", NULL },
{ "idlerestart", SEC_ADMINISTRATOR, true, NULL, "", serverIdleRestartCommandTable },
{ "idleshutdown", SEC_ADMINISTRATOR, true, NULL, "", serverShutdownCommandTable },
{ "idleshutdown", SEC_ADMINISTRATOR, true, NULL, "", serverIdleShutdownCommandTable },
{ "info", SEC_PLAYER, true, OldHandler<&ChatHandler::HandleServerInfoCommand>, "", NULL },
{ "motd", SEC_PLAYER, true, OldHandler<&ChatHandler::HandleServerMotdCommand>, "", NULL },
{ "plimit", SEC_ADMINISTRATOR, true, OldHandler<&ChatHandler::HandleServerPLimitCommand>, "", NULL },
@@ -336,6 +336,7 @@ ChatCommand* ChatHandler::getCommandTable()
{ "lookup", SEC_ADMINISTRATOR, true, NULL, "", lookupCommandTable },
{ "pdump", SEC_ADMINISTRATOR, true, NULL, "", pdumpCommandTable },
{ "guild", SEC_ADMINISTRATOR, true, NULL, "", guildCommandTable },
{ "group", SEC_ADMINISTRATOR, false, NULL, "", groupCommandTable },
{ "cast", SEC_ADMINISTRATOR, false, NULL, "", castCommandTable },
{ "reset", SEC_ADMINISTRATOR, true, NULL, "", resetCommandTable },
{ "instance", SEC_ADMINISTRATOR, true, NULL, "", instanceCommandTable },
+366 -122
View File
@@ -26,6 +26,7 @@
#include "ConditionMgr.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "Spell.h"
// Checks if object meets the condition
// Can have CONDITION_SOURCE_TYPE_NONE && !mReferenceId if called from a special event (ie: eventAI)
@@ -94,14 +95,14 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
}
case CONDITION_CLASS:
{
if (Player* player = object->ToPlayer())
condMeets = player->getClassMask() & ConditionValue1;
if (Unit* unit = object->ToUnit())
condMeets = unit->getClassMask() & ConditionValue1;
break;
}
case CONDITION_RACE:
{
if (Player* player = object->ToPlayer())
condMeets = player->getRaceMask() & ConditionValue1;
if (Unit* unit = object->ToUnit())
condMeets = unit->getRaceMask() & ConditionValue1;
break;
}
case CONDITION_SKILL:
@@ -113,7 +114,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
case CONDITION_QUESTREWARDED:
{
if (Player* player = object->ToPlayer())
condMeets = (player->GetQuestRewardStatus(ConditionValue1) == !ConditionValue2);
condMeets = player->GetQuestRewardStatus(ConditionValue1);
break;
}
case CONDITION_QUESTTAKEN:
@@ -121,7 +122,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
if (Player* player = object->ToPlayer())
{
QuestStatus status = player->GetQuestStatus(ConditionValue1);
condMeets = ((status == QUEST_STATUS_INCOMPLETE) == !ConditionValue2);
condMeets = (status == QUEST_STATUS_INCOMPLETE);
}
break;
}
@@ -130,7 +131,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
if (Player* player = object->ToPlayer())
{
QuestStatus status = player->GetQuestStatus(ConditionValue1);
condMeets = ((status == QUEST_STATUS_COMPLETE && !player->GetQuestRewardStatus(ConditionValue1)) == !ConditionValue2);
condMeets = (status == QUEST_STATUS_COMPLETE && !player->GetQuestRewardStatus(ConditionValue1));
}
break;
}
@@ -139,7 +140,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
if (Player* player = object->ToPlayer())
{
QuestStatus status = player->GetQuestStatus(ConditionValue1);
condMeets = ((status == QUEST_STATUS_NONE) == !ConditionValue2);
condMeets = (status == QUEST_STATUS_NONE);
}
break;
}
@@ -153,9 +154,6 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
condMeets = ((InstanceMap*)map)->GetInstanceScript()->GetData(ConditionValue1) == ConditionValue2;
break;
}
case CONDITION_SPELL_SCRIPT_TARGET:
condMeets = true;//spell target condition is handled in spellsystem, here it is always true
break;
case CONDITION_MAPID:
condMeets = object->GetMapId() == ConditionValue1;
break;
@@ -291,12 +289,153 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo)
return condMeets && script;
}
uint32 Condition::GetSearcherTypeMaskForCondition()
{
// build mask of types for which condition can return true
// this is used for speeding up gridsearches
if (NegativeCondition)
return (GRID_MAP_TYPE_MASK_ALL);
uint32 mask = 0;
switch (ConditionType)
{
case CONDITION_NONE:
mask |= GRID_MAP_TYPE_MASK_ALL;
break;
case CONDITION_AURA:
mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_ITEM:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_ITEM_EQUIPPED:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_ZONEID:
mask |= GRID_MAP_TYPE_MASK_ALL;
break;
case CONDITION_REPUTATION_RANK:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_ACHIEVEMENT:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_TEAM:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_CLASS:
mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_RACE:
mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_SKILL:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_QUESTREWARDED:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_QUESTTAKEN:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_QUEST_COMPLETE:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_QUEST_NONE:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_ACTIVE_EVENT:
mask |= GRID_MAP_TYPE_MASK_ALL;
break;
case CONDITION_INSTANCE_DATA:
mask |= GRID_MAP_TYPE_MASK_ALL;
break;
case CONDITION_MAPID:
mask |= GRID_MAP_TYPE_MASK_ALL;
break;
case CONDITION_AREAID:
mask |= GRID_MAP_TYPE_MASK_ALL;
break;
case CONDITION_SPELL:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_LEVEL:
mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_DRUNKENSTATE:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_NEAR_CREATURE:
mask |= GRID_MAP_TYPE_MASK_ALL;
break;
case CONDITION_NEAR_GAMEOBJECT:
mask |= GRID_MAP_TYPE_MASK_ALL;
break;
case CONDITION_OBJECT_ENTRY:
switch (ConditionValue1)
{
case TYPEID_UNIT:
mask |= GRID_MAP_TYPE_MASK_CREATURE;
break;
case TYPEID_PLAYER:
mask |= GRID_MAP_TYPE_MASK_PLAYER;
break;
case TYPEID_GAMEOBJECT:
mask |= GRID_MAP_TYPE_MASK_GAMEOBJECT;
break;
case TYPEID_CORPSE:
mask |= GRID_MAP_TYPE_MASK_CORPSE;
break;
default:
break;
}
case CONDITION_TYPE_MASK:
if (ConditionValue1 & TYPEMASK_UNIT)
mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER;
if (ConditionValue1 & TYPEMASK_PLAYER)
mask |= GRID_MAP_TYPE_MASK_PLAYER;
if (ConditionValue1 & TYPEMASK_GAMEOBJECT)
mask |= GRID_MAP_TYPE_MASK_GAMEOBJECT;
if (ConditionValue1 & TYPEMASK_CORPSE)
mask |= GRID_MAP_TYPE_MASK_CORPSE;
break;
case CONDITION_RELATION_TO:
mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_REACTION_TO:
mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_DISTANCE_TO:
mask |= GRID_MAP_TYPE_MASK_ALL;
break;
case CONDITION_ALIVE:
mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_HP_VAL:
mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_HP_PCT:
mask |= GRID_MAP_TYPE_MASK_CREATURE | GRID_MAP_TYPE_MASK_PLAYER;
break;
case CONDITION_WORLD_STATE:
mask |= GRID_MAP_TYPE_MASK_ALL;
break;
case CONDITION_PHASEMASK:
mask |= GRID_MAP_TYPE_MASK_ALL;
break;
default:
ASSERT(false && "Condition::GetSearcherTypeMaskForCondition - missing condition handling!");
break;
}
return mask;
}
uint32 Condition::GetMaxAvailableConditionTargets()
{
// returns number of targets which are available for given source type
switch(SourceType)
{
case CONDITION_SOURCE_TYPE_SPELL:
case CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET:
case CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE:
case CONDITION_SOURCE_TYPE_VEHICLE_SPELL:
case CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT:
@@ -327,15 +466,58 @@ ConditionList ConditionMgr::GetConditionReferences(uint32 refId)
return conditions;
}
uint32 ConditionMgr::GetSearcherTypeMaskForConditionList(ConditionList const& conditions)
{
if (conditions.empty())
return GRID_MAP_TYPE_MASK_ALL;
// groupId, typeMask
std::map<uint32, uint32> ElseGroupStore;
for (ConditionList::const_iterator i = conditions.begin(); i != conditions.end(); ++i)
{
// no point of having not loaded conditions in list
ASSERT((*i)->isLoaded() && "ConditionMgr::GetSearcherTypeMaskForConditionList - not yet loaded condition found in list");
std::map<uint32, uint32>::const_iterator itr = ElseGroupStore.find((*i)->ElseGroup);
// group not filled yet, fill with widest mask possible
if (itr == ElseGroupStore.end())
ElseGroupStore[(*i)->ElseGroup] = GRID_MAP_TYPE_MASK_ALL;
// no point of checking anymore, empty mask
else if (!(*itr).second)
continue;
if ((*i)->ReferenceId) // handle reference
{
ConditionReferenceContainer::const_iterator ref = ConditionReferenceStore.find((*i)->ReferenceId);
ASSERT(ref != ConditionReferenceStore.end() && "ConditionMgr::GetSearcherTypeMaskForConditionList - incorrect reference");
ElseGroupStore[(*i)->ElseGroup] &= GetSearcherTypeMaskForConditionList((*ref).second);
}
else // handle normal condition
{
// object will match conditions in one ElseGroupStore only when it matches all of them
// so, let's find a smallest possible mask which satisfies all conditions
ElseGroupStore[(*i)->ElseGroup] &= (*i)->GetSearcherTypeMaskForCondition();
}
}
// object will match condition when one of the checks in ElseGroupStore is matching
// so, let's include all possible masks
uint32 mask = 0;
for (std::map<uint32, uint32>::const_iterator i = ElseGroupStore.begin(); i != ElseGroupStore.end(); ++i)
mask |= i->second;
return mask;
}
bool ConditionMgr::IsObjectMeetToConditionList(ConditionSourceInfo& sourceInfo, ConditionList const& conditions)
{
// groupId, groupCheckPassed
std::map<uint32, bool> ElseGroupStore;
for (ConditionList::const_iterator i = conditions.begin(); i != conditions.end(); ++i)
{
sLog->outDebug(LOG_FILTER_CONDITIONSYS, "ConditionMgr::IsPlayerMeetToConditionList condType: %u val1: %u", (*i)->ConditionType, (*i)->ConditionValue1);
if ((*i)->isLoaded())
{
//! Find ElseGroup in ElseGroupStore
std::map<uint32, bool>::const_iterator itr = ElseGroupStore.find((*i)->ElseGroup);
//! If not found, add an entry in the store and set to true (placeholder)
if (itr == ElseGroupStore.end())
ElseGroupStore[(*i)->ElseGroup] = true;
else if (!(*itr).second)
@@ -391,6 +573,33 @@ bool ConditionMgr::IsObjectMeetToConditions(ConditionSourceInfo& sourceInfo, Con
return IsObjectMeetToConditionList(sourceInfo, conditions);
}
bool ConditionMgr::CanHaveSourceGroupSet(ConditionSourceType sourceType) const
{
return (sourceType == CONDITION_SOURCE_TYPE_CREATURE_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_DISENCHANT_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_FISHING_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_GAMEOBJECT_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_ITEM_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_MAIL_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_MILLING_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_PICKPOCKETING_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_PROSPECTING_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_REFERENCE_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_SKINNING_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_SPELL_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_GOSSIP_MENU ||
sourceType == CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION ||
sourceType == CONDITION_SOURCE_TYPE_VEHICLE_SPELL ||
sourceType == CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET ||
sourceType == CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT ||
sourceType == CONDITION_SOURCE_TYPE_SMART_EVENT);
}
bool ConditionMgr::CanHaveSourceIdSet(ConditionSourceType sourceType) const
{
return (sourceType == CONDITION_SOURCE_TYPE_SMART_EVENT);
}
ConditionList ConditionMgr::GetConditionsForNotGroupedEntry(ConditionSourceType sourceType, uint32 entry)
{
ConditionList spellCond;
@@ -487,6 +696,7 @@ void ConditionMgr::LoadConditions(bool isReload)
sLog->outString("Re-Loading `gossip_menu_option` Table for Conditions!");
sObjectMgr->LoadGossipMenuItems();
sSpellMgr->UnloadSpellInfoImplicitTargetConditionLists();
}
QueryResult result = WorldDatabase.Query("SELECT SourceTypeOrReferenceId, SourceGroup, SourceEntry, SourceId, ElseGroup, ConditionTypeOrReference, ConditionTarget, "
@@ -583,16 +793,23 @@ void ConditionMgr::LoadConditions(bool isReload)
}
//Grouping is only allowed for some types (loot templates, gossip menus, gossip items)
if (cond->SourceGroup && !isGroupable(cond->SourceType))
if (cond->SourceGroup && !CanHaveSourceGroupSet(cond->SourceType))
{
sLog->outErrorDb("Condition type %u has not allowed grouping %u!", uint32(cond->SourceType), cond->SourceGroup);
sLog->outErrorDb("Condition type %u has not allowed value of SourceGroup = %u!", uint32(cond->SourceType), cond->SourceGroup);
delete cond;
continue;
}
else if (cond->SourceGroup)
if (cond->SourceId && !CanHaveSourceIdSet(cond->SourceType))
{
sLog->outErrorDb("Condition type %u has not allowed value of SourceId = %u!", uint32(cond->SourceType), cond->SourceId);
delete cond;
continue;
}
if (cond->SourceGroup)
{
bool valid = false;
//handle grouped conditions
// handle grouped conditions
switch (cond->SourceType)
{
case CONDITION_SOURCE_TYPE_CREATURE_LOOT_TEMPLATE:
@@ -637,20 +854,19 @@ void ConditionMgr::LoadConditions(bool isReload)
case CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION:
valid = addToGossipMenuItems(cond);
break;
case CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT:
{
SpellClickEventConditionStore[cond->SourceGroup][cond->SourceEntry].push_back(cond);
valid = true;
++count;
continue; // do not add to m_AllocatedMemory to avoid double deleting
break;
}
case CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET:
valid = addToSpellImplicitTargetConditions(cond);
break;
case CONDITION_SOURCE_TYPE_VEHICLE_SPELL:
{
//if no list for vehicle create one
if (VehicleSpellConditionStore.find(cond->SourceGroup) == VehicleSpellConditionStore.end())
{
ConditionTypeContainer cmap;
VehicleSpellConditionStore[cond->SourceGroup] = cmap;
}
//if no list for vehicle's spell create one
if (VehicleSpellConditionStore[cond->SourceGroup].find(cond->SourceEntry) == VehicleSpellConditionStore[cond->SourceGroup].end())
{
ConditionList clist;
VehicleSpellConditionStore[cond->SourceGroup][cond->SourceEntry] = clist;
}
VehicleSpellConditionStore[cond->SourceGroup][cond->SourceEntry].push_back(cond);
valid = true;
++count;
@@ -658,18 +874,8 @@ void ConditionMgr::LoadConditions(bool isReload)
}
case CONDITION_SOURCE_TYPE_SMART_EVENT:
{
// If the entry does not exist, create a new list
//! TODO: PAIR_32 ?
std::pair<int32, uint32> key = std::make_pair(cond->SourceEntry, cond->SourceId);
if (SmartEventConditionStore.find(key) == SmartEventConditionStore.end())
{
ConditionTypeContainer cmap;
SmartEventConditionStore[key] = cmap;
}
if (SmartEventConditionStore[key].find(cond->SourceGroup) == SmartEventConditionStore[key].end())
{
ConditionList clist;
SmartEventConditionStore[key][cond->SourceGroup] = clist;
}
SmartEventConditionStore[key][cond->SourceGroup].push_back(cond);
valid = true;
++count;
@@ -771,6 +977,78 @@ bool ConditionMgr::addToGossipMenuItems(Condition* cond)
return false;
}
bool ConditionMgr::addToSpellImplicitTargetConditions(Condition* cond)
{
uint32 conditionEffMask = cond->SourceGroup;
SpellInfo* spellInfo = const_cast<SpellInfo*>(sSpellMgr->GetSpellInfo(cond->SourceEntry));
ASSERT(spellInfo);
std::list<uint32> sharedMasks;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
// check if effect is already a part of some shared mask
bool found = false;
for (std::list<uint32>::iterator itr = sharedMasks.begin(); itr != sharedMasks.end(); ++itr)
{
if ((1<<i) & *itr)
{
found = true;
break;
}
}
if (found)
continue;
// build new shared mask with found effect
uint32 sharedMask = (1<<i);
ConditionList* cmp = spellInfo->Effects[i].ImplicitTargetConditions;
for (uint8 effIndex = i+1; effIndex < MAX_SPELL_EFFECTS; ++effIndex)
{
if (spellInfo->Effects[effIndex].ImplicitTargetConditions == cmp)
sharedMask |= 1<<effIndex;
}
sharedMasks.push_back(sharedMask);
}
for (std::list<uint32>::iterator itr = sharedMasks.begin(); itr != sharedMasks.end(); ++itr)
{
// some effect indexes should have same data
if (uint32 commonMask = *itr & conditionEffMask)
{
uint8 firstEffIndex = 0;
for (; firstEffIndex < MAX_SPELL_EFFECTS; ++firstEffIndex)
if ((1<<firstEffIndex) & *itr)
break;
// get shared data
ConditionList* sharedList = spellInfo->Effects[firstEffIndex].ImplicitTargetConditions;
// there's already data entry for that sharedMask
if (sharedList)
{
// we have overlapping masks in db
if (conditionEffMask != *itr)
{
sLog->outErrorDb("SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set - "
"effect masks are overlapping (all SourceGroup values having given bit set must be equal) - ignoring.", cond->SourceEntry, cond->SourceGroup);
return false;
}
}
// no data for shared mask, we can create new submask
else
{
// add new list, create new shared mask
sharedList = new ConditionList();
for (uint8 i = firstEffIndex; i < MAX_SPELL_EFFECTS; ++i)
if ((1<<i) & commonMask)
spellInfo->Effects[i].ImplicitTargetConditions = sharedList;
}
sharedList->push_back(cond);
break;
}
}
return true;
}
bool ConditionMgr::isSourceTypeValid(Condition* cond)
{
if (cond->SourceType == CONDITION_SOURCE_TYPE_NONE || cond->SourceType >= CONDITION_SOURCE_TYPE_MAX)
@@ -985,64 +1263,54 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
}
break;
}
case CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET:
case CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET:
{
if (cond->ConditionType != CONDITION_SPELL_SCRIPT_TARGET)
{
sLog->outErrorDb("SourceEntry %u in `condition` table, has ConditionType %u. Only CONDITION_SPELL_SCRIPT_TARGET(18) is valid for CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET(14), ignoring.", cond->SourceEntry, uint32(cond->ConditionType));
return false;
}
SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cond->SourceEntry);
if (!spellProto)
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(cond->SourceEntry);
if (!spellInfo)
{
sLog->outErrorDb("SourceEntry %u in `condition` table, does not exist in `spell.dbc`, ignoring.", cond->SourceEntry);
return false;
}
bool targetfound = false;
if ((cond->SourceGroup > MAX_EFFECT_MASK) || !cond->SourceGroup)
{
sLog->outErrorDb("SourceEntry %u in `condition` table, has incorrect SourceGroup %u (spell effectMask) set , ignoring.", cond->SourceEntry, cond->SourceGroup);
return false;
}
uint32 origGroup = cond->SourceGroup;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (spellProto->Effects[i].TargetA.GetTarget() == TARGET_UNIT_SRC_AREA_ENTRY ||
spellProto->Effects[i].TargetB.GetTarget() == TARGET_UNIT_SRC_AREA_ENTRY ||
spellProto->Effects[i].TargetA.GetTarget() == TARGET_UNIT_DEST_AREA_ENTRY ||
spellProto->Effects[i].TargetB.GetTarget() == TARGET_UNIT_DEST_AREA_ENTRY ||
spellProto->Effects[i].TargetA.GetTarget() == TARGET_UNIT_NEARBY_ENTRY ||
spellProto->Effects[i].TargetB.GetTarget() == TARGET_UNIT_NEARBY_ENTRY ||
spellProto->Effects[i].TargetA.GetTarget() == TARGET_GAMEOBJECT_NEARBY_ENTRY ||
spellProto->Effects[i].TargetB.GetTarget() == TARGET_GAMEOBJECT_NEARBY_ENTRY ||
spellProto->Effects[i].TargetA.GetTarget() == TARGET_GAMEOBJECT_SRC_AREA ||
spellProto->Effects[i].TargetB.GetTarget() == TARGET_GAMEOBJECT_SRC_AREA ||
spellProto->Effects[i].TargetA.GetTarget() == TARGET_GAMEOBJECT_DEST_AREA ||
spellProto->Effects[i].TargetB.GetTarget() == TARGET_GAMEOBJECT_DEST_AREA ||
spellProto->Effects[i].TargetA.GetTarget() == TARGET_DEST_NEARBY_ENTRY ||
spellProto->Effects[i].TargetB.GetTarget() == TARGET_DEST_NEARBY_ENTRY ||
spellProto->Effects[i].TargetA.GetTarget() == TARGET_UNIT_CONE_ENTRY ||
spellProto->Effects[i].TargetB.GetTarget() == TARGET_UNIT_CONE_ENTRY)
if (!((1<<i) & cond->SourceGroup))
continue;
switch (spellInfo->Effects[i].TargetA.GetSelectionCategory())
{
targetfound = true;
//break;
case TARGET_SELECT_CATEGORY_NEARBY:
case TARGET_SELECT_CATEGORY_CONE:
case TARGET_SELECT_CATEGORY_AREA:
continue;
default:
break;
}
else if (cond->ConditionValue3 & (1 << i))
switch (spellInfo->Effects[i].TargetB.GetSelectionCategory())
{
cond->ConditionValue3 &= ~(1 << i);
sLog->outErrorDb("SourceEntry %u in `condition` table does not have any implicit target TARGET_UNIT_NEARBY_ENTRY(38) or TARGET_DEST_NEARBY_ENTRY (46)"
", TARGET_UNIT_SRC_AREA_ENTRY(7), TARGET_UNIT_DEST_AREA_ENTRY(8), TARGET_UNIT_CONE_ENTRY(60), TARGET_GAMEOBJECT_NEARBY_ENTRY(40)"
"TARGET_GAMEOBJECT_SRC_AREA(51), TARGET_GAMEOBJECT_DEST_AREA(52) in effect %u", cond->SourceEntry, uint32(i));
case TARGET_SELECT_CATEGORY_NEARBY:
case TARGET_SELECT_CATEGORY_CONE:
case TARGET_SELECT_CATEGORY_AREA:
continue;
default:
break;
}
sLog->outErrorDb("SourceEntry %u SourceGroup %u in `condition` table - spell %u does not have implicit targets of types: _AREA_, _CONE_, _NEARBY_ for effect %u, SourceGroup needs correction, ignoring.", cond->SourceEntry, origGroup, cond->SourceEntry, uint32(i));
cond->SourceGroup &= ~(1<<i);
}
if (!targetfound && !cond->ConditionValue3) // cond->mConditionValue3 already errored up there
{
sLog->outErrorDb("SourceEntry %u in `condition` table does not have any implicit target TARGET_UNIT_NEARBY_ENTRY(38) or TARGET_DEST_NEARBY_ENTRY (46)"
", TARGET_UNIT_SRC_AREA_ENTRY(7), TARGET_UNIT_DEST_AREA_ENTRY(8), TARGET_UNIT_CONE_ENTRY(60), TARGET_GAMEOBJECT_NEARBY_ENTRY(40)"
"TARGET_GAMEOBJECT_SRC_AREA(51), TARGET_GAMEOBJECT_DEST_AREA(52)", cond->SourceEntry);
// all effects were removed, no need to add the condition at all
if (!cond->SourceGroup)
return false;
}
if ((cond->ConditionValue1 == SPELL_TARGET_TYPE_DEAD) && !spellProto->IsAllowingDeadTarget())
{
sLog->outErrorDb("SourceEntry %u in `condition` table does have SPELL_TARGET_TYPE_DEAD specified but spell does not have SPELL_ATTR2_CAN_TARGET_DEAD", cond->SourceEntry);
return false;
}
break;
}
case CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE:
@@ -1318,46 +1586,6 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
sLog->outErrorDb("Race condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_SPELL_SCRIPT_TARGET:
{
if (cond->ConditionValue1 >= MAX_SPELL_TARGET_TYPE)
{
sLog->outErrorDb("SpellTarget condition has non existing spell target type (%u), skipped", cond->ConditionValue1);
return false;
}
switch (cond->ConditionValue1)
{
case SPELL_TARGET_TYPE_GAMEOBJECT:
{
if (cond->ConditionValue2 && !sObjectMgr->GetGameObjectTemplate(cond->ConditionValue2))
{
sLog->outErrorDb("SpellTarget condition has non existing gameobject (%u) as target, skipped", cond->ConditionValue2);
return false;
}
break;
}
case SPELL_TARGET_TYPE_CONTROLLED:
case SPELL_TARGET_TYPE_CREATURE:
case SPELL_TARGET_TYPE_DEAD:
{
if (cond->ConditionValue2 && !sObjectMgr->GetCreatureTemplate(cond->ConditionValue2))
{
sLog->outErrorDb("SpellTarget condition has non existing creature template entry (%u) as target, skipped", cond->ConditionValue2);
return false;
}
const CreatureTemplate* cInfo = sObjectMgr->GetCreatureTemplate(cond->ConditionValue2);
if (cond->SourceEntry == 30427 && !cInfo->SkinLootId)
{
sLog->outErrorDb("SpellTarget condition has creature entry %u as a target of spellid 30427, but this creature has no skinlootid. Gas extraction will not work!, skipped", cond->ConditionValue2);
return false;
}
break;
}
}
break;
}
case CONDITION_MAPID:
{
MapEntry const* me = sMapStore.LookupEntry(cond->ConditionValue1);
@@ -1598,6 +1826,9 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond)
sLog->outErrorDb("Phasemask condition has useless data in value3 (%u)!", cond->ConditionValue3);
break;
}
case CONDITION_UNUSED_18:
sLog->outErrorDb("Found ConditionTypeOrReference = CONDITION_UNUSED_18 in `conditions` table - ignoring");
return false;
case CONDITION_UNUSED_19:
sLog->outErrorDb("Found ConditionTypeOrReference = CONDITION_UNUSED_19 in `conditions` table - ignoring");
return false;
@@ -1666,6 +1897,19 @@ void ConditionMgr::Clean()
SmartEventConditionStore.clear();
for (CreatureSpellConditionContainer::iterator itr = SpellClickEventConditionStore.begin(); itr != SpellClickEventConditionStore.end(); ++itr)
{
for (ConditionTypeContainer::iterator it = itr->second.begin(); it != itr->second.end(); ++it)
{
for (ConditionList::const_iterator i = it->second.begin(); i != it->second.end(); ++i)
delete *i;
it->second.clear();
}
itr->second.clear();
}
SpellClickEventConditionStore.clear();
// this is a BIG hack, feel free to fix it if you can figure out the ConditionMgr ;)
for (std::list<Condition*>::const_iterator itr = AllocatedMemoryStore.begin(); itr != AllocatedMemoryStore.end(); ++itr)
delete *itr;
+34 -23
View File
@@ -48,7 +48,7 @@ enum ConditionTypes
CONDITION_CLASS = 15, // class 0 0 true if player's class is equal to class
CONDITION_RACE = 16, // race 0 0 true if player's race is equal to race
CONDITION_ACHIEVEMENT = 17, // achievement_id 0 0 true if achievement is complete
CONDITION_SPELL_SCRIPT_TARGET = 18, // SpellScriptTargetType, TargetEntry, 0
CONDITION_UNUSED_18 = 18, //
CONDITION_UNUSED_19 = 19, //
CONDITION_UNUSED_20 = 20, //
CONDITION_UNUSED_21 = 21, //
@@ -72,6 +72,33 @@ enum ConditionTypes
CONDITION_MAX = 39 // MAX
};
/*! Documentation on implementing a new ConditionSourceType:
Step 1: Check for the lowest free ID. Look for CONDITION_SOURCE_TYPE_UNUSED_XX in the enum.
Then define the new source type.
Step 2: Determine and map the parameters for the new condition type.
Step 3: Add a case block to ConditionMgr::isSourceTypeValid with the new condition type
and validate the parameters.
Step 4: If your condition can be grouped (determined in step 2), add a rule for it in
ConditionMgr::CanHaveSourceGroupSet, following the example of the existing types.
Step 5: Define the maximum available condition targets in ConditionMgr::GetMaxAvailableConditionTargets.
The following steps only apply if your condition can be grouped:
Step 6: Determine how you are going to store your conditions. You need to add a new storage container
for it in ConditionMgr class, along with a function like:
ConditionList GetConditionsForXXXYourNewSourceTypeXXX(parameters...)
The above function should be placed in upper level (practical) code that actually
checks the conditions.
Step 7: Implement loading for your source type in ConditionMgr::LoadConditions.
Step 8: Implement memory cleaning for your source type in ConditionMgr::Clean.
*/
enum ConditionSourceType
{
CONDITION_SOURCE_TYPE_NONE = 0,
@@ -87,7 +114,7 @@ enum ConditionSourceType
CONDITION_SOURCE_TYPE_REFERENCE_LOOT_TEMPLATE = 10,
CONDITION_SOURCE_TYPE_SKINNING_LOOT_TEMPLATE = 11,
CONDITION_SOURCE_TYPE_SPELL_LOOT_TEMPLATE = 12,
CONDITION_SOURCE_TYPE_SPELL_SCRIPT_TARGET = 13,
CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET = 13,
CONDITION_SOURCE_TYPE_GOSSIP_MENU = 14,
CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION = 15,
CONDITION_SOURCE_TYPE_CREATURE_TEMPLATE_VEHICLE = 16,
@@ -173,6 +200,7 @@ struct Condition
}
bool Meets(ConditionSourceInfo& sourceInfo);
uint32 GetSearcherTypeMaskForCondition();
bool isLoaded() const { return ConditionType > CONDITION_NONE || ReferenceId; }
uint32 GetMaxAvailableConditionTargets();
};
@@ -198,9 +226,12 @@ class ConditionMgr
bool isConditionTypeValid(Condition* cond);
ConditionList GetConditionReferences(uint32 refId);
uint32 GetSearcherTypeMaskForConditionList(ConditionList const& conditions);
bool IsObjectMeetToConditions(WorldObject* object, ConditionList const& conditions);
bool IsObjectMeetToConditions(WorldObject* object1, WorldObject* object2, ConditionList const& conditions);
bool IsObjectMeetToConditions(ConditionSourceInfo& sourceInfo, ConditionList const& conditions);
bool CanHaveSourceGroupSet(ConditionSourceType sourceType) const;
bool CanHaveSourceIdSet(ConditionSourceType sourceType) const;
ConditionList GetConditionsForNotGroupedEntry(ConditionSourceType sourceType, uint32 entry);
ConditionList GetConditionsForSpellClickEvent(uint32 creatureId, uint32 spellId);
ConditionList GetConditionsForSmartEvent(int32 entryOrGuid, uint32 eventId, uint32 sourceType);
@@ -211,29 +242,9 @@ class ConditionMgr
bool addToLootTemplate(Condition* cond, LootTemplate* loot);
bool addToGossipMenus(Condition* cond);
bool addToGossipMenuItems(Condition* cond);
bool addToSpellImplicitTargetConditions(Condition* cond);
bool IsObjectMeetToConditionList(ConditionSourceInfo& sourceInfo, ConditionList const& conditions);
bool isGroupable(ConditionSourceType sourceType) const
{
return (sourceType == CONDITION_SOURCE_TYPE_CREATURE_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_DISENCHANT_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_FISHING_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_GAMEOBJECT_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_ITEM_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_MAIL_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_MILLING_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_PICKPOCKETING_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_PROSPECTING_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_REFERENCE_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_SKINNING_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_SPELL_LOOT_TEMPLATE ||
sourceType == CONDITION_SOURCE_TYPE_GOSSIP_MENU ||
sourceType == CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION ||
sourceType == CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT ||
sourceType == CONDITION_SOURCE_TYPE_VEHICLE_SPELL ||
sourceType == CONDITION_SOURCE_TYPE_SMART_EVENT);
}
void Clean(); // free up resources
std::list<Condition*> AllocatedMemoryStore; // some garbage collection :)
+14 -10
View File
@@ -1066,19 +1066,23 @@ struct HolidayNamesEntry
};
*/
#define MAX_HOLIDAY_DURATIONS 10
#define MAX_HOLIDAY_DATES 26
#define MAX_HOLIDAY_FLAGS 10
struct HolidaysEntry
{
uint32 ID; // 0 m_ID
//uint32 duration[10]; // 1-10 m_duration
//uint32 date[26]; // 11-36 m_date (dates in unix time starting at January, 1, 2000)
//uint32 region; // 37 m_region (wow region)
//uint32 looping; // 38 m_looping
//uint32 calendarFlags[10]; // 39-48 m_calendarFlags
uint32 Id; // 0 m_ID
uint32 Duration[MAX_HOLIDAY_DURATIONS]; // 1-10 m_duration
uint32 Date[MAX_HOLIDAY_DATES]; // 11-36 m_date (dates in unix time starting at January, 1, 2000)
uint32 Region; // 37 m_region (wow region)
uint32 Looping; // 38 m_looping
uint32 CalendarFlags[MAX_HOLIDAY_FLAGS]; // 39-48 m_calendarFlags
//uint32 holidayNameId; // 49 m_holidayNameID (HolidayNames.dbc)
//uint32 holidayDescriptionId; // 50 m_holidayDescriptionID (HolidayDescriptions.dbc)
//char *textureFilename; // 51 m_textureFilename
//uint32 priority; // 52 m_priority
//uint32 calendarFilterType; // 53 m_calendarFilterType (-1 = Fishing Contest, 0 = Unk, 1 = Darkmoon Festival, 2 = Yearly holiday)
char* TextureFilename; // 51 m_textureFilename
uint32 Priority; // 52 m_priority
uint32 CalendarFilterType; // 53 m_calendarFilterType (-1 = Fishing Contest, 0 = Unk, 1 = Darkmoon Festival, 2 = Yearly holiday)
//uint32 flags; // 54 m_flags (0 = Darkmoon Faire, Fishing Contest and Wotlk Launch, rest is 1)
};
@@ -1086,7 +1090,7 @@ struct ItemEntry
{
uint32 ID; // 0
uint32 Class; // 1
uint32 SubClass; // 2 some items have strnage subclasses
uint32 SubClass; // 2 some items have strange subclasses
int32 Unk0; // 3
int32 Material; // 4
uint32 DisplayId; // 5
+1 -1
View File
@@ -67,7 +67,7 @@ const char GtOCTRegenHPfmt[]="f";
//const char GtOCTRegenMPfmt[]="f";
const char GtRegenHPPerSptfmt[]="f";
const char GtRegenMPPerSptfmt[]="f";
const char Holidaysfmt[]="nxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
const char Holidaysfmt[]="niiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiixxsiix";
const char Itemfmt[]="niiiiiii";
const char ItemBagFamilyfmt[]="nxxxxxxxxxxxxxxxxx";
//const char ItemDisplayTemplateEntryfmt[]="nxxxxxxxxxxixxxxxxxxxxx";
+1 -1
View File
@@ -32,7 +32,7 @@ Corpse::Corpse(CorpseType type) : WorldObject(type != CORPSE_BONES)
m_objectType |= TYPEMASK_CORPSE;
m_objectTypeId = TYPEID_CORPSE;
m_updateFlag = (UPDATEFLAG_HIGHGUID | UPDATEFLAG_HAS_POSITION | UPDATEFLAG_POSITION);
m_updateFlag = (UPDATEFLAG_LOWGUID | UPDATEFLAG_STATIONARY_POSITION | UPDATEFLAG_POSITION);
m_valuesCount = CORPSE_END;
+42 -42
View File
@@ -303,7 +303,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data
return false;
}
uint32 displayID = sObjectMgr->ChooseDisplayId(0, GetCreatureInfo(), data);
uint32 displayID = sObjectMgr->ChooseDisplayId(0, GetCreatureTemplate(), data);
CreatureModelInfo const* minfo = sObjectMgr->GetCreatureModelRandomGender(&displayID);
if (!minfo) // Cancel load if no model defined
{
@@ -342,7 +342,7 @@ bool Creature::InitEntry(uint32 Entry, uint32 /*team*/, const CreatureData* data
m_defaultMovementType = IDLE_MOTION_TYPE;
for (uint8 i=0; i < CREATURE_MAX_SPELLS; ++i)
m_spells[i] = GetCreatureInfo()->spells[i];
m_spells[i] = GetCreatureTemplate()->spells[i];
return true;
}
@@ -352,14 +352,14 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData* data)
if (!InitEntry(Entry, team, data))
return false;
CreatureTemplate const* cInfo = GetCreatureInfo();
CreatureTemplate const* cInfo = GetCreatureTemplate();
m_regenHealth = cInfo->RegenHealth;
// creatures always have melee weapon ready if any
SetSheath(SHEATH_STATE_MELEE);
SelectLevel(GetCreatureInfo());
SelectLevel(GetCreatureTemplate());
if (team == HORDE)
setFaction(cInfo->faction_H);
else
@@ -754,7 +754,7 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry,
if (!CreateFromProto(guidlow, Entry, vehId, team, data))
return false;
switch (GetCreatureInfo()->rank)
switch (GetCreatureTemplate()->rank)
{
case CREATURE_ELITE_RARE:
m_corpseDelay = sWorld->getIntConfig(CONFIG_CORPSE_DECAY_RARE);
@@ -783,7 +783,7 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry,
SetByteValue(UNIT_FIELD_BYTES_0, 2, minfo->gender);
}
if (GetCreatureInfo()->InhabitType & INHABIT_AIR)
if (GetCreatureTemplate()->InhabitType & INHABIT_AIR)
{
if (GetDefaultMovementType() == IDLE_MOTION_TYPE)
AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY);
@@ -791,10 +791,10 @@ bool Creature::Create(uint32 guidlow, Map* map, uint32 phaseMask, uint32 Entry,
SetFlying(true);
}
if (GetCreatureInfo()->InhabitType & INHABIT_WATER)
if (GetCreatureTemplate()->InhabitType & INHABIT_WATER)
AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
LastUsedScriptID = GetCreatureInfo()->ScriptID;
LastUsedScriptID = GetCreatureTemplate()->ScriptID;
// TODO: Replace with spell, handle from DB
if (isSpiritHealer() || isSpiritGuide())
@@ -816,22 +816,22 @@ bool Creature::isCanTrainingOf(Player* player, bool msg) const
TrainerSpellData const* trainer_spells = GetTrainerSpells();
if ((!trainer_spells || trainer_spells->spellList.empty()) && GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS)
if ((!trainer_spells || trainer_spells->spellList.empty()) && GetCreatureTemplate()->trainer_type != TRAINER_TYPE_PETS)
{
sLog->outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list.",
GetGUIDLow(), GetEntry());
return false;
}
switch (GetCreatureInfo()->trainer_type)
switch (GetCreatureTemplate()->trainer_type)
{
case TRAINER_TYPE_CLASS:
if (player->getClass() != GetCreatureInfo()->trainer_class)
if (player->getClass() != GetCreatureTemplate()->trainer_class)
{
if (msg)
{
player->PlayerTalkClass->ClearMenus();
switch (GetCreatureInfo()->trainer_class)
switch (GetCreatureTemplate()->trainer_class)
{
case CLASS_DRUID: player->PlayerTalkClass->SendGossipMenu(4913, GetGUID()); break;
case CLASS_HUNTER: player->PlayerTalkClass->SendGossipMenu(10090, GetGUID()); break;
@@ -856,12 +856,12 @@ bool Creature::isCanTrainingOf(Player* player, bool msg) const
}
break;
case TRAINER_TYPE_MOUNTS:
if (GetCreatureInfo()->trainer_race && player->getRace() != GetCreatureInfo()->trainer_race)
if (GetCreatureTemplate()->trainer_race && player->getRace() != GetCreatureTemplate()->trainer_race)
{
if (msg)
{
player->PlayerTalkClass->ClearMenus();
switch (GetCreatureInfo()->trainer_class)
switch (GetCreatureTemplate()->trainer_class)
{
case RACE_DWARF: player->PlayerTalkClass->SendGossipMenu(5865, GetGUID()); break;
case RACE_GNOME: player->PlayerTalkClass->SendGossipMenu(4881, GetGUID()); break;
@@ -879,7 +879,7 @@ bool Creature::isCanTrainingOf(Player* player, bool msg) const
}
break;
case TRAINER_TYPE_TRADESKILLS:
if (GetCreatureInfo()->trainer_spell && !player->HasSpell(GetCreatureInfo()->trainer_spell))
if (GetCreatureTemplate()->trainer_spell && !player->HasSpell(GetCreatureTemplate()->trainer_spell))
{
if (msg)
{
@@ -930,8 +930,8 @@ bool Creature::isCanInteractWithBattleMaster(Player* player, bool msg) const
bool Creature::isCanTrainingAndResetTalentsOf(Player* player) const
{
return player->getLevel() >= 10
&& GetCreatureInfo()->trainer_type == TRAINER_TYPE_CLASS
&& player->getClass() == GetCreatureInfo()->trainer_class;
&& GetCreatureTemplate()->trainer_type == TRAINER_TYPE_CLASS
&& player->getClass() == GetCreatureTemplate()->trainer_class;
}
void Creature::AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint32 /*MovementFlags*/, uint8 /*type*/)
@@ -1040,7 +1040,7 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
uint32 dynamicflags = GetUInt32Value(UNIT_DYNAMIC_FLAGS);
// check if it's a custom model and if not, use 0 for displayId
CreatureTemplate const* cinfo = GetCreatureInfo();
CreatureTemplate const* cinfo = GetCreatureTemplate();
if (cinfo)
{
if (displayId == cinfo->Modelid1 || displayId == cinfo->Modelid2 ||
@@ -1302,7 +1302,7 @@ bool Creature::LoadCreatureFromDB(uint32 guid, Map* map, bool addToMap)
curhealth = data->curhealth;
if (curhealth)
{
curhealth = uint32(curhealth*_GetHealthMod(GetCreatureInfo()->rank));
curhealth = uint32(curhealth*_GetHealthMod(GetCreatureTemplate()->rank));
if (curhealth < 1)
curhealth = 1;
}
@@ -1502,8 +1502,8 @@ void Creature::setDeathState(DeathState s)
setActive(false);
if (!isPet() && GetCreatureInfo()->SkinLootId)
if (LootTemplates_Skinning.HaveLootFor(GetCreatureInfo()->SkinLootId))
if (!isPet() && GetCreatureTemplate()->SkinLootId)
if (LootTemplates_Skinning.HaveLootFor(GetCreatureTemplate()->SkinLootId))
if (hasLootRecipient())
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE);
@@ -1529,11 +1529,11 @@ void Creature::setDeathState(DeathState s)
SetFullHealth();
SetLootRecipient(NULL);
ResetPlayerDamageReq();
CreatureTemplate const* cinfo = GetCreatureInfo();
CreatureTemplate const* cinfo = GetCreatureTemplate();
SetWalk(true);
if (GetCreatureInfo()->InhabitType & INHABIT_AIR)
if (GetCreatureTemplate()->InhabitType & INHABIT_AIR)
AddUnitMovementFlag(MOVEMENTFLAG_CAN_FLY | MOVEMENTFLAG_FLYING);
if (GetCreatureInfo()->InhabitType & INHABIT_WATER)
if (GetCreatureTemplate()->InhabitType & INHABIT_WATER)
AddUnitMovementFlag(MOVEMENTFLAG_SWIMMING);
SetUInt32Value(UNIT_NPC_FLAGS, cinfo->npcflag);
ClearUnitState(uint32(UNIT_STATE_ALL_STATE));
@@ -1573,7 +1573,7 @@ void Creature::Respawn(bool force)
if (m_originalEntry != GetEntry())
UpdateEntry(m_originalEntry);
CreatureTemplate const* cinfo = GetCreatureInfo();
CreatureTemplate const* cinfo = GetCreatureTemplate();
SelectLevel(cinfo);
setDeathState(JUST_ALIVED);
@@ -1634,11 +1634,11 @@ bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo)
return false;
// Spells that don't have effectMechanics.
if (!spellInfo->HasAnyEffectMechanic() && GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))
if (!spellInfo->HasAnyEffectMechanic() && GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))
return true;
// This check must be done instead of 'if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))' for not break
// the check of mechanic immunity on DB (tested) because GetCreatureInfo()->MechanicImmuneMask and m_spellImmune[IMMUNITY_MECHANIC] don't have same data.
// This check must be done instead of 'if (GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Mechanic - 1)))' for not break
// the check of mechanic immunity on DB (tested) because GetCreatureTemplate()->MechanicImmuneMask and m_spellImmune[IMMUNITY_MECHANIC] don't have same data.
bool immunedToAllEffects = true;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
if (!IsImmunedToSpellEffect(spellInfo, i))
@@ -1654,10 +1654,10 @@ bool Creature::IsImmunedToSpell(SpellInfo const* spellInfo)
bool Creature::IsImmunedToSpellEffect(SpellInfo const* spellInfo, uint32 index) const
{
if (GetCreatureInfo()->MechanicImmuneMask & (1 << (spellInfo->Effects[index].Mechanic - 1)))
if (GetCreatureTemplate()->MechanicImmuneMask & (1 << (spellInfo->Effects[index].Mechanic - 1)))
return true;
if (GetCreatureInfo()->type == CREATURE_TYPE_MECHANICAL && spellInfo->Effects[index].Effect == SPELL_EFFECT_HEAL)
if (GetCreatureTemplate()->type == CREATURE_TYPE_MECHANICAL && spellInfo->Effects[index].Effect == SPELL_EFFECT_HEAL)
return true;
return Unit::IsImmunedToSpellEffect(spellInfo, index);
@@ -2015,7 +2015,7 @@ CreatureAddon const* Creature::GetCreatureAddon() const
}
// dependent from difficulty mode entry
return sObjectMgr->GetCreatureTemplateAddon(GetCreatureInfo()->Entry);
return sObjectMgr->GetCreatureTemplateAddon(GetCreatureTemplate()->Entry);
}
//creature_addon table
@@ -2236,7 +2236,7 @@ void Creature::AllLootRemovedFromCorpse()
return;
float decayRate;
CreatureTemplate const* cinfo = GetCreatureInfo();
CreatureTemplate const* cinfo = GetCreatureTemplate();
decayRate = sWorld->getRate(RATE_CORPSE_DECAY_LOOTED);
uint32 diff = uint32((m_corpseRemoveTime - now) * decayRate);
@@ -2408,24 +2408,24 @@ bool Creature::IsDungeonBoss() const
return cinfo && (cinfo->flags_extra & CREATURE_FLAG_EXTRA_DUNGEON_BOSS);
}
void Creature::SetWalk(bool enable)
bool Creature::SetWalk(bool enable)
{
if (enable)
AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
else
RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
if (!Unit::SetWalk(enable))
return false;
WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_WALK_MODE : SMSG_SPLINE_MOVE_SET_RUN_MODE, 9);
data.append(GetPackGUID());
SendMessageToSet(&data, true);
return true;
}
void Creature::SetLevitate(bool enable)
bool Creature::SetLevitate(bool enable)
{
if (enable)
AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
else
RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
if (!Unit::SetLevitate(enable))
return false;
WorldPacket data(enable ? SMSG_SPLINE_MOVE_GRAVITY_DISABLE : SMSG_SPLINE_MOVE_GRAVITY_ENABLE, 9);
data.append(GetPackGUID());
SendMessageToSet(&data, true);
return true;
}
+13 -13
View File
@@ -457,17 +457,17 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
void Update(uint32 time); // overwrited Unit::Update
void GetRespawnPosition(float &x, float &y, float &z, float* ori = NULL, float* dist =NULL) const;
uint32 GetEquipmentId() const { return GetCreatureInfo()->equipmentId; }
uint32 GetEquipmentId() const { return GetCreatureTemplate()->equipmentId; }
void SetCorpseDelay(uint32 delay) { m_corpseDelay = delay; }
uint32 GetCorpseDelay() const { return m_corpseDelay; }
bool isRacialLeader() const { return GetCreatureInfo()->RacialLeader; }
bool isCivilian() const { return GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN; }
bool isTrigger() const { return GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER; }
bool isGuard() const { return GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_GUARD; }
bool canWalk() const { return GetCreatureInfo()->InhabitType & INHABIT_GROUND; }
bool canSwim() const { return GetCreatureInfo()->InhabitType & INHABIT_WATER; }
//bool canFly() const { return GetCreatureInfo()->InhabitType & INHABIT_AIR; }
bool isRacialLeader() const { return GetCreatureTemplate()->RacialLeader; }
bool isCivilian() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_CIVILIAN; }
bool isTrigger() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER; }
bool isGuard() const { return GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_GUARD; }
bool canWalk() const { return GetCreatureTemplate()->InhabitType & INHABIT_GROUND; }
bool canSwim() const { return GetCreatureTemplate()->InhabitType & INHABIT_WATER; }
//bool canFly() const { return GetCreatureTemplate()->InhabitType & INHABIT_AIR; }
void SetReactState(ReactStates st) { m_reactState = st; }
ReactStates GetReactState() { return m_reactState; }
@@ -496,7 +496,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
if (isPet())
return false;
uint32 rank = GetCreatureInfo()->rank;
uint32 rank = GetCreatureTemplate()->rank;
return rank != CREATURE_ELITE_NORMAL && rank != CREATURE_ELITE_RARE;
}
@@ -505,7 +505,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
if (isPet())
return false;
return GetCreatureInfo()->rank == CREATURE_ELITE_WORLDBOSS;
return GetCreatureTemplate()->rank == CREATURE_ELITE_WORLDBOSS;
}
bool IsDungeonBoss() const;
@@ -520,8 +520,8 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
void AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint32 MovementFlags, uint8 type);
CreatureAI* AI() const { return (CreatureAI*)i_AI; }
void SetWalk(bool enable);
void SetLevitate(bool enable);
bool SetWalk(bool enable);
bool SetLevitate(bool enable);
uint32 GetShieldBlockValue() const //dunno mob block value
{
@@ -558,7 +558,7 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature
TrainerSpellData const* GetTrainerSpells() const;
CreatureTemplate const* GetCreatureInfo() const { return m_creatureInfo; }
CreatureTemplate const* GetCreatureTemplate() const { return m_creatureInfo; }
CreatureData const* GetCreatureData() const { return m_creatureData; }
CreatureAddon const* GetCreatureAddon() const;
@@ -240,7 +240,7 @@ void CreatureGroup::LeaderMoveTo(float x, float y, float z)
if (member->IsWithinDist(m_leader, dist + MAX_DESYNC))
member->SetUnitMovementFlags(m_leader->GetUnitMovementFlags());
else
member->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
member->SetWalk(false);
member->GetMotionMaster()->MovePoint(0, dx, dy, dz);
member->SetHomePosition(dx, dy, dz, pathangle);
@@ -33,7 +33,7 @@ DynamicObject::DynamicObject(bool isWorldObject) : WorldObject(isWorldObject),
m_objectType |= TYPEMASK_DYNAMICOBJECT;
m_objectTypeId = TYPEID_DYNAMICOBJECT;
m_updateFlag = (UPDATEFLAG_HIGHGUID | UPDATEFLAG_HAS_POSITION | UPDATEFLAG_POSITION);
m_updateFlag = (UPDATEFLAG_LOWGUID | UPDATEFLAG_STATIONARY_POSITION | UPDATEFLAG_POSITION);
m_valuesCount = DYNAMICOBJECT_END;
}
@@ -38,7 +38,7 @@ GameObject::GameObject() : WorldObject(false), m_model(NULL), m_goValue(new Game
m_objectType |= TYPEMASK_GAMEOBJECT;
m_objectTypeId = TYPEID_GAMEOBJECT;
m_updateFlag = (UPDATEFLAG_HIGHGUID | UPDATEFLAG_HAS_POSITION | UPDATEFLAG_POSITION | UPDATEFLAG_ROTATION);
m_updateFlag = (UPDATEFLAG_LOWGUID | UPDATEFLAG_STATIONARY_POSITION | UPDATEFLAG_POSITION | UPDATEFLAG_ROTATION);
m_valuesCount = GAMEOBJECT_END;
m_respawnTime = 0;
+13 -15
View File
@@ -56,8 +56,7 @@ void AddItemsSetItem(Player* player, Item* item)
if (!eff)
{
eff = new ItemSetEffect;
memset(eff, 0, sizeof(ItemSetEffect));
eff = new ItemSetEffect();
eff->setid = setid;
size_t x = 0;
@@ -238,7 +237,7 @@ Item::Item()
m_objectType |= TYPEMASK_ITEM;
m_objectTypeId = TYPEID_ITEM;
m_updateFlag = UPDATEFLAG_HIGHGUID;
m_updateFlag = UPDATEFLAG_LOWGUID;
m_valuesCount = ITEM_END;
m_slot = 0;
@@ -780,20 +779,18 @@ bool Item::CanBeTraded(bool mail, bool trade) const
bool Item::HasEnchantRequiredSkill(const Player* player) const
{
// Check all enchants for required skill
for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot)
if (uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot)))
if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id))
if (enchantEntry->requiredSkill && player->GetSkillValue(enchantEntry->requiredSkill) < enchantEntry->requiredSkillValue)
return false;
// Check all enchants for required skill
for (uint32 enchant_slot = PERM_ENCHANTMENT_SLOT; enchant_slot < MAX_ENCHANTMENT_SLOT; ++enchant_slot)
if (uint32 enchant_id = GetEnchantmentId(EnchantmentSlot(enchant_slot)))
if (SpellItemEnchantmentEntry const* enchantEntry = sSpellItemEnchantmentStore.LookupEntry(enchant_id))
if (enchantEntry->requiredSkill && player->GetSkillValue(enchantEntry->requiredSkill) < enchantEntry->requiredSkillValue)
return false;
return true;
}
uint32 Item::GetEnchantRequiredLevel() const
{
uint32 level = 0;
// Check all enchants for required level
@@ -861,7 +858,7 @@ bool Item::IsFitToSpellRequirements(SpellInfo const* spellInfo) const
// Special case - accept weapon type for main and offhand requirements
if (proto->InventoryType == INVTYPE_WEAPON &&
(spellInfo->EquippedItemInventoryTypeMask & (1 << INVTYPE_WEAPONMAINHAND) ||
spellInfo->EquippedItemInventoryTypeMask & (1 << INVTYPE_WEAPONOFFHAND)))
spellInfo->EquippedItemInventoryTypeMask & (1 << INVTYPE_WEAPONOFFHAND)))
return true;
else if ((spellInfo->EquippedItemInventoryTypeMask & (1 << proto->InventoryType)) == 0)
return false; // inventory type not present in mask
@@ -1001,12 +998,13 @@ bool Item::IsLimitedToAnotherMapOrZone(uint32 cur_mapId, uint32 cur_zoneId) cons
// time.
void Item::SendTimeUpdate(Player* owner)
{
if (!GetUInt32Value(ITEM_FIELD_DURATION))
uint32 duration = GetUInt32Value(ITEM_FIELD_DURATION);
if (!duration)
return;
WorldPacket data(SMSG_ITEM_TIME_UPDATE, (8+4));
data << (uint64)GetGUID();
data << (uint32)GetUInt32Value(ITEM_FIELD_DURATION);
data << uint64(GetGUID());
data << uint32(duration);
owner->GetSession()->SendPacket(&data);
}
+57 -48
View File
@@ -209,7 +209,7 @@ void Object::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
if (target == this) // building packet for yourself
flags |= UPDATEFLAG_SELF;
if (flags & UPDATEFLAG_HAS_POSITION)
if (flags & UPDATEFLAG_STATIONARY_POSITION)
{
// UPDATETYPE_CREATE_OBJECT2 dynamic objects, corpses...
if (isType(TYPEMASK_DYNAMICOBJECT) || isType(TYPEMASK_CORPSE) || isType(TYPEMASK_PLAYER))
@@ -293,19 +293,21 @@ void Object::BuildOutOfRangeUpdateBlock(UpdateData* data) const
data->AddOutOfRangeGUID(GetGUID());
}
void Object::DestroyForPlayer(Player* target, bool anim) const
void Object::DestroyForPlayer(Player* target, bool onDeath) const
{
ASSERT(target);
WorldPacket data(SMSG_DESTROY_OBJECT, 8 + 1);
data << uint64(GetGUID());
data << uint8(anim ? 1 : 0); // WotLK (bool), may be despawn animation
//! If the following bool is true, the client will call "void CGUnit_C::OnDeath()" for this object.
//! OnDeath() does for eg trigger death animation and interrupts certain spells/missiles/auras/sounds...
data << uint8(onDeath ? 1 : 0);
target->GetSession()->SendPacket(&data);
}
void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
void Object::_BuildMovementUpdate(ByteBuffer* data, uint16 flags) const
{
*data << (uint16)flags; // update flags
*data << uint16(flags); // update flags
// 0x20
if (flags & UPDATEFLAG_LIVING)
@@ -330,13 +332,29 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
{
if (flags & UPDATEFLAG_POSITION)
{
*data << uint8(0); // unk PGUID!
*data << ((WorldObject*)this)->GetPositionX();
*data << ((WorldObject*)this)->GetPositionY();
*data << ((WorldObject*)this)->GetPositionZ();
Transport* transport = ((WorldObject*)this)->GetTransport();
if (transport)
data->append(transport->GetPackGUID());
else
*data << uint8(0);
*data << ((WorldObject*)this)->GetPositionX();
*data << ((WorldObject*)this)->GetPositionY();
*data << ((WorldObject*)this)->GetPositionZ();
if (transport)
{
*data << ((WorldObject*)this)->GetTransOffsetX();
*data << ((WorldObject*)this)->GetTransOffsetY();
*data << ((WorldObject*)this)->GetTransOffsetZ();
}
else
{
*data << ((WorldObject*)this)->GetPositionX();
*data << ((WorldObject*)this)->GetPositionY();
*data << ((WorldObject*)this)->GetPositionZ();
}
*data << ((WorldObject*)this)->GetOrientation();
if (GetTypeId() == TYPEID_CORPSE)
@@ -347,28 +365,23 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
else
{
// 0x40
if (flags & UPDATEFLAG_HAS_POSITION)
if (flags & UPDATEFLAG_STATIONARY_POSITION)
{
// 0x02
if (flags & UPDATEFLAG_TRANSPORT && ((GameObject*)this)->GetGoType() == GAMEOBJECT_TYPE_MO_TRANSPORT)
{
*data << (float)0;
*data << (float)0;
*data << (float)0;
*data << ((WorldObject*)this)->GetOrientation();
}
else
{
*data << ((WorldObject*)this)->GetPositionX();
*data << ((WorldObject*)this)->GetPositionY();
*data << ((WorldObject*)this)->GetPositionZ();
*data << ((WorldObject*)this)->GetOrientation();
}
*data << ((WorldObject*)this)->GetPositionX();
*data << ((WorldObject*)this)->GetPositionY();
*data << ((WorldObject*)this)->GetPositionZ();
*data << ((WorldObject*)this)->GetOrientation();
}
}
}
// 0x8
if (flags & UPDATEFLAG_UNKNOWN)
{
*data << uint32(0);
}
// 0x10
if (flags & UPDATEFLAG_LOWGUID)
{
switch (GetTypeId())
@@ -381,14 +394,16 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
case TYPEID_CORPSE:
*data << uint32(GetGUIDLow()); // GetGUIDLow()
break;
//! Unit, Player and default here are sending wrong values.
//! TODO: Research the proper formula
case TYPEID_UNIT:
*data << uint32(0x0000000B); // unk, can be 0xB or 0xC
*data << uint32(0x0000000B); // unk
break;
case TYPEID_PLAYER:
if (flags & UPDATEFLAG_SELF)
*data << uint32(0x0000002F); // unk, can be 0x15 or 0x22
*data << uint32(0x0000002F); // unk
else
*data << uint32(0x00000008); // unk, can be 0x7 or 0x8
*data << uint32(0x00000008); // unk
break;
default:
*data << uint32(0x00000000); // unk
@@ -396,15 +411,8 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
}
}
// 0x10
if (flags & UPDATEFLAG_HIGHGUID)
{
// not high guid
*data << uint32(GetUInt32Value(OBJECT_FIELD_GUID)); // unk
}
// 0x4
if (flags & UPDATEFLAG_HAS_TARGET) // packed guid (current target guid)
if (flags & UPDATEFLAG_HAS_TARGET)
{
if (Unit* victim = ((Unit*)this)->getVictim())
data->append(victim->GetPackGUID());
@@ -415,14 +423,15 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
// 0x2
if (flags & UPDATEFLAG_TRANSPORT)
{
*data << uint32(getMSTime()); // ms time
*data << uint32(getMSTime()); // Unknown - getMSTime is wrong.
}
// 0x80
if (flags & UPDATEFLAG_VEHICLE) // unused for now
if (flags & UPDATEFLAG_VEHICLE)
{
*data << uint32(((Unit*)this)->GetVehicleKit()->GetVehicleInfo()->m_ID); // vehicle id
*data << float(((Creature*)this)->GetOrientation()); // facing adjustment
// TODO: Allow players to aquire this updateflag.
*data << uint32(((Unit*)this)->GetVehicleKit()->GetVehicleInfo()->m_ID);
*data << float(((Creature*)this)->GetOrientation());
}
// 0x200
@@ -541,7 +550,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask*
{
if (GetTypeId() == TYPEID_UNIT)
{
CreatureTemplate const* cinfo = ToCreature()->GetCreatureInfo();
CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate();
// this also applies for transform auras
if (SpellInfo const* transform = sSpellMgr->GetSpellInfo(ToUnit()->getTransForm()))
@@ -581,7 +590,7 @@ void Object::_BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask*
{
uint32 dynamicFlags = m_uint32Values[index];
if (const Creature* creature = ToCreature())
if (Creature const* creature = ToCreature())
{
if (creature->hasLootRecipient())
{
@@ -1085,9 +1094,9 @@ bool Object::PrintIndexError(uint32 index, bool set) const
return false;
}
bool Position::HasInLine(Unit const* target, float distance, float width) const
bool Position::HasInLine(WorldObject const* target, float width) const
{
if (!HasInArc(M_PI, target) || !target->IsWithinDist3d(m_positionX, m_positionY, m_positionZ, distance))
if (!HasInArc(M_PI, target))
return false;
width += target->GetObjectSize();
float angle = GetRelativeAngle(target);
@@ -1502,14 +1511,14 @@ bool WorldObject::IsInBetween(const WorldObject* obj1, const WorldObject* obj2,
return (size * size) >= GetExactDist2dSq(obj1->GetPositionX() + cos(angle) * dist, obj1->GetPositionY() + sin(angle) * dist);
}
bool WorldObject::isInFront(WorldObject const* target, float distance, float arc) const
bool WorldObject::isInFront(WorldObject const* target, float arc) const
{
return IsWithinDist(target, distance) && HasInArc(arc, target);
return HasInArc(arc, target);
}
bool WorldObject::isInBack(WorldObject const* target, float distance, float arc) const
bool WorldObject::isInBack(WorldObject const* target, float arc) const
{
return IsWithinDist(target, distance) && !HasInArc(2 * M_PI - arc, target);
return !HasInArc(2 * M_PI - arc, target);
}
void WorldObject::GetRandomPoint(const Position &pos, float distance, float &rand_x, float &rand_y, float &rand_z) const
+14 -14
View File
@@ -147,7 +147,7 @@ class Object
void BuildOutOfRangeUpdateBlock(UpdateData* data) const;
void BuildMovementUpdateBlock(UpdateData* data, uint32 flags = 0) const;
virtual void DestroyForPlayer(Player* target, bool anim = false) const;
virtual void DestroyForPlayer(Player* target, bool onDeath = false) const;
int32 GetInt32Value(uint16 index) const
{
@@ -299,18 +299,18 @@ class Object
// FG: some hacky helpers
void ForceValuesUpdateAtIndex(uint32);
Player* ToPlayer(){ if (GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Player*>(this); else return NULL; }
const Player* ToPlayer() const { if (GetTypeId() == TYPEID_PLAYER) return (const Player*)((Player*)this); else return NULL; }
Creature* ToCreature(){ if (GetTypeId() == TYPEID_UNIT) return reinterpret_cast<Creature*>(this); else return NULL; }
const Creature* ToCreature() const {if (GetTypeId() == TYPEID_UNIT) return (const Creature*)((Creature*)this); else return NULL; }
Player* ToPlayer() { if (GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Player*>(this); else return NULL; }
Player const* ToPlayer() const { if (GetTypeId() == TYPEID_PLAYER) return (Player const*)((Player*)this); else return NULL; }
Creature* ToCreature() { if (GetTypeId() == TYPEID_UNIT) return reinterpret_cast<Creature*>(this); else return NULL; }
Creature const* ToCreature() const { if (GetTypeId() == TYPEID_UNIT) return (Creature const*)((Creature*)this); else return NULL; }
Unit* ToUnit(){ if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Unit*>(this); else return NULL; }
const Unit* ToUnit() const {if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return (const Unit*)((Unit*)this); else return NULL; }
GameObject* ToGameObject(){ if (GetTypeId() == TYPEID_GAMEOBJECT) return reinterpret_cast<GameObject*>(this); else return NULL; }
const GameObject* ToGameObject() const {if (GetTypeId() == TYPEID_GAMEOBJECT) return (const GameObject*)((GameObject*)this); else return NULL; }
Unit* ToUnit() { if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return reinterpret_cast<Unit*>(this); else return NULL; }
Unit const* ToUnit() const { if (GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) return (const Unit*)((Unit*)this); else return NULL; }
GameObject* ToGameObject() { if (GetTypeId() == TYPEID_GAMEOBJECT) return reinterpret_cast<GameObject*>(this); else return NULL; }
GameObject const* ToGameObject() const { if (GetTypeId() == TYPEID_GAMEOBJECT) return (const GameObject*)((GameObject*)this); else return NULL; }
Corpse* ToCorpse(){ if (GetTypeId() == TYPEID_CORPSE) return reinterpret_cast<Corpse*>(this); else return NULL; }
const Corpse* ToCorpse() const {if (GetTypeId() == TYPEID_CORPSE) return (const Corpse*)((Corpse*)this); else return NULL; }
Corpse* ToCorpse() { if (GetTypeId() == TYPEID_CORPSE) return reinterpret_cast<Corpse*>(this); else return NULL; }
Corpse const* ToCorpse() const { if (GetTypeId() == TYPEID_CORPSE) return (const Corpse*)((Corpse*)this); else return NULL; }
protected:
Object ();
@@ -451,7 +451,7 @@ struct Position
bool IsInDist(const Position* pos, float dist) const
{ return GetExactDistSq(pos) < dist * dist; }
bool HasInArc(float arcangle, const Position* pos) const;
bool HasInLine(Unit const* target, float distance, float width) const;
bool HasInLine(WorldObject const* target, float width) const;
std::string ToString() const;
};
ByteBuffer& operator>>(ByteBuffer& buf, Position::PositionXYZOStreamer const& streamer);
@@ -707,8 +707,8 @@ class WorldObject : public Object, public WorldLocation
bool IsInRange(WorldObject const* obj, float minRange, float maxRange, bool is3D = true) const;
bool IsInRange2d(float x, float y, float minRange, float maxRange) const;
bool IsInRange3d(float x, float y, float z, float minRange, float maxRange) const;
bool isInFront(WorldObject const* target, float distance, float arc = M_PI) const;
bool isInBack(WorldObject const* target, float distance, float arc = M_PI) const;
bool isInFront(WorldObject const* target, float arc = M_PI) const;
bool isInBack(WorldObject const* target, float arc = M_PI) const;
bool IsInBetween(const WorldObject* obj1, const WorldObject* obj2, float size = 0) const;
@@ -34,17 +34,17 @@ enum OBJECT_UPDATE_TYPE
enum OBJECT_UPDATE_FLAGS
{
UPDATEFLAG_NONE = 0x0000,
UPDATEFLAG_SELF = 0x0001,
UPDATEFLAG_TRANSPORT = 0x0002,
UPDATEFLAG_HAS_TARGET = 0x0004,
UPDATEFLAG_LOWGUID = 0x0008,
UPDATEFLAG_HIGHGUID = 0x0010,
UPDATEFLAG_LIVING = 0x0020,
UPDATEFLAG_HAS_POSITION = 0x0040,
UPDATEFLAG_VEHICLE = 0x0080,
UPDATEFLAG_POSITION = 0x0100,
UPDATEFLAG_ROTATION = 0x0200
UPDATEFLAG_NONE = 0x0000,
UPDATEFLAG_SELF = 0x0001,
UPDATEFLAG_TRANSPORT = 0x0002,
UPDATEFLAG_HAS_TARGET = 0x0004,
UPDATEFLAG_UNKNOWN = 0x0008,
UPDATEFLAG_LOWGUID = 0x0010,
UPDATEFLAG_LIVING = 0x0020,
UPDATEFLAG_STATIONARY_POSITION = 0x0040,
UPDATEFLAG_VEHICLE = 0x0080,
UPDATEFLAG_POSITION = 0x0100,
UPDATEFLAG_ROTATION = 0x0200
};
class UpdateData
+11 -11
View File
@@ -180,7 +180,7 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
setFaction(owner->getFaction());
SetUInt32Value(UNIT_CREATED_BY_SPELL, summon_spell_id);
CreatureTemplate const* cinfo = GetCreatureInfo();
CreatureTemplate const* cinfo = GetCreatureTemplate();
if (cinfo->type == CREATURE_TYPE_CRITTER)
{
map->AddToMap(this->ToCreature());
@@ -692,7 +692,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
{
ASSERT(creature);
if (!CreateBaseAtTamed(creature->GetCreatureInfo(), creature->GetMap(), creature->GetPhaseMask()))
if (!CreateBaseAtTamed(creature->GetCreatureTemplate(), creature->GetMap(), creature->GetPhaseMask()))
return false;
Relocate(creature->GetPositionX(), creature->GetPositionY(), creature->GetPositionZ(), creature->GetOrientation());
@@ -704,7 +704,7 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
return false;
}
CreatureTemplate const* cinfo = GetCreatureInfo();
CreatureTemplate const* cinfo = GetCreatureTemplate();
if (!cinfo)
{
sLog->outError("CreateBaseAtCreature() failed, creatureInfo is missing!");
@@ -763,7 +763,7 @@ bool Pet::CreateBaseAtTamed(CreatureTemplate const* cinfo, Map* map, uint32 phas
// TODO: Move stat mods code to pet passive auras
bool Guardian::InitStatsForLevel(uint8 petlevel)
{
CreatureTemplate const* cinfo = GetCreatureInfo();
CreatureTemplate const* cinfo = GetCreatureTemplate();
ASSERT(cinfo);
SetLevel(petlevel);
@@ -997,7 +997,7 @@ bool Pet::HaveInDiet(ItemTemplate const* item) const
if (!item->FoodType)
return false;
CreatureTemplate const* cInfo = GetCreatureInfo();
CreatureTemplate const* cInfo = GetCreatureTemplate();
if (!cInfo)
return false;
@@ -1405,7 +1405,7 @@ void Pet::InitLevelupSpellsForLevel()
{
uint8 level = getLevel();
if (PetLevelupSpellSet const* levelupSpells = GetCreatureInfo()->family ? sSpellMgr->GetPetLevelupSpellList(GetCreatureInfo()->family) : NULL)
if (PetLevelupSpellSet const* levelupSpells = GetCreatureTemplate()->family ? sSpellMgr->GetPetLevelupSpellList(GetCreatureTemplate()->family) : NULL)
{
// PetLevelupSpellSet ordered by levels, process in reversed order
for (PetLevelupSpellSet::const_reverse_iterator itr = levelupSpells->rbegin(); itr != levelupSpells->rend(); ++itr)
@@ -1419,7 +1419,7 @@ void Pet::InitLevelupSpellsForLevel()
}
}
int32 petSpellsId = GetCreatureInfo()->PetSpellDataId ? -(int32)GetCreatureInfo()->PetSpellDataId : GetEntry();
int32 petSpellsId = GetCreatureTemplate()->PetSpellDataId ? -(int32)GetCreatureTemplate()->PetSpellDataId : GetEntry();
// default spells (can be not learned if pet level (as owner level decrease result for example) less first possible in normal game)
if (PetDefaultSpellsEntry const* defSpells = sSpellMgr->GetPetDefaultSpellsEntry(petSpellsId))
@@ -1543,7 +1543,7 @@ bool Pet::resetTalents()
if (owner->ToPlayer()->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
owner->ToPlayer()->RemoveAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS, true);
CreatureTemplate const* ci = GetCreatureInfo();
CreatureTemplate const* ci = GetCreatureTemplate();
if (!ci)
return false;
// Check pet talent type
@@ -1771,9 +1771,9 @@ bool Pet::IsPermanentPetFor(Player* owner)
switch (owner->getClass())
{
case CLASS_WARLOCK:
return GetCreatureInfo()->type == CREATURE_TYPE_DEMON;
return GetCreatureTemplate()->type == CREATURE_TYPE_DEMON;
case CLASS_DEATH_KNIGHT:
return GetCreatureInfo()->type == CREATURE_TYPE_UNDEAD;
return GetCreatureTemplate()->type == CREATURE_TYPE_UNDEAD;
default:
return false;
}
@@ -1812,7 +1812,7 @@ bool Pet::HasSpell(uint32 spell) const
// Get all passive spells in our skill line
void Pet::LearnPetPassives()
{
CreatureTemplate const* cInfo = GetCreatureInfo();
CreatureTemplate const* cInfo = GetCreatureTemplate();
if (!cInfo)
return;
+83 -60
View File
@@ -145,7 +145,6 @@ static uint32 copseReclaimDelay[MAX_DEATH_COUNT] = { 30, 60, 120 };
PlayerTaxi::PlayerTaxi()
{
// Taxi nodes
memset(m_taximask, 0, sizeof(m_taximask));
}
@@ -541,7 +540,7 @@ inline void KillRewarder::_RewardKillCredit(Player* player)
// 4.4. Give kill credit (player must not be in group, or he must be alive or without corpse).
if (!_group || player->isAlive() || !player->GetCorpse())
if (_victim->GetTypeId() == TYPEID_UNIT)
player->KilledMonster(_victim->ToCreature()->GetCreatureInfo(), _victim->GetGUID());
player->KilledMonster(_victim->ToCreature()->GetCreatureTemplate(), _victim->GetGUID());
}
void KillRewarder::_RewardPlayer(Player* player, bool isDungeon)
@@ -1124,10 +1123,10 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
if (oEntry->ItemId[j] <= 0)
continue;
uint32 item_id = oEntry->ItemId[j];
uint32 itemId = oEntry->ItemId[j];
// just skip, reported in ObjectMgr::LoadItemTemplates
ItemTemplate const* iProto = sObjectMgr->GetItemTemplate(item_id);
ItemTemplate const* iProto = sObjectMgr->GetItemTemplate(itemId);
if (!iProto)
continue;
@@ -1149,7 +1148,7 @@ bool Player::Create(uint32 guidlow, CharacterCreateInfo* createInfo)
if (iProto->GetMaxStackSize() < count)
count = iProto->GetMaxStackSize();
}
StoreNewItemInBestSlots(item_id, count);
StoreNewItemInBestSlots(itemId, count);
}
}
@@ -1590,14 +1589,14 @@ void Player::Update(uint32 p_time)
if (HasUnitState(UNIT_STATE_MELEE_ATTACKING) && !HasUnitState(UNIT_STATE_CASTING))
{
if (Unit* pVictim = getVictim())
if (Unit* victim = getVictim())
{
// default combat reach 10
// TODO add weapon, skill check
if (isAttackReady(BASE_ATTACK))
{
if (!IsWithinMeleeRange(pVictim))
if (!IsWithinMeleeRange(victim))
{
setAttackTimer(BASE_ATTACK, 100);
if (m_swingErrorMsg != 1) // send single time (client auto repeat)
@@ -1607,7 +1606,7 @@ void Player::Update(uint32 p_time)
}
}
//120 degrees of radiant range
else if (!HasInArc(2*M_PI/3, pVictim))
else if (!HasInArc(2*M_PI/3, victim))
{
setAttackTimer(BASE_ATTACK, 100);
if (m_swingErrorMsg != 2) // send single time (client auto repeat)
@@ -1626,16 +1625,16 @@ void Player::Update(uint32 p_time)
setAttackTimer(OFF_ATTACK, ATTACK_DISPLAY_DELAY);
// do attack
AttackerStateUpdate(pVictim, BASE_ATTACK);
AttackerStateUpdate(victim, BASE_ATTACK);
resetAttackTimer(BASE_ATTACK);
}
}
if (haveOffhandWeapon() && isAttackReady(OFF_ATTACK))
{
if (!IsWithinMeleeRange(pVictim))
if (!IsWithinMeleeRange(victim))
setAttackTimer(OFF_ATTACK, 100);
else if (!HasInArc(2*M_PI/3, pVictim))
else if (!HasInArc(2*M_PI/3, victim))
setAttackTimer(OFF_ATTACK, 100);
else
{
@@ -1644,13 +1643,13 @@ void Player::Update(uint32 p_time)
setAttackTimer(BASE_ATTACK, ATTACK_DISPLAY_DELAY);
// do attack
AttackerStateUpdate(pVictim, OFF_ATTACK);
AttackerStateUpdate(victim, OFF_ATTACK);
resetAttackTimer(OFF_ATTACK);
}
}
/*Unit* owner = pVictim->GetOwner();
Unit* u = owner ? owner : pVictim;
/*Unit* owner = victim->GetOwner();
Unit* u = owner ? owner : victim;
if (u->IsPvP() && (!duel || duel->opponent != u))
{
UpdatePvP(true);
@@ -2689,11 +2688,11 @@ Creature* Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
return NULL;
// Deathstate checks
if (!isAlive() && !(creature->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_GHOST))
if (!isAlive() && !(creature->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_GHOST))
return NULL;
// alive or spirit healer
if (!creature->isAlive() && !(creature->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_DEAD_INTERACT))
if (!creature->isAlive() && !(creature->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_DEAD_INTERACT))
return NULL;
// appropriate npc type
@@ -4460,7 +4459,7 @@ bool Player::resetTalents(bool no_cost)
/* when prev line will dropped use next line
if (Pet* pet = GetPet())
{
if (pet->getPetType() == HUNTER_PET && !pet->GetCreatureInfo()->isTameable(CanTameExoticPets()))
if (pet->getPetType() == HUNTER_PET && !pet->GetCreatureTemplate()->isTameable(CanTameExoticPets()))
RemovePet(NULL, PET_SAVE_NOT_IN_SLOT, true);
}
*/
@@ -4627,9 +4626,9 @@ void Player::BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) c
Unit::BuildCreateUpdateBlockForPlayer(data, target);
}
void Player::DestroyForPlayer(Player* target, bool anim) const
void Player::DestroyForPlayer(Player* target, bool onDeath) const
{
Unit::DestroyForPlayer(target, anim);
Unit::DestroyForPlayer(target, onDeath);
for (uint8 i = 0; i < INVENTORY_SLOT_BAG_END; ++i)
{
@@ -6229,7 +6228,7 @@ void Player::UpdateWeaponSkill(WeaponAttackType attType)
if (GetShapeshiftForm() == FORM_TREE)
return; // use weapon but not skill up
if (victim && victim->GetTypeId() == TYPEID_UNIT && (victim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_SKILLGAIN))
if (victim && victim->GetTypeId() == TYPEID_UNIT && (victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_SKILLGAIN))
return;
uint32 weapon_skill_gain = sWorld->getIntConfig(CONFIG_SKILL_GAIN_WEAPON);
@@ -6929,7 +6928,7 @@ void Player::RewardReputation(Unit* pVictim, float rate)
if (pVictim->ToCreature()->IsReputationGainDisabled())
return;
ReputationOnKillEntry const* Rep = sObjectMgr->GetReputationOnKilEntry(pVictim->ToCreature()->GetCreatureInfo()->Entry);
ReputationOnKillEntry const* Rep = sObjectMgr->GetReputationOnKilEntry(pVictim->ToCreature()->GetCreatureTemplate()->Entry);
if (!Rep)
return;
@@ -7952,15 +7951,22 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply
if (CanUseAttackType(attType))
_ApplyWeaponDamage(slot, proto, ssv, apply);
// Apply feral bonus from ScalingStatValue if set
if (ssv)
if (int32 feral_bonus = ssv->getFeralBonus(proto->ScalingStatValue))
ApplyFeralAPBonus(feral_bonus, apply);
// Druids get feral AP bonus from weapon dps (lso use DPS from ScalingStatValue)
// Druids get feral AP bonus from weapon dps (also use DPS from ScalingStatValue)
if (getClass() == CLASS_DRUID)
if (int32 feral_bonus = proto->getFeralBonus(ssv->getDPSMod(proto->ScalingStatValue)))
{
int32 dpsMod = 0;
int32 feral_bonus = 0;
if (ssv)
{
dpsMod = ssv->getDPSMod(proto->ScalingStatValue);
feral_bonus += ssv->getFeralBonus(proto->ScalingStatValue);
}
feral_bonus += proto->getFeralBonus(dpsMod);
if (feral_bonus)
ApplyFeralAPBonus(feral_bonus, apply);
}
}
void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingStatValuesEntry const* ssv, bool apply)
@@ -8847,7 +8853,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
creature->lootForPickPocketed = true;
loot->clear();
if (uint32 lootid = creature->GetCreatureInfo()->pickpocketLootId)
if (uint32 lootid = creature->GetCreatureTemplate()->pickpocketLootId)
loot->FillLoot(lootid, LootTemplates_Pickpocketing, this, true);
// Generate extra money for pick pocket loot
@@ -8894,7 +8900,7 @@ void Player::SendLoot(uint64 guid, LootType loot_type)
if (loot_type == LOOT_SKINNING)
{
loot->clear();
loot->FillLoot(creature->GetCreatureInfo()->SkinLootId, LootTemplates_Skinning, this, true);
loot->FillLoot(creature->GetCreatureTemplate()->SkinLootId, LootTemplates_Skinning, this, true);
permission = OWNER_PERMISSION;
}
// set group rights only for loot_type != LOOT_SKINNING
@@ -12009,7 +12015,7 @@ Item* Player::StoreNewItem(ItemPosCountVec const& dest, uint32 item, bool update
{
pItem->SetSoulboundTradeable(allowedLooters);
pItem->SetUInt32Value(ITEM_FIELD_CREATE_PLAYED_TIME, GetTotalPlayedTime());
m_itemSoulboundTradeable.push_back(pItem);
AddTradeableItem(pItem);
// save data
std::ostringstream ss;
@@ -12452,7 +12458,7 @@ void Player::MoveItemToInventory(ItemPosCountVec const& dest, Item* pItem, bool
}
if (pLastItem->HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_BOP_TRADEABLE))
m_itemSoulboundTradeable.push_back(pLastItem);
AddTradeableItem(pLastItem);
}
void Player::DestroyItem(uint8 bag, uint8 slot, bool update)
@@ -13451,6 +13457,11 @@ void Player::UpdateSoulboundTradeItems()
}
}
void Player::AddTradeableItem(Item* item)
{
m_itemSoulboundTradeable.push_back(item);
}
//TODO: should never allow an item to be added to m_itemSoulboundTradeable twice
void Player::RemoveTradeableItem(Item* item)
{
@@ -14080,12 +14091,10 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
menuItemBounds = sObjectMgr->GetGossipMenuItemsMapBounds(0);
uint32 npcflags = 0;
Creature* creature = NULL;
if (source->GetTypeId() == TYPEID_UNIT)
{
creature = source->ToCreature();
npcflags = creature->GetUInt32Value(UNIT_NPC_FLAGS);
npcflags = source->GetUInt32Value(UNIT_NPC_FLAGS);
if (npcflags & UNIT_NPC_FLAG_QUESTGIVER && showQuests)
PrepareQuestMenu(source->GetGUID());
}
@@ -14100,7 +14109,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
if (!sConditionMgr->IsObjectMeetToConditions(this, source, itr->second.Conditions))
continue;
if (source->GetTypeId() == TYPEID_UNIT)
if (Creature* creature = source->ToCreature())
{
if (!(itr->second.OptionNpcflag & npcflags))
continue;
@@ -14137,7 +14146,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
canTalk = false;
break;
case GOSSIP_OPTION_UNLEARNPETTALENTS:
if (!GetPet() || GetPet()->getPetType() != HUNTER_PET || GetPet()->m_spells.size() <= 1 || creature->GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS || creature->GetCreatureInfo()->trainer_class != CLASS_HUNTER)
if (!GetPet() || GetPet()->getPetType() != HUNTER_PET || GetPet()->m_spells.size() <= 1 || creature->GetCreatureTemplate()->trainer_type != TRAINER_TYPE_PETS || creature->GetCreatureTemplate()->trainer_class != CLASS_HUNTER)
canTalk = false;
break;
case GOSSIP_OPTION_TAXIVENDOR:
@@ -14173,10 +14182,8 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
break;
}
}
else if (source->GetTypeId() == TYPEID_GAMEOBJECT)
else if (GameObject* go = source->ToGameObject())
{
GameObject* go = source->ToGameObject();
switch (itr->second.OptionType)
{
case GOSSIP_OPTION_GOSSIP:
@@ -14412,7 +14419,7 @@ uint32 Player::GetDefaultGossipMenuForSource(WorldObject* source)
switch (source->GetTypeId())
{
case TYPEID_UNIT:
return source->ToCreature()->GetCreatureInfo()->GossipMenuId;
return source->ToCreature()->GetCreatureTemplate()->GossipMenuId;
case TYPEID_GAMEOBJECT:
return source->ToGameObject()->GetGOInfo()->GetGossipMenuId();
default:
@@ -16011,9 +16018,9 @@ void Player::CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id)
if (reqTarget != entry) // if entry doesn't match, check for killcredits referenced in template
{
CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry);
for (uint8 j = 0; j < MAX_KILL_CREDIT; ++j)
if (cinfo->KillCredit[j] == reqTarget)
entry = cinfo->KillCredit[j];
for (uint8 k = 0; k < MAX_KILL_CREDIT; ++k)
if (cinfo->KillCredit[k] == reqTarget)
entry = cinfo->KillCredit[k];
}
}
}
@@ -17584,7 +17591,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F
for (Tokens::iterator itr = GUIDlist.begin(); itr != GUIDlist.end(); ++itr)
looters.insert(atol(*itr));
item->SetSoulboundTradeable(looters);
m_itemSoulboundTradeable.push_back(item);
AddTradeableItem(item);
}
else
{
@@ -17658,7 +17665,7 @@ void Player::_LoadMailedItems(Mail* mail)
{
sLog->outError("Player %u has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUIDLow(), itemGuid, itemTemplate, mail->messageID);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_MAIL_ITEM);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_MAIL_ITEM);
stmt->setUInt32(0, itemGuid);
CharacterDatabase.Execute(stmt);
@@ -17674,10 +17681,8 @@ void Player::_LoadMailedItems(Mail* mail)
{
sLog->outError("Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", mail->messageID, itemGuid);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM);
stmt->setUInt32(0, itemGuid);
CharacterDatabase.Execute(stmt);
item->FSetState(ITEM_REMOVED);
@@ -17785,12 +17790,19 @@ void Player::_LoadQuestStatus(PreparedQueryResult result)
QuestStatusData& questStatusData = m_QuestStatus[quest_id];
uint8 qstatus = fields[1].GetUInt8();
if (qstatus < MAX_QUEST_STATUS)
if (qstatus < MAX_QUEST_STATUS && qstatus > QUEST_STATUS_NONE)
questStatusData.Status = QuestStatus(qstatus);
else if (qstatus == QUEST_STATUS_NONE)
{
sLog->outError("Player %s (GUID: %u) has QUEST_STATUS_NONE for quest %u and should be removed from character_queststatus.",
GetName(), GetGUIDLow(), quest_id);
continue;
}
else
{
questStatusData.Status = QUEST_STATUS_INCOMPLETE;
sLog->outError("Player %s have invalid quest %d status (%u), replaced by QUEST_STATUS_INCOMPLETE(3).", GetName(), quest_id, qstatus);
sLog->outError("Player %s (GUID: %u) has invalid quest %d status (%u), replaced by QUEST_STATUS_INCOMPLETE(3).",
GetName(), GetGUIDLow(), quest_id, qstatus);
}
questStatusData.Explored = (fields[2].GetUInt8() > 0);
@@ -18134,6 +18146,9 @@ void Player::UnbindInstance(BoundInstancesMap::iterator &itr, Difficulty difficu
}
itr->second.save->RemovePlayer(this); // save can become invalid
if (itr->second.perm)
GetSession()->SendCalendarRaidLockout(itr->second.save, false);
m_boundInstances[difficulty].erase(itr++);
}
}
@@ -18202,6 +18217,8 @@ void Player::BindToInstance()
data << uint32(0);
GetSession()->SendPacket(&data);
BindToInstance(mapSave, true);
GetSession()->SendCalendarRaidLockout(mapSave, true);
}
void Player::SendRaidInfo()
@@ -19053,20 +19070,22 @@ void Player::_SaveDailyQuestStatus(SQLTransaction& trans)
stmt->setUInt32(0, GetGUIDLow());
trans->Append(stmt);
for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx)
{
if (GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx))
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_DAILYQUESTSTATUS);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_DAILYQUESTSTATUS);
stmt->setUInt32(0, GetGUIDLow());
stmt->setUInt32(1, GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx));
stmt->setUInt64(2, uint64(m_lastDailyQuestTime));
trans->Append(stmt);
}
}
if (!m_DFQuests.empty())
{
for (DFQuestsDoneList::iterator itr = m_DFQuests.begin(); itr != m_DFQuests.end(); ++itr)
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_DAILYQUESTSTATUS);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_DAILYQUESTSTATUS);
stmt->setUInt32(0, GetGUIDLow());
stmt->setUInt32(1, (*itr));
stmt->setUInt64(2, uint64(m_lastDailyQuestTime));
@@ -19089,7 +19108,7 @@ void Player::_SaveWeeklyQuestStatus(SQLTransaction& trans)
{
uint32 quest_id = *iter;
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_WEEKLYQUESTSTATUS);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_WEEKLYQUESTSTATUS);
stmt->setUInt32(0, GetGUIDLow());
stmt->setUInt32(1, quest_id);
trans->Append(stmt);
@@ -19115,7 +19134,7 @@ void Player::_SaveSeasonalQuestStatus(SQLTransaction& trans)
{
uint32 quest_id = (*itr);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_SEASONALQUESTSTATUS);
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_SEASONALQUESTSTATUS);
stmt->setUInt32(0, GetGUIDLow());
stmt->setUInt32(1, quest_id);
stmt->setUInt32(2, event_id);
@@ -19760,7 +19779,7 @@ void Player::PetSpellInitialize()
WorldPacket data(SMSG_PET_SPELLS, 8+2+4+4+4*MAX_UNIT_ACTION_BAR_INDEX+1+1);
data << uint64(pet->GetGUID());
data << uint16(pet->GetCreatureInfo()->family); // creature family (required for pet talents)
data << uint16(pet->GetCreatureTemplate()->family); // creature family (required for pet talents)
data << uint32(0);
data << uint8(pet->GetReactState()) << uint8(charmInfo->GetCommandState()) << uint16(0);
@@ -19854,7 +19873,7 @@ void Player::VehicleSpellInitialize()
WorldPacket data(SMSG_PET_SPELLS, 8 + 2 + 4 + 4 + 4 * 10 + 1 + 1 + cooldownCount * (4 + 2 + 4 + 4));
data << uint64(veh->GetGUID());
data << uint16(veh->GetCreatureInfo()->family);
data << uint16(veh->GetCreatureTemplate()->family);
data << uint32(0);
// The following three segments are read as one uint32
data << uint8(veh->GetReactState());
@@ -19940,7 +19959,7 @@ void Player::CharmSpellInitialize()
uint8 addlist = 0;
if (charm->GetTypeId() != TYPEID_PLAYER)
{
//CreatureInfo const* cinfo = charm->ToCreature()->GetCreatureInfo();
//CreatureInfo const* cinfo = charm->ToCreature()->GetCreatureTemplate();
//if (cinfo && cinfo->type == CREATURE_TYPE_DEMON && getClass() == CLASS_WARLOCK)
{
for (uint32 i = 0; i < MAX_SPELL_CHARM; ++i)
@@ -20066,9 +20085,13 @@ void Player::RestoreSpellMods(Spell* spell, uint32 ownerAuraId, Aura* aura)
continue;
// check if mod affected this spell
// first, check if the mod aura applied at least one spellmod to this spell
Spell::UsedSpellMods::iterator iterMod = spell->m_appliedMods.find(mod->ownerAura);
if (iterMod == spell->m_appliedMods.end())
continue;
// secondly, check if the current mod is one of the spellmods applied by the mod aura
if (!(mod->mask & spell->m_spellInfo->SpellFamilyFlags))
continue;
// remove from list
spell->m_appliedMods.erase(iterMod);
@@ -22638,7 +22661,7 @@ bool Player::isHonorOrXPTarget(Unit* pVictim)
{
if (pVictim->ToCreature()->isTotem() ||
pVictim->ToCreature()->isPet() ||
pVictim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL)
pVictim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL)
return false;
}
return true;
@@ -23998,7 +24021,7 @@ void Player::LearnPetTalent(uint64 petGuid, uint32 talentId, uint32 talentRank)
if (!talentTabInfo)
return;
CreatureTemplate const* ci = pet->GetCreatureInfo();
CreatureTemplate const* ci = pet->GetCreatureTemplate();
if (!ci)
return;
@@ -24259,7 +24282,7 @@ void Player::BuildPetTalentsInfoData(WorldPacket* data)
data->put<uint32>(pointsPos, unspentTalentPoints); // put real points
CreatureTemplate const* ci = pet->GetCreatureInfo();
CreatureTemplate const* ci = pet->GetCreatureTemplate();
if (!ci)
return;
+12 -10
View File
@@ -687,9 +687,9 @@ enum TransferAbortReason
TRANSFER_ABORT_UNIQUE_MESSAGE = 0x09, // Until you've escaped TLK's grasp, you cannot leave this place!
TRANSFER_ABORT_TOO_MANY_REALM_INSTANCES = 0x0A, // Additional instances cannot be launched, please try again later.
TRANSFER_ABORT_NEED_GROUP = 0x0B, // 3.1
TRANSFER_ABORT_NOT_FOUND2 = 0x0C, // 3.1
TRANSFER_ABORT_NOT_FOUND3 = 0x0D, // 3.1
TRANSFER_ABORT_NOT_FOUND4 = 0x0E, // 3.2
TRANSFER_ABORT_NOT_FOUND1 = 0x0C, // 3.1
TRANSFER_ABORT_NOT_FOUND2 = 0x0D, // 3.1
TRANSFER_ABORT_NOT_FOUND3 = 0x0E, // 3.2
TRANSFER_ABORT_REALM_ONLY = 0x0F, // All players on party must be from the same realm.
TRANSFER_ABORT_MAP_NOT_ALLOWED = 0x10, // Map can't be entered at this time.
};
@@ -1337,6 +1337,7 @@ class Player : public Unit, public GridObject<Player>
void UpdateEnchantTime(uint32 time);
void UpdateSoulboundTradeItems();
void AddTradeableItem(Item* item);
void RemoveTradeableItem(Item* item);
void UpdateItemDuration(uint32 time, bool realtimeonly = false);
void AddEnchantmentDurations(Item* item);
@@ -1914,7 +1915,7 @@ class Player : public Unit, public GridObject<Player>
WorldSession* GetSession() const { return m_session; }
void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const;
void DestroyForPlayer(Player* target, bool anim = false) const;
void DestroyForPlayer(Player* target, bool onDeath = false) const;
void SendLogXPGain(uint32 GivenXP, Unit* victim, uint32 BonusXP, bool recruitAFriend = false, float group_rate=1.0f);
// notifiers
@@ -1982,7 +1983,7 @@ class Player : public Unit, public GridObject<Player>
void UpdateDefense();
void UpdateWeaponSkill (WeaponAttackType attType);
void UpdateCombatSkills(Unit* pVictim, WeaponAttackType attType, bool defence);
void UpdateCombatSkills(Unit* victim, WeaponAttackType attType, bool defence);
void SetSkill(uint16 id, uint16 step, uint16 currVal, uint16 maxVal);
uint16 GetMaxSkillValue(uint32 skill) const; // max + perm. bonus + temp bonus
@@ -2015,9 +2016,9 @@ class Player : public Unit, public GridObject<Player>
bool IsAtGroupRewardDistance(WorldObject const* pRewardSource) const;
bool IsAtRecruitAFriendDistance(WorldObject const* pOther) const;
void RewardPlayerAndGroupAtKill(Unit* pVictim, bool isBattleGround);
void RewardPlayerAndGroupAtKill(Unit* victim, bool isBattleGround);
void RewardPlayerAndGroupAtEvent(uint32 creature_id, WorldObject* pRewardSource);
bool isHonorOrXPTarget(Unit* pVictim);
bool isHonorOrXPTarget(Unit* victim);
bool GetsRecruitAFriendBonus(bool forXP);
uint8 GetGrantableLevels() { return m_grantableLevels; }
@@ -2026,7 +2027,7 @@ class Player : public Unit, public GridObject<Player>
ReputationMgr& GetReputationMgr() { return m_reputationMgr; }
ReputationMgr const& GetReputationMgr() const { return m_reputationMgr; }
ReputationRank GetReputationRank(uint32 faction_id) const;
void RewardReputation(Unit* pVictim, float rate);
void RewardReputation(Unit* victim, float rate);
void RewardReputation(Quest const* quest);
void UpdateSkillsForLevel();
@@ -2037,7 +2038,7 @@ class Player : public Unit, public GridObject<Player>
/*** PVP SYSTEM ***/
/*********************************************************/
void UpdateHonorFields();
bool RewardHonor(Unit* pVictim, uint32 groupsize, int32 honor = -1, bool pvptoken = false);
bool RewardHonor(Unit* victim, uint32 groupsize, int32 honor = -1, bool pvptoken = false);
uint32 GetHonorPoints() const { return GetUInt32Value(PLAYER_FIELD_HONOR_CURRENCY); }
uint32 GetArenaPoints() const { return GetUInt32Value(PLAYER_FIELD_ARENA_CURRENCY); }
void ModifyHonorPoints(int32 value, SQLTransaction* trans = NULL); //! If trans is specified, honor save query will be added to trans
@@ -2331,7 +2332,7 @@ class Player : public Unit, public GridObject<Player>
void UpdateTriggerVisibility();
template<class T>
void UpdateVisibilityOf(T* target, UpdateData& data, std::set<Unit*>& visibleNow);
void UpdateVisibilityOf(T* target, UpdateData& data, std::set<Unit*>& visibleNow);
uint8 m_forced_speed_changes[MAX_MOVE_TYPE];
@@ -2414,6 +2415,7 @@ class Player : public Unit, public GridObject<Player>
void SetAuraUpdateMaskForRaid(uint8 slot) { m_auraRaidUpdateMask |= (uint64(1) << slot); }
Player* GetNextRandomRaidMember(float radius);
PartyResult CanUninviteFromGroup() const;
// Battleground Group System
void SetBattlegroundOrBattlefieldRaid(Group *group, int8 subgroup = -1);
void RemoveFromBattlegroundOrBattlefieldRaid();
@@ -173,7 +173,7 @@ void MapManager::LoadTransportNPCs()
Transport::Transport(uint32 period, uint32 script) : GameObject(), m_pathTime(0), m_timer(0),
currenttguid(0), m_period(period), ScriptId(script), m_nextNodeTime(0)
{
m_updateFlag = (UPDATEFLAG_TRANSPORT | UPDATEFLAG_HIGHGUID | UPDATEFLAG_HAS_POSITION | UPDATEFLAG_ROTATION);
m_updateFlag = (UPDATEFLAG_TRANSPORT | UPDATEFLAG_LOWGUID | UPDATEFLAG_STATIONARY_POSITION | UPDATEFLAG_ROTATION);
}
Transport::~Transport()
+2 -2
View File
@@ -1019,12 +1019,12 @@ void Creature::UpdateDamagePhysical(WeaponAttackType attType)
float weapon_maxdamage = GetWeaponDamageRange(attType, MAXDAMAGE);
/* difference in AP between current attack power and base value from DB */
float att_pwr_change = GetTotalAttackPowerValue(attType) - GetCreatureInfo()->attackpower;
float att_pwr_change = GetTotalAttackPowerValue(attType) - GetCreatureTemplate()->attackpower;
float base_value = GetModifierValue(unitMod, BASE_VALUE) + (att_pwr_change * GetAPMultiplier(attType, false) / 14.0f);
float base_pct = GetModifierValue(unitMod, BASE_PCT);
float total_value = GetModifierValue(unitMod, TOTAL_VALUE);
float total_pct = GetModifierValue(unitMod, TOTAL_PCT);
float dmg_multiplier = GetCreatureInfo()->dmg_multiplier;
float dmg_multiplier = GetCreatureTemplate()->dmg_multiplier;
if (!CanUseAttackType(attType))
{
+76 -66
View File
@@ -158,7 +158,7 @@ m_HostileRefManager(this)
m_objectType |= TYPEMASK_UNIT;
m_objectTypeId = TYPEID_UNIT;
m_updateFlag = (UPDATEFLAG_HIGHGUID | UPDATEFLAG_LIVING | UPDATEFLAG_HAS_POSITION);
m_updateFlag = (UPDATEFLAG_LIVING | UPDATEFLAG_STATIONARY_POSITION);
m_attackTimer[BASE_ATTACK] = 0;
m_attackTimer[OFF_ATTACK] = 0;
@@ -281,7 +281,6 @@ Unit::~Unit()
_DeleteRemovedAuras();
delete m_charmInfo;
delete m_vehicleKit;
delete movespline;
ASSERT(!m_duringRemoveFromWorld);
@@ -431,7 +430,7 @@ void Unit::SendMonsterMoveTransport(Unit* vehicleOwner)
data.append(GetPackGUID());
data.append(vehicleOwner->GetPackGUID());
data << int8(GetTransSeat());
data << uint8(GetTypeId() == TYPEID_PLAYER ? 1 : 0); // boolean
data << uint8(0);
data << GetPositionX() - vehicleOwner->GetPositionX();
data << GetPositionY() - vehicleOwner->GetPositionY();
data << GetPositionZ() - vehicleOwner->GetPositionZ();
@@ -1470,8 +1469,8 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo
if (GetTypeId() == TYPEID_PLAYER)
{
float bonusPct = 0;
AuraEffectList const& ResIgnoreAuras = GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT);
for (AuraEffectList::const_iterator itr = ResIgnoreAuras.begin(); itr != ResIgnoreAuras.end(); ++itr)
AuraEffectList const& armorPenAuras = GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT);
for (AuraEffectList::const_iterator itr = armorPenAuras.begin(); itr != armorPenAuras.end(); ++itr)
{
if ((*itr)->GetSpellInfo()->EquippedItemClass == -1)
{
@@ -2015,7 +2014,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
else
parry_chance -= GetTotalAuraModifier(SPELL_AURA_MOD_EXPERTISE) * 25;
if (victim->GetTypeId() == TYPEID_PLAYER || !(victim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY))
if (victim->GetTypeId() == TYPEID_PLAYER || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_PARRY))
{
int32 tmp2 = int32(parry_chance);
if (tmp2 > 0 // check if unit _can_ parry
@@ -2027,7 +2026,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
}
}
if (victim->GetTypeId() == TYPEID_PLAYER || !(victim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK))
if (victim->GetTypeId() == TYPEID_PLAYER || !(victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK))
{
tmp = block_chance;
if (tmp > 0 // check if unit _can_ block
@@ -2046,7 +2045,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
if (tmp > 0 && roll < (sum += tmp))
{
sLog->outStaticDebug ("RollMeleeOutcomeAgainst: CRIT <%d, %d)", sum-tmp, sum);
if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRIT))
if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRIT))
sLog->outStaticDebug ("RollMeleeOutcomeAgainst: CRIT DISABLED)");
else
return MELEE_HIT_CRIT;
@@ -2076,7 +2075,7 @@ MeleeHitOutcome Unit::RollMeleeOutcomeAgainst (const Unit* victim, WeaponAttackT
if (getLevelForTarget(victim) >= victim->getLevelForTarget(this) + 4 &&
// can be from by creature (if can) or from controlled player that considered as creature
!IsControlledByPlayer() &&
!(GetTypeId() == TYPEID_UNIT && ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH))
!(GetTypeId() == TYPEID_UNIT && ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_CRUSH))
{
// when their weapon skill is 15 or more above victim's defense skill
tmp = victimDefenseSkill;
@@ -2190,7 +2189,7 @@ bool Unit::isSpellBlocked(Unit* victim, SpellInfo const* spellProto, WeaponAttac
{
// Check creatures flags_extra for disable block
if (victim->GetTypeId() == TYPEID_UNIT &&
victim->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK)
victim->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_BLOCK)
return false;
float blockChance = victim->GetUnitBlockChance();
@@ -2328,7 +2327,7 @@ SpellMissInfo Unit::MeleeSpellHitResult(Unit* victim, SpellInfo const* spell)
// Check creatures flags_extra for disable parry
if (victim->GetTypeId() == TYPEID_UNIT)
{
uint32 flagEx = victim->ToCreature()->GetCreatureInfo()->flags_extra;
uint32 flagEx = victim->ToCreature()->GetCreatureTemplate()->flags_extra;
if (flagEx & CREATURE_FLAG_EXTRA_NO_PARRY)
canParry = false;
// Check creatures flags_extra for disable block
@@ -9179,7 +9178,7 @@ FactionTemplateEntry const* Unit::getFactionTemplateEntry() const
if (Player const* player = ToPlayer())
sLog->outError("Player %s has invalid faction (faction template id) #%u", player->GetName(), getFaction());
else if (Creature const* creature = ToCreature())
sLog->outError("Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureInfo()->Entry, getFaction());
sLog->outError("Creature (template id: %u) has invalid faction (faction template id) #%u", creature->GetCreatureTemplate()->Entry, getFaction());
else
sLog->outError("Unit (name=%s, type=%u) has invalid faction (faction template id) #%u", GetName(), uint32(GetTypeId()), getFaction());
@@ -9907,7 +9906,7 @@ void Unit::SetCharm(Unit* charm, bool apply)
if (charm->HasUnitMovementFlag(MOVEMENTFLAG_WALKING))
{
charm->RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
charm->SetWalk(false);
charm->SendMovementFlagUpdate();
}
@@ -10004,6 +10003,7 @@ Unit* Unit::GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo)
&& _IsValidAttackTarget(magnet, spellInfo)
&& IsWithinLOSInMap(magnet))
{
// TODO: handle this charge drop by proc in cast phase on explicit target
(*itr)->GetBase()->DropCharge(AURA_REMOVE_BY_EXPIRE);
return magnet;
}
@@ -10235,7 +10235,7 @@ uint32 Unit::SpellDamageBonus(Unit* victim, SpellInfo const* spellProto, uint32
// ..done
// Pet damage?
if (GetTypeId() == TYPEID_UNIT && !ToCreature()->isPet())
DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureInfo()->rank);
DoneTotalMod *= ToCreature()->GetSpellDamageMod(ToCreature()->GetCreatureTemplate()->rank);
AuraEffectList const& mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
@@ -12032,7 +12032,7 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy)
UpdateSpeed(MOVE_FLIGHT, true);
}
if (!(creature->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_MOUNTED_COMBAT))
if (!(creature->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_MOUNTED_COMBAT))
Dismount();
}
@@ -12051,12 +12051,12 @@ void Unit::ClearInCombat()
// Player's state will be cleared in Player::UpdateContestedPvP
if (Creature* creature = ToCreature())
{
if (creature->GetCreatureInfo() && creature->GetCreatureInfo()->unit_flags & UNIT_FLAG_IMMUNE_TO_PC)
if (creature->GetCreatureTemplate() && creature->GetCreatureTemplate()->unit_flags & UNIT_FLAG_IMMUNE_TO_PC)
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); // set immunity state to the one from db on evade
ClearUnitState(UNIT_STATE_ATTACK_PLAYER);
if (HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED))
SetUInt32Value(UNIT_DYNAMIC_FLAGS, creature->GetCreatureInfo()->dynamicflags);
SetUInt32Value(UNIT_DYNAMIC_FLAGS, creature->GetCreatureTemplate()->dynamicflags);
if (creature->isPet())
{
@@ -12171,7 +12171,7 @@ bool Unit::_IsValidAttackTarget(Unit const* target, SpellInfo const* bySpell) co
}
Creature const* creatureAttacker = ToCreature();
if (creatureAttacker && creatureAttacker->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK26)
if (creatureAttacker && creatureAttacker->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_UNK26)
return false;
Player const* playerAffectingAttacker = HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE) ? GetAffectingPlayer() : NULL;
@@ -12258,7 +12258,7 @@ bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) co
// can't assist non-friendly targets
if (GetReactionTo(target) <= REP_NEUTRAL
&& target->GetReactionTo(this) <= REP_NEUTRAL
&& (!ToCreature() || !(ToCreature()->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK26)))
&& (!ToCreature() || !(ToCreature()->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_UNK26)))
return false;
// PvP case
@@ -12292,7 +12292,7 @@ bool Unit::_IsValidAssistTarget(Unit const* target, SpellInfo const* bySpell) co
&& !((target->GetByteValue(UNIT_FIELD_BYTES_2, 1) & UNIT_BYTE2_FLAG_PVP)))
{
if (Creature const* creatureTarget = target->ToCreature())
return creatureTarget->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_UNK26 || creatureTarget->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS;
return creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_UNK26 || creatureTarget->GetCreatureTemplate()->type_flags & CREATURE_TYPEFLAGS_AID_PLAYERS;
}
return true;
}
@@ -12514,7 +12514,7 @@ void Unit::UpdateSpeed(UnitMoveType mtype, bool forced)
{
// Set creature speed rate from CreatureInfo
if (GetTypeId() == TYPEID_UNIT)
speed *= ToCreature()->GetCreatureInfo()->speed_walk;
speed *= ToCreature()->GetCreatureTemplate()->speed_walk;
// Normalize speed by 191 aura SPELL_AURA_USE_NORMAL_MOVEMENT_SPEED if need
// TODO: possible affect only on MOVE_RUN
@@ -13200,7 +13200,7 @@ float Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,
Unit const* source = casterOwner ? casterOwner : caster;
if ((target->GetTypeId() == TYPEID_PLAYER
|| ((Creature*)target)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH)
|| ((Creature*)target)->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH)
&& source->GetTypeId() == TYPEID_PLAYER)
duration = limitduration;
}
@@ -13209,7 +13209,7 @@ float Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,
if (group == DIMINISHING_TAUNT)
{
if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TAUNT_DIMINISH))
if (GetTypeId() == TYPEID_UNIT && (ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_TAUNT_DIMINISH))
{
DiminishingLevels diminish = Level;
switch (diminish)
@@ -13226,7 +13226,7 @@ float Unit::ApplyDiminishingToDuration(DiminishingGroup group, int32 &duration,
// Some diminishings applies to mobs too (for example, Stun)
else if ((GetDiminishingReturnsGroupType(group) == DRTYPE_PLAYER
&& ((targetOwner ? (targetOwner->GetTypeId() == TYPEID_PLAYER) : (GetTypeId() == TYPEID_PLAYER))
|| (GetTypeId() == TYPEID_UNIT && ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH)))
|| (GetTypeId() == TYPEID_UNIT && ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH)))
|| GetDiminishingReturnsGroupType(group) == DRTYPE_ALL)
{
DiminishingLevels diminish = Level;
@@ -13310,7 +13310,7 @@ uint32 Unit::GetCreatureType() const
return CREATURE_TYPE_HUMANOID;
}
else
return ToCreature()->GetCreatureInfo()->type;
return ToCreature()->GetCreatureTemplate()->type;
}
/*#######################################
@@ -13682,7 +13682,7 @@ void Unit::RemoveFromWorld()
{
m_duringRemoveFromWorld = true;
if (IsVehicle())
GetVehicleKit()->Uninstall();
RemoveVehicleKit();
RemoveCharmAuras();
RemoveBindSightAuras();
@@ -13691,7 +13691,7 @@ void Unit::RemoveFromWorld()
RemoveAllGameObjects();
RemoveAllDynObjects();
ExitVehicle();
ExitVehicle(); // Remove applied auras with SPELL_AURA_CONTROL_VEHICLE
UnsummonAllTotems();
RemoveAllControlled();
@@ -13903,12 +13903,7 @@ void CharmInfo::InitCharmCreateSpells()
newstate = ACT_PASSIVE;
else
{
bool autocast = false;
for (uint32 i = 0; i < MAX_SPELL_EFFECTS && !autocast; ++i)
if (spellInfo->Effects[i].TargetA.GetType() == TARGET_TYPE_UNIT_TARGET)
autocast = true;
if (autocast)
if (spellInfo->NeedsExplicitUnitTarget())
{
newstate = ACT_ENABLED;
ToggleCreatureAutocast(spellInfo, true);
@@ -15398,10 +15393,10 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
creature->lootForPickPocketed = false;
loot->clear();
if (uint32 lootid = creature->GetCreatureInfo()->lootid)
if (uint32 lootid = creature->GetCreatureTemplate()->lootid)
loot->FillLoot(lootid, LootTemplates_Creature, looter, false, false, creature->GetLootMode());
loot->generateMoneyLoot(creature->GetCreatureInfo()->mingold, creature->GetCreatureInfo()->maxgold);
loot->generateMoneyLoot(creature->GetCreatureTemplate()->mingold, creature->GetCreatureTemplate()->maxgold);
}
player->RewardPlayerAndGroupAtKill(victim, false);
@@ -15459,7 +15454,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
// Inform pets (if any) when player kills target)
// MUST come after victim->setDeathState(JUST_DIED); or pet next target
// selection will get stuck on same target and break pet react state
if (Player* player = ToPlayer())
if (player)
{
Pet* pet = player->GetPet();
if (pet && pet->isAlive() && pet->isControlled())
@@ -15502,7 +15497,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
if (!creature->isPet())
{
creature->DeleteThreatList();
CreatureTemplate const* cInfo = creature->GetCreatureInfo();
CreatureTemplate const* cInfo = creature->GetCreatureTemplate();
if (cInfo && (cInfo->lootid || cInfo->maxgold > 0))
creature->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
}
@@ -15531,7 +15526,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
{
if (instanceMap->IsRaidOrHeroicDungeon())
{
if (creature->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
if (creature->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
((InstanceMap*)instanceMap)->PermBindAllPlayers(creditedPlayer);
}
else
@@ -15595,9 +15590,6 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)
if (Player* killed = victim->ToPlayer())
sScriptMgr->OnPlayerKilledByCreature(killerCre, killed);
}
if (victim->GetVehicle())
victim->ExitVehicle();
}
void Unit::SetControlled(bool apply, UnitState state)
@@ -15948,7 +15940,7 @@ bool Unit::SetCharmedBy(Unit* charmer, CharmType type, AuraApplication const* au
case CHARM_TYPE_CHARM:
if (GetTypeId() == TYPEID_UNIT && charmer->getClass() == CLASS_WARLOCK)
{
CreatureTemplate const* cinfo = ToCreature()->GetCreatureInfo();
CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate();
if (cinfo && cinfo->type == CREATURE_TYPE_DEMON)
{
// to prevent client crash
@@ -16052,7 +16044,7 @@ void Unit::RemoveCharmedBy(Unit* charmer)
case CHARM_TYPE_CHARM:
if (GetTypeId() == TYPEID_UNIT && charmer->getClass() == CLASS_WARLOCK)
{
CreatureTemplate const* cinfo = ToCreature()->GetCreatureInfo();
CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate();
if (cinfo && cinfo->type == CREATURE_TYPE_DEMON)
{
SetByteValue(UNIT_FIELD_BYTES_0, 1, uint8(cinfo->unit_class));
@@ -16091,7 +16083,7 @@ void Unit::RestoreFaction()
}
}
if (CreatureTemplate const* cinfo = ToCreature()->GetCreatureInfo()) // normal creature
if (CreatureTemplate const* cinfo = ToCreature()->GetCreatureTemplate()) // normal creature
{
FactionTemplateEntry const* faction = getFactionTemplateEntry();
setFaction((faction && faction->friendlyMask & 0x004) ? cinfo->faction_H : cinfo->faction_A);
@@ -16183,26 +16175,6 @@ bool Unit::IsInRaidWith(Unit const* unit) const
return false;
}
bool Unit::IsTargetMatchingCheck(Unit const* target, SpellTargetSelectionCheckTypes check) const
{
switch (check)
{
case TARGET_SELECT_CHECK_ENEMY:
if (IsControlledByPlayer())
return !IsFriendlyTo(target);
else
return IsHostileTo(target);
case TARGET_SELECT_CHECK_ALLY:
return IsFriendlyTo(target);
case TARGET_SELECT_CHECK_PARTY:
return IsInPartyWith(target);
case TARGET_SELECT_CHECK_RAID:
return IsInRaidWith(target);
default:
return true;
}
}
void Unit::GetRaidMember(std::list<Unit*> &nearMembers, float radius)
{
Player* owner = GetCharmerOrOwnerPlayerOrPlayerItself();
@@ -17026,12 +16998,21 @@ void Unit::ChangeSeat(int8 seatId, bool next)
void Unit::ExitVehicle(Position const* exitPosition)
{
// This function can be called at upper level code to initialize an exit from the passenger's side.
//! This function can be called at upper level code to initialize an exit from the passenger's side.
if (!m_vehicle)
return;
GetVehicleBase()->RemoveAurasByType(SPELL_AURA_CONTROL_VEHICLE, GetGUID());
_ExitVehicle(exitPosition);
//! The following call would not even be executed successfully as the
//! SPELL_AURA_CONTROL_VEHICLE unapply handler already calls _ExitVehicle without
//! specifying an exitposition. The subsequent call below would return on if (!m_vehicle).
/*_ExitVehicle(exitPosition);*/
//! To do:
//! We need to allow SPELL_AURA_CONTROL_VEHICLE unapply handlers in spellscripts
//! to specify exit coordinates and either store those per passenger, or we need to
//! init spline movement based on those coordinates in unapply handlers, and
//! relocate exiting passengers based on Unit::moveSpline data. Either way,
//! Coming Soon™
}
void Unit::_ExitVehicle(Position const* exitPosition)
@@ -17117,6 +17098,9 @@ void Unit::BuildMovementPacket(ByteBuffer *data) const
*data << float (GetTransOffsetO());
*data << uint32(GetTransTime());
*data << uint8 (GetTransSeat());
if (GetExtraUnitMovementFlags() & MOVEMENTFLAG2_INTERPOLATED_MOVEMENT)
*data << uint32(m_movementInfo.t_time2);
}
// 0x02200000
@@ -17471,3 +17455,29 @@ void Unit::SetFacingToObject(WorldObject* pObject)
// TODO: figure out under what conditions creature will move towards object instead of facing it where it currently is.
SetFacingTo(GetAngle(pObject));
}
bool Unit::SetWalk(bool enable)
{
if (enable == IsWalking())
return false;
if (enable)
AddUnitMovementFlag(MOVEMENTFLAG_WALKING);
else
RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING);
return true;
}
bool Unit::SetLevitate(bool enable)
{
if (enable == IsLevitating())
return false;
if (enable)
AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
else
RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING);
return true;
}
+2 -1
View File
@@ -1394,7 +1394,6 @@ class Unit : public WorldObject
bool IsNeutralToAll() const;
bool IsInPartyWith(Unit const* unit) const;
bool IsInRaidWith(Unit const* unit) const;
bool IsTargetMatchingCheck(Unit const* target, SpellTargetSelectionCheckTypes check) const;
void GetPartyMemberInDist(std::list<Unit*> &units, float dist);
void GetPartyMembers(std::list<Unit*> &units);
void GetRaidMember(std::list<Unit*> &units, float dist);
@@ -1628,6 +1627,8 @@ class Unit : public WorldObject
void SendMovementFlagUpdate();
bool IsLevitating() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_LEVITATING);}
bool IsWalking() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING);}
virtual bool SetWalk(bool enable);
virtual bool SetLevitate(bool enable);
void SetInFront(Unit const* target);
void SetFacingTo(float ori);
+1 -1
View File
@@ -146,7 +146,7 @@ void Vehicle::ApplyAllImmunities()
_me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK_DEST, true);
// Mechanical units & vehicles ( which are not Bosses, they have own immunities in DB ) should be also immune on healing ( exceptions in switch below )
if (_me->ToCreature() && _me->ToCreature()->GetCreatureInfo()->type == CREATURE_TYPE_MECHANICAL && !_me->ToCreature()->isWorldBoss())
if (_me->ToCreature() && _me->ToCreature()->GetCreatureTemplate()->type == CREATURE_TYPE_MECHANICAL && !_me->ToCreature()->isWorldBoss())
{
// Heal & dispel ...
_me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_HEAL, true);
+1 -1
View File
@@ -1174,7 +1174,7 @@ void GameEventMgr::UpdateEventNPCFlags(uint16 event_id)
if (cr)
{
uint32 npcflag = GetNPCFlag(cr);
if (const CreatureTemplate* ci = cr->GetCreatureInfo())
if (const CreatureTemplate* ci = cr->GetCreatureTemplate())
npcflag |= ci->npcflag;
cr->SetUInt32Value(UNIT_NPC_FLAGS, npcflag);
// reset gossip options, since the flag change might have added / removed some
+1 -1
View File
@@ -400,4 +400,4 @@ template Pet* ObjectAccessor::GetObjectInWorld<Pet>(uint32 mapid, float x, float
template Creature* ObjectAccessor::GetObjectInWorld<Creature>(uint32 mapid, float x, float y, uint64 guid, Creature* /*fake*/);
template Corpse* ObjectAccessor::GetObjectInWorld<Corpse>(uint32 mapid, float x, float y, uint64 guid, Corpse* /*fake*/);
template GameObject* ObjectAccessor::GetObjectInWorld<GameObject>(uint32 mapid, float x, float y, uint64 guid, GameObject* /*fake*/);
template DynamicObject* ObjectAccessor::GetObjectInWorld<DynamicObject>(uint32 mapid, float x, float y, uint64 guid, DynamicObject* /*fake*/);
template DynamicObject* ObjectAccessor::GetObjectInWorld<DynamicObject>(uint32 mapid, float x, float y, uint64 guid, DynamicObject* /*fake*/);
+75 -98
View File
@@ -389,6 +389,7 @@ void ObjectMgr::LoadCreatureTemplates()
return;
}
_creatureTemplateStore.rehash(result->GetRowCount());
uint32 count = 0;
do
{
@@ -700,7 +701,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
else if (!displayScaleEntry)
displayScaleEntry = displayEntry;
CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid2);;
CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid2);
if (!modelInfo)
sLog->outErrorDb("No model data exist for `Modelid2` = %u listed by creature (Entry: %u).", cInfo->Modelid2, cInfo->Entry);
}
@@ -732,7 +733,7 @@ void ObjectMgr::CheckCreatureTemplate(CreatureTemplate const* cInfo)
else if (!displayScaleEntry)
displayScaleEntry = displayEntry;
CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid4);;
CreatureModelInfo const* modelInfo = GetCreatureModelInfo(cInfo->Modelid4);
if (!modelInfo)
sLog->outErrorDb("No model data exist for `Modelid4` = %u listed by creature (Entry: %u).", cInfo->Modelid4, cInfo->Entry);
}
@@ -991,7 +992,7 @@ void ObjectMgr::LoadEquipmentTemplates()
if (!equipmentInfo.ItemEntry[i])
continue;
ItemEntry const* dbcItem = sItemStore.LookupEntry(equipmentInfo.ItemEntry[i]);
ItemEntry const* dbcItem = sItemStore.LookupEntry(equipmentInfo.ItemEntry[i]);
if (!dbcItem)
{
@@ -1070,25 +1071,25 @@ void ObjectMgr::ChooseCreatureFlags(const CreatureTemplate* cinfo, uint32& npcfl
CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(uint32* displayID)
{
CreatureModelInfo const* minfo = GetCreatureModelInfo(*displayID);
if (!minfo)
CreatureModelInfo const* modelInfo = GetCreatureModelInfo(*displayID);
if (!modelInfo)
return NULL;
// If a model for another gender exists, 50% chance to use it
if (minfo->modelid_other_gender != 0 && urand(0, 1) == 0)
if (modelInfo->modelid_other_gender != 0 && urand(0, 1) == 0)
{
CreatureModelInfo const* minfo_tmp = GetCreatureModelInfo(minfo->modelid_other_gender);
CreatureModelInfo const* minfo_tmp = GetCreatureModelInfo(modelInfo->modelid_other_gender);
if (!minfo_tmp)
sLog->outErrorDb("Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", *displayID, minfo->modelid_other_gender);
sLog->outErrorDb("Model (Entry: %u) has modelid_other_gender %u not found in table `creature_model_info`. ", *displayID, modelInfo->modelid_other_gender);
else
{
// Model ID changed
*displayID = minfo->modelid_other_gender;
*displayID = modelInfo->modelid_other_gender;
return minfo_tmp;
}
}
return minfo;
return modelInfo;
}
void ObjectMgr::LoadCreatureModelInfo()
@@ -1104,6 +1105,7 @@ void ObjectMgr::LoadCreatureModelInfo()
return;
}
_creatureModelStore.rehash(result->GetRowCount());
uint32 count = 0;
do
@@ -1137,9 +1139,7 @@ void ObjectMgr::LoadCreatureModelInfo()
}
if (modelInfo.combat_reach < 0.1f)
{
modelInfo.combat_reach = DEFAULT_COMBAT_REACH;
}
++count;
}
@@ -1327,7 +1327,6 @@ void ObjectMgr::LoadLinkedRespawn()
if (!error)
_linkedRespawnStore[guid] = linkedGuid;
}
while (result->NextRow());
@@ -1381,9 +1380,9 @@ void ObjectMgr::LoadCreatures()
{
uint32 oldMSTime = getMSTime();
// 0 1 2 3 4 5 6 7 8 9 10
// 0 1 2 3 4 5 6 7 8 9 10
QueryResult result = WorldDatabase.Query("SELECT creature.guid, id, map, modelid, equipment_id, position_x, position_y, position_z, orientation, spawntimesecs, spawndist, "
// 11 12 13 14 15 16 17 18 19 20 21
// 11 12 13 14 15 16 17 18 19 20 21
"currentwaypoint, curhealth, curmana, MovementType, spawnMask, phaseMask, eventEntry, pool_entry, creature.npcflag, creature.unit_flags, creature.dynamicflags "
"FROM creature "
"LEFT OUTER JOIN game_event_creature ON creature.guid = game_event_creature.guid "
@@ -1404,6 +1403,7 @@ void ObjectMgr::LoadCreatures()
if (GetMapDifficultyData(i, Difficulty(k)))
spawnMasks[i] |= (1 << k);
_creatureDataStore.rehash(result->GetRowCount());
uint32 count = 0;
do
{
@@ -1420,7 +1420,6 @@ void ObjectMgr::LoadCreatures()
}
CreatureData& data = _creatureDataStore[guid];
data.id = entry;
data.mapid = fields[ 2].GetUInt32();
data.displayid = fields[ 3].GetUInt32();
@@ -1694,7 +1693,7 @@ void ObjectMgr::LoadGameobjects()
// 0 1 2 3 4 5 6
QueryResult result = WorldDatabase.Query("SELECT gameobject.guid, id, map, position_x, position_y, position_z, orientation, "
// 7 8 9 10 11 12 13 14 15 16 17
// 7 8 9 10 11 12 13 14 15 16 17
"rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, state, spawnMask, phaseMask, eventEntry, pool_entry "
"FROM gameobject LEFT OUTER JOIN game_event_gameobject ON gameobject.guid = game_event_gameobject.guid "
"LEFT OUTER JOIN pool_gameobject ON gameobject.guid = pool_gameobject.guid");
@@ -1714,6 +1713,7 @@ void ObjectMgr::LoadGameobjects()
if (GetMapDifficultyData(i, Difficulty(k)))
spawnMasks[i] |= (1 << k);
_gameObjectDataStore.rehash(result->GetRowCount());
do
{
Field* fields = result->Fetch();
@@ -1820,7 +1820,6 @@ void ObjectMgr::LoadGameobjects()
if (gameEvent == 0 && PoolId == 0) // if not this is to be managed by GameEvent System or Pool system
AddGameobjectToGrid(guid, &data);
++count;
} while (result->NextRow());
sLog->outString(">> Loaded %lu gameobjects in %u ms", (unsigned long)_gameObjectDataStore.size(), GetMSTimeDiffToNow(oldMSTime));
@@ -2085,6 +2084,7 @@ void ObjectMgr::LoadItemTemplates()
return;
}
_itemTemplateStore.rehash(result->GetRowCount());
uint32 count = 0;
bool enforceDBCAttributes = sWorld->getBoolConfig(CONFIG_DBC_ENFORCE_ITEM_ATTRIBUTES);
@@ -2626,7 +2626,7 @@ void ObjectMgr::LoadItemTemplates()
uint32 item_id = entry->ItemId[j];
if (!sObjectMgr->GetItemTemplate(item_id))
if (!GetItemTemplate(item_id))
notFoundOutfit.insert(item_id);
}
}
@@ -2703,6 +2703,7 @@ void ObjectMgr::LoadItemSetNames()
return;
}
_itemSetNameStore.rehash(result->GetRowCount());
uint32 count = 0;
do
@@ -3128,7 +3129,7 @@ void ObjectMgr::LoadPlayerInfo()
uint32 item_id = fields[2].GetUInt32();
if (!sObjectMgr->GetItemTemplate(item_id))
if (!GetItemTemplate(item_id))
{
sLog->outErrorDb("Item id %u (race %u class %u) in `playercreateinfo_item` table but not listed in `item_template`, ignoring.", item_id, current_race, current_class);
continue;
@@ -3691,7 +3692,7 @@ void ObjectMgr::LoadQuests()
{
Field* fields = result->Fetch();
Quest * newQuest = new Quest(fields);
Quest* newQuest = new Quest(fields);
_questTemplates[newQuest->GetQuestId()] = newQuest;
} while (result->NextRow());
@@ -3709,9 +3710,7 @@ void ObjectMgr::LoadQuests()
// additional quest integrity checks (GO, creature_template and item_template must be loaded already)
if (qinfo->GetQuestMethod() >= 3)
{
sLog->outErrorDb("Quest %u has `Method` = %u, expected values are 0, 1 or 2.", qinfo->GetQuestId(), qinfo->GetQuestMethod());
}
if (qinfo->Flags & ~QUEST_TRINITY_FLAGS_DB_ALLOWED)
{
@@ -4398,7 +4397,6 @@ void ObjectMgr::LoadScripts(ScriptsType type)
do
{
Field* fields = result->Fetch();
ScriptInfo tmp;
tmp.type = type;
@@ -4807,8 +4805,8 @@ void ObjectMgr::LoadWaypointScripts()
uint32 action = fields[0].GetUInt32();
actionSet.erase(action);
} while (result->NextRow());
}
while (result->NextRow());
}
for (std::set<uint32>::iterator itr = actionSet.begin(); itr != actionSet.end(); ++itr)
@@ -5161,11 +5159,11 @@ void ObjectMgr::LoadGossipText()
int count = 0;
if (!result)
{
sLog->outString(">> Loaded %u npc texts", count);
sLog->outString();
return;
}
_gossipTextStore.rehash(result->GetRowCount());
int cic;
@@ -5295,7 +5293,6 @@ void ObjectMgr::ReturnOrDeleteOldMails(bool serverUp)
uint32 returnedCount = 0;
do
{
Field* fields = result->Fetch();
Mail* m = new Mail;
m->messageID = fields[0].GetUInt32();
@@ -5614,7 +5611,7 @@ uint32 ObjectMgr::GetTaxiMountDisplayId(uint32 id, uint32 team, bool allowed_alt
}
// minfo is not actually used but the mount_id was updated
sObjectMgr->GetCreatureModelRandomGender(&mount_id);
GetCreatureModelRandomGender(&mount_id);
return mount_id;
}
@@ -5762,10 +5759,10 @@ WorldSafeLocsEntry const* ObjectMgr::GetClosestGraveYard(float x, float y, float
if (MapId != entry->map_id)
{
// if find graveyard at different map from where entrance placed (or no entrance data), use any first
if (!mapEntry ||
mapEntry->entrance_map < 0 ||
uint32(mapEntry->entrance_map) != entry->map_id ||
(mapEntry->entrance_x == 0 && mapEntry->entrance_y == 0))
if (!mapEntry
|| mapEntry->entrance_map < 0
|| uint32(mapEntry->entrance_map) != entry->map_id
|| (mapEntry->entrance_x == 0 && mapEntry->entrance_y == 0))
{
// not have any corrdinates for check distance anyway
entryFar = entry;
@@ -5910,8 +5907,6 @@ void ObjectMgr::RemoveGraveYardLink(uint32 id, uint32 zoneId, uint32 team, bool
WorldDatabase.Execute(stmt);
}
return;
}
void ObjectMgr::LoadAreaTriggerTeleports()
@@ -5981,7 +5976,7 @@ void ObjectMgr::LoadAccessRequirements()
_accessRequirementStore.clear(); // need for reload case
// 0 1 2 3 4 5 6 7 8 9
// 0 1 2 3 4 5 6 7 8 9
QueryResult result = WorldDatabase.Query("SELECT mapid, difficulty, level_min, level_max, item, item2, quest_done_A, quest_done_H, completed_achievement, quest_failed_text FROM access_requirement");
if (!result)
{
@@ -6015,7 +6010,7 @@ void ObjectMgr::LoadAccessRequirements()
if (ar.item)
{
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(ar.item);
ItemTemplate const* pProto = GetItemTemplate(ar.item);
if (!pProto)
{
sLog->outError("Key item %u does not exist for map %u difficulty %u, removing key requirement.", ar.item, mapid, difficulty);
@@ -6025,7 +6020,7 @@ void ObjectMgr::LoadAccessRequirements()
if (ar.item2)
{
ItemTemplate const* pProto = sObjectMgr->GetItemTemplate(ar.item2);
ItemTemplate const* pProto = GetItemTemplate(ar.item2);
if (!pProto)
{
sLog->outError("Second item %u does not exist for map %u difficulty %u, removing key requirement.", ar.item2, mapid, difficulty);
@@ -6132,10 +6127,10 @@ void ObjectMgr::SetHighestGuids()
_hiItemGuid = (*result)[0].GetUInt32()+1;
// Cleanup other tables from not existed guids ( >= _hiItemGuid)
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item >= '%u'", _hiItemGuid); // One-time query
CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid >= '%u'", _hiItemGuid); // One-time query
CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE itemguid >= '%u'", _hiItemGuid); // One-time query
CharacterDatabase.PExecute("DELETE FROM guild_bank_item WHERE item_guid >= '%u'", _hiItemGuid); // One-time query
CharacterDatabase.PExecute("DELETE FROM character_inventory WHERE item >= '%u'", _hiItemGuid);
CharacterDatabase.PExecute("DELETE FROM mail_items WHERE item_guid >= '%u'", _hiItemGuid);
CharacterDatabase.PExecute("DELETE FROM auctionhouse WHERE itemguid >= '%u'", _hiItemGuid);
CharacterDatabase.PExecute("DELETE FROM guild_bank_item WHERE item_guid >= '%u'", _hiItemGuid);
result = WorldDatabase.Query("SELECT MAX(guid) FROM gameobject");
if (result)
@@ -6390,6 +6385,7 @@ void ObjectMgr::LoadGameObjectTemplate()
return;
}
_gameObjectTemplateStore.rehash(result->GetRowCount());
uint32 count = 0;
do
{
@@ -6411,14 +6407,10 @@ void ObjectMgr::LoadGameObjectTemplate()
got.size = fields[9].GetFloat();
for (uint8 i = 0; i < MAX_GAMEOBJECT_QUEST_ITEMS; ++i)
{
got.questItems[i] = fields[10 + i].GetUInt32();
}
for (uint8 i = 0; i < MAX_GAMEOBJECT_DATA; ++i)
{
got.raw.data[i] = fields[16 + i].GetUInt32();
}
got.AIName = fields[40].GetString();
got.ScriptId = GetScriptId(fields[41].GetCString());
@@ -6427,28 +6419,28 @@ void ObjectMgr::LoadGameObjectTemplate()
switch (got.type)
{
case GAMEOBJECT_TYPE_DOOR: //0
case GAMEOBJECT_TYPE_DOOR: //0
{
if (got.door.lockId)
CheckGOLockId(&got, got.door.lockId, 1);
CheckGONoDamageImmuneId(&got, got.door.noDamageImmune, 3);
CheckGONoDamageImmuneId(&got, got.door.noDamageImmune, 3);
break;
}
case GAMEOBJECT_TYPE_BUTTON: //1
case GAMEOBJECT_TYPE_BUTTON: //1
{
if (got.button.lockId)
CheckGOLockId(&got, got.button.lockId, 1);
CheckGOLockId(&got, got.button.lockId, 1);
CheckGONoDamageImmuneId(&got, got.button.noDamageImmune, 4);
break;
}
case GAMEOBJECT_TYPE_QUESTGIVER: //2
case GAMEOBJECT_TYPE_QUESTGIVER: //2
{
if (got.questgiver.lockId)
CheckGOLockId(&got, got.questgiver.lockId, 0);
CheckGONoDamageImmuneId(&got, got.questgiver.noDamageImmune, 5);
break;
}
case GAMEOBJECT_TYPE_CHEST: //3
case GAMEOBJECT_TYPE_CHEST: //3
{
if (got.chest.lockId)
CheckGOLockId(&got, got.chest.lockId, 0);
@@ -6459,16 +6451,16 @@ void ObjectMgr::LoadGameObjectTemplate()
CheckGOLinkedTrapId(&got, got.chest.linkedTrapId, 7);
break;
}
case GAMEOBJECT_TYPE_TRAP: //6
case GAMEOBJECT_TYPE_TRAP: //6
{
if (got.trap.lockId)
CheckGOLockId(&got, got.trap.lockId, 0);
break;
}
case GAMEOBJECT_TYPE_CHAIR: //7
CheckAndFixGOChairHeightId(&got, got.chair.height, 1);
break;
case GAMEOBJECT_TYPE_SPELL_FOCUS: //8
case GAMEOBJECT_TYPE_CHAIR: //7
CheckAndFixGOChairHeightId(&got, got.chair.height, 1);
break;
case GAMEOBJECT_TYPE_SPELL_FOCUS: //8
{
if (got.spellFocus.focusId)
{
@@ -6481,7 +6473,7 @@ void ObjectMgr::LoadGameObjectTemplate()
CheckGOLinkedTrapId(&got, got.spellFocus.linkedTrapId, 2);
break;
}
case GAMEOBJECT_TYPE_GOOBER: //10
case GAMEOBJECT_TYPE_GOOBER: //10
{
if (got.goober.lockId)
CheckGOLockId(&got, got.goober.lockId, 0);
@@ -6499,19 +6491,19 @@ void ObjectMgr::LoadGameObjectTemplate()
CheckGOLinkedTrapId(&got, got.goober.linkedTrapId, 12);
break;
}
case GAMEOBJECT_TYPE_AREADAMAGE: //12
case GAMEOBJECT_TYPE_AREADAMAGE: //12
{
if (got.areadamage.lockId)
CheckGOLockId(&got, got.areadamage.lockId, 0);
break;
}
case GAMEOBJECT_TYPE_CAMERA: //13
case GAMEOBJECT_TYPE_CAMERA: //13
{
if (got.camera.lockId)
CheckGOLockId(&got, got.camera.lockId, 0);
break;
}
case GAMEOBJECT_TYPE_MO_TRANSPORT: //15
case GAMEOBJECT_TYPE_MO_TRANSPORT: //15
{
if (got.moTransport.taxiPathId)
{
@@ -6521,37 +6513,37 @@ void ObjectMgr::LoadGameObjectTemplate()
}
break;
}
case GAMEOBJECT_TYPE_SUMMONING_RITUAL: //18
break;
case GAMEOBJECT_TYPE_SPELLCASTER: //22
case GAMEOBJECT_TYPE_SUMMONING_RITUAL: //18
break;
case GAMEOBJECT_TYPE_SPELLCASTER: //22
{
// always must have spell
CheckGOSpellId(&got, got.spellcaster.spellId, 0);
break;
}
case GAMEOBJECT_TYPE_FLAGSTAND: //24
case GAMEOBJECT_TYPE_FLAGSTAND: //24
{
if (got.flagstand.lockId)
CheckGOLockId(&got, got.flagstand.lockId, 0);
CheckGONoDamageImmuneId(&got, got.flagstand.noDamageImmune, 5);
break;
}
case GAMEOBJECT_TYPE_FISHINGHOLE: //25
case GAMEOBJECT_TYPE_FISHINGHOLE: //25
{
if (got.fishinghole.lockId)
CheckGOLockId(&got, got.fishinghole.lockId, 4);
break;
}
case GAMEOBJECT_TYPE_FLAGDROP: //26
case GAMEOBJECT_TYPE_FLAGDROP: //26
{
if (got.flagdrop.lockId)
CheckGOLockId(&got, got.flagdrop.lockId, 0);
CheckGONoDamageImmuneId(&got, got.flagdrop.noDamageImmune, 3);
break;
}
case GAMEOBJECT_TYPE_BARBER_CHAIR: //32
CheckAndFixGOChairHeightId(&got, got.barberChair.chairheight, 0);
break;
case GAMEOBJECT_TYPE_BARBER_CHAIR: //32
CheckAndFixGOChairHeightId(&got, got.barberChair.chairheight, 0);
break;
}
++count;
@@ -6579,7 +6571,6 @@ void ObjectMgr::LoadExplorationBaseXP()
do
{
Field* fields = result->Fetch();
uint8 level = fields[0].GetUInt8();
uint32 basexp = fields[1].GetUInt32();
@@ -6621,7 +6612,6 @@ void ObjectMgr::LoadPetNames()
do
{
Field* fields = result->Fetch();
std::string word = fields[0].GetString();
uint32 entry = fields[1].GetUInt32();
@@ -6734,7 +6724,6 @@ void ObjectMgr::LoadReputationRewardRate()
do
{
Field* fields = result->Fetch();
uint32 factionId = fields[0].GetUInt32();
@@ -6872,7 +6861,6 @@ void ObjectMgr::LoadReputationSpilloverTemplate()
do
{
Field* fields = result->Fetch();
uint32 factionId = fields[0].GetUInt32();
@@ -6992,12 +6980,12 @@ void ObjectMgr::LoadPointsOfInterest()
uint32 point_id = fields[0].GetUInt32();
PointOfInterest POI;
POI.x = fields[1].GetFloat();
POI.y = fields[2].GetFloat();
POI.icon = fields[3].GetUInt32();
POI.flags = fields[4].GetUInt32();
POI.data = fields[5].GetUInt32();
POI.icon_name = fields[6].GetString();
POI.x = fields[1].GetFloat();
POI.y = fields[2].GetFloat();
POI.icon = fields[3].GetUInt32();
POI.flags = fields[4].GetUInt32();
POI.data = fields[5].GetUInt32();
POI.icon_name = fields[6].GetString();
if (!Trinity::IsValidMapCoord(POI.x, POI.y))
{
@@ -7046,7 +7034,6 @@ void ObjectMgr::LoadQuestPOI()
do
{
fields = points->Fetch();
uint32 questId = fields[0].GetUInt32();
@@ -7092,7 +7079,7 @@ void ObjectMgr::LoadNPCSpellClickSpells()
uint32 oldMSTime = getMSTime();
_spellClickInfoStore.clear();
// 0 1 2 3
// 0 1 2 3
QueryResult result = WorldDatabase.Query("SELECT npc_entry, spell_id, cast_flags, user_type FROM npc_spellclick_spells");
if (!result)
@@ -7171,7 +7158,7 @@ void ObjectMgr::SaveCreatureRespawnTime(uint32 loguid, uint32 instance, time_t t
_creatureRespawnTimesMutex.release();
}
PreparedStatement *stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CREATURE_RESPAWN);
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_REP_CREATURE_RESPAWN);
stmt->setUInt32(0, loguid);
stmt->setUInt64(1, uint64(t));
stmt->setUInt32(2, instance);
@@ -7325,7 +7312,6 @@ void ObjectMgr::LoadQuestRelationsHelper(QuestRelations& map, std::string table,
do
{
uint32 id = result->Fetch()[0].GetUInt32();
uint32 quest = result->Fetch()[1].GetUInt32();
uint32 poolId = result->Fetch()[2].GetUInt32();
@@ -7648,7 +7634,7 @@ void ObjectMgr::LoadGameObjectForQuests()
sLog->outString();
}
bool ObjectMgr::LoadTrinityStrings(char const* table, int32 min_value, int32 max_value)
bool ObjectMgr::LoadTrinityStrings(const char* table, int32 min_value, int32 max_value)
{
uint32 oldMSTime = getMSTime();
@@ -7690,7 +7676,6 @@ bool ObjectMgr::LoadTrinityStrings(char const* table, int32 min_value, int32 max
if (!result)
{
if (min_value == MIN_TRINITY_STRING_ID) // error only in case internal strings
sLog->outErrorDb(">> Loaded 0 trinity strings. DB table `%s` is empty. Cannot continue.", table);
else
@@ -7778,7 +7763,6 @@ void ObjectMgr::LoadFishingBaseSkillLevel()
do
{
Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
int32 skill = fields[1].GetInt32();
@@ -7808,7 +7792,7 @@ bool ObjectMgr::CheckDeclinedNames(std::wstring w_ownname, DeclinedName const& n
bool y = true;
// check declined names
for (uint8 i =0; i < MAX_DECLINED_NAME_CASES; ++i)
for (uint8 i = 0; i < MAX_DECLINED_NAME_CASES; ++i)
{
std::wstring wname;
if (!Utf8toWStr(names.name[i], wname))
@@ -7887,7 +7871,6 @@ void ObjectMgr::LoadGameTele()
do
{
Field* fields = result->Fetch();
uint32 id = fields[0].GetUInt32();
@@ -7930,7 +7913,7 @@ GameTele const* ObjectMgr::GetGameTele(const std::string& name) const
// explicit name case
std::wstring wname;
if (!Utf8toWStr(name, wname))
return false;
return NULL;
// converting string that we try to find to lower case
wstrToLower(wname);
@@ -8028,7 +8011,6 @@ void ObjectMgr::LoadMailLevelRewards()
do
{
Field* fields = result->Fetch();
uint8 level = fields[0].GetUInt8();
@@ -8172,7 +8154,6 @@ void ObjectMgr::LoadTrainerSpell()
do
{
Field* fields = result->Fetch();
uint32 entry = fields[0].GetUInt32();
@@ -8184,8 +8165,7 @@ void ObjectMgr::LoadTrainerSpell()
AddSpellToTrainer(entry, spell, spellCost, reqSkill, reqSkillValue, reqLevel);
count++;
++count;
}
while (result->NextRow());
@@ -8224,7 +8204,6 @@ int ObjectMgr::LoadReferenceVendor(int32 vendor, int32 item, std::set<uint32> *s
vList.AddItem(item_id, maxcount, incrtime, ExtendedCost);
++count;
}
} while (result->NextRow());
return count;
@@ -8275,7 +8254,6 @@ void ObjectMgr::LoadVendors()
vList.AddItem(item_id, maxcount, incrtime, ExtendedCost);
++count;
}
}
while (result->NextRow());
@@ -8302,7 +8280,6 @@ void ObjectMgr::LoadGossipMenu()
do
{
Field* fields = result->Fetch();
GossipMenus gMenu;
@@ -8621,7 +8598,7 @@ void ObjectMgr::LoadDbScriptStrings()
sLog->outErrorDb("Table `db_script_string` has unused string id %u", *itr);
}
bool LoadTrinityStrings(char const* table, int32 start_value, int32 end_value)
bool LoadTrinityStrings(const char* table, int32 start_value, int32 end_value)
{
// MAX_DB_SCRIPT_STRING_ID is max allowed negative value for scripts (scrpts can use only more deep negative values
// start/end reversed for negative values
+2 -2
View File
@@ -526,6 +526,7 @@ struct GraveYardData
uint32 safeLocId;
uint32 team;
};
typedef std::multimap<uint32, GraveYardData> GraveYardContainer;
typedef UNORDERED_MAP<uint32, VendorItemData> CacheVendorItemContainer;
@@ -640,7 +641,7 @@ class ObjectMgr
return NULL;
}
InstanceTemplate const* GetInstanceTemplate(uint32 mapID);
InstanceTemplate const* GetInstanceTemplate(uint32 mapId);
PetLevelInfo const* GetPetLevelInfo(uint32 creature_id, uint8 level) const;
@@ -1338,7 +1339,6 @@ class ObjectMgr
GO_TO_GO,
GO_TO_CREATURE, // GO is dependant on creature
};
};
#define sObjectMgr ACE_Singleton<ObjectMgr, ACE_Null_Mutex>::instance()
+10
View File
@@ -65,6 +65,16 @@ typedef GridRefManager<DynamicObject> DynamicObjectMapType;
typedef GridRefManager<GameObject> GameObjectMapType;
typedef GridRefManager<Player> PlayerMapType;
enum GridMapTypeMask
{
GRID_MAP_TYPE_MASK_CORPSE = 0x01,
GRID_MAP_TYPE_MASK_CREATURE = 0x02,
GRID_MAP_TYPE_MASK_DYNAMICOBJECT = 0x04,
GRID_MAP_TYPE_MASK_GAMEOBJECT = 0x08,
GRID_MAP_TYPE_MASK_PLAYER = 0x10,
GRID_MAP_TYPE_MASK_ALL = 0x1F
};
typedef Grid<Player, AllWorldObjectTypes, AllGridObjectTypes> GridType;
typedef NGrid<MAX_NUMBER_OF_CELLS, Player, AllWorldObjectTypes, AllGridObjectTypes> NGridType;
@@ -343,24 +343,17 @@ bool AnyDeadUnitObjectInRangeCheck::operator()(Creature* u)
bool AnyDeadUnitSpellTargetInRangeCheck::operator()(Player* u)
{
return AnyDeadUnitObjectInRangeCheck::operator()(u)
&& (i_spellInfo->CheckTarget(i_searchObj, u, true) == SPELL_CAST_OK)
&& i_searchObj->IsTargetMatchingCheck(u, i_check);
return AnyDeadUnitObjectInRangeCheck::operator()(u) && i_check(u);
}
bool AnyDeadUnitSpellTargetInRangeCheck::operator()(Corpse* u)
{
Player* owner = ObjectAccessor::FindPlayer(u->GetOwnerGUID());
return owner && AnyDeadUnitObjectInRangeCheck::operator()(u)
&& (i_spellInfo->CheckTarget(i_searchObj, owner, true) == SPELL_CAST_OK)
&& i_searchObj->IsTargetMatchingCheck(owner, i_check);
return AnyDeadUnitObjectInRangeCheck::operator()(u) && i_check(u);
}
bool AnyDeadUnitSpellTargetInRangeCheck::operator()(Creature* u)
{
return AnyDeadUnitObjectInRangeCheck::operator()(u)
&& (i_spellInfo->CheckTarget(i_searchObj, u, true) == SPELL_CAST_OK)
&& i_searchObj->IsTargetMatchingCheck(u, i_check);
return AnyDeadUnitObjectInRangeCheck::operator()(u) && i_check(u);
}
template void ObjectUpdater::Visit<GameObject>(GameObjectMapType &);
+45 -72
View File
@@ -30,6 +30,7 @@
#include "Player.h"
#include "Unit.h"
#include "CreatureAI.h"
#include "Spell.h"
class Player;
//class Map;
@@ -168,12 +169,33 @@ namespace Trinity
template<class Check>
struct WorldObjectSearcher
{
uint32 i_mapTypeMask;
uint32 i_phaseMask;
WorldObject* &i_object;
Check &i_check;
WorldObjectSearcher(WorldObject const* searcher, WorldObject* & result, Check& check)
: i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) {}
WorldObjectSearcher(WorldObject const* searcher, WorldObject* & result, Check& check, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL)
: i_mapTypeMask(mapTypeMask), i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) {}
void Visit(GameObjectMapType &m);
void Visit(PlayerMapType &m);
void Visit(CreatureMapType &m);
void Visit(CorpseMapType &m);
void Visit(DynamicObjectMapType &m);
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {}
};
template<class Check>
struct WorldObjectLastSearcher
{
uint32 i_mapTypeMask;
uint32 i_phaseMask;
WorldObject* &i_object;
Check &i_check;
WorldObjectLastSearcher(WorldObject const* searcher, WorldObject* & result, Check& check, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL)
: i_mapTypeMask(mapTypeMask), i_phaseMask(searcher->GetPhaseMask()), i_object(result), i_check(check) {}
void Visit(GameObjectMapType &m);
void Visit(PlayerMapType &m);
@@ -187,12 +209,13 @@ namespace Trinity
template<class Check>
struct WorldObjectListSearcher
{
uint32 i_mapTypeMask;
uint32 i_phaseMask;
std::list<WorldObject*> &i_objects;
Check& i_check;
WorldObjectListSearcher(WorldObject const* searcher, std::list<WorldObject*> &objects, Check & check)
: i_phaseMask(searcher->GetPhaseMask()), i_objects(objects), i_check(check) {}
WorldObjectListSearcher(WorldObject const* searcher, std::list<WorldObject*> &objects, Check & check, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL)
: i_mapTypeMask(mapTypeMask), i_phaseMask(searcher->GetPhaseMask()), i_objects(objects), i_check(check) {}
void Visit(PlayerMapType &m);
void Visit(CreatureMapType &m);
@@ -206,14 +229,17 @@ namespace Trinity
template<class Do>
struct WorldObjectWorker
{
uint32 i_mapTypeMask;
uint32 i_phaseMask;
Do const& i_do;
WorldObjectWorker(WorldObject const* searcher, Do const& _do)
: i_phaseMask(searcher->GetPhaseMask()), i_do(_do) {}
WorldObjectWorker(WorldObject const* searcher, Do const& _do, uint32 mapTypeMask = GRID_MAP_TYPE_MASK_ALL)
: i_mapTypeMask(mapTypeMask), i_phaseMask(searcher->GetPhaseMask()), i_do(_do) {}
void Visit(GameObjectMapType &m)
{
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_GAMEOBJECT))
return;
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
@@ -221,12 +247,16 @@ namespace Trinity
void Visit(PlayerMapType &m)
{
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_PLAYER))
return;
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
}
void Visit(CreatureMapType &m)
{
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CREATURE))
return;
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
@@ -234,6 +264,8 @@ namespace Trinity
void Visit(CorpseMapType &m)
{
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CORPSE))
return;
for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
@@ -241,6 +273,8 @@ namespace Trinity
void Visit(DynamicObjectMapType &m)
{
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_DYNAMICOBJECT))
return;
for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if (itr->getSource()->InSamePhase(i_phaseMask))
i_do(itr->getSource());
@@ -527,73 +561,11 @@ namespace Trinity
// CHECKS && DO classes
// WorldObject check classes
class RaiseDeadObjectCheck
{
public:
RaiseDeadObjectCheck(Unit* source, float range) : _source(source), _range(range) {}
bool operator()(Creature* u)
{
if (_source->GetTypeId() != TYPEID_PLAYER || !((Player*)_source)->isHonorOrXPTarget(u) ||
u->getDeathState() != CORPSE ||
(u->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1))) == 0 ||
(u->GetDisplayId() != u->GetNativeDisplayId()))
return false;
return _source->IsWithinDistInMap(u, _range);
}
bool operator()(Player* u)
{
if (_source == u || _source->GetTypeId() != TYPEID_PLAYER || !((Player*)_source)->isHonorOrXPTarget(u) ||
u->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST) || u->isInFlight() || !u->isDead() ||
(u->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1))) == 0)
return false;
return _source->IsWithinDistInMap(u, _range);
}
bool operator()(Corpse* u)
{
if (_source->GetTypeId() != TYPEID_PLAYER || u->GetType() == CORPSE_BONES)
return false;
return _source->IsWithinDistInMap(u, _range);
}
template<class NOT_INTERESTED> bool operator()(NOT_INTERESTED*) { return false; }
private:
Unit* const _source;
float _range;
};
class ExplodeCorpseObjectCheck
{
public:
ExplodeCorpseObjectCheck(Unit* funit, float range) : i_funit(funit), i_range(range) {}
bool operator()(Player* u)
{
if (u->getDeathState() != CORPSE || u->isInFlight() ||
u->HasAuraType(SPELL_AURA_GHOST) || (u->GetDisplayId() != u->GetNativeDisplayId()))
return false;
return i_funit->IsWithinDistInMap(u, i_range);
}
bool operator()(Creature* u)
{
if (u->getDeathState() != CORPSE || u->isInFlight() ||
(u->GetDisplayId() != u->GetNativeDisplayId()) ||
(u->GetCreatureTypeMask() & CREATURE_TYPEMASK_MECHANICAL_OR_ELEMENTAL) != 0)
return false;
return i_funit->IsWithinDistInMap(u, i_range);
}
template<class NOT_INTERESTED> bool operator()(NOT_INTERESTED*) { return false; }
private:
Unit* const i_funit;
float i_range;
};
class AnyDeadUnitObjectInRangeCheck
{
public:
AnyDeadUnitObjectInRangeCheck(Unit const* searchObj, float range) : i_searchObj(searchObj), i_range(range) {}
AnyDeadUnitObjectInRangeCheck(Unit* searchObj, float range) : i_searchObj(searchObj), i_range(range) {}
bool operator()(Player* u);
bool operator()(Corpse* u);
bool operator()(Creature* u);
@@ -606,15 +578,16 @@ namespace Trinity
class AnyDeadUnitSpellTargetInRangeCheck : public AnyDeadUnitObjectInRangeCheck
{
public:
AnyDeadUnitSpellTargetInRangeCheck(Unit const* searchObj, float range, SpellInfo const* spellInfo, SpellTargetSelectionCheckTypes check)
: AnyDeadUnitObjectInRangeCheck(searchObj, range), i_spellInfo(spellInfo), i_check(check) {}
AnyDeadUnitSpellTargetInRangeCheck(Unit* searchObj, float range, SpellInfo const* spellInfo, SpellTargetCheckTypes check)
: AnyDeadUnitObjectInRangeCheck(searchObj, range), i_spellInfo(spellInfo), i_check(searchObj, searchObj, spellInfo, check, NULL)
{}
bool operator()(Player* u);
bool operator()(Corpse* u);
bool operator()(Creature* u);
template<class NOT_INTERESTED> bool operator()(NOT_INTERESTED*) { return false; }
protected:
SpellInfo const* i_spellInfo;
SpellTargetSelectionCheckTypes i_check;
WorldObjectSpellTargetCheck i_check;
};
// WorldObject do classes
@@ -51,6 +51,9 @@ inline void Trinity::ObjectUpdater::Visit(CreatureMapType &m)
template<class Check>
void Trinity::WorldObjectSearcher<Check>::Visit(GameObjectMapType &m)
{
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_GAMEOBJECT))
return;
// already found
if (i_object)
return;
@@ -71,6 +74,9 @@ void Trinity::WorldObjectSearcher<Check>::Visit(GameObjectMapType &m)
template<class Check>
void Trinity::WorldObjectSearcher<Check>::Visit(PlayerMapType &m)
{
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_PLAYER))
return;
// already found
if (i_object)
return;
@@ -91,6 +97,9 @@ void Trinity::WorldObjectSearcher<Check>::Visit(PlayerMapType &m)
template<class Check>
void Trinity::WorldObjectSearcher<Check>::Visit(CreatureMapType &m)
{
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CREATURE))
return;
// already found
if (i_object)
return;
@@ -111,6 +120,9 @@ void Trinity::WorldObjectSearcher<Check>::Visit(CreatureMapType &m)
template<class Check>
void Trinity::WorldObjectSearcher<Check>::Visit(CorpseMapType &m)
{
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CORPSE))
return;
// already found
if (i_object)
return;
@@ -131,6 +143,9 @@ void Trinity::WorldObjectSearcher<Check>::Visit(CorpseMapType &m)
template<class Check>
void Trinity::WorldObjectSearcher<Check>::Visit(DynamicObjectMapType &m)
{
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_DYNAMICOBJECT))
return;
// already found
if (i_object)
return;
@@ -148,9 +163,93 @@ void Trinity::WorldObjectSearcher<Check>::Visit(DynamicObjectMapType &m)
}
}
template<class Check>
void Trinity::WorldObjectLastSearcher<Check>::Visit(GameObjectMapType &m)
{
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_GAMEOBJECT))
return;
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
if (i_check(itr->getSource()))
i_object = itr->getSource();
}
}
template<class Check>
void Trinity::WorldObjectLastSearcher<Check>::Visit(PlayerMapType &m)
{
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_PLAYER))
return;
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
if (i_check(itr->getSource()))
i_object = itr->getSource();
}
}
template<class Check>
void Trinity::WorldObjectLastSearcher<Check>::Visit(CreatureMapType &m)
{
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CREATURE))
return;
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
if (i_check(itr->getSource()))
i_object = itr->getSource();
}
}
template<class Check>
void Trinity::WorldObjectLastSearcher<Check>::Visit(CorpseMapType &m)
{
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CORPSE))
return;
for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
if (i_check(itr->getSource()))
i_object = itr->getSource();
}
}
template<class Check>
void Trinity::WorldObjectLastSearcher<Check>::Visit(DynamicObjectMapType &m)
{
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_DYNAMICOBJECT))
return;
for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
{
if (!itr->getSource()->InSamePhase(i_phaseMask))
continue;
if (i_check(itr->getSource()))
i_object = itr->getSource();
}
}
template<class Check>
void Trinity::WorldObjectListSearcher<Check>::Visit(PlayerMapType &m)
{
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_PLAYER))
return;
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if (itr->getSource()->InSamePhase(i_phaseMask))
if (i_check(itr->getSource()))
@@ -160,6 +259,9 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(PlayerMapType &m)
template<class Check>
void Trinity::WorldObjectListSearcher<Check>::Visit(CreatureMapType &m)
{
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CREATURE))
return;
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if (itr->getSource()->InSamePhase(i_phaseMask))
if (i_check(itr->getSource()))
@@ -169,6 +271,9 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(CreatureMapType &m)
template<class Check>
void Trinity::WorldObjectListSearcher<Check>::Visit(CorpseMapType &m)
{
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_CORPSE))
return;
for (CorpseMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if (itr->getSource()->InSamePhase(i_phaseMask))
if (i_check(itr->getSource()))
@@ -178,6 +283,9 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(CorpseMapType &m)
template<class Check>
void Trinity::WorldObjectListSearcher<Check>::Visit(GameObjectMapType &m)
{
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_GAMEOBJECT))
return;
for (GameObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if (itr->getSource()->InSamePhase(i_phaseMask))
if (i_check(itr->getSource()))
@@ -187,6 +295,9 @@ void Trinity::WorldObjectListSearcher<Check>::Visit(GameObjectMapType &m)
template<class Check>
void Trinity::WorldObjectListSearcher<Check>::Visit(DynamicObjectMapType &m)
{
if (!(i_mapTypeMask & GRID_MAP_TYPE_MASK_DYNAMICOBJECT))
return;
for (DynamicObjectMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
if (itr->getSource()->InSamePhase(i_phaseMask))
if (i_check(itr->getSource()))
+2 -1
View File
@@ -41,6 +41,7 @@ totalPlayersRolling(0), totalNeed(0), totalGreed(0), totalPass(0), itemSlot(0),
rollVoteMask(ROLL_ALL_TYPE_NO_DISENCHANT)
{
}
Roll::~Roll()
{
}
@@ -1730,7 +1731,7 @@ bool Group::InCombatToInstance(uint32 instanceId)
Player* player = itr->getSource();
if (player && !player->getAttackers().empty() && player->GetInstanceId() == instanceId && (player->GetMap()->IsRaidOrHeroicDungeon()))
for (std::set<Unit*>::const_iterator i = player->getAttackers().begin(); i != player->getAttackers().end(); ++i)
if ((*i) && (*i)->GetTypeId() == TYPEID_UNIT && (*i)->ToCreature()->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
if ((*i) && (*i)->GetTypeId() == TYPEID_UNIT && (*i)->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_INSTANCE_BIND)
return true;
}
return false;
@@ -309,33 +309,34 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)
sAuctionMgr->AddAItem(newItem);
auctionHouse->AddAuction(AH);
for (uint32 i = 0; i < itemsCount; ++i)
for (uint32 j = 0; j < itemsCount; ++j)
{
Item* item = items[i];
Item* item2 = items[j];
if (item->GetCount() == count[i])
if (item2->GetCount() == count[j])
{
_player->MoveItemFromInventory(item->GetBagSlot(), item->GetSlot(), true);
_player->MoveItemFromInventory(item2->GetBagSlot(), item2->GetSlot(), true);
SQLTransaction trans = CharacterDatabase.BeginTransaction();
item->DeleteFromInventoryDB(trans);
item->SaveToDB(trans);
item2->DeleteFromInventoryDB(trans);
item2->SaveToDB(trans);
CharacterDatabase.CommitTransaction(trans);
}
else
{
item->SetCount(item->GetCount() - count[i]);
item->SetState(ITEM_CHANGED, _player);
_player->ItemRemovedQuestCheck(item->GetEntry(), count[i]);
item->SendUpdateToPlayer(_player);
item2->SetCount(item2->GetCount() - count[j]);
item2->SetState(ITEM_CHANGED, _player);
_player->ItemRemovedQuestCheck(item2->GetEntry(), count[j]);
item2->SendUpdateToPlayer(_player);
SQLTransaction trans = CharacterDatabase.BeginTransaction();
item->SaveToDB(trans);
item2->SaveToDB(trans);
CharacterDatabase.CommitTransaction(trans);
}
}
SQLTransaction trans = CharacterDatabase.BeginTransaction();
newItem->SaveToDB(trans);
AH->SaveToDB(trans);
_player->SaveInventoryAndGoldToDB(trans);
CharacterDatabase.CommitTransaction(trans);
+747 -155
View File
@@ -16,6 +16,22 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/*
----- Opcodes Not Used yet -----
SMSG_CALENDAR_CLEAR_PENDING_ACTION SendCalendarClearPendingAction()
SMSG_CALENDAR_RAID_LOCKOUT_UPDATED SendCalendarRaidLockoutUpdated(InstanceSave const* save) <--- Structure unknown, using LOCKOUT_ADDED
----- Opcodes without Sniffs -----
SMSG_CALENDAR_FILTER_GUILD [ for (... uint32(count) { packguid(???), uint8(???) } ]
SMSG_CALENDAR_ARENA_TEAM [ for (... uint32(count) { packguid(???), uint8(???) } ]
CMSG_CALENDAR_EVENT_INVITE_NOTES [ packguid(Invitee), uint64(inviteId), string(Text), Boolean(Unk) ]
SMSG_CALENDAR_EVENT_INVITE_NOTES [ uint32(unk1), uint32(unk2), uint32(unk3), uint32(unk4), uint32(unk5) ]
SMSG_CALENDAR_EVENT_INVITE_NOTES_ALERT [ uint64(inviteId), string(Text) ]
SMSG_CALENDAR_EVENT_INVITE_STATUS_ALERT [ Structure unkown ]
*/
#include "Common.h"
#include "WorldPacket.h"
#include "WorldSession.h"
@@ -24,8 +40,12 @@
#include "Log.h"
#include "Opcodes.h"
#include "Player.h"
#include "CalendarMgr.h"
#include "ObjectMgr.h"
#include "ObjectAccessor.h"
#include "DatabaseEnv.h"
void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recv_data*/)
void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
{
uint64 guid = _player->GetGUID();
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_CALENDAR [" UI64FMTD "]", guid);
@@ -33,32 +53,54 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recv_data*/)
time_t cur_time = time_t(time(NULL));
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_SEND_CALENDAR [" UI64FMTD "]", guid);
WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR, 4+4*0+4+4*0+4+4);
WorldPacket data(SMSG_CALENDAR_SEND_CALENDAR, 1000); // Impossible to get the correct size without doing a double iteration of some elements
data << uint32(0); // invite count
/*
for (;;)
CalendarInviteIdList const& invites = sCalendarMgr->GetPlayerInvites(guid);
data << uint32(invites.size());
for (CalendarInviteIdList::const_iterator it = invites.begin(); it != invites.end(); ++it)
{
uint64 inviteId;
uint64 unkGuid0;
uint8 unk1, unk2, unk3;
uint64 creatorGuid;
}
*/
CalendarInvite* invite = sCalendarMgr->GetInvite(*it);
CalendarEvent* calendarEvent = invite ? sCalendarMgr->GetEvent(invite->GetEventId()) : NULL;
data << uint32(0); // event count
/*
for (;;)
{
uint64 eventId;
std::string title; // 128 chars
uint32 type;
uint32 occurrenceTime;
uint32 flags;
uint32 unk4; -- possibly mapid for dungeon/raid
uint64 creatorGuid;
if (calendarEvent)
{
data << uint64(invite->GetEventId());
data << uint64(invite->GetInviteId());
data << uint8(invite->GetStatus());
data << uint8(invite->GetRank());
data << uint8(calendarEvent->GetGuildId() != 0);
data.appendPackGUID(calendarEvent->GetCreatorGUID());
}
else
{
sLog->outError("SMSG_CALENDAR_SEND_CALENDAR: No Invite found with id [" UI64FMTD "]", *it);
data << uint64(0) << uint64(0) << uint8(0) << uint8(0);
data.appendPackGUID(0);
}
}
CalendarEventIdList const& events = sCalendarMgr->GetPlayerEvents(guid);
data << uint32(events.size());
for (CalendarEventIdList::const_iterator it = events.begin(); it != events.end(); ++it)
{
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(*it))
{
data << uint64(*it);
data << calendarEvent->GetTitle().c_str();
data << uint32(calendarEvent->GetType());
data << uint32(calendarEvent->GetTime());
data << uint32(calendarEvent->GetFlags());
data << uint32(calendarEvent->GetDungeonId());
data.appendPackGUID(calendarEvent->GetCreatorGUID());
}
else
{
sLog->outError("SMSG_CALENDAR_SEND_CALENDAR: No Event found with id [" UI64FMTD "]", *it);
data << uint64(0) << uint8(0) << uint32(0)
<< uint32(0) << uint32(0) << uint32(0);
data.appendPackGUID(0);
}
}
*/
data << uint32(cur_time); // server time
data << uint32(secsToTimeBitFields(cur_time)); // server time
@@ -108,202 +150,752 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recv_data*/)
data << uint32(mapEntry->unk_time);
++counter;
}
data.put<uint32>(p_counter, counter);
data << uint32(0); // holiday count?
/*
for (;;)
// TODO: Fix this, how we do know how many and what holidays to send?
uint32 holidayCount = 0;
data << uint32(holidayCount);
for (uint32 i = 0; i < holidayCount; ++i)
{
uint32 unk5, unk6, unk7, unk8, unk9;
for (uint32 j = 0; j < 26; ++j)
{
uint32 unk10;
}
for (uint32 j = 0; j < 10; ++j)
{
uint32 unk11;
}
for (uint32 j = 0; j < 10; ++j)
{
uint32 unk12;
}
std::string holidayName; // 64 chars
HolidaysEntry const* holiday = sHolidaysStore.LookupEntry(666);
data << uint32(holiday->Id); // m_ID
data << uint32(holiday->Region); // m_region, might be looping
data << uint32(holiday->Looping); // m_looping, might be region
data << uint32(holiday->Priority); // m_priority
data << uint32(holiday->CalendarFilterType); // m_calendarFilterType
for (uint8 j = 0; j < MAX_HOLIDAY_DATES; ++j)
data << uint32(holiday->Date[j]); // 26 * m_date
for (uint8 j = 0; j < MAX_HOLIDAY_DURATIONS; ++j)
data << uint32(holiday->Duration[j]); // 10 * m_duration
for (uint8 j = 0; j < MAX_HOLIDAY_FLAGS; ++j)
data << uint32(holiday->CalendarFlags[j]); // 10 * m_calendarFlags
data << holiday->TextureFilename; // m_textureFilename (holiday name)
}
*/
SendPacket(&data);
}
void WorldSession::HandleCalendarGetEvent(WorldPacket& recv_data)
void WorldSession::HandleCalendarGetEvent(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_GET_EVENT");
recv_data.read_skip<uint64>(); // unk
uint64 eventId;
recvData >> eventId;
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_EVENT. Event: ["
UI64FMTD "] Event [" UI64FMTD "]", _player->GetGUID(), eventId);
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
SendCalendarEvent(*calendarEvent, CALENDAR_SENDTYPE_GET);
}
void WorldSession::HandleCalendarGuildFilter(WorldPacket& recv_data)
void WorldSession::HandleCalendarGuildFilter(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_GUILD_FILTER");
recv_data.read_skip<uint32>(); // unk1
recv_data.read_skip<uint32>(); // unk2
recv_data.read_skip<uint32>(); // unk3
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GUILD_FILTER [" UI64FMTD "]", _player->GetGUID());
int32 unk1, unk2, unk3;
recvData >> unk1;
recvData >> unk2;
recvData >> unk3;
sLog->outDebug(LOG_FILTER_NETWORKIO, "Calendar: CMSG_CALENDAR_GUILD_FILTER - unk1: %d unk2: %d unk3: %d", unk1, unk2, unk3);
}
void WorldSession::HandleCalendarArenaTeam(WorldPacket& recv_data)
void WorldSession::HandleCalendarArenaTeam(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_ARENA_TEAM");
recv_data.read_skip<uint32>(); // unk
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_ARENA_TEAM [" UI64FMTD "]", _player->GetGUID());
int32 unk1;
recvData >> unk1;
sLog->outDebug(LOG_FILTER_NETWORKIO, "Calendar: CMSG_CALENDAR_ARENA_TEAM - unk1: %d", unk1);
}
void WorldSession::HandleCalendarAddEvent(WorldPacket& recv_data)
void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_ADD_EVENT");
recv_data.rfinish(); // set to end to avoid warnings spam
uint64 guid = _player->GetGUID();
std::string title;
std::string description;
uint8 type;
bool repeatable;
uint32 maxInvites;
int32 dungeonId;
uint32 eventPackedTime;
uint32 unkPackedTime;
uint32 flags;
uint64 inviteId = 0;
uint64 invitee = 0;
uint8 status;
uint8 rank;
//std::string unk1, unk2;
//recv_data >> (std::string)unk1;
//recv_data >> (std::string)unk2;
recvData >> title >> description >> type >> repeatable >> maxInvites;
recvData >> dungeonId >> eventPackedTime >> unkPackedTime >> flags;
//uint8 unk3, unk4;
//uint32 unk5, unk6, unk7, unk8, unk9, count = 0;
//recv_data >> (uint8)unk3;
//recv_data >> (uint8)unk4;
//recv_data >> (uint32)unk5;
//recv_data >> (uint32)unk6;
//recv_data >> (uint32)unk7;
//recv_data >> (uint32)unk8;
//recv_data >> (uint32)unk9;
//if (!((unk9 >> 6) & 1))
//{
// recv_data >> (uint32)count;
// if (count)
// {
// uint8 unk12, unk13;
// uint64 guid;
// for (int i=0; i<count; i++)
// {
// recv_data.readPackGUID(guid);
// recv_data >> (uint8)unk12;
// recv_data >> (uint8)unk13;
// }
// }
//}
if (!(flags & CALENDAR_FLAG_WITHOUT_INVITES))
{
uint32 inviteCount;
recvData >> inviteCount;
recvData.readPackGUID(invitee);
recvData >> status >> rank;
if (inviteCount != 1 || invitee != guid)
{
sLog->outError("HandleCalendarAddEvent: [" UI64FMTD
"]: More than one invite (%d) or Invitee [" UI64FMTD
"] differs", guid, inviteCount, invitee);
return;
}
inviteId = sCalendarMgr->GetFreeInviteId();
}
else
{
inviteId = 0;
status = CALENDAR_STATUS_NO_OWNER;
rank = CALENDAR_RANK_PLAYER;
}
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_ADD_EVENT: [" UI64FMTD "] "
"Title %s, Description %s, type %u, Repeatable %u, MaxInvites %u, "
"Dungeon ID %d, Time %u, Time2 %u, Flags %u, Invitee [" UI64FMTD "] "
"Status %d, Rank %d", guid, title.c_str(), description.c_str(),
type, repeatable, maxInvites, dungeonId, eventPackedTime,
unkPackedTime, flags, invitee, status, rank);
CalendarAction action;
action.SetAction(CALENDAR_ACTION_ADD_EVENT);
action.SetPlayer(_player);
action.Event.SetEventId(sCalendarMgr->GetFreeEventId());
action.Event.SetCreatorGUID(guid);
action.Event.SetType((CalendarEventType) type);
action.Event.SetFlags(flags);
action.Event.SetTime(eventPackedTime);
action.Event.SetTimeZoneTime(unkPackedTime);
action.Event.SetRepeatable(repeatable);
action.Event.SetMaxInvites(maxInvites);
action.Event.SetDungeonId(dungeonId);
action.Event.SetGuildId((flags & CALENDAR_FLAG_GUILD_ONLY) ? GetPlayer()->GetGuildId() : 0);
action.Event.SetTitle(title);
action.Event.SetDescription(description);
action.Event.AddInvite(inviteId);
action.Invite.SetEventId(action.Event.GetEventId());
action.Invite.SetInviteId(inviteId);
action.Invite.SetInvitee(invitee);
action.Invite.SetStatus((CalendarInviteStatus) status);
action.Invite.SetRank((CalendarModerationRank) rank);
action.Invite.SetSenderGUID(guid);
sCalendarMgr->AddAction(action);
}
void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recv_data)
void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_UPDATE_EVENT");
recv_data.rfinish(); // set to end to avoid warnings spam
uint64 guid = _player->GetGUID();
uint64 eventId;
uint64 inviteId;
std::string title;
std::string description;
uint8 type;
bool repeatable;
uint32 maxInvites;
int32 dungeonId;
uint32 eventPackedTime;
uint32 timeZoneTime;
uint32 flags;
//recv_data >> uint64
//recv_data >> uint64
//recv_data >> std::string
//recv_data >> std::string
//recv_data >> uint8
//recv_data >> uint8
//recv_data >> uint32
//recv_data >> uint32
//recv_data >> uint32
//recv_data >> uint32
//recv_data >> uint32
recvData >> eventId >> inviteId >> title >> description >> type;
recvData >> repeatable >> maxInvites >> dungeonId;
recvData >> eventPackedTime >> timeZoneTime >> flags;
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_UPDATE_EVENT [" UI64FMTD "] EventId [" UI64FMTD
"], InviteId [" UI64FMTD "] Title %s, Description %s, type %u "
"Repeatable %u, MaxInvites %u, Dungeon ID %d, Time %u "
"Time2 %u, Flags %u", guid, eventId, inviteId, title.c_str(),
description.c_str(), type, repeatable, maxInvites, dungeonId,
eventPackedTime, timeZoneTime, flags);
CalendarAction action;
action.SetAction(CALENDAR_ACTION_MODIFY_EVENT);
action.SetPlayer(_player);
action.SetInviteId(inviteId);
action.Event.SetEventId(eventId);
action.Event.SetType((CalendarEventType) type);
action.Event.SetFlags((CalendarFlags) flags);
action.Event.SetTime(eventPackedTime);
action.Event.SetTimeZoneTime(timeZoneTime);
action.Event.SetRepeatable(repeatable);
action.Event.SetDungeonId(dungeonId);
action.Event.SetTitle(title);
action.Event.SetDescription(description);
action.Event.SetMaxInvites(maxInvites);
sCalendarMgr->AddAction(action);
}
void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recv_data)
void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_REMOVE_EVENT");
recv_data.rfinish(); // set to end to avoid warnings spam
uint64 guid = _player->GetGUID();
uint64 eventId;
uint64 inviteId;
uint32 flags;
//recv_data >> uint64
//recv_data >> uint64
//recv_data >> uint32
recvData >> eventId >> inviteId >> flags;
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_REMOVE_EVENT [" UI64FMTD "], EventId [" UI64FMTD
"] inviteId [" UI64FMTD "] Flags?: %u", guid, eventId, inviteId, flags);
CalendarAction action;
action.SetAction(CALENDAR_ACTION_REMOVE_EVENT);
action.SetPlayer(_player);
action.SetInviteId(inviteId);
action.Event.SetEventId(eventId);
action.Event.SetFlags((CalendarFlags) flags);
sCalendarMgr->AddAction(action);
}
void WorldSession::HandleCalendarCopyEvent(WorldPacket& recv_data)
void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_COPY_EVENT");
recv_data.rfinish(); // set to end to avoid warnings spam
uint64 guid = _player->GetGUID();
uint64 eventId;
uint64 inviteId;
uint32 time;
//recv_data >> uint64
//recv_data >> uint64
//recv_data >> uint32
recvData >> eventId >> inviteId >> time;
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_COPY_EVENT [" UI64FMTD "], EventId [" UI64FMTD
"] inviteId [" UI64FMTD "] Time: %u", guid, eventId, inviteId, time);
CalendarAction action;
action.SetAction(CALENDAR_ACTION_COPY_EVENT);
action.SetPlayer(_player);
action.SetInviteId(inviteId);
action.Event.SetEventId(eventId);
action.Event.SetTime(time);
sCalendarMgr->AddAction(action);
}
void WorldSession::HandleCalendarEventInvite(WorldPacket& recv_data)
void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_INVITE");
recv_data.rfinish(); // set to end to avoid warnings spam
uint64 guid = _player->GetGUID();
uint64 eventId;
uint64 inviteId;
std::string name;
uint8 status;
uint8 rank;
uint64 invitee = 0;
uint32 team = 0;
//recv_data >> uint64
//recv_data >> uint64
//recv_data >> std::string
//recv_data >> uint8
//recv_data >> uint8
recvData >> eventId >> inviteId >> name >> status >> rank;
if (Player* player = sObjectAccessor->FindPlayerByName(name.c_str()))
{
invitee = player->GetGUID();
team = player->GetTeam();
}
else
{
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GUID_RACE_ACC_BY_NAME);
stmt->setString(0, name);
if (PreparedQueryResult result = CharacterDatabase.Query(stmt))
{
Field* fields = result->Fetch();
invitee = MAKE_NEW_GUID(fields[0].GetUInt32(), 0, HIGHGUID_PLAYER);
team = Player::TeamForRace(fields[1].GetUInt8());
}
}
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_INVITE [" UI64FMTD "], EventId ["
UI64FMTD "] InviteId [" UI64FMTD "] Name %s ([" UI64FMTD "]), status %u, "
"Rank %u", guid, eventId, inviteId, name.c_str(), invitee, status, rank);
if (!invitee)
{
SendCalendarCommandResult(CALENDAR_ERROR_PLAYER_NOT_FOUND);
return;
}
if (_player->GetTeam() != team)
{
SendCalendarCommandResult(CALENDAR_ERROR_NOT_ALLIED);
return;
}
// TODO: Check ignore, even if offline (db query)
CalendarAction action;
action.SetAction(CALENDAR_ACTION_ADD_EVENT_INVITE);
action.SetPlayer(_player);
action.SetInviteId(inviteId);
action.Invite.SetEventId(eventId);
action.Invite.SetInviteId(sCalendarMgr->GetFreeInviteId());
action.Invite.SetSenderGUID(_player->GetGUID());
action.Invite.SetInvitee(invitee);
action.Invite.SetRank((CalendarModerationRank) rank);
action.Invite.SetStatus((CalendarInviteStatus) status);
sCalendarMgr->AddAction(action);
}
void WorldSession::HandleCalendarEventRsvp(WorldPacket& recv_data)
void WorldSession::HandleCalendarEventSignup(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_RSVP");
recv_data.rfinish(); // set to end to avoid warnings spam
uint64 guid = _player->GetGUID();
uint64 eventId;
uint8 status;
//recv_data >> uint64
//recv_data >> uint64
//recv_data >> uint32
recvData >> eventId >> status;
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_SIGNUP [" UI64FMTD "] EventId ["
UI64FMTD "] Status %u", guid, eventId, status);
CalendarAction action;
action.SetAction(CALENDAR_ACTION_SIGNUP_TO_EVENT);
action.SetPlayer(_player);
action.SetExtraData(GetPlayer()->GetGuildId());
action.Event.SetEventId(eventId);
action.Invite.SetStatus((CalendarInviteStatus) status);
sCalendarMgr->AddAction(action);
}
void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recv_data)
void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_REMOVE_INVITE");
recv_data.rfinish(); // set to end to avoid warnings spam
uint64 guid = _player->GetGUID();
uint64 eventId;
uint64 inviteId;
uint8 status;
//recv_data.readPackGUID(guid)
//recv_data >> uint64
//recv_data >> uint64
//recv_data >> uint64
recvData >> eventId >> inviteId >> status;
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_RSVP [" UI64FMTD"] EventId ["
UI64FMTD "], InviteId [" UI64FMTD "], status %u", guid, eventId,
inviteId, status);
CalendarAction action;
action.SetAction(CALENDAR_ACTION_MODIFY_EVENT_INVITE);
action.SetPlayer(_player);
action.SetInviteId(inviteId);
action.Invite.SetInviteId(inviteId);
action.Invite.SetEventId(eventId);
action.Invite.SetStatus((CalendarInviteStatus) status);
sCalendarMgr->AddAction(action);
}
void WorldSession::HandleCalendarEventStatus(WorldPacket& recv_data)
void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_STATUS");
recv_data.rfinish(); // set to end to avoid warnings spam
uint64 guid = _player->GetGUID();
uint64 invitee;
uint64 eventId;
uint64 owninviteId;
uint64 inviteId;
//recv_data.readPackGUID(guid)
//recv_data >> uint64
//recv_data >> uint64
//recv_data >> uint64
//recv_data >> uint32
recvData.readPackGUID(invitee);
recvData >> inviteId >> owninviteId >> eventId;
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_REMOVE_INVITE ["
UI64FMTD "] EventId [" UI64FMTD "], OwnInviteId ["
UI64FMTD "], Invitee ([" UI64FMTD "] id: [" UI64FMTD "])",
guid, eventId, owninviteId, invitee, inviteId);
CalendarAction action;
action.SetAction(CALENDAR_ACTION_REMOVE_EVENT_INVITE);
action.SetPlayer(_player);
action.SetInviteId(owninviteId);
action.Invite.SetInviteId(inviteId);
action.Invite.SetEventId(eventId);
action.Invite.SetInvitee(invitee);
sCalendarMgr->AddAction(action);
}
void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recv_data)
void WorldSession::HandleCalendarEventStatus(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_EVENT_MODERATOR_STATUS");
recv_data.rfinish(); // set to end to avoid warnings spam
uint64 guid = _player->GetGUID();
uint64 invitee;
uint64 eventId;
uint64 inviteId;
uint64 owninviteId;
uint8 status;
//recv_data.readPackGUID(guid)
//recv_data >> uint64
//recv_data >> uint64
//recv_data >> uint64
//recv_data >> uint32
recvData.readPackGUID(invitee);
recvData >> eventId >> inviteId >> owninviteId >> status;
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_STATUS [" UI64FMTD"] EventId ["
UI64FMTD "] OwnInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: ["
UI64FMTD "], status %u", guid, eventId, owninviteId, invitee, inviteId, status);
CalendarAction action;
action.SetAction(CALENDAR_ACTION_MODIFY_EVENT_INVITE);
action.SetPlayer(_player);
action.SetInviteId(owninviteId);
action.Invite.SetInviteId(inviteId);
action.Invite.SetEventId(eventId);
action.Invite.SetInvitee(invitee);
action.Invite.SetStatus((CalendarInviteStatus) status);
sCalendarMgr->AddAction(action);
}
void WorldSession::HandleCalendarComplain(WorldPacket& recv_data)
void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_COMPLAIN");
recv_data.rfinish(); // set to end to avoid warnings spam
uint64 guid = _player->GetGUID();
uint64 invitee;
uint64 eventId;
uint64 inviteId;
uint64 owninviteId;
uint8 status;
//recv_data >> uint64
//recv_data >> uint64
//recv_data >> uint64
recvData.readPackGUID(invitee);
recvData >> eventId >> inviteId >> owninviteId >> status;
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_EVENT_MODERATOR_STATUS [" UI64FMTD "] EventId ["
UI64FMTD "] OwnInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: ["
UI64FMTD "], status %u", guid, eventId, owninviteId, invitee, inviteId, status);
CalendarAction action;
action.SetAction(CALENDAR_ACTION_MODIFY_MODERATOR_EVENT_INVITE);
action.SetPlayer(_player);
action.SetInviteId(owninviteId);
action.Invite.SetInviteId(inviteId);
action.Invite.SetEventId(eventId);
action.Invite.SetInvitee(invitee);
action.Invite.SetStatus((CalendarInviteStatus) status);
sCalendarMgr->AddAction(action);
}
void WorldSession::HandleCalendarGetNumPending(WorldPacket& /*recv_data*/)
void WorldSession::HandleCalendarComplain(WorldPacket& recvData)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: CMSG_CALENDAR_GET_NUM_PENDING"); // empty
uint64 guid = _player->GetGUID();
uint64 eventId;
uint64 complainGUID;
recvData >> eventId >> complainGUID;
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_COMPLAIN [" UI64FMTD "] EventId ["
UI64FMTD "] guid [" UI64FMTD "]", guid, eventId, complainGUID);
}
void WorldSession::HandleCalendarGetNumPending(WorldPacket& /*recvData*/)
{
uint64 guid = _player->GetGUID();
uint32 pending = sCalendarMgr->GetPlayerNumPending(guid);
sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_GET_NUM_PENDING: [" UI64FMTD
"] Pending: %u", guid, pending);
WorldPacket data(SMSG_CALENDAR_SEND_NUM_PENDING, 4);
data << uint32(0); // 0 - no pending invites, 1 - some pending invites
data << uint32(pending);
SendPacket(&data);
}
// ----------------------------------- SEND ------------------------------------
void WorldSession::SendCalendarEvent(CalendarEvent const& calendarEvent, CalendarSendEventType sendEventType)
{
uint64 guid = _player->GetGUID();
uint64 eventId = calendarEvent.GetEventId();
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_SEND_EVENT [" UI64FMTD "] EventId ["
UI64FMTD "] SendType %u", guid, eventId, sendEventType);
WorldPacket data(SMSG_CALENDAR_SEND_EVENT);
data << uint8(sendEventType);
data.appendPackGUID(calendarEvent.GetCreatorGUID());
data << uint64(eventId);
data << calendarEvent.GetTitle().c_str();
data << calendarEvent.GetDescription().c_str();
data << uint8(calendarEvent.GetType());
data << uint8(calendarEvent.GetRepeatable());
data << uint32(calendarEvent.GetMaxInvites());
data << int32(calendarEvent.GetDungeonId());
data << uint32(calendarEvent.GetFlags());
data << uint32(calendarEvent.GetTime());
data << uint32(calendarEvent.GetTimeZoneTime());
data << uint32(calendarEvent.GetGuildId());
CalendarInviteIdList const& invites = calendarEvent.GetInviteIdList();
data << uint32(invites.size());
for (CalendarInviteIdList::const_iterator it = invites.begin(); it != invites.end(); ++it)
{
if (CalendarInvite* invite = sCalendarMgr->GetInvite(*it))
{
uint64 guid = invite->GetInvitee();
Player* player = ObjectAccessor::FindPlayer(guid);
uint8 level = player ? player->getLevel() : Player::GetLevelFromDB(guid);
data.appendPackGUID(guid);
data << uint8(level);
data << uint8(invite->GetStatus());
data << uint8(invite->GetRank());
data << uint8(calendarEvent.GetGuildId() != 0);
data << uint64(invite->GetInviteId());
data << uint32(invite->GetStatusTime());
data << invite->GetText().c_str();
}
else
{
data.appendPackGUID(guid);
data << uint8(0) << uint8(0) << uint8(0) << uint8(0)
<< uint64(0) << uint32(0) << uint8(0);
sLog->outError("SendCalendarEvent: No Invite found with id [" UI64FMTD "]", *it);
}
}
SendPacket(&data);
}
void WorldSession::SendCalendarEventInvite(CalendarInvite const& invite, bool pending)
{
uint64 guid = _player->GetGUID();
uint64 eventId = invite.GetEventId();
uint64 inviteId = invite.GetInviteId();
uint64 invitee = invite.GetInvitee();
uint8 status = invite.GetStatus();
uint32 statusTime = invite.GetStatusTime();
Player* player = ObjectAccessor::FindPlayer(invitee);
uint8 level = player ? player->getLevel() : Player::GetLevelFromDB(invitee);
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_INVITE [" UI64FMTD "] EventId ["
UI64FMTD "] InviteId [" UI64FMTD "] Invitee [" UI64FMTD "] "
" Level %u, Status %u, StatusTime %u" , guid, eventId, inviteId,
invitee, level, status, statusTime);
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE, 8 + 8 + 8 + 1 + 1 + 1 + (statusTime ? 4 : 0) + 1);
data.appendPackGUID(invitee);
data << uint64(eventId);
data << uint64(inviteId);
data << uint8(level);
data << uint8(status);
if (statusTime)
data << uint8(1) << uint32(statusTime);
else
data << uint8(0);
data << uint8(pending);
SendPacket(&data);
}
void WorldSession::SendCalendarEventInviteAlert(CalendarEvent const& calendarEvent, CalendarInvite const& invite)
{
uint64 guid = _player->GetGUID();
uint64 eventId = calendarEvent.GetEventId();
uint64 inviteId = invite.GetInviteId();
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_INVITE_ALERT [" UI64FMTD "] EventId ["
UI64FMTD "] InviteId [" UI64FMTD "]", guid, eventId, inviteId);
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_ALERT);
data << uint64(eventId);
data << calendarEvent.GetTitle().c_str();
data << uint32(calendarEvent.GetTime());
data << uint32(calendarEvent.GetFlags());
data << uint32(calendarEvent.GetType());
data << uint32(calendarEvent.GetDungeonId());
data << uint64(inviteId);
data << uint8(invite.GetStatus());
data << uint8(invite.GetRank());
data.appendPackGUID(calendarEvent.GetCreatorGUID());
data.appendPackGUID(invite.GetSenderGUID());
SendPacket(&data);
}
void WorldSession::SendCalendarEventUpdateAlert(CalendarEvent const& calendarEvent, CalendarSendEventType sendEventType)
{
uint64 guid = _player->GetGUID();
uint64 eventId = calendarEvent.GetEventId();
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_UPDATED_ALERT ["
UI64FMTD "] EventId [" UI64FMTD "]", guid, eventId);
WorldPacket data(SMSG_CALENDAR_EVENT_UPDATED_ALERT, 1 + 8 + 4 + 4 + 4 + 1 + 4 +
calendarEvent.GetTitle().size() + calendarEvent.GetDescription().size() + 1 + 4 + 4);
data << uint8(sendEventType);
data << uint64(eventId);
data << uint32(calendarEvent.GetTime());
data << uint32(calendarEvent.GetFlags());
data << uint32(calendarEvent.GetTime());
data << uint8(calendarEvent.GetType());
data << uint32(calendarEvent.GetDungeonId());
data << calendarEvent.GetTitle().c_str();
data << calendarEvent.GetDescription().c_str();
data << uint8(calendarEvent.GetRepeatable());
data << uint32(calendarEvent.GetMaxInvites());
data << uint32(0); // FIXME
SendPacket(&data);
}
void WorldSession::SendCalendarEventRemovedAlert(CalendarEvent const& calendarEvent)
{
uint64 guid = _player->GetGUID();
uint64 eventId = calendarEvent.GetEventId();
uint32 eventTime = (calendarEvent.GetTime());
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_REMOVED_ALERT [" UI64FMTD "] EventId ["
UI64FMTD "] Time %u", guid, eventId, eventTime);
WorldPacket data(SMSG_CALENDAR_EVENT_REMOVED_ALERT, 1 + 8 + 1);
data << uint8(1); // FIXME: If true does not SignalEvent(EVENT_CALENDAR_ACTION_PENDING)
data << uint64(eventId);
data << uint32(eventTime);
SendPacket(&data);
}
void WorldSession::SendCalendarEventStatus(CalendarEvent const& calendarEvent, CalendarInvite const& invite)
{
uint64 guid = _player->GetGUID();
uint64 eventId = calendarEvent.GetEventId();
uint64 inviteId = invite.GetInviteId();
uint64 invitee = invite.GetInvitee();
uint32 eventTime = (calendarEvent.GetTime());
uint32 flags = calendarEvent.GetFlags();
uint8 status = invite.GetStatus();
uint8 rank = invite.GetRank();
uint32 statusTime = secsToTimeBitFields(invite.GetStatusTime());
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_STATUS [" UI64FMTD "] EventId ["
UI64FMTD "] InviteId [" UI64FMTD "] Invitee [" UI64FMTD "] Time %u "
"Flags %u, Status %u, Rank %u, StatusTime %u",
guid, eventId, inviteId, invitee, eventTime, flags, status, rank,
statusTime);
WorldPacket data(SMSG_CALENDAR_EVENT_STATUS, 8 + 8 + 4 + 4 + 1 + 1 + 4);
data.appendPackGUID(invitee);
data << uint64(eventId);
data << uint32(eventTime);
data << uint32(flags);
data << uint8(status);
data << uint8(rank);
data << uint32(statusTime);
SendPacket(&data);
}
void WorldSession::SendCalendarEventModeratorStatusAlert(CalendarInvite const& invite)
{
uint64 guid = _player->GetGUID();
uint64 eventId = invite.GetEventId();
uint64 invitee = invite.GetInvitee();
uint8 status = invite.GetStatus();
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_MODERATOR_STATUS_ALERT [" UI64FMTD
"] Invitee [" UI64FMTD "] EventId [" UI64FMTD "] Status %u ", guid,
invitee, eventId, status);
WorldPacket data(SMSG_CALENDAR_EVENT_MODERATOR_STATUS_ALERT, 8 + 8 + 1 + 1);
data.appendPackGUID(invitee);
data << uint64(eventId);
data << uint8(status);
data << uint8(1); // FIXME
SendPacket(&data);
}
void WorldSession::SendCalendarEventInviteRemoveAlert(CalendarEvent const& calendarEvent, CalendarInviteStatus status)
{
uint64 guid = _player->GetGUID();
uint64 eventId = calendarEvent.GetEventId();
uint32 eventTime = (calendarEvent.GetTime());
uint32 flags = calendarEvent.GetFlags();
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_INVITE_REMOVED_ALERT ["
UI64FMTD "] EventId [" UI64FMTD "] Time %u, Flags %u, Status %u",
guid, eventId, eventTime, flags, status);
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_REMOVED_ALERT, 8 + 4 + 4 + 1);
data << uint64(eventId);
data << uint32(eventTime);
data << uint32(flags);
data << uint8(status);
SendPacket(&data);
}
void WorldSession::SendCalendarEventInviteRemove(CalendarInvite const& invite, uint32 flags)
{
uint64 guid = _player->GetGUID();
uint64 eventId = invite.GetEventId();
uint64 invitee = invite.GetInvitee();
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_EVENT_INVITE_REMOVED ["
UI64FMTD "] Invitee [" UI64FMTD "] EventId [" UI64FMTD
"] Flags %u", guid, invitee, eventId, flags);
WorldPacket data(SMSG_CALENDAR_EVENT_INVITE_REMOVED, 8 + 4 + 4 + 1);
data.appendPackGUID(invitee);
data << uint32(eventId);
data << uint32(flags);
data << uint8(1); // FIXME
SendPacket(&data);
}
void WorldSession::SendCalendarClearPendingAction()
{
uint64 guid = _player->GetGUID();
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_CLEAR_PENDING_ACTION [" UI64FMTD "]", guid);
WorldPacket data(SMSG_CALENDAR_CLEAR_PENDING_ACTION, 0);
SendPacket(&data);
}
void WorldSession::SendCalendarRaidLockoutUpdated(InstanceSave const* save)
{
if (!save)
return;
uint64 guid = _player->GetGUID();
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_RAID_LOCKOUT_UPDATED [" UI64FMTD
"] Map: %u, Difficulty %u", guid, save->GetMapId(), save->GetDifficulty());
time_t cur_time = time_t(time(NULL));
WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_UPDATED, 4 + 4 + 4 + 4 + 8);
data << secsToTimeBitFields(cur_time);
data << uint32(save->GetMapId());
data << uint32(save->GetDifficulty());
data << uint32(save->GetResetTime() - cur_time);
data << uint64(save->GetInstanceId());
SendPacket(&data);
}
void WorldSession::SendCalendarCommandResult(CalendarError err, char const* param /*= NULL*/)
{
uint64 guid = _player->GetGUID();
sLog->outDebug(LOG_FILTER_NETWORKIO, "SMSG_CALENDAR_COMMAND_RESULT [" UI64FMTD "] Value: %u", guid, err);
WorldPacket data(SMSG_CALENDAR_COMMAND_RESULT, 0);
data << uint32(0);
data << uint8(0);
switch (err)
{
case CALENDAR_ERROR_OTHER_INVITES_EXCEEDED:
case CALENDAR_ERROR_ALREADY_INVITED_TO_EVENT_S:
case CALENDAR_ERROR_IGNORING_YOU_S:
data << param;
break;
default:
data << uint8(0);
break;
}
data << uint32(err);
SendPacket(&data);
}
void WorldSession::SendCalendarRaidLockout(InstanceSave const* save, bool add)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "%s", add ? "SMSG_CALENDAR_RAID_LOCKOUT_ADDED" : "SMSG_CALENDAR_RAID_LOCKOUT_REMOVED");
time_t currTime = time(NULL);
WorldPacket data(SMSG_CALENDAR_RAID_LOCKOUT_REMOVED, (add ? 4 : 0) + 4 + 4 + 4 + 8);
if (add)
{
data.SetOpcode(SMSG_CALENDAR_RAID_LOCKOUT_ADDED);
data << uint32(secsToTimeBitFields(currTime));
}
data << uint32(save->GetMapId());
data << uint32(save->GetDifficulty());
data << uint32(save->GetResetTime() - currTime);
data << uint64(save->GetInstanceId());
SendPacket(&data);
}
@@ -1811,8 +1811,8 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD))
{
// Reset guild
if (QueryResult result = CharacterDatabase.PQuery("SELECT guildid FROM `guild_member` WHERE guid ='%u'", lowGuid))
if (Guild* guild = sGuildMgr->GetGuildById((result->Fetch()[0]).GetUInt32()))
if (QueryResult result2 = CharacterDatabase.PQuery("SELECT guildid FROM `guild_member` WHERE guid ='%u'", lowGuid))
if (Guild* guild = sGuildMgr->GetGuildById((result2->Fetch()[0]).GetUInt32()))
guild->DeleteMember(MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER));
}
-1
View File
@@ -1262,7 +1262,6 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recv_data)
}
}
}
}
}
+12 -13
View File
@@ -386,8 +386,8 @@ void WorldSession::DoLootRelease(uint64 lguid)
{
Creature* creature = GetPlayer()->GetMap()->GetCreature(lguid);
bool ok_loot = creature && creature->isAlive() == (player->getClass() == CLASS_ROGUE && creature->lootForPickPocketed);
if (!ok_loot || !creature->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
bool lootAllowed = creature && creature->isAlive() == (player->getClass() == CLASS_ROGUE && creature->lootForPickPocketed);
if (!lootAllowed || !creature->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
return;
loot = &creature->loot;
@@ -448,7 +448,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data)
if (_player->GetLootGUID() != lootguid)
return;
Loot* pLoot = NULL;
Loot* loot = NULL;
if (IS_CRE_OR_VEH_GUID(GetPlayer()->GetLootGUID()))
{
@@ -456,7 +456,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data)
if (!creature)
return;
pLoot = &creature->loot;
loot = &creature->loot;
}
else if (IS_GAMEOBJECT_GUID(GetPlayer()->GetLootGUID()))
{
@@ -464,19 +464,19 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data)
if (!pGO)
return;
pLoot = &pGO->loot;
loot = &pGO->loot;
}
if (!pLoot)
if (!loot)
return;
if (slotid > pLoot->items.size())
if (slotid > loot->items.size())
{
sLog->outDebug(LOG_FILTER_LOOT, "MasterLootItem: Player %s might be using a hack! (slot %d, size %lu)", GetPlayer()->GetName(), slotid, (unsigned long)pLoot->items.size());
sLog->outDebug(LOG_FILTER_LOOT, "MasterLootItem: Player %s might be using a hack! (slot %d, size %lu)", GetPlayer()->GetName(), slotid, (unsigned long)loot->items.size());
return;
}
LootItem& item = pLoot->items[slotid];
LootItem& item = loot->items[slotid];
ItemPosCountVec dest;
InventoryResult msg = target->CanStoreNewItem(NULL_BAG, NULL_SLOT, dest, item.itemid, item.count);
@@ -495,14 +495,13 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket & recv_data)
Item* newitem = target->StoreNewItem(dest, item.itemid, true, item.randomPropertyId, looters);
target->SendNewItem(newitem, uint32(item.count), false, false, true);
target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_ITEM, item.itemid, item.count);
target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, pLoot->loot_type, item.count);
target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_TYPE, loot->loot_type, item.count);
target->GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_LOOT_EPIC_ITEM, item.itemid, item.count);
// mark as looted
item.count=0;
item.is_looted=true;
pLoot->NotifyItemRemoved(slotid);
--pLoot->unlootedCount;
loot->NotifyItemRemoved(slotid);
--loot->unlootedCount;
}
+18 -18
View File
@@ -127,11 +127,11 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket & recv_data)
if (GetPlayer()->HasUnitState(UNIT_STATE_DIED))
GetPlayer()->RemoveAurasByType(SPELL_AURA_FEIGN_DEATH);
if ((unit && unit->GetCreatureInfo()->ScriptID != unit->LastUsedScriptID) || (go && go->GetGOInfo()->ScriptId != go->LastUsedScriptID))
if ((unit && unit->GetCreatureTemplate()->ScriptID != unit->LastUsedScriptID) || (go && go->GetGOInfo()->ScriptId != go->LastUsedScriptID))
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleGossipSelectOptionOpcode - Script reloaded while in use, ignoring and set new scipt id");
if (unit)
unit->LastUsedScriptID = unit->GetCreatureInfo()->ScriptID;
unit->LastUsedScriptID = unit->GetCreatureTemplate()->ScriptID;
if (go)
go->LastUsedScriptID = go->GetGOInfo()->ScriptId;
_player->PlayerTalkClass->SendCloseGossip();
@@ -813,7 +813,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
Player* player = GetPlayer();
if (player->isInFlight())
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) in flight, ignore Area Trigger ID:%u",
sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) in flight, ignore Area Trigger ID:%u",
player->GetName(), player->GetGUIDLow(), triggerId);
return;
}
@@ -821,14 +821,14 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
AreaTriggerEntry const* atEntry = sAreaTriggerStore.LookupEntry(triggerId);
if (!atEntry)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) send unknown (by DBC) Area Trigger ID:%u",
sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) send unknown (by DBC) Area Trigger ID:%u",
player->GetName(), player->GetGUIDLow(), triggerId);
return;
}
if (player->GetMapId() != atEntry->mapid)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) too far (trigger map: %u player map: %u), ignore Area Trigger ID: %u",
sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (trigger map: %u player map: %u), ignore Area Trigger ID: %u",
player->GetName(), atEntry->mapid, player->GetMapId(), player->GetGUIDLow(), triggerId);
return;
}
@@ -842,7 +842,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
float dist = player->GetDistance(atEntry->x, atEntry->y, atEntry->z);
if (dist > atEntry->radius + delta)
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) too far (radius: %f distance: %f), ignore Area Trigger ID: %u",
sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (radius: %f distance: %f), ignore Area Trigger ID: %u",
player->GetName(), player->GetGUIDLow(), atEntry->radius, dist, triggerId);
return;
}
@@ -873,7 +873,7 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
(fabs(dy) > atEntry->box_y / 2 + delta) ||
(fabs(dz) > atEntry->box_z / 2 + delta))
{
sLog->outDebug(LOG_FILTER_NETWORKIO, "Player '%s' (GUID: %u) too far (1/2 box X: %f 1/2 box Y: %f 1/2 box Z: %f rotatedPlayerX: %f rotatedPlayerY: %f dZ:%f), ignore Area Trigger ID: %u",
sLog->outDebug(LOG_FILTER_NETWORKIO, "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (1/2 box X: %f 1/2 box Y: %f 1/2 box Z: %f rotatedPlayerX: %f rotatedPlayerY: %f dZ:%f), ignore Area Trigger ID: %u",
player->GetName(), player->GetGUIDLow(), atEntry->box_x/2, atEntry->box_y/2, atEntry->box_z/2, rotPlayerX, rotPlayerY, dz, triggerId);
return;
}
@@ -1060,7 +1060,7 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data)
sLog->outDetail("MISC: Added Item %u into button %u", action, button);
break;
default:
sLog->outError("MISC: Unknown action button type %u for action %u into button %u", type, action, button);
sLog->outError("MISC: Unknown action button type %u for action %u into button %u for player %s (GUID: %u)", type, action, button, _player->GetName(), _player->GetGUIDLow());
return;
}
GetPlayer()->addActionButton(button, action, type);
@@ -1327,7 +1327,7 @@ void WorldSession::HandleWhoisOpcode(WorldPacket& recv_data)
WorldPacket data(SMSG_WHOIS, msg.size()+1);
data << msg;
_player->GetSession()->SendPacket(&data);
SendPacket(&data);
sLog->outDebug(LOG_FILTER_NETWORKIO, "Received whois command from player %s for character %s", GetPlayer()->GetName(), charname.c_str());
}
@@ -1503,16 +1503,16 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket & recv_data)
{
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* pGroupGuy = itr->getSource();
if (!pGroupGuy)
Player* groupGuy = itr->getSource();
if (!groupGuy)
continue;
if (!pGroupGuy->IsInMap(pGroupGuy))
if (!groupGuy->IsInMap(groupGuy))
return;
if (pGroupGuy->GetMap()->IsNonRaidDungeon())
if (groupGuy->GetMap()->IsNonRaidDungeon())
{
sLog->outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while group member (Name: %s, GUID: %u) is inside!", _player->GetGUIDLow(), pGroupGuy->GetName(), pGroupGuy->GetGUIDLow());
sLog->outError("WorldSession::HandleSetDungeonDifficultyOpcode: player %d tried to reset the instance while group member (Name: %s, GUID: %u) is inside!", _player->GetGUIDLow(), groupGuy->GetName(), groupGuy->GetGUIDLow());
return;
}
}
@@ -1560,14 +1560,14 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket & recv_data)
{
for (GroupReference* itr = group->GetFirstMember(); itr != NULL; itr = itr->next())
{
Player* pGroupGuy = itr->getSource();
if (!pGroupGuy)
Player* groupGuy = itr->getSource();
if (!groupGuy)
continue;
if (!pGroupGuy->IsInMap(pGroupGuy))
if (!groupGuy->IsInMap(groupGuy))
return;
if (pGroupGuy->GetMap()->IsRaid())
if (groupGuy->GetMap()->IsRaid())
{
sLog->outError("WorldSession::HandleSetRaidDifficultyOpcode: player %d tried to reset the instance while inside!", _player->GetGUIDLow());
return;
+13 -7
View File
@@ -135,7 +135,7 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
if (!unit->isCanTrainingOf(_player, true))
return;
CreatureTemplate const* ci = unit->GetCreatureInfo();
CreatureTemplate const* ci = unit->GetCreatureTemplate();
if (!ci)
{
@@ -337,7 +337,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket & recv_data)
if (!sScriptMgr->OnGossipHello(_player, unit))
{
// _player->TalkedToCreature(unit->GetEntry(), unit->GetGUID());
_player->PrepareGossipMenu(unit, unit->GetCreatureInfo()->GossipMenuId, true);
_player->PrepareGossipMenu(unit, unit->GetCreatureTemplate()->GossipMenuId, true);
_player->SendPreparedGossip(unit);
}
unit->AI()->sGossipHello(_player);
@@ -615,7 +615,7 @@ void WorldSession::HandleStablePet(WorldPacket & recv_data)
Pet* pet = _player->GetPet();
// can't place in stable dead pet
if (!pet||!pet->isAlive()||pet->getPetType() != HUNTER_PET)
if (!pet || !pet->isAlive() || pet->getPetType() != HUNTER_PET)
{
SendStableResult(STABLE_ERR_STABLE);
return;
@@ -853,16 +853,22 @@ void WorldSession::HandleStableSwapPetCallback(PreparedQueryResult result, uint3
return;
}
// move alive pet to slot or delete dead pet
Pet* pet = _player->GetPet();
// The player's pet could have been removed during the delay of the DB callback
if (!pet)
{
SendStableResult(STABLE_ERR_STABLE);
return;
}
// move alive pet to slot or delete dead pet
_player->RemovePet(pet, pet->isAlive() ? PetSaveMode(slot) : PET_SAVE_AS_DELETED);
// summon unstabled pet
Pet* newpet = new Pet(_player);
if (!newpet->LoadPetFromDB(_player, petEntry, petId))
Pet* newPet = new Pet(_player);
if (!newPet->LoadPetFromDB(_player, petEntry, petId))
{
delete newpet;
delete newPet;
SendStableResult(STABLE_ERR_STABLE);
}
else
+1 -1
View File
@@ -103,7 +103,7 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket & recv_data)
if (sScriptMgr->OnGossipHello(_player, creature))
return;
_player->PrepareGossipMenu(creature, creature->GetCreatureInfo()->GossipMenuId, true);
_player->PrepareGossipMenu(creature, creature->GetCreatureTemplate()->GossipMenuId, true);
_player->SendPreparedGossip(creature);
creature->AI()->sGossipHello(_player);
+80 -82
View File
@@ -147,7 +147,6 @@ uint32 LootStore::LoadLootTable()
// Adds current row to the template
tab->second->AddEntry(storeitem);
++count;
}
while (result->NextRow());
@@ -205,12 +204,12 @@ LootTemplate* LootStore::GetLootForConditionFill(uint32 loot_id)
return tab->second;
}
uint32 LootStore::LoadAndCollectLootIds(LootIdSet& ids_set)
uint32 LootStore::LoadAndCollectLootIds(LootIdSet& lootIdSet)
{
uint32 count = LoadLootTable();
for (LootTemplateMap::const_iterator tab = m_LootTemplates.begin(); tab != m_LootTemplates.end(); ++tab)
ids_set.insert(tab->first);
lootIdSet.insert(tab->first);
return count;
}
@@ -221,16 +220,16 @@ void LootStore::CheckLootRefs(LootIdSet* ref_set) const
ltItr->second->CheckLootRefs(m_LootTemplates, ref_set);
}
void LootStore::ReportUnusedIds(LootIdSet const& ids_set) const
void LootStore::ReportUnusedIds(LootIdSet const& lootIdSet) const
{
// all still listed ids isn't referenced
for (LootIdSet::const_iterator itr = ids_set.begin(); itr != ids_set.end(); ++itr)
for (LootIdSet::const_iterator itr = lootIdSet.begin(); itr != lootIdSet.end(); ++itr)
sLog->outErrorDb("Table '%s' entry %d isn't %s and not referenced from loot, and then useless.", GetName(), *itr, GetEntryName());
}
void LootStore::ReportNotExistedId(uint32 id) const
{
sLog->outErrorDb("Table '%s' entry %d (%s) not exist but used as loot id in DB.", GetName(), id, GetEntryName());
sLog->outErrorDb("Table '%s' entry %d (%s) does not exist but used as loot id in DB.", GetName(), id, GetEntryName());
}
//
@@ -296,7 +295,6 @@ bool LootStoreItem::IsValid(LootStore const& store, uint32 entry) const
sLog->outErrorDb("Table '%s' entry %d item %d: max count (%u) less that min count (%i) - skipped", store.GetName(), entry, itemid, int32(maxcount), mincountOrRef);
return false;
}
}
else // mincountOrRef < 0
{
@@ -1420,8 +1418,8 @@ void LoadLootTemplates_Creature()
uint32 oldMSTime = getMSTime();
LootIdSet ids_set, ids_setUsed;
uint32 count = LootTemplates_Creature.LoadAndCollectLootIds(ids_set);
LootIdSet lootIdSet, lootIdSetUsed;
uint32 count = LootTemplates_Creature.LoadAndCollectLootIds(lootIdSet);
// Remove real entries and check loot existence
CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
@@ -1429,18 +1427,18 @@ void LoadLootTemplates_Creature()
{
if (uint32 lootid = itr->second.lootid)
{
if (ids_set.find(lootid) == ids_set.end())
if (lootIdSet.find(lootid) == lootIdSet.end())
LootTemplates_Creature.ReportNotExistedId(lootid);
else
ids_setUsed.insert(lootid);
lootIdSetUsed.insert(lootid);
}
}
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
ids_set.erase(*itr);
for (LootIdSet::const_iterator itr = lootIdSetUsed.begin(); itr != lootIdSetUsed.end(); ++itr)
lootIdSet.erase(*itr);
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Creature.ReportUnusedIds(ids_set);
LootTemplates_Creature.ReportUnusedIds(lootIdSet);
if (count)
sLog->outString(">> Loaded %u creature loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
@@ -1456,7 +1454,7 @@ void LoadLootTemplates_Disenchant()
uint32 oldMSTime = getMSTime();
LootIdSet lootIdSet, loodIdSetUsed;
LootIdSet lootIdSet, lootIdSetUsed;
uint32 count = LootTemplates_Disenchant.LoadAndCollectLootIds(lootIdSet);
ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
@@ -1467,11 +1465,11 @@ void LoadLootTemplates_Disenchant()
if (lootIdSet.find(lootid) == lootIdSet.end())
LootTemplates_Disenchant.ReportNotExistedId(lootid);
else
loodIdSetUsed.insert(lootid);
lootIdSetUsed.insert(lootid);
}
}
for (LootIdSet::const_iterator itr = loodIdSetUsed.begin(); itr != loodIdSetUsed.end(); ++itr)
for (LootIdSet::const_iterator itr = lootIdSetUsed.begin(); itr != lootIdSetUsed.end(); ++itr)
lootIdSet.erase(*itr);
// output error for any still listed (not referenced from appropriate table) ids
@@ -1490,17 +1488,17 @@ void LoadLootTemplates_Fishing()
uint32 oldMSTime = getMSTime();
LootIdSet ids_set;
uint32 count = LootTemplates_Fishing.LoadAndCollectLootIds(ids_set);
LootIdSet lootIdSet;
uint32 count = LootTemplates_Fishing.LoadAndCollectLootIds(lootIdSet);
// remove real entries and check existence loot
for (uint32 i = 1; i < sAreaStore.GetNumRows(); ++i)
if (AreaTableEntry const* areaEntry = sAreaStore.LookupEntry(i))
if (ids_set.find(areaEntry->ID) != ids_set.end())
ids_set.erase(areaEntry->ID);
if (lootIdSet.find(areaEntry->ID) != lootIdSet.end())
lootIdSet.erase(areaEntry->ID);
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Fishing.ReportUnusedIds(ids_set);
LootTemplates_Fishing.ReportUnusedIds(lootIdSet);
if (count)
sLog->outString(">> Loaded %u fishing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
@@ -1516,8 +1514,8 @@ void LoadLootTemplates_Gameobject()
uint32 oldMSTime = getMSTime();
LootIdSet ids_set, ids_setUsed;
uint32 count = LootTemplates_Gameobject.LoadAndCollectLootIds(ids_set);
LootIdSet lootIdSet, lootIdSetUsed;
uint32 count = LootTemplates_Gameobject.LoadAndCollectLootIds(lootIdSet);
// remove real entries and check existence loot
GameObjectTemplateContainer const* gotc = sObjectMgr->GetGameObjectTemplates();
@@ -1525,18 +1523,18 @@ void LoadLootTemplates_Gameobject()
{
if (uint32 lootid = itr->second.GetLootId())
{
if (sObjectMgr->IsGoOfSpecificEntrySpawned(itr->second.entry) && ids_set.find(lootid) == ids_set.end())
if (sObjectMgr->IsGoOfSpecificEntrySpawned(itr->second.entry) && lootIdSet.find(lootid) == lootIdSet.end())
LootTemplates_Gameobject.ReportNotExistedId(lootid);
else
ids_setUsed.insert(lootid);
lootIdSetUsed.insert(lootid);
}
}
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
ids_set.erase(*itr);
for (LootIdSet::const_iterator itr = lootIdSetUsed.begin(); itr != lootIdSetUsed.end(); ++itr)
lootIdSet.erase(*itr);
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Gameobject.ReportUnusedIds(ids_set);
LootTemplates_Gameobject.ReportUnusedIds(lootIdSet);
if (count)
sLog->outString(">> Loaded %u gameobject loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
@@ -1552,17 +1550,17 @@ void LoadLootTemplates_Item()
uint32 oldMSTime = getMSTime();
LootIdSet ids_set;
uint32 count = LootTemplates_Item.LoadAndCollectLootIds(ids_set);
LootIdSet lootIdSet;
uint32 count = LootTemplates_Item.LoadAndCollectLootIds(lootIdSet);
// remove real entries and check existence loot
ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
for (ItemTemplateContainer::const_iterator itr = its->begin(); itr != its->end(); ++itr)
if (ids_set.find(itr->second.ItemId) != ids_set.end() && itr->second.Flags & ITEM_PROTO_FLAG_OPENABLE)
ids_set.erase(itr->second.ItemId);
if (lootIdSet.find(itr->second.ItemId) != lootIdSet.end() && itr->second.Flags & ITEM_PROTO_FLAG_OPENABLE)
lootIdSet.erase(itr->second.ItemId);
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Item.ReportUnusedIds(ids_set);
LootTemplates_Item.ReportUnusedIds(lootIdSet);
if (count)
sLog->outString(">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
@@ -1578,8 +1576,8 @@ void LoadLootTemplates_Milling()
uint32 oldMSTime = getMSTime();
LootIdSet ids_set;
uint32 count = LootTemplates_Milling.LoadAndCollectLootIds(ids_set);
LootIdSet lootIdSet;
uint32 count = LootTemplates_Milling.LoadAndCollectLootIds(lootIdSet);
// remove real entries and check existence loot
ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
@@ -1588,12 +1586,12 @@ void LoadLootTemplates_Milling()
if (!(itr->second.Flags & ITEM_PROTO_FLAG_MILLABLE))
continue;
if (ids_set.find(itr->second.ItemId) != ids_set.end())
ids_set.erase(itr->second.ItemId);
if (lootIdSet.find(itr->second.ItemId) != lootIdSet.end())
lootIdSet.erase(itr->second.ItemId);
}
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Milling.ReportUnusedIds(ids_set);
LootTemplates_Milling.ReportUnusedIds(lootIdSet);
if (count)
sLog->outString(">> Loaded %u milling loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
@@ -1609,8 +1607,8 @@ void LoadLootTemplates_Pickpocketing()
uint32 oldMSTime = getMSTime();
LootIdSet ids_set, ids_setUsed;
uint32 count = LootTemplates_Pickpocketing.LoadAndCollectLootIds(ids_set);
LootIdSet lootIdSet, lootIdSetUsed;
uint32 count = LootTemplates_Pickpocketing.LoadAndCollectLootIds(lootIdSet);
// Remove real entries and check loot existence
CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
@@ -1618,18 +1616,18 @@ void LoadLootTemplates_Pickpocketing()
{
if (uint32 lootid = itr->second.pickpocketLootId)
{
if (ids_set.find(lootid) == ids_set.end())
if (lootIdSet.find(lootid) == lootIdSet.end())
LootTemplates_Pickpocketing.ReportNotExistedId(lootid);
else
ids_setUsed.insert(lootid);
lootIdSetUsed.insert(lootid);
}
}
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
ids_set.erase(*itr);
for (LootIdSet::const_iterator itr = lootIdSetUsed.begin(); itr != lootIdSetUsed.end(); ++itr)
lootIdSet.erase(*itr);
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Pickpocketing.ReportUnusedIds(ids_set);
LootTemplates_Pickpocketing.ReportUnusedIds(lootIdSet);
if (count)
sLog->outString(">> Loaded %u pickpocketing loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
@@ -1645,8 +1643,8 @@ void LoadLootTemplates_Prospecting()
uint32 oldMSTime = getMSTime();
LootIdSet ids_set;
uint32 count = LootTemplates_Prospecting.LoadAndCollectLootIds(ids_set);
LootIdSet lootIdSet;
uint32 count = LootTemplates_Prospecting.LoadAndCollectLootIds(lootIdSet);
// remove real entries and check existence loot
ItemTemplateContainer const* its = sObjectMgr->GetItemTemplateStore();
@@ -1655,12 +1653,12 @@ void LoadLootTemplates_Prospecting()
if (!(itr->second.Flags & ITEM_PROTO_FLAG_PROSPECTABLE))
continue;
if (ids_set.find(itr->second.ItemId) != ids_set.end())
ids_set.erase(itr->second.ItemId);
if (lootIdSet.find(itr->second.ItemId) != lootIdSet.end())
lootIdSet.erase(itr->second.ItemId);
}
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Prospecting.ReportUnusedIds(ids_set);
LootTemplates_Prospecting.ReportUnusedIds(lootIdSet);
if (count)
sLog->outString(">> Loaded %u prospecting loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
@@ -1676,17 +1674,17 @@ void LoadLootTemplates_Mail()
uint32 oldMSTime = getMSTime();
LootIdSet ids_set;
uint32 count = LootTemplates_Mail.LoadAndCollectLootIds(ids_set);
LootIdSet lootIdSet;
uint32 count = LootTemplates_Mail.LoadAndCollectLootIds(lootIdSet);
// remove real entries and check existence loot
for (uint32 i = 1; i < sMailTemplateStore.GetNumRows(); ++i)
if (sMailTemplateStore.LookupEntry(i))
if (ids_set.find(i) != ids_set.end())
ids_set.erase(i);
if (lootIdSet.find(i) != lootIdSet.end())
lootIdSet.erase(i);
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Mail.ReportUnusedIds(ids_set);
LootTemplates_Mail.ReportUnusedIds(lootIdSet);
if (count)
sLog->outString(">> Loaded %u mail loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
@@ -1702,8 +1700,8 @@ void LoadLootTemplates_Skinning()
uint32 oldMSTime = getMSTime();
LootIdSet ids_set, ids_setUsed;
uint32 count = LootTemplates_Skinning.LoadAndCollectLootIds(ids_set);
LootIdSet lootIdSet, lootIdSetUsed;
uint32 count = LootTemplates_Skinning.LoadAndCollectLootIds(lootIdSet);
// remove real entries and check existence loot
CreatureTemplateContainer const* ctc = sObjectMgr->GetCreatureTemplates();
@@ -1711,18 +1709,18 @@ void LoadLootTemplates_Skinning()
{
if (uint32 lootid = itr->second.SkinLootId)
{
if (ids_set.find(lootid) == ids_set.end())
if (lootIdSet.find(lootid) == lootIdSet.end())
LootTemplates_Skinning.ReportNotExistedId(lootid);
else
ids_setUsed.insert(lootid);
lootIdSetUsed.insert(lootid);
}
}
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
ids_set.erase(*itr);
for (LootIdSet::const_iterator itr = lootIdSetUsed.begin(); itr != lootIdSetUsed.end(); ++itr)
lootIdSet.erase(*itr);
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Skinning.ReportUnusedIds(ids_set);
LootTemplates_Skinning.ReportUnusedIds(lootIdSet);
if (count)
sLog->outString(">> Loaded %u skinning loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
@@ -1738,8 +1736,8 @@ void LoadLootTemplates_Spell()
uint32 oldMSTime = getMSTime();
LootIdSet ids_set;
uint32 count = LootTemplates_Spell.LoadAndCollectLootIds(ids_set);
LootIdSet lootIdSet;
uint32 count = LootTemplates_Spell.LoadAndCollectLootIds(lootIdSet);
// remove real entries and check existence loot
for (uint32 spell_id = 1; spell_id < sSpellMgr->GetSpellInfoStoreSize(); ++spell_id)
@@ -1752,7 +1750,7 @@ void LoadLootTemplates_Spell()
if (!spellInfo->IsLootCrafting())
continue;
if (ids_set.find(spell_id) == ids_set.end())
if (lootIdSet.find(spell_id) == lootIdSet.end())
{
// not report about not trainable spells (optionally supported by DB)
// ignore 61756 (Northrend Inscription Research (FAST QA VERSION) for example
@@ -1762,11 +1760,11 @@ void LoadLootTemplates_Spell()
}
}
else
ids_set.erase(spell_id);
lootIdSet.erase(spell_id);
}
// output error for any still listed (not referenced from appropriate table) ids
LootTemplates_Spell.ReportUnusedIds(ids_set);
LootTemplates_Spell.ReportUnusedIds(lootIdSet);
if (count)
sLog->outString(">> Loaded %u spell loot templates in %u ms", count, GetMSTimeDiffToNow(oldMSTime));
@@ -1781,24 +1779,24 @@ void LoadLootTemplates_Reference()
uint32 oldMSTime = getMSTime();
LootIdSet ids_set;
LootTemplates_Reference.LoadAndCollectLootIds(ids_set);
LootIdSet lootIdSet;
LootTemplates_Reference.LoadAndCollectLootIds(lootIdSet);
// check references and remove used
LootTemplates_Creature.CheckLootRefs(&ids_set);
LootTemplates_Fishing.CheckLootRefs(&ids_set);
LootTemplates_Gameobject.CheckLootRefs(&ids_set);
LootTemplates_Item.CheckLootRefs(&ids_set);
LootTemplates_Milling.CheckLootRefs(&ids_set);
LootTemplates_Pickpocketing.CheckLootRefs(&ids_set);
LootTemplates_Skinning.CheckLootRefs(&ids_set);
LootTemplates_Disenchant.CheckLootRefs(&ids_set);
LootTemplates_Prospecting.CheckLootRefs(&ids_set);
LootTemplates_Mail.CheckLootRefs(&ids_set);
LootTemplates_Reference.CheckLootRefs(&ids_set);
LootTemplates_Creature.CheckLootRefs(&lootIdSet);
LootTemplates_Fishing.CheckLootRefs(&lootIdSet);
LootTemplates_Gameobject.CheckLootRefs(&lootIdSet);
LootTemplates_Item.CheckLootRefs(&lootIdSet);
LootTemplates_Milling.CheckLootRefs(&lootIdSet);
LootTemplates_Pickpocketing.CheckLootRefs(&lootIdSet);
LootTemplates_Skinning.CheckLootRefs(&lootIdSet);
LootTemplates_Disenchant.CheckLootRefs(&lootIdSet);
LootTemplates_Prospecting.CheckLootRefs(&lootIdSet);
LootTemplates_Mail.CheckLootRefs(&lootIdSet);
LootTemplates_Reference.CheckLootRefs(&lootIdSet);
// output error for any still listed ids (not referenced from any loot table)
LootTemplates_Reference.ReportUnusedIds(ids_set);
LootTemplates_Reference.ReportUnusedIds(lootIdSet);
sLog->outString(">> Loaded refence loot templates in %u ms", GetMSTimeDiffToNow(oldMSTime));
sLog->outString();
+3 -1
View File
@@ -1544,7 +1544,7 @@ inline GridMap* Map::GetGrid(float x, float y)
return GridMaps[gx][gy];
}
float Map::GetWaterOrGroundLevel(float x, float y, float z, float* ground /*= NULL*/, bool swim /*= false*/) const
float Map::GetWaterOrGroundLevel(float x, float y, float z, float* ground /*= NULL*/, bool /*swim = false*/) const
{
if (const_cast<Map*>(this)->GetGrid(x, y))
{
@@ -2518,6 +2518,8 @@ void InstanceMap::PermBindAllPlayers(Player* source)
WorldPacket data(SMSG_INSTANCE_SAVE_CREATED, 4);
data << uint32(0);
player->GetSession()->SendPacket(&data);
player->GetSession()->SendCalendarRaidLockout(save, true);
}
// if the leader is not in the instance the group will not get a perm bind
+2 -2
View File
@@ -162,8 +162,8 @@ namespace Trinity
if (u->GetTypeId() == TYPEID_UNIT &&
(((Creature*)u)->isTotem() || ((Creature*)u)->isPet() ||
(((Creature*)u)->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL) ||
((Creature*)u)->GetCreatureInfo()->type == CREATURE_TYPE_CRITTER))
(((Creature*)u)->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_NO_XP_AT_KILL) ||
((Creature*)u)->GetCreatureTemplate()->type == CREATURE_TYPE_CRITTER))
gain = 0;
else
{
@@ -3422,4 +3422,105 @@ enum ActivateTaxiReply
ERR_TAXINOTSTANDING = 12
};
// Calendar - start
enum CalendarFlags
{
CALENDAR_FLAG_ALL_ALLOWED = 0x001,
CALENDAR_FLAG_INVITES_LOCKED = 0x010,
CALENDAR_FLAG_WITHOUT_INVITES = 0x040,
CALENDAR_FLAG_GUILD_ONLY = 0x400,
};
enum CalendarActionData
{
CALENDAR_ACTION_NONE,
CALENDAR_ACTION_ADD_EVENT,
CALENDAR_ACTION_MODIFY_EVENT,
CALENDAR_ACTION_REMOVE_EVENT,
CALENDAR_ACTION_COPY_EVENT,
CALENDAR_ACTION_ADD_EVENT_INVITE,
CALENDAR_ACTION_MODIFY_EVENT_INVITE,
CALENDAR_ACTION_MODIFY_MODERATOR_EVENT_INVITE,
CALENDAR_ACTION_REMOVE_EVENT_INVITE,
CALENDAR_ACTION_SIGNUP_TO_EVENT,
};
enum CalendarModerationRank
{
CALENDAR_RANK_PLAYER,
CALENDAR_RANK_MODERATOR,
CALENDAR_RANK_OWNER,
};
enum CalendarSendEventType
{
CALENDAR_SENDTYPE_GET,
CALENDAR_SENDTYPE_ADD,
CALENDAR_SENDTYPE_COPY,
};
enum CalendarEventType
{
CALENDAR_TYPE_RAID,
CALENDAR_TYPE_DUNGEON,
CALENDAR_TYPE_PVP,
CALENDAR_TYPE_MEETING,
CALENDAR_TYPE_OTHER,
};
enum CalendarInviteStatus
{
CALENDAR_STATUS_INVITED,
CALENDAR_STATUS_ACCEPTED,
CALENDAR_STATUS_DECLINED,
CALENDAR_STATUS_TENTATIVE,
CALENDAR_STATUS_OUT,
CALENDAR_STATUS_STANDBY,
CALENDAR_STATUS_CONFIRMED,
CALENDAR_STATUS_NO_OWNER,
CALENDAR_STATUS_8,
CALENDAR_STATUS_9,
};
enum CalendarError
{
CALENDAR_OK = 0,
CALENDAR_ERROR_GUILD_EVENTS_EXCEEDED = 1,
CALENDAR_ERROR_EVENTS_EXCEEDED = 2,
CALENDAR_ERROR_SELF_INVITES_EXCEEDED = 3,
CALENDAR_ERROR_OTHER_INVITES_EXCEEDED = 4,
CALENDAR_ERROR_PERMISSIONS = 5,
CALENDAR_ERROR_EVENT_INVALID = 6,
CALENDAR_ERROR_NOT_INVITED = 7,
CALENDAR_ERROR_INTERNAL = 8,
CALENDAR_ERROR_GUILD_PLAYER_NOT_IN_GUILD = 9,
CALENDAR_ERROR_ALREADY_INVITED_TO_EVENT_S = 10,
CALENDAR_ERROR_PLAYER_NOT_FOUND = 11,
CALENDAR_ERROR_NOT_ALLIED = 12,
CALENDAR_ERROR_IGNORING_YOU_S = 13,
CALENDAR_ERROR_INVITES_EXCEEDED = 14,
CALENDAR_ERROR_INVALID_DATE = 16,
CALENDAR_ERROR_INVALID_TIME = 17,
CALENDAR_ERROR_NEEDS_TITLE = 19,
CALENDAR_ERROR_EVENT_PASSED = 20,
CALENDAR_ERROR_EVENT_LOCKED = 21,
CALENDAR_ERROR_DELETE_CREATOR_FAILED = 22,
CALENDAR_ERROR_SYSTEM_DISABLED = 24,
CALENDAR_ERROR_RESTRICTED_ACCOUNT = 25,
CALENDAR_ERROR_ARENA_EVENTS_EXCEEDED = 26,
CALENDAR_ERROR_RESTRICTED_LEVEL = 27,
CALENDAR_ERROR_USER_SQUELCHED = 28,
CALENDAR_ERROR_NO_INVITE = 29,
CALENDAR_ERROR_EVENT_WRONG_SERVER = 36,
CALENDAR_ERROR_INVITE_WRONG_SERVER = 37,
CALENDAR_ERROR_NO_GUILD_INVITES = 38,
CALENDAR_ERROR_INVALID_SIGNUP = 39,
CALENDAR_ERROR_NO_MODERATOR = 40
};
// Calendar - end
#endif
+1 -4
View File
@@ -365,10 +365,7 @@ void MotionMaster::MoveJump(float x, float y, float z, float speedXY, float spee
init.SetParabolic(max_height,0);
init.SetVelocity(speedXY);
init.Launch();
if (_owner->GetTypeId() == TYPEID_PLAYER)
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED);
else
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_ACTIVE);
Mutate(new EffectMovementGenerator(id), MOTION_SLOT_CONTROLLED);
}
void MotionMaster::MoveFall(uint32 id/*=0*/)
+6 -1
View File
@@ -84,7 +84,12 @@ class MotionMaster //: private std::stack<MovementGenerator *>
//typedef std::stack<MovementGenerator *> Impl;
typedef MovementGenerator* _Ty;
void pop() { Impl[_top] = NULL; --_top; }
void pop()
{
Impl[_top] = NULL;
while (!top())
--_top;
}
void push(_Ty _Val) { ++_top; Impl[_top] = _Val; }
bool needInitTop() const { return _needInit[_top]; }
+3 -3
View File
@@ -38,7 +38,7 @@ class MovementGenerator
virtual void Reset(Unit &) = 0;
virtual bool Update(Unit &, const uint32 time_diff) = 0;
virtual bool Update(Unit &, const uint32& time_diff) = 0;
virtual MovementGeneratorType GetMovementGeneratorType() = 0;
@@ -64,7 +64,7 @@ class MovementGeneratorMedium : public MovementGenerator
//u->AssertIsType<T>();
(static_cast<D*>(this))->Reset(*((T*)&u));
}
bool Update(Unit &u, const uint32 time_diff)
bool Update(Unit &u, const uint32& time_diff)
{
//u->AssertIsType<T>();
return (static_cast<D*>(this))->Update(*((T*)&u), time_diff);
@@ -74,7 +74,7 @@ class MovementGeneratorMedium : public MovementGenerator
void Initialize(T &u);
void Finalize(T &u);
void Reset(T &u);
bool Update(T &u, const uint32 time_diff);
bool Update(T &u, const uint32& time_diff);
};
struct SelectableMovement : public FactoryHolder<MovementGenerator, MovementGeneratorType>
@@ -399,7 +399,7 @@ void TimedFleeingMovementGenerator::Finalize(Unit &owner)
}
}
bool TimedFleeingMovementGenerator::Update(Unit & owner, const uint32 time_diff)
bool TimedFleeingMovementGenerator::Update(Unit & owner, const uint32& time_diff)
{
if (!owner.isAlive())
return false;
@@ -64,7 +64,7 @@ class TimedFleeingMovementGenerator
i_totalFleeTime(time) {}
MovementGeneratorType GetMovementGeneratorType() { return TIMED_FLEEING_MOTION_TYPE; }
bool Update(Unit &, const uint32);
bool Update(Unit &, const uint32&);
void Finalize(Unit &);
private:
@@ -35,9 +35,6 @@ void HomeMovementGenerator<Creature>::Reset(Creature &)
void HomeMovementGenerator<Creature>::_setTargetLocation(Creature & owner)
{
if (!&owner)
return;
if (owner.HasUnitState(UNIT_STATE_ROOT | UNIT_STATE_STUNNED | UNIT_STATE_DISTRACTED))
return;
@@ -49,7 +49,7 @@ void RotateMovementGenerator::Initialize(Unit& owner)
owner.AttackStop();
}
bool RotateMovementGenerator::Update(Unit& owner, const uint32 diff)
bool RotateMovementGenerator::Update(Unit& owner, const uint32& diff)
{
float angle = owner.GetOrientation();
if (m_direction == ROTATE_DIRECTION_LEFT)
@@ -93,7 +93,7 @@ DistractMovementGenerator::Finalize(Unit& owner)
}
bool
DistractMovementGenerator::Update(Unit& /*owner*/, const uint32 time_diff)
DistractMovementGenerator::Update(Unit& /*owner*/, const uint32& time_diff)
{
if (time_diff > m_timer)
return false;

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