Skip to content
Permalink
Browse files

SendQuestArrow() fix for HSA clients (#91)

* Changed SendQuestArrow to receive an arrow id rather than requiring an object reference.
*Added new error if no id is supplied to a cancellation request.
* .Fix uo.em to have correct default.
  • Loading branch information...
sigmantium committed Jun 19, 2019
1 parent d8911ac commit 76487f0ab2f509e8bfdf46ea20d7ced97146e021
@@ -2,9 +2,15 @@
<ESCRIPT>
<header>
<topic>Latest Core Changes</topic>
<datemodified>06-17-2019</datemodified>
<datemodified>06-18-2019</datemodified>
</header>
<version name="POL100">
<entry>
<date>06-18-2018</date>
<author>DevGIB:</author>
<change type="Changed">Fixed SendQuestArrow() function to use arrow id's rather than an actual object reference. This allows for multiple arrows to be sent to the client and cancelled individually by storing them in a cprop to be recalled later.<br/>
When sending SendQuestArrow() the function will return the arrows id for further processing.</change>
</entry>
<entry>
<date>06-17-2018</date>
<author>DevGIB:</author>
@@ -2252,19 +2252,20 @@ equal to n. Thus you can request 0-40 units in groups of 5, etc. </explain>
</function>

<function name="SendQuestArrow">
<prototype>SendQuestArrow(to_whom, x := -1, y := -1, target := "")</prototype>
<prototype>SendQuestArrow(to_whom, x := -1, y := -1, arrowid := "")</prototype>
<parameter name="to_whom" value="Character reference the arrow shows to" />
<parameter name="x" value="Integer world coordinates" />
<parameter name="y" value="Integer world coordinates" />
<parameter name="target" value="Item or Character reference" />
<parameter name="arrowid" value="Integer" />
<explain>Sends a "quest arrow" to the player that points at x,y</explain>
<explain>Passing 'x' and 'y' within map bounds will set the Quest Arrow to point at that location.</explain>
<explain>Passing -1 as 'x' and 'y' (ie. by just called SendQuestArrow(to_whom)) will remove it.</explain>
<explain>If the client is HSA (client version > 7.0.9), "target" is required. Otherwise it will be ignored.</explain>
<return>1 on success</return>
<explain>If the client is HSA (client version > 7.0.9), Multiple arrows can exist at one time. You can specify an id using the arrowid param otherwise one will be generated by the core.</explain>
<explain>Pass an 'x' and 'y' value of -1 well cancel the arrow, for HSA clients an arrow id is required to clear that specific arrow.</explain>
<return>arrowid on success</return>
<error>"No client attached"</error>
<error>"Invalid parameter"</error>
<error>"No valid target for HSA client"</error>
<error>"ArrowID out of range"</error>
<error>"ArrowID must be supplied for cancelation."</error>
<related>Character</related>
</function>

@@ -1,4 +1,7 @@
-- POL100 --
06-18-2018 DevGIB:
Changed: Fixed SendQuestArrow() function to use arrow id's rather than an actual object reference. This allows for multiple arrows to be sent to the client and cancelled individually by storing them in a cprop to be recalled later.
When sending SendQuestArrow() the function will return the arrows id for further processing.
06-17-2018 DevGIB:
Changed: Fixed default for OS::Start_Skill_Script on script_name attribute to be string like required.
06-17-2018 DevGIB:
@@ -4100,24 +4100,44 @@ BObjectImp* UOExecutorModule::mf_SendPacket()
BObjectImp* UOExecutorModule::mf_SendQuestArrow()
{
Character* chr;
int x, y;
UObject* target = nullptr;
int x, y, arrow_id;
u32 arrowid;

if ( getCharacterParam( exec, 0, chr ) && getParam( 1, x, -1, 1000000 ) &&
getParam( 2, y, -1, 1000000 ) ) // max values checked below
{
if ( !chr->has_active_client() )
return new BError( "No client attached" );

if (exec.getParam(3, arrow_id))
{
if (arrow_id < 1)
return new BError("ArrowID out of range");
arrowid = (u32)arrow_id;

}
else
{
arrowid = this->uoexec.pid();
}
bool usesNewPktSize = ( chr->client->ClientType & Network::CLIENTTYPE_7090 ) > 0;

Network::PktHelper::PacketOut<Network::PktOut_BA> msg;
if ( x == -1 && y == -1 )
{
msg->Write<u8>( PKTOUT_BA_ARROW_OFF );
msg->offset += 4; // u16 x_tgt,y_tgt
if ( usesNewPktSize )
msg->offset += 4; // u32 serial
if (usesNewPktSize)
{
if (!arrow_id || arrow_id == 0 )
{
return new BError( "ArrowID must be supplied for cancelation." );
}
else
{
msg->Write<u32>(static_cast<u32>(arrowid & 0xFFFFFFFF));
}
}
}
else
{
@@ -4128,17 +4148,10 @@ BObjectImp* UOExecutorModule::mf_SendQuestArrow()
msg->WriteFlipped<u16>( static_cast<u16>( x & 0xFFFF ) );
msg->WriteFlipped<u16>( static_cast<u16>( y & 0xFFFF ) );
if ( usesNewPktSize )
{
if ( !getUObjectParam( exec, 3, target ) )
{
exec.setFunctionResult( nullptr );
return new BError( "No valid target for HSA client" );
}
msg->Write<u32>( static_cast<u32>( target->serial_ext & 0xFFFFFFFF ) );
}
msg->Write<u32>( static_cast<u32>( arrowid & 0xFFFFFFFF ) );
}
msg.Send( chr->client );
return new BLong( 1 );
return new BLong(arrowid);
}
else
{
@@ -380,7 +380,7 @@ SendOpenSpecialContainer( character, container );
SendOverallSeason( season_id, playsound := 1 );
SendPacket( to_whom, packet_hex_string );
SendPopUpMenu( to_whom, above, menu );
SendQuestArrow( to_whom, x := -1, y := -1, target := "" ); // no params (-1x,-1y) turns the arrow off, target is required for HSA clients
SendQuestArrow( to_whom, x := -1, y := -1, arrowid := 0 ); // no params (-1x,-1y) turns the arrow off, target is required for HSA clients
SendSellWindow( character, vendor, i1, i2, i3, flags := 0 );
SendSkillWindow( towhom, forwhom );
SendStatus( character );

0 comments on commit 76487f0

Please sign in to comment.
You can’t perform that action at this time.