FAF Player joins Galactic War

Submitted by Brutus5000 on Fri, 07/22/2016 - 01:32
Goal

Create a faction character for the FAF player

Input data
  • FAF Player ID
  • Selected Faction
Preconditions

FAF player is not allowed to have an active character:

SELECT COUNT(id) FROM characters WHERE faf_id = <FAF Player ID> AND killed_by IS NOT NULL;

must be 0.

(possibly balancing restriction for factions?)

Database transaction

Generate a random name for the faction -> <Faction Name>

INSERT INTO characters (faf_id, name, faction) VALUES (<FAF Player ID> , <Faction Name>, <Selected Faction>)

SET @character_id = LAST_INSERT_ID();

INSERT INTO promotions (fk_character, new_rank, created_at) VALUES (@character_id, 1, NOW())

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.