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

@@ -98,6 +98,8 @@ makeCommand "pbv", (room, pokemon...) ->
else
room.announce('success', "<b>PBV:</b> #{messages.join('; ')}")
findPokemonAtPBV = (pbv) ->
messages = []
counter = 0

View File

@@ -9,7 +9,7 @@ PokeBattle.events.on "errorMessage", (type, args...) ->
options =
title: "Your login timed out!"
body: """To access the simulator, you need to
<a href="http://91.121.152.74/">login again</a>."""
<a href="https://battling.p-insurgence.com">login again</a>."""
$modal = PokeBattle.modal('modals/errors', options)
$modal.find('.modal-footer button').first().focus()
PokeBattle.primus.end()
@@ -33,6 +33,8 @@ PokeBattle.events.on "errorMessage", (type, args...) ->
when e.FIND_BATTLE
PokeBattle.events.trigger("findBattleCanceled")
PokeBattle.events.trigger("findBattleCanceledUnranked")
PokeBattle.events.trigger("findBattleCanceledRandom")
# Show errors
[errors] = args

View File

@@ -28,6 +28,17 @@ $ ->
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')
@@ -45,6 +56,12 @@ $ ->
.addClass('icon-spinner spinner-anim')
.removeClass("icon-earth")
$mainButtons.find('.find_battle_random').on 'challenge', ->
$this = $(this)
$this.find('.find-icon')
.addClass('icon-spinner spinner-anim')
.removeClass("icon-earth")
$mainButtons.find('.display_credits').click ->
$modal = PokeBattle.modal('modals/credits')
$modal.find('.modal-footer button').first().focus()
@@ -68,15 +85,28 @@ depressFindBattleUnranked = ->
.addClass("icon-earth")
$mainButtons.find('.find_battle_select_team .select').removeClass('disabled')
depressFindBattleRandom = ->
$mainButtons = $('.main_buttons')
$button = $mainButtons.find('.find_battle_random')
$button.removeClass("disabled")
$button.find('.find-icon')
.removeClass("icon-spinner spinner-anim")
.addClass("icon-earth")
$mainButtons.find('.find_battle_select_team .select').removeClass('disabled')
$(window).load ->
$mainButtons = $('.main_buttons')
PokeBattle.battles.on 'add', (battle) ->
if !battle.get('spectating')
depressFindBattle()
depressFindBattleUnranked()
depressFindBattleRandom()
PokeBattle.primus.on 'findBattleCanceled', depressFindBattle
PokeBattle.events.on 'findBattleCanceled', depressFindBattle
PokeBattle.primus.on 'findBattleCanceledUnranked', depressFindBattleUnranked
PokeBattle.events.on 'findBattleCanceledUnranked', depressFindBattleUnranked
PokeBattle.events.on 'findBattleCanceledUnranked', depressFindBattleUnranked
PokeBattle.primus.on 'findBattleCanceledRandom', depressFindBattleRandom
PokeBattle.events.on 'findBattleCanceledRandom', depressFindBattleRandom

View File

@@ -58,13 +58,17 @@ class @challengePaneObject
format = defaultformat()
# Toggle state when you press the button.
if !$button.hasClass('disabled')
team = getSelectedTeam()
unless team
alert("You need to create a team using the Teambuilder before you can battle.")
PokeBattle.navigation.showTeambuilder()
return
disableButtons()
teamJSON = team.toNonNullJSON().pokemon
if $eventName is "findBattleRandom"
teamJSON = []
disableButtons()
else
team = getSelectedTeam()
unless team
alert("You need to create a team using the Teambuilder before you can battle.")
PokeBattle.navigation.showTeambuilder()
return
disableButtons()
teamJSON = team.toNonNullJSON().pokemon
# Send the event
PokeBattle.primus.send($eventName, format, teamJSON, options.selectedAlt)
$button.addClass('disabled').trigger('challenge')

View File

@@ -13,6 +13,10 @@ block content
.button.big.find_battle
span.find-icon.icon-earth
| Ranked battle
p
.button.big.find_battle_random
span.find-icon.icon-earth
| Random battle
.find_battle_select_team
.section
.button.teambuilder_button