mirror of
https://gitlab.com/Deukhoofd/BattleSim.git
synced 2025-10-27 18:00:03 +00:00
Added framework for random team generation, added admin buttons to generate teams, changed authorization to use different forums depending on test or production
This commit is contained in:
@@ -23,9 +23,13 @@ class @TeambuilderView extends Backbone.View
|
||||
'click .add_pokemon': 'addNewPokemonEvent'
|
||||
'click .save_team': 'saveTeam'
|
||||
|
||||
'click .random-team-admin a': 'randomTeamTierChange'
|
||||
'click .getrandomteams': 'getRandomTeams'
|
||||
|
||||
initialize: (attributes) =>
|
||||
@selectedPokemon = 0
|
||||
@selectedTeam = null
|
||||
@randomformatadmin = window.DEFAULT_FORMAT
|
||||
|
||||
@render()
|
||||
|
||||
@@ -159,17 +163,18 @@ class @TeambuilderView extends Backbone.View
|
||||
format = $link.data('format')
|
||||
team = @getSelectedTeam()
|
||||
realformat = window.PokeBattle.conditions.Formats_[format]
|
||||
console.log(team.hasPBV())
|
||||
console.log(team.hasTier())
|
||||
if realformat.tierBased and team.hasPBV()
|
||||
console.log('this')
|
||||
else if !realformat.tierBased and team.hasTier()
|
||||
console.log('that')
|
||||
if format != team.get('generation')
|
||||
team.set('generation', format)
|
||||
@renderTeam()
|
||||
@dirty() # renderTeam() removes dirty, so call it again
|
||||
|
||||
randomTeamTierChange: (e) =>
|
||||
@$("#currentselectedrandomadminformat")[0].innerHTML = e.currentTarget.text
|
||||
@randomformatadmin = e.currentTarget.dataset.format
|
||||
getRandomTeams: (e) =>
|
||||
number = parseInt(e.currentTarget.textContent, 10)
|
||||
PokeBattle.primus.send('getRandomTeamsAdmin', @randomformatadmin, number)
|
||||
|
||||
setSelectedPokemonIndex: (index) =>
|
||||
pokemon = @getSelectedTeam().at(index)
|
||||
@selectedPokemon = index
|
||||
|
||||
@@ -11,5 +11,16 @@ if window.PokeBattle.username == "Deukhoofd" || window.PokeBattle.username == "t
|
||||
h5 Admin Commands
|
||||
.button.get-teams Get all teams
|
||||
br
|
||||
| Get teams from user
|
||||
input(type=text)
|
||||
| Get Random teams
|
||||
- var allformats = window.PokeBattle.conditions.Formats()
|
||||
.dropdown.random-team-admin
|
||||
.current-format-random-admin.button.dropdown-toggle(data-toggle="dropdown")
|
||||
a#currentselectedrandomadminformat(href="#", data-format="#{allformats[window.DEFAULT_FORMAT].name}") #{allformats[window.DEFAULT_FORMAT].humanName}
|
||||
ul.dropdown-menu(role='menu')
|
||||
for format in allformats
|
||||
li
|
||||
a(href="#", data-format="#{format.name}") #{format.humanName}
|
||||
.button.getrandomteams 1
|
||||
.button.getrandomteams 5
|
||||
.button.getrandomteams 10
|
||||
.button.getrandomteams 25
|
||||
Reference in New Issue
Block a user