bool CREvent::OnCreateRoleBtn(const CEGUI::EventArgs &e)
{
	if (GetInst(SelectRolePage).GetPlayerCount() >= 1)
	{
        GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("Base_34"));   //目前不能创建更多的角色了!
		return false;
	}
	CEGUI::Window *pPageWin = GetInst(CreateRolePage).GetPageWindow();
	CEGUI::Editbox* pNameEdit = static_cast<CEGUI::Editbox*>(pPageWin->getChild("EditName"));

	const char * strName = CEGUIStringToAnsiChar(pNameEdit->getText());
	if (strcmp(strName,"") == 0)
	{
		GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("Player_72"));  //"名字不能为空"
		return false;
	}
	if (!CheckName(strName))
	{
		GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("Player_73"));  //"名字中不能有空格"
		return false; 
	}
	int  iSex  = random(2);
	//RandomChoseDetails();
	//RandomChoseCountry();
	BYTE lConstellation = random(12) + 1;
	//const char *strName,char nOccupation, char nSex, BYTE lHead, BYTE lFace, BYTE lCountry,BYTE lConstellation,BYTE bRandCountry
	GetGame()->C2L_AddRole_Send(strName, 0, (char)GetSelectSex(), GetHair(), GetFace(), GetSelectCountry(), lConstellation, 0 );
	return true;
}
	bool CQuestionManager::Startup()
	{
		if( !GetInst( CConfiger ).IsEnable() )
		{
			return false;
		}

		// create events
		m_Events[ET_QUIT] = ::CreateEvent( NULL, FALSE, FALSE, NULL );
		m_Events[ET_GEN] = ::CreateEvent( NULL, FALSE, FALSE, NULL );

		// create the mutex
		::InitializeCriticalSection( &m_QuesMutex );

		// startup update questions timer 
		int updateInterval = 1000 * GetInst( CConfiger ).GetSystem().UpdateQuestionInterval;
		m_UpdateTimer = m_Timer.Schedule( this, NULL, timeGetTime() + updateInterval, updateInterval );

		// generate questions at startup in the main thread.
		m_pQuestions = GenQuestions();

		// create the thread
		m_Thread = (HANDLE)::_beginthreadex( NULL, 0, threadFunc, this, 0, NULL );

		return true;
	}
bool OpenSaleUI()
{
	CEGUI::WindowManager& wndmgr = GetWndMgr();
	//获取出售订单ID
	CEGUI::MultiColumnList* mcl = WMCL(wndmgr.getWindow("Auction/Tab/BuySale/BuyMCL"));
	if(!mcl)
		return false;
	CEGUI::ListboxItem* lbi = mcl->getFirstSelectedItem();
	if(!lbi)
	{
		//MessageBox(g_hWnd,AppFrame::GetText("AU_100"),"ERROR",MB_OK);
		GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_100"),NULL,NULL,true);
		return false;
	}

	CEGUI::Window* wnd = wndmgr.getWindow("Auction/SaleWnd");
	wnd->setVisible(true);
	wnd->setAlwaysOnTop(true);
	CEGUI::Editbox* editbox = WEditBox(wnd->getChildRecursive("Auction/SaleWnd/saleNum"));//出售界面编辑框激活
	editbox->activate();

	AHdata& ah = GetInst(AHdata);
	uint ID = lbi->getID();
	ah.SetCanSaleID(ID);
	return true;
}
//添加任务奖励
void CEncouragement::OnBnClickedButton1()
{
	POSITION   pos   =   m_EncouragementList.GetFirstSelectedItemPosition();
	int ItemNum = m_EncouragementList.GetNextSelectedItem(pos);
	if (ItemNum<0)
	{
		ItemNum = 0;
	}
    CXmlEdit::MapTextFileTable::iterator  MapIter = GetInst(CXmlEdit).m_AllQuestTextFile.find( m_Textfile);
    if ( MapIter != GetInst(CXmlEdit).m_AllQuestTextFile.end() )
    {
        MapIter->second[ "Q" ] = ":";
    }
    else
    {
        return ;
    }

    m_TextIndex.SetWindowText("Q");
    m_TextContext.SetWindowText("");

    ReadRoleEncouragement( &m_Textfile );
    m_EncouragementList.EnsureVisible( 0 , FALSE );
    m_EncouragementList.SetItemState(  0 , LVIS_SELECTED|LVIS_FOCUSED,LVIS_SELECTED|LVIS_FOCUSED);
    m_EncouragementList.SetFocus();
    m_EncouragementList.SetSelectedColumn(0);
}
Exemple #5
0
//执行
void COpScript::Execute(CMoveShape* pShape)
{
#ifdef _RUNSTACKINFO1_
    CMessage::AsyWriteFile(GetGame()->GetStatckFileName(), "COpScript::Execute() begin");
#endif
    //  [5/4/2009 chenxianj]
    //CScript *pTempScript =  PopFreeScript("COpScript::Execute");
    //if (pTempScript)
    //{
    //	pTempScript->SetVariableList(m_pParam->pVariableList);
    //	pTempScript->SetUsedItemID(m_pParam->GoodsGuid);
    //	pTempScript->SetSrcShapeEx(m_pParam->pUser);
    //	//  [5/4/2009 chenxianj]
    //	itExpress it = m_Expressions.begin();
    //	for(;it != m_Expressions.end();it++)
    //	{
    //		if(m_pParam->pUser)
    //			pTempScript->SetRegion(dynamic_cast<CRegion*>(m_pParam->pUser->GetFather()));
    //		else
    //			pTempScript->SetRegion(NULL);


    //		(*it)->Execute(pTempScript,pShape);

    //	}
    //	//  [5/4/2009 chenxianj]
    //	PushFreeScript(pTempScript);
    //}
    Script::RunEnv env( m_pParam->pUser, pShape, static_cast<CRegion*>( m_pParam->pUser->GetFather() ),
                        m_pParam->pVariableList );
    VariableList *varList = m_pParam->pVariableList;
    if( !varList->AddVar( "$ParamA", (double)(DWORD)m_pParam->pUser ) )
    {
        varList->SetVarValue( "$ParamA", (double)(DWORD) m_pParam->pUser );
    }
    if( !varList->AddVar( "$ParamB", (double)(DWORD)pShape ) )
    {
        varList->SetVarValue( "$ParamB", (double)(DWORD) pShape );
    }

    Script *script = GetInst( ScriptSys ).NewScript( env );
    for( itExpress it = m_Expressions.begin(); it != m_Expressions.end(); ++ it )
    {
        CExpressions *exp = *it;
        int ret = exp->Execute( script, pShape );
        if( !script->CanDelete( ret ) )
        {
            // yield script, cannot run.
            assert( "Yield script" && 0 );
        }
    }
    GetInst( ScriptSys ).DelScript( script );

#ifdef _RUNSTACKINFO1_
    CMessage::AsyWriteFile(GetGame()->GetStatckFileName(), "COpScript::Execute() end");
#endif
}
bool OnReturnCharSel(const CEGUI::EventArgs &args)
{
	// 玩家有队伍发送离开队伍消息
	TeamMsgMgr& mgr = GetInst(TeamMsgMgr);
	mgr.SendSelfLeaveTeam();
    CMessage msg(MSG_C2S_OTHER_QUITTOSELECT);
    msg.Send();
    GetInst(UIManager).CloseAllPage();
    return true;
}
    void SkillTracer::Init(long id, long lvl, const CGUID &target, ulong traceTime)
    {
        m_SkillID  = id;
        m_SkillLvl = lvl;
        m_TargetID = target;
        m_EndTime = timeGetTime() + traceTime;

        m_SkillMaxDis = (float)GetInst(SkillAttribute).GetStrCondif(m_SkillID,lvl, "MaxAtkDistance");
        m_SkillMinDis = (float)GetInst(SkillAttribute).GetStrCondif(m_SkillID,lvl, "MinAtkDistance");

    }
Exemple #8
0
DWORD IBuff::GetRemain()
{
	if( GetInst() == 0 )
		return 0;
	
	DWORD dwElapsedTime = ::timeGetTime() - GetInst();
	if( dwElapsedTime > GetTotal() )	// 남은 시간은 총 버프 시간보다 클 수 없다.
		return 0;						// 실제로 버프 제거는 시간 만료 후 다음 프로세스에서 하기 때문에 발생 가능하다.

	return GetTotal() - dwElapsedTime;
}
void  FactionOper::RecvSetChairmanNotifyMsg(CMessage* pMsg)
{
    TCHAR	szPrompt[ 256 ];

    // 老族长 名字
    TCHAR	nameOldMaster[ MAX_MEMBER_NAME_SIZE ];
    pMsg->GetStr( nameOldMaster, MAX_MEMBER_NAME_SIZE );

    // 新族长 名字
    TCHAR	nameNewMaster[ MAX_MEMBER_NAME_SIZE ];
    pMsg->GetStr( nameNewMaster, MAX_MEMBER_NAME_SIZE );

    // 如果我是老族长
    if( ! lstrcmp( GetGame()->GetMainPlayer()->GetName(), nameOldMaster ) )
    {
        // "您已经将族长职位转让给 %s!"
        wsprintf( szPrompt, AppFrame::GetText("FA_104") , nameNewMaster );
        GetInst(MsgEventManager).PushEvent(Msg_Ok,szPrompt);

        // 修改官阶
        m_pFactionManager->SetMyJob( 0 );
    }
    // 如果我是新族长
    else if( ! lstrcmp( GetGame()->GetMainPlayer()->GetName(), nameNewMaster ) )
    {
        // "%s 任命您为 %s 的新族长!"
        wsprintf( szPrompt, AppFrame::GetText("FA_302") , nameOldMaster, m_pFactionManager->GetMyFaction()->GetName() );
        GetInst(MsgEventManager).PushEvent(Msg_Ok,szPrompt);

        // 设置作为族长的相关数据
        m_pFactionManager->SetMyJob( Exceptive_JobLvl );
    }
    // 如果是我的会友
    else if( m_pFactionManager->GetMyFaction() )
    {
        // "%s 任命 %s 为 %s 的新族长!"
        wsprintf( szPrompt, AppFrame::GetText("FA_303") , nameOldMaster, m_pFactionManager->GetMyFaction()->GetName() );
        GetInst(ChatListPage).AddChatWords(szPrompt,0xffffffff,0,0xff000000,"",CHAT_SYSTEM);
    }

    // 更新 Member 数据
    if( CFacMember* pMember = m_pFactionManager->GetMyConfrere( nameOldMaster ) )
    {
        pMember->SetJob( 0 );
    }

    if( CFacMember* pMember = m_pFactionManager->GetMyConfrere( nameNewMaster ) )
    {
        pMember->SetJob( Exceptive_JobLvl );
    }

    // 刷新界面
    FireUIEvent("FactionPage","UpdateMem");
}
Exemple #10
0
void CPlayListDlg::OnInitDialog(HWND hwndDlg)
{
	m_hWnd = hwndDlg;
	ShellInitDialog(m_hWnd);

	// ツールバーの準備
	SHMENUBARINFO mbi;
	memset(&mbi, 0, sizeof(SHMENUBARINFO));
	mbi.cbSize = sizeof(SHMENUBARINFO);
	mbi.hwndParent = m_hWnd;
	mbi.nToolBarId = IDR_DUMMY;
	mbi.hInstRes = GetInst();
	SHCreateMenuBar(&mbi);
	m_hwndMB = mbi.hwndMB;

	SendMessage(m_hwndMB, TB_DELETEBUTTON, 0, 0);
	SendMessage(m_hwndMB, TB_ADDSTRING, (WPARAM)GetInst(), IDC_UP);
	SendMessage(m_hwndMB, TB_ADDSTRING, (WPARAM)GetInst(), IDC_DOWN);

	CommandBar_AddBitmap(m_hwndMB, GetInst(), IDR_PLAYLIST, 6, 16, 16);
	TBBUTTON tbbMain[] = {
		{0, IDC_ADD, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
		{1, IDC_UP, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, 0, 0, 0, 0},
		{2, IDC_DOWN, TBSTATE_ENABLED, TBSTYLE_BUTTON | TBSTYLE_AUTOSIZE, 0, 0, 0, 1},
		{3, IDC_DELETE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
		{4, IDC_SAVE, TBSTATE_ENABLED, TBSTYLE_BUTTON, 0, 0, 0, -1},
		{5, IDC_CTRLKEY, TBSTATE_ENABLED, TBSTYLE_CHECK, 0, 0, 0, -1}
	};

	for (int i = 0; i < sizeof(tbbMain) / sizeof(TBBUTTON); i++) {
		CommandBar_InsertButton(m_hwndMB, i, &tbbMain[i]);
	}

	// リストの準備
	HWND hwndLV = GetDlgItem(m_hWnd, IDC_PLAY_LIST);
	ListView_SetExtendedListViewStyle(hwndLV, 
		ListView_GetExtendedListViewStyle(hwndLV) | LVS_EX_FULLROWSELECT);

	// カラムの挿入
	LVCOLUMN lvc;
	lvc.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH;
	lvc.fmt = LVCFMT_LEFT;
	lvc.cx = 0;
	lvc.pszText = _T("Name");
	lvc.iSubItem = 0;
	ListView_InsertColumn(hwndLV, 0, &lvc);
	
	// イメージリストを設定
	ListView_SetImageList(hwndLV, m_hImageList, LVSIL_SMALL);

	// リストを更新
	UpdatePlayList();
}
Exemple #11
0
CPlayListDlg::CPlayListDlg()
{
	m_fListDrag = FALSE;
	m_nDragItem = -1;

	m_hWnd = NULL;
	m_hImageList = ImageList_Create(16, 16, ILC_COLOR | ILC_MASK, 2, 2);
	HICON hIcon = LoadIcon(GetInst(), LPCTSTR(IDI_FILE_S));
	ImageList_AddIcon(m_hImageList, hIcon);
	DestroyIcon(hIcon);
	hIcon = LoadIcon(GetInst(), LPCTSTR(IDI_PLAY_S));
	ImageList_AddIcon(m_hImageList, hIcon);
	DestroyIcon(hIcon);
}
    void FightStateScript::OnUseSkillEnd(long ret)
    {
        Script *script = GetInst(ScriptSys).GetScript(m_skillScriptID);
        if(script != NULL)
        {
            script->PushRetValue(ret);
            GetInst(ScriptSys).ResumeScript(script, 1);
        }
		else
		{
			LogError(AI_MODULE, "Get ScriptSys instance error.");
		}
        m_State = NORMAL;
    }
Exemple #13
0
CPlayListDlg::CPlayListDlg()
{
	m_hWnd = NULL;
	m_hwndMB = NULL;
	m_fCtrlKey = FALSE;
	
	m_hImageList = ImageList_Create(SCALEX(16), SCALEY(16), ILC_COLOR | ILC_MASK, 2, 2);
	HICON hIcon = LoadIcon(GetInst(), LPCTSTR(IDI_FILE_S));
	ImageList_AddIcon(m_hImageList, hIcon);
	DestroyIcon(hIcon);
	hIcon = (HICON)LoadImage(GetInst(), (LPCTSTR)IDI_PLAY_S, IMAGE_ICON, SCALEX(16), SCALEY(16), 0);
	ImageList_AddIcon(m_hImageList, hIcon);
	DestroyIcon(hIcon);
}
void CEncouragement::OnEnChangeEdit1()
{
    // TODO:  如果该控件是 RICHEDIT 控件,则它将不会
    // 发送该通知,除非重写 CDialog::OnInitDialog()
    // 函数并调用 CRichEditCtrl().SetEventMask(),
    // 同时将 ENM_CHANGE 标志“或”运算到掩码中。

    // TODO:  在此添加控件通知处理程序代码
    POSITION   pos   =   m_EncouragementList.GetFirstSelectedItemPosition();
    if(pos==NULL)
    {	
        return;		
    }

    
    int nSelectItem= m_EncouragementList.GetNextSelectedItem(pos);
    CString selectType =  m_EncouragementList.GetItemText(nSelectItem,0);
    CString selectNum =   m_EncouragementList.GetItemText(nSelectItem,1);
    CXmlEdit::MapTextFileTable::iterator  MapIter = GetInst(CXmlEdit).m_AllQuestTextFile.find( m_Textfile);

    if ( MapIter!= GetInst(CXmlEdit).m_AllQuestTextFile.end() )
    {
         UpdateData( TRUE );

         map<CString,CString>::iterator  TextIter1 = MapIter->second.find( selectType );

         char  QText[256];
         m_TextIndex.GetWindowText( QText , 256 );

         map<CString,CString>::iterator  TextIter2 = MapIter->second.find( QText );
         if ( strcmp( selectType.GetBuffer(),QText) == 0 )
         {
             return ;
         }
         if ( TextIter2 != MapIter->second.end() )
         {
             //MessageBox("存在重复的索引文本!");
             return ;
         }
         if ( TextIter1 != MapIter->second.end() )
         {
              MapIter->second.erase( TextIter1 );
              MapIter->second.insert( std::make_pair(QText,selectNum) );
         }

         m_EncouragementList.SetItemText(nSelectItem,0,QText);
    }
    
}
Exemple #15
0
void CEffectDlg::ShowEffectDlg(HWND hwndParent, HANDLE hMap)
{
	m_hMap = hMap;
	CTempStr strTitle(IDS_TITLE_EFFECT);

	PROPSHEETPAGE psp[4];
	memset(psp, 0, sizeof(psp));
	psp[0].dwSize = sizeof(PROPSHEETPAGE);
	psp[0].dwFlags = PSP_DEFAULT;
	psp[0].pszTemplate = MAKEINTRESOURCE(IDD_PAGE_EQUALIZER);
	psp[0].pfnDlgProc = (DLGPROC)EqualizerProc;
	psp[0].hInstance = GetInst();
	psp[0].pszIcon = NULL;
	psp[0].lParam = (LPARAM)this;
	psp[1].dwSize = sizeof(PROPSHEETPAGE);
	psp[1].dwFlags = PSP_DEFAULT;
	psp[1].pszTemplate = MAKEINTRESOURCE(IDD_PAGE_EFFECT);
	psp[1].pfnDlgProc = (DLGPROC)EffectProc;
	psp[1].hInstance = GetInst();
	psp[1].pszIcon = NULL;
	psp[1].lParam = (LPARAM)this;
	psp[2].dwSize = sizeof(PROPSHEETPAGE);
	psp[2].dwFlags = PSP_DEFAULT;
	psp[2].pszTemplate = MAKEINTRESOURCE(IDD_PAGE_REVERB);
	psp[2].pfnDlgProc = (DLGPROC)ReverbProc;
	psp[2].hInstance = GetInst();
	psp[2].pszIcon = NULL;
	psp[2].lParam = (LPARAM)this;
	psp[3].dwSize = sizeof(PROPSHEETPAGE);
	psp[3].dwFlags = PSP_DEFAULT;
	psp[3].pszTemplate = MAKEINTRESOURCE(IDD_PAGE_EFFECT_SAVE);
	psp[3].pfnDlgProc = (DLGPROC)PresetProc;
	psp[3].hInstance = GetInst();
	psp[3].pszIcon = NULL;
	psp[3].lParam = (LPARAM)this;
	
	PROPSHEETHEADER psh;
	psh.dwSize = sizeof(PROPSHEETHEADER);
	psh.dwFlags = PSH_PROPSHEETPAGE | PSH_NOAPPLYNOW | PSH_USECALLBACK;
	psh.pfnCallback = PropSheetCallback;
	psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
	psh.nStartPage = 0;
	psh.pszIcon = NULL;
	psh.pszCaption = strTitle;
	psh.hwndParent = hwndParent;
	psh.hInstance = GetInst();
	psh.ppsp = psp;
	PropertySheet(&psh);
}
Exemple #16
0
void LoadAccel( int bitmap )
{
    if( bitmap & MENU_DELETE ) {
        State->hAccel[1] = LoadAccelerators( GetInst(), "DeleteAccelTable" );
    }
    if( bitmap & MENU_COPY ) {
        State->hAccel[2] = LoadAccelerators( GetInst(), "CopyAccelTable" );
    }
    if( bitmap & MENU_PASTE ) {
        State->hAccel[3] = LoadAccelerators( GetInst(), "PasteAccelTable" );
    }
    if( bitmap & MENU_CUT ) {
        State->hAccel[4] = LoadAccelerators( GetInst(), "CutAccelTable" );
    }
}
Exemple #17
0
void NewState( void )
{
    /* initialize state info */
    State = EdAlloc( sizeof( STATE ) );
    State->currstate = DORMANT;
    State->basestate = DORMANT;
    State->currobj = NULL;
    State->selecteatom = NULL;
    State->prevobject = NULL;
    State->mainobject = NULL;
    State->gridvinc = DEF_V_GRID;
    State->gridhinc = DEF_H_GRID;
    State->vresizegrid = DEF_V_GRID;
    State->hresizegrid = DEF_H_GRID;
    State->offset.x = 0;
    State->offset.y = 0;
    State->hAccel[0] = LoadAccelerators( GetInst(), "EscAccelTable" );
    State->hAccel[1] = NULL;
    State->hAccel[2] = NULL;
    State->hAccel[3] = NULL;
    State->hAccel[4] = NULL;
    State->showerror = true;
    State->error = NULL;
    State->mouseaction = NULL;
    State->show_eatoms = true;
    State->id = StateID;
    ++StateID;
    State->next = StateList;
    StateList = State;
}
//提交出售请求
bool OnSaleSubmit(const CEGUI::EventArgs& e)
{
	CEGUI::WindowManager& wndmgr = GetWndMgr();
	CEGUI::Editbox* edb = WEditBox(wndmgr.getWindow("Auction/SaleWnd/saleNum"));
	AHdata& ah = GetInst(AHdata);
	//获取出售数量
	uint saleNum = CEGUI::PropertyHelper::stringToInt(edb->getText());
	uint cansaleNum = ah.GetCountByCanSaleID(ah.GetCanSaleID());
	if(saleNum == 0 || saleNum > cansaleNum )
	{
		GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_101"),NULL,NULL,true);
		return false;
	}
	ah.Send_AH_SEL(cansaleNum);//发送出售请求前要设置出售的订单ID
	return true;
}
////提交购买请求
bool OnBuySubmit(const CEGUI::EventArgs& e)
{
	CEGUI::WindowManager& wndmgr = GetWndMgr();
	CEGUI::Editbox* edb = WEditBox(wndmgr.getWindow("Auction/Buy/buyNum"));
	AHdata& ah = GetInst(AHdata);
	//获取购买数量
	uint buyNum = CEGUI::PropertyHelper::stringToInt(edb->getText());
	uint canbuyNum = ah.GetCountByCanBuyID(ah.GetCanBuyID());
	if(buyNum== 0 || buyNum > canbuyNum)
	{
		GetInst(MsgEventManager).PushEvent(Msg_Ok,AppFrame::GetText("AU_103"),NULL,NULL,true);
		return false;
	}
	ah.Send_AH_BUY(buyNum);//发送购买请求前要设置购买的订单ID
	return true;
}
	///
	/// 取得指定列表里某个变量的值
	///
	/// luaVar = GetVar( operType, "$varName", [pos] )
	/// @param operType:VT_SCRIPT, VT_SRCSHAPE, VT_DESTSHAPE, VT_GLOBAL
	/// @param varName 变量名
	/// @param pos [可选] 数组索引,从0开始
	/// @return 变量值,如果变量不存在,则需要与各类型对应的非法值做比较:
	/// 字符串可与""比较,数字与INVALID_NUM比较,GUID与 CGUID::GUID_INVALID 做比较
	///
	static int GetVar( lua_State *L )
	{
		Script *script = GetInst( ScriptSys ).GetScript( L );
		long operType = (long) tolua_tonumber( L, 1, 0 );
		VariableList *varList = ( script != NULL ? script->GetVarList( operType ) : NULL );
		long index = (long) tolua_tonumber( L, 3, 0 );
		const char *varName = TOLUA_TOSTRING( varName, L, 2, "" );
		long varType = VarList::VarType( varName );
		if( varList == NULL )
		{
			lua_pushnumber( L, -1 );
			return 1;
		}
		if( varType == VariableList::VAR_NUM )
		{
			VariableList::Number val = varList->GetVarValue<VariableList::Number>( varName, index );
			lua_pushnumber( L, (lua_Number) val );
		}
		else if( varType == VariableList::VAR_STRING )
		{
			const tString &val = varList->GetVarValue<tString>( varName, index );
			lua_pushstring( L, val.Valid() ? val.Str() : "" );
		}
		else if( varType == VariableList::VAR_GUID )
		{
			const CGUID &val = varList->GetVarValue<CGUID>( varName, index );
            Script::PushGCGUID( L, val );
		}
		else
		{
			// argument error.
			lua_pushnumber( L, -1 );
		}
		return 1;
	}
void Script::CallScriptByGUID(const CGUID& shapeGuid, const char* scriptFilename)
{
	CMoveShape* shape = GetGame()->FindShape(TYPE_PLAYER, shapeGuid);
	if(shape==NULL)
	{
		CServerRegion* region = dynamic_cast<CServerRegion*>(m_RunEnv.region);
		if(region != NULL)
			shape = dynamic_cast<CMoveShape*>(region->FindChildObject(TYPE_MONSTER, shapeGuid));
	}

	if(shape != NULL) // 本地调用脚本
	{
		RunEnv env;
		env.region = dynamic_cast<CRegion*>(shape->GetFather());
		env.srcShape = shape;
		GetInst(ScriptSys).RunScript(env, scriptFilename);
	}
	else // 跨服调用脚本
	{
		CMessage msg(MSG_S2W_QUEST_PlayerRunScript);
		msg.Add(shapeGuid); // call guid
		msg.Add(scriptFilename);	 // called script name
		msg.SendToSocket(GetGame()->GetWSSocket());
	}
}
Exemple #22
0
//更新右搜索(筛选)菜单
bool OnSearchRightMenuUpdate(const CEGUI::EventArgs& e)
{
    CEGUI::Combobox* cbbox = WComboBox(WEArgs(e).window);
    cbbox->clearAllSelections();
    cbbox->resetList();
    cbbox->getEditbox()->setText("");

    //由索引关联商城类型
    SCGData::eSCType eShopCityType = GetShopCityTypeByTabContentSelIndex();
    //由索引关联商店类型,tabControl的索引0单独对应热销商品
    SCGData::eSType shoptype = GetShopTypeByTabContentSelIndex();
    if(shoptype == SCGData::TABTYPE_HOT)//热销没有筛选项
        return true;
    //根据商城和商店类型获取筛选数据
    SCGData* dt = GetInst(ShopCityMsgMgr).GetShopCityGoodsData();
    SCGData::MapFLDTA& mapSel = dt->GetFilterList();
    SCGData::MapUFLDTPA& mapUSel = mapSel[eShopCityType];
    SCGData::MapStrFilDTPA& mapStrSel = mapUSel[shoptype];
    SCGData::MapStrFilDTPA::iterator iter = mapStrSel.begin();
    for( ; iter != mapStrSel.end() ; ++iter)
    {
        //初始化筛选菜单
        string str = (*iter).first;
        //CEGUI::ListboxItem* lbi = new CEGUI::ListboxTextItem(str.c_str());
        CEGUI::ListboxItem* lbi = new CEGUI::ListboxTextItem(ToCEGUIString(str.c_str()));
        lbi->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
        if(iter == mapStrSel.begin() )//默认让第一个为选中项
            lbi->setSelected(true);
        cbbox->addItem(lbi);
    }
    return true;
}
Exemple #23
0
//更新左搜索(导购)菜单
bool OnSearchLeftMenuUpdate(const CEGUI::EventArgs& e)
{
    CEGUI::Combobox* cbbox = WComboBox(WEArgs(e).window);
    cbbox->clearAllSelections();
    cbbox->resetList();
    cbbox->getEditbox()->setText("");
    //由索引关联商城类型
    SCGData::eSCType eCityType = GetShopCityTypeByTabContentSelIndex();
    SCGData* dt = GetInst(ShopCityMsgMgr).GetShopCityGoodsData();
    SCGData::MapGuideDataA& mapGuide = dt->GetGuideList();
    //根据索引获取导购数据
    SCGData::MapStrGGDTPA& mapGuideDTA = mapGuide[eCityType];
    CEGUI::Combobox* cbboxRight = WComboBox(GetWndMgr().getWindow(SHOPCITY_SEARCH_RIGHTWND_NAME));
    if(cbboxRight)
    {
        CEGUI::ListboxItem* lbi = cbboxRight->getSelectedItem();
        size_t idx = 0;
        if(lbi)
            idx = cbboxRight->getItemIndex(lbi);
        SCGData::MapStrGGDTPA::iterator iter = mapGuideDTA.begin();
        for(; iter != mapGuideDTA.end() ; ++iter)
        {
            //添加导购菜单
            string menuStr = iter->first;
            //CEGUI::ListboxItem* lbi = new CEGUI::ListboxTextItem(menuStr.c_str());
            CEGUI::ListboxItem* lbi = new CEGUI::ListboxTextItem(ToCEGUIString(menuStr.c_str()));
            lbi->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
            if(iter == mapGuideDTA.begin())//默认让第一个为选中
                lbi->setSelected(true);
            cbbox->addItem(lbi);
        }
    }
    return true;
}
Exemple #24
0
//新品推荐
bool OnUpdateTwitter(const CEGUI::EventArgs& e)
{
    CEGUI::Window* twitter = WEArgs(e).window;
    CEGUI::Listbox*  lb = WListBox(twitter->getChildRecursive(SHOPCITY_TWITTER_CHILDLISTBOX_NAME));
#ifdef _DEBUG
    OutputDebugStr(lb->getName().c_str());
    OutputDebugStr("\n");
    OutputDebugStr(twitter->getChildAtIdx(0)->getName().c_str());
    OutputDebugStr("n");
#endif
    //清空
    lb->resetList();

    //由索引关联商城类型
    SCGData::eSCType eCityType = GetShopCityTypeByTabContentSelIndex();
    SCGData* dt = GetInst(ShopCityMsgMgr).GetShopCityGoodsData();
    //新品推荐显示
    SCGData::MapNewestA& resdta = dt->GetNewestVec();
    SCGData::VecGDPTA& vecDTA = resdta[eCityType];
    for(uint i = 0 ; i < vecDTA.size() ; ++i)
    {
        CGoodsList::tagGoods2* ptg2 = CGoodsList::GetProperty(vecDTA[i].index);
        if(ptg2)
        {
            string str  = ptg2->BaseProperty.strName.c_str();
            //CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(str.c_str(),vecDTA[i].index);//索引关联Item ID
            CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(ToCEGUIString(str.c_str()),vecDTA[i].index);//索引关联Item ID
            lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
            lb->addItem(lti);
        }
    }
    return true;
}
	void CShop::OnPlayerConformSellMsg( CMessage *pMsg, const CGUID &npcID )
	{
		CPlayer *pPlayer = pMsg->GetPlayer();
		if( pPlayer == NULL )
		{
			return ;
		}

		unsigned char ret = pMsg->GetByte();
		if( ret == 0 )
		{
			// 取消出售操作
			m_CachedSellData.Remove( pPlayer->GetExID() );
			// 重新打开收购界面
			GetInst( CShopManager ).OpenShopForSell( m_lID, pPlayer->GetExID(), npcID );
			return ;
		}

		// 确认出售
		const CCachedSellData::SellGoodsListT *sell_list = m_CachedSellData.Get( pPlayer->GetExID() );
		if( sell_list == NULL )
		{
			PutoutLog( LOG_FILE, LT_ERROR, "No cached sell data for player [%s].", pPlayer->GetName() );
			return;
		}

		DoPlayerSell( pPlayer, *sell_list );
		m_CachedSellData.Remove( pPlayer->GetExID() );
	}
bool UpdateCanSaleMCLDate(const CEGUI::EventArgs& e)
{
	AHdata& ah = GetInst(AHdata);
	AHdata::vecOrderRaw listOR = ah.m_CanSaleOrder;//可出售列表
	CEGUI::MultiColumnList* mcl = WMCL(WEArgs(e).window);
	if(!mcl)
		return false;
	mcl->resetList();
	AHdata::vecOrderRaw::iterator it = listOR.begin();
	for (uint i = 0 ; i < listOR.size() ; ++i,++it)
	{
		mcl->addRow();
		CEGUI::ListboxTextItem* lti = new CEGUI::ListboxTextItem(ToCEGUIString(AppFrame::GetText("AU_104")),it->id);//第二个参数与订单ID关联
		lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
		mcl->setItem(lti,0,i);

		lti = new CEGUI::ListboxTextItem(CEGUI::PropertyHelper::intToString(it->price));
		lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
		mcl->setItem(lti,1,i);

		lti = new CEGUI::ListboxTextItem(CEGUI::PropertyHelper::intToString(it->cnt));
		lti->setSelectionBrushImage(IMAGES_FILE_NAME,BRUSH_NAME);
		mcl->setItem(lti,2,i);
	}
	return true;
}
Exemple #27
0
void CPlayListDlg::OnInitDialog(HWND hwndDlg)
{
	m_hWnd = hwndDlg;
	ShellInitDialog(m_hWnd);

	// ツールバーの準備
	SHMENUBARINFO mbi;
	memset(&mbi, 0, sizeof(SHMENUBARINFO));
	mbi.cbSize = sizeof(SHMENUBARINFO);
	mbi.hwndParent = m_hWnd;
	mbi.nToolBarId = IDR_PLAYLIST;
	mbi.hInstRes = GetInst();
	SHCreateMenuBar(&mbi);
	m_hwndMB = mbi.hwndMB;

	// リストの準備
	HWND hwndLV = GetDlgItem(m_hWnd, IDC_PLAY_LIST);
	ListView_SetExtendedListViewStyle(hwndLV, 
		ListView_GetExtendedListViewStyle(hwndLV) | LVS_EX_FULLROWSELECT);

	// カラムの挿入
	LVCOLUMN lvc;
	lvc.mask = LVCF_FMT | LVCF_SUBITEM | LVCF_TEXT | LVCF_WIDTH;
	lvc.fmt = LVCFMT_LEFT;
	lvc.cx = 0;
	lvc.pszText = _T("Name");
	lvc.iSubItem = 0;
	ListView_InsertColumn(hwndLV, 0, &lvc);
	
	// イメージリストを設定
	ListView_SetImageList(hwndLV, m_hImageList, LVSIL_SMALL);

	// リストを更新
	UpdatePlayList();
}
bool UpdateSaleUIDate( const CEGUI::EventArgs& e )
{	
	CEGUI::WindowManager& mgr = GetWndMgr();
	CEGUI::Window* weimian = mgr.getWindow("Auction/SaleWnd/Text61");
	weimian->setText("");
	CEGUI::Window* gold = mgr.getWindow("Auction/SaleWnd/Text6");
	gold->setText("");
	//获取输入的出售数目
	CEGUI::Editbox* edb = WEditBox(mgr.getWindow("Auction/SaleWnd/saleNum"));
	if(!edb)
		return false;
	uint saleNum = CEGUI::PropertyHelper::stringToInt(edb->getText());
	if(saleNum==0)
		return false;
	//设置支付位面数
	weimian->setText(edb->getText());

	AHdata& ah = GetInst(AHdata);
	uint orderID = ah.GetCanSaleID();//获取要出售的订单ID
	uint price = ah.GetPriceByCanSaleID(orderID);//单价
	//计算价格
	uint subCust = saleNum * price;
	//设置需要支付金币
	gold->setText(CEGUI::PropertyHelper::intToString(subCust));
	return true;
}
Exemple #29
0
bool OnShopCityContentSelChanged(const CEGUI::EventArgs& e)
{
    CEGUI::TabControl* tbs = WTabControl(WEArgs(e).window);
    if(tbs)
    {
        CEGUI::Window* tbcontent =  tbs->getTabContentsAtIndex(tbs->getSelectedTabIndex());
        if(tbcontent)
        {
            tbcontent->addChildWindow(GetWindow(SHOPCITY_CHILD_PAGE_NAME));//把唯一ShopCityChild加到当前选中tbcontent上
            //更新ItemSet的显示
            FireUIEvent(SHOPCITY_ITEMSET_PAGE_NAME,SHOPCITY_ITEMSET_EVENT_UPDATE);
            //更新最近购买
            FireUIEvent(SHOPCITY_LATESTBUY_NAME,SHOPCITY_PAGE_EVENT_UPDATE_LATESTBUY);
            //更新推荐
            FireUIEvent(SHOPCITY_TWITTER_NAME,SHOPCITY_TWITTER_EVENT_NAME);
            //更新左搜索(导购)菜单
            FireUIEvent(SHOPCITY_SEARCH_LEFTWND_NAME,SHOPCITY_SEARCHLEFT_EVENT_MENUUPDATE_NAME);
            //更新右搜索(筛选)菜单
            FireUIEvent(SHOPCITY_SEARCH_RIGHTWND_NAME,SHOPCITY_SEARCHRIGHT_EVENT_MENUUPDATE_NAME);
            //设置更新源类型
            ShopCityMsgMgr& msgMgr = GetInst(ShopCityMsgMgr);
            msgMgr.SetStateUpdateUIByType(0);//由选中的商城商店类型来更新
        }
    }
    return true;
}
bool OnRefreshPerMCL(const CEGUI::EventArgs& e)
{
	//发送刷新列表信息
	AHdata& ad = GetInst(AHdata);
	ad.Send_AH_REQUEST_AGENT();
	return true;
}