本文整理汇总了C++中Guild::CreateFromCharter方法的典型用法代码示例。如果您正苦于以下问题:C++ Guild::CreateFromCharter方法的具体用法?C++ Guild::CreateFromCharter怎么用?C++ Guild::CreateFromCharter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guild
的用法示例。
在下文中一共展示了Guild::CreateFromCharter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CreateGuildCommand
bool ChatHandler::CreateGuildCommand(const char* args, WorldSession *m_session)
{
if(!*args)
return false;
Player * ptarget = getSelectedChar(m_session);
if(!ptarget) return false;
if(strlen((char*)args)>75)
{
// send message to user
char buf[256];
snprintf((char*)buf,256,"The name was too long by %ui", 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;
}
}
Charter tempCharter(0, ptarget->GetLowGUID(), CHARTER_TYPE_GUILD);
tempCharter.SignatureCount=0;
tempCharter.GuildName = string(args);
Guild * pGuild = Guild::Create();
pGuild->CreateFromCharter(&tempCharter, ptarget->GetSession());
SystemMessage(m_session, "Guild created");
return true;
}
示例2: CreateGuildCommand
bool ChatHandler::CreateGuildCommand(const char* args, WorldSession* m_session)
{
if(!*args)
return false;
Player* ptarget = getSelectedChar(m_session);
if(!ptarget) return false;
if(ptarget->IsInGuild())
{
RedSystemMessage(m_session, "%s is already in a guild.", ptarget->GetName());
return true;
}
if(strlen((char*)args) > 75)
{
// send message to user
char buf[256];
snprintf((char*)buf, 256, "The name was too long by %u", (uint32)strlen(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;
}
}
Guild* pGuild = NULL;
pGuild = objmgr.GetGuildByGuildName(string(args));
if(pGuild)
{
RedSystemMessage(m_session, "Guild name is already taken.");
return true;
}
Charter tempCharter(0, ptarget->GetLowGUID(), CHARTER_TYPE_GUILD);
tempCharter.SignatureCount = 0;
tempCharter.GuildName = string(args);
pGuild = Guild::Create();
pGuild->CreateFromCharter(&tempCharter, ptarget->GetSession());
GreenSystemMessage(m_session, "Guild created");
sGMLog.writefromsession(m_session, "Created guild '%s'", args);
return true;
}
示例3: HandleCharterTurnInCharter
void WorldSession::HandleCharterTurnInCharter(WorldPacket & recv_data)
{
uint64 mooguid;
recv_data >> mooguid;
Charter * pCharter = objmgr.GetCharterByItemGuid(mooguid);
if(!pCharter) return;
if(pCharter->CharterType == CHARTER_TYPE_GUILD)
{
Charter * gc = pCharter;
if(gc == NULL)
return;
if( gc->GetLeader() != _player->GetLowGUID() )
return;
if(gc->SignatureCount < 9 && Config.MainConfig.GetBoolDefault("Server", "RequireAllSignatures", false))
{
SendNotification("You don't have the required amount of signatures to turn in this petition.");
return;
}
// dont know hacky or not but only solution for now
// If everything is fine create guild
Guild *pGuild = Guild::Create();
pGuild->CreateFromCharter(gc, this);
// Destroy the charter
_player->m_playerInfo->charterId[CHARTER_TYPE_GUILD] = 0;
gc->Destroy();
_player->GetItemInterface()->RemoveItemAmt(ITEM_ENTRY_GUILD_CHARTER, 1);
sHookInterface.OnGuildCreate(_player, pGuild);
}
else
{
/* Arena charter - TODO: Replace with correct messages */
ArenaTeam * team;
uint32 type;
uint32 i;
uint32 icon, iconcolor, bordercolor, border, background;
recv_data >> iconcolor >>icon >> bordercolor >> border >> background;
switch(pCharter->CharterType)
{
case CHARTER_TYPE_ARENA_2V2:
type = ARENA_TEAM_TYPE_2V2;
break;
case CHARTER_TYPE_ARENA_3V3:
type = ARENA_TEAM_TYPE_3V3;
break;
case CHARTER_TYPE_ARENA_5V5:
type = ARENA_TEAM_TYPE_5V5;
break;
default:
SendNotification("Internal Error");
return;
}
if( pCharter->GetLeader() != _player->GetLowGUID() )
return;
if(_player->m_playerInfo->arenaTeam[pCharter->CharterType-1] != NULL)
{
sChatHandler.SystemMessage(this, "You are already in an arena team.");
return;
}
if(pCharter->SignatureCount < pCharter->GetNumberOfSlotsByType() && Config.MainConfig.GetBoolDefault("Server", "RequireAllSignatures", false))
{
sChatHandler.SystemMessage(this, "You don't have the required amount of signatures to turn in this petition.");
return;
}
team = new ArenaTeam(type, objmgr.GenerateArenaTeamId());
team->m_name = pCharter->GuildName;
team->m_emblemColour = iconcolor;
team->m_emblemStyle = icon;
team->m_borderColour = bordercolor;
team->m_borderStyle = border;
team->m_backgroundColour = background;
team->m_leader=_player->GetLowGUID();
team->m_stat_rating=1500;
objmgr.AddArenaTeam(team);
objmgr.UpdateArenaTeamRankings();
team->AddMember(_player->m_playerInfo);
/* Add the members */
for(i = 0; i < pCharter->SignatureCount; ++i)
{
PlayerInfo * info = objmgr.GetPlayerInfo(pCharter->Signatures[i]);
if(info)
{
team->AddMember(info);
//.........这里部分代码省略.........
示例4: HandleGuildCreateCommand
//.guild create
bool ChatHandler::HandleGuildCreateCommand(const char* args, WorldSession* m_session)
{
#if VERSION_STRING != Cata
Player* selected_player = GetSelectedPlayer(m_session, true, true);
if (selected_player == nullptr)
return true;
if (!*args)
return false;
if (selected_player->IsInGuild())
{
RedSystemMessage(m_session, "%s is already in a guild.", selected_player->GetName());
return true;
}
if (strlen((char*)args) > 75)
{
// send message to user
char buf[256];
snprintf((char*)buf, 256, "The name was too long by %u", (uint32)strlen(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;
}
}
Guild* pGuild = NULL;
pGuild = objmgr.GetGuildByGuildName(std::string(args));
if (pGuild)
{
RedSystemMessage(m_session, "Guild name is already taken.");
return true;
}
Charter tempCharter(0, selected_player->getGuidLow(), CHARTER_TYPE_GUILD);
tempCharter.SignatureCount = 0;
tempCharter.GuildName = std::string(args);
pGuild = Guild::Create();
pGuild->CreateFromCharter(&tempCharter, selected_player->GetSession());
GreenSystemMessage(m_session, "Guild created");
sGMLog.writefromsession(m_session, "Created guild '%s'", args);
return true;
#else
Player* selected_player = GetSelectedPlayer(m_session, true, true);
if (selected_player == nullptr)
return true;
if (!*args)
return false;
if (selected_player->GetGuild())
{
RedSystemMessage(m_session, "%s is already in a guild.", selected_player->GetName());
return true;
}
if (strlen((char*)args) > 75)
{
// send message to user
char buf[256];
snprintf((char*)buf, 256, "The name was too long by %u", (uint32)strlen(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;
}
}
Charter tempCharter(0, selected_player->getGuidLow(), CHARTER_TYPE_GUILD);
tempCharter.SignatureCount = 0;
tempCharter.GuildName = std::string(args);
Guild* guild = new Guild;
if (!guild->create(selected_player, std::string(args)))
{
delete guild;
SystemMessage(m_session, "Guild not created");
return true;
}
sGuildMgr.addGuild(guild);
//\todo danko
//.........这里部分代码省略.........