New flying system

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:
Talos Meliora - New flying system - RaGEZONE Forums

Talos Meliora - New flying system - RaGEZONE Forums

Talos Meliora - New flying system - RaGEZONE Forums


#define __FLYING_NEW_SYSTEM

Code:
DPClient.cpp
Search for:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
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:
Code:
public:
      CMover();
      virtual     ~CMover();

Add above:
Code:
#ifdef __FLYING_NEW_SYSTEM
public:
      int m_nFlyMode;
#endif
 
Last edited:
nice release thanks homes!

Where do you add SetStopFlying?
 
Last edited:
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:
Talos Meliora - New flying system - RaGEZONE Forums

Talos Meliora - New flying system - RaGEZONE Forums

Talos Meliora - New flying system - RaGEZONE Forums


#define __FLYING_NEW_SYSTEM

Code:
DPClient.cpp
Search for:
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:
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:
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:
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:
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:
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:
Code:
m_dwCtrlReadyTime

Add above:
Code:
#ifdef __FLYING_NEW_SYSTEM
      int                     m_nFlyMode;
#endif

MoverEquip.cpp

Search for:
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:
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:
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:
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:
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:
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:
Code:
public:
      CMover();
      virtual     ~CMover();

Add above:
Code:
#ifdef __FLYING_NEW_SYSTEM
public:
      int m_nFlyMode;
#endif


A few remarks from me:

Sending the item’s ID from the client isn’t a great idea
Also, constantly calling GetProp() isn’t a great idea, since it incurs an unnecessary lookup
Ideally, remove all checks from the WndWorld and put them on the server

WndWorld.cpp
C++:
        CItemElem* elem = g_pPlayer->m_Inventory.GetEquip(PARTS_RIDE);
        if(IsUsableItem(elem)) {
            ItemProp* prop = elem->GetProp();
            if(prop->dwItemKind3 == IK3_STICK || prop->dwItemKind3 == IK3_BOARD || prop->dwItemKind3 == IK3_WING) {
                std::string str;
                if(!g_pPlayer->GetWorld()->m_bFly || g_pPlayer->GetWorld()->GetHeightAttribute(g_pPlayer->GetPos().x, g_pPlayer->GetPos().z) == HATTR_NOFLY) {
                    g_DPlay.SendUpdateFlying(1);
                    str = "You're not allowed to fly here!";
                }
                else if(g_pPlayer->IsChaotic()) {
                    g_DPlay.SendUpdateFlying(1);
                    str = "You can't fly!";
                }
                else if(g_pPlayer->IsAttackMode()) {
                    g_DPlay.SendUpdateFlying(1);
                    str = "You can't fly while attacking!";
                }
                else if(g_pPlayer->HasBuffByIk3(IK3_TEXT_DISGUISE)) {
                    g_DPlay.SendUpdateFlying(1);
                    str = "You can't fly while transforming!";
                }
                else if(g_pPlayer->IsFly()) {
                    g_DPlay.SendUpdateFlying(1);
                    str = "Flying de-activated!"; // If you want, comment on this
                }
                else {
                    g_DPlay.SendUpdateFlying(0);
                    str = "Flying activated!"; // If you want, comment on this
                }
                if(!str.empty())
                    g_WndMng.PutString(str.c_str(), NULL, 0xffff0000);
            }
        }


In DPSrvr.cpp for example:
C++:
void CDPSrvr::OnFlyingChange(CAr& ar, DPID dpidCache, DPID dpidUser, LPBYTE lpBuf, u_long uBufSize) {
    int nFlyMode;
    CUser* pUser = g_UserMng.GetUser(dpidCache, dpidUser);
    ar >> nFlyMode;
    if(!IsValidObj(pUser))
        return;
    CMover* mover = static_cast<CMover*>(pUser);
    CItemElem* elem = pUser->m_Inventory.GetEquip(PARTS_RIDE);
    if(IsUsableItem(elem)) {
        mover->m_nFlyMode = nFlyMode;
        mover->IsAttackMode();
        if(nFlyMode == 1) {
            if(mover->m_pActMover) {
                mover->m_pActMover->SendActMsg(OBJMSG_MODE_GROUND, elem->m_dwItemId, 0, 1);
                mover->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();
            if(mover->m_pActMover) {
                mover->m_pActMover->SendActMsg(OBJMSG_MODE_FLY, elem->m_dwItemId, 0, 1);
                mover->m_pActMover->AddStateFlag(OBJSTAF_FLY);
            }
            pUser->ClearDest();
        }
        g_UserMng.UpdateFlying(pUser, nFlyMode, elem->m_dwItemId);
    }
}

I don’t know exactly what g_pPlayer->SetStopFlying() does, but I’m guessing it resets OBJMSG_MODE_GROUND and clears the OBJSTAF_FLY flag. If that’s the case, then:


It’s also better to update OBJMSG_MODE_GROUND on the server side:
OBJMSG_DIE in ActionMoverMsg2 i think
C++:
#ifdef __FLYING_NEW_SYSTEM
                if(pAttacker->IsPlayer() && pAttacker->m_pActMover) {
                    CItemElem* elem = pAttacker->m_Inventory.GetEquip(PARTS_RIDE);
                    if(IsUsableItem(elem)) {
                        pAttacker->m_pActMover->SendActMsg(OBJMSG_MODE_GROUND, elem->m_dwItemId, 0, 1);
                        pAttacker->m_pActMover->RemoveStateFlag(OBJSTAF_FLY);
                        pAttacker->ClearDest();
                    }
                }
#endif


Also, if you don’t want the ride to be unequipped after death or when entering a HATTR_NOFLY zone, you should disable UnequipRide()
 
And also to consider. It will take model editing if its beyond the Ancient weapons i believe(could be wrong). As that's right before the new glows were put in game no weapons beyond that will support the old glows.
 
I think he will also have to add some stuff with the DB for it to work am I correct? if he will add __OLDNEWGLOW
 
No, But can we get back on topic and not hijack this thread for something completely off topic? Open a help thread if you need further assistance.
 
A few remarks from me:

Sending the item’s ID from the client isn’t a great idea
Also, constantly calling GetProp() isn’t a great idea, since it incurs an unnecessary lookup
Ideally, remove all checks from the WndWorld and put them on the server

Thank you for the remarks. When I have time I will update this system and thread.
 
Non, mais pouvons-nous revenir au sujet et éviter de détourner ce fil de discussion pour un sujet complètement hors sujet ? Ouvrez un fil d'aide si vous avez besoin d'aide.
:hotpotato: 👌, Apparemment, les fils d'aide ne sont pas utilisés très souvent ici :')
 
Back