diff options
Diffstat (limited to 'src/server/game')
| -rw-r--r-- | src/server/game/Battlefield/Battlefield.cpp | 4 | ||||
| -rwxr-xr-x | src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp | 1 | ||||
| -rwxr-xr-x | src/server/game/Entities/Unit/Unit.cpp | 39 | ||||
| -rwxr-xr-x | src/server/game/Loot/LootMgr.cpp | 2 | ||||
| -rwxr-xr-x | src/server/game/Spells/Auras/SpellAuraEffects.cpp | 2 | ||||
| -rwxr-xr-x | src/server/game/Spells/Auras/SpellAuras.cpp | 2 | ||||
| -rwxr-xr-x | src/server/game/Spells/Spell.cpp | 2 | ||||
| -rwxr-xr-x | src/server/game/Spells/SpellEffects.cpp | 8 | ||||
| -rwxr-xr-x | src/server/game/Spells/SpellMgr.cpp | 2 |
9 files changed, 33 insertions, 29 deletions
diff --git a/src/server/game/Battlefield/Battlefield.cpp b/src/server/game/Battlefield/Battlefield.cpp index c0cf64ead58..eecee6268ed 100644 --- a/src/server/game/Battlefield/Battlefield.cpp +++ b/src/server/game/Battlefield/Battlefield.cpp @@ -451,8 +451,8 @@ WorldPacket Battlefield::BuildWarningAnnPacket(std::string msg) data << uint32(1); data << uint8(0); data << uint64(0); - data << uint32(strlen(msg.c_str()) + 1); - data << msg.c_str(); + data << uint32(msg.length()); + data << msg; data << uint8(0); return data; diff --git a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp index 8df6f93a082..e4803af8a21 100755 --- a/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp +++ b/src/server/game/Battlegrounds/Zones/BattlegroundWS.cpp @@ -731,7 +731,6 @@ void BattlegroundWS::Reset() _bothFlagsKept = false; _flagDebuffState = 0; _flagSpellForceTimer = 0; - _lastFlagCaptureTeam = 0; _flagsDropTimer[BG_TEAM_ALLIANCE] = 0; _flagsDropTimer[BG_TEAM_HORDE] = 0; _flagsTimer[BG_TEAM_ALLIANCE] = 0; diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 5d397790b44..27e2cbf358b 100755 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -381,9 +381,7 @@ void Unit::MonsterMoveWithSpeed(float x, float y, float z, float speed) void Unit::UpdateSplineMovement(uint32 t_diff) { - enum{ - POSITION_UPDATE_DELAY = 400, - }; + uint32 const positionUpdateDelay = 400; if (movespline->Finalized()) return; @@ -397,7 +395,7 @@ void Unit::UpdateSplineMovement(uint32 t_diff) m_movesplineTimer.Update(t_diff); if (m_movesplineTimer.Passed() || arrived) { - m_movesplineTimer.Reset(POSITION_UPDATE_DELAY); + m_movesplineTimer.Reset(positionUpdateDelay); Movement::Location loc = movespline->ComputePosition(); if (HasUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT)) @@ -543,12 +541,11 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam GetAI()->DamageDealt(victim, damage, damagetype); if (victim->GetTypeId() == TYPEID_PLAYER) + { if (victim->ToPlayer()->GetCommandStatus(CHEAT_GOD)) return 0; - // Signal to pets that their owner was attacked - if (victim->GetTypeId() == TYPEID_PLAYER) - { + // Signal to pets that their owner was attacked Pet* pet = victim->ToPlayer()->GetPet(); if (pet && pet->isAlive()) @@ -6728,10 +6725,13 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere // Judgement of Light case 20185: { - // 2% of base mana - basepoints0 = int32(victim->CountPctFromMaxHealth(2)); - victim->CastCustomSpell(victim, 20267, &basepoints0, 0, 0, true, 0, triggeredByAura); - return true; + if (!victim) + return false; + + // 2% of base mana + basepoints0 = int32(victim->CountPctFromMaxHealth(2)); + victim->CastCustomSpell(victim, 20267, &basepoints0, 0, 0, true, 0, triggeredByAura); + return true; } // Judgement of Wisdom case 20186: @@ -16149,7 +16149,8 @@ void Unit::RemoveCharmedBy(Unit* charmer) if (Creature* creature = ToCreature()) { - creature->AI()->OnCharmed(false); + if (creature->AI()) + creature->AI()->OnCharmed(false); if (type != CHARM_TYPE_VEHICLE) // Vehicles' AI is never modified { @@ -17049,6 +17050,7 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a sLog->outDebug(LOG_FILTER_VEHICLES, "EnterVehicle: %u leave vehicle %u seat %d and enter %d.", GetEntry(), m_vehicle->GetBase()->GetEntry(), GetTransSeat(), seatId); ChangeSeat(seatId); } + return; } else @@ -17084,6 +17086,7 @@ void Unit::_EnterVehicle(Vehicle* vehicle, int8 seatId, AuraApplication const* a ASSERT(!m_vehicle); m_vehicle = vehicle; + if (!m_vehicle->AddPassenger(this, seatId)) { m_vehicle = NULL; @@ -17136,9 +17139,11 @@ void Unit::_ExitVehicle(Position const* exitPosition) m_vehicle->RemovePassenger(this); + Player* player = ToPlayer(); + // If player is on mouted duel and exits the mount should immediatly lose the duel - if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->duel && ToPlayer()->duel->isMounted) - ToPlayer()->DuelComplete(DUEL_FLED); + if (player && player->duel && player->duel->isMounted) + player->DuelComplete(DUEL_FLED); // This should be done before dismiss, because there may be some aura removal Vehicle* vehicle = m_vehicle; @@ -17155,8 +17160,8 @@ void Unit::_ExitVehicle(Position const* exitPosition) AddUnitState(UNIT_STATE_MOVE); - if (GetTypeId() == TYPEID_PLAYER) - ToPlayer()->SetFallInformation(0, GetPositionZ()); + if (player) + player->SetFallInformation(0, GetPositionZ()); else if (HasUnitMovementFlag(MOVEMENTFLAG_ROOT)) { WorldPacket data(SMSG_SPLINE_MOVE_UNROOT, 8); @@ -17172,7 +17177,7 @@ void Unit::_ExitVehicle(Position const* exitPosition) //GetMotionMaster()->MoveFall(); // Enable this once passenger positions are calculater properly (see above) - if (Player* player = ToPlayer()) + if (player) player->ResummonPetTemporaryUnSummonedIfAny(); if (vehicle->GetBase()->HasUnitTypeMask(UNIT_MASK_MINION)) diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 72636a5d2aa..fca8d78a3de 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -524,7 +524,7 @@ QuestItemList* Loot::FillQuestLoot(Player* player) // increase once if one looter only, looter-times if free for all if (item.freeforall || !item.is_blocked) ++unlootedCount; - if (!player->GetGroup() || (player->GetGroup()->GetLootMethod() != GROUP_LOOT || player->GetGroup()->GetLootMethod() != ROUND_ROBIN)) + if (!player->GetGroup() || (player->GetGroup()->GetLootMethod() != GROUP_LOOT && player->GetGroup()->GetLootMethod() != ROUND_ROBIN)) item.is_blocked = true; if (items.size() + ql->size() == MAX_NR_LOOT_ITEMS) diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index bca26bd7391..29dcde9d616 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5042,7 +5042,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool } case 43681: // Inactive { - if (!target || target->GetTypeId() != TYPEID_PLAYER || aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) + if (target->GetTypeId() != TYPEID_PLAYER || aurApp->GetRemoveMode() != AURA_REMOVE_BY_EXPIRE) return; if (target->GetMap()->IsBattleground()) diff --git a/src/server/game/Spells/Auras/SpellAuras.cpp b/src/server/game/Spells/Auras/SpellAuras.cpp index fb1cdc576ba..d94e6b0e9e6 100755 --- a/src/server/game/Spells/Auras/SpellAuras.cpp +++ b/src/server/game/Spells/Auras/SpellAuras.cpp @@ -425,7 +425,7 @@ void Aura::_UnapplyForTarget(Unit* target, Unit* caster, AuraApplication * auraA if (itr == m_applications.end()) { sLog->outError(LOG_FILTER_SPELLS_AURAS, "Aura::_UnapplyForTarget, target:%u, caster:%u, spell:%u was not found in owners application map!", - target->GetGUIDLow(), caster->GetGUIDLow(), auraApp->GetBase()->GetSpellInfo()->Id); + target->GetGUIDLow(), caster ? caster->GetGUIDLow() : 0, auraApp->GetBase()->GetSpellInfo()->Id); ASSERT(false); } diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index e64197b5242..1dcee6dbac7 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -2525,7 +2525,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo* target) } } - if (missInfo != SPELL_MISS_EVADE && m_caster && !m_caster->IsFriendlyTo(unit) && (!m_spellInfo->IsPositive() || m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL))) + if (missInfo != SPELL_MISS_EVADE && !m_caster->IsFriendlyTo(unit) && (!m_spellInfo->IsPositive() || m_spellInfo->HasEffect(SPELL_EFFECT_DISPEL))) { m_caster->CombatStart(unit, !(m_spellInfo->AttributesEx3 & SPELL_ATTR3_NO_INITIAL_AGGRO)); diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index 3637bb18049..ad9298f0144 100755 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1724,8 +1724,7 @@ void Spell::DoCreateItem(uint32 /*i*/, uint32 itemtype) pItem->SetUInt32Value(ITEM_FIELD_CREATOR, player->GetGUIDLow()); // send info to the client - if (pItem) - player->SendNewItem(pItem, num_to_add, true, bgType == 0); + player->SendNewItem(pItem, num_to_add, true, bgType == 0); // we succeeded in creating at least one item, so a levelup is possible if (bgType == 0) @@ -2079,7 +2078,8 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex) bg->EventPlayerClickedOnFlag(player, gameObjTarget); return; } - }else if (m_spellInfo->Id == 1842 && gameObjTarget->GetGOInfo()->type == GAMEOBJECT_TYPE_TRAP && gameObjTarget->GetOwner()) + } + else if (m_spellInfo->Id == 1842 && gameObjTarget->GetGOInfo()->type == GAMEOBJECT_TYPE_TRAP && gameObjTarget->GetOwner()) { gameObjTarget->SetLootState(GO_JUST_DEACTIVATED); return; @@ -2116,7 +2116,7 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex) if (gameObjTarget) SendLoot(guid, LOOT_SKINNING); - else + else if (itemTarget) itemTarget->SetFlag(ITEM_FIELD_FLAGS, ITEM_FLAG_UNLOCKED); // not allow use skill grow at item base open diff --git a/src/server/game/Spells/SpellMgr.cpp b/src/server/game/Spells/SpellMgr.cpp index e17e71f8869..f718b118ad7 100755 --- a/src/server/game/Spells/SpellMgr.cpp +++ b/src/server/game/Spells/SpellMgr.cpp @@ -1135,7 +1135,7 @@ bool SpellArea::IsFitToRequirements(Player const* player, uint32 newZone, uint32 case 68719: // Oil Refinery - Isle of Conquest. case 68720: // Quarry - Isle of Conquest. { - if (player->GetBattlegroundTypeId() != BATTLEGROUND_IC || !player->GetBattleground()) + if (!player || player->GetBattlegroundTypeId() != BATTLEGROUND_IC || !player->GetBattleground()) return false; uint8 nodeType = spellId == 68719 ? NODE_TYPE_REFINERY : NODE_TYPE_QUARRY; |
