From 70829288ba034d8b5d4c91ee1500c419d35e74be Mon Sep 17 00:00:00 2001 From: kandera Date: Thu, 28 Mar 2013 23:36:28 -0400 Subject: DB/Error: Change error messages per aokromes request --- src/server/game/Globals/ObjectMgr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index b04d259c5d0..1191bc42816 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -7944,13 +7944,13 @@ void ObjectMgr::AddSpellToTrainer(uint32 entry, uint32 spell, uint32 spellCost, CreatureTemplate const* cInfo = GetCreatureTemplate(entry); if (!cInfo) { - sLog->outError(LOG_FILTER_SQL, "Table `npc_trainer` contains an entry for a non-existing creature template (Entry: %u), ignoring", entry); + sLog->outError(LOG_FILTER_SQL, "Table `npc_trainer` contains entries for a non-existing creature template (Entry: %u), ignoring", entry); return; } if (!(cInfo->npcflag & UNIT_NPC_FLAG_TRAINER)) { - sLog->outError(LOG_FILTER_SQL, "Table `npc_trainer` contains an entry for a creature template (Entry: %u) without trainer flag, ignoring", entry); + sLog->outError(LOG_FILTER_SQL, "Table `npc_trainer` contains entries for a creature template (Entry: %u) without trainer flag, ignoring", entry); return; } -- cgit v1.2.3 From 34c73a512186a8eb009392b54aaa198e998a50eb Mon Sep 17 00:00:00 2001 From: Gacko Date: Sun, 31 Mar 2013 15:45:20 +0200 Subject: Core/Player: showQuests check in PrepareGossipMenu for GameObjects --- src/server/game/Entities/Player/Player.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 65b0fc8b005..e12e5eef238 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -14318,12 +14318,11 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool if (source->GetTypeId() == TYPEID_UNIT) { npcflags = source->GetUInt32Value(UNIT_NPC_FLAGS); - if (npcflags & UNIT_NPC_FLAG_QUESTGIVER && showQuests) + if (showQuests && npcflags & UNIT_NPC_FLAG_QUESTGIVER) PrepareQuestMenu(source->GetGUID()); } - - if (source->GetTypeId() == TYPEID_GAMEOBJECT) - if (source->ToGameObject()->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) + else if (source->GetTypeId() == TYPEID_GAMEOBJECT) + if (showQuests && source->ToGameObject()->GetGoType() == GAMEOBJECT_TYPE_QUESTGIVER) PrepareQuestMenu(source->GetGUID()); for (GossipMenuItemsContainer::const_iterator itr = menuItemBounds.first; itr != menuItemBounds.second; ++itr) -- cgit v1.2.3 From 7fb539c0d8ebb231ec98cd9a3e4f11fee81ccefc Mon Sep 17 00:00:00 2001 From: kandera Date: Sun, 31 Mar 2013 19:47:32 -0400 Subject: Core/Spells: Fix blood-caked blade damage modifier. Author AliveShiro Closes #7831 --- src/server/game/Spells/SpellEffects.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 4cb40a05e3d..2b48afcd20d 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3379,7 +3379,7 @@ void Spell::EffectWeaponDmg(SpellEffIndex effIndex) // Blood-Caked Strike - Blood-Caked Blade if (m_spellInfo->SpellIconID == 1736) { - AddPct(totalDamagePercentMod, unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) * 12.5f); + AddPct(totalDamagePercentMod, unitTarget->GetDiseasesByCaster(m_caster->GetGUID()) * 50.0f); break; } // Heart Strike -- cgit v1.2.3 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') 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') 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 b44f7cdd23bab34114383f2b97a88c32d05efbad Mon Sep 17 00:00:00 2001 From: kandera Date: Wed, 3 Apr 2013 02:12:26 -0400 Subject: Core/Spells: fix spell cast on damagable gameobjects Author: LiMCrosS Closes #5810 Closes #5625 --- src/server/game/Spells/Spell.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 93e14154302..0c6d70add0b 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -7392,7 +7392,7 @@ WorldObjectSpellAreaTargetCheck::WorldObjectSpellAreaTargetCheck(float range, Po bool WorldObjectSpellAreaTargetCheck::operator()(WorldObject* target) { - if (!target->IsWithinDist3d(_position, _range)) + if (!target->IsWithinDist3d(_position, _range) && !(target->ToGameObject() && target->ToGameObject()->IsInRange(_position->GetPositionX(), _position->GetPositionY(), _position->GetPositionZ(), _range))) return false; return WorldObjectSpellTargetCheck::operator ()(target); } -- 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') 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') 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 e2444c04e2561a9bca6a1b2e71c011d0719dba75 Mon Sep 17 00:00:00 2001 From: kandera Date: Wed, 3 Apr 2013 18:08:25 -0400 Subject: Core/Spells/Auras: fix the way we handle spells that use SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE and SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE Closes #7622 --- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 2 +- src/server/game/Spells/SpellEffects.cpp | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 71c74db7ba2..80751fe9c86 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5796,7 +5796,7 @@ void AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit* { if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster() ? caster : target) { - int32 basepoints0 = GetAmount(); + int32 basepoints0 = triggeredSpellInfo->Effects[EFFECT_0].CalcValue(triggerCaster) <= 1 ? triggeredSpellInfo->Effects[EFFECT_0].CalcValue(triggerCaster) : GetAmount(); triggerCaster->CastCustomSpell(target, triggerSpellId, &basepoints0, 0, 0, true, 0, this); sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id); } diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 2b48afcd20d..38a87f173f6 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -939,9 +939,8 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex) if (m_spellInfo->Effects[effIndex].Effect == SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE) { // maybe need to set value only when 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((SpellValueMod)effIndex, damage); } // Remove spell cooldown (not category) if spell triggering spell with cooldown and same category -- cgit v1.2.3 From bd5dcf492741b6c7dbde3294dbc27e1d726f84fc Mon Sep 17 00:00:00 2001 From: kandera Date: Wed, 3 Apr 2013 18:15:24 -0400 Subject: Core/Spells: add the value calculation for all three spell effects on the triggered spell. thx shauren --- src/server/game/Spells/SpellEffects.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 38a87f173f6..167a2213132 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -938,9 +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) { - // maybe need to set value only when basepoints == 0? if (m_spellInfo->Effects[effIndex].BasePoints == 0) - values.AddSpellMod((SpellValueMod)effIndex, damage); + { + 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 -- 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') 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 7df4d147e3a30dbc51ee5fa359fdc69e8ac311c3 Mon Sep 17 00:00:00 2001 From: Gacko Date: Thu, 4 Apr 2013 19:32:45 +0200 Subject: Core/Gossips: Fix usage of PrepareGossipMenu with GOs --- src/server/game/Entities/GameObject/GameObject.cpp | 2 +- src/server/game/Spells/SpellEffects.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index db51d88653a..afa7fa76abc 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -1119,7 +1119,7 @@ void GameObject::Use(Unit* user) Player* player = user->ToPlayer(); - player->PrepareGossipMenu(this, GetGOInfo()->questgiver.gossipID); + player->PrepareGossipMenu(this, GetGOInfo()->questgiver.gossipID, true); player->SendPreparedGossip(this); return; } diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 541dfbb6232..04baa4f529e 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1982,7 +1982,7 @@ void Spell::SendLoot(uint64 guid, LootType loottype) return; case GAMEOBJECT_TYPE_QUESTGIVER: - player->PrepareGossipMenu(gameObjTarget, gameObjTarget->GetGOInfo()->questgiver.gossipID); + player->PrepareGossipMenu(gameObjTarget, gameObjTarget->GetGOInfo()->questgiver.gossipID, true); player->SendPreparedGossip(gameObjTarget); return; -- cgit v1.2.3 From 53b1f6e2e57d37d65a12d4360950c88c3b761c51 Mon Sep 17 00:00:00 2001 From: Shauren Date: Thu, 4 Apr 2013 23:31:13 +0200 Subject: Core/Spells: Reimplemented SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION --- src/server/game/DataStores/DBCStores.cpp | 2 + src/server/game/DataStores/DBCStores.h | 1 + src/server/game/DataStores/DBCStructure.h | 5 ++ src/server/game/DataStores/DBCfmt.h | 1 + src/server/game/Spells/Auras/SpellAuraEffects.cpp | 30 ++++---- src/server/game/Spells/SpellEffects.cpp | 9 +-- src/server/game/Spells/SpellInfo.cpp | 91 +++++++++++++++++++---- 7 files changed, 104 insertions(+), 35 deletions(-) (limited to 'src') diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index f382082761a..f58a04df6af 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -101,6 +101,7 @@ DBCStorage sGtChanceToMeleeCritBaseStore(GtChance DBCStorage sGtChanceToMeleeCritStore(GtChanceToMeleeCritfmt); DBCStorage sGtChanceToSpellCritBaseStore(GtChanceToSpellCritBasefmt); DBCStorage sGtChanceToSpellCritStore(GtChanceToSpellCritfmt); +DBCStorage sGtNPCManaCostScalerStore(GtNPCManaCostScalerfmt); DBCStorage sGtOCTClassCombatRatingScalarStore(GtOCTClassCombatRatingScalarfmt); DBCStorage sGtOCTRegenHPStore(GtOCTRegenHPfmt); //DBCStorage sGtOCTRegenMPStore(GtOCTRegenMPfmt); -- not used currently @@ -344,6 +345,7 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales, bad_dbc_files, sGtChanceToMeleeCritStore, dbcPath, "gtChanceToMeleeCrit.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sGtChanceToSpellCritBaseStore, dbcPath, "gtChanceToSpellCritBase.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sGtChanceToSpellCritStore, dbcPath, "gtChanceToSpellCrit.dbc"); + LoadDBC(availableDbcLocales, bad_dbc_files, sGtNPCManaCostScalerStore, dbcPath, "gtNPCManaCostScaler.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sGtOCTClassCombatRatingScalarStore, dbcPath, "gtOCTClassCombatRatingScalar.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sGtOCTRegenHPStore, dbcPath, "gtOCTRegenHP.dbc"); //LoadDBC(dbcCount, availableDbcLocales, bad_dbc_files, sGtOCTRegenMPStore, dbcPath, "gtOCTRegenMP.dbc"); -- not used currently diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index 48a2cb3fe4e..a7be35612a5 100644 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -108,6 +108,7 @@ extern DBCStorage sGtChanceToMeleeCritBaseStore; extern DBCStorage sGtChanceToMeleeCritStore; extern DBCStorage sGtChanceToSpellCritBaseStore; extern DBCStorage sGtChanceToSpellCritStore; +extern DBCStorage sGtNPCManaCostScalerStore; extern DBCStorage sGtOCTClassCombatRatingScalarStore; extern DBCStorage sGtOCTRegenHPStore; //extern DBCStorage sGtOCTRegenMPStore; -- not used currently diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 9636d5e0f35..532deefa268 100644 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -1020,6 +1020,11 @@ struct GtChanceToSpellCritBaseEntry float base; }; +struct GtNPCManaCostScalerEntry +{ + float ratio; +}; + struct GtChanceToSpellCritEntry { float ratio; diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h index c82fdf868b3..4d48b29b968 100644 --- a/src/server/game/DataStores/DBCfmt.h +++ b/src/server/game/DataStores/DBCfmt.h @@ -61,6 +61,7 @@ char const GtChanceToMeleeCritBasefmt[] = "f"; char const GtChanceToMeleeCritfmt[] = "f"; char const GtChanceToSpellCritBasefmt[] = "f"; char const GtChanceToSpellCritfmt[] = "f"; +char const GtNPCManaCostScalerfmt[] = "f"; char const GtOCTClassCombatRatingScalarfmt[] = "df"; char const GtOCTRegenHPfmt[] = "f"; //char const GtOCTRegenMPfmt[] = "f"; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 80751fe9c86..1e37c5cd0ad 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -2502,6 +2502,8 @@ void AuraEffect::HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bo if (apply) { uint32 creatureEntry = GetMiscValue(); + uint32 displayId = 0; + uint32 vehicleId = 0; // Festive Holiday Mount if (target->HasAura(62061)) @@ -2512,23 +2514,21 @@ void AuraEffect::HandleAuraMounted(AuraApplication const* aurApp, uint8 mode, bo creatureEntry = 15665; } - CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(creatureEntry); - if (!ci) + if (CreatureTemplate const* creatureInfo = sObjectMgr->GetCreatureTemplate(creatureEntry)) { - sLog->outError(LOG_FILTER_SQL, "AuraMounted: `creature_template`='%u' not found in database (only need its modelid)", GetMiscValue()); - return; - } + displayId = ObjectMgr::ChooseDisplayId(creatureInfo); + sObjectMgr->GetCreatureModelRandomGender(&displayId); - uint32 displayID = ObjectMgr::ChooseDisplayId(ci); - sObjectMgr->GetCreatureModelRandomGender(&displayID); + vehicleId = creatureInfo->VehicleId; - //some spell has one aura of mount and one of vehicle - for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) - if (GetSpellInfo()->Effects[i].Effect == SPELL_EFFECT_SUMMON - && GetSpellInfo()->Effects[i].MiscValue == GetMiscValue()) - displayID = 0; + //some spell has one aura of mount and one of vehicle + for (uint32 i = 0; i < MAX_SPELL_EFFECTS; ++i) + if (GetSpellInfo()->Effects[i].Effect == SPELL_EFFECT_SUMMON + && GetSpellInfo()->Effects[i].MiscValue == GetMiscValue()) + displayId = 0; + } - target->Mount(displayID, ci->VehicleId, GetMiscValue()); + target->Mount(displayId, vehicleId, creatureEntry); } else { @@ -5796,8 +5796,8 @@ void AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick(Unit* target, Unit* { if (Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster() ? caster : target) { - int32 basepoints0 = triggeredSpellInfo->Effects[EFFECT_0].CalcValue(triggerCaster) <= 1 ? triggeredSpellInfo->Effects[EFFECT_0].CalcValue(triggerCaster) : GetAmount(); - triggerCaster->CastCustomSpell(target, triggerSpellId, &basepoints0, 0, 0, true, 0, this); + int32 basepoints = GetAmount(); + triggerCaster->CastCustomSpell(target, triggerSpellId, &basepoints, &basepoints, &basepoints, true, 0, this); sLog->outDebug(LOG_FILTER_SPELLS_AURAS, "AuraEffect::HandlePeriodicTriggerSpellWithValueAuraTick: Spell %u Trigger %u", GetId(), triggeredSpellInfo->Id); } } diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 04baa4f529e..4717832a727 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -938,12 +938,9 @@ 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); - } + 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/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index 8635270bb84..e5ad78b00a3 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -450,17 +450,56 @@ int32 SpellEffectInfo::CalcValue(Unit const* caster, int32 const* bp, Unit const value = caster->ApplyEffectModifiers(_spellInfo, _effIndex, value); // amount multiplication based on caster's level - if (!basePointsPerLevel && (_spellInfo->Attributes & SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION && _spellInfo->SpellLevel) && - Effect != SPELL_EFFECT_WEAPON_PERCENT_DAMAGE && - Effect != SPELL_EFFECT_KNOCK_BACK && - Effect != SPELL_EFFECT_ADD_EXTRA_ATTACKS && - ApplyAuraName != SPELL_AURA_MOD_SPEED_ALWAYS && - ApplyAuraName != SPELL_AURA_MOD_SPEED_NOT_STACK && - ApplyAuraName != SPELL_AURA_MOD_INCREASE_SPEED && - ApplyAuraName != SPELL_AURA_MOD_DECREASE_SPEED) - //there are many more: slow speed, -healing pct - value *= 0.25f * exp(caster->getLevel() * (70 - _spellInfo->SpellLevel) / 1000.0f); - //value = int32(value * (int32)getLevel() / (int32)(_spellInfo->spellLevel ? _spellInfo->spellLevel : 1)); + if (!caster->IsControlledByPlayer() && + _spellInfo->SpellLevel && _spellInfo->SpellLevel != caster->getLevel() && + !basePointsPerLevel && (_spellInfo->Attributes & SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION)) + { + bool canEffectScale = false; + switch (Effect) + { + case SPELL_EFFECT_SCHOOL_DAMAGE: + case SPELL_EFFECT_DUMMY: + case SPELL_EFFECT_POWER_DRAIN: + case SPELL_EFFECT_HEALTH_LEECH: + case SPELL_EFFECT_HEAL: + case SPELL_EFFECT_WEAPON_DAMAGE: + case SPELL_EFFECT_POWER_BURN: + case SPELL_EFFECT_SCRIPT_EFFECT: + case SPELL_EFFECT_NORMALIZED_WEAPON_DMG: + case SPELL_EFFECT_FORCE_CAST_WITH_VALUE: + case SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE: + case SPELL_EFFECT_TRIGGER_MISSILE_SPELL_WITH_VALUE: + canEffectScale = true; + break; + default: + break; + } + + switch (ApplyAuraName) + { + case SPELL_AURA_PERIODIC_DAMAGE: + case SPELL_AURA_DUMMY: + case SPELL_AURA_PERIODIC_HEAL: + case SPELL_AURA_DAMAGE_SHIELD: + case SPELL_AURA_PROC_TRIGGER_DAMAGE: + case SPELL_AURA_PERIODIC_LEECH: + case SPELL_AURA_PERIODIC_MANA_LEECH: + case SPELL_AURA_SCHOOL_ABSORB: + case SPELL_AURA_PERIODIC_TRIGGER_SPELL_WITH_VALUE: + canEffectScale = true; + break; + default: + break; + } + + if (canEffectScale) + { + GtNPCManaCostScalerEntry const* spellScaler = sGtNPCManaCostScalerStore.LookupEntry(_spellInfo->SpellLevel - 1); + GtNPCManaCostScalerEntry const* casterScaler = sGtNPCManaCostScalerStore.LookupEntry(caster->getLevel() - 1); + if (spellScaler && casterScaler) + value *= casterScaler->ratio / spellScaler->ratio; + } + } } return int32(value); @@ -2124,15 +2163,39 @@ int32 SpellInfo::CalcPowerCost(Unit const* caster, SpellSchoolMask schoolMask) c SpellSchools school = GetFirstSchoolInMask(schoolMask); // Flat mod from caster auras by spell school powerCost += caster->GetInt32Value(UNIT_FIELD_POWER_COST_MODIFIER + school); + // Shiv - costs 20 + weaponSpeed*10 energy (apply only to non-triggered spell with energy cost) if (AttributesEx4 & SPELL_ATTR4_SPELL_VS_EXTEND_COST) - powerCost += caster->GetAttackTime(OFF_ATTACK) / 100; + { + uint32 speed = 0; + if (SpellShapeshiftEntry const* ss = sSpellShapeshiftStore.LookupEntry(caster->GetShapeshiftForm())) + speed = ss->attackSpeed; + else + { + WeaponAttackType slot = BASE_ATTACK; + if (AttributesEx3 & SPELL_ATTR3_REQ_OFFHAND) + slot = OFF_ATTACK; + + speed = caster->GetAttackTime(slot); + } + + powerCost += speed / 100; + } + // Apply cost mod by spell if (Player* modOwner = caster->GetSpellModOwner()) modOwner->ApplySpellMod(Id, SPELLMOD_COST, powerCost); - if (Attributes & SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION) - powerCost = int32(powerCost / (1.117f * SpellLevel / caster->getLevel() -0.1327f)); + if (!caster->IsControlledByPlayer()) + { + if (Attributes & SPELL_ATTR0_LEVEL_DAMAGE_CALCULATION) + { + GtNPCManaCostScalerEntry const* spellScaler = sGtNPCManaCostScalerStore.LookupEntry(SpellLevel - 1); + GtNPCManaCostScalerEntry const* casterScaler = sGtNPCManaCostScalerStore.LookupEntry(caster->getLevel() - 1); + if (spellScaler && casterScaler) + powerCost *= casterScaler->ratio / spellScaler->ratio; + } + } // PCT mod from user auras by school powerCost = int32(powerCost * (1.0f + caster->GetFloatValue(UNIT_FIELD_POWER_COST_MULTIPLIER + school))); -- cgit v1.2.3 From d24ef896dfd9932ca8b74b5683fdda71b77f0287 Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 5 Apr 2013 15:06:35 +0200 Subject: Core/PacketIO: Implemented possibility to ban client addons serverside --- sql/base/characters_database.sql | 26 +++++++++ .../2013_04_05_00_characters_banned_addons.sql | 9 +++ src/server/game/Addons/AddonMgr.cpp | 68 +++++++++++++++++----- src/server/game/Addons/AddonMgr.h | 16 ++++- src/server/game/DataStores/DBCStores.cpp | 2 + src/server/game/DataStores/DBCStores.h | 1 + src/server/game/DataStores/DBCStructure.h | 9 +++ src/server/game/DataStores/DBCfmt.h | 1 + src/server/game/Server/WorldSession.cpp | 29 +++++---- 9 files changed, 127 insertions(+), 34 deletions(-) create mode 100644 sql/updates/characters/2013_04_05_00_characters_banned_addons.sql (limited to 'src') diff --git a/sql/base/characters_database.sql b/sql/base/characters_database.sql index c5a011871ca..46b6a1a2bdb 100644 --- a/sql/base/characters_database.sql +++ b/sql/base/characters_database.sql @@ -213,6 +213,32 @@ LOCK TABLES `auctionhouse` WRITE; /*!40000 ALTER TABLE `auctionhouse` ENABLE KEYS */; UNLOCK TABLES; +-- +-- Table structure for table `banned_addons` +-- + +DROP TABLE IF EXISTS `banned_addons`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `banned_addons` ( + `Id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `Name` varchar(255) NOT NULL, + `Version` varchar(255) NOT NULL DEFAULT '', + `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`Id`), + UNIQUE KEY `idx_name_ver` (`Name`, `Version`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `banned_addons` +-- + +LOCK TABLES `banned_addons` WRITE; +/*!40000 ALTER TABLE `banned_addons` DISABLE KEYS */; +/*!40000 ALTER TABLE `banned_addons` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Table structure for table `bugreport` -- diff --git a/sql/updates/characters/2013_04_05_00_characters_banned_addons.sql b/sql/updates/characters/2013_04_05_00_characters_banned_addons.sql new file mode 100644 index 00000000000..4f286b2326c --- /dev/null +++ b/sql/updates/characters/2013_04_05_00_characters_banned_addons.sql @@ -0,0 +1,9 @@ +DROP TABLE IF EXISTS `banned_addons`; +CREATE TABLE `banned_addons` ( + `Id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, + `Name` varchar(255) NOT NULL, + `Version` varchar(255) NOT NULL DEFAULT '', + `Timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, + PRIMARY KEY (`Id`), + UNIQUE KEY `idx_name_ver` (`Name`, `Version`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/src/server/game/Addons/AddonMgr.cpp b/src/server/game/Addons/AddonMgr.cpp index 86a90d4d78a..3e1180727d0 100644 --- a/src/server/game/Addons/AddonMgr.cpp +++ b/src/server/game/Addons/AddonMgr.cpp @@ -18,10 +18,10 @@ #include "AddonMgr.h" #include "DatabaseEnv.h" +#include "DBCStores.h" #include "Log.h" #include "Timer.h" - -#include +#include namespace AddonMgr { @@ -34,6 +34,8 @@ namespace typedef std::list SavedAddonsList; SavedAddonsList m_knownAddons; + + BannedAddonList m_bannedAddons; } void LoadFromDB() @@ -41,28 +43,57 @@ void LoadFromDB() uint32 oldMSTime = getMSTime(); QueryResult result = CharacterDatabase.Query("SELECT name, crc FROM addons"); - if (!result) + if (result) { - sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 known addons. DB table `addons` is empty!"); - return; - } + uint32 count = 0; - uint32 count = 0; + do + { + Field* fields = result->Fetch(); - do - { - Field* fields = result->Fetch(); + std::string name = fields[0].GetString(); + uint32 crc = fields[1].GetUInt32(); - std::string name = fields[0].GetString(); - uint32 crc = fields[1].GetUInt32(); + m_knownAddons.push_back(SavedAddon(name, crc)); - m_knownAddons.push_back(SavedAddon(name, crc)); + ++count; + } + while (result->NextRow()); - ++count; + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); } - while (result->NextRow()); + else + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 known addons. DB table `addons` is empty!"); + + oldMSTime = getMSTime(); + result = CharacterDatabase.Query("SELECT id, name, version, UNIX_TIMESTAMP(timestamp) FROM banned_addons"); + if (result) + { + uint32 count = 0; + uint32 dbcMaxBannedAddon = sBannedAddOnsStore.GetNumRows(); + + do + { + Field* fields = result->Fetch(); - sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u known addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + BannedAddon addon; + addon.Id = fields[0].GetUInt32() + dbcMaxBannedAddon; + addon.Timestamp = uint32(fields[3].GetUInt64()); + + std::string name = fields[1].GetString(); + std::string version = fields[2].GetString(); + + MD5(reinterpret_cast(name.c_str()), name.length(), addon.NameMD5); + MD5(reinterpret_cast(version.c_str()), version.length(), addon.VersionMD5); + + m_bannedAddons.push_back(addon); + + ++count; + } + while (result->NextRow()); + + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded %u banned addons in %u ms", count, GetMSTimeDiffToNow(oldMSTime)); + } } void SaveAddon(AddonInfo const& addon) @@ -91,4 +122,9 @@ SavedAddon const* GetAddonInfo(const std::string& name) return NULL; } +BannedAddonList const* GetBannedAddons() +{ + return &m_bannedAddons; +} + } // Namespace diff --git a/src/server/game/Addons/AddonMgr.h b/src/server/game/Addons/AddonMgr.h index 4d387fcfd4c..35e24e965b5 100644 --- a/src/server/game/Addons/AddonMgr.h +++ b/src/server/game/Addons/AddonMgr.h @@ -21,6 +21,7 @@ #include "Define.h" #include +#include struct AddonInfo { @@ -37,7 +38,7 @@ struct AddonInfo struct SavedAddon { - SavedAddon(const std::string& name, uint32 crc) : Name(name) + SavedAddon(std::string const& name, uint32 crc) : Name(name) { CRC = crc; } @@ -46,13 +47,24 @@ struct SavedAddon uint32 CRC; }; -#define STANDARD_ADDON_CRC 0x4c1c776d +struct BannedAddon +{ + uint32 Id; + uint8 NameMD5[16]; + uint8 VersionMD5[16]; + uint32 Timestamp; +}; + +#define STANDARD_ADDON_CRC 0x4C1C776D namespace AddonMgr { void LoadFromDB(); void SaveAddon(AddonInfo const& addon); SavedAddon const* GetAddonInfo(const std::string& name); + + typedef std::list BannedAddonList; + BannedAddonList const* GetBannedAddons(); } #endif diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index f58a04df6af..3f5ff28a6c3 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -61,6 +61,7 @@ DBCStorage sAchievementCriteriaStore(AchievementCrite DBCStorage sAreaTriggerStore(AreaTriggerEntryfmt); DBCStorage sAuctionHouseStore(AuctionHouseEntryfmt); DBCStorage sBankBagSlotPricesStore(BankBagSlotPricesEntryfmt); +DBCStorage sBannedAddOnsStore(BannedAddOnsfmt); DBCStorage sBattlemasterListStore(BattlemasterListEntryfmt); DBCStorage sBarberShopStyleStore(BarberShopStyleEntryfmt); DBCStorage sCharStartOutfitStore(CharStartOutfitEntryfmt); @@ -286,6 +287,7 @@ void LoadDBCStores(const std::string& dataPath) LoadDBC(availableDbcLocales, bad_dbc_files, sAreaPOIStore, dbcPath, "AreaPOI.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sAuctionHouseStore, dbcPath, "AuctionHouse.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sBankBagSlotPricesStore, dbcPath, "BankBagSlotPrices.dbc"); + LoadDBC(availableDbcLocales, bad_dbc_files, sBannedAddOnsStore, dbcPath, "BannedAddOns.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sBattlemasterListStore, dbcPath, "BattlemasterList.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sBarberShopStyleStore, dbcPath, "BarberShopStyle.dbc"); LoadDBC(availableDbcLocales, bad_dbc_files, sCharStartOutfitStore, dbcPath, "CharStartOutfit.dbc"); diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index a7be35612a5..0090ec7d132 100644 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -75,6 +75,7 @@ extern DBCStorage sAreaPOIStore; extern DBCStorage sAreaTriggerStore; extern DBCStorage sAuctionHouseStore; extern DBCStorage sBankBagSlotPricesStore; +extern DBCStorage sBannedAddOnsStore; extern DBCStorage sBarberShopStyleStore; extern DBCStorage sBattlemasterListStore; extern DBCStorage sChatChannelsStore; diff --git a/src/server/game/DataStores/DBCStructure.h b/src/server/game/DataStores/DBCStructure.h index 532deefa268..a8c2f1b132e 100644 --- a/src/server/game/DataStores/DBCStructure.h +++ b/src/server/game/DataStores/DBCStructure.h @@ -596,6 +596,15 @@ struct BankBagSlotPricesEntry uint32 price; }; +struct BannedAddOnsEntry +{ + uint32 Id; + // uint32 NameMD5[4]; + // uint32 VersionMD5[4]; + // uint32 Timestamp; + // uint32 State; +}; + struct BarberShopStyleEntry { uint32 Id; // 0 diff --git a/src/server/game/DataStores/DBCfmt.h b/src/server/game/DataStores/DBCfmt.h index 4d48b29b968..a07d3abb52a 100644 --- a/src/server/game/DataStores/DBCfmt.h +++ b/src/server/game/DataStores/DBCfmt.h @@ -29,6 +29,7 @@ char const AreaPOIEntryfmt[] = "niiiiiiiiiiifffixixxxxxxxxxxxxxxxxxxxxxxxxxxxxxx char const AreaTriggerEntryfmt[] = "niffffffff"; char const AuctionHouseEntryfmt[] = "niiixxxxxxxxxxxxxxxxx"; char const BankBagSlotPricesEntryfmt[] = "ni"; +char const BannedAddOnsfmt[] = "nxxxxxxxxxx"; char const BarberShopStyleEntryfmt[] = "nixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxiii"; char const BattlemasterListEntryfmt[] = "niiiiiiiiixssssssssssssssssxiixx"; char const CharStartOutfitEntryfmt[] = "dbbbXiiiiiiiiiiiiiiiiiiiiiiiixxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; diff --git a/src/server/game/Server/WorldSession.cpp b/src/server/game/Server/WorldSession.cpp index 5e91f0f2464..71b74ad3a5f 100644 --- a/src/server/game/Server/WorldSession.cpp +++ b/src/server/game/Server/WorldSession.cpp @@ -960,12 +960,7 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data) SavedAddon const* savedAddon = AddonMgr::GetAddonInfo(addonName); if (savedAddon) { - bool match = true; - if (addon.CRC != savedAddon->CRC) - match = false; - - if (!match) sLog->outInfo(LOG_FILTER_GENERAL, "ADDON: %s was known, but didn't match known CRC (0x%x)!", addon.Name.c_str(), savedAddon->CRC); else sLog->outInfo(LOG_FILTER_GENERAL, "ADDON: %s was known, CRC is correct (0x%x)", addon.Name.c_str(), savedAddon->CRC); @@ -984,9 +979,6 @@ void WorldSession::ReadAddonsInfo(WorldPacket &data) uint32 currentTime; addonInfo >> currentTime; sLog->outDebug(LOG_FILTER_NETWORKIO, "ADDON: CurrentTime: %u", currentTime); - - if (addonInfo.rpos() != addonInfo.size()) - sLog->outDebug(LOG_FILTER_NETWORKIO, "packet under-read!"); } else sLog->outError(LOG_FILTER_GENERAL, "Addon packet uncompress error!"); @@ -1037,18 +1029,23 @@ void WorldSession::SendAddonsInfo() data << uint32(0); /// @todo Find out the meaning of this. } - uint8 unk3 = 0; // 0 is sent here - data << uint8(unk3); - if (unk3) - { - // String, length 256 (null terminated) - data << uint8(0); - } + data << uint8(0); // uses URL + //if (usesURL) + // data << uint8(0); // URL } m_addonsList.clear(); - data << uint32(0); // count for an unknown for loop + AddonMgr::BannedAddonList const* bannedAddons = AddonMgr::GetBannedAddons(); + data << uint32(bannedAddons->size()); + for (AddonMgr::BannedAddonList::const_iterator itr = bannedAddons->begin(); itr != bannedAddons->end(); ++itr) + { + data << uint32(itr->Id); + data.append(itr->NameMD5, sizeof(itr->NameMD5)); + data.append(itr->VersionMD5, sizeof(itr->VersionMD5)); + data << uint32(itr->Timestamp); + data << uint32(1); // IsBanned + } SendPacket(&data); } -- cgit v1.2.3 From 6e6ed50ab3e2f2559acf92f998516d0e7d094968 Mon Sep 17 00:00:00 2001 From: Kinzcool Date: Sun, 7 Apr 2013 02:23:06 -0400 Subject: DB/Triggers: Implemented arenas triggers teleport to stop people that go outside the walls. --- .../2013_04_07_00_world_areatrigger_teleport.sql | 27 ++++++++++++++++++++++ .../game/Battlegrounds/Zones/BattlegroundBE.cpp | 6 ----- .../game/Battlegrounds/Zones/BattlegroundBE.h | 1 - .../game/Battlegrounds/Zones/BattlegroundDS.cpp | 6 ----- .../game/Battlegrounds/Zones/BattlegroundDS.h | 1 - .../game/Battlegrounds/Zones/BattlegroundNA.cpp | 6 ----- .../game/Battlegrounds/Zones/BattlegroundNA.h | 1 - .../game/Battlegrounds/Zones/BattlegroundRL.cpp | 6 ----- .../game/Battlegrounds/Zones/BattlegroundRL.h | 1 - .../game/Battlegrounds/Zones/BattlegroundRV.cpp | 6 ----- .../game/Battlegrounds/Zones/BattlegroundRV.h | 1 - 11 files changed, 27 insertions(+), 35 deletions(-) create mode 100644 sql/updates/world/2013_04_07_00_world_areatrigger_teleport.sql (limited to 'src') diff --git a/sql/updates/world/2013_04_07_00_world_areatrigger_teleport.sql b/sql/updates/world/2013_04_07_00_world_areatrigger_teleport.sql new file mode 100644 index 00000000000..b9669aaf9c0 --- /dev/null +++ b/sql/updates/world/2013_04_07_00_world_areatrigger_teleport.sql @@ -0,0 +1,27 @@ +DELETE FROM `areatrigger_teleport` WHERE `id` IN (4917, 4919, 4921, 4922, 4923, 4924, 4925, 4927, 4928, 4929, 4930, 4931, 4932, 4933, 4934, 4935, 4936, 4941, 4944, 5326, 5328, 5329, 5330, 5331, 5447); +INSERT INTO `areatrigger_teleport` (`id`, `target_map`, `target_position_x`, `target_position_y`, `target_position_z`, `target_orientation`, `name`) VALUES +(4917, 559, 4054.57, 2923.23, 13.8179, 0, 'Arena - Nagrand - Teleport Target - Game On'), +(4919, 562, 6238.89, 264.155, 0.894302, 0, 'Arena - Bladesedge - Teleport Target - Game On'), +(4921, 562, 6238.89, 264.155, 0.894302, 0, 'Arena - Bladesedge - Teleport Target - Game On'), +(4922, 562, 6238.89, 264.155, 0.894302, 0, 'Arena - Bladesedge - Teleport Target - Game On'), +(4923, 562, 6238.89, 264.155, 0.894302, 0, 'Arena - Bladesedge - Teleport Target - Game On'), +(4924, 562, 6238.89, 264.155, 0.894302, 0, 'Arena - Bladesedge - Teleport Target - Game On'), +(4925, 562, 6238.89, 264.155, 0.894302, 0, 'Arena - Bladesedge - Teleport Target - Game On'), +(4927, 572, 1286.57, 1667.4, 39.602, 0, 'Arena - Undercity - Teleport Target - Game On'), +(4928, 572, 1286.57, 1667.4, 39.602, 0, 'Arena - Undercity - Teleport Target - Game On'), +(4929, 572, 1286.57, 1667.4, 39.602, 0, 'Arena - Undercity - Teleport Target - Game On'), +(4930, 572, 1286.57, 1667.4, 39.602, 0, 'Arena - Undercity - Teleport Target - Game On'), +(4931, 572, 1286.57, 1667.4, 39.602, 0, 'Arena - Undercity - Teleport Target - Game On'), +(4932, 572, 1286.57, 1667.4, 39.602, 0, 'Arena - Undercity - Teleport Target - Game On'), +(4933, 572, 1286.57, 1667.4, 39.602, 0, 'Arena - Undercity - Teleport Target - Game On'), +(4934, 572, 1286.57, 1667.4, 39.602, 0, 'Arena - Undercity - Teleport Target - Game On'), +(4935, 572, 1286.57, 1667.4, 39.602, 0, 'Arena - Undercity - Teleport Target - Game On'), +(4936, 572, 1286.57, 1667.4, 39.602, 0, 'Arena - Undercity - Teleport Target - Game On'), +(4941, 572, 1286.57, 1667.4, 39.602, 0, 'Arena - Undercity - Teleport Target - Game On'), +(4944, 562, 6238.89, 264.155, 0.894302, 0, 'Arena - Bladesedge - Teleport Target - Game On'), +(5326, 617, 1291.57, 792.965, 8.11463, 0, 'Arena - Dalaran Arena - Teleport Target'), +(5328, 617, 1291.57, 792.965, 8.11463, 0, 'Arena - Dalaran Arena - Teleport Target'), +(5329, 617, 1291.57, 792.965, 8.11463, 0, 'Arena - Dalaran Arena - Teleport Target'), +(5330, 617, 1291.57, 792.965, 8.11463, 0, 'Arena - Dalaran Arena - Teleport Target'), +(5331, 617, 1291.57, 792.965, 8.11463, 0, 'Arena - Dalaran Arena - Teleport Target'), +(5447, 618, 763.365, -284.29, 28.2767, 0, 'Arena - Orgrimmar - Teleport Target 3'); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp index 9d1c12a8903..c09b42f1e7f 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.cpp @@ -94,12 +94,6 @@ void BattlegroundBE::HandleKillPlayer(Player* player, Player* killer) CheckArenaWinConditions(); } -bool BattlegroundBE::HandlePlayerUnderMap(Player* player) -{ - player->TeleportTo(GetMapId(), 6238.930176f, 262.963470f, 0.889519f, player->GetOrientation()); - return true; -} - void BattlegroundBE::HandleAreaTrigger(Player* player, uint32 trigger) { if (GetStatus() != STATUS_IN_PROGRESS) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h index 9953e548df6..f9a3028ddf6 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundBE.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundBE.h @@ -59,7 +59,6 @@ class BattlegroundBE : public Battleground void Reset(); void FillInitialWorldStates(WorldPacket &d); void HandleKillPlayer(Player* player, Player* killer); - bool HandlePlayerUnderMap(Player* player); /* Scorekeeping */ void UpdatePlayerScore(Player* Source, uint32 type, uint32 value, bool doAddHonor = true); diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp index e7462f970a3..fe1973d3daf 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.cpp @@ -201,12 +201,6 @@ void BattlegroundDS::HandleAreaTrigger(Player* player, uint32 trigger) } } -bool BattlegroundDS::HandlePlayerUnderMap(Player* player) -{ - player->TeleportTo(GetMapId(), 1299.046f, 784.825f, 9.338f, 2.422f); - return true; -} - void BattlegroundDS::FillInitialWorldStates(WorldPacket &data) { data << uint32(3610) << uint32(1); // 9 show diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h index 43437595220..cdfbbc480bb 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundDS.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundDS.h @@ -96,7 +96,6 @@ class BattlegroundDS : public Battleground void Reset(); void FillInitialWorldStates(WorldPacket &d); void HandleKillPlayer(Player* player, Player* killer); - bool HandlePlayerUnderMap(Player* player); private: uint32 _waterfallTimer; uint8 _waterfallStatus; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp index 4d0cdf08eba..d3ce5c1544e 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.cpp @@ -91,12 +91,6 @@ void BattlegroundNA::HandleKillPlayer(Player* player, Player* killer) CheckArenaWinConditions(); } -bool BattlegroundNA::HandlePlayerUnderMap(Player* player) -{ - player->TeleportTo(GetMapId(), 4055.504395f, 2919.660645f, 13.611241f, player->GetOrientation()); - return true; -} - void BattlegroundNA::HandleAreaTrigger(Player* player, uint32 trigger) { if (GetStatus() != STATUS_IN_PROGRESS) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h index d53f47787a4..e3633197253 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundNA.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundNA.h @@ -58,6 +58,5 @@ class BattlegroundNA : public Battleground void Reset(); void FillInitialWorldStates(WorldPacket &d); void HandleKillPlayer(Player* player, Player* killer); - bool HandlePlayerUnderMap(Player* player); }; #endif diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp index 1b18583827d..de7d6995120 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.cpp @@ -91,12 +91,6 @@ void BattlegroundRL::HandleKillPlayer(Player* player, Player* killer) CheckArenaWinConditions(); } -bool BattlegroundRL::HandlePlayerUnderMap(Player* player) -{ - player->TeleportTo(GetMapId(), 1285.810547f, 1667.896851f, 39.957642f, player->GetOrientation()); - return true; -} - void BattlegroundRL::HandleAreaTrigger(Player* player, uint32 trigger) { if (GetStatus() != STATUS_IN_PROGRESS) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h index e5e55782005..877e0626271 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRL.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRL.h @@ -54,6 +54,5 @@ class BattlegroundRL : public Battleground void HandleAreaTrigger(Player* Source, uint32 Trigger); bool SetupBattleground(); void HandleKillPlayer(Player* player, Player* killer); - bool HandlePlayerUnderMap(Player* player); }; #endif diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index 9f15bd29bed..6325bd2a629 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -135,12 +135,6 @@ void BattlegroundRV::HandleKillPlayer(Player* player, Player* killer) CheckArenaWinConditions(); } -bool BattlegroundRV::HandlePlayerUnderMap(Player* player) -{ - player->TeleportTo(GetMapId(), 763.5f, -284, 28.276f, 2.422f); - return true; -} - void BattlegroundRV::HandleAreaTrigger(Player* player, uint32 trigger) { if (GetStatus() != STATUS_IN_PROGRESS) diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h index b6dc3775df8..a836e4e1af3 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.h +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.h @@ -108,7 +108,6 @@ class BattlegroundRV : public Battleground void HandleAreaTrigger(Player* Source, uint32 Trigger); bool SetupBattleground(); void HandleKillPlayer(Player* player, Player* killer); - bool HandlePlayerUnderMap(Player* player); private: uint32 Timer; -- 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') 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 199f8b71408a3ac99e4fd356c8a3a9e9ebc65487 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sun, 7 Apr 2013 16:02:27 +0200 Subject: Core/Movement: Use spline id generator for movement packets --- src/server/game/Movement/Spline/MoveSplineInit.cpp | 1 + src/server/game/Movement/Spline/MovementTypedefs.h | 1 + src/server/game/Movement/Spline/MovementUtil.cpp | 1 + 3 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/server/game/Movement/Spline/MoveSplineInit.cpp b/src/server/game/Movement/Spline/MoveSplineInit.cpp index e661cf877e3..4b1af78a799 100644 --- a/src/server/game/Movement/Spline/MoveSplineInit.cpp +++ b/src/server/game/Movement/Spline/MoveSplineInit.cpp @@ -125,6 +125,7 @@ namespace Movement MoveSplineInit::MoveSplineInit(Unit* m) : unit(m) { + args.splineId = splineIdGen.NewId(); // Elevators also use MOVEMENTFLAG_ONTRANSPORT but we do not keep track of their position changes args.TransformForTransport = unit->HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT) && unit->GetTransGUID(); // mix existing state into new diff --git a/src/server/game/Movement/Spline/MovementTypedefs.h b/src/server/game/Movement/Spline/MovementTypedefs.h index d8fe21ad4e6..51679260ebb 100644 --- a/src/server/game/Movement/Spline/MovementTypedefs.h +++ b/src/server/game/Movement/Spline/MovementTypedefs.h @@ -76,6 +76,7 @@ namespace Movement extern double gravity; extern float computeFallElevation(float t_passed, bool isSafeFall, float start_velocity); + extern UInt32Counter splineIdGen; } #endif // TRINITYSERVER_TYPEDEFS_H diff --git a/src/server/game/Movement/Spline/MovementUtil.cpp b/src/server/game/Movement/Spline/MovementUtil.cpp index 99413384dd8..3531b629454 100644 --- a/src/server/game/Movement/Spline/MovementUtil.cpp +++ b/src/server/game/Movement/Spline/MovementUtil.cpp @@ -23,6 +23,7 @@ namespace Movement { double gravity = 19.29110527038574; + UInt32Counter splineIdGen; /// Velocity bounds that makes fall speed limited float terminalVelocity = 60.148003f; -- cgit v1.2.3 From 8cbad9466ddd096b120ae3c3fdc9cfc841fb9b8c Mon Sep 17 00:00:00 2001 From: Gacko Date: Mon, 8 Apr 2013 18:16:44 +0200 Subject: Core/Gossip: New AddMenuItem method for using DB texts Many thanks to @Erimioa --- src/server/game/AI/ScriptedAI/ScriptedGossip.h | 4 +++ src/server/game/Entities/Creature/GossipDef.cpp | 44 +++++++++++++++++++++++++ src/server/game/Entities/Creature/GossipDef.h | 4 +++ 3 files changed, 52 insertions(+) (limited to 'src') diff --git a/src/server/game/AI/ScriptedAI/ScriptedGossip.h b/src/server/game/AI/ScriptedAI/ScriptedGossip.h index 80142afd14b..93add2ae652 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedGossip.h +++ b/src/server/game/AI/ScriptedAI/ScriptedGossip.h @@ -78,7 +78,11 @@ enum eTradeskill // d - Action (identifys this Menu Item) // e - Text to be displayed in pop up box // f - Money value in pop up box +// g - Coded +// h - Menu ID from DB +// i - Menu item ID from DB #define ADD_GOSSIP_ITEM(a, b, c, d) PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, a, b, c, d, "", 0) +#define ADD_GOSSIP_ITEM_DB(h, i, c, d) PlayerTalkClass->GetGossipMenu().AddMenuItem(h, i, c, d) #define ADD_GOSSIP_ITEM_EXTENDED(a, b, c, d, e, f, g) PlayerTalkClass->GetGossipMenu().AddMenuItem(-1, a, b, c, d, e, f, g) // This fuction Sends the current menu to show to client, a - NPCTEXTID(uint32), b - npc guid(uint64) diff --git a/src/server/game/Entities/Creature/GossipDef.cpp b/src/server/game/Entities/Creature/GossipDef.cpp index a2305a8a56d..f19f2474213 100644 --- a/src/server/game/Entities/Creature/GossipDef.cpp +++ b/src/server/game/Entities/Creature/GossipDef.cpp @@ -65,6 +65,48 @@ void GossipMenu::AddMenuItem(int32 menuItemId, uint8 icon, std::string const& me menuItem.BoxMoney = boxMoney; } +/** + * @name AddMenuItem + * @brief Adds a localized gossip menu item from db by menu id and menu item id. + * @param menuId Gossip menu id. + * @param menuItemId Gossip menu item id. + * @param sender Identifier of the current menu. + * @param action Custom action given to OnGossipHello. + */ +void GossipMenu::AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, uint32 action) +{ + /// Find items for given menu id. + GossipMenuItemsMapBounds bounds = sObjectMgr->GetGossipMenuItemsMapBounds(menuId); + /// Return if there are none. + if (bounds.first == bounds.second) + return; + + /// Iterate over each of them. + for (GossipMenuItemsContainer::const_iterator itr = bounds.first; itr != bounds.second; ++itr) + { + /// Find the one with the given menu item id. + if (itr->second.OptionIndex != menuItemId) + continue; + + /// Store texts for localization. + std::string strOptionText = itr->second.OptionText; + std::string strBoxText = itr->second.BoxText; + + /// Check need of localization. + if (GetLocale() > LOCALE_enUS) + /// Find localizations from database. + if (GossipMenuItemsLocale const* no = sObjectMgr->GetGossipMenuItemsLocale(MAKE_PAIR32(menuId, menuItemId))) + { + /// Translate texts if there are any. + ObjectMgr::GetLocaleString(no->OptionText, GetLocale(), strOptionText); + ObjectMgr::GetLocaleString(no->BoxText, GetLocale(), strBoxText); + } + + /// Add menu item with existing method. Menu item id -1 is also used in ADD_GOSSIP_ITEM macro. + AddMenuItem(-1, itr->second.OptionIcon, strOptionText, sender, action, strBoxText, itr->second.BoxMoney, itr->second.BoxCoded); + } +} + void GossipMenu::AddGossipMenuItemData(uint32 menuItemId, uint32 gossipActionMenuId, uint32 gossipActionPoi) { GossipMenuItemData& itemData = _menuItemData[menuItemId]; @@ -108,6 +150,8 @@ void GossipMenu::ClearMenu() PlayerMenu::PlayerMenu(WorldSession* session) : _session(session) { + if (_session) + _gossipMenu.SetLocale(_session->GetSessionDbLocaleIndex()); } PlayerMenu::~PlayerMenu() diff --git a/src/server/game/Entities/Creature/GossipDef.h b/src/server/game/Entities/Creature/GossipDef.h index f13f19bba55..b43ab8ec332 100644 --- a/src/server/game/Entities/Creature/GossipDef.h +++ b/src/server/game/Entities/Creature/GossipDef.h @@ -163,9 +163,12 @@ class GossipMenu ~GossipMenu(); void AddMenuItem(int32 menuItemId, uint8 icon, std::string const& message, uint32 sender, uint32 action, std::string const& boxMessage, uint32 boxMoney, bool coded = false); + void AddMenuItem(uint32 menuId, uint32 menuItemId, uint32 sender, uint32 action); void SetMenuId(uint32 menu_id) { _menuId = menu_id; } uint32 GetMenuId() const { return _menuId; } + void SetLocale(LocaleConstant locale) { _locale = locale; } + LocaleConstant GetLocale() const { return _locale; } void AddGossipMenuItemData(uint32 menuItemId, uint32 gossipActionMenuId, uint32 gossipActionPoi); @@ -212,6 +215,7 @@ class GossipMenu GossipMenuItemContainer _menuItems; GossipMenuItemDataContainer _menuItemData; uint32 _menuId; + LocaleConstant _locale; }; class QuestMenu -- cgit v1.2.3 From 100a632a62e7bdbbf79595557de1066affc9346f Mon Sep 17 00:00:00 2001 From: Ascathor Date: Tue, 9 Apr 2013 21:27:27 +0200 Subject: Clearify the guild limitation message on world server initation (3.3.5a withdrawal cap; 4.3.4 withdrawal and guild rep cap) --- src/server/game/World/World.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index ec11a29b5c1..a786a218dc5 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1779,7 +1779,7 @@ void World::SetInitialWorldSettings() sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate random battleground reset time..."); InitRandomBGResetTime(); - sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate Guild cap reset time..."); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Calculate guild limitation(s) reset time..."); InitGuildResetTime(); LoadCharacterNameData(); -- 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') 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') 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') 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') 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') 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 7afe928f2a9dfbade05bbb0736ef9c8795a06435 Mon Sep 17 00:00:00 2001 From: click Date: Sun, 14 Apr 2013 14:35:45 +0200 Subject: Core/Buildsystem: Actually follow CONF_DIR path-directive when installing configuration-files on UNIX Fixes issue #9649 --- src/server/authserver/CMakeLists.txt | 2 +- src/server/worldserver/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/authserver/CMakeLists.txt b/src/server/authserver/CMakeLists.txt index f7c4b9cb8ca..57ab1ffa4ed 100644 --- a/src/server/authserver/CMakeLists.txt +++ b/src/server/authserver/CMakeLists.txt @@ -98,7 +98,7 @@ endif() if( UNIX ) install(TARGETS authserver DESTINATION bin) - install(FILES authserver.conf.dist DESTINATION etc) + install(FILES authserver.conf.dist DESTINATION ${CONF_DIR}) elseif( WIN32 ) install(TARGETS authserver DESTINATION "${CMAKE_INSTALL_PREFIX}") install(FILES authserver.conf.dist DESTINATION "${CMAKE_INSTALL_PREFIX}") diff --git a/src/server/worldserver/CMakeLists.txt b/src/server/worldserver/CMakeLists.txt index b7097be8e2a..933d545c899 100644 --- a/src/server/worldserver/CMakeLists.txt +++ b/src/server/worldserver/CMakeLists.txt @@ -197,7 +197,7 @@ endif() if( UNIX ) install(TARGETS worldserver DESTINATION bin) - install(FILES worldserver.conf.dist DESTINATION etc) + install(FILES worldserver.conf.dist DESTINATION ${CONF_DIR}) elseif( WIN32 ) install(TARGETS worldserver DESTINATION "${CMAKE_INSTALL_PREFIX}") install(FILES worldserver.conf.dist DESTINATION "${CMAKE_INSTALL_PREFIX}") -- cgit v1.2.3 From 4be3090a0f347002e41d4a78a031245bad3cd887 Mon Sep 17 00:00:00 2001 From: xjose93 Date: Sun, 14 Apr 2013 11:36:06 +0200 Subject: Core/Log: Added more information to log when a map cant be created. --- src/server/game/Handlers/MovementHandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index 6f1c2a30d5e..4410cd20d7c 100644 --- a/src/server/game/Handlers/MovementHandler.cpp +++ b/src/server/game/Handlers/MovementHandler.cpp @@ -76,7 +76,7 @@ void WorldSession::HandleMoveWorldportAckOpcode() // while the player is in transit, for example the map may get full if (!newMap || !newMap->CanEnter(GetPlayer())) { - sLog->outError(LOG_FILTER_NETWORKIO, "Map %d could not be created for player %d, porting player to homebind", loc.GetMapId(), GetPlayer()->GetGUIDLow()); + sLog->outError(LOG_FILTER_NETWORKIO, "Map %d (%s) could not be created for player %d (%s), porting player to homebind", loc.GetMapId(), newMap ? newMap->GetMapName() : "Unknown", GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str()); GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation()); return; } -- cgit v1.2.3 From 19b47e452fff6ca20d1ba1b7ab4c037d87aa4df0 Mon Sep 17 00:00:00 2001 From: xjose93 Date: Sun, 14 Apr 2013 11:19:30 +0200 Subject: Core/Events: announce event system improvement. --- sql/updates/world/2013_04_14_00_world_game_event.sql | 2 ++ src/server/game/Events/GameEventMgr.cpp | 8 +++++--- src/server/game/Events/GameEventMgr.h | 1 + 3 files changed, 8 insertions(+), 3 deletions(-) create mode 100644 sql/updates/world/2013_04_14_00_world_game_event.sql (limited to 'src') diff --git a/sql/updates/world/2013_04_14_00_world_game_event.sql b/sql/updates/world/2013_04_14_00_world_game_event.sql new file mode 100644 index 00000000000..82929053e8c --- /dev/null +++ b/sql/updates/world/2013_04_14_00_world_game_event.sql @@ -0,0 +1,2 @@ +ALTER TABLE `game_event` +ADD COLUMN `announce` tinyint(3) unsigned NULL DEFAULT 2 COMMENT '0 dont announce, 1 announce, 2 value from config' AFTER `world_event`; diff --git a/src/server/game/Events/GameEventMgr.cpp b/src/server/game/Events/GameEventMgr.cpp index 9141f77b852..737a6d1b91c 100644 --- a/src/server/game/Events/GameEventMgr.cpp +++ b/src/server/game/Events/GameEventMgr.cpp @@ -205,8 +205,8 @@ void GameEventMgr::LoadFromDB() { { uint32 oldMSTime = getMSTime(); - // 0 1 2 3 4 5 6 7 - QueryResult result = WorldDatabase.Query("SELECT eventEntry, UNIX_TIMESTAMP(start_time), UNIX_TIMESTAMP(end_time), occurence, length, holiday, description, world_event FROM game_event"); + // 0 1 2 3 4 5 6 7 8 + QueryResult result = WorldDatabase.Query("SELECT eventEntry, UNIX_TIMESTAMP(start_time), UNIX_TIMESTAMP(end_time), occurence, length, holiday, description, world_event, announce FROM game_event"); if (!result) { mGameEvent.clear(); @@ -237,6 +237,7 @@ void GameEventMgr::LoadFromDB() pGameEvent.state = (GameEventState)(fields[7].GetUInt8()); pGameEvent.nextstart = 0; + pGameEvent.announce = fields[8].GetUInt8(); if (pGameEvent.length == 0 && pGameEvent.state == GAMEEVENT_NORMAL) // length>0 is validity check { @@ -1104,7 +1105,8 @@ void GameEventMgr::UnApplyEvent(uint16 event_id) void GameEventMgr::ApplyNewEvent(uint16 event_id) { - if (sWorld->getBoolConfig(CONFIG_EVENT_ANNOUNCE)) + uint8 announce = mGameEvent[event_id].announce; + if (announce == 1 || (announce == 2 && sWorld->getBoolConfig(CONFIG_EVENT_ANNOUNCE))) sWorld->SendWorldText(LANG_EVENTMESSAGE, mGameEvent[event_id].description.c_str()); sLog->outInfo(LOG_FILTER_GAMEEVENTS, "GameEvent %u \"%s\" started.", event_id, mGameEvent[event_id].description.c_str()); diff --git a/src/server/game/Events/GameEventMgr.h b/src/server/game/Events/GameEventMgr.h index 4175e57f28a..ad4ddeeba88 100644 --- a/src/server/game/Events/GameEventMgr.h +++ b/src/server/game/Events/GameEventMgr.h @@ -66,6 +66,7 @@ struct GameEventData GameEventConditionMap conditions; // conditions to finish std::set prerequisite_events; // events that must be completed before starting this event std::string description; + uint8 announce; // if 0 dont announce, if 1 announce, if 2 take config value bool isValid() const { return length > 0 || state > GAMEEVENT_NORMAL; } }; -- 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') 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 e5ec998864c83254842c41e14d8373a081fc57ea Mon Sep 17 00:00:00 2001 From: Shocker Date: Thu, 18 Apr 2013 05:40:39 +0300 Subject: Core/Spells: Fix dynobj aura stacking --- src/server/game/Spells/Auras/SpellAuras.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index 51149df1265..12c4183ce2e 100644 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -1801,7 +1801,7 @@ bool Aura::CanStackWith(Aura const* existingAura) const return true; // Dynobj auras always stack - if (existingAura->GetType() == DYNOBJ_AURA_TYPE) + if (GetType() == DYNOBJ_AURA_TYPE || existingAura->GetType() == DYNOBJ_AURA_TYPE) return true; SpellInfo const* existingSpellInfo = existingAura->GetSpellInfo(); -- 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') 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') 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') 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 3166d149c3c6fc9164b504742b9c6316856a7a1e Mon Sep 17 00:00:00 2001 From: xjose93 Date: Tue, 23 Apr 2013 09:58:00 +0200 Subject: Core/Log: Added mapname to log when a player cant be teleported. --- src/server/game/Handlers/MovementHandler.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index 6f1c2a30d5e..35f77315dda 100644 --- a/src/server/game/Handlers/MovementHandler.cpp +++ b/src/server/game/Handlers/MovementHandler.cpp @@ -89,8 +89,8 @@ void WorldSession::HandleMoveWorldportAckOpcode() GetPlayer()->SendInitialPacketsBeforeAddToMap(); if (!GetPlayer()->GetMap()->AddPlayerToMap(GetPlayer())) { - sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: failed to teleport player %s (%d) to map %d because of unknown reason!", - GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), loc.GetMapId()); + sLog->outError(LOG_FILTER_NETWORKIO, "WORLD: failed to teleport player %s (%d) to map %d (%s) because of unknown reason!", + GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), loc.GetMapId(), newMap ? newMap->GetMapName() : "Unknown"); GetPlayer()->ResetMap(); GetPlayer()->SetMap(oldMap); GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation()); -- cgit v1.2.3 From c7a6c1be84ad3598e586f051d7c6a4d268bfcccf Mon Sep 17 00:00:00 2001 From: xjose93 Date: Tue, 23 Apr 2013 14:50:08 +0200 Subject: Core/Log: Added guid (of gm), area and zone to gm command log. --- src/server/game/Chat/Chat.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Chat/Chat.cpp b/src/server/game/Chat/Chat.cpp index 7c92af2d67f..f9d8fe9378f 100644 --- a/src/server/game/Chat/Chat.cpp +++ b/src/server/game/Chat/Chat.cpp @@ -369,8 +369,19 @@ bool ChatHandler::ExecuteCommandInTable(ChatCommand* table, const char* text, co { Player* p = m_session->GetPlayer(); uint64 sel_guid = p->GetSelection(); - sLog->outCommand(m_session->GetAccountId(), "Command: %s [Player: %s (Account: %u) X: %f Y: %f Z: %f Map: %u Selected %s: %s (GUID: %u)]", - fullcmd.c_str(), p->GetName().c_str(), m_session->GetAccountId(), p->GetPositionX(), p->GetPositionY(), p->GetPositionZ(), p->GetMapId(), + uint32 areaId = p->GetAreaId(); + std::string areaName = "Unknown"; + std::string zoneName = "Unknown"; + if (AreaTableEntry const* area = GetAreaEntryByAreaID(areaId)) + { + int locale = GetSessionDbcLocale(); + areaName = area->area_name[locale]; + if (AreaTableEntry const* zone = GetAreaEntryByAreaID(area->zone)) + zoneName = zone->area_name[locale]; + } + + sLog->outCommand(m_session->GetAccountId(), "Command: %s [Player: %s (Guid: %u) (Account: %u) X: %f Y: %f Z: %f Map: %u (%s) Area: %u (%s) Zone: %s Selected %s: %s (GUID: %u)]", + fullcmd.c_str(), p->GetName().c_str(), GUID_LOPART(p->GetGUID()), m_session->GetAccountId(), p->GetPositionX(), p->GetPositionY(), p->GetPositionZ(), p->GetMapId(), p->GetMap() ? p->GetMap()->GetMapName() : "Unknown", areaId, areaName.c_str(), zoneName.c_str(), GetLogNameForGuid(sel_guid), (p->GetSelectedUnit()) ? p->GetSelectedUnit()->GetName().c_str() : "", GUID_LOPART(sel_guid)); } } -- cgit v1.2.3 From 2d8a4a1bc968b0749b08236ea5f930561b94bbeb Mon Sep 17 00:00:00 2001 From: Eilo Date: Tue, 23 Apr 2013 12:41:44 -0500 Subject: Script/Arena: Ring of Valor, toggle visuals gameobjects accordingly --- src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp index 6325bd2a629..68e961414f9 100644 --- a/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundRV.cpp @@ -64,8 +64,6 @@ void BattlegroundRV::PostUpdateImpl(uint32 diff) setState(BG_RV_STATE_SWITCH_PILLARS); break; case BG_RV_STATE_SWITCH_PILLARS: - for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PULLEY_2; ++i) - DoorOpen(i); TogglePillarCollision(); setTimer(BG_RV_PILLAR_SWITCH_TIMER); break; @@ -211,6 +209,13 @@ void BattlegroundRV::TogglePillarCollision() { bool apply = GetPillarCollision(); + // Toggle visual pillars, pulley, gear, and collision based on previous state + for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_GEAR_2; ++i) + apply ? DoorOpen(i) : DoorClose(i); + + for (uint8 i = BG_RV_OBJECT_PILAR_2; i <= BG_RV_OBJECT_PULLEY_2; ++i) + apply ? DoorClose(i) : DoorOpen(i); + for (uint8 i = BG_RV_OBJECT_PILAR_1; i <= BG_RV_OBJECT_PILAR_COLLISION_4; ++i) { if (GameObject* gob = GetBgMap()->GetGameObject(BgObjects[i])) -- cgit v1.2.3 From d7e9d1bafb288596f0057fcd5517ba95981579e4 Mon Sep 17 00:00:00 2001 From: xjose93 Date: Thu, 25 Apr 2013 19:10:10 +0200 Subject: Core/World: Improvements in Autobroadcast system (dropped from world database and moved to auth database, added realmid and weight columns) --- sql/updates/auth/2013_04_25_00_auth_misc.txt | 8 +++++ sql/updates/world/2013_04_25_00_world_misc.sql | 1 + src/server/game/World/World.cpp | 41 +++++++++++++++++++--- src/server/game/World/World.h | 6 +++- .../Database/Implementation/LoginDatabase.cpp | 1 + .../shared/Database/Implementation/LoginDatabase.h | 1 + 6 files changed, 52 insertions(+), 6 deletions(-) create mode 100644 sql/updates/auth/2013_04_25_00_auth_misc.txt create mode 100644 sql/updates/world/2013_04_25_00_world_misc.sql (limited to 'src') diff --git a/sql/updates/auth/2013_04_25_00_auth_misc.txt b/sql/updates/auth/2013_04_25_00_auth_misc.txt new file mode 100644 index 00000000000..383b19ebd55 --- /dev/null +++ b/sql/updates/auth/2013_04_25_00_auth_misc.txt @@ -0,0 +1,8 @@ +DROP TABLE IF EXISTS `autobroadcast`; +CREATE TABLE `autobroadcast` ( + `realmid` int(10) NOT NULL, + `id` int(11) NOT NULL AUTO_INCREMENT, + `weight` tinyint(3) DEFAULT 1, + `text` longtext NOT NULL, + PRIMARY KEY (`id`, `realmid`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8; diff --git a/sql/updates/world/2013_04_25_00_world_misc.sql b/sql/updates/world/2013_04_25_00_world_misc.sql new file mode 100644 index 00000000000..c07a3f76b5f --- /dev/null +++ b/sql/updates/world/2013_04_25_00_world_misc.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS `autobroadcast`; diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index a786a218dc5..144d91485b5 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1866,12 +1866,16 @@ void World::LoadAutobroadcasts() uint32 oldMSTime = getMSTime(); m_Autobroadcasts.clear(); + m_AutobroadcastsWeights.clear(); - QueryResult result = WorldDatabase.Query("SELECT text FROM autobroadcast"); + uint32 realmId = ConfigMgr::GetIntDefault("RealmID", 0); + PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_AUTOBROADCAST); + stmt->setInt32(0, realmId); + PreparedQueryResult result = LoginDatabase.Query(stmt); if (!result) { - sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty!"); + sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 autobroadcasts definitions. DB table `autobroadcast` is empty for this realm!"); return; } @@ -1880,9 +1884,10 @@ void World::LoadAutobroadcasts() do { Field* fields = result->Fetch(); - std::string message = fields[0].GetString(); + uint8 id = fields[0].GetUInt8(); - m_Autobroadcasts.push_back(message); + m_Autobroadcasts[id] = fields[2].GetString(); + m_AutobroadcastsWeights[id] = fields[1].GetUInt8(); ++count; } while (result->NextRow()); @@ -2635,9 +2640,35 @@ void World::SendAutoBroadcast() if (m_Autobroadcasts.empty()) return; + uint32 weight = 0; + AutobroadcastsWeightMap selectionWeights; std::string msg; - msg = Trinity::Containers::SelectRandomContainerElement(m_Autobroadcasts); + for (AutobroadcastsWeightMap::const_iterator it = m_AutobroadcastsWeights.begin(); it != m_AutobroadcastsWeights.end(); ++it) + { + if (it->second) + { + weight += it->second; + selectionWeights[it->first] = it->second; + } + } + + if (weight) + { + uint32 selectedWeight = urand(0, weight - 1); + weight = 0; + for (AutobroadcastsWeightMap::const_iterator it = selectionWeights.begin(); it != selectionWeights.end(); ++it) + { + weight += it->second; + if (selectedWeight < weight) + { + msg = m_Autobroadcasts[it->first]; + break; + } + } + } + else + msg = m_Autobroadcasts[urand(0, m_Autobroadcasts.size())]; uint32 abcenter = sWorld->getIntConfig(CONFIG_AUTOBROADCAST_CENTER); diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index 00bb9e7ffb2..b303ca4bd4b 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -820,7 +820,11 @@ class World // used versions std::string m_DBVersion; - std::list m_Autobroadcasts; + typedef std::map AutobroadcastsMap; + AutobroadcastsMap m_Autobroadcasts; + + typedef std::map AutobroadcastsWeightMap; + AutobroadcastsWeightMap m_AutobroadcastsWeights; std::map _characterNameDataMap; void LoadCharacterNameData(); diff --git a/src/server/shared/Database/Implementation/LoginDatabase.cpp b/src/server/shared/Database/Implementation/LoginDatabase.cpp index 4b0ee041603..0118f637205 100644 --- a/src/server/shared/Database/Implementation/LoginDatabase.cpp +++ b/src/server/shared/Database/Implementation/LoginDatabase.cpp @@ -91,6 +91,7 @@ void LoginDatabaseConnection::DoPrepareStatements() 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_AUTOBROADCAST, "SELECT id, weight, text FROM autobroadcast WHERE realmid = ? OR realmid = -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 0f5a388a0b0..97cf91fc178 100644 --- a/src/server/shared/Database/Implementation/LoginDatabase.h +++ b/src/server/shared/Database/Implementation/LoginDatabase.h @@ -111,6 +111,7 @@ enum LoginDatabaseStatements LOGIN_SEL_REALMLIST_SECURITY_LEVEL, LOGIN_DEL_ACCOUNT, LOGIN_SEL_IP2NATION_COUNTRY, + LOGIN_SEL_AUTOBROADCAST, LOGIN_SEL_ACCOUNT_ACCESS_BY_ID, LOGIN_SEL_RBAC_ACCOUNT_GROUPS, -- cgit v1.2.3 From 25d064432667973fb2b3ef1e111745ecffcbcdd4 Mon Sep 17 00:00:00 2001 From: xjose93 Date: Fri, 26 Apr 2013 14:33:13 +0200 Subject: Core/Guild: Add guid of gm and guildname to log when an item its deposit on guildbank. --- src/server/game/Guilds/Guild.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index 158a20d67d1..6421f9caa65 100644 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -986,10 +986,10 @@ void Guild::BankMoveItemData::LogAction(MoveItemData* pFrom) const if (!pFrom->IsBank() && m_pPlayer->GetSession()->HasPermission(RBAC_PERM_LOG_GM_TRADE)) /// @todo Move this to scripts { sLog->outCommand(m_pPlayer->GetSession()->GetAccountId(), - "GM %s (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank (Guild ID: %u)", - m_pPlayer->GetName().c_str(), m_pPlayer->GetSession()->GetAccountId(), + "GM %s (Guid: %u) (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank named: %s (Guild ID: %u)", + GUID_LOPART(m_pPlayer->GetGUID()), m_pPlayer->GetName().c_str(), m_pPlayer->GetSession()->GetAccountId(), pFrom->GetItem()->GetTemplate()->Name1.c_str(), pFrom->GetItem()->GetEntry(), pFrom->GetItem()->GetCount(), - m_pGuild->GetId()); + m_pGuild->GetName().c_str(), m_pGuild->GetId()); } } -- cgit v1.2.3 From 24fb735a0d978fb0290d0ca6714f04e5cc5c5d89 Mon Sep 17 00:00:00 2001 From: xjose93 Date: Fri, 26 Apr 2013 14:38:27 +0200 Subject: Core/Player: Add playername at log when a player not found in characters database. --- src/server/game/Entities/Player/Player.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index e12e5eef238..4114dd6109f 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -16910,7 +16910,9 @@ bool Player::LoadFromDB(uint32 guid, SQLQueryHolder *holder) PreparedQueryResult result = holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_FROM); if (!result) { - sLog->outError(LOG_FILTER_PLAYER, "Player (GUID: %u) not found in table `characters`, can't load. ", guid); + std::string name = ""; + sObjectMgr->GetPlayerNameByGUID(guid, name); + sLog->outError(LOG_FILTER_PLAYER, "Player %s (GUID: %u) not found in table `characters`, can't load. ", name.c_str(), guid); return false; } -- cgit v1.2.3 From 118ec195a64bf706b65bbf8c292232148ae84de9 Mon Sep 17 00:00:00 2001 From: Shauren Date: Fri, 26 Apr 2013 22:46:43 +0200 Subject: Core/DBLayer: Fixed mismatched field type in auction house prepared statement. Closes #9694 --- src/server/game/AuctionHouse/AuctionHouseMgr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 4c80d268c12..94964568695 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -658,7 +658,7 @@ void AuctionEntry::SaveToDB(SQLTransaction& trans) const stmt->setUInt32(2, itemGUIDLow); stmt->setUInt32(3, owner); stmt->setInt32 (4, int32(buyout)); - stmt->setUInt64(5, uint64(expire_time)); + stmt->setUInt32(5, uint32(expire_time)); stmt->setUInt32(6, bidder); stmt->setInt32 (7, int32(bid)); stmt->setInt32 (8, int32(startbid)); -- cgit v1.2.3 From eb7f0adcb5bc01c019e9c9341e8c3b4c1e2ffc4b Mon Sep 17 00:00:00 2001 From: xjose93 Date: Sat, 27 Apr 2013 01:10:10 +0200 Subject: Core/Maps: Add mapname when a player is binded to other save. --- src/server/game/Maps/Map.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 70942b8ffc0..98f0159ddb9 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2421,7 +2421,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) // cannot enter other instances if bound permanently if (playerBind->save != mapSave) { - sLog->outError(LOG_FILTER_MAPS, "InstanceMap::Add: player %s(%d) is permanently bound to instance %d, %d, %d, %d, %d, %d but he is being put into instance %d, %d, %d, %d, %d, %d", player->GetName().c_str(), player->GetGUIDLow(), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset()); + sLog->outError(LOG_FILTER_MAPS, "InstanceMap::Add: player %s(%d) is permanently bound to instance %s %d, %d, %d, %d, %d, %d but he is being put into instance %s %d, %d, %d, %d, %d, %d", player->GetName().c_str(), player->GetGUIDLow(), GetMapName(), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset(), GetMapName(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset()); return false; } } @@ -2433,9 +2433,9 @@ bool InstanceMap::AddPlayerToMap(Player* player) InstanceGroupBind* groupBind = group->GetBoundInstance(this); if (playerBind && playerBind->save != mapSave) { - sLog->outError(LOG_FILTER_MAPS, "InstanceMap::Add: player %s(%d) is being put into instance %d, %d, %d, %d, %d, %d but he is in group %d and is bound to instance %d, %d, %d, %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), GUID_LOPART(group->GetLeaderGUID()), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset()); + sLog->outError(LOG_FILTER_MAPS, "InstanceMap::Add: player %s(%d) is being put into instance %s %d, %d, %d, %d, %d, %d but he is in group %d and is bound to instance %d, %d, %d, %d, %d, %d!", player->GetName().c_str(), player->GetGUIDLow(), GetMapName(), mapSave->GetMapId(), mapSave->GetInstanceId(), mapSave->GetDifficulty(), mapSave->GetPlayerCount(), mapSave->GetGroupCount(), mapSave->CanReset(), GUID_LOPART(group->GetLeaderGUID()), playerBind->save->GetMapId(), playerBind->save->GetInstanceId(), playerBind->save->GetDifficulty(), playerBind->save->GetPlayerCount(), playerBind->save->GetGroupCount(), playerBind->save->CanReset()); if (groupBind) - sLog->outError(LOG_FILTER_MAPS, "InstanceMap::Add: the group is bound to the instance %d, %d, %d, %d, %d, %d", groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(), groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset()); + sLog->outError(LOG_FILTER_MAPS, "InstanceMap::Add: the group is bound to the instance %s %d, %d, %d, %d, %d, %d", GetMapName(), groupBind->save->GetMapId(), groupBind->save->GetInstanceId(), groupBind->save->GetDifficulty(), groupBind->save->GetPlayerCount(), groupBind->save->GetGroupCount(), groupBind->save->CanReset()); //ASSERT(false); return false; } -- cgit v1.2.3 From 1ce50f84425147a98b2bd9897fdc79ff58cf4560 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 27 Apr 2013 11:45:37 +0200 Subject: Core/OutdoorPvP: Fixed crash in capture point update when players leave the point Closes #9722 --- src/server/game/OutdoorPvP/OutdoorPvP.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/OutdoorPvP/OutdoorPvP.cpp b/src/server/game/OutdoorPvP/OutdoorPvP.cpp index 93bf7edc7d5..684bc43ceaa 100644 --- a/src/server/game/OutdoorPvP/OutdoorPvP.cpp +++ b/src/server/game/OutdoorPvP/OutdoorPvP.cpp @@ -280,10 +280,17 @@ bool OPvPCapturePoint::Update(uint32 diff) float radius = (float)m_capturePoint->GetGOInfo()->capturePoint.radius; for (uint32 team = 0; team < 2; ++team) - for (PlayerSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end(); ++itr) - if (Player* player = ObjectAccessor::FindPlayer(*itr)) + { + for (PlayerSet::iterator itr = m_activePlayers[team].begin(); itr != m_activePlayers[team].end();) + { + uint64 playerGuid = *itr; + ++itr; + + if (Player* player = ObjectAccessor::FindPlayer(playerGuid)) if (!m_capturePoint->IsWithinDistInMap(player, radius) || !player->IsOutdoorPvPActive()) HandlePlayerLeave(player); + } + } std::list players; Trinity::AnyPlayerInObjectRangeCheck checker(m_capturePoint, radius); -- cgit v1.2.3 From a4201904722149b3188894cf1ef41e9f5c8b92a9 Mon Sep 17 00:00:00 2001 From: xjose93 Date: Sat, 27 Apr 2013 19:56:40 +0200 Subject: Core/Log: Add playerguid and mapnames when player still in world when its teleported. --- src/server/game/Handlers/MovementHandler.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Handlers/MovementHandler.cpp b/src/server/game/Handlers/MovementHandler.cpp index f4c4b68524f..75d00a7da59 100644 --- a/src/server/game/Handlers/MovementHandler.cpp +++ b/src/server/game/Handlers/MovementHandler.cpp @@ -64,14 +64,15 @@ void WorldSession::HandleMoveWorldportAckOpcode() GetPlayer()->m_InstanceValid = true; Map* oldMap = GetPlayer()->GetMap(); + Map* newMap = sMapMgr->CreateMap(loc.GetMapId(), GetPlayer()); + if (GetPlayer()->IsInWorld()) { - sLog->outError(LOG_FILTER_NETWORKIO, "Player (Name %s) is still in world when teleported from map %u to new map %u", GetPlayer()->GetName().c_str(), oldMap->GetId(), loc.GetMapId()); + sLog->outError(LOG_FILTER_NETWORKIO, "Player %s (GUID: %u) is still in world when teleported from map %s (%u) to new map %s (%u)", GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID()), oldMap->GetMapName(), oldMap->GetId(), newMap ? newMap->GetMapName() : "Unknown", loc.GetMapId()); oldMap->RemovePlayerFromMap(GetPlayer(), false); } // relocate the player to the teleport destination - Map* newMap = sMapMgr->CreateMap(loc.GetMapId(), GetPlayer()); // the CanEnter checks are done in TeleporTo but conditions may change // while the player is in transit, for example the map may get full if (!newMap || !newMap->CanEnter(GetPlayer())) -- cgit v1.2.3 From 1c2d617c18b028d6b0c12a04105a9ff2caa71060 Mon Sep 17 00:00:00 2001 From: Ascathor Date: Sun, 28 Apr 2013 00:04:55 +0200 Subject: Core/Player: CharDelete.Heroic.MinLevel as seperated unlink requirement for Heroic classes Also added documentation for GetCharacterNameData --- src/server/game/Entities/Player/Player.cpp | 25 +++++++++++++++++++------ src/server/game/World/World.cpp | 24 +++++++++++++++++++++++- src/server/game/World/World.h | 1 + src/server/worldserver/worldserver.conf.dist | 10 +++++++++- 4 files changed, 52 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 4114dd6109f..60dbb7651d0 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -4688,20 +4688,33 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell */ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmChars, bool deleteFinally) { - // for not existed account avoid update realm + // Avoid realm-update for non-existing account if (accountId == 0) updateRealmChars = false; + // Convert guid to low GUID for CharacterNameData, but also other methods on success + uint32 guid = GUID_LOPART(playerguid); + + // To avoid a query, we select loaded data. If it doesn't exist, return. + CharacterNameData const* nameData = sWorld->GetCharacterNameData(guid); + if (!nameData) + { + sLog->outError(LOG_FILTER_PLAYER, "Invalid call on information for guid (%u) from account (%u). Could not delete character.", guid, accountId); + return; + } + + // Selecting the required pieces of information + uint8 playerClass = nameData->m_class; + uint8 playerLevel = nameData->m_level; + // Define the required variables uint32 charDelete_method = sWorld->getIntConfig(CONFIG_CHARDELETE_METHOD); - uint32 charDelete_minLvl = sWorld->getIntConfig(CONFIG_CHARDELETE_MIN_LEVEL); + uint32 charDelete_minLvl = sWorld->getIntConfig(playerClass != CLASS_DEATH_KNIGHT ? CONFIG_CHARDELETE_MIN_LEVEL : CONFIG_CHARDELETE_HEROIC_MIN_LEVEL); - // if we want to finally delete the character or the character does not meet the level requirement, + // if we want to finalize the character removal or the character does not meet the level requirement of either heroic or non-heroic settings, // we set it to mode CHAR_DELETE_REMOVE - if (deleteFinally || Player::GetLevelFromDB(playerguid) < charDelete_minLvl) + if (deleteFinally || playerLevel < charDelete_minLvl) charDelete_method = CHAR_DELETE_REMOVE; - uint32 guid = GUID_LOPART(playerguid); - // convert corpse to bones if exist (to prevent exiting Corpse in World without DB entry) // bones will be deleted by corpse/bones deleting thread shortly sObjectAccessor->ConvertCorpseForPlayer(playerguid); diff --git a/src/server/game/World/World.cpp b/src/server/game/World/World.cpp index 144d91485b5..834f02d7692 100644 --- a/src/server/game/World/World.cpp +++ b/src/server/game/World/World.cpp @@ -1100,6 +1100,7 @@ void World::LoadConfigSettings(bool reload) ///- Load the CharDelete related config options m_int_configs[CONFIG_CHARDELETE_METHOD] = ConfigMgr::GetIntDefault("CharDelete.Method", 0); m_int_configs[CONFIG_CHARDELETE_MIN_LEVEL] = ConfigMgr::GetIntDefault("CharDelete.MinLevel", 0); + m_int_configs[CONFIG_CHARDELETE_HEROIC_MIN_LEVEL] = ConfigMgr::GetIntDefault("CharDelete.Heroic.MinLevel", 0); m_int_configs[CONFIG_CHARDELETE_KEEP_DAYS] = ConfigMgr::GetIntDefault("CharDelete.KeepDays", 30); ///- Read the "Data" directory from the config file @@ -3076,6 +3077,27 @@ void World::ProcessQueryCallbacks() } } +/** +* @brief Loads several pieces of information on server startup with the low GUID +* There is no further database query necessary. +* These are a number of methods that work into the calling function. +* +* @param guid Requires a lowGUID to call +* @return Name, Gender, Race, Class and Level of player character +* Example Usage: +* @code +* CharacterNameData const* nameData = sWorld->GetCharacterNameData(lowGUID); +* if (!nameData) +* return; +* +* std::string playerName = nameData->m_name; +* uint8 playerGender = nameData->m_gender; +* uint8 playerRace = nameData->m_race; +* uint8 playerClass = nameData->m_class; +* uint8 playerLevel = nameData->m_level; +* @endcode +**/ + void World::LoadCharacterNameData() { sLog->outInfo(LOG_FILTER_SERVER_LOADING, "Loading character name data"); @@ -3145,7 +3167,7 @@ CharacterNameData const* World::GetCharacterNameData(uint32 guid) const void World::ReloadRBAC() { - // Pasive reload, we mark the data as invalidated and next time a permission is checked it will be reloaded + // Passive reload, we mark the data as invalidated and next time a permission is checked it will be reloaded sLog->outInfo(LOG_FILTER_RBAC, "World::ReloadRBAC()"); for (SessionMap::const_iterator itr = m_sessions.begin(); itr != m_sessions.end(); ++itr) if (WorldSession* session = itr->second) diff --git a/src/server/game/World/World.h b/src/server/game/World/World.h index b303ca4bd4b..984a1709ac8 100644 --- a/src/server/game/World/World.h +++ b/src/server/game/World/World.h @@ -300,6 +300,7 @@ enum WorldIntConfigs CONFIG_CHARDELETE_KEEP_DAYS, CONFIG_CHARDELETE_METHOD, CONFIG_CHARDELETE_MIN_LEVEL, + CONFIG_CHARDELETE_HEROIC_MIN_LEVEL, CONFIG_AUTOBROADCAST_CENTER, CONFIG_AUTOBROADCAST_INTERVAL, CONFIG_MAX_RESULTS_LOOKUP_COMMANDS, diff --git a/src/server/worldserver/worldserver.conf.dist b/src/server/worldserver/worldserver.conf.dist index bf19240407f..a9b09e5d94f 100644 --- a/src/server/worldserver/worldserver.conf.dist +++ b/src/server/worldserver/worldserver.conf.dist @@ -2372,12 +2372,20 @@ CharDelete.Method = 0 # # CharDelete.MinLevel -# Description: Required level to use the unlinking method if enabled. +# Description: Required level to use the unlinking method if enabled for non-heroic classes. # Default: 0 - (Same method for every level) # 1+ - (Only characters with the specified level will use the unlinking method) CharDelete.MinLevel = 0 +# +# CharDelete.Heroic.MinLevel +# Description: Required level to use the unlinking method if enabled for heroic classes. +# Default: 0 - (Same method for every level) +# 1+ - (Only characters with the specified level will use the unlinking method) + +CharDelete.Heroic.MinLevel = 0 + # # CharDelete.KeepDays # Description: Time (in days) before unlinked characters will be removed from the database. -- cgit v1.2.3 From 425f85c354d38e42dfcc04753da40bfb0a966fd6 Mon Sep 17 00:00:00 2001 From: joschiwald Date: Sun, 28 Apr 2013 15:57:44 +0200 Subject: Core/ScriptLoader: load eventscripts --- src/server/game/Scripting/ScriptLoader.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/server/game/Scripting/ScriptLoader.cpp b/src/server/game/Scripting/ScriptLoader.cpp index 845c3fa704d..edabc7b4284 100644 --- a/src/server/game/Scripting/ScriptLoader.cpp +++ b/src/server/game/Scripting/ScriptLoader.cpp @@ -640,6 +640,7 @@ void AddScripts() AddKalimdorScripts(); AddOutlandScripts(); AddNorthrendScripts(); + AddEventScripts(); AddBattlegroundScripts(); AddOutdoorPvPScripts(); AddCustomScripts(); -- cgit v1.2.3 From c33b811829767aefe228f6c4f65408c632f05538 Mon Sep 17 00:00:00 2001 From: Vincent_Michael Date: Sun, 28 Apr 2013 17:01:13 +0200 Subject: Core/Guild: Fix logic fail --- src/server/game/Guilds/Guild.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Guilds/Guild.cpp b/src/server/game/Guilds/Guild.cpp index afecd673c07..fe02b693e8b 100644 --- a/src/server/game/Guilds/Guild.cpp +++ b/src/server/game/Guilds/Guild.cpp @@ -987,7 +987,7 @@ void Guild::BankMoveItemData::LogAction(MoveItemData* pFrom) const { sLog->outCommand(m_pPlayer->GetSession()->GetAccountId(), "GM %s (Guid: %u) (Account: %u) deposit item: %s (Entry: %d Count: %u) to guild bank named: %s (Guild ID: %u)", - GUID_LOPART(m_pPlayer->GetGUID()), m_pPlayer->GetName().c_str(), m_pPlayer->GetSession()->GetAccountId(), + m_pPlayer->GetName().c_str(), m_pPlayer->GetGUIDLow(), m_pPlayer->GetSession()->GetAccountId(), pFrom->GetItem()->GetTemplate()->Name1.c_str(), pFrom->GetItem()->GetEntry(), pFrom->GetItem()->GetCount(), m_pGuild->GetName().c_str(), m_pGuild->GetId()); } -- cgit v1.2.3 From c0b7755384e3bc5dc1b9abc880249bfd2c4c90ff Mon Sep 17 00:00:00 2001 From: xjose93 Date: Mon, 29 Apr 2013 09:20:26 +0200 Subject: Core/Logs: Add mapname at logging some info about loading bound instances --- src/server/game/Entities/Player/Player.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 60dbb7651d0..ee9f412b0e4 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -18439,14 +18439,16 @@ void Player::_LoadBoundInstances(PreparedQueryResult result) bool deleteInstance = false; MapEntry const* mapEntry = sMapStore.LookupEntry(mapId); + std::string mapname = mapEntry ? mapEntry->name[sWorld->GetDefaultDbcLocale()] : "Unknown"; + if (!mapEntry || !mapEntry->IsDungeon()) { - sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) has bind to not existed or not dungeon map %d", GetName().c_str(), GetGUIDLow(), mapId); + sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) has bind to not existed or not dungeon map %d (%s)", GetName().c_str(), GetGUIDLow(), mapId, mapname.c_str()); deleteInstance = true; } else if (difficulty >= MAX_DIFFICULTY) { - sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u", GetName().c_str(), GetGUIDLow(), difficulty, mapId); + sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u (%s)", GetName().c_str(), GetGUIDLow(), difficulty, mapId, mapname.c_str()); deleteInstance = true; } else @@ -18454,12 +18456,12 @@ void Player::_LoadBoundInstances(PreparedQueryResult result) MapDifficulty const* mapDiff = GetMapDifficultyData(mapId, Difficulty(difficulty)); if (!mapDiff) { - sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u", GetName().c_str(), GetGUIDLow(), difficulty, mapId); + sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) has bind to not existed difficulty %d instance for map %u (%s)", GetName().c_str(), GetGUIDLow(), difficulty, mapId, mapname.c_str()); deleteInstance = true; } else if (!perm && group) { - sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) is in group %d but has a non-permanent character bind to map %d, %d, %d", GetName().c_str(), GetGUIDLow(), GUID_LOPART(group->GetGUID()), mapId, instanceId, difficulty); + sLog->outError(LOG_FILTER_PLAYER, "_LoadBoundInstances: player %s(%d) is in group %d but has a non-permanent character bind to map %d (%s), %d, %d", GetName().c_str(), GetGUIDLow(), GUID_LOPART(group->GetGUID()), mapId, mapname.c_str(), instanceId, difficulty); deleteInstance = true; } } -- cgit v1.2.3 From fc02b7f8a034556c8941b1571beb904a2bc917a0 Mon Sep 17 00:00:00 2001 From: xjose93 Date: Mon, 29 Apr 2013 10:15:35 +0200 Subject: Core/Logs: Add player guid into some logs. --- src/server/game/Battlegrounds/BattlegroundQueue.cpp | 7 ++++--- src/server/game/Entities/Player/Player.cpp | 10 +++++----- src/server/game/Handlers/MiscHandler.cpp | 2 +- src/server/game/Handlers/PetHandler.cpp | 8 ++++---- 4 files changed, 14 insertions(+), 13 deletions(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index 65d3b9dc0b8..600f5e8150b 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -285,8 +285,6 @@ uint32 BattlegroundQueue::GetAverageQueueWaitTime(GroupQueueInfo* ginfo, Battleg //remove player from queue and from group info, if group info is empty then remove it too void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount) { - //Player* player = ObjectAccessor::FindPlayer(guid); - int32 bracket_id = -1; // signed for proper for-loop finish QueuedPlayersMap::iterator itr; @@ -294,7 +292,10 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount) itr = m_QueuedPlayers.find(guid); if (itr == m_QueuedPlayers.end()) { - sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue: couldn't find player to remove GUID: %u", GUID_LOPART(guid)); + std::string playerName = "Unknown"; + if (Player* player = ObjectAccessor::FindPlayer(guid)) + playerName = player->GetName(); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue: couldn't find player %s (GUID: %u)", GUID_LOPART(guid)); return; } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 60dbb7651d0..35a675d7d61 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -6667,13 +6667,13 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) { if (button >= MAX_ACTION_BUTTONS) { - sLog->outError(LOG_FILTER_PLAYER, "Action %u not added into button %u for player %s: button must be < %u", action, button, GetName().c_str(), MAX_ACTION_BUTTONS ); + sLog->outError(LOG_FILTER_PLAYER, "Action %u not added into button %u for player %s (GUID: %u): button must be < %u", action, button, GetName().c_str(), GUID_LOPART(GetGUID()), MAX_ACTION_BUTTONS ); return false; } if (action >= MAX_ACTION_BUTTON_ACTION_VALUE) { - sLog->outError(LOG_FILTER_PLAYER, "Action %u not added into button %u for player %s: action must be < %u", action, button, GetName().c_str(), MAX_ACTION_BUTTON_ACTION_VALUE); + sLog->outError(LOG_FILTER_PLAYER, "Action %u not added into button %u for player %s (GUID: %u): action must be < %u", action, button, GetName().c_str(), GUID_LOPART(GetGUID()), MAX_ACTION_BUTTON_ACTION_VALUE); return false; } @@ -6682,20 +6682,20 @@ bool Player::IsActionButtonDataValid(uint8 button, uint32 action, uint8 type) case ACTION_BUTTON_SPELL: if (!sSpellMgr->GetSpellInfo(action)) { - sLog->outError(LOG_FILTER_PLAYER, "Spell action %u not added into button %u for player %s: spell not exist", action, button, GetName().c_str()); + sLog->outError(LOG_FILTER_PLAYER, "Spell action %u not added into button %u for player %s (GUID: %u): spell not exist", action, button, GetName().c_str(), GUID_LOPART(GetGUID())); return false; } if (!HasSpell(action)) { - sLog->outError(LOG_FILTER_PLAYER, "Spell action %u not added into button %u for player %s: player don't known this spell", action, button, GetName().c_str()); + sLog->outError(LOG_FILTER_PLAYER, "Spell action %u not added into button %u for player %s (GUID: %u): player don't known this spell", action, button, GetName().c_str(), GUID_LOPART(GetGUID())); return false; } break; case ACTION_BUTTON_ITEM: if (!sObjectMgr->GetItemTemplate(action)) { - sLog->outError(LOG_FILTER_PLAYER, "Item action %u not added into button %u for player %s: item not exist", action, button, GetName().c_str()); + sLog->outError(LOG_FILTER_PLAYER, "Item action %u not added into button %u for player %s (GUID: %u): item not exist", action, button, GetName().c_str(), GUID_LOPART(GetGUID())); return false; } break; diff --git a/src/server/game/Handlers/MiscHandler.cpp b/src/server/game/Handlers/MiscHandler.cpp index 5a9289904f5..afe6e352950 100644 --- a/src/server/game/Handlers/MiscHandler.cpp +++ b/src/server/game/Handlers/MiscHandler.cpp @@ -1385,7 +1385,7 @@ void WorldSession::HandleFarSightOpcode(WorldPacket& recvData) if (WorldObject* target = _player->GetViewpoint()) _player->SetSeer(target); else - sLog->outError(LOG_FILTER_NETWORKIO, "Player %s requests non-existing seer " UI64FMTD, _player->GetName().c_str(), _player->GetUInt64Value(PLAYER_FARSIGHT)); + sLog->outError(LOG_FILTER_NETWORKIO, "Player %s (GUID: %u) requests non-existing seer " UI64FMTD, _player->GetName().c_str(), GUID_LOPART(_player->GetGUID()), _player->GetUInt64Value(PLAYER_FARSIGHT)); } else { diff --git a/src/server/game/Handlers/PetHandler.cpp b/src/server/game/Handlers/PetHandler.cpp index fc5f6fbd513..4d70a246909 100644 --- a/src/server/game/Handlers/PetHandler.cpp +++ b/src/server/game/Handlers/PetHandler.cpp @@ -74,13 +74,13 @@ void WorldSession::HandlePetAction(WorldPacket& recvData) if (!pet) { - sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetAction: Pet (GUID: %u) doesn't exist for player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str()); + sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetAction: Pet (GUID: %u) doesn't exist for player %s (GUID: %u)", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID())); return; } if (pet != GetPlayer()->GetFirstControlled()) { - sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetAction: Pet (GUID: %u) does not belong to player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str()); + sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetAction: Pet (GUID: %u) does not belong to player %s (GUID: %u)", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID())); return; } @@ -715,7 +715,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket) if (!pet || (pet != _player->GetGuardianPet() && pet != _player->GetCharm())) { - sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); + sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s (GUID: %u).", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID())); return; } @@ -760,7 +760,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket) if (!caster || (caster != _player->GetGuardianPet() && caster != _player->GetCharm())) { - sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str()); + sLog->outError(LOG_FILTER_NETWORKIO, "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s (GUID: %u).", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GUID_LOPART(GetPlayer()->GetGUID())); return; } -- 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') 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 2e1b1b8ceb08dcbe35f11605486c45f52717f2e2 Mon Sep 17 00:00:00 2001 From: Shauren Date: Mon, 29 Apr 2013 15:29:51 +0200 Subject: Core/Players: Fixed deleting characters, remove CharacterNameData only after the character is deleted, not before --- src/server/game/Entities/Player/Player.cpp | 3 +++ src/server/game/Handlers/CharacterHandler.cpp | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index b8e1233593b..2b39045e1e7 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -5013,10 +5013,13 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC } default: sLog->outError(LOG_FILTER_PLAYER, "Player::DeleteFromDB: Unsupported delete method: %u.", charDelete_method); + return; } if (updateRealmChars) sWorld->UpdateRealmCharCount(accountId); + + sWorld->DeleteCharacterNameData(GUID_LOPART(guid)); } /** diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index f1ec017962e..3e27157ed66 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -738,7 +738,6 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData) std::string IP_str = GetRemoteAddress(); sLog->outInfo(LOG_FILTER_CHARACTER, "Account: %d, IP: %s deleted character: %s, GUID: %u, Level: %u", accountId, IP_str.c_str(), name.c_str(), GUID_LOPART(guid), level); sScriptMgr->OnPlayerDelete(guid); - sWorld->DeleteCharacterNameData(GUID_LOPART(guid)); if (sLog->ShouldLog(LOG_FILTER_PLAYER_DUMP, LOG_LEVEL_INFO)) // optimize GetPlayerDump call { -- cgit v1.2.3 From 54749e6918df211e1534daefc31281cf5767f7b5 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 30 Apr 2013 11:10:39 +0200 Subject: Core/Battlegrounds: Fixed a crash in queue logging --- src/server/game/Battlegrounds/BattlegroundQueue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Battlegrounds/BattlegroundQueue.cpp b/src/server/game/Battlegrounds/BattlegroundQueue.cpp index 600f5e8150b..c4fad3f49b3 100644 --- a/src/server/game/Battlegrounds/BattlegroundQueue.cpp +++ b/src/server/game/Battlegrounds/BattlegroundQueue.cpp @@ -295,7 +295,7 @@ void BattlegroundQueue::RemovePlayer(uint64 guid, bool decreaseInvitedCount) std::string playerName = "Unknown"; if (Player* player = ObjectAccessor::FindPlayer(guid)) playerName = player->GetName(); - sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue: couldn't find player %s (GUID: %u)", GUID_LOPART(guid)); + sLog->outError(LOG_FILTER_BATTLEGROUND, "BattlegroundQueue: couldn't find player %s (GUID: %u)", playerName.c_str(), GUID_LOPART(guid)); return; } -- cgit v1.2.3 From b1e8c422593f4f6429d82d7a9e5cb50bf7350be7 Mon Sep 17 00:00:00 2001 From: Shauren Date: Wed, 1 May 2013 21:56:39 +0200 Subject: Core/PacketIO: Corrected structures of SMSG_PARTY_MEMBER_STATS and SMSG_PARTY_MEMBER_STATS_FULL, fixes weird pet behavior in groups (appearing as "Unknown", breaking combat logs) Closes #345 --- src/server/game/Handlers/GroupHandler.cpp | 230 +++++++++++++++++++----------- 1 file changed, 149 insertions(+), 81 deletions(-) (limited to 'src') diff --git a/src/server/game/Handlers/GroupHandler.cpp b/src/server/game/Handlers/GroupHandler.cpp index 89f77e784b9..02933dcc3d9 100644 --- a/src/server/game/Handlers/GroupHandler.cpp +++ b/src/server/game/Handlers/GroupHandler.cpp @@ -725,45 +725,66 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke data->Initialize(SMSG_PARTY_MEMBER_STATS, 8 + 4 + byteCount); data->append(player->GetPackGUID()); - *data << (uint32) mask; + *data << uint32(mask); if (mask & GROUP_UPDATE_FLAG_STATUS) { if (player) { + uint16 playerStatus = MEMBER_STATUS_ONLINE; if (player->IsPvP()) - *data << (uint16) (MEMBER_STATUS_ONLINE | MEMBER_STATUS_PVP); - else - *data << (uint16) MEMBER_STATUS_ONLINE; + playerStatus |= MEMBER_STATUS_PVP; + + if (!player->isAlive()) + { + if (player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) + playerStatus |= MEMBER_STATUS_GHOST; + else + playerStatus |= MEMBER_STATUS_DEAD; + } + + if (player->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP)) + playerStatus |= MEMBER_STATUS_PVP_FFA; + + if (player->isAFK()) + playerStatus |= MEMBER_STATUS_AFK; + + if (player->isDND()) + playerStatus |= MEMBER_STATUS_DND; + + *data << uint16(playerStatus); } else - *data << (uint16) MEMBER_STATUS_OFFLINE; + *data << uint16(MEMBER_STATUS_OFFLINE); } if (mask & GROUP_UPDATE_FLAG_CUR_HP) - *data << (uint32) player->GetHealth(); + *data << uint32(player->GetHealth()); if (mask & GROUP_UPDATE_FLAG_MAX_HP) - *data << (uint32) player->GetMaxHealth(); + *data << uint32(player->GetMaxHealth()); Powers powerType = player->getPowerType(); if (mask & GROUP_UPDATE_FLAG_POWER_TYPE) - *data << (uint8) powerType; + *data << uint8(powerType); if (mask & GROUP_UPDATE_FLAG_CUR_POWER) - *data << (uint16) player->GetPower(powerType); + *data << uint16(player->GetPower(powerType)); if (mask & GROUP_UPDATE_FLAG_MAX_POWER) - *data << (uint16) player->GetMaxPower(powerType); + *data << uint16(player->GetMaxPower(powerType)); if (mask & GROUP_UPDATE_FLAG_LEVEL) - *data << (uint16) player->getLevel(); + *data << uint16(player->getLevel()); if (mask & GROUP_UPDATE_FLAG_ZONE) - *data << (uint16) player->GetZoneId(); + *data << uint16(player->GetZoneId()); if (mask & GROUP_UPDATE_FLAG_POSITION) - *data << (uint16) player->GetPositionX() << (uint16) player->GetPositionY(); + { + *data << uint16(player->GetPositionX()); + *data << uint16(player->GetPositionY()); + } if (mask & GROUP_UPDATE_FLAG_AURAS) { @@ -794,61 +815,55 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke if (pet) *data << pet->GetName(); else - *data << (uint8) 0; + *data << uint8(0); } if (mask & GROUP_UPDATE_FLAG_PET_MODEL_ID) { if (pet) - *data << (uint16) pet->GetDisplayId(); + *data << uint16(pet->GetDisplayId()); else - *data << (uint16) 0; + *data << uint16(0); } if (mask & GROUP_UPDATE_FLAG_PET_CUR_HP) { if (pet) - *data << (uint32) pet->GetHealth(); + *data << uint32(pet->GetHealth()); else - *data << (uint32) 0; + *data << uint32(0); } if (mask & GROUP_UPDATE_FLAG_PET_MAX_HP) { if (pet) - *data << (uint32) pet->GetMaxHealth(); + *data << uint32(pet->GetMaxHealth()); else - *data << (uint32) 0; + *data << uint32(0); } if (mask & GROUP_UPDATE_FLAG_PET_POWER_TYPE) { if (pet) - *data << (uint8) pet->getPowerType(); + *data << uint8(pet->getPowerType()); else - *data << (uint8) 0; + *data << uint8(0); } if (mask & GROUP_UPDATE_FLAG_PET_CUR_POWER) { if (pet) - *data << (uint16) pet->GetPower(pet->getPowerType()); + *data << uint16(pet->GetPower(pet->getPowerType())); else - *data << (uint16) 0; + *data << uint16(0); } if (mask & GROUP_UPDATE_FLAG_PET_MAX_POWER) { if (pet) - *data << (uint16) pet->GetMaxPower(pet->getPowerType()); + *data << uint16(pet->GetMaxPower(pet->getPowerType())); else - *data << (uint16) 0; - } - - if (mask & GROUP_UPDATE_FLAG_VEHICLE_SEAT) - { - if (Vehicle* veh = player->GetVehicle()) - *data << (uint32) veh->GetVehicleInfo()->m_seatID[player->m_movementInfo.t_seat]; + *data << uint16(0); } if (mask & GROUP_UPDATE_FLAG_PET_AURAS) @@ -863,12 +878,20 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke { AuraApplication const* aurApp = pet->GetVisibleAura(i); *data << uint32(aurApp ? aurApp->GetBase()->GetId() : 0); - *data << uint8(1); + *data << uint8(aurApp ? aurApp->GetFlags() : 0); } } } else - *data << (uint64) 0; + *data << uint64(0); + } + + if (mask & GROUP_UPDATE_FLAG_VEHICLE_SEAT) + { + if (Vehicle* veh = player->GetVehicle()) + *data << uint32(veh->GetVehicleInfo()->m_seatID[player->m_movementInfo.t_seat]); + else + *data << uint32(0); } } @@ -885,81 +908,126 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket &recvData) WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 3+4+2); data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related data.appendPackGUID(Guid); - data << (uint32) GROUP_UPDATE_FLAG_STATUS; - data << (uint16) MEMBER_STATUS_OFFLINE; + data << uint32(GROUP_UPDATE_FLAG_STATUS); + data << uint16(MEMBER_STATUS_OFFLINE); SendPacket(&data); return; } Pet* pet = player->GetPet(); + Powers powerType = player->getPowerType(); WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 4+2+2+2+1+2*6+8+1+8); data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related data.append(player->GetPackGUID()); - uint32 mask1 = 0x00040BFF; // common mask, real flags used 0x000040BFF + uint32 updateFlags = GROUP_UPDATE_FLAG_STATUS | GROUP_UPDATE_FLAG_CUR_HP | GROUP_UPDATE_FLAG_MAX_HP + | GROUP_UPDATE_FLAG_CUR_POWER | GROUP_UPDATE_FLAG_MAX_POWER | GROUP_UPDATE_FLAG_LEVEL + | GROUP_UPDATE_FLAG_ZONE | GROUP_UPDATE_FLAG_POSITION | GROUP_UPDATE_FLAG_AURAS + | GROUP_UPDATE_FLAG_PET_NAME | GROUP_UPDATE_FLAG_PET_MODEL_ID | GROUP_UPDATE_FLAG_PET_AURAS; + + if (powerType != POWER_MANA) + updateFlags |= GROUP_UPDATE_FLAG_POWER_TYPE; + if (pet) - mask1 = 0x7FFFFFFF; // for hunters and other classes with pets + updateFlags |= GROUP_UPDATE_FLAG_PET_GUID | GROUP_UPDATE_FLAG_PET_CUR_HP | GROUP_UPDATE_FLAG_PET_MAX_HP + | GROUP_UPDATE_FLAG_PET_POWER_TYPE | GROUP_UPDATE_FLAG_PET_CUR_POWER | GROUP_UPDATE_FLAG_PET_MAX_POWER; - Powers powerType = player->getPowerType(); - data << (uint32) mask1; // group update mask - data << (uint16) MEMBER_STATUS_ONLINE; // member's online status - data << (uint32) player->GetHealth(); // GROUP_UPDATE_FLAG_CUR_HP - data << (uint32) player->GetMaxHealth(); // GROUP_UPDATE_FLAG_MAX_HP - data << (uint8) powerType; // GROUP_UPDATE_FLAG_POWER_TYPE - data << (uint16) player->GetPower(powerType); // GROUP_UPDATE_FLAG_CUR_POWER - data << (uint16) player->GetMaxPower(powerType); // GROUP_UPDATE_FLAG_MAX_POWER - data << (uint16) player->getLevel(); // GROUP_UPDATE_FLAG_LEVEL - data << (uint16) player->GetZoneId(); // GROUP_UPDATE_FLAG_ZONE - data << (uint16) player->GetPositionX(); // GROUP_UPDATE_FLAG_POSITION - data << (uint16) player->GetPositionY(); // GROUP_UPDATE_FLAG_POSITION - - uint64 auramask = 0; + if (player->GetVehicle()) + updateFlags |= GROUP_UPDATE_FLAG_VEHICLE_SEAT; + + uint16 playerStatus = MEMBER_STATUS_ONLINE; + if (player->IsPvP()) + playerStatus |= MEMBER_STATUS_PVP; + + if (!player->isAlive()) + { + if (player->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST)) + playerStatus |= MEMBER_STATUS_GHOST; + else + playerStatus |= MEMBER_STATUS_DEAD; + } + + if (player->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP)) + playerStatus |= MEMBER_STATUS_PVP_FFA; + + if (player->isAFK()) + playerStatus |= MEMBER_STATUS_AFK; + + if (player->isDND()) + playerStatus |= MEMBER_STATUS_DND; + + data << uint32(updateFlags); + data << uint16(playerStatus); // GROUP_UPDATE_FLAG_STATUS + data << uint32(player->GetHealth()); // GROUP_UPDATE_FLAG_CUR_HP + data << uint32(player->GetMaxHealth()); // GROUP_UPDATE_FLAG_MAX_HP + if (updateFlags & GROUP_UPDATE_FLAG_POWER_TYPE) + data << uint8(powerType); + + data << uint16(player->GetPower(powerType)); // GROUP_UPDATE_FLAG_CUR_POWER + data << uint16(player->GetMaxPower(powerType)); // GROUP_UPDATE_FLAG_MAX_POWER + data << uint16(player->getLevel()); // GROUP_UPDATE_FLAG_LEVEL + data << uint16(player->GetZoneId()); // GROUP_UPDATE_FLAG_ZONE + data << uint16(player->GetPositionX()); // GROUP_UPDATE_FLAG_POSITION + data << uint16(player->GetPositionY()); // GROUP_UPDATE_FLAG_POSITION + + uint64 auraMask = 0; size_t maskPos = data.wpos(); - data << (uint64) auramask; // placeholder + data << uint64(auraMask); // placeholder for (uint8 i = 0; i < MAX_AURAS; ++i) { - if (AuraApplication * aurApp = player->GetVisibleAura(i)) + if (AuraApplication const* aurApp = player->GetVisibleAura(i)) { - auramask |= (uint64(1) << i); - data << (uint32) aurApp->GetBase()->GetId(); - data << (uint8) 1; + auraMask |= uint64(1) << i; + data << uint32(aurApp->GetBase()->GetId()); + data << uint8(aurApp->GetFlags()); } } - data.put(maskPos, auramask); // GROUP_UPDATE_FLAG_AURAS + data.put(maskPos, auraMask); // GROUP_UPDATE_FLAG_AURAS + + if (updateFlags & GROUP_UPDATE_FLAG_PET_GUID) + data << uint64(pet->GetGUID()); + + data << std::string(pet ? pet->GetName() : ""); // GROUP_UPDATE_FLAG_PET_NAME + data << uint16(pet ? pet->GetDisplayId() : 0); // GROUP_UPDATE_FLAG_PET_MODEL_ID + + if (updateFlags & GROUP_UPDATE_FLAG_PET_CUR_HP) + data << uint32(pet->GetHealth()); + + if (updateFlags & GROUP_UPDATE_FLAG_PET_MAX_HP) + data << uint32(pet->GetMaxHealth()); + + if (updateFlags & GROUP_UPDATE_FLAG_PET_POWER_TYPE) + data << (uint8)pet->getPowerType(); + + if (updateFlags & GROUP_UPDATE_FLAG_PET_CUR_POWER) + data << uint16(pet->GetPower(pet->getPowerType())); + + if (updateFlags & GROUP_UPDATE_FLAG_PET_MAX_POWER) + data << uint16(pet->GetMaxPower(pet->getPowerType())); + + uint64 petAuraMask = 0; + maskPos = data.wpos(); + data << uint64(petAuraMask); // placeholder if (pet) { - Powers petpowertype = pet->getPowerType(); - data << (uint64) pet->GetGUID(); // GROUP_UPDATE_FLAG_PET_GUID - data << pet->GetName(); // GROUP_UPDATE_FLAG_PET_NAME - data << (uint16) pet->GetDisplayId(); // GROUP_UPDATE_FLAG_PET_MODEL_ID - data << (uint32) pet->GetHealth(); // GROUP_UPDATE_FLAG_PET_CUR_HP - data << (uint32) pet->GetMaxHealth(); // GROUP_UPDATE_FLAG_PET_MAX_HP - data << (uint8) petpowertype; // GROUP_UPDATE_FLAG_PET_POWER_TYPE - data << (uint16) pet->GetPower(petpowertype); // GROUP_UPDATE_FLAG_PET_CUR_POWER - data << (uint16) pet->GetMaxPower(petpowertype); // GROUP_UPDATE_FLAG_PET_MAX_POWER - - uint64 petauramask = 0; - size_t petMaskPos = data.wpos(); - data << (uint64) petauramask; // placeholder for (uint8 i = 0; i < MAX_AURAS; ++i) { - if (AuraApplication * auraApp = pet->GetVisibleAura(i)) + if (AuraApplication const* aurApp = pet->GetVisibleAura(i)) { - petauramask |= (uint64(1) << i); - data << (uint32) auraApp->GetBase()->GetId(); - data << (uint8) 1; + petAuraMask |= uint64(1) << i; + data << uint32(aurApp->GetBase()->GetId()); + data << uint8(aurApp->GetFlags()); } } - data.put(petMaskPos, petauramask); // GROUP_UPDATE_FLAG_PET_AURAS - } - else - { - data << (uint8) 0; // GROUP_UPDATE_FLAG_PET_NAME - data << (uint64) 0; // GROUP_UPDATE_FLAG_PET_AURAS } + data.put(maskPos, petAuraMask); // GROUP_UPDATE_FLAG_PET_AURAS + + if (updateFlags & GROUP_UPDATE_FLAG_VEHICLE_SEAT) + data << uint32(player->GetVehicle()->GetVehicleInfo()->m_seatID[player->m_movementInfo.t_seat]); + SendPacket(&data); } -- cgit v1.2.3 From 8dea73fc83ed00764e03c6ee3bb7c1ffa28527eb Mon Sep 17 00:00:00 2001 From: Warpten Date: Thu, 2 May 2013 04:08:35 +0300 Subject: Core/Spells: Fixed a silly typo in SpellInfo::_IsPositiveEffect. Fixes some auras being displayed as debuffs while they should not. (Just see Invisibility #66) Ref. #7912 --- src/server/game/Spells/SpellInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellInfo.cpp b/src/server/game/Spells/SpellInfo.cpp index e5ad78b00a3..c46b1d08641 100644 --- a/src/server/game/Spells/SpellInfo.cpp +++ b/src/server/game/Spells/SpellInfo.cpp @@ -2476,7 +2476,7 @@ bool SpellInfo::_IsPositiveEffect(uint8 effIndex, bool deep) const continue; // if non-positive trigger cast targeted to positive target this main cast is non-positive // this will place this spell auras as debuffs - if (_IsPositiveTarget(spellTriggeredProto->Effects[i].TargetA.GetTarget(), spellTriggeredProto->Effects[i].TargetB.GetTarget()) && !spellTriggeredProto->_IsPositiveEffect(i, true)) + if (!_IsPositiveTarget(spellTriggeredProto->Effects[i].TargetA.GetTarget(), spellTriggeredProto->Effects[i].TargetB.GetTarget()) && !spellTriggeredProto->_IsPositiveEffect(i, true)) return false; } } -- cgit v1.2.3 From 26efbacfab68e392d18d0b4fd66cb400660605b6 Mon Sep 17 00:00:00 2001 From: Nay Date: Thu, 2 May 2013 03:56:34 +0200 Subject: Core/Spells: Fix a logging message error --- src/server/game/Spells/SpellMgr.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 31d433367ac..9aebffcf53c 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1540,7 +1540,7 @@ void SpellMgr::LoadSpellTargetPositions() SpellInfo const* spellInfo = GetSpellInfo(Spell_ID); if (!spellInfo) { - sLog->outError(LOG_FILTER_SQL, "Spell (ID:%u) listed in `spell_target_position` does not exist.", Spell_ID); + sLog->outError(LOG_FILTER_SQL, "Spell (Id: %u) listed in `spell_target_position` does not exist.", Spell_ID); continue; } @@ -1555,7 +1555,7 @@ void SpellMgr::LoadSpellTargetPositions() uint32 area_id = sMapMgr->GetAreaId(st.target_mapId, st.target_X, st.target_Y, st.target_Z); if (area_id != uint32(spellInfo->Effects[i].MiscValue)) { - sLog->outError(LOG_FILTER_SQL, "Spell (Id: %u) listed in `spell_target_position` expected point to zone %u bit point to zone %u.", Spell_ID, spellInfo->Effects[i].MiscValue, area_id); + sLog->outError(LOG_FILTER_SQL, "Spell (Id: %u) listed in `spell_target_position` expected to point to area %u, but points to area %u instead.", Spell_ID, spellInfo->Effects[i].MiscValue, area_id); break; } } -- cgit v1.2.3 From 45bae8d4b74d772215cb22c7bb27732f55c5d9fd Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 4 May 2013 20:50:14 +0200 Subject: Core/Players: Fixed tabard championing in normal modes of WotLK level 80 dungeons Closes #9227 --- src/server/game/DataStores/DBCStores.cpp | 16 ++++++++++++++++ src/server/game/DataStores/DBCStores.h | 2 ++ src/server/game/Entities/Player/Player.cpp | 9 +++------ src/server/game/Entities/Unit/Unit.cpp | 2 +- 4 files changed, 22 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index 3f5ff28a6c3..11e588f8e8c 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -892,3 +892,19 @@ CharStartOutfitEntry const* GetCharStartOutfitEntry(uint8 race, uint8 class_, ui return itr->second; } + +/// Returns LFGDungeonEntry for a specific map and difficulty. Will return first found entry if multiple dungeons use the same map (such as Scarlet Monastery) +LFGDungeonEntry const* GetLFGDungeon(uint32 mapId, Difficulty difficulty) +{ + for (uint32 i = 0; i < sLFGDungeonStore.GetNumRows(); ++i) + { + LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(i); + if (!dungeon) + continue; + + if (dungeon->map == mapId && Difficulty(dungeon->difficulty) == difficulty) + return dungeon; + } + + return NULL; +} diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index 0090ec7d132..3efdeec0268 100644 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -67,6 +67,8 @@ PvPDifficultyEntry const* GetBattlegroundBracketById(uint32 mapid, BattlegroundB CharStartOutfitEntry const* GetCharStartOutfitEntry(uint8 race, uint8 class_, uint8 gender); +LFGDungeonEntry const* GetLFGDungeon(uint32 mapId, Difficulty difficulty); + extern DBCStorage sAchievementStore; extern DBCStorage sAchievementCriteriaStore; extern DBCStorage sAreaStore;// recommend access using functions diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 2b39045e1e7..7117fd3bbc0 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -5019,7 +5019,7 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC if (updateRealmChars) sWorld->UpdateRealmCharCount(accountId); - sWorld->DeleteCharacterNameData(GUID_LOPART(guid)); + sWorld->DeleteCharacterNameData(guid); } /** @@ -7036,14 +7036,11 @@ void Player::RewardReputation(Unit* victim, float rate) if (GetChampioningFaction()) { // support for: Championing - http://www.wowwiki.com/Championing - Map const* map = GetMap(); if (map && map->IsNonRaidDungeon()) - { - if (AccessRequirement const* accessRequirement = sObjectMgr->GetAccessRequirement(map->GetId(), map->GetDifficulty())) - if (accessRequirement->levelMin == 80) + if (LFGDungeonEntry const* dungeon = GetLFGDungeon(map->GetId(), map->GetDifficulty())) + if (dungeon->reclevel == 80) ChampioningFaction = GetChampioningFaction(); - } } uint32 team = GetTeam(); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index bf73feeae16..798c9371574 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -2209,7 +2209,7 @@ void Unit::SendMeleeAttackStop(Unit* victim) { WorldPacket data(SMSG_ATTACKSTOP, (8+8+4)); data.append(GetPackGUID()); - data.append(victim ? victim->GetPackGUID() : 0); + data.appendPackGUID(victim ? victim->GetGUID() : 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"); -- cgit v1.2.3 From 27ceee92fbfdb0021b9e6e852d5097b7195e9e11 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 7 May 2013 18:47:36 +0200 Subject: Core/AuctionHouse: Fixed field type mismatches when saving auction to database (db fields are unsigned int) and prevent posting auctions with bids or buyouts over gold cap Closes #9762 --- src/server/game/AuctionHouse/AuctionHouseMgr.cpp | 8 ++++---- src/server/game/Handlers/AuctionHouseHandler.cpp | 14 +++++++++++++- 2 files changed, 17 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp index 94964568695..a29f9414fa9 100644 --- a/src/server/game/AuctionHouse/AuctionHouseMgr.cpp +++ b/src/server/game/AuctionHouse/AuctionHouseMgr.cpp @@ -657,12 +657,12 @@ void AuctionEntry::SaveToDB(SQLTransaction& trans) const stmt->setUInt32(1, auctioneer); stmt->setUInt32(2, itemGUIDLow); stmt->setUInt32(3, owner); - stmt->setInt32 (4, int32(buyout)); + stmt->setUInt32(4, buyout); stmt->setUInt32(5, uint32(expire_time)); stmt->setUInt32(6, bidder); - stmt->setInt32 (7, int32(bid)); - stmt->setInt32 (8, int32(startbid)); - stmt->setInt32 (9, int32(deposit)); + stmt->setUInt32(7, bid); + stmt->setUInt32(8, startbid); + stmt->setUInt32(9, deposit); trans->Append(stmt); } diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index 47ad7ffa568..abeee3e1a9e 100644 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -127,6 +127,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) if (itemsCount > MAX_AUCTION_ITEMS) { SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR); + recvData.rfinish(); return; } @@ -135,8 +136,11 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) recvData >> itemGUIDs[i]; recvData >> count[i]; - if (!itemGUIDs[i] || !count[i] || count[i] > 1000 ) + if (!itemGUIDs[i] || !count[i] || count[i] > 1000) + { + recvData.rfinish(); return; + } } recvData >> bid; @@ -146,6 +150,14 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData) if (!bid || !etime) return; + if (bid > MAX_MONEY_AMOUNT || buyout > MAX_MONEY_AMOUNT) + { + sLog->outDebug(LOG_FILTER_NETWORKIO, "WORLD: HandleAuctionSellItem - Player %s (GUID %u) attempted to sell item with higher price than max gold amount.", _player->GetName().c_str(), _player->GetGUIDLow()); + SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR); + return; + } + + Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer, UNIT_NPC_FLAG_AUCTIONEER); if (!creature) { -- cgit v1.2.3 From 77d4acc776a23ffd81b8c8a2653042ee3f279841 Mon Sep 17 00:00:00 2001 From: Shauren Date: Tue, 7 May 2013 19:55:16 +0200 Subject: Core/Players: Fixed deleting characters unlinked from accounts Closes #9764 --- src/server/game/Entities/Player/Player.cpp | 34 +++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 7117fd3bbc0..8283285342f 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -4677,7 +4677,7 @@ TrainerSpellState Player::GetTrainerSpellState(TrainerSpell const* trainer_spell /** * Deletes a character from the database * - * The way, how the characters will be deleted is decided based on the config option. + * The way characters will be deleted is decided based on the config option. * * @see Player::DeleteOldCharacters * @@ -4694,26 +4694,26 @@ void Player::DeleteFromDB(uint64 playerguid, uint32 accountId, bool updateRealmC // Convert guid to low GUID for CharacterNameData, but also other methods on success uint32 guid = GUID_LOPART(playerguid); + uint32 charDelete_method = sWorld->getIntConfig(CONFIG_CHARDELETE_METHOD); - // To avoid a query, we select loaded data. If it doesn't exist, return. - CharacterNameData const* nameData = sWorld->GetCharacterNameData(guid); - if (!nameData) + if (deleteFinally) + charDelete_method = CHAR_DELETE_REMOVE; + else if (CharacterNameData const* nameData = sWorld->GetCharacterNameData(guid)) // To avoid a query, we select loaded data. If it doesn't exist, return. { - sLog->outError(LOG_FILTER_PLAYER, "Invalid call on information for guid (%u) from account (%u). Could not delete character.", guid, accountId); - return; - } + if (!nameData) + { + sLog->outError(LOG_FILTER_PLAYER, "Cannot find CharacterNameData entry for player %u from account %u. Could not delete character.", guid, accountId); + return; + } - // Selecting the required pieces of information - uint8 playerClass = nameData->m_class; - uint8 playerLevel = nameData->m_level; - // Define the required variables - uint32 charDelete_method = sWorld->getIntConfig(CONFIG_CHARDELETE_METHOD); - uint32 charDelete_minLvl = sWorld->getIntConfig(playerClass != CLASS_DEATH_KNIGHT ? CONFIG_CHARDELETE_MIN_LEVEL : CONFIG_CHARDELETE_HEROIC_MIN_LEVEL); + // Define the required variables + uint32 charDelete_minLvl = sWorld->getIntConfig(nameData->m_class != CLASS_DEATH_KNIGHT ? CONFIG_CHARDELETE_MIN_LEVEL : CONFIG_CHARDELETE_HEROIC_MIN_LEVEL); - // if we want to finalize the character removal or the character does not meet the level requirement of either heroic or non-heroic settings, - // we set it to mode CHAR_DELETE_REMOVE - if (deleteFinally || playerLevel < charDelete_minLvl) - charDelete_method = CHAR_DELETE_REMOVE; + // if we want to finalize the character removal or the character does not meet the level requirement of either heroic or non-heroic settings, + // we set it to mode CHAR_DELETE_REMOVE + if (nameData->m_level < charDelete_minLvl) + charDelete_method = CHAR_DELETE_REMOVE; + } // convert corpse to bones if exist (to prevent exiting Corpse in World without DB entry) // bones will be deleted by corpse/bones deleting thread shortly -- 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') 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 1fbe054bd52698b557b1ba314b12602280c742aa Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 11 May 2013 11:40:12 +0200 Subject: Core/GameObjects: SMSG_DESTRUCTIBLE_BUILDING_DAMAGE needs to be sent for destructible building heals as well --- src/server/game/Entities/GameObject/GameObject.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/server/game/Entities/GameObject/GameObject.cpp b/src/server/game/Entities/GameObject/GameObject.cpp index afa7fa76abc..5510c98e2dc 100644 --- a/src/server/game/Entities/GameObject/GameObject.cpp +++ b/src/server/game/Entities/GameObject/GameObject.cpp @@ -1831,14 +1831,14 @@ void GameObject::ModifyHealth(int32 change, Unit* attackerOrHealer /*= NULL*/, u Player* player = attackerOrHealer->GetCharmerOrOwnerPlayerOrPlayerItself(); // dealing damage, send packet - /// @todo is there any packet for healing? - if (change < 0 && player) + if (player) { WorldPacket data(SMSG_DESTRUCTIBLE_BUILDING_DAMAGE, 8 + 8 + 8 + 4 + 4); data.appendPackGUID(GetGUID()); data.appendPackGUID(attackerOrHealer->GetGUID()); data.appendPackGUID(player->GetGUID()); - data << uint32(-change); + data << uint32(-change); // change < 0 triggers SPELL_BUILDING_HEAL combat log event + // change >= 0 triggers SPELL_BUILDING_DAMAGE event data << uint32(spellId); player->GetSession()->SendPacket(&data); } -- cgit v1.2.3 From e2f8abd48dbd5ef61b63b673b3093fdaf5747163 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 11 May 2013 12:16:36 +0200 Subject: Core/Spells * Removed area MiscValue check for spells with SPELL_EFFECT_BIND, it's purpose is only to be sent in packets, not determine real area player will be bound to. * Corrected guid sent in SMSG_PLAYERBOUND, it should be caster's guid, not player's * Also updated position for Teach: Death Gate Closes #9661 --- .../world/2013_05_11_00_world_spell_target_position.sql | 1 + src/server/game/Spells/SpellEffects.cpp | 6 +++--- src/server/game/Spells/SpellMgr.cpp | 12 +----------- 3 files changed, 5 insertions(+), 14 deletions(-) create mode 100644 sql/updates/world/2013_05_11_00_world_spell_target_position.sql (limited to 'src') diff --git a/sql/updates/world/2013_05_11_00_world_spell_target_position.sql b/sql/updates/world/2013_05_11_00_world_spell_target_position.sql new file mode 100644 index 00000000000..0e6b14682ae --- /dev/null +++ b/sql/updates/world/2013_05_11_00_world_spell_target_position.sql @@ -0,0 +1 @@ +UPDATE `spell_target_position` SET `target_map`=0 WHERE `id`=53821; diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 9807e7a016d..fac5a5748de 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -6085,7 +6085,7 @@ void Spell::EffectBind(SpellEffIndex effIndex) player->SetHomebind(homeLoc, areaId); // binding - WorldPacket data(SMSG_BINDPOINTUPDATE, (4+4+4+4+4)); + WorldPacket data(SMSG_BINDPOINTUPDATE, 4 + 4 + 4 + 4 + 4); data << float(homeLoc.GetPositionX()); data << float(homeLoc.GetPositionY()); data << float(homeLoc.GetPositionZ()); @@ -6097,8 +6097,8 @@ void Spell::EffectBind(SpellEffIndex effIndex) homeLoc.GetPositionX(), homeLoc.GetPositionY(), homeLoc.GetPositionZ(), homeLoc.GetMapId(), areaId); // zone update - data.Initialize(SMSG_PLAYERBOUND, 8+4); - data << uint64(player->GetGUID()); + data.Initialize(SMSG_PLAYERBOUND, 8 + 4); + data << uint64(m_caster->GetGUID()); data << uint32(areaId); player->SendDirectMessage(&data); } diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index 9aebffcf53c..ee34e26808c 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1549,21 +1549,11 @@ void SpellMgr::LoadSpellTargetPositions() { if (spellInfo->Effects[i].TargetA.GetTarget() == TARGET_DEST_DB || spellInfo->Effects[i].TargetB.GetTarget() == TARGET_DEST_DB) { - // additional requirements - if (spellInfo->Effects[i].Effect == SPELL_EFFECT_BIND && spellInfo->Effects[i].MiscValue) - { - uint32 area_id = sMapMgr->GetAreaId(st.target_mapId, st.target_X, st.target_Y, st.target_Z); - if (area_id != uint32(spellInfo->Effects[i].MiscValue)) - { - sLog->outError(LOG_FILTER_SQL, "Spell (Id: %u) listed in `spell_target_position` expected to point to area %u, but points to area %u instead.", Spell_ID, spellInfo->Effects[i].MiscValue, area_id); - break; - } - } - found = true; break; } } + if (!found) { sLog->outError(LOG_FILTER_SQL, "Spell (Id: %u) listed in `spell_target_position` does not have target TARGET_DEST_DB (17).", Spell_ID); -- cgit v1.2.3 From 78195b3c54a32866f96efb02457fe8161460b692 Mon Sep 17 00:00:00 2001 From: Vlad Date: Mon, 13 May 2013 11:30:48 +0300 Subject: Allow use effectIndex in spell_target_position. --- .../2013_05_13_00_world_spell_target_position.sql | 5 +++ src/server/game/Spells/Spell.cpp | 2 +- src/server/game/Spells/SpellMgr.cpp | 44 ++++++++++------------ src/server/game/Spells/SpellMgr.h | 6 +-- 4 files changed, 28 insertions(+), 29 deletions(-) create mode 100644 sql/updates/world/2013_05_13_00_world_spell_target_position.sql (limited to 'src') diff --git a/sql/updates/world/2013_05_13_00_world_spell_target_position.sql b/sql/updates/world/2013_05_13_00_world_spell_target_position.sql new file mode 100644 index 00000000000..c4ef5521094 --- /dev/null +++ b/sql/updates/world/2013_05_13_00_world_spell_target_position.sql @@ -0,0 +1,5 @@ +ALTER TABLE `spell_target_position` ADD COLUMN `effIndex` tinyint(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `id`; +ALTER TABLE `spell_target_position` DROP INDEX `PRIMARY`, ADD PRIMARY KEY (`id`, `effIndex`); + +UPDATE `spell_target_position` SET `effIndex`='1' WHERE `id` IN (53821, 68081, 46473, 73655, 72546, 72340, 67838, 67835, 67836, 67837, 67834, 49098, 49097, 54963, 11012, 8606); +UPDATE `spell_target_position` SET `effIndex`='2' WHERE `id` IN (36801, 71765, 71763, 71762, 71744, 71712, 71751, 43209, 51852); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 0c6d70add0b..63ec9d032ff 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1391,7 +1391,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici m_targets.SetDst(playerCaster->m_homebindX, playerCaster->m_homebindY, playerCaster->m_homebindZ, playerCaster->GetOrientation(), playerCaster->m_homebindMapId); return; case TARGET_DEST_DB: - if (SpellTargetPosition const* st = sSpellMgr->GetSpellTargetPosition(m_spellInfo->Id)) + if (SpellTargetPosition const* st = sSpellMgr->GetSpellTargetPosition(m_spellInfo->Id, effIndex)) { /// @todo fix this check if (m_spellInfo->HasEffect(SPELL_EFFECT_TELEPORT_UNITS) || m_spellInfo->HasEffect(SPELL_EFFECT_BIND)) diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index ee34e26808c..8f2e05bde53 100644 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -620,9 +620,9 @@ bool SpellMgr::IsSpellLearnToSpell(uint32 spell_id1, uint32 spell_id2) const return false; } -SpellTargetPosition const* SpellMgr::GetSpellTargetPosition(uint32 spell_id) const +SpellTargetPosition const* SpellMgr::GetSpellTargetPosition(uint32 spell_id, SpellEffIndex effIndex) const { - SpellTargetPositionMap::const_iterator itr = mSpellTargetPositions.find(spell_id); + SpellTargetPositionMap::const_iterator itr = mSpellTargetPositions.find(std::make_pair(spell_id, effIndex)); if (itr != mSpellTargetPositions.end()) return &itr->second; return NULL; @@ -1501,8 +1501,8 @@ void SpellMgr::LoadSpellTargetPositions() mSpellTargetPositions.clear(); // need for reload case - // 0 1 2 3 4 5 - QueryResult result = WorldDatabase.Query("SELECT id, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position"); + // 0 1 2 3 4 5 6 + QueryResult result = WorldDatabase.Query("SELECT id, effIndex, target_map, target_position_x, target_position_y, target_position_z, target_orientation FROM spell_target_position"); if (!result) { sLog->outInfo(LOG_FILTER_SERVER_LOADING, ">> Loaded 0 spell target coordinates. DB table `spell_target_position` is empty."); @@ -1515,54 +1515,48 @@ void SpellMgr::LoadSpellTargetPositions() Field* fields = result->Fetch(); uint32 Spell_ID = fields[0].GetUInt32(); + SpellEffIndex effIndex = SpellEffIndex(fields[1].GetUInt8()); SpellTargetPosition st; - st.target_mapId = fields[1].GetUInt16(); - st.target_X = fields[2].GetFloat(); - st.target_Y = fields[3].GetFloat(); - st.target_Z = fields[4].GetFloat(); - st.target_Orientation = fields[5].GetFloat(); + st.target_mapId = fields[2].GetUInt16(); + st.target_X = fields[3].GetFloat(); + st.target_Y = fields[4].GetFloat(); + st.target_Z = fields[5].GetFloat(); + st.target_Orientation = fields[6].GetFloat(); MapEntry const* mapEntry = sMapStore.LookupEntry(st.target_mapId); if (!mapEntry) { - sLog->outError(LOG_FILTER_SQL, "Spell (ID:%u) target map (ID: %u) does not exist in `Map.dbc`.", Spell_ID, st.target_mapId); + sLog->outError(LOG_FILTER_SQL, "Spell (Id: %u, effIndex: %u) target map (ID: %u) does not exist in `Map.dbc`.", Spell_ID, effIndex, st.target_mapId); continue; } if (st.target_X==0 && st.target_Y==0 && st.target_Z==0) { - sLog->outError(LOG_FILTER_SQL, "Spell (ID:%u) target coordinates not provided.", Spell_ID); + sLog->outError(LOG_FILTER_SQL, "Spell (Id: %u, effIndex: %u) target coordinates not provided.", Spell_ID, effIndex); continue; } SpellInfo const* spellInfo = GetSpellInfo(Spell_ID); if (!spellInfo) { - sLog->outError(LOG_FILTER_SQL, "Spell (Id: %u) listed in `spell_target_position` does not exist.", Spell_ID); + sLog->outError(LOG_FILTER_SQL, "Spell (ID:%u) listed in `spell_target_position` does not exist.", Spell_ID); continue; } - bool found = false; - for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) + if (spellInfo->Effects[effIndex].TargetA.GetTarget() == TARGET_DEST_DB || spellInfo->Effects[effIndex].TargetB.GetTarget() == TARGET_DEST_DB) { - if (spellInfo->Effects[i].TargetA.GetTarget() == TARGET_DEST_DB || spellInfo->Effects[i].TargetB.GetTarget() == TARGET_DEST_DB) - { - found = true; - break; - } + std::pair key = std::make_pair(Spell_ID, effIndex); + mSpellTargetPositions[key] = st; + ++count; } - - if (!found) + else { - sLog->outError(LOG_FILTER_SQL, "Spell (Id: %u) listed in `spell_target_position` does not have target TARGET_DEST_DB (17).", Spell_ID); + sLog->outError(LOG_FILTER_SQL, "Spell (Id: %u, effIndex: %u) listed in `spell_target_position` does not have target TARGET_DEST_DB (17).", Spell_ID, effIndex); continue; } - mSpellTargetPositions[Spell_ID] = st; - ++count; - } while (result->NextRow()); /* diff --git a/src/server/game/Spells/SpellMgr.h b/src/server/game/Spells/SpellMgr.h index c1b64e76a41..b7a3294efe3 100644 --- a/src/server/game/Spells/SpellMgr.h +++ b/src/server/game/Spells/SpellMgr.h @@ -377,6 +377,8 @@ struct SpellTargetPosition float target_Orientation; }; +typedef std::map, SpellTargetPosition> SpellTargetPositionMap; + // Enum with EffectRadiusIndex and their actual radius enum EffectRadiusIndex { @@ -439,8 +441,6 @@ enum EffectRadiusIndex EFFECT_RADIUS_80_YARDS_2 = 65 }; -typedef UNORDERED_MAP SpellTargetPositionMap; - // Spell pet auras class PetAura { @@ -641,7 +641,7 @@ class SpellMgr bool IsSpellLearnToSpell(uint32 spell_id1, uint32 spell_id2) const; // Spell target coordinates - SpellTargetPosition const* GetSpellTargetPosition(uint32 spell_id) const; + SpellTargetPosition const* GetSpellTargetPosition(uint32 spell_id, SpellEffIndex effIndex) const; // Spell Groups table SpellSpellGroupMapBounds GetSpellSpellGroupMapBounds(uint32 spell_id) const; -- 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') 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