本文整理汇总了C++中GossipMenu::AddMenuItem方法的典型用法代码示例。如果您正苦于以下问题:C++ GossipMenu::AddMenuItem方法的具体用法?C++ GossipMenu::AddMenuItem怎么用?C++ GossipMenu::AddMenuItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GossipMenu
的用法示例。
在下文中一共展示了GossipMenu::AddMenuItem方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: send_MainPage
void send_MainPage(Object * pObject, Player* Plr)
{
if( pObject == NULL || Plr == NULL )
return;
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), GOLD_SINK_ITEM_NPC_DESC_TEXT_ID, Plr);
char WriteBuff[500];
char WriteBuff2[500];
char ItemLink[ 500 ];
for( uint32 i=0;i<RENTED_ITEM_COUNT;i++)
{
ItemPrototype *iProto = ItemPrototypeStorage.LookupEntry( RentedItemIDs[ i ] );
if( iProto == NULL )
continue;
GetItemLinkByProto(iProto, ItemLink );
int64 *Holder;
Holder = pObject->GetCreateIn64Extension( GOLD_SINK_ITEM_NPC_ID + i * EXTENSION_ITEM_INFO_SIZE + EXTENSION_ITEM_INFO_INDEX_TIME );
//check if item is still reserved
if( *Holder > UNIXTIME )
{
int64 ReservedSecondsRemaining = *Holder - UNIXTIME;
sprintf( WriteBuff, "Item %s is reserved for %d seconds",ItemLink, ReservedSecondsRemaining );
Menu->AddItem( 0, WriteBuff, 2);
continue;
}
//tell the player we have an item available if he agrees to pay more
Holder = pObject->GetCreateIn64Extension( GOLD_SINK_ITEM_NPC_ID + i * EXTENSION_ITEM_INFO_SIZE + EXTENSION_ITEM_INFO_INDEX_COST );
uint32 NeededGold = ( RENTED_ITEM_MIN_GOLD + *Holder ) * ITEM_RESERVE_GOLD_INCREMENT_PCT / 100;
sprintf( WriteBuff, "Pay at least %u to reserve %s for min %u max %u minutes", NeededGold, ItemLink, MINIMUM_RESERVE_MINUTES, MINIMUM_RESERVE_MINUTES + MAXIMIM_RESERVE_MINUTES );
sprintf( WriteBuff2, "Steal %s from other player?", ItemLink );
Menu->AddMenuItem( 0, WriteBuff, 0, 0, WriteBuff2, NeededGold * 10000, true, 2 + i );
}
Menu->SendTo(Plr);
}
示例2: send_StatusPage
void send_StatusPage(Maze_Map_Info *selected_map,Selected_Event_info *eventi,Object * pObject, Player* Plr)
{
GossipMenu *Menu;
objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 1, Plr);
if( selected_map == NULL )
{
Plr->BroadcastMessage( "! GM needs to select a MAP before player menu is available for event!");
}
else
{
bool isleader;
if( Plr->IsGroupLeader() )
isleader = true;
else
isleader = false;
char tstr[500];
uint32 teamsize = selected_map->max_players_in_team;
if( eventi->status != TS_NOT_STARTED )
{
sprintf( tstr,"%s Maze Event started. Come back later.", selected_map->map_name_menu );
Menu->AddItem( 0, tstr, MENU_ID_STATUS_PAGE);
}
else
{
//count teams registered so far
uint32 teams_registered_so_far = 0;
for(uint32 j=0;j<MAX_TEAMS_PER_EVENT;j++)
if( eventi->teams_registered[ j ].is_used != 0 )
teams_registered_so_far++;
if( selected_map->max_teams_per_event <= teams_registered_so_far )
{
sprintf( tstr,"Event Queue is full %u", teams_registered_so_far);
Menu->AddItem( 0, tstr, 2 );
}
else if( isleader )
{
sprintf( tstr,"Queue for %s Event as group(%u/%u)", selected_map->map_name_menu,teams_registered_so_far,selected_map->max_teams_per_event);
Menu->AddMenuItem( 0, tstr,0,0,"Input your unique team name to join/create(use Accept button not Enter)",0,1,MENU_ID_CREATE_JOIN_TEAM_AS_GROUP);
}
else
{
sprintf( tstr,"Queue for %s Event to a group(%u/%u)", selected_map->map_name_menu,teams_registered_so_far,selected_map->max_teams_per_event);
Menu->AddMenuItem( 0, tstr,0,0,"Input your unique team name to join/create(use Accept button not Enter)",0,1,MENU_ID_CREATE_JOIN_TEAM_AS_PLAYER);
}
}
}
// leaving so soon ?
Menu->AddItem( 0, "Leave event queue",100);
//special menu for GMs
if( Plr->GetSession() && Plr->GetSession()->HasPermissions() )
{
Menu->AddItem( 0, "(GM)Pick a MAP for next event",671);
if( eventi->is_spawned == true )
{
if( eventi->status == TS_NOT_STARTED )
Menu->AddItem( 0, "(GM)Start Maze Event",660);
Menu->AddItem( 0, "(GM)Stop Event",672);
}
}
//dev commands
if( Plr->GetSession() && Plr->GetSession()->HasGMPermissions() )
{
Menu->AddItem( 0, "(GM-DEV)Reload Map Files",673);
}
Menu->SendTo(Plr);
}