Skip to content

Commit

Permalink
feat: announce realm first mythic group
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyeriah committed Oct 9, 2024
1 parent 769d305 commit 3a55be6
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 0 deletions.
6 changes: 6 additions & 0 deletions data/sql/db-world/zone_difficulty_completion_logs.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CREATE TABLE `zone_difficulty_completion_logs` (
`guid` INT UNSIGNED NOT NULL,
`type` TINYINT NOT NULL,
`mode` TINYINT NOT NULL DEFAULT 0,
PRIMARY KEY (`guid`, `type`)
);
2 changes: 2 additions & 0 deletions src/ZoneDifficulty.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,15 @@ class ZoneDifficulty
[[nodiscard]] bool ShouldNerfMap(uint32 mapId) { return NerfInfo.find(mapId) != NerfInfo.end(); };
[[nodiscard]] int32 GetLowestMatchingPhase(uint32 mapId, uint32 phaseMask);
void RewardItem(Player* player, uint8 category, uint8 itemType, uint8 counter, Creature* creature, uint32 itemEntry);
void LogAndAnnounceKill(Unit* creature, bool isMythic);

bool IsEnabled{ false };
bool IsDebugInfoEnabled{ false };
float MythicmodeHpModifier{ 2.0 };
bool MythicmodeEnable{ false };
bool MythicmodeInNormalDungeons{ false };
bool UseVendorInterface{ false };
bool IsBlackTempleDone{ false };
std::vector<uint32> DailyHeroicQuests;
std::map<uint32, uint32> HeroicTBCQuestMapList;
std::map<uint32, uint8> EncounterCounter;
Expand Down
23 changes: 23 additions & 0 deletions src/mod_zone_difficulty_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1047,3 +1047,26 @@ void ZoneDifficulty::RewardItem(Player* player, uint8 category, uint8 itemType,
if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(reward.Entry))
player->GetSession()->SendAreaTriggerMessage("You were rewarded %s for %u points.", proto->Name1.c_str(), reward.Price);
};

void ZoneDifficulty::LogAndAnnounceKill(Unit* source, bool isMythic)
{
// Just black temple supported for the time being
if (sZoneDifficulty->IsBlackTempleDone)
return;

sZoneDifficulty->IsBlackTempleDone = true;

ChatHandler(nullptr).SendWorldText("Congrats on conquering Black Temple ({}) and defeating Illidan Stormrage! Well done, champions!", isMythic ? "Mythic" : "Normal");

std::string names = "Realm first group: ";

if (Map* map = source->GetMap())
{
map->DoForAllPlayers([&](Player* mapPlayer) {
names.append(mapPlayer->GetName() + ", ");
CharacterDatabase.Execute("INSERT INTO zone_difficulty_completion_logs (guid, type, mode) VALUES ({}, {}, {})", mapPlayer->GetGUID().GetCounter(), TYPE_RAID_T6, 1);
});
}

ChatHandler(nullptr).SendWorldText(names.c_str());
};
5 changes: 5 additions & 0 deletions src/mod_zone_difficulty_scripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -432,6 +432,9 @@ class mod_zone_difficulty_worldscript : public WorldScript
sZoneDifficulty->MythicmodeInNormalDungeons = sConfigMgr->GetOption<bool>("ModZoneDifficulty.Mythicmode.InNormalDungeons", false);
sZoneDifficulty->UseVendorInterface = sConfigMgr->GetOption<bool>("ModZoneDifficulty.UseVendorInterface", false);
sZoneDifficulty->LoadMapDifficultySettings();

if (CharacterDatabase.Query("SELECT 1 FROM zone_difficulty_completion_logs WHERE type = {}", TYPE_RAID_T6))
sZoneDifficulty->IsBlackTempleDone = true;
}

void OnStartup() override
Expand Down Expand Up @@ -557,6 +560,8 @@ class mod_zone_difficulty_globalscript : public GlobalScript
player->UpdatePlayerSetting(ModZoneDifficultyString + "ct", SETTING_BLACK_TEMPLE, 1);
ChatHandler(player->GetSession()).PSendSysMessage("Congratulations on completing the Black Temple!");
});

sZoneDifficulty->LogAndAnnounceKill(source, true);
}
}
/* debug
Expand Down

0 comments on commit 3a55be6

Please sign in to comment.