EnhancedWeaponEvent
in package
Defines enhanced weapon sale events for weapon shops.
Table of Contents
Constants
- DURATION = 21600
- GRACE_PERIOD = 3600
Properties
- $expires : int
- $gameID : int
- $locationTypeID : int
- $sectorID : int
- $weapon : Weapon
- $weaponTypeID : int
Methods
- getDurationRemainingPercent() : float
- Returns the amount of time left in the event as a percent of the total duration of the event.
- getExpireTime() : int
- getLatestEvent() : self
- Get the most recent event.
- getSectorID() : int
- getShopEvents() : array<string|int, self>
- Return all the valid events for the given location in a sector.
- getWeapon() : Weapon
- __construct() : mixed
- createEvent() : self
- Create a new event.
- getEventFromDatabase() : self
- Convenience function to instantiate an event from a query result.
Constants
DURATION
protected
mixed
DURATION
= 21600
GRACE_PERIOD
protected
mixed
GRACE_PERIOD
= 3600
Properties
$expires read-only
protected
int
$expires
$gameID read-only
protected
int
$gameID
$locationTypeID read-only
protected
int
$locationTypeID
$sectorID read-only
protected
int
$sectorID
$weapon read-only
protected
Weapon
$weapon
$weaponTypeID read-only
protected
int
$weaponTypeID
Methods
getDurationRemainingPercent()
Returns the amount of time left in the event as a percent of the total duration of the event.
public
getDurationRemainingPercent() : float
Return values
floatgetExpireTime()
public
getExpireTime() : int
Return values
intgetLatestEvent()
Get the most recent event.
public
static getLatestEvent(int $gameID) : self
This function also does the work of cleaning up expired events and creating new ones when necessary.
Parameters
- $gameID : int
Return values
selfgetSectorID()
public
getSectorID() : int
Return values
intgetShopEvents()
Return all the valid events for the given location in a sector.
public
static getShopEvents(int $gameID, int $sectorID, int $locationID) : array<string|int, self>
Parameters
- $gameID : int
- $sectorID : int
- $locationID : int
Return values
array<string|int, self>getWeapon()
public
getWeapon() : Weapon
Return values
Weapon__construct()
protected
__construct(int $gameID, int $weaponTypeID, int $locationTypeID, int $sectorID, int $expires, bool $bonusAccuracy, bool $bonusDamage) : mixed
Parameters
- $gameID : int
- $weaponTypeID : int
- $locationTypeID : int
- $sectorID : int
- $expires : int
- $bonusAccuracy : bool
- $bonusDamage : bool
createEvent()
Create a new event.
private
static createEvent(int $gameID) : self
Events are generated randomly across all weapon types available in the game, and then randomly across locations that offer that weapon type.
Parameters
- $gameID : int
Return values
selfgetEventFromDatabase()
Convenience function to instantiate an event from a query result.
private
static getEventFromDatabase(DatabaseRecord $dbRecord) : self
Parameters
- $dbRecord : DatabaseRecord