1
0
mirror of https://gitlab.com/Deukhoofd/BattleSim.git synced 2025-10-27 18:00:03 +00:00

Added /timer command for enabling the timer after battle has started

This commit is contained in:
Deukhoofd
2016-04-12 19:45:15 +02:00
parent cd9ea965bb
commit 9ca2a8746c
13 changed files with 298 additions and 114 deletions

View File

@@ -7697,14 +7697,19 @@
format = defaultformat();
}
if (!$button.hasClass('disabled')) {
team = getSelectedTeam();
if (!team) {
alert("You need to create a team using the Teambuilder before you can battle.");
PokeBattle.navigation.showTeambuilder();
return;
if ($eventName === "findBattleRandom") {
teamJSON = [];
disableButtons();
} else {
team = getSelectedTeam();
if (!team) {
alert("You need to create a team using the Teambuilder before you can battle.");
PokeBattle.navigation.showTeambuilder();
return;
}
disableButtons();
teamJSON = team.toNonNullJSON().pokemon;
}
disableButtons();
teamJSON = team.toNonNullJSON().pokemon;
PokeBattle.primus.send($eventName, format, teamJSON, options.selectedAlt);
return $button.addClass('disabled').trigger('challenge');
} else {
@@ -11325,7 +11330,7 @@
}
options = {
title: "Your login timed out!",
body: "To access the simulator, you need to\n<a href=\"http://91.121.152.74/\">login again</a>."
body: "To access the simulator, you need to\n<a href=\"https://battling.p-insurgence.com\">login again</a>."
};
$modal = PokeBattle.modal('modals/errors', options);
$modal.find('.modal-footer button').first().focus();
@@ -11353,6 +11358,8 @@
return PokeBattle.primus.end();
case e.FIND_BATTLE:
PokeBattle.events.trigger("findBattleCanceled");
PokeBattle.events.trigger("findBattleCanceledUnranked");
PokeBattle.events.trigger("findBattleCanceledRandom");
errors = args[0];
return alert(errors);
case e.BATTLE_DNE:
@@ -11409,7 +11416,7 @@
}).call(this);
(function() {
var depressFindBattle, depressFindBattleUnranked;
var depressFindBattle, depressFindBattleRandom, depressFindBattleUnranked;
$(function() {
var $mainButtons;
@@ -11427,6 +11434,11 @@
button: $mainButtons.find('.find_battle_non_ranked'),
clauses: [Conditions.SLEEP_CLAUSE, Conditions.EVASION_CLAUSE, Conditions.SPECIES_CLAUSE, Conditions.OHKO_CLAUSE, Conditions.PRANKSTER_SWAGGER_CLAUSE, Conditions.TIMED_BATTLE]
});
createChallengeButton({
eventName: "findBattleRandom",
button: $mainButtons.find('.find_battle_random'),
clauses: [Conditions.SLEEP_CLAUSE, Conditions.EVASION_CLAUSE, Conditions.SPECIES_CLAUSE, Conditions.OHKO_CLAUSE, Conditions.PRANKSTER_SWAGGER_CLAUSE, Conditions.TIMED_BATTLE]
});
createChallengePaneNew({
populate: $mainButtons.find('.find_battle_select_team')
});
@@ -11440,6 +11452,11 @@
$this = $(this);
return $this.find('.find-icon').addClass('icon-spinner spinner-anim').removeClass("icon-earth");
});
$mainButtons.find('.find_battle_random').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');
@@ -11465,19 +11482,31 @@
return $mainButtons.find('.find_battle_select_team .select').removeClass('disabled');
};
depressFindBattleRandom = function() {
var $button, $mainButtons;
$mainButtons = $('.main_buttons');
$button = $mainButtons.find('.find_battle_random');
$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')) {
depressFindBattle();
return depressFindBattleUnranked();
depressFindBattleUnranked();
return depressFindBattleRandom();
}
});
PokeBattle.primus.on('findBattleCanceled', depressFindBattle);
PokeBattle.events.on('findBattleCanceled', depressFindBattle);
PokeBattle.primus.on('findBattleCanceledUnranked', depressFindBattleUnranked);
return PokeBattle.events.on('findBattleCanceledUnranked', depressFindBattleUnranked);
PokeBattle.events.on('findBattleCanceledUnranked', depressFindBattleUnranked);
PokeBattle.primus.on('findBattleCanceledRandom', depressFindBattleRandom);
return PokeBattle.events.on('findBattleCanceledRandom', depressFindBattleRandom);
});
}).call(this);

View File

@@ -5315,14 +5315,19 @@
format = defaultformat();
}
if (!$button.hasClass('disabled')) {
team = getSelectedTeam();
if (!team) {
alert("You need to create a team using the Teambuilder before you can battle.");
PokeBattle.navigation.showTeambuilder();
return;
if ($eventName === "findBattleRandom") {
teamJSON = [];
disableButtons();
} else {
team = getSelectedTeam();
if (!team) {
alert("You need to create a team using the Teambuilder before you can battle.");
PokeBattle.navigation.showTeambuilder();
return;
}
disableButtons();
teamJSON = team.toNonNullJSON().pokemon;
}
disableButtons();
teamJSON = team.toNonNullJSON().pokemon;
PokeBattle.primus.send($eventName, format, teamJSON, options.selectedAlt);
return $button.addClass('disabled').trigger('challenge');
} else {