PDA

View Full Version : [TrinityCore] Starting Guild for the new Character



Wise
14-08-20, 09:14 AM
If activated, when some player is created, this script will add the player to a guild.
You'll need these options in your worldserver.conf file:


################################################## #################################################
# STARTING GUILD
#
# These settings control the Starting Guild functionality
#
# StartingGuild.Enable
# Description: Enables or Disables the Starting Guild functionality.
# Default: 0 - (Disabled)
# 1 - (Enabled)


StartingGuild.Enable = 0


#
# StartingGuild.GuildID
# Description: The identifier (ID) of the Guild. It must be an integer number
# Default: 1


StartingGuild.GuildID = 1


#
################################################## #################################################


/*
Made by: Erictemponi
*/

#include "ScriptMgr.h"
#include "Config.h"
#include "Guild.h"
#include "GuildMgr.h"

class StartingGuildScript : public PlayerScript
{
public:
StartingGuildScript() : PlayerScript("StartingGuildScript") { }

// called when some player is created
void OnCreate(Player* pPlayer)
{
if (sConfigMgr->GetBoolDefault("StartingGuild.Enable", false))
{
uint32 guildID = sConfigMgr->GetIntDefault("StartingGuild.GuildID", 1);
Guild* targetGuild = sGuildMgr->GetGuildById(guildID);
if (targetGuild)
{
ObjectGuid playerGuid = pPlayer->GetGUID();
// player's guild membership checked in AddMember before add
CharacterDatabaseTransaction trans(nullptr);
targetGuild->AddMember(trans, playerGuid);
}
}
}
};

void AddSC_starting_guild()
{
new StartingGuildScript();
}


Credits:



LordPsyan old patch
Erictemponi for this newest one.

Logandros
10-01-23, 07:07 AM
Is there a way to have multiple entries, 1 for each faction?