[TUT]How to Cross Bow

12/31/2011 19:07 max982#1
Hello :)
Happy new year

i found this on my computer so im gona share it :D
it works 100% (this one is the same used in flyforglory)

this code will make you the crossbow to work like on an official server

Code:
IN DPClient.cpp
---------------------------------
Replace
-----------
	if( pItemBase->GetProp()->dwParts == PARTS_RWEAPON )
	{
		CItemElem* pItemElemWepon = g_pPlayer->m_Inventory.GetEquip( PARTS_RWEAPON	);
		if( pItemElemWepon && pItemElemWepon->GetProp()->dwItemKind3 == IK3_BOW ) 
		{
			if( pItemBase->GetProp()->dwItemKind3 != IK3_BOW )	// 장착되어있는것이 보우면 안벗겨두 됨
			{
				CItemElem* pItemElemBullet = g_pPlayer->m_Inventory.GetEquip( PARTS_BULLET );	
				if( pItemElemBullet && pItemElemBullet->GetProp()->dwItemKind3 == IK3_ARROW )
				{
					BEFORESENDSOLE( ar, PACKETTYPE_DOUSEITEM, DPID_UNKNOWN );
					ar << MAKELONG( ITYPE_ITEM, pItemElemBullet->m_dwObjId );
					ar << pItemElemBullet->m_dwObjId;
					ar << PARTS_BULLET;
					SEND( ar, this, DPID_SERVERPLAYER );
				}			
			}
		}
	}

-----------------------
with:
-----------------------
	if( pItemElem->GetProp()->dwParts == PARTS_RWEAPON )
	{
		CItemElem* pItemElemWepon = g_pPlayer->m_Inventory.GetEquip( PARTS_RWEAPON	);
		if( pItemElemWepon && ( pItemElemWepon->GetProp()->dwItemKind3 == IK3_BOW || pItemElemWepon->GetProp()->dwItemKind3 == IK3_CROSSBOW ) ) // 장착되어있는것이 활이면
		{
			if( pItemElem->GetProp()->dwItemKind3 != IK3_BOW || pItemElem->GetProp()->dwItemKind3 != IK3_CROSSBOW )	// 장착되어있는것이 보우면 안벗겨두 됨
			{
				CItemElem* pItemElemBullet = g_pPlayer->m_Inventory.GetEquip( PARTS_BULLET );	
				if( pItemElemBullet && pItemElemBullet->GetProp()->dwItemKind3 == IK3_ARROW )
				{
					BEFORESENDSOLE( ar, PACKETTYPE_DOEQUIP, DPID_UNKNOWN );
					ar << pItemElemBullet->m_dwObjId;
					ar << PARTS_BULLET;
					SEND( ar, this, DPID_SERVERPLAYER );
				}			
			}
		}
	
	}


------------------
WndWorld.cpp
--------------------
replace:
--------------------
					if( pItemProp->dwItemKind3 == IK3_BOW  )
						g_pPlayer->CMD_SetRangeAttack( idTarget, nPower );	


------------------
with:
------------------
					if( pItemProp->dwItemKind3 == IK3_BOW || pItemProp->dwItemKind3 == IK3_CROSSBOW )
						g_pPlayer->CMD_SetRangeAttack( idTarget, nPower );	


-----------------
replace:
------------------
				if( pItemElem && (pItemElem->GetProp()->dwItemKind3 == IK3_BOW ) )
				{
					if( !m_bLButtonDown )
						g_pPlayer->CMD_SetRangeAttack( pFocusObj->GetId(), 0 );		// 원거리공격 패턴에 들어감 
				}
------------------
with:
------------------
				if( pItemElem && (pItemElem->GetProp()->dwItemKind3 == IK3_BOW || pItemElem->GetProp()->dwItemKind3 == IK3_CROSSBOW) )
				{
					if( !m_bLButtonDown )
						g_pPlayer->CMD_SetRangeAttack( pFocusObj->GetId(), 0 );		// 원거리공격 패턴에 들어감 
				}

-------------------
after
-------------------
			case IK3_BOW:
				m_dwPowerTick = ::GetTickCount() + POWER_ATK_DELAY;
				g_pPlayer->CMD_SetRangeAttack( idTarget, nPower );		
				break;
--------------------
add
--------------------
			case IK3_CROSSBOW:
				m_dwPowerTick = ::GetTickCount() + POWER_ATK_DELAY;
				g_pPlayer->CMD_SetRangeAttack( idTarget, nPower );		
				break;
---------------------
after
---------------------
	if( pItemElem && pItemElem->GetProp()->dwItemKind3 == IK3_BOW ) 
	{
		// 그리고 왼쪽 버튼을 누르고 포커스가 있어야한다. 그래야 마법 타이밍 작동하니까.
		if( pFocus && pFocus->GetType() == OT_MOVER && g_pPlayer->IsLive() )
		{
			bRenderGauge = TRUE;
			if( m_bLButtonDown && m_bSelectTarget )
			{
				if( nPower >= MAX_CHARGE_LEVEL )			// 맥스치가 되면 자동으로 발사됨.
					dwShootItemKind = IK3_BOW;
			}
		}
	}

-----------------------
add
------------------------
	if( pItemElem && pItemElem->GetProp()->dwItemKind3 == IK3_CROSSBOW ) 
	{
		// 그리고 왼쪽 버튼을 누르고 포커스가 있어야한다. 그래야 마법 타이밍 작동하니까.
		if( pFocus && pFocus->GetType() == OT_MOVER && g_pPlayer->IsLive() )
		{
			bRenderGauge = TRUE;
			if( m_bLButtonDown && m_bSelectTarget )
			{
				if( nPower >= MAX_CHARGE_LEVEL )			// 맥스치가 되면 자동으로 발사됨.
					dwShootItemKind = IK3_CROSSBOW;
			}
		}
	}

---------------------------
WndField.cpp
----------------------------
replace
----------------------------
	else if(m_pItemElem->GetProp()->dwItemKind3 == IK3_YOYO ||
			m_pItemElem->GetProp()->dwItemKind3 == IK3_KNUCKLEHAMMER ||
			m_pItemElem->GetProp()->dwItemKind3 == IK3_BOW)
----------------------------
with
---------------------------
	else if(m_pItemElem->GetProp()->dwItemKind3 == IK3_YOYO ||
			m_pItemElem->GetProp()->dwItemKind3 == IK3_KNUCKLEHAMMER ||
			m_pItemElem->GetProp()->dwItemKind3 == IK3_BOW ||
			m_pItemElem->GetProp()->dwItemKind3 == IK3_CROSSBOW)


------------------------------
Project.cpp
-----------------------------
After
----------------------------
	switch( dwItemKind3 )
	{
	case IK3_SWD:
	case IK3_CHEERSTICK:
	case IK3_WAND:	
	case IK3_AXE:
	case IK3_KNUCKLEHAMMER:
	case IK3_STAFF:
	case IK3_YOYO: 
	case IK3_BOW:
----------------------------
add
----------------------------
	case IK3_CROSSBOW:


-----------------------------
Moverskill.cpp
-----------------------------
replace
----------------------------
	case IK3_YOBO:
		if( dwItemKind3 != IK3_YOYO && dwItemKind3 != IK3_BOW  )	
		{
			if( IsPlayer() )
				( (CUser*)this )->AddDefinedText( TID_GAME_WRONGITEM, "" );
			return FALSE;
		}
		break;

-----------------------------
with
-----------------------------

	case IK3_YOBO:
		if( dwItemKind3 != IK3_YOYO && dwItemKind3 != IK3_BOW && dwItemKind3 != IK3_CROSSBOW  )	
		{
			if( IsPlayer() )
				( (CUser*)this )->AddDefinedText( TID_GAME_WRONGITEM, "" );
			return FALSE;
		}
		break;

-------------------------
MoverMsg.cpp
-------------------
replace
--------------------
	if( pItemProp->dwItemKind3 != IK3_BOW  )	// 들고있는 무기가 보우가 아니면 에러
		return;

--------------------
with
-------------------
	if( pItemProp->dwItemKind3 != IK3_BOW && pItemProp->dwItemKind3 != IK3_CROSSBOW )	// 들고있는 무기가 보우가 아니면 에러
		return;

--------------------
MoverEquip.cpp
---------------------
replace
-----------------------
	// �*살을 착용하려 했을때 보우일때만 착용돼야 함
	if( pItemProp->dwItemKind3 == IK3_ARROW && ( pHandItemProp == NULL ||  pHandItemProp->dwItemKind3 != IK3_BOW  ) )
		return FALSE;			

---------------------
with
----------------
	// �*살을 착용하려 했을때 보우일때만 착용돼야 함
	if( pItemProp->dwItemKind3 == IK3_ARROW && ( pHandItemProp == NULL || ( pHandItemProp->dwItemKind3 != IK3_BOW && pHandItemProp->dwItemKind3 != IK3_CROSSBOW )) )
		return FALSE;			

-------------------
after
-----------------
				case IK3_BOW:
					((CModelObject*)pModel)->SetParent( PARTS_RWEAPON, ((CModelObject*)pModel)->GetLHandIdx() );
					break;

----------------
add
---------------
				case IK3_CROSSBOW:
					((CModelObject*)pModel)->SetParent( PARTS_RWEAPON, ((CModelObject*)pModel)->GetRHandIdx() );
					break;

---------------
after
----------------
					case IK3_BOW:
						((CModelObject*)pModel)->SetParent( PARTS_RWEAPON, ((CModelObject*)pModel)->GetLHandIdx() );
						break;
--------------
add
----------------

					case IK3_CROSSBOW:
						((CModelObject*)pModel)->SetParent( PARTS_RWEAPON, ((CModelObject*)pModel)->GetRHandIdx() );
						break;

--------------
Mover.cpp
--------------
replace
---------------
		if( pItemProp->dwItemKind3 == IK3_BOW || pItemProp->dwLinkKind == IK3_BOW )
		{
			dwTip = TID_TIP_NEEDSATTACKITEM;			
		}

--------------
with
---------------

		if( pItemProp->dwItemKind3 == IK3_BOW || pItemProp->dwLinkKind == IK3_BOW || pItemProp->dwItemKind3 == IK3_CROSSBOW || pItemProp->dwLinkKind == IK3_CROSSBOW )
		{
			dwTip = TID_TIP_NEEDSATTACKITEM;			
		}


------------------
after
----------------
				case IK3_BOW: 
					if( !bMasterPlayer ) dwMotion += MTI_STAND_13;
					else dwMotion += 200;
					break;
------------------
add
-------------------
				case IK3_CROSSBOW: 
     					   if( !bMasterPlayer ) dwMotion += MTI_STAND_15;
     					   else dwMotion += 200;
      					  break;


--------------------
Ctrl.cpp
---------------------
Replace
--------------------

			if( pSkillProp->dwLinkKind == IK3_BOW )
			{
				CModelObject *pModel = (CModelObject *)m_pModel;
				pModel->GetHandPos( &vPos, PARTS_LWEAPON, GetMatrixWorld() );		// 주먹 월드좌표 구함		
				vPos.y -=	1.0f;
			}

------------------
with
------------------
			if( pSkillProp->dwLinkKind == IK3_BOW || pSkillProp->dwLinkKind == IK3_CROSSBOW )
			{
				CModelObject *pModel = (CModelObject *)m_pModel;
				pModel->GetHandPos( &vPos, PARTS_LWEAPON, GetMatrixWorld() );		// 주먹 월드좌표 구함		
				vPos.y -=	1.0f;
			}



---------------------
ActionMovermsg.cpp
-------------------------
replace
---------------------------

				CItemElem* pItemElem = pMover->GetWeaponItem();
				if( pItemElem && (pItemElem->GetProp()->dwItemKind3 == IK3_WAND || pItemElem->GetProp()->dwItemKind3 == IK3_BOW ) )
					return -2;

------------------------------
with
-----------------------------

				CItemElem* pItemElem = pMover->GetWeaponItem();
				if( pItemElem && (pItemElem->GetProp()->dwItemKind3 == IK3_WAND || pItemElem->GetProp()->dwItemKind3 == IK3_BOW || pItemElem->GetProp()->dwItemKind3 == IK3_MAGICBARUNA || pItemElem->GetProp()->dwItemKind3 == IK3_CROSSBOW ) )
					return -2;
Have fun and if it helped you
press thanks :D
12/31/2011 19:18 Yasunai#2
Whats the Reason for this Thread?

And Thanks Happy New Year too.

Yours sencierly

Yasunai
12/31/2011 19:30 max982#3
this code will make you the crossbow to work like on an official server
i forgot to add it XD
12/31/2011 19:34 Yasunai#4
Okay ;) Thank you.
You got a thanks,
but i don't need it :D
12/31/2011 21:15 Jacksx3#5
Cool you became a thanks ! !
01/01/2012 03:14 N8Schatten#6
ich checke es net nochma auf deutsch Bitte.
Der Code macht den Bogen wie bei Offi richtig?
aber wo is der unterschied zu "unseren" Bisherigen B�gen??
01/01/2012 15:10 Flash!#7
Quote:
Originally Posted by N8Schatten View Post
ich checke es net nochma auf deutsch Bitte.
Der Code macht den Bogen wie bei Offi richtig?
aber wo is der unterschied zu "unseren" Bisherigen B�gen??
Mit dem neuen Crossbow steht man normalerweise anders, l�uft man anders
(wie ein Soldat, sieht echt lustig aus) und die "Schie�-Animation" hat sich ver�ndert. Nur wenige Server haben es wirklich eingebaut, einige kennen es nichtmal.
01/02/2012 02:50 yannickFlyff#8
Man saugt sich Etiooms source und hat es scheis leaker lol.