Exemplo n.º 1
0
void CRPGPlayer::ShowClassMenu( int team )
{
	IMenuStyle *style = menus->GetDefaultStyle();
	IBaseMenu *menu = style->CreateMenu(&g_RPGPlugin, myself->GetIdentity());
	menu->SetDefaultTitle(MENU_CLASS_TITLE);

	switch (team)
	{
	case TEAM_SURVIVORS:
		for (int i = 0; i < NUM_HUMAN_CLASSES; i++)
		{
			menu->AppendItem(HumanClasses[i], ItemDrawInfo(HumanClasses[i]));
		}
		break;
	case TEAM_UNDEAD:
		for (int i = 0; i < NUM_ZOMBIE_CLASSES; i++)
		{
			menu->AppendItem(ZombieClasses[i], ItemDrawInfo(ZombieClasses[i]));
		}
		break;
	}

	menu->InsertItem(MENU_CHOICE_RETURN, MENU_ITEM_RETURN, ItemDrawInfo(MENU_ITEM_RETURN));
	menu->Display(this->GetIndex(), MENU_TIME_FOREVER );
}
Exemplo n.º 2
0
void CRPGPlayer::ShowChar()
{
	IMenuStyle *style = menus->GetDefaultStyle();
	IBaseMenu *menu = style->CreateMenu(&g_RPGPlugin, myself->GetIdentity());

	IMenuPanel *panel = menu->CreatePanel();

	menu->SetDefaultTitle(MENU_CHAR_TITLE);
	panel->DrawTitle(MENU_CHAR_TITLE);

	char text[255];
	sprintf(text, "Player ID: %d", GetSQLIndex());
	panel->DrawItem(ItemDrawInfo(text));

	int classnum = GetCurrentClass();

	if (classnum > RPG_CLASS_NONE)
	{
		int team = GetCachedTeam();
		if ( team == TEAM_SURVIVORS)
		{
			sprintf(text, "Class: %s", HumanClasses[classnum]);
		}
		else if (team == TEAM_UNDEAD)
		{
			sprintf(text, "Class: %s", ZombieClasses[classnum]);
		}
		else
		{
			sprintf(text, "Class: None");
		}

		panel->DrawItem(ItemDrawInfo(text));	// item 1

		sprintf(text, "Level: %d", GetLevel());
		panel->DrawItem(ItemDrawInfo(text)); // item 2

		sprintf(text, "Experience: %d", GetExperience());
		panel->DrawItem(ItemDrawInfo(text)); // item 3

		for (int i = 0; i < MAX_SKILLS; i++)		// item 4-7
		{
			sprintf(text, "%s - (Level %d)", SkillNames[skills[i].iIndex], skills[i].iLevel);
			panel->DrawItem(ItemDrawInfo(text));
		}

	}

	panel->SendDisplay(GetIndex(), &g_RPGPlugin, MENU_TIME_FOREVER );
}
Exemplo n.º 3
0
void CRPGPlayer::ShowBaseMenu()
{
	IMenuStyle *style = menus->GetDefaultStyle();
	IBaseMenu *menu = style->CreateMenu(&g_RPGPlugin, myself->GetIdentity());
	menu->SetDefaultTitle(MENU_BASE_TITLE);

	for (int i = 0; i < BASEMENUCHOICES; i++)
	{
		menu->AppendItem(BaseMenuChoices[i], ItemDrawInfo(BaseMenuChoices[i]));
	}
	//menu->SetMenuOptionFlags( menu->GetMenuOptionFlags() | MENUFLAG_BUTTON_EXIT );
	menu->Display(this->GetIndex(), MENU_TIME_FOREVER);

}
Exemplo n.º 4
0
void CRPGPlayer::ShowSkillMenu()
{
	if (GetCurrentClass() == RPG_CLASS_NONE )
	{
		ShowClassMenu( GetPlayerInfo()->GetTeamIndex());
		return;
	}

	if (GetFreeSkills() < 0)
	{
		ResetAccount();
		gamehelpers->TextMsg(GetIndex(), HUD_PRINTTALK, "[ZPS-RPG] Your skills have been reset because of an error.\n");
	}

	IMenuStyle *style = menus->GetDefaultStyle();
	IBaseMenu *menu = style->CreateMenu(&g_RPGPlugin, myself->GetIdentity());

	menu->SetDefaultTitle(MENU_SKILL_TITLE);

	char skillname[64];
	unsigned int menustyle = ITEMDRAW_DEFAULT;

	for (int i = 0; i < MAX_SKILLS; i++)
	{
		sprintf(skillname, "%s (Level %d)", SkillNames[skills[i].iIndex], skills[i].iLevel);
		menustyle = ITEMDRAW_DEFAULT;

		if ((skills[i].iLevel >= 3) || (GetFreeSkills() == 0))
			menustyle = ITEMDRAW_DISABLED;

		if( i == 3 ) // ULTIMATE
		{
			if ((skills[i].iLevel >= 1) || (GetLevel() < 6) || (GetFreeSkills() == 0))
			{
				menustyle = ITEMDRAW_DISABLED;
			}
		}

		menu->AppendItem(SkillNames[skills[i].iIndex], ItemDrawInfo(skillname, menustyle));
	}
	menu->AppendItem(MENU_ITEM_RESET, ItemDrawInfo("Reset Skills"));
	menu->InsertItem(6, MENU_ITEM_RETURN, ItemDrawInfo(MENU_ITEM_RETURN));
	menu->SetMenuOptionFlags( menu->GetMenuOptionFlags() | MENUFLAG_BUTTON_EXIT );
	menu->Display(this->GetIndex(), MENU_TIME_FOREVER);
}
Exemplo n.º 5
0
static cell_t SetMenuTitle(IPluginContext *pContext, const cell_t *params)
{
    Handle_t hndl = (Handle_t)params[1];
    HandleError err;
    IBaseMenu *menu;

    if ((err=g_Menus.ReadMenuHandle(params[1], &menu)) != HandleError_None)
    {
        return pContext->ThrowNativeError("Menu handle %x is invalid (error %d)", hndl, err);
    }

    char buffer[1024];
    g_SourceMod.FormatString(buffer, sizeof(buffer), pContext, params, 2);

    menu->SetDefaultTitle(buffer);

    return 1;
}