Class Index | File Index

Classes


Namespace core.draft

The annual draft of new prospects.
Defined in: <js/core/draft.js>.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
Method Summary
Method Attributes Method Name and Description
<static>  
core.draft.generatePlayers(cb)
Generate a set of draft prospects.
<static>  
core.draft.selectPlayer(pick, pid, cb)
Select a player for the current drafting team.
<static>  
core.draft.setOrder(cb)
Sets draft order and save it to the draftOrder object store.
<static>  
core.draft.untilUserOrEnd(cb)
Simulate draft picks until it's the user's turn or the draft is over.
Namespace Detail
core.draft
Method Detail
<static> core.draft.generatePlayers(cb)
Generate a set of draft prospects. This is called before the draft occurs, otherwise there will be no one to draft!
Parameters:
{function()} cb
Callback function.

<static> core.draft.selectPlayer(pick, pid, cb)
Select a player for the current drafting team. This can be called in response to the user clicking the "draft" button for a player, or by some other function like untilUserOrEnd.
Parameters:
{object} pick
Pick object, like from db.getDraftOrder, that contains information like the team, round, etc.
{number} pid
Integer player ID for the player to be drafted.
{function()} cb
Optional callback function. Argument is the player ID that was drafted (same as pid input.. probably this can be eliminated, then).

<static> core.draft.setOrder(cb)
Sets draft order and save it to the draftOrder object store. This is currently based on winning percentage (no lottery).
Parameters:
{function()} cb
Optional callback function.

<static> core.draft.untilUserOrEnd(cb)
Simulate draft picks until it's the user's turn or the draft is over. This could be made faster by passing a transaction around, so all the writes for all the picks are done in one transaction. But when calling selectPlayer elsewhere (i.e. in testing or in response to the user's pick), it needs to be sure that the transaction is complete before continuing. So I would need to create a special case there to account for it. Given that this isn't really *that* slow now, that probably isn't worth the complexity.
Parameters:
{function(Array.|Array.)} cb
Callback function. First argument is the list of draft picks (from db.getDraftOrder). Second argument is a list of player IDs who were drafted during this function call, in order.

Documentation generated by JsDoc Toolkit 2.4.0 on Fri Mar 01 2013 11:45:19 GMT-0500 (EST)