mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-01-13 09:07:19 +00:00
Refactor guild managment into a singleton (#1913)
The idea is to centralize the creation, assignment, and management of bot guilds into a single class that can be referenced. The way this is intended to work. when the manager is created, if the config option to delete guilds is set, then it deletes all bot guilds. On startup 1. Load all guild names from database. Shuffle keys for some randomization. 2. Load Guilds from database 3. For existing guilds, identify the guild faction, number of members, and assess if the guild is 'full' based on the number of bots set in config. 4. Determine if the leader of the guild is a real player based on the leader account. 5. Mark any playerbot guild names as not available (false). The validation process (2-5) is set to run once an hour. Guild Creation. Now guild creation occurs on an as needed bases during the initialization process. Previously, all of the guilds would be created at once, and then randomly assigned. When a bot is not in a guild during initialization, it will check if there are any partially filled guilds of that bots faction where the bot can be assigned to. If not, and the cache of bot guilds is less than the set number in config, it will randomly return the available name. This then goes to the CreateGuild function where the core guild manager creates a guild, the guild emblem is set, and the cache updated. If a bot is assigned to guild, but fails to join then it throws an error. Checking for real player guilds function now lives in the guild manager. --------- Co-authored-by: bashermens <31279994+hermensbas@users.noreply.github.com>
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include "Metric.h"
|
||||
#include "PlayerScript.h"
|
||||
#include "PlayerbotAIConfig.h"
|
||||
#include "PlayerbotGuildMgr.h"
|
||||
#include "PlayerbotSpellCache.h"
|
||||
#include "PlayerbotWorldThreadProcessor.h"
|
||||
#include "RandomPlayerbotMgr.h"
|
||||
@@ -514,6 +515,6 @@ void AddPlayerbotsScripts()
|
||||
new PlayerbotsScript();
|
||||
new PlayerBotsBGScript();
|
||||
AddPlayerbotsSecureLoginScripts();
|
||||
|
||||
AddSC_playerbots_commandscript();
|
||||
PlayerBotsGuildValidationScript();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user