bool RestrictWeaponPage::PopulateMenuPage(player_t *player_ptr)
{
	this->SetEscLink("%s", Translate(player_ptr, 530));
	this->SetTitle("%s", Translate(player_ptr, 531));

	// Setup weapon list
	for( int i = 0; i < MAX_WEAPONS_USED; i++ )
	{
		if ( !gpManiWeaponMgr->weapons[i] ) continue;
		if (gpManiWeaponMgr->weapons[i]->GetDisplayID() == 0) continue;

		MenuItem *ptr = new RestrictWeaponItem();
		if (!gpManiWeaponMgr->weapons[i]->IsRestricted())
		{
			ptr->SetDisplayText("%s", Translate(player_ptr, gpManiWeaponMgr->weapons[i]->GetDisplayID()));	
		}
		else
		{
			ptr->SetDisplayText("* %s <%i>", 
				Translate(player_ptr, gpManiWeaponMgr->weapons[i]->GetDisplayID()), 
				gpManiWeaponMgr->weapons[i]->GetTeamLimit());
		}

		ptr->SetHiddenText("%s", Translate(player_ptr, gpManiWeaponMgr->weapons[i]->GetDisplayID()));
		ptr->params.AddParam("index", i);
		this->AddItem(ptr);
	}

	this->SortHidden();
	return true;

}
bool ObservePlayerPage::PopulateMenuPage(player_t *player_ptr)
{
	this->SetEscLink("%s", Translate(player_ptr, 3110));
	this->SetTitle("%s", Translate(player_ptr, 3111));

	MenuItem *ptr = NULL;

	if (gpManiObserverTrack->observer_id[player_ptr->index - 1] != -1)
	{
		ptr = new ObservePlayerItem;
		ptr->SetDisplayText("%s", Translate(player_ptr, 3114));
		ptr->params.AddParamVar("user_id", "%i", -1);
		ptr->SetHiddenText(" ");
		this->AddItem(ptr);
	}

	for( int i = 1; i <= max_players; i++ )
	{
		player_t player;
		player.index = i;
		if (!FindPlayerByIndex(&player)) continue;
		if (player.player_info->IsFakeClient())
		{
			continue;
		}

		ptr = new ObservePlayerItem;

		if (gpManiObserverTrack->observer_id[player_ptr->index - 1] == player.index)
		{
			ptr->SetDisplayText("%s [%s] %i",
				Translate(player_ptr, 3112),
				player.name, 
				player.user_id);
		}
		else
		{
			ptr->SetDisplayText("[%s] %i",
				player.name, 
				player.user_id);
		}

		ptr->SetHiddenText("%s", player.name);
		ptr->params.AddParamVar("user_id", "%i", player.user_id);
		this->AddItem(ptr);
	}

	this->SortHidden();
	return true;
}
bool SetSkinPage::PopulateMenuPage(player_t *player_ptr)
{
	this->SetEscLink("%s", Translate(player_ptr, 780));
	this->SetTitle("%s", Translate(player_ptr, 781));

	for( int i = 1; i <= max_players; i++ )
	{
		player_t player;
		player.index = i;
		if (!FindPlayerByIndex(&player)) continue;
		if (player.is_dead)	continue;

		if (player_ptr->index != player.index &&
			gpManiClient->HasAccess(player.index, IMMUNITY, IMMUNITY_SETSKIN))
		{
			continue;
		}

		MenuItem *ptr = new SetSkinItem();
		ptr->SetDisplayText("[%s] %i", player.name, player.user_id);
		ptr->SetHiddenText("%s", player.name);
		ptr->params.AddParam("user_id", player.user_id);
		this->AddItem(ptr);
	}

	this->SortHidden();
	return true;
}
bool FavouritesPage::PopulateMenuPage(player_t *player_ptr)
{
	this->SetEscLink("%s", Translate(player_ptr, 770));
	this->SetTitle("%s", Translate(player_ptr, 771));
	
	for (int i = 0; i < web_shortcut_list_size; i++)
	{
		MenuItem *ptr = new FavouritesItem;
		ptr->params.AddParam("index", i);
		ptr->SetDisplayText("%s", web_shortcut_list[i].shortcut);
		this->AddItem(ptr);
	}

	return true;
}
bool PlaySoundPage::PopulateMenuPage(player_t *player_ptr)
{
	this->SetEscLink("%s", Translate(player_ptr, 540));
	this->SetTitle("%s", Translate(player_ptr, 541));

	// Setup sound list
	for( int i = 0; i < sound_list_size; i++ )
	{
		MenuItem *ptr = new PlaySoundItem();
		ptr->SetDisplayText("%s", sound_list[i].alias);
		ptr->params.AddParam("index", i);
		this->AddItem(ptr);
	}

	return true;
}
bool SkinOptionsPage::PopulateMenuPage(player_t *player_ptr)
{
	this->SetEscLink("%s", Translate(player_ptr, 782));
	this->SetTitle("%s", Translate(player_ptr, 783));

	for( int i = 0; i < skin_list_size; i++ )
	{
		if (mani_skins_setskin_misc_only.GetInt() == 1 &&
			skin_list[i].skin_type != MANI_MISC_SKIN)
		{
			continue;
		}

		MenuItem *ptr = new SkinOptionsItem();
		ptr->SetDisplayText("%s", skin_list[i].skin_name);
		ptr->params.AddParam("index", i);
		this->AddItem(ptr);
	}

	return true;
}
bool JoinSkinChoicePage::PopulateMenuPage(player_t *player_ptr)
{
	if (!gpManiGameType->IsValidActiveTeam(player_ptr->team)) return false;
	if (mani_skins_admin.GetInt() == 0 &&
		mani_skins_reserved.GetInt() == 0 &&
		mani_skins_public.GetInt() == 0)
	{
		// Skins not enabled
		return false;
	}

	int	skin_type;

	this->SetEscLink("Press Esc to choose skin");
	this->SetTitle("Choose your skin");

	if (current_skin_list[player_ptr->index - 1].team_id == player_ptr->team) return false;

	// Setup player list
	if (mani_skins_admin.GetInt() != 0)
	{
		if (gpManiClient->HasAccess(player_ptr->index, ADMIN, ADMIN_SKINS))
		{
			if (player_ptr->team == TEAM_A || !gpManiGameType->IsTeamPlayAllowed()) 
			{
				skin_type = MANI_ADMIN_T_SKIN;
			}
			else
			{
				skin_type = MANI_ADMIN_CT_SKIN;
			}

			for (int i = 0; i < skin_list_size; i ++)
			{
				if (skin_list[i].skin_type == skin_type)
				{
					MenuItem *ptr = new JoinSkinChoiceItem();
					ptr->SetDisplayText("Admin : %s", skin_list[i].skin_name);
					ptr->params.AddParam("index", i);
					this->AddItem(ptr);
				}
			}
		}
	}

	if (mani_skins_reserved.GetInt() != 0)
	{
		if (gpManiClient->HasAccess(player_ptr->index, IMMUNITY, IMMUNITY_RESERVE_SKIN))
		{
			if (player_ptr->team == TEAM_A || !gpManiGameType->IsTeamPlayAllowed()) 
			{
				skin_type = MANI_RESERVE_T_SKIN;
			}
			else
			{
				skin_type = MANI_RESERVE_CT_SKIN;
			}

			for (int i = 0; i < skin_list_size; i ++)
			{
				if (skin_list[i].skin_type == skin_type)
				{
					MenuItem *ptr = new JoinSkinChoiceItem();
					ptr->SetDisplayText("Reserved : %s", skin_list[i].skin_name);	
					ptr->params.AddParam("index", i);
					this->AddItem(ptr);
				}
			}
		}
	}

	if (mani_skins_public.GetInt() != 0)
	{
		if (player_ptr->team == TEAM_A || !gpManiGameType->IsTeamPlayAllowed()) 
		{
			skin_type = MANI_T_SKIN;
		}
		else
		{
			skin_type = MANI_CT_SKIN;
		}

		for (int i = 0; i < skin_list_size; i ++)
		{
			if (skin_list[i].skin_type == skin_type)
			{
				MenuItem *ptr = new JoinSkinChoiceItem();
				ptr->SetDisplayText("%s", skin_list[i].skin_name);
				ptr->params.AddParam("index", i);
				this->AddItem(ptr);
			}
		}
	}

	if (mani_skins_force_public.GetInt() == 0)
	{
		MenuItem *ptr = new JoinSkinChoiceItem();
		ptr->SetDisplayText("Standard");
		ptr->params.AddParam("index", 999);
		this->AddItem(ptr);
	}

	return true;
}
bool TKPlayerPage::PopulateMenuPage(player_t *player_ptr)
{

	bool	is_bot;
	char	*name;

	this->params.GetParam("is_bot", &is_bot);
	this->params.GetParam("name", &name);

	this->SetEscLink("%s", Translate(player_ptr, 620));
	this->SetTitle("%s", Translate(player_ptr, 631,"%s", name));

	// Some people don't want the forgive option
	if (IsMenuOptionAllowed(MANI_TK_FORGIVE, is_bot))
	{
		MENUOPTION_CREATE_PARAM(TKPlayerItem, 632, AddParam("punish", MANI_TK_FORGIVE));
	}

	// Some people don't want the slay option
	if (IsMenuOptionAllowed(MANI_TK_SLAY, is_bot))
	{
		MENUOPTION_CREATE_PARAM(TKPlayerItem, 633, AddParam("punish", MANI_TK_SLAY));
	}

	// Some people don't want the slap option
	if (IsMenuOptionAllowed(MANI_TK_SLAP, is_bot) && gpManiGameType->IsSlapAllowed())
	{
		MenuItem *ptr = new TKPlayerItem;
		ptr->SetDisplayText("%s", Translate(player_ptr, 634, "%i", mani_tk_slap_to_damage.GetInt()));
		ptr->params.AddParam("punish", MANI_TK_SLAP);
		this->AddItem(ptr);
	}

	// Some people don't want the beacon option
	if (IsMenuOptionAllowed(MANI_TK_BEACON, is_bot) && gpManiGameType->GetAdvancedEffectsAllowed())
	{
		MENUOPTION_CREATE_PARAM(TKPlayerItem, 643, AddParam("punish", MANI_TK_BEACON));
	}

	// Some people don't want the time bomb option
	if (IsMenuOptionAllowed(MANI_TK_TIME_BOMB, is_bot))
	{
		MENUOPTION_CREATE_PARAM(TKPlayerItem, 640, AddParam("punish", MANI_TK_TIME_BOMB));
	}

	// Some people don't want the fire bomb option
	if (IsMenuOptionAllowed(MANI_TK_FIRE_BOMB, is_bot) && gpManiGameType->IsFireAllowed())
	{
		MENUOPTION_CREATE_PARAM(TKPlayerItem, 641, AddParam("punish", MANI_TK_FIRE_BOMB));
	}

	// Some people don't want the freeze bomb option
	if (IsMenuOptionAllowed(MANI_TK_FREEZE_BOMB, is_bot))
	{
		MENUOPTION_CREATE_PARAM(TKPlayerItem, 642, AddParam("punish", MANI_TK_FREEZE_BOMB));
	}

	// Some people don't want the freeze option
	if (IsMenuOptionAllowed(MANI_TK_FREEZE, is_bot))
	{
		MENUOPTION_CREATE_PARAM(TKPlayerItem, 636, AddParam("punish", MANI_TK_FREEZE));
	}

	// Some people don't want the burn option
	if (IsMenuOptionAllowed(MANI_TK_BURN, is_bot)  && gpManiGameType->IsFireAllowed())
	{
		MENUOPTION_CREATE_PARAM(TKPlayerItem, 639, AddParam("punish", MANI_TK_BURN));
	}

	// Some people don't want the cash option
	if (IsMenuOptionAllowed(MANI_TK_CASH, is_bot) && gpManiGameType->CanUseProp(MANI_PROP_ACCOUNT))
	{
		MenuItem *ptr = new TKPlayerItem;
		ptr->SetDisplayText("%s", Translate(player_ptr, 637, "%i", mani_tk_cash_percent.GetInt()));
		ptr->params.AddParam("punish", MANI_TK_CASH);
		this->AddItem(ptr);
	}

	// Some people don't want the drug option
	if (IsMenuOptionAllowed(MANI_TK_DRUG, is_bot) && gpManiGameType->IsDrugAllowed())
	{
		MENUOPTION_CREATE_PARAM(TKPlayerItem, 638, AddParam("punish", MANI_TK_DRUG));
	}

	// Some people don't want the blind option
	if (IsMenuOptionAllowed(MANI_TK_BLIND, is_bot))
	{
		MENUOPTION_CREATE_PARAM(TKPlayerItem, 635, AddParam("punish", MANI_TK_BLIND));
	}

	return true;
}