From d89626f767d1a2fd57f83bb682b866c818c480c2 Mon Sep 17 00:00:00 2001 From: Gacko Date: Mon, 1 Apr 2013 17:52:20 +0200 Subject: Script/Event: Fix warnings in Children's Week script --- src/server/scripts/Events/childrens_week.cpp | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Events/childrens_week.cpp b/src/server/scripts/Events/childrens_week.cpp index 2ec5e1190c8..2ef776e4e76 100644 --- a/src/server/scripts/Events/childrens_week.cpp +++ b/src/server/scripts/Events/childrens_week.cpp @@ -684,7 +684,6 @@ class npc_the_etymidian : public CreatureScript private: uint32 timer; int8 phase; - uint32 GOtimer; uint64 playerGUID; uint64 orphanGUID; @@ -847,7 +846,6 @@ class npc_alexstraza_the_lifebinder : public CreatureScript uint32 timer; uint64 playerGUID; uint64 orphanGUID; - uint64 alexstraszaGUID; }; -- cgit v1.2.3 From 294fac60a03a69d6f618c9d0e163615f379a9d33 Mon Sep 17 00:00:00 2001 From: Pitcrawler Date: Tue, 2 Apr 2013 01:06:19 +0200 Subject: DB/Quests: Fix It Was The Orcs, Honest! Closes #2037 --- sql/updates/world/2013_04_01_00_world_misc.sql | 20 +++++++++++ src/server/scripts/Spells/spell_generic.cpp | 50 ++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) create mode 100644 sql/updates/world/2013_04_01_00_world_misc.sql (limited to 'src/server/scripts') diff --git a/sql/updates/world/2013_04_01_00_world_misc.sql b/sql/updates/world/2013_04_01_00_world_misc.sql new file mode 100644 index 00000000000..5cacfc839d8 --- /dev/null +++ b/sql/updates/world/2013_04_01_00_world_misc.sql @@ -0,0 +1,20 @@ +DELETE FROM `spell_script_names` WHERE `spell_id`=45759; +INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES +(45759,'spell_gen_orc_disguise'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=17 AND `SourceEntry`=45742; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`SourceId`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionTarget`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`NegativeCondition`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(17,0,45742,0,0,1,0,45760,0,0,0,0,'','Spell Plant Warsong Banner can be casted only if player has aura Warsong Orc Disguise (Male)'), +(17,0,45742,0,0,31,1,3,25430,0,0,0,'','Spell Plant Warsong Banner can be casted only on Magmothregar'), +(17,0,45742,0,0,36,1,0,0,0,1,0,'','Spell Plant Warsong Banner can be casted only if target is dead'), +(17,0,45742,0,1,1,0,45762,0,0,0,0,'','Spell Plant Warsong Banner can be casted only if player has aura Warsong Orc Disguise (Female)'), +(17,0,45742,0,1,31,1,3,25430,0,0,0,'','Spell Plant Warsong Banner can be casted only on Magmothregar'), +(17,0,45742,0,1,36,1,0,0,0,1,0,'','Spell Plant Warsong Banner can be casted only if target is dead'); + +UPDATE `creature_template` SET `AIName`='SmartAI' WHERE `entry`=25430; +DELETE FROM `creature_ai_scripts` WHERE `creature_id`=25430; +DELETE FROM `smart_scripts` WHERE `entryorguid`=25430 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 +(25430,0,0,0,4,0,100,0,0,0,0,0,11,50413,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Magmothregar - On aggro - Spellcast Magnataur Charge'), +(25430,0,1,0,0,0,100,0,3500,12800,10100,14000,11,50822,0,0,0,0,0,1,0,0,0,0,0,0,0, 'Magmothregar - On update IC - Spellcast Fervor'), +(25430,0,2,0,8,0,100,0,45742,0,0,0,11,45744,0,0,0,0,0,7,0,0,0,0,0,0,0, 'Magmothregar - On spellhit Plant Warsong Banner - Spellcast It Was The Orcs, Honest!: Plant Banner Kill Credit'); diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 00b504d2403..8c25fa1e24f 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -3513,6 +3513,55 @@ class spell_gen_aura_service_uniform : public SpellScriptLoader } }; +enum OrcDisguiseSpells +{ + SPELL_ORC_DISGUISE_TRIGGER = 45759, + SPELL_ORC_DISGUISE_MALE = 45760, + SPELL_ORC_DISGUISE_FEMALE = 45762, +}; + +class spell_gen_orc_disguise : public SpellScriptLoader +{ + public: + spell_gen_orc_disguise() : SpellScriptLoader("spell_gen_orc_disguise") { } + + class spell_gen_orc_disguise_SpellScript : public SpellScript + { + PrepareSpellScript(spell_gen_orc_disguise_SpellScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_TRIGGER) || !sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_MALE) || + !sSpellMgr->GetSpellInfo(SPELL_ORC_DISGUISE_FEMALE)) + return false; + return true; + } + + void HandleScript(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (Player* target = GetHitPlayer()) + { + uint8 gender = target->getGender(); + if (!gender) + caster->CastSpell(target, SPELL_ORC_DISGUISE_MALE, true); + else + caster->CastSpell(target, SPELL_ORC_DISGUISE_FEMALE, true); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_gen_orc_disguise_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_gen_orc_disguise_SpellScript(); + } +}; + void AddSC_generic_spell_scripts() { new spell_gen_absorb0_hitlimit1(); @@ -3592,4 +3641,5 @@ void AddSC_generic_spell_scripts() new spell_gen_gift_of_naaru(); new spell_gen_replenishment(); new spell_gen_aura_service_uniform(); + new spell_gen_orc_disguise(); } -- cgit v1.2.3 From 9aebfaf722127fa6477782aeac7534c48ba0bffb Mon Sep 17 00:00:00 2001 From: kandera Date: Wed, 3 Apr 2013 03:37:56 -0400 Subject: DB/Commands: fix the use of gobject info when used with a game object entry --- sql/updates/world/2013_04_03_00_world_command.sql | 1 + src/server/scripts/Commands/cs_gobject.cpp | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 sql/updates/world/2013_04_03_00_world_command.sql (limited to 'src/server/scripts') diff --git a/sql/updates/world/2013_04_03_00_world_command.sql b/sql/updates/world/2013_04_03_00_world_command.sql new file mode 100644 index 00000000000..a94efebc8ea --- /dev/null +++ b/sql/updates/world/2013_04_03_00_world_command.sql @@ -0,0 +1 @@ +UPDATE `world`.`command` SET `help`='Syntax: .gobject info [$object_entry]\r \r Query Gameobject information for selected gameobject or given entry.' WHERE `name`='gobject info'; diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp index f99e51fb260..12fd4250eb8 100644 --- a/src/server/scripts/Commands/cs_gobject.cpp +++ b/src/server/scripts/Commands/cs_gobject.cpp @@ -592,7 +592,8 @@ public: entry = object->GetEntry(); else entry = atoi((char*)args); - } + } else + entry = atoi((char*)args); GameObjectTemplate const* gameObjectInfo = sObjectMgr->GetGameObjectTemplate(entry); -- cgit v1.2.3 From ad38ecaf988ab13cad0bcb11868874f89c7f7765 Mon Sep 17 00:00:00 2001 From: kandera Date: Wed, 3 Apr 2013 09:03:19 -0400 Subject: Core/Battlefield: Fix the invisible wall at the end of wintergrasp Closes #9422 DB/Strings: fix the error messages from the spirit guides Author Nastrand #9035 --- .../world/2013_04_03_01_world_trinity_string.sql | 11 +++++++++++ src/server/game/Battlefield/Zones/BattlefieldWG.h | 20 ++++++++++---------- src/server/scripts/Northrend/zone_wintergrasp.cpp | 2 +- 3 files changed, 22 insertions(+), 11 deletions(-) create mode 100644 sql/updates/world/2013_04_03_01_world_trinity_string.sql (limited to 'src/server/scripts') diff --git a/sql/updates/world/2013_04_03_01_world_trinity_string.sql b/sql/updates/world/2013_04_03_01_world_trinity_string.sql new file mode 100644 index 00000000000..63a29a53d71 --- /dev/null +++ b/sql/updates/world/2013_04_03_01_world_trinity_string.sql @@ -0,0 +1,11 @@ +-- Add Trinity String for Spirit Guide and wintergrasp battle mage +DELETE FROM `trinity_string` WHERE `entry` IN (20071,20072,20074,20073,20070,20075,20076,20077); +INSERT INTO `trinity_string`(`entry`,`content_default`) VALUES +(20071, 'Guide me to the Sunken Ring Graveyard.'), +(20072, 'Guide me to the Broken Temple Graveyard.'), +(20074, 'Guide me to the Eastspark Graveyard.'), +(20073, 'Guide me to the Westspark Graveyard.'), +(20070, 'Guide me to the Fortress Graveyard.'), +(20075, 'Guide me back to the Horde landing camp.'), +(20076, 'Guide me back to the Alliance landing camp.'), +(20077, 'Queue for Wintergrasp.'); \ No newline at end of file diff --git a/src/server/game/Battlefield/Zones/BattlefieldWG.h b/src/server/game/Battlefield/Zones/BattlefieldWG.h index fcd000e75af..f67ba8a826f 100644 --- a/src/server/game/Battlefield/Zones/BattlefieldWG.h +++ b/src/server/game/Battlefield/Zones/BattlefieldWG.h @@ -171,13 +171,13 @@ enum WGGraveyardId enum WGGossipText { - BATTLEFIELD_WG_GOSSIPTEXT_GY_NE = -1850501, - BATTLEFIELD_WG_GOSSIPTEXT_GY_NW = -1850502, - BATTLEFIELD_WG_GOSSIPTEXT_GY_SE = -1850504, - BATTLEFIELD_WG_GOSSIPTEXT_GY_SW = -1850503, - BATTLEFIELD_WG_GOSSIPTEXT_GY_KEEP = -1850500, - BATTLEFIELD_WG_GOSSIPTEXT_GY_HORDE = -1850505, - BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE = -1850506 + BATTLEFIELD_WG_GOSSIPTEXT_GY_NE = 20071, + BATTLEFIELD_WG_GOSSIPTEXT_GY_NW = 20072, + BATTLEFIELD_WG_GOSSIPTEXT_GY_SE = 20074, + BATTLEFIELD_WG_GOSSIPTEXT_GY_SW = 20073, + BATTLEFIELD_WG_GOSSIPTEXT_GY_KEEP = 20070, + BATTLEFIELD_WG_GOSSIPTEXT_GY_HORDE = 20075, + BATTLEFIELD_WG_GOSSIPTEXT_GY_ALLIANCE = 20076 }; enum WintergraspNpcs @@ -1127,7 +1127,7 @@ struct BfWGGameObjectBuilding build->SetDestructibleState(GO_DESTRUCTIBLE_REBUILDING, NULL, true); if (build->GetEntry() == GO_WINTERGRASP_VAULT_GATE) if (GameObject* go = build->FindNearestGameObject(GO_WINTERGRASP_KEEP_COLLISION_WALL, 50.0f)) - go->EnableCollision(true); + go->SetGoState(GO_STATE_READY); // Update worldstate m_State = BATTLEFIELD_WG_OBJECTSTATE_ALLIANCE_INTACT - (m_Team * 3); @@ -1183,8 +1183,8 @@ struct BfWGGameObjectBuilding break; case BATTLEFIELD_WG_OBJECTTYPE_DOOR_LAST: if (GameObject* build = m_WG->GetGameObject(m_BuildGUID)) - if (GameObject* go = build->FindNearestGameObject(GO_WINTERGRASP_KEEP_COLLISION_WALL, 10.0f)) - go->EnableCollision(false); + if (GameObject* go = build->FindNearestGameObject(GO_WINTERGRASP_KEEP_COLLISION_WALL, 50.0f)) + go->SetGoState(GO_STATE_ACTIVE); m_WG->SetRelicInteractible(true); if (m_WG->GetRelic()) m_WG->GetRelic()->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); diff --git a/src/server/scripts/Northrend/zone_wintergrasp.cpp b/src/server/scripts/Northrend/zone_wintergrasp.cpp index ce0eaefac90..1b944f9babb 100644 --- a/src/server/scripts/Northrend/zone_wintergrasp.cpp +++ b/src/server/scripts/Northrend/zone_wintergrasp.cpp @@ -40,7 +40,7 @@ enum WGqueuenpctext WG_NPCQUEUE_TEXT_A_NOWAR = 14782, WG_NPCQUEUE_TEXT_A_QUEUE = 14791, WG_NPCQUEUE_TEXT_A_WAR = 14781, - WG_NPCQUEUE_TEXTOPTION_JOIN = -1850507, + WG_NPCQUEUE_TEXTOPTION_JOIN = 20077, }; enum Spells -- cgit v1.2.3 From abbe692d7251757f62d22063e9e2b90956dd490f Mon Sep 17 00:00:00 2001 From: kandera Date: Wed, 3 Apr 2013 18:22:22 -0400 Subject: Core/Cleanup: cleanup tabs and change them to spaces --- src/server/game/Spells/SpellEffects.cpp | 12 ++++++------ src/server/scripts/Spells/spell_generic.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 167a2213132..541dfbb6232 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -938,12 +938,12 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex) // set basepoints for trigger with value effect if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE) { - if (m_spellInfo->Effects[effIndex].BasePoints == 0) - { - values.AddSpellMod(SPELLVALUE_BASE_POINT0, damage); - values.AddSpellMod(SPELLVALUE_BASE_POINT1, damage); - values.AddSpellMod(SPELLVALUE_BASE_POINT2, damage); - } + if (m_spellInfo->Effects[effIndex].BasePoints == 0) + { + values.AddSpellMod(SPELLVALUE_BASE_POINT0, damage); + values.AddSpellMod(SPELLVALUE_BASE_POINT1, damage); + values.AddSpellMod(SPELLVALUE_BASE_POINT2, damage); + } } // Remove spell cooldown (not category) if spell triggering spell with cooldown and same category diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 8c25fa1e24f..60f641d9054 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -3641,5 +3641,5 @@ void AddSC_generic_spell_scripts() new spell_gen_gift_of_naaru(); new spell_gen_replenishment(); new spell_gen_aura_service_uniform(); - new spell_gen_orc_disguise(); + new spell_gen_orc_disguise(); } -- cgit v1.2.3 From 3e32caa59362733052eec4a4e9fed7b8695b1e45 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 7 Apr 2013 16:02:00 +0200 Subject: Scripts/Ulduar: Fixed crashes with Kologarn using Stone Grip --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 2 -- .../Northrend/Ulduar/Ulduar/boss_kologarn.cpp | 36 +++++++++++++--------- 2 files changed, 22 insertions(+), 16 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 1e37c5cd0ad..7b1eb94102e 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -2898,12 +2898,10 @@ void AuraEffect::HandleAuraControlVehicle(AuraApplication const* aurApp, uint8 m return; Unit* target = aurApp->GetTarget(); - if (!target->IsVehicle()) return; Unit* caster = GetCaster(); - if (!caster || caster == target) return; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp index 47fe7c8f80a..b558508f78a 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_kologarn.cpp @@ -166,7 +166,7 @@ class boss_kologarn : public CreatureScript left = apply; if (!apply && isEncounterInProgress) { - who->ToCreature()->DisappearAndDie(); + who->ToCreature()->DespawnOrUnsummon(); Talk(SAY_LEFT_ARM_GONE); events.ScheduleEvent(EVENT_RESPAWN_LEFT_ARM, 40000); } @@ -177,7 +177,7 @@ class boss_kologarn : public CreatureScript right = apply; if (!apply && isEncounterInProgress) { - who->ToCreature()->DisappearAndDie(); + who->ToCreature()->DespawnOrUnsummon(); Talk(SAY_RIGHT_ARM_GONE); events.ScheduleEvent(EVENT_RESPAWN_RIGHT_ARM, 40000); } @@ -529,7 +529,7 @@ class spell_ulduar_stone_grip_absorb : public SpellScriptLoader //! What we do here is remove all harmful aura's related and teleport to safe spot. void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL) + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_ENEMY_SPELL) return; if (!GetOwner()->ToCreature()) @@ -568,22 +568,30 @@ class spell_ulduar_stone_grip : public SpellScriptLoader owner->RemoveAurasDueToSpell(aurEff->GetAmount()); } - void OnRemoveVehicle(AuraEffect const* /*aurEff*/, AuraEffectHandleModes mode) + void OnRemoveVehicle(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (!(mode & AURA_EFFECT_HANDLE_REAL)) - return; - - if (GetOwner()->GetTypeId() != TYPEID_UNIT) + PreventDefaultAction(); + Unit* caster = GetCaster(); + if (!caster) return; - Player* caster = GetCaster() ? GetCaster()->ToPlayer() : NULL; - if (!caster || !caster->IsOnVehicle(GetOwner()->ToUnit())) - return; + Position exitPosition; + exitPosition.m_positionX = 1750.0f; + exitPosition.m_positionY = -7.5f + frand(-3.0f, 3.0f); + exitPosition.m_positionZ = 457.9322f; + // Remove pending passengers before exiting vehicle - might cause an Uninstall + GetTarget()->GetVehicleKit()->RemovePendingEventsForPassenger(caster); + caster->_ExitVehicle(&exitPosition); caster->RemoveAurasDueToSpell(GetId()); - caster->ExitVehicle(); - caster->GetMotionMaster()->MoveJump(1756.25f + irand(-3, 3), -8.3f + irand(-3, 3), 448.8f, 5.0f, 5.0f); - PreventDefaultAction(); + + // Temporarily relocate player to vehicle exit dest serverside to send proper fall movement + // beats me why blizzard sends these 2 spline packets one after another instantly + Position oldPos; + caster->GetPosition(&oldPos); + caster->Relocate(exitPosition); + caster->GetMotionMaster()->MoveFall(); + caster->Relocate(oldPos); } void Register() -- cgit v1.2.3 From 6521b1aad60d229b9c6be310629ab2a83e57da73 Mon Sep 17 00:00:00 2001 From: Pitcrawler Date: Thu, 11 Apr 2013 02:14:49 +0200 Subject: DB/SAI: Convert a core script to SAI. Fixes issues when abandoning the quest. Thanks @dr-j for the initial work. --- sql/updates/world/2013_04_11_01_world_misc.sql | 64 +++++++ src/server/scripts/Outland/zone_shattrath_city.cpp | 196 +-------------------- 2 files changed, 65 insertions(+), 195 deletions(-) create mode 100644 sql/updates/world/2013_04_11_01_world_misc.sql (limited to 'src/server/scripts') diff --git a/sql/updates/world/2013_04_11_01_world_misc.sql b/sql/updates/world/2013_04_11_01_world_misc.sql new file mode 100644 index 00000000000..e7b7ef4f132 --- /dev/null +++ b/sql/updates/world/2013_04_11_01_world_misc.sql @@ -0,0 +1,64 @@ +SET @NPC_LARRY := 19720; +SET @NPC_MALONE := 19725; +SET @NPC_JACK := 19726; + +DELETE FROM `gossip_menu_option` WHERE `menu_id`=8033; +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 +(8033, 0, 0, 'Ezekiel said that you might have a certain book...', 1, 1, 0, 0, 0, 0, ''); + +UPDATE `creature_template` SET `AIName`='SmartAI', `ScriptName`='' WHERE `entry` IN (@NPC_LARRY,@NPC_MALONE,@NPC_JACK); +DELETE FROM `smart_scripts` WHERE `entryorguid` IN (@NPC_LARRY,@NPC_MALONE,@NPC_JACK) 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 +(@NPC_LARRY,0,0,1,25,0,100,0,0,0,0,0,2,1194,0,0,0,0,0,1,0,0,0,0,0,0,0,'"Dirty" Larry - On reset - Set faction'), +(@NPC_LARRY,0,1,2,61,0,100,0,0,0,0,0,18,256,0,0,0,0,0,1,0,0,0,0,0,0,0,'"Dirty" Larry - On reset - Set unit_flags IMMUNE_TO_PC'), +(@NPC_LARRY,0,2,3,61,0,100,0,0,0,0,0,81,3,0,0,0,0,0,1,0,0,0,0,0,0,0,'"Dirty" Larry - On reset - Set npcflag gossip, questgiver'), +(@NPC_LARRY,0,3,4,61,0,100,0,0,0,0,0,45,1,2,0,0,0,0,10,70376,@NPC_MALONE,0,0,0,0,0,'Dirty" Larry - On reset - Set data 1 2 "Epic" Malone'), +(@NPC_LARRY,0,4,0,61,0,100,0,0,0,0,0,45,1,2,0,0,0,0,10,70377,@NPC_JACK,0,0,0,0,0,'Dirty" Larry - On reset - Set data 1 2 "Creepjack"'), +(@NPC_LARRY,0,5,6,62,0,100,0,8033,0,0,0,64,1,0,0,0,0,0,7,0,0,0,0,0,0,0,'Dirty" Larry - On gossip select - Store targetlist'), +(@NPC_LARRY,0,6,7,61,0,100,0,0,0,0,0,72,0,0,0,0,0,0,7,0,0,0,0,0,0,0,'Dirty" Larry - On gossip select - Close Gossip'), +(@NPC_LARRY,0,7,8,61,0,100,0,0,0,0,0,1,0,5000,0,0,0,0,1,0,0,0,0,0,0,0,'Dirty" Larry - On gossip select - Say line'), +(@NPC_LARRY,0,8,9,61,0,100,0,0,0,0,0,81,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Dirty" Larry - On gossip select - Set npcflag none'), +(@NPC_LARRY,0,9,10,61,0,100,0,0,0,0,0,70,0,0,0,0,0,0,10,70376,@NPC_MALONE,0,0,0,0,0,'Dirty" Larry - On gossip select - Respawn "Epic" Malone '), +(@NPC_LARRY,0,10,0,61,0,100,0,0,0,0,0,70,0,0,0,0,0,0,10,70377,@NPC_JACK,0,0,0,0,0,'Dirty" Larry - On gossip select - Respawn "Creepjack" '), +(@NPC_LARRY,0,11,0,52,0,100,0,0,@NPC_LARRY,0,0,1,1,5000,0,0,0,0,1,0,0,0,0,0,0,0,'Dirty" Larry - On text over - Say line'), +(@NPC_LARRY,0,12,0,52,0,100,0,1,@NPC_LARRY,0,0,1,2,2000,0,0,0,0,1,0,0,0,0,0,0,0,'Dirty" Larry - On text over - Say line'), +(@NPC_LARRY,0,13,0,52,0,100,0,2,@NPC_LARRY,0,0,1,3,2000,0,0,0,0,1,0,0,0,0,0,0,0,'Dirty" Larry - On text over - Say line'), +(@NPC_LARRY,0,14,0,52,0,100,0,3,@NPC_LARRY,0,0,1,4,2000,0,0,0,0,1,0,0,0,0,0,0,0,'Dirty" Larry - On text over - Say line'), +(@NPC_LARRY,0,15,16,52,0,100,0,4,@NPC_LARRY,0,0,2,14,0,0,0,0,0,1,0,0,0,0,0,0,0,'Dirty" Larry - On text over - Set faction'), +(@NPC_LARRY,0,16,17,61,0,100,0,0,0,0,0,19,256,0,0,0,0,0,1,0,0,0,0,0,0,0,'Dirty" Larry - On text over - Remove unit_flags IMMUNE_TO_PC'), +(@NPC_LARRY,0,17,18,61,0,100,0,0,0,0,0,49,0,0,0,0,0,0,12,1,0,0,0,0,0,0,'Dirty" Larry - On text over - Attack'), +(@NPC_LARRY,0,18,19,61,0,100,0,0,0,0,0,100,1,0,0,0,0,0,10,70376,@NPC_MALONE,0,0,0,0,0,'Dirty" Larry - On text over - Send targetlist to "Epic" Malone'), +(@NPC_LARRY,0,19,20,61,0,100,0,0,0,0,0,45,1,1,0,0,0,0,10,70376,@NPC_MALONE,0,0,0,0,0,'Dirty" Larry - On text over - Set data 1 1 "Epic" Malone'), +(@NPC_LARRY,0,20,21,61,0,100,0,0,0,0,0,100,1,0,0,0,0,0,10,70377,@NPC_JACK,0,0,0,0,0,'Dirty" Larry - On text over - Send targetlist to "Creepjack"'), +(@NPC_LARRY,0,21,0,61,0,100,0,0,0,0,0,45,1,1,0,0,0,0,10,70377,@NPC_JACK,0,0,0,0,0,'Dirty" Larry - On text over - Set data 1 1 "Creepjack"'), +(@NPC_LARRY,0,22,23,2,0,100,0,0,20,0,0,15,10231,0,0,0,0,0,16,0,0,0,0,0,0,0,'Dirty" Larry - On health below 20% - Quest credit'), +(@NPC_LARRY,0,23,24,61,0,100,0,0,0,0,0,1,5,0,0,0,0,0,1,0,0,0,0,0,0,0,'Dirty" Larry - On health below 20% - Say line'), +(@NPC_LARRY,0,24,3,61,0,100,0,0,0,0,0,24,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Dirty" Larry - On health below 20% - Evade'), +(@NPC_LARRY,0,25,0,11,0,100,0,0,0,0,0,42,0,15,0,0,0,0,1,0,0,0,0,0,0,0,'Dirty" Larry - On spawn - Set invincibility HP level'), + +(@NPC_MALONE,0,0,1,25,0,100,0,0,0,0,0,2,1194,0,0,0,0,0,1,0,0,0,0,0,0,0,'"Epic" Malone - On reset - Set faction'), +(@NPC_MALONE,0,1,0,61,0,100,0,0,0,0,0,18,256,0,0,0,0,0,1,0,0,0,0,0,0,0,'"Epic" Malone - On reset - Set unit_flags IMMUNE_TO_PC'), +(@NPC_MALONE,0,2,3,38,0,100,0,1,1,0,0,2,14,0,0,0,0,0,1,0,0,0,0,0,0,0,'"Epic" Malone - On data 1 1 set - Set faction'), +(@NPC_MALONE,0,3,4,61,0,100,0,0,0,0,0,19,256,0,0,0,0,0,1,0,0,0,0,0,0,0,'"Epic" Malone - On data 1 1 set - Remove unit_flags IMMUNE_TO_PC'), +(@NPC_MALONE,0,4,0,61,0,100,0,0,0,0,0,49,0,0,0,0,0,0,12,1,0,0,0,0,0,0,'"Epic" Malone - On data 1 1 set - Attack'), +(@NPC_MALONE,0,5,0,38,0,100,0,1,2,0,0,24,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'"Epic" Malone - On data 1 2 set - Evade'), + +(@NPC_JACK,0,0,1,25,0,100,0,0,0,0,0,2,1194,0,0,0,0,0,1,0,0,0,0,0,0,0,'"Creepjack" - On reset - Set faction'), +(@NPC_JACK,0,1,0,61,0,100,0,0,0,0,0,18,256,0,0,0,0,0,1,0,0,0,0,0,0,0,'"Creepjack" - On reset - Set unit_flags IMMUNE_TO_PC'), +(@NPC_JACK,0,2,3,38,0,100,0,1,1,0,0,2,14,0,0,0,0,0,1,0,0,0,0,0,0,0,'"Creepjack" - On data 1 1 set - Set faction'), +(@NPC_JACK,0,3,4,61,0,100,0,0,0,0,0,19,256,0,0,0,0,0,1,0,0,0,0,0,0,0,'"Creepjack" - On data 1 1 set - Remove unit_flags IMMUNE_TO_PC'), +(@NPC_JACK,0,4,0,61,0,100,0,0,0,0,0,49,0,0,0,0,0,0,12,1,0,0,0,0,0,0,'"Creepjack" - On data 1 1 set - Attack'), +(@NPC_JACK,0,5,0,38,0,100,0,1,2,0,0,24,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'"Creepjack" - On data 1 2 set - Evade'); + +DELETE FROM `creature_text` WHERE `entry`=@NPC_LARRY; +INSERT INTO `creature_text` (`entry`, `groupid`, `id`, `text`, `type`, `language`, `probability`, `emote`, `duration`, `sound`, `comment`) VALUES +(@NPC_LARRY, 0, 0, 'Time to teach you a lesson in manners, little boy! ', 12, 0, 100, 0, 0, 0, '"Dirty" Larry'), +(@NPC_LARRY, 1, 0, 'I''m now going to give you to the count of "3" to get out of here before I sick the dogs on you.', 12, 0, 100, 0, 0, 0, '"Dirty" Larry'), +(@NPC_LARRY, 2, 0, '1...', 12, 0, 100, 0, 0, 0, '"Dirty" Larry'), +(@NPC_LARRY, 3, 0, '2...', 12, 0, 100, 0, 0, 0, '"Dirty" Larry'), +(@NPC_LARRY, 4, 0, 'Time to meet your maker!', 12, 0, 100, 0, 0, 0, '"Dirty" Larry'), +(@NPC_LARRY, 5, 0, 'Alright, we give up! Don''t hurt us!', 12, 0, 100, 0, 0, 0, '"Dirty" Larry'); + +DELETE FROM `conditions` WHERE `SourceTypeOrReferenceId`=15 AND `SourceGroup`=8033; +INSERT INTO `conditions` (`SourceTypeOrReferenceId`,`SourceGroup`,`SourceEntry`,`ElseGroup`,`ConditionTypeOrReference`,`ConditionValue1`,`ConditionValue2`,`ConditionValue3`,`ErrorTextId`,`ScriptName`,`Comment`) VALUES +(15,8033,0,0,9,10231,0,0,0,'','"Dirty" Larry only show gossip if player is on and has not completed What Book? I Dont See Any Book'); diff --git a/src/server/scripts/Outland/zone_shattrath_city.cpp b/src/server/scripts/Outland/zone_shattrath_city.cpp index 4af11191708..1fb0210bb73 100644 --- a/src/server/scripts/Outland/zone_shattrath_city.cpp +++ b/src/server/scripts/Outland/zone_shattrath_city.cpp @@ -19,7 +19,7 @@ /* ScriptData SDName: Shattrath_City SD%Complete: 100 -SDComment: Quest support: 10004, 10009, 10211, 10231. Flask vendors, Teleport to Caverns of Time +SDComment: Quest support: 10004, 10009, 10211. Flask vendors, Teleport to Caverns of Time SDCategory: Shattrath City EndScriptData */ @@ -29,7 +29,6 @@ npc_salsalabim npc_shattrathflaskvendors npc_zephyr npc_kservant -npc_dirty_larry npc_ishanah npc_khadgar EndContentData */ @@ -424,198 +423,6 @@ public: }; }; -/*###### -# npc_dirty_larry -######*/ - -#define GOSSIP_BOOK "Ezekiel said that you might have a certain book..." - -enum DirtyLarry -{ - SAY_1 = 0, - SAY_2 = 1, - SAY_3 = 2, - SAY_4 = 3, - SAY_5 = 4, - SAY_GIVEUP = 5, - - QUEST_WBI = 10231, - NPC_CREEPJACK = 19726, - NPC_MALONE = 19725 -}; - -class npc_dirty_larry : public CreatureScript -{ -public: - npc_dirty_larry() : CreatureScript("npc_dirty_larry") { } - - struct npc_dirty_larryAI : public ScriptedAI - { - npc_dirty_larryAI(Creature* creature) : ScriptedAI(creature) {} - - bool Event; - bool Attack; - bool Done; - - uint64 PlayerGUID; - - uint32 SayTimer; - uint32 Step; - - void Reset() - { - Event = false; - Attack = false; - Done = false; - - PlayerGUID = 0; - SayTimer = 0; - Step = 0; - - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->setFaction(1194); - if (Creature* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20)) - { - Creepjack->AI()->EnterEvadeMode(); - Creepjack->setFaction(1194); - Creepjack->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - - if (Creature* Malone = me->FindNearestCreature(NPC_MALONE, 20)) - { - Malone->AI()->EnterEvadeMode(); - Malone->setFaction(1194); - Malone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - } - - uint32 NextStep(uint32 Step) - { - Player* player = Unit::GetPlayer(*me, PlayerGUID); - - switch (Step) - { - case 0:{ me->SetInFront(player); - Unit* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20); - if (Creepjack) - Creepjack->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - Unit* Malone = me->FindNearestCreature(NPC_MALONE, 20); - if (Malone) - Malone->SetUInt32Value(UNIT_FIELD_BYTES_1, 0); - me->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); }return 2000; - case 1: Talk(SAY_1, player->GetGUID()); return 3000; - case 2: Talk(SAY_2, player->GetGUID()); return 5000; - case 3: Talk(SAY_3, player->GetGUID()); return 2000; - case 4: Talk(SAY_4, player->GetGUID()); return 2000; - case 5: Talk(SAY_5, player->GetGUID()); return 2000; - case 6: Attack = true; return 2000; - default: return 0; - } - } - - void EnterCombat(Unit* /*who*/){} - - void UpdateAI(uint32 diff) - { - if (SayTimer <= diff) - { - if (Event) - SayTimer = NextStep(++Step); - } - else - SayTimer -= diff; - - if (Attack) - { - me->setFaction(14); - me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (Player* player = Unit::GetPlayer(*me, PlayerGUID)) - { - if (Creature* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20)) - { - Creepjack->Attack(player, true); - Creepjack->setFaction(14); - Creepjack->GetMotionMaster()->MoveChase(player); - Creepjack->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - - if (Creature* Malone = me->FindNearestCreature(NPC_MALONE, 20)) - { - Malone->Attack(player, true); - Malone->setFaction(14); - Malone->GetMotionMaster()->MoveChase(player); - Malone->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - DoStartMovement(player); - AttackStart(player); - } - Attack = false; - } - - if (HealthBelowPct(5) && !Done) - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->RemoveAllAuras(); - - if (Creature* Creepjack = me->FindNearestCreature(NPC_CREEPJACK, 20)) - { - Creepjack->AI()->EnterEvadeMode(); - Creepjack->setFaction(1194); - Creepjack->GetMotionMaster()->MoveTargetedHome(); - Creepjack->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - - if (Creature* Malone = me->FindNearestCreature(NPC_MALONE, 20)) - { - Malone->AI()->EnterEvadeMode(); - Malone->setFaction(1194); - Malone->GetMotionMaster()->MoveTargetedHome(); - Malone->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - } - me->setFaction(1194); - Done = true; - Talk(SAY_GIVEUP); - me->DeleteThreatList(); - me->CombatStop(); - me->GetMotionMaster()->MoveTargetedHome(); - if (Player* player = Unit::GetPlayer(*me, PlayerGUID)) - player->GroupEventHappens(QUEST_WBI, me); - } - DoMeleeAttackIfReady(); - } - }; - - bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) - { - player->PlayerTalkClass->ClearMenus(); - if (action == GOSSIP_ACTION_INFO_DEF+1) - { - CAST_AI(npc_dirty_larry::npc_dirty_larryAI, creature->AI())->Event = true; - CAST_AI(npc_dirty_larry::npc_dirty_larryAI, creature->AI())->PlayerGUID = player->GetGUID(); - player->CLOSE_GOSSIP_MENU(); - } - - return true; - } - - bool OnGossipHello(Player* player, Creature* creature) - { - if (creature->isQuestGiver()) - player->PrepareQuestMenu(creature->GetGUID()); - - if (player->GetQuestStatus(QUEST_WBI) == QUEST_STATUS_INCOMPLETE) - player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_BOOK, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1); - - player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID()); - return true; - } - - CreatureAI* GetAI(Creature* creature) const - { - return new npc_dirty_larryAI (creature); - } -}; - /*###### # npc_ishanah ######*/ @@ -727,7 +534,6 @@ void AddSC_shattrath_city() new npc_shattrathflaskvendors(); new npc_zephyr(); new npc_kservant(); - new npc_dirty_larry(); new npc_ishanah(); new npc_khadgar(); } -- cgit v1.2.3 From 96ad520ea3708621f5466aeb5fc2b8d82f837607 Mon Sep 17 00:00:00 2001 From: Gacko Date: Fri, 12 Apr 2013 17:34:43 +0200 Subject: Script/Spell: Apply Frost Imbued Blade only in 25 man mode Note: Quest credit spells are already casted in 25 man mode only. --- src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp index ea74d8ec61c..7294e4a5571 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_sindragosa.cpp @@ -1131,7 +1131,8 @@ class spell_sindragosa_frost_breath : public SpellScriptLoader if (!target) return; - if (target->GetQuestStatus(QUEST_FROST_INFUSION) != QUEST_STATUS_INCOMPLETE) + // Check difficulty and quest status + if (!(target->GetRaidDifficulty() & RAID_DIFFICULTY_MASK_25MAN) || target->GetQuestStatus(QUEST_FROST_INFUSION) != QUEST_STATUS_INCOMPLETE) return; // Check if player has Shadow's Edge equipped and not ready for infusion -- cgit v1.2.3 From 852e8e720c10b9cc9ad266e411d840870ee3c892 Mon Sep 17 00:00:00 2001 From: Gacko Date: Fri, 12 Apr 2013 17:35:56 +0200 Subject: Script: Remove unnecessary constant --- .../scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp | 1 - 1 file changed, 1 deletion(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index f4df90c49e8..938b2e94d02 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -73,7 +73,6 @@ enum Spells enum Shadowmourne { QUEST_BLOOD_INFUSION = 24756, - ITEM_SHADOW_S_EDGE = 49888, SPELL_GUSHING_WOUND = 72132, SPELL_THIRST_QUENCHED = 72154, -- cgit v1.2.3 From 24a7a6f96553f20aed9f655bc2d77012d9b785c2 Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 12 Apr 2013 17:54:40 +0200 Subject: Scripts/Pit of Saron: Changed Overlord's Brand script to be safer Closes #9125 --- src/server/game/Spells/SpellEffects.cpp | 2 -- .../PitOfSaron/boss_scourgelord_tyrannus.cpp | 32 ++++++++++++---------- .../FrozenHalls/PitOfSaron/pit_of_saron.h | 13 +++++++++ 3 files changed, 31 insertions(+), 16 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 4717832a727..9807e7a016d 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -2392,8 +2392,6 @@ void Spell::EffectSummonType(SpellEffIndex effIndex) case SUMMON_CATEGORY_VEHICLE: // Summoning spells (usually triggered by npc_spellclick) that spawn a vehicle and that cause the clicker // to cast a ride vehicle spell on the summoned unit. - float x, y, z; - m_caster->GetClosePoint(x, y, z, DEFAULT_WORLD_OBJECT_SIZE); summon = m_originalCaster->GetMap()->SummonCreature(entry, *destTarget, properties, duration, m_caster, m_spellInfo->Id); if (!summon || !summon->IsVehicle()) return; diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp index 3d22bac4376..c335c90cc30 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp @@ -136,9 +136,7 @@ class boss_tyrannus : public CreatureScript void InitializeAI() { - if (!instance || static_cast(me->GetMap())->GetScriptId() != sObjectMgr->GetScriptId(PoSScriptName)) - me->IsAIEnabled = false; - else if (instance->GetBossState(DATA_TYRANNUS) != DONE) + if (instance->GetBossState(DATA_TYRANNUS) != DONE) Reset(); else me->DespawnOrUnsummon(); @@ -281,7 +279,7 @@ class boss_tyrannus : public CreatureScript CreatureAI* GetAI(Creature* creature) const { - return new boss_tyrannusAI(creature); + return GetPitOfSaronAI(creature); } }; @@ -387,32 +385,32 @@ class boss_rimefang : public CreatureScript class player_overlord_brandAI : public PlayerAI { public: - player_overlord_brandAI(Player* player) : PlayerAI(player) + player_overlord_brandAI(Player* player) : PlayerAI(player), _tyrannus(0) { - tyrannus = NULL; } void SetGUID(uint64 guid, int32 /*type*/) { - tyrannus = ObjectAccessor::GetCreature(*me, guid); - me->IsAIEnabled = tyrannus != NULL; + _tyrannus = guid; } void DamageDealt(Unit* /*victim*/, uint32& damage, DamageEffectType /*damageType*/) { - if (tyrannus->getVictim()) - me->CastCustomSpell(SPELL_OVERLORD_BRAND_DAMAGE, SPELLVALUE_BASE_POINT0, damage, tyrannus->getVictim(), true, NULL, NULL, tyrannus->GetGUID()); + if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannus)) + if (tyrannus->getVictim()) + me->CastCustomSpell(SPELL_OVERLORD_BRAND_DAMAGE, SPELLVALUE_BASE_POINT0, damage, tyrannus->getVictim(), true, NULL, NULL, tyrannus->GetGUID()); } void HealDone(Unit* /*target*/, uint32& addHealth) { - me->CastCustomSpell(SPELL_OVERLORD_BRAND_HEAL, SPELLVALUE_BASE_POINT0, int32(addHealth*5.5f), tyrannus, true, NULL, NULL, tyrannus->GetGUID()); + if (Creature* tyrannus = ObjectAccessor::GetCreature(*me, _tyrannus)) + me->CastCustomSpell(SPELL_OVERLORD_BRAND_HEAL, SPELLVALUE_BASE_POINT0, int32(addHealth*5.5f), tyrannus, true, NULL, NULL, tyrannus->GetGUID()); } void UpdateAI(uint32 /*diff*/) { } private: - Creature* tyrannus; + uint64 _tyrannus; }; class spell_tyrannus_overlord_brand : public SpellScriptLoader @@ -424,6 +422,11 @@ class spell_tyrannus_overlord_brand : public SpellScriptLoader { PrepareAuraScript(spell_tyrannus_overlord_brand_AuraScript); + bool Load() + { + return GetCaster() && GetCaster()->GetEntry() == NPC_TYRANNUS; + } + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (GetTarget()->GetTypeId() != TYPEID_PLAYER) @@ -440,9 +443,10 @@ class spell_tyrannus_overlord_brand : public SpellScriptLoader if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; - delete GetTarget()->GetAI(); - GetTarget()->SetAI(oldAI); GetTarget()->IsAIEnabled = oldAIState; + UnitAI* thisAI = GetTarget()->GetAI(); + GetTarget()->SetAI(oldAI); + delete thisAI; } void Register() diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h index 94bca5ffaf7..a9b88ca3066 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h @@ -18,6 +18,9 @@ #ifndef DEF_PIT_OF_SARON_H #define DEF_PIT_OF_SARON_H +#include "Map.h" +#include "Creature.h" + #define PoSScriptName "instance_pit_of_saron" #define MAX_ENCOUNTER 3 @@ -94,4 +97,14 @@ enum GameObjectIds GO_HALLS_OF_REFLECTION_PORTCULLIS = 201848, }; +template +AI* GetPitOfSaronAI(Creature* creature) +{ + if (InstanceMap* instance = creature->GetMap()->ToInstanceMap()) + if (instance->GetInstanceScript()) + if (instance->GetScriptId() == sObjectMgr->GetScriptId(PoSScriptName)) + return new AI(creature); + return NULL; +} + #endif -- cgit v1.2.3 From c0303c82bf100b8fcce217c5e84e731b135b9c45 Mon Sep 17 00:00:00 2001 From: joschiwald Date: Fri, 12 Apr 2013 21:21:30 +0200 Subject: Scripts/Quest: Fix "Massacre At Light's" after recent vehicle changes and drop some silly code Closes #9448 --- sql/updates/world/2013_04_11_03_world_misc.sql | 8 + .../EasternKingdoms/ScarletEnclave/chapter1.cpp | 332 ++++++++++----------- 2 files changed, 166 insertions(+), 174 deletions(-) create mode 100644 sql/updates/world/2013_04_11_03_world_misc.sql (limited to 'src/server/scripts') diff --git a/sql/updates/world/2013_04_11_03_world_misc.sql b/sql/updates/world/2013_04_11_03_world_misc.sql new file mode 100644 index 00000000000..5f1e89d631d --- /dev/null +++ b/sql/updates/world/2013_04_11_03_world_misc.sql @@ -0,0 +1,8 @@ +DELETE FROM `spell_target_position` WHERE `id`=52464; +INSERT INTO `spell_target_position` (`id`, `target_map`, `target_position_x`, `target_position_y`, `target_position_z`, `target_orientation`) VALUES +(52464, 609, 2384.13, -5900.07, 107.998, 0); + +UPDATE `gameobject_template` SET `ScriptName`='' WHERE `entry`=190767; + +DELETE FROM `creature` WHERE `guid`=129164; +DELETE FROM `creature_addon` WHERE `guid`=129164; diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index abaf900508c..7f6a9c1d63b 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -861,59 +861,82 @@ public: ## npc_scarlet_miner_cart ####*/ -enum Spells_SM +enum ScarletMinerCart { - SPELL_CART_CHECK = 54173, - SPELL_CART_DRAG = 52465 + SPELL_CART_CHECK = 54173, + SPELL_SUMMON_CART = 52463, + SPELL_SUMMON_MINER = 52464, + SPELL_CART_DRAG = 52465, + + NPC_MINER = 28841 }; class npc_scarlet_miner_cart : public CreatureScript { -public: - npc_scarlet_miner_cart() : CreatureScript("npc_scarlet_miner_cart") { } + public: + npc_scarlet_miner_cart() : CreatureScript("npc_scarlet_miner_cart") { } - CreatureAI* GetAI(Creature* creature) const - { - return new npc_scarlet_miner_cartAI(creature); - } - - struct npc_scarlet_miner_cartAI : public PassiveAI - { - npc_scarlet_miner_cartAI(Creature* creature) : PassiveAI(creature), minerGUID(0) + struct npc_scarlet_miner_cartAI : public PassiveAI { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); - me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); // Modelid2 is a horse. - } + npc_scarlet_miner_cartAI(Creature* creature) : PassiveAI(creature), _minerGUID(0), _playerGUID(0) + { + me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); + me->SetDisplayId(me->GetCreatureTemplate()->Modelid1); // Modelid2 is a horse. + } - uint64 minerGUID; + void JustSummoned(Creature* summon) + { + if (summon->GetEntry() == NPC_MINER) + { + _minerGUID = summon->GetGUID(); + summon->AI()->SetGUID(_playerGUID); + } + } - void SetGUID(uint64 guid, int32 /*id*/) - { - minerGUID = guid; - } + void SummonedCreatureDespawn(Creature* summon) + { + if (summon->GetEntry() == NPC_MINER) + _minerGUID = 0; + } - void DoAction(int32 /*param*/) - { - if (Creature* miner = Unit::GetCreature(*me, minerGUID)) + void DoAction(int32 /*param*/) { - me->SetWalk(false); + if (Creature* miner = ObjectAccessor::GetCreature(*me, _minerGUID)) + { + me->SetWalk(false); - //Not 100% correct, but movement is smooth. Sometimes miner walks faster - //than normal, this speed is fast enough to keep up at those times. - me->SetSpeed(MOVE_RUN, 1.25f); + // Not 100% correct, but movement is smooth. Sometimes miner walks faster + // than normal, this speed is fast enough to keep up at those times. + me->SetSpeed(MOVE_RUN, 1.25f); - me->GetMotionMaster()->MoveFollow(miner, 1.0f, 0); + me->GetMotionMaster()->MoveFollow(miner, 1.0f, 0); + } } - } - void PassengerBoarded(Unit* /*who*/, int8 /*seatId*/, bool apply) + void PassengerBoarded(Unit* who, int8 /*seatId*/, bool apply) + { + if (apply) + { + _playerGUID = who->GetGUID(); + me->CastSpell((Unit*)NULL, SPELL_SUMMON_MINER, true); + } + else + { + _playerGUID = 0; + if (Creature* miner = ObjectAccessor::GetCreature(*me, _minerGUID)) + miner->DespawnOrUnsummon(); + } + } + + private: + uint64 _minerGUID; + uint64 _playerGUID; + }; + + CreatureAI* GetAI(Creature* creature) const { - if (!apply) - if (Creature* miner = Unit::GetCreature(*me, minerGUID)) - miner->DisappearAndDie(); + return new npc_scarlet_miner_cartAI(creature); } - }; - }; /*#### @@ -928,166 +951,128 @@ enum Says_SM class npc_scarlet_miner : public CreatureScript { -public: - npc_scarlet_miner() : CreatureScript("npc_scarlet_miner") { } - - CreatureAI* GetAI(Creature* creature) const - { - return new npc_scarlet_minerAI(creature); - } + public: + npc_scarlet_miner() : CreatureScript("npc_scarlet_miner") { } - struct npc_scarlet_minerAI : public npc_escortAI - { - npc_scarlet_minerAI(Creature* creature) : npc_escortAI(creature) + struct npc_scarlet_minerAI : public npc_escortAI { - me->SetReactState(REACT_PASSIVE); - } + npc_scarlet_minerAI(Creature* creature) : npc_escortAI(creature) + { + me->SetReactState(REACT_PASSIVE); + } - uint32 IntroTimer; - uint32 IntroPhase; - uint64 carGUID; + uint32 IntroTimer; + uint32 IntroPhase; + uint64 carGUID; - void Reset() - { - carGUID = 0; - IntroTimer = 0; - IntroPhase = 0; - } + void Reset() + { + carGUID = 0; + IntroTimer = 0; + IntroPhase = 0; + } - void InitWaypoint() - { - AddWaypoint(1, 2389.03f, -5902.74f, 109.014f, 5000); - AddWaypoint(2, 2341.812012f, -5900.484863f, 102.619743f); - AddWaypoint(3, 2306.561279f, -5901.738281f, 91.792419f); - AddWaypoint(4, 2300.098389f, -5912.618652f, 86.014885f); - AddWaypoint(5, 2294.142090f, -5927.274414f, 75.316849f); - AddWaypoint(6, 2286.984375f, -5944.955566f, 63.714966f); - AddWaypoint(7, 2280.001709f, -5961.186035f, 54.228283f); - AddWaypoint(8, 2259.389648f, -5974.197754f, 42.359348f); - AddWaypoint(9, 2242.882812f, -5984.642578f, 32.827850f); - AddWaypoint(10, 2217.265625f, -6028.959473f, 7.675705f); - AddWaypoint(11, 2202.595947f, -6061.325684f, 5.882018f); - AddWaypoint(12, 2188.974609f, -6080.866699f, 3.370027f); - - if (urand(0, 1)) + void IsSummonedBy(Unit* summoner) { - AddWaypoint(13, 2176.483887f, -6110.407227f, 1.855181f); - AddWaypoint(14, 2172.516602f, -6146.752441f, 1.074235f); - AddWaypoint(15, 2138.918457f, -6158.920898f, 1.342926f); - AddWaypoint(16, 2129.866699f, -6174.107910f, 4.380779f); - AddWaypoint(17, 2117.709473f, -6193.830078f, 13.3542f, 10000); + carGUID = summoner->GetGUID(); } - else + + void InitWaypoint() { - AddWaypoint(13, 2184.190186f, -6166.447266f, 0.968877f); - AddWaypoint(14, 2234.265625f, -6163.741211f, 0.916021f); - AddWaypoint(15, 2268.071777f, -6158.750977f, 1.822252f); - AddWaypoint(16, 2270.028320f, -6176.505859f, 6.340538f); - AddWaypoint(17, 2271.739014f, -6195.401855f, 13.3542f, 10000); + AddWaypoint(1, 2389.03f, -5902.74f, 109.014f, 5000); + AddWaypoint(2, 2341.812012f, -5900.484863f, 102.619743f); + AddWaypoint(3, 2306.561279f, -5901.738281f, 91.792419f); + AddWaypoint(4, 2300.098389f, -5912.618652f, 86.014885f); + AddWaypoint(5, 2294.142090f, -5927.274414f, 75.316849f); + AddWaypoint(6, 2286.984375f, -5944.955566f, 63.714966f); + AddWaypoint(7, 2280.001709f, -5961.186035f, 54.228283f); + AddWaypoint(8, 2259.389648f, -5974.197754f, 42.359348f); + AddWaypoint(9, 2242.882812f, -5984.642578f, 32.827850f); + AddWaypoint(10, 2217.265625f, -6028.959473f, 7.675705f); + AddWaypoint(11, 2202.595947f, -6061.325684f, 5.882018f); + AddWaypoint(12, 2188.974609f, -6080.866699f, 3.370027f); + + if (urand(0, 1)) + { + AddWaypoint(13, 2176.483887f, -6110.407227f, 1.855181f); + AddWaypoint(14, 2172.516602f, -6146.752441f, 1.074235f); + AddWaypoint(15, 2138.918457f, -6158.920898f, 1.342926f); + AddWaypoint(16, 2129.866699f, -6174.107910f, 4.380779f); + AddWaypoint(17, 2117.709473f, -6193.830078f, 13.3542f, 10000); + } + else + { + AddWaypoint(13, 2184.190186f, -6166.447266f, 0.968877f); + AddWaypoint(14, 2234.265625f, -6163.741211f, 0.916021f); + AddWaypoint(15, 2268.071777f, -6158.750977f, 1.822252f); + AddWaypoint(16, 2270.028320f, -6176.505859f, 6.340538f); + AddWaypoint(17, 2271.739014f, -6195.401855f, 13.3542f, 10000); + } } - } - void InitCartQuest(Player* who) - { - carGUID = who->GetVehicleBase()->GetGUID(); - InitWaypoint(); - Start(false, false, who->GetGUID()); - SetDespawnAtFar(false); - } + void SetGUID(uint64 guid, int32 /*id = 0*/) + { + InitWaypoint(); + Start(false, false, guid); + SetDespawnAtFar(false); + } - void WaypointReached(uint32 waypointId) - { - switch (waypointId) + void WaypointReached(uint32 waypointId) { - case 1: - if (Unit* car = Unit::GetCreature(*me, carGUID)) - { - me->SetInFront(car); - me->SendMovementFlagUpdate(); - } - Talk(SAY_SCARLET_MINER_0); - SetRun(true); - IntroTimer = 4000; - IntroPhase = 1; - break; - case 17: - if (Unit* car = Unit::GetCreature(*me, carGUID)) - { - me->SetInFront(car); - me->SendMovementFlagUpdate(); - car->Relocate(car->GetPositionX(), car->GetPositionY(), me->GetPositionZ() + 1); - car->StopMoving(); - car->RemoveAura(SPELL_CART_DRAG); - } - Talk(SAY_SCARLET_MINER_1); - break; - default: - break; + switch (waypointId) + { + case 1: + if (Unit* car = ObjectAccessor::GetCreature(*me, carGUID)) + me->SetFacingToObject(car); + Talk(SAY_SCARLET_MINER_0); + SetRun(true); + IntroTimer = 4000; + IntroPhase = 1; + break; + case 17: + if (Unit* car = ObjectAccessor::GetCreature(*me, carGUID)) + { + me->SetFacingToObject(car); + car->RemoveAura(SPELL_CART_DRAG); + } + Talk(SAY_SCARLET_MINER_1); + break; + default: + break; + } } - } - void UpdateAI(uint32 diff) - { - if (IntroPhase) + void UpdateAI(uint32 diff) { - if (IntroTimer <= diff) + if (IntroPhase) { - if (IntroPhase == 1) + if (IntroTimer <= diff) { - if (Creature* car = Unit::GetCreature(*me, carGUID)) - DoCast(car, SPELL_CART_DRAG); - IntroTimer = 800; - IntroPhase = 2; + if (IntroPhase == 1) + { + if (Creature* car = Unit::GetCreature(*me, carGUID)) + DoCast(car, SPELL_CART_DRAG); + IntroTimer = 800; + IntroPhase = 2; + } + else + { + if (Creature* car = Unit::GetCreature(*me, carGUID)) + car->AI()->DoAction(0); + IntroPhase = 0; + } } else - { - if (Creature* car = Unit::GetCreature(*me, carGUID)) - car->AI()->DoAction(0); - IntroPhase = 0; - } - } else IntroTimer-=diff; + IntroTimer -= diff; + } + npc_escortAI::UpdateAI(diff); } - npc_escortAI::UpdateAI(diff); - } - }; - -}; - -/*###### -## go_inconspicuous_mine_car -######*/ + }; -enum Spells_Cart -{ - SPELL_CART_SUMM = 52463 -}; - -class go_inconspicuous_mine_car : public GameObjectScript -{ -public: - go_inconspicuous_mine_car() : GameObjectScript("go_inconspicuous_mine_car") { } - - bool OnGossipHello(Player* player, GameObject* /*go*/) - { - if (player->GetQuestStatus(12701) == QUEST_STATUS_INCOMPLETE) + CreatureAI* GetAI(Creature* creature) const { - // Hack Why Trinity Dont Support Custom Summon Location - if (Creature* miner = player->SummonCreature(28841, 2383.869629f, -5900.312500f, 107.996086f, player->GetOrientation(), TEMPSUMMON_DEAD_DESPAWN, 1)) - { - player->CastSpell(player, SPELL_CART_SUMM, true); - if (Creature* car = player->GetVehicleCreatureBase()) - { - if (car->GetEntry() == 28817) - { - car->AI()->SetGUID(miner->GetGUID()); - CAST_AI(npc_scarlet_miner::npc_scarlet_minerAI, miner->AI())->InitCartQuest(player); - } else sLog->outError(LOG_FILTER_TSCR, "OnGossipHello vehicle entry is not correct."); - } else sLog->outError(LOG_FILTER_TSCR, "OnGossipHello player is not on the vehicle."); - } else sLog->outError(LOG_FILTER_TSCR, "OnGossipHello Scarlet Miner cant be found by script."); + return new npc_scarlet_minerAI(creature); } - return true; - } - }; // npc 28912 quest 17217 boss 29001 mob 29007 go 191092 @@ -1105,5 +1090,4 @@ void AddSC_the_scarlet_enclave_c1() new npc_scarlet_ghoul(); new npc_scarlet_miner(); new npc_scarlet_miner_cart(); - new go_inconspicuous_mine_car(); } -- cgit v1.2.3 From e9d7b53e6dd74793b5ad81e7df7cd365adfe61e5 Mon Sep 17 00:00:00 2001 From: Gacko Date: Tue, 16 Apr 2013 20:29:24 +0200 Subject: Fix some creature text runtime errors --- .../world/2013_04_16_02_world_creature_text.sql | 44 ++++++++++++++++++++++ .../EasternKingdoms/ScarletEnclave/chapter1.cpp | 2 +- .../ShadowfangKeep/shadowfang_keep.cpp | 12 +++--- .../UtgardeKeep/boss_ingvar_the_plunderer.cpp | 9 ++--- 4 files changed, 54 insertions(+), 13 deletions(-) create mode 100644 sql/updates/world/2013_04_16_02_world_creature_text.sql (limited to 'src/server/scripts') diff --git a/sql/updates/world/2013_04_16_02_world_creature_text.sql b/sql/updates/world/2013_04_16_02_world_creature_text.sql new file mode 100644 index 00000000000..034c632d12a --- /dev/null +++ b/sql/updates/world/2013_04_16_02_world_creature_text.sql @@ -0,0 +1,44 @@ +UPDATE `creature_text` SET `entry`=29227 WHERE `entry`=29173 AND `groupid`=76; +UPDATE `creature_text` SET `entry`=36794 WHERE `entry`=36658 AND `groupid` IN (1,2); + +DELETE FROM `creature_text` WHERE `entry` IN (18879,17491); +INSERT INTO `creature_text`(`entry`,`groupid`,`id`,`text`,`type`,`comment`) VALUES +(18879,0,0,'The %s is very weak',16,'Phase Hunter - Emote'), +(17491,0,0,'Gakarah ma!',12,'Laughing Skull Rogue'), +(17491,0,1,'We are the true Horde!',12,'Laughing Skull Rogue'); + +DELETE FROM `smart_scripts` WHERE `entryorguid`=26670; +INSERT INTO `smart_scripts` VALUES +(26670,0,0,1,1,0,100,6,0,0,0,0,21,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter - Out Of Combat - Allow Combat Movement'), +(26670,0,1,0,61,0,100,0,0,0,0,0,20,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter - Out Of Combat - Start Auto Attack'), +(26670,0,2,3,4,0,100,3,0,0,0,0,11,48854,0,0,0,0,0,2,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter (Normal) - On Aggro - Cast Shoot'), +(26670,0,3,0,61,0,100,0,0,0,0,0,23,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter (Normal) - On Aggro - Increment Phase'), +(26670,0,4,5,9,1,100,2,5,30,5000,8000,11,48854,0,0,0,0,0,2,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter (Normal) - At 5 - 30 Range - Cast Shoot'), +(26670,0,5,0,61,0,100,0,0,0,0,0,40,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter (Normal) - At 5 - 30 Range - Display ranged weapon'), +(26670,0,6,7,4,0,100,5,0,0,0,0,11,59241,0,0,0,0,0,2,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter (Heroic) - On Aggro - Cast Shoot'), +(26670,0,7,0,61,0,100,0,0,0,0,0,23,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter (Heroic) - On Aggro - Increment Phase'), +(26670,0,8,9,9,1,100,4,5,30,5000,8000,11,59241,0,0,0,0,0,2,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter (Heroic) - At 5 - 30 Range - Cast Shoot'), +(26670,0,9,0,61,0,100,0,0,0,0,0,40,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter (Heroic) - At 5 - 30 Range - Display ranged weapon'), +(26670,0,10,11,9,1,100,6,25,80,0,0,21,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter - At 25 - 80 Range - Allow Combat Movement'), +(26670,0,11,0,61,0,100,0,0,0,0,0,20,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter - At 25 - 80 Range - Start Auto Attack'), +(26670,0,12,13,9,1,100,6,0,5,0,0,21,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter - At 0 - 5 Range - Allow Combat Movement'), +(26670,0,13,14,61,0,100,0,0,0,0,0,40,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter - At 0 - 5 Range - Display melee weapon'), +(26670,0,14,0,61,0,100,0,0,0,0,0,20,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter - At 0 - 5 Range - Start Auto Attack'), +(26670,0,15,16,9,1,100,6,5,15,0,0,21,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter - At 5 - 15 Range - Allow Combat Movement'), +(26670,0,16,0,61,0,100,0,0,0,0,0,20,0,0,0,0,0,0,1,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter - At 5 - 15 Range - Start Auto Attack'),(26670,0,17,17,0,0,100,2,9000,14000,22000,26000,11,48871,0,0,0,0,0,5,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter (Normal) - In Combat - Cast Aimed Shot'),(26670,0,18,0,61,0,100,0,0,0,0,0,40,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter (Normal) - In Combat - Display ranged weapon'),(26670,0,19,20,0,0,100,4,9000,14000,22000,26000,11,59243,0,0,0,0,0,5,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter (Heroic) - In Combat - Cast Aimed Shot'),(26670,0,20,0,61,0,100,0,0,0,0,0,40,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter (Heroic) - In Combat - Display ranged weapon'),(26670,0,21,22,0,0,100,2,14000,17000,24000,27000,11,48872,1,0,0,0,0,6,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter (Normal) - In Combat - Cast Multi-Shot'),(26670,0,22,0,61,0,100,0,0,0,0,0,40,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter (Normal) - In Combat - Display ranged weapon'),(26670,0,23,24,0,0,100,4,14000,17000,24000,27000,11,59244,1,0,0,0,0,6,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter (Heroic) - In Combat - Cast Multi-Shot'),(26670,0,24,0,61,0,100,0,0,0,0,0,40,2,0,0,0,0,0,1,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter (Heroic) - In Combat - Display ranged weapon'),(26670,0,25,0,2,0,100,7,0,15,0,0,23,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter - At 15% HP - Increment Phase'),(26670,0,26,27,2,2,100,7,0,15,0,0,21,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter - At 15% HP - Allow Combat Movement'),(26670,0,27,0,61,0,100,0,0,0,0,0,25,1,0,0,0,0,0,0,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter - At 15% HP - Flee For Assist'),(26670,0,28,0,7,0,100,6,0,0,0,0,40,1,0,0,0,0,0,1,0,0,0,0,0,0,0,'Ymirjar Flesh Hunter - On Evade - Display melee weapon'); + +DELETE FROM `creature_text` WHERE `entry` IN (23980,23954); +INSERT INTO `creature_text`(`entry`,`groupid`,`text`,`type`,`sound`,`comment`) VALUES +(23954,0,'I\'ll paint my face with your blood!',14,13207,'ingvar SAY_AGGRO_FIRST'), +(23954,1,'Mjul orm agn gjor!',14,13212,'ingvar SAY_KILL_FIRST'), +(23954,2,'My life for the... death god!',14,13213,'ingvar SAY_DEATH_FIRST'), +(23980,0,'I return! A second chance to carve out your skull!',14,13209,'ingvar SAY_AGGRO_SECOND'), +(23980,1,'I am a warrior born!',14,13214,'ingvar SAY_KILL_SECOND'), +(23980,2,'No! I can do... better! I can...',14,13211,'ingvar SAY_DEATH_SECOND'); + +DELETE FROM `creature_text` WHERE `entry`=11440; +INSERT INTO `creature_text`(`entry`,`id`,`text`,`type`,`probability`,`comment`) VALUES +(11440,0,'I\'ll crush you!',12,100,'Gordok Enforcer Aggro'), +(11440,1,'Me not feel so good.',12,100,'Gordok Enforcer Aggro'), +(11440,2,'Me smash! You die!',12,100,'Gordok Enforcer Aggro'), +(11440,3,'Raaar!!! Me smash $R!',12,100,'Gordok Enforcer Aggro'); diff --git a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp index 7f6a9c1d63b..c479e4ef432 100644 --- a/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletEnclave/chapter1.cpp @@ -371,7 +371,7 @@ public: creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_IMMUNE_TO_PC); creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNK_15); - sCreatureTextMgr->SendChat(creature, SAY_EVENT_ATTACK, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player); + sCreatureTextMgr->SendChat(creature, SAY_DUEL, 0, CHAT_MSG_ADDON, LANG_ADDON, TEXT_RANGE_NORMAL, 0, TEAM_OTHER, false, player); player->CastSpell(creature, SPELL_DUEL, false); player->CastSpell(player, SPELL_DUEL_FLAG, true); diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp index 7af7e1e78bc..156d31c804f 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.cpp @@ -98,34 +98,32 @@ public: npc_shadowfang_prisonerAI(Creature* creature) : npc_escortAI(creature) { instance = creature->GetInstanceScript(); - uiNpcEntry = creature->GetEntry(); } InstanceScript* instance; - uint32 uiNpcEntry; void WaypointReached(uint32 waypointId) { switch (waypointId) { case 0: - if (uiNpcEntry == NPC_ASH) + if (me->GetEntry() == NPC_ASH) Talk(SAY_FREE_AS); else Talk(SAY_FREE_AD); break; case 10: - if (uiNpcEntry == NPC_ASH) + if (me->GetEntry() == NPC_ASH) Talk(SAY_OPEN_DOOR_AS); else Talk(SAY_OPEN_DOOR_AD); break; case 11: - if (uiNpcEntry == NPC_ASH) + if (me->GetEntry() == NPC_ASH) DoCast(me, SPELL_UNLOCK); break; case 12: - if (uiNpcEntry == NPC_ASH) + if (me->GetEntry() == NPC_ASH) Talk(SAY_POST_DOOR_AS); else Talk(SAY_POST1_DOOR_AD); @@ -134,7 +132,7 @@ public: instance->SetData(TYPE_FREE_NPC, DONE); break; case 13: - if (uiNpcEntry != NPC_ASH) + if (me->GetEntry() != NPC_ASH) Talk(SAY_POST2_DOOR_AD); break; } diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp index 215630ac5fa..dfb12a03c33 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/boss_ingvar_the_plunderer.cpp @@ -30,13 +30,12 @@ enum Yells { //Yells Ingvar YELL_AGGRO_1 = 0, - YELL_AGGRO_2 = 1, - + YELL_KILL_1 = 1, YELL_DEAD_1 = 2, - YELL_DEAD_2 = 3, - YELL_KILL_1 = 4, - YELL_KILL_2 = 5, + YELL_AGGRO_2 = 0, + YELL_KILL_2 = 1, + YELL_DEAD_2 = 2 }; enum Creatures -- cgit v1.2.3 From 678cade1163080263bdea9e349fbb67b7af15ea7 Mon Sep 17 00:00:00 2001 From: xjose93 Date: Tue, 16 Apr 2013 17:08:58 +0200 Subject: Core/Commands: rename guilds (.guild rename "old guildname" "new guildname") --- sql/updates/world/2013_04_16_01_world_misc.sql | 10 +++++ src/server/game/Guilds/Guild.cpp | 13 ++++++ src/server/game/Guilds/Guild.h | 2 + src/server/game/Miscellaneous/Language.h | 4 +- src/server/scripts/Commands/cs_guild.cpp | 50 ++++++++++++++++++++++ .../Database/Implementation/CharacterDatabase.cpp | 2 + .../Database/Implementation/CharacterDatabase.h | 1 + 7 files changed, 81 insertions(+), 1 deletion(-) create mode 100644 sql/updates/world/2013_04_16_01_world_misc.sql (limited to 'src/server/scripts') diff --git a/sql/updates/world/2013_04_16_01_world_misc.sql b/sql/updates/world/2013_04_16_01_world_misc.sql new file mode 100644 index 00000000000..4c7561a0e69 --- /dev/null +++ b/sql/updates/world/2013_04_16_01_world_misc.sql @@ -0,0 +1,10 @@ +DELETE FROM `command` WHERE `name` = 'guild rename'; +INSERT INTO `command` (`name`, `security`, `help`) VALUES +('guild rename', 3, 'Syntax: .guild rename "$GuildName" "$NewGuildName" \n\n Rename a guild named $GuildName with $NewGuildName. Guild name and new guild name must in quotes.'); + +SET @ENTRY1 := 96; +SET @ENTRY2 := 97; +DELETE FROM `trinity_string` WHERE `entry` IN (@ENTRY1, @ENTRY2); +INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES +(@ENTRY1, 'The guild name \'%s\' is already taken'), +(@ENTRY2, 'Changed guild name \'%s\' to \'%s\''); diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index 158a20d67d1..2ec9130f263 100644 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -1285,6 +1285,19 @@ void Guild::OnPlayerStatusChange(Player* player, uint32 flag, bool state) } } +bool Guild::SetName(std::string const& name) +{ + if (m_name == name || name.empty() || name.length() > 24 || sObjectMgr->IsReservedName(name) || !ObjectMgr::IsValidCharterName(name)) + return false; + + m_name = name; + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_GUILD_NAME); + stmt->setString(0, m_name); + stmt->setUInt32(1, GetId()); + CharacterDatabase.Execute(stmt); + return true; +} + void Guild::HandleRoster(WorldSession* session /*= NULL*/) { // Guess size diff --git a/src/server/game/Guilds/Guild.h b/src/server/game/Guilds/Guild.h index 6af397f6fed..f6a3e095957 100644 --- a/src/server/game/Guilds/Guild.h +++ b/src/server/game/Guilds/Guild.h @@ -657,6 +657,8 @@ public: std::string const& GetMOTD() const { return m_motd; } std::string const& GetInfo() const { return m_info; } + bool SetName(std::string const& name); + // Handle client commands void HandleRoster(WorldSession* session = NULL); // NULL = broadcast void HandleQuery(WorldSession* session); diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index f4379e59f19..e03adf2a4a1 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -119,7 +119,9 @@ enum TrinityStrings LANG_RBAC_LIST_GROUPS_HEADER = 93, LANG_RBAC_LIST_ROLES_HEADER = 94, LANG_RBAC_LIST_PERMISSIONS_HEADER = 95, - // Room for more level 0 96-99 not used + LANG_GUILD_RENAME_ALREADY_EXISTS = 96, + LANG_GUILD_RENAME_DONE = 97, + // Room for more level 0 98-99 not used // level 1 chat LANG_GLOBAL_NOTIFY = 100, diff --git a/src/server/scripts/Commands/cs_guild.cpp b/src/server/scripts/Commands/cs_guild.cpp index afe792048f6..9d2214c82e9 100644 --- a/src/server/scripts/Commands/cs_guild.cpp +++ b/src/server/scripts/Commands/cs_guild.cpp @@ -43,6 +43,7 @@ public: { "invite", SEC_GAMEMASTER, true, &HandleGuildInviteCommand, "", NULL }, { "uninvite", SEC_GAMEMASTER, true, &HandleGuildUninviteCommand, "", NULL }, { "rank", SEC_GAMEMASTER, true, &HandleGuildRankCommand, "", NULL }, + { "rename", SEC_GAMEMASTER, true, &HandleGuildRenameCommand, "", NULL }, { NULL, 0, false, NULL, "", NULL } }; static ChatCommand commandTable[] = @@ -192,6 +193,55 @@ public: uint8 newRank = uint8(atoi(rankStr)); return targetGuild->ChangeMemberRank(targetGuid, newRank); } + + static bool HandleGuildRenameCommand(ChatHandler* handler, char const* _args) + { + if (!*_args) + return false; + + char *args = (char *)_args; + + char const* oldGuildStr = handler->extractQuotedArg(args); + if (!oldGuildStr) + { + handler->SendSysMessage(LANG_BAD_VALUE); + handler->SetSentErrorMessage(true); + return false; + } + + char const* newGuildStr = handler->extractQuotedArg(strtok(NULL, "")); + if (!newGuildStr) + { + handler->SendSysMessage(LANG_INSERT_GUILD_NAME); + handler->SetSentErrorMessage(true); + return false; + } + + Guild* guild = sGuildMgr->GetGuildByName(oldGuildStr); + if (!guild) + { + handler->PSendSysMessage(LANG_COMMAND_COULDNOTFIND, oldGuildStr); + handler->SetSentErrorMessage(true); + return false; + } + + if (sGuildMgr->GetGuildByName(newGuildStr)) + { + handler->PSendSysMessage(LANG_GUILD_RENAME_ALREADY_EXISTS, newGuildStr); + handler->SetSentErrorMessage(true); + return false; + } + + if (!guild->SetName(newGuildStr)) + { + handler->SendSysMessage(LANG_BAD_VALUE); + handler->SetSentErrorMessage(true); + return false; + } + + handler->PSendSysMessage(LANG_GUILD_RENAME_DONE, oldGuildStr, newGuildStr); + return true; + } }; void AddSC_guild_commandscript() diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index 2b57693db9b..f834ead6a5b 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -171,6 +171,8 @@ void CharacterDatabaseConnection::DoPrepareStatements() // 0: uint32, 1: string, 2: uint32, 3: string, 4: string, 5: uint64, 6-10: uint32, 11: uint64 PrepareStatement(CHAR_INS_GUILD, "INSERT INTO guild (guildid, name, leaderguid, info, motd, createdate, EmblemStyle, EmblemColor, BorderStyle, BorderColor, BackgroundColor, BankMoney) VALUES(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(CHAR_DEL_GUILD, "DELETE FROM guild WHERE guildid = ?", CONNECTION_ASYNC); // 0: uint32 + // 0: string, 1: uint32 + PrepareStatement(CHAR_UPD_GUILD_NAME, "UPDATE guild SET name = ? WHERE guildid = ?", CONNECTION_ASYNC); // 0: uint32, 1: uint32, 2: uint8, 4: string, 5: string PrepareStatement(CHAR_INS_GUILD_MEMBER, "INSERT INTO guild_member (guildid, guid, rank, pnote, offnote) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(CHAR_DEL_GUILD_MEMBER, "DELETE FROM guild_member WHERE guid = ?", CONNECTION_ASYNC); // 0: uint32 diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index 3eb6a726007..65878b4c577 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -166,6 +166,7 @@ enum CharacterDatabaseStatements CHAR_INS_GUILD, CHAR_DEL_GUILD, + CHAR_UPD_GUILD_NAME, CHAR_INS_GUILD_MEMBER, CHAR_DEL_GUILD_MEMBER, CHAR_DEL_GUILD_MEMBERS, -- cgit v1.2.3 From 7542049eba46205572b9c9498d6891df31d0ca5b Mon Sep 17 00:00:00 2001 From: Bezo Date: Mon, 15 Apr 2013 14:56:00 +0300 Subject: [Ip2nationLock] Implement the ip2nation lock country. --- sql/base/auth_database.sql | 1 + sql/updates/auth/2013_04_22_00_auth_misc.sql | 21 ++++++++ sql/updates/world/2013_04_22_00_world_misc.sql | 7 +++ src/server/authserver/Server/AuthSocket.cpp | 40 ++++++++++++--- src/server/scripts/Commands/cs_account.cpp | 60 +++++++++++++++++++++- src/server/scripts/Commands/cs_misc.cpp | 2 +- .../Database/Implementation/LoginDatabase.cpp | 5 +- .../shared/Database/Implementation/LoginDatabase.h | 3 ++ .../Database/Implementation/WorldDatabase.cpp | 1 - .../shared/Database/Implementation/WorldDatabase.h | 1 - 10 files changed, 129 insertions(+), 12 deletions(-) create mode 100644 sql/updates/auth/2013_04_22_00_auth_misc.sql create mode 100644 sql/updates/world/2013_04_22_00_world_misc.sql (limited to 'src/server/scripts') diff --git a/sql/base/auth_database.sql b/sql/base/auth_database.sql index c3752e980dd..943be73b20f 100644 --- a/sql/base/auth_database.sql +++ b/sql/base/auth_database.sql @@ -34,6 +34,7 @@ CREATE TABLE `account` ( `last_ip` varchar(15) NOT NULL DEFAULT '127.0.0.1', `failed_logins` int(10) unsigned NOT NULL DEFAULT '0', `locked` tinyint(3) unsigned NOT NULL DEFAULT '0', + `lock_country` varchar(2) NOT NULL DEFAULT '00', `last_login` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `online` tinyint(3) unsigned NOT NULL DEFAULT '0', `expansion` tinyint(3) unsigned NOT NULL DEFAULT '2', diff --git a/sql/updates/auth/2013_04_22_00_auth_misc.sql b/sql/updates/auth/2013_04_22_00_auth_misc.sql new file mode 100644 index 00000000000..508c0aab944 --- /dev/null +++ b/sql/updates/auth/2013_04_22_00_auth_misc.sql @@ -0,0 +1,21 @@ +ALTER TABLE `account` ADD COLUMN `lock_country` VARCHAR(2) NOT NULL DEFAULT '00' AFTER `locked`; + +DROP TABLE IF EXISTS ip2nation; +CREATE TABLE ip2nation ( + ip int(11) unsigned NOT NULL default '0', + country char(2) NOT NULL default '', + KEY ip (ip) +); + +DROP TABLE IF EXISTS ip2nationCountries; +CREATE TABLE ip2nationCountries ( + code varchar(4) NOT NULL default '', + iso_code_2 varchar(2) NOT NULL default '', + iso_code_3 varchar(3) default '', + iso_country varchar(255) NOT NULL default '', + country varchar(255) NOT NULL default '', + lat float NOT NULL default '0', + lon float NOT NULL default '0', + PRIMARY KEY (code), + KEY code (code) +); diff --git a/sql/updates/world/2013_04_22_00_world_misc.sql b/sql/updates/world/2013_04_22_00_world_misc.sql new file mode 100644 index 00000000000..99eee20ffef --- /dev/null +++ b/sql/updates/world/2013_04_22_00_world_misc.sql @@ -0,0 +1,7 @@ +DROP TABLE IF EXISTS ip2nation; +DROP TABLE IF EXISTS ip2nationCountries; + +DELETE FROM `command` WHERE `name` in ('account lock', 'account lock ip', 'account lock country'); +INSERT INTO `command` (`name`,`security`,`help`) VALUES +('account lock ip', 0, 'Syntax: .account lock ip [on|off]\nAllow login from account only from current used IP or remove this requirement.'), +('account lock country', 0, 'Syntax: .account lock country [on|off]\nAllow login from account only from current used Country or remove this requirement.'); diff --git a/src/server/authserver/Server/AuthSocket.cpp b/src/server/authserver/Server/AuthSocket.cpp index 32ddf029f1c..a080a038314 100644 --- a/src/server/authserver/Server/AuthSocket.cpp +++ b/src/server/authserver/Server/AuthSocket.cpp @@ -386,17 +386,45 @@ bool AuthSocket::_HandleLogonChallenge() sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account '%s' is locked to IP - '%s'", _login.c_str(), fields[3].GetCString()); sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Player address is '%s'", ip_address.c_str()); - if (strcmp(fields[3].GetCString(), ip_address.c_str())) + if (strcmp(fields[4].GetCString(), ip_address.c_str())) { sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account IP differs"); - pkt << (uint8) WOW_FAIL_SUSPENDED; + pkt << uint8(WOW_FAIL_LOCKED_ENFORCED); locked = true; } else sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account IP matches"); } else + { sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account '%s' is not locked to ip", _login.c_str()); + std::string accountCountry = fields[3].GetString(); + if (accountCountry.empty() || accountCountry == "00") + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account '%s' is not locked to country", _login.c_str()); + else if (!accountCountry.empty()) + { + uint32 ip = inet_addr(ip_address.c_str()); + EndianConvertReverse(ip); + + stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGON_COUNTRY); + stmt->setUInt32(0, ip); + if (PreparedQueryResult sessionCountryQuery = LoginDatabase.Query(stmt)) + { + std::string loginCountry = (*sessionCountryQuery)[0].GetString(); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account '%s' is locked to country: '%s' Player country is '%s'", _login.c_str(), accountCountry.c_str(), loginCountry.c_str()); + if (loginCountry != accountCountry) + { + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account country differs."); + pkt << uint8(WOW_FAIL_UNLOCKABLE_LOCK); + locked = true; + } + else + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] Account country matches"); + } + else + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[AuthChallenge] IP2NATION Table empty"); + } + } if (!locked) { @@ -426,8 +454,8 @@ bool AuthSocket::_HandleLogonChallenge() std::string rI = fields[0].GetString(); // Don't calculate (v, s) if there are already some in the database - std::string databaseV = fields[5].GetString(); - std::string databaseS = fields[6].GetString(); + std::string databaseV = fields[6].GetString(); + std::string databaseS = fields[7].GetString(); sLog->outDebug(LOG_FILTER_NETWORKIO, "database authentication values: v='%s' s='%s'", databaseV.c_str(), databaseS.c_str()); @@ -484,7 +512,7 @@ bool AuthSocket::_HandleLogonChallenge() if (securityFlags & 0x04) // Security token input pkt << uint8(1); - uint8 secLevel = fields[4].GetUInt8(); + uint8 secLevel = fields[5].GetUInt8(); _accountSecurityLevel = secLevel <= SEC_ADMINISTRATOR ? AccountTypes(secLevel) : SEC_ADMINISTRATOR; _localizationName.resize(4); @@ -498,7 +526,7 @@ bool AuthSocket::_HandleLogonChallenge() } } else //no account - pkt << (uint8)WOW_FAIL_UNKNOWN_ACCOUNT; + pkt << uint8(WOW_FAIL_UNKNOWN_ACCOUNT); } socket().send((char const*)pkt.contents(), pkt.size()); diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index 3953beab3da..cf2816c985e 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -42,13 +42,19 @@ public: { "password", SEC_CONSOLE, true, &HandleAccountSetPasswordCommand, "", NULL }, { NULL, SEC_PLAYER, false, NULL, "", NULL } }; + static ChatCommand accountLockCommandTable[] = + { + { "country", SEC_PLAYER, true, &HandleAccountLockCountryCommand, "", NULL }, + { "ip", SEC_PLAYER, true, &HandleAccountLockIpCommand, "", NULL }, + { NULL, SEC_PLAYER, false, NULL, "", NULL }, + }; static ChatCommand accountCommandTable[] = { { "addon", SEC_MODERATOR, false, &HandleAccountAddonCommand, "", NULL }, { "create", SEC_CONSOLE, true, &HandleAccountCreateCommand, "", NULL }, { "delete", SEC_CONSOLE, true, &HandleAccountDeleteCommand, "", NULL }, { "onlinelist", SEC_CONSOLE, true, &HandleAccountOnlineListCommand, "", NULL }, - { "lock", SEC_PLAYER, false, &HandleAccountLockCommand, "", NULL }, + { "lock", SEC_PLAYER, false, NULL, "", accountLockCommandTable }, { "set", SEC_ADMINISTRATOR, true, NULL, "", accountSetCommandTable }, { "password", SEC_PLAYER, false, &HandleAccountPasswordCommand, "", NULL }, { "", SEC_PLAYER, false, &HandleAccountCommand, "", NULL }, @@ -245,7 +251,57 @@ public: return true; } - static bool HandleAccountLockCommand(ChatHandler* handler, char const* args) + static bool HandleAccountLockCountryCommand(ChatHandler* handler, char const* args) + { + if (!*args) + { + handler->SendSysMessage(LANG_USE_BOL); + handler->SetSentErrorMessage(true); + return false; + } + std::string param = (char*)args; + + if (!param.empty()) + { + if (param == "on") + { + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_LOGON_COUNTRY); + uint32 ip = inet_addr(handler->GetSession()->GetRemoteAddress().c_str()); + EndianConvertReverse(ip); + stmt->setUInt32(0, ip); + PreparedQueryResult result = LoginDatabase.Query(stmt); + if (result) + { + Field* fields = result->Fetch(); + std::string country = fields[0].GetString(); + stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_LOCK_CONTRY); + stmt->setString(0, country); + stmt->setUInt32(1, handler->GetSession()->GetAccountId()); + LoginDatabase.Execute(stmt); + handler->PSendSysMessage(LANG_COMMAND_ACCLOCKLOCKED); + } + else + { + handler->PSendSysMessage("[IP2NATION] Table empty"); + sLog->outDebug(LOG_FILTER_AUTHSERVER, "[IP2NATION] Table empty"); + } + } + else if (param == "off") + { + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_LOCK_CONTRY); + stmt->setString(0, "00"); + stmt->setUInt32(1, handler->GetSession()->GetAccountId()); + LoginDatabase.Execute(stmt); + handler->PSendSysMessage(LANG_COMMAND_ACCLOCKUNLOCKED); + } + return true; + } + handler->SendSysMessage(LANG_USE_BOL); + handler->SetSentErrorMessage(true); + return false; + } + + static bool HandleAccountLockIpCommand(ChatHandler* handler, char const* args) { if (!*args) { diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index c6d80cea3a5..bb7d6ea9594 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1587,7 +1587,7 @@ public: EndianConvertReverse(ip); #endif - PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_SEL_IP2NATION_COUNTRY); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP2NATION_COUNTRY); stmt->setUInt32(0, ip); diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp index a23294a038c..4b0ee041603 100644 --- a/src/server/shared/Database/Implementation/LoginDatabase.cpp +++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp @@ -37,7 +37,8 @@ void LoginDatabaseConnection::DoPrepareStatements() PrepareStatement(LOGIN_SEL_SESSIONKEY, "SELECT a.sessionkey, a.id, aa.gmlevel FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE username = ?", CONNECTION_SYNCH); PrepareStatement(LOGIN_UPD_VS, "UPDATE account SET v = ?, s = ? WHERE username = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_UPD_LOGONPROOF, "UPDATE account SET sessionkey = ?, last_ip = ?, last_login = NOW(), locale = ?, failed_logins = 0, os = ? WHERE username = ?", CONNECTION_ASYNC); - PrepareStatement(LOGIN_SEL_LOGONCHALLENGE, "SELECT a.sha_pass_hash, a.id, a.locked, a.last_ip, aa.gmlevel, a.v, a.s FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE a.username = ?", CONNECTION_SYNCH); + PrepareStatement(LOGIN_SEL_LOGONCHALLENGE, "SELECT a.sha_pass_hash, a.id, a.locked, a.lock_country, a.last_ip, aa.gmlevel, a.v, a.s FROM account a LEFT JOIN account_access aa ON (a.id = aa.id) WHERE a.username = ?", CONNECTION_SYNCH); + PrepareStatement(LOGIN_SEL_LOGON_COUNTRY, "SELECT country FROM ip2nation WHERE ip < ? ORDER BY ip DESC LIMIT 0,1", CONNECTION_SYNCH); PrepareStatement(LOGIN_UPD_FAILEDLOGINS, "UPDATE account SET failed_logins = failed_logins + 1 WHERE username = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_SEL_FAILEDLOGINS, "SELECT id, failed_logins FROM account WHERE username = ?", CONNECTION_SYNCH); PrepareStatement(LOGIN_SEL_ACCOUNT_ID_BY_NAME, "SELECT id FROM account WHERE username = ?", CONNECTION_SYNCH); @@ -59,6 +60,7 @@ void LoginDatabaseConnection::DoPrepareStatements() PrepareStatement(LOGIN_INS_REALM_CHARACTERS_INIT, "INSERT INTO realmcharacters (realmid, acctid, numchars) SELECT realmlist.id, account.id, 0 FROM realmlist, account LEFT JOIN realmcharacters ON acctid=account.id WHERE acctid IS NULL", CONNECTION_ASYNC); PrepareStatement(LOGIN_UPD_EXPANSION, "UPDATE account SET expansion = ? WHERE id = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_UPD_ACCOUNT_LOCK, "UPDATE account SET locked = ? WHERE id = ?", CONNECTION_ASYNC); + PrepareStatement(LOGIN_UPD_ACCOUNT_LOCK_CONTRY, "UPDATE account SET lock_country = ? WHERE id = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_INS_LOG, "INSERT INTO logs (time, realm, type, level, string) VALUES (?, ?, ?, ?, ?)", CONNECTION_ASYNC); PrepareStatement(LOGIN_UPD_USERNAME, "UPDATE account SET v = 0, s = 0, username = ?, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC); PrepareStatement(LOGIN_UPD_PASSWORD, "UPDATE account SET v = 0, s = 0, sha_pass_hash = ? WHERE id = ?", CONNECTION_ASYNC); @@ -88,6 +90,7 @@ void LoginDatabaseConnection::DoPrepareStatements() PrepareStatement(LOGIN_SEL_ACCOUNT_WHOIS, "SELECT username, email, last_ip FROM account WHERE id = ?", CONNECTION_SYNCH); PrepareStatement(LOGIN_SEL_REALMLIST_SECURITY_LEVEL, "SELECT allowedSecurityLevel from realmlist WHERE id = ?", CONNECTION_SYNCH); PrepareStatement(LOGIN_DEL_ACCOUNT, "DELETE FROM account WHERE id = ?", CONNECTION_ASYNC); + PrepareStatement(LOGIN_SEL_IP2NATION_COUNTRY, "SELECT c.country FROM ip2nationCountries c, ip2nation i WHERE i.ip < ? AND c.code = i.country ORDER BY i.ip DESC LIMIT 0,1", CONNECTION_SYNCH); PrepareStatement(LOGIN_SEL_ACCOUNT_ACCESS_BY_ID, "SELECT gmlevel, RealmID FROM account_access WHERE id = ? and (RealmID = ? OR RealmID = -1) ORDER BY gmlevel desc", CONNECTION_SYNCH); diff --git a/src/server/shared/Database/Implementation/LoginDatabase.h b/src/server/shared/Database/Implementation/LoginDatabase.h index 939cc4b4790..0f5a388a0b0 100644 --- a/src/server/shared/Database/Implementation/LoginDatabase.h +++ b/src/server/shared/Database/Implementation/LoginDatabase.h @@ -56,6 +56,7 @@ enum LoginDatabaseStatements LOGIN_UPD_VS, LOGIN_UPD_LOGONPROOF, LOGIN_SEL_LOGONCHALLENGE, + LOGIN_SEL_LOGON_COUNTRY, LOGIN_UPD_FAILEDLOGINS, LOGIN_SEL_FAILEDLOGINS, LOGIN_SEL_ACCOUNT_ID_BY_NAME, @@ -79,6 +80,7 @@ enum LoginDatabaseStatements LOGIN_INS_REALM_CHARACTERS_INIT, LOGIN_UPD_EXPANSION, LOGIN_UPD_ACCOUNT_LOCK, + LOGIN_UPD_ACCOUNT_LOCK_CONTRY, LOGIN_INS_LOG, LOGIN_UPD_USERNAME, LOGIN_UPD_PASSWORD, @@ -108,6 +110,7 @@ enum LoginDatabaseStatements LOGIN_SEL_ACCOUNT_WHOIS, LOGIN_SEL_REALMLIST_SECURITY_LEVEL, LOGIN_DEL_ACCOUNT, + LOGIN_SEL_IP2NATION_COUNTRY, LOGIN_SEL_ACCOUNT_ACCESS_BY_ID, LOGIN_SEL_RBAC_ACCOUNT_GROUPS, diff --git a/src/server/shared/Database/Implementation/WorldDatabase.cpp b/src/server/shared/Database/Implementation/WorldDatabase.cpp index 89f3cf8fdce..fa7818d2dca 100644 --- a/src/server/shared/Database/Implementation/WorldDatabase.cpp +++ b/src/server/shared/Database/Implementation/WorldDatabase.cpp @@ -80,7 +80,6 @@ void WorldDatabaseConnection::DoPrepareStatements() PrepareStatement(WORLD_SEL_COMMANDS, "SELECT name, security, help FROM command", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_CREATURE_TEMPLATE, "SELECT difficulty_entry_1, difficulty_entry_2, difficulty_entry_3, KillCredit1, KillCredit2, modelid1, modelid2, modelid3, modelid4, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, exp, faction_A, faction_H, npcflag, speed_walk, speed_run, scale, rank, mindmg, maxdmg, dmgschool, attackpower, dmg_multiplier, baseattacktime, rangeattacktime, unit_class, unit_flags, unit_flags2, dynamicflags, family, trainer_type, trainer_spell, trainer_class, trainer_race, minrangedmg, maxrangedmg, rangedattackpower, type, type_flags, lootid, pickpocketloot, skinloot, resistance1, resistance2, resistance3, resistance4, resistance5, resistance6, spell1, spell2, spell3, spell4, spell5, spell6, spell7, spell8, PetSpellDataId, VehicleId, mingold, maxgold, AIName, MovementType, InhabitType, HoverHeight, Health_mod, Mana_mod, Armor_mod, RacialLeader, questItem1, questItem2, questItem3, questItem4, questItem5, questItem6, movementId, RegenHealth, mechanic_immune_mask, flags_extra, ScriptName FROM creature_template WHERE entry = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_WAYPOINT_SCRIPT_BY_ID, "SELECT guid, delay, command, datalong, datalong2, dataint, x, y, z, o FROM waypoint_scripts WHERE id = ?", CONNECTION_SYNCH); - PrepareStatement(WORLD_SEL_IP2NATION_COUNTRY, "SELECT c.country FROM ip2nationCountries c, ip2nation i WHERE i.ip < ? AND c.code = i.country ORDER BY i.ip DESC LIMIT 0,1", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_ITEM_TEMPLATE_BY_NAME, "SELECT entry FROM item_template WHERE name = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_CREATURE_BY_ID, "SELECT guid FROM creature WHERE id = ?", CONNECTION_SYNCH); PrepareStatement(WORLD_SEL_GAMEOBJECT_NEAREST, "SELECT guid, id, position_x, position_y, position_z, map, (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) AS order_ FROM gameobject WHERE map = ? AND (POW(position_x - ?, 2) + POW(position_y - ?, 2) + POW(position_z - ?, 2)) <= ? ORDER BY order_", CONNECTION_SYNCH); diff --git a/src/server/shared/Database/Implementation/WorldDatabase.h b/src/server/shared/Database/Implementation/WorldDatabase.h index 032baf29dd9..d8c3c69dbba 100644 --- a/src/server/shared/Database/Implementation/WorldDatabase.h +++ b/src/server/shared/Database/Implementation/WorldDatabase.h @@ -100,7 +100,6 @@ enum WorldDatabaseStatements WORLD_SEL_COMMANDS, WORLD_SEL_CREATURE_TEMPLATE, WORLD_SEL_WAYPOINT_SCRIPT_BY_ID, - WORLD_SEL_IP2NATION_COUNTRY, WORLD_SEL_ITEM_TEMPLATE_BY_NAME, WORLD_SEL_CREATURE_BY_ID, WORLD_SEL_GAMEOBJECT_NEAREST, -- cgit v1.2.3 From 4537d4082eb3d23fcf2e6d7038d7da9dbecd15b6 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 22 Apr 2013 17:37:13 +0200 Subject: Scripts/Commands: Corrected queried database for ip2nation in .pinfo command --- src/server/scripts/Commands/cs_misc.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/scripts/Commands/cs_misc.cpp b/src/server/scripts/Commands/cs_misc.cpp index bb7d6ea9594..9fa143673ca 100644 --- a/src/server/scripts/Commands/cs_misc.cpp +++ b/src/server/scripts/Commands/cs_misc.cpp @@ -1588,12 +1588,8 @@ public: #endif PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_IP2NATION_COUNTRY); - stmt->setUInt32(0, ip); - - PreparedQueryResult result2 = WorldDatabase.Query(stmt); - - if (result2) + if (PreparedQueryResult result2 = LoginDatabase.Query(stmt)) { Field* fields2 = result2->Fetch(); lastIp.append(" ("); -- cgit v1.2.3 From f2b6b2f95e2664686e247ec0870fbb77a5770d54 Mon Sep 17 00:00:00 2001 From: xjose93 Date: Tue, 23 Apr 2013 15:33:42 +0200 Subject: Core/Commands: Improve .character rename [name], now can force rename .character rename [name] [newName] --- sql/updates/world/2013_04_29_00_world_misc.sql | 11 ++ src/server/game/Miscellaneous/Language.h | 5 +- src/server/scripts/Commands/cs_character.cpp | 121 ++++++++++++++++++--- .../Database/Implementation/CharacterDatabase.cpp | 1 + .../Database/Implementation/CharacterDatabase.h | 1 + 5 files changed, 123 insertions(+), 16 deletions(-) create mode 100644 sql/updates/world/2013_04_29_00_world_misc.sql (limited to 'src/server/scripts') diff --git a/sql/updates/world/2013_04_29_00_world_misc.sql b/sql/updates/world/2013_04_29_00_world_misc.sql new file mode 100644 index 00000000000..716a77be584 --- /dev/null +++ b/sql/updates/world/2013_04_29_00_world_misc.sql @@ -0,0 +1,11 @@ +DELETE FROM `command` WHERE `name` = 'character rename'; +INSERT INTO `command` (`name`, `security`, `help`) VALUES +('character rename', 2, 'Syntax: .character rename [$name] [$newName] \n\nMark selected in game or by $name in command character for rename at next login.\n\nIf $newName then the player will be forced rename.'); + +SET @ENTRY := 98; +SET @ENTRY1 := 167; +DELETE FROM `trinity_string` WHERE `entry` IN (@ENTRY, @ENTRY+1, @ENTRY1); +INSERT INTO `trinity_string` (`entry`, `content_default`) VALUES +(@ENTRY, '\'%s\' already exists as character name, choose another one'), +(@ENTRY+1, 'Player \'%s\' forced rename to \'%s\''), +(@ENTRY1, 'This name is reserved, choose another one'); diff --git a/src/server/game/Miscellaneous/Language.h b/src/server/game/Miscellaneous/Language.h index e03adf2a4a1..eb55e44c9ee 100644 --- a/src/server/game/Miscellaneous/Language.h +++ b/src/server/game/Miscellaneous/Language.h @@ -121,7 +121,8 @@ enum TrinityStrings LANG_RBAC_LIST_PERMISSIONS_HEADER = 95, LANG_GUILD_RENAME_ALREADY_EXISTS = 96, LANG_GUILD_RENAME_DONE = 97, - // Room for more level 0 98-99 not used + LANG_RENAME_PLAYER_ALREADY_EXISTS = 98, + LANG_RENAME_PLAYER_WITH_NEW_NAME = 99, // level 1 chat LANG_GLOBAL_NOTIFY = 100, @@ -198,7 +199,7 @@ enum TrinityStrings LANG_COMMAND_TELE_NOTFOUND = 164, LANG_COMMAND_TELE_PARAMETER = 165, LANG_COMMAND_TELE_NOLOCATION = 166, - // 167 // not used + LANG_RESERVED_NAME = 167, LANG_COMMAND_TELE_LOCATION = 168, LANG_MAIL_SENT = 169, diff --git a/src/server/scripts/Commands/cs_character.cpp b/src/server/scripts/Commands/cs_character.cpp index c29b62975ab..fdcf88177a9 100644 --- a/src/server/scripts/Commands/cs_character.cpp +++ b/src/server/scripts/Commands/cs_character.cpp @@ -308,28 +308,121 @@ public: if (!handler->extractPlayerTarget((char*)args, &target, &targetGuid, &targetName)) return false; - if (target) + char const* newNameStr = strtok(NULL, " "); + + if (newNameStr) { - // check online security - if (handler->HasLowerSecurity(target, 0)) + std::string playerOldName; + std::string newName = newNameStr; + + if (target) + { + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; + + playerOldName = target->GetName(); + } + else + { + // check offline security + if (handler->HasLowerSecurity(NULL, targetGuid)) + return false; + + sObjectMgr->GetPlayerNameByGUID(targetGuid, playerOldName); + } + + if (!normalizePlayerName(newName)) + { + handler->SendSysMessage(LANG_BAD_VALUE); + handler->SetSentErrorMessage(true); + return false; + } + + if (ObjectMgr::CheckPlayerName(newName, true) != CHAR_NAME_SUCCESS) + { + handler->SendSysMessage(LANG_BAD_VALUE); + handler->SetSentErrorMessage(true); + return false; + } + + if (WorldSession* session = handler->GetSession()) + { + if (!session->HasPermission(RBAC_PERM_SKIP_CHECK_CHARACTER_CREATION_RESERVEDNAME) && sObjectMgr->IsReservedName(newName)) + { + handler->SendSysMessage(LANG_RESERVED_NAME); + handler->SetSentErrorMessage(true); + return false; + } + } + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHECK_NAME); + stmt->setString(0, newName); + PreparedQueryResult result = CharacterDatabase.Query(stmt); + if (result) + { + handler->PSendSysMessage(LANG_RENAME_PLAYER_ALREADY_EXISTS, newName.c_str()); + handler->SetSentErrorMessage(true); return false; + } + + // Remove declined name from db + stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_DECLINED_NAME); + stmt->setUInt32(0, targetGuid); + CharacterDatabase.Execute(stmt); + + if (target) + { + target->SetName(newName); + + if (WorldSession* session = target->GetSession()) + session->KickPlayer(); + } + else + { + stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_NAME_BY_GUID); + stmt->setString(0, newName); + stmt->setUInt32(1, GUID_LOPART(targetGuid)); + CharacterDatabase.Execute(stmt); + } + + sWorld->UpdateCharacterNameData(targetGuid, newName); - handler->PSendSysMessage(LANG_RENAME_PLAYER, handler->GetNameLink(target).c_str()); - target->SetAtLoginFlag(AT_LOGIN_RENAME); + handler->PSendSysMessage(LANG_RENAME_PLAYER_WITH_NEW_NAME, playerOldName.c_str(), newName.c_str()); + + if (WorldSession* session = handler->GetSession()) + { + if (Player* player = session->GetPlayer()) + sLog->outCommand(session->GetAccountId(), "GM %s (Account: %u) forced rename %s to player %s (Account: %u)", player->GetName().c_str(), session->GetAccountId(), newName.c_str(), playerOldName.c_str(), sObjectMgr->GetPlayerAccountIdByGUID(targetGuid)); + } + else + sLog->outCommand(0, "CONSOLE forced rename '%s' to '%s' (GUID: %u)", playerOldName.c_str(), newName.c_str(), GUID_LOPART(targetGuid)); } else { - // check offline security - if (handler->HasLowerSecurity(NULL, targetGuid)) - return false; + if (target) + { + // check online security + if (handler->HasLowerSecurity(target, 0)) + return false; - std::string oldNameLink = handler->playerLink(targetName); - handler->PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid)); + handler->PSendSysMessage(LANG_RENAME_PLAYER, handler->GetNameLink(target).c_str()); + target->SetAtLoginFlag(AT_LOGIN_RENAME); + } + else + { + // check offline security + if (handler->HasLowerSecurity(NULL, targetGuid)) + return false; - PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); - stmt->setUInt16(0, uint16(AT_LOGIN_RENAME)); - stmt->setUInt32(1, GUID_LOPART(targetGuid)); - CharacterDatabase.Execute(stmt); + std::string oldNameLink = handler->playerLink(targetName); + handler->PSendSysMessage(LANG_RENAME_PLAYER_GUID, oldNameLink.c_str(), GUID_LOPART(targetGuid)); + + PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG); + stmt->setUInt16(0, uint16(AT_LOGIN_RENAME)); + stmt->setUInt32(1, GUID_LOPART(targetGuid)); + CharacterDatabase.Execute(stmt); + } } return true; diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.cpp b/src/server/shared/Database/Implementation/CharacterDatabase.cpp index f834ead6a5b..2e6ab10b087 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.cpp +++ b/src/server/shared/Database/Implementation/CharacterDatabase.cpp @@ -165,6 +165,7 @@ void CharacterDatabaseConnection::DoPrepareStatements() PrepareStatement(CHAR_SEL_MATCH_MAKER_RATING, "SELECT matchMakerRating FROM character_arena_stats WHERE guid = ? AND slot = ?", CONNECTION_SYNCH); PrepareStatement(CHAR_SEL_CHARACTER_COUNT, "SELECT account, COUNT(guid) FROM characters WHERE account = ? GROUP BY account", CONNECTION_ASYNC); PrepareStatement(CHAR_UPD_NAME, "UPDATE characters set name = ?, at_login = at_login & ~ ? WHERE guid = ?", CONNECTION_ASYNC); + PrepareStatement(CHAR_UPD_NAME_BY_GUID, "UPDATE characters SET name = ? WHERE guid = ?", CONNECTION_ASYNC); PrepareStatement(CHAR_DEL_DECLINED_NAME, "DELETE FROM character_declinedname WHERE guid = ?", CONNECTION_ASYNC); // Guild handling diff --git a/src/server/shared/Database/Implementation/CharacterDatabase.h b/src/server/shared/Database/Implementation/CharacterDatabase.h index 65878b4c577..59ac15978b6 100644 --- a/src/server/shared/Database/Implementation/CharacterDatabase.h +++ b/src/server/shared/Database/Implementation/CharacterDatabase.h @@ -161,6 +161,7 @@ enum CharacterDatabaseStatements CHAR_SEL_MATCH_MAKER_RATING, CHAR_SEL_CHARACTER_COUNT, CHAR_UPD_NAME, + CHAR_UPD_NAME_BY_GUID, CHAR_DEL_DECLINED_NAME, CHAR_SEL_CHARACTER_DATA_BY_GUID, -- cgit v1.2.3 From f4b83273ec8c109e264e37b691e97dfb89606f86 Mon Sep 17 00:00:00 2001 From: illusion Date: Sat, 11 May 2013 11:19:57 +0200 Subject: Core/Tickets * Fixed .ticket complete command not marking tickets as completed * Fixed "Need more help" button functionality after ticket has been answered by a GM Closes #9383 --- src/server/game/Handlers/TicketHandler.cpp | 9 +++++++-- src/server/game/Tickets/TicketMgr.cpp | 10 ++++++++-- src/server/game/Tickets/TicketMgr.h | 5 +++-- src/server/scripts/Commands/cs_ticket.cpp | 4 ++++ 4 files changed, 22 insertions(+), 6 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/game/Handlers/TicketHandler.cpp b/src/server/game/Handlers/TicketHandler.cpp index 2da2735a3f9..7b35462e7a2 100644 --- a/src/server/game/Handlers/TicketHandler.cpp +++ b/src/server/game/Handlers/TicketHandler.cpp @@ -41,10 +41,15 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData) } GMTicketResponse response = GMTICKET_RESPONSE_CREATE_ERROR; + GmTicket* ticket = sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID()); + + if (ticket && ticket->IsCompleted()) + sTicketMgr->CloseTicket(ticket->GetId(), GetPlayer()->GetGUID());; + // Player must not have ticket - if (!sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID())) + if (!ticket || ticket->IsClosed()) { - GmTicket* ticket = new GmTicket(GetPlayer(), recvData); + ticket = new GmTicket(GetPlayer(), recvData); uint32 count; std::list times; diff --git a/src/server/game/Tickets/TicketMgr.cpp b/src/server/game/Tickets/TicketMgr.cpp index fe10b81b09d..d76f6e9444b 100644 --- a/src/server/game/Tickets/TicketMgr.cpp +++ b/src/server/game/Tickets/TicketMgr.cpp @@ -239,7 +239,10 @@ void GmTicket::SetChatLog(std::list time, std::string const& log) /////////////////////////////////////////////////////////////////////////////////////////////////// // Ticket manager -TicketMgr::TicketMgr() : _status(true), _lastTicketId(0), _lastSurveyId(0), _openTicketCount(0), _lastChange(time(NULL)) { } +TicketMgr::TicketMgr() : _status(true), _lastTicketId(0), _lastSurveyId(0), _openTicketCount(0), + _lastChange(time(NULL)) +{ +} TicketMgr::~TicketMgr() { @@ -247,7 +250,10 @@ TicketMgr::~TicketMgr() delete itr->second; } -void TicketMgr::Initialize() { SetStatus(sWorld->getBoolConfig(CONFIG_ALLOW_TICKETS)); } +void TicketMgr::Initialize() +{ + SetStatus(sWorld->getBoolConfig(CONFIG_ALLOW_TICKETS)); +} void TicketMgr::ResetTickets() { diff --git a/src/server/game/Tickets/TicketMgr.h b/src/server/game/Tickets/TicketMgr.h index 0fe45f81360..91ef98dda23 100644 --- a/src/server/game/Tickets/TicketMgr.h +++ b/src/server/game/Tickets/TicketMgr.h @@ -82,7 +82,7 @@ class GmTicket { public: GmTicket(); - explicit GmTicket(Player* player, WorldPacket& recvData); + GmTicket(Player* player, WorldPacket& recvData); ~GmTicket(); bool IsClosed() const { return _closedBy; } @@ -119,7 +119,8 @@ public: else if (_escalatedStatus == TICKET_UNASSIGNED) _escalatedStatus = TICKET_ASSIGNED; } - void SetClosedBy(const int64& value) { _closedBy = value; } + void SetClosedBy(int64 value) { _closedBy = value; } + void SetCompleted() { _completed = true; } void SetMessage(std::string const& message) { _message = message; diff --git a/src/server/scripts/Commands/cs_ticket.cpp b/src/server/scripts/Commands/cs_ticket.cpp index 95cbf70e1f8..0795b2ab90c 100644 --- a/src/server/scripts/Commands/cs_ticket.cpp +++ b/src/server/scripts/Commands/cs_ticket.cpp @@ -235,6 +235,10 @@ public: if (player->IsInWorld()) ticket->SendResponse(player->GetSession()); + SQLTransaction trans = SQLTransaction(NULL); + ticket->SetCompleted(); + ticket->SaveToDB(trans); + sTicketMgr->UpdateLastChange(); return true; } -- cgit v1.2.3 From 243c325ca4323feb4f7f80c0ecd3873c78cbf887 Mon Sep 17 00:00:00 2001 From: Spp Date: Tue, 7 May 2013 12:02:22 +0200 Subject: Core: Declare some functions const and remove use of "using" directive in a couple of files --- src/server/game/Entities/Unit/Unit.cpp | 101 ++++++++++++++--------------- src/server/game/Entities/Unit/Unit.h | 20 +++--- src/server/game/Movement/MotionMaster.cpp | 2 +- src/server/game/Movement/PathGenerator.cpp | 27 ++++---- src/server/game/Movement/PathGenerator.h | 58 ++++++++--------- src/server/scripts/Commands/cs_mmaps.cpp | 12 ++-- 6 files changed, 108 insertions(+), 112 deletions(-) (limited to 'src/server/scripts') diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 798c9371574..7886c276020 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -144,37 +144,30 @@ void DamageInfo::BlockDamage(uint32 amount) m_damage -= amount; } -ProcEventInfo::ProcEventInfo(Unit* actor, Unit* actionTarget, Unit* procTarget, uint32 typeMask, uint32 spellTypeMask, uint32 spellPhaseMask, uint32 hitMask, Spell* spell, DamageInfo* damageInfo, HealInfo* healInfo) -:_actor(actor), _actionTarget(actionTarget), _procTarget(procTarget), _typeMask(typeMask), _spellTypeMask(spellTypeMask), _spellPhaseMask(spellPhaseMask), -_hitMask(hitMask), _spell(spell), _damageInfo(damageInfo), _healInfo(healInfo) -{ -} +ProcEventInfo::ProcEventInfo(Unit* actor, Unit* actionTarget, Unit* procTarget, + uint32 typeMask, uint32 spellTypeMask, + uint32 spellPhaseMask, uint32 hitMask, + Spell* spell, DamageInfo* damageInfo, + HealInfo* healInfo) : + _actor(actor), _actionTarget(actionTarget), _procTarget(procTarget), + _typeMask(typeMask), _spellTypeMask(spellTypeMask), + _spellPhaseMask(spellPhaseMask), _hitMask(hitMask), _spell(spell), + _damageInfo(damageInfo), _healInfo(healInfo) +{ } // we can disable this warning for this since it only // causes undefined behavior when passed to the base class constructor #ifdef _MSC_VER #pragma warning(disable:4355) #endif -Unit::Unit(bool isWorldObject): WorldObject(isWorldObject) - , m_movedPlayer(NULL) - , m_lastSanctuaryTime(0) - , m_TempSpeed(0.0f) - , IsAIEnabled(false) - , NeedChangeAI(false) - , m_ControlledByPlayer(false) - , movespline(new Movement::MoveSpline()) - , i_AI(NULL) - , i_disabledAI(NULL) - , m_AutoRepeatFirstCast(false) - , m_procDeep(0) - , m_removedAurasCount(0) - , i_motionMaster(this) - , m_ThreatManager(this) - , m_vehicle(NULL) - , m_vehicleKit(NULL) - , m_unitTypeMask(UNIT_MASK_NONE) - , m_HostileRefManager(this) - , _lastDamagedTime(0) +Unit::Unit(bool isWorldObject) : + WorldObject(isWorldObject), m_movedPlayer(NULL), m_lastSanctuaryTime(0), + m_TempSpeed(0.0f), IsAIEnabled(false), NeedChangeAI(false), + m_ControlledByPlayer(false), movespline(new Movement::MoveSpline()), + i_AI(NULL), i_disabledAI(NULL), m_AutoRepeatFirstCast(false), m_procDeep(0), + m_removedAurasCount(0), i_motionMaster(this), m_ThreatManager(this), + m_vehicle(NULL), m_vehicleKit(NULL), m_unitTypeMask(UNIT_MASK_NONE), + m_HostileRefManager(this), _lastDamagedTime(0) { #ifdef _MSC_VER #pragma warning(default:4355) @@ -1428,7 +1421,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo* damageInfo, bool durabilityLoss) victim->DealDamageMods(this, damage, NULL); /// @todo Move this to a packet handler - WorldPacket data(SMSG_SPELLDAMAGESHIELD, (8+8+4+4+4+4)); + WorldPacket data(SMSG_SPELLDAMAGESHIELD, 8 + 8 + 4 + 4 + 4 + 4 + 4); data << uint64(victim->GetGUID()); data << uint64(GetGUID()); data << uint32(i_spellProto->Id); @@ -1476,7 +1469,6 @@ bool Unit::IsDamageReducedByArmor(SpellSchoolMask schoolMask, SpellInfo const* s uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo const* spellInfo, WeaponAttackType /*attackType*/) { - uint32 newdamage = 0; float armor = float(victim->GetArmor()); // Ignore enemy armor by SPELL_AURA_MOD_TARGET_RESISTANCE aura @@ -1486,16 +1478,16 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo if (Player* modOwner = GetSpellModOwner()) modOwner->ApplySpellMod(spellInfo->Id, SPELLMOD_IGNORE_ARMOR, armor); - AuraEffectList const& ResIgnoreAurasAb = GetAuraEffectsByType(SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST); - for (AuraEffectList::const_iterator j = ResIgnoreAurasAb.begin(); j != ResIgnoreAurasAb.end(); ++j) + AuraEffectList const& resIgnoreAurasAb = GetAuraEffectsByType(SPELL_AURA_MOD_ABILITY_IGNORE_TARGET_RESIST); + for (AuraEffectList::const_iterator j = resIgnoreAurasAb.begin(); j != resIgnoreAurasAb.end(); ++j) { if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL && (*j)->IsAffectedOnSpell(spellInfo)) armor = floor(AddPct(armor, -(*j)->GetAmount())); } - AuraEffectList const& ResIgnoreAuras = GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST); - for (AuraEffectList::const_iterator j = ResIgnoreAuras.begin(); j != ResIgnoreAuras.end(); ++j) + AuraEffectList const& resIgnoreAuras = GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_TARGET_RESIST); + for (AuraEffectList::const_iterator j = resIgnoreAuras.begin(); j != resIgnoreAuras.end(); ++j) { if ((*j)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL) armor = floor(AddPct(armor, -(*j)->GetAmount())); @@ -1541,7 +1533,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo float levelModifier = getLevel(); if (levelModifier > 59) - levelModifier = levelModifier + (4.5f * (levelModifier - 59)); + levelModifier = levelModifier + 4.5f * (levelModifier - 59); float tmpvalue = 0.1f * armor / (8.5f * levelModifier + 40); tmpvalue = tmpvalue / (1.0f + tmpvalue); @@ -1551,9 +1543,7 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo if (tmpvalue > 0.75f) tmpvalue = 0.75f; - newdamage = uint32(damage - (damage * tmpvalue)); - - return (newdamage > 1) ? newdamage : 1; + return std::max(damage * (1.0f - tmpvalue), 1); } void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffectType damagetype, uint32 const damage, uint32 *absorb, uint32 *resist, SpellInfo const* spellInfo) @@ -1646,6 +1636,7 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe if (((*itr)->GetAmount() > auraAbsorbMod) && (*itr)->IsAffectedOnSpell(spellInfo)) auraAbsorbMod = float((*itr)->GetAmount()); } + RoundToInterval(auraAbsorbMod, 0.0f, 100.0f); // We're going to call functions which can modify content of the list during iteration over it's elements @@ -1801,7 +1792,7 @@ void Unit::CalcAbsorbResist(Unit* victim, SpellSchoolMask schoolMask, DamageEffe // We're going to call functions which can modify content of the list during iteration over it's elements // Let's copy the list so we can prevent iterator invalidation AuraEffectList vSplitDamagePctCopy(victim->GetAuraEffectsByType(SPELL_AURA_SPLIT_DAMAGE_PCT)); - for (AuraEffectList::iterator itr = vSplitDamagePctCopy.begin(), next; (itr != vSplitDamagePctCopy.end()) && (dmgInfo.GetDamage() > 0); ++itr) + for (AuraEffectList::iterator itr = vSplitDamagePctCopy.begin(); itr != vSplitDamagePctCopy.end() && dmgInfo.GetDamage() > 0; ++itr) { // Check if aura was removed during iteration - we don't need to work on such auras AuraApplication const* aurApp = (*itr)->GetBase()->GetApplicationOfTarget(victim->GetGUID()); @@ -2209,7 +2200,7 @@ void Unit::SendMeleeAttackStop(Unit* victim) { WorldPacket data(SMSG_ATTACKSTOP, (8+8+4)); data.append(GetPackGUID()); - data.appendPackGUID(victim ? victim->GetGUID() : 0); + data.append(victim ? victim->GetPackGUID() : 0); data << uint32(0); //! Can also take the value 0x01, which seems related to updating rotation SendMessageToSet(&data, true); sLog->outDebug(LOG_FILTER_UNITS, "WORLD: Sent SMSG_ATTACKSTOP"); @@ -2248,7 +2239,7 @@ bool Unit::isBlockCritical() return false; } -int32 Unit::GetMechanicResistChance(const SpellInfo* spell) +int32 Unit::GetMechanicResistChance(const SpellInfo* spell) const { if (!spell) return 0; @@ -2272,11 +2263,15 @@ bool Unit::CanUseAttackType(uint8 attacktype) const { switch (attacktype) { - case BASE_ATTACK: return !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED); - case OFF_ATTACK: return !HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISARM_OFFHAND); - case RANGED_ATTACK: return !HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISARM_RANGED); + case BASE_ATTACK: + return !HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISARMED); + case OFF_ATTACK: + return !HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISARM_OFFHAND); + case RANGED_ATTACK: + return !HasFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_DISARM_RANGED); + default: + return true; } - return true; } // Melee based spells hit result calculations @@ -4332,11 +4327,11 @@ bool Unit::HasAuraTypeWithValue(AuraType auratype, int32 value) const return false; } -bool Unit::HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid) +bool Unit::HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid) const { if (!(m_interruptMask & flag)) return false; - for (AuraApplicationList::iterator iter = m_interruptableAuras.begin(); iter != m_interruptableAuras.end(); ++iter) + for (AuraApplicationList::const_iterator iter = m_interruptableAuras.begin(); iter != m_interruptableAuras.end(); ++iter) { if (!(*iter)->IsPositive() && (*iter)->GetBase()->GetSpellInfo()->AuraInterruptFlags & flag && (!guid || (*iter)->GetBase()->GetCasterGUID() == guid)) return true; @@ -4344,9 +4339,9 @@ bool Unit::HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid) return false; } -bool Unit::HasNegativeAuraWithAttribute(uint32 flag, uint64 guid) +bool Unit::HasNegativeAuraWithAttribute(uint32 flag, uint64 guid) const { - for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter) + for (AuraApplicationMap::const_iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter) { Aura const* aura = iter->second->GetBase(); if (!iter->second->IsPositive() && aura->GetSpellInfo()->Attributes & flag && (!guid || aura->GetCasterGUID() == guid)) @@ -4355,11 +4350,11 @@ bool Unit::HasNegativeAuraWithAttribute(uint32 flag, uint64 guid) return false; } -bool Unit::HasAuraWithMechanic(uint32 mechanicMask) +bool Unit::HasAuraWithMechanic(uint32 mechanicMask) const { - for (AuraApplicationMap::iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter) + for (AuraApplicationMap::const_iterator iter = m_appliedAuras.begin(); iter != m_appliedAuras.end(); ++iter) { - SpellInfo const* spellInfo = iter->second->GetBase()->GetSpellInfo(); + SpellInfo const* spellInfo = iter->second->GetBase()->GetSpellInfo(); if (spellInfo->Mechanic && (mechanicMask & (1 << spellInfo->Mechanic))) return true; @@ -4394,7 +4389,7 @@ uint32 Unit::GetDiseasesByCaster(uint64 casterGUID, bool remove) }; uint32 diseases = 0; - for (AuraType const* itr = &diseaseAuraTypes[0]; itr && itr[0] != SPELL_AURA_NONE; ++itr) + for (AuraType const* itr = diseaseAuraTypes; *itr != SPELL_AURA_NONE; ++itr) { for (AuraEffectList::iterator i = m_modAuras[*itr].begin(); i != m_modAuras[*itr].end();) { @@ -9585,9 +9580,11 @@ void Unit::SetCharm(Unit* charm, bool apply) } if (charm->GetTypeId() == TYPEID_PLAYER - || !charm->ToCreature()->HasUnitTypeMask(UNIT_MASK_MINION) - || charm->GetOwnerGUID() != GetGUID()) + || !charm->ToCreature()->HasUnitTypeMask(UNIT_MASK_MINION) + || charm->GetOwnerGUID() != GetGUID()) + { m_Controlled.erase(charm); + } } } diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index c972f97788f..67a6fa2a994 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1462,19 +1462,19 @@ class Unit : public WorldObject uint32 GetRangedDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_RANGED, 2.0f, 100.0f, damage); } uint32 GetSpellDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_SPELL, 2.0f, 100.0f, damage); } - void ApplyResilience(const Unit* victim, float * crit, int32 * damage, bool isCrit, CombatRating type) const; + void ApplyResilience(Unit const* victim, float* crit, int32* damage, bool isCrit, CombatRating type) const; - float MeleeSpellMissChance(const Unit* victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const; + float MeleeSpellMissChance(Unit const* victim, WeaponAttackType attType, int32 skillDiff, uint32 spellId) const; SpellMissInfo MeleeSpellHitResult(Unit* victim, SpellInfo const* spell); SpellMissInfo MagicSpellHitResult(Unit* victim, SpellInfo const* spell); SpellMissInfo SpellHitResult(Unit* victim, SpellInfo const* spell, bool canReflect = false); - float GetUnitDodgeChance() const; - float GetUnitParryChance() const; - float GetUnitBlockChance() const; - float GetUnitMissChance(WeaponAttackType attType) const; + float GetUnitDodgeChance() const; + float GetUnitParryChance() const; + float GetUnitBlockChance() const; + float GetUnitMissChance(WeaponAttackType attType) const; float GetUnitCriticalChance(WeaponAttackType attackType, const Unit* victim) const; - int32 GetMechanicResistChance(const SpellInfo* spell); + int32 GetMechanicResistChance(const SpellInfo* spell) const; bool CanUseAttackType(uint8 attacktype) const; virtual uint32 GetShieldBlockValue() const =0; @@ -1776,9 +1776,9 @@ class Unit : public WorldObject bool HasAuraTypeWithMiscvalue(AuraType auratype, int32 miscvalue) const; bool HasAuraTypeWithAffectMask(AuraType auratype, SpellInfo const* affectedSpell) const; bool HasAuraTypeWithValue(AuraType auratype, int32 value) const; - bool HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid = 0); - bool HasNegativeAuraWithAttribute(uint32 flag, uint64 guid = 0); - bool HasAuraWithMechanic(uint32 mechanicMask); + bool HasNegativeAuraWithInterruptFlag(uint32 flag, uint64 guid = 0) const; + bool HasNegativeAuraWithAttribute(uint32 flag, uint64 guid = 0) const; + bool HasAuraWithMechanic(uint32 mechanicMask) const; AuraEffect* IsScriptOverriden(SpellInfo const* spell, int32 script) const; uint32 GetDiseasesByCaster(uint64 casterGUID, bool remove = false); diff --git a/src/server/game/Movement/MotionMaster.cpp b/src/server/game/Movement/MotionMaster.cpp index 8e045b98dbb..a7148055376 100644 --- a/src/server/game/Movement/MotionMaster.cpp +++ b/src/server/game/Movement/MotionMaster.cpp @@ -426,7 +426,7 @@ void MotionMaster::MoveCharge(float x, float y, float z, float speed, uint32 id, void MotionMaster::MoveCharge(PathGenerator const& path) { - Vector3 dest = path.GetActualEndPosition(); + G3D::Vector3 dest = path.GetActualEndPosition(); MoveCharge(dest.x, dest.y, dest.z, SPEED_CHARGE, EVENT_CHARGE_PREPATH); diff --git a/src/server/game/Movement/PathGenerator.cpp b/src/server/game/Movement/PathGenerator.cpp index 07e33f353c7..046f24e67b2 100644 --- a/src/server/game/Movement/PathGenerator.cpp +++ b/src/server/game/Movement/PathGenerator.cpp @@ -28,9 +28,10 @@ ////////////////// PathGenerator ////////////////// PathGenerator::PathGenerator(const Unit* owner) : - _polyLength(0), _type(PATHFIND_BLANK), - _useStraightPath(false), _forceDestination(false), _pointPathLimit(MAX_POINT_PATH_LENGTH), - _endPosition(Vector3::zero()), _sourceUnit(owner), _navMesh(NULL), _navMeshQuery(NULL) + _polyLength(0), _type(PATHFIND_BLANK), _useStraightPath(false), + _forceDestination(false), _pointPathLimit(MAX_POINT_PATH_LENGTH), + _endPosition(G3D::Vector3::zero()), _sourceUnit(owner), _navMesh(NULL), + _navMeshQuery(NULL) { sLog->outDebug(LOG_FILTER_MAPS, "++ PathGenerator::PathGenerator for %u \n", _sourceUnit->GetGUIDLow()); @@ -58,10 +59,10 @@ bool PathGenerator::CalculatePath(float destX, float destY, float destZ, bool fo if (!Trinity::IsValidMapCoord(destX, destY, destZ) || !Trinity::IsValidMapCoord(x, y, z)) return false; - Vector3 dest(destX, destY, destZ); + G3D::Vector3 dest(destX, destY, destZ); SetEndPosition(dest); - Vector3 start(x, y, z); + G3D::Vector3 start(x, y, z); SetStartPosition(start); _forceDestination = forceDest; @@ -151,7 +152,7 @@ dtPolyRef PathGenerator::GetPolyByLocation(float const* point, float* distance) return INVALID_POLYREF; } -void PathGenerator::BuildPolyPath(Vector3 const& startPos, Vector3 const& endPos) +void PathGenerator::BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 const& endPos) { // *** getting start/end poly logic *** @@ -202,7 +203,7 @@ void PathGenerator::BuildPolyPath(Vector3 const& startPos, Vector3 const& endPos { Creature* owner = (Creature*)_sourceUnit; - Vector3 p = (distToStartPoly > 7.0f) ? startPos : endPos; + G3D::Vector3 const& p = (distToStartPoly > 7.0f) ? startPos : endPos; if (_sourceUnit->GetBaseMap()->IsUnderWater(p.x, p.y, p.z)) { sLog->outDebug(LOG_FILTER_MAPS, "++ BuildPolyPath :: underWater case\n"); @@ -230,7 +231,7 @@ void PathGenerator::BuildPolyPath(Vector3 const& startPos, Vector3 const& endPos if (DT_SUCCESS == _navMeshQuery->closestPointOnPoly(endPoly, endPoint, closestPoint)) { dtVcopy(endPoint, closestPoint); - SetActualEndPosition(Vector3(endPoint[2], endPoint[0], endPoint[1])); + SetActualEndPosition(G3D::Vector3(endPoint[2], endPoint[0], endPoint[1])); } _type = PATHFIND_INCOMPLETE; @@ -449,7 +450,7 @@ void PathGenerator::BuildPointPath(const float *startPoint, const float *endPoin _pathPoints.resize(pointCount); for (uint32 i = 0; i < pointCount; ++i) - _pathPoints[i] = Vector3(pathPoints[i*VERTEX_SIZE+2], pathPoints[i*VERTEX_SIZE], pathPoints[i*VERTEX_SIZE+1]); + _pathPoints[i] = G3D::Vector3(pathPoints[i*VERTEX_SIZE+2], pathPoints[i*VERTEX_SIZE], pathPoints[i*VERTEX_SIZE+1]); NormalizePath(); @@ -563,7 +564,7 @@ NavTerrain PathGenerator::GetNavTerrain(float x, float y, float z) } } -bool PathGenerator::HaveTile(const Vector3& p) const +bool PathGenerator::HaveTile(const G3D::Vector3& p) const { int tx = -1, ty = -1; float point[VERTEX_SIZE] = {p.y, p.z, p.x}; @@ -791,13 +792,13 @@ bool PathGenerator::InRangeYZX(const float* v1, const float* v2, float r, float return (dx * dx + dz * dz) < r * r && fabsf(dy) < h; } -bool PathGenerator::InRange(Vector3 const& p1, Vector3 const& p2, float r, float h) const +bool PathGenerator::InRange(G3D::Vector3 const& p1, G3D::Vector3 const& p2, float r, float h) const { - Vector3 d = p1 - p2; + G3D::Vector3 d = p1 - p2; return (d.x * d.x + d.y * d.y) < r * r && fabsf(d.z) < h; } -float PathGenerator::Dist3DSqr(Vector3 const& p1, Vector3 const& p2) const +float PathGenerator::Dist3DSqr(G3D::Vector3 const& p1, G3D::Vector3 const& p2) const { return (p1 - p2).squaredLength(); } diff --git a/src/server/game/Movement/PathGenerator.h b/src/server/game/Movement/PathGenerator.h index d41d3160db5..ac66b7cec57 100644 --- a/src/server/game/Movement/PathGenerator.h +++ b/src/server/game/Movement/PathGenerator.h @@ -24,9 +24,6 @@ #include "DetourNavMeshQuery.h" #include "MoveSplineInitArgs.h" -using Movement::Vector3; -using Movement::PointsArray; - class Unit; // 74*4.0f=296y number_of_points*interval = max_path_len @@ -63,42 +60,43 @@ class PathGenerator bool CalculatePath(float destX, float destY, float destZ, bool forceDest = false); // option setters - use optional - void SetUseStraightPath(bool useStraightPath) { _useStraightPath = useStraightPath; }; - void SetPathLengthLimit(float distance) { _pointPathLimit = std::min(uint32(distance/SMOOTH_PATH_STEP_SIZE), MAX_POINT_PATH_LENGTH); }; + void SetUseStraightPath(bool useStraightPath) { _useStraightPath = useStraightPath; } + void SetPathLengthLimit(float distance) { _pointPathLimit = std::min(uint32(distance/SMOOTH_PATH_STEP_SIZE), MAX_POINT_PATH_LENGTH); } // result getters - Vector3 const& GetStartPosition() const { return _startPosition; } - Vector3 const& GetEndPosition() const { return _endPosition; } - Vector3 const& GetActualEndPosition() const { return _actualEndPosition; } + G3D::Vector3 const& GetStartPosition() const { return _startPosition; } + G3D::Vector3 const& GetEndPosition() const { return _endPosition; } + G3D::Vector3 const& GetActualEndPosition() const { return _actualEndPosition; } + + Movement::PointsArray const& GetPath() const { return _pathPoints; } - PointsArray const& GetPath() const { return _pathPoints; } PathType GetPathType() const { return _type; } private: - dtPolyRef _pathPolyRefs[MAX_PATH_LENGTH]; // array of detour polygon references - uint32 _polyLength; // number of polygons in the path + dtPolyRef _pathPolyRefs[MAX_PATH_LENGTH]; // array of detour polygon references + uint32 _polyLength; // number of polygons in the path - PointsArray _pathPoints; // our actual (x,y,z) path to the target - PathType _type; // tells what kind of path this is + Movement::PointsArray _pathPoints; // our actual (x,y,z) path to the target + PathType _type; // tells what kind of path this is - bool _useStraightPath; // type of path will be generated - bool _forceDestination; // when set, we will always arrive at given point - uint32 _pointPathLimit; // limit point path size; min(this, MAX_POINT_PATH_LENGTH) + bool _useStraightPath; // type of path will be generated + bool _forceDestination; // when set, we will always arrive at given point + uint32 _pointPathLimit; // limit point path size; min(this, MAX_POINT_PATH_LENGTH) - Vector3 _startPosition; // {x, y, z} of current location - Vector3 _endPosition; // {x, y, z} of the destination - Vector3 _actualEndPosition;// {x, y, z} of the closest possible point to given destination + G3D::Vector3 _startPosition; // {x, y, z} of current location + G3D::Vector3 _endPosition; // {x, y, z} of the destination + G3D::Vector3 _actualEndPosition; // {x, y, z} of the closest possible point to given destination - Unit const* const _sourceUnit; // the unit that is moving - dtNavMesh const* _navMesh; // the nav mesh - dtNavMeshQuery const* _navMeshQuery; // the nav mesh query used to find the path + Unit const* const _sourceUnit; // the unit that is moving + dtNavMesh const* _navMesh; // the nav mesh + dtNavMeshQuery const* _navMeshQuery; // the nav mesh query used to find the path - dtQueryFilter _filter; // use single filter for all movements, update it when needed + dtQueryFilter _filter; // use single filter for all movements, update it when needed - void SetStartPosition(Vector3 Point) { _startPosition = Point; } - void SetEndPosition(Vector3 Point) { _actualEndPosition = Point; _endPosition = Point; } - void SetActualEndPosition(Vector3 Point) { _actualEndPosition = Point; } + void SetStartPosition(G3D::Vector3 const& point) { _startPosition = point; } + void SetEndPosition(G3D::Vector3 const& point) { _actualEndPosition = point; _endPosition = point; } + void SetActualEndPosition(G3D::Vector3 const& point) { _actualEndPosition = point; } void NormalizePath(); void Clear() @@ -107,15 +105,15 @@ class PathGenerator _pathPoints.clear(); } - bool InRange(Vector3 const& p1, Vector3 const& p2, float r, float h) const; - float Dist3DSqr(Vector3 const& p1, Vector3 const& p2) const; + bool InRange(G3D::Vector3 const& p1, G3D::Vector3 const& p2, float r, float h) const; + float Dist3DSqr(G3D::Vector3 const& p1, G3D::Vector3 const& p2) const; bool InRangeYZX(float const* v1, float const* v2, float r, float h) const; dtPolyRef GetPathPolyByPosition(dtPolyRef const* polyPath, uint32 polyPathSize, float const* Point, float* Distance = NULL) const; dtPolyRef GetPolyByLocation(float const* Point, float* Distance) const; - bool HaveTile(Vector3 const& p) const; + bool HaveTile(G3D::Vector3 const& p) const; - void BuildPolyPath(Vector3 const& startPos, Vector3 const& endPos); + void BuildPolyPath(G3D::Vector3 const& startPos, G3D::Vector3 const& endPos); void BuildPointPath(float const* startPoint, float const* endPoint); void BuildShortcut(); diff --git a/src/server/scripts/Commands/cs_mmaps.cpp b/src/server/scripts/Commands/cs_mmaps.cpp index 79cd0deb75e..55b6edbadbe 100644 --- a/src/server/scripts/Commands/cs_mmaps.cpp +++ b/src/server/scripts/Commands/cs_mmaps.cpp @@ -95,14 +95,14 @@ public: path.SetUseStraightPath(useStraightPath); bool result = path.CalculatePath(x, y, z); - PointsArray const& pointPath = path.GetPath(); + Movement::PointsArray const& pointPath = path.GetPath(); handler->PSendSysMessage("%s's path to %s:", target->GetName().c_str(), player->GetName().c_str()); handler->PSendSysMessage("Building: %s", useStraightPath ? "StraightPath" : "SmoothPath"); - handler->PSendSysMessage("Result: %s - Length: "SIZEFMTD" - Type: %u", (result ? "true" : "false"), pointPath.size(), path.GetPathType()); + handler->PSendSysMessage("Result: %s - Length: " SIZEFMTD " - Type: %u", (result ? "true" : "false"), pointPath.size(), path.GetPathType()); - Vector3 start = path.GetStartPosition(); - Vector3 end = path.GetEndPosition(); - Vector3 actualEnd = path.GetActualEndPosition(); + G3D::Vector3 const &start = path.GetStartPosition(); + G3D::Vector3 const &end = path.GetEndPosition(); + G3D::Vector3 const &actualEnd = path.GetActualEndPosition(); handler->PSendSysMessage("StartPosition (%.3f, %.3f, %.3f)", start.x, start.y, start.z); handler->PSendSysMessage("EndPosition (%.3f, %.3f, %.3f)", end.x, end.y, end.z); @@ -264,7 +264,7 @@ public: if (!creatureList.empty()) { - handler->PSendSysMessage("Found "SIZEFMTD" Creatures.", creatureList.size()); + handler->PSendSysMessage("Found " SIZEFMTD " Creatures.", creatureList.size()); uint32 paths = 0; uint32 uStartTime = getMSTime(); -- cgit v1.2.3