Inheritance diagram for BaseRPSGame:
Allow your users to challenge each other to Rock Paper Scissors and duke it out with taunts, statistics, and alert sytem integration. Lots of fun.
Definition at line 9 of file base-rps-game.inc.php.
Public Member Functions | |
__construct ($data=null, $table= 'janken') | |
initialize our oject. | |
getPagesXml () | |
add in our special pages. | |
initChallengePage () | |
prep our challenge page | |
drawChallengePage () | |
draw our challenge page | |
initTauntPage () | |
prep our taunt page | |
drawTauntPage () | |
draw our taunt page | |
createTauntForm () | |
create a form for adding our taunt | |
initDefendPage () | |
prep our defend page. | |
canView () | |
who can view it? by default everyone =) | |
canEdit () | |
who can edit it? by default nobody | |
canDelete () | |
who can delete it? by default nobody | |
drawChallengeBox ($userId) | |
draw a challenge box for a user. | |
initViewPage () | |
prep our view page | |
drawViewPage () | |
draw our view page | |
drawDefendBox () | |
draw a box for the defender to defend themselves. | |
drawFightBox () | |
draw information about the fight | |
getUserStats ($userId) | |
get an array of stats about a users RPS performance | |
lookupData ($deep=true) | |
lookup our data. | |
getDataToCache ($deep=true) | |
this is the funciton that gets the data we need saved to cache. | |
setDataFromCache ($data, $deep=true) | |
this function sets the data in the object from the data we retrieved from the cache. | |
getCreateFieldsArray () | |
get the fields for the table. | |
getCreateIndexesArray () | |
get the indexes for the table. | |
Public Attributes | |
$Attacker | |
this is our attacker object | |
$Defender | |
this is our defender object | |
Static Public Attributes | |
$winMatrix | |
our win matrix. | |
Protected Member Functions | |
getDeletePageXml () | |
no delete page. | |
getEditPageXml () | |
no edit page. |
|
initialize our oject.
Reimplemented from BaseObject. Definition at line 46 of file base-rps-game.inc.php. |
|
who can delete it? by default nobody
Reimplemented from BaseObject. Definition at line 252 of file base-rps-game.inc.php. |
|
who can edit it? by default nobody
Reimplemented from BaseObject. Definition at line 244 of file base-rps-game.inc.php. |
|
who can view it? by default everyone =)
Reimplemented from BaseObject. Definition at line 236 of file base-rps-game.inc.php. |
|
create a form for adding our taunt
Definition at line 185 of file base-rps-game.inc.php. References BaseModule::getUrl(). Referenced by drawChallengePage(), and drawTauntPage(). |
|
draw a challenge box for a user. it shows some text and the three options for attacking
Definition at line 263 of file base-rps-game.inc.php. References BaseModule::getLink(). Referenced by drawViewPage(). |
|
draw our challenge page
Definition at line 122 of file base-rps-game.inc.php. References createTauntForm(), BaseModule::params(), and BaseObject::save(). |
|
draw a box for the defender to defend themselves.
Definition at line 348 of file base-rps-game.inc.php. References BaseModule::getLink(). Referenced by drawViewPage(). |
|
draw information about the fight
Definition at line 366 of file base-rps-game.inc.php. Referenced by drawViewPage(). |
|
draw our taunt page
Definition at line 165 of file base-rps-game.inc.php. References createTauntForm(), Util::redirect(), and BaseObject::save(). |
|
draw our view page
Definition at line 291 of file base-rps-game.inc.php. References Linkify::bbcode(), drawChallengeBox(), drawDefendBox(), and drawFightBox(). |
|
get the fields for the table.
Reimplemented from BaseObject. Definition at line 495 of file base-rps-game.inc.php. |
|
get the indexes for the table.
Reimplemented from BaseObject. Definition at line 520 of file base-rps-game.inc.php. |
|
this is the funciton that gets the data we need saved to cache. by default it saves our data, and will save the comments or tags objects if needed. its recommended to extend this to add data that you'd like cached by the object
Reimplemented from BaseObject. Definition at line 468 of file base-rps-game.inc.php. |
|
no delete page. you cant delete your games. sorry losers. Reimplemented from BaseObject. Definition at line 56 of file base-rps-game.inc.php. |
|
no edit page. you cant edit your games. sorry losers. Reimplemented from BaseObject. Definition at line 64 of file base-rps-game.inc.php. |
|
add in our special pages. challenge - challenge someone to a game of RPS defend - defend yourself in a game of RPS taunt - add a taunt to your attack Reimplemented from BaseObject. Definition at line 76 of file base-rps-game.inc.php. |
|
get an array of stats about a users RPS performance This function return a keyed array here are what they mean: offwin - offense wins offloss - offense losses offtie - offense ties offpercent - offense win percent defwin - defense wins defloss - defense losses deftie - defense ties defpercent - defense win percent totwin - total wins totloss - total losses tottie - total ties totpercent - total win percent
Definition at line 396 of file base-rps-game.inc.php. References dbFetchAssoc(), and dbQuery(). |
|
prep our challenge page
Definition at line 107 of file base-rps-game.inc.php. References BaseModule::assertLogin(), and BaseModule::params(). |
|
prep our defend page.
Definition at line 207 of file base-rps-game.inc.php. References BaseModule::assertLogin(), initViewPage(), BaseModule::params(), Util::redirect(), and BaseObject::save(). |
|
prep our taunt page
Definition at line 149 of file base-rps-game.inc.php. References BaseModule::assertLogin(), and BaseModule::params(). |
|
prep our view page
Definition at line 281 of file base-rps-game.inc.php. Referenced by initDefendPage(). |
|
lookup our data.
Reimplemented from BaseObject. Definition at line 457 of file base-rps-game.inc.php. |
|
this function sets the data in the object from the data we retrieved from the cache. it takes the data from the array and puts it in the object. you'll want to override this one if you added custome data in getDataToCache() and load it into the object.
Reimplemented from BaseObject. Definition at line 478 of file base-rps-game.inc.php. |
|
this is our attacker object
Definition at line 36 of file base-rps-game.inc.php. |
|
this is our defender object
Definition at line 41 of file base-rps-game.inc.php. |
|
Initial value: array( 'rock' => array( 'rock' => 'tie', 'paper' => 'defense', 'scissors' => 'offense' ), 'paper' => array( 'rock' => 'offense', 'paper' => 'tie', 'scissors' => 'defense' ), 'scissors' => array( 'rock' => 'defense', 'paper' => 'offense', 'scissors' => 'tie' ), ) a 3x3 array of win/loss/tie where the first index is the attackers move, and the second index is the defenders move Definition at line 15 of file base-rps-game.inc.php. |