Class Index | File Index

Classes


Namespace core.contractNegotiation

All aspects of contract negotiation.
Defined in: <js/core/contractNegotiation.js>.

Namespace Summary
Constructor Attributes Constructor Name and Description
 
Method Summary
Method Attributes Method Name and Description
<static>  
core.contractNegotiation.accept(pid, cb)
Accept the player's offer.
<static>  
core.contractNegotiation.cancel(pid)
Cancel contract negotiations with a player.
<static>  
core.contractNegotiation.cancelAll(cb)
Cancel all ongoing contract negotiations.
<static>  
core.contractNegotiation.create(ot, pid, resigning, cb)
Start a new contract negotiation with a player.
<static>  
core.contractNegotiation.offer(pid, teamAmount, teamYears, cb)
Make an offer to a player.
<static>  
core.contractNegotiation.validAmount(years)
Restrict the input to between 500 and 20000, the valid amount of annual thousands of dollars for a contract.
<static>  
core.contractNegotiation.validYears(years)
Restrict the input to between 1 and 5, the valid number of years for a contract.
Namespace Detail
core.contractNegotiation
Method Detail
<static> core.contractNegotiation.accept(pid, cb)
Accept the player's offer. If successful, then the team's current roster will be displayed.
Parameters:
{number} pid
An integer that must correspond with the player ID of a player in an ongoing negotiation.
{function(string=)} cb
Callback to be run only after the contract is successfully accepted. If an error occurs, pass a string error message.

<static> core.contractNegotiation.cancel(pid)
Cancel contract negotiations with a player.
Parameters:
{number} pid
An integer that must correspond with the player ID of a player in an ongoing negotiation.

<static> core.contractNegotiation.cancelAll(cb)
Cancel all ongoing contract negotiations. Currently, the only time there should be multiple ongoing negotiations in the first place is when a user is resigning players at the end of the season, although that should probably change eventually.
Parameters:
{function()=} cb
Optional callback.

<static> core.contractNegotiation.create(ot, pid, resigning, cb)
Start a new contract negotiation with a player.
Parameters:
{IDBTransaction|null} ot
An IndexedDB transaction on gameAttributes, negotiations, and players, readwrite; if null is passed, then a new transaction will be used.
{number} pid
An integer that must correspond with the player ID of a free agent.
{boolean} resigning
Set to true if this is a negotiation for a contract extension, which will allow multiple simultaneous negotiations. Set to false otherwise.
{function(string=)} cb
Callback to be run only after a successful negotiation is started. If an error occurs, pass a string error message.

<static> core.contractNegotiation.offer(pid, teamAmount, teamYears, cb)
Make an offer to a player.
Parameters:
{number} pid
An integer that must correspond with the player ID of a player in an ongoing negotiation.
{number} teamAmount
Teams's offer amount in thousands of dollars per year (between 500 and 20000).
{number} teamYears
Team's offer length in years (between 1 and 5).
{function()=} cb
Optional callback.

<static> {number} core.contractNegotiation.validAmount(years)
Restrict the input to between 500 and 20000, the valid amount of annual thousands of dollars for a contract.
Parameters:
{number} years
Annual salary, in thousands of dollars, to be validated.
Returns:
{number} An integer between 500 and 20000.

<static> {number} core.contractNegotiation.validYears(years)
Restrict the input to between 1 and 5, the valid number of years for a contract.
Parameters:
{number} years
Number of years, to be validated.
Returns:
{number} An integer between 1 and 5.

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