Core/Game: Code style and remove unused core.

Signed-off-by: Gyx <[email protected]>
This commit is contained in:
Gyx
2012-03-17 20:13:37 +08:00
parent 9bb04a23ad
commit 1e94ab8d51
13 changed files with 83 additions and 67 deletions
+1 -1
View File
@@ -70,7 +70,7 @@ bool ChatHandler::HandleStartCommand(const char* /*args*/)
return false; return false;
} }
if ((chr->isDead()) || (chr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))) if (chr->isDead() || chr->HasFlag(PLAYER_FLAGS, PLAYER_FLAGS_GHOST))
{ {
// if player is dead and stuck, send ghost to graveyard // if player is dead and stuck, send ghost to graveyard
chr->RepopAtGraveyard(); chr->RepopAtGraveyard();
+3 -8
View File
@@ -42,7 +42,6 @@
bool ChatHandler::HandleNameAnnounceCommand(const char* args) bool ChatHandler::HandleNameAnnounceCommand(const char* args)
{ {
WorldPacket data;
if (!*args) if (!*args)
return false; return false;
@@ -56,7 +55,6 @@ bool ChatHandler::HandleNameAnnounceCommand(const char* args)
bool ChatHandler::HandleGMNameAnnounceCommand(const char* args) bool ChatHandler::HandleGMNameAnnounceCommand(const char* args)
{ {
WorldPacket data;
if (!*args) if (!*args)
return false; return false;
@@ -422,13 +420,10 @@ bool ChatHandler::HandleTaxiCheatCommand(const char* args)
std::string argstr = (char*)args; std::string argstr = (char*)args;
Player* chr = getSelectedPlayer(); Player* chr = getSelectedPlayer();
if (!chr)
{
chr=m_session->GetPlayer();
}
// check online security if (!chr)
else if (HasLowerSecurity(chr, 0)) chr = m_session->GetPlayer();
else if (HasLowerSecurity(chr, 0)) // check online security
return false; return false;
if (argstr == "on") if (argstr == "on")
+2 -5
View File
@@ -175,7 +175,6 @@ bool ChatHandler::HandleItemMoveCommand(const char* args)
{ {
if (!*args) if (!*args)
return false; return false;
uint8 srcslot, dstslot;
char* pParam1 = strtok((char*)args, " "); char* pParam1 = strtok((char*)args, " ");
if (!pParam1) if (!pParam1)
@@ -185,8 +184,8 @@ bool ChatHandler::HandleItemMoveCommand(const char* args)
if (!pParam2) if (!pParam2)
return false; return false;
srcslot = (uint8)atoi(pParam1); uint8 srcslot = (uint8)atoi(pParam1);
dstslot = (uint8)atoi(pParam2); uint8 dstslot = (uint8)atoi(pParam2);
if (srcslot == dstslot) if (srcslot == dstslot)
return true; return true;
@@ -279,7 +278,6 @@ bool ChatHandler::HandlePInfoCommand(const char* args)
uint32 areaId; uint32 areaId;
uint32 phase = 0; uint32 phase = 0;
// get additional information from Player object // get additional information from Player object
if (target) if (target)
{ {
@@ -756,7 +754,6 @@ bool ChatHandler::HandleLookupPlayerAccountCommand(const char* args)
bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args) bool ChatHandler::HandleLookupPlayerEmailCommand(const char* args)
{ {
if (!*args) if (!*args)
return false; return false;
+3 -10
View File
@@ -87,7 +87,6 @@ bool ChatHandler::HandleSetSkillCommand(const char *args)
return false; return false;
char *level_p = strtok (NULL, " "); char *level_p = strtok (NULL, " ");
if (!level_p) if (!level_p)
return false; return false;
@@ -2146,14 +2145,10 @@ bool ChatHandler::HandleExploreCheatCommand(const char *args)
for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i) for (uint8 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i)
{ {
if (flag != 0) if (flag != 0)
{
m_session->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0xFFFFFFFF); m_session->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0xFFFFFFFF);
}
else else
{
m_session->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0); m_session->GetPlayer()->SetFlag(PLAYER_EXPLORED_ZONES_1+i, 0);
} }
}
return true; return true;
} }
@@ -2434,7 +2429,9 @@ bool ChatHandler::HandleListAurasCommand (const char * /*args*/)
for (uint16 i = 0; i < TOTAL_AURAS; ++i) for (uint16 i = 0; i < TOTAL_AURAS; ++i)
{ {
Unit::AuraEffectList const& uAuraList = unit->GetAuraEffectsByType(AuraType(i)); Unit::AuraEffectList const& uAuraList = unit->GetAuraEffectsByType(AuraType(i));
if (uAuraList.empty()) continue; if (uAuraList.empty())
continue;
PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, uAuraList.size(), i); PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, uAuraList.size(), i);
for (Unit::AuraEffectList::const_iterator itr = uAuraList.begin(); itr != uAuraList.end(); ++itr) for (Unit::AuraEffectList::const_iterator itr = uAuraList.begin(); itr != uAuraList.end(); ++itr)
{ {
@@ -4494,10 +4491,6 @@ bool ChatHandler::HandleChannelSetOwnership(const char *args)
return true; return true;
} }
/*------------------------------------------
*-------------TRINITY----------------------
*-------------------------------------*/
bool ChatHandler::HandlePlayAllCommand(const char *args) bool ChatHandler::HandlePlayAllCommand(const char *args)
{ {
if (!*args) if (!*args)
+3 -1
View File
@@ -474,7 +474,9 @@ void LoadDBCStores(const std::string& dataPath)
for (unsigned int i = 0; i < sTalentStore.GetNumRows(); ++i) for (unsigned int i = 0; i < sTalentStore.GetNumRows(); ++i)
{ {
TalentEntry const* talentInfo = sTalentStore.LookupEntry(i); TalentEntry const* talentInfo = sTalentStore.LookupEntry(i);
if (!talentInfo) continue; if (!talentInfo)
continue;
for (int j = 0; j < MAX_TALENT_RANK; j++) for (int j = 0; j < MAX_TALENT_RANK; j++)
if (talentInfo->RankID[j]) if (talentInfo->RankID[j])
sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(i, j); sTalentSpellPosMap[talentInfo->RankID[j]] = TalentSpellPos(i, j);
@@ -1701,7 +1701,8 @@ SpellInfo const* Creature::reachWithSpellAttack(Unit* victim)
break; break;
} }
} }
if (bcontinue) continue; if (bcontinue)
continue;
if (spellInfo->ManaCost > GetPower(POWER_MANA)) if (spellInfo->ManaCost > GetPower(POWER_MANA))
continue; continue;
@@ -1744,7 +1745,8 @@ SpellInfo const* Creature::reachWithSpellCure(Unit* victim)
break; break;
} }
} }
if (bcontinue) continue; if (bcontinue)
continue;
if (spellInfo->ManaCost > GetPower(POWER_MANA)) if (spellInfo->ManaCost > GetPower(POWER_MANA))
continue; continue;
+2 -1
View File
@@ -1336,7 +1336,8 @@ bool Pet::addSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetSpel
{ {
for (PetSpellMap::const_iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2) for (PetSpellMap::const_iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2)
{ {
if (itr2->second.state == PETSPELL_REMOVED) continue; if (itr2->second.state == PETSPELL_REMOVED)
continue;
SpellInfo const* oldRankSpellInfo = sSpellMgr->GetSpellInfo(itr2->first); SpellInfo const* oldRankSpellInfo = sSpellMgr->GetSpellInfo(itr2->first);
+26 -13
View File
@@ -3692,9 +3692,12 @@ bool Player::addSpell(uint32 spellId, bool active, bool learning, bool dependent
{ {
for (PlayerSpellMap::iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2) for (PlayerSpellMap::iterator itr2 = m_spells.begin(); itr2 != m_spells.end(); ++itr2)
{ {
if (itr2->second->state == PLAYERSPELL_REMOVED) continue; if (itr2->second->state == PLAYERSPELL_REMOVED)
continue;
SpellInfo const* i_spellInfo = sSpellMgr->GetSpellInfo(itr2->first); SpellInfo const* i_spellInfo = sSpellMgr->GetSpellInfo(itr2->first);
if (!i_spellInfo) continue; if (!i_spellInfo)
continue;
if (spellInfo->IsDifferentRankOf(i_spellInfo)) if (spellInfo->IsDifferentRankOf(i_spellInfo))
{ {
@@ -8293,7 +8296,9 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
{ {
uint32 enchant_id = item->GetEnchantmentId(EnchantmentSlot(e_slot)); uint32 enchant_id = item->GetEnchantmentId(EnchantmentSlot(e_slot));
SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id); SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);
if (!pEnchant) continue; if (!pEnchant)
continue;
for (uint8 s = 0; s < MAX_ITEM_ENCHANTMENT_EFFECTS; ++s) for (uint8 s = 0; s < MAX_ITEM_ENCHANTMENT_EFFECTS; ++s)
{ {
if (pEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL) if (pEnchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL)
@@ -11165,7 +11170,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const
Item* pItem = pItems[k]; Item* pItem = pItems[k];
// no item // no item
if (!pItem) continue; if (!pItem)
continue;
sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanStoreItems %i. item = %u, count = %u", k + 1, pItem->GetEntry(), pItem->GetCount()); sLog->outDebug(LOG_FILTER_PLAYER_ITEMS, "STORAGE: CanStoreItems %i. item = %u, count = %u", k + 1, pItem->GetEntry(), pItem->GetCount());
ItemTemplate const* pProto = pItem->GetTemplate(); ItemTemplate const* pProto = pItem->GetTemplate();
@@ -11204,7 +11210,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const
break; break;
} }
} }
if (b_found) continue; if (b_found)
continue;
for (int t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; ++t) for (int t = CURRENCYTOKEN_SLOT_START; t < CURRENCYTOKEN_SLOT_END; ++t)
{ {
@@ -11216,7 +11223,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const
break; break;
} }
} }
if (b_found) continue; if (b_found)
continue;
for (int t = INVENTORY_SLOT_ITEM_START; t < INVENTORY_SLOT_ITEM_END; ++t) for (int t = INVENTORY_SLOT_ITEM_START; t < INVENTORY_SLOT_ITEM_END; ++t)
{ {
@@ -11228,7 +11236,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const
break; break;
} }
} }
if (b_found) continue; if (b_found)
continue;
for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t) for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t)
{ {
@@ -11249,7 +11258,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const
} }
} }
} }
if (b_found) continue; if (b_found)
continue;
} }
// special bag case // special bag case
@@ -11270,7 +11280,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const
} }
} }
if (b_found) continue; if (b_found)
continue;
if (pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS) if (pProto->BagFamily & BAG_FAMILY_MASK_CURRENCY_TOKENS)
{ {
@@ -11285,7 +11296,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const
} }
} }
if (b_found) continue; if (b_found)
continue;
for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t) for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t)
{ {
@@ -11309,7 +11321,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const
} }
} }
} }
if (b_found) continue; if (b_found)
continue;
} }
// search free slot // search free slot
@@ -11323,7 +11336,8 @@ InventoryResult Player::CanStoreItems(Item** pItems, int count) const
break; break;
} }
} }
if (b_found) continue; if (b_found)
continue;
// search free slot in bags // search free slot in bags
for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t) for (int t = INVENTORY_SLOT_BAG_START; !b_found && t < INVENTORY_SLOT_BAG_END; ++t)
@@ -23353,7 +23367,6 @@ void Player::SetTitle(CharTitlesEntry const* title, bool lost)
GetSession()->SendPacket(&data); GetSession()->SendPacket(&data);
} }
/*-----------------------TRINITY--------------------------*/
bool Player::isTotalImmunity() bool Player::isTotalImmunity()
{ {
AuraEffectList const& immune = GetAuraEffectsByType(SPELL_AURA_SCHOOL_IMMUNITY); AuraEffectList const& immune = GetAuraEffectsByType(SPELL_AURA_SCHOOL_IMMUNITY);
@@ -216,7 +216,8 @@ void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket & recv_data)
for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next()) for (GroupReference* itr = grp->GetFirstMember(); itr != NULL; itr = itr->next())
{ {
Player* member = itr->getSource(); Player* member = itr->getSource();
if (!member) continue; // this should never happen if (!member)
continue; // this should never happen
WorldPacket data; WorldPacket data;
+2 -1
View File
@@ -643,7 +643,8 @@ uint32 WorldSession::getDialogStatus(Player* player, Object* questgiver, uint32
uint32 result2 = 0; uint32 result2 = 0;
uint32 quest_id = i->second; uint32 quest_id = i->second;
Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id); Quest const* quest = sObjectMgr->GetQuestTemplate(quest_id);
if (!quest) continue; if (!quest)
continue;
ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, quest->GetQuestId()); ConditionList conditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_QUEST_SHOW_MARK, quest->GetQuestId());
if (!sConditionMgr->IsObjectMeetToConditions(player, conditions)) if (!sConditionMgr->IsObjectMeetToConditions(player, conditions))
@@ -1462,10 +1462,16 @@ void AuraEffect::HandleShapeshiftBoosts(Unit* target, bool apply) const
const PlayerSpellMap& sp_list = target->ToPlayer()->GetSpellMap(); const PlayerSpellMap& sp_list = target->ToPlayer()->GetSpellMap();
for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
{ {
if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled) continue; if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled)
if (itr->first == spellId || itr->first == spellId2) continue; continue;
if (itr->first == spellId || itr->first == spellId2)
continue;
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR0_PASSIVE | SPELL_ATTR0_HIDDEN_CLIENTSIDE))) continue; if (!spellInfo || !(spellInfo->Attributes & (SPELL_ATTR0_PASSIVE | SPELL_ATTR0_HIDDEN_CLIENTSIDE)))
continue;
if (spellInfo->Stances & (1<<(GetMiscValue()-1))) if (spellInfo->Stances & (1<<(GetMiscValue()-1)))
target->CastSpell(target, itr->first, true, NULL, this); target->CastSpell(target, itr->first, true, NULL, this);
} }
@@ -2069,7 +2075,9 @@ void AuraEffect::HandleAuraModShapeshift(AuraApplication const* aurApp, uint8 mo
PlayerSpellMap const& sp_list = target->ToPlayer()->GetSpellMap(); PlayerSpellMap const& sp_list = target->ToPlayer()->GetSpellMap();
for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr) for (PlayerSpellMap::const_iterator itr = sp_list.begin(); itr != sp_list.end(); ++itr)
{ {
if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled) continue; if (itr->second->state == PLAYERSPELL_REMOVED || itr->second->disabled)
continue;
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first);
if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139) if (spellInfo && spellInfo->SpellFamilyName == SPELLFAMILY_WARRIOR && spellInfo->SpellIconID == 139)
Rage_val += target->CalculateSpellDamage(target, spellInfo, 0) * 10; Rage_val += target->CalculateSpellDamage(target, spellInfo, 0) * 10;
+3 -1
View File
@@ -4038,7 +4038,9 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
while (bag) // 256 = 0 due to var type while (bag) // 256 = 0 due to var type
{ {
item = m_caster->ToPlayer()->GetItemByPos(bag, slot); item = m_caster->ToPlayer()->GetItemByPos(bag, slot);
if (item && item->GetEntry() == 38587) break; if (item && item->GetEntry() == 38587)
break;
++slot; ++slot;
if (slot == 39) if (slot == 39)
{ {
+2 -1
View File
@@ -452,7 +452,8 @@ DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, s
{ {
if (!fgets(buf, 32000, fin)) if (!fgets(buf, 32000, fin))
{ {
if (feof(fin)) break; if (feof(fin))
break;
ROLLBACK(DUMP_FILE_BROKEN); ROLLBACK(DUMP_FILE_BROKEN);
} }