Apply style fix

This commit is contained in:
Antz 2020-01-10 23:13:44 +00:00
parent 5531a0087d
commit 35405dd549
155 changed files with 10968 additions and 3660 deletions

View file

@ -224,11 +224,15 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString(const std::string& values, Team
}
if (m_TaxiDestinations.empty())
{ return true; }
{
return true;
}
// Check integrity
if (m_TaxiDestinations.size() < 2)
{ return false; }
{
return false;
}
for (size_t i = 1; i < m_TaxiDestinations.size(); ++i)
{
@ -236,12 +240,16 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString(const std::string& values, Team
uint32 path;
sObjectMgr.GetTaxiPath(m_TaxiDestinations[i - 1], m_TaxiDestinations[i], path, cost);
if (!path)
{ return false; }
{
return false;
}
}
// can't load taxi path without mount set (quest taxi path?)
if (!sObjectMgr.GetTaxiMountDisplayId(GetTaxiSource(), team, true))
{ return false; }
{
return false;
}
return true;
}
@ -249,7 +257,9 @@ bool PlayerTaxi::LoadTaxiDestinationsFromString(const std::string& values, Team
std::string PlayerTaxi::SaveTaxiDestinationsToString()
{
if (m_TaxiDestinations.empty())
{ return ""; }
{
return "";
}
std::ostringstream ss;
@ -262,7 +272,9 @@ std::string PlayerTaxi::SaveTaxiDestinationsToString()
uint32 PlayerTaxi::GetCurrentTaxiPath() const
{
if (m_TaxiDestinations.size() < 2)
{ return 0; }
{
return 0;
}
uint32 path;
uint32 cost;
@ -294,7 +306,9 @@ bool TradeData::HasItem(ObjectGuid item_guid) const
{
for (int i = 0; i < TRADE_SLOT_COUNT; ++i)
if (m_items[i] == item_guid)
{ return true; }
{
return true;
}
return false;
}
@ -309,7 +323,9 @@ void TradeData::SetItem(TradeSlots slot, Item* item)
ObjectGuid itemGuid = item ? item->GetObjectGuid() : ObjectGuid();
if (m_items[slot] == itemGuid)
{ return; }
{
return;
}
m_items[slot] = itemGuid;
@ -320,7 +336,9 @@ void TradeData::SetItem(TradeSlots slot, Item* item)
// need remove possible trader spell applied to changed item
if (slot == TRADE_SLOT_NONTRADED)
{ GetTraderData()->SetSpell(0); }
{
GetTraderData()->SetSpell(0);
}
// need remove possible player spell applied (possible move reagent)
SetSpell(0);
@ -331,7 +349,9 @@ void TradeData::SetSpell(uint32 spell_id, Item* castItem /*= NULL*/)
ObjectGuid itemGuid = castItem ? castItem->GetObjectGuid() : ObjectGuid();
if (m_spell == spell_id && m_spellCastItem == itemGuid)
{ return; }
{
return;
}
m_spell = spell_id;
m_spellCastItem = itemGuid;
@ -346,7 +366,9 @@ void TradeData::SetSpell(uint32 spell_id, Item* castItem /*= NULL*/)
void TradeData::SetMoney(uint64 money)
{
if (m_money == money)
{ return; }
{
return;
}
if (money > m_player->GetMoney())
{
@ -377,7 +399,9 @@ void TradeData::SetAccepted(bool state, bool crosssend /*= false*/)
if (!state)
{
if (crosssend)
{ m_trader->GetSession()->SendTradeStatus(TRADE_STATUS_BACK_TO_TRADE); }
{
m_trader->GetSession()->SendTradeStatus(TRADE_STATUS_BACK_TO_TRADE);
}
else
{ m_player->GetSession()->SendTradeStatus(TRADE_STATUS_BACK_TO_TRADE); }
}
@ -405,11 +429,15 @@ Player::Player(WorldSession* session): Unit(), m_mover(this), m_camera(this), m_
m_ExtraFlags = 0;
if (GetSession()->GetSecurity() >= SEC_GAMEMASTER)
{ SetAcceptTicket(true); }
{
SetAcceptTicket(true);
}
// players always accept
if (GetSession()->GetSecurity() == SEC_PLAYER)
{ SetAcceptWhispers(true); }
{
SetAcceptWhispers(true);
}
m_comboPoints = 0;
@ -786,14 +814,18 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c
for (int j = 0; j < MAX_OUTFIT_ITEMS; ++j)
{
if (oEntry->ItemId[j] <= 0)
{ continue; }
{
continue;
}
uint32 item_id = oEntry->ItemId[j];
// just skip, reported in ObjectMgr::LoadItemPrototypes
ItemPrototype const* iProto = ObjectMgr::GetItemPrototype(item_id);
if (!iProto)
{ continue; }
{
continue;
}
// BuyCount by default
int32 count = iProto->BuyCount;
@ -850,7 +882,9 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c
// if this is ammo then use it
msg = CanUseAmmo(pItem->GetEntry());
if (msg == EQUIP_ERR_OK)
{ SetAmmo(pItem->GetEntry()); }
{
SetAmmo(pItem->GetEntry());
}
}
}
}
@ -872,7 +906,9 @@ bool Player::StoreNewItemInBestSlots(uint32 titem_id, uint32 titem_amount)
uint16 eDest;
uint8 msg = CanEquipNewItem(NULL_SLOT, eDest, titem_id, false);
if (msg != EQUIP_ERR_OK)
{ break; }
{
break;
}
EquipNewItem(eDest, titem_id, true);
AutoUnequipOffhandIfNeed();
@ -907,7 +943,9 @@ Item* Player::StoreNewItemInInventorySlot(uint32 itemEntry, uint32 amount)
if (msg == EQUIP_ERR_OK)
{
if (Item* pItem = StoreNewItem(vDest, itemEntry, true, Item::GenerateItemRandomPropertyId(itemEntry)))
{ return pItem; }
{
return pItem;
}
}
return NULL;
@ -918,7 +956,9 @@ void Player::SendMirrorTimer(MirrorTimerType Type, uint32 MaxValue, uint32 Curre
if (int(MaxValue) == DISABLED_MIRROR_TIMER)
{
if (int(CurrentValue) != DISABLED_MIRROR_TIMER)
{ StopMirrorTimer(Type); }
{
StopMirrorTimer(Type);
}
return;
}
WorldPacket data(SMSG_START_MIRROR_TIMER, (21));
@ -942,13 +982,17 @@ void Player::StopMirrorTimer(MirrorTimerType Type)
uint32 Player::EnvironmentalDamage(EnviromentalDamage type, uint32 damage)
{
if (!IsAlive() || isGameMaster())
{ return 0; }
{
return 0;
}
// Absorb, resist some environmental damage type
uint32 absorb = 0;
uint32 resist = 0;
if (type == DAMAGE_LAVA)
{ CalculateDamageAbsorbAndResist(this, SPELL_SCHOOL_MASK_FIRE, DIRECT_DAMAGE, damage, &absorb, &resist); }
{
CalculateDamageAbsorbAndResist(this, SPELL_SCHOOL_MASK_FIRE, DIRECT_DAMAGE, damage, &absorb, &resist);
}
else if (type == DAMAGE_SLIME)
{ CalculateDamageAbsorbAndResist(this, SPELL_SCHOOL_MASK_NATURE, DIRECT_DAMAGE, damage, &absorb, &resist); }
@ -993,7 +1037,9 @@ int32 Player::getMaxTimer(MirrorTimerType timer)
{
case FATIGUE_TIMER:
if (GetSession()->GetSecurity() >= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FATIGUE_GMLEVEL))
{ return DISABLED_MIRROR_TIMER; }
{
return DISABLED_MIRROR_TIMER;
}
return sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FATIGUE_MAX) * IN_MILLISECONDS;
case BREATH_TIMER:
{
@ -1009,7 +1055,9 @@ int32 Player::getMaxTimer(MirrorTimerType timer)
case FIRE_TIMER:
{
if (!IsAlive() || GetSession()->GetSecurity() >= (AccountTypes)sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FIRE_GMLEVEL))
{ return DISABLED_MIRROR_TIMER; }
{
return DISABLED_MIRROR_TIMER;
}
return sWorld.getConfig(CONFIG_UINT32_TIMERBAR_FIRE_MAX) * IN_MILLISECONDS;
}
default:
@ -1022,13 +1070,17 @@ void Player::UpdateMirrorTimers()
{
// Desync flags for update on next HandleDrowning
if (m_MirrorTimerFlags)
{ m_MirrorTimerFlagsLast = ~m_MirrorTimerFlags; }
{
m_MirrorTimerFlagsLast = ~m_MirrorTimerFlags;
}
}
void Player::HandleDrowning(uint32 time_diff)
{
if (!m_MirrorTimerFlags)
{ return; }
{
return;
}
// In water
if (m_MirrorTimerFlags & UNDERWATER_INWATER)
@ -1061,7 +1113,9 @@ void Player::HandleDrowning(uint32 time_diff)
// Need breath regen
m_MirrorTimer[BREATH_TIMER] += 10 * time_diff;
if (m_MirrorTimer[BREATH_TIMER] >= UnderWaterTime || !IsAlive())
{ StopMirrorTimer(BREATH_TIMER); }
{
StopMirrorTimer(BREATH_TIMER);
}
else if (m_MirrorTimerFlagsLast & UNDERWATER_INWATER)
{ SendMirrorTimer(BREATH_TIMER, UnderWaterTime, m_MirrorTimer[BREATH_TIMER], 10); }
}
@ -1099,7 +1153,9 @@ void Player::HandleDrowning(uint32 time_diff)
int32 DarkWaterTime = getMaxTimer(FATIGUE_TIMER);
m_MirrorTimer[FATIGUE_TIMER] += 10 * time_diff;
if (m_MirrorTimer[FATIGUE_TIMER] >= DarkWaterTime || !IsAlive())
{ StopMirrorTimer(FATIGUE_TIMER); }
{
StopMirrorTimer(FATIGUE_TIMER);
}
else if (m_MirrorTimerFlagsLast & UNDERWATER_INDARKWATER)
{ SendMirrorTimer(FATIGUE_TIMER, DarkWaterTime, m_MirrorTimer[FATIGUE_TIMER], 10); }
}
@ -1108,7 +1164,9 @@ void Player::HandleDrowning(uint32 time_diff)
{
// Breath timer not activated - activate it
if (m_MirrorTimer[FIRE_TIMER] == DISABLED_MIRROR_TIMER)
{ m_MirrorTimer[FIRE_TIMER] = getMaxTimer(FIRE_TIMER); }
{
m_MirrorTimer[FIRE_TIMER] = getMaxTimer(FIRE_TIMER);
}
else
{
m_MirrorTimer[FIRE_TIMER] -= time_diff;
@ -1119,7 +1177,9 @@ void Player::HandleDrowning(uint32 time_diff)
// TODO: Check this formula
uint32 damage = urand(600, 700);
if (m_MirrorTimerFlags & UNDERWATER_INLAVA)
{ EnvironmentalDamage(DAMAGE_LAVA, damage); }
{
EnvironmentalDamage(DAMAGE_LAVA, damage);
}
// need to skip Slime damage in Undercity,
// maybe someone can find better way to handle environmental damage
//else if (m_zoneUpdateId != 1497)
@ -13117,7 +13177,9 @@ void Player::OnGossipSelect(WorldObject* pSource, uint32 gossipListId, uint32 me
if (pMenuData.m_gAction_script)
{
if (pSource->GetTypeId() == TYPEID_UNIT)
{ GetMap()->ScriptsStart(DBS_ON_GOSSIP, pMenuData.m_gAction_script, pSource, this, Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_SOURCE); }
{
GetMap()->ScriptsStart(DBS_ON_GOSSIP, pMenuData.m_gAction_script, pSource, this, Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_SOURCE);
}
else if (pSource->GetTypeId() == TYPEID_GAMEOBJECT)
{ GetMap()->ScriptsStart(DBS_ON_GOSSIP, pMenuData.m_gAction_script, this, pSource, Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_TARGET); }
}
@ -13160,7 +13222,9 @@ uint32 Player::GetGossipTextId(uint32 menuId, WorldObject* pSource)
// Start related script
if (scriptId)
{ GetMap()->ScriptsStart(DBS_ON_GOSSIP, scriptId, this, pSource, Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_TARGET); }
{
GetMap()->ScriptsStart(DBS_ON_GOSSIP, scriptId, this, pSource, Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_TARGET);
}
return textId;
}
@ -13705,7 +13769,9 @@ void Player::AddQuest(Quest const* pQuest, Object* questGiver)
// starting initial DB quest script
if (pQuest->GetQuestStartScript() != 0)
{ GetMap()->ScriptsStart(DBS_ON_QUEST_START, pQuest->GetQuestStartScript(), questGiver, this, Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_SOURCE); }
{
GetMap()->ScriptsStart(DBS_ON_QUEST_START, pQuest->GetQuestStartScript(), questGiver, this, Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_SOURCE);
}
}
// remove start item if not need
@ -13928,7 +13994,9 @@ void Player::RewardQuest(Quest const* pQuest, uint32 reward, Object* questGiver,
}
if (!handled && pQuest->GetQuestCompleteScript() != 0)
{ GetMap()->ScriptsStart(DBS_ON_QUEST_END, pQuest->GetQuestCompleteScript(), questGiver, this, Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_SOURCE); }
{
GetMap()->ScriptsStart(DBS_ON_QUEST_END, pQuest->GetQuestCompleteScript(), questGiver, this, Map::SCRIPT_EXEC_PARAM_UNIQUE_BY_SOURCE);
}
// cast spells after mark quest complete (some spells have quest completed state reqyurements in spell_area data)
if (pQuest->GetRewSpellCast() > 0)
@ -16022,7 +16090,9 @@ bool Player::LoadFromDB(ObjectGuid guid, SqlQueryHolder* holder)
case 1: SetGameMaster(true); break; // enable
case 2: // save state
if (extraflags & PLAYER_EXTRA_GM_ON)
{ SetGameMaster(true); }
{
SetGameMaster(true);
}
break;
}
@ -16084,7 +16154,9 @@ bool Player::IsTappedByMeOrMyGroup(Creature* creature)
{
/* Nobody tapped the monster (solo kill by another NPC) */
if (!creature->HasFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_TAPPED))
{ return false; }
{
return false;
}
/* If there is a loot recipient, assign it to recipient */
if (Player* recipient = creature->GetLootRecipient())
@ -18183,7 +18255,9 @@ void Player::outDebugStatsValues() const
{
// optimize disabled debug output
if (!sLog.HasLogLevelOrHigher(LOG_LVL_DEBUG) || sLog.HasLogFilter(LOG_FILTER_PLAYER_STATS))
{ return; }
{
return;
}
sLog.outDebug("HP is: \t\t\t%u\t\tMP is: \t\t\t%u", GetMaxHealth(), GetMaxPower(POWER_MANA));
sLog.outDebug("AGILITY is: \t\t%f\t\tSTRENGTH is: \t\t%f", GetStat(STAT_AGILITY), GetStat(STAT_STRENGTH));