-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
936 additions
and
846 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
#include "ToSMapMgr.h" | ||
|
||
std::string ToSMapManager::GetHexColorFromClass(uint8 classId) | ||
{ | ||
switch (classId) | ||
{ | ||
case CLASS_DEATH_KNIGHT: | ||
return "|cffFC2A43"; | ||
case CLASS_HUNTER: | ||
return "|cffAAD174"; | ||
case CLASS_PALADIN: | ||
return "|cffF28CBC"; | ||
case CLASS_ROGUE: | ||
return "|cffFEF262"; | ||
case CLASS_WARLOCK: | ||
return "|cff9A81C2"; | ||
case CLASS_DRUID: | ||
return "|cffF67404"; | ||
case CLASS_MAGE: | ||
return "|cff70C9F1"; | ||
case CLASS_PRIEST: | ||
return "|cffF5F3F6"; | ||
case CLASS_SHAMAN: | ||
return "|cff05D7BA"; | ||
case CLASS_WARRIOR: | ||
return "|cffC9A074"; | ||
} | ||
|
||
return "|cffFFFFFF"; | ||
} | ||
|
||
ToSCurseTemplate* ToSMapManager::GetCurseById(uint32 curseId) | ||
{ | ||
auto it = CurseTemplates.find(curseId); | ||
if (it == CurseTemplates.end()) | ||
{ | ||
return nullptr; | ||
} | ||
|
||
return &it->second; | ||
} | ||
|
||
ToSWaveTemplate* ToSMapManager::GetWaveTemplateForWave(uint32 wave) | ||
{ | ||
auto it = WaveTemplates.find(wave); | ||
if (it == WaveTemplates.end()) | ||
{ | ||
return nullptr; | ||
} | ||
|
||
return &it->second; | ||
} | ||
|
||
uint32 ToSMapManager::GetTotalWaves() | ||
{ | ||
return WaveTemplates.size(); | ||
} | ||
|
||
std::vector<ToSEnemyGroup*> ToSMapManager::GetEnemiesFromGroup(uint32 groupId, uint32 subGroup) | ||
{ | ||
std::vector<ToSEnemyGroup*> groups; | ||
|
||
for (auto it = EnemyGroups.begin(); it != EnemyGroups.end(); ++it) | ||
{ | ||
if (it->second.group == groupId && | ||
it->second.subGroup == subGroup) | ||
{ | ||
groups.push_back(&it->second); | ||
} | ||
} | ||
|
||
return groups; | ||
} | ||
|
||
std::vector<uint32> ToSMapManager::GetSubGroups(uint32 groupId) | ||
{ | ||
std::vector<uint32> subgroups; | ||
|
||
for (auto it = EnemyGroups.begin(); it != EnemyGroups.end(); ++it) | ||
{ | ||
if (it->second.group == groupId) | ||
{ | ||
uint32 subgroup = it->second.subGroup; | ||
|
||
auto it = std::find(subgroups.begin(), subgroups.end(), subgroup); | ||
if (it != subgroups.end()) | ||
{ | ||
continue; | ||
} | ||
|
||
subgroups.push_back(subgroup); | ||
} | ||
} | ||
|
||
return subgroups; | ||
} | ||
|
||
std::vector<ToSRewardTemplate>* ToSMapManager::GetRewardTemplates(uint32 rewardId) | ||
{ | ||
auto it = RewardTemplates.find(rewardId); | ||
if (it == RewardTemplates.end()) | ||
{ | ||
return nullptr; | ||
} | ||
|
||
return &it->second; | ||
} | ||
|
||
Creature* ToSMapManager::SpawnNPC(uint32 entry, Map* map, Position* position) | ||
{ | ||
if (!map || !position) | ||
{ | ||
return nullptr; | ||
} | ||
|
||
if (!sObjectMgr->GetCreatureTemplate(entry)) | ||
{ | ||
return nullptr; | ||
} | ||
|
||
return map->SummonCreature(entry, *position); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#ifndef MODULE_TRIAL_OF_STRENGTH_MAP_MGR_H | ||
#define MODULE_TRIAL_OF_STRENGTH_MAP_MGR_H | ||
|
||
#include "TrialOfStrength.h" | ||
|
||
#include <unordered_map> | ||
|
||
class ToSMapManager | ||
{ | ||
private: | ||
ToSMapManager() { } | ||
public: | ||
static ToSMapManager* GetInstance() | ||
{ | ||
if (!instance) | ||
{ | ||
instance = new ToSMapManager(); | ||
} | ||
|
||
return instance; | ||
} | ||
|
||
std::string GetHexColorFromClass(uint8 classId); | ||
ToSCurseTemplate* GetCurseById(uint32 curseId); | ||
ToSWaveTemplate* GetWaveTemplateForWave(uint32 wave); | ||
uint32 GetTotalWaves(); | ||
std::vector<ToSEnemyGroup*> GetEnemiesFromGroup(uint32 groupId, uint32 subGroup); | ||
std::vector<ToSRewardTemplate>* GetRewardTemplates(uint32 rewardId); | ||
std::vector<uint32> GetSubGroups(uint32 groupId); | ||
Creature* SpawnNPC(uint32 entry, Map* map, Position* position); | ||
public: | ||
std::unordered_map<uint32, ToSWaveTemplate> WaveTemplates; | ||
std::unordered_map<uint32, ToSEnemyGroup> EnemyGroups; | ||
std::unordered_map<uint32, std::vector<ToSRewardTemplate>> RewardTemplates; | ||
std::unordered_map<uint32, ToSCurseTemplate> CurseTemplates; | ||
private: | ||
inline static ToSMapManager* instance; | ||
}; | ||
|
||
#define sToSMapMgr ToSMapManager::GetInstance() | ||
|
||
#endif // MODULE_TRIAL_OF_STRENGTH_MAP_MGR_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.