Character retracts from battle

Submitted by Brutus5000 on Sun, 07/24/2016 - 01:39

Abort battle for a character and revert his transactions

Input data
  • <character id>
  • <battle id>

Character is set up for battle, battle has not yet started:

SELECT battles.status FROM battles
JOIN battle_participants ON = battle_participants.fk_battle
WHERE battle_participants.fk_character = <character id> AND = <battle id>

ASSERT THAT battles.status = 'I'

Database transaction

DELETE FROM battle_participants WHERE fk_character = <character id> AND fk_battle = <battle id>

DELECT FROM unit_transaction_details WHERE fk_unit_transation = (SELECT id FROM unit_transaction WHERE fk_character = <character id> AND fk_battle = <battle id>)

DELETE FROM unit_transactions WHERE fk_character = <character id> AND fk_battle = <battle id>

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • Lines and paragraphs break automatically.
  • Web page addresses and email addresses turn into links automatically.