-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement MultiQueue action from UserPatch.
- Loading branch information
1 parent
1c0e746
commit e4cc4fb
Showing
2 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
namespace RecAnalyst\Model\Actions; | ||
|
||
use RecAnalyst\RecordedGame; | ||
|
||
/** | ||
* Represents a multiple building queue action, from UserPatch 1.4. | ||
*/ | ||
class MultiQueueAction extends Action | ||
{ | ||
/** | ||
* The action ID. | ||
* | ||
* @var int | ||
*/ | ||
const ID = 0x70; | ||
|
||
/** | ||
* Building IDs that the action applies to. | ||
* | ||
* @var int[] | ||
*/ | ||
public $buildings; | ||
|
||
/** | ||
* ID of the unit type that is being queued. | ||
* | ||
* @var int | ||
*/ | ||
public $typeId; | ||
|
||
/** | ||
* Amount of units that are being queued. | ||
* | ||
* @var int | ||
*/ | ||
public $count; | ||
|
||
/** | ||
* Create a ... | ||
* | ||
* @param \RecAnalyst\RecordedGame $rec Recorded game instance. | ||
* @param int $time Recorded game instance. | ||
*/ | ||
public function __construct(RecordedGame $rec, $time, $buildings, $typeId, $count) | ||
{ | ||
parent::__construct($rec, $time); | ||
|
||
$this->buildings = $buildings; | ||
$this->typeId = $typeId; | ||
$this->count = $count; | ||
} | ||
|
||
/** | ||
* Get a string representation of the action. | ||
* | ||
* @return string | ||
*/ | ||
public function __toString() | ||
{ | ||
return sprintf( | ||
'MultiQueue(typeId=%d, count=%d, buildings[%d]={%s})', | ||
$this->typeId, | ||
$this->count, | ||
count($this->buildings), | ||
implode(', ', $this->buildings) | ||
); | ||
} | ||
} |