From 8e8ff7c66037753ffb2a707f5bfde153405e5f35 Mon Sep 17 00:00:00 2001 From: Machiavelli Date: Wed, 29 Feb 2012 13:55:57 +0100 Subject: Core/Conditions: Remove some useless checks in Condition::Meets against a value that's _supposed to be_ const 0 in database. --- src/server/game/Conditions/ConditionMgr.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/server/game/Conditions/ConditionMgr.cpp') diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 7d21f94f372..0f1895bf1ed 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -114,7 +114,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) case CONDITION_QUESTREWARDED: { if (Player* player = object->ToPlayer()) - condMeets = (player->GetQuestRewardStatus(ConditionValue1) == !ConditionValue2); + condMeets = player->GetQuestRewardStatus(ConditionValue1); break; } case CONDITION_QUESTTAKEN: @@ -122,7 +122,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) if (Player* player = object->ToPlayer()) { QuestStatus status = player->GetQuestStatus(ConditionValue1); - condMeets = ((status == QUEST_STATUS_INCOMPLETE) == !ConditionValue2); + condMeets = (status == QUEST_STATUS_INCOMPLETE); } break; } @@ -131,7 +131,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) if (Player* player = object->ToPlayer()) { QuestStatus status = player->GetQuestStatus(ConditionValue1); - condMeets = ((status == QUEST_STATUS_COMPLETE && !player->GetQuestRewardStatus(ConditionValue1)) == !ConditionValue2); + condMeets = (status == QUEST_STATUS_COMPLETE && !player->GetQuestRewardStatus(ConditionValue1)); } break; } @@ -140,7 +140,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) if (Player* player = object->ToPlayer()) { QuestStatus status = player->GetQuestStatus(ConditionValue1); - condMeets = ((status == QUEST_STATUS_NONE) == !ConditionValue2); + condMeets = (status == QUEST_STATUS_NONE); } break; } -- cgit v1.2.3 From e2c20cca72555dbac2fdfe72ee0314d1c494d8ff Mon Sep 17 00:00:00 2001 From: Machiavelli Date: Thu, 1 Mar 2012 14:30:19 +0100 Subject: Core/Conditions: Small optimization in ConditonMgr, as well as proper rules for spellclick conditions in Clean(), and finally some documentation added on how to add new source types. --- src/server/game/Conditions/ConditionMgr.cpp | 51 +++++++++-------------------- src/server/game/Conditions/ConditionMgr.h | 27 +++++++++++++++ 2 files changed, 43 insertions(+), 35 deletions(-) (limited to 'src/server/game/Conditions/ConditionMgr.cpp') diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 0f1895bf1ed..755b9299352 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -515,7 +515,9 @@ bool ConditionMgr::IsObjectMeetToConditionList(ConditionSourceInfo& sourceInfo, sLog->outDebug(LOG_FILTER_CONDITIONSYS, "ConditionMgr::IsPlayerMeetToConditionList condType: %u val1: %u", (*i)->ConditionType, (*i)->ConditionValue1); if ((*i)->isLoaded()) { + //! Find ElseGroup in ElseGroupStore std::map::const_iterator itr = ElseGroupStore.find((*i)->ElseGroup); + //! If not found, add an entry in the store and set to true (placeholder) if (itr == ElseGroupStore.end()) ElseGroupStore[(*i)->ElseGroup] = true; else if (!(*itr).second) @@ -854,18 +856,6 @@ void ConditionMgr::LoadConditions(bool isReload) break; case CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT: { - //if no list for npc create one - if (SpellClickEventConditionStore.find(cond->SourceGroup) == SpellClickEventConditionStore.end()) - { - ConditionTypeContainer cmap; - SpellClickEventConditionStore[cond->SourceGroup] = cmap; - } - //if no list for spellclick spell create one - if (SpellClickEventConditionStore[cond->SourceGroup].find(cond->SourceEntry) == SpellClickEventConditionStore[cond->SourceGroup].end()) - { - ConditionList clist; - SpellClickEventConditionStore[cond->SourceGroup][cond->SourceEntry] = clist; - } SpellClickEventConditionStore[cond->SourceGroup][cond->SourceEntry].push_back(cond); valid = true; ++count; @@ -877,18 +867,6 @@ void ConditionMgr::LoadConditions(bool isReload) break; case CONDITION_SOURCE_TYPE_VEHICLE_SPELL: { - //if no list for vehicle create one - if (VehicleSpellConditionStore.find(cond->SourceGroup) == VehicleSpellConditionStore.end()) - { - ConditionTypeContainer cmap; - VehicleSpellConditionStore[cond->SourceGroup] = cmap; - } - //if no list for vehicle's spell create one - if (VehicleSpellConditionStore[cond->SourceGroup].find(cond->SourceEntry) == VehicleSpellConditionStore[cond->SourceGroup].end()) - { - ConditionList clist; - VehicleSpellConditionStore[cond->SourceGroup][cond->SourceEntry] = clist; - } VehicleSpellConditionStore[cond->SourceGroup][cond->SourceEntry].push_back(cond); valid = true; ++count; @@ -896,18 +874,8 @@ void ConditionMgr::LoadConditions(bool isReload) } case CONDITION_SOURCE_TYPE_SMART_EVENT: { - // If the entry does not exist, create a new list + //! TODO: PAIR_32 ? std::pair key = std::make_pair(cond->SourceEntry, cond->SourceId); - if (SmartEventConditionStore.find(key) == SmartEventConditionStore.end()) - { - ConditionTypeContainer cmap; - SmartEventConditionStore[key] = cmap; - } - if (SmartEventConditionStore[key].find(cond->SourceGroup) == SmartEventConditionStore[key].end()) - { - ConditionList clist; - SmartEventConditionStore[key][cond->SourceGroup] = clist; - } SmartEventConditionStore[key][cond->SourceGroup].push_back(cond); valid = true; ++count; @@ -1929,6 +1897,19 @@ void ConditionMgr::Clean() SmartEventConditionStore.clear(); + for (CreatureSpellConditionContainer::iterator itr = SpellClickEventConditionStore.begin(); itr != SpellClickEventConditionStore.end(); ++itr) + { + for (ConditionTypeContainer::iterator it = itr->second.begin(); it != itr->second.end(); ++it) + { + for (ConditionList::const_iterator i = it->second.begin(); i != it->second.end(); ++i) + delete *i; + it->second.clear(); + } + itr->second.clear(); + } + + SpellClickEventConditionStore.clear(); + // this is a BIG hack, feel free to fix it if you can figure out the ConditionMgr ;) for (std::list::const_iterator itr = AllocatedMemoryStore.begin(); itr != AllocatedMemoryStore.end(); ++itr) delete *itr; diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 5a5e2dd1c2e..ec6d6dd8453 100755 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -72,6 +72,33 @@ enum ConditionTypes CONDITION_MAX = 39 // MAX }; +/*! Documentation on implementing a new ConditionSourceType: + Step 1: Check for the lowest free ID. Look for CONDITION_SOURCE_TYPE_UNUSED_XX in the enum. + Then define the new source type. + + Step 2: Determine and map the parameters for the new condition type. + + Step 3: Add a case block to ConditionMgr::isSourceTypeValid with the new condition type + and validate the parameters. + + Step 4: If your condition can be grouped (determined in step 2), add a rule for it in + ConditionMgr::CanHaveSourceGroupSet, following the example of the existing types. + + Step 5: Define the maximum available condition targets in ConditionMgr::GetMaxAvailableConditionTargets. + + The following steps only apply if your condition can be grouped: + + Step 6: Determine how you are going to store your conditions. You need to add a new storage container + for it in ConditionMgr class, along with a function like: + ConditionList GetConditionsForXXXYourNewSourceTypeXXX(parameters...) + + The above function should be placed in upper level (practical) code that actually + checks the conditions. + + Step 7: Implement loading for your source type in ConditionMgr::LoadConditions. + + Step 8: Implement memory cleaning for your source type in ConditionMgr::Clean. +*/ enum ConditionSourceType { CONDITION_SOURCE_TYPE_NONE = 0, -- cgit v1.2.3 From a153e0ca06698e95a35714964c51abadbd72e3c2 Mon Sep 17 00:00:00 2001 From: click Date: Wed, 7 Mar 2012 00:05:34 +0100 Subject: Core: Remove some whitespace and tabs --- src/server/game/Conditions/ConditionMgr.cpp | 2 +- src/server/game/Conditions/ConditionMgr.h | 4 ++-- src/server/game/Handlers/CalendarHandler.cpp | 2 +- .../Movement/MovementGenerators/TargetedMovementGenerator.cpp | 4 ++-- src/server/game/Spells/Spell.cpp | 2 +- src/server/scripts/Commands/cs_debug.cpp | 6 +++--- .../scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp | 4 ++-- src/server/scripts/Spells/spell_warlock.cpp | 2 +- src/tools/vmap4_extractor/model.cpp | 2 +- src/tools/vmap4_extractor/mpq_libmpq04.h | 10 +++++----- src/tools/vmap4_extractor/vmapexport.h | 4 ++-- 11 files changed, 21 insertions(+), 21 deletions(-) (limited to 'src/server/game/Conditions/ConditionMgr.cpp') diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 755b9299352..eadcc5c5fbb 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -1294,7 +1294,7 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond) default: break; } - + switch (spellInfo->Effects[i].TargetB.GetSelectionCategory()) { case TARGET_SELECT_CATEGORY_NEARBY: diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index ec6d6dd8453..2df79eab088 100755 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -89,10 +89,10 @@ enum ConditionTypes The following steps only apply if your condition can be grouped: Step 6: Determine how you are going to store your conditions. You need to add a new storage container - for it in ConditionMgr class, along with a function like: + for it in ConditionMgr class, along with a function like: ConditionList GetConditionsForXXXYourNewSourceTypeXXX(parameters...) - The above function should be placed in upper level (practical) code that actually + The above function should be placed in upper level (practical) code that actually checks the conditions. Step 7: Implement loading for your source type in ConditionMgr::LoadConditions. diff --git a/src/server/game/Handlers/CalendarHandler.cpp b/src/server/game/Handlers/CalendarHandler.cpp index c9e99af6fed..64acc512add 100755 --- a/src/server/game/Handlers/CalendarHandler.cpp +++ b/src/server/game/Handlers/CalendarHandler.cpp @@ -207,7 +207,7 @@ void WorldSession::HandleCalendarGuildFilter(WorldPacket& recvData) void WorldSession::HandleCalendarArenaTeam(WorldPacket& recvData) { sLog->outDebug(LOG_FILTER_NETWORKIO, "CMSG_CALENDAR_ARENA_TEAM [" UI64FMTD "]", _player->GetGUID()); - + int32 unk1; recvData >> unk1; diff --git a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp index 064a8fc8297..6d507a3b694 100755 --- a/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp +++ b/src/server/game/Movement/MovementGenerators/TargetedMovementGenerator.cpp @@ -40,12 +40,12 @@ void TargetedMovementGeneratorMedium::_setTargetLocation(T &owner) float x, y, z; //! Following block of code deleted by MrSmite in issue 4891 //! Code kept for learning and diagnostical purposes -// +// // if (i_offset && i_target->IsWithinDistInMap(&owner,2*i_offset)) // { // if (!owner.movespline->Finalized()) // return; -// +// // owner.GetPosition(x, y, z); // } // else diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 2ffa94371f9..65ab9444f58 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -6444,7 +6444,7 @@ void Spell::UpdatePointers() SpellDestination& dest = m_destTargets[effIndex]; if (!dest._transportGUID) continue; - + if (!transport || transport->GetGUID() != dest._transportGUID) transport = ObjectAccessor::GetWorldObject(*m_caster, dest._transportGUID); diff --git a/src/server/scripts/Commands/cs_debug.cpp b/src/server/scripts/Commands/cs_debug.cpp index 9646a881fc0..814b18389a7 100644 --- a/src/server/scripts/Commands/cs_debug.cpp +++ b/src/server/scripts/Commands/cs_debug.cpp @@ -1303,10 +1303,10 @@ public: return false; char* mask2 = strtok(NULL, " \n"); - + uint32 moveFlags = (uint32)atoi(mask1); target->SetUnitMovementFlags(moveFlags); - + if (mask2) { uint32 moveFlagsExtra = uint32(atoi(mask2)); @@ -1316,7 +1316,7 @@ public: target->SendMovementFlagUpdate(); handler->PSendSysMessage(LANG_MOVEFLAGS_SET, target->GetUnitMovementFlags(), target->GetExtraUnitMovementFlags()); } - + return true; } }; diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp index 64060464d7c..e03440cec98 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/boss_malygos.cpp @@ -241,7 +241,7 @@ public: _cannotMove = true; me->SetFlying(true); - + if (instance) instance->DoStopTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } @@ -362,7 +362,7 @@ public: Talk(SAY_AGGRO_P_ONE); DoCast(SPELL_BERSEKER); // periodic aura, first tick in 10 minutes - + if (instance) instance->DoStartTimedAchievement(ACHIEVEMENT_TIMED_TYPE_EVENT, ACHIEV_TIMED_START_EVENT); } diff --git a/src/server/scripts/Spells/spell_warlock.cpp b/src/server/scripts/Spells/spell_warlock.cpp index 5ae630fcd68..e4593be295c 100644 --- a/src/server/scripts/Spells/spell_warlock.cpp +++ b/src/server/scripts/Spells/spell_warlock.cpp @@ -449,7 +449,7 @@ class spell_warl_demonic_circle_summon : public SpellScriptLoader { if (GameObject* circle = GetTarget()->GetGameObject(GetId())) { - // Here we check if player is in demonic circle teleport range, if so add + // Here we check if player is in demonic circle teleport range, if so add // WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST; allowing him to cast the WARLOCK_DEMONIC_CIRCLE_TELEPORT. // If not in range remove the WARLOCK_DEMONIC_CIRCLE_ALLOW_CAST. diff --git a/src/tools/vmap4_extractor/model.cpp b/src/tools/vmap4_extractor/model.cpp index ac28e1ff086..e81972f521f 100644 --- a/src/tools/vmap4_extractor/model.cpp +++ b/src/tools/vmap4_extractor/model.cpp @@ -167,7 +167,7 @@ ModelInstance::ModelInstance(MPQFile &f,const char* ModelInstName, uint32 mapID, uint16 adtId = 0;// not used for models uint32 flags = MOD_M2; - if(tileX == 65 && tileY == 65) flags |= MOD_WORLDSPAWN; + if(tileX == 65 && tileY == 65) flags |= MOD_WORLDSPAWN; //write mapID, tileX, tileY, Flags, ID, Pos, Rot, Scale, name fwrite(&mapID, sizeof(uint32), 1, pDirfile); fwrite(&tileX, sizeof(uint32), 1, pDirfile); diff --git a/src/tools/vmap4_extractor/mpq_libmpq04.h b/src/tools/vmap4_extractor/mpq_libmpq04.h index 4b0a2465bfd..ed51022de78 100644 --- a/src/tools/vmap4_extractor/mpq_libmpq04.h +++ b/src/tools/vmap4_extractor/mpq_libmpq04.h @@ -24,14 +24,14 @@ public: void close(); void GetFileListTo(vector& filelist) { - uint32 filenum; - if(libmpq__file_number(mpq_a, "(listfile)", &filenum)) return; - libmpq__off_t size, transferred; - libmpq__file_unpacked_size(mpq_a, filenum, &size); + uint32 filenum; + if(libmpq__file_number(mpq_a, "(listfile)", &filenum)) return; + libmpq__off_t size, transferred; + libmpq__file_unpacked_size(mpq_a, filenum, &size); char *buffer = new char[size]; - libmpq__file_read(mpq_a, filenum, (unsigned char*)buffer, size, &transferred); + libmpq__file_read(mpq_a, filenum, (unsigned char*)buffer, size, &transferred); char seps[] = "\n"; char *token; diff --git a/src/tools/vmap4_extractor/vmapexport.h b/src/tools/vmap4_extractor/vmapexport.h index b407e7a106e..0381011efb7 100644 --- a/src/tools/vmap4_extractor/vmapexport.h +++ b/src/tools/vmap4_extractor/vmapexport.h @@ -23,8 +23,8 @@ enum ModelFlags { - MOD_M2 = 1, - MOD_WORLDSPAWN = 1<<1, + MOD_M2 = 1, + MOD_WORLDSPAWN = 1<<1, MOD_HAS_BOUND = 1<<2 }; -- cgit v1.2.3 From f85fdbebe7db448d895bb97ee5eafa393a1f6547 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 10 Mar 2012 20:53:26 +0100 Subject: Core/DBC: Remove store getters (useless since we don't have scripts as external dll) --- src/server/game/AI/EventAI/CreatureEventAI.cpp | 2 +- src/server/game/AI/ScriptedAI/ScriptedCreature.cpp | 2 +- src/server/game/Conditions/ConditionMgr.cpp | 2 +- src/server/game/DataStores/DBCStores.cpp | 9 --------- src/server/game/DataStores/DBCStores.h | 9 --------- src/server/game/Entities/Player/Player.cpp | 2 +- src/server/game/Scripting/ScriptMgr.cpp | 2 +- src/server/game/Scripting/ScriptSystem.cpp | 4 ++-- src/server/scripts/Commands/cs_achievement.cpp | 2 +- src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp | 2 +- src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp | 2 +- .../scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp | 2 +- 12 files changed, 11 insertions(+), 29 deletions(-) (limited to 'src/server/game/Conditions/ConditionMgr.cpp') diff --git a/src/server/game/AI/EventAI/CreatureEventAI.cpp b/src/server/game/AI/EventAI/CreatureEventAI.cpp index 730606becb5..11887611ae8 100755 --- a/src/server/game/AI/EventAI/CreatureEventAI.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAI.cpp @@ -1252,7 +1252,7 @@ void CreatureEventAI::DoScriptText(int32 textEntry, WorldObject* source, Unit* t if ((*i).second.SoundId) { - if (GetSoundEntriesStore()->LookupEntry((*i).second.SoundId)) + if (sSoundEntriesStore.LookupEntry((*i).second.SoundId)) source->PlayDirectSound((*i).second.SoundId); else sLog->outErrorDb("CreatureEventAI: DoScriptText entry %i tried to process invalid sound id %u.", textEntry, (*i).second.SoundId); diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp index bd6c901f99c..5c1bbf0ad06 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp @@ -171,7 +171,7 @@ void ScriptedAI::DoPlaySoundToSet(WorldObject* source, uint32 soundId) if (!source) return; - if (!GetSoundEntriesStore()->LookupEntry(soundId)) + if (!sSoundEntriesStore.LookupEntry(soundId)) { sLog->outError("TSCR: Invalid soundId %u used in DoPlaySoundToSet (Source: TypeId %u, GUID %u)", soundId, source->GetTypeId(), source->GetGUIDLow()); return; diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index eadcc5c5fbb..7fe6df14679 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -1545,7 +1545,7 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) } case CONDITION_ACHIEVEMENT: { - AchievementEntry const* achievement = GetAchievementStore()->LookupEntry(cond->ConditionValue1); + AchievementEntry const* achievement = sAchievementStore.LookupEntry(cond->ConditionValue1); if (!achievement) { sLog->outErrorDb("Achivement condition has non existing achivement id (%u), skipped", cond->ConditionValue1); diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index acc130dcddf..cbff5c900f6 100755 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -872,12 +872,3 @@ uint32 GetLiquidFlags(uint32 liquidType) return 0; } -// script support functions - DBCStorage const* GetSoundEntriesStore() { return &sSoundEntriesStore; } - DBCStorage const* GetSpellRangeStore() { return &sSpellRangeStore; } - DBCStorage const* GetFactionStore() { return &sFactionStore; } - DBCStorage const* GetItemDisplayStore() { return &sItemStore; } - DBCStorage const* GetCreatureDisplayStore() { return &sCreatureDisplayInfoStore; } - DBCStorage const* GetEmotesStore() { return &sEmotesStore; } - DBCStorage const* GetEmotesTextStore() { return &sEmotesTextStore; } - DBCStorage const* GetAchievementStore() { return &sAchievementStore; } diff --git a/src/server/game/DataStores/DBCStores.h b/src/server/game/DataStores/DBCStores.h index 3f8d19c1f5e..cd30ed587f8 100755 --- a/src/server/game/DataStores/DBCStores.h +++ b/src/server/game/DataStores/DBCStores.h @@ -175,13 +175,4 @@ extern DBCStorage sWorldSafeLocsStore; void LoadDBCStores(const std::string& dataPath); -// script support functions - DBCStorage const* GetSoundEntriesStore(); - DBCStorage const* GetSpellRangeStore(); - DBCStorage const* GetFactionStore(); - DBCStorage const* GetItemDisplayStore(); - DBCStorage const* GetCreatureDisplayStore(); - DBCStorage const* GetEmotesStore(); - DBCStorage const* GetEmotesTextStore(); - DBCStorage const* GetAchievementStore(); #endif diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 92a21dfb52c..8318bd246d0 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -23077,7 +23077,7 @@ void Player::UpdateUnderwaterState(Map* m, float x, float y, float z) if (liquid && liquid->SpellId) { if (res & (LIQUID_MAP_UNDER_WATER | LIQUID_MAP_IN_WATER)) - CastSpell(this, liquid->SpellId, this); + CastSpell(this, liquid->SpellId, true); else RemoveAurasDueToSpell(liquid->SpellId); } diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index ac15bd5c985..fba6b460ec9 100755 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -181,7 +181,7 @@ void DoScriptText(int32 iTextEntry, WorldObject* pSource, Unit* target) if (pData->uiSoundId) { - if (GetSoundEntriesStore()->LookupEntry(pData->uiSoundId)) + if (sSoundEntriesStore.LookupEntry(pData->uiSoundId)) pSource->SendPlaySound(pData->uiSoundId, false); else sLog->outError("TSCR: DoScriptText entry %i tried to process invalid sound id %u.", iTextEntry, pData->uiSoundId); diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp index 65e855cd887..ecb82a80a8d 100755 --- a/src/server/game/Scripting/ScriptSystem.cpp +++ b/src/server/game/Scripting/ScriptSystem.cpp @@ -67,7 +67,7 @@ void SystemMgr::LoadScriptTexts() if (temp.uiSoundId) { - if (!GetSoundEntriesStore()->LookupEntry(temp.uiSoundId)) + if (!sSoundEntriesStore.LookupEntry(temp.uiSoundId)) sLog->outErrorDb("TSCR: Entry %i in table `script_texts` has soundId %u but sound does not exist.", iId, temp.uiSoundId); } @@ -129,7 +129,7 @@ void SystemMgr::LoadScriptTextsCustom() if (temp.uiSoundId) { - if (!GetSoundEntriesStore()->LookupEntry(temp.uiSoundId)) + if (!sSoundEntriesStore.LookupEntry(temp.uiSoundId)) sLog->outErrorDb("TSCR: Entry %i in table `custom_texts` has soundId %u but sound does not exist.", iId, temp.uiSoundId); } diff --git a/src/server/scripts/Commands/cs_achievement.cpp b/src/server/scripts/Commands/cs_achievement.cpp index f136cba46ab..7667e79ece7 100644 --- a/src/server/scripts/Commands/cs_achievement.cpp +++ b/src/server/scripts/Commands/cs_achievement.cpp @@ -67,7 +67,7 @@ public: return false; } - if (AchievementEntry const* achievementEntry = GetAchievementStore()->LookupEntry(achievementId)) + if (AchievementEntry const* achievementEntry = sAchievementStore.LookupEntry(achievementId)) target->CompletedAchievement(achievementEntry); return true; diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp index ea2846185f8..23e64d756f5 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp +++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.cpp @@ -315,7 +315,7 @@ public: eventTimer = 3000; if (Creature* naralex = instance->instance->GetCreature(instance->GetData64(DATA_NARALEX))) { - AchievementEntry const* AchievWC = GetAchievementStore()->LookupEntry(ACHIEVEMENT_WAILING_CAVERNS); + AchievementEntry const* AchievWC = sAchievementStore.LookupEntry(ACHIEVEMENT_WAILING_CAVERNS); if (AchievWC) { Map* map = me->GetMap(); diff --git a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp index 63f7c653c5a..abd16cd9c93 100644 --- a/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp +++ b/src/server/scripts/Northrend/Naxxramas/boss_sapphiron.cpp @@ -153,7 +153,7 @@ public: CheckPlayersFrostResist(); if (CanTheHundredClub) { - AchievementEntry const* AchievTheHundredClub = GetAchievementStore()->LookupEntry(ACHIEVEMENT_THE_HUNDRED_CLUB); + AchievementEntry const* AchievTheHundredClub = sAchievementStore.LookupEntry(ACHIEVEMENT_THE_HUNDRED_CLUB); if (AchievTheHundredClub) { if (map && map->IsDungeon()) diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp index 83604ed4153..13ba85f646c 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/boss_volkhan.cpp @@ -152,7 +152,7 @@ public: if (IsHeroic() && GolemsShattered < 5) { - AchievementEntry const* AchievShatterResistant = GetAchievementStore()->LookupEntry(ACHIEVEMENT_SHATTER_RESISTANT); + AchievementEntry const* AchievShatterResistant = sAchievementStore.LookupEntry(ACHIEVEMENT_SHATTER_RESISTANT); if (AchievShatterResistant) { Map* map = me->GetMap(); -- cgit v1.2.3 From a92820b51c791595676805396a599fa345d58db2 Mon Sep 17 00:00:00 2001 From: Nay Date: Tue, 27 Mar 2012 00:43:56 +0100 Subject: Core/DBLayer: Correct few more wrong read types (No. 1) DB/World: Some consistency in the ints "length" field (not really a length) From A to D world tables verified; missing all the others int(11) -> int32 unsigned int(10) -> uint32 mediumint(8) -> int32 unsigned mediumint(8) -> uint32 smallint(6) -> int16 unsigned smallint(5) -> uint16 tinyint(4) -> int8 unsigned tinyint(3) -> uint8 --- sql/updates/world/2012_03_27_00_world_misc.sql | 49 ++++++++++++++++++++++ src/server/game/AI/EventAI/CreatureEventAIMgr.cpp | 32 +++++++------- src/server/game/Achievements/AchievementMgr.cpp | 2 +- src/server/game/Battlegrounds/BattlegroundMgr.cpp | 8 ++-- src/server/game/Conditions/ConditionMgr.cpp | 4 +- .../game/Entities/Creature/CreatureGroups.cpp | 2 +- src/server/game/Entities/Transport/Transport.cpp | 8 ++-- src/server/game/Globals/ObjectMgr.cpp | 24 +++++------ src/server/game/Loot/LootMgr.cpp | 2 +- src/server/game/Scripting/ScriptSystem.cpp | 8 ++-- src/server/scripts/Commands/cs_npc.cpp | 2 +- 11 files changed, 95 insertions(+), 46 deletions(-) create mode 100644 sql/updates/world/2012_03_27_00_world_misc.sql (limited to 'src/server/game/Conditions/ConditionMgr.cpp') diff --git a/sql/updates/world/2012_03_27_00_world_misc.sql b/sql/updates/world/2012_03_27_00_world_misc.sql new file mode 100644 index 00000000000..132c91b81d7 --- /dev/null +++ b/sql/updates/world/2012_03_27_00_world_misc.sql @@ -0,0 +1,49 @@ +ALTER TABLE `battleground_template` CHANGE `Weight` `Weight` tinyint(3) unsigned NOT NULL DEFAULT '1'; +ALTER TABLE `conditions` CHANGE `SourceId` `SourceId` int(11) NOT NULL DEFAULT '0'; +ALTER TABLE `creature` CHANGE `equipment_id` `equipment_id` mediumint(8) NOT NULL DEFAULT '0'; +ALTER TABLE `creature_addon` CHANGE `path_id` `path_id` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `creature_ai_scripts` CHANGE `id` `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Identifier'; +ALTER TABLE `creature_ai_scripts` CHANGE `creature_id` `creature_id` int(10) unsigned NOT NULL DEFAULT '0' COMMENT 'Creature Template Identifier'; +ALTER TABLE `creature_ai_scripts` CHANGE `event_type` `event_type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Event Type'; +ALTER TABLE `creature_ai_scripts` CHANGE `event_chance` `event_chance` int(10) unsigned NOT NULL DEFAULT '100'; +ALTER TABLE `creature_ai_scripts` CHANGE `event_flags` `event_flags` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `creature_ai_scripts` CHANGE `action1_type` `action1_type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Action Type'; +ALTER TABLE `creature_ai_scripts` CHANGE `action2_type` `action2_type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Action Type'; +ALTER TABLE `creature_ai_scripts` CHANGE `action3_type` `action3_type` tinyint(3) unsigned NOT NULL DEFAULT '0' COMMENT 'Action Type'; +ALTER TABLE `creature_ai_summons` CHANGE `id` `id` int(10) unsigned NOT NULL AUTO_INCREMENT COMMENT 'Location Identifier'; +ALTER TABLE `creature_ai_summons` CHANGE `spawntimesecs` `spawntimesecs` int(10) unsigned NOT NULL DEFAULT '120'; +ALTER TABLE `creature_classlevelstats` CHANGE `level` `level` tinyint(4) NOT NULL; +ALTER TABLE `creature_classlevelstats` CHANGE `class` `class` tinyint(4) NOT NULL; +ALTER TABLE `creature_classlevelstats` CHANGE `basehp0` `basehp0` smallint(6) NOT NULL; +ALTER TABLE `creature_classlevelstats` CHANGE `basehp1` `basehp1` smallint(6) NOT NULL; +ALTER TABLE `creature_classlevelstats` CHANGE `basehp2` `basehp2` smallint(6) NOT NULL; +ALTER TABLE `creature_classlevelstats` CHANGE `basemana` `basemana` smallint(6) NOT NULL; +ALTER TABLE `creature_classlevelstats` CHANGE `basearmor` `basearmor` smallint(6) NOT NULL; +ALTER TABLE `creature_formations` CHANGE `leaderGUID` `leaderGUID` int(10) unsigned NOT NULL; +ALTER TABLE `creature_formations` CHANGE `memberGUID` `memberGUID` int(10) unsigned NOT NULL; +ALTER TABLE `creature_formations` CHANGE `groupAI` `groupAI` int(10) unsigned NOT NULL; +ALTER TABLE `creature_loot_template` CHANGE `mincountOrRef` `mincountOrRef` mediumint(8) NOT NULL DEFAULT '1'; +ALTER TABLE `creature_onkill_reputation` CHANGE `RewOnKillRepValue1` `RewOnKillRepValue1` mediumint(8) NOT NULL DEFAULT '0'; +ALTER TABLE `creature_template` CHANGE `KillCredit1` `KillCredit1` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `creature_template` CHANGE `KillCredit2` `KillCredit2` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `creature_template` CHANGE `exp` `exp` smallint(6) NOT NULL DEFAULT '0'; +ALTER TABLE `creature_template` CHANGE `resistance1` `resistance1` smallint(6) NOT NULL DEFAULT '0'; +ALTER TABLE `creature_template` CHANGE `resistance2` `resistance2` smallint(6) NOT NULL DEFAULT '0'; +ALTER TABLE `creature_template` CHANGE `resistance3` `resistance3` smallint(6) NOT NULL DEFAULT '0'; +ALTER TABLE `creature_template` CHANGE `resistance4` `resistance4` smallint(6) NOT NULL DEFAULT '0'; +ALTER TABLE `creature_template` CHANGE `resistance5` `resistance5` smallint(6) NOT NULL DEFAULT '0'; +ALTER TABLE `creature_template` CHANGE `resistance6` `resistance6` smallint(6) NOT NULL DEFAULT '0'; +ALTER TABLE `creature_template` CHANGE `questItem1` `questItem1` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `creature_template` CHANGE `questItem2` `questItem2` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `creature_template` CHANGE `questItem3` `questItem3` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `creature_template` CHANGE `questItem4` `questItem4` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `creature_template` CHANGE `questItem5` `questItem5` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `creature_template` CHANGE `questItem6` `questItem6` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `creature_template` CHANGE `WDBVerified` `WDBVerified` smallint(6) NULL DEFAULT '1'; +ALTER TABLE `creature_template_addon` CHANGE `path_id` `path_id` int(10) unsigned NOT NULL DEFAULT '0'; +ALTER TABLE `creature_transport` CHANGE `guid` `guid` int(11) NOT NULL AUTO_INCREMENT COMMENT 'GUID of NPC on transport - not the same as creature.guid'; +ALTER TABLE `creature_transport` CHANGE `transport_entry` `transport_entry` int(11) NOT NULL COMMENT 'Transport entry'; +ALTER TABLE `creature_transport` CHANGE `npc_entry` `npc_entry` int(11) NOT NULL COMMENT 'NPC entry'; +ALTER TABLE `creature_transport` CHANGE `emote` `emote` int(11) NOT NULL; +ALTER TABLE `db_script_string` CHANGE `entry` `entry` int(10) unsigned NOT NULL DEFAULT '0'; + \ No newline at end of file diff --git a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp index add7b4db174..facfbd7581c 100755 --- a/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp +++ b/src/server/game/AI/EventAI/CreatureEventAIMgr.cpp @@ -56,10 +56,10 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Texts() StringTextData temp; int32 i = fields[0].GetInt32(); - temp.SoundId = fields[1].GetInt32(); - temp.Type = fields[2].GetInt32(); - temp.Language = fields[3].GetInt32(); - temp.Emote = fields[4].GetInt32(); + temp.SoundId = fields[1].GetUInt32(); + temp.Type = fields[2].GetUInt8(); + temp.Language = fields[3].GetUInt8(); + temp.Emote = fields[4].GetUInt16(); // range negative if (i > MIN_CREATURE_AI_TEXT_STRING_ID || i <= MAX_CREATURE_AI_TEXT_STRING_ID) @@ -187,7 +187,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() temp.creature_id = fields[1].GetUInt32(); uint32 creature_id = temp.creature_id; - uint32 e_type = fields[2].GetUInt32(); + uint32 e_type = fields[2].GetUInt8(); //Report any errors in event if (e_type >= EVENT_T_END) { @@ -196,13 +196,13 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() } temp.event_type = EventAI_Type(e_type); - temp.event_inverse_phase_mask = fields[3].GetUInt32(); - temp.event_chance = fields[4].GetUInt8(); - temp.event_flags = fields[5].GetUInt8(); - temp.raw.param1 = fields[6].GetUInt32(); - temp.raw.param2 = fields[7].GetUInt32(); - temp.raw.param3 = fields[8].GetUInt32(); - temp.raw.param4 = fields[9].GetUInt32(); + temp.event_inverse_phase_mask = fields[3].GetInt32(); + temp.event_chance = fields[4].GetUInt32(); + temp.event_flags = fields[5].GetUInt32(); + temp.raw.param1 = fields[6].GetInt32(); + temp.raw.param2 = fields[7].GetInt32(); + temp.raw.param3 = fields[8].GetInt32(); + temp.raw.param4 = fields[9].GetInt32(); //Creature does not exist in database if (!sObjectMgr->GetCreatureTemplate(temp.creature_id)) @@ -399,7 +399,7 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() for (uint32 j = 0; j < MAX_ACTIONS; j++) { - uint16 action_type = fields[10+(j*4)].GetUInt16(); + uint16 action_type = fields[10+(j*4)].GetUInt8(); if (action_type >= ACTION_T_END) { sLog->outErrorDb("CreatureEventAI: Event %u Action %u has incorrect action type (%u), replace by ACTION_T_NONE.", i, j+1, action_type); @@ -410,9 +410,9 @@ void CreatureEventAIMgr::LoadCreatureEventAI_Scripts() CreatureEventAI_Action& action = temp.action[j]; action.type = EventAI_ActionType(action_type); - action.raw.param1 = fields[11+(j*4)].GetUInt32(); - action.raw.param2 = fields[12+(j*4)].GetUInt32(); - action.raw.param3 = fields[13+(j*4)].GetUInt32(); + action.raw.param1 = fields[11+(j*4)].GetInt32(); + action.raw.param2 = fields[12+(j*4)].GetInt32(); + action.raw.param3 = fields[13+(j*4)].GetInt32(); //Report any errors in actions switch (action.type) diff --git a/src/server/game/Achievements/AchievementMgr.cpp b/src/server/game/Achievements/AchievementMgr.cpp index 5a97f6fa18f..7b2e157eac8 100755 --- a/src/server/game/Achievements/AchievementMgr.cpp +++ b/src/server/game/Achievements/AchievementMgr.cpp @@ -2282,7 +2282,7 @@ void AchievementGlobalMgr::LoadAchievementCriteriaData() continue; } - uint32 dataType = fields[1].GetUInt32(); + uint32 dataType = fields[1].GetUInt8(); const char* scriptName = fields[4].GetCString(); uint32 scriptId = 0; if (strcmp(scriptName, "")) // not empty diff --git a/src/server/game/Battlegrounds/BattlegroundMgr.cpp b/src/server/game/Battlegrounds/BattlegroundMgr.cpp index 77b985b205f..e1b99cbdcb9 100755 --- a/src/server/game/Battlegrounds/BattlegroundMgr.cpp +++ b/src/server/game/Battlegrounds/BattlegroundMgr.cpp @@ -708,10 +708,10 @@ void BattlegroundMgr::CreateInitialBattlegrounds() CreateBattlegroundData data; data.bgTypeId = BattlegroundTypeId(bgTypeID_); data.IsArena = (bl->type == TYPE_ARENA); - data.MinPlayersPerTeam = fields[1].GetUInt32(); - data.MaxPlayersPerTeam = fields[2].GetUInt32(); - data.LevelMin = fields[3].GetUInt32(); - data.LevelMax = fields[4].GetUInt32(); + data.MinPlayersPerTeam = fields[1].GetUInt16(); + data.MaxPlayersPerTeam = fields[2].GetUInt16(); + data.LevelMin = fields[3].GetUInt8(); + data.LevelMax = fields[4].GetUInt8(); //check values from DB if (data.MaxPlayersPerTeam == 0 || data.MinPlayersPerTeam == 0 || data.MinPlayersPerTeam > data.MaxPlayersPerTeam) { diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 7fe6df14679..3fcabea4c74 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -719,8 +719,8 @@ void ConditionMgr::LoadConditions(bool isReload) Condition* cond = new Condition(); int32 iSourceTypeOrReferenceId = fields[0].GetInt32(); cond->SourceGroup = fields[1].GetUInt32(); - cond->SourceEntry = fields[2].GetInt32(); - cond->SourceId = fields[3].GetUInt32(); + cond->SourceEntry = fields[2].GetUInt32(); + cond->SourceId = fields[3].GetInt32(); cond->ElseGroup = fields[4].GetUInt32(); int32 iConditionTypeOrReference = fields[5].GetInt32(); cond->ConditionTarget = fields[6].GetUInt8(); diff --git a/src/server/game/Entities/Creature/CreatureGroups.cpp b/src/server/game/Entities/Creature/CreatureGroups.cpp index bcedfa40864..2104f474072 100755 --- a/src/server/game/Entities/Creature/CreatureGroups.cpp +++ b/src/server/game/Entities/Creature/CreatureGroups.cpp @@ -101,7 +101,7 @@ void FormationMgr::LoadCreatureFormations() group_member = new FormationInfo(); group_member->leaderGUID = fields[0].GetUInt32(); uint32 memberGUID = fields[1].GetUInt32(); - group_member->groupAI = fields[4].GetUInt8(); + group_member->groupAI = fields[4].GetUInt32(); //If creature is group leader we may skip loading of dist/angle if (group_member->leaderGUID != memberGUID) { diff --git a/src/server/game/Entities/Transport/Transport.cpp b/src/server/game/Entities/Transport/Transport.cpp index ebb524d5f64..81a505b7acc 100755 --- a/src/server/game/Entities/Transport/Transport.cpp +++ b/src/server/game/Entities/Transport/Transport.cpp @@ -144,14 +144,14 @@ void MapManager::LoadTransportNPCs() do { Field* fields = result->Fetch(); - uint32 guid = fields[0].GetUInt32(); - uint32 entry = fields[1].GetUInt32(); - uint32 transportEntry = fields[2].GetUInt32(); + uint32 guid = fields[0].GetInt32(); + uint32 entry = fields[1].GetInt32(); + uint32 transportEntry = fields[2].GetInt32(); float tX = fields[3].GetFloat(); float tY = fields[4].GetFloat(); float tZ = fields[5].GetFloat(); float tO = fields[6].GetFloat(); - uint32 anim = fields[7].GetUInt32(); + uint32 anim = fields[7].GetInt32(); for (MapManager::TransportSet::iterator itr = m_Transports.begin(); itr != m_Transports.end(); ++itr) { diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 91ce5c44537..f66ca460c0a 100755 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -422,7 +422,7 @@ void ObjectMgr::LoadCreatureTemplates() creatureTemplate.GossipMenuId = fields[13].GetUInt32(); creatureTemplate.minlevel = fields[14].GetUInt8(); creatureTemplate.maxlevel = fields[15].GetUInt8(); - creatureTemplate.expansion = uint32(fields[16].GetUInt16()); + creatureTemplate.expansion = uint32(fields[16].GetInt16()); creatureTemplate.faction_A = uint32(fields[17].GetUInt16()); creatureTemplate.faction_H = uint32(fields[18].GetUInt16()); creatureTemplate.npcflag = fields[19].GetUInt32(); @@ -455,7 +455,7 @@ void ObjectMgr::LoadCreatureTemplates() creatureTemplate.SkinLootId = fields[46].GetUInt32(); for (uint8 i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; ++i) - creatureTemplate.resistance[i] = fields[47 + i -1].GetInt32(); + creatureTemplate.resistance[i] = fields[47 + i -1].GetInt16(); for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i) creatureTemplate.spells[i] = fields[53 + i].GetUInt32(); @@ -5975,7 +5975,7 @@ void ObjectMgr::LoadAreaTriggerTeleports() AreaTrigger at; - at.target_mapId = fields[1].GetUInt32(); + at.target_mapId = fields[1].GetUInt16(); at.target_X = fields[2].GetFloat(); at.target_Y = fields[3].GetFloat(); at.target_Z = fields[4].GetFloat(); @@ -6837,13 +6837,13 @@ void ObjectMgr::LoadReputationOnKill() uint32 creature_id = fields[0].GetUInt32(); ReputationOnKillEntry repOnKill; - repOnKill.RepFaction1 = fields[1].GetUInt32(); - repOnKill.RepFaction2 = fields[2].GetUInt32(); + repOnKill.RepFaction1 = fields[1].GetInt16(); + repOnKill.RepFaction2 = fields[2].GetInt16(); repOnKill.IsTeamAward1 = fields[3].GetBool(); - repOnKill.ReputationMaxCap1 = fields[4].GetUInt32(); + repOnKill.ReputationMaxCap1 = fields[4].GetUInt8(); repOnKill.RepValue1 = fields[5].GetInt32(); repOnKill.IsTeamAward2 = fields[6].GetBool(); - repOnKill.ReputationMaxCap2 = fields[7].GetUInt32(); + repOnKill.ReputationMaxCap2 = fields[7].GetUInt8(); repOnKill.RepValue2 = fields[8].GetInt32(); repOnKill.TeamDependent = fields[9].GetUInt8(); @@ -8692,16 +8692,16 @@ void ObjectMgr::LoadCreatureClassLevelStats() { Field* fields = result->Fetch(); - uint8 Level = fields[0].GetUInt8(); - uint8 Class = fields[1].GetUInt8(); + uint8 Level = fields[0].GetInt8(); + uint8 Class = fields[1].GetInt8(); CreatureBaseStats stats; for (uint8 i = 0; i < MAX_CREATURE_BASE_HP; ++i) - stats.BaseHealth[i] = fields[i + 2].GetUInt16(); + stats.BaseHealth[i] = fields[i + 2].GetInt16(); - stats.BaseMana = fields[5].GetUInt16(); - stats.BaseArmor = fields[6].GetUInt16(); + stats.BaseMana = fields[5].GetInt16(); + stats.BaseArmor = fields[6].GetInt16(); if (!Class || ((1 << (Class - 1)) & CLASSMASK_ALL_CREATURES) == 0) sLog->outErrorDb("Creature base stats for level %u has invalid class %u", Level, Class); diff --git a/src/server/game/Loot/LootMgr.cpp b/src/server/game/Loot/LootMgr.cpp index 3522571775c..7c7cc06201c 100755 --- a/src/server/game/Loot/LootMgr.cpp +++ b/src/server/game/Loot/LootMgr.cpp @@ -116,7 +116,7 @@ uint32 LootStore::LoadLootTable() uint16 lootmode = fields[3].GetUInt16(); uint8 group = fields[4].GetUInt8(); int32 mincountOrRef = fields[5].GetInt32(); - int32 maxcount = fields[6].GetInt32(); + int32 maxcount = fields[6].GetUInt8(); if (maxcount > std::numeric_limits::max()) { diff --git a/src/server/game/Scripting/ScriptSystem.cpp b/src/server/game/Scripting/ScriptSystem.cpp index ecb82a80a8d..66f5a4089dc 100755 --- a/src/server/game/Scripting/ScriptSystem.cpp +++ b/src/server/game/Scripting/ScriptSystem.cpp @@ -109,11 +109,11 @@ void SystemMgr::LoadScriptTextsCustom() Field* pFields = result->Fetch(); StringTextData temp; - int32 iId = pFields[0].GetInt32(); + int32 iId = pFields[0].GetInt32(); temp.uiSoundId = pFields[1].GetUInt32(); - temp.uiType = pFields[2].GetUInt32(); - temp.uiLanguage = pFields[3].GetUInt32(); - temp.uiEmote = pFields[4].GetUInt32(); + temp.uiType = pFields[2].GetUInt8(); + temp.uiLanguage = pFields[3].GetUInt8(); + temp.uiEmote = pFields[4].GetUInt16(); if (iId >= 0) { diff --git a/src/server/scripts/Commands/cs_npc.cpp b/src/server/scripts/Commands/cs_npc.cpp index 249506fb0f1..a9959c60201 100644 --- a/src/server/scripts/Commands/cs_npc.cpp +++ b/src/server/scripts/Commands/cs_npc.cpp @@ -694,7 +694,7 @@ public: { PreparedStatement* stmt = WorldDatabase.GetPreparedStatement(WORLD_UPD_CREATURE_TRANSPORT_EMOTE); - stmt->setInt16(0, int16(emote)); + stmt->setInt32(0, int32(emote)); stmt->setInt32(1, target->GetTransport()->GetEntry()); stmt->setInt32(2, target->GetGUIDTransport()); -- cgit v1.2.3 From 7a5f6dd198fb6e66d8142b31be78b48e4b6931e7 Mon Sep 17 00:00:00 2001 From: Nay Date: Sat, 7 Apr 2012 23:15:16 +0100 Subject: Core/Conditions: Add CONDITION_TITLE Original patch by svetilo12 --- src/server/game/Conditions/ConditionMgr.cpp | 16 +++++++++++++--- src/server/game/Conditions/ConditionMgr.h | 2 +- 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'src/server/game/Conditions/ConditionMgr.cpp') diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 3fcabea4c74..1fb0a78605b 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -422,6 +422,9 @@ uint32 Condition::GetSearcherTypeMaskForCondition() case CONDITION_PHASEMASK: mask |= GRID_MAP_TYPE_MASK_ALL; break; + case CONDITION_TITLE: + mask |= GRID_MAP_TYPE_MASK_PLAYER; + break; default: ASSERT(false && "Condition::GetSearcherTypeMaskForCondition - missing condition handling!"); break; @@ -1826,9 +1829,16 @@ bool ConditionMgr::isConditionTypeValid(Condition* cond) sLog->outErrorDb("Phasemask condition has useless data in value3 (%u)!", cond->ConditionValue3); break; } - case CONDITION_UNUSED_18: - sLog->outErrorDb("Found ConditionTypeOrReference = CONDITION_UNUSED_18 in `conditions` table - ignoring"); - return false; + case CONDITION_TITLE: + { + CharTitlesEntry const* titleEntry = sCharTitlesStore.LookupEntry(cond->ConditionValue1); + if (!titleEntry) + { + sLog->outErrorDb("Title condition has non existing title in value1 (%u), skipped", cond->ConditionValue1); + return false; + } + break; + } case CONDITION_UNUSED_19: sLog->outErrorDb("Found ConditionTypeOrReference = CONDITION_UNUSED_19 in `conditions` table - ignoring"); return false; diff --git a/src/server/game/Conditions/ConditionMgr.h b/src/server/game/Conditions/ConditionMgr.h index 2df79eab088..130a23a0cb0 100755 --- a/src/server/game/Conditions/ConditionMgr.h +++ b/src/server/game/Conditions/ConditionMgr.h @@ -48,7 +48,7 @@ enum ConditionTypes CONDITION_CLASS = 15, // class 0 0 true if player's class is equal to class CONDITION_RACE = 16, // race 0 0 true if player's race is equal to race CONDITION_ACHIEVEMENT = 17, // achievement_id 0 0 true if achievement is complete - CONDITION_UNUSED_18 = 18, // + CONDITION_TITLE = 18, // title id 0 0 true if player has title CONDITION_UNUSED_19 = 19, // CONDITION_UNUSED_20 = 20, // CONDITION_UNUSED_21 = 21, // -- cgit v1.2.3 From 2d0e5e2e0c16ce1a7683ecf9cdc83cdc644d1eb0 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 8 Apr 2012 12:56:18 +0100 Subject: Core/Conditions: Add missing code for CONDITION_TITLE DB/Char: Add changes to character base Thanks to manuel and QAston for noticing --- sql/base/characters_database.sql | 2 ++ src/server/game/Conditions/ConditionMgr.cpp | 6 ++++++ 2 files changed, 8 insertions(+) (limited to 'src/server/game/Conditions/ConditionMgr.cpp') diff --git a/sql/base/characters_database.sql b/sql/base/characters_database.sql index f0e919a5bcd..9908254ff0e 100644 --- a/sql/base/characters_database.sql +++ b/sql/base/characters_database.sql @@ -1932,6 +1932,8 @@ CREATE TABLE `lag_reports` ( `posX` float NOT NULL DEFAULT '0', `posY` float NOT NULL DEFAULT '0', `posZ` float NOT NULL DEFAULT '0', + `latency` int(10) unsigned NOT NULL DEFAULT '0', + `createTime` int(10) unsigned NOT NULL DEFAULT '0', PRIMARY KEY (`reportId`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Player System'; /*!40101 SET character_set_client = @saved_cs_client */; diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 1fb0a78605b..96f454fd3e2 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -274,6 +274,12 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) condMeets = object->GetPhaseMask() & ConditionValue1; break; } + case CONDITION_TITLE: + { + if (Player* player = object->ToPlayer()) + condMeets = player->HasTitle(ConditionValue1); + break; + } default: condMeets = false; break; -- cgit v1.2.3 From e56b2cdd59c5c7673da1aaac5fe8a99d4891e260 Mon Sep 17 00:00:00 2001 From: Nay Date: Sun, 20 May 2012 17:58:35 +0100 Subject: Core: Fix a few compile warnings --- src/server/game/Conditions/ConditionMgr.cpp | 2 +- src/server/game/Entities/Player/Player.cpp | 6 +++--- src/server/game/Maps/Map.cpp | 2 +- src/server/scripts/Spells/spell_generic.cpp | 2 +- src/tools/map_extractor/System.cpp | 18 +++++++++--------- src/tools/map_extractor/adt.cpp | 12 ++++++------ src/tools/map_extractor/loadlib.cpp | 2 +- src/tools/map_extractor/mpq_libmpq04.h | 4 ++-- src/tools/map_extractor/wdt.cpp | 6 +++--- 9 files changed, 27 insertions(+), 27 deletions(-) (limited to 'src/server/game/Conditions/ConditionMgr.cpp') diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 96f454fd3e2..4176d9f605b 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -190,7 +190,7 @@ bool Condition::Meets(ConditionSourceInfo& sourceInfo) } case CONDITION_OBJECT_ENTRY: { - if (object->GetTypeId() == ConditionValue1) + if (uint32(object->GetTypeId()) == ConditionValue1) condMeets = (!ConditionValue2) || (object->GetEntry() == ConditionValue2); break; } diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index d38489ef5a9..f5f336a2402 100755 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -12019,7 +12019,7 @@ InventoryResult Player::CanRollForItemInLFG(ItemTemplate const* proto, WorldObje Map const* map = lootedObject->GetMap(); if (uint32 dungeonId = sLFGMgr->GetDungeon(GetGroup()->GetGUID(), true)) if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) - if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty()) + if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == uint32(map->GetDifficulty())) lootedObjectInDungeon = true; if (!lootedObjectInDungeon) @@ -17658,7 +17658,7 @@ void Player::_LoadInventory(PreparedQueryResult result, uint32 timeDiff) } else if (IsBagPos(item->GetPos())) - if (Bag* pBag = item->ToBag()) + if (item->IsBag()) invalidBagMap[item->GetGUIDLow()] = item; } else @@ -17811,7 +17811,7 @@ Item* Player::_LoadItem(SQLTransaction& trans, uint32 zoneId, uint32 timeDiff, F GameEventMgr::ActiveEvents const& activeEventsList = sGameEventMgr->GetActiveEventList(); for (GameEventMgr::ActiveEvents::const_iterator itr = activeEventsList.begin(); itr != activeEventsList.end(); ++itr) { - if (events[*itr].holiday_id == proto->HolidayId) + if (uint32(events[*itr].holiday_id) == proto->HolidayId) { remove = false; break; diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index a1b3d913c99..162dd12d121 100755 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -2470,7 +2470,7 @@ bool InstanceMap::AddPlayerToMap(Player* player) if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true)) if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) if (LFGDungeonEntry const* randomDungeon = sLFGDungeonStore.LookupEntry(*(sLFGMgr->GetSelectedDungeons(player->GetGUID()).begin()))) - if (uint32(dungeon->map) == GetId() && dungeon->difficulty == GetDifficulty() && randomDungeon->type == LFG_TYPE_RANDOM) + if (uint32(dungeon->map) == GetId() && dungeon->difficulty == uint32(GetDifficulty()) && randomDungeon->type == uint32(LFG_TYPE_RANDOM)) player->CastSpell(player, LFG_SPELL_LUCK_OF_THE_DRAW, true); } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 501c7c47676..0c879cfb029 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -1513,7 +1513,7 @@ class spell_gen_luck_of_the_draw : public SpellScriptLoader if (group->isLFGGroup()) if (uint32 dungeonId = sLFGMgr->GetDungeon(group->GetGUID(), true)) if (LFGDungeonEntry const* dungeon = sLFGDungeonStore.LookupEntry(dungeonId)) - if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == map->GetDifficulty()) + if (uint32(dungeon->map) == map->GetId() && dungeon->difficulty == uint32(map->GetDifficulty())) if (randomDungeon && randomDungeon->type == LFG_TYPE_RANDOM) return; // in correct dungeon diff --git a/src/tools/map_extractor/System.cpp b/src/tools/map_extractor/System.cpp index cf2f2188a70..3deb9f44dd7 100644 --- a/src/tools/map_extractor/System.cpp +++ b/src/tools/map_extractor/System.cpp @@ -221,7 +221,7 @@ uint32 ReadMapDBC() map_ids[x].id = dbc.getRecord(x).getUInt(0); strcpy(map_ids[x].name, dbc.getRecord(x).getString(1)); } - printf("Done! (%u maps loaded)\n", map_count); + printf("Done! (%d maps loaded)\n", map_count); return map_count; } @@ -246,7 +246,7 @@ void ReadAreaTableDBC() maxAreaId = dbc.getMaxId(); - printf("Done! (%u areas loaded)\n", area_count); + printf("Done! (%d areas loaded)\n", area_count); } void ReadLiquidTypeTableDBC() @@ -259,15 +259,15 @@ void ReadLiquidTypeTableDBC() exit(1); } - size_t LiqType_count = dbc.getRecordCount(); - size_t LiqType_maxid = dbc.getMaxId(); - LiqType = new uint16[LiqType_maxid + 1]; - memset(LiqType, 0xff, (LiqType_maxid + 1) * sizeof(uint16)); + size_t liqTypeCount = dbc.getRecordCount(); + size_t liqTypeMaxId = dbc.getMaxId(); + LiqType = new uint16[liqTypeMaxId + 1]; + memset(LiqType, 0xff, (liqTypeMaxId + 1) * sizeof(uint16)); - for(uint32 x = 0; x < LiqType_count; ++x) + for(uint32 x = 0; x < liqTypeCount; ++x) LiqType[dbc.getRecord(x).getUInt(0)] = dbc.getRecord(x).getUInt(3); - printf("Done! (%u LiqTypes loaded)\n", LiqType_count); + printf("Done! (%d LiqTypes loaded)\n", liqTypeCount); } // @@ -364,7 +364,7 @@ uint8 liquid_flags[ADT_CELLS_PER_GRID][ADT_CELLS_PER_GRID]; bool liquid_show[ADT_GRID_SIZE][ADT_GRID_SIZE]; float liquid_height[ADT_GRID_SIZE+1][ADT_GRID_SIZE+1]; -bool ConvertADT(char *filename, char *filename2, int cell_y, int cell_x, uint32 build) +bool ConvertADT(char *filename, char *filename2, int /*cell_y*/, /*int cell_x*/, uint32 build) { ADT_file adt; diff --git a/src/tools/map_extractor/adt.cpp b/src/tools/map_extractor/adt.cpp index fde70681113..66134180cb0 100644 --- a/src/tools/map_extractor/adt.cpp +++ b/src/tools/map_extractor/adt.cpp @@ -53,7 +53,7 @@ bool ADT_file::prepareLoadedData() bool adt_MHDR::prepareLoadedData() { - if (fcc != 'MHDR') + if (fcc != "MHDR") return false; if (size!=sizeof(adt_MHDR)-8) @@ -72,7 +72,7 @@ bool adt_MHDR::prepareLoadedData() bool adt_MCIN::prepareLoadedData() { - if (fcc != 'MCIN') + if (fcc != "MCIN") return false; // Check cells data @@ -86,7 +86,7 @@ bool adt_MCIN::prepareLoadedData() bool adt_MH2O::prepareLoadedData() { - if (fcc != 'MH2O') + if (fcc != "MH2O") return false; // Check liquid data @@ -98,7 +98,7 @@ bool adt_MH2O::prepareLoadedData() bool adt_MCNK::prepareLoadedData() { - if (fcc != 'MCNK') + if (fcc != "MCNK") return false; // Check height map @@ -113,7 +113,7 @@ bool adt_MCNK::prepareLoadedData() bool adt_MCVT::prepareLoadedData() { - if (fcc != 'MCVT') + if (fcc != "MCVT") return false; if (size != sizeof(adt_MCVT)-8) @@ -124,7 +124,7 @@ bool adt_MCVT::prepareLoadedData() bool adt_MCLQ::prepareLoadedData() { - if (fcc != 'MCLQ') + if (fcc != "MCLQ") return false; return true; diff --git a/src/tools/map_extractor/loadlib.cpp b/src/tools/map_extractor/loadlib.cpp index 465eb04083f..77dca04d4c8 100644 --- a/src/tools/map_extractor/loadlib.cpp +++ b/src/tools/map_extractor/loadlib.cpp @@ -49,7 +49,7 @@ bool FileLoader::prepareLoadedData() { // Check version version = (file_MVER *) data; - if (version->fcc != 'MVER') + if (version->fcc != "MVER") return false; if (version->ver != FILE_FORMAT_VERSION) return false; diff --git a/src/tools/map_extractor/mpq_libmpq04.h b/src/tools/map_extractor/mpq_libmpq04.h index 1f3b259bbfc..89f715e9e87 100644 --- a/src/tools/map_extractor/mpq_libmpq04.h +++ b/src/tools/map_extractor/mpq_libmpq04.h @@ -60,8 +60,8 @@ class MPQFile libmpq__off_t pointer,size; // disable copying - MPQFile(const MPQFile &f) {} - void operator=(const MPQFile &f) {} + MPQFile(const MPQFile& /*f*/) {} + void operator=(const MPQFile& /*f*/) {} public: MPQFile(const char* filename); // filenames are not case sensitive diff --git a/src/tools/map_extractor/wdt.cpp b/src/tools/map_extractor/wdt.cpp index dedefbb64e5..d9ad0f4c7d3 100644 --- a/src/tools/map_extractor/wdt.cpp +++ b/src/tools/map_extractor/wdt.cpp @@ -4,21 +4,21 @@ bool wdt_MWMO::prepareLoadedData() { - if (fcc != 'MWMO') + if (fcc != "MWMO") return false; return true; } bool wdt_MPHD::prepareLoadedData() { - if (fcc != 'MPHD') + if (fcc != "MPHD") return false; return true; } bool wdt_MAIN::prepareLoadedData() { - if (fcc != 'MAIN') + if (fcc != "MAIN") return false; return true; } -- cgit v1.2.3 From c8d20004a50d823c7acc4de97266615827af29f7 Mon Sep 17 00:00:00 2001 From: Shauren Date: Sat, 30 Jun 2012 16:07:09 +0200 Subject: Core: Minor code style corrections --- src/server/collision/Models/GameObjectModel.cpp | 2 +- src/server/collision/RegularGrid.h | 2 +- src/server/game/Conditions/ConditionMgr.cpp | 2 +- src/server/game/Handlers/AuctionHouseHandler.cpp | 2 +- .../game/Movement/Spline/MovementPacketBuilder.cpp | 2 +- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 2 +- src/server/game/Spells/Spell.cpp | 16 ++++----- src/server/game/Spells/SpellScript.cpp | 8 ++--- src/server/game/Warden/Warden.cpp | 2 +- src/server/game/Warden/WardenCheckMgr.cpp | 2 +- src/server/game/Warden/WardenMac.cpp | 4 +-- src/server/game/Warden/WardenWin.cpp | 4 +-- .../BlackrockSpire/boss_pyroguard_emberseer.cpp | 2 +- .../Northrend/IcecrownCitadel/boss_rotface.cpp | 2 +- .../IcecrownCitadel/boss_valithria_dreamwalker.cpp | 4 +-- .../Ulduar/Ulduar/boss_flame_leviathan.cpp | 2 +- .../scripts/Outland/blades_edge_mountains.cpp | 2 +- .../shared/Cryptography/WardenKeyGeneration.h | 42 ++++++++++++---------- src/server/shared/Database/PreparedStatement.cpp | 2 +- 19 files changed, 55 insertions(+), 49 deletions(-) (limited to 'src/server/game/Conditions/ConditionMgr.cpp') diff --git a/src/server/collision/Models/GameObjectModel.cpp b/src/server/collision/Models/GameObjectModel.cpp index 84c736c22e8..8b63620e783 100644 --- a/src/server/collision/Models/GameObjectModel.cpp +++ b/src/server/collision/Models/GameObjectModel.cpp @@ -176,7 +176,7 @@ bool GameObjectModel::intersectRay(const G3D::Ray& ray, float& MaxDist, bool Sto Ray modRay(p, iInvRot * ray.direction()); float distance = MaxDist * iInvScale; bool hit = iModel->IntersectRay(modRay, distance, StopAtFirstHit); - if(hit) + if (hit) { distance *= iScale; MaxDist = distance; diff --git a/src/server/collision/RegularGrid.h b/src/server/collision/RegularGrid.h index 2867b29cfc1..00d7b0cd209 100644 --- a/src/server/collision/RegularGrid.h +++ b/src/server/collision/RegularGrid.h @@ -176,7 +176,7 @@ public: } if (cell == last_cell) break; - if(tMaxX < tMaxY) + if (tMaxX < tMaxY) { tMaxX += tDeltaX; cell.x += stepX; diff --git a/src/server/game/Conditions/ConditionMgr.cpp b/src/server/game/Conditions/ConditionMgr.cpp index 4176d9f605b..9f534ab697d 100755 --- a/src/server/game/Conditions/ConditionMgr.cpp +++ b/src/server/game/Conditions/ConditionMgr.cpp @@ -441,7 +441,7 @@ uint32 Condition::GetSearcherTypeMaskForCondition() uint32 Condition::GetMaxAvailableConditionTargets() { // returns number of targets which are available for given source type - switch(SourceType) + switch (SourceType) { case CONDITION_SOURCE_TYPE_SPELL: case CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET: diff --git a/src/server/game/Handlers/AuctionHouseHandler.cpp b/src/server/game/Handlers/AuctionHouseHandler.cpp index d26f275b864..3aee9ff0b00 100755 --- a/src/server/game/Handlers/AuctionHouseHandler.cpp +++ b/src/server/game/Handlers/AuctionHouseHandler.cpp @@ -161,7 +161,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket & recv_data) etime *= MINUTE; - switch(etime) + switch (etime) { case 1*MIN_AUCTION_TIME: case 2*MIN_AUCTION_TIME: diff --git a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp index 16f06a25058..8aef671d2d1 100644 --- a/src/server/game/Movement/Spline/MovementPacketBuilder.cpp +++ b/src/server/game/Movement/Spline/MovementPacketBuilder.cpp @@ -49,7 +49,7 @@ namespace Movement data << move_spline.spline.getPoint(move_spline.spline.first()); data << move_spline.GetId(); - switch(splineflags & MoveSplineFlag::Mask_Final_Facing) + switch (splineflags & MoveSplineFlag::Mask_Final_Facing) { case MoveSplineFlag::Final_Target: data << uint8(MonsterMoveFacingTarget); diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp index ac51fff81f6..a4acff2a47c 100755 --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp @@ -5083,7 +5083,7 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool break; case SPELLFAMILY_ROGUE: // Tricks of the trade - switch(GetId()) + switch (GetId()) { case 59628: //Tricks of the trade buff on rogue (6sec duration) target->SetReducedThreatPercent(0,0); diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index e9ae93751b8..33ecd66e8f6 100755 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -827,7 +827,7 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar break; } - switch(targetType.GetSelectionCategory()) + switch (targetType.GetSelectionCategory()) { case TARGET_SELECT_CATEGORY_CHANNEL: SelectImplicitChannelTargets(effIndex, targetType); @@ -845,7 +845,7 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar switch (targetType.GetObjectType()) { case TARGET_OBJECT_TYPE_SRC: - switch(targetType.GetReferenceType()) + switch (targetType.GetReferenceType()) { case TARGET_REFERENCE_TYPE_CASTER: m_targets.SetSrc(*m_caster); @@ -856,7 +856,7 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar } break; case TARGET_OBJECT_TYPE_DEST: - switch(targetType.GetReferenceType()) + switch (targetType.GetReferenceType()) { case TARGET_REFERENCE_TYPE_CASTER: SelectImplicitCasterDestTargets(effIndex, targetType); @@ -873,7 +873,7 @@ void Spell::SelectEffectImplicitTargets(SpellEffIndex effIndex, SpellImplicitTar } break; default: - switch(targetType.GetReferenceType()) + switch (targetType.GetReferenceType()) { case TARGET_REFERENCE_TYPE_CASTER: SelectImplicitCasterObjectTargets(effIndex, targetType); @@ -1367,7 +1367,7 @@ void Spell::SelectImplicitAreaTargets(SpellEffIndex effIndex, SpellImplicitTarge void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType) { - switch(targetType.GetTarget()) + switch (targetType.GetTarget()) { case TARGET_DEST_CASTER: m_targets.SetDst(*m_caster); @@ -1432,7 +1432,7 @@ void Spell::SelectImplicitCasterDestTargets(SpellEffIndex effIndex, SpellImplici void Spell::SelectImplicitTargetDestTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType) { WorldObject* target = m_targets.GetObjectTarget(); - switch(targetType.GetTarget()) + switch (targetType.GetTarget()) { case TARGET_DEST_TARGET_ENEMY: case TARGET_DEST_TARGET_ANY: @@ -1465,7 +1465,7 @@ void Spell::SelectImplicitDestDestTargets(SpellEffIndex effIndex, SpellImplicitT if (!m_targets.HasDst()) m_targets.SetDst(*m_caster); - switch(targetType.GetTarget()) + switch (targetType.GetTarget()) { case TARGET_DEST_DYNOBJ_ENEMY: case TARGET_DEST_DYNOBJ_ALLY: @@ -1491,7 +1491,7 @@ void Spell::SelectImplicitDestDestTargets(SpellEffIndex effIndex, SpellImplicitT void Spell::SelectImplicitCasterObjectTargets(SpellEffIndex effIndex, SpellImplicitTargetInfo const& targetType) { - switch(targetType.GetTarget()) + switch (targetType.GetTarget()) { case TARGET_UNIT_CASTER: AddUnitTarget(m_caster, 1 << effIndex, false); diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 633e08e6fb1..a19c356b9ed 100755 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -224,8 +224,8 @@ bool SpellScript::TargetHook::CheckEffect(SpellInfo const* spellEntry, uint8 eff spellEntry->Effects[effIndex].TargetB.GetTarget() != targetType) return false; - SpellImplicitTargetInfo targetType(this->targetType); - switch (targetType.GetSelectionCategory()) + SpellImplicitTargetInfo targetInfo(targetType); + switch (targetInfo.GetSelectionCategory()) { case TARGET_SELECT_CATEGORY_CHANNEL: // SINGLE return !area; @@ -235,13 +235,13 @@ bool SpellScript::TargetHook::CheckEffect(SpellInfo const* spellEntry, uint8 eff case TARGET_SELECT_CATEGORY_AREA: // AREA return area; case TARGET_SELECT_CATEGORY_DEFAULT: - switch (targetType.GetObjectType()) + switch (targetInfo.GetObjectType()) { case TARGET_OBJECT_TYPE_SRC: // EMPTY case TARGET_OBJECT_TYPE_DEST: // EMPTY return false; default: - switch(targetType.GetReferenceType()) + switch (targetInfo.GetReferenceType()) { case TARGET_REFERENCE_TYPE_CASTER: // SINGLE return !area; diff --git a/src/server/game/Warden/Warden.cpp b/src/server/game/Warden/Warden.cpp index 8608701e2ee..54e56174b1a 100644 --- a/src/server/game/Warden/Warden.cpp +++ b/src/server/game/Warden/Warden.cpp @@ -211,7 +211,7 @@ void WorldSession::HandleWardenDataOpcode(WorldPacket& recvData) sLog->outDebug(LOG_FILTER_WARDEN, "Got packet, opcode %02X, size %u", opcode, uint32(recvData.size())); recvData.hexlike(); - switch(opcode) + switch (opcode) { case WARDEN_CMSG_MODULE_MISSING: _warden->SendModuleToClient(); diff --git a/src/server/game/Warden/WardenCheckMgr.cpp b/src/server/game/Warden/WardenCheckMgr.cpp index f4c7a5069cf..abd7ff8f87d 100644 --- a/src/server/game/Warden/WardenCheckMgr.cpp +++ b/src/server/game/Warden/WardenCheckMgr.cpp @@ -121,7 +121,7 @@ void WardenCheckMgr::LoadWardenChecks() if (checkType == MPQ_CHECK || checkType == MEM_CHECK) { - WardenCheckResult *wr = new WardenCheckResult(); + WardenCheckResult* wr = new WardenCheckResult(); wr->Result.SetHexStr(checkResult.c_str()); int len = checkResult.size() / 2; if (wr->Result.GetNumBytes() < len) diff --git a/src/server/game/Warden/WardenMac.cpp b/src/server/game/Warden/WardenMac.cpp index 319cda304cc..3cc95b9f3f7 100644 --- a/src/server/game/Warden/WardenMac.cpp +++ b/src/server/game/Warden/WardenMac.cpp @@ -43,8 +43,8 @@ void WardenMac::Init(WorldSession *pClient, BigNumber *K) _session = pClient; // Generate Warden Key SHA1Randx WK(K->AsByteArray(), K->GetNumBytes()); - WK.generate(_inputKey, 16); - WK.generate(_outputKey, 16); + WK.Generate(_inputKey, 16); + WK.Generate(_outputKey, 16); /* Seed: 4D808D2C77D905C41A6380EC08586AFE (0x05 packet) Hash: (0x04 packet) diff --git a/src/server/game/Warden/WardenWin.cpp b/src/server/game/Warden/WardenWin.cpp index a7485d7da51..9aa439ec8c0 100644 --- a/src/server/game/Warden/WardenWin.cpp +++ b/src/server/game/Warden/WardenWin.cpp @@ -47,8 +47,8 @@ void WardenWin::Init(WorldSession* session, BigNumber *k) _session = session; // Generate Warden Key SHA1Randx WK(k->AsByteArray(), k->GetNumBytes()); - WK.generate(_inputKey, 16); - WK.generate(_outputKey, 16); + WK.Generate(_inputKey, 16); + WK.Generate(_outputKey, 16); memcpy(_seed, Module.Seed, 16); diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp index 0279f3e2834..015c13d1098 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/boss_pyroguard_emberseer.cpp @@ -64,7 +64,7 @@ public: void Reset() { - if(instance->GetBossState(DATA_PYROGAURD_EMBERSEER) == IN_PROGRESS) + if (instance->GetBossState(DATA_PYROGAURD_EMBERSEER) == IN_PROGRESS) OpenDoors(false); instance->SetBossState(DATA_PYROGAURD_EMBERSEER,NOT_STARTED); // respawn any dead Blackhand Incarcerators diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp index 079a2ef48e1..5a0560293da 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp @@ -494,7 +494,7 @@ class spell_rotface_mutated_infection : public SpellScriptLoader { // remove targets with this aura already // tank is not on this list - targets.remove_if (Trinity::UnitAuraCheck(true, GetSpellInfo()->Id)); + targets.remove_if(Trinity::UnitAuraCheck(true, GetSpellInfo()->Id)); if (targets.empty()) return; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp index 82946ad1f13..826c62a4390 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_valithria_dreamwalker.cpp @@ -1189,7 +1189,7 @@ class spell_dreamwalker_summoner : public SpellScriptLoader void FilterTargets(std::list& targets) { - targets.remove_if (Trinity::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED)); + targets.remove_if(Trinity::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED)); if (targets.empty()) return; @@ -1238,7 +1238,7 @@ class spell_dreamwalker_summon_suppresser : public SpellScriptLoader std::list summoners; GetCreatureListWithEntryInGrid(summoners, caster, NPC_WORLD_TRIGGER, 100.0f); - summoners.remove_if (Trinity::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED)); + summoners.remove_if(Trinity::UnitAuraCheck(true, SPELL_RECENTLY_SPAWNED)); Trinity::Containers::RandomResizeList(summoners, 2); if (summoners.empty()) return; diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp index ce0a61d1099..9d5adf39817 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/boss_flame_leviathan.cpp @@ -1230,7 +1230,7 @@ public: //bool OnGossipSelect(Player* player, Creature* creature, uint32 sender, uint32 action) //{ // player->PlayerTalkClass->ClearMenus(); - // switch(action) + // switch (action) // { // case GOSSIP_ACTION_INFO_DEF+1: // if (player) diff --git a/src/server/scripts/Outland/blades_edge_mountains.cpp b/src/server/scripts/Outland/blades_edge_mountains.cpp index 4ec1d04b6ad..c46757a3956 100644 --- a/src/server/scripts/Outland/blades_edge_mountains.cpp +++ b/src/server/scripts/Outland/blades_edge_mountains.cpp @@ -651,7 +651,7 @@ class npc_simon_bunny : public CreatureScript { _events.Update(diff); - switch(_events.ExecuteEvent()) + switch (_events.ExecuteEvent()) { case EVENT_SIMON_PERIODIC_PLAYER_CHECK: if (!CheckPlayer()) diff --git a/src/server/shared/Cryptography/WardenKeyGeneration.h b/src/server/shared/Cryptography/WardenKeyGeneration.h index 9b44ab1832e..f0a9905b6fe 100644 --- a/src/server/shared/Cryptography/WardenKeyGeneration.h +++ b/src/server/shared/Cryptography/WardenKeyGeneration.h @@ -21,50 +21,56 @@ #ifndef _WARDEN_KEY_GENERATION_H #define _WARDEN_KEY_GENERATION_H -class SHA1Randx { +class SHA1Randx +{ public: - SHA1Randx(uint8 *buff, uint32 size) { + SHA1Randx(uint8* buff, uint32 size) + { uint32 taken = size/2; sh.Initialize(); - sh.UpdateData(buff,taken); + sh.UpdateData(buff, taken); sh.Finalize(); - memcpy(o1,sh.GetDigest(),20); + memcpy(o1, sh.GetDigest(), 20); sh.Initialize(); - sh.UpdateData(buff+taken,size-taken); + sh.UpdateData(buff + taken, size - taken); sh.Finalize(); - memcpy(o2,sh.GetDigest(),20); + memcpy(o2, sh.GetDigest(), 20); - memset(o0,0x00,20); + memset(o0, 0x00, 20); - fillUp(); + FillUp(); } - void generate(uint8 *buf, uint32 sz) { - for(uint32 i=0;ibind_result_done) + if (m_Mstmt->bind_result_done) { delete[] m_Mstmt->bind->length; delete[] m_Mstmt->bind->is_null; -- cgit v1.2.3