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.
149 lines
5.6 KiB
149 lines
5.6 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 ('inclu/messagefunctions.inc.php');
|
||
|
include_once ('inclu/halloffame.inc.php');
|
||
|
include_once ('inclu/fruitdistribution.inc.php');
|
||
|
include_once ('inclu/exp.inc.php');
|
||
|
|
||
|
|
||
|
$row2 = mysql_query("SELECT c1.lernpunkte AS c1lern, c2.lernpunkte AS c2lern, u.round, u.win, u.hp1, u.hp2,c1.hp AS c1hp, c2.hp AS c2hp, c1.mp AS c1mp, c2.mp AS c2mp, u.mp1, u.mp2, c1.id AS c1id, c2.id AS c2id, c1.exp AS c1exp, c2.exp AS c2exp, i1.geld AS i1geld, i2.geld AS i2geld,
|
||
|
i1.id AS i1id, i2.id AS i2id FROM turnier_kampf u LEFT JOIN chars c1 ON(c1.id=u.char1) LEFT JOIN user i1 ON(i1.id=c1.besitzer) LEFT JOIN chars c2 ON(c2.id=u.char2) LEFT JOIN user i2 ON(i2.id=c2.besitzer) WHERE u.art='wochen' ORDER BY u.round ASC");
|
||
|
|
||
|
$x=0;
|
||
|
while($row = mysql_fetch_array($row2)) {
|
||
|
|
||
|
$new_hp = explode(",",$row[hp1]);
|
||
|
$or_hp1 = explode(",",$row[c1hp]);
|
||
|
$new_hp2 = count($new_hp) - 1;
|
||
|
|
||
|
$new_mp = explode(",",$row[mp1]);
|
||
|
$or_mp1 = explode(",",$row[c1mp]);
|
||
|
$new_mp2 = count($new_mp) - 1;
|
||
|
|
||
|
$or_exp1 = explode(",",$row[c1exp]);
|
||
|
$add_exp1 = ($row[round] * 3000);
|
||
|
$new_exp = $or_exp1[0] + ($row[round] * 3000);
|
||
|
|
||
|
|
||
|
$new_lernpunkte1 = $row[c1lern] + (($row[round] * $row[round] / 4));
|
||
|
$new_lernpunkte2 = $row[c2lern] + (($row[round] * $row[round] / 4));
|
||
|
|
||
|
$new_geld1 = $row[i1geld] + ($row[round] * 3000);
|
||
|
$new_geld2 = $row[i2geld] + ($row[round] * 3000);
|
||
|
|
||
|
$trainings_points1 = $row[round] * 1;
|
||
|
$trainings_points2 = $row[round] * 1;
|
||
|
|
||
|
if($row[round] == 6 AND $row[win] == $row[c1id]) {
|
||
|
$new_exp += 15000;
|
||
|
$add_exp1 += 15000;
|
||
|
$new_lernpunkte1 += 15;
|
||
|
$new_geld1 += 20000;
|
||
|
$trainings_points1 += 10;
|
||
|
$char_id1 = $row[win];
|
||
|
}
|
||
|
|
||
|
$new_hp_2 = explode(",",$row[hp2]);
|
||
|
$or_hp1_2 = explode(",",$row[c2hp]);
|
||
|
$new_hp2_2 = count($new_hp_2) - 1;
|
||
|
|
||
|
$new_mp_2 = explode(",",$row[mp2]);
|
||
|
$or_mp1_2 = explode(",",$row[c2mp]);
|
||
|
$new_mp2_2 = count($new_mp_2) - 1;
|
||
|
|
||
|
$or_exp1_2 = explode(",",$row[c2exp]);
|
||
|
$add_exp2 = ($row[round] * 3000);
|
||
|
$new_exp_2 = $or_exp1_2[0] + ($row[round] * 3000);
|
||
|
|
||
|
if($row[round] == 6 AND $row[win] == $row[c2id]) {
|
||
|
$new_exp_2 += 15000;
|
||
|
$add_exp2 += 15000;
|
||
|
$new_lernpunkte2 += 15;
|
||
|
$new_geld2 += 20000;
|
||
|
$trainings_points2 += 10;
|
||
|
$char_id1 = $row[win];
|
||
|
}
|
||
|
$old_win = $row[win];
|
||
|
|
||
|
//mysql_query("UPDATE chars SET status='Frei', training_points=training_points+'$trainings_points1', lernpunkte='$new_lernpunkte1', hp='$new_hp[$new_hp2],$or_hp1[1]', mp='$new_mp[$new_mp2],$or_mp1[1]', exp='$new_exp,$or_exp1[1]' WHERE id='$row[c1id]'");
|
||
|
//mysql_query("UPDATE chars SET status='Frei', training_points=training_points+'$trainings_points2', lernpunkte='$new_lernpunkte2', hp='$new_hp_2[$new_hp2_2],$or_hp1_2[1]', mp='$new_mp_2[$new_mp2_2],$or_mp1_2[1]', exp='$new_exp_2,$or_exp1_2[1]' WHERE id='$row[c2id]'");
|
||
|
// mysql_query("UPDATE chars SET status='Frei', exp='$new_exp,$or_exp1[1]' WHERE id='$row[c1id]'");
|
||
|
// mysql_query("UPDATE chars SET status='Frei', exp='$new_exp_2,$or_exp1_2[1]' WHERE id='$row[c2id]'");
|
||
|
|
||
|
addExpToChar($row['c1id'],$add_exp1);
|
||
|
addExpToChar($row['c2id'],$add_exp2);
|
||
|
|
||
|
mysql_query("UPDATE user SET geld='$new_geld1' WHERE id='$row[i1id]' LIMIT 1");
|
||
|
mysql_query("UPDATE user SET geld='$new_geld2' WHERE id='$row[i2id]' LIMIT 1");
|
||
|
|
||
|
}
|
||
|
|
||
|
$win_user = mysql_Fetch_array(mysql_Query("SELECT name, besitzer FROM chars WHERE id='$old_win' LIMIT 1"));
|
||
|
$win_name = mysql_fetch_Array(mysql_query("SELECT nickname FROM user WHERE id='$win_user[besitzer]' LIMIT 1"));
|
||
|
$win_online = mysql_fetch_array(mysql_query("SELECT turnier FROM online LIMIT 1"));
|
||
|
mysql_query("UPDATE online SET turnier='$win_online[turnier],$win_user[name],$win_name[nickname]' WHERE id='1'");
|
||
|
// insertIntoHallOfFame($title, $charid, $userid);
|
||
|
insertIntoHallOfFame('Wochenturnier', $old_win, $win_user['besitzer']);
|
||
|
|
||
|
mysql_query("UPDATE wochen_markt SET anzahl='1'");
|
||
|
|
||
|
$xiu=5;
|
||
|
|
||
|
if($xiu >= mt_rand(1, 100)) {
|
||
|
////////////////FRUCHT ARRAY
|
||
|
//include "array.php";
|
||
|
distributeFruit($win_user['besitzer']);
|
||
|
|
||
|
}
|
||
|
$sql5 = 'Select count(win), win from turnier_kampf where art = \'wochen\' group by win order by count(win) desc';
|
||
|
$qry5 = mysql_query($sql5);
|
||
|
|
||
|
$rang1 = mysql_fetch_assoc($qry5);
|
||
|
$rang2 = mysql_fetch_assoc($qry5);
|
||
|
$rang3 = mysql_fetch_assoc($qry5);
|
||
|
$rang4 = mysql_fetch_assoc($qry5);
|
||
|
$rang5 = mysql_fetch_assoc($qry5);
|
||
|
$rang6 = mysql_fetch_assoc($qry5);
|
||
|
$rang7 = mysql_fetch_assoc($qry5);
|
||
|
$rang8 = mysql_fetch_assoc($qry5);
|
||
|
|
||
|
|
||
|
$sql = 'select u.clan, c.id, u.id as userid from chars c inner join user u on c.besitzer = u.id where c.id IN ('.$rang1['win'].','.$rang2['win'].','.$rang3['win'].','.$rang4['win'].','.$rang5['win'].','.$rang6['win'].','.$rang7['win'].','.$rang8['win'].')';
|
||
|
|
||
|
echo $sql.'<br>';
|
||
|
$qry = mysql_query($sql);
|
||
|
|
||
|
while($row = mysql_fetch_assoc($qry)){
|
||
|
switch($row['id']){
|
||
|
case $rang1['win']:
|
||
|
mysql_query('UPDATE user set pkt = pkt + 50 WHERE id = '.$row['userid']);
|
||
|
insertUserTickerMessage($row['userid'], '50 IP von Wochenturnier Sieg erhalten!');
|
||
|
break;
|
||
|
case $rang2['win']:
|
||
|
mysql_query('UPDATE user set pkt = pkt + 40 WHERE id = '.$row['userid']);
|
||
|
insertUserTickerMessage($row['userid'], '40 IP von Wochenturnier 2.Platz erhalten!');
|
||
|
break;
|
||
|
case $rang3['win']:
|
||
|
case $rang4['win']:
|
||
|
mysql_query('UPDATE user set pkt = pkt + 30 WHERE id = '.$row['userid']);
|
||
|
insertUserTickerMessage($row['userid'], '30 IP von Wochenturnier 3. oder 4. Platz erhalten!');
|
||
|
break;
|
||
|
case $rang5['win']:
|
||
|
case $rang6['win']:
|
||
|
case $rang7['win']:
|
||
|
case $rang8['win']:
|
||
|
mysql_query('UPDATE user set pkt = pkt + 20 WHERE id = '.$row['userid']);
|
||
|
insertUserTickerMessage($row['userid'], '20 IP von Wochenturnier 5-8. Platz erhalten!');
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
?>
|