Files
mod-playerbots/src/Util/BroadcastHelper.h
bashermens 13fff46fa0 Improper singletons migration to clean Meyer's singletons (cherry-pick) (#2082)
# Pull Request

- Applies the clean and corrected singletons, Meyer pattern. (cherry
picked from @SmashingQuasar )

Testing by just playing the game in various ways. Been tested by myself
@Celandriel and @SmashingQuasar
---

## Complexity & Impact

- Does this change add new decision branches?
    - [x] No
    - [ ] Yes (**explain below**)

- Does this change increase per-bot or per-tick processing?
    - [x] No
    - [ ] Yes (**describe and justify impact**)

- Could this logic scale poorly under load?
    - [x] No
    - [ ] Yes (**explain why**)

---

## Defaults & Configuration

- Does this change modify default bot behavior?
    - [x] No
    - [ ] Yes (**explain why**)

---

## AI Assistance

- Was AI assistance (e.g. ChatGPT or similar tools) used while working
on this change?
    - [x] No
    - [ ] Yes (**explain below**)
---

## Final Checklist

- [x] Stability is not compromised
- [x] Performance impact is understood, tested, and acceptable
- [x] Added logic complexity is justified and explained
- [x] Documentation updated if needed

---

## Notes for Reviewers

Anything that significantly improves realism at the cost of stability or
performance should be carefully discussed
before merging.

---------

Co-authored-by: Nicolas Lebacq <nicolas.cordier@outlook.com>
Co-authored-by: Keleborn <22352763+Celandriel@users.noreply.github.com>
2026-01-30 21:49:37 +01:00

149 lines
3.4 KiB
C++

#pragma once
class PlayerbotAI;
class Player;
class ItemTemplate;
class Quest;
class Creature;
class Group;
class BroadcastHelper
{
public:
BroadcastHelper();
public:
enum ToChannel
{
TO_GUILD = 1,
TO_WORLD = 2,
TO_GENERAL = 3,
TO_TRADE = 4,
TO_LOOKING_FOR_GROUP = 5,
TO_LOCAL_DEFENSE = 6,
TO_WORLD_DEFENSE = 7,
TO_GUILD_RECRUITMENT = 8
};
static uint8_t GetLocale();
static bool BroadcastTest(
PlayerbotAI* ai,
Player* bot
);
static bool BroadcastToChannelWithGlobalChance(
PlayerbotAI* ai,
std::string message,
std::list<std::pair<ToChannel, uint32_t>> toChannels
);
static bool BroadcastLootingItem(
PlayerbotAI* ai,
Player* bot,
const ItemTemplate* proto
);
static bool BroadcastQuestAccepted(
PlayerbotAI* ai,
Player* bot,
const Quest* quest
);
static bool BroadcastQuestUpdateAddKill(
PlayerbotAI* ai,
Player* bot,
Quest const* quest,
uint32_t availableCount,
uint32_t requiredCount,
std::string obectiveName
);
static bool BroadcastQuestUpdateAddItem(
PlayerbotAI* ai,
Player* bot,
Quest const* quest,
uint32_t availableCount,
uint32_t requiredCount,
const ItemTemplate* proto
);
static bool BroadcastQuestUpdateFailedTimer(
PlayerbotAI* ai,
Player* bot,
Quest const* quest
);
static bool BroadcastQuestUpdateComplete(
PlayerbotAI* ai,
Player* bot,
Quest const* quest
);
static bool BroadcastQuestTurnedIn(
PlayerbotAI* ai,
Player* bot,
Quest const* quest
);
static bool BroadcastKill(
PlayerbotAI* ai,
Player* bot,
Creature* creature
);
static bool BroadcastLevelup(
PlayerbotAI* ai,
Player* bot
);
static bool BroadcastGuildMemberPromotion(
PlayerbotAI* ai,
Player* bot,
Player* player
);
static bool BroadcastGuildMemberDemotion(
PlayerbotAI* ai,
Player* bot,
Player* player
);
static bool BroadcastGuildGroupOrRaidInvite(
PlayerbotAI* ai,
Player* bot,
Player* player,
Group* group
);
static bool BroadcastSuggestInstance(
PlayerbotAI* ai,
std::vector<std::string>& allowedInstances,
Player* bot
);
static bool BroadcastSuggestQuest(
PlayerbotAI* ai,
std::vector<uint32>& quests,
Player* bot
);
static bool BroadcastSuggestGrindMaterials(
PlayerbotAI* ai,
std::string item,
Player* bot
);
static bool BroadcastSuggestGrindReputation(
PlayerbotAI* ai,
std::vector<std::string> levels,
std::vector<std::string> allowedFactions,
Player* bot
);
static bool BroadcastSuggestSell(
PlayerbotAI* ai,
const ItemTemplate* proto,
uint32_t count,
uint32_t price,
Player* bot
);
static bool BroadcastSuggestSomething(
PlayerbotAI* ai,
Player* bot
);
static bool BroadcastSuggestSomethingToxic(
PlayerbotAI* ai,
Player* bot
);
static bool BroadcastSuggestToxicLinks(
PlayerbotAI* ai,
Player* bot
);
static bool BroadcastSuggestThunderfury(
PlayerbotAI* ai,
Player* bot
);
};