virtual void execute (CCtrlBase * /* pCaller */, const string &Params)
	{
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(pIM->getElementFromId("ui:interface", Params));
		if (pGC == NULL)
		{
			nlwarning("%s is not a container", Params.c_str());
			return;
		}
		if (!isContainerAuthorized(pGC)) return;

		CActionsManager *pAM = &Actions;

		// If key is up
		if (!pAM->valide(CAction::CName("show_on_press",Params.c_str())))
		{
			pGC->setActive(false);
			_FirstTime = true;
		}
		else // Key is down
		{
			// For the first time ?
			/*if (_FirstTime)
			{
				_FirstTime = false;
			}
			else // Not the first time*/
			{
				// Show the container
				pGC->setActive(true);
			}
		}
	}
	virtual void execute (CCtrlBase * /* pCaller */, const string &Params)
	{
		string webapp, window = Params;
		vector<string> res;
		explode(Params, string("|"), res);
		if(res[0]=="webig" || res[0]=="mailbox" || res[0]=="guild_forum" || res[0]=="profile")
		{
			window = "webig";
			if(res[0]=="mailbox")
				webapp = "mail";
			else if(res[0]=="guild_forum")
				webapp = "forum";
			else if(res[0]=="profile")
				webapp = "profile&pname="+urlencode(getParam(Params,"pname"))+"&ptype="+getParam(Params,"ptype");
			else
				webapp = "web";
		}

		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(pIM->getElementFromId("ui:interface", window));
		if (pGC == NULL)
		{
			nlwarning("%s is not a container", window.c_str());
			return;
		}
		if (!isContainerAuthorized(pGC)) return;

		if(window == "webig")
		{
			if(pGC->getActive() && currentWebApp == webapp)
			{
				pGC->setActive(false);
				currentWebApp.clear();
			}
			else
			{
				pGC->setActive(true);
				currentWebApp = webapp;
			}
			if(!webapp.empty() && pGC->getActive())
			{
				CGroupHTML *pGH = dynamic_cast<CGroupHTML*>(pIM->getElementFromId("ui:interface:webig:content:html"));
				if (pGH == NULL)
				{
					nlwarning("%s is not a group html", window.c_str());
					return;
				}
				pGH->setURL("http://atys.ryzom.com/start/index.php?app="+webapp);
			}
		}
		else
		{
			// normal open/close swap
			pGC->setActive(!pGC->getActive());
		}
	}
Exemplo n.º 3
0
	virtual void execute(CCtrlBase *pCaller, const string &/* Params */)
	{
		sint nMacNb = getMacroFromId(pCaller->getId());
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		CMacroCmdManager *pMCM = CMacroCmdManager::getInstance();
		pMCM->CurrentEditMacro = pMCM->getMacros()[nMacNb];
		pMCM->CurrentEditMacroNb = nMacNb;
		CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(CWidgetManager::getInstance()->getElementFromId(WIN_NEWMACRO));
		if (pGC != NULL)
		{
			pGC->setTitle(NEWMACRO_TITLE_EDIT);
			pGC->setActive (false);
			pGC->setActive (true);
		}
	}
Exemplo n.º 4
0
// ***************************************************************************
void	COutpostManager::startPvpJoinProposal(bool playerGuildInConflict, bool playerGuildIsAttacker,
							 uint32 ownerGuildNameId, uint32 attackerGuildNameId, uint32 declTimer)
{
	// reset counter that force player to be neutral (eg: 10 seconds)
	_EndTickForPvpJoinProposal= NetMngr.getCurrentServerTick() + declTimer;

	// setup TEMP DB
	CInterfaceManager	*pIM= CInterfaceManager::getInstance();

	CCDBNodeLeaf	*node= pIM->getDbProp("UI:TEMP:OUTPOST:PVP_PROPOSAL_PLAYER_GUILD_IN_CONFLICT");
	if(node)	node->setValueBool(playerGuildInConflict);
	node= pIM->getDbProp("UI:TEMP:OUTPOST:PVP_PROPOSAL_PLAYER_GUILD_IS_ATTACKER");
	if(node)	node->setValueBool(playerGuildIsAttacker);
	node= pIM->getDbProp("UI:TEMP:OUTPOST:PVP_PROPOSAL_ATTACKER");
	if(node)	node->setValue32(attackerGuildNameId);
	node= pIM->getDbProp("UI:TEMP:OUTPOST:PVP_PROPOSAL_DEFENDER");
	if(node)	node->setValue32(ownerGuildNameId);
	node= pIM->getDbProp("UI:TEMP:OUTPOST:PVP_PROPOSAL_TICK_END");
	if(node)	node->setValue32(_EndTickForPvpJoinProposal);

	// open Popup
	CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(pIM->getElementFromId("ui:interface:join_pvp_outpost_proposal"));
	if (pGC)
	{
		pGC->setActive(true);
		pIM->setTopWindow(pGC);
		pGC->updateCoords();
		pGC->updateCoords();
		pGC->center();
		pGC->enableBlink(2);
	}

}
// ***************************************************************************************
void CBotChatPageMission::begin()
{
	CBotChatPage::begin();
	CInterfaceManager *im = CInterfaceManager::getInstance();
	// clear intro text
	im->getDbProp(BOT_CHAT_BASE_DB_PATH ":CHOOSE_MISSION")->setValue32(0);
	_MissionPagesObs.setMissionClientType(_MType);
	_MissionPagesObs.start();

	// Select the Mission Aspect according to mission type
	im->getDbProp("UI:TEMP:MISSION:MISSION_TYPE")->setValue32(_MType);

	CGroupContainer *gc = dynamic_cast<CGroupContainer *>(im->getElementFromId(WIN_BOT_CHAT_PAGE_MISSION));
	if (gc)
	{
		// show the ui
		gc->setActive(true);
		// unselect any list
		CDBGroupListSheetText *buyListSheet = dynamic_cast<CDBGroupListSheetText *>(gc->getGroup("missions"));
		if (buyListSheet)
		{
			buyListSheet->unselect();
		}
	}

}
Exemplo n.º 6
0
// ***************************************************************************
void CGuildManager::launchAscensor()
{
	// Start the huge list exchange
	Ascensors.start();

	// Increment session id
	Ascensors.incrementSessionID();

	// Send request of the first page to the server specifying the session id
	CBitMemStream out;
	if(GenericMsgHeaderMngr.pushNameToStream("GUILD:FIRST_ASCENSOR_PAGE", out))
	{
		uint16 session = Ascensors.getSessionID();
		out.serial(session);
		NetMngr.push(out);
		//nlinfo("impulseCallBack : GUILD:FIRST_ASCENSOR_PAGE %d sent",session);
	}
	else
	{
		nlwarning("impulseCallBack : unknown message name : 'GUILD:FIRST_ASCENSOR_PAGE'.");
	}

	// Start Ascensor Interface
	CInterfaceManager *pIM = CInterfaceManager::getInstance();
	CGroupContainer *pAC = dynamic_cast<CGroupContainer*>(pIM->getElementFromId(WIN_ASCENSOR));
	if (pAC == NULL) return;
	pAC->setActive(true);
	pIM->setTopWindow(pAC);
}
	virtual void execute (CCtrlBase * /* pCaller */, const string &Params)
	{
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(pIM->getElementFromId("ui:interface", Params));
		if (pGC == NULL)
		{
			nlwarning("%s is not a container", Params.c_str());
			return;
		}
		if (!isContainerAuthorized(pGC)) return;

		pGC->setActive(false);
	}
Exemplo n.º 8
0
	virtual void execute(CCtrlBase * /* pCaller */, const string &/* Params */)
	{
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		CMacroCmdManager *pMCM = CMacroCmdManager::getInstance();
		// Reinit the new_macro container and variables
		CMacroCmd mc;
		mc.Name = "NewMacro";
		mc.BitmapBack = 0;
		mc.BitmapIcon = 0;
		mc.BitmapOver = 0;
		pMCM->CurrentEditMacro = mc;

		CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(CWidgetManager::getInstance()->getElementFromId(WIN_NEWMACRO));
		if (pGC != NULL)
		{
			pGC->setTitle(NEWMACRO_TITLE_NEW);
			pGC->setActive (false);
			pGC->setActive (true);
		}

		pMCM->CurrentEditMacroNb = -1;
		pMCM->EditCmd->deactivate();
	}
Exemplo n.º 9
0
	virtual void execute (CCtrlBase * /* pCaller */, const string &/* Params */)
	{
		uint32 i;
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		const vector<CInterfaceManager::SMasterGroup> &rVMG = pIM->getAllMasterGroup();
		for (uint32 nMasterGroup = 0; nMasterGroup < rVMG.size(); nMasterGroup++)
		{
			const CInterfaceManager::SMasterGroup &rMG = rVMG[nMasterGroup];
			const vector<CInterfaceGroup*> &rV = rMG.Group->getGroups();
			// Active all containers (that can be activated)
			for (i = 0; i < rV.size(); ++i)
			{
				CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(rV[i]);
				if (pGC == NULL) continue;
				if (pGC->isSavable())
				{
					// Yoyo: DO NOT force activation of containers who don't want to save their Active state.
					// Usually driven by server.
					if(pGC->isActiveSavable())
						pGC->setActive(true);
				}
			}

			pIM->checkCoords();
			pIM->getMasterGroup((uint8)nMasterGroup).centerAllContainers();

			// Pop in and close all containers
			for (i = 0; i < rV.size(); ++i)
			{
				CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(rV[i]);
				if (pGC == NULL) continue;
				if (pGC->isSavable())
				{
					if (pGC->isPopable()&&pGC->isPopuped())
						pGC->popin();

					// Can close ?
					if (pGC->isOpenable()&&pGC->isOpen())
						pGC->close();
				}
			}

			pIM->getMasterGroup((uint8)nMasterGroup).deactiveAllContainers();
		}
	}
Exemplo n.º 10
0
	void execute (CCtrlBase * /* pCaller */, const std::string &sParams)
	{
		CInterfaceManager *im = CInterfaceManager::getInstance();
		string receiver = getParam (sParams, "player");
		if (receiver.empty())
			return;

		CChatGroupWindow *pCGW = PeopleInterraction.getChatGroupWindow();
		if (pCGW != NULL)
		{
			CGroupContainer *pGC = pCGW->createFreeTeller(receiver);
			if (pGC != NULL)
				pGC->setActive(true);
			CGroupEditBox *eb = dynamic_cast<CGroupEditBox *>(pGC->getGroup("eb"));
			if (eb)
			{
				CWidgetManager::getInstance()->setCaptureKeyboard(eb);
			}
		}
	}
// ***************************************************************************************
void CBotChatPageMission::selectMission(CDBCtrlSheet *missionSheet)
{
	if (!missionSheet) return;
	if (missionSheet->getGrayed()) return;
	// show the dialog with good infos
	CInterfaceManager *im = CInterfaceManager::getInstance();
	CGroupContainer *gc = dynamic_cast<CGroupContainer *>(im->getElementFromId(WIN_BOT_CHAT_ACCEPT_MISSION));

	// copy text id for title
	{
		CCDBNodeLeaf *titleTextLeaf = dynamic_cast<CCDBNodeLeaf *>(missionSheet->getRootBranch()->getNode(ICDBNode::CTextId("TEXT")));
		//
		CViewTextID	*viewTitleTextID = dynamic_cast<CViewTextID *>(gc->getView("text_title_id"));
		if (viewTitleTextID && titleTextLeaf)
			viewTitleTextID->setTextId(titleTextLeaf->getValue32());
	}

	// copy text id for details
	CCDBNodeLeaf *detailTextLeaf = dynamic_cast<CCDBNodeLeaf *>(missionSheet->getRootBranch()->getNode(ICDBNode::CTextId("DETAIL_TEXT")));
	//
	CViewTextID	*viewTextID = dynamic_cast<CViewTextID *>(gc->getView("text_id"));
	if(viewTextID && detailTextLeaf)
	{
		viewTextID->setTextId(detailTextLeaf->getValue32());
	}
	// copy icon
	CCDBNodeLeaf *iconLeaf = im->getDbProp("UI:TEMP:MISSION:ICON");
	if (iconLeaf)
	{
		iconLeaf->setValue32(missionSheet->getSheetId());
	}
	//
	if (!gc) return;
	im->setTopWindow(gc);
	gc->setActive(true);
	gc->updateCoords();
	gc->center();
	gc->setModalParentList(WIN_BOT_CHAT_PAGE_MISSION);
	_CurrSel = missionSheet;
}
Exemplo n.º 12
0
// ***************************************************************************
void	COutpostManager::update()
{
	// *** If there is a join proposal running
	if(_EndTickForPvpJoinProposal!=0)
	{
		if(_EndTickForPvpJoinProposal<NetMngr.getCurrentServerTick())
		{
			CInterfaceManager	*pIM= CInterfaceManager::getInstance();

			// Force the neutral choose
			pIM->runActionHandler("outpost_pvp_join", NULL, "neutral");

			// close the window
			CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(pIM->getElementFromId("ui:interface:join_pvp_outpost_proposal"));
			if (pGC)
				pGC->setActive(false);

			// stop timer
			_EndTickForPvpJoinProposal= 0;
		}
	}
}
Exemplo n.º 13
0
	virtual void execute(CCtrlBase * /* pCaller */, const string &/* Params */)
	{
		CInterfaceManager *pIM = CInterfaceManager::getInstance();
		CMacroCmdManager *pMCM = CMacroCmdManager::getInstance();
		CSPhraseManager	*pPM = CSPhraseManager::getInstance();

		// Validate name
		CAHManager::getInstance()->runActionHandler("new_macro_enter_name",NULL);

		// Check if macro has more than one command
		if (pMCM->CurrentEditMacro.Commands.size() == 0) return;

		// Add a macro
		if (pMCM->CurrentEditMacroNb != -1)
		{
			// retrieve the Id of the edited macro, to keep the same id in addMacro()
			pMCM->CurrentEditMacro.ID= pMCM->getMacros()[pMCM->CurrentEditMacroNb].ID;
			pMCM->delMacro(pMCM->CurrentEditMacroNb);
			pMCM->addMacro(pMCM->CurrentEditMacro,pMCM->CurrentEditMacroNb);
			// update the Memory Manager
			pPM->updateMacroShortcuts(pMCM->CurrentEditMacro.ID);
			// reset id of EditMacro
			pMCM->CurrentEditMacro.ID= -1;
		}
		else
		{
			pMCM->addMacro(pMCM->CurrentEditMacro);
		}

		CGroupContainer *pGC = dynamic_cast<CGroupContainer*>(CWidgetManager::getInstance()->getElementFromId(WIN_NEWMACRO));
		if (pGC != NULL) pGC->setActive (false);

		CAHManager::getInstance()->runActionHandler("macros_open",NULL);

		// Refresh key containers
		pMCM->refreshAllKeyDisplays();
	}
Exemplo n.º 14
0
// ***************************************************************************
void CGuildManager::update()
{
	CInterfaceManager *pIM = CInterfaceManager::getInstance();
	STRING_MANAGER::CStringManagerClient *pSMC = STRING_MANAGER::CStringManagerClient::instance();

	// *** Need to rebuild the guild data?
	if (_NeedRebuild)
	{
		_NeedUpdate = true;
		_NeedRebuild = false;

		// Rebuild transfert the database to the local structure

		// Guild stuff
		uint32 oldName = _Guild.NameID;
		_Guild.NameID = pIM->getDbProp("SERVER:GUILD:NAME")->getValue32();
		_Guild.Name = "";
		_InGuild = (_Guild.NameID != 0);
		if (!_InGuild)
			closeAllInterfaces();
		_Guild.Icon = pIM->getDbProp("SERVER:GUILD:ICON")->getValue64();
		_Guild.QuitGuildAvailable = true;

		// Guild Members
		if(_NeedRebuildMembers)
		{
			_NeedUpdateMembers = true;
			_NeedRebuildMembers = false;

			_GuildMembers.clear();
			for (uint32 i = 0; i < MAX_GUILD_MEMBER; ++i)
			{
				sint32 name = pIM->getDbProp("SERVER:GUILD:MEMBERS:"+toString(i)+":NAME")->getValue32();
				if (name != 0)
				{
					SGuildMember gm;
					gm.NameID = name;
					gm.Index = i;
					gm.Grade = (EGSPD::CGuildGrade::TGuildGrade)(pIM->getDbProp("SERVER:GUILD:MEMBERS:"+toString(i)+":GRADE")->getValue32());
					gm.Online = (TCharConnectionState)(pIM->getDbProp("SERVER:GUILD:MEMBERS:"+toString(i)+":ONLINE")->getValue32());
					gm.EnterDate = pIM->getDbProp("SERVER:GUILD:MEMBERS:"+toString(i)+":ENTER_DATE")->getValue32();
					_GuildMembers.push_back(gm);
				}
			}
		}

		// Does the player are newcomer ?
		// Boris 01/09/2006 : removed : now the guild interface is open if
		// is was active before OR if the EGS ask it to the client

		bool playerNewToTheGuild = _NewToTheGuild &&(oldName != _Guild.NameID) && _InGuild;
		if (playerNewToTheGuild)
		{
			// reset the flag
			_NewToTheGuild = false;
			// Don't pop the guild window in ring mode.
			// NB nico : this test should not be necessary, as the guild infos should be filled during the init of the db
			// However, there are situation where this db info is filled after init (should only happen at guild creation time ...)
			// Maybe an EGS  bug ?
			if (R2::getEditor().getMode() == R2::CEditor::NotInitialized)
			{
				CInterfaceElement *pElt;
				// Open the guild info if we are not in the init phase
				if (!IngameDbMngr.initInProgress())
				{
					pElt = pIM->getElementFromId(WIN_GUILD);
					if (pElt != NULL)
						pElt->setActive(true);
				}
				// Browse the forum
				pElt = pIM->getElementFromId(WIN_GUILD_FORUM":content:html");
				if (pElt != NULL)
				{
					CGroupHTML *html = dynamic_cast<CGroupHTML*>(pElt);
					if (html)
						html->browse("home");
				}
			}
		}
	}

	// *** Need to update Names?
	if (_NeedUpdate)
	{
		bool bAllValid = true;
		// Update wait until all the name of members, name of the guild and description are valid

		if (!pSMC->getString (_Guild.NameID, _Guild.Name)) bAllValid = false;

		for (uint i = 0; i < _GuildMembers.size(); ++i)
		{
			if (!pSMC->getString (_GuildMembers[i].NameID, _GuildMembers[i].Name)) bAllValid = false;
			else _GuildMembers[i].Name = CEntityCL::removeTitleAndShardFromName(_GuildMembers[i].Name);
		}

		// If all is valid no more need update and if guild is opened update the interface
		if (bAllValid)
		{
			// Search for UserEntity to find our own grade
			if ((UserEntity != NULL) && (_GuildMembers.size() > 0))
			{
				uint i;
				_Grade = EGSPD::CGuildGrade::Member;
				string sUserName = strlwr(UserEntity->getEntityName().toString());
				for (i = 0; i < _GuildMembers.size(); ++i)
				{
					if (strlwr(_GuildMembers[i].Name.toString()) == sUserName)
					{
						_Grade = _GuildMembers[i].Grade;
						break;
					}
				}
			}

			// set this value in the database
			pIM->getDbProp("UI:VARIABLES:USER:GUILD_GRADE")->setValue32(_Grade);

			// update the guild display
			CGroupContainer *pGuild = dynamic_cast<CGroupContainer*>(pIM->getElementFromId(WIN_GUILD));
			if (pGuild != NULL)
			{
				// if the guild window is visible
				if (pGuild->isOpen() && pGuild->getActive())
				{
					// Close the modal window if the member list will change
					if(pIM->getModalWindow()!=NULL && _NeedUpdateMembers)
					{
						if (pIM->getModalWindow()->getId() == MENU_GUILD_MEMBER )
							pIM->disableModalWindow();
					}

					// Rebuild interface. Rebuild members only if needed
					pIM->runActionHandler("guild_sheet_open", NULL, toString("update_members=%d", (uint)_NeedUpdateMembers) );
				}
			}

			// guild updated
			_NeedUpdate = false;
			_NeedUpdateMembers= false;
		}
	}

	// *** Join proposal handling
	if (_JoinPropUpdate)
	{
		bool bAllValid = true;
		if (!pSMC->getDynString (_JoinPropPhraseID, _JoinPropPhrase)) bAllValid = false;
		// If all is valid no more need update and update the interface
		if (bAllValid)
		{
			_JoinPropUpdate = false;
			CGroupContainer *pJoinProp = dynamic_cast<CGroupContainer*>(pIM->getElementFromId(WIN_JOIN_PROPOSAL));
			if (pJoinProp != NULL)
			{
				CViewText *pJoinPropPhraseView = dynamic_cast<CViewText*>(pIM->getElementFromId(VIEW_JOIN_PROPOSAL_PHRASE));
				if (pJoinPropPhraseView != NULL)
					pJoinPropPhraseView->setText(_JoinPropPhrase);

				pJoinProp->setActive(true);
				pIM->setTopWindow(pJoinProp);
				pJoinProp->updateCoords();
				pJoinProp->center();
				pJoinProp->enableBlink(2);
			}
		}
	}
}