[HELP´] Auto Attack

Results 1 to 3 of 3
  1. #1
    Member kikolindo is offline
    MemberRank
    Mar 2020 Join Date
    85Posts

    [HELP´] Auto Attack

    I am adding an auto attack system and I have a problem, could someone help me?

    https://prnt.sc/s2v682

    LINE ERROR:
    Code:
    for( MAPBUFF::iterator t = pWndWorld->m_buffs.m_mapBuffs.begin(); t!= pWndWorld->m_buffs.m_mapBuffs.end(); ++t )
    WndField.Cpp


    Code:
    
    #ifdef __NEW_NEIGUA
    int partySkill[]={6,8};
    CWndRefresher::CWndRefresher() 
    {
    	m_dwsfxtime = -1;
    	bStart = FALSE;
    	for( int i = 0; i < 4; i++ )
    	{
    		m_pItemElem[i] = NULL;
    		m_pTexture[i] = NULL;
    		m_dwitemid[i] = NULL;
    
    
    	}    
    
    
    }
    CWndRefresher::~CWndRefresher() 
    {
    
    
    } 
    
    
    
    
    BOOL CWndRefresher::Initialize( CWndBase* pWndParent, DWORD dwType )
    {
    	return CWndNeuz::InitDialog( g_Neuz.GetSafeHwnd(), APP_REFRESHER, 0, CPoint( 0, 0 ), pWndParent );
    }
    
    
    
    
    BOOL CWndRefresher::OnCommand( UINT nID, DWORD dwMessage, CWndBase* pWndBase ) 
    { 
    	return CWndNeuz::OnCommand( nID, dwMessage, pWndBase ); 
    } 
    void CWndRefresher::OnSize( UINT nType, int cx, int cy ) 
    { 
    	CWndNeuz::OnSize( nType, cx, cy ); 
    } 
    void CWndRefresher::OnLButtonUp( UINT nFlags, CPoint point ) 
    { 
    } 
    void CWndRefresher::OnLButtonDown( UINT nFlags, CPoint point ) 
    { 
    } 
    void CWndRefresher::OnDraw( C2DRender* p2DRender )
    {
    	//if (bStart)
    	//{
    	//	CString str;
    	//	str.Format("杀怪:%d",g_pPlayer->n_KillNumber);
    	//	p2DRender->TextOut(16,164,1,1,str,0xffff0000);
    	//}
    	int j = 0;
    	for (unsigned int i=0;i<Skill.size();i++)
    	{
    		LPSKILL lpSkill;
    		lpSkill = g_pPlayer->GetSkill(0,Skill[i]);
    		ItemProp* pSkillProp = prj.GetSkillProp( lpSkill->dwSkill );
    		if (pSkillProp)
    		{
    			CTexture *pIcon = NULL;
    			pIcon =m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_ICON, pSkillProp->szIcon ), 0xffff00ff );
    			pIcon->Render(p2DRender,CPoint(m_rect[j].left+11,m_rect[j].top+1),255);
    			j++;
    		}
    	}
    	for (unsigned int i=0;i<BuffItem.size();i++)
    	{
    		ItemProp* pItemProp = prj.GetItemProp(BuffItem[i]);
    		if (pItemProp)
    		{
    			CTexture *pIcon = NULL;
    			pIcon =m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_ITEM, pItemProp->szIcon ), 0xffff00ff );
    			pIcon->Render(p2DRender,CPoint(m_rect[j].left+11,m_rect[j].top+1),255);
    			j++;
    		}
    	}
    	//剧团
    	for (int i=0;i< 2;i++)
    	{
    		ItemProp* pItemProp =  prj.GetPartySkill( partySkill[i] );
    
    
    		if( pItemProp ) 
    		{
    			CTexture *pIcon = NULL;
    			pIcon =m_textureMng.AddTexture( g_Neuz.m_pd3dDevice, MakePath( DIR_ICON, pItemProp->szIcon), 0xffff00ff, FALSE );
    			pIcon->Render(p2DRender,CPoint(m_rect[j].left+11,m_rect[j].top+1),255);
    			j++;
    		}
    		if( g_Party.m_nSizeofMember != 0 && g_Party.IsLeader( g_pPlayer->m_idPlayer ))
    		{
    			if(g_Party.GetLevel() - pItemProp->dwReqDisLV>=0 )
    			{
    				CWndButton* pButtn1 = (CWndButton*)GetDlgItem(400+i);
    				pButtn1->EnableWindow(TRUE);
    			}
    
    
    		}else
    		{
    			CWndButton* pButtn1 = (CWndButton*)GetDlgItem(400+i);
    			pButtn1->SetCheck(FALSE);
    			pButtn1->EnableWindow(FALSE);
    
    
    		}
    	}
    
    
    
    
    }
    HRESULT CWndRefresher::RestoreDeviceObjects()
    {
    	CWndNeuz::RestoreDeviceObjects();
    	return S_OK;
    }
    HRESULT CWndRefresher::InvalidateDeviceObjects()
    {
    	CWndNeuz::InvalidateDeviceObjects();
    	return S_OK;
    }
    HRESULT CWndRefresher::DeleteDeviceObjects()
    {
    	CWndNeuz::DeleteDeviceObjects();
    	InvalidateDeviceObjects();
    	return S_OK;
    }
    void CWndRefresher::OnInitialUpdate( void )
    {
    	CWndNeuz::OnInitialUpdate(); 
    
    
    	CWndButton* pButton = (CWndButton*)GetDlgItem(WIDC_BUTTON_REFRESH_START);
    	CWndButton* pButton2 = (CWndButton*)GetDlgItem(WIDC_BUTTON_REFRESH_STOP);
    	// pButton->EnableWindow(FALSE);
    	pButton2->EnableWindow(FALSE);
    
    
    	///////////////插入药品////////////////////
    	CWndComboBox* pCombo = (CWndComboBox*)GetDlgItem(WIDC_COMBOBOX);
    	CWndComboBox* pCombo1 = (CWndComboBox*)GetDlgItem(WIDC_COMBOBOX1);
    	CWndComboBox* pCombo2 = (CWndComboBox*)GetDlgItem(WIDC_COMBOBOX2);
    	int nIndex = -1;
    	CString str;
    	pCombo->ResetContent();
    	nIndex = pCombo->AddString("select Hp");
    	pCombo->SetItemData( nIndex, 0);
    	pCombo->SetCurSel(nIndex);
    	pCombo1->ResetContent();
    	nIndex = pCombo1->AddString("select Mp");
    	pCombo1->SetItemData( nIndex, 0);
    	pCombo1->SetCurSel(nIndex);
    	pCombo2->ResetContent();
    	nIndex = pCombo2->AddString("select Fp");
    	pCombo2->SetItemData( nIndex, 0);
    	pCombo2->SetCurSel(nIndex);
    	for(int i=0;i<MAX_INVENTORY;i++)
    	{
    		CItemElem* pItemElem = (CItemElem*)g_pPlayer->m_Inventory.GetAt(i);
    		if (!pItemElem)
    			continue;
    		ItemProp* pItemProp = pItemElem->GetProp();
    		if (!pItemProp)
    			continue;
    		if (pItemProp->dwItemKind2 != IK2_FOOD && pItemProp->dwItemKind2 !=IK2_REFRESHER && pItemProp->dwItemKind2 !=IK2_POTION	)
    			continue;
    		BOOL bCunZai = FALSE;
    		if (pItemProp->dwDestParam[0] == DST_HP)
    		{
    			for (int i=0;i<pCombo->GetListBoxSize();i++)
    			{
    				if (pCombo->GetItemData(i) == pItemProp->dwID)
    				{
    					bCunZai = TRUE;
    					break;
    				}
    			}
    			if (bCunZai == FALSE)
    			{
    				str.Format("%s",pItemProp->szName);
    				nIndex = pCombo->AddString(str);
    				pCombo->SetItemData( nIndex, pItemProp->dwID);
    				pCombo->SetCurSel(nIndex);
    				m_dwitemid[0] = pItemProp->dwID;
    			}
    
    
    		}else if (pItemProp->dwDestParam[0] == DST_MP)
    		{
    			for (int i=0;i<pCombo1->GetListBoxSize();i++)
    			{
    				if (pCombo1->GetItemData(i) == pItemProp->dwID)
    				{
    					bCunZai = TRUE;
    					break;
    				}
    			}
    			if (bCunZai == FALSE)
    			{
    				str.Format("%s",pItemProp->szName);
    				nIndex = pCombo1->AddString(str);
    				pCombo1->SetItemData( nIndex, pItemProp->dwID);
    				pCombo1->SetCurSel(nIndex);
    				m_dwitemid[1] = pItemProp->dwID;
    			}
    		}else if (pItemProp->dwDestParam[0] == DST_FP)
    		{
    			for (int i=0;i<pCombo2->GetListBoxSize();i++)
    			{
    				if (pCombo2->GetItemData(i) == pItemProp->dwID)
    				{
    					bCunZai = TRUE;
    					break;
    				}
    			}
    			if (bCunZai == FALSE)
    			{
    				str.Format("%s",pItemProp->szName);
    				nIndex = pCombo2->AddString(str);
    				pCombo2->SetItemData( nIndex, pItemProp->dwID);
    				pCombo2->SetCurSel(nIndex);
    				m_dwitemid[2] = pItemProp->dwID;
    			}
    		}
    	}
    
    
    
    
    
    
    
    
    
    
    	///////////////////////////////////////////////////////////////////////
    	CWndButton* pWndButton;
    	pWndButton = (CWndButton*)GetDlgItem( WIDC_RADIO );
    	pWndButton->SetCheck( FALSE );
    	pWndButton = (CWndButton*)GetDlgItem( WIDC_RADIO1 );
    	pWndButton->SetCheck( TRUE );//默认选择无限范围
    
    
    	CWndEdit* LVmin = (CWndEdit*)GetDlgItem( WIDC_EDIT );
    	CWndEdit* LVmax = (CWndEdit*)GetDlgItem( WIDC_EDIT1 );
    	LVmin->SetString("1");
    	LVmax->SetString("999");
    	///////////////////////////////////////////////////////////////////////////////////////////
    	if (g_pPlayer->IsAuthorization(AUTH_ADMINISTRATOR))
    	{
    		CWndButton* pWndButtonRang =  new CWndButton;
    		pWndButtonRang->Create("bow double hit",WBS_CHECK,CRect(75,145,145,161),this,300);
    	}
    	////////////////////////////////////////////////////////////////////////////////////////////
    	CWndButton* pWndButtonRang =  new CWndButton;
    	pWndButtonRang->Create("check ascription",WBS_CHECK,CRect(5,145,75,161),this,301);
    
    
    
    
    
    
    	CPoint pt;
    	int index = 0;
    	//CWndButton* pWndButtonSkill =  new CWndButton;
    	for( int x=0; x<10; x++ )//技能框
    	{
    		for( int y=0; y<6; y++ )
    		{
    			pt = CPoint( x+155, y+8 );
    
    
    			pt.x += (x*42);
    			pt.y += (y*32);
    
    
    			SetRect( m_rect[index], pt.x, pt.y, pt.x+32, pt.y+32 );
    			index++;
    		}
    	}
    	index = 0;
    	Skill.clear();
    	for( int i = 0; i < MAX_SKILL_JOB; i++ ) 
    	{
    		LPSKILL lpSkill;
    		lpSkill = &g_pPlayer->m_aJobSkill[i];
    
    
    		if( lpSkill->dwSkill != NULL_ID && lpSkill->dwLevel>0)
    		{
    			ItemProp* pSkillProp = prj.m_aPropSkill.GetAt( lpSkill->dwSkill );
    			if( pSkillProp && pSkillProp->nEvildoing == 1 && pSkillProp->dwReferValue1>0)
    			{
    				CWndButton* pWndButtonSkill =  new CWndButton;
    				Skill.push_back(i);
    				pWndButtonSkill->Create("",WBS_CHECK,m_rect[index],this,100+index);
    				index++;
    			}else if (pSkillProp && pSkillProp->dwID == SI_RIN_SUP_MERKABAHANZELRUSHA)
    			{
    				CWndButton* pWndButtonSkill =  new CWndButton;
    				Skill.push_back(i);
    				pWndButtonSkill->Create("",WBS_CHECK,m_rect[index],this,100+index);
    				index++;
    			}
    		}
    
    
    	}
    
    
    	BuffItem.clear();
    	int index2 = 0;
    	for(int i=0;i<MAX_INVENTORY;i++)
    	{
    		CItemElem* pItemElem = (CItemElem*)g_pPlayer->m_Inventory.GetAt(i);
    		if (pItemElem && IsBuffItem(pItemElem->m_dwItemId))
    		{
    			BuffItem.push_back(pItemElem->m_dwItemId);
    			CWndButton* pWndButtonSkill =  new CWndButton;
    			pWndButtonSkill->Create("",WBS_CHECK,m_rect[index+index2],this,200+index2);
    			index2++;
    		}
    	}
    	//剧团技能
    	for (int i=0;i<2;i++)
    	{
    		CWndButton* pWndButtonSkill =  new CWndButton;
    		pWndButtonSkill->Create("",WBS_CHECK,m_rect[index+index2+i],this,400+i);
    		pWndButtonSkill->EnableWindow(FALSE);
    	}
    
    
    	CWndButton* pWndButtonF1 =  new CWndButton;
    	pWndButtonF1->Create("F1",WBS_CHECK,m_rect[index+index2+2],this,500);
    	//pWndButtonF1->EnableWindow(FALSE);
    	int n = (index+index2 +2)%6==0?0:1;
    	SetWndRect(CRect(5,5,176+int((index+index2+2)/6+n)*42,240));
    
    
    
    
    
    
    	MoveParentCenter(); 
    }
    BOOL CWndRefresher::IsBuffItem(DWORD itemId)
    {
    	switch(itemId)
    	{
    	case II_CHR_SYS_SCR_UPCUTSTONE:
    	case II_SYS_SYS_SCR_AMPES:
    	case II_SYS_SYS_SCR_ICEATKSPEED:
    	case II_SYS_SYS_SCR_VELOCIJUMP:
    	case II_CHR_SYS_SCR_ACTIVITION:
    	case II_SYS_SYS_SCR_AMPESC:
    	//case II_GEN_FOO_INS_STARCANDYA:
    	//case II_GEN_FOO_INS_STARCANDYB:
    	//case II_GEN_FOO_INS_STARCANDYC:
    	case II_SYS_SYS_SCR_AMPESS:
    		return TRUE;
    		break;
    	default:
    		return FALSE;
    		break;
    
    
    	}
    }
    BOOL CWndRefresher::OnDropIcon( LPSHORTCUT pShortcut, CPoint point )
    {
    	//LPWNDCTRL wndCtrl[4];
    	//wndCtrl[0] = GetWndCtrl( WIDC_CUSTOM7 );
    	//wndCtrl[1] = GetWndCtrl( WIDC_CUSTOM1 );
    	//wndCtrl[2] = GetWndCtrl( WIDC_CUSTOM2 ); 
    	//wndCtrl[3] = GetWndCtrl( WIDC_CUSTOM8); 
    	//for( int i = 0; i < 4; i++ )
    	//{
    	//	if( !wndCtrl[i] )
    	//	{
    	//		continue;
    	//	}
    	//	if( wndCtrl[i]->rect.PtInRect( point ))
    	//	{
    
    
    	//		CItemElem* pTempElem;
    	//		CItemBase* pItemBase = g_pPlayer->GetItemId( pShortcut->m_dwId );
    	//		pTempElem = (CItemElem*) pItemBase;
    	//		ItemProp* pItemProp = pTempElem->GetProp();
    
    
    
    
    	//		if( pItemProp->dwItemKind2 == IK2_FOOD || pItemProp->dwItemKind2 == IK2_POTION || pItemProp->dwItemKind2 == IK2_REFRESHER || pItemProp->dwUseable == 1)
    	//		{
    	//			if( m_pItemElem[i])
    	//			{
    	//				m_pItemElem[i]->SetExtra(0);
    	//				m_pItemElem[i] = NULL;
    	//				m_dwitemid[i]=NULL;
    	//			}
    	//			m_pItemElem[i] = (CItemElem*)pTempElem;
    	//			m_pTexture[i] = CWndBase::m_textureMng.AddTexture( D3DDEVICE, MakePath( DIR_ITEM, m_pItemElem[i]->GetProp()->szIcon ), 0xffff00ff );
    	//			if( m_pTexture[i])
    	//			{
    	//				m_dwitemid[i]=m_pItemElem[i]->m_dwItemId;
    	//			//	m_pItemElem[i]->SetExtra(1);
    	//			}
    	//		}else{
    	//			return FALSE;
    	//		}
    
    
    	//	}
    	//}
    	return TRUE;
    }
    DWORD timeEndInter = 0;
    DWORD s_CoolTime=0;
    DWORD nPowtime =0;
    BOOL CWndRefresher::Process()
    {
    	if (g_pPlayer->GetHitPoint() == 0)
    	{
    		return FALSE;
    	}
    	////////////////吃药////////////////////////////
    	CWndButton* hp = (CWndButton*)GetDlgItem(WIDC_HP);
    	CWndButton* mp = (CWndButton*)GetDlgItem(WIDC_MP);
    	CWndButton* fp = (CWndButton*)GetDlgItem(WIDC_FP);
    	//for( int i = 0; i < 3; ++i )
    	{
    		DWORD dwId = g_pPlayer->m_Inventory.Find( m_dwitemid[0] );
    		if( bStart && dwId != NULL_ID && hp->GetCheck()  )
    		{
    			CItemBase* pItemBase = g_pPlayer->GetItemId(dwId);
    
    
    			if(pItemBase &&(((FLOAT)g_pPlayer->GetMaxHitPoint() / g_pPlayer->GetHitPoint() ) > 2.0F || pItemBase->GetProp()->nAdjParamVal1 + g_pPlayer->GetHitPoint() <= g_pPlayer->GetMaxHitPoint())  )
    			{
    
    
    				if( g_pPlayer->m_cooltimeMgr.CanUse( g_pPlayer->m_cooltimeMgr.GetGroup(pItemBase->GetProp() )))
    				{
    					g_DPlay.SendDoUseItem( MAKELONG( ITYPE_ITEM, pItemBase->m_dwObjId ), NULL_ID, pItemBase->GetProp()->dwParts );
    				}
    			}
    		}
    		dwId = g_pPlayer->m_Inventory.Find( m_dwitemid[1] );
    		if( bStart && dwId != NULL_ID && mp->GetCheck() )
    		{
    			CItemBase* pItemBase = g_pPlayer->GetItemId(dwId);
    			//if( ((FLOAT)g_pPlayer->GetMaxManaPoint() / g_pPlayer->GetManaPoint() ) > 2.0F || m_pItemElem[1]->GetProp()->nAdjParamVal1 + g_pPlayer->GetManaPoint() <= g_pPlayer->GetMaxManaPoint() )
    			if( pItemBase && g_pPlayer->GetManaPoint()  < 500 && g_pPlayer->GetManaPoint() < g_pPlayer->GetMaxManaPoint())
    			{
    
    
    				if( g_tmCurrent-m_CoolTime>2000)
    				{
    					g_DPlay.SendDoUseItem( MAKELONG( ITYPE_ITEM, pItemBase->m_dwObjId ), NULL_ID, pItemBase->GetProp()->dwParts );
    					m_CoolTime = g_tmCurrent;
    
    
    				}
    			}
    		}
    		dwId = g_pPlayer->m_Inventory.Find( m_dwitemid[2] );
    		if( bStart && dwId != NULL_ID && fp->GetCheck() )
    		{
    			CItemBase* pItemBase = g_pPlayer->GetItemId(dwId);
    			//if( ((FLOAT)g_pPlayer->GetMaxFatiguePoint() / g_pPlayer->GetFatiguePoint() ) > 2.0F || m_pItemElem[2]->GetProp()->nAdjParamVal1 + g_pPlayer->GetFatiguePoint() <= g_pPlayer->GetMaxFatiguePoint() )
    			if(pItemBase &&  g_pPlayer->GetFatiguePoint() < 200 && g_pPlayer->GetFatiguePoint() < g_pPlayer->GetMaxFatiguePoint())
    			{
    				if( g_tmCurrent-m_CoolTime>2000)
    				{
    					g_DPlay.SendDoUseItem( MAKELONG( ITYPE_ITEM, pItemBase->m_dwObjId ), NULL_ID, pItemBase->GetProp()->dwParts );
    					m_CoolTime = g_tmCurrent;
    
    
    				}
    			}
    		}
    		//dwId = g_pPlayer->m_Inventory.Find( m_dwitemid[3] );
    		//if( bStart && dwId != NULL_ID && Ex->GetCheck() )
    		//{
    		//	CItemBase* pItemBase = g_pPlayer->GetItemId(dwId);
    		//	if(pItemBase && !g_pPlayer->HasBuff( BUFF_ITEM, pItemBase->m_dwItemId ))
    		//	{
    		//		if( g_tmCurrent-m_CoolTime>2000)
    		//		{
    		//			g_DPlay.SendDoUseItem( MAKELONG( ITYPE_ITEM, pItemBase->m_dwObjId ), NULL_ID, pItemBase->GetProp()->dwParts );
    		//			m_CoolTime = g_tmCurrent;
    		//		}
    		//	}
    
    
    		//}
    
    
    
    
    	}
    	////////////////////////////以下是自动打怪//////////////////////////
    	if (g_pPlayer->IsFly())
    	{
    		return FALSE;
    	}
    
    
    
    
    	CWndButton*	fanwei = (CWndButton*)GetDlgItem( WIDC_RADIO );
    	CWndButton* dafanwei = (CWndButton*)GetDlgItem( WIDC_RADIO1 );
    	//取得怪物等级范围
    	CWndEdit* LVmin = (CWndEdit*)GetDlgItem( WIDC_EDIT );
    	CWndEdit* LVmax = (CWndEdit*)GetDlgItem( WIDC_EDIT1 );
    	CWndButton* F1 = (CWndButton*)GetDlgItem(500);
    	int MinLv = _ttoi( LVmin->GetString() );
    	int MaxLv = _ttoi( LVmax->GetString() );
    	if(MinLv>999 || MinLv<1 || MaxLv > 999 || MaxLv< 1)
    	{
    		return FALSE;
    	}
    	if (bStart)
    	{
    		//if(fanwei->GetCheck())
    	//		CreateSfx(g_Neuz.m_pd3dDevice,XI_NEIGUA,g_pPlayer->GetPos(),g_pPlayer->GetId());
    		CWorld* pWorld = g_WorldMng.Get();
    		float fDist;
    		CObj* pSelectOld = pWorld->GetObjFocus();
    		CObj* pSelectNEW = NULL;
    		CMover* pMover = (CMover*)pSelectOld;
    		if(pSelectOld&&pSelectOld->GetType()!=OT_MOVER)
    		{
    			return FALSE;
    			//bStart=false;
    			//CWndButton* pButton1 = (CWndButton*)GetDlgItem(WIDC_BUTTON_REFRESH_START);
    			//pButton1->EnableWindow(TRUE);
    		}
    		if (pMover && pMover->GetHitPoint() > 0)
    		{
    
    
    			CWndButton* guishu = (CWndButton*)GetDlgItem(301);//判断归属
    			if (guishu->GetCheck() && pMover->m_idAttacker != NULL_ID && pMover->m_idAttacker != g_pPlayer->GetId() )
    			{
    				CMover *pTmp = prj.GetMover(pMover->m_idAttacker);
    				if (g_pPlayer->m_idparty>0 && pTmp && pTmp->GetPartyId() == g_pPlayer->m_idparty)
    				{
    
    
    				}else
    				{
    					pWorld->SetObjFocus( NULL );
    					return FALSE;
    				}
    			}
    			D3DXVECTOR3 vStart = g_pPlayer->GetPos();			vStart.y += 0.5f;
    			D3DXVECTOR3 vEnd   = pMover->GetPos();	vEnd.y += 0.5f;
    			if (g_pPlayer->GetWorld()->IntersectObjLine( NULL, vStart, vEnd, FALSE, FALSE ))
    			{
    				if(g_tmCurrent - timeEndInter > SEC(5))
    				{
    					pWorld->SetObjFocus( NULL );
    					return FALSE;
    
    
    				}
    
    
    			}else
    			{
    				timeEndInter =g_tmCurrent;
    				//判断连续技是否存在
    				CWndTaskBar* pTaskBar = g_WndMng.m_pWndTaskBar;
    				if(pTaskBar->m_aSlotQueue[ 0 ].IsEmpty())
    				{
    					if (g_pPlayer->IsAuthorization(AUTH_ADMINISTRATOR))
    					{
    						CWndButton* range = (CWndButton*)GetDlgItem( 300 );	
    						if(range->GetCheck() && g_pPlayer->GetWeaponItem()->GetProp()->dwItemKind3 == IK3_BOW)
    						{							
    							if (F1->GetCheck())
    							{
    								LPSHORTCUT lpShortcut = &pTaskBar->m_paSlotItem[ 0 ] ;
    								if (lpShortcut->IsEmpty() || lpShortcut->m_dwShortcut != SHORTCUT_SKILL)
    								{
    									g_pPlayer->CMD_SetRangeAttack(pMover->GetId(),4);
    								}else
    								{
    									//LPSKILL pSkill = g_pPlayer->GetSkill(0,lpShortcut->m_dwIndex);
    									//ItemProp* pSkillProp = prj.GetSkillProp( pSkill->dwSkill );
    									if (g_pPlayer->GetReuseDelay( lpShortcut->m_dwId )<=0)
    									{
    										g_pPlayer->CMD_SetUseSkill( pMover->m_objid, lpShortcut->m_dwId );
    									}else
    									{
    										g_pPlayer->CMD_SetRangeAttack(pMover->GetId(),4);
    									}
    									//g_WndMng.UseSkillShortCut(lpShortcut->m_dwType ,lpShortcut->m_dwIndex);
    
    
    								}
    
    
    								//g_WndMng.ObjectExecutor( lpShortcut );
    							}else
    								g_pPlayer->CMD_SetRangeAttack(pMover->GetId(),4);
    						}
    						else
    						{
    							if (F1->GetCheck())
    							{
    								LPSHORTCUT lpShortcut = &pTaskBar->m_paSlotItem[ 0 ] ;
    								if (lpShortcut->IsEmpty() || lpShortcut->m_dwShortcut != SHORTCUT_SKILL)
    								{
    									((CWndWorld *)g_WndMng.m_pWndWorld)->m_bAutoAttack = TRUE;
    								}else
    								{
    									//LPSKILL pSkill = g_pPlayer->GetSkill(0,lpShortcut->m_dwIndex);
    									//ItemProp* pSkillProp = prj.GetSkillProp( pSkill->dwSkill );
    									if (g_pPlayer->GetReuseDelay( lpShortcut->m_dwId )<=0)
    									{
    										g_pPlayer->CMD_SetUseSkill( pMover->m_objid, lpShortcut->m_dwId );
    									}else
    									{
    										((CWndWorld *)g_WndMng.m_pWndWorld)->m_bAutoAttack = TRUE;
    									}
    									//g_WndMng.UseSkillShortCut(lpShortcut->m_dwType ,lpShortcut->m_dwIndex);
    
    
    								}
    
    
    								//g_WndMng.ObjectExecutor( lpShortcut );
    							}else
    								((CWndWorld *)g_WndMng.m_pWndWorld)->m_bAutoAttack = TRUE;
    						}
    					}else
    					{
    						if (F1->GetCheck())
    						{
    							LPSHORTCUT lpShortcut = &pTaskBar->m_paSlotItem[ 0 ] ;
    							if (lpShortcut->IsEmpty() || lpShortcut->m_dwShortcut != SHORTCUT_SKILL)
    							{
    								((CWndWorld *)g_WndMng.m_pWndWorld)->m_bAutoAttack = TRUE;
    							}else
    							{
    								if (g_pPlayer->GetReuseDelay( lpShortcut->m_dwId )<=0)
    								{
    									//g_pPlayer->CMD_SetUseSkill( pMover->m_objid, lpShortcut->m_dwId );
    									g_WndMng.ObjectExecutor( lpShortcut );
    								}
    							}
    
    
    						}else
    							((CWndWorld *)g_WndMng.m_pWndWorld)->m_bAutoAttack = TRUE;
    					}
    				}else
    					g_WndMng.m_pWndWorld->UseSkill();
    			}
    
    
    		}else
    		{
    			//寻怪之前判断辅助状态
    			int j = 0;
    			for (unsigned int i=0;i<Skill.size();i++)
    			{
    				LPSKILL pSkill = g_pPlayer->GetSkill(0,Skill[i]);
    				ItemProp* pSkillProp = prj.GetSkillProp( pSkill->dwSkill );
    				if (pSkillProp)
    				{
    					CWndButton* pButton = (CWndButton*)GetDlgItem(100+j);
    					if (pButton->GetCheck() && !g_pPlayer->HasBuff(BUFF_SKILL,pSkillProp->dwID) &&
    						g_pPlayer->GetReuseDelay( Skill[i] )<=0 && !g_pPlayer->HasBuff(BUFF_SKILL,SI_BLD_SUP_BERSERK)
    						)
    					{
    						if( g_tmCurrent-m_CoolTime>2000)
    						{
    							g_pPlayer->CMD_SetUseSkill( g_pPlayer->m_objid, Skill[i] );
    							m_CoolTime = g_tmCurrent;
    							//使用技能后暂停2秒寻怪
    							if (pSkillProp->dwID == SI_RIN_SUP_MERKABAHANZELRUSHA)
    							{
    								s_CoolTime = -1;
    							}else if (s_CoolTime !=-1)
    							{
    								s_CoolTime = g_tmCurrent;
    							}
    
    
    
    
    							//CString str;
    							//str.Format("发送技能:%s ID:%d time:%d",pSkillProp->szName,pSkillProp->dwID,s_CoolTime);
    							//g_WndMng.PutString(str);
    						}
    
    
    
    
    						//g_DPlay.SendUseSkill(0,Skill[i],g_pPlayer->m_objid);
    					}
    					j++;
    				}
    			}
    			if (s_CoolTime!=-1 && g_tmCurrent - s_CoolTime > 2000)
    			{
    				CObj* pObj;
    				CCtrl *pSrc = g_pPlayer;
    				D3DXVECTOR3 vPos = g_pPlayer->GetPos();
    				BOOL	bApply;
    				BOOL	lApply;
    				FLOAT fRange =  20.0f; 
    				FLOAT nRange = 20.0f;
    				FLOAT nline = 20.0f;
    				fDist = 0.0f;
    				D3DXVECTOR3	vDist;
    				pSelectNEW = NULL;
    				//	if( nApplyType & (OBJTYPE_MONSTER | OBJTYPE_CTRL) )
    				{
    					FOR_LINKMAP( g_pPlayer->GetWorld(), vPos, pObj, (int)nRange, CObj::linkDynamic, GetLayer() )	// linkDynamic
    					{
    						D3DXVECTOR3 vStart = g_pPlayer->GetPos();			vStart.y += 0.5f;
    						D3DXVECTOR3 vEnd   = pObj->GetPos();	vEnd.y += 0.5f;
    						float ftemp;
    
    
    						bApply = TRUE;
    						lApply = TRUE;
    
    
    						if( pObj->GetType() == OT_MOVER && g_pPlayer->GetWorld()->IntersectObjLine( NULL, vStart, vEnd, FALSE, FALSE ) == FALSE)				
    						{
    
    
    							CMover *pTarget = (CMover *)pObj;
    							if(fanwei->GetCheck())//挂机范围选择
    							{
    								bApply = pTarget->IsRangeObj(vPos,fRange);
    							}
    							CWndButton* guishu = (CWndButton*)GetDlgItem(301);
    							if (guishu->GetCheck() && pTarget->m_idAttacker != NULL_ID && pTarget->m_idAttacker != g_pPlayer->GetId())
    							{			
    								CMover *pTmp = prj.GetMover(pTarget->m_idAttacker);
    								if (g_pPlayer->m_idparty && pTmp && pTmp->GetPartyId() == g_pPlayer->m_idparty)
    								{
    
    
    								}else
    								{
    									bApply = FALSE;
    								}
    
    
    							}
    
    
    							//寻怪等级选择
    							if(pTarget->GetLevel()>=MinLv && pTarget->GetLevel()<=MaxLv)
    							{
    								lApply = TRUE;
    							}else
    								lApply = FALSE;
    							if( pTarget->GetHitPoint() > 0 && pTarget->IsPeaceful() == FALSE  && pTarget->GetProp()->dwClass != RANK_GUARD && bApply && lApply)		// 不是和平模式的NPC
    							{
    
    
    								vDist = vStart - vEnd;
    								ftemp =  D3DXVec3LengthSq( &vDist );
    								if(fDist > 0 )//找到更近的怪物
    								{
    									if( fDist > ftemp)
    									{
    										fDist = ftemp;
    										pSelectNEW = (CMover *)pObj;
    									}
    								}else
    								{
    									fDist = ftemp;
    									pSelectNEW = (CMover *)pObj;
    								}
    							}
    
    
    						} 
    
    
    
    
    					}
    					END_LINKMAP
    
    
    						if(pSelectNEW)
    						{
    							pWorld->SetObjFocus( pSelectNEW );
    						}
    				}
    
    
    			}
    		}
    
    
    		////////////////////////以下使用物品和团技能///////////////////
    
    
    
    
    		for (unsigned int i=0;i<BuffItem.size();i++)
    		{
    			CWndButton* pButton = (CWndButton*)GetDlgItem(200+i);
    			DWORD dwId = g_pPlayer->m_Inventory.Find( BuffItem[i] );
    			if (dwId!=NULL_ID && pButton->GetCheck())
    			{
    				switch (BuffItem[i])
    				{
    				case II_CHR_SYS_SCR_UPCUTSTONE:
    					{
    						if (!(g_pPlayer->IsSMMode( SM_ATTACK_UP1 ) || g_pPlayer->IsSMMode( SM_ATTACK_UP )))
    						{
    							CItemBase* pItemBase = g_pPlayer->GetItemId(dwId);
    							g_DPlay.SendDoUseItem( MAKELONG( ITYPE_ITEM, pItemBase->m_dwObjId ), NULL_ID );
    						}
    
    
    					}break;
    				case II_SYS_SYS_SCR_VELOCIJUMP:
    					{
    						if (!(g_pPlayer->IsSMMode( SM_VELOCIJUMP )))
    						{
    							CItemBase* pItemBase = g_pPlayer->GetItemId(dwId);
    							g_DPlay.SendDoUseItem( MAKELONG( ITYPE_ITEM, pItemBase->m_dwObjId ), NULL_ID );
    						}
    					}break;
    				case II_CHR_SYS_SCR_ACTIVITION:
    					{
    						if (!(g_pPlayer->IsSMMode( SM_ACTPOINT )))
    						{
    							CItemBase* pItemBase = g_pPlayer->GetItemId(dwId);
    							g_DPlay.SendDoUseItem( MAKELONG( ITYPE_ITEM, pItemBase->m_dwObjId ), NULL_ID );
    						}
    					}break;
    				//case II_GEN_FOO_INS_STARCANDYA:
    				//case II_GEN_FOO_INS_STARCANDYB:
    				//case II_GEN_FOO_INS_STARCANDYC:
    				//	{
    				//		if (!(g_pPlayer->HasBuff(BUFF_ITEM3, BuffItem[i])))
    				//		{
    				//			CItemBase* pItemBase = g_pPlayer->GetItemId(dwId);
    				//			g_DPlay.SendDoUseItem( MAKELONG( ITYPE_ITEM, pItemBase->m_dwObjId ), NULL_ID );
    				//		}
    				//	}break;
    
    
    				default:if (!g_pPlayer->HasBuff(BUFF_ITEM,BuffItem[i]))
    						{
    							CItemBase* pItemBase = g_pPlayer->GetItemId(dwId);
    							g_DPlay.SendDoUseItem( MAKELONG( ITYPE_ITEM, pItemBase->m_dwObjId ), NULL_ID );
    						}break;
    				}
    
    
    			}
    		}
    		if (g_Party.GetSizeofMember()>0 && g_Party.IsLeader(g_pPlayer->m_idPlayer) && g_Party.m_nKindTroup == 1)
    		{
    			for (int i=0;i<2;i++)
    			{
    				CWndButton* pButton = (CWndButton*)GetDlgItem(400+i);
    				if (pButton->GetCheck())
    				{
    					ItemProp* pItemProp =  prj.GetPartySkill( partySkill[i]);
    					if (pItemProp)
    					{
    						if ((g_Party.GetLevel() - pItemProp->dwReqDisLV)>=0 && int(g_Party.GetPoint() - pItemProp->dwExp) >= 0)
    						{
    							DWORD	dwSkillTimeTmp = 0;
    							CWndWorld *pWndWorld = (CWndWorld *)g_WndMng.m_pWndWorld;
    
    
    							for( MAPBUFF::iterator t = pWndWorld->m_buffs.m_mapBuffs.begin(); t!= pWndWorld->m_buffs.m_mapBuffs.end(); ++t )
    							{
    								IBuff* ptr	= t->second;
    								if( ptr->GetId() == partySkill[i] )	
    									dwSkillTimeTmp = ptr->GetTotal();
    							}
    
    
    							if( dwSkillTimeTmp == 0)
    							{
    								g_DPlay.SendPartySkillUse( partySkill[i] );
    							}
    						}
    					}
    
    
    				}
    
    
    			}
    		}
    	}
    	return TRUE;
    }
    
    
    
    
    BOOL CWndRefresher::OnChildNotify( UINT message, UINT nID, LRESULT* pLResult )
    {
    	switch (nID)
    	{
    	case WIDC_BUTTON_REFRESH_START:// Start Refreshing
    		{ 
    			bStart = TRUE;
    			CWndButton* pButton2 = (CWndButton*)GetDlgItem(WIDC_BUTTON_REFRESH_STOP);
    			pButton2->EnableWindow(TRUE);
    			CWndButton* pButton1 = (CWndButton*)GetDlgItem(WIDC_BUTTON_REFRESH_START);
    			pButton1->EnableWindow(FALSE);
    			Move(-500.-500);
    			break;
    		}
    	case WIDC_BUTTON_REFRESH_STOP:// Stop Refreshing
    		{
    			bStart = FALSE;
    			CWndButton* pButton2 = (CWndButton*)GetDlgItem(WIDC_BUTTON_REFRESH_STOP);
    			pButton2->EnableWindow(FALSE);
    			CWndButton* pButton1 = (CWndButton*)GetDlgItem(WIDC_BUTTON_REFRESH_START);
    			pButton1->EnableWindow(TRUE);
    
    
    			break;
    		}
    	case WIDC_COMBOBOX1:
    		{
    			CWndComboBox* pCombo = (CWndComboBox*)GetDlgItem(WIDC_COMBOBOX1);
    			if (pCombo->GetCurSel() !=-1)
    			{
    				m_dwitemid[1] = pCombo->GetItemData(pCombo->GetCurSel());
    			}
    
    
    			break;
    		}
    	case WIDC_COMBOBOX2:
    		{
    			CWndComboBox* pCombo = (CWndComboBox*)GetDlgItem(WIDC_COMBOBOX2);
    			if (pCombo->GetCurSel() !=-1)
    			{
    				m_dwitemid[2] = pCombo->GetItemData(pCombo->GetCurSel());
    			}
    
    
    			break;
    		}
    	case WIDC_COMBOBOX:
    		{
    			CWndComboBox* pCombo = (CWndComboBox*)GetDlgItem(WIDC_COMBOBOX);
    			if (pCombo->GetCurSel() !=-1)
    			{
    				m_dwitemid[0] = pCombo->GetItemData(pCombo->GetCurSel());
    			}
    
    
    			break;
    		}
    
    
    	//case WIDC_BUTTON:
    	//	{
    
    
    
    
    	//		break;
    	//	}
    	case WIDC_RADIO:
    		{
    			CWndButton* pButton = (CWndButton*)GetDlgItem(WIDC_RADIO);
    			pButton->SetCheck(TRUE);
    			pButton = (CWndButton*)GetDlgItem(WIDC_RADIO1);
    			pButton->SetCheck(FALSE);
    			break;
    		}
    	case WIDC_RADIO1:
    		{
    			CWndButton* pButton = (CWndButton*)GetDlgItem(WIDC_RADIO1);
    			pButton->SetCheck(TRUE);
    			pButton = (CWndButton*)GetDlgItem(WIDC_RADIO);
    			pButton->SetCheck(FALSE);
    			break;
    		}
    	}
    	return CWndNeuz::OnChildNotify( message, nID, pLResult );
    }
    
    
    
    
    #endif


  2. #2
    Enthusiast Ketchup is offline
    MemberRank
    Jan 2009 Join Date
    25Posts

    Re: [HELP´] Auto Attack

    You need to check CBuffMgr for w/e you added as its listed as private instead of public.

  3. #3
    Member kikolindo is offline
    MemberRank
    Mar 2020 Join Date
    85Posts

    Re: [HELP´] Auto Attack

    @Ketchup is this system incomplete? because I didn't add anything related to CBuffMgr or it could be something that is already on my server?



Advertisement