本文整理汇总了C++中Guild::GetGuildId方法的典型用法代码示例。如果您正苦于以下问题:C++ Guild::GetGuildId方法的具体用法?C++ Guild::GetGuildId怎么用?C++ Guild::GetGuildId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guild
的用法示例。
在下文中一共展示了Guild::GetGuildId方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: HandleGuildBankDepositItem
void WorldSession::HandleGuildBankDepositItem(WorldPacket & recv_data)
{
uint64 guid;
uint8 source_isfrombank;
uint32 wtf;
uint8 wtf2;
uint32 i;
Guild * pGuild = _player->m_playerInfo->guild;
GuildMember * pMember = _player->m_playerInfo->guildMember;
if(pGuild==NULL || pMember==NULL)
return;
recv_data >> guid >> source_isfrombank;
if(source_isfrombank)
{
GuildBankTab * pSourceTab;
GuildBankTab * pDestTab;
Item * pSourceItem;
Item * pDestItem;
uint8 dest_bank;
uint8 dest_bankslot;
uint8 source_bank;
uint8 source_bankslot;
/* read packet */
recv_data >> dest_bank;
recv_data >> dest_bankslot;
recv_data >> wtf;
recv_data >> source_bank;
recv_data >> source_bankslot;
/* sanity checks to avoid overflows */
if(source_bankslot >= MAX_GUILD_BANK_SLOTS ||
dest_bankslot >= MAX_GUILD_BANK_SLOTS ||
source_bank >= MAX_GUILD_BANK_TABS ||
dest_bank >= MAX_GUILD_BANK_TABS)
{
return;
}
/* make sure we have permissions */
if(!pMember->pRank->CanPerformBankCommand(GR_RIGHT_GUILD_BANK_DEPOSIT_ITEMS, dest_bank) ||
!pMember->pRank->CanPerformBankCommand(GR_RIGHT_GUILD_BANK_DEPOSIT_ITEMS, source_bank))
return;
/* locate the tabs */
pSourceTab = pGuild->GetBankTab((uint32)source_bank);
pDestTab = pGuild->GetBankTab((uint32)dest_bank);
if(pSourceTab == NULL || pDestTab == NULL)
return;
pSourceItem = pSourceTab->pSlots[source_bankslot];
pDestItem = pDestTab->pSlots[dest_bankslot];
if(pSourceItem == NULL && pDestItem == NULL)
return;
/* perform the actual swap */
pSourceTab->pSlots[source_bankslot] = pDestItem;
pDestTab->pSlots[dest_bankslot] = pSourceItem;
/* update the client */
if(pSourceTab == pDestTab)
{
/* send both slots in the packet */
pGuild->SendGuildBank(this, pSourceTab, source_bankslot, dest_bankslot);
}
else
{
/* send a packet for each different bag */
pGuild->SendGuildBank(this, pSourceTab, source_bankslot, -1);
pGuild->SendGuildBank(this, pDestTab, dest_bankslot, -1);
}
/* update in sql */
if(pDestItem == NULL)
{
/* this means the source slot is no longer being used. */
CharacterDatabase.Execute("DELETE FROM guild_bankitems WHERE guildId = %u AND tabId = %u AND slotId = %u",
pGuild->GetGuildId(), (uint32)pSourceTab->iTabId, (uint32)source_bankslot);
}
else
{
/* insert the new item */
CharacterDatabase.Execute("REPLACE INTO guild_bankitems VALUES(%u, %u, %u, %u)",
pGuild->GetGuildId(), (uint32)pSourceTab->iTabId, (uint32)source_bankslot, pDestItem->GetLowGUID());
}
if(pSourceItem == NULL)
{
/* this means the destination slot is no longer being used. */
CharacterDatabase.Execute("DELETE FROM guild_bankitems WHERE guildId = %u AND tabId = %u AND slotId = %u",
pGuild->GetGuildId(), (uint32)pDestTab->iTabId, (uint32)dest_bankslot);
}
else
{
/* insert the new item */
CharacterDatabase.Execute("REPLACE INTO guild_bankitems VALUES(%u, %u, %u, %u)",
//.........这里部分代码省略.........
示例2: 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;
}