Apply style fix pt3

This commit is contained in:
Antz 2020-01-13 10:14:05 +00:00
parent 1392c131e7
commit d93dbd95fe
191 changed files with 9851 additions and 676 deletions

View file

@ -74,11 +74,17 @@ ArenaTeam::~ArenaTeam()
bool ArenaTeam::Create(ObjectGuid captainGuid, ArenaType type, std::string arenaTeamName)
{
if (!IsArenaTypeValid(type))
{
return false;
}
if (!sObjectMgr.GetPlayer(captainGuid)) // player not exist
{
return false;
}
if (sObjectMgr.GetArenaTeamByName(arenaTeamName)) // arena team with this name already exist
{
return false;
}
DEBUG_LOG("GUILD: creating arena team %s to leader: %s", arenaTeamName.c_str(), captainGuid.GetString().c_str());
@ -113,7 +119,9 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
// arena team is full (can't have more than type * 2 players!)
if (GetMembersSize() >= GetMaxMembersSize())
{
return false;
}
Player* pl = sObjectMgr.GetPlayer(playerGuid);
if (pl)
@ -132,7 +140,9 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
// 0 1
QueryResult* result = CharacterDatabase.PQuery("SELECT name, class FROM characters WHERE guid='%u'", playerGuid.GetCounter());
if (!result)
{
return false;
}
plName = (*result)[0].GetCppString();
plClass = (*result)[1].GetUInt8();
@ -193,7 +203,9 @@ bool ArenaTeam::AddMember(ObjectGuid playerGuid)
bool ArenaTeam::LoadArenaTeamFromDB(QueryResult* arenaTeamDataResult)
{
if (!arenaTeamDataResult)
{
return false;
}
Field* fields = arenaTeamDataResult->Fetch();
@ -203,7 +215,9 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult* arenaTeamDataResult)
m_Type = ArenaType(fields[3].GetUInt32());
if (!IsArenaTypeValid(m_Type))
{
return false;
}
m_BackgroundColor = fields[4].GetUInt32();
m_EmblemStyle = fields[5].GetUInt32();
@ -224,7 +238,9 @@ bool ArenaTeam::LoadArenaTeamFromDB(QueryResult* arenaTeamDataResult)
bool ArenaTeam::LoadMembersFromDB(QueryResult* arenaTeamMembersResult)
{
if (!arenaTeamMembersResult)
{
return false;
}
bool captainPresentInTeam = false;
@ -267,7 +283,9 @@ bool ArenaTeam::LoadMembersFromDB(QueryResult* arenaTeamMembersResult)
// arena team can't be > 2 * arenatype (2 for 2x2, 3 for 3x3, 5 for 5x5)
if (GetMembersSize() >= GetMaxMembersSize())
{
return false;
}
if (newmember.guid == GetCaptainGuid())
captainPresentInTeam = true;
@ -429,7 +447,9 @@ void ArenaTeam::InspectStats(WorldSession* session, ObjectGuid guid)
{
ArenaTeamMember* member = GetMember(guid);
if (!member)
{
return;
}
WorldPacket data(MSG_INSPECT_ARENA_TEAMS, 8 + 1 + 4 * 6);
data << guid; // player guid
@ -587,7 +607,9 @@ bool ArenaTeam::HaveMember(ObjectGuid guid) const
{
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
if (itr->guid == guid)
{
return true;
}
return false;
}
@ -734,7 +756,9 @@ void ArenaTeam::UpdateArenaPointsHelper(std::map<uint32, uint32>& PlayerPoints)
// helper function for arena point distribution (this way, when distributing, no actual calculation is required, just a few comparisons)
// 10 played games per week is a minimum
if (m_stats.games_week < 10)
{
return;
}
// to get points, a player has to participate in at least 30% of the matches
uint32 min_plays = (uint32) ceil(m_stats.games_week * 0.3);
for (MemberList::const_iterator itr = m_members.begin(); itr != m_members.end(); ++itr)
@ -788,7 +812,9 @@ bool ArenaTeam::IsFighting() const
if (Player* p = sObjectMgr.GetPlayer(itr->guid))
{
if (p->GetMap()->IsBattleArena())
{
return true;
}
}
}
return false;

View file

@ -141,7 +141,9 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction)
if (auction_owner)
owner_name = auction_owner->GetName();
else if (ownerGuid && !sObjectMgr.GetPlayerNameByGUID(ownerGuid, owner_name))
{ owner_name = sObjectMgr.GetMangosStringForDBCLocale(LANG_UNKNOWN); }
{
owner_name = sObjectMgr.GetMangosStringForDBCLocale(LANG_UNKNOWN);
}
uint32 owner_accid = sObjectMgr.GetPlayerAccountIdByGUID(ownerGuid);
@ -150,7 +152,9 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry* auction)
}
}
else if (!bidder)
{ bidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(bidder_guid); }
{
bidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(bidder_guid);
}
if (auction_owner)
auction_owner->GetSession()->SendAuctionOwnerNotification(auction);
@ -679,11 +683,17 @@ int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry* auc, Pl
ItemPrototype const* itemProto1 = ObjectMgr::GetItemPrototype(itemTemplate);
ItemPrototype const* itemProto2 = ObjectMgr::GetItemPrototype(auc->itemTemplate);
if (!itemProto2 || !itemProto1)
{
return 0;
}
if (itemProto1->RequiredLevel < itemProto2->RequiredLevel)
{
return -1;
}
else if (itemProto1->RequiredLevel > itemProto2->RequiredLevel)
{
return +1;
}
break;
}
case 1: // quality = 1
@ -691,47 +701,71 @@ int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry* auc, Pl
ItemPrototype const* itemProto1 = ObjectMgr::GetItemPrototype(itemTemplate);
ItemPrototype const* itemProto2 = ObjectMgr::GetItemPrototype(auc->itemTemplate);
if (!itemProto2 || !itemProto1)
{
return 0;
}
if (itemProto1->Quality < itemProto2->Quality)
{
return -1;
}
else if (itemProto1->Quality > itemProto2->Quality)
{
return +1;
}
break;
}
case 2: // buyoutthenbid = 2
if (buyout != auc->buyout)
{
if (buyout < auc->buyout)
{
return -1;
}
else if (buyout > auc->buyout)
{
return +1;
}
}
else
{
if (bid < auc->bid)
{
return -1;
}
else if (bid > auc->bid)
{
return +1;
}
}
break;
case 3: // duration = 3
if (expireTime < auc->expireTime)
{
return -1;
}
else if (expireTime > auc->expireTime)
{
return +1;
}
break;
case 4: // status = 4
if (bidder < auc->bidder)
{
return -1;
}
else if (bidder > auc->bidder)
{
return +1;
}
break;
case 5: // name = 5
{
ItemPrototype const* itemProto1 = ObjectMgr::GetItemPrototype(itemTemplate);
ItemPrototype const* itemProto2 = ObjectMgr::GetItemPrototype(auc->itemTemplate);
if (!itemProto2 || !itemProto1)
{
return 0;
}
int32 loc_idx = viewPlayer->GetSession()->GetSessionDbLocaleIndex();
@ -754,16 +788,24 @@ int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry* auc, Pl
if (bid1 != bid2)
{
if (bid1 < bid2)
{
return -1;
}
else if (bid1 > bid2)
{
return +1;
}
}
else
{
if (buyout < auc->buyout)
{
return -1;
}
else if (buyout > auc->buyout)
{
return +1;
}
}
break;
@ -776,24 +818,36 @@ int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry* auc, Pl
uint64 bid2 = auc->bid ? auc->bid : auc->startbid;
if (bid1 < bid2)
{
return -1;
}
else if (bid1 > bid2)
{
return +1;
}
break;
}
case 9: // quantity = 9
{
if (itemCount < auc->itemCount)
{
return -1;
}
else if (itemCount > auc->itemCount)
{
return +1;
}
break;
}
case 10: // buyout = 10
if (buyout < auc->buyout)
{
return -1;
}
else if (buyout > auc->buyout)
{
return +1;
}
break;
case 11: // unused = 11
default:
@ -806,12 +860,16 @@ int AuctionEntry::CompareAuctionEntry(uint32 column, const AuctionEntry* auc, Pl
bool AuctionSorter::operator()(const AuctionEntry* auc1, const AuctionEntry* auc2) const
{
if (m_sort[0] == MAX_AUCTION_SORT) // not sorted
{
return false;
}
for (uint32 i = 0; i < MAX_AUCTION_SORT; ++i)
{
if (m_sort[i] == MAX_AUCTION_SORT) // end of sort
{
return false;
}
int res = auc1->CompareAuctionEntry(m_sort[i] & ~AUCTION_SORT_REVERSED, auc2, m_viewPlayer);
// "equal" by used column

View file

@ -212,7 +212,9 @@ Item* Bag::GetItemByLimitedCategory(uint32 limitedCategory) const
{
for (uint32 i = 0; i < GetBagSize(); ++i)
if (m_bagslot[i] && m_bagslot[i]->GetProto()->ItemLimitCategory == limitedCategory)
{
return m_bagslot[i];
}
return NULL;
}

View file

@ -42,7 +42,9 @@ CalendarEvent::~CalendarEvent()
bool CalendarEvent::AddInvite(CalendarInvite* invite)
{
if (!invite)
{
return false;
}
return m_Invitee.insert(CalendarInviteMap::value_type(invite->InviteId, invite)).second;
}
@ -51,7 +53,9 @@ CalendarInvite* CalendarEvent::GetInviteById(uint64 inviteId)
{
CalendarInviteMap::iterator itr = m_Invitee.find(inviteId);
if (itr != m_Invitee.end())
{
return itr->second;
}
return NULL;
}
@ -61,7 +65,9 @@ CalendarInvite* CalendarEvent::GetInviteByGuid(ObjectGuid const& guid)
while (inviteItr != m_Invitee.end())
{
if (inviteItr->second->InviteeGuid == guid)
{
return inviteItr->second;
}
++inviteItr;
}
@ -249,7 +255,9 @@ CalendarEvent* CalendarMgr::AddEvent(ObjectGuid const& guid, std::string title,
{
Player* player = sObjectMgr.GetPlayer(guid);
if (!player)
{
return NULL;
}
if (title.empty())
{
@ -356,7 +364,9 @@ CalendarInvite* CalendarMgr::AddInvite(CalendarEvent* event, ObjectGuid const& s
{
Player* sender = sObjectMgr.GetPlayer(senderGuid);
if (!event || !sender)
{
return NULL;
}
std::string name;
sObjectMgr.GetPlayerNameByGUID(inviteeGuid, name);
@ -477,7 +487,9 @@ void CalendarMgr::CopyEvent(uint64 eventId, time_t newTime, ObjectGuid const& gu
CALENDAR_MAX_INVITES, event->DungeonId, newTime, event->UnknownTime, event->Flags);
if (!newEvent)
{
return;
}
if (newEvent->IsGuildAnnouncement())
AddInvite(newEvent, guid, guid, CALENDAR_STATUS_CONFIRMED, CALENDAR_RANK_OWNER, "", time(NULL));
@ -686,7 +698,9 @@ bool CalendarMgr::CanAddEvent(ObjectGuid const& guid)
// count all event created by guid
for (CalendarEventStore::iterator itr = m_EventStore.begin(); itr != m_EventStore.end(); ++itr)
if ((itr->second.CreatorGuid == guid) && (++totalEvents >= CALENDAR_MAX_EVENTS))
{
return false;
}
return true;
}
@ -694,13 +708,17 @@ bool CalendarMgr::CanAddEvent(ObjectGuid const& guid)
bool CalendarMgr::CanAddGuildEvent(uint32 guildId)
{
if (!guildId)
{
return false;
}
uint32 totalEvents = 0;
// count all guild events in a guild
for (CalendarEventStore::iterator itr = m_EventStore.begin(); itr != m_EventStore.end(); ++itr)
if ((itr->second.GuildId == guildId) && (++totalEvents >= CALENDAR_MAX_GUILD_EVENTS))
{
return false;
}
return true;
}
@ -721,7 +739,9 @@ bool CalendarMgr::CanAddInviteTo(ObjectGuid const& guid)
while (ci_itr != cInvMap->end())
{
if ((ci_itr->second->InviteeGuid == guid) && (++totalInvites >= CALENDAR_MAX_INVITES))
{
return false;
}
++ci_itr;
}
}

View file

@ -277,7 +277,9 @@ bool Corpse::IsHostileTo(Unit const* unit) const
return owner->IsHostileTo(unit);
}
else
{ return false; }
{
return false;
}
}
bool Corpse::IsFriendlyTo(Unit const* unit) const
@ -287,7 +289,9 @@ bool Corpse::IsFriendlyTo(Unit const* unit) const
return owner->IsFriendlyTo(unit);
}
else
{ return true; }
{
return true;
}
}
bool Corpse::IsExpired(time_t t) const
@ -297,5 +301,7 @@ bool Corpse::IsExpired(time_t t) const
return m_time < t - 60 * MINUTE;
}
else
{ return m_time < t - 3 * DAY; }
{
return m_time < t - 3 * DAY;
}
}

View file

@ -143,7 +143,9 @@ void CreatureCreatePos::SelectFinalPoint(Creature* cr)
m_pos.z = m_closeObject->GetPositionZ();
}
else
{ m_closeObject->GetClosePoint(m_pos.x, m_pos.y, m_pos.z, cr->GetObjectBoundingRadius(), m_dist, m_angle); }
{
m_closeObject->GetClosePoint(m_pos.x, m_pos.y, m_pos.z, cr->GetObjectBoundingRadius(), m_dist, m_angle);
}
}
}
@ -638,7 +640,9 @@ void Creature::Update(uint32 update_diff, uint32 diff)
LoadCreatureAddon(true);
}
else
{ SetDeathState(JUST_ALIVED); }
{
SetDeathState(JUST_ALIVED);
}
// Call AI respawn virtual function
if (AI())
@ -679,7 +683,9 @@ void Creature::Update(uint32 update_diff, uint32 diff)
StopGroupLoot();
}
else
{ m_groupLootTimer -= update_diff; }
{
m_groupLootTimer -= update_diff;
}
}
break;
@ -767,7 +773,9 @@ void Creature::RegenerateAll(uint32 update_diff)
m_regenTimer = 0;
}
else
{ m_regenTimer -= update_diff; }
{
m_regenTimer -= update_diff;
}
}
if (m_regenTimer != 0)
{
@ -787,7 +795,9 @@ void Creature::RegenerateAll(uint32 update_diff)
void Creature::RegeneratePower()
{
if (!IsRegeneratingPower())
{
return;
}
Powers powerType = GetPowerType();
uint32 curValue = GetPower(powerType);
@ -877,10 +887,14 @@ void Creature::RegenerateHealth()
addvalue = uint32(Spirit * 0.25 * HealthIncreaseRate);
}
else
{ addvalue = uint32(Spirit * 0.80 * HealthIncreaseRate); }
{
addvalue = uint32(Spirit * 0.80 * HealthIncreaseRate);
}
}
else
{ addvalue = maxValue / 3; }
{
addvalue = maxValue / 3;
}
ModifyHealth(addvalue);
}
@ -1318,7 +1332,9 @@ void Creature::SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask)
}
}
else
{ displayId = 0; }
{
displayId = 0;
}
}
// data->guid = guid don't must be update at save
@ -1378,7 +1394,9 @@ void Creature::SelectLevel(uint32 forcedLevel /*= USE_DEFAULT_DATABASE_LEVEL*/)
{
CreatureInfo const* cinfo = GetCreatureInfo();
if (!cinfo)
{
return;
}
uint32 rank = IsPet() ? 0 : cinfo->Rank; // TODO :: IsPet probably not needed here
@ -1555,7 +1573,9 @@ void Creature::SelectLevel(const CreatureInfo* cinfo, float percentHealth /*= 10
SetHealth(health);
}
else
{ SetHealthPercent(percentHealth); }
{
SetHealthPercent(percentHealth);
}
SetModifierValue(UNIT_MOD_HEALTH, BASE_VALUE, float(health));
@ -1812,7 +1832,9 @@ void Creature::LoadEquipment(uint32 equip_entry, bool force)
EquipmentInfo const* einfo = sObjectMgr.GetEquipmentInfo(equip_entry);
if (!einfo)
{
return;
}
m_equipmentId = equip_entry;
for (uint8 i = 0; i < MAX_VIRTUAL_ITEM_SLOT; ++i)
@ -2060,7 +2082,9 @@ bool Creature::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectInd
{
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(index);
if (!spellEffect)
{
return false;
}
if (!castOnSelf && GetCreatureInfo()->MechanicImmuneMask & (1 << (spellEffect->EffectMechanic - 1)))
{
@ -2080,7 +2104,9 @@ bool Creature::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectInd
}
// Spell effect taunt check
else if (spellEffect->Effect == SPELL_EFFECT_ATTACK_ME)
{ return true; }
{
return true;
}
}
return Unit::IsImmuneToSpellEffect(spellInfo, index, castOnSelf);
@ -2090,7 +2116,9 @@ bool Creature::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectInd
void Creature::SetLootStatus(CreatureLootStatus status)
{
if (status <= m_lootStatus)
{
return;
}
m_lootStatus = status;
switch (status)
@ -2122,14 +2150,18 @@ bool Creature::IsTappedBy(Player* plr) const
if (Player* recipient = GetLootRecipient())
{
if (recipient == plr)
{
return true;
}
if (Group* grp = recipient->GetGroup())
{
if (Group* plrGroup = plr->GetGroup())
{
if (plrGroup == grp)
{
return true;
}
}
}
return false;
@ -2334,7 +2366,9 @@ void Creature::CallAssistance()
SetNoCallAssistance(true);
if (GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_NO_CALL_ASSIST)
{
return;
}
AI()->SendAIEventAround(AI_EVENT_CALL_ASSISTANCE, getVictim(), sWorld.getConfig(CONFIG_UINT32_CREATURE_FAMILY_ASSISTANCE_DELAY), sWorld.getConfig(CONFIG_FLOAT_CREATURE_FAMILY_ASSISTANCE_RADIUS));
}
@ -2507,7 +2541,9 @@ CreatureDataAddon const* Creature::GetCreatureAddon() const
{
// If CreatureTemplateAddon for difficulty_entry_N exist, it's there for a reason
if (CreatureDataAddon const* addon = ObjectMgr::GetCreatureTemplateAddon(GetCreatureInfo()->Entry))
{
return addon;
}
}
// Return CreatureTemplateAddon when nothing else exist
@ -2649,11 +2685,17 @@ bool Creature::MeetsSelectAttackingRequirement(Unit* pTarget, SpellEntry const*
return false;
}
else if (selectFlags & SELECT_FLAG_POWER_RAGE && pTarget->GetPowerType() != POWER_RAGE)
{ return false; }
{
return false;
}
else if (selectFlags & SELECT_FLAG_POWER_ENERGY && pTarget->GetPowerType() != POWER_ENERGY)
{ return false; }
{
return false;
}
else if (selectFlags & SELECT_FLAG_POWER_RUNIC && pTarget->GetPowerType() != POWER_RUNIC_POWER)
{ return false; }
{
return false;
}
if (selectFlags & SELECT_FLAG_IN_MELEE_RANGE && !CanReachWithMeleeAttack(pTarget))
{
@ -2844,9 +2886,13 @@ time_t Creature::GetRespawnTimeEx() const
return m_respawnTime;
}
else if (m_corpseDecayTimer > 0) // dead (corpse)
{
return now + m_respawnDelay + m_corpseDecayTimer / IN_MILLISECONDS;
}
else
{ return now; }
{
return now;
}
}
void Creature::GetRespawnCoord(float& x, float& y, float& z, float* ori, float* dist) const
@ -3051,7 +3097,9 @@ uint32 Creature::UpdateVendorItemCurrentCount(VendorItem const* vItem, uint32 us
vCount->count += diff * pProto->BuyCount;
}
else
{ vCount->count = vItem->maxcount; }
{
vCount->count = vItem->maxcount;
}
}
vCount->count = vCount->count > used_count ? vCount->count - used_count : 0;
@ -3258,7 +3306,9 @@ void Creature::SetWalk(bool enable, bool asDefault)
clearUnitState(UNIT_STAT_RUNNING);
}
else
{ addUnitState(UNIT_STAT_RUNNING); }
{
addUnitState(UNIT_STAT_RUNNING);
}
}
// Nothing changed?
@ -3272,7 +3322,9 @@ void Creature::SetWalk(bool enable, bool asDefault)
m_movementInfo.AddMovementFlag(MOVEFLAG_WALK_MODE);
}
else
{ m_movementInfo.RemoveMovementFlag(MOVEFLAG_WALK_MODE); }
{
m_movementInfo.RemoveMovementFlag(MOVEFLAG_WALK_MODE);
}
if (IsInWorld())
{
@ -3299,7 +3351,9 @@ void Creature::SetLevitate(bool enable)
m_movementInfo.AddMovementFlag(MOVEFLAG_LEVITATING);
}
else
{ m_movementInfo.RemoveMovementFlag(MOVEFLAG_LEVITATING); }
{
m_movementInfo.RemoveMovementFlag(MOVEFLAG_LEVITATING);
}
if (IsInWorld())
{
@ -3374,7 +3428,9 @@ void Creature::SetRoot(bool enable)
m_movementInfo.AddMovementFlag(MOVEFLAG_ROOT);
}
else
{ m_movementInfo.RemoveMovementFlag(MOVEFLAG_ROOT); }
{
m_movementInfo.RemoveMovementFlag(MOVEFLAG_ROOT);
}
if (IsInWorld())
{

View file

@ -170,9 +170,13 @@ struct CreatureInfo
return SKILL_HERBALISM;
}
else if (CreatureTypeFlags & CREATURE_TYPEFLAGS_MININGLOOT)
{ return SKILL_MINING; }
{
return SKILL_MINING;
}
else if (CreatureTypeFlags & CREATURE_TYPEFLAGS_ENGINEERLOOT)
{
return SKILL_ENGINEERING;
}
else
{ return SKILL_SKINNING; } // normal case
}
@ -185,7 +189,9 @@ struct CreatureInfo
bool isTameable(bool exotic) const
{
if (CreatureType != CREATURE_TYPE_BEAST || Family == 0 || (CreatureTypeFlags & CREATURE_TYPEFLAGS_TAMEABLE) == 0)
{
return false;
}
// if can tame exotic then can tame any temable
return exotic || !IsExotic();
@ -798,7 +804,9 @@ class Creature : public Unit
return 0;
}
else
{ return m_charmInfo->GetCharmSpell(pos)->GetAction(); }
{
return m_charmInfo->GetCharmSpell(pos)->GetAction();
}
}
void SetCombatStartPosition(float x, float y, float z) { m_combatStartX = x; m_combatStartY = y; m_combatStartZ = z; }

View file

@ -73,7 +73,9 @@ CanCastResult CreatureAI::CanCastSpell(Unit* pTarget, const SpellEntry* pSpell,
}
if (!pSpell->HasAttribute(SPELL_ATTR_EX2_IGNORE_LOS) && !m_creature->IsWithinLOSInMap(pTarget) && m_creature != pTarget)
{
return CAST_FAIL_NOT_IN_LOS;
}
}
if (const SpellRangeEntry* pSpellRange = sSpellRangeStore.LookupEntry(pSpell->rangeIndex))
@ -99,7 +101,9 @@ CanCastResult CreatureAI::CanCastSpell(Unit* pTarget, const SpellEntry* pSpell,
return CAST_OK;
}
else
{ return CAST_FAIL_OTHER; }
{
return CAST_FAIL_OTHER;
}
}
CanCastResult CreatureAI::DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32 uiCastFlags, ObjectGuid uiOriginalCasterGUID)
@ -162,7 +166,9 @@ CanCastResult CreatureAI::DoCastSpellIfCan(Unit* pTarget, uint32 uiSpell, uint32
}
}
else
{ return CAST_FAIL_IS_CASTING; }
{
return CAST_FAIL_IS_CASTING;
}
}
bool CreatureAI::DoMeleeAttackIfReady()
@ -179,7 +185,9 @@ void CreatureAI::SetCombatMovement(bool enable, bool stopOrStartMovement /*=fals
m_creature->clearUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT);
}
else
{ m_creature->addUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT); }
{
m_creature->addUnitState(UNIT_STAT_NO_COMBAT_MOVEMENT);
}
if (stopOrStartMovement && m_creature->getVictim()) // Only change current movement while in combat
{
@ -188,7 +196,9 @@ void CreatureAI::SetCombatMovement(bool enable, bool stopOrStartMovement /*=fals
m_creature->GetMotionMaster()->MoveChase(m_creature->getVictim(), m_attackDistance, m_attackAngle);
}
else if (!enable && m_creature->GetMotionMaster()->GetCurrentMovementGeneratorType() == CHASE_MOTION_TYPE)
{ m_creature->StopMoving(); }
{
m_creature->StopMoving();
}
}
}

View file

@ -44,7 +44,9 @@ namespace FactorySelector
{
// charmed creature may have some script even if its not supposed to be that way (ex: Eye of Acherus)
if (creature->IsCharmed())
{
return scriptedAI;
}
// Allow scripting AI for normal creatures and not controlled pets (guardians and mini-pets)
if (!creature->IsPet() || !static_cast<Pet*>(creature)->isControlled())
@ -71,7 +73,9 @@ namespace FactorySelector
}
}
else if (creature->IsTotem())
{ ai_factory = ai_registry.GetRegistryItem("TotemAI"); }
{
ai_factory = ai_registry.GetRegistryItem("TotemAI");
}
// select by script name
if (!ai_factory && !ainame.empty())

View file

@ -44,7 +44,9 @@ bool CreatureEventAIHolder::UpdateRepeatTimer(Creature* creature, uint32 repeatM
Time = repeatMin;
}
else if (repeatMax > repeatMin)
{ Time = urand(repeatMin, repeatMax); }
{
Time = urand(repeatMin, repeatMax);
}
else
{
sLog.outErrorEventAI("Creature %u using Event %u (Type = %u) has RandomMax < RandomMin. Event repeating disabled.", creature->GetEntry(), Event.event_id, Event.event_type);
@ -83,9 +85,13 @@ void CreatureEventAI::GetAIInformation(ChatHandler& reader)
reader.PSendSysMessage("%u Type%3u (%s) Timer(%3us) actions[type(param1)]: %2u(%5u) -- %2u(%u) -- %2u(%5u)", itr->Event.event_id, itr->Event.event_type, itr->Enabled ? "On" : "Off", itr->Time / 1000, itr->Event.action[0].type, itr->Event.action[0].raw.param1, itr->Event.action[1].type, itr->Event.action[1].raw.param1, itr->Event.action[2].type, itr->Event.action[2].raw.param1);
}
else if (itr->Event.action[1].type != ACTION_T_NONE)
{ reader.PSendSysMessage("%u Type%3u (%s) Timer(%3us) actions[type(param1)]: %2u(%5u) -- %2u(%5u)", itr->Event.event_id, itr->Event.event_type, itr->Enabled ? "On" : "Off", itr->Time / 1000, itr->Event.action[0].type, itr->Event.action[0].raw.param1, itr->Event.action[1].type, itr->Event.action[1].raw.param1); }
{
reader.PSendSysMessage("%u Type%3u (%s) Timer(%3us) actions[type(param1)]: %2u(%5u) -- %2u(%5u)", itr->Event.event_id, itr->Event.event_type, itr->Enabled ? "On" : "Off", itr->Time / 1000, itr->Event.action[0].type, itr->Event.action[0].raw.param1, itr->Event.action[1].type, itr->Event.action[1].raw.param1);
}
else
{ reader.PSendSysMessage("%u Type%3u (%s) Timer(%3us) action[type(param1)]: %2u(%5u)", itr->Event.event_id, itr->Event.event_type, itr->Enabled ? "On" : "Off", itr->Time / 1000, itr->Event.action[0].type, itr->Event.action[0].raw.param1); }
{
reader.PSendSysMessage("%u Type%3u (%s) Timer(%3us) action[type(param1)]: %2u(%5u)", itr->Event.event_id, itr->Event.event_type, itr->Enabled ? "On" : "Off", itr->Time / 1000, itr->Event.action[0].type, itr->Event.action[0].raw.param1);
}
}
}
@ -130,7 +136,9 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c),
}
}
else if (IsEventFlagsFitForNormalMap(i->event_flags))
{ ++events_count; }
{
++events_count;
}
}
// EventMap had events but they were not added because they must be for instance
if (events_count == 0)
@ -158,7 +166,9 @@ CreatureEventAI::CreatureEventAI(Creature* c) : CreatureAI(c),
}
}
else if (IsEventFlagsFitForNormalMap(i->event_flags))
{ storeEvent = true; }
{
storeEvent = true;
}
if (storeEvent)
{
@ -313,11 +323,15 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
break;
case EVENT_T_RANGE:
if (!m_creature->IsInCombat() || !m_creature->getVictim() || !m_creature->IsInMap(m_creature->getVictim()))
{
return false;
}
// DISCUSS TODO - Likely replace IsInRange check with CombatReach checks (as used rather for such checks)
if (!m_creature->IsInRange(m_creature->getVictim(), (float)event.range.minDist, (float)event.range.maxDist))
{
return false;
}
// Repeat Timers
pHolder.UpdateRepeatTimer(m_creature, event.range.repeatMin, event.range.repeatMax);
@ -645,9 +659,13 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
textId = action.text.TextId[rnd % 3];
}
else if (action.text.TextId[1] && (rnd % 2))
{ textId = action.text.TextId[1]; }
{
textId = action.text.TextId[1];
}
else
{ textId = action.text.TextId[0]; }
{
textId = action.text.TextId[0];
}
}
// ACTION_T_CHANCED_TEXT, chance hits
else if ((rnd % 100) < action.chanced_text.chance)
@ -657,7 +675,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
textId = action.chanced_text.TextId[rnd % 2];
}
else
{ textId = action.chanced_text.TextId[0]; }
{
textId = action.chanced_text.TextId[0];
}
}
if (textId)
@ -702,7 +722,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
m_creature->SetFactionTemporary(action.set_faction.factionId, action.set_faction.factionFlags);
}
else // no id provided, assume reset and then use default
{ m_creature->ClearTemporaryFaction(); }
{
m_creature->ClearTemporaryFaction();
}
break;
}
@ -721,10 +743,14 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
// if no param1, then use value from param2 (modelId)
else
{ m_creature->SetDisplayId(action.morph.modelId); }
{
m_creature->SetDisplayId(action.morph.modelId);
}
}
else
{ m_creature->DeMorph(); }
{
m_creature->DeMorph();
}
break;
}
case ACTION_T_SOUND: //4
@ -842,14 +868,18 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, action.summon.duration);
}
else
{ pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OOC_DESPAWN, 0); }
{
pCreature = m_creature->SummonCreature(action.summon.creatureId, 0.0f, 0.0f, 0.0f, 0.0f, TEMPSUMMON_TIMED_OOC_DESPAWN, 0);
}
if (!pCreature)
{
sLog.outErrorEventAI("failed to spawn creature %u. Spawn event %d is on creature %d", action.summon.creatureId, EventId, m_creature->GetEntry());
}
else if (action.summon.target != TARGET_T_SELF && target)
{ pCreature->AI()->AttackStart(target); }
{
pCreature->AI()->AttackStart(target);
}
break;
}
case ACTION_T_THREAT_SINGLE_PCT: //13
@ -858,7 +888,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
m_creature->GetThreatManager().modifyThreatPercent(target, action.threat_single_pct.percent);
}
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_THREAT_SINGLE_PCT(%u), target-type %u", EventId, action.type, action.threat_single_pct.target); }
{
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_THREAT_SINGLE_PCT(%u), target-type %u", EventId, action.type, action.threat_single_pct.target);
}
break;
case ACTION_T_THREAT_ALL_PCT: //14
{
@ -879,7 +911,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
}
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_QUEST_EVENT(%u), target-type %u", EventId, action.type, action.quest_event.target); }
{
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_QUEST_EVENT(%u), target-type %u", EventId, action.type, action.quest_event.target);
}
break;
case ACTION_T_CAST_EVENT: //16
if (Unit* target = GetTargetByType(action.cast_event.target, pActionInvoker, pAIEventSender, reportTargetError, 0, SELECT_FLAG_PLAYER))
@ -890,7 +924,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
}
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_CST_EVENT(%u), target-type %u", EventId, action.type, action.cast_event.target); }
{
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_CST_EVENT(%u), target-type %u", EventId, action.type, action.cast_event.target);
}
break;
case ACTION_T_SET_UNIT_FIELD: //17
{
@ -903,7 +939,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SET_UNIT_FIELD(%u), target-type %u", EventId, action.type, action.set_unit_field.target); }
{
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SET_UNIT_FIELD(%u), target-type %u", EventId, action.type, action.set_unit_field.target);
}
break;
}
@ -913,7 +951,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
target->SetFlag(UNIT_FIELD_FLAGS, action.unit_flag.value);
}
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SET_UNIT_FLAG(%u), target-type %u", EventId, action.type, action.unit_flag.target); }
{
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_SET_UNIT_FLAG(%u), target-type %u", EventId, action.type, action.unit_flag.target);
}
break;
case ACTION_T_REMOVE_UNIT_FLAG: //19
if (Unit* target = GetTargetByType(action.unit_flag.target, pActionInvoker, pAIEventSender, reportTargetError))
@ -921,7 +961,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
target->RemoveFlag(UNIT_FIELD_FLAGS, action.unit_flag.value);
}
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVE_UNIT_FLAG(%u), target-type %u", EventId, action.type, action.unit_flag.target); }
{
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVE_UNIT_FLAG(%u), target-type %u", EventId, action.type, action.unit_flag.target);
}
case ACTION_T_AUTO_ATTACK: //20
m_MeleeEnabled = action.auto_attack.state != 0;
break;
@ -939,7 +981,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
m_creature->SendMeleeAttackStart(m_creature->getVictim());
}
else if (action.combat_movement.melee && m_creature->IsInCombat() && m_creature->getVictim())
{ m_creature->SendMeleeAttackStop(m_creature->getVictim()); }
{
m_creature->SendMeleeAttackStop(m_creature->getVictim());
}
break;
case ACTION_T_SET_PHASE: //22
m_Phase = action.set_phase.phase;
@ -959,7 +1003,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
m_Phase = MAX_PHASE - 1;
}
else
{ m_Phase = new_phase; }
{
m_Phase = new_phase;
}
DEBUG_FILTER_LOG(LOG_FILTER_EVENT_AI_DEV, "CreatureEventAI: ACTION_T_INC_PHASE - script %u for %s, phase is now %u", EventId, m_creature->GetGuidStr().c_str(), m_Phase);
break;
@ -979,7 +1025,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
temp->GroupEventHappens(action.quest_event_all.questId, m_creature);
}
else if (pActionInvoker && pActionInvoker->GetTypeId() == TYPEID_PLAYER)
{ ((Player*)pActionInvoker)->GroupEventHappens(action.quest_event_all.questId, m_creature); }
{
((Player*)pActionInvoker)->GroupEventHappens(action.quest_event_all.questId, m_creature);
}
break;
case ACTION_T_CAST_EVENT_ALL: //27
{
@ -997,7 +1045,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
target->RemoveAurasDueToSpell(action.remove_aura.spellId);
}
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVEAURASFROMSPELL(%u), target-type %u", EventId, action.type, action.remove_aura.target); }
{
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_REMOVEAURASFROMSPELL(%u), target-type %u", EventId, action.type, action.remove_aura.target);
}
break;
case ACTION_T_RANGED_MOVEMENT: //29
m_attackDistance = (float)action.ranged_movement.distance;
@ -1023,7 +1073,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
m_Phase = action.random_phase_range.phaseMin + (rnd % (action.random_phase_range.phaseMax - action.random_phase_range.phaseMin));
}
else
{ sLog.outErrorEventAI("ACTION_T_RANDOM_PHASE_RANGE can not have Param2 <= Param1. Divide by Zero. Event = %d. CreatureEntry = %d", EventId, m_creature->GetEntry()); }
{
sLog.outErrorEventAI("ACTION_T_RANDOM_PHASE_RANGE can not have Param2 <= Param1. Divide by Zero. Event = %d. CreatureEntry = %d", EventId, m_creature->GetEntry());
}
break;
case ACTION_T_SUMMON_ID: //32
{
@ -1046,14 +1098,18 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
pCreature = m_creature->SummonCreature(action.summon_id.creatureId, i->second.position_x, i->second.position_y, i->second.position_z, i->second.orientation, TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN, i->second.SpawnTimeSecs);
}
else
{ pCreature = m_creature->SummonCreature(action.summon_id.creatureId, i->second.position_x, i->second.position_y, i->second.position_z, i->second.orientation, TEMPSUMMON_TIMED_OOC_DESPAWN, 0); }
{
pCreature = m_creature->SummonCreature(action.summon_id.creatureId, i->second.position_x, i->second.position_y, i->second.position_z, i->second.orientation, TEMPSUMMON_TIMED_OOC_DESPAWN, 0);
}
if (!pCreature)
{
sLog.outErrorEventAI("failed to spawn creature %u. EventId %d.Creature %d", action.summon_id.creatureId, EventId, m_creature->GetEntry());
}
else if (action.summon_id.target != TARGET_T_SELF && target)
{ pCreature->AI()->AttackStart(target); }
{
pCreature->AI()->AttackStart(target);
}
break;
}
@ -1074,7 +1130,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
}
else if (reportTargetError)
{ sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_KILLED_MONSTER(%u), target-type %u", EventId, action.type, action.killed_monster.target); }
{
sLog.outErrorEventAI("Event %u - NULL target for ACTION_T_KILLED_MONSTER(%u), target-type %u", EventId, action.type, action.killed_monster.target);
}
}
break;
case ACTION_T_SET_INST_DATA: //34
@ -1155,7 +1213,9 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
m_InvinceabilityHpLevel = m_creature->GetMaxHealth() * action.invincibility_hp_level.hp_level / 100;
}
else
{ m_InvinceabilityHpLevel = action.invincibility_hp_level.hp_level; }
{
m_InvinceabilityHpLevel = action.invincibility_hp_level.hp_level;
}
break;
}
case ACTION_T_MOUNT_TO_ENTRY_OR_MODEL: //43
@ -1173,10 +1233,14 @@ void CreatureEventAI::ProcessAction(CreatureEventAI_Action const& action, uint32
}
// if no param1, then use value from param2 (modelId)
else
{ m_creature->Mount(action.mount.modelId); }
{
m_creature->Mount(action.mount.modelId);
}
}
else
{ m_creature->Unmount(); }
{
m_creature->Unmount();
}
break;
}
@ -1242,7 +1306,9 @@ void CreatureEventAI::JustRespawned() // NOTE that this is
}
// Handle Spawned Events
else if (SpawnedEventConditionsCheck((*i).Event))
{ ProcessEvent(*i); }
{
ProcessEvent(*i);
}
}
}
@ -1763,7 +1829,9 @@ void CreatureEventAI::DamageTaken(Unit* dealer, uint32& damage)
damage = 0;
}
else
{ damage = m_creature->GetHealth() - m_InvinceabilityHpLevel; }
{
damage = m_creature->GetHealth() - m_InvinceabilityHpLevel;
}
}
uint32 step = m_throwAIEventStep != 100 ? m_throwAIEventStep : 0;

View file

@ -598,7 +598,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
sLog.outErrorEventAI("Event %u Action %u has not set chance param1. Text will not be displayed", i, j + 1);
}
else if (action.chanced_text.chance >= 100)
{ sLog.outErrorEventAI("Event %u Action %u has set chance param1 >= 100. Text will always be displayed", i, j + 1); }
{
sLog.outErrorEventAI("Event %u Action %u has set chance param1 >= 100. Text will always be displayed", i, j + 1);
}
// no break here to check texts
case ACTION_T_TEXT:
{
@ -629,7 +631,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
action.text.TextId[k] = 0;
}
else
{ usedTextIds.insert(action.text.TextId[k]); }
{
usedTextIds.insert(action.text.TextId[k]);
}
}
}
break;
@ -786,7 +790,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
}
}
else
{ sLog.outErrorEventAI("Event %u Action %u uses nonexistent Quest entry %u.", i, j + 1, action.quest_event.questId); }
{
sLog.outErrorEventAI("Event %u Action %u uses nonexistent Quest entry %u.", i, j + 1, action.quest_event.questId);
}
IsValidTargetType(temp.event_type, action.type, action.quest_event.target, i, j + 1);
break;
@ -824,7 +830,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
sLog.outErrorEventAI("Event %u Action %u is incrementing phase by 0. Was this intended?", i, j + 1);
}
else if (std::abs(action.set_inc_phase.step) > MAX_PHASE - 1)
{ sLog.outErrorEventAI("Event %u Action %u is change phase by too large for any use %i.", i, j + 1, action.set_inc_phase.step); }
{
sLog.outErrorEventAI("Event %u Action %u is change phase by too large for any use %i.", i, j + 1, action.set_inc_phase.step);
}
break;
case ACTION_T_QUEST_EVENT_ALL:
if (Quest const* qid = sObjectMgr.GetQuestTemplate(action.quest_event_all.questId))
@ -835,7 +843,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
}
}
else
{ sLog.outErrorEventAI("Event %u Action %u uses nonexistent Quest entry %u.", i, j + 1, action.quest_event_all.questId); }
{
sLog.outErrorEventAI("Event %u Action %u uses nonexistent Quest entry %u.", i, j + 1, action.quest_event_all.questId);
}
break;
case ACTION_T_CAST_EVENT_ALL:
if (!sCreatureStorage.LookupEntry<CreatureInfo>(action.cast_event_all.creatureId))
@ -1047,7 +1057,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts()
sLog.outErrorEventAI("EventAI not has script for creature entry (%u), but AIName = '%s'.", i, cInfo->AIName);
}
else if (!ainame && hasevent)
{ sLog.outErrorEventAI("EventAI has script for creature entry (%u), but AIName = '%s' instead 'EventAI'.", i, cInfo->AIName); }
{
sLog.outErrorEventAI("EventAI has script for creature entry (%u), but AIName = '%s' instead 'EventAI'.", i, cInfo->AIName);
}
}
}

View file

@ -140,7 +140,9 @@ void DynamicObject::Update(uint32 /*update_diff*/, uint32 p_time)
m_aliveDuration -= p_time;
}
else
{ deleteThis = true; }
{
deleteThis = true;
}
// have radius and work as persistent effect
if (m_radius)
@ -201,7 +203,9 @@ void DynamicObject::Delay(int32 delaytime)
++iter;
}
else
{ m_affected.erase(iter++); }
{
m_affected.erase(iter++);
}
}
}
@ -229,7 +233,9 @@ bool DynamicObject::IsHostileTo(Unit const* unit) const
return owner->IsHostileTo(unit);
}
else
{ return false; }
{
return false;
}
}
bool DynamicObject::IsFriendlyTo(Unit const* unit) const
@ -239,5 +245,7 @@ bool DynamicObject::IsFriendlyTo(Unit const* unit) const
return owner->IsFriendlyTo(unit);
}
else
{ return true; }
{
return true;
}
}

View file

@ -49,11 +49,17 @@ namespace MaNGOS
return 0;
}
else if (pl_level <= 39)
{ return pl_level - 5 - pl_level / 10; }
{
return pl_level - 5 - pl_level / 10;
}
else if (pl_level <= 59)
{
return pl_level - 1 - pl_level / 5;
}
else
{
return pl_level - 9;
}
}
inline XPColorChar GetColorCode(uint32 pl_level, uint32 mob_level)
@ -63,13 +69,21 @@ namespace MaNGOS
return RED;
}
else if (mob_level >= pl_level + 3)
{ return ORANGE; }
{
return ORANGE;
}
else if (mob_level >= pl_level - 2)
{ return YELLOW; }
{
return YELLOW;
}
else if (mob_level > GetGrayLevel(pl_level))
{ return GREEN; }
{
return GREEN;
}
else
{ return GRAY; }
{
return GRAY;
}
}
inline uint32 GetZeroDifference(uint32 pl_level)

View file

@ -253,7 +253,9 @@ bool GameObject::Create(uint32 guidlow, uint32 name_id, Map* map, uint32 phaseMa
((BattleGroundMap*)map)->GetBG()->HandleGameObjectCreate(this);
}
else if (OutdoorPvP* outdoorPvP = sOutdoorPvPMgr.GetScript(GetZoneId()))
{ outdoorPvP->HandleGameObjectCreate(this); }
{
outdoorPvP->HandleGameObjectCreate(this);
}
// Notify the map's instance data.
// Only works if you create the object in it, not if it is moves to that map.
@ -539,7 +541,9 @@ void GameObject::Update(uint32 update_diff, uint32 p_time)
SetUInt32Value(GAMEOBJECT_FLAGS, (GetGOInfo()->flags & ~(GO_FLAG_LOCKED | GO_FLAG_INTERACT_COND | GO_FLAG_NO_INTERACT)) | currentLockOrInteractFlags);
}
else
{ SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags); }
{
SetUInt32Value(GAMEOBJECT_FLAGS, GetGOInfo()->flags);
}
}
loot.clear();
@ -615,7 +619,9 @@ void GameObject::Delete()
sPoolMgr.UpdatePool<GameObject>(*GetMap()->GetPersistentState(), poolid, GetGUIDLow());
}
else
{ AddObjectToRemoveList(); }
{
AddObjectToRemoveList();
}
}
void GameObject::SaveToDB()
@ -845,7 +851,9 @@ bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoi
// invisible at client always
if (!GetGOInfo()->displayId)
{
return false;
}
// Transport always visible at this step implementation
if (IsTransport() && IsInMap(u))
@ -881,14 +889,18 @@ bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoi
else
{
if (u->IsFriendlyTo(owner))
{
return true;
}
}
}
// handle environment traps (spawned by DB)
else
{
if (this->IsFriendlyTo(u))
{
return true;
}
else
trapNotVisible = true;
}
@ -897,11 +909,15 @@ bool GameObject::isVisibleForInState(Player const* u, WorldObject const* viewPoi
if (Aura* aura = ((Player*)u)->GetAura(2836, EFFECT_INDEX_0))
{
if (roll_chance_i(aura->GetModifier()->m_amount) && u->IsInFront(this, 15.0f))
{
return true;
}
}
if (trapNotVisible)
{
return false;
}
}
}
@ -1156,14 +1172,18 @@ void GameObject::SwitchDoorOrButton(bool activate, bool alternative /* = false *
SetFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
}
else
{ RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE); }
{
RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_IN_USE);
}
if (GetGoState() == GO_STATE_READY) // if closed -> open
{
SetGoState(alternative ? GO_STATE_ACTIVE_ALTERNATIVE : GO_STATE_ACTIVE);
}
else // if open -> close
{ SetGoState(GO_STATE_READY); }
{
SetGoState(GO_STATE_READY);
}
}
void GameObject::Use(Unit* user)
@ -1412,7 +1432,9 @@ void GameObject::Use(Unit* user)
SendGameObjectCustomAnim(GetObjectGuid());
}
else
{ SetGoState(GO_STATE_ACTIVE); }
{
SetGoState(GO_STATE_ACTIVE);
}
m_cooldownTime = time(NULL) + info->GetAutoCloseTime();
@ -1460,7 +1482,9 @@ void GameObject::Use(Unit* user)
GetMap()->ScriptsStart(DBS_ON_GO_USE, GetGUIDLow(), spellCaster, this);
}
else
{ return; }
{
return;
}
// cast this spell later if provided
spellId = info->goober.spellId;
@ -1587,7 +1611,9 @@ void GameObject::Use(Unit* user)
SetLootState(GO_JUST_DEACTIVATED);
}
else
{ player->SendLoot(GetObjectGuid(), success ? LOOT_FISHING : LOOT_FISHING_FAIL); }
{
player->SendLoot(GetObjectGuid(), success ? LOOT_FISHING : LOOT_FISHING_FAIL);
}
}
else
{
@ -1661,7 +1687,9 @@ void GameObject::Use(Unit* user)
}
}
else
{ return; }
{
return;
}
}
spellCaster = player;
@ -1712,7 +1740,9 @@ void GameObject::Use(Unit* user)
}
// reset ritual for this GO
else
{ ClearAllUsesData(); }
{
ClearAllUsesData();
}
// go to end function to spell casting
break;
@ -1879,10 +1909,14 @@ void GameObject::Use(Unit* user)
{
GameObjectInfo const* info = GetGOInfo();
if (!info)
{
return;
}
if (user->GetTypeId() != TYPEID_PLAYER)
{
return;
}
Player* player = (Player*)user;
@ -2379,13 +2413,21 @@ void GameObject::SetCapturePointSlider(float value, bool isLocked)
m_captureState = CAPTURE_STATE_WIN_ALLIANCE;
}
else if ((int)m_captureSlider == CAPTURE_SLIDER_HORDE)
{ m_captureState = CAPTURE_STATE_WIN_HORDE; }
{
m_captureState = CAPTURE_STATE_WIN_HORDE;
}
else if (m_captureSlider > CAPTURE_SLIDER_MIDDLE + info->capturePoint.neutralPercent * 0.5f)
{ m_captureState = CAPTURE_STATE_PROGRESS_ALLIANCE; }
{
m_captureState = CAPTURE_STATE_PROGRESS_ALLIANCE;
}
else if (m_captureSlider < CAPTURE_SLIDER_MIDDLE - info->capturePoint.neutralPercent * 0.5f)
{ m_captureState = CAPTURE_STATE_PROGRESS_HORDE; }
{
m_captureState = CAPTURE_STATE_PROGRESS_HORDE;
}
else
{ m_captureState = CAPTURE_STATE_NEUTRAL; }
{
m_captureState = CAPTURE_STATE_NEUTRAL;
}
}
void GameObject::TickCapturePoint()
@ -2413,7 +2455,9 @@ void GameObject::TickCapturePoint()
++rangePlayers;
}
else
{ --rangePlayers; }
{
--rangePlayers;
}
ObjectGuid guid = (*itr)->GetObjectGuid();
if (!tempUsers.erase(guid))
@ -2462,7 +2506,9 @@ void GameObject::TickCapturePoint()
rangePlayers = maxSuperiority;
}
else if (rangePlayers < -maxSuperiority)
{ rangePlayers = -maxSuperiority; }
{
rangePlayers = -maxSuperiority;
}
// time to capture from 0% to 100% is maxTime for minSuperiority amount of players and minTime for maxSuperiority amount of players (linear function: y = dy/dx*x+d)
float deltaSlider = info->capturePoint.minTime;
@ -2597,7 +2643,9 @@ void GameObject::DealGameObjectDamage(uint32 damage, uint32 spell, Unit* caster)
MANGOS_ASSERT(spell && sSpellStore.LookupEntry(spell) && caster);
if (!damage)
{
return;
}
ForceGameObjectHealth(-int32(damage), caster);

View file

@ -694,7 +694,9 @@ class GameObject : public WorldObject
return m_respawnTime;
}
else
{ return now; }
{
return now;
}
}
void SetRespawnTime(time_t respawn)

View file

@ -350,7 +350,9 @@ bool Guild::CheckGuildStructure()
{ return false; } // guild will disbanded and deleted in caller
}
else if (GM_rights != GR_GUILDMASTER)
{ SetLeader(m_LeaderGuid); }
{
SetLeader(m_LeaderGuid);
}
// Allow only 1 guildmaster, set other to officer
for (MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
@ -825,7 +827,9 @@ void Guild::AddRank(const std::string& name_, uint32 rights, uint32 money)
void Guild::DelRank(uint32 rankId)
{
if (rankId >= m_Ranks.size())
{
return;
}
// client won't allow to have less than GUILD_RANKS_MIN_COUNT ranks in guild
if (m_Ranks.size() <= GUILD_RANKS_MIN_COUNT || rankId < GUILD_RANKS_MIN_COUNT)
@ -846,10 +850,14 @@ void Guild::DelRank(uint32 rankId)
void Guild::SwitchRank(uint32 rankId, bool up)
{
if (rankId >= m_Ranks.size())
{
return;
}
if ((rankId == GR_GUILDMASTER && up) || (rankId == GetLowestRank() && !up))
{
return;
}
uint32 otherRankId = rankId + (up ? -1 : 1);
DEBUG_LOG("rank: %u otherrank %u", rankId, otherRankId);
@ -1048,7 +1056,9 @@ void Guild::Roster(WorldSession* session /*= NULL*/)
session->SendPacket(&data);
}
else
{ BroadcastPacket(&data); }
{
BroadcastPacket(&data);
}
DEBUG_LOG("WORLD: Sent (SMSG_GUILD_ROSTER)");
}
@ -1254,12 +1264,16 @@ void Guild::LogGuildEvent(uint8 EventType, ObjectGuid playerGuid1, ObjectGuid pl
void Guild::DisplayGuildBankContent(WorldSession* session, uint8 TabId)
{
if (TabId >= GetPurchasedTabs())
{
return;
}
GuildBankTab const* tab = m_TabListMap[TabId];
if (!IsMemberHaveRights(session->GetPlayer()->GetGUIDLow(), TabId, GUILD_BANK_RIGHT_VIEW_TAB))
{
return;
}
WorldPacket data(SMSG_GUILD_BANK_LIST, 1200);
ByteBuffer buffer;
@ -1395,7 +1409,9 @@ void Guild::DisplayGuildBankContentUpdate(uint8 TabId, GuildItemPosCountVec cons
Item* Guild::GetItem(uint8 TabId, uint8 SlotId)
{
if (TabId >= GetPurchasedTabs() || SlotId >= GUILD_BANK_MAX_SLOTS)
{
return NULL;
}
return m_TabListMap[TabId]->Slots[SlotId];
}
@ -1436,7 +1452,9 @@ void Guild::DisplayGuildBankTabsInfo(WorldSession* session)
void Guild::CreateNewBankTab()
{
if (GetPurchasedTabs() >= GUILD_BANK_MAX_TABS)
{
return;
}
uint32 tabId = GetPurchasedTabs(); // next free id
m_TabListMap.push_back(new GuildBankTab);
@ -1450,7 +1468,9 @@ void Guild::CreateNewBankTab()
void Guild::SetGuildBankTabInfo(uint8 TabId, std::string Name, std::string Icon)
{
if (m_TabListMap[TabId]->Name == Name && m_TabListMap[TabId]->Icon == Icon)
{
return;
}
m_TabListMap[TabId]->Name = Name;
m_TabListMap[TabId]->Icon = Icon;
@ -1463,7 +1483,9 @@ void Guild::SetGuildBankTabInfo(uint8 TabId, std::string Name, std::string Icon)
uint32 Guild::GetBankRights(uint32 rankId, uint8 TabId) const
{
if (rankId >= m_Ranks.size() || TabId >= GUILD_BANK_MAX_TABS)
{
return 0;
}
return m_Ranks[rankId].TabRight[TabId];
}
@ -1508,7 +1530,9 @@ void Guild::LoadGuildBankFromDB()
// 0 1 2 3 4 5
result = CharacterDatabase.PQuery("SELECT data, text, TabId, SlotId, item_guid, item_entry FROM guild_bank_item JOIN item_instance ON item_guid = guid WHERE guildid='%u' ORDER BY TabId", m_Id);
if (!result)
{
return;
}
do
{
@ -1571,7 +1595,9 @@ bool Guild::MemberMoneyWithdraw(uint64 amount, uint32 LowGuid)
uint64 MoneyWithDrawRight = GetMemberMoneyWithdrawRem(LowGuid);
if (MoneyWithDrawRight < amount || GetGuildBankMoney() < amount)
{
return false;
}
SetBankMoney(GetGuildBankMoney() - amount);
@ -1579,7 +1605,9 @@ bool Guild::MemberMoneyWithdraw(uint64 amount, uint32 LowGuid)
{
MemberList::iterator itr = members.find(LowGuid);
if (itr == members.end())
{
return false;
}
itr->second.BankRemMoney -= amount;
CharacterDatabase.PExecute("UPDATE guild_member SET BankRemMoney='%u' WHERE guildid='%u' AND guid='%u'",
itr->second.BankRemMoney, m_Id, LowGuid);
@ -1610,13 +1638,17 @@ bool Guild::MemberItemWithdraw(uint8 TabId, uint32 LowGuid)
uint32 SlotsWithDrawRight = GetMemberSlotWithdrawRem(LowGuid, TabId);
if (SlotsWithDrawRight == 0)
{
return false;
}
if (SlotsWithDrawRight < WITHDRAW_SLOT_UNLIMITED)
{
MemberList::iterator itr = members.find(LowGuid);
if (itr == members.end())
{
return false;
}
--itr->second.BankRemSlotsTab[TabId];
CharacterDatabase.PExecute("UPDATE guild_member SET BankRemSlotsTab%u='%u' WHERE guildid='%u' AND guid='%u'",
uint32(TabId), itr->second.BankRemSlotsTab[TabId], m_Id, LowGuid);
@ -1628,10 +1660,14 @@ bool Guild::IsMemberHaveRights(uint32 LowGuid, uint8 TabId, uint32 rights) const
{
MemberList::const_iterator itr = members.find(LowGuid);
if (itr == members.end())
{
return false;
}
if (itr->second.RankId == GR_GUILDMASTER)
{
return true;
}
return (GetBankRights(itr->second.RankId, TabId) & rights) == rights;
}
@ -1640,14 +1676,20 @@ uint32 Guild::GetMemberSlotWithdrawRem(uint32 LowGuid, uint8 TabId)
{
MemberList::iterator itr = members.find(LowGuid);
if (itr == members.end())
{
return 0;
}
MemberSlot& member = itr->second;
if (member.RankId == GR_GUILDMASTER)
{
return WITHDRAW_SLOT_UNLIMITED;
}
if ((GetBankRights(member.RankId, TabId) & GUILD_BANK_RIGHT_VIEW_TAB) != GUILD_BANK_RIGHT_VIEW_TAB)
{
return 0;
}
uint32 curTime = uint32(time(NULL) / MINUTE);
if (curTime - member.BankResetTimeTab[TabId] >= 24 * HOUR / MINUTE)
@ -1664,11 +1706,15 @@ uint64 Guild::GetMemberMoneyWithdrawRem(uint32 LowGuid)
{
MemberList::iterator itr = members.find(LowGuid);
if (itr == members.end())
{
return 0;
}
MemberSlot& member = itr->second;
if (member.RankId == GR_GUILDMASTER)
{
return WITHDRAW_MONEY_UNLIMITED;
}
uint32 curTime = uint32(time(NULL) / MINUTE); // minutes
// 24 hours
@ -1685,7 +1731,9 @@ uint64 Guild::GetMemberMoneyWithdrawRem(uint32 LowGuid)
void Guild::SetBankMoneyPerDay(uint32 rankId, uint32 money)
{
if (rankId >= m_Ranks.size())
{
return;
}
if (rankId == GR_GUILDMASTER)
money = (uint32)WITHDRAW_MONEY_UNLIMITED;
@ -1738,20 +1786,28 @@ void Guild::SetBankRightsAndSlots(uint32 rankId, uint8 TabId, uint32 right, uint
uint32 Guild::GetBankMoneyPerDay(uint32 rankId)
{
if (rankId >= m_Ranks.size())
{
return 0;
}
if (rankId == GR_GUILDMASTER)
{
return (uint32)WITHDRAW_MONEY_UNLIMITED;
}
return m_Ranks[rankId].BankMoneyPerDay;
}
uint32 Guild::GetBankSlotPerDay(uint32 rankId, uint8 TabId)
{
if (rankId >= m_Ranks.size() || TabId >= GUILD_BANK_MAX_TABS)
{
return 0;
}
if (rankId == GR_GUILDMASTER)
{
return WITHDRAW_SLOT_UNLIMITED;
}
return m_Ranks[rankId].TabSlotPerDay[TabId];
}
@ -1761,7 +1817,9 @@ uint32 Guild::GetBankSlotPerDay(uint32 rankId, uint8 TabId)
bool Guild::LoadBankRightsFromDB(QueryResult* guildBankTabRightsResult)
{
if (!guildBankTabRightsResult)
{
return true;
}
do
{
@ -1850,7 +1908,9 @@ void Guild::LoadGuildBankEventLogFromDB()
// 0 1 2 3 4 5 6
QueryResult* result = CharacterDatabase.PQuery("SELECT LogGuid, EventType, PlayerGuid, ItemOrMoney, ItemStackCount, DestTabId, TimeStamp FROM guild_bank_eventlog WHERE guildid='%u' AND TabId='%u' ORDER BY TimeStamp DESC,LogGuid DESC LIMIT %u", m_Id, GUILD_BANK_MONEY_LOGS_TAB, GUILD_BANK_MAX_LOGS);
if (!result)
{
return;
}
bool isNextMoneyLogGuidSet = false;
do
@ -1886,7 +1946,9 @@ void Guild::LoadGuildBankEventLogFromDB()
void Guild::DisplayGuildBankLogs(WorldSession* session, uint8 TabId)
{
if (TabId > GUILD_BANK_MAX_TABS)
{
return;
}
ByteBuffer buffer;
bool hasCashFlow = GetLevel() >= 5 && TabId == GUILD_BANK_MAX_TABS; // has Cash Flow perk
@ -2013,7 +2075,9 @@ void Guild::AppendDisplayGuildBankSlot(WorldPacket& data, ByteBuffer& buffer, Gu
Item* Guild::StoreItem(uint8 tabId, GuildItemPosCountVec const& dest, Item* pItem)
{
if (!pItem)
{
return NULL;
}
Item* lastItem = pItem;
@ -2040,7 +2104,9 @@ Item* Guild::StoreItem(uint8 tabId, GuildItemPosCountVec const& dest, Item* pIte
Item* Guild::_StoreItem(uint8 tab, uint8 slot, Item* pItem, uint32 count, bool clone)
{
if (!pItem)
{
return NULL;
}
DEBUG_LOG("GUILD STORAGE: StoreItem tab = %u, slot = %u, item = %u, count = %u", tab, slot, pItem->GetEntry(), count);
@ -2054,7 +2120,9 @@ Item* Guild::_StoreItem(uint8 tab, uint8 slot, Item* pItem, uint32 count, bool c
pItem->SetCount(count);
if (!pItem)
{
return NULL;
}
m_TabListMap[tab]->Slots[slot] = pItem;
@ -2111,11 +2179,15 @@ InventoryResult Guild::_CanStoreItem_InSpecificSlot(uint8 tab, uint8 slot, Guild
{
// check item type
if (pItem2->GetEntry() != pSrcItem->GetEntry())
{
return EQUIP_ERR_ITEM_CANT_STACK;
}
// check free space
if (pItem2->GetCount() >= pSrcItem->GetMaxStackCount())
{
return EQUIP_ERR_ITEM_CANT_STACK;
}
need_space = pSrcItem->GetMaxStackCount() - pItem2->GetCount();
}
@ -2166,7 +2238,9 @@ InventoryResult Guild::_CanStoreItem_InTab(uint8 tab, GuildItemPosCountVec& dest
count -= need_space;
if (count == 0)
{
return EQUIP_ERR_OK;
}
}
}
}
@ -2183,7 +2257,9 @@ InventoryResult Guild::_CanStoreItem_InTab(uint8 tab, GuildItemPosCountVec& dest
count -= need_space;
if (count == 0)
{
return EQUIP_ERR_OK;
}
}
}
}
@ -2195,20 +2271,28 @@ InventoryResult Guild::CanStoreItem(uint8 tab, uint8 slot, GuildItemPosCountVec&
DEBUG_LOG("GUILD STORAGE: CanStoreItem tab = %u, slot = %u, item = %u, count = %u", tab, slot, pItem->GetEntry(), count);
if (count > pItem->GetCount())
{
return EQUIP_ERR_COULDNT_SPLIT_ITEMS;
}
if (pItem->IsSoulBound())
{
return EQUIP_ERR_CANT_DROP_SOULBOUND;
}
// in specific slot
if (slot != NULL_SLOT)
{
InventoryResult res = _CanStoreItem_InSpecificSlot(tab, slot, dest, count, swap, pItem);
if (res != EQUIP_ERR_OK)
{
return res;
}
if (count == 0)
{
return EQUIP_ERR_OK;
}
}
// not specific slot or have space for partly store only in specific slot
@ -2218,19 +2302,27 @@ InventoryResult Guild::CanStoreItem(uint8 tab, uint8 slot, GuildItemPosCountVec&
{
InventoryResult res = _CanStoreItem_InTab(tab, dest, count, true, pItem, slot);
if (res != EQUIP_ERR_OK)
{
return res;
}
if (count == 0)
{
return EQUIP_ERR_OK;
}
}
// search free slot in bag for place to
InventoryResult res = _CanStoreItem_InTab(tab, dest, count, false, pItem, slot);
if (res != EQUIP_ERR_OK)
{
return res;
}
if (count == 0)
{
return EQUIP_ERR_OK;
}
return EQUIP_ERR_BANK_FULL;
}
@ -2238,13 +2330,19 @@ InventoryResult Guild::CanStoreItem(uint8 tab, uint8 slot, GuildItemPosCountVec&
void Guild::SetGuildBankTabText(uint8 TabId, std::string text)
{
if (TabId >= GetPurchasedTabs())
{
return;
}
if (!m_TabListMap[TabId])
{
return;
}
if (m_TabListMap[TabId]->Text == text)
{
return;
}
utf8truncate(text, 500); // DB and client size limitation
@ -2276,11 +2374,15 @@ void Guild::SwapItems(Player* pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTa
{
// empty operation
if (BankTab == BankTabDst && BankTabSlot == BankTabSlotDst)
{
return;
}
Item* pItemSrc = GetItem(BankTab, BankTabSlot);
if (!pItemSrc) // may prevent crash
{
return;
}
if (SplitedAmount > pItemSrc->GetCount())
return; // cheating?
@ -2293,12 +2395,16 @@ void Guild::SwapItems(Player* pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTa
{
// check dest pos rights (if different tabs)
if (!IsMemberHaveRights(pl->GetGUIDLow(), BankTabDst, GUILD_BANK_RIGHT_DEPOSIT_ITEM))
{
return;
}
// check source pos rights (if different tabs)
uint32 remRight = GetMemberSlotWithdrawRem(pl->GetGUIDLow(), BankTab);
if (remRight <= 0)
{
return;
}
}
if (SplitedAmount)
@ -2368,12 +2474,16 @@ void Guild::SwapItems(Player* pl, uint8 BankTab, uint8 BankTabSlot, uint8 BankTa
{
// check source pos rights (item swapped to src)
if (!IsMemberHaveRights(pl->GetGUIDLow(), BankTab, GUILD_BANK_RIGHT_DEPOSIT_ITEM))
{
return;
}
// check dest pos rights (item swapped to src)
uint32 remRightDst = GetMemberSlotWithdrawRem(pl->GetGUIDLow(), BankTabDst);
if (remRightDst <= 0)
{
return;
}
}
CharacterDatabase.BeginTransaction();
@ -2403,7 +2513,9 @@ void Guild::MoveFromBankToChar(Player* pl, uint8 BankTab, uint8 BankTabSlot, uin
Item* pItemChar = pl->GetItemByPos(PlayerBag, PlayerSlot);
if (!pItemBank) // Problem to get bank item
{
return;
}
if (SplitedAmount > pItemBank->GetCount())
return; // cheating?
@ -2458,7 +2570,9 @@ void Guild::MoveFromBankToChar(Player* pl, uint8 BankTab, uint8 BankTabSlot, uin
// check source pos rights (item moved to inventory)
uint32 remRight = GetMemberSlotWithdrawRem(pl->GetGUIDLow(), BankTab);
if (remRight <= 0)
{
return;
}
CharacterDatabase.BeginTransaction();
LogBankEvent(GUILD_BANK_LOG_WITHDRAW_ITEM, BankTab, pl->GetGUIDLow(), pItemBank->GetEntry(), pItemBank->GetCount());
@ -2474,7 +2588,9 @@ void Guild::MoveFromBankToChar(Player* pl, uint8 BankTab, uint8 BankTabSlot, uin
{
// check source pos rights (item swapped to bank)
if (!IsMemberHaveRights(pl->GetGUIDLow(), BankTab, GUILD_BANK_RIGHT_DEPOSIT_ITEM))
{
return;
}
if (pItemChar)
{
@ -2507,7 +2623,9 @@ void Guild::MoveFromBankToChar(Player* pl, uint8 BankTab, uint8 BankTabSlot, uin
// check source pos rights (item moved to inventory)
uint32 remRight = GetMemberSlotWithdrawRem(pl->GetGUIDLow(), BankTab);
if (remRight <= 0)
{
return;
}
if (pItemChar)
{
@ -2551,7 +2669,9 @@ void Guild::MoveFromCharToBank(Player* pl, uint8 PlayerBag, uint8 PlayerSlot, ui
Item* pItemChar = pl->GetItemByPos(PlayerBag, PlayerSlot);
if (!pItemChar) // Problem to get item from player
{
return;
}
if (!pItemChar->CanBeTraded())
{
@ -2561,7 +2681,9 @@ void Guild::MoveFromCharToBank(Player* pl, uint8 PlayerBag, uint8 PlayerSlot, ui
// check source pos rights (item moved to bank)
if (!IsMemberHaveRights(pl->GetGUIDLow(), BankTab, GUILD_BANK_RIGHT_DEPOSIT_ITEM))
{
return;
}
if (SplitedAmount > pItemChar->GetCount())
return; // cheating?
@ -2659,7 +2781,9 @@ void Guild::MoveFromCharToBank(Player* pl, uint8 PlayerBag, uint8 PlayerSlot, ui
// check bank pos rights (item swapped with inventory)
uint32 remRight = GetMemberSlotWithdrawRem(pl->GetGUIDLow(), BankTab);
if (remRight <= 0)
{
return;
}
}
// logging item move to bank
@ -2714,7 +2838,9 @@ void Guild::BroadcastEvent(GuildEvents event, ObjectGuid guid, char const* str1
data << str2;
}
else if (str1)
{ data << str1; }
{
data << str1;
}
if (guid)
data << ObjectGuid(guid);
@ -2749,7 +2875,9 @@ bool GuildItemPosCount::isContainedIn(GuildItemPosCountVec const& vec) const
{
for (GuildItemPosCountVec::const_iterator itr = vec.begin(); itr != vec.end(); ++itr)
if (itr->Slot == this->Slot)
{
return true;
}
return false;
}

View file

@ -424,7 +424,9 @@ class Guild
{
for (MemberList::const_iterator itr = members.begin(); itr != members.end(); ++itr)
if (itr->second.RankId == rankId)
{
return true;
}
return false;
}

View file

@ -80,7 +80,9 @@ void AddItemsSetItem(Player* player, Item* item)
player->ItemSetEff[x] = eff;
}
else
{ player->ItemSetEff.push_back(eff); }
{
player->ItemSetEff.push_back(eff);
}
}
++eff->item_count;
@ -228,7 +230,9 @@ bool ItemCanGoIntoBag(ItemPrototype const* pProto, ItemPrototype const* pBagProt
return true;
case ITEM_SUBCLASS_MINING_CONTAINER:
if (!(pProto->BagFamily & BAG_FAMILY_MINING_SUPP))
{
return false;
}
return true;
case ITEM_SUBCLASS_ENGINEERING_CONTAINER:
if (!(pProto->BagFamily & BAG_FAMILY_ENGINEERING_SUPP))
@ -238,19 +242,27 @@ bool ItemCanGoIntoBag(ItemPrototype const* pProto, ItemPrototype const* pBagProt
return true;
case ITEM_SUBCLASS_GEM_CONTAINER:
if (!(pProto->BagFamily & BAG_FAMILY_GEMS))
{
return false;
}
return true;
case ITEM_SUBCLASS_LEATHERWORKING_CONTAINER:
if (!(pProto->BagFamily & BAG_FAMILY_LEATHERWORKING_SUPP))
{
return false;
}
return true;
case ITEM_SUBCLASS_INSCRIPTION_CONTAINER:
if (!(pProto->BagFamily & BAG_FAMILY_INSCRIPTION_SUPP))
{
return false;
}
return true;
case ITEM_SUBCLASS_FISHING_CONTAINER:
if (!(pProto->BagFamily & BAG_FAMILY_FISHING_SUPP))
{
return false;
}
return true;
default:
return false;
@ -280,7 +292,9 @@ bool ItemCanGoIntoBag(ItemPrototype const* pProto, ItemPrototype const* pBagProt
uint32 ItemPrototype::GetArmor() const
{
if (Quality >= ITEM_QUALITY_HEIRLOOM) // heirlooms have it's own dbc...
{
return 0;
}
if (Class == ITEM_CLASS_ARMOR && SubClass == ITEM_SUBCLASS_ARMOR_SHIELD)
{
@ -295,7 +309,9 @@ uint32 ItemPrototype::GetArmor() const
ItemArmorTotalEntry const* iat = sItemArmorTotalStore.LookupEntry(ItemLevel);
if (!iaq || !iat)
{
return 0;
}
if (InventoryType != INVTYPE_HEAD && InventoryType != INVTYPE_CHEST && InventoryType != INVTYPE_SHOULDERS &&
InventoryType != INVTYPE_LEGS && InventoryType != INVTYPE_FEET && InventoryType != INVTYPE_WRISTS &&
@ -311,7 +327,9 @@ uint32 ItemPrototype::GetArmor() const
al = sArmorLocationStore.LookupEntry(InventoryType);
if (!al)
{
return 0;
}
float iatMult, alMult;
@ -347,7 +365,9 @@ float ItemPrototype::getDPS() const
if (Class == ITEM_CLASS_WEAPON)
{
if (Quality >= ITEM_QUALITY_HEIRLOOM) // heirlooms have it's own dbc...
{
return damage;
}
ItemDamageEntry const* id = NULL;
@ -395,7 +415,9 @@ float ItemPrototype::getDPS() const
}
if (!id)
{
return damage;
}
return id->Value[Quality];
}
@ -455,7 +477,9 @@ bool Item::Create(uint32 guidlow, uint32 itemid, Player const* owner)
bool Item::IsNotEmptyBag() const
{
if (Bag const* bag = ToBag())
{
return !bag->IsEmpty();
}
return false;
}
@ -820,7 +844,9 @@ uint32 Item::GetSkill()
return 0;
}
else
{ return item_weapon_skills[proto->SubClass]; }
{
return item_weapon_skills[proto->SubClass];
}
case ITEM_CLASS_ARMOR:
if (proto->SubClass >= MAX_ITEM_SUBCLASS_ARMOR)
@ -828,7 +854,9 @@ uint32 Item::GetSkill()
return 0;
}
else
{ return item_armor_skills[proto->SubClass]; }
{
return item_armor_skills[proto->SubClass];
}
default:
return 0;
@ -846,7 +874,9 @@ int32 Item::GenerateItemRandomPropertyId(uint32 item_id)
// item must have one from this field values not null if it can have random enchantments
if ((!itemProto->RandomProperty) && (!itemProto->RandomSuffix))
{
return 0;
}
// Random Property case
if (itemProto->RandomProperty)
@ -920,7 +950,9 @@ bool Item::UpdateItemSuffixFactor()
{
uint32 suffixFactor = GenerateEnchSuffixFactor(GetEntry());
if (GetItemSuffixFactor() == suffixFactor)
{
return false;
}
SetUInt32Value(ITEM_FIELD_PROPERTY_SEED, suffixFactor);
return true;
}
@ -1086,7 +1118,9 @@ bool Item::IsBoundByEnchant() const
}
if (enchant_slot == TRANSMOGRIFY_ENCHANTMENT_SLOT)
{
return true;
}
if (enchant_slot > PRISMATIC_ENCHANTMENT_SLOT && enchant_slot < PROP_ENCHANTMENT_SLOT_0)
continue;
@ -1118,7 +1152,9 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
{
// EffectItemType[0] is the associated scroll itemID, if a scroll can be made
if (spellEffect_0->EffectItemType == 0)
{
return false;
}
// Other checks do not apply to vellum enchants, so return final result
int32 eqItemClass = spellInfo->GetEquippedItemClass();
return proto->SubClass == ITEM_SUBCLASS_VELLUM && (eqItemClass == ITEM_CLASS_WEAPON || eqItemClass == ITEM_CLASS_ARMOR);
@ -1127,7 +1163,9 @@ bool Item::IsFitToSpellRequirements(SpellEntry const* spellInfo) const
SpellEquippedItemsEntry const* equippedItems = spellInfo->GetSpellEquippedItems();
if (!equippedItems)
{
return true;
}
if (equippedItems->EquippedItemClass != -1) // -1 == any item class
{
@ -1339,7 +1377,9 @@ void Item::SendTimeUpdate(Player* owner)
{
#ifdef ENABLE_PLAYERBOTS
if (!owner || !owner->IsInWorld() || owner->GetPlayerbotAI())
{
return;
}
#endif
uint32 duration = GetUInt32Value(ITEM_FIELD_DURATION);
@ -1380,7 +1420,9 @@ Item* Item::CreateItem(uint32 item, uint32 count, Player const* player, uint32 r
return pItem;
}
else
{ delete pItem; }
{
delete pItem;
}
}
return NULL;
}
@ -1422,7 +1464,9 @@ bool Item::IsBindedNotWith(Player const* player) const
// not BOA item case
if (!IsBoundAccountWide())
{
return true;
}
// online
if (Player* owner = GetOwner())
@ -1514,7 +1558,9 @@ bool Item::HasMaxCharges() const
for (int i = 0; i < MAX_ITEM_PROTO_SPELLS; ++i)
if (GetSpellCharges(i) != itemProto->Spells[i].SpellCharges)
{
return false;
}
return true;
}
@ -1563,7 +1609,9 @@ void Item::SetLootState(ItemLootUpdateState state)
}
// temporary must stay until remove (ignore any changes)
else if (m_lootState != ITEM_LOOT_TEMPORARY)
{ m_lootState = ITEM_LOOT_UNCHANGED; }
{
m_lootState = ITEM_LOOT_UNCHANGED;
}
break;
case ITEM_LOOT_REMOVED:
// if loot not saved then it existence in past can be just ignored
@ -1628,17 +1676,23 @@ int32 Item::GetReforgableStat(ItemModType statType) const
ItemPrototype const* proto = GetProto();
for (uint32 i = 0; i < MAX_ITEM_PROTO_STATS; ++i)
if (proto->ItemStat[i].ItemStatType == statType)
{
return proto->ItemStat[i].ItemStatValue;
}
int32 randomPropId = GetItemRandomPropertyId();
if (!randomPropId)
{
return 0;
}
if (randomPropId < 0)
{
ItemRandomSuffixEntry const* randomSuffix = sItemRandomSuffixStore.LookupEntry(-randomPropId);
if (!randomSuffix)
{
return 0;
}
for (uint32 e = PROP_ENCHANTMENT_SLOT_0; e <= PROP_ENCHANTMENT_SLOT_4; ++e)
{
@ -1651,7 +1705,9 @@ int32 Item::GetReforgableStat(ItemModType statType) const
for (int k = 0; k < 5; ++k)
{
if (randomSuffix->enchant_id[k] == enchant->ID)
{
return int32((randomSuffix->prefix[k] * GetItemSuffixFactor()) / 10000);
}
}
}
}
@ -1662,7 +1718,9 @@ int32 Item::GetReforgableStat(ItemModType statType) const
{
ItemRandomPropertiesEntry const* randomProp = sItemRandomPropertiesStore.LookupEntry(randomPropId);
if (!randomProp)
{
return 0;
}
for (uint32 e = PROP_ENCHANTMENT_SLOT_0; e <= PROP_ENCHANTMENT_SLOT_4; ++e)
{
@ -1675,7 +1733,9 @@ int32 Item::GetReforgableStat(ItemModType statType) const
for (int k = 0; k < 3; ++k)
{
if (randomProp->enchant_id[k] == enchant->ID)
{
return int32(enchant->amount[k]);
}
}
}
}

View file

@ -168,13 +168,19 @@ uint32 GenerateEnchSuffixFactor(uint32 item_id)
ItemPrototype const* itemProto = ObjectMgr::GetItemPrototype(item_id);
if (!itemProto)
{
return 0;
}
if (!itemProto->RandomSuffix)
{
return 0;
}
RandomPropertiesPointsEntry const* randomProperty = sRandomPropertiesPointsStore.LookupEntry(itemProto->ItemLevel);
if (!randomProperty)
{
return 0;
}
uint32 suffixFactor;
switch (itemProto->InventoryType)

View file

@ -274,11 +274,15 @@ bool LootStoreItem::Roll(bool rate) const
}
if (type == LOOTITEM_TYPE_CURRENCY)
{
return roll_chance_f(chance * (rate ? sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_CURRENCY) : 1.0f));
}
else
{
if (needs_quest)
{
return roll_chance_f(chance * (rate ? sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_ITEM_QUEST) : 1.0f));
}
ItemPrototype const* pProto = ObjectMgr::GetItemPrototype(itemid);
@ -436,7 +440,9 @@ bool LootItem::AllowedForPlayer(Player const* player, WorldObject const* lootTar
{
// DB conditions check
if (conditionId && !sObjectMgr.IsPlayerMeetToCondition(conditionId, player, player->GetMap(), lootTarget, CONDITION_FROM_LOOT))
{
return false;
}
if (type == LOOT_ITEM_TYPE_ITEM)
{
@ -592,7 +598,9 @@ bool Loot::FillLoot(uint32 loot_id, LootStore const& store, Player* loot_owner,
}
// ... for personal loot
else
{ FillNotNormalLootFor(loot_owner); }
{
FillNotNormalLootFor(loot_owner);
}
return true;
}
@ -753,7 +761,9 @@ void Loot::NotifyItemRemoved(uint8 lootIndex)
pl->SendNotifyLootItemRemoved(lootIndex);
}
else
{ m_playersLooting.erase(i); }
{
m_playersLooting.erase(i);
}
}
}
@ -770,7 +780,9 @@ void Loot::NotifyMoneyRemoved()
pl->SendNotifyLootMoneyRemoved();
}
else
{ m_playersLooting.erase(i); }
{
m_playersLooting.erase(i);
}
}
}
@ -808,7 +820,9 @@ void Loot::NotifyQuestItemRemoved(uint8 questIndex)
}
}
else
{ m_playersLooting.erase(i); }
{
m_playersLooting.erase(i);
}
}
}
@ -821,9 +835,13 @@ void Loot::generateMoneyLoot(uint32 minAmount, uint32 maxAmount)
gold = uint32(maxAmount * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY));
}
else if ((maxAmount - minAmount) < 32700)
{ gold = uint32(urand(minAmount, maxAmount) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)); }
{
gold = uint32(urand(minAmount, maxAmount) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY));
}
else
{ gold = uint32(urand(minAmount >> 8, maxAmount >> 8) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)) << 8; }
{
gold = uint32(urand(minAmount >> 8, maxAmount >> 8) * sWorld.getConfig(CONFIG_FLOAT_RATE_DROP_MONEY)) << 8;
}
}
}
@ -1071,7 +1089,9 @@ void LootTemplate::LootGroup::AddEntry(LootStoreItem& item)
ExplicitlyChanced.push_back(item);
}
else
{ EqualChanced.push_back(item); }
{
EqualChanced.push_back(item);
}
}
// Rolls an item from the group, returns NULL if all miss their chances
@ -1197,7 +1217,9 @@ void LootTemplate::LootGroup::CheckLootRefs(LootIdSet* ref_set) const
LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
}
else if (ref_set)
{ ref_set->erase(-ieItr->mincountOrRef); }
{
ref_set->erase(-ieItr->mincountOrRef);
}
}
}
@ -1210,7 +1232,9 @@ void LootTemplate::LootGroup::CheckLootRefs(LootIdSet* ref_set) const
LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
}
else if (ref_set)
{ ref_set->erase(-ieItr->mincountOrRef); }
{
ref_set->erase(-ieItr->mincountOrRef);
}
}
}
}
@ -1229,7 +1253,9 @@ void LootTemplate::AddEntry(LootStoreItem& item)
Groups[item.group - 1].AddEntry(item); // Adds new entry to the group
}
else // Non-grouped entries and references are stored together
{ Entries.push_back(item); }
{
Entries.push_back(item);
}
}
// Rolls for every item in the template and adds the rolled items the the loot
@ -1369,7 +1395,9 @@ void LootTemplate::CheckLootRefs(LootIdSet* ref_set) const
LootTemplates_Reference.ReportNotExistedId(-ieItr->mincountOrRef);
}
else if (ref_set)
{ ref_set->erase(-ieItr->mincountOrRef); }
{
ref_set->erase(-ieItr->mincountOrRef);
}
}
}
@ -1394,7 +1422,9 @@ void LoadLootTemplates_Creature()
LootTemplates_Creature.ReportNotExistedId(lootid);
}
else
{ ids_setUsed.insert(lootid); }
{
ids_setUsed.insert(lootid);
}
}
}
}
@ -1426,7 +1456,9 @@ void LoadLootTemplates_Disenchant()
LootTemplates_Disenchant.ReportNotExistedId(lootid);
}
else
{ ids_setUsed.insert(lootid); }
{
ids_setUsed.insert(lootid);
}
}
}
}
@ -1473,7 +1505,9 @@ void LoadLootTemplates_Gameobject()
LootTemplates_Gameobject.ReportNotExistedId(lootid);
}
else
{ ids_setUsed.insert(lootid); }
{
ids_setUsed.insert(lootid);
}
}
}
for (LootIdSet::const_iterator itr = ids_setUsed.begin(); itr != ids_setUsed.end(); ++itr)
@ -1504,7 +1538,9 @@ void LoadLootTemplates_Item()
}
// wdb have wrong data cases, so skip by default
else if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK))
{ LootTemplates_Item.ReportNotExistedId(proto->ItemId); }
{
LootTemplates_Item.ReportNotExistedId(proto->ItemId);
}
}
}
@ -1554,7 +1590,9 @@ void LoadLootTemplates_Pickpocketing()
LootTemplates_Pickpocketing.ReportNotExistedId(lootid);
}
else
{ ids_setUsed.insert(lootid); }
{
ids_setUsed.insert(lootid);
}
}
}
}
@ -1624,7 +1662,9 @@ void LoadLootTemplates_Skinning()
LootTemplates_Skinning.ReportNotExistedId(lootid);
}
else
{ ids_setUsed.insert(lootid); }
{
ids_setUsed.insert(lootid);
}
}
}
}

View file

@ -1574,7 +1574,9 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap
z = max_z;
}
else if (z < ground_z)
{ z = ground_z; }
{
z = ground_z;
}
}
}
else
@ -1601,7 +1603,9 @@ void WorldObject::UpdateAllowedPositionZ(float x, float y, float& z, Map* atMap
z = max_z;
}
else if (z < ground_z)
{ z = ground_z; }
{
z = ground_z;
}
}
}
else
@ -1681,7 +1685,9 @@ namespace MaNGOS
text = i_textData->Content[loc_idx + 1].c_str();
}
else
{ text = i_textData->Content[0].c_str(); }
{
text = i_textData->Content[0].c_str();
}
ChatHandler::BuildChatPacket(data, i_msgtype, text, i_language, CHAT_TAG_NONE, i_object.GetObjectGuid(), i_object.GetNameForLocaleIdx(loc_idx),
i_target ? i_target->GetObjectGuid() : ObjectGuid(), i_target ? i_target->GetNameForLocaleIdx(loc_idx) : "");
@ -1906,7 +1912,9 @@ GameObject* WorldObject::SummonGameObject(uint32 id, float x, float y, float z,
Map *map = GetMap();
if (!map)
{
return NULL;
}
if (!pGameObj->Create(map->GenerateLocalLowGuid(HIGHGUID_GAMEOBJECT), id, map, GetPhaseMask(), x, y, z, angle))
{
@ -2001,7 +2009,9 @@ namespace MaNGOS
angle -= 2.0f * M_PI_F;
}
else if (angle < -M_PI_F)
{ angle += 2.0f * M_PI_F; }
{
angle += 2.0f * M_PI_F;
}
i_selector.AddUsedArea(u, angle, dist2d);
}
@ -2035,7 +2045,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
if (searcher)
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
else
{ UpdateGroundPositionZ(x, y, z); }
{
UpdateGroundPositionZ(x, y, z);
}
return;
}
@ -2063,7 +2075,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
if (searcher)
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
else
{ UpdateGroundPositionZ(x, y, z); }
{
UpdateGroundPositionZ(x, y, z);
}
if (fabs(init_z - z) < dist && IsWithinLOS(x, y, z))
{
@ -2087,7 +2101,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
if (searcher)
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
else
{ UpdateGroundPositionZ(x, y, z); }
{
UpdateGroundPositionZ(x, y, z);
}
if (fabs(init_z - z) < dist && IsWithinLOS(x, y, z))
{
@ -2105,7 +2121,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
if (searcher)
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
else
{ UpdateGroundPositionZ(x, y, z); }
{
UpdateGroundPositionZ(x, y, z);
}
return;
}
@ -2121,7 +2139,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
if (searcher)
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
else
{ UpdateGroundPositionZ(x, y, z); }
{
UpdateGroundPositionZ(x, y, z);
}
if (fabs(init_z - z) < dist && IsWithinLOS(x, y, z))
{
@ -2136,7 +2156,9 @@ void WorldObject::GetNearPoint(WorldObject const* searcher, float& x, float& y,
if (searcher)
{ searcher->UpdateAllowedPositionZ(x, y, z, GetMap()); } // update to LOS height if available
else
{ UpdateGroundPositionZ(x, y, z); }
{
UpdateGroundPositionZ(x, y, z);
}
}
void WorldObject::SetPhaseMask(uint32 newPhaseMask, bool update)
@ -2158,7 +2180,9 @@ void WorldObject::PlayDistanceSound(uint32 sound_id, Player const* target /*= NU
target->SendDirectMessage(&data);
}
else
{ SendMessageToSet(&data, true); }
{
SendMessageToSet(&data, true);
}
}
void WorldObject::PlayDirectSound(uint32 sound_id, Player const* target /*= NULL*/) const
@ -2171,7 +2195,9 @@ void WorldObject::PlayDirectSound(uint32 sound_id, Player const* target /*= NULL
target->SendDirectMessage(&data);
}
else
{ SendMessageToSet(&data, true); }
{
SendMessageToSet(&data, true);
}
}
void WorldObject::PlayMusic(uint32 sound_id, Player const* target /*= NULL*/) const
@ -2183,7 +2209,9 @@ void WorldObject::PlayMusic(uint32 sound_id, Player const* target /*= NULL*/) co
target->SendDirectMessage(&data);
}
else
{ SendMessageToSet(&data, true); }
{
SendMessageToSet(&data, true);
}
}
void WorldObject::UpdateVisibilityAndView()
@ -2288,7 +2316,9 @@ void WorldObject::SetActiveObjectState(bool active)
GetMap()->RemoveFromActive(this);
}
else if (!IsActiveObject() && active)
{ GetMap()->AddToActive(this); }
{
GetMap()->AddToActive(this);
}
}
m_isActiveObject = active;
}

View file

@ -292,7 +292,9 @@ class Object
RemoveFlag(index, flag);
}
else
{ SetFlag(index, flag); }
{
SetFlag(index, flag);
}
}
/**
@ -316,7 +318,9 @@ class Object
SetFlag(index, flag);
}
else
{ RemoveFlag(index, flag); }
{
RemoveFlag(index, flag);
}
}
void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag);
@ -329,7 +333,9 @@ class Object
RemoveByteFlag(index, offset, flag);
}
else
{ SetByteFlag(index, offset, flag); }
{
SetByteFlag(index, offset, flag);
}
}
bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
@ -346,7 +352,9 @@ class Object
SetByteFlag(index, offset, flag);
}
else
{ RemoveByteFlag(index, offset, flag); }
{
RemoveByteFlag(index, offset, flag);
}
}
void SetShortFlag(uint16 index, bool highpart, uint16 newFlag);
@ -359,7 +367,9 @@ class Object
RemoveShortFlag(index, highpart, flag);
}
else
{ SetShortFlag(index, highpart, flag); }
{
SetShortFlag(index, highpart, flag);
}
}
bool HasShortFlag(uint16 index, bool highpart, uint8 flag) const
@ -375,7 +385,9 @@ class Object
SetShortFlag(index, highpart, flag);
}
else
{ RemoveShortFlag(index, highpart, flag); }
{
RemoveShortFlag(index, highpart, flag);
}
}
void SetFlag64(uint16 index, uint64 newFlag)
@ -399,7 +411,9 @@ class Object
RemoveFlag64(index, flag);
}
else
{ SetFlag64(index, flag); }
{
SetFlag64(index, flag);
}
}
bool HasFlag64(uint16 index, uint64 flag) const
@ -415,7 +429,9 @@ class Object
SetFlag64(index, flag);
}
else
{ RemoveFlag64(index, flag); }
{
RemoveFlag64(index, flag);
}
}
void ClearUpdateMask(bool remove);

View file

@ -130,20 +130,26 @@ LanguageDesc const* GetLanguageDescByID(uint32 lang)
bool SpellClickInfo::IsFitToRequirements(Player const* player, Creature const* clickedCreature) const
{
if (conditionId)
{
return sObjectMgr.IsPlayerMeetToCondition(conditionId, player, player->GetMap(), clickedCreature, CONDITION_FROM_SPELLCLICK);
}
if (questStart)
{
// not in expected required quest state
if (!player || ((!questStartCanActive || !player->IsActiveQuest(questStart)) && !player->GetQuestRewardStatus(questStart)))
{
return false;
}
}
if (questEnd)
{
// not in expected forbidden quest state
if (!player || player->GetQuestRewardStatus(questEnd))
{
return false;
}
}
return true;
@ -220,7 +226,9 @@ ArenaTeam* ObjectMgr::GetArenaTeamById(uint32 arenateamid) const
{
ArenaTeamMap::const_iterator itr = mArenaTeamMap.find(arenateamid);
if (itr != mArenaTeamMap.end())
{
return itr->second;
}
return NULL;
}
@ -229,7 +237,9 @@ ArenaTeam* ObjectMgr::GetArenaTeamByName(const std::string& arenateamname) const
{
for (ArenaTeamMap::const_iterator itr = mArenaTeamMap.begin(); itr != mArenaTeamMap.end(); ++itr)
if (itr->second->GetName() == arenateamname)
{
return itr->second;
}
return NULL;
}
@ -238,7 +248,9 @@ ArenaTeam* ObjectMgr::GetArenaTeamByCaptain(ObjectGuid guid) const
{
for (ArenaTeamMap::const_iterator itr = mArenaTeamMap.begin(); itr != mArenaTeamMap.end(); ++itr)
if (itr->second->GetCaptainGuid() == guid)
{
return itr->second;
}
return NULL;
}
@ -641,7 +653,9 @@ void ObjectMgr::LoadCreatureTemplates()
const_cast<CreatureInfo*>(cInfo)->ModelId[i] = 0;
}
else if (!displayScaleEntry)
{ displayScaleEntry = displayEntry; }
{
displayScaleEntry = displayEntry;
}
CreatureModelInfo const* minfo = sCreatureModelStorage.LookupEntry<CreatureModelInfo>(cInfo->ModelId[i]);
if (!minfo)
@ -791,7 +805,9 @@ void ObjectMgr::LoadCreatureTemplates()
const_cast<CreatureInfo*>(cInfo)->Scale = displayScaleEntry->Scale;
}
else
{ const_cast<CreatureInfo*>(cInfo)->Scale = DEFAULT_OBJECT_SCALE; }
{
const_cast<CreatureInfo*>(cInfo)->Scale = DEFAULT_OBJECT_SCALE;
}
}
}
}
@ -1021,12 +1037,16 @@ void ObjectMgr::LoadCreatureClassLvlStats()
CreatureClassLvlStats const* ObjectMgr::GetCreatureClassLvlStats(uint32 level, uint32 unitClass, int32 expansion) const
{
if (expansion < 0)
{
return NULL;
}
CreatureClassLvlStats const* cCLS = &m_creatureClassLvlStats[level][classToIndex[unitClass]][expansion];
if (cCLS->BaseHealth != 0 && cCLS->BaseDamage > 0.1f)
{
return cCLS;
}
return NULL;
}
@ -1084,7 +1104,9 @@ void ObjectMgr::LoadEquipmentTemplates()
uint32 ObjectMgr::GetCreatureModelAlternativeModel(uint32 modelId) const
{
if (const CreatureModelInfo* modelInfo = GetCreatureModelInfo(modelId))
{
return modelInfo->modelid_alternative;
}
return 0;
}
@ -1107,10 +1129,14 @@ CreatureModelInfo const* ObjectMgr::GetCreatureModelRandomGender(uint32 display_
return minfo; // not fatal, just use the previous one
}
else
{ return minfo_tmp; }
{
return minfo_tmp;
}
}
else
{ return minfo; }
{
return minfo;
}
}
uint32 ObjectMgr::GetModelForRace(uint32 sourceModelId, uint32 racemask)
@ -1230,7 +1256,9 @@ void ObjectMgr::LoadCreatureModelInfo()
}
}
else
{ sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u female model id %u", race, raceEntry->model_f); }
{
sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u female model id %u", race, raceEntry->model_f);
}
if (CreatureModelInfo const* minfo = GetCreatureModelInfo(raceEntry->model_m))
{
@ -1257,7 +1285,9 @@ void ObjectMgr::LoadCreatureModelInfo()
}
}
else
{ sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u male model id %u", race, raceEntry->model_m); }
{
sLog.outErrorDb("Table `creature_model_info` expect have data for character race %u male model id %u", race, raceEntry->model_m);
}
}
sLog.outString(">> Loaded %u creature model based info", sCreatureModelStorage.GetRecordCount());
@ -3565,7 +3595,9 @@ void ObjectMgr::GetPlayerLevelInfo(uint32 race, uint32 class_, uint32 level, Pla
*info = pInfo->levelInfo[level - 1];
}
else
{ BuildPlayerLevelInfo(race, class_, level, info); }
{
BuildPlayerLevelInfo(race, class_, level, info);
}
}
void ObjectMgr::BuildPlayerLevelInfo(uint8 race, uint8 _class, uint8 level, PlayerLevelInfo* info) const
@ -3816,7 +3848,9 @@ void ObjectMgr::LoadGroups()
mGroupMap.erase(itr++);
}
else
{ ++itr; }
{
++itr;
}
}
// -- loading instances --
@ -4368,7 +4402,9 @@ void ObjectMgr::LoadQuests()
qinfo->RewChoiceItemId[j] = 0; // no changes, quest will not reward this
}
else
{ choice_found = true; }
{
choice_found = true;
}
if (!qinfo->RewChoiceItemCount[j])
{
@ -4507,7 +4543,9 @@ void ObjectMgr::LoadQuests()
qinfo->RewMailDelaySecs = 0; // no mail will send to player
}
else
{ usedMailTemplates[qinfo->RewMailTemplateId] = qinfo->GetQuestId(); }
{
usedMailTemplates[qinfo->RewMailTemplateId] = qinfo->GetQuestId();
}
}
if (qinfo->NextQuestInChain)
@ -4520,7 +4558,9 @@ void ObjectMgr::LoadQuests()
qinfo->NextQuestInChain = 0;
}
else
{ qNextItr->second->prevChainQuests.push_back(qinfo->GetQuestId()); }
{
qNextItr->second->prevChainQuests.push_back(qinfo->GetQuestId());
}
}
// fill additional data stores
@ -6906,7 +6946,9 @@ void ObjectMgr::LoadPetNames()
PetHalfName1[entry].push_back(word);
}
else
{ PetHalfName0[entry].push_back(word); }
{
PetHalfName0[entry].push_back(word);
}
++count;
}
while (result->NextRow());
@ -7702,7 +7744,9 @@ void ObjectMgr::GetConditions(uint32 conditionId, std::vector<PlayerCondition co
{
const PlayerCondition* condition = sConditionStorage.LookupEntry<PlayerCondition>(conditionId);
if (!condition)
{
return;
}
if (condition->m_condition == CONDITION_OR || condition->m_condition == CONDITION_AND)
{
@ -7869,7 +7913,9 @@ void ObjectMgr::LoadGameobjectQuestRelations()
sLog.outErrorDb("Table `quest_relations` have data for nonexistent gameobject entry (%u) and existing quest %u", itr->first, itr->second);
}
else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
{ sLog.outErrorDb("Table `quest_relations` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); }
{
sLog.outErrorDb("Table `quest_relations` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second);
}
}
}
@ -7885,7 +7931,9 @@ void ObjectMgr::LoadGameobjectInvolvedRelations()
sLog.outErrorDb("Table `quest_relations` have data for nonexistent gameobject entry (%u) and existing quest %u", itr->first, itr->second);
}
else if (goInfo->type != GAMEOBJECT_TYPE_QUESTGIVER)
{ sLog.outErrorDb("Table `quest_relations` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second); }
{
sLog.outErrorDb("Table `quest_relations` have data gameobject entry (%u) for quest %u, but GO is not GAMEOBJECT_TYPE_QUESTGIVER", itr->first, itr->second);
}
}
}
@ -7901,7 +7949,9 @@ void ObjectMgr::LoadCreatureQuestRelations()
sLog.outErrorDb("Table `quest_relations` have data for nonexistent creature entry (%u) and existing quest %u", itr->first, itr->second);
}
else if (!(cInfo->NpcFlags & UNIT_NPC_FLAG_QUESTGIVER))
{ sLog.outErrorDb("Table `quest_relations` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); }
{
sLog.outErrorDb("Table `quest_relations` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second);
}
}
}
@ -7917,7 +7967,9 @@ void ObjectMgr::LoadCreatureInvolvedRelations()
sLog.outErrorDb("Table `quest_relations` have data for nonexistent creature entry (%u) and existing quest %u", itr->first, itr->second);
}
else if (!(cInfo->NpcFlags & UNIT_NPC_FLAG_QUESTGIVER))
{ sLog.outErrorDb("Table `quest_relations` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second); }
{
sLog.outErrorDb("Table `quest_relations` has creature entry (%u) for quest %u, but npcflag does not include UNIT_NPC_FLAG_QUESTGIVER", itr->first, itr->second);
}
}
}
@ -8287,11 +8339,17 @@ inline void _DoStringError(int32 entry, char const* text, ...)
sLog.outErrorScriptLib("%s", buf);
}
else if (entry <= MIN_CREATURE_AI_TEXT_STRING_ID) // eventAI error
{ sLog.outErrorEventAI("%s", buf); }
{
sLog.outErrorEventAI("%s", buf);
}
else if (entry < MIN_DB_SCRIPT_STRING_ID) // mangos string error
{ sLog.outError("%s", buf); }
{
sLog.outError("%s", buf);
}
else // if (entry > MIN_DB_SCRIPT_STRING_ID) // DB script text error
{ sLog.outErrorDb("DB-SCRIPTS: %s", buf); }
{
sLog.outErrorDb("DB-SCRIPTS: %s", buf);
}
}
bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min_value, int32 max_value, bool extra_content)
@ -8329,7 +8387,9 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min
mMangosStringLocaleMap.erase(itr++);
}
else
{ ++itr; }
{
++itr;
}
}
sLog.outString("Loading texts from %s%s", table, extra_content ? ", with additional data" : "");
@ -8349,7 +8409,9 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min
sLog.outErrorDb(">> Loaded 0 mangos strings. DB table `%s` is empty. Can not continue.", table);
}
else
{ sLog.outString(">> Loaded 0 string templates. DB table `%s` is empty.", table); }
{
sLog.outString(">> Loaded 0 string templates. DB table `%s` is empty.", table);
}
return false;
}
@ -8450,7 +8512,9 @@ bool ObjectMgr::LoadMangosStrings(DatabaseType& db, char const* table, int32 min
sLog.outString(">> Loaded %u MaNGOS strings from table %s", count, table);
}
else
{ sLog.outString(">> Loaded %u %s templates from %s", count, extra_content ? "text" : "string", table); }
{
sLog.outString(">> Loaded %u %s templates from %s", count, extra_content ? "text" : "string", table);
}
sLog.outString();
m_loadedStringCount[min_value] = count;
@ -8469,7 +8533,9 @@ const char* ObjectMgr::GetMangosString(int32 entry, int locale_idx) const
return msl->Content[locale_idx + 1].c_str();
}
else
{ return msl->Content[0].c_str(); }
{
return msl->Content[0].c_str();
}
}
_DoStringError(entry, "Entry %i not found but requested", entry);
@ -8537,10 +8603,14 @@ bool ObjectMgr::CheckDeclinedNames(const std::wstring& mainpart, DeclinedName co
{
std::wstring wname;
if (!Utf8toWStr(names.name[i], wname))
{
return false;
}
if (mainpart != GetMainPartOfName(wname, i + 1))
{
return false;
}
}
return true;
}
@ -8609,7 +8679,9 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co
return true;
}
else
{ return uint32(player->GetTeam()) == m_value1; }
{
return uint32(player->GetTeam()) == m_value1;
}
}
case CONDITION_SKILL:
return player->HasSkill(m_value1) && player->GetBaseSkillValue(m_value1) >= m_value2;
@ -8799,7 +8871,9 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co
return !player->HasSkill(m_value1);
}
else
{ return player->HasSkill(m_value1) && player->GetBaseSkillValue(m_value1) < m_value2; }
{
return player->HasSkill(m_value1) && player->GetBaseSkillValue(m_value1) < m_value2;
}
}
case CONDITION_REPUTATION_RANK_MAX:
{
@ -8892,7 +8966,9 @@ bool PlayerCondition::Meets(Player const* player, Map const* map, WorldObject co
return true;
}
else
{ return !player->IsAlive() || (m_value2 && source && !source->IsWithinDistInMap(player, m_value2)); }
{
return !player->IsAlive() || (m_value2 && source && !source->IsWithinDistInMap(player, m_value2));
}
case 2: // All players in instance dead or out of range
for (Map::PlayerList::const_iterator itr = map->GetPlayers().begin(); itr != map->GetPlayers().end(); ++itr)
{
@ -9456,9 +9532,13 @@ SkillRangeType GetSkillRangeType(SkillLineEntry const* pSkill, bool racial)
return SKILL_RANGE_RANK;
}
else if (racial)
{ return SKILL_RANGE_NONE; }
{
return SKILL_RANGE_NONE;
}
else
{ return SKILL_RANGE_MONO; }
{
return SKILL_RANGE_MONO;
}
default:
case SKILL_CATEGORY_ATTRIBUTES: // not found in dbc
case SKILL_CATEGORY_GENERIC: // only GENERIC(DND)
@ -9546,7 +9626,9 @@ GameTele const* ObjectMgr::GetGameTele(const std::string& name) const
return &itr->second;
}
else if (alt == NULL && itr->second.wnameLow.find(wname) != std::wstring::npos)
{ alt = &itr->second; }
{
alt = &itr->second;
}
return alt;
}
@ -10208,7 +10290,9 @@ void ObjectMgr::LoadGossipMenuItems(std::set<uint32>& gossipScriptSet)
sLog.outErrorDb("Gossip menu option (MenuId: %u Id: %u) have action_menu_id = %u for nonexistent menu", gMenuItem.menu_id, gMenuItem.id, gMenuItem.action_menu_id);
}
else if (!sLog.HasLogFilter(LOG_FILTER_DB_STRICTED_CHECK))
{ menu_ids.erase(gMenuItem.action_menu_id); }
{
menu_ids.erase(gMenuItem.action_menu_id);
}
}
if (gMenuItem.option_icon >= GOSSIP_ICON_MAX)
@ -10306,7 +10390,9 @@ void ObjectMgr::LoadGossipMenus()
{
ScriptChainMap const* scm = sScriptMgr.GetScriptChainMap(DBS_ON_GOSSIP);
if (!scm)
{
return;
}
// Check which script-ids in db_scripts type DBS_ON_GOSSIP are not used
std::set<uint32> gossipScriptSet;
@ -10894,7 +10980,9 @@ bool FindCreatureData::operator()(CreatureDataPair const& dataPair)
// skip not spawned (in any state),
uint16 pool_id = sPoolMgr.IsPartOfAPool<Creature>(dataPair.first);
if (pool_id && !i_player->GetMap()->GetPersistentState()->IsSpawnedPoolObject<Creature>(dataPair.first))
{
return false;
}
if (!i_spawnedData || new_dist < i_spawnedDist)
{
@ -10930,7 +11018,9 @@ bool DoDisplayText(WorldObject* source, int32 entry, Unit const* target /*=NULL*
}
}
else
{ source->PlayDirectSound(data->SoundId); }
{
source->PlayDirectSound(data->SoundId);
}
}
if (data->Emote)
@ -10959,10 +11049,14 @@ bool DoDisplayText(WorldObject* source, int32 entry, Unit const* target /*=NULL*
CreatureDataPair const* FindCreatureData::GetResult() const
{
if (i_spawnedData)
{
return i_spawnedData;
}
if (i_mapData)
{
return i_mapData;
}
return i_anyData;
}
@ -10971,18 +11065,24 @@ bool FindGOData::operator()(GameObjectDataPair const& dataPair)
{
// skip wrong entry ids
if (i_id && dataPair.second.id != i_id)
{
return false;
}
if (!i_anyData)
i_anyData = &dataPair;
// without player we can't find more stricted cases, so use fouded
if (!i_player)
{
return true;
}
// skip diff. map cases
if (dataPair.second.mapid != i_player->GetMapId())
{
return false;
}
float new_dist = i_player->GetDistance2d(dataPair.second.posX, dataPair.second.posY);
@ -10995,7 +11095,9 @@ bool FindGOData::operator()(GameObjectDataPair const& dataPair)
// skip not spawned (in any state)
uint16 pool_id = sPoolMgr.IsPartOfAPool<GameObject>(dataPair.first);
if (pool_id && !i_player->GetMap()->GetPersistentState()->IsSpawnedPoolObject<GameObject>(dataPair.first))
{
return false;
}
if (!i_spawnedData || new_dist < i_spawnedDist)
{
@ -11009,10 +11111,14 @@ bool FindGOData::operator()(GameObjectDataPair const& dataPair)
GameObjectDataPair const* FindGOData::GetResult() const
{
if (i_mapData)
{
return i_mapData;
}
if (i_spawnedData)
{
return i_spawnedData;
}
return i_anyData;
}

View file

@ -740,7 +740,9 @@ class ObjectMgr
{
QuestPOIMap::const_iterator itr = mQuestPOIMap.find(questId);
if (itr != mQuestPOIMap.end())
{
return &itr->second;
}
return NULL;
}
@ -748,7 +750,9 @@ class ObjectMgr
{
DungeonFinderRequirementsMap::const_iterator itr = mDungeonFinderRequirementsMap.find(MAKE_PAIR32(mapId, difficulty));
if (itr != mDungeonFinderRequirementsMap.end())
{
return &itr->second;
}
return NULL;
}
@ -960,11 +964,15 @@ class ObjectMgr
{
MailLevelRewardMap::const_iterator map_itr = m_mailLevelRewardMap.find(level);
if (map_itr == m_mailLevelRewardMap.end())
{
return NULL;
}
for (MailLevelRewardList::const_iterator set_itr = map_itr->second.begin(); set_itr != map_itr->second.end(); ++set_itr)
if (set_itr->raceMask & raceMask)
{
return &*set_itr;
}
return NULL;
}
@ -1277,7 +1285,9 @@ class ObjectMgr
{
ItemConvertMap::const_iterator iter = m_ItemConvert.find(itemEntry);
if (iter == m_ItemConvert.end())
{
return 0;
}
ItemPrototype const* proto = GetItemPrototype(iter->second);
return (proto && proto->AllowableRace & raceMask) ? iter->second : 0;

View file

@ -80,7 +80,9 @@ void ObjectPosSelector::AddUsedArea(WorldObject const* obj, float angle, float d
m_UsedAreaLists[USED_POS_PLUS].insert(UsedArea(angle, OccupiedArea(sr_angle, obj)));
}
else
{ m_UsedAreaLists[USED_POS_MINUS].insert(UsedArea(-angle, OccupiedArea(sr_angle, obj))); }
{
m_UsedAreaLists[USED_POS_MINUS].insert(UsedArea(-angle, OccupiedArea(sr_angle, obj)));
}
}
/**
@ -135,7 +137,9 @@ void ObjectPosSelector::InitializeAngle(UsedAreaSide side)
m_stepAngle[side] = std::max(m_searchedForReqHAngle + otherArea.second.angleOffset - otherArea.first, 0.0f);
}
else // Other side empty. start from 0
{ m_stepAngle[side] = 0.0f; }
{
m_stepAngle[side] = 0.0f;
}
// As m_stepAngle will be incremented first in ::NextSideAngle
m_stepAngle[side] -= m_searchedForReqHAngle;
@ -171,7 +175,9 @@ bool ObjectPosSelector::NextAngle(float& angle)
}
// both sides finishes
else
{ break; }
{
break;
}
}
// no angles

View file

@ -116,7 +116,9 @@ bool Pet::LoadPetFromDB(Player* owner, uint32 petentry, uint32 petnumber, bool c
ownerid,PET_SAVE_AS_CURRENT,PET_SAVE_LAST_STABLE_SLOT);
if (!result)
{
return false;
}
Field* fields = result->Fetch();
@ -601,7 +603,9 @@ void Pet::RegenerateAll(uint32 update_diff)
m_regenTimer = 4000;
}
else
{ m_regenTimer -= update_diff; }
{
m_regenTimer -= update_diff;
}
}
bool Pet::CanTakeMoreActiveSpells(uint32 spellid)
@ -842,7 +846,9 @@ bool Pet::CreateBaseAtCreature(Creature* creature)
SetName(cFamily->Name[sWorld.GetDefaultDbcLocale()]);
}
else
{ SetName(creature->GetNameForLocaleIdx(sObjectMgr.GetDBCLocaleIndex())); }
{
SetName(creature->GetNameForLocaleIdx(sObjectMgr.GetDBCLocaleIndex()));
}
SetByteValue(UNIT_FIELD_BYTES_0, 1, CLASS_WARRIOR);
SetByteValue(UNIT_FIELD_BYTES_0, 2, GENDER_NONE);
@ -1195,10 +1201,14 @@ uint32 Pet::GetCurrentFoodBenefitLevel(uint32 itemlevel)
}
// -10..-6
else if (getLevel() <= itemlevel + 10) // pure guess, but sounds good
{ return 17000; }
{
return 17000;
}
// -14..-11
else if (getLevel() <= itemlevel + 14) // level 55 food gets green on 70, makes sense to me
{ return 8000; }
{
return 8000;
}
// -15 or less
else
{ return 0; } // food too low level
@ -1407,7 +1417,9 @@ void Pet::_LoadAuras(uint32 timediff)
remaincharges = procCharges;
}
else
{ remaincharges = 0; }
{
remaincharges = 0;
}
uint32 defstackamount = spellproto->GetStackAmount();
if (!defstackamount)
@ -1417,7 +1429,9 @@ void Pet::_LoadAuras(uint32 timediff)
else if (defstackamount < stackcount)
stackcount = defstackamount;
else if (!stackcount)
{ stackcount = 1; }
{
stackcount = 1;
}
SpellAuraHolder* holder = CreateSpellAuraHolder(spellproto, this, NULL);
holder->SetLoadedState(casterGuid, ObjectGuid(HIGHGUID_ITEM, item_lowguid), stackcount, remaincharges, maxduration, remaintime);
@ -1444,7 +1458,9 @@ void Pet::_LoadAuras(uint32 timediff)
AddSpellAuraHolder(holder);
}
else
{ delete holder; }
{
delete holder;
}
}
while (result->NextRow());
@ -1557,7 +1573,9 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
CharacterDatabase.PExecute("DELETE FROM pet_spell WHERE spell = '%u'", spell_id);
}
else
{ sLog.outError("Pet::addSpell: nonexistent in SpellStore spell #%u request.", spell_id); }
{
sLog.outError("Pet::addSpell: nonexistent in SpellStore spell #%u request.", spell_id);
}
return false;
}
@ -1580,12 +1598,16 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
ToggleAutocast(spell_id, true);
}
else if (active == ACT_DISABLED)
{ ToggleAutocast(spell_id, false); }
{
ToggleAutocast(spell_id, false);
}
return false;
}
else
{ return false; }
{
return false;
}
}
uint32 oldspell_id = 0;
@ -1601,10 +1623,14 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
newspell.active = ACT_PASSIVE;
}
else
{ newspell.active = ACT_DISABLED; }
{
newspell.active = ACT_DISABLED;
}
}
else
{ newspell.active = active; }
{
newspell.active = active;
}
// talent: unlearn all other talent ranks (high and low)
if (TalentSpellPos const* talentPos = GetTalentSpellPos(spell_id))
@ -1647,7 +1673,9 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
}
// ignore new lesser rank
else if (sSpellMgr.IsHighRankOfSpell(itr2->first, spell_id))
{ return false; }
{
return false;
}
}
}
}
@ -1659,7 +1687,9 @@ bool Pet::addSpell(uint32 spell_id, ActiveStates active /*= ACT_DECIDE*/, PetSpe
CastSpell(this, spell_id, true);
}
else
{ m_charmInfo->AddSpellToActionBar(spell_id, ActiveStates(newspell.active)); }
{
m_charmInfo->AddSpellToActionBar(spell_id, ActiveStates(newspell.active));
}
if (newspell.active == ACT_ENABLED)
{
@ -1776,7 +1806,9 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
m_spells.erase(itr);
}
else
{ itr->second.state = PETSPELL_REMOVED; }
{
itr->second.state = PETSPELL_REMOVED;
}
RemoveAurasDueToSpell(spell_id);
@ -1798,7 +1830,9 @@ bool Pet::removeSpell(uint32 spell_id, bool learn_prev, bool clear_ab)
learnSpell(prev_id);
}
else
{ learn_prev = false; }
{
learn_prev = false;
}
}
// if remove last rank or non-ranked then update action bar at server and client if need
@ -1843,7 +1877,9 @@ bool Pet::resetTalents(bool no_cost)
{
Unit* owner = GetOwner();
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
{
return false;
}
// not need after this call
if (((Player*)owner)->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
@ -1851,11 +1887,15 @@ bool Pet::resetTalents(bool no_cost)
CreatureInfo const* ci = GetCreatureInfo();
if (!ci)
{
return false;
}
// Check pet talent type
CreatureFamilyEntry const* pet_family = sCreatureFamilyStore.LookupEntry(ci->Family);
if (!pet_family || pet_family->petTalentType < 0)
{
return false;
}
Player* player = (Player*)owner;
@ -1930,7 +1970,9 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
// no offline pets
if (!resultPets)
{
return;
}
QueryResult* result = CharacterDatabase.PQuery(
"SELECT DISTINCT pet_spell.spell FROM pet_spell, character_pet "
@ -1988,7 +2030,9 @@ void Pet::resetTalentsForAllPetsOf(Player* owner, Pet* online_pet /*= NULL*/)
delete result;
if (!need_execute)
{
return;
}
ss << ")";
@ -2024,7 +2068,9 @@ void Pet::InitTalentForLevel()
Unit* owner = GetOwner();
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
{
return;
}
if (!m_loading)
((Player*)owner)->SendTalentsInfoData(true);
@ -2041,13 +2087,19 @@ uint32 Pet::resetTalentsCost() const
}
// then 50 silver
else if (m_resetTalentsCost < 50 * SILVER)
{ return 50 * SILVER; }
{
return 50 * SILVER;
}
// then 1 gold
else if (m_resetTalentsCost < 1 * GOLD)
{ return 1 * GOLD; }
{
return 1 * GOLD;
}
// then increasing at a rate of 1 gold; cap 10 gold
else
{ return (m_resetTalentsCost + 1 * GOLD > 10 * GOLD ? 10 * GOLD : m_resetTalentsCost + 1 * GOLD); }
{
return (m_resetTalentsCost + 1 * GOLD > 10 * GOLD ? 10 * GOLD : m_resetTalentsCost + 1 * GOLD);
}
}
uint8 Pet::GetMaxTalentPointsForLevel(uint32 level)
@ -2174,7 +2226,9 @@ void Pet::LearnPetPassives()
void Pet::CastPetAuras(bool current)
{
if (!isControlled())
{
return;
}
Unit* owner = GetOwner();
@ -2188,14 +2242,18 @@ void Pet::CastPetAuras(bool current)
owner->RemovePetAura(pa);
}
else
{ CastPetAura(pa); }
{
CastPetAura(pa);
}
}
}
void Pet::CastOwnerTalentAuras()
{
if (!GetOwner() || GetOwner()->GetTypeId() != TYPEID_PLAYER)
{
return;
}
Player* pOwner = static_cast<Player *>(GetOwner());
@ -2244,7 +2302,9 @@ void Pet::CastPetAura(PetAura const* aura)
CastCustomSpell(this, auraId, &basePoints, NULL, NULL, true);
}
else
{ CastSpell(this, auraId, true); }
{
CastSpell(this, auraId, true);
}
}
struct DoPetLearnSpell
@ -2335,7 +2395,9 @@ void Pet::ApplyModeFlags(PetModeFlags mode, bool apply)
Unit* owner = GetOwner();
if (!owner || owner->GetTypeId() != TYPEID_PLAYER)
{
return;
}
WorldPacket data(SMSG_PET_MODE, 12);
data << GetObjectGuid();

View file

@ -54,7 +54,9 @@ void PetAI::MoveInLineOfSight(Unit* pWho)
{
if (Unit* victim = m_creature->getVictim())
if (victim->IsAlive())
{
return;
}
if (CharmInfo* charmInfo = m_creature->GetCharmInfo())
{
@ -154,7 +156,9 @@ void PetAI::UpdateAI(const uint32 diff)
// UpdateAllies self set update timer
{ UpdateAllies(); }
else
{ m_updateAlliesTimer -= diff; }
{
m_updateAlliesTimer -= diff;
}
if (inCombat && !victim)
{
@ -214,7 +218,9 @@ void PetAI::UpdateAI(const uint32 diff)
((Pet*)m_creature)->SetSpellOpener();
}
else
{
return;
}
}
// Autocast (casted only in combat or persistent spells in any state)
else if (!m_creature->IsNonMeleeSpellCasted(false))
@ -357,7 +363,9 @@ void PetAI::UpdateAI(const uint32 diff)
// Stop here if casting spell (No melee and no movement)
if (m_creature->IsNonMeleeSpellCasted(false))
{
return;
}
if (victim)
{
@ -465,7 +473,9 @@ void PetAI::UpdateAllies()
return;
}
else if (owner->GetTypeId() == TYPEID_PLAYER)
{ pGroup = ((Player*)owner)->GetGroup(); }
{
pGroup = ((Player*)owner)->GetGroup();
}
// only pet and owner/not in group->ok
if (m_AllySet.size() == 2 && !pGroup)
@ -499,7 +509,9 @@ void PetAI::UpdateAllies()
}
}
else // remove group
{ m_AllySet.insert(owner->GetObjectGuid()); }
{
m_AllySet.insert(owner->GetObjectGuid());
}
}
void PetAI::AttackedBy(Unit* attacker)

File diff suppressed because it is too large Load diff

View file

@ -246,7 +246,9 @@ struct Glyph
void SetId(uint32 newId)
{
if (newId == id)
{
return;
}
if (id == 0 && uState == GLYPH_UNCHANGED) // not exist yet in db and already saved
{
@ -925,7 +927,9 @@ class PlayerTaxi
return true;
}
else
{ return false; }
{
return false;
}
}
void AppendTaximaskTo(ByteBuffer& data, bool all);
@ -1197,7 +1201,9 @@ class Player : public Unit
m_ExtraFlags |= PLAYER_EXTRA_AUCTION_ENEMY;
}
else if (state > 0)
{ m_ExtraFlags |= PLAYER_EXTRA_AUCTION_NEUTRAL; }
{
m_ExtraFlags |= PLAYER_EXTRA_AUCTION_NEUTRAL;
}
}
@ -2307,7 +2313,9 @@ class Player : public Unit
{
for (int i = 0; i < PLAYER_MAX_BATTLEGROUND_QUEUES; ++i)
if (m_bgBattleGroundQueueID[i].invitedToInstance == instanceId)
{
return m_bgBattleGroundQueueID[i].bgQueueTypeId;
}
return BATTLEGROUND_QUEUE_NONE;
}
uint32 GetBattleGroundQueueIndex(BattleGroundQueueTypeId bgQueueTypeId) const

View file

@ -35,7 +35,9 @@ int
ReactorAI::Permissible(const Creature* creature)
{
if (creature->IsCivilian() || creature->IsNeutralToAll())
{
return PERMIT_BASE_REACTIVE;
}
return PERMIT_BASE_NO;
}
@ -49,7 +51,9 @@ void
ReactorAI::AttackStart(Unit* p)
{
if (!p || !m_creature->CanAttackByItself())
{
return;
}
if (m_creature->Attack(p, true))
{
@ -75,7 +79,9 @@ ReactorAI::UpdateAI(const uint32 /*time_diff*/)
{
// update i_victimGuid if i_creature.getVictim() !=0 and changed
if (!m_creature->SelectHostileTarget() || !m_creature->getVictim())
{
return;
}
i_victimGuid = m_creature->getVictim()->GetObjectGuid();

View file

@ -40,7 +40,9 @@ ReputationRank ReputationMgr::ReputationToRank(int32 standing)
{
limit -= PointsInRank[i];
if (standing >= limit)
{
return ReputationRank(i);
}
}
return MIN_REPUTATION_RANK;
}
@ -61,7 +63,9 @@ int32 ReputationMgr::GetReputation(uint32 faction_id) const
int32 ReputationMgr::GetBaseReputation(FactionEntry const* factionEntry) const
{
if (!factionEntry)
{
return 0;
}
uint32 raceMask = m_player->getRaceMask();
uint32 classMask = m_player->getClassMask();
@ -75,10 +79,14 @@ int32 ReputationMgr::GetReputation(FactionEntry const* factionEntry) const
{
// Faction without recorded reputation. Just ignore.
if (!factionEntry)
{
return 0;
}
if (FactionState const* state = GetState(factionEntry))
{
return GetBaseReputation(factionEntry) + state->Standing;
}
return 0;
}
@ -106,7 +114,9 @@ void ReputationMgr::ApplyForceReaction(uint32 faction_id, ReputationRank rank, b
uint32 ReputationMgr::GetDefaultStateFlags(FactionEntry const* factionEntry) const
{
if (!factionEntry)
{
return 0;
}
uint32 raceMask = m_player->getRaceMask();
uint32 classMask = m_player->getClassMask();
@ -201,7 +211,9 @@ void ReputationMgr::SendInitialReputations()
void ReputationMgr::SendVisible(FactionState const* faction) const
{
if (m_player->GetSession()->PlayerLoading())
{
return;
}
// make faction visible in reputation list at client
WorldPacket data(SMSG_SET_FACTION_VISIBLE, 4);
@ -361,7 +373,9 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in
achievementManager.UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_GAIN_HONORED_REPUTATION, factionEntry->ID);
if (new_rank > old_rank)
{
return true;
}
}
return false;
}
@ -369,7 +383,9 @@ bool ReputationMgr::SetOneFactionReputation(FactionEntry const* factionEntry, in
void ReputationMgr::SetVisible(FactionTemplateEntry const* factionTemplateEntry)
{
if (!factionTemplateEntry->faction)
{
return;
}
if (FactionEntry const* factionEntry = sFactionStore.LookupEntry(factionTemplateEntry->faction))
SetVisible(factionEntry);
@ -378,11 +394,15 @@ void ReputationMgr::SetVisible(FactionTemplateEntry const* factionTemplateEntry)
void ReputationMgr::SetVisible(FactionEntry const* factionEntry)
{
if (factionEntry->reputationListID < 0)
{
return;
}
FactionStateList::iterator itr = m_factions.find(factionEntry->reputationListID);
if (itr == m_factions.end())
{
return;
}
SetVisible(&itr->second);
}
@ -391,11 +411,15 @@ void ReputationMgr::SetVisible(FactionState* faction)
{
// always invisible or hidden faction can't be make visible
if (faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED | FACTION_FLAG_HIDDEN))
{
return;
}
// already set
if (faction->Flags & FACTION_FLAG_VISIBLE)
{
return;
}
faction->Flags |= FACTION_FLAG_VISIBLE;
faction->needSend = true;
@ -410,11 +434,15 @@ void ReputationMgr::SetAtWar(RepListID repListID, bool on)
{
FactionStateList::iterator itr = m_factions.find(repListID);
if (itr == m_factions.end())
{
return;
}
// always invisible or hidden faction can't change war state
if (itr->second.Flags & (FACTION_FLAG_INVISIBLE_FORCED | FACTION_FLAG_HIDDEN))
{
return;
}
SetAtWar(&itr->second, on);
}
@ -423,11 +451,15 @@ void ReputationMgr::SetAtWar(FactionState* faction, bool atWar)
{
// not allow declare war to faction unless already hated or less
if (atWar && (faction->Flags & FACTION_FLAG_PEACE_FORCED) && ReputationToRank(faction->Standing) > REP_HATED)
{
return;
}
// already set
if (((faction->Flags & FACTION_FLAG_AT_WAR) != 0) == atWar)
{
return;
}
if (atWar)
faction->Flags |= FACTION_FLAG_AT_WAR;
@ -442,7 +474,9 @@ void ReputationMgr::SetInactive(RepListID repListID, bool on)
{
FactionStateList::iterator itr = m_factions.find(repListID);
if (itr == m_factions.end())
{
return;
}
SetInactive(&itr->second, on);
}
@ -451,11 +485,15 @@ void ReputationMgr::SetInactive(FactionState* faction, bool inactive)
{
// always invisible or hidden faction can't be inactive
if (inactive && ((faction->Flags & (FACTION_FLAG_INVISIBLE_FORCED | FACTION_FLAG_HIDDEN)) || !(faction->Flags & FACTION_FLAG_VISIBLE)))
{
return;
}
// already set
if (((faction->Flags & FACTION_FLAG_INACTIVE) != 0) == inactive)
{
return;
}
if (inactive)
faction->Flags |= FACTION_FLAG_INACTIVE;

View file

@ -60,12 +60,16 @@ bool PlayerSocial::AddToSocialList(ObjectGuid friend_guid, bool ignore)
if (ignore)
{
if (GetNumberOfSocialsWithFlag(SOCIAL_FLAG_IGNORED) >= SOCIALMGR_IGNORE_LIMIT)
{
return false;
}
}
else
{
if (GetNumberOfSocialsWithFlag(SOCIAL_FLAG_FRIEND) >= SOCIALMGR_FRIEND_LIMIT)
{
return false;
}
}
uint32 flag = SOCIAL_FLAG_FRIEND;
@ -92,7 +96,9 @@ void PlayerSocial::RemoveFromSocialList(ObjectGuid friend_guid, bool ignore)
{
PlayerSocialMap::iterator itr = m_playerSocialMap.find(friend_guid.GetCounter());
if (itr == m_playerSocialMap.end()) // not exist
{
return;
}
uint32 flag = SOCIAL_FLAG_FRIEND;
if (ignore)
@ -114,7 +120,9 @@ void PlayerSocial::SetFriendNote(ObjectGuid friend_guid, std::string note)
{
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid.GetCounter());
if (itr == m_playerSocialMap.end()) // not exist
{
return;
}
utf8truncate(note, 48); // DB and client size limitation
@ -128,7 +136,9 @@ void PlayerSocial::SendSocialList()
{
Player* plr = sObjectMgr.GetPlayer(ObjectGuid(HIGHGUID_PLAYER, m_playerLowGuid));
if (!plr)
{
return;
}
uint32 size = m_playerSocialMap.size();
@ -164,7 +174,9 @@ bool PlayerSocial::HasFriend(ObjectGuid friend_guid)
{
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(friend_guid.GetCounter());
if (itr != m_playerSocialMap.end())
{
return itr->second.Flags & SOCIAL_FLAG_FRIEND;
}
return false;
}
@ -172,7 +184,9 @@ bool PlayerSocial::HasIgnore(ObjectGuid ignore_guid)
{
PlayerSocialMap::const_iterator itr = m_playerSocialMap.find(ignore_guid.GetCounter());
if (itr != m_playerSocialMap.end())
{
return itr->second.Flags & SOCIAL_FLAG_IGNORED;
}
return false;
}
@ -187,7 +201,9 @@ SocialMgr::~SocialMgr()
void SocialMgr::GetFriendInfo(Player* player, uint32 friend_lowguid, FriendInfo& friendInfo)
{
if (!player)
{
return;
}
Player* pFriend = ObjectAccessor::FindPlayer(ObjectGuid(HIGHGUID_PLAYER, friend_lowguid));
@ -273,7 +289,9 @@ void SocialMgr::SendFriendStatus(Player* player, FriendsResult result, ObjectGui
void SocialMgr::BroadcastToFriendListers(Player* player, WorldPacket* packet)
{
if (!player)
{
return;
}
Team team = player->GetTeam();
AccountTypes security = player->GetSession()->GetSecurity();
@ -307,7 +325,9 @@ PlayerSocial* SocialMgr::LoadFromDB(QueryResult* result, ObjectGuid guid)
social->SetPlayerGuid(guid);
if (!result)
{
return social;
}
uint32 friend_guid = 0;
uint32 flags = 0;

File diff suppressed because it is too large Load diff

View file

@ -89,19 +89,25 @@ float CalculateDefaultCoefficient(SpellEntry const* spellProto, DamageEffectType
inline float GetSpellMinRange(SpellRangeEntry const* range, bool friendly = false)
{
if (!range)
{
return 0;
}
return (friendly ? range->minRangeFriendly : range->minRange);
}
inline float GetSpellMaxRange(SpellRangeEntry const* range, bool friendly = false)
{
if (!range)
{
return 0;
}
return (friendly ? range->maxRangeFriendly : range->maxRange);
}
inline uint32 GetSpellRecoveryTime(SpellEntry const *spellInfo)
{
if(SpellCooldownsEntry const* cooldowns = spellInfo->GetSpellCooldowns())
{
return cooldowns->RecoveryTime > cooldowns->CategoryRecoveryTime ? cooldowns->RecoveryTime : cooldowns->CategoryRecoveryTime;
}
return 0;
}
int32 GetSpellDuration(SpellEntry const *spellInfo);
@ -117,7 +123,9 @@ inline bool IsSpellHaveEffect(SpellEntry const* spellInfo, SpellEffects effect)
{
if(SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i)))
if(SpellEffects(effectEntry->Effect) == effect)
{
return true;
}
}
return false;
}
@ -126,7 +134,9 @@ inline bool IsAuraApplyEffect(SpellEntry const* spellInfo, SpellEffectIndex effe
{
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(SpellEffectIndex(effecIdx));
if (!spellEffect)
{
return false;
}
switch (spellEffect->Effect)
{
@ -147,7 +157,9 @@ inline bool IsSpellAppliesAura(SpellEntry const* spellInfo, uint32 effectMask =
for (int i = 0; i < MAX_EFFECT_INDEX; ++i)
if (effectMask & (1 << i))
if (IsAuraApplyEffect(spellInfo, SpellEffectIndex(i)))
{
return true;
}
return false;
}
@ -156,7 +168,9 @@ inline bool IsEffectHandledOnDelayedSpellLaunch(SpellEntry const* spellInfo, Spe
{
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(effecIdx);
if(!effectEntry)
{
return false;
}
switch (effectEntry->Effect)
{
case SPELL_EFFECT_SCHOOL_DAMAGE:
@ -174,7 +188,9 @@ inline bool IsPeriodicRegenerateEffect(SpellEntry const* spellInfo, SpellEffectI
{
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(effecIdx);
if(!effectEntry)
{
return false;
}
switch (AuraType(effectEntry->EffectApplyAuraName))
{
@ -195,7 +211,9 @@ inline bool IsSpellHaveAura(SpellEntry const* spellInfo, AuraType aura, uint32 e
if (effectMask & (1 << i))
if(SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i)))
if(AuraType(effectEntry->EffectApplyAuraName) == aura)
{
return true;
}
return false;
}
@ -205,7 +223,9 @@ inline bool IsSpellLastAuraEffect(SpellEntry const* spellInfo, SpellEffectIndex
{
if(SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(i)))
if(effectEntry->EffectApplyAuraName)
{
return false;
}
}
return true;
@ -243,7 +263,9 @@ inline bool IsLootCraftingSpell(SpellEntry const* spellInfo)
{
SpellEffectEntry const* spellEffect0 = spellInfo->GetSpellEffect(EFFECT_INDEX_0);
if (!spellEffect0)
{
return false;
}
SpellTotemsEntry const* totems = spellInfo->GetSpellTotems();
@ -273,7 +295,9 @@ inline bool IsSpellRemoveAllMovementAndControlLossEffects(SpellEntry const* spel
{
SpellEffectEntry const* spellEffect0 = spellProto->GetSpellEffect(EFFECT_INDEX_0);
if (!spellEffect0)
{
return false;
}
return spellEffect0->EffectApplyAuraName == SPELL_AURA_MECHANIC_IMMUNITY &&
spellEffect0->EffectMiscValue == 1 &&
@ -351,14 +375,20 @@ inline bool IsSpellWithCasterSourceTargetsOnly(SpellEntry const* spellInfo)
uint32 targetA = effectEntry->EffectImplicitTargetA;
if(targetA && !IsCasterSourceTarget(targetA))
{
return false;
}
uint32 targetB = effectEntry->EffectImplicitTargetB;
if(targetB && !IsCasterSourceTarget(targetB))
{
return false;
}
if (!targetA && !targetB)
{
return false;
}
}
return true;
}
@ -439,13 +469,19 @@ inline bool IsAreaOfEffectSpell(SpellEntry const* spellInfo)
{
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(EFFECT_INDEX_0);
if(effectEntry && (IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetA)) || IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetB))))
{
return true;
}
effectEntry = spellInfo->GetSpellEffect(EFFECT_INDEX_1);
if(effectEntry && (IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetA)) || IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetB))))
{
return true;
}
effectEntry = spellInfo->GetSpellEffect(EFFECT_INDEX_2);
if(effectEntry && (IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetA)) || IsAreaEffectTarget(Targets(effectEntry->EffectImplicitTargetB))))
{
return true;
}
return false;
}
@ -470,7 +506,9 @@ inline bool HasAreaAuraEffect(SpellEntry const* spellInfo)
if(!effectEntry)
continue;
if (IsAreaAuraEffect(effectEntry->Effect))
{
return true;
}
}
return false;
}
@ -554,11 +592,15 @@ inline bool IsChanneledSpell(SpellEntry const* spellInfo)
inline bool IsNeedCastSpellAtFormApply(SpellEntry const* spellInfo, ShapeshiftForm form)
{
if ((!spellInfo->HasAttribute(SPELL_ATTR_PASSIVE) && !spellInfo->HasAttribute(SPELL_ATTR_UNK7)) || !form)
{
return false;
}
SpellShapeshiftEntry const* shapeShift = spellInfo->GetSpellShapeshift();
if (!shapeShift)
{
return false;
}
// passive spells with SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT are already active without shapeshift, do no recast!
return (shapeShift->Stances & (1<<(form-1)) && !(spellInfo->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT));
@ -623,10 +665,14 @@ inline Mechanics GetEffectMechanic(SpellEntry const* spellInfo, SpellEffectIndex
{
SpellEffectEntry const* effectEntry = spellInfo->GetSpellEffect(SpellEffectIndex(effect));
if (effectEntry && effectEntry->EffectMechanic)
{
return Mechanics(effectEntry->EffectMechanic);
}
SpellCategoriesEntry const* spellCategory = spellInfo->GetSpellCategories();
if (spellCategory && spellCategory->Mechanic)
{
return Mechanics(spellCategory->Mechanic);
}
return MECHANIC_NONE;
}
@ -634,9 +680,13 @@ inline uint32 GetDispellMask(DispelType dispel)
{
// If dispell all
if (dispel == DISPEL_ALL)
{
return DISPEL_ALL_MASK;
}
else
{
return (1 << dispel);
}
}
// Diminishing Returns interaction with spells
@ -850,14 +900,20 @@ class PetAura
{
std::map<uint32, uint32>::const_iterator itr = auras.find(petEntry);
if (itr != auras.end())
{
return itr->second;
}
else
{
std::map<uint32, uint32>::const_iterator itr2 = auras.find(0);
if (itr2 != auras.end())
{
return itr2->second;
}
else
{
return 0;
}
}
}
@ -996,7 +1052,9 @@ class SpellMgr
{
SpellElixirMap::const_iterator itr = mSpellElixirs.find(spellid);
if (itr == mSpellElixirs.end())
{
return 0x0;
}
return itr->second;
}
@ -1007,22 +1065,34 @@ class SpellMgr
// flasks must have all bits set from ELIXIR_FLASK_MASK
if ((mask & ELIXIR_FLASK_MASK) == ELIXIR_FLASK_MASK)
{
return SPELL_FLASK_ELIXIR;
}
else if (mask & ELIXIR_BATTLE_MASK)
{
return SPELL_BATTLE_ELIXIR;
}
else if (mask & ELIXIR_GUARDIAN_MASK)
{
return SPELL_GUARDIAN_ELIXIR;
}
else if (mask & ELIXIR_WELL_FED)
{
return SPELL_WELL_FED;
}
else
{
return SPELL_NORMAL;
}
}
SpellThreatEntry const* GetSpellThreatEntry(uint32 spellid) const
{
SpellThreatMap::const_iterator itr = mSpellThreatMap.find(spellid);
if (itr != mSpellThreatMap.end())
{
return &itr->second;
}
return NULL;
}
@ -1030,10 +1100,14 @@ class SpellMgr
float GetSpellThreatMultiplier(SpellEntry const* spellInfo) const
{
if (!spellInfo)
{
return 1.0f;
}
if (SpellThreatEntry const* entry = GetSpellThreatEntry(spellInfo->Id))
{
return entry->multiplier;
}
return 1.0f;
}
@ -1043,7 +1117,9 @@ class SpellMgr
{
SpellProcEventMap::const_iterator itr = mSpellProcEventMap.find(spellId);
if (itr != mSpellProcEventMap.end())
{
return &itr->second;
}
return NULL;
}
@ -1052,7 +1128,9 @@ class SpellMgr
{
SpellProcItemEnchantMap::const_iterator itr = mSpellProcItemEnchantMap.find(spellid);
if (itr == mSpellProcItemEnchantMap.end())
{
return 0.0f;
}
return itr->second;
}
@ -1065,7 +1143,9 @@ class SpellMgr
// Lookup data
SpellBonusMap::const_iterator itr = mSpellBonusMap.find(spellId);
if (itr != mSpellBonusMap.end())
{
return &itr->second;
}
return NULL;
}
@ -1075,7 +1155,9 @@ class SpellMgr
{
SpellTargetPositionMap::const_iterator itr = mSpellTargetPositions.find(spell_id);
if (itr != mSpellTargetPositions.end())
{
return &itr->second;
}
return NULL;
}
@ -1084,7 +1166,9 @@ class SpellMgr
{
SpellChainMap::const_iterator itr = mSpellChains.find(spell_id);
if (itr == mSpellChains.end())
{
return NULL;
}
return &itr->second;
}
@ -1092,7 +1176,9 @@ class SpellMgr
uint32 GetFirstSpellInChain(uint32 spell_id) const
{
if (SpellChainNode const* node = GetSpellChainNode(spell_id))
{
return node->first;
}
return spell_id;
}
@ -1100,7 +1186,9 @@ class SpellMgr
uint32 GetPrevSpellInChain(uint32 spell_id) const
{
if (SpellChainNode const* node = GetSpellChainNode(spell_id))
{
return node->prev;
}
return 0;
}
@ -1123,7 +1211,9 @@ class SpellMgr
uint8 GetSpellRank(uint32 spell_id) const
{
if (SpellChainNode const* node = GetSpellChainNode(spell_id))
{
return node->rank;
}
return 0;
}
@ -1136,12 +1226,16 @@ class SpellMgr
// not ordered correctly by rank value
if (itr == mSpellChains.end() || !rank2 || itr->second.rank <= rank2)
{
return false;
}
// check present in same rank chain
for (; itr != mSpellChains.end(); itr = mSpellChains.find(itr->second.prev))
if (itr->second.prev == spell2)
{
return true;
}
return false;
}
@ -1164,9 +1258,13 @@ class SpellMgr
{
SpellLearnSkillMap::const_iterator itr = mSpellLearnSkills.find(spell_id);
if (itr != mSpellLearnSkills.end())
{
return &itr->second;
}
else
{
return NULL;
}
}
bool IsSpellLearnSpell(uint32 spell_id) const
@ -1184,7 +1282,9 @@ class SpellMgr
SpellLearnSpellMapBounds bounds = GetSpellLearnSpellMapBounds(spell_id1);
for (SpellLearnSpellMap::const_iterator i = bounds.first; i != bounds.second; ++i)
if (i->second.spell == spell_id2)
{
return true;
}
return false;
}
@ -1213,18 +1313,26 @@ class SpellMgr
{
SpellPetAuraMap::const_iterator itr = mSpellPetAuraMap.find((spell_id << 8) + eff);
if (itr != mSpellPetAuraMap.end())
{
return &itr->second;
}
else
{
return NULL;
}
}
PetLevelupSpellSet const* GetPetLevelupSpellList(uint32 petFamily) const
{
PetLevelupSpellMap::const_iterator itr = mPetLevelupSpellMap.find(petFamily);
if (itr != mPetLevelupSpellMap.end())
{
return &itr->second;
}
else
{
return NULL;
}
}
// < 0 for petspelldata id, > 0 for creature_id
@ -1232,7 +1340,9 @@ class SpellMgr
{
PetDefaultSpellsMap::const_iterator itr = mPetDefaultSpellsMap.find(id);
if (itr != mPetDefaultSpellsMap.end())
{
return &itr->second;
}
return NULL;
}

View file

@ -169,7 +169,9 @@ void Player::UpdateResistances(uint32 school)
pet->UpdateResistances(school);
}
else
{ UpdateArmor(); }
{
UpdateArmor();
}
}
void Player::UpdateArmor()
@ -648,7 +650,9 @@ void Player::UpdateAllSpellCritChances()
void Player::UpdateExpertise(WeaponAttackType attack)
{
if (attack == RANGED_ATTACK)
{
return;
}
int32 expertise = int32(GetRatingBonusValue(CR_EXPERTISE));
@ -736,7 +740,9 @@ void Player::UpdateMasteryAuras()
std::vector<uint32> const* masterySpells = GetTalentTreeMasterySpells(m_talentsPrimaryTree[m_activeSpec]);
if (!masterySpells)
{
return;
}
for (uint32 i = 0; i < masterySpells->size(); ++i)
{
@ -825,7 +831,9 @@ void Creature::UpdateResistances(uint32 school)
SetResistance(SpellSchools(school), int32(value));
}
else
{ UpdateArmor(); }
{
UpdateArmor();
}
}
void Creature::UpdateArmor()
@ -983,7 +991,9 @@ void Pet::UpdateResistances(uint32 school)
SetResistance(SpellSchools(school), int32(value));
}
else
{ UpdateArmor(); }
{
UpdateArmor();
}
}
void Pet::UpdateArmor()
@ -1051,7 +1061,9 @@ void Pet::UpdateAttackPowerAndDamage(bool ranged)
val = GetStat(STAT_STRENGTH) - 10.0f;
}
else
{ val = 2 * GetStat(STAT_STRENGTH) - 20.0f; }
{
val = 2 * GetStat(STAT_STRENGTH) - 20.0f;
}
Unit* owner = GetOwner();
if (owner && owner->GetTypeId() == TYPEID_PLAYER)

View file

@ -61,7 +61,9 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
m_timer -= update_diff;
}
else if (m_timer != m_lifetime)
{ m_timer = m_lifetime; }
{
m_timer = m_lifetime;
}
break;
}
@ -122,10 +124,14 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
return;
}
else
{ m_timer -= update_diff; }
{
m_timer -= update_diff;
}
}
else if (m_timer != m_lifetime)
{ m_timer = m_lifetime; }
{
m_timer = m_lifetime;
}
break;
}
case TEMPSUMMON_TIMED_OOC_OR_DEAD_DESPAWN:
@ -145,10 +151,14 @@ void TemporarySummon::Update(uint32 update_diff, uint32 diff)
return;
}
else
{ m_timer -= update_diff; }
{
m_timer -= update_diff;
}
}
else if (m_timer != m_lifetime)
{ m_timer = m_lifetime; }
{
m_timer = m_lifetime;
}
break;
}
case TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN:

View file

@ -49,7 +49,9 @@ bool Totem::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const*
Team team = owner->GetTypeId() == TYPEID_PLAYER ? ((Player*)owner)->GetTeam() : TEAM_NONE;
if (!CreateFromProto(guidlow, cinfo, team))
{
return false;
}
// special model selection case for totems
if (owner->GetTypeId() == TYPEID_PLAYER)
@ -65,7 +67,9 @@ bool Totem::Create(uint32 guidlow, CreatureCreatePos& cPos, CreatureInfo const*
cPos.m_pos.z = owner->GetPositionZ();
if (!cPos.Relocate(this))
{
return false;
}
// Notify the map's instance data.
// Only works if you create the object in it, not if it is moves to that map.
@ -111,7 +115,9 @@ void Totem::Summon(Unit* owner)
// there are some totems, which exist just for their visual appeareance
if (!GetSpell())
{
return;
}
switch (m_type)
{
@ -174,7 +180,9 @@ void Totem::SetOwner(Unit* owner)
Unit* Totem::GetOwner()
{
if (ObjectGuid ownerGuid = GetOwnerGuid())
{
return ObjectAccessor::GetUnit(*this, ownerGuid);
}
return NULL;
}
@ -199,7 +207,9 @@ bool Totem::IsImmuneToSpellEffect(SpellEntry const* spellInfo, SpellEffectIndex
// Mana Spring, Healing stream, Mana tide
// Flags : 0x00000002000 | 0x00000004000 | 0x00004000000 -> 0x00004006000
if (spellInfo->GetSpellFamilyName() == SPELLFAMILY_SHAMAN && spellInfo->IsFitToFamilyMask(UI64LIT(0x00004006000)))
{
return false;
}
SpellEffectEntry const* spellEffect = spellInfo->GetSpellEffect(index);
if (spellEffect)
{

View file

@ -36,7 +36,9 @@ int
TotemAI::Permissible(const Creature* creature)
{
if (creature->IsTotem())
{
return PERMIT_BASE_PROACTIVE;
}
return PERMIT_BASE_NO;
}
@ -59,15 +61,21 @@ void
TotemAI::UpdateAI(const uint32 /*diff*/)
{
if (getTotem().GetTotemType() != TOTEM_ACTIVE)
{
return;
}
if (!m_creature->IsAlive() || m_creature->IsNonMeleeSpellCasted(false))
{
return;
}
// Search spell
SpellEntry const* spellInfo = sSpellStore.LookupEntry(getTotem().GetSpell());
if (!spellInfo)
{
return;
}
// Get spell rangy
SpellRangeEntry const* srange = sSpellRangeStore.LookupEntry(spellInfo->rangeIndex);

File diff suppressed because it is too large Load diff

View file

@ -1385,7 +1385,9 @@ class Unit : public WorldObject
bool CanUseEquippedWeapon(WeaponAttackType attackType) const
{
if (IsInFeralForm())
{
return false;
}
switch (attackType)
{
@ -1456,10 +1458,14 @@ class Unit : public WorldObject
Unit* getAttackerForHelper() // If someone wants to help, who to give them
{
if (getVictim() != NULL)
{
return getVictim();
}
if (!m_attackers.empty())
{
return *(m_attackers.begin());
}
return NULL;
}
@ -1900,7 +1906,9 @@ class Unit : public WorldObject
bool IsContestedGuard() const
{
if (FactionTemplateEntry const* entry = getFactionTemplateEntry())
{
return entry->IsContestedGuardFaction();
}
return false;
}
@ -3296,7 +3304,9 @@ class Unit : public WorldObject
{
VisibleAuraMap::const_iterator itr = m_visibleAuras.find(slot);
if (itr != m_visibleAuras.end())
{
return itr->second;
}
return NULL;
}
void SetVisibleAura(uint8 slot, SpellAuraHolder* holder)

View file

@ -189,12 +189,16 @@ void VehicleInfo::Board(Unit* passenger, uint8 seat)
// This check is also called in Spell::CheckCast()
if (!CanBoard(passenger))
{
return;
}
// Use the planned seat only if the seat is valid, possible to choose and empty
if (!IsSeatAvailableFor(passenger, seat))
if (!GetUsableSeatFor(passenger, seat))
{
return;
}
VehicleSeatEntry const* seatEntry = GetSeatEntry(seat);
MANGOS_ASSERT(seatEntry);
@ -259,25 +263,33 @@ void VehicleInfo::SwitchSeat(Unit* passenger, uint8 seat)
// Switching seats is not possible
if (m_vehicleEntry->m_flags & VEHICLE_FLAG_DISABLE_SWITCH)
{
return;
}
PassengerMap::const_iterator itr = m_passengers.find(passenger);
MANGOS_ASSERT(itr != m_passengers.end());
// We are already boarded to this seat
if (itr->second->GetTransportSeat() == seat)
{
return;
}
// Check if it's a valid seat
if (!IsSeatAvailableFor(passenger, seat))
{
return;
}
VehicleSeatEntry const* seatEntry = GetSeatEntry(itr->second->GetTransportSeat());
MANGOS_ASSERT(seatEntry);
// Switching seats is only allowed if this flag is set
if (~seatEntry->m_flags & SEAT_FLAG_CAN_SWITCH)
{
return;
}
// Remove passenger modifications of the old seat
RemoveSeatMods(passenger, seatEntry->m_flags);
@ -379,31 +391,45 @@ void VehicleInfo::UnBoard(Unit* passenger, bool changeVehicle)
bool VehicleInfo::CanBoard(Unit* passenger) const
{
if (!passenger)
{
return false;
}
// Passenger is this vehicle
if (passenger == m_owner)
{
return false;
}
// Passenger is already on this vehicle (in this case switching seats is required)
if (passenger->IsBoarded() && passenger->GetTransportInfo()->GetTransport() == m_owner)
{
return false;
}
// Prevent circular boarding: passenger (could only be vehicle) must not have m_owner on board
if (passenger->IsVehicle() && passenger->GetVehicleInfo()->HasOnBoard(m_owner))
{
return false;
}
// Check if we have at least one empty seat
if (!GetEmptySeats())
{
return false;
}
// Passenger is already boarded
if (m_passengers.find(passenger) != m_passengers.end())
{
return false;
}
// Check for empty player seats
if (passenger->GetTypeId() == TYPEID_PLAYER)
{
return GetEmptySeatsMask() & m_playerSeats;
}
// Check for empty creature seats
return GetEmptySeatsMask() & m_creatureSeats;
@ -413,7 +439,9 @@ Unit* VehicleInfo::GetPassenger(uint8 seat) const
{
for (PassengerMap::const_iterator itr = m_passengers.begin(); itr != m_passengers.end(); ++itr)
if (itr->second->GetTransportSeat() == seat)
{
return (Unit*)itr->first;
}
return NULL;
}
@ -468,14 +496,18 @@ bool VehicleInfo::GetUsableSeatFor(Unit* passenger, uint8& seat) const
// No usable seats available
if (!possibleSeats)
{
return false;
}
// Start with 0
seat = 0;
for (uint8 i = 1; seat < MAX_VEHICLE_SEAT; i <<= 1, ++seat)
if (possibleSeats & i)
{
return true;
}
return false;
}