Example #1
0
	void GossipHello(Object* pObject, Player* plr, bool AutoSend){

        GossipMenu *Menu;

        objmgr.CreateGossipMenuForPlayer(&Menu, pObject->GetGUID(), 14736, plr);

		
		if( plr->CanGainXp() )
			Menu->AddMenuItem( 0, const_cast< char* >( GOSSIP_DISABLE_XP_GAIN ), 0, 1, const_cast< char*>( GOSSIP_BOXMSG_DISABLE_XP_GAIN ), 100000, false );
		else
			Menu->AddMenuItem( 0, const_cast< char* >( GOSSIP_ENABLE_XP_GAIN ), 0, 1, const_cast< char* >( GOSSIP_BOXMSG_ENABLE_XP_GAIN ), 100000, false );
        
        if(AutoSend)
            Menu->SendTo(plr);
    }
Example #2
0
	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);
	}
	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);
	}