Skip to content

Commit

Permalink
Move remaining drop errors to suspicious acts (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinEady committed Aug 14, 2021
1 parent 3bd1fdd commit 0db4b97
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 9 deletions.
7 changes: 6 additions & 1 deletion docs/docs.polserver.com/pol100/corechanges.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@
<ESCRIPT>
<header>
<topic>Latest Core Changes</topic>
<datemodified>08-11-2021</datemodified>
<datemodified>08-13-2021</datemodified>
</header>
<version name="POL100.1.0">
<entry>
<date>08-14-2021</date>
<author>Kevin:</author>
<change type="Fixed">The remaining drop errors (too far away; location blocked) can now be disabled via the ShowWarningItem option.</change>
</entry>
<entry>
<date>08-11-2021</date>
<author>Kevin:</author>
Expand Down
4 changes: 3 additions & 1 deletion pol-core/doc/core-changes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
-- POL100.1.0 --
-- POL100.1.0 --
08-14-2021 Kevin:
Fixed: The remaining drop errors (too far away; location blocked) can now be disabled via the ShowWarningItem option.
08-11-2021 Kevin:
Fixed: User Functions that conflict with the same name as Module Functions will now result in a compilation error.
08-03-2021 Turley:
Expand Down
9 changes: 3 additions & 6 deletions pol-core/pol/dropitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -371,18 +371,15 @@ bool drop_item_on_ground( Network::Client* client, Items::Item* item, u16 x, u16
short newz;
if ( !inrangex( chr, x, y, 2 ) && !client->chr->can_moveanydist() )
{
POLLOG_ERROR.Format( "Client (Character {}) tried to drop an item out of range.\n" )
<< client->chr->name();
SuspiciousActs::DropItemOutOfRange( client, item->serial );
send_item_move_failure( client, MOVE_ITEM_FAILURE_TOO_FAR_AWAY );
return false;
}

if ( !chr->realm->dropheight( x, y, z, client->chr->z, &newz, &multi ) )
{
POLLOG_ERROR.Format(
"Client (Character {}) tried to drop an item at ({},{},{}), which is a blocked "
"location.\n" )
<< client->chr->name() << x << y << (int)z;
SuspiciousActs::DropItemOutAtBlockedLocation( client, item->serial, x, y, z );
send_item_move_failure( client, MOVE_ITEM_FAILURE_TOO_FAR_AWAY );
return false;
}

Expand Down
23 changes: 22 additions & 1 deletion pol-core/pol/systems/suspiciousacts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,25 @@ void SuspiciousActs::OutOfSequenceCursor( Network::Client* client )
POLLOG_ERROR << targetter->acct->name() << "/" << targetter->name()
<< " used out of sequence cursor.\n";
}
}
}

void SuspiciousActs::DropItemOutOfRange( Network::Client* client, u32 )
{
if ( Plib::systemstate.config.show_warning_item )
{
POLLOG_ERROR.Format( "Client (Character {}) tried to drop an item out of range.\n" )
<< client->chr->name();
}
}

void SuspiciousActs::DropItemOutAtBlockedLocation( Network::Client* client, u32, u16 x, u16 y,
s8 z )
{
if ( Plib::systemstate.config.show_warning_item )
{
POLLOG_ERROR.Format(
"Client (Character {}) tried to drop an item at ({},{},{}), which is a blocked "
"location.\n" )
<< client->chr->name() << x << y << (int)z;
}
}
3 changes: 3 additions & 0 deletions pol-core/pol/systems/suspiciousacts.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ void GumpResponseHasTooManyIntsOrStrings( Network::Client* client );
void GumpResponseOverflows( Network::Client* client );

void DropItemButNoneGotten( Network::Client* client, u32 item_serial );
void DropItemOutOfRange( Network::Client* client, u32 item_serial );
void DropItemOutAtBlockedLocation( Network::Client* client, u32 item_serial, u16 x, u16 y, s8 z );

void DropItemOtherThanGotten( Network::Client* client, u32 dropped_item_serial,
u32 gotten_item_serial );

Expand Down

0 comments on commit 0db4b97

Please sign in to comment.