Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| LoadPlayerInventoryCommand | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| pack | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace AqwSocketClient\Commands; |
| 6 | |
| 7 | use AqwSocketClient\Interfaces\CommandInterface; |
| 8 | use AqwSocketClient\Objects\Identifiers\AreaIdentifier; |
| 9 | use AqwSocketClient\Objects\Identifiers\SocketIdentifier; |
| 10 | use AqwSocketClient\Packet; |
| 11 | use Override; |
| 12 | |
| 13 | /** |
| 14 | * Represents a command sent to the server to request the loading and retrieval |
| 15 | * of the current player's inventory data. |
| 16 | * |
| 17 | * @see AqwSocketClient\Interfaces\CommandInterface |
| 18 | */ |
| 19 | final class LoadPlayerInventoryCommand implements CommandInterface |
| 20 | { |
| 21 | public function __construct( |
| 22 | public readonly AreaIdentifier $areaId, |
| 23 | public readonly SocketIdentifier $socketId, |
| 24 | ) {} |
| 25 | |
| 26 | /** |
| 27 | * Converts the command object into a ready-to-send {@see AqwSocketClient\Packet} object, |
| 28 | * serializing the inventory retrieval request according to the AQW protocol. |
| 29 | * |
| 30 | * @return Packet The final packet object ready for transmission. |
| 31 | */ |
| 32 | #[Override] |
| 33 | public function pack(): Packet |
| 34 | { |
| 35 | return Packet::packetify("%xt%zm%retrieveInventory%{$this->areaId->value}%{$this->socketId->value}%"); |
| 36 | } |
| 37 | } |