You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
2.4 KiB

14 years ago
<?php
/*
*
* @copyright (c) 2010 animegame.eu
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
*
*/
include "db.php";
include_once('path.inc.php'); // get the path ;)
14 years ago
include_once ('inclu/messagefunctions.inc.php');
include_once ('inclu/halloffame.inc.php');
include_once ('inclu/fruitdistribution.inc.php');
include_once ('inclu/exp.inc.php');
include_once (ROOT_PATH.'/include/usergroup.inc.php');
include_once ('inclu/turnier.inc.php');
include_once ('inclu/char.inc.php');
14 years ago
// calculate the avg level of the chars participating
$sql = '(Select distinct(char1) as x from turnier_kampf where art = \'gross\' ) union (Select distinct(char2) as x from turnier_kampf where art = \'gross\' )';
14 years ago
$charids = array();
$qry1 = mysql_query($sql);
14 years ago
while($row = mysql_fetch_assoc($qry1)){
$charids[] = $row['x'];
14 years ago
}
$sql2 = 'Select avg(level) as dlevel from chars where id in ('.join(',', $charids).')';
$row = mysql_fetch_assoc(mysql_query($sql2));
14 years ago
$dlevel = ceil($row['dlevel']);
// do the stuff for the whole exp and money distribution there ;)
//$results = generateTournamentResults('gross', 250000, 2000000);
// Franky && Sinnes request no more money for rounds
$results = generateTournamentResults('gross', 250000, 0);
$rang1 = getChar($results[0][0]);
14 years ago
insertIntoHallOfFame('Weltturnier', $rang1['id'], $rang1['besitzer']);
14 years ago
//$natur_frucht = mysql_num_rows(mysql_query("SELECT id FROM wochen_markt WHERE art='natur'")); ///wieviel TF gibt es?.
14 years ago
////////////////FRUCHT ARRAY
//include "array.php";
distributeFruit($rang1['besitzer']);
14 years ago
//Schutz vor automatischem löschen hinzufügen für den sieger :)
$usergroups = getUserGroups($rang1['besitzer']);
if(!isUserInGroup($usergroups, INAKTIV_LOESCHSCHUTZ) && !isUserInGroup($usergroups, AKTIV_LOESCHSCHUTZ)) {
addUserToGroup($rang1['besitzer'], INAKTIV_LOESCHSCHUTZ);
}
14 years ago
// Durchschnittslevel
$summe = 20000000/(1+exp(5-$dlevel/14));
// Now distribute the shop points ;)
14 years ago
$prices[] = 4000000; // 1.
$prices[] = 3000000; // 2.
$prices[] = 2000000; // 3. + 4.
$cprices[] = ceil($summe/2);
$cprices[] = ceil($summe/4);
$cprices[] = ceil($summe/8);
distributeUserPrices($prices, $results, 'Weltturnier');
#distributeShopPoints($prices, $results, 'Weltturnier');
// clan prices are not distributed anymore!!
//distributeClanPrices($cprices, $results, 'Weltturnier');
14 years ago
?>