From 786fa591635ab834de54078bdabeb038d2c16047 Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Sat, 7 Mar 2009 08:40:47 +0100 Subject: *Change the character's voice on modify gender - by Machiavelli --HG-- branch : trunk --- src/game/Level3.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp index 533f0707b47..20c4396eee8 100644 --- a/src/game/Level3.cpp +++ b/src/game/Level3.cpp @@ -7146,6 +7146,7 @@ bool ChatHandler::HandleModifyGenderCommand(const char *args) // Set gender player->SetByteValue(UNIT_FIELD_BYTES_0, 2, gender); + player->SetByteValue(PLAYER_BYTES_3, 0, gender); // Change display ID player->SetDisplayId(new_displayId); -- cgit v1.2.3 From 1013a80da304c5869e7f0c1543f58c921077683f Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Sat, 7 Mar 2009 08:41:31 +0100 Subject: *Send directly the battleground marks instead of spells - by balrok --HG-- branch : trunk --- src/game/BattleGround.cpp | 33 ++++++++++----------------------- src/game/BattleGround.h | 9 +++------ src/game/SpellEffects.cpp | 28 +--------------------------- 3 files changed, 14 insertions(+), 56 deletions(-) (limited to 'src') diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp index 944e19bed1c..c90911f1b58 100644 --- a/src/game/BattleGround.cpp +++ b/src/game/BattleGround.cpp @@ -621,42 +621,29 @@ void BattleGround::RewardMark(Player *plr,uint32 count) if(plr->GetDummyAura(SPELL_AURA_PLAYER_INACTIVE)) return; - BattleGroundMarks mark; - bool IsSpell; + if(!plr || !count) + return; + + BattleGroundMarks mark; switch(GetTypeID()) { case BATTLEGROUND_AV: - IsSpell = true; - if(count == ITEM_WINNER_COUNT) - mark = SPELL_AV_MARK_WINNER; - else - mark = SPELL_AV_MARK_LOSER; + mark = ITEM_AV_MARK_OF_HONOR; break; case BATTLEGROUND_WS: - IsSpell = true; - if(count == ITEM_WINNER_COUNT) - mark = SPELL_WS_MARK_WINNER; - else - mark = SPELL_WS_MARK_LOSER; + mark = ITEM_WS_MARK_OF_HONOR; break; case BATTLEGROUND_AB: - IsSpell = true; - if(count == ITEM_WINNER_COUNT) - mark = SPELL_AB_MARK_WINNER; - else - mark = SPELL_AB_MARK_LOSER; + mark = ITEM_AB_MARK_OF_HONOR; break; - case BATTLEGROUND_EY: - IsSpell = false; + case BATTLEGROUND_EY: mark = ITEM_EY_MARK_OF_HONOR; break; default: return; } - if(IsSpell) - plr->CastSpell(plr, mark, true); - else if ( objmgr.GetItemPrototype( mark ) ) + if ( objmgr.GetItemPrototype( mark ) ) { ItemPosCountVec dest; uint32 no_space_count = 0; @@ -664,7 +651,7 @@ void BattleGround::RewardMark(Player *plr,uint32 count) if( msg != EQUIP_ERR_OK ) // convert to possible store amount count -= no_space_count; - if( count != 0 && !dest.empty()) // can add some + if(!dest.empty()) // can add some if(Item* item = plr->StoreNewItem( dest, mark, true, 0)) plr->SendNewItem(item,count,false,true); diff --git a/src/game/BattleGround.h b/src/game/BattleGround.h index 41f7e37d235..411bbaf6211 100644 --- a/src/game/BattleGround.h +++ b/src/game/BattleGround.h @@ -50,12 +50,9 @@ enum BattleGroundQuests enum BattleGroundMarks { - SPELL_WS_MARK_LOSER = 24950, - SPELL_WS_MARK_WINNER = 24951, - SPELL_AB_MARK_LOSER = 24952, - SPELL_AB_MARK_WINNER = 24953, - SPELL_AV_MARK_LOSER = 24954, - SPELL_AV_MARK_WINNER = 24955, + ITEM_AV_MARK_OF_HONOR = 20560, + ITEM_WS_MARK_OF_HONOR = 20558, + ITEM_AB_MARK_OF_HONOR = 20559, ITEM_EY_MARK_OF_HONOR = 29024 }; diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 64b7811d462..a985e1c9fb1 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -2627,33 +2627,7 @@ void Spell::DoCreateItem(uint32 i, uint32 itemtype) // we succeeded in creating at least one item, so a levelup is possible player->UpdateCraftSkill(m_spellInfo->Id); - } - - // for battleground marks send by mail if not add all expected - if(no_space > 0 ) - { - BattleGroundTypeId bgType; - switch(m_spellInfo->Id) - { - case SPELL_AV_MARK_WINNER: - case SPELL_AV_MARK_LOSER: - bgType = BATTLEGROUND_AV; - break; - case SPELL_WS_MARK_WINNER: - case SPELL_WS_MARK_LOSER: - bgType = BATTLEGROUND_WS; - break; - case SPELL_AB_MARK_WINNER: - case SPELL_AB_MARK_LOSER: - bgType = BATTLEGROUND_AB; - break; - default: - return; - } - - if(BattleGround* bg = sBattleGroundMgr.GetBattleGroundTemplate(bgType)) - bg->SendRewardMarkByMail(player,newitemid,no_space); - } + } } void Spell::EffectCreateItem(uint32 i) -- cgit v1.2.3 From 7123bef9758a92e0a2380040a6ad2eaaf5de670e Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Sat, 7 Mar 2009 08:58:21 +0100 Subject: *Prevent multiple summoning of Nightbane - by Klaimmore --HG-- branch : trunk --- .../scripts/zone/karazhan/boss_nightbane.cpp | 3 +-- .../scripts/zone/karazhan/instance_karazhan.cpp | 26 +++++----------------- 2 files changed, 7 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/bindings/scripts/scripts/zone/karazhan/boss_nightbane.cpp b/src/bindings/scripts/scripts/zone/karazhan/boss_nightbane.cpp index 8ed47127e16..f2c683ac4bf 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/boss_nightbane.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/boss_nightbane.cpp @@ -114,8 +114,7 @@ struct TRINITY_DLL_DECL boss_nightbaneAI : public ScriptedAI m_creature->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE); m_creature->setActive(true); - pInstance->SetData(DATA_NIGHTBANE_EVENT, 6); - if(pInstance->GetData(DATA_NIGHTBANE_EVENT) > 1) + if(pInstance->GetData(DATA_NIGHTBANE_EVENT) == DONE || pInstance->GetData(DATA_NIGHTBANE_EVENT) == IN_PROGRESS) { m_creature->DealDamage(m_creature, m_creature->GetMaxHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false); m_creature->RemoveCorpse(); diff --git a/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp b/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp index f274e81b5c4..c43d5f69590 100644 --- a/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp +++ b/src/bindings/scripts/scripts/zone/karazhan/instance_karazhan.cpp @@ -64,9 +64,6 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance uint64 MastersTerraceDoor[2]; uint64 ImageGUID; - uint8 Nightbane; - bool CheckNightbane; - void Initialize() { for (uint8 i = 0; i < ENCOUNTERS; ++i) @@ -91,10 +88,6 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance MastersTerraceDoor[0]= 0; MastersTerraceDoor[1]= 0; ImageGUID = 0; - - Nightbane = 0; - - CheckNightbane = false; } bool IsEncounterInProgress() const @@ -121,12 +114,7 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance case DATA_NETHERSPITE_EVENT: return Encounters[8]; case DATA_CHESS_EVENT: return Encounters[9]; case DATA_MALCHEZZAR_EVENT: return Encounters[10]; - case DATA_NIGHTBANE_EVENT: - if(CheckNightbane) - { - CheckNightbane = false; - return Nightbane; - }else return Encounters[11]; + case DATA_NIGHTBANE_EVENT: return Encounters[11]; case DATA_OPERA_PERFORMANCE: return OperaEvent; case DATA_OPERA_OZ_DEATHCOUNT: return OzDeathCount; case DATA_IMAGE_OF_MEDIVH: return ImageGUID; @@ -187,11 +175,9 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance case DATA_CHESS_EVENT: Encounters[9] = data; break; case DATA_MALCHEZZAR_EVENT: Encounters[10] = data; break; case DATA_NIGHTBANE_EVENT: - if(data == 6) - { - Nightbane; - CheckNightbane = true; - }else Encounters[11] = data; + if (Encounters[11] == DONE) + break; + Encounters[11] = data; break; case DATA_OPERA_OZ_DEATHCOUNT: ++OzDeathCount; break; } @@ -244,7 +230,7 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance std::ostringstream stream; stream << Encounters[0] << " " << Encounters[1] << " " << Encounters[2] << " " << Encounters[3] << " " << Encounters[4] << " " << Encounters[5] << " " << Encounters[6] << " " << Encounters[7] << " " - << Encounters[8] << " " << Encounters[9] << " " << Encounters[10]; + << Encounters[8] << " " << Encounters[9] << " " << Encounters[10] << " " << Encounters[11]; char* out = new char[stream.str().length() + 1]; strcpy(out, stream.str().c_str()); if(out) @@ -268,7 +254,7 @@ struct TRINITY_DLL_DECL instance_karazhan : public ScriptedInstance std::istringstream stream(in); stream >> Encounters[0] >> Encounters[1] >> Encounters[2] >> Encounters[3] >> Encounters[4] >> Encounters[5] >> Encounters[6] >> Encounters[7] - >> Encounters[8] >> Encounters[9] >> Encounters[10]; + >> Encounters[8] >> Encounters[9] >> Encounters[10] >> Encounters[11]; for(uint8 i = 0; i < ENCOUNTERS; ++i) if(Encounters[i] == IN_PROGRESS) // Do not load an encounter as "In Progress" - reset it instead. Encounters[i] = NOT_STARTED; -- cgit v1.2.3 From 892e54c79cfe4282818701561fbdd118232c85de Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Sat, 7 Mar 2009 09:04:27 +0100 Subject: *Fix a typo - by Anubisss --HG-- branch : trunk --- .../zone/tempest_keep/the_mechanar/boss_nethermancer_sepethrea.cpp | 6 +++--- .../scripts/zone/tempest_keep/the_mechanar/instance_mechanar.cpp | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_nethermancer_sepethrea.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_nethermancer_sepethrea.cpp index 93b653a344c..4fecea70363 100644 --- a/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_nethermancer_sepethrea.cpp +++ b/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/boss_nethermancer_sepethrea.cpp @@ -201,9 +201,6 @@ struct TRINITY_DLL_DECL mob_ragin_flamesAI : public ScriptedAI void UpdateAI(const uint32 diff) { - if (!UpdateVictim()) - return; - //Check_Timer if(Check_Timer < diff) { @@ -219,6 +216,9 @@ struct TRINITY_DLL_DECL mob_ragin_flamesAI : public ScriptedAI Check_Timer = 1000; }else Check_Timer -= diff; + if (!UpdateVictim()) + return; + if (!onlyonce) { if (Unit* target = SelectUnit(SELECT_TARGET_RANDOM,0)) diff --git a/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/instance_mechanar.cpp b/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/instance_mechanar.cpp index d2c62b89234..05866eb27fb 100644 --- a/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/instance_mechanar.cpp +++ b/src/bindings/scripts/scripts/zone/tempest_keep/the_mechanar/instance_mechanar.cpp @@ -46,7 +46,8 @@ struct TRINITY_DLL_DECL instance_mechanar : public ScriptedInstance bool IsEncounterInProgress() const { for(uint8 i = 0; i < ENCOUNTERS; ++i) - if(Encounters[i]) return true; + if(Encounters[i] == IN_PROGRESS) + return true; return false; } -- cgit v1.2.3 From ae7078784366172e27d2fe0ac4b18345b628fd3f Mon Sep 17 00:00:00 2001 From: KingPin Date: Sat, 7 Mar 2009 07:47:02 -0500 Subject: Extend the spell_disabled table to have a seperate flag for pet spells from player spells, Patch by Koani --HG-- branch : trunk --- src/game/ObjectMgr.cpp | 3 +++ src/game/ObjectMgr.h | 2 ++ src/game/Spell.cpp | 11 ++++++++++- src/game/SpellMgr.h | 3 ++- 4 files changed, 17 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index a08c22450db..7da8e89b26b 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -6289,6 +6289,7 @@ void ObjectMgr::LoadSpellDisabledEntrys() { m_DisabledPlayerSpells.clear(); // need for reload case m_DisabledCreatureSpells.clear(); + m_DisabledPetSpells.clear(); QueryResult *result = WorldDatabase.Query("SELECT entry, disable_mask FROM spell_disabled"); uint32 total_count = 0; @@ -6321,6 +6322,8 @@ void ObjectMgr::LoadSpellDisabledEntrys() m_DisabledPlayerSpells.insert(spellid); if(disable_mask & SPELL_DISABLE_CREATURE) m_DisabledCreatureSpells.insert(spellid); + if(disable_mask & SPELL_DISABLE_PET) + m_DisabledPetSpells.insert(spellid); ++total_count; } while ( result->NextRow() ); diff --git a/src/game/ObjectMgr.h b/src/game/ObjectMgr.h index 72497170b3a..5489bf7e42f 100644 --- a/src/game/ObjectMgr.h +++ b/src/game/ObjectMgr.h @@ -712,6 +712,7 @@ class ObjectMgr void LoadSpellDisabledEntrys(); bool IsPlayerSpellDisabled(uint32 spellid) { return (m_DisabledPlayerSpells.count(spellid) != 0); } bool IsCreatureSpellDisabled(uint32 spellid) { return (m_DisabledCreatureSpells.count(spellid) != 0); } + bool IsPetSpellDisabled(uint32 spellid) { return (m_DisabledPetSpells.count(spellid) != 0); } int GetIndexForLocale(LocaleConstant loc); LocaleConstant GetLocaleForIndex(int i); @@ -831,6 +832,7 @@ class ObjectMgr std::set m_DisabledPlayerSpells; std::set m_DisabledCreatureSpells; + std::set m_DisabledPetSpells; GraveYardMap mGraveYardMap; diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 707f1819968..15cee611db0 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2048,7 +2048,7 @@ void Spell::prepare(SpellCastTargets * targets, Aura* triggeredByAura) return; } - if(m_caster->GetTypeId() == TYPEID_PLAYER || (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->isPet())) + if(m_caster->GetTypeId() == TYPEID_PLAYER) { if(objmgr.IsPlayerSpellDisabled(m_spellInfo->Id)) { @@ -2057,6 +2057,15 @@ void Spell::prepare(SpellCastTargets * targets, Aura* triggeredByAura) return; } } + else if (m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->isPet()) + { + if(objmgr.IsPetSpellDisabled(m_spellInfo->Id)) + { + SendCastResult(SPELL_FAILED_SPELL_UNAVAILABLE); + finish(false); + return; + } + } else { if(objmgr.IsCreatureSpellDisabled(m_spellInfo->Id)) diff --git a/src/game/SpellMgr.h b/src/game/SpellMgr.h index 4ac0871e853..35d867dce2b 100644 --- a/src/game/SpellMgr.h +++ b/src/game/SpellMgr.h @@ -230,7 +230,8 @@ enum SpellFamilyNames enum SpellDisableTypes { SPELL_DISABLE_PLAYER = 1, - SPELL_DISABLE_CREATURE = 2 + SPELL_DISABLE_CREATURE = 2, + SPELL_DISABLE_PET = 4 }; enum SpellEffectTargetTypes -- cgit v1.2.3 From 658568a8e2eb749ea974b45e09b7e2775d6e0c69 Mon Sep 17 00:00:00 2001 From: megamage Date: Sat, 7 Mar 2009 17:17:01 -0600 Subject: *Fix a crash when statues are killed. --HG-- branch : trunk --- src/game/Spell.cpp | 12 +++++++++--- src/game/Unit.cpp | 10 +++++----- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 707f1819968..442df24239a 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -2116,8 +2116,11 @@ void Spell::cancel() if(m_spellState == SPELL_STATE_FINISHED) return; + uint32 oldState = m_spellState; + m_spellState = SPELL_STATE_FINISHED; + m_autoRepeat = false; - switch (m_spellState) + switch (oldState) { case SPELL_STATE_PREPARING: case SPELL_STATE_DELAYED: @@ -2149,10 +2152,13 @@ void Spell::cancel() } break; } - finish(false); - m_caster->RemoveDynObject(m_spellInfo->Id); m_caster->RemoveGameObject(m_spellInfo->Id,true); + + //set state back so finish will be processed + m_spellState = oldState; + + finish(false); } void Spell::cast(bool skipCheck) diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 7bdb3b28d27..6c75903072f 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -4706,13 +4706,10 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) if(!caster) // can be already located for IsSingleTargetSpell case caster = Aur->GetCaster(); - if(caster) + if(caster && caster->isAlive()) { - if(caster->GetTypeId()==TYPEID_UNIT && ((Creature*)caster)->isTotem() && ((Totem*)caster)->GetTotemType()==TOTEM_STATUE) - statue = ((Totem*)caster); - // stop caster chanelling state - else if(caster->m_currentSpells[CURRENT_CHANNELED_SPELL] + if(caster->m_currentSpells[CURRENT_CHANNELED_SPELL] //prevent recurential call && caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED) { @@ -4727,6 +4724,9 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode) caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel(); } } + + if(caster->GetTypeId()==TYPEID_UNIT && ((Creature*)caster)->isTotem() && ((Totem*)caster)->GetTotemType()==TOTEM_STATUE) + statue = ((Totem*)caster); } // Unsummon summon as possessed creatures on spell cancel -- cgit v1.2.3 From 9720fb075f7e8d86d5d6a55ba0938e0c72a53cd5 Mon Sep 17 00:00:00 2001 From: Blaymoira Date: Sun, 8 Mar 2009 09:36:32 +0100 Subject: *Added dinamic spell immunities for two scripts --HG-- branch : trunk --- sql/updates/1160_world.sql | 4 ++-- src/bindings/scripts/scripts/zone/black_temple/boss_bloodboil.cpp | 7 +++++++ src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp | 7 +++++++ 3 files changed, 16 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/sql/updates/1160_world.sql b/sql/updates/1160_world.sql index bf959443065..5c77aebdf41 100644 --- a/sql/updates/1160_world.sql +++ b/sql/updates/1160_world.sql @@ -62,7 +62,7 @@ INSERT INTO `access_requirement` VALUES ('26','60','0','0','0','0','0','0',NULL,'0',NULL,'instance Temple of Ahn\'Qiraj (531)'), ('27','68','0','0'/*'24490'*/,'0','0','0','0',NULL,'0',NULL,'instance Karazhan (532)'), ('28','60','0','0','0','0','0','0',NULL,'0',NULL,'instance Naxxramas (533)'), -('29','70','0','0','0','0','0','10445',NULL,'0',NULL,'instance Hyjal Summit (534)'), +('29','70','0','0','0','0','0','0',NULL,'0',NULL,'instance Hyjal Summit (534)'), ('30','55','0','0'/*'28395'*/,'0','30637','30622','0',NULL,'0',NULL,'instance The Shattered Halls (540)'), ('31','55','0','0','0','30637','30622','0',NULL,'0',NULL,'instance The Blood Furnace (542)'), ('32','55','0','0','0','30637','30622','0',NULL,'0',NULL,'instance Hellfire Ramparts (543)'), @@ -80,7 +80,7 @@ INSERT INTO `access_requirement` VALUES ('44','55','0','0','0','30633','0','0',NULL,'0',NULL,'instance Mana-Tombs (557)'), ('45','55','0','0','0','30633','0','0',NULL,'0',NULL,'instance Auchenai Crypts (558)'), ('46','66','0','0','0','30635','0','0',NULL,'0',NULL,'instance Old Hillsbrad Foothills (560)'), -('47','70','0','32649','0','0','0','0',NULL,'0',NULL,'instance Black Temple (564)'), +('47','70','0','0','0','0','0','0',NULL,'0',NULL,'instance Black Temple (564)'), ('48','65','0','0','0','0','0','0',NULL,'0',NULL,'instance Gruul\'s Lair (565)'), ('49','70','0','0','0','0','0','0',NULL,'0',NULL,'instance Zul\'Aman (568)'), ('50','70','0','0','0','0','0','0',NULL,'0',NULL,'instance Sunwell Plateau (580)'), diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_bloodboil.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_bloodboil.cpp index 16fff2fac02..3abde8c307f 100644 --- a/src/bindings/scripts/scripts/zone/black_temple/boss_bloodboil.cpp +++ b/src/bindings/scripts/scripts/zone/black_temple/boss_bloodboil.cpp @@ -111,6 +111,9 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI PhaseChangeTimer = 60000; Phase1 = true; + + m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); + m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, false); } void Aggro(Unit *who) @@ -292,6 +295,8 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI if(DoGetThreat(target)) DoModifyThreatPercent(target, -100); m_creature->AddThreat(target, 50000000.0f); + m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); + m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); // If VMaps are disabled, this spell can call the whole instance DoCast(m_creature, SPELL_INSIGNIFIGANCE, true); DoCast(target, SPELL_FEL_RAGE_TARGET, true); @@ -325,6 +330,8 @@ struct TRINITY_DLL_DECL boss_gurtogg_bloodboilAI : public ScriptedAI FelAcidTimer += 2000; EjectTimer += 2000; PhaseChangeTimer = 60000; + m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); + m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, false); } }else PhaseChangeTimer -= diff; diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp index ac6d1091c60..3ae719effaf 100644 --- a/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp +++ b/src/bindings/scripts/scripts/zone/black_temple/boss_supremus.cpp @@ -91,6 +91,9 @@ struct TRINITY_DLL_DECL boss_supremusAI : public ScriptedAI Phase1 = true; summons.DespawnAll(); + + m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); + m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, false); } void Aggro(Unit *who) @@ -212,6 +215,8 @@ struct TRINITY_DLL_DECL boss_supremusAI : public ScriptedAI PhaseSwitchTimer = 60000; m_creature->SetSpeed(MOVE_RUN, 1.2f); DoZoneInCombat(); + m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, false); + m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, false); } else { @@ -222,6 +227,8 @@ struct TRINITY_DLL_DECL boss_supremusAI : public ScriptedAI PhaseSwitchTimer = 60000; m_creature->SetSpeed(MOVE_RUN, 0.9f); DoZoneInCombat(); + m_creature->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_TAUNT, true); + m_creature->ApplySpellImmune(0, IMMUNITY_EFFECT,SPELL_EFFECT_ATTACK_ME, true); } }else PhaseSwitchTimer -= diff; -- cgit v1.2.3 From 0f8dee432c4eb78b466744b9e3e13266c6be19d7 Mon Sep 17 00:00:00 2001 From: megamage Date: Sun, 8 Mar 2009 11:11:21 -0600 Subject: *Update of relocation notify code. --HG-- branch : trunk --- src/game/GridNotifiers.cpp | 41 +--------------- src/game/GridNotifiers.h | 61 ++++++++++-------------- src/game/GridNotifiersImpl.h | 109 +++++++++++++++++++++++++------------------ src/game/Map.cpp | 43 +++++++++-------- src/game/Player.cpp | 45 +++++++----------- src/game/Player.h | 1 + 6 files changed, 133 insertions(+), 167 deletions(-) (limited to 'src') diff --git a/src/game/GridNotifiers.cpp b/src/game/GridNotifiers.cpp index f516035ea16..13fa66308e5 100644 --- a/src/game/GridNotifiers.cpp +++ b/src/game/GridNotifiers.cpp @@ -30,23 +30,6 @@ using namespace Trinity; -/*void -Trinity::PlayerNotifier::Visit(PlayerMapType &m) -{ - for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter) - { - if( iter->getSource() == &i_player ) - continue; - - iter->getSource()->UpdateVisibilityOf(&i_player); - i_player.UpdateVisibilityOf(iter->getSource()); - - if (!i_player.GetSharedVisionList().empty()) - for (SharedVisionList::const_iterator it = i_player.GetSharedVisionList().begin(); it != i_player.GetSharedVisionList().end(); ++it) - (*it)->UpdateVisibilityOf(iter->getSource()); - } -}*/ - void VisibleChangesNotifier::Visit(PlayerMapType &m) { @@ -60,27 +43,7 @@ VisibleChangesNotifier::Visit(PlayerMapType &m) } void -VisibleNotifier::Visit(PlayerMapType &m) -{ - for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter) - { - if( iter->getSource() == &i_player ) - continue; - - iter->getSource()->UpdateVisibilityOf(&i_player); - //i_player.UpdateVisibilityOf(iter->getSource()); - - //if (!i_player.GetSharedVisionList().empty()) - // for (SharedVisionList::const_iterator it = i_player.GetSharedVisionList().begin(); it != i_player.GetSharedVisionList().end(); ++it) - // (*it)->UpdateVisibilityOf(iter->getSource()); - - i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_data_updates,i_visibleNow); - i_clientGUIDs.erase(iter->getSource()->GetGUID()); - } -} - -void -VisibleNotifier::Notify() +PlayerRelocationNotifier::Notify() { // at this moment i_clientGUIDs have guids that not iterate at grid level checks // but exist one case when this possible and object not out of range: transports @@ -146,7 +109,7 @@ VisibleNotifier::Notify() // send data at target visibility change (adding to client) for(std::set::const_iterator vItr = i_visibleNow.begin(); vItr != i_visibleNow.end(); ++vItr) if((*vItr)!=&i_player && (*vItr)->isType(TYPEMASK_UNIT)) - i_player.SendAuraDurationsForTarget((Unit*)(*vItr)); + i_player.SendInitialVisiblePackets((Unit*)(*vItr)); } void diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index b7b0a9d4292..5d723adb3f8 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -38,16 +38,7 @@ class Player; namespace Trinity { - - /*struct TRINITY_DLL_DECL PlayerNotifier - { - explicit PlayerNotifier(Player &pl) : i_player(pl) {} - void Visit(PlayerMapType &); - template void Visit(GridRefManager &) {} - Player &i_player; - };*/ - - struct TRINITY_DLL_DECL VisibleNotifier + struct TRINITY_DLL_DECL PlayerRelocationNotifier { Player &i_player; UpdateData i_data; @@ -55,12 +46,28 @@ namespace Trinity Player::ClientGUIDs i_clientGUIDs; std::set i_visibleNow; - explicit VisibleNotifier(Player &player) : i_player(player),i_clientGUIDs(player.m_clientGUIDs) {} - template void Visit(GridRefManager &m); - void Visit(PlayerMapType &); + PlayerRelocationNotifier(Player &player) : i_player(player),i_clientGUIDs(player.m_clientGUIDs) {} + + #ifdef WIN32 + template inline void Visit(GridRefManager &); + template<> inline void Visit(PlayerMapType &); + template<> inline void Visit(CreatureMapType &); + #endif + void Notify(void); }; + struct TRINITY_DLL_DECL CreatureRelocationNotifier + { + Creature &i_creature; + CreatureRelocationNotifier(Creature &c) : i_creature(c) {} + template void Visit(GridRefManager &) {} + #ifdef WIN32 + template<> inline void Visit(PlayerMapType &); + template<> inline void Visit(CreatureMapType &); + #endif + }; + struct TRINITY_DLL_DECL VisibleChangesNotifier { WorldObject &i_object; @@ -168,25 +175,6 @@ namespace Trinity template void Visit(GridRefManager &) {} }; - struct TRINITY_DLL_DECL PlayerRelocationNotifier - { - Player &i_player; - PlayerRelocationNotifier(Player &pl) : i_player(pl) {} - template void Visit(GridRefManager &) {} - void Visit(PlayerMapType &); - void Visit(CreatureMapType &); - }; - - struct TRINITY_DLL_DECL CreatureRelocationNotifier - { - Creature &i_creature; - CreatureRelocationNotifier(Creature &c) : i_creature(c) {} - template void Visit(GridRefManager &) {} - #ifdef WIN32 - template<> void Visit(PlayerMapType &); - #endif - }; - struct TRINITY_DLL_DECL DynamicObjectUpdater { DynamicObject &i_dynobject; @@ -968,10 +956,11 @@ namespace Trinity }; #ifndef WIN32 - template<> void PlayerRelocationNotifier::Visit(CreatureMapType &); - template<> void PlayerRelocationNotifier::Visit(PlayerMapType &); - template<> void CreatureRelocationNotifier::Visit(PlayerMapType &); - template<> void CreatureRelocationNotifier::Visit(CreatureMapType &); + template inline void PlayerRelocationNotifier::Visit(GridRefManager &); + template<> inline void PlayerRelocationNotifier::Visit(CreatureMapType &); + template<> inline void PlayerRelocationNotifier::Visit(PlayerMapType &); + template<> inline void CreatureRelocationNotifier::Visit(PlayerMapType &); + template<> inline void CreatureRelocationNotifier::Visit(CreatureMapType &); template<> inline void DynamicObjectUpdater::Visit(CreatureMapType &); template<> inline void DynamicObjectUpdater::Visit(PlayerMapType &); #endif diff --git a/src/game/GridNotifiersImpl.h b/src/game/GridNotifiersImpl.h index 2a8b41f4fc8..1f641ce9226 100644 --- a/src/game/GridNotifiersImpl.h +++ b/src/game/GridNotifiersImpl.h @@ -29,17 +29,6 @@ #include "CreatureAI.h" #include "SpellAuras.h" -template -inline void -Trinity::VisibleNotifier::Visit(GridRefManager &m) -{ - for(typename GridRefManager::iterator iter = m.begin(); iter != m.end(); ++iter) - { - i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_data_updates,i_visibleNow); - i_clientGUIDs.erase(iter->getSource()->GetGUID()); - } -} - inline void Trinity::ObjectUpdater::Visit(CreatureMapType &m) { @@ -48,28 +37,10 @@ Trinity::ObjectUpdater::Visit(CreatureMapType &m) iter->getSource()->Update(i_timeDiff); } -inline void -Trinity::PlayerRelocationNotifier::Visit(PlayerMapType &m) -{ - for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter) - { - if(&i_player==iter->getSource()) - continue; - - // visibility for players updated by ObjectAccessor::UpdateVisibilityFor calls in appropriate places - - // Cancel Trade - if(i_player.GetTrader()==iter->getSource()) - // iteraction distance - if(!i_player.IsWithinDistInMap(iter->getSource(), 5)) - i_player.GetSession()->SendCancelTrade(); // will clode both side trade windows - } -} - inline void PlayerCreatureRelocationWorker(Player* pl, Creature* c) { - // update creature visibility at player/creature move - pl->UpdateVisibilityOf(c); + if(!pl->isAlive() || !c->isAlive() || pl->isInFlight()) + return; // Creature AI reaction if(c->HasReactState(REACT_AGGRESSIVE) && !c->hasUnitState(UNIT_STAT_SIGHTLESS)) @@ -94,27 +65,71 @@ inline void CreatureCreatureRelocationWorker(Creature* c1, Creature* c2) } } +template +inline void +Trinity::PlayerRelocationNotifier::Visit(GridRefManager &m) +{ + for(typename GridRefManager::iterator iter = m.begin(); iter != m.end(); ++iter) + { + i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_data_updates,i_visibleNow); + i_clientGUIDs.erase(iter->getSource()->GetGUID()); + } +} + +template<> +inline void +Trinity::PlayerRelocationNotifier::Visit(PlayerMapType &m) +{ + for(PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter) + { + if(iter->getSource()->m_Notified) //self is also skipped in this check + continue; + + i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_data_updates,i_visibleNow); + i_clientGUIDs.erase(iter->getSource()->GetGUID()); + + iter->getSource()->UpdateVisibilityOf(&i_player); + + //if (!i_player.GetSharedVisionList().empty()) + // for (SharedVisionList::const_iterator it = i_player.GetSharedVisionList().begin(); it != i_player.GetSharedVisionList().end(); ++it) + // (*it)->UpdateVisibilityOf(iter->getSource()); + + // Cancel Trade + if(i_player.GetTrader()==iter->getSource()) + if(!i_player.IsWithinDistInMap(iter->getSource(), 5)) // iteraction distance + i_player.GetSession()->SendCancelTrade(); // will clode both side trade windows + } +} + +template<> inline void Trinity::PlayerRelocationNotifier::Visit(CreatureMapType &m) { - if(!i_player.isAlive() || i_player.isInFlight()) - return; + for(CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) + { + if(iter->getSource()->m_Notified) + continue; - for(CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter) - if( !iter->getSource()->m_Notified && iter->getSource()->isAlive()) - PlayerCreatureRelocationWorker(&i_player,iter->getSource()); + i_player.UpdateVisibilityOf(iter->getSource(),i_data,i_data_updates,i_visibleNow); + i_clientGUIDs.erase(iter->getSource()->GetGUID()); + + PlayerCreatureRelocationWorker(&i_player, iter->getSource()); + } } template<> inline void Trinity::CreatureRelocationNotifier::Visit(PlayerMapType &m) { - if(!i_creature.isAlive()) - return; + for(PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter) + { + if(iter->getSource()->m_Notified) + continue; - for(PlayerMapType::iterator iter=m.begin(); iter != m.end(); ++iter) - if( !iter->getSource()->m_Notified && iter->getSource()->isAlive() && !iter->getSource()->isInFlight()) - PlayerCreatureRelocationWorker(iter->getSource(), &i_creature); + iter->getSource()->UpdateVisibilityOf(&i_creature); + + PlayerCreatureRelocationWorker(iter->getSource(), &i_creature); + } } template<> @@ -124,11 +139,15 @@ Trinity::CreatureRelocationNotifier::Visit(CreatureMapType &m) if(!i_creature.isAlive()) return; - for(CreatureMapType::iterator iter=m.begin(); iter != m.end(); ++iter) + for(CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) { - Creature* c = iter->getSource(); - if( !iter->getSource()->m_Notified && c != &i_creature && c->isAlive()) - CreatureCreatureRelocationWorker(c, &i_creature); + if(iter->getSource()->m_Notified) + continue; + + if(!iter->getSource()->isAlive()) + continue; + + CreatureCreatureRelocationWorker(iter->getSource(), &i_creature); } } diff --git a/src/game/Map.cpp b/src/game/Map.cpp index 7a280160913..847ec49c119 100644 --- a/src/game/Map.cpp +++ b/src/game/Map.cpp @@ -624,34 +624,15 @@ void Map::RelocationNotify() if(unit->GetTypeId() == TYPEID_PLAYER) { - //UpdatePlayerVisibility((Player*)unit, cell, val); - //Trinity::PlayerNotifier pl_notifier(*player); - //VisitWorld(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), pl_notifier); - - //UpdateObjectsVisibilityFor((Player*)unit, cell, val); - Trinity::VisibleNotifier ob_notifier(*((Player*)unit)); - VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), ob_notifier); - ob_notifier.Notify(); - Trinity::PlayerRelocationNotifier notifier(*((Player*)unit)); VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), notifier); + notifier.Notify(); } else { Trinity::CreatureRelocationNotifier notifier(*((Creature*)unit)); VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), notifier); } - - // Update visibility back to player who is controlling the unit - if(unit->GetSharedVisionList().size()) - { - for(SharedVisionList::const_iterator it = unit->GetSharedVisionList().begin(); it != unit->GetSharedVisionList().end(); ++it) - { - Trinity::VisibleNotifier ob_notifier(**it); - VisitAll(unit->GetPositionX(), unit->GetPositionY(), World::GetMaxVisibleDistance(), ob_notifier); - ob_notifier.Notify(); - } - } } //Clear list @@ -768,6 +749,28 @@ void Map::Update(const uint32 &t_diff) } } } + + // Update bindsight players + if(obj->isType(TYPEMASK_UNIT)) + { + if(!((Unit*)obj)->GetSharedVisionList().empty()) + for(SharedVisionList::const_iterator it = ((Unit*)obj)->GetSharedVisionList().begin(); it != ((Unit*)obj)->GetSharedVisionList().end(); ++it) + { + Trinity::PlayerRelocationNotifier notifier(**it); + VisitAll(obj->GetPositionX(), obj->GetPositionY(), World::GetMaxVisibleDistance(), notifier); + notifier.Notify(); + } + } + else if(obj->GetTypeId() == TYPEID_DYNAMICOBJECT) + { + if(Unit *caster = ((DynamicObject*)obj)->GetCaster()) + if(caster->GetTypeId() == TYPEID_PLAYER && caster->GetUInt64Value(PLAYER_FARSIGHT) == obj->GetGUID()) + { + Trinity::PlayerRelocationNotifier notifier(*((Player*)caster)); + VisitAll(obj->GetPositionX(), obj->GetPositionY(), World::GetMaxVisibleDistance(), notifier); + notifier.Notify(); + } + } } } diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 5c9c0c978e2..6345a8d2d1f 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -16785,19 +16785,7 @@ void Player::HandleStealthedUnitsDetection() sLog.outDebug("Object %u (Type: %u) is detected in stealth by player %u. Distance = %f",(*i)->GetGUIDLow(),(*i)->GetTypeId(),GetGUIDLow(),GetDistance(*i)); #endif - // target aura duration for caster show only if target exist at caster client - // send data at target visibility change (adding to client) - if((*i)!=this && (*i)->isType(TYPEMASK_UNIT)) - { - SendAuraDurationsForTarget(*i); - //if(((Unit*)(*i))->isAlive()) //should be always alive - { - if((*i)->GetTypeId()==TYPEID_UNIT) - ((Creature*)(*i))->SendMonsterMoveWithSpeedToCurrentDestination(this); - if(((Unit*)(*i))->getVictim()) - ((Unit*)(*i))->SendAttackStart(((Unit*)(*i))->getVictim()); - } - } + SendInitialVisiblePackets(*i); } } } @@ -17781,21 +17769,24 @@ void Player::UpdateVisibilityOf(WorldObject* target) // target aura duration for caster show only if target exist at caster client // send data at target visibility change (adding to client) - if(target!=this && target->isType(TYPEMASK_UNIT)) - { - SendAuraDurationsForTarget((Unit*)target); - if(((Unit*)target)->isAlive()) - { - if(target->GetTypeId()==TYPEID_UNIT) - ((Creature*)target)->SendMonsterMoveWithSpeedToCurrentDestination(this); - if(((Unit*)target)->getVictim()) - ((Unit*)target)->SendAttackStart(((Unit*)target)->getVictim()); - } - } + if(target->isType(TYPEMASK_UNIT)) + SendInitialVisiblePackets((Unit*)target); } } } +void Player::SendInitialVisiblePackets(Unit* target) +{ + SendAuraDurationsForTarget(target); + if(target->isAlive()) + { + if(target->GetMotionMaster()->GetCurrentMovementGeneratorType() != IDLE_MOTION_TYPE) + target->SendMonsterMoveWithSpeedToCurrentDestination(this); + if(target->hasUnitState(UNIT_STAT_MELEE_ATTACKING) && target->getVictim()) + target->SendAttackStart(target->getVictim()); + } +} + template inline void UpdateVisibilityOf_helper(std::set& s64, T* target) { @@ -17842,7 +17833,7 @@ void Player::UpdateVisibilityOf(T* target, UpdateData& data, UpdateDataMapType& } } -template<> +/*template<> void Player::UpdateVisibilityOf(Creature* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow) { if(HaveAtClient(target)) @@ -17875,10 +17866,10 @@ void Player::UpdateVisibilityOf(Creature* target, UpdateData& data, Up #endif } } -} +}*/ template void Player::UpdateVisibilityOf(Player* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); -//template void Player::UpdateVisibilityOf(Creature* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); +template void Player::UpdateVisibilityOf(Creature* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); template void Player::UpdateVisibilityOf(Corpse* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); template void Player::UpdateVisibilityOf(GameObject* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); template void Player::UpdateVisibilityOf(DynamicObject* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); diff --git a/src/game/Player.h b/src/game/Player.h index d6e87a1b58c..53dcf84d5b5 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -2024,6 +2024,7 @@ class TRINITY_DLL_SPEC Player : public Unit bool IsVisibleGloballyFor(Player* pl) const; void UpdateVisibilityOf(WorldObject* target); + void SendInitialVisiblePackets(Unit* target); template void UpdateVisibilityOf(T* target, UpdateData& data, UpdateDataMapType& data_updates, std::set& visibleNow); -- cgit v1.2.3