Package | com.whirled.avrg |
Class | public class PlayerSubControlServer |
Inheritance | PlayerSubControlServer ![]() ![]() ![]() ![]() ![]() |
Implements | MessageSubControl |
See also
Method | Defined by | ||
---|---|---|---|
![]() |
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener.
| AbstractControl | |
awardPrize(ident:String):void
Awards the specified prize item to this player.
| PlayerSubControlServer | ||
awardTrophy(ident:String):Boolean
Awards the specified trophy to this player.
| PlayerSubControlServer | ||
![]() |
completeTask(taskId:String, payout:Number):void
This method calculates and awards a coin payout for the player.
| PlayerSubControlBase | |
consumeItemPack(ident:String):Boolean
Consumes the specified item pack for this player.
| PlayerSubControlServer | ||
![]() |
deactivateGame():void
Quits the game for this player.
| PlayerSubControlBase | |
![]() |
doBatch(fn:Function, ... args):void
Execute the specified function as a batch of commands that will be sent to the server
together.
| AbstractSubControl | |
![]() |
getBars():int
Returns this player's current bar balance.
| PlayerSubControlBase | |
![]() |
getCoins():int
Returns this player's current coin balance.
| PlayerSubControlBase | |
![]() |
getPartyId():int
Get the party id of this player.
| PlayerSubControlBase | |
getPlayerId():int
Returns the id of this player.
| PlayerSubControlServer | ||
![]() |
getPlayerItemPacks():Array
Returns all item packs owned by this client's player (the default) or a specified player.
| PlayerSubControlBase | |
![]() |
getPlayerLevelPacks():Array
Returns all level packs owned by this client's player (the default) or a specified player.
| PlayerSubControlBase | |
getPlayerName():String
Returns the name of this player.
| PlayerSubControlServer | ||
![]() |
getRoomId():int
Accesses the id of the room that this player is in.
| PlayerSubControlBase | |
![]() |
getTargetId():int
Get the targetId on which this control operates.
| TargetedSubControl | |
![]() |
holdsTrophy(ident:String):Boolean
Returns true if this client's player (the default) or a specified player has the trophy
with the specified identifier.
| PlayerSubControlBase | |
![]() |
isConnected():Boolean
Are we connected and running inside the whirled environment, or has someone just
loaded up our SWF by itself?
| AbstractSubControl | |
![]() |
moveToRoom(roomId:int, exitCoords:Array = null):void
Instructs this player's client to move to the specified room, or pass 0 to put the player
in no room.
| PlayerSubControlBase | |
![]() |
playAvatarAction(action:String):void
Plays an action on this players avatar.
| PlayerSubControlBase | |
purchaseItemPack(ident:String):void
Purchases the item pack with the specified identifier on behalf of the player.
| PlayerSubControlServer | ||
![]() |
removeEventListener(type:String, listener:Function, useCapture:Boolean = false):void
Unregisters an event listener.
| AbstractControl | |
sendMessage(name:String, value:Object = null):void
Sends a message to this player only.
| PlayerSubControlServer | ||
![]() |
setAvatarLocation(x:Number, y:Number, z:Number, orient:Number):void
Sets the location and orientation of this player's avatar in room coordinates.
| PlayerSubControlBase | |
![]() |
setAvatarState(state:String):void
Sets the stats of this player's avatar.
| PlayerSubControlBase |
awardPrize | () | method |
public function awardPrize(ident:String):void
Awards the specified prize item to this player. If the supplied prize identifier is not valid, this will not be known until the request is processed on the server, so the method will return successfully but no prize will have been awarded. Thus you should be careful not to misspell your prize identifier in your code or in the associated prize item.
Note: a game is only allowed to award a prize once per game session. This is to guard against bugs that might try to award many hundreds of the same prize to a user while playing a game. If you eallywant to award multiple instances of a prize, you will need to make different prize items with unique identifiers which all reference the same target item.
Note also: because a game anaward the same prize more than once if the player earns the prize in separate game sessions, a game that wishes to only award a prize once should couple the award of the prize with the award of a trophy and then structure their code like so:
if (_ctrl.awardTrophy("special_award_trophy")) { _ctrl.awardPrize("special_award_avatar"); }
The first time the player accomplishes the necessary goal, they will be awarded the trophy and the prize. Subsequently, awardTrophy() will return false indicating that the player already has the trophy in question and the prize will not be awarded. Alternatively the game could store whether or not the player has earned the prize in a user cookie.
Parametersident:String |
awardTrophy | () | method |
public function awardTrophy(ident:String):Boolean
Awards the specified trophy to this player. If the supplied trophy identifier is not valid, this will not be known until the request is processed on the server, so the method will return succcessfully but no trophy will be awarded. Thus, you should be careful not to misspell your trophy identifier in your code or in the associated trophy source item.
Parametersident:String |
Boolean — true if the trophy was requested, false if the player already has that trophy.
|
consumeItemPack | () | method |
public function consumeItemPack(ident:String):Boolean
Consumes the specified item pack for this player. The player must currently own at least one copy of the item pack. On success, a GameContentEvent.PLAYER_CONTENT_CONSUMED event will be dispatched on this control (on both the client and server).
Note: this functionality is only allowed for approved games. This method will silently fail for unapproved games. The approval process is still being developed.
Parametersident:String — the identifier of the item pack to be consumed.
|
Boolean — true if the consume request was sent, false if the the player is known not to own at
least one copy of the item pack.
|
getPlayerId | () | method |
public override function getPlayerId():int
Returns the id of this player. This id is the member id and can be used to view the member's profile (www.whirled.com/#people-{id}).
Returnsint |
getPlayerName | () | method |
public override function getPlayerName():String
Returns the name of this player.
ReturnsString |
purchaseItemPack | () | method |
public function purchaseItemPack(ident:String):void
Purchases the item pack with the specified identifier on behalf of the player. If the purchase cannot be completed due to a lack of funds or other reason the player will be notified via chat feedback. A GameContentEvent.PLAYER_CONTENT_ADDED event will be issued if the purchase succeeds.
Note: this functionality is only allowed for approved games. This method will silently fail for unapproved games. The approval process is still being developed.
Parametersident:String |
sendMessage | () | method |
public function sendMessage(name:String, value:Object = null):void
Sends a message to this player only. Clients receive messages by listening for
MessageReceivedEvent
s on theis PlayerSubControlClient
.
name:String |
|
value:Object (default = null )
|
See also