Skip to content

Commit

Permalink
Address Discord comments
Browse files Browse the repository at this point in the history
- Remove SuspecisionActs for no boat process.
- Add `relative_direction` to boat move sysevent.
  • Loading branch information
KevinEady committed Nov 8, 2023
1 parent 5679494 commit 1bc934e
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 25 deletions.
18 changes: 10 additions & 8 deletions pol-core/pol/miscmsg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,22 +431,24 @@ void handle_msg_BF( Client* client, PKTBI_BF* msg )
break;
}

Module::UOExecutorModule* process = multi->process();
if ( !process )
if ( msg->boatmove.direction > 7 || msg->boatmove.speed > 2 )
{
SuspiciousActs::BoatMoveMultiNoRunningScript( client, multi->serial );
SuspiciousActs::BoatMoveOutOfRangeParameters( client, multi->serial, msg->boatmove.direction,
msg->boatmove.speed );
break;
}

if ( msg->boatmove.direction > 7 || msg->boatmove.speed > 2 )
Module::UOExecutorModule* process = multi->process();
if ( !process )
{
SuspiciousActs::BoatMoveOutOfRangeParameters( client, multi->serial, msg->boatmove.direction,
msg->boatmove.speed );
break;
}

process->uoexec().signal_event(
new Module::BoatMovementEvent( chr, msg->boatmove.speed, msg->boatmove.direction ) );
auto relative_direction =
static_cast<Core::UFACING>( ( msg->boatmove.direction + boat->boat_facing() ) & 7 );

process->uoexec().signal_event( new Module::BoatMovementEvent(
chr, msg->boatmove.speed, msg->boatmove.direction, relative_direction ) );

break;
}
Expand Down
11 changes: 0 additions & 11 deletions pol-core/pol/systems/suspiciousacts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,17 +147,6 @@ void SuspiciousActs::BoatMoveNotBoatMulti( Network::Client* client )
}
}

void SuspiciousActs::BoatMoveMultiNoRunningScript( Network::Client* client, u32 multi_serial )
{
if ( Plib::systemstate.config.show_warning_boat_move )
{
POLLOG_ERROR.Format(
"{}/{} tried to use a boat movement packet on a boat multi (serial 0x{:X}) that has no "
"running script.\n" )
<< client->acct->name() << client->chr->name() << multi_serial;
}
}

void SuspiciousActs::BoatMoveNotPilot( Network::Client* client, u32 multi_serial )
{
if ( Plib::systemstate.config.show_warning_boat_move )
Expand Down
4 changes: 1 addition & 3 deletions pol-core/pol/systems/suspiciousacts.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ void BoatMoveNotBoatMulti( Network::Client* client );
// boat movement packet without being on a boat multi
void BoatMoveNotPilot( Network::Client* client, u32 multi_serial );

// boat movement packet on boat multi with no running script
void BoatMoveMultiNoRunningScript( Network::Client* client, u32 multi_serial );

// boat movement packet used packet with direction > 7 or speed > 2
void BoatMoveOutOfRangeParameters( Network::Client* client, u32 multi_serial, u8 direction,
u8 speed );
} // namespace Pol::SuspiciousActs
Expand Down
5 changes: 3 additions & 2 deletions pol-core/pol/uoscrobj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4770,13 +4770,14 @@ BObjectImp* EClientRefObjImp::call_polmethod_id( const int id, Core::UOExecutor&
return base::call_polmethod_id( id, ex );
}

BoatMovementEvent::BoatMovementEvent( Mobile::Character* source, const u8 speed,
const u8 direction )
BoatMovementEvent::BoatMovementEvent( Mobile::Character* source, const u8 speed, const u8 direction,
const u8 relative_direction )
{
addMember( "type", new BLong( Core::EVID_BOAT_MOVEMENT ) );
addMember( "source", new Module::EOfflineCharacterRefObjImp( source ) );
addMember( "speed", new BLong( static_cast<int>( speed ) ) );
addMember( "direction", new BLong( static_cast<int>( direction ) ) );
addMember( "relative_direction", new BLong( static_cast<int>( relative_direction ) ) );
}

SourcedEvent::SourcedEvent( Core::EVENTID type, Mobile::Character* source )
Expand Down
3 changes: 2 additions & 1 deletion pol-core/pol/uoscrobj.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,8 @@ class DamageEvent final : public Bscript::BStruct
class BoatMovementEvent : public Bscript::BStruct
{
public:
BoatMovementEvent( Mobile::Character* source, const u8 speed, const u8 direction );
BoatMovementEvent( Mobile::Character* source, const u8 speed, const u8 direction,
const u8 relative_direction );
};

class SourcedEvent : public Bscript::BStruct
Expand Down

0 comments on commit 1bc934e

Please sign in to comment.