From abbef98c3d259c2ab52eafd0ffd02918aa755c89 Mon Sep 17 00:00:00 2001 From: Spyder Date: Sat, 17 Dec 2011 10:11:42 -0600 Subject: [PATCH] Core/Miscs: Some typos. --- src/server/game/Entities/Unit/Unit.cpp | 1 - src/server/game/Grids/GridDefines.h | 18 +- .../Server/Protocol/Handlers/ChatHandler.cpp | 23 ++- .../game/Spells/Auras/SpellAuraEffects.cpp | 19 ++ src/server/game/Spells/SpellEffects.cpp | 4 +- src/server/scripts/Spells/spell_mage.cpp | 184 +----------------- 6 files changed, 46 insertions(+), 203 deletions(-) diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index d67157de..2ab8f5c4 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -9059,7 +9059,6 @@ bool Unit::HandleProcTriggerSpell(Unit *pVictim, uint32 damage, } break; // Die by the Sword - // Die by the Sword case 85386: case 86624: if (HealthBelowPct(19) || (!HealthBelowPctDamaged(20, damage))) diff --git a/src/server/game/Grids/GridDefines.h b/src/server/game/Grids/GridDefines.h index 5bb768a1..3a293c30 100644 --- a/src/server/game/Grids/GridDefines.h +++ b/src/server/game/Grids/GridDefines.h @@ -131,6 +131,7 @@ struct CoordPair { typedef CoordPair GridPair; typedef CoordPair CellPair; typedef CoordPair GridCoord; +typedef CoordPair CellCoord; namespace Trinity { template @@ -145,19 +146,20 @@ inline RET_TYPE Compute(float x, float y, float center_offset, float size) { } - inline GridCoord ComputeGridCoord(float x, float y) - { - return Compute(x, y, CENTER_GRID_OFFSET, SIZE_OF_GRIDS); - } +inline GridCoord ComputeGridCoord(float x, float y) { + return Compute(x, y, CENTER_GRID_OFFSET, SIZE_OF_GRIDS); +} + +inline CellCoord ComputeCellCoord(float x, float y) { + return Compute(x, y, CENTER_GRID_CELL_OFFSET, SIZE_OF_GRID_CELL); +} inline GridPair ComputeGridPair(float x, float y) { - return Compute(x, y, CENTER_GRID_OFFSET, - SIZE_OF_GRIDS); + return Compute(x, y, CENTER_GRID_OFFSET, SIZE_OF_GRIDS); } inline CellPair ComputeCellPair(float x, float y) { - return Compute(x, y, CENTER_GRID_CELL_OFFSET, - SIZE_OF_GRID_CELL); + return Compute(x, y, CENTER_GRID_CELL_OFFSET, SIZE_OF_GRID_CELL); } inline CellPair ComputeCellPair(float x, float y, float &x_off, float &y_off) { diff --git a/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp b/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp index 23976e86..2d29dfe4 100644 --- a/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp +++ b/src/server/game/Server/Protocol/Handlers/ChatHandler.cpp @@ -176,7 +176,8 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) { } //sLog->outDebug("CHAT: packet received. type %u, lang %u", type, lang); - + Player* sender = GetPlayer(); + // prevent talking at unknown language (cheating) LanguageDesc const* langDesc = GetLanguageDescByID(lang); if (!langDesc) { @@ -324,13 +325,15 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) { case CHAT_MSG_SAY: case CHAT_MSG_EMOTE: case CHAT_MSG_YELL: { - if (_player->getLevel() + if (GetSecurity() == SEC_PLAYER) + { + if (sender->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_SAY_LEVEL_REQ)) { SendNotification(GetArkCoreString(LANG_SAY_REQ), sWorld->getIntConfig(CONFIG_CHAT_SAY_LEVEL_REQ)); return; + } } - if (type == CHAT_MSG_SAY) GetPlayer()->Say(msg, lang); else if (type == CHAT_MSG_EMOTE) @@ -513,12 +516,14 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket & recv_data) { } break; case CHAT_MSG_CHANNEL: { - if (_player->getLevel() - < sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ)) { - SendNotification(GetArkCoreString(LANG_CHANNEL_REQ), - sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ)); - return; - } + if (GetSecurity() == SEC_PLAYER) + { + if (sender->getLevel() < sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ)) + { + SendNotification(GetArkCoreString(LANG_CHANNEL_REQ), sWorld->getIntConfig(CONFIG_CHAT_CHANNEL_LEVEL_REQ)); + return; + } + } if (ChannelMgr* cMgr = channelMgr(_player->GetTeam())) { if (Channel *chn = cMgr->GetChannel(channel, _player)) { diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 0a2eac43..56c81e01 100644 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -1071,6 +1071,25 @@ void AuraEffect::CalculateSpellMod() { default: break; } + case SPELL_AURA_MOD_SPELL_CRIT_CHANCE: + switch (GetId()) { + case 51466: // Elemental oath + case 51470: // Elemental oath + // "while Clearcasting from Elemental Focus is active, you deal 5%/10% more spell damage." + if (!m_spellmod) { + m_spellmod = new SpellModifier(GetBase()); + m_spellmod->op = SPELLMOD_EFFECT2; + m_spellmod->type = SPELLMOD_FLAT; + m_spellmod->spellId = GetId(); + m_spellmod->mask[1] = 0x0004000; + } + m_spellmod->value = GetBase()->GetUnitOwner()->CalculateSpellDamage( + GetBase()->GetUnitOwner(), GetSpellProto(), 1); + break; + default: + break; + } + break; case SPELL_AURA_ADD_FLAT_MODIFIER: case SPELL_AURA_ADD_PCT_MODIFIER: if (!m_spellmod) { diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index a19f6524..978d7080 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1868,8 +1868,8 @@ void Spell::EffectDummy(SpellEffIndex effIndex) { //Juggernaut crit bonus & Cooldown if (m_caster->HasAura(64976)) { m_caster->CastSpell(m_caster, 65156, true); - m_caster->ToPlayer()->AddSpellCooldown(20252, 0, - time(NULL) + 30); + m_caster->CastSpell(m_caster, 96216, false); + m_caster->ToPlayer()->AddSpellCooldown(20252, 0, time(NULL) + 30); } return; } diff --git a/src/server/scripts/Spells/spell_mage.cpp b/src/server/scripts/Spells/spell_mage.cpp index 0c630045..2c776c04 100644 --- a/src/server/scripts/Spells/spell_mage.cpp +++ b/src/server/scripts/Spells/spell_mage.cpp @@ -347,184 +347,6 @@ class spell_mage_summon_water_elemental : public SpellScriptLoader } }; -// npc_flame_orb -enum eFlameOrb -{ - SPELL_FLAME_ORB_DAMAGE = 86719, - FLAME_ORB_DISTANCE = 120 -}; - -class npc_flame_orb : public CreatureScript -{ -public: - npc_flame_orb() : CreatureScript("npc_flame_orb") {} - - struct npc_flame_orbAI : public ScriptedAI - { - npc_flame_orbAI(Creature *creature) : ScriptedAI(creature) - { - x = me->GetPositionX(); - y = me->GetPositionY(); - z = me->GetOwner()->GetPositionZ()+2; - o = me->GetOrientation(); - me->NearTeleportTo(x, y, z, o, true); - angle = me->GetOwner()->GetAngle(me); - newx = me->GetPositionX() + FLAME_ORB_DISTANCE/2 * cos(angle); - newy = me->GetPositionY() + FLAME_ORB_DISTANCE/2 * sin(angle); - CombatCheck = false; - } - - float x,y,z,o,newx,newy,angle; - bool CombatCheck; - uint32 DespawnTimer; - uint32 DespawnCheckTimer; - uint32 DamageTimer; - - void EnterCombat(Unit* /*target*/) - { - me->GetMotionMaster()->MoveCharge(newx, newy, z, 1.14286f); // Normal speed - DespawnTimer = 15 * IN_MILLISECONDS; - CombatCheck = true; - } - - void Reset() - { - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE|UNIT_FLAG_NON_ATTACKABLE); - me->AddUnitMovementFlag(MOVEMENTFLAG_FLYING); - me->SetReactState(REACT_PASSIVE); - if (CombatCheck == true) - DespawnTimer = 15 * IN_MILLISECONDS; - else - DespawnTimer = 4 * IN_MILLISECONDS; - DamageTimer = 1 * IN_MILLISECONDS; - me->GetMotionMaster()->MovePoint(0, newx, newy, z); - } - - void UpdateAI(const uint32 diff) - { - if (!me->isInCombat() && CombatCheck == false) - { - me->SetSpeed(MOVE_RUN, 2, true); - me->SetSpeed(MOVE_FLIGHT, 2, true); - } - - if (DespawnTimer <= diff) - { - me->SetVisible(false); - me->DisappearAndDie(); - } - else - DespawnTimer -= diff; - - if (DamageTimer <= diff) - { - if (Unit* target = me->SelectNearestTarget(20)) - DoCast(target, SPELL_FLAME_ORB_DAMAGE); - - DamageTimer = 1 * IN_MILLISECONDS; - } - else - DamageTimer -= diff; - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new npc_flame_orbAI(creature); - } -}; - -class npc_ring_of_frost : public CreatureScript -{ -public: - npc_ring_of_frost() : CreatureScript("npc_ring_of_frost") { } - - struct npc_ring_of_frostAI : public ScriptedAI - { - npc_ring_of_frostAI(Creature *creature) : ScriptedAI(creature) {} - bool Isready; - uint32 timer; - - void Reset() - { - timer = 3000; // 3sec - Isready = false; - } - - void InitializeAI() - { - ScriptedAI::InitializeAI(); - Unit* owner = me->GetOwner(); - if (!owner || owner->GetTypeId() != TYPEID_PLAYER) - return; - - me->SetReactState(REACT_PASSIVE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); - - // Remove other ring spawned by the player - std::list templist; - float x, y, z; - me->GetPosition(x, y, z); - { - CellCoord pair(Trinity::ComputeCellCoord(x, y)); - Cell cell(pair); - cell.SetNoCreate(); - - Trinity::AllFriendlyCreaturesInGrid check(me); - Trinity::CreatureListSearcher searcher(me, templist, check); - - TypeContainerVisitor, GridTypeMapContainer> cSearcher(searcher); - - cell.Visit(pair, cSearcher, *(me->GetMap()), *me, me->GetGridActivationRange()); - - if (!templist.empty()) - for (std::list::const_iterator itr = templist.begin(); itr != templist.end(); ++itr) - if((*itr)->GetEntry() == me->GetEntry() && ((*itr)->GetOwner() == me->GetOwner() && *itr != me)) - (*itr)->DisappearAndDie(); - templist.clear(); - } - } - - void EnterEvadeMode() { return; } - - void CheckIfMoveInRing(Unit* who) - { - if (who->isAlive() && me->IsInRange(who, 2.0f, 4.7f) && !who->HasAura(82691)/*<= target already frozen*/ && !Isready) - me->CastSpell(who, 82691, true); - } - - void UpdateAI(const uint32 diff) - { - if (timer <= diff) - { - if (!Isready) - { - Isready = true; - timer = 9000; // 9sec - } - else - me->DisappearAndDie(); - } - else - timer -= diff; - - // Find all the enemies - std::list targets; - Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(me, me, 5.0f); - Trinity::UnitListSearcher searcher(me, targets, u_check); - me->VisitNearbyObject(5.0f, searcher); - for (std::list::const_iterator iter = targets.begin(); iter != targets.end(); ++iter) - CheckIfMoveInRing(*iter); - } - }; - - CreatureAI* GetAI(Creature* creature) const - { - return new npc_ring_of_frostAI(creature); - } -}; - void AddSC_mage_spell_scripts() { new spell_mage_cold_snap; new spell_mage_frost_warding_trigger(); @@ -533,8 +355,4 @@ void AddSC_mage_spell_scripts() { new spell_mage_polymorph_cast_visual; //d new spell_mage_blast_wave; new spell_mage_summon_water_elemental; - new npc_flame_orb; - new npc_ring_of_frost; -} - - +} \ No newline at end of file