Oki, managed to sort out and improve a lot of code in the Arena... still not there yet I am afraid, it's working but not everything sorts and behaves like I expected it to (I found that out after a bit of testing). I've updated the code in DB again (Ladder placement is now updated properly, some alignment issues solved, initial challenges for the official matches are now drawn only from lineups, not the whole pool of arena combatants and teams (didn't make any sense otherwise), some code improvements here and there, empty space in a lineup after a fight can no longer be "challenged" and lead to stupid errors + some other minor stuff).
Tomorrow I need to finish some minor sorting issues and than I can start with making Arena interesting (adding jsons for team formation, mobs, npcs, intro with some characters and so on)

For testing:
Lineups are supposed to work like this:
If a team/fighter wins in any of the official matches, he/she/team goes up one position in a lineup, loser goes down one position *(regardless of their previous positions, if winner is not in the lineups, last place in the lineup looses it's position and winner gets it).
Remember that fights take place automatically so you could in theory be knocked out of a lineup if you avoid fighting for to long. Right now winning has effect only on arena reputation but I am planning to add normal reputation and fame as well. Also plan is to give a chance of reputation increasing just for being in any of the lineups.
Player cannot have two official fights on the same day (not even a 1v1 fights and a team fight) but if AP allows, any amount of dog fighting is permitted.
Right now player is allowed to issue challenges in official matches even without being in the top 100 (for testing purposes).
Official matches do not have battle stats restrictions (opfor will not refuse a fight based on player being to strong). That's by design (not for testing).
----------------------
Done for tonight I guess...