diff options
18 files changed, 272 insertions, 83 deletions
diff --git a/sql/updates/world/2013_10_16_00_world_trinity_string.sql b/sql/updates/world/2013_10_16_00_world_trinity_string.sql new file mode 100644 index 00000000000..be77dd1b01c --- /dev/null +++ b/sql/updates/world/2013_10_16_00_world_trinity_string.sql @@ -0,0 +1,4 @@ +DELETE FROM `trinity_string` WHERE entry IN (1149, 1150); +INSERT INTO `trinity_string` (entry, content_default, content_loc1, content_loc2, content_loc3, content_loc4, content_loc5, content_loc6, content_loc7, content_loc8) VALUES +(1149, 'Group type: %s and consists of %u players.', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL), +(1150, 'Name: %s (%s), Zone: %s, Phase: %u, GUID: %u, Flags: %s, Roles: %s', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL); diff --git a/sql/updates/world/2013_10_20_00_world_spell_proc_event.sql b/sql/updates/world/2013_10_20_00_world_spell_proc_event.sql new file mode 100644 index 00000000000..90bf4619de4 --- /dev/null +++ b/sql/updates/world/2013_10_20_00_world_spell_proc_event.sql @@ -0,0 +1,3 @@ +-- Fixes Ormorok the Tree Shaper Spell Reflect +DELETE FROM `spell_proc_event` WHERE (`entry` = '47981'); +INSERT INTO `spell_proc_event` (`entry`,`procEx`) VALUES ('47981','2048'); diff --git a/sql/updates/world/2013_10_20_02_world_gossip.sql b/sql/updates/world/2013_10_20_02_world_gossip.sql new file mode 100644 index 00000000000..934334800d5 --- /dev/null +++ b/sql/updates/world/2013_10_20_02_world_gossip.sql @@ -0,0 +1,96 @@ +-- DB/Gossip: Update some data for trainer NPCs from sniffs +SET @ALLCLASMASK := 1535; +SET @CLASSMASK_PAL := 2; +SET @CLASSMASK_HUN := 4; +SET @CLASSMASK_MAGE := 128; +SET @CLASSMASK_DRU := 1024; + +SET @TRAINEROPT := 0; +SET @TALENTOPT := 1; + +-- NPCS: +-- Milstaff Stormeye, 2489, Mage trainer 15050_2012-01-29_21-59-26_aliance_pali_Trainers_with_mage.pkt +SET @MENU1 := 4823; +SET @TEXTOK1 := 5878; +SET @TEXTERR1 := 5877; + +-- Kal, 3602, Druid trainer, source https://gist.github.com/Kinzcool/a34dce9b128e6cc5ca6d +SET @MENU2 := 3923; +SET @TEXTOK2 := 4779; +SET @TEXTERR2 := 4780; + +-- Dargh Trueaim, 10930, Hunter trainer, source https://gist.github.com/Kinzcool/a34dce9b128e6cc5ca6d +SET @NPC3 := 10930; +SET @MENU3 := 4674; +SET @TEXT3 := 5000; + +-- Ysuria, 27703, Mage trainer, source https://gist.github.com/Kinzcool/a34dce9b128e6cc5ca6d +SET @MENU4 := 9581; + +-- Brother Wilhelm, 927, Paladin trainer, verified that only has training option with TDB434, UDB +SET @MENU5 := 4664; +SET @TEXTOK5 := 3976; +SET @TEXTERR5 := 3977; + +-- Gart Mistrunner, 3060, Druid trainer, verified that only has training option with TDB434 +SET @MENU6 := 4644; +SET @TEXTOK6 := 5716; +SET @TEXTERR6 := 5717; + +-- Archmage Celindra, 29156, Mage trainer, verified that only has training option with TDB434, UDB +SET @MENU7 := 9777; +SET @TEXTOK7 := 13456; +SET @TEXTERR7 := 13455; + +-- Deal with the new data +DELETE FROM `gossip_menu` WHERE +(`entry` = @MENU1 AND `text_id` = @TEXTOK1) +OR (`entry` = @MENU2 AND `text_id` = @TEXTOK2) +OR (`entry` = @MENU3 AND `text_id` = @TEXT3); + +DELETE FROM `gossip_menu_option` WHERE +(`menu_id` = @MENU1 AND `id` = @TRAINEROPT) +OR (`menu_id` = @MENU2 AND `id` IN (@TRAINEROPT, @TALENTOPT)); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 14 AND +( + (`SourceEntry` IN (@TEXTOK1, @TEXTERR1) AND `SourceGroup` = @MENU1) + OR (`SourceEntry` IN (@TEXTOK2, @TEXTERR2) AND `SourceGroup` = @MENU2) + OR (`SourceEntry` IN (@TEXTOK5, @TEXTERR5) AND `SourceGroup` = @MENU5) + OR (`SourceEntry` IN (@TEXTOK6, @TEXTERR6) AND `SourceGroup` = @MENU6) + OR (`SourceEntry` IN (@TEXTOK7, @TEXTERR7) AND `SourceGroup` = @MENU7) +); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 15 AND `SourceEntry` = @TRAINEROPT AND `SourceGroup` IN (@MENU1, @MENU4, @MENU5, @MENU6, @MENU7); +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId` = 15 AND `SourceEntry` IN (@TRAINEROPT, @TALENTOPT) AND `SourceGroup` = @MENU2; + +INSERT INTO `gossip_menu` (entry, text_id) VALUES +(@MENU1, @TEXTOK1), +(@MENU2, @TEXTOK2), +(@MENU3, @TEXT3); + +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 +(@MENU1, @TRAINEROPT, 3, 'Please teach me.', 5, 16, 0, 0, 0, 0, ''), +(@MENU2, @TRAINEROPT, 3, 'I seek training as a druid.', 5, 16, 0, 0, 0, 0, ''), +(@MENU2, @TALENTOPT, 0, 'I wish to unlearn my talents.', 16, 16, 0, 0, 0, 0, ''); + +INSERT INTO `conditions` (SourceTypeOrReferenceId, SourceGroup, SourceEntry, SourceId, ElseGroup, ConditionTypeOrReference, ConditionTarget, ConditionValue1, ConditionValue2, ConditionValue3, NegativeCondition, ErrorType, ErrorTextId, ScriptName, Comment) VALUES +(14, @MENU1, @TEXTOK1, 0, 0, 15, 0, @CLASSMASK_MAGE, 0, 0, 0, 0, 0, '', 'Show gossip text if player is a Mage'), +(14, @MENU1, @TEXTERR1, 0, 0, 15, 0, (@ALLCLASMASK & ~@CLASSMASK_MAGE), 0, 0, 0, 0, 0, '', 'Show gossip text if player is not a Mage'), +(15, @MENU1, @TRAINEROPT, 0, 0, 15, 0, @CLASSMASK_MAGE, 0, 0, 0, 0, 0, '', 'Show gossip option if player is a Mage'), +(14, @MENU2, @TEXTOK2, 0, 0, 15, 0, @CLASSMASK_DRU, 0, 0, 0, 0, 0, '', 'Show gossip text if player is a Druid'), +(14, @MENU2, @TEXTERR2, 0, 0, 15, 0, (@ALLCLASMASK & ~@CLASSMASK_DRU), 0, 0, 0, 0, 0, '', 'Show gossip text if player is not a Druid'), +(15, @MENU2, @TRAINEROPT, 0, 0, 15, 0, @CLASSMASK_DRU, 0, 0, 0, 0, 0, '', 'Show gossip option if player is a Druid'), +(15, @MENU2, @TALENTOPT, 0, 0, 15, 0, @CLASSMASK_DRU, 0, 0, 0, 0, 0, '', 'Show gossip option if player is a Druid'), +(15, @MENU4, @TRAINEROPT, 0, 0, 15, 0, @CLASSMASK_MAGE, 0, 0, 0, 0, 0, '', 'Show gossip option if player is a Mage'), +(14, @MENU5, @TEXTOK5, 0, 0, 15, 0, @CLASSMASK_PAL, 0, 0, 0, 0, 0, '', 'Show gossip text if player is a Paladin'), +(14, @MENU5, @TEXTERR5, 0, 0, 15, 0, (@ALLCLASMASK & ~@CLASSMASK_PAL), 0, 0, 0, 0, 0, '', 'Show gossip text if player is not a Paladin'), +(15, @MENU5, @TRAINEROPT, 0, 0, 15, 0, @CLASSMASK_PAL, 0, 0, 0, 0, 0, '', 'Show gossip option if player is a Paladin'), +(14, @MENU6, @TEXTOK6, 0, 0, 15, 0, @CLASSMASK_PAL, 0, 0, 0, 0, 0, '', 'Show gossip text if player is a Druid'), +(14, @MENU6, @TEXTERR6, 0, 0, 15, 0, (@ALLCLASMASK & ~@CLASSMASK_PAL), 0, 0, 0, 0, 0, '', 'Show gossip text if player is not a Druid'), +(15, @MENU6, @TRAINEROPT, 0, 0, 15, 0, @CLASSMASK_PAL, 0, 0, 0, 0, 0, '', 'Show gossip option if player is a Druid'), +(14, @MENU7, @TEXTOK7, 0, 0, 15, 0, @CLASSMASK_MAGE, 0, 0, 0, 0, 0, '', 'Show gossip text if player is a Mage'), +(14, @MENU7, @TEXTERR7, 0, 0, 15, 0, (@ALLCLASMASK & ~@CLASSMASK_MAGE), 0, 0, 0, 0, 0, '', 'Show gossip text if player is not a Mage'), +(15, @MENU7, @TRAINEROPT, 0, 0, 15, 0, @CLASSMASK_MAGE, 0, 0, 0, 0, 0, '', 'Show gossip option if player is a Mage'); + +UPDATE `creature_template` SET `gossip_menu_id` = @MENU3 WHERE `entry` = @NPC3; diff --git a/sql/updates/world/2013_10_21_00_world_sai.sql b/sql/updates/world/2013_10_21_00_world_sai.sql new file mode 100644 index 00000000000..acd070675f1 --- /dev/null +++ b/sql/updates/world/2013_10_21_00_world_sai.sql @@ -0,0 +1,23 @@ +-- 12180 The Captive Prospectors +UPDATE `smart_scripts` SET `link`=1 WHERE `entryorguid`IN(27113,27114,27115) AND `source_type`=0 AND `id`=0; +DELETE FROM `smart_scripts` WHERE `entryorguid`IN(27113,27114,27115) AND `id`=1; +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 +(27113,0,1,0,61,0,100,0,0,0,0,0,33,27113,0,0,0,0,0,7,0,0,0,0,0,0,0,'Prospector Gann - On Spell Hit - Give Kill Credit'), +(27114,0,1,0,61,0,100,0,0,0,0,0,33,27114,0,0,0,0,0,7,0,0,0,0,0,0,0,'Prospector Torgan - On Spell Hit - Give Kill Credit'), +(27115,0,1,0,61,0,100,0,0,0,0,0,33,27115,0,0,0,0,0,7,0,0,0,0,0,0,0,'Prospector Veranna - On Spell Hit - Give Kill Credit'); + +-- [11150] Raze Direhorn Post! +-- [11205] Raze Direhorn Post! +UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry` IN(23751,23752,23753); +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (23751,23752,23753); +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 +(23751, 0, 0, 0, 8, 0, 100, 0, 42356, 0, 0, 0, 33, 23751 , 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'North Tent - On Spellhit - Kill Credit'), +(23752, 0, 0, 0, 8, 0, 100, 0, 42356, 0, 0, 0, 33, 23752 , 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'Northeast Tent - On Spellhit - Kill Credit'), +(23753, 0, 0, 0, 8, 0, 100, 0, 42356, 0, 0, 0, 33, 23753 , 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 'East Tent - On Spellhit - Kill Credit'); +-- Know Your Ley Lines [11547] +UPDATE `creature_template` SET `AIName`= 'SmartAI' WHERE `entry` IN (25156,25154,25157); +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (25156,25154,25157) 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 +(25156,0,0,0,8,0,100,0,45191,0,0,0,33,25156,0,0,0,0,0,7,0,0,0,0,0,0,0,'Sunwell - Quest Bunny - Portal - On Spell Hit(Sample Ley Line Field) - Give Quest Credit'), +(25154,0,0,0,8,0,100,0,45191,0,0,0,33,25154,0,0,0,0,0,7,0,0,0,0,0,0,0,'Sunwell - Quest Bunny - Shrine - On Spell Hit(Sample Ley Line Field) - Give Quest Credit'), +(25157,0,0,0,8,0,100,0,45191,0,0,0,33,25157,0,0,0,0,0,7,0,0,0,0,0,0,0,'Sunwell - Quest Bunny - Sunwell - On Spell Hit(Sample Ley Line Field) - Give Quest Credit'); diff --git a/src/server/game/AI/SmartScripts/SmartScript.cpp b/src/server/game/AI/SmartScripts/SmartScript.cpp index f01d0d1ab03..7ea6895d028 100644 --- a/src/server/game/AI/SmartScripts/SmartScript.cpp +++ b/src/server/game/AI/SmartScripts/SmartScript.cpp @@ -252,7 +252,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u { if (IsUnit(*itr)) { - (*itr)->SendPlaySound(e.action.sound.sound, e.action.sound.onlySelf > 0 ? true : false); + (*itr)->SendPlaySound(e.action.sound.sound, e.action.sound.onlySelf > 0); TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_SOUND: target: %s (GuidLow: %u), sound: %u, onlyself: %u", (*itr)->GetName().c_str(), (*itr)->GetGUIDLow(), e.action.sound.sound, e.action.sound.onlySelf); } @@ -516,7 +516,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS) me->InterruptNonMeleeSpells(false); - me->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) ? true : false); + me->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED)); TC_LOG_DEBUG(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); } @@ -547,7 +547,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (e.action.cast.flags & SMARTCAST_INTERRUPT_PREVIOUS) tempLastInvoker->InterruptNonMeleeSpells(false); - tempLastInvoker->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) ? true : false); + tempLastInvoker->CastSpell((*itr)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED)); TC_LOG_DEBUG(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); } @@ -697,7 +697,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!IsSmart()) break; - CAST_AI(SmartAI, me->AI())->SetAutoAttack(e.action.autoAttack.attack ? true : false); + CAST_AI(SmartAI, me->AI())->SetAutoAttack(e.action.autoAttack.attack); TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_AUTO_ATTACK: Creature: %u bool on = %u", me->GetGUIDLow(), e.action.autoAttack.attack); break; @@ -707,7 +707,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!IsSmart()) break; - bool move = e.action.combatMove.move ? true : false; + bool move = e.action.combatMove.move; CAST_AI(SmartAI, me->AI())->SetCombatMove(move); TC_LOG_DEBUG(LOG_FILTER_DATABASE_AI, "SmartScript::ProcessAction:: SMART_ACTION_ALLOW_COMBAT_MOVEMENT: Creature %u bool on = %u", me->GetGUIDLow(), e.action.combatMove.move); @@ -1282,7 +1282,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!IsSmart()) break; - CAST_AI(SmartAI, me->AI())->SetFly(e.action.setFly.fly ? true : false); + CAST_AI(SmartAI, me->AI())->SetFly(e.action.setFly.fly); break; } case SMART_ACTION_SET_RUN: @@ -1290,7 +1290,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!IsSmart()) break; - CAST_AI(SmartAI, me->AI())->SetRun(e.action.setRun.run ? true : false); + CAST_AI(SmartAI, me->AI())->SetRun(e.action.setRun.run); break; } case SMART_ACTION_SET_SWIM: @@ -1298,7 +1298,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!IsSmart()) break; - CAST_AI(SmartAI, me->AI())->SetSwim(e.action.setSwim.swim ? true : false); + CAST_AI(SmartAI, me->AI())->SetSwim(e.action.setSwim.swim); break; } case SMART_ACTION_WP_START: @@ -1306,9 +1306,9 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u if (!IsSmart()) break; - bool run = e.action.wpStart.run ? true : false; + bool run = e.action.wpStart.run; uint32 entry = e.action.wpStart.pathID; - bool repeat = e.action.wpStart.repeat ? true : false; + bool repeat = e.action.wpStart.repeat; ObjectList* targets = GetTargets(e, unit); StoreTargetList(targets, SMART_ESCORT_TARGETS); me->SetReactState((ReactStates)e.action.wpStart.reactState); @@ -1336,7 +1336,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u uint32 DespawnTime = e.action.wpStop.despawnTime; uint32 quest = e.action.wpStop.quest; - bool fail = e.action.wpStop.fail ? true : false; + bool fail = e.action.wpStop.fail; CAST_AI(SmartAI, me->AI())->StopPath(DespawnTime, quest, fail); break; } @@ -1689,7 +1689,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u interruptedSpell = true; } - (*itr)->ToUnit()->CastSpell((*it)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED) ? true : false); + (*itr)->ToUnit()->CastSpell((*it)->ToUnit(), e.action.cast.spell, (e.action.cast.flags & SMARTCAST_TRIGGERED)); } else TC_LOG_DEBUG(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())); @@ -2050,7 +2050,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsCreature(*itr)) - (*itr)->ToCreature()->setRegeneratingHealth(e.action.setHealthRegen.regenHealth ? true : false); + (*itr)->ToCreature()->setRegeneratingHealth(e.action.setHealthRegen.regenHealth); delete targets; break; @@ -2063,7 +2063,7 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u for (ObjectList::const_iterator itr = targets->begin(); itr != targets->end(); ++itr) if (IsCreature(*itr)) - (*itr)->ToCreature()->SetControlled(e.action.setRoot.root ? true : false, UNIT_STATE_ROOT); + (*itr)->ToCreature()->SetControlled(e.action.setRoot.root, UNIT_STATE_ROOT); delete targets; break; @@ -2519,7 +2519,7 @@ ObjectList* SmartScript::GetTargets(SmartScriptHolder const& e, Unit* invoker /* } case SMART_TARGET_CLOSEST_CREATURE: { - Creature* target = GetClosestCreatureWithEntry(baseObject, e.target.closest.entry, (float)(e.target.closest.dist ? e.target.closest.dist : 100), e.target.closest.dead ? false : true); + Creature* target = GetClosestCreatureWithEntry(baseObject, e.target.closest.entry, (float)(e.target.closest.dist ? e.target.closest.dist : 100), !e.target.closest.dead); if (target) l->push_back(target); break; @@ -2686,7 +2686,7 @@ void SmartScript::ProcessEvent(SmartScriptHolder& e, Unit* unit, uint32 var0, ui ProcessTimedAction(e, e.event.minMaxRepeat.repeatMin, e.event.minMaxRepeat.repeatMax, me->GetVictim()); break; } - case SMART_EVENT_TARGET_CASTING: + case SMART_EVENT_VICTIM_CASTING: { if (!me || !me->IsInCombat()) return; @@ -3148,7 +3148,7 @@ void SmartScript::UpdateTimer(SmartScriptHolder& e, uint32 const diff) case SMART_EVENT_MANA_PCT: case SMART_EVENT_TARGET_MANA_PCT: case SMART_EVENT_RANGE: - case SMART_EVENT_TARGET_CASTING: + case SMART_EVENT_VICTIM_CASTING: case SMART_EVENT_FRIENDLY_HEALTH: case SMART_EVENT_FRIENDLY_IS_CC: case SMART_EVENT_FRIENDLY_MISSING_BUFF: diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index 361cf025647..87c35d59cc0 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -438,7 +438,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e) if (e.event.kill.creature && !IsCreatureValid(e, e.event.kill.creature)) return false; break; - case SMART_EVENT_TARGET_CASTING: + case SMART_EVENT_VICTIM_CASTING: if (e.event.targetCasting.spellId > 0 && !sSpellMgr->GetSpellInfo(e.event.targetCasting.spellId)) { sLog->outError(LOG_FILTER_SQL, "SmartAIMgr: Entry %d SourceType %u Event %u Action %u uses non-existent Spell entry %u, skipped.", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType(), e.event.spellHit.spell); diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.h b/src/server/game/AI/SmartScripts/SmartScriptMgr.h index f12f2ab69c0..7ed8e60ed44 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.h +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.h @@ -94,7 +94,7 @@ enum SMART_EVENT SMART_EVENT_OOC_LOS = 10, // NoHostile, MaxRnage, CooldownMin, CooldownMax SMART_EVENT_RESPAWN = 11, // type, MapId, ZoneId SMART_EVENT_TARGET_HEALTH_PCT = 12, // HPMin%, HPMax%, RepeatMin, RepeatMax - SMART_EVENT_TARGET_CASTING = 13, // RepeatMin, RepeatMax, spellid + SMART_EVENT_VICTIM_CASTING = 13, // RepeatMin, RepeatMax, spellid SMART_EVENT_FRIENDLY_HEALTH = 14, // HPDeficit, Radius, RepeatMin, RepeatMax SMART_EVENT_FRIENDLY_IS_CC = 15, // Radius, RepeatMin, RepeatMax SMART_EVENT_FRIENDLY_MISSING_BUFF = 16, // SpellId, Radius, RepeatMin, RepeatMax @@ -1196,7 +1196,7 @@ const uint32 SmartAIEventMask[SMART_EVENT_END][2] = {SMART_EVENT_OOC_LOS, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_RESPAWN, SMART_SCRIPT_TYPE_MASK_CREATURE + SMART_SCRIPT_TYPE_MASK_GAMEOBJECT }, {SMART_EVENT_TARGET_HEALTH_PCT, SMART_SCRIPT_TYPE_MASK_CREATURE }, - {SMART_EVENT_TARGET_CASTING, SMART_SCRIPT_TYPE_MASK_CREATURE }, + {SMART_EVENT_VICTIM_CASTING, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_FRIENDLY_HEALTH, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_FRIENDLY_IS_CC, SMART_SCRIPT_TYPE_MASK_CREATURE }, {SMART_EVENT_FRIENDLY_MISSING_BUFF, SMART_SCRIPT_TYPE_MASK_CREATURE }, diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index af92f0e9df4..6d940623963 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -105,7 +105,11 @@ void GameObject::CleanupsBeforeDelete(bool /*finalCleanup*/) RemoveFromOwner(); if (GetTransport() && !ToTransport()) + { GetTransport()->RemovePassenger(this); + SetTransport(NULL); + m_movementInfo.transport.Reset(); + } } void GameObject::RemoveFromOwner() diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 40dbe6c2fe7..eaee6dc090a 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -923,9 +923,6 @@ void Player::CleanupsBeforeDelete(bool finalCleanup) Unit::CleanupsBeforeDelete(finalCleanup); - if (m_transport) - m_transport->RemovePassenger(this); - // clean up player-instance binds, may unload some instance saves for (uint8 i = 0; i < MAX_DIFFICULTY; ++i) for (BoundInstancesMap::iterator itr = m_boundInstances[i].begin(); itr != m_boundInstances[i].end(); ++itr) @@ -2181,8 +2178,26 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati if (!(options & TELE_TO_NOT_LEAVE_COMBAT)) CombatStop(); + // new final coordinates + float final_x = x; + float final_y = y; + float final_z = z; + float final_o = orientation; + + // Calculate final positions if on transport + if (m_transport) + { + float tx, ty, tz, to; + m_movementInfo.transport.pos.GetPosition(tx, ty, tz, to); + + final_x = x + tx * std::cos(orientation) - ty * std::sin(orientation); + final_y = y + ty * std::cos(orientation) + tx * std::sin(orientation); + final_z = z + tz; + final_o = Position::NormalizeOrientation(orientation + m_movementInfo.transport.pos.GetOrientation()); + } + // this will be used instead of the current location in SaveToDB - m_teleport_dest = WorldLocation(mapid, x, y, z, orientation); + m_teleport_dest = WorldLocation(mapid, final_x, final_y, final_z, final_o); SetFallInformation(0, z); // code for finish transfer called in WorldSession::HandleMovementOpcodes() @@ -2193,7 +2208,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati { Position oldPos; GetPosition(&oldPos); - Relocate(x, y, z, orientation); + Relocate(final_x, final_y, final_z, final_o); SendTeleportAckPacket(); SendTeleportPacket(oldPos); // this automatically relocates to oldPos in order to broadcast the packet in the right place } @@ -2295,16 +2310,20 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati float final_z = z; float final_o = orientation; + // Calculate final positions if on transport if (m_transport) { - final_x += m_movementInfo.transport.pos.GetPositionX(); - final_y += m_movementInfo.transport.pos.GetPositionY(); - final_z += m_movementInfo.transport.pos.GetPositionZ(); - final_o += m_movementInfo.transport.pos.GetOrientation(); + float tx, ty, tz, to; + m_movementInfo.transport.pos.GetPosition(tx, ty, tz, to); + + final_x = x + tx * std::cos(orientation) - ty * std::sin(orientation); + final_y = y + ty * std::cos(orientation) + tx * std::sin(orientation); + final_z = z + tz; + final_o = Position::NormalizeOrientation(orientation + m_movementInfo.transport.pos.GetOrientation()); } m_teleport_dest = WorldLocation(mapid, final_x, final_y, final_z, final_o); - SetFallInformation(0, final_z); + SetFallInformation(0, z); // if the player is saved before worldportack (at logout for example) // this will be used instead of the current location in SaveToDB @@ -15459,9 +15478,6 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg) // can be start if only all quests in prev quest exclusive group completed and rewarded ObjectMgr::ExclusiveQuestGroupsBounds range(sObjectMgr->mExclusiveQuestGroups.equal_range(qPrevInfo->GetExclusiveGroup())); - // always must be found if qPrevInfo->ExclusiveGroup != 0 - ASSERT(range.first != range.second); - for (; range.first != range.second; ++range.first) { uint32 exclude_Id = range.first->second; @@ -15495,9 +15511,6 @@ bool Player::SatisfyQuestPreviousQuest(Quest const* qInfo, bool msg) // can be start if only all quests in prev quest exclusive group active ObjectMgr::ExclusiveQuestGroupsBounds range(sObjectMgr->mExclusiveQuestGroups.equal_range(qPrevInfo->GetExclusiveGroup())); - // always must be found if qPrevInfo->ExclusiveGroup != 0 - ASSERT(range.first != range.second); - for (; range.first != range.second; ++range.first) { uint32 exclude_Id = range.first->second; @@ -15665,9 +15678,6 @@ bool Player::SatisfyQuestExclusiveGroup(Quest const* qInfo, bool msg) ObjectMgr::ExclusiveQuestGroupsBounds range(sObjectMgr->mExclusiveQuestGroups.equal_range(qInfo->GetExclusiveGroup())); - // always must be found if qInfo->ExclusiveGroup != 0 - ASSERT(range.first != range.second); - for (; range.first != range.second; ++range.first) { uint32 exclude_Id = range.first->second; diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index 06af4244246..30b7b61f574 100644 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -181,8 +181,8 @@ void Transport::Update(uint32 diff) float t = CalculateSegmentPos(float(timer) * 0.001f); G3D::Vector3 pos, dir; _currentFrame->Spline->evaluate_percent(_currentFrame->Index, t, pos); - //_currentFrame->Spline->evaluate_derivative(_currentFrame->Index, t, dir); - UpdatePosition(pos.x, pos.y, pos.z, 0.0f/*atan2(dir.x, dir.y)*/); + _currentFrame->Spline->evaluate_derivative(_currentFrame->Index, t, dir); + UpdatePosition(pos.x, pos.y, pos.z, atan2(dir.x, dir.y)); } } @@ -450,40 +450,19 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) } } - // Teleport passengers after everyone on destination map are sent create packet - // but before transport itself is registered there and begins updating - for (std::set<WorldObject*>::iterator itr = _staticPassengers.begin(); itr != _staticPassengers.end(); ++itr) + for (std::set<WorldObject*>::iterator itr = _passengers.begin(); itr != _passengers.end();) { - switch ((*itr)->GetTypeId()) - { - case TYPEID_UNIT: - (*itr)->ToCreature()->FarTeleportTo(newMap, x, y, z, (*itr)->GetOrientation()); - break; - case TYPEID_GAMEOBJECT: - { - GameObject* go = (*itr)->ToGameObject(); - go->GetMap()->RemoveFromMap(go, false); - Relocate(x, y, z, go->GetOrientation()); - SetMap(newMap); - newMap->AddToMap(go); - break; - } - default: - break; - } - } + WorldObject* obj = (*itr++); - for (std::set<WorldObject*>::iterator itr = _passengers.begin(); itr != _passengers.end(); ++itr) - { - switch ((*itr)->GetTypeId()) + switch (obj->GetTypeId()) { case TYPEID_UNIT: - if (!IS_PLAYER_GUID((*itr)->ToUnit()->GetOwnerGUID())) // pets should be teleported with player - (*itr)->ToCreature()->FarTeleportTo(newMap, x, y, z, (*itr)->GetOrientation()); + if (!IS_PLAYER_GUID(obj->ToUnit()->GetOwnerGUID())) // pets should be teleported with player + obj->ToCreature()->FarTeleportTo(newMap, x, y, z, obj->GetOrientation()); break; case TYPEID_GAMEOBJECT: { - GameObject* go = (*itr)->ToGameObject(); + GameObject* go = obj->ToGameObject(); go->GetMap()->RemoveFromMap(go, false); Relocate(x, y, z, go->GetOrientation()); SetMap(newMap); @@ -491,7 +470,8 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z) break; } case TYPEID_PLAYER: - (*itr)->ToPlayer()->TeleportTo(newMapid, x, y, z, (*itr)->GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT); + if (!obj->ToPlayer()->TeleportTo(newMapid, x, y, z, GetOrientation(), TELE_TO_NOT_LEAVE_TRANSPORT)) + _passengers.erase(obj); break; default: break; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 2fd1c500305..c3a611c441f 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -7575,7 +7575,7 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp CastSpell(this, 28682, true); - return (procEx & PROC_EX_CRITICAL_HIT) ? true : false; + return (procEx & PROC_EX_CRITICAL_HIT); } // Empowered Fire case 31656: @@ -8914,6 +8914,9 @@ bool Unit::Attack(Unit* victim, bool meleeAttack) if (GetTypeId() == TYPEID_PLAYER && IsMounted()) return false; + if (HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED)) + return false; + // nobody can attack GM in GM-mode if (victim->GetTypeId() == TYPEID_PLAYER) { @@ -13349,7 +13352,7 @@ void Unit::SetPower(Powers power, uint32 val) data.append(GetPackGUID()); data << uint8(power); data << uint32(val); - SendMessageToSet(&data, GetTypeId() == TYPEID_PLAYER ? true : false); + SendMessageToSet(&data, GetTypeId() == TYPEID_PLAYER); // group update if (Player* player = ToPlayer()) @@ -13499,9 +13502,12 @@ void Unit::CleanupsBeforeDelete(bool finalCleanup) { CleanupBeforeRemoveFromMap(finalCleanup); - if (Creature* thisCreature = ToCreature()) - if (GetTransport()) - GetTransport()->RemovePassenger(thisCreature); + if (GetTransport()) + { + GetTransport()->RemovePassenger(this); + SetTransport(NULL); + m_movementInfo.transport.Reset(); + } } void Unit::UpdateCharmAI() diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index d6f96f79cc1..3309a8c010e 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -2301,7 +2301,10 @@ void AuraEffect::HandleAuraModPacify(AuraApplication const* aurApp, uint8 mode, Unit* target = aurApp->GetTarget(); if (apply) + { target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PACIFIED); + target->AttackStop(); + } else { // do not remove unit flag if there are more than this auraEffect of that kind on unit on unit diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 2eee80924a4..aa629b46e28 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2680,7 +2680,9 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit* unit, uint32 effectMask, bool scaleA m_diminishLevel = unit->GetDiminishing(m_diminishGroup); DiminishingReturnsType type = GetDiminishingReturnsGroupType(m_diminishGroup); // Increase Diminishing on unit, current informations for actually casts will use values above - if ((type == DRTYPE_PLAYER && unit->GetCharmerOrOwnerPlayerOrPlayerItself()) || type == DRTYPE_ALL) + if ((type == DRTYPE_PLAYER && + (unit->GetCharmerOrOwnerPlayerOrPlayerItself() || (unit->GetTypeId() == TYPEID_UNIT && unit->ToCreature()->GetCreatureTemplate()->flags_extra & CREATURE_FLAG_EXTRA_ALL_DIMINISH))) || + type == DRTYPE_ALL) unit->IncrDiminishing(m_diminishGroup); } diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 562d7fee518..0732c389bfa 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1150,10 +1150,15 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/) orientation = m_targets.GetUnitTarget()->GetOrientation(); TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTeleportUnits - teleport unit to %u %f %f %f %f\n", mapid, x, y, z, orientation); - if (mapid == unitTarget->GetMapId()) - unitTarget->NearTeleportTo(x, y, z, orientation, unitTarget == m_caster); - else if (unitTarget->GetTypeId() == TYPEID_PLAYER) + if (unitTarget->GetTypeId() == TYPEID_PLAYER) unitTarget->ToPlayer()->TeleportTo(mapid, x, y, z, orientation, unitTarget == m_caster ? TELE_TO_SPELL : 0); + else if (mapid == unitTarget->GetMapId()) + unitTarget->NearTeleportTo(x, y, z, orientation, unitTarget == m_caster); + else + { + TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTeleportUnits - spellId %u attempted to teleport creature to a different map.", m_spellInfo->Id); + return; + } // post effects for TARGET_DEST_DB switch (m_spellInfo->Id) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index ff89cc61f6f..52ffb2ff525 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -191,6 +191,13 @@ DiminishingGroup GetDiminishingReturnsGroupForSpell(SpellInfo const* spellproto, return DIMINISHING_FEAR; break; } + case SPELLFAMILY_SHAMAN: + { + // Storm, Earth and Fire - Earthgrab + if (spellproto->SpellFamilyFlags[2] & 0x4000) + return DIMINISHING_NONE; + break; + } case SPELLFAMILY_DEATHKNIGHT: { // Hungering Cold (no flags) diff --git a/src/server/scripts/Commands/cs_group.cpp b/src/server/scripts/Commands/cs_group.cpp index 8c38d954203..1c0949398b9 100644 --- a/src/server/scripts/Commands/cs_group.cpp +++ b/src/server/scripts/Commands/cs_group.cpp @@ -260,24 +260,36 @@ public: static bool HandleGroupListCommand(ChatHandler* handler, char const* args) { + // Get ALL the variables! Player* playerTarget; + uint32 phase = 0; + uint32 groupCounter = 0; uint64 guidTarget; std::string nameTarget; + std::string zoneName; + const char* onlineState = ""; + // Parse the guid to uint32... uint32 parseGUID = MAKE_NEW_GUID(atol((char*)args), 0, HIGHGUID_PLAYER); + // ... and try to extract a player out of it. if (sObjectMgr->GetPlayerNameByGUID(parseGUID, nameTarget)) { playerTarget = sObjectMgr->GetPlayerByLowGUID(parseGUID); guidTarget = parseGUID; } + // If not, we return false and end right away. else if (!handler->extractPlayerTarget((char*)args, &playerTarget, &guidTarget, &nameTarget)) return false; + // Next, we need a group. So we define a group variable. Group* groupTarget = NULL; + + // We try to extract a group from an online player. if (playerTarget) groupTarget = playerTarget->GetGroup(); + // If not, we extract it from the SQL. if (!groupTarget) { PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_GROUP_MEMBER); @@ -287,6 +299,7 @@ public: groupTarget = sGroupMgr->GetGroupByDbStoreId((*resultGroup)[0].GetUInt32()); } + // If both fails, players simply has no party. Return false. if (!groupTarget) { handler->PSendSysMessage(LANG_GROUP_NOT_IN_GROUP, nameTarget.c_str()); @@ -294,12 +307,20 @@ public: return false; } - handler->PSendSysMessage(LANG_GROUP_TYPE, (groupTarget->isRaidGroup() ? "raid" : "party")); + // We get the group members after successfully detecting a group. Group::MemberSlotList const& members = groupTarget->GetMemberSlots(); + + // To avoid a cluster fuck, namely trying multiple queries to simply get a group member count... + handler->PSendSysMessage(LANG_GROUP_TYPE, (groupTarget->isRaidGroup() ? "raid" : "party"), members.size()); + // ... we simply move the group type and member count print after retrieving the slots and simply output it's size. + + // While rather dirty codestyle-wise, it saves space (if only a little). For each member, we look several informations up. for (Group::MemberSlotList::const_iterator itr = members.begin(); itr != members.end(); ++itr) { + // Define temporary variable slot to iterator. Group::MemberSlot const& slot = *itr; + // Check for given flag and assign it to that iterator std::string flags; if (slot.flags & MEMBER_FLAG_ASSISTANT) flags = "Assistant"; @@ -321,13 +342,38 @@ public: if (flags.empty()) flags = "None"; + // Check if iterator is online. If is... Player* p = ObjectAccessor::FindPlayer((*itr).guid); - const char* onlineState = (p && p->IsInWorld()) ? "online" : "offline"; + if (p && p->IsInWorld()) + { + // ... than, it prints information like "is online", where he is, etc... + onlineState = "online"; + phase = (!p->IsGameMaster() ? p->GetPhaseMask() : -1); + uint32 locale = handler->GetSessionDbcLocale(); + + AreaTableEntry const* area = GetAreaEntryByAreaID(p->GetAreaId()); + if (area) + { + AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone); + if (zone) + zoneName = zone->area_name[locale]; + } + } + else + { + // ... else, everything is set to offline or neutral values. + zoneName = "<ERROR>"; + onlineState = "Offline"; + phase = 0; + } + // Now we can print those informations for every single member of each group! handler->PSendSysMessage(LANG_GROUP_PLAYER_NAME_GUID, slot.name.c_str(), onlineState, - GUID_LOPART(slot.guid), flags.c_str(), lfg::GetRolesString(slot.roles).c_str()); + zoneName.c_str(), phase, GUID_LOPART(slot.guid), flags.c_str(), + lfg::GetRolesString(slot.roles).c_str()); } + // And finish after every iterator is done. return true; } }; diff --git a/src/server/scripts/Kalimdor/zone_silithus.cpp b/src/server/scripts/Kalimdor/zone_silithus.cpp index fd8a1069ff7..79bd6f691e6 100644 --- a/src/server/scripts/Kalimdor/zone_silithus.cpp +++ b/src/server/scripts/Kalimdor/zone_silithus.cpp @@ -1014,7 +1014,7 @@ public: uint8 DeadMemberCount = 0; uint8 FailedMemberCount = 0; - Group::MemberSlotList const members = EventGroup->GetMemberSlots(); + Group::MemberSlotList const& members = EventGroup->GetMemberSlots(); for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr) { diff --git a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp index eac3dce43b0..24fbcf881b2 100644 --- a/src/server/scripts/Outland/zone_shadowmoon_valley.cpp +++ b/src/server/scripts/Outland/zone_shadowmoon_valley.cpp @@ -1467,7 +1467,7 @@ public: uint8 DeadMemberCount = 0; uint8 FailedMemberCount = 0; - const Group::MemberSlotList members = EventGroup->GetMemberSlots(); + Group::MemberSlotList const& members = EventGroup->GetMemberSlots(); for (Group::member_citerator itr = members.begin(); itr!= members.end(); ++itr) { |
