diff options
20 files changed, 114 insertions, 113 deletions
diff --git a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp index f99e317454c..4105012ac86 100644 --- a/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp +++ b/src/server/game/AI/SmartScripts/SmartScriptMgr.cpp @@ -62,27 +62,19 @@ void SmartWaypointMgr::LoadFromDB()          y = fields[3].GetFloat();          z = fields[4].GetFloat(); -        WayPoint* wp = new WayPoint(id, x, y, z); -          if (last_entry != entry)          { -            path = new WPPath; +            waypoint_map[entry] = new WPPath();              last_id = 1; +            count++;          }          if (last_id != id) -        {              sLog->outErrorDb("SmartWaypointMgr::LoadFromDB: Path entry %u, unexpected point id %u, expected %u.", entry, id, last_id); -        }          last_id++; -        (*path)[id] = wp; +        (*waypoint_map[entry])[id] = new WayPoint(id, x, y, z); -        if (last_entry != entry) -        { -            count++; -            waypoint_map[entry] = path; -        }          last_entry = entry;          total++;      } diff --git a/src/server/game/Battlegrounds/ArenaTeam.cpp b/src/server/game/Battlegrounds/ArenaTeam.cpp index 02707261d13..a5c34e4b7ee 100755 --- a/src/server/game/Battlegrounds/ArenaTeam.cpp +++ b/src/server/game/Battlegrounds/ArenaTeam.cpp @@ -295,8 +295,10 @@ void ArenaTeam::SetCaptain(uint64 guid)      if (newCaptain)      {          newCaptain->SetArenaTeamInfoField(GetSlot(), ARENA_TEAM_MEMBER, 0); +        char const* oldCaptainName = oldCaptain ? oldCaptain->GetName() : ""; +        uint32 oldCaptainLowGuid = oldCaptain ? oldCaptain->GetGUIDLow() : 0;          sLog->outArena("Player: %s [GUID: %u] promoted player: %s [GUID: %u] to leader of arena team [Id: %u] [Type: %u].", -                        oldCaptain->GetName(), oldCaptain->GetGUIDLow(), newCaptain->GetName(), newCaptain->GetGUIDLow(), GetId(), GetType()); +                        oldCaptainName, oldCaptainLowGuid, newCaptain->GetName(), newCaptain->GetGUIDLow(), GetId(), GetType());      }  } diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp index 801b522feab..5ea9fc67fed 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundAV.cpp @@ -1032,17 +1032,18 @@ void BattlegroundAV::EventPlayerAssaultsPoint(Player* player, uint32 object)              std::vector<uint64> ghost_list = m_ReviveQueue[BgCreatures[node]];              if (!ghost_list.empty())              { -                Player* player; -                WorldSafeLocsEntry const* ClosestGrave = NULL; +                Player* waitingPlayer;  // player waiting at graveyard for resurrection +                WorldSafeLocsEntry const* closestGrave = NULL;                  for (std::vector<uint64>::iterator itr = ghost_list.begin(); itr != ghost_list.end(); ++itr)                  { -                    player = ObjectAccessor::FindPlayer(*ghost_list.begin()); -                    if (!player) +                    waitingPlayer = ObjectAccessor::FindPlayer(*ghost_list.begin()); +                    if (!waitingPlayer)                          continue; -                    if (!ClosestGrave) -                        ClosestGrave = GetClosestGraveYard(player); + +                    if (!closestGrave) +                        closestGrave = GetClosestGraveYard(waitingPlayer);                      else -                        player->TeleportTo(GetMapId(), ClosestGrave->x, ClosestGrave->y, ClosestGrave->z, player->GetOrientation()); +                        waitingPlayer->TeleportTo(GetMapId(), closestGrave->x, closestGrave->y, closestGrave->z, player->GetOrientation());                  }                  m_ReviveQueue[BgCreatures[node]].clear();              } diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 3dfa1cece61..20bcfc8f41c 100755 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -2408,24 +2408,24 @@ bool Creature::IsDungeonBoss() const      return cinfo && (cinfo->flags_extra & CREATURE_FLAG_EXTRA_DUNGEON_BOSS);  } -void Creature::SetWalk(bool enable) +bool Creature::SetWalk(bool enable)  { -    if (enable) -        AddUnitMovementFlag(MOVEMENTFLAG_WALKING); -    else -        RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); +    if (!Unit::SetWalk(enable)) +        return false; +      WorldPacket data(enable ? SMSG_SPLINE_MOVE_SET_WALK_MODE : SMSG_SPLINE_MOVE_SET_RUN_MODE, 9);      data.append(GetPackGUID());      SendMessageToSet(&data, true); +    return true;  } -void Creature::SetLevitate(bool enable) +bool Creature::SetLevitate(bool enable)  { -    if (enable) -        AddUnitMovementFlag(MOVEMENTFLAG_LEVITATING); -    else -        RemoveUnitMovementFlag(MOVEMENTFLAG_LEVITATING); +    if (!Unit::SetLevitate(enable)) +        return false; +      WorldPacket data(enable ? SMSG_SPLINE_MOVE_GRAVITY_DISABLE : SMSG_SPLINE_MOVE_GRAVITY_ENABLE, 9);      data.append(GetPackGUID());      SendMessageToSet(&data, true); +    return true;  } diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index bfe186329e1..40477de7c75 100755 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -520,8 +520,8 @@ class Creature : public Unit, public GridObject<Creature>, public MapCreature          void AI_SendMoveToPacket(float x, float y, float z, uint32 time, uint32 MovementFlags, uint8 type);          CreatureAI* AI() const { return (CreatureAI*)i_AI; } -        void SetWalk(bool enable); -        void SetLevitate(bool enable); +        bool SetWalk(bool enable); +        bool SetLevitate(bool enable);          uint32 GetShieldBlockValue() const                  //dunno mob block value          { diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index fde4f4c6959..632453a230f 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -7944,14 +7944,12 @@ void Player::_ApplyItemBonuses(ItemTemplate const* proto, uint8 slot, bool apply          _ApplyWeaponDamage(slot, proto, ssv, apply);     // Apply feral bonus from ScalingStatValue if set -    if (ssv) -        if (int32 feral_bonus = ssv->getFeralBonus(proto->ScalingStatValue)) -            ApplyFeralAPBonus(feral_bonus, apply); - -    // Druids get feral AP bonus from weapon dps (lso use DPS from ScalingStatValue) -    if (getClass() == CLASS_DRUID) -        if (int32 feral_bonus = proto->getFeralBonus(ssv->getDPSMod(proto->ScalingStatValue))) +    if (ssv && getClass() == CLASS_DRUID) +    { +        int32 feral_bonus = ssv->getFeralBonus(proto->ScalingStatValue) + proto->getFeralBonus(ssv->getDPSMod(proto->ScalingStatValue)); +        if (feral_bonus)              ApplyFeralAPBonus(feral_bonus, apply); +    }  }  void Player::_ApplyWeaponDamage(uint8 slot, ItemTemplate const* proto, ScalingStatValuesEntry const* ssv, bool apply) @@ -14071,12 +14069,10 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool          menuItemBounds = sObjectMgr->GetGossipMenuItemsMapBounds(0);      uint32 npcflags = 0; -    Creature* creature = NULL;      if (source->GetTypeId() == TYPEID_UNIT)      { -        creature = source->ToCreature(); -        npcflags = creature->GetUInt32Value(UNIT_NPC_FLAGS); +        npcflags = source->GetUInt32Value(UNIT_NPC_FLAGS);          if (npcflags & UNIT_NPC_FLAG_QUESTGIVER && showQuests)              PrepareQuestMenu(source->GetGUID());      } @@ -14091,7 +14087,7 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool          if (!sConditionMgr->IsObjectMeetToConditions(this, source, itr->second.Conditions))              continue; -        if (source->GetTypeId() == TYPEID_UNIT) +        if (Creature* creature = source->ToCreature())          {              if (!(itr->second.OptionNpcflag & npcflags))                  continue; @@ -14164,10 +14160,8 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool                      break;              }          } -        else if (source->GetTypeId() == TYPEID_GAMEOBJECT) +        else if (GameObject* go = source->ToGameObject())          { -            GameObject* go = source->ToGameObject(); -              switch (itr->second.OptionType)              {                  case GOSSIP_OPTION_GOSSIP: @@ -16002,9 +15996,9 @@ void Player::CastedCreatureOrGO(uint32 entry, uint64 guid, uint32 spell_id)                              if (reqTarget != entry) // if entry doesn't match, check for killcredits referenced in template                              {                                  CreatureTemplate const* cinfo = sObjectMgr->GetCreatureTemplate(entry); -                                for (uint8 j = 0; j < MAX_KILL_CREDIT; ++j) -                                    if (cinfo->KillCredit[j] == reqTarget) -                                        entry = cinfo->KillCredit[j]; +                                for (uint8 k = 0; k < MAX_KILL_CREDIT; ++k) +                                    if (cinfo->KillCredit[k] == reqTarget) +                                        entry = cinfo->KillCredit[k];                              }                           }                      } @@ -17649,7 +17643,7 @@ void Player::_LoadMailedItems(Mail* mail)          {              sLog->outError("Player %u has unknown item_template (ProtoType) in mailed items(GUID: %u template: %u) in mail (%u), deleted.", GetGUIDLow(), itemGuid, itemTemplate, mail->messageID); -            PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_MAIL_ITEM); +            stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_INVALID_MAIL_ITEM);              stmt->setUInt32(0, itemGuid);              CharacterDatabase.Execute(stmt); @@ -17665,10 +17659,8 @@ void Player::_LoadMailedItems(Mail* mail)          {              sLog->outError("Player::_LoadMailedItems - Item in mail (%u) doesn't exist !!!! - item guid: %u, deleted from mail", mail->messageID, itemGuid); -            PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM); - +            stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_MAIL_ITEM);              stmt->setUInt32(0, itemGuid); -              CharacterDatabase.Execute(stmt);              item->FSetState(ITEM_REMOVED); @@ -19044,20 +19036,22 @@ void Player::_SaveDailyQuestStatus(SQLTransaction& trans)      stmt->setUInt32(0, GetGUIDLow());      trans->Append(stmt);      for (uint32 quest_daily_idx = 0; quest_daily_idx < PLAYER_MAX_DAILY_QUESTS; ++quest_daily_idx) +    {          if (GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx))          { -            PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_DAILYQUESTSTATUS); +            stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_DAILYQUESTSTATUS);              stmt->setUInt32(0, GetGUIDLow());              stmt->setUInt32(1, GetUInt32Value(PLAYER_FIELD_DAILY_QUESTS_1+quest_daily_idx));              stmt->setUInt64(2, uint64(m_lastDailyQuestTime));              trans->Append(stmt);          } +    }      if (!m_DFQuests.empty())      {          for (DFQuestsDoneList::iterator itr = m_DFQuests.begin(); itr != m_DFQuests.end(); ++itr)          { -            PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_DAILYQUESTSTATUS); +            stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_DAILYQUESTSTATUS);              stmt->setUInt32(0, GetGUIDLow());              stmt->setUInt32(1, (*itr));              stmt->setUInt64(2, uint64(m_lastDailyQuestTime)); @@ -19080,7 +19074,7 @@ void Player::_SaveWeeklyQuestStatus(SQLTransaction& trans)      {          uint32 quest_id  = *iter; -        PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_WEEKLYQUESTSTATUS); +        stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_WEEKLYQUESTSTATUS);          stmt->setUInt32(0, GetGUIDLow());          stmt->setUInt32(1, quest_id);          trans->Append(stmt); @@ -19106,7 +19100,7 @@ void Player::_SaveSeasonalQuestStatus(SQLTransaction& trans)          {              uint32 quest_id = (*itr); -            PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_SEASONALQUESTSTATUS); +            stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHARACTER_SEASONALQUESTSTATUS);              stmt->setUInt32(0, GetGUIDLow());              stmt->setUInt32(1, quest_id);              stmt->setUInt32(2, event_id); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 69fb9906efb..41d13f38cc8 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -1469,8 +1469,8 @@ uint32 Unit::CalcArmorReducedDamage(Unit* victim, const uint32 damage, SpellInfo      if (GetTypeId() == TYPEID_PLAYER)      {          float bonusPct = 0; -        AuraEffectList const& ResIgnoreAuras = GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT); -        for (AuraEffectList::const_iterator itr = ResIgnoreAuras.begin(); itr != ResIgnoreAuras.end(); ++itr) +        AuraEffectList const& armorPenAuras = GetAuraEffectsByType(SPELL_AURA_MOD_ARMOR_PENETRATION_PCT); +        for (AuraEffectList::const_iterator itr = armorPenAuras.begin(); itr != armorPenAuras.end(); ++itr)          {              if ((*itr)->GetSpellInfo()->EquippedItemClass == -1)              { @@ -15459,7 +15459,7 @@ void Unit::Kill(Unit* victim, bool durabilityLoss)      // Inform pets (if any) when player kills target)      // MUST come after victim->setDeathState(JUST_DIED); or pet next target      // selection will get stuck on same target and break pet react state -    if (Player* player = ToPlayer()) +    if (player)      {          Pet* pet = player->GetPet();          if (pet && pet->isAlive() && pet->isControlled()) @@ -17003,7 +17003,7 @@ void Unit::ExitVehicle(Position const* exitPosition)          return;      GetVehicleBase()->RemoveAurasByType(SPELL_AURA_CONTROL_VEHICLE, GetGUID()); -    //! The following call would not even be executed successfully as the  +    //! The following call would not even be executed successfully as the      //! SPELL_AURA_CONTROL_VEHICLE unapply handler already calls _ExitVehicle without      //! specifying an exitposition. The subsequent call below would return on if (!m_vehicle).      /*_ExitVehicle(exitPosition);*/ @@ -17456,10 +17456,28 @@ void Unit::SetFacingToObject(WorldObject* pObject)      SetFacingTo(GetAngle(pObject));  } -void Unit::SetWalk(bool enable) +bool Unit::SetWalk(bool enable) +{ +    if (enable == IsWalking()) +        return false; + +    if (enable) +        AddUnitMovementFlag(MOVEMENTFLAG_WALKING); +    else +        RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); + +    return true; +} + +bool Unit::SetLevitate(bool enable)  { +    if (enable == IsLevitating()) +        return false; +      if (enable)          AddUnitMovementFlag(MOVEMENTFLAG_WALKING);      else          RemoveUnitMovementFlag(MOVEMENTFLAG_WALKING); -}
\ No newline at end of file + +    return true; +} diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 00f96f15a2c..0fe5f3d8ca3 100755 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1627,7 +1627,8 @@ class Unit : public WorldObject          void SendMovementFlagUpdate();          bool IsLevitating() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_LEVITATING);}          bool IsWalking() const { return m_movementInfo.HasMovementFlag(MOVEMENTFLAG_WALKING);} -        virtual void SetWalk(bool enable); +        virtual bool SetWalk(bool enable); +        virtual bool SetLevitate(bool enable);          void SetInFront(Unit const* target);          void SetFacingTo(float ori); diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index f99bfe52df3..45c0f7bed42 100755 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -309,28 +309,28 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data)              sAuctionMgr->AddAItem(newItem);              auctionHouse->AddAuction(AH); -            for (uint32 i = 0; i < itemsCount; ++i) +            for (uint32 j = 0; j < itemsCount; ++j)              { -                Item* item = items[i]; +                Item* item2 = items[j]; -                if (item->GetCount() == count[i]) +                if (item2->GetCount() == count[j])                  { -                    _player->MoveItemFromInventory(item->GetBagSlot(), item->GetSlot(), true); +                    _player->MoveItemFromInventory(item2->GetBagSlot(), item2->GetSlot(), true);                      SQLTransaction trans = CharacterDatabase.BeginTransaction(); -                    item->DeleteFromInventoryDB(trans); -                    item->SaveToDB(trans); +                    item2->DeleteFromInventoryDB(trans); +                    item2->SaveToDB(trans);                      CharacterDatabase.CommitTransaction(trans);                  }                  else                  { -                    item->SetCount(item->GetCount() - count[i]); -                    item->SetState(ITEM_CHANGED, _player); -                    _player->ItemRemovedQuestCheck(item->GetEntry(), count[i]); -                    item->SendUpdateToPlayer(_player); +                    item2->SetCount(item2->GetCount() - count[j]); +                    item2->SetState(ITEM_CHANGED, _player); +                    _player->ItemRemovedQuestCheck(item2->GetEntry(), count[j]); +                    item2->SendUpdateToPlayer(_player);                      SQLTransaction trans = CharacterDatabase.BeginTransaction(); -                    item->SaveToDB(trans); +                    item2->SaveToDB(trans);                      CharacterDatabase.CommitTransaction(trans);                  }              } diff --git a/src/server/game/Handlers/CharacterHandler.cpp b/src/server/game/Handlers/CharacterHandler.cpp index a48cf70bd54..30119c79d96 100644 --- a/src/server/game/Handlers/CharacterHandler.cpp +++ b/src/server/game/Handlers/CharacterHandler.cpp @@ -1811,8 +1811,8 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recv_data)          if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD))          {              // Reset guild -            if (QueryResult result = CharacterDatabase.PQuery("SELECT guildid FROM `guild_member` WHERE guid ='%u'", lowGuid)) -                if (Guild* guild = sGuildMgr->GetGuildById((result->Fetch()[0]).GetUInt32())) +            if (QueryResult result2 = CharacterDatabase.PQuery("SELECT guildid FROM `guild_member` WHERE guid ='%u'", lowGuid)) +                if (Guild* guild = sGuildMgr->GetGuildById((result2->Fetch()[0]).GetUInt32()))                      guild->DeleteMember(MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER));          } diff --git a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp index fb2249c508e..a8602153de3 100755 --- a/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/WaypointMovementGenerator.cpp @@ -79,7 +79,7 @@ void WaypointMovementGenerator<Creature>::OnArrived(Creature& creature)      if (i_path->at(i_currentNode)->event_id && urand(0, 99) < i_path->at(i_currentNode)->event_chance)      {          sLog->outDebug(LOG_FILTER_MAPSCRIPTS, "Creature movement start script %u at point %u for "UI64FMTD".", i_path->at(i_currentNode)->event_id, i_currentNode, creature.GetGUID()); -        creature.GetMap()->ScriptsStart(sWaypointScripts, i_path->at(i_currentNode)->event_id, &creature, NULL/*, false*/); +        creature.GetMap()->ScriptsStart(sWaypointScripts, i_path->at(i_currentNode)->event_id, &creature, NULL);      }      // Inform script diff --git a/src/server/game/Scripting/MapScripts.cpp b/src/server/game/Scripting/MapScripts.cpp index 7757e1a1a35..fb2590ebbfe 100755 --- a/src/server/game/Scripting/MapScripts.cpp +++ b/src/server/game/Scripting/MapScripts.cpp @@ -39,9 +39,9 @@ void Map::ScriptsStart(ScriptMapMap const& scripts, uint32 id, Object* source, O          return;      // prepare static data -    uint64 sourceGUID = source ? source->GetGUID() : (uint64)0; //some script commands doesn't have source -    uint64 targetGUID = target ? target->GetGUID() : (uint64)0; -    uint64 ownerGUID  = (source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : (uint64)0; +    uint64 sourceGUID = source ? source->GetGUID() : uint64(0); //some script commands doesn't have source +    uint64 targetGUID = target ? target->GetGUID() : uint64(0); +    uint64 ownerGUID  = (source && source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : uint64(0);      ///- Schedule script execution for all scripts in the script map      ScriptMap const* s2 = &(s->second); @@ -74,9 +74,9 @@ void Map::ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* sou      // NOTE: script record _must_ exist until command executed      // prepare static data -    uint64 sourceGUID = source ? source->GetGUID() : (uint64)0; -    uint64 targetGUID = target ? target->GetGUID() : (uint64)0; -    uint64 ownerGUID  = (source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : (uint64)0; +    uint64 sourceGUID = source ? source->GetGUID() : uint64(0); +    uint64 targetGUID = target ? target->GetGUID() : uint64(0); +    uint64 ownerGUID  = (source && source->GetTypeId() == TYPEID_ITEM) ? ((Item*)source)->GetOwnerGUID() : uint64(0);      ScriptAction sa;      sa.sourceGUID = sourceGUID; diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index 99497870a15..cb79bd00776 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -4686,11 +4686,11 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool                      if (owner_aura)                      {                          owner_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount); -                    } -                    if (pet_aura) -                    { -                        pet_aura->SetCharges(0); -                        pet_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount); +                        if (pet_aura) +                        { +                            pet_aura->SetCharges(0); +                            pet_aura->SetStackAmount(owner_aura->GetSpellInfo()->StackAmount); +                        }                      }                      break;                  } diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index b4ee4febbef..db36eb30191 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -1126,7 +1126,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge                          case TYPEID_PLAYER:                          {                              Unit* unitTarget = (*itr)->ToUnit(); -                            if (unitTarget->isAlive() || !playerCaster->isHonorOrXPTarget(unitTarget)  +                            if (unitTarget->isAlive() || !playerCaster->isHonorOrXPTarget(unitTarget)                                  || ((unitTarget->GetCreatureTypeMask() & (1 << (CREATURE_TYPE_HUMANOID-1))) == 0)                                  || (unitTarget->GetDisplayId() != unitTarget->GetNativeDisplayId()))                                  break; @@ -1151,7 +1151,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge          case 51328:              // check if our target is not valid (spell can target ghoul or dead unit)              if (!(m_targets.GetUnitTarget() && m_targets.GetUnitTarget()->GetDisplayId() == m_targets.GetUnitTarget()->GetNativeDisplayId() && -                ((m_targets.GetUnitTarget()->GetEntry() == 26125 && m_targets.GetUnitTarget()->GetOwnerGUID() == m_caster->GetGUID())  +                ((m_targets.GetUnitTarget()->GetEntry() == 26125 && m_targets.GetUnitTarget()->GetOwnerGUID() == m_caster->GetGUID())                  || m_targets.GetUnitTarget()->isDead())))              {                  // remove existing targets @@ -1893,7 +1893,7 @@ void Spell::SearchChainTargets(std::list<WorldObject*>& targets, uint32 chainTar      }      // chain lightning/heal spells and similar - allow to jump at larger distance and go out of los -    bool isBouncingFar = (m_spellInfo->AttributesEx4 & SPELL_ATTR4_AREA_TARGET_CHAIN  +    bool isBouncingFar = (m_spellInfo->AttributesEx4 & SPELL_ATTR4_AREA_TARGET_CHAIN          || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_NONE          || m_spellInfo->DmgClass == SPELL_DAMAGE_CLASS_MAGIC); @@ -4505,9 +4505,7 @@ void Spell::TakeReagents()      if (m_caster->GetTypeId() != TYPEID_PLAYER)          return; -    ItemTemplate const* castItemTemplate = m_CastItem -            ? m_CastItem->GetTemplate() -            : NULL; +    ItemTemplate const* castItemTemplate = m_CastItem ? m_CastItem->GetTemplate() : NULL;      // do not take reagents for these item casts      if (castItemTemplate && castItemTemplate->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST) @@ -7230,7 +7228,7 @@ namespace Trinity  {  WorldObjectSpellTargetCheck::WorldObjectSpellTargetCheck(Unit* caster, Unit* referer, SpellInfo const* spellInfo, -            SpellTargetCheckTypes selectionType, ConditionList* condList) : _caster(caster), _referer(referer), _spellInfo(spellInfo),  +            SpellTargetCheckTypes selectionType, ConditionList* condList) : _caster(caster), _referer(referer), _spellInfo(spellInfo),      _targetSelectionType(selectionType), _condList(condList)  {      if (condList) @@ -7304,7 +7302,7 @@ bool WorldObjectSpellTargetCheck::operator()(WorldObject* target)      return sConditionMgr->IsObjectMeetToConditions(*_condSrcInfo, *_condList);  } -WorldObjectSpellNearbyTargetCheck::WorldObjectSpellNearbyTargetCheck(float range, Unit* caster, SpellInfo const* spellInfo,  +WorldObjectSpellNearbyTargetCheck::WorldObjectSpellNearbyTargetCheck(float range, Unit* caster, SpellInfo const* spellInfo,      SpellTargetCheckTypes selectionType, ConditionList* condList)      : WorldObjectSpellTargetCheck(caster, caster, spellInfo, selectionType, condList), _range(range), _position(caster)  { diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp index 77332bd30a8..589b666c035 100644 --- a/src/server/game/Warden/WardenCheckMgr.cpp +++ b/src/server/game/Warden/WardenCheckMgr.cpp @@ -82,7 +82,7 @@ void WardenCheckMgr::LoadWardenChecks()      uint32 count = 0;      do      { -        Field* fields = result->Fetch(); +        fields = result->Fetch();          uint16 id               = fields[0].GetUInt16();          uint8 checkType         = fields[1].GetUInt8(); @@ -156,11 +156,11 @@ void WardenCheckMgr::LoadWardenChecks()      uint32 overrideCount = 0; -    if(overrideResult) +    if (overrideResult)      {          do          { -            Field * fields = overrideResult->Fetch(); +            fields = overrideResult->Fetch();              uint16 checkId = fields[0].GetUInt16(); diff --git a/src/server/scripts/Commands/cs_account.cpp b/src/server/scripts/Commands/cs_account.cpp index 7372c92c4dd..df83fe8118f 100644 --- a/src/server/scripts/Commands/cs_account.cpp +++ b/src/server/scripts/Commands/cs_account.cpp @@ -502,11 +502,12 @@ public:              stmt->setUInt32(0, targetAccountId);              stmt->setUInt32(1, realmID);          } +          LoginDatabase.Execute(stmt);          if (gm != 0)          { -            PreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_ACCESS); +            stmt = LoginDatabase.GetPreparedStatement(LOGIN_INS_ACCOUNT_ACCESS);              stmt->setUInt32(0, targetAccountId);              stmt->setUInt8(1, uint8(gm)); diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp index 41806dcb308..02a8de14fdf 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/boss_kiljaeden.cpp @@ -660,17 +660,9 @@ public:              DoScriptText(RAND(SAY_KJ_REFLECTION1, SAY_KJ_REFLECTION2), me);              for (uint8 i = 0; i < 4; ++i)              { -                float x, y, z; -                Unit* target = NULL; -                for (uint8 i = 0; i < 6; ++i) -                { -                    target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true); -                    if (!target || !target->HasAura(SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT, 0)) -                        break; -                } - -                if (target) +                if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100, true, -SPELL_VENGEANCE_OF_THE_BLUE_FLIGHT))                  { +                    float x, y, z;                      target->GetPosition(x, y, z);                      if (Creature* pSinisterReflection = me->SummonCreature(CREATURE_SINISTER_REFLECTION, x, y, z, 0, TEMPSUMMON_CORPSE_DESPAWN, 0))                      { diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp index 0f4b046f7d5..636be5e29be 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/boss_prince_taldaram.cpp @@ -389,8 +389,10 @@ public:      bool OnGossipHello(Player* /*player*/, GameObject* pGO)      {          InstanceScript* instance = pGO->GetInstanceScript(); +        if (!instance) +            return true; -        Creature* pPrinceTaldaram = Unit::GetCreature(*pGO, instance ? instance->GetData64(DATA_PRINCE_TALDARAM) : 0); +        Creature* pPrinceTaldaram = Unit::GetCreature(*pGO, instance->GetData64(DATA_PRINCE_TALDARAM));          if (pPrinceTaldaram && pPrinceTaldaram->isAlive())          {              // maybe these are hacks :( diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp index 9fcfcfa47e5..7c82454ba87 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/boss_grand_champions.cpp @@ -208,7 +208,7 @@ public:              switch (i)              {                  case 2: -                    if ((instance && uiWaypointPath == 3) || uiWaypointPath == 2) +                    if (instance && (uiWaypointPath == 3 || uiWaypointPath == 2))                          instance->SetData(DATA_MOVEMENT_DONE, instance->GetData(DATA_MOVEMENT_DONE)+1);                      break;                  case 3: diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp index 4674d4584e1..8513eae5876 100644 --- a/src/server/scripts/World/npcs_special.cpp +++ b/src/server/scripts/World/npcs_special.cpp @@ -137,8 +137,8 @@ public:                  if (!spawnedTemplate)                  { -                    SpawnAssoc = NULL;                      sLog->outErrorDb("TCSR: Creature template entry %u does not exist in DB, which is required by npc_air_force_bots", SpawnAssoc->spawnedCreatureEntry); +                    SpawnAssoc = NULL;                      return;                  }              }  | 
