1
0
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:
Deukhoofd
2016-04-11 20:01:11 +02:00
parent 03e1e7d440
commit cd9ea965bb
10 changed files with 5620 additions and 5282 deletions

View File

@@ -6364,6 +6364,8 @@
this.setSelectedTeam = __bind(this.setSelectedTeam, this);
this.getSelectedPokemon = __bind(this.getSelectedPokemon, this);
this.setSelectedPokemonIndex = __bind(this.setSelectedPokemonIndex, this);
this.getRandomTeams = __bind(this.getRandomTeams, this);
this.randomTeamTierChange = __bind(this.randomTeamTierChange, this);
this.changeTeamFormat = __bind(this.changeTeamFormat, this);
this.saveTeam = __bind(this.saveTeam, this);
this.addNewPokemon = __bind(this.addNewPokemon, this);
@@ -6408,12 +6410,15 @@
'click .go_back': 'goBackToOverview',
'click .pokemon_list li': 'clickPokemon',
'click .add_pokemon': 'addNewPokemonEvent',
'click .save_team': 'saveTeam'
'click .save_team': 'saveTeam',
'click .random-team-admin a': 'randomTeamTierChange',
'click .getrandomteams': 'getRandomTeams'
};
TeambuilderView.prototype.initialize = function(attributes) {
this.selectedPokemon = 0;
this.selectedTeam = null;
this.randomformatadmin = window.DEFAULT_FORMAT;
this.render();
this.listenTo(PokeBattle.TeamStore, 'reset', this.resetTeams);
this.listenTo(PokeBattle.TeamStore, 'add', this.addNewTeam);
@@ -6594,13 +6599,6 @@
format = $link.data('format');
team = this.getSelectedTeam();
realformat = window.PokeBattle.conditions.Formats_[format];
console.log(team.hasPBV());
console.log(team.hasTier());
if (realformat.tierBased && team.hasPBV()) {
console.log('this');
} else if (!realformat.tierBased && team.hasTier()) {
console.log('that');
}
if (format !== team.get('generation')) {
team.set('generation', format);
this.renderTeam();
@@ -6608,6 +6606,17 @@
}
};
TeambuilderView.prototype.randomTeamTierChange = function(e) {
this.$("#currentselectedrandomadminformat")[0].innerHTML = e.currentTarget.text;
return this.randomformatadmin = e.currentTarget.dataset.format;
};
TeambuilderView.prototype.getRandomTeams = function(e) {
var number;
number = parseInt(e.currentTarget.textContent, 10);
return PokeBattle.primus.send('getRandomTeamsAdmin', this.randomformatadmin, number);
};
TeambuilderView.prototype.setSelectedPokemonIndex = function(index) {
var pokemon;
pokemon = this.getSelectedTeam().at(index);

File diff suppressed because one or more lines are too long

View File

@@ -1083,7 +1083,7 @@ var locals_ = (locals || {}),team = locals_.team,window = locals_.window;buf.pus
this["JST"]["teambuilder/teams"] = function anonymous(locals
/**/) {
var buf = [];
var locals_ = (locals || {}),teams = locals_.teams,window = locals_.window,text = locals_.text;buf.push("<h2>Your teams</h2><div class=\"teambuilder_teams clearfix\">");
var locals_ = (locals || {}),teams = locals_.teams,window = locals_.window;buf.push("<h2>Your teams</h2><div class=\"teambuilder_teams clearfix\">");
// iterate teams
;(function(){
var $$obj = teams;
@@ -1109,7 +1109,32 @@ buf.push(null == (jade.interp = window.JST['teambuilder/team']({team: team, wind
buf.push("</div><div class=\"button button_blue add-new-team\">Add new team</div><div class=\"button import-team\">Import</div>");
if ( window.PokeBattle.username == "Deukhoofd" || window.PokeBattle.username == "thesuzerain")
{
buf.push("<div class=\"Team-Admin\"><h5>Admin Commands</h5><div class=\"button get-teams\">Get all teams</div><br/>Get teams from user<input" + (jade.attrs({ 'type':(text) }, {"type":true})) + "/></div>");
buf.push("<div class=\"Team-Admin\"><h5>Admin Commands</h5><div class=\"button get-teams\">Get all teams</div><br/>Get Random teams");
var allformats = window.PokeBattle.conditions.Formats()
buf.push("<div class=\"dropdown random-team-admin\"><div data-toggle=\"dropdown\" class=\"current-format-random-admin button dropdown-toggle\"><a" + (jade.attrs({ 'id':('currentselectedrandomadminformat'), 'href':("#"), 'data-format':("" + (allformats[window.DEFAULT_FORMAT].name) + "") }, {"href":true,"data-format":true})) + ">" + (jade.escape((jade.interp = allformats[window.DEFAULT_FORMAT].humanName) == null ? '' : jade.interp)) + "</a></div><ul role=\"menu\" class=\"dropdown-menu\">");
// iterate allformats
;(function(){
var $$obj = allformats;
if ('number' == typeof $$obj.length) {
for (var $index = 0, $$l = $$obj.length; $index < $$l; $index++) {
var format = $$obj[$index];
buf.push("<li><a" + (jade.attrs({ 'href':("#"), 'data-format':("" + (format.name) + "") }, {"href":true,"data-format":true})) + ">" + (jade.escape((jade.interp = format.humanName) == null ? '' : jade.interp)) + "</a></li>");
}
} else {
var $$l = 0;
for (var $index in $$obj) {
$$l++; var format = $$obj[$index];
buf.push("<li><a" + (jade.attrs({ 'href':("#"), 'data-format':("" + (format.name) + "") }, {"href":true,"data-format":true})) + ">" + (jade.escape((jade.interp = format.humanName) == null ? '' : jade.interp)) + "</a></li>");
}
}
}).call(this);
buf.push("</ul><div class=\"button getrandomteams\">1</div><div class=\"button getrandomteams\">5</div><div class=\"button getrandomteams\">10</div><div class=\"button getrandomteams\">25</div></div></div>");
};return buf.join("");
};