<% template FreeAgencySvc(starwave.webgames.minigame.challenge.services.FreeAgencySvc obj) context = obj.minigameContext challenge = obj.challenge %> <% start = 0 end = 0 if (obj.availablePlayers != null) { start = 0 end = 29 if (obj.availablePlayers.length - 1 < 29) { end = obj.availablePlayers.length - 1 } if (obj.currentRequest.args["page"] == "2") { start = 30 if (obj.availablePlayers.length - 1 < 59) { end = obj.availablePlayers.length - 1 } else { end = 59 } } if (obj.currentRequest.args["page"] == "3") { start = 60 if (obj.availablePlayers.length - 1 < 89) { end = obj.availablePlayers.length - 1 } else { end = 89 } } else if (obj.currentRequest.args["page"] == "4") { start = 90 end = obj.availablePlayers.length - 1 } } position_lookup_singular = ##(0, "Point Guard", 1, "Shooting Guard", 2, "Small Forward", 3, "Power Forward", 4, "Center", 5, "Coach") position_lookup_abbrev = ##(0, "PG", 1, "SG", 2, "SF", 3, "PF", 4, "C", 5, "Coach") budget = challenge.entryBudget // Calculate different averages, totals and values roster = obj.roster rosterAtPos = obj.entryPlayersAt ap = obj.availablePlayers currentSalary = 0.0 openSlots = 0 // Count open slots foreach (item in roster) { if (item == null) { openSlots = openSlots + 1} if (item != null) { // This will enable us to avoid another call to DB currentSalary = currentSalary + item.lockedSalary } } cashLeft = budget - currentSalary; //slotsLeft = openSlots + rosterAtPos.length avgSalary = 0.0 slotsFilled = roster.length - openSlots slotsLeft = roster.length - slotsFilled if (roster.length > 0 and slotsFilled != 0) { avgSalary = currentSalary / (slotsFilled) } if (slotsLeft != 0) { avgLeft = cashLeft / slotsLeft } else { avgLeft = cashLeft } %> <% challenge.positions[obj.positionID].name %> <% Header("FreeAgencySvc") %>
Select Your <% challenge.positions[obj.positionID].name %>
<% EntryHeader(context) %>
Group Directory

<% numberFormat("#.0") %>
Balance Sheet   Rules for Selecting Players
Starting:
Spent:
Available:
80.0 (13.33/player)
<% if (currentSalary > challenge.entryBudget + 0.00000000000001) { '' & currentSalary & '' } else { currentSalary } %> (<% avgSalary %>/player)
<% cashLeft %> (<% avgLeft %>/player)
  Staying under the <%challenge.entryBudget%> point limit, select one player from each position. To add a new player, click the radio button next to the player's name and click the "Select" button at the bottom of the page. This will automatically add that player and drop your existing player at that position. For more information see How to Play.
<% '

' %>
<% /************************** BUILD ROSTER FOR SPECIFIC POSITION TABLE *****************************/ if (rosterAtPos != null) { if (obj.positionID < 5) { %> <% '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' //'' '' '' '' '' %> <% //playerTotals = obj.rosterAtPosPlayerTotals x = 0 foreach (plyr in rosterAtPos) { player = plyr.player playerStats = plyr.playerTotals numberFormat(null) '\n\n' '' '' '' '' nullFormat("--") gp = 0 fgp = 0 ftp = 0 rpg = 0 apg = 0 tpg = 0 spg = 0 bpg = 0 ppg = 0 VGMpoints = 0 gp = playerStats["nGamesPlayed"].asInteger if (gp > 0) { numberFormat("#.000") if (playerStats["nFieldGoalsAttempted"].asInteger > 0) { fgp = playerStats["nFieldGoalsMade"].asDouble / playerStats["nFieldGoalsAttempted"].asInteger } if (playerStats["nFreethrowsAttempted"].asInteger > 0) { ftp = playerStats["nFreethrowsMade"].asDouble / playerStats["nFreethrowsAttempted"].asInteger } rpg = playerStats["nRebounds"].asDouble / playerStats["nGamesPlayed"].asInteger apg = playerStats["nAssists"].asDouble / playerStats["nGamesPlayed"].asInteger tpg = playerStats["nTurnovers"].asDouble / playerStats["nGamesPlayed"].asInteger spg = playerStats["nSteals"].asDouble / playerStats["nGamesPlayed"].asInteger bpg = playerStats["nBlocks"].asDouble / playerStats["nGamesPlayed"].asInteger ppg = playerStats["nNBAPoints"].asDouble / playerStats["nGamesPlayed"].asInteger VGMpoints = playerStats["nVGMPoints"].asDouble / playerStats["nGamesPlayed"].asInteger } numberFormat(null) '' '' '' '' '' '' '' '' '' '' '' '' '' x = x + 1 } } else { // coaches '' '' '' '' '' '' '' '' '' '' '' '' '' %> <% //playerTotals = obj.rosterAtPosPlayerTotals x = 0 foreach (plyr in rosterAtPos) { player = plyr.player playerStats = plyr.playerTotals numberFormat(null) '\n' '' '' '' '' nullFormat("--") gp = 0 fgp = 0 ftp = 0 rpg = 0 apg = 0 tpg = 0 spg = 0 bpg = 0 ppg = 0 VGMpoints = 0 gp = playerStats["nGamesPlayed"].asInteger if (gp > 0) { numberFormat("#.000") if (playerStats["nFieldGoalsAttempted"].asInteger > 0) { fgp = playerStats["nFieldGoalsMade"].asDouble / playerStats["nFieldGoalsAttempted"].asInteger } if (playerStats["nFreethrowsAttempted"].asInteger > 0) { ftp = playerStats["nFreethrowsMade"].asDouble / playerStats["nFreethrowsAttempted"].asInteger } rpg = playerStats["nRebounds"].asDouble / playerStats["nGamesPlayed"].asInteger apg = playerStats["nAssists"].asDouble / playerStats["nGamesPlayed"].asInteger tpg = playerStats["nTurnovers"].asDouble / playerStats["nGamesPlayed"].asInteger spg = playerStats["nSteals"].asDouble / playerStats["nGamesPlayed"].asInteger bpg = playerStats["nBlocks"].asDouble / playerStats["nGamesPlayed"].asInteger ppg = playerStats["nNBAPoints"].asDouble / playerStats["nGamesPlayed"].asInteger VGMpoints = playerStats["nVGMPoints"].asDouble } numberFormat(null) '' numberFormat("#.000") '' numberFormat(null) '' '' '' '' x = x + 1 } } } %> <% /************************** BUILD AVAILABLE PLAYERS TABLE *****************************/ if (ap != null) { if (ap[0].player.positionID < 5) { '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' //'' '' '' '' '' %> <% foreach (x in start..end) { plyr = ap[x] player = plyr.player playerStats = plyr.playerTotals numberFormat(null) if (player.ID != 55555555) { '\n' '' '' '' '' nullFormat("--") gp = 0 fgp = 0 ftp = 0 rpg = 0 apg = 0 tpg = 0 spg = 0 bpg = 0 ppg = 0 VGMpoints = 0 gp = playerStats["nGamesPlayed"].asInteger if (gp > 0) { if (playerStats["nFieldGoalsAttempted"].asInteger > 0) { fgp = playerStats["nFieldGoalsMade"].asDouble / playerStats["nFieldGoalsAttempted"].asInteger } if (playerStats["nFreethrowsAttempted"].asInteger > 0) { ftp = playerStats["nFreethrowsMade"].asDouble / playerStats["nFreethrowsAttempted"].asInteger } rpg = playerStats["nRebounds"].asDouble / playerStats["nGamesPlayed"].asInteger apg = playerStats["nAssists"].asDouble / playerStats["nGamesPlayed"].asInteger tpg = playerStats["nTurnovers"].asDouble / playerStats["nGamesPlayed"].asInteger spg = playerStats["nSteals"].asDouble / playerStats["nGamesPlayed"].asInteger bpg = playerStats["nBlocks"].asDouble / playerStats["nGamesPlayed"].asInteger ppg = playerStats["nNBAPoints"].asDouble / playerStats["nGamesPlayed"].asInteger VGMpoints = playerStats["nVGMPoints"].asDouble / playerStats["nGamesPlayed"].asInteger } numberFormat(null) '' '' '' '' '' '' '' '' '' '' '' '' '' } } } else { '' '' '' '' '' '' '' '' '' '' '' '' '' foreach (plyr in ap){ player = plyr.player playerStats = plyr.playerTotals if (player.ID != 55555555) { '\n' numberFormat(null) '' '' '' '' nullFormat("--") gp = 0 fgp = 0 ftp = 0 rpg = 0 apg = 0 tpg = 0 spg = 0 bpg = 0 ppg = 0 VGMpoints = 0 gp = playerStats["nGamesPlayed"].asInteger if (gp > 0) { fgp = playerStats["nFieldGoalsMade"].asDouble / playerStats["nFieldGoalsAttempted"].asInteger ftp = playerStats["nFreethrowsMade"].asDouble / playerStats["nFreethrowsAttempted"].asInteger rpg = playerStats["nRebounds"].asDouble / playerStats["nGamesPlayed"].asInteger apg = playerStats["nAssists"].asDouble / playerStats["nGamesPlayed"].asInteger tpg = playerStats["nTurnovers"].asDouble / playerStats["nGamesPlayed"].asInteger spg = playerStats["nSteals"].asDouble / playerStats["nGamesPlayed"].asInteger bpg = playerStats["nBlocks"].asDouble / playerStats["nGamesPlayed"].asInteger ppg = playerStats["nNBAPoints"].asDouble / playerStats["nGamesPlayed"].asInteger VGMpoints = playerStats["nVGMPoints"].asDouble } numberFormat(null) '' numberFormat("#.000") '' numberFormat(null) '' '' '' '' } } } '
Your Current <% challenge.positions[obj.positionID].name %>
KEEPPLAYERNEXT GPFG%FT%RPGAPGTPGSPGBPGPPGVGM*PTS RATINGLOCK
' & player.firstName & ' ' & player.lastName & ', ' & player.proTeam.abbrev if (player.isInjured !=0) { '*' } '' & player.addlText & ' ' & gp & '' numberFormat("#.000") fgp & '' numberFormat("#.000") ftp & '' numberFormat(".0") rpg & '' & apg & '' & tpg & '' & spg & '' & bpg & '' & ppg & '' & VGMpoints & ' ' & player.value & '' & plyr.lockedSalary & '
Your Current ' & challenge.positions[obj.positionID].name & '
KEEPCOACHNEXT REC.PCTVGM** RATINGCHANGE
' & player.firstName & ' ' & player.lastName & ', ' & player.proTeam.abbrev if (player.isInjured !=0) { '*' } '' & player.addlText & ' ' & playerStats["nWins"] & '-' & (gp- playerStats["nWins"].asInteger) & '' if (gp == 0) { '.000'} else { playerStats["nWins"].asDouble / gp } '' & VGMpoints & ' ' & player.value & '' & plyr.lockedSalary & '
Available ' & challenge.positions[obj.positionID].pluralName & '
ADDPLAYERNEXT GPFG%FT%RPGAPGTPGSPGBPGPPGVGM*PTS RATINGCHNG
' & player.firstName & ' ' & player.lastName & ', ' & player.proTeam.abbrev if (player.isInjured !=0) { '*' } '' & player.addlText & ' ' & gp & '' numberFormat("#.000") fgp & '' numberFormat("#.000") ftp & '' numberFormat("0.0") rpg & '' & apg & '' & tpg & '' & spg & '' & bpg & '' & ppg & '' & VGMpoints & ' ' & player.value & '' & player.valueDelta & '
Available ' & challenge.positions[obj.positionID].name & '
ADDCOACHNEXT REC.PCTVGM** RATINGCHANGE
' & player.firstName & ' ' & player.lastName & ', ' & player.proTeam.abbrev if (player.isInjured !=0) { '*' } '' & player.addlText & ' ' & playerStats["nWins"] & '-' & (gp- playerStats["nWins"].asInteger) & '' if (gp == 0) { '.000'} else { playerStats["nWins"].asDouble / gp } '' & VGMpoints & ' ' & player.value & '' & player.valueDelta & '
' numberFormat("#") if (start > 29) { 'Previous' } if (end < obj.availablePlayers.length - 1 and start > 29) { ' | ' } if (end < obj.availablePlayers.length - 1) { 'Next' } '' } %>

<% '' %> VGM* = (PTS + REB + AST + STL + BLK) - ((FGA - FGM) + (FTA - FTM) + TO)
VGM** = Coaches receive five pts for every game won by that coach's WNBA team
* - Player is injured.
<% Footer("FreeAgencySvc") %>