mirror of
https://gitlab.com/Deukhoofd/BattleSim.git
synced 2025-10-27 18:00:03 +00:00
Added Find Battle Unranked
This commit is contained in:
BIN
public/Sprites/Icons/iconempty.png
Normal file
BIN
public/Sprites/Icons/iconempty.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 301 B |
BIN
public/Sprites/favicon.png
Normal file
BIN
public/Sprites/favicon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 597 B |
@@ -6,7 +6,7 @@
|
||||
.red{color:#dc4e48}
|
||||
.yellow{color:#b92}
|
||||
.grey{color:#999}
|
||||
html,body{color:#333332;padding:0;margin:0;font-size:100%;font-family:'proxima-nova','Helvetica Neue',Calibri,'Droid Sans',Helvetica,Arial,sans-serif;background:#f3f3f3 url("//media.pokebattle.com/img/bg.png");line-height:normal}
|
||||
html,body{color:#333332;padding:0;margin:0;font-size:100%;font-family:'proxima-nova','Helvetica Neue',Calibri,'Droid Sans',Helvetica,Arial,sans-serif;background:#f3f3f3 #00f;line-height:normal}
|
||||
ul,ol{list-style:none}
|
||||
ul,ol,p{margin:0;padding:0}
|
||||
#content{position:absolute;top:0;left:150px;right:0;bottom:0;-webkit-box-shadow:0 0 10px #000;box-shadow:0 0 10px #000}
|
||||
|
||||
@@ -3146,8 +3146,7 @@
|
||||
$this = $(el);
|
||||
team = $this.data('team');
|
||||
slot = $this.data('slot');
|
||||
pokemon = _this.model.getPokemon(team, slot);
|
||||
return _this.pokemonPopover($this, pokemon);
|
||||
return pokemon = _this.model.getPokemon(team, slot);
|
||||
};
|
||||
})(this));
|
||||
this.renderTimers();
|
||||
@@ -3338,6 +3337,7 @@
|
||||
$newPokemon.attr('data-slot', slot);
|
||||
$newPokemon.removeClass('hidden');
|
||||
this.pokemonPopover($newSprite, pokemon);
|
||||
pokemon.set('beeninbattle', true);
|
||||
this.cannedText('SENT_OUT', player, player, slot);
|
||||
if (this.skip != null) {
|
||||
$oldPokemon.css({
|
||||
@@ -7476,8 +7476,24 @@
|
||||
(function() {
|
||||
var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
||||
|
||||
this.challengePaneArray = [];
|
||||
|
||||
this.challengePaneObject = (function() {
|
||||
function challengePaneObject(object) {
|
||||
this.object = object;
|
||||
this.event = this.object.eventName;
|
||||
this.button = this.object.button;
|
||||
this.populate = this.object.populate;
|
||||
this.clauses = this.object.defaultClauses;
|
||||
this.blockedClauses = this.object.blockedClauses;
|
||||
}
|
||||
|
||||
return challengePaneObject;
|
||||
|
||||
})();
|
||||
|
||||
this.createChallengePane = function(opts) {
|
||||
var $accept, $button, $buttons, $checkboxes, $format, $reject, $selectFormat, $wrapper, acceptEventName, altCreatedEvent, blockedClauses, cancelChallenge, cancelEventName, capitalizedEventName, defaultClauses, disableButtons, enableButtons, eventName, generation, getSelectedTeam, isAttachedToDom, personId, rejectEventName, renderCurrentTeam, selectedAlt, selectedTeamId, teamUpdated, toggleAltInput, _ref;
|
||||
var $PaneArray, $accept, $button, $buttons, $checkboxes, $format, $reject, $selectFormat, $wrapper, acceptEventName, altCreatedEvent, blockedClauses, cancelChallenge, cancelEventName, capitalizedEventName, defaultClauses, disableButtons, enableButtons, eventName, generation, getSelectedTeam, isAttachedToDom, personId, rejectEventName, renderCurrentTeam, selectedAlt, selectedTeamId, teamUpdated, toggleAltInput, _ref;
|
||||
$wrapper = opts.populate;
|
||||
$button = opts.button;
|
||||
$accept = opts.acceptButton || $();
|
||||
@@ -7494,6 +7510,7 @@
|
||||
blockedClauses = (_ref = opts.blockedClauses) != null ? _ref : false;
|
||||
selectedTeamId = null;
|
||||
selectedAlt = null;
|
||||
$PaneArray = this.challengePaneArray;
|
||||
getSelectedTeam = function() {
|
||||
return PokeBattle.TeamStore.get(selectedTeamId) || PokeBattle.TeamStore.at(0);
|
||||
};
|
||||
@@ -7554,9 +7571,16 @@
|
||||
}));
|
||||
$selectFormat = $wrapper.find(".select-format");
|
||||
$button.on('click.challenge', function() {
|
||||
var $clauses, clauses, format, team, teamJSON;
|
||||
var $clauses, clauses, format, team, teamJSON, thisChallenge;
|
||||
thisChallenge = _.find($PaneArray, function(butt) {
|
||||
return butt.button.selector === $button.selector;
|
||||
});
|
||||
console.log(thisChallenge);
|
||||
PokeBattle.requestNotifyPermission();
|
||||
format = $selectFormat.data('format');
|
||||
if (typeof format === "undefined" && typeof personId === "undefined") {
|
||||
format = $('.select-format').data('format');
|
||||
}
|
||||
if (!$button.hasClass('disabled')) {
|
||||
team = getSelectedTeam();
|
||||
if (!team) {
|
||||
@@ -7572,7 +7596,7 @@
|
||||
$clauses.each(function() {
|
||||
return clauses.push(parseInt($(this).val(), 10));
|
||||
});
|
||||
PokeBattle.primus.send(eventName, personId, format, teamJSON, clauses, selectedAlt);
|
||||
PokeBattle.primus.send(eventName, personId, format, teamJSON, thisChallenge.clauses, selectedAlt);
|
||||
} else {
|
||||
PokeBattle.primus.send(eventName, format, teamJSON, selectedAlt);
|
||||
}
|
||||
@@ -11062,14 +11086,39 @@
|
||||
}).call(this);
|
||||
|
||||
(function() {
|
||||
var depressFindBattle;
|
||||
var depressFindBattle, depressFindBattleUnranked;
|
||||
|
||||
$(function() {
|
||||
var $mainButtons;
|
||||
var $mainButtons, challengeobj, challengeobjunranked, challengepaneobj, challengepaneobjunranked;
|
||||
$mainButtons = $('.main_buttons');
|
||||
$mainButtons.on('click', '.teambuilder_button', function(e) {
|
||||
return PokeBattle.navigation.showTeambuilder();
|
||||
});
|
||||
challengeobjunranked = {
|
||||
eventName: "findBattleunranked",
|
||||
populate: $mainButtons.find('.find_battle_select_team'),
|
||||
button: $mainButtons.find('.find_battle_non_ranked'),
|
||||
defaultClauses: [Conditions.SLEEP_CLAUSE, Conditions.EVASION_CLAUSE, Conditions.SPECIES_CLAUSE, Conditions.OHKO_CLAUSE, Conditions.PRANKSTER_SWAGGER_CLAUSE, Conditions.UNRELEASED_BAN, Conditions.TIMED_BATTLE],
|
||||
blockedClauses: true
|
||||
};
|
||||
challengeobj = {
|
||||
eventName: "findBattle",
|
||||
populate: $mainButtons.find('.find_battle_select_team'),
|
||||
button: $mainButtons.find('.find_battle'),
|
||||
defaultClauses: [Conditions.SLEEP_CLAUSE, Conditions.EVASION_CLAUSE, Conditions.SPECIES_CLAUSE, Conditions.OHKO_CLAUSE, Conditions.PRANKSTER_SWAGGER_CLAUSE, Conditions.UNRELEASED_BAN, Conditions.RATED_BATTLE, Conditions.TIMED_BATTLE],
|
||||
blockedClauses: true
|
||||
};
|
||||
challengepaneobjunranked = new challengePaneObject(challengeobjunranked);
|
||||
challengePaneArray.push(challengepaneobjunranked);
|
||||
challengepaneobj = new challengePaneObject(challengeobj);
|
||||
challengePaneArray.push(challengepaneobj);
|
||||
createChallengePane({
|
||||
eventName: "findBattleunranked",
|
||||
populate: $mainButtons.find('.find_battle_select_team'),
|
||||
button: $mainButtons.find('.find_battle_non_ranked'),
|
||||
defaultClauses: [Conditions.SLEEP_CLAUSE, Conditions.EVASION_CLAUSE, Conditions.SPECIES_CLAUSE, Conditions.OHKO_CLAUSE, Conditions.PRANKSTER_SWAGGER_CLAUSE, Conditions.UNRELEASED_BAN, Conditions.TIMED_BATTLE],
|
||||
blockedClauses: true
|
||||
});
|
||||
createChallengePane({
|
||||
eventName: "findBattle",
|
||||
populate: $mainButtons.find('.find_battle_select_team'),
|
||||
@@ -11082,6 +11131,11 @@
|
||||
$this = $(this);
|
||||
return $this.find('.find-icon').addClass('icon-spinner spinner-anim').removeClass("icon-earth");
|
||||
});
|
||||
$mainButtons.find('.find_battle_non_ranked').on('challenge', function() {
|
||||
var $this;
|
||||
$this = $(this);
|
||||
return $this.find('.find-icon').addClass('icon-spinner spinner-anim').removeClass("icon-earth");
|
||||
});
|
||||
return $mainButtons.find('.display_credits').click(function() {
|
||||
var $modal;
|
||||
$modal = PokeBattle.modal('modals/credits');
|
||||
@@ -11098,16 +11152,28 @@
|
||||
return $mainButtons.find('.find_battle_select_team .select').removeClass('disabled');
|
||||
};
|
||||
|
||||
depressFindBattleUnranked = function() {
|
||||
var $button, $mainButtons;
|
||||
$mainButtons = $('.main_buttons');
|
||||
$button = $mainButtons.find('.find_battle_non_ranked');
|
||||
$button.removeClass("disabled");
|
||||
$button.find('.find-icon').removeClass("icon-spinner spinner-anim").addClass("icon-earth");
|
||||
return $mainButtons.find('.find_battle_select_team .select').removeClass('disabled');
|
||||
};
|
||||
|
||||
$(window).load(function() {
|
||||
var $mainButtons;
|
||||
$mainButtons = $('.main_buttons');
|
||||
PokeBattle.battles.on('add', function(battle) {
|
||||
if (!battle.get('spectating')) {
|
||||
return depressFindBattle();
|
||||
depressFindBattle();
|
||||
return depressFindBattleUnranked();
|
||||
}
|
||||
});
|
||||
PokeBattle.primus.on('findBattleCanceled', depressFindBattle);
|
||||
return PokeBattle.events.on('findBattleCanceled', depressFindBattle);
|
||||
PokeBattle.events.on('findBattleCanceled', depressFindBattle);
|
||||
PokeBattle.primus.on('findBattleCanceledUnranked', depressFindBattleUnranked);
|
||||
return PokeBattle.events.on('findBattleCanceledUnranked', depressFindBattleUnranked);
|
||||
});
|
||||
|
||||
}).call(this);
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -2872,8 +2872,7 @@
|
||||
$this = $(el);
|
||||
team = $this.data('team');
|
||||
slot = $this.data('slot');
|
||||
pokemon = _this.model.getPokemon(team, slot);
|
||||
return _this.pokemonPopover($this, pokemon);
|
||||
return pokemon = _this.model.getPokemon(team, slot);
|
||||
};
|
||||
})(this));
|
||||
this.renderTimers();
|
||||
@@ -3064,6 +3063,7 @@
|
||||
$newPokemon.attr('data-slot', slot);
|
||||
$newPokemon.removeClass('hidden');
|
||||
this.pokemonPopover($newSprite, pokemon);
|
||||
pokemon.set('beeninbattle', true);
|
||||
this.cannedText('SENT_OUT', player, player, slot);
|
||||
if (this.skip != null) {
|
||||
$oldPokemon.css({
|
||||
@@ -5208,8 +5208,24 @@
|
||||
(function() {
|
||||
var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
|
||||
|
||||
this.challengePaneArray = [];
|
||||
|
||||
this.challengePaneObject = (function() {
|
||||
function challengePaneObject(object) {
|
||||
this.object = object;
|
||||
this.event = this.object.eventName;
|
||||
this.button = this.object.button;
|
||||
this.populate = this.object.populate;
|
||||
this.clauses = this.object.defaultClauses;
|
||||
this.blockedClauses = this.object.blockedClauses;
|
||||
}
|
||||
|
||||
return challengePaneObject;
|
||||
|
||||
})();
|
||||
|
||||
this.createChallengePane = function(opts) {
|
||||
var $accept, $button, $buttons, $checkboxes, $format, $reject, $selectFormat, $wrapper, acceptEventName, altCreatedEvent, blockedClauses, cancelChallenge, cancelEventName, capitalizedEventName, defaultClauses, disableButtons, enableButtons, eventName, generation, getSelectedTeam, isAttachedToDom, personId, rejectEventName, renderCurrentTeam, selectedAlt, selectedTeamId, teamUpdated, toggleAltInput, _ref;
|
||||
var $PaneArray, $accept, $button, $buttons, $checkboxes, $format, $reject, $selectFormat, $wrapper, acceptEventName, altCreatedEvent, blockedClauses, cancelChallenge, cancelEventName, capitalizedEventName, defaultClauses, disableButtons, enableButtons, eventName, generation, getSelectedTeam, isAttachedToDom, personId, rejectEventName, renderCurrentTeam, selectedAlt, selectedTeamId, teamUpdated, toggleAltInput, _ref;
|
||||
$wrapper = opts.populate;
|
||||
$button = opts.button;
|
||||
$accept = opts.acceptButton || $();
|
||||
@@ -5226,6 +5242,7 @@
|
||||
blockedClauses = (_ref = opts.blockedClauses) != null ? _ref : false;
|
||||
selectedTeamId = null;
|
||||
selectedAlt = null;
|
||||
$PaneArray = this.challengePaneArray;
|
||||
getSelectedTeam = function() {
|
||||
return PokeBattle.TeamStore.get(selectedTeamId) || PokeBattle.TeamStore.at(0);
|
||||
};
|
||||
@@ -5286,9 +5303,16 @@
|
||||
}));
|
||||
$selectFormat = $wrapper.find(".select-format");
|
||||
$button.on('click.challenge', function() {
|
||||
var $clauses, clauses, format, team, teamJSON;
|
||||
var $clauses, clauses, format, team, teamJSON, thisChallenge;
|
||||
thisChallenge = _.find($PaneArray, function(butt) {
|
||||
return butt.button.selector === $button.selector;
|
||||
});
|
||||
console.log(thisChallenge);
|
||||
PokeBattle.requestNotifyPermission();
|
||||
format = $selectFormat.data('format');
|
||||
if (typeof format === "undefined" && typeof personId === "undefined") {
|
||||
format = $('.select-format').data('format');
|
||||
}
|
||||
if (!$button.hasClass('disabled')) {
|
||||
team = getSelectedTeam();
|
||||
if (!team) {
|
||||
@@ -5304,7 +5328,7 @@
|
||||
$clauses.each(function() {
|
||||
return clauses.push(parseInt($(this).val(), 10));
|
||||
});
|
||||
PokeBattle.primus.send(eventName, personId, format, teamJSON, clauses, selectedAlt);
|
||||
PokeBattle.primus.send(eventName, personId, format, teamJSON, thisChallenge.clauses, selectedAlt);
|
||||
} else {
|
||||
PokeBattle.primus.send(eventName, format, teamJSON, selectedAlt);
|
||||
}
|
||||
|
||||
@@ -383,8 +383,6 @@ var teamIndex = (team === yourTeam ? yourIndex : 1 - yourIndex)
|
||||
buf.push("<div" + (jade.attrs({ "class": [('bg-faded-blue'),('fill-' + leftOrRight)] }, {"class":true})) + "><div" + (jade.attrs({ "class": [(leftOrRight)] }, {"class":true})) + "><div class=\"owner_name\">" + (jade.escape(null == (jade.interp = team.get('owner')) ? "" : jade.interp)) + "</div><div class=\"battle-timer frozen-timer hidden\"></div><div class=\"battle-timer remaining-timer\"></div><div class=\"pokemon_icons\">");
|
||||
var teamvisible = team.collection.parents[0].get('visibleteam')
|
||||
var isdef = typeof teamvisible
|
||||
if ( isdef != 'undefined' && teamvisible)
|
||||
{
|
||||
var orig = team.get('pokemon')
|
||||
var teamPokemon = team.getRandomOrder()
|
||||
for (var i = 0, len = teamPokemon.length; i < len; i += 1)
|
||||
@@ -396,13 +394,38 @@ buf.push("<div class=\"icon_wrapper\">");
|
||||
var origpkmn = orig.findWhere({species: pokemon.species});
|
||||
var faintClass = (origpkmn.isFainted() ? 'fainted' : '')
|
||||
var style = window.PokemonIconBackground(origpkmn)
|
||||
if ( isdef != 'undefined' && teamvisible)
|
||||
{
|
||||
buf.push("<a" + (jade.attrs({ 'href':(window.PokemonIconBackground(origpkmn)), 'target':("_blank"), 'style':(style), 'data-team':(teamIndex), 'data-slot':(i), "class": [('pokemon_icon'),(faintClass)] }, {"class":true,"href":true,"target":true,"style":true,"data-team":true,"data-slot":true})) + "></a>");
|
||||
if ( !origpkmn.isFainted())
|
||||
{
|
||||
buf.push("<div class=\"pokemon_hp_background\"><div" + (jade.attrs({ 'style':("height: " + (origpkmn.getSpecies().id) + "%"), "class": [('pokemon_hp'),(origpkmn.getHPColor())] }, {"class":true,"style":true})) + "></div></div>");
|
||||
}
|
||||
buf.push("</div>");
|
||||
}
|
||||
else
|
||||
{
|
||||
var hasbeeninbattle = origpkmn.get('beeninbattle')
|
||||
if ( hasbeeninbattle == true)
|
||||
{
|
||||
console.log('hasbeeninbattle')
|
||||
buf.push("<a" + (jade.attrs({ 'href':(window.PokemonIconBackground(origpkmn)), 'target':("_blank"), 'style':(style), 'data-team':(teamIndex), 'data-slot':(i), "class": [('pokemon_icon'),(faintClass)] }, {"class":true,"href":true,"target":true,"style":true,"data-team":true,"data-slot":true})) + "></a>");
|
||||
if ( !origpkmn.isFainted())
|
||||
{
|
||||
buf.push("<div class=\"pokemon_hp_background\"><div" + (jade.attrs({ 'style':("height: " + (origpkmn.getSpecies().id) + "%"), "class": [('pokemon_hp'),(origpkmn.getHPColor())] }, {"class":true,"style":true})) + "></div></div>");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log('hasnoybeeninbattle')
|
||||
var newstyle = "background:url('../Sprites/Icons/iconempty.png')!important; background-size: cover!important;"
|
||||
buf.push("<a" + (jade.attrs({ 'href':(""), 'target':("_blank"), 'style':(newstyle), 'data-team':(teamIndex), 'data-slot':(i), "class": [('pokemon_icon'),(faintClass)] }, {"class":true,"href":true,"target":true,"style":true,"data-team":true,"data-slot":true})) + "></a>");
|
||||
if ( !origpkmn.isFainted())
|
||||
{
|
||||
buf.push("<div class=\"pokemon_hp_background\"><div" + (jade.attrs({ 'style':("height: " + (origpkmn.getSpecies().id) + "%"), "class": [('pokemon_hp'),(origpkmn.getHPColor())] }, {"class":true,"style":true})) + "></div></div>");
|
||||
}
|
||||
}
|
||||
}
|
||||
buf.push("</div>");
|
||||
}
|
||||
}
|
||||
buf.push("</div></div></div>");
|
||||
@@ -418,8 +441,6 @@ var teamIndex = (team === yourTeam ? yourIndex : 1 - yourIndex)
|
||||
buf.push("<div" + (jade.attrs({ "class": [('bg-faded-blue'),('fill-' + leftOrRight)] }, {"class":true})) + "><div" + (jade.attrs({ "class": [(leftOrRight)] }, {"class":true})) + "><div class=\"owner_name\">" + (jade.escape(null == (jade.interp = team.get('owner')) ? "" : jade.interp)) + "</div><div class=\"battle-timer frozen-timer hidden\"></div><div class=\"battle-timer remaining-timer\"></div><div class=\"pokemon_icons\">");
|
||||
var teamvisible = team.collection.parents[0].get('visibleteam')
|
||||
var isdef = typeof teamvisible
|
||||
if ( isdef != 'undefined' && teamvisible)
|
||||
{
|
||||
var orig = team.get('pokemon')
|
||||
var teamPokemon = team.getRandomOrder()
|
||||
for (var i = 0, len = teamPokemon.length; i < len; i += 1)
|
||||
@@ -431,13 +452,38 @@ buf.push("<div class=\"icon_wrapper\">");
|
||||
var origpkmn = orig.findWhere({species: pokemon.species});
|
||||
var faintClass = (origpkmn.isFainted() ? 'fainted' : '')
|
||||
var style = window.PokemonIconBackground(origpkmn)
|
||||
if ( isdef != 'undefined' && teamvisible)
|
||||
{
|
||||
buf.push("<a" + (jade.attrs({ 'href':(window.PokemonIconBackground(origpkmn)), 'target':("_blank"), 'style':(style), 'data-team':(teamIndex), 'data-slot':(i), "class": [('pokemon_icon'),(faintClass)] }, {"class":true,"href":true,"target":true,"style":true,"data-team":true,"data-slot":true})) + "></a>");
|
||||
if ( !origpkmn.isFainted())
|
||||
{
|
||||
buf.push("<div class=\"pokemon_hp_background\"><div" + (jade.attrs({ 'style':("height: " + (origpkmn.getSpecies().id) + "%"), "class": [('pokemon_hp'),(origpkmn.getHPColor())] }, {"class":true,"style":true})) + "></div></div>");
|
||||
}
|
||||
buf.push("</div>");
|
||||
}
|
||||
else
|
||||
{
|
||||
var hasbeeninbattle = origpkmn.get('beeninbattle')
|
||||
if ( hasbeeninbattle == true)
|
||||
{
|
||||
console.log('hasbeeninbattle')
|
||||
buf.push("<a" + (jade.attrs({ 'href':(window.PokemonIconBackground(origpkmn)), 'target':("_blank"), 'style':(style), 'data-team':(teamIndex), 'data-slot':(i), "class": [('pokemon_icon'),(faintClass)] }, {"class":true,"href":true,"target":true,"style":true,"data-team":true,"data-slot":true})) + "></a>");
|
||||
if ( !origpkmn.isFainted())
|
||||
{
|
||||
buf.push("<div class=\"pokemon_hp_background\"><div" + (jade.attrs({ 'style':("height: " + (origpkmn.getSpecies().id) + "%"), "class": [('pokemon_hp'),(origpkmn.getHPColor())] }, {"class":true,"style":true})) + "></div></div>");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
console.log('hasnoybeeninbattle')
|
||||
var newstyle = "background:url('../Sprites/Icons/iconempty.png')!important; background-size: cover!important;"
|
||||
buf.push("<a" + (jade.attrs({ 'href':(""), 'target':("_blank"), 'style':(newstyle), 'data-team':(teamIndex), 'data-slot':(i), "class": [('pokemon_icon'),(faintClass)] }, {"class":true,"href":true,"target":true,"style":true,"data-team":true,"data-slot":true})) + "></a>");
|
||||
if ( !origpkmn.isFainted())
|
||||
{
|
||||
buf.push("<div class=\"pokemon_hp_background\"><div" + (jade.attrs({ 'style':("height: " + (origpkmn.getSpecies().id) + "%"), "class": [('pokemon_hp'),(origpkmn.getHPColor())] }, {"class":true,"style":true})) + "></div></div>");
|
||||
}
|
||||
}
|
||||
}
|
||||
buf.push("</div>");
|
||||
}
|
||||
}
|
||||
buf.push("</div></div></div>");
|
||||
|
||||
Reference in New Issue
Block a user