本文整理汇总了C++中Guild::GetFreeGuildIdFromDb方法的典型用法代码示例。如果您正苦于以下问题:C++ Guild::GetFreeGuildIdFromDb方法的具体用法?C++ Guild::GetFreeGuildIdFromDb怎么用?C++ Guild::GetFreeGuildIdFromDb使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guild
的用法示例。
在下文中一共展示了Guild::GetFreeGuildIdFromDb方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateGuildCommand
bool ChatHandler::CreateGuildCommand(const char* args, WorldSession *m_session)
{
if(!*args)
return false;
Player * ptarget = m_session->GetPlayer()->GetMapMgr()->GetPlayer(m_session->GetPlayer()->GetSelection());
if(ptarget == 0)
{
ptarget = m_session->GetPlayer();
}
if(strlen((char*)args)>75)
{
// send message to user
char buf[256];
snprintf((char*)buf,256,"The name was too long by %i", strlen((char*)args)-75);
SystemMessage(m_session, buf);
return true;
}
for (uint32 i = 0; i < strlen(args); i++) {
if(!isalpha(args[i]) && args[i]!=' ') {
SystemMessage(m_session, "Error, name can only contain chars A-Z and a-z.");
return true;
}
}
if(objmgr.GetGuildByGuildName(args))
{
WorldPacket data(SMSG_GUILD_COMMAND_RESULT, 100);
data << uint32(0);
data << args;
data << uint32(C_R_GUILD_NAME_EXISTS);
m_session->SendPacket(&data);
return true;
}
Guild *pGuild = new Guild;
uint32 guildId = pGuild->GetFreeGuildIdFromDb();
if(guildId == 0)
{
printf("Error Getting Free Guild ID");
delete pGuild;
return false;
}
//Guild Setup
pGuild->SetGuildId( guildId );
pGuild->SetGuildName( args );
pGuild->CreateRank("Guild Master", GR_RIGHT_ALL);
pGuild->CreateRank("Officer", GR_RIGHT_ALL);
pGuild->CreateRank("Veteran", GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK);
pGuild->CreateRank("Member", GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK);
pGuild->CreateRank("Initiate", GR_RIGHT_GCHATLISTEN | GR_RIGHT_GCHATSPEAK);
pGuild->SetGuildEmblemStyle( 0xFFFF );
pGuild->SetGuildEmblemColor( 0xFFFF );
pGuild->SetGuildBorderStyle( 0xFFFF );
pGuild->SetGuildBorderColor( 0xFFFF );
pGuild->SetGuildBackgroundColor( 0xFFFF );
objmgr.AddGuild(pGuild);
//Guild Leader Setup
ptarget->SetGuildId( pGuild->GetGuildId() );
ptarget->SetUInt32Value(PLAYER_GUILDID, pGuild->GetGuildId() );
ptarget->SetGuildRank(GUILDRANK_GUILD_MASTER);
ptarget->SetUInt32Value(PLAYER_GUILDRANK,GUILDRANK_GUILD_MASTER);
pGuild->SetGuildLeaderGuid( ptarget->GetGUID() );
pGuild->AddNewGuildMember( ptarget );
pGuild->SaveToDb();
pGuild->SaveRanksToDb();
return true;
}