// ****************************************************************************
int CSessionBrowserImpl::luaJoinRingSession(CLuaState &ls)
{
    nldebug("SB: luaJoinRingSession");
    const char *funcName = "joinRingSession";
    CLuaIHM::checkArgCount(ls, funcName, 1);
    CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);

    CInterfaceManager *pIM = CInterfaceManager::getInstance();
    CSessionBrowserImpl & sessionBrowser = CSessionBrowserImpl::getInstance();
    sessionBrowser.joinSession(getCharId(), (TSessionId)(uint32) ls.toNumber(1), ClientCfg.ConfigFile.getVar("Application").asString(0));

    if(!sessionBrowser.waitOneMessage(sessionBrowser.getMessageName("on_joinSessionResult")))
    {
        nlwarning("joinSession callback return false");
    }

    if(sessionBrowser._LastJoinSessionResult == 20)
    {
        CViewText* pVT = dynamic_cast<CViewText*>(pIM->getElementFromId("ui:interface:warning_free_trial:text"));
        if (pVT != NULL)
            pVT->setText(CI18N::get("uiRingWarningFreeTrial"));
        pIM->runActionHandler("enter_modal", NULL, "group=ui:interface:warning_free_trial");
    }

    return 0;
}
Example #2
0
//*****************************************************************************************************************
int CGroupHeader::luaEnlargeColumns(CLuaState &ls)
{
	const char *funcName = "enlargeColumns";
	CLuaIHM::checkArgCount(ls, funcName, 1);
	CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
	enlargeColumns((sint32) ls.toNumber(1));
	return 0;
}
Example #3
0
//*****************************************************************************************************************
int CGroupHeader::luaResizeColumnsAndContainer(CLuaState &ls)
{
	const char *funcName = "resizeColumnsAndContainer";
	CLuaIHM::checkArgCount(ls, funcName, 1);
	CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
	resizeColumnsAndContainer((sint32) ls.toNumber(1));
	return 0;
}
Example #4
0
int CGroupTab::luaRemoveTab(CLuaState &ls)
{
	const char *funcName = "removeTab";
	CLuaIHM::checkArgCount(ls, funcName, 1);
	CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
	removeTab((uint) ls.toNumber(1));
	return 0;
}
Example #5
0
// ***************************************************************************
int	CGroupTab::luaShowTabButton(CLuaState &ls)
{
	const char *funcName = "showTabButton";
	CLuaIHM::checkArgCount(ls, funcName, 1);
	CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
	sint showTab = (sint)ls.toNumber(1);

	if(showTab>=0 && showTab<(sint)_Buttons.size())
	{
		sint32 maxWidth = _Parent->getWReal();
		sint32 buttonsWidth = 0;

		if(showTab<_FirstTabIndex)
		{
			_FirstTabIndex = showTab;
			sint lastTabIndex = _FirstTabIndex;
			for(uint i=_FirstTabIndex; i<_Buttons.size(); i++)
			{
				CCtrlTabButton * tab = _Buttons[i];
				sint32 tabWidth = tab->getWMax();
				if(buttonsWidth+tabWidth <= maxWidth)
				{
					buttonsWidth += tabWidth;
					if(!tab->getActive())
						tab->setActive(true);
					lastTabIndex = i;
				}
				else
					break;
			}

			if(lastTabIndex <_Selection)
				select(lastTabIndex);
			else
				updateFirstTabButton();
		}
		else if(showTab>_LastTabIndex)
		{
			for(uint i=_FirstTabIndex; i<=(uint)showTab; i++)
				buttonsWidth += _Buttons[i]->getWMax();

			while(buttonsWidth>maxWidth)
			{
				buttonsWidth -= _Buttons[_FirstTabIndex]->getWMax();
				_FirstTabIndex++;
			}

			if(_Selection<_FirstTabIndex)
				select(_FirstTabIndex);
			else
				updateFirstTabButton();
		}
	}

	return 0;
}
// ****************************************************************************
int CSessionBrowserImpl::luaUpdateScenarioScores(CLuaState &ls)
{
    nldebug("SB: luaUpdateScenarioScores");
    const char *funcName = "updateScenarioScores";
    CLuaIHM::checkArgCount(ls, funcName, 5);
    CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
    CLuaIHM::checkArgType(ls, funcName, 2, LUA_TNUMBER);
    CLuaIHM::checkArgType(ls, funcName, 3, LUA_TNUMBER);
    CLuaIHM::checkArgType(ls, funcName, 4, LUA_TNUMBER);
    CLuaIHM::checkArgType(ls, funcName, 5, LUA_TNUMBER);

    if (R2::getEditor().getMode() != R2::CEditor::NotInitialized)
    {
        CSessionBrowserImpl::getInstance().setPlayerRating(getCharId(), R2::getEditor().getDMC().getEditionModule().getCurrentAdventureId(),
                (uint32) ls.toNumber(1), (uint32) ls.toNumber(2), (uint32) ls.toNumber(3), (uint32) ls.toNumber(4), (uint32) ls.toNumber(5));
    }

    return 0;
}
Example #7
0
// ***************************************************************************
int	CGroupTab::luaGetGroup(CLuaState &ls)
{
	const char *funcName = "getGroup";
	CLuaIHM::checkArgCount(ls, funcName, 1);
	CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
	CInterfaceGroup* group = getGroup((uint) ls.toNumber(1));
	if(group != NULL){
		CLuaIHM::pushUIOnStack(ls, group);
		return 1;
	}
	return 0;
}
Example #8
0
// ***************************************************************************
int	CGroupTab::luaGetTabButton(CLuaState &ls)
{
	const char *funcName = "getTabButton";
	CLuaIHM::checkArgCount(ls, funcName, 1);
	CLuaIHM::checkArgType(ls, funcName, 1, LUA_TNUMBER);
	CCtrlTabButton* tab = getTabButton((uint) ls.toNumber(1));
	if(tab != NULL){
		CLuaIHM::pushUIOnStack(ls, tab);
		return 1;
	}
	return 0;
}
Example #9
0
// ***************************************************************************
int CGroupTab::luaAddTabWithOrder(CLuaState &ls)
{
	const char *funcName = "addTabWithOrder";
	CLuaIHM::checkArgCount(ls, funcName, 2);
	CLuaIHM::checkArgType(ls, funcName, 2, LUA_TNUMBER);

	CCtrlTabButton *tabB = dynamic_cast<CCtrlTabButton *>(CLuaIHM::getUIOnStack(ls, 1));
	if (tabB)
	{
		// don't use addTab to avoid selection of new tab
		addTab(tabB, (sint) ls.toNumber(2));
	}
	return 0;
}