Newbie Spellweaver
- Joined
- Dec 10, 2021
- Messages
- 23
- Reaction score
- 37
This system is from Alysia Online (__WING_SYSTEM)
This code has been tested in Ketchup's clean v15
I modified the code + fixed some stuff.
Preview:
#define __FLYING_NEW_SYSTEM
Code:
This code has been tested in Ketchup's clean v15
I modified the code + fixed some stuff.
Preview:
#define __FLYING_NEW_SYSTEM
Code:
DPClient.cpp
DPClient.h
DPSrvr.cpp
DPSrvr.h
User.cpp
User.h
Mover.cpp
Mover.h
MoverEquip.cpp
MoverRender.cpp
ObjSerializeOpt.cpp
WndWorld.cpp
MsgHdr.h
Obj.cpp
Obj.h
Search for:
Add at the end in if statement "if( IsValidObj( (CObj*)pMover ) )"":
Search for:
Add in "OnSnapshot":
Search for:
Add above:
Search for:
Add above:
Code:
CDPClient::OnMoverDeath
Add at the end in if statement "if( IsValidObj( (CObj*)pMover ) )"":
Code:
#ifdef __FLYING_NEW_SYSTEM
if (pAttacker == g_pPlayer && g_pPlayer->IsFly())
{
g_pPlayer->SetStopFlying();
SendPlayerBehavior();
}
#endif
Search for:
Code:
CDPClient::OnWorldMsg
Add in "OnSnapshot":
Code:
#ifdef __FLYING_NEW_SYSTEM
case SNAPSHOTTYPE_UPDATEFLYING: OnUpdateFlying(objid, ar); break;
#endif
Search for:
Code:
II_SYS_SYS_SCR_PARTYSUMMON
Add above:
Code:
#ifdef __FLYING_NEW_SYSTEM
if (pItemProp->dwItemKind3 == IK3_STICK
|| pItemProp->dwItemKind3 == IK3_BOARD
|| pItemProp->dwItemKind3 == IK3_WING)
{
if (!g_pPlayer->m_Inventory.GetEquip(PARTS_RIDE))
{
g_WndMng.PutString(("Flying item equiped, use SHIFT to toggle flying!"), NULL, 0xff00ff00);
}
}
#endif
Search for:
Code:
g_DPlay
Add above:
Code:
#ifdef __FLYING_NEW_SYSTEM
void CDPClient::SendUpdateFlying(int m_nFlyMode, DWORD dwID)
{
if (IsValidObj(g_pPlayer))
{
g_pPlayer->m_nFlyMode = m_nFlyMode;
}
BEFORESENDSOLE(ar, PACKETTYPE_UPDATE_FLYING, DPID_UNKNOWN);
ar << m_nFlyMode << dwID;
SEND(ar, this, DPID_SERVERPLAYER);
}
void CDPClient::OnUpdateFlying(OBJID objid, CAr& ar)
{
int nFlyMode;
DWORD dwID;
ar >> nFlyMode >> dwID;
CCtrl* pCtrl = prj.GetCtrl(objid);
if (IsValidObj((CObj*)pCtrl))
{
CMover* pMover = (CMover*)pCtrl;
pMover->m_nFlyMode = nFlyMode;
if (nFlyMode == 1)
{
pMover->SendActMsg(OBJMSG_MODE_GROUND, dwID, 0, 1);
pMover->ClearDest();
}
else if (nFlyMode == 0)
{
pMover->SendActMsg(OBJMSG_MODE_FLY, dwID, 0, 1);
pMover->ClearDest();
}
}
}
#endif
DPClient.h
Search for:
Add above:
Code:
OnShout
Add above:
Code:
#ifdef __FLYING_NEW_SYSTEM
void OnUpdateFlying(OBJID objid, CAr& ar);
void SendUpdateFlying(int m_nFlyMode, DWORD dwID);
#endif
DPSrvr.cpp
Search for:
Add above:
Scroll all the way down the file and add:
Code:
}
CDPSrvr::~CDPSrvr()
Add above:
Code:
#ifdef __FLYING_NEW_SYSTEM
ON_MSG(PACKETTYPE_UPDATE_FLYING, &CDPSrvr::OnFlyingChange);
#endif
Scroll all the way down the file and add:
Code:
#ifdef __FLYING_NEW_SYSTEM
void CDPSrvr::OnFlyingChange(CAr& ar, DPID dpidCache, DPID dpidUser, LPBYTE lpBuf, u_long uBufSize)
{
int nFlyMode;
DWORD dwID;
CUser* pUser = g_UserMng.GetUser(dpidCache, dpidUser);
ar >> nFlyMode >> dwID;
CString str;
if (pUser)
{
if (((CMover*)pUser))
{
((CMover*)pUser)->m_nFlyMode = nFlyMode;
((CMover*)pUser)->IsAttackMode();
if (nFlyMode == 1)
{
((CMover*)pUser)->m_pActMover->SendActMsg(OBJMSG_MODE_GROUND, dwID, 0, 1);
((CMover*)pUser)->m_pActMover->RemoveStateFlag(OBJSTAF_FLY);
pUser->ClearDest();
}
else if (nFlyMode == 0)
{
if (pUser->HasActivatedSystemPet())
{
pUser->PetRelease();
}
if (pUser->HasActivatedEatPet())
{
CMover* pEatPet = prj.GetMover(pUser->GetEatPetId());
if (IsValidObj(pEatPet))
{
pUser->InactivateEatPet();
}
}
if (pUser->HasPet())
{
pUser->RemovePet();
}
((CMover*)pUser)->m_pActMover->SendActMsg(OBJMSG_MODE_FLY, dwID, 0, 1);
((CMover*)pUser)->m_pActMover->AddStateFlag(OBJSTAF_FLY);
pUser->ClearDest();
}
g_UserMng.UpdateFlying(pUser, nFlyMode, dwID);
}
else
{
pUser->AddText("Something went terribly wrong");
}
}
}
#endif
DPSrvr.h
Search for:
Add above:
Code:
private:
DPID m_dpidCache;
Add above:
Code:
#ifdef __FLYING_NEW_SYSTEM
void OnFlyingChange(CAr& ar, DPID dpidCache, DPID dpidUser, LPBYTE lpBuf, u_long uBufSize);
#endif
User.cpp
Scroll all the way down the file and add:
Code:
#ifdef __FLYING_NEW_SYSTEM
void CUserMng::UpdateFlying(CUser* pUser, int m_nFlyMode, DWORD dwID)
{
CAr arBlock;
arBlock << pUser->GetId() << SNAPSHOTTYPE_UPDATEFLYING;
arBlock << m_nFlyMode;
arBlock << dwID;
GETBLOCK(arBlock, lpBlock, uBlockSize);
FOR_VISIBILITYRANGE(pUser)
{
USERPTR->AddBlock(lpBlock, uBlockSize);
}
NEXT_VISIBILITYRANGE(pUser)
}
#endif
User.h
Search for:
Add above:
Code:
};
#endif // __USER_H__
Add above:
Code:
#ifdef __FLYING_NEW_SYSTEM
void UpdateFlying(CUser* pUser, int m_nFlyMode, DWORD dwID);
#endif
Mover.cpp
Search for:
Disable this code:
Code:
TID_ERROR_NOFLY
Disable this code:
Code:
#ifndef __FLYING_NEW_SYSTEM
int nAttr = pWorld->GetHeightAttribute( GetPos().x, GetPos().z );
if( !pWorld->m_bFly || nAttr == HATTR_NOFLY )
{
PrintString( this, TID_ERROR_NOFLY );
return FALSE;
}
#endif
Mover.h
Search for:
Add above:
Search for:
Add below:
Code:
m_dwCtrlReadyTime
Add above:
Code:
#ifdef __FLYING_NEW_SYSTEM
int m_nFlyMode;
#endif
Search for:
Code:
SetStop()
Add below:
Code:
#ifdef __FLYING_NEW_SYSTEM
void SetStopFlying() { SendActMsg(OBJMSG_MODE_GROUND); ClearDestObj(); }
#endif
MoverEquip.cpp
Search for:
Disable this code:
Search for:
Disable this code:
Search for:
2 TIMES -> disable this code:
1 TIME -> disable this code:
Search for:
Scroll up, add this code:
Code:
TID_ERROR_NOFLY
Disable this code:
Code:
#ifndef __FLYING_NEW_SYSTEM
if( !pWorld->m_bFly )
{
#ifdef __WORLDSERVER
( (CUser*)this )->AddDefinedText( TID_ERROR_NOFLY, "" );
#else // __WORLDSERVER
g_WndMng.PutString( prj.GetText( TID_ERROR_NOFLY ), NULL, prj.GetTextColor( TID_ERROR_NOFLY ) );
#endif // __WORLDSERVER
return FALSE;
}
#endif
Search for:
Code:
OBJSTA_STAND
Disable this code:
Code:
#ifndef __FLYING_NEW_SYSTEM
if( nAttr == HATTR_NOFLY )
return FALSE;
#ifdef __WORLDSERVER
if( m_pActMover->IsState( OBJSTA_STAND ) == FALSE )
return FALSE;
#endif
#endif
Search for:
Code:
OBJMSG_MODE_FLY
2 TIMES -> disable this code:
Code:
#ifndef __FLYING_NEW_SYSTEM
SendActMsg( OBJMSG_MODE_FLY, pItemProp->dwID, 0, 1 );
#endif
1 TIME -> disable this code:
Code:
#ifndef __FLYING_NEW_SYSTEM
SendActMsg( OBJMSG_MODE_FLY, pProp->dwID, 0, 1 );
#endif
Search for:
Code:
CMover::InvalidEquipOff
Scroll up, add this code:
Code:
if( i == PARTS_RIDE )
{
if( m_pActMover->IsFly() )
{
SendActMsg( OBJMSG_MODE_GROUND, 0, 0, 1 );
#ifdef __FLYING_NEW_SYSTEM
ClearDest();
#endif
}
if( m_dwRideItemIdx != 0 )
{
m_dwRideItemIdx = 0;
}
if( m_Inventory.GetEquip( i ) )
{
m_Inventory.UnEquip( i );
}
}
MoverRender.cpp
Search for:
Above change this code:
Code:
IK3_STICK
Above change this code:
Code:
#ifdef __FLYING_NEW_SYSTEM
if (m_pRide)
#else
if( m_pRide && m_pActMover->IsFly() )
#endif
ObjSerializeOpt.cpp
Search for:
Add above:
Search for:
Add above:
Code:
m_idGuild > 0
Add above:
Code:
#ifdef __FLYING_NEW_SYSTEM
ar << m_nFlyMode;
#endif
Search for:
Code:
u_char u1;
Add above:
Code:
#ifdef __FLYING_NEW_SYSTEM
ar >> m_nFlyMode;
#endif
WndWorld.cpp
Search for:
Add above:
Code:
if(nChar == VK_SHIFT && m_bShiftPushed != FALSE)
Add above:
Code:
#ifdef __FLYING_NEW_SYSTEM
if (nChar == VK_SHIFT)
{
CItemElem* pItemProp2 = g_pPlayer->m_Inventory.GetEquip(PARTS_RIDE);
if (pItemProp2)
{
if (pItemProp2->GetProp()->dwItemKind3 == IK3_STICK
|| pItemProp2->GetProp()->dwItemKind3 == IK3_BOARD
|| pItemProp2->GetProp()->dwItemKind3 == IK3_WING)
{
if (g_pPlayer->GetWorld()->m_bFly == FALSE
|| g_pPlayer->GetWorld()->GetHeightAttribute(g_pPlayer->GetPos().x, g_pPlayer->GetPos().z) == HATTR_NOFLY)
{
g_DPlay.SendUpdateFlying(1, pItemProp2->GetProp()->dwID);
g_WndMng.PutString("You're not allowed to fly here!", NULL, 0xffff0000);
}
else if (g_pPlayer->IsChaotic())
{
g_DPlay.SendUpdateFlying(1, pItemProp2->GetProp()->dwID);
g_WndMng.PutString("You can't fly!", NULL, 0xffff0000);
}
else if (g_pPlayer->IsAttackMode())
{
g_DPlay.SendUpdateFlying(1, pItemProp2->GetProp()->dwID);
g_WndMng.PutString("You can't fly while attacking!", NULL, 0xffff0000);
}
else if (g_pPlayer->HasBuffByIk3(IK3_TEXT_DISGUISE))
{
g_DPlay.SendUpdateFlying(1, pItemProp2->GetProp()->dwID);
g_WndMng.PutString("You can't fly while transforming!", NULL, 0xffff0000);
}
else if (g_pPlayer->IsFly())
{
g_DPlay.SendUpdateFlying(1, pItemProp2->GetProp()->dwID);
g_WndMng.PutString("Flying de-activated!", NULL, 0xff00ff00);
}
else
{
g_DPlay.SendUpdateFlying(0, pItemProp2->GetProp()->dwID);
g_WndMng.PutString("Flying activated!", NULL, 0xff00ff00);
}
}
}
}
#endif
MsgHdr.h
Search for the last:
Add underneath:
Search for the last:
Add underneath:
Code:
#define PACKETTYPE_
Add underneath:
Code:
#ifdef __FLYING_NEW_SYSTEM
#define PACKETTYPE_UPDATE_FLYING (DWORD)0x88100350
#endif
Search for the last:
Code:
#define SNAPSHOTTYPE
Add underneath:
Code:
#ifdef __FLYING_NEW_SYSTEM
#define SNAPSHOTTYPE_UPDATEFLYING (WORD)0x8950
#endif
Obj.cpp
Search for:
Add above:
Search for:
Add above:
Code:
if( bAll )
{
m_Inventory.Copy( pMover->m_Inventory );
Add above:
Code:
#ifdef __FLYING_NEW_SYSTEM
m_nFlyMode = pMover->m_nFlyMode;
#endif
Search for:
Code:
}
}
void CMover::PeriodTick( void )
Add above:
Code:
#ifdef __FLYING_NEW_SYSTEM
m_nFlyMode = pMover->m_nFlyMode;
#endif
Obj.h
Search for:
Add above:
Code:
public:
CMover();
virtual ~CMover();
Add above:
Code:
#ifdef __FLYING_NEW_SYSTEM
public:
int m_nFlyMode;
#endif
Last edited:

