diff --git a/cronjob/.buildpath b/cronjob/.buildpath new file mode 100644 index 0000000..8bcb4b5 --- /dev/null +++ b/cronjob/.buildpath @@ -0,0 +1,5 @@ + + + + + diff --git a/cronjob/.project b/cronjob/.project new file mode 100644 index 0000000..7afc993 --- /dev/null +++ b/cronjob/.project @@ -0,0 +1,11 @@ + + + cronjob + + + + + + + + diff --git a/cronjob/3.php b/cronjob/3.php new file mode 100644 index 0000000..fbc4f2f --- /dev/null +++ b/cronjob/3.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/cronjob/SSJ.php b/cronjob/SSJ.php new file mode 100644 index 0000000..56fd738 --- /dev/null +++ b/cronjob/SSJ.php @@ -0,0 +1,52 @@ + \ No newline at end of file diff --git a/cronjob/Turnier2.php b/cronjob/Turnier2.php new file mode 100644 index 0000000..536aaf7 --- /dev/null +++ b/cronjob/Turnier2.php @@ -0,0 +1,149 @@ += 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.'
'; +$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; + } +} + +?> \ No newline at end of file diff --git a/cronjob/array.php b/cronjob/array.php new file mode 100644 index 0000000..412c71a --- /dev/null +++ b/cronjob/array.php @@ -0,0 +1,19 @@ + \ No newline at end of file diff --git a/cronjob/clan_.php b/cronjob/clan_.php new file mode 100644 index 0000000..96527ba --- /dev/null +++ b/cronjob/clan_.php @@ -0,0 +1,93 @@ +=0; $i--) + { + if($i>0) $zufall=mt_rand(0,$i); + else $zufall=0; + $temp=$array[$i]; + $array[$i]=$array[$zufall]; + $array[$zufall]=$temp; + $newarray[]=$array[$i]; + array_pop($array); + } + return $newarray; +} + +include "db.php"; +mysql_query("UPDATE online SET clan_tick=clan_tick+1 WHERE id='1' LIMIT 1"); +$tick_zahl = mysql_fetch_array(mysql_query("SELECT clan_tick FROM online WHERE id='1' LIMIT 1")); + +mysql_query("DELETE FROM clan_kampf"); +$kampf_offen = mysql_query("SELECT an, besitzer, charakter1, charakter2, charakter3, charakter4, charakter5, charakter6, +gcharakter1, gcharakter2, gcharakter3, gcharakter4, gcharakter5, gcharakter6 FROM clan_k_list WHERE aktiv='1' AND tick='$tick_zahl[clan_tick]' "); + +$char1_list = "0"; +$char2_list = "0"; +$iw=1; +while($aktive_clans = mysql_fetch_array($kampf_offen)) { +$clan1[] = $aktive_clans[besitzer]; +$clan1[] = $aktive_clans[besitzer]; +$clan1[] = $aktive_clans[besitzer]; +$clan2[] = $aktive_clans[an]; +$clan2[] = $aktive_clans[an]; +$clan2[] = $aktive_clans[an]; + +$char1_array[0] = $aktive_clans[charakter1]; +$char1_array[1] = $aktive_clans[charakter2]; +$char1_array[2] = $aktive_clans[charakter3]; +$char1_array[3] = $aktive_clans[charakter4]; +$char1_array[4] = $aktive_clans[charakter5]; +$char1_array[5] = $aktive_clans[charakter6]; + +$char2_array[0] = $aktive_clans[gcharakter1]; +$char2_array[1] = $aktive_clans[gcharakter2]; +$char2_array[2] = $aktive_clans[gcharakter3]; +$char2_array[3] = $aktive_clans[gcharakter4]; +$char2_array[4] = $aktive_clans[gcharakter5]; +$char2_array[5] = $aktive_clans[gcharakter6]; + + $char1_array = rand_array($char1_array); + $char1_array = array_unique($char1_array); + + $char2_array = rand_array($char2_array); + $char2_array = array_unique($char2_array); + + +$char1_list .= ",".$char1_array[0].""; +$char1_list .= ",".$char1_array[1].""; +$char1_list .= ",".$char1_array[2].""; + +$char2_list .= ",".$char2_array[0].""; +$char2_list .= ",".$char2_array[1].""; +$char2_list .= ",".$char2_array[2].""; + +} + +$char1_list_exploder = explode(",", $char1_list); +$char2_list_exploder = explode(",", $char2_list); + + +$yt=1; +while($iw < count($char1_list_exploder)) { +$chara_1 = mysql_fetch_array(mysql_query("SELECT * FROM chars WHERE id='$char1_list_exploder[$iw]'")); +$chara_2 = mysql_fetch_array(mysql_query("SELECT * FROM chars WHERE id='$char2_list_exploder[$iw]'")); + + $round = 1; + include "clan_kampf.php"; + +$yt++; +$iw++; +} + +mysql_query("DELETE FROM clan_k_list WHERE tick='$tick_zahl[clan_tick]'"); +?> \ No newline at end of file diff --git a/cronjob/clan_exp.php b/cronjob/clan_exp.php new file mode 100644 index 0000000..8ba04e5 --- /dev/null +++ b/cronjob/clan_exp.php @@ -0,0 +1,27 @@ += $exp_rows1[max_exp] AND $exp_rows1[level] != 5) { +mysql_query("UPDATE clan SET level=level+1, max_exp='$new_max_exp1', member=member+2 WHERE id='$clan1[$iws]'"); +} + +if($EXP_new2+$exp_rows2[min_exp] >= $exp_rows2[max_exp] AND $exp_rows2[level] != 5) { +mysql_query("UPDATE clan SET level=level+1, max_exp='$new_max_exp2', member=member+2 WHERE id='$clan2[$iws]'"); +} + +?> \ No newline at end of file diff --git a/cronjob/clan_kampf.php b/cronjob/clan_kampf.php new file mode 100644 index 0000000..54f3d35 --- /dev/null +++ b/cronjob/clan_kampf.php @@ -0,0 +1,214 @@ + $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) { + +$technick1 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10")); +$prozent_technik1 = (20*$technick1[aktiv])-20; +$technick1 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10")); + +$technick2 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10")); +$prozent_technik2 = (20*$technick2[aktiv])-20; +$technick2 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10")); + + +///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte +include "kampf/andere_technik.php"; /////////////////// Wenn man ne andere technik sich aussuchen will... + + +$technick1[speed]=$technick1[speed]+(($technick1[speed]/100)*$prozent_technik1); +$technick2[speed]=$technick2[speed]+(($technick2[speed]/100)*$prozent_technik2); + +$technick1[verteidigung]=$technick1[verteidigung]+(($technick1[verteidigung]/100)*$prozent_technik1); +$technick2[verteidigung]=$technick2[verteidigung]+(($technick2[verteidigung]/100)*$prozent_technik2); + +$technick1[starke]=$technick1[starke]+(($technick1[starke]/100)*$prozent_technik1); +$technick2[starke]=$technick2[starke]+(($technick2[starke]/100)*$prozent_technik2); + + + +$speeds_char1 = ($k_speed[0] + $technick1[speed]); +$speeds_char2 = ($k_speed[1] + $technick2[speed]); + +$speeds_char1_4 = ($k_speed[0] + $technick1[speed]) / 1.5; +$speeds_char2_4 = ($k_speed[1] + $technick2[speed]) / 1.5; + +if($speeds_char1_4 < 1) { $speeds_char1_4 = 1; } +if($speeds_char2_4 < 1) { $speeds_char2_4 = 1; } + +$speed_char1 = mt_rand($speeds_char1_4,$speeds_char1); +$speed_char2 = mt_rand($speeds_char2_4,$speeds_char2); + + + +include "kampf_include.php"; + + +#####################################KAMPF SYSTEM +include "kampf/kampf_rechnung.php"; + + + +$db_query = mysql_fetch_array(mysql_query("SELECT * FROM clan_kampf WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1")); + +mysql_query("UPDATE clan_kampf SET hp1='$db_query[hp1],$k_hp7[0]', hp2='$db_query[hp2],$k_hp7[1]', mp1='$db_query[mp1],$k_mp7[0]', mp2='$db_query[mp2],$k_mp7[1]', schaden1='$db_query[schaden1],$schaden_1', schaden2='$db_query[schaden2],$schaden_2', attacke1='$db_query[attacke1],$technick1[name]', attacke2='$db_query[attacke2],$technick2[name]', starke1='$db_query[starke1],$k_starke[0]', starke2='$db_query[starke2],$k_starke[1]', ver1='$db_query[ver1],$k_ver[0]', ver2='$db_query[ver2],$k_ver[1]', speed1='$db_query[speed1],$k_speed[0]', speed2='$db_query[speed2],$k_speed[1]', ausdauer1='$db_query[ausdauer1],$k_ausdauer[0]', ausdauer2='$db_query[ausdauer2],$k_ausdauer[1]' WHERE id='$db_query[id]'"); + + +$x++; +} +###########################EXP VERTEILUNG + +if($k_hp[0] <= 0 AND $k_hp[1] <= 0) { + + if($k_hp[0] > $k_hp[1]) { + $k_hp[0] = $k_hp1[1]; + } else { + $k_hp[1] = $k_hp2[1]; + } +} +$s=0; +while($s < 2) { + +if($s == 1) { + +if($k_hp[0] > $k_hp[1]) { $X13 = HALLO; } else { $X23 = HALLO; } +} + +if($k_hp[1] < $k_aufgabe[1] OR $X13 == "HALLO") { +$clan1_win = 1; +$clan2_win = 0; +$k_exp[1] = 0; +$k_geld[1] = 2000; +$k_exp[0] = 0; +$k_geld[0] = 5000; + +$sieger = $chara_1[id]; +$verlierer = $chara_2[id]; + +} + +if($k_hp[0] < $k_aufgabe[0] OR $X23 == "HALLO") { + +$sieger = $chara_2[id]; +$verlierer = $chara_1[id]; + +$clan1_win= 0; +$clan2_win = 1; +$k_exp[1] = 0; +$k_geld[1] = 5000; +$k_exp[0] = 0; +$k_geld[0] = 2000; + + +} + +if($k_exp[0]) { $s=2; } else { $s++; } + +} +$iws = $iw-1; +mysql_query("UPDATE clan_kampf SET clan1_id='$clan1[$iws]', clan2_id='$clan2[$iws]', exp1='$k_exp[0]', win='$sieger', lose='$verlierer', exp2='$k_exp[1]', geld1='$k_geld[0]', geld2='$k_geld[1]', clan1_win='$clan1_win', clan2_win='$clan2_win' WHERE id='$db_query[id]'"); + + +if($yt == 3) { +$yt=0; +$win_rows1 = mysql_num_rows(mysql_query("SELECT id FROM clan_kampf WHERE clan1_win='1' AND clan1_id='$clan1[$iws]' LIMIT 2")); +$win_rows2 = mysql_num_rows(mysql_query("SELECT id FROM clan_kampf WHERE clan2_win='1' AND clan2_id='$clan2[$iws]' LIMIT 2")); + +if($win_rows1 > $win_rows2) { + +////CLAN 1 WINS +$exp_rows1 = mysql_fetch_array(mysql_query("SELECT siege, level, min_exp, max_exp FROM clan WHERE id='$clan1[$iws]' LIMIT 1")); +$exp_rows2 = mysql_fetch_array(mysql_query("SELECT siege, level, min_exp, max_exp FROM clan WHERE id='$clan2[$iws]' LIMIT 1")); + +$EXP_new1 = ($exp_rows2[siege]+10) * 30; +$EXP_new2 = ($exp_rows1[siege]+10) * 15; + +include "clan_exp.php"; + +mysql_query("UPDATE clan SET geld=geld+'5000', siege=siege+1, min_exp=min_exp+'$EXP_new1' WHERE id='$clan1[$iws]'"); +mysql_query("UPDATE clan SET geld=geld+'2000', niederlagen=niederlagen+1, min_exp=min_exp+'$EXP_new2' WHERE id='$clan2[$iws]'"); +} else { + +$exp_rows1 = mysql_fetch_array(mysql_query("SELECT siege, level, min_exp, max_exp FROM clan WHERE id='$clan1[$iws]' LIMIT 1")); +$exp_rows2 = mysql_fetch_array(mysql_query("SELECT siege, level, min_exp, max_exp FROM clan WHERE id='$clan2[$iws]' LIMIT 1")); + +$EXP_new2 = ($exp_rows1[siege]+10) * 30; +$EXP_new1 = ($exp_rows2[siege]+10) * 15; + + +include "clan_exp.php"; + +////CLAN 2 WINS + +mysql_query("UPDATE clan SET geld=geld+'2000', niederlagen=niederlagen+1, min_exp=min_exp+'$EXP_new1' WHERE id='$clan1[$iws]'"); +mysql_query("UPDATE clan SET geld=geld+'5000', siege=siege+1, min_exp=min_exp+'$EXP_new2' WHERE id='$clan2[$iws]'"); +} + +} + +?> \ No newline at end of file diff --git a/cronjob/clanfights.inc.php b/cronjob/clanfights.inc.php new file mode 100644 index 0000000..2fa5071 --- /dev/null +++ b/cronjob/clanfights.inc.php @@ -0,0 +1,225 @@ + now()'; + $row = mysql_fetch_assoc(mysql_query($sql)); + if ($row['anzahl'] > 0) { + $GLOBALS['char_status'][$charid] = 'Turnier'; + return 'Turnier'; + } + $sql = 'SELECT count(*) as anzahl from quests where charid = ' . $charid; + $row = mysql_fetch_assoc(mysql_query($sql)); + if ($row['anzahl'] > 0) { + $GLOBALS['char_status'][$charid] = 'Schatz Suche'; + return 'Schatz Suche'; + } + $sql = 'SELECT count(*) as anzahl from kampf where db_satz = ' . $charid; + $row = mysql_fetch_assoc(mysql_query($sql)); + if ($row['anzahl'] > 0) { + $GLOBALS['char_status'][$charid] = 'Kampf'; + return 'Kampf'; + } + + $sql = 'SELECT count(*) as anzahl FROM kampf_list where charakter = ' . $charid; + $row = mysql_fetch_assoc(mysql_query($sql)); + if ($row['anzahl'] > 0) { + $GLOBALS['char_status'][$charid] = 'Kampf erstellt'; + return 'Kampf erstellt'; + } + $sql = 'SELECT count(*) as anzahl FROM turnier1 where charakter = ' . $charid; + $row = mysql_fetch_assoc(mysql_query($sql)); + if ($row['anzahl'] > 0) { + $GLOBALS['char_status'][$charid] = 'Angemeldet'; + return 'Angemeldet'; + } + $GLOBALS['char_status'][$charid] = 'Frei'; + return 'Frei'; +} + +function getPicture($char){ + // Sichergehen, dass Char geladen wurde + if($char['bild'] == null || $char['bild'] == ''){ + return 'design/bilder/avatare/noavart.gif'; + } + return $char['bild']; +} + +function getChar2($charid) { + // Fehlerkontrolle + if(!is_numeric($charid)){ + return null; + } else { + $char = mysql_fetch_assoc(mysql_query('Select * from chars where id = '.$charid)); + if(!$char){return null;} +// Speichere in $char['stauts'] den aktuellen Status des Chars (buffer-Strategie ist hierbei die selbe) + $char['status'] = getStatus($char['id'],$buffer_enabled); + $char['bild'] = getPicture($char); + } + return $char; +} + +function starteClanFight($chara_1, $chara_2, $clanfight_id, $runde, $kampf){ + global $sieger, $verlierer; + include 'kampf_clan.php'; +} + +function starteClanFight_survival($chara_1, $fighter_a, $chara_2, $fighter_b, $clanfight_id, $runde, $kampf){ + global $sieger, $verlierer, $fighter_team_a_array, $fighter_team_b_array; + include 'kampf_clan1.php'; +} + +function clanFightExecute($id) { + $pkt_a_satz= 0; + $pkt_b_satz= 0; + $pkt_runde_a= 0; + $pkt_runde_b= 0; + $rundenzaehler= 1; + $kampfzaehler= 1; + + $clanfight_daten= mysql_fetch_assoc(mysql_query('SELECT fighter, gfighter, numberoffighter FROM clan_fight_list WHERE id='.$id.' LIMIT 1')); + $fighter_a_array= explode(",",$clanfight_daten['fighter']); + $fighter_b_array= explode(",",$clanfight_daten['gfighter']); + + for ($x=1;;$x++) { + /*if ($rundenzaehler == 7) { + break; + }*/ + + $fighter_a= mt_rand(0, count($fighter_a_array)-1); + $fighter_b= mt_rand(0, count($fighter_b_array)-1); + + $char_a= getChar2($fighter_a_array[$fighter_a]); + $char_b= getChar2($fighter_b_array[$fighter_b]); + + starteClanFight($char_a, $char_b, $id, $rundenzaehler, $kampfzaehler); + + $kampfzaehler++; + + if ($fighter_a_array[$fighter_a] == $sieger) { + $pkt_a_satz++; + } else { + $pkt_b_satz++; + } + + unset($fighter_a_array[$fighter_a]); + unset($fighter_b_array[$fighter_b]); + sort($fighter_a_array); + sort($fighter_b_array); + + #if ($pkt_a_satz == 3 OR $pkt_b_satz == 3) { + if ($pkt_a_satz + $pkt_b_satz == $clanfight_daten['numberoffighter']) { + if ($pkt_a_satz > $pkt_b_satz) { + $pkt_runde_a++; + } elseif ($pkt_a_satz < $pkt_b_satz) { + $pkt_runde_b++; + } + + $fighter_a_array= explode(",",$clanfight_daten['fighter']); + $fighter_b_array= explode(",",$clanfight_daten['gfighter']); + + $rundenzaehler++; + $kampfzaehler= 1; + $pkt_a_satz= 0; + $pkt_b_satz= 0; + if ($pkt_runde_a + $pkt_runde_b == 6) { + break; + } + } + } +} + +function selectFighterOfTeams($fighter_team_a_array,$fighter_team_b_array,$sieger='') { + global $fighter_a, $fighter_b, $sieger; + if (empty($sieger)) { + $fighter_a= mt_rand(0, count($fighter_team_a_array)-1); + $fighter_b= mt_rand(0, count($fighter_team_b_array)-1); + } else { + for ($y=0;$y diff --git a/cronjob/db_example.php b/cronjob/db_example.php new file mode 100644 index 0000000..b935c6a --- /dev/null +++ b/cronjob/db_example.php @@ -0,0 +1,29 @@ + + diff --git a/cronjob/delete.php b/cronjob/delete.php new file mode 100644 index 0000000..909962d --- /dev/null +++ b/cronjob/delete.php @@ -0,0 +1,162 @@ += 200000) { + $anzahl = 1; + } + if ($row[preis] < 200000) { + $anzahl = 5; + } + if ($row[preis] < 100000) { + $anzahl = 10; + } + if ($row[preis] < 50000) { + $anzahl = 20; + } + if ($row[preis] < 30000) { + $anzahl = 50; + } + if ($row[preis] < 20000) { + $anzahl = 60; + } + if ($row[preis] < 15000) { + $anzahl = 75; + } + if ($row[preis] < 10000) { + $anzahl = 100; + } + if ($row[preis] < 7000) { + $anzahl = 150; + } + if ($row[preis] < 5000) { + $anzahl = 200; + } + if ($row[preis] < 2000) { + $anzahl = 500; + } + if ($row[preis] < 1000) { + $anzahl = 1000; + } + if ($row[preis] < 500) { + $anzahl = 1500; + } + if ($row[preis] < 80) { + $anzahl = 5000; + } + mysql_query("UPDATE item SET anzahl='$anzahl' WHERE id='$row[id]'"); + + $x++; +} + +$row = ""; + +mysql_query("DELETE FROM liga_kampf"); +mysql_query("DELETE FROM wanted_kampf"); +mysql_query("UPDATE chars SET status='Frei' WHERE status='Tod'"); +mysql_query("UPDATE user SET pw_fight='4'"); +//mysql_query("UPDATE user SET ks_points=ks_points+'1' WHERE ks_points < 30"); + +//////////////////////////////////NPCS!!!! + +$wahl = "starke+verteidigung+speed+ausdauer+glueck"; +$row = mysql_fetch_array(mysql_query("SELECT name, level, starke, speed, verteidigung, ausdauer, glueck, hp, mp FROM chars WHERE level<'150' AND rasse!='NPC' ORDER BY ($wahl) DESC LIMIT 1")); + +$new_hp = explode(",", $row[hp]); +$new_mp = explode(",", $row[mp]); + +$beste_mp = (($new_mp[1] / 100) * mt_rand(75, 130)) + 1000; +$beste_hp = (($new_hp[1] / 100) * mt_rand(80, 150)) + 3000; + +$beste_starke = ($row[starke] / 100) * mt_rand(75, 130); +$beste_speed = ($row[speed] / 100) * mt_rand(75, 110); +$beste_verteidigung = ($row[verteidigung] / 100) * mt_rand(75, 110); +$beste_ausdauer = ($row[ausdauer] / 100) * mt_rand(75, 130); +$beste_glueck = ($row[glueck] / 100) * mt_rand(75, 130); + +mysql_query("UPDATE chars SET hp='$beste_hp,$beste_hp', mp='$beste_mp,$beste_mp', starke='$beste_starke', speed='$beste_speed', verteidigung='$beste_verteidigung', ausdauer='$beste_ausdauer', glueck='$beste_glueck' WHERE id='$brolly' LIMIT 1"); + +//////////////////////////////////NPCS!!!! + +$row = mysql_fetch_array(mysql_query("SELECT name, level, starke, speed, verteidigung, ausdauer, glueck, hp, mp FROM chars WHERE level<'150' AND rasse!='NPC' ORDER BY starke DESC LIMIT 1")); + +$new_hp = explode(",", $row[hp]); +$new_mp = explode(",", $row[mp]); + +$beste_mp = (($new_mp[1] / 100) * mt_rand(100, 150)) + 1000; +$beste_hp = (($new_hp[1] / 100) * mt_rand(120, 220)) + 3000; + +$beste_starke = ($row[starke] / 100) * mt_rand(60, 110); +$beste_speed = ($row[speed] / 100) * mt_rand(60, 100); +$beste_verteidigung = ($row[verteidigung] / 100) * mt_rand(100, 150); +$beste_ausdauer = ($row[ausdauer] / 100) * mt_rand(100, 200); +$beste_glueck = ($row[glueck] / 100) * mt_rand(80, 100); + +mysql_query("UPDATE chars SET hp='$beste_hp,$beste_hp', mp='$beste_mp,$beste_mp', starke='$beste_starke', speed='$beste_speed', verteidigung='$beste_verteidigung', ausdauer='$beste_ausdauer', glueck='$beste_glueck' WHERE id='$bebi' LIMIT 1"); + +//////////////////NPC +$wahl = "starke+verteidigung+speed+ausdauer+glueck"; +$row = mysql_fetch_array(mysql_query("SELECT hp, mp, name, level, starke, speed, verteidigung, ausdauer, glueck FROM chars WHERE level<'150' AND rasse!='NPC' ORDER BY level DESC LIMIT 1")); + +$new_hp = explode(",", $row[hp]); +$new_mp = explode(",", $row[mp]); + +$beste_mp = (($new_mp[1] / 100) * mt_rand(150, 200)) + 1000; +$beste_hp = (($new_hp[1] / 100) * mt_rand(100, 200)) + 3000; + +$beste_starke = ($row[starke] / 100) * mt_rand(75, 120); +$beste_speed = ($row[speed] / 100) * mt_rand(75, 120); +$beste_verteidigung = ($row[verteidigung] / 100) * mt_rand(80, 100); +$beste_ausdauer = ($row[ausdauer] / 100) * mt_rand(60, 120); +$beste_glueck = ($row[glueck] / 100) * mt_rand(60, 200); + +mysql_query("UPDATE chars SET hp='$beste_hp,$beste_hp', mp='$beste_mp,$beste_mp', starke='$beste_starke', speed='$beste_speed', verteidigung='$beste_verteidigung', ausdauer='$beste_ausdauer', glueck='$beste_glueck' WHERE id='$flamingo' LIMIT 1"); + +//////////////////NPC +$row = mysql_fetch_array(mysql_query("SELECT hp, mp, name, level, starke, speed, verteidigung, ausdauer, glueck FROM chars WHERE level<'150' AND rasse!='NPC' ORDER BY speed DESC LIMIT 1")); + +$new_hp = explode(",", $row[hp]); +$new_mp = explode(",", $row[mp]); + +$beste_mp = (($new_mp[1] / 100) * mt_rand(80, 110)) + 1000; +$beste_hp = (($new_hp[1] / 100) * mt_rand(80, 250)) + 3000; + +$beste_starke = ($row[starke] / 100) * mt_rand(80, 120); +$beste_speed = ($row[speed] / 100) * mt_rand(80, 130); +$beste_verteidigung = ($row[verteidigung] / 100) * mt_rand(80, 120); +$beste_ausdauer = ($row[ausdauer] / 100) * mt_rand(80, 150); +$beste_glueck = ($row[glueck] / 100) * mt_rand(90, 100); + +mysql_query("UPDATE chars SET hp='$beste_hp,$beste_hp', mp='$beste_mp,$beste_mp', starke='$beste_starke', speed='$beste_speed', verteidigung='$beste_verteidigung', ausdauer='$beste_ausdauer', glueck='$beste_glueck' WHERE id='$mihawk' LIMIT 1"); +?> diff --git a/cronjob/frucht.php b/cronjob/frucht.php new file mode 100644 index 0000000..59b395d --- /dev/null +++ b/cronjob/frucht.php @@ -0,0 +1,48 @@ + \ No newline at end of file diff --git a/cronjob/generic_turnier.php b/cronjob/generic_turnier.php new file mode 100644 index 0000000..684c393 --- /dev/null +++ b/cronjob/generic_turnier.php @@ -0,0 +1,215 @@ +$v){ + if ($k==0) continue; + $it = explode("=",$argv[$k]); +// echo $it[0].'='.$it[1].'('.$argv[$k].')'."\n"; + if (isset($it[1])) $_GET[$it[0]] = $it[1]; + } +} + + + +//set_time_limit(0); +include "db.php"; +include "inclu/char.inc.php"; + +$name = $_GET['name']; // Name des Turniers (benötigt) +$anzahl = $_GET['anzahl']; // Anzahl (benötigt) + +if(is_null($name)){ + echo 'Kein Name für Turnier angegeben!
'; + exit; +} + +// Auswahlkriterien +$fusion = $_GET['fusion']; // 1 für erlaubt +$special = $_GET['special']; // Spezialchars 1 für erlaubt +$minlevel = $_GET['minlevel']; // selbsterklärend +$maxlevel = $_GET['maxlevel']; // selbsterklärend +$gain = $_GET['gain']; // ('Anmeldung', 'PL', 'Level') +$randomize = $_GET['randomize']; // 1 für nach jeder Runde die reihenfolge setzen + +// Turniereigenschaften +$gruppenphase = $_GET['gruppenphase']; // Flag für Gruppenphase (1 für aktiv) +$grp_size = $_GET['grp_size']; // Anzahl der Teilnehmer in einer Gruppe +$grp_proceed = $_GET['grp_proceed']; // Anzahl der Teilnehmer die Gruppenphase verlassen (1 nur Sieger, 2 Sieger und Zweiter ..) + +/** + * Berechnet ein Kampf zwischen zwei chars + * @param int $char1_id die id des ersten chars + * @param int $char2_id die id des zweiten chars + * @param String $art der name des turniers (für die sql-Anfrage wichtig) + * @param int $round rundennummer (0,1,2...) + * @return int die id des siegenden chars + */ +function turnierfight($char1_id, $char2_id, $art_1, $round){ + // Gotta replace this later -.- + echo 'Fight between '.$char1_id.' und '.$char2_id; + + $chara_1 = getChar($char1_id); // ohne Equip für Turniere!! + $chara_2 = getChar($char2_id); // ohne Equip für Turniere!! + //$chara_1 = getCharWithBuffs($char1_id); // Equip für Turniere!! + //$chara_2 = getCharWithBuffs($char2_id); // Equip für Turniere!! + include "turnier_kampf.php"; + + echo ', Sieger '.$sieger.'
'; +// in $sieger steht die id des gewinners + if($char1_id == $sieger){ + return $char1_id; + } + return $char2_id; +} + + +// Auswerten der Eingaben +if($gruppenphase == 1){ + if(is_null($grp_size)){ // Wenn es nicht gesetzt ist + $grp_size = 4; // Default: 4 in einer Gruppe + } + if(is_null($grp_proceed)){ // Wenn es nicht gesetzt ist + $grp_proceed = 1; // Default: Nur Sieger kommt weiter + } + // Berechne ob die Angegebene Anzahl passt (Anzahl muss durch grp_size teilbar und Ergebnis eine 2er Potenz sein) + $count_groups = round($anzahl / $grp_size); + $loga = log($count_groups * $grp_proceed, 2) ; + if($anzahl % $grp_size != 0 || $loga != round($loga)){ + echo 'Parameter der Gruppenphasen sind ungültig!
'; + } + + echo 'Gruppenphasen werden leider noch nicht unterstützt
'; + exit; +} else{ + $loga = log($anzahl, 2) ; + if($loga != round($loga)){ + echo 'Die Anzahl der Teilnehmer ist ungültig (Muss eine 2er Potenz sein)!
'; + exit; + } +} + +mysql_query('DELETE FROM turnier_kampf WHERE art=\''.$name.'\''); + + +// Es sollen keine NPC mitmachen :) und nicht die Spezial Wanted NPCs +$auswahl_kriteria = ' rasse != \'NPC\' '; +$auswahl_kriteria .= ' AND besitzer!=2 '; +if($fusion != 1){ + $auswahl_kriteria .= ' AND fusion=\'nein\' '; +} + +if($special != 1){ + $auswahl_kriteria .= ' AND char_type = \'\' '; +} + +if(is_numeric($minlevel)){ + $auswahl_kriteria .= ' AND level >= '.$minlevel.' '; +} + +if(is_numeric($maxlevel)){ + $auswahl_kriteria .= ' AND level <= '.$maxlevel.' '; +} + +// Erstma checken ob es überhaupt genug chars gibt ;) + +$sql = 'SELECT count(*) as anzahl from chars where '.$auswahl_kriteria; +echo $sql.'
'; +$qry = mysql_query($sql); +$row = mysql_fetch_assoc($qry); + +if($row['anzahl'] < $anzahl){ + echo $name.' konnte nicht gestartet werden, da es nur '.$row['anzahl'].' von '.$anzahl.' nötigen Chars gibt!
'; + exit; +} + +// Erstma nur die id auslesen (danach wird eh nochmal gemischt ;)) +$cid = array(); +if($gain == 'Anmeldung'){ + $sql = 'SELECT charakter as id FROM turnier1 t WHERE art = \''.$name.'\''; + $qry = mysql_query($sql); + while($row = mysql_fetch_assoc($qry)){ + $cid[] = $row['id']; + } + mysql_query('DELETE FROM turnier1 WHERE art = \''.$name.'\''); // Lösche die Anmeldungsliste + if(count($cid) > 0){ + $sql = 'SELECT id FROM chars where '.$auswahl_kriteria.' and id NOT IN('.join(',',$cid).') ORDER BY RAND()'; + } else { + // Turnier is voll! + $sql = 'SELECT id FROM chars where '.$auswahl_kriteria.' ORDER BY RAND()'; + } +} else if($gain == 'PL'){ + // Die Buffs werden nicht zur PL gezählt ;) + $sql = 'SELECT id FROM chars where '.$auswahl_kriteria.' ORDER BY starke+verteidigung+speed+ausdauer+glueck desc'; +} else if($gain == 'Level'){ + $sql = 'SELECT id FROM chars where '.$auswahl_kriteria.' ORDER BY level desc'; +} else{ + echo 'Parameter gain war weder Anmeldung, PL noch Level
'; + exit; +} + +echo $sql.'
'; +$qry = mysql_query($sql); +while(($row = mysql_fetch_assoc($qry)) && count($cid) < $anzahl){ +// echo $row['id'].'
'; + $cid[] = $row['id']; +} + +//print_r($cid); + +$sql = 'SELECT id FROM chars WHERE id IN('.join(', ',$cid).') ORDER BY RAND()'; // Mischen der Teilnehmer +//echo $sql.'
'; +$qry = mysql_query($sql); +$char_array = array(); +while($row = mysql_fetch_assoc($qry)){ + $char_array[] = $row['id']; +} +// So alle chars sind jetzt in den Arrays +$round = 1; + + +//print_r($chars); +echo '
'; + +// Hier Gruppenphase berechnen und die Chars für die Endrunde in $chars speichern + +// Beginn der Endrunde +while(count($char_array) > 1){ // Solange bis nur ein Char übrig bleibt + $n_chars = array(); + for($i=0;$i'; + $n_chars[] = turnierfight($char_array[$i], $char_array[$i+1], $name, $round); + } +// echo 'nxt round
'; + $round++; + if($randomize == 1) { + $char_array = shuffle($n_chars); + } else { + $char_array = $n_chars; + } +} + + +?> \ No newline at end of file diff --git a/cronjob/gross_Turnier2.php b/cronjob/gross_Turnier2.php new file mode 100644 index 0000000..7798170 --- /dev/null +++ b/cronjob/gross_Turnier2.php @@ -0,0 +1,203 @@ +'; + +$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='gross' 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]); +$new_exp = $or_exp1[0] + ($row[round] * 10000); +$add_exp1 = ($row[round] * 10000); + + +$new_lernpunkte1 = $row[c1lern] + (($row[round] * $row[round] / 2)); +$new_lernpunkte2 = $row[c2lern] + (($row[round] * $row[round] / 2)); + +$new_geld1 = $row[i1geld] + ($row[round] * 10000); +$new_geld2 = $row[i2geld] + ($row[round] * 10000); + +$trainings_points1 = $row[round] * 2; +$trainings_points2 = $row[round] * 2; + +if($row[round] == 9 AND $row[win] == $row[c1id]) { +$new_exp += 250000; +$add_exp1 += 250000; +$new_lernpunkte1 += 30; +$trainings_points1 += 50; +$new_geld1 += 2000000; +} + +$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]); +$new_exp_2 = $or_exp1_2[0] + ($row[round] * 3000); +$add_exp2 = ($row[round] * 10000); + +if($row[round] == 9 AND $row[win] == $row[c2id]) { +$new_exp_2 += 250000; +$add_exp2 += 250000; +$new_lernpunkte2 += 30; +$trainings_points2 += 50; +$new_geld2 += 2000000; +} +$old_win = $row[win]; + +//mysql_query("UPDATE chars SET 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 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 exp='$new_exp,$or_exp1[1]' WHERE id='$row[c1id]'"); +//mysql_query("UPDATE chars SET 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 id, name, besitzer FROM chars WHERE id='$old_win' LIMIT 1")); +$win_name = mysql_fetch_Array(mysql_query("SELECT id, nickname, clan FROM user WHERE id='$win_user[besitzer]' LIMIT 1")); +$win_online = mysql_fetch_array(mysql_query("SELECT turnier_gross FROM online LIMIT 1")); +mysql_query("UPDATE online SET turnier_gross='$win_online[turnier_gross],$win_user[name],$win_name[nickname]' WHERE id='1'"); +// insertIntoHallOfFame($title, $charid, $userid); +insertIntoHallOfFame('Weltturnier', $old_win, $win_user['besitzer']); + +$natur_frucht = mysql_num_rows(mysql_query("SELECT id FROM wochen_markt WHERE art='natur'")); ///wieviel TF gibt es?. + +////////////////FRUCHT ARRAY +//include "array.php"; +distributeFruit($win_user['besitzer']); + +// Durchschnittslevel + +$sql5 = 'Select count(win), win from turnier_kampf where art = \'gross\' 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); +$rang9 = mysql_fetch_assoc($qry5); +$rang10 = mysql_fetch_assoc($qry5); +$rang11 = mysql_fetch_assoc($qry5); +$rang12 = mysql_fetch_assoc($qry5); +$rang13 = mysql_fetch_assoc($qry5); +$rang14 = mysql_fetch_assoc($qry5); +$rang15 = mysql_fetch_assoc($qry5); +$rang16 = mysql_fetch_assoc($qry5); + + +$summe = 20000000/(1+exp(5-$dlevel/14)); + + + +$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'].','.$rang9['win'].','.$rang10['win'].','.$rang11['win'].','.$rang12['win'].','.$rang13['win'].','.$rang14['win'].','.$rang15['win'].','.$rang16['win'].')'; + +echo $sql.'
'; +$qry = mysql_query($sql); + +while($row = mysql_fetch_assoc($qry)){ + switch($row['id']){ + case $rang1['win']: + $sql = 'UPDATE clan SET geld=geld+'.ceil($summe/2).' WHERE id='.$row['clan']; + echo $sql.'
'; + mysql_query($sql); + insertClanTickerMessage($row['clan'], 'Das Preisgeld von '.ceil($summe/2).' für den 1. Platz im Welttunier erhalten!'); + mysql_query('UPDATE user set pkt = pkt + 100 WHERE id = '.$row['userid']); + insertUserTickerMessage($row['userid'], '100 IP von Welttunier Sieg erhalten!'); + break; + case $rang2['win']: + $sql = 'UPDATE clan SET geld=geld+'.ceil($summe/4).' WHERE id='.$row['clan']; + echo $sql.'
'; + mysql_query($sql); + insertClanTickerMessage($row['clan'], 'Das Preisgeld von '.ceil($summe/4).' für den 2. Platz im Welttunier erhalten!'); + mysql_query('UPDATE user set pkt = pkt + 90 WHERE id = '.$row['userid']); + insertUserTickerMessage($row['userid'], '90 IP von Welttunier 2.Platz erhalten!'); + break; + case $rang3['win']: + case $rang4['win']: + $sql = 'UPDATE clan SET geld=geld+'.ceil($summe/8).' WHERE id='.$row['clan']; + echo $sql.'
'; + mysql_query($sql); + mysql_query('UPDATE user set pkt = pkt + 75 WHERE id = '.$row['userid']); + insertClanTickerMessage($row['clan'], 'Das Preisgeld von '.ceil($summe/8).' für den 3-4. Platz im Welttunier erhalten!'); + insertUserTickerMessage($row['userid'], '75 IP von Welttunier 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 + 50 WHERE id = '.$row['userid']); + insertUserTickerMessage($row['userid'], '50 IP von Welttunier 5-8. Platz erhalten!'); + break; + + case $rang9['win']: + case $rang10['win']: + case $rang11['win']: + case $rang12['win']: + case $rang13['win']: + case $rang14['win']: + case $rang15['win']: + case $rang16['win']: + mysql_query('UPDATE user set pkt = pkt + 25 WHERE id = '.$row['userid']); + insertUserTickerMessage($row['userid'], '25 IP von Welttunier 9-16. Platz erhalten!'); + break; + + default: + break; + } +} +//mysql_query('UPDATE clan SET geld=geld+\'20000000\' WHERE id='$win_name[clan]' LIMIT 1'); + +?> \ No newline at end of file diff --git a/cronjob/gross_turnier.php b/cronjob/gross_turnier.php new file mode 100644 index 0000000..d6d2faf --- /dev/null +++ b/cronjob/gross_turnier.php @@ -0,0 +1,114 @@ +=0; $i--) + { + if($i>0) $zufall=mt_rand(0,$i); + else $zufall=0; + $temp=$array[$i]; + $array[$i]=$array[$zufall]; + $array[$zufall]=$temp; + $newarray[]=$array[$i]; + array_pop($array); + } + return $newarray; +} + +include "db.php"; + +$chars_max = mysql_num_rows(mysql_query("SELECT id FROM chars WHERE rasse !='NPC' ORDER BY level DESC LIMIT 512")); + +if($chars_max<512) { +echo "keine 512 spieler."; +exit; +} + +mysql_query("DELETE FROM turnier_kampf WHERE art='$art_1'"); + + +$char1 = mysql_query("SELECT id FROM chars WHERE rasse !='NPC' ORDER BY level DESC LIMIT 512"); +while($row=mysql_fetch_array($char1)) +{ + $test2[]=$row['id']; +} + +do +{ + + $test2 = rand_array($test2); + $test2 = array_unique($test2); +} + + +while(count($test2)<512); + +$test3=$test2; +reset($test3); +while(current($test3)!=end($test2)) +{ + if(empty($list)) $list=current($test3); + else $list.=','.next($test3); +} + +$result=mysql_query("SELECT * FROM chars WHERE id IN(".$list.") LIMIT 512"); +while($row=mysql_fetch_array($result)) +{ + $charas[$row['id']]=$row; +} + +$a8=0; +$b8=1; + +$round = 1; +while($a8 < 512) +{ + $chara_1 = $charas[$test2[$a8]]; + $chara_2 = $charas[$test2[$b8]]; + include "turnier_kampf.php"; + $a8+=2; + $b8+=2; +} + + + +while($round < 9) +{ + unset($test9); + + + $chars_win = mysql_Query("SELECT win FROM turnier_kampf WHERE round='$round' AND art='$art_1'"); + while($row9 = mysql_fetch_array($chars_win)) + { + $test9[]=$row9['win']; + } + $round++; + $k9=0; + $l9=1; + while($k9 < count($test9)) + { + $chara_1 = $charas[$test9[$k9]]; + $chara_2 = $charas[$test9[$l9]]; + include "turnier_kampf.php"; + $k9+=2; + $l9+=2; + } + + + + +} + +mysql_query("DELETE FROM turnier1 WHERE art='$art_1'"); +?> \ No newline at end of file diff --git a/cronjob/inclu/char.inc.php b/cronjob/inclu/char.inc.php new file mode 100644 index 0000000..59e5c19 --- /dev/null +++ b/cronjob/inclu/char.inc.php @@ -0,0 +1,277 @@ + now()'; + $row = mysql_fetch_assoc(mysql_query($sql)); + if ($row['anzahl'] > 0) { + $GLOBALS['char_buffered_statuses'][$charid] = 'Turnier'; + return 'Turnier'; + } + $sql = 'SELECT count(*) as anzahl from quests where charid = ' . $charid; + $row = mysql_fetch_assoc(mysql_query($sql)); + if ($row['anzahl'] > 0) { + $GLOBALS['char_buffered_statuses'][$charid] = 'Schatz Suche'; + return 'Schatz Suche'; + } + $sql = 'SELECT count(*) as anzahl from kampf where db_satz = ' . $charid; + $row = mysql_fetch_assoc(mysql_query($sql)); + if ($row['anzahl'] > 0) { + $GLOBALS['char_buffered_statuses'][$charid] = 'Kampf'; + return 'Kampf'; + } + + $sql = 'SELECT count(*) as anzahl FROM kampf_list where charakter = ' . $charid; + $row = mysql_fetch_assoc(mysql_query($sql)); + if ($row['anzahl'] > 0) { + $GLOBALS['char_buffered_statuses'][$charid] = 'Kampf erstellt'; + return 'Kampf erstellt'; + } + $sql = 'SELECT count(*) as anzahl FROM turnier1 where charakter = ' . $charid; + $row = mysql_fetch_assoc(mysql_query($sql)); + if ($row['anzahl'] > 0) { + $GLOBALS['char_buffered_statuses'][$charid] = 'Angemeldet'; + return 'Angemeldet'; + } + $GLOBALS['char_buffered_statuses'][$charid] = 'Frei'; + return 'Frei'; +} + +/* + * Char generell! + */ + +// Initialisierung des Puffers +$GLOBALS['char_buffered_instances'] = array (); +$GLOBALS['chars_read_out_user'] = array (); + +// Uebergabe der Charid, und optional ob gepuffert werden darf +// returns: Char als Array +function getChar($charid, $buffer_enabled = true) { + // Fehlerkontrolle + if(!is_numeric($charid)){ + return null; + } +// Wenn Char nicht im Puffer ist, oder nicht gepuffert werden soll + if ($GLOBALS['char_buffered_instances'][$charid] == null || !$buffer_enabled) { +// Lese das Charfeld aus der Datenbank aus + $char = mysql_fetch_assoc(mysql_query('Select * from chars where id = '.$charid)); + if(!$char){return null;} +// Speichere in $char['stauts'] den aktuellen Status des Chars (buffer-Strategie ist hierbei die selbe) + $char['status'] = getStatus($char['id'],$buffer_enabled); + $char['bild'] = getPicture($char); + $GLOBALS['char_buffered_instances'][$charid] = &$char; // Speichern des Chars in den Puffer + } +// Gebe Char zurueck + return $GLOBALS['char_buffered_instances'][$charid]; +} + +function getChar2($charid) { + // Fehlerkontrolle + if(!is_numeric($charid)){ + return null; + } else { + $char = mysql_fetch_assoc(mysql_query('Select * from chars where id = '.$charid)); + if(!$char){return null;} +// Speichere in $char['stauts'] den aktuellen Status des Chars (buffer-Strategie ist hierbei die selbe) + $char['status'] = getStatus($char['id'],$buffer_enabled); + $char['bild'] = getPicture($char); + } + return $char; +} + +function getCharWithBuffs($charid, $buffer_enabled = true){ + $char = getChar($charid, $buffer_enabled); + if($char['kampf_item'] != NULL && $char['kampf_item'] != ',,,,'){ + $char_buffs = mysql_fetch_assoc(mysql_query('SELECT sum(i.hp) as hp, sum(i.mp) as mp, sum(i.starke) as starke, sum(i.verteidigung) as verteidigung, sum(i.speed) as speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id IN (' . $char['kampf_item'] . ')')); + } + $char['starke'] += $char_buffs['starke']; + $char['verteidigung'] += $char_buffs['verteidigung']; + $char['speed'] += $char_buffs['speed']; + $char['ausdauer'] += $char_buffs['ausdauer']; + $char['glueck'] += $char_buffs['glueck']; + return $char; +} + +// Uebergabe der Userid (Nachteil ist, dass Puffer von getChar mit $charid nicht moeglich ist, weil information fehlt, ob alle Chars im Buffer sind + + +/* + * Liefert die Url zum Avatarbild (Falls Char keinen Avatar hat gibt es die + * noavatar.gif zurueck!) + * returns Url of Avatar-Picture + * */ +function getPicture($char){ + // Sichergehen, dass Char geladen wurde + if($char['bild'] == null || $char['bild'] == ''){ + return 'design/bilder/avatare/noavart.gif'; + } + return $char['bild']; +} + + +// returns Array von Char-Arrays +function getCharsOfUser($userid, $buffer_enabled = true) { + // Fehlerkontrolle + if(!is_numeric($userid)){ + return null; + } + + if ($GLOBALS['chars_read_out_user'][$userid] == null || !$buffer_enabled) { + $GLOBALS['chars_read_out_user'][$userid] = array(); + $qry = mysql_query('Select * from chars where besitzer = '.$userid.' order by id'); + while($char = mysql_fetch_assoc($qry)){ +// Speichere in $char['stauts'] den aktuellen Status des Chars (buffer-Strategie ist hierbei die selbe) + $char['status'] = getStatus($char['id'],$buffer_enabled); + $char['bild'] = getPicture($char); +// Speichere den Char in das Globale-Pufferfeld + $GLOBALS['char_buffered_instances'][$char['id']] = $char; +// Gebe dem User eine Referenz auf die globale chars-Variable + $GLOBALS['chars_read_out_user'][$userid][] = &$GLOBALS['char_buffered_instances'][$char['id']]; + } + } + return $GLOBALS['chars_read_out_user'][$userid]; // Gebe das globale Userfeld zurück. +} + +function deleteChar($userid, $charid){ + $char = getChar($charid); + if($char['besitzer'] != $userid){ + return 'Char gehoert nicht dir!'; + } else if($char['status'] != 'Frei'){ + return 'Char ist nicht Frei!'; + } + mysql_query('Delete from lernen where besitzer = '.$charid); + mysql_query('Delete from chars where id = '.$charid); + return true; +} + + +/* + * Funktionen die durch Puffern profitieren würden oder um einfach Code einzusparen und um flexibel zu bleiben + * + */ + +// Ermittelt den Besitzer +// Returns true = Ja, False = Nein, NULL = Error +function isUserOwnerOf($userid, $charid, $buffer_enabled = true){ + // Fehlerkontrolle + if(!is_numeric($userid) || !is_numeric($charid)){ + return null; + } + $char = getChar($charid, $buffer_enabled); + if($char == null){ + return null; + } + return $char['besitzer'] == $userid; +} + +// Funktion um das Powerlevel zu Berechnen (Kann ja durchaus sein, dass sich mal was dran ändert!) +// Returns Powerlevel als Integer, NULL = Error +function getPowerLevel($charid, $buffer_enabled = true){ + $char = getChar($charid, $buffer_enabled); + if($char == null){ + return null; + } + return $char['starke']+$char['verteidigung']+$char['speed']+$char['ausdauer']+$char['glueck']; +} + +function getPowerLevelWithBuffs($charid, $buffer_enabled = true){ + $char = getChar($charid, $buffer_enabled); + if($char == null){ + return null; + } + if($char['kampf_item'] != NULL && $char['kampf_item'] != ',,,,'){ + $char_buffs = mysql_fetch_assoc(mysql_query('SELECT sum(i.hp) as hp, sum(i.mp) as mp, sum(i.starke) as starke, sum(i.verteidigung) as verteidigung, sum(i.speed) as speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id IN (' . $char['kampf_item'] . ')')); + } + return $char_buffs['starke']+$char_buffs['verteidigung']+$char_buffs['speed']+$char_buffs['ausdauer']+$char_buffs['glueck']+$char['starke']+$char['verteidigung']+$char['speed']+$char['ausdauer']+$char['glueck']; +} + +/* + * Auslesen der Attacken, die der Char beherrscht + */ +function getCharAttacks($charid){ + +} + +// Auslesen der Kampfeinstellungen +function getChoosenAttacks($charid){ + +} + + +function getCharRaceId($charid){ + $char = getChar($charid); + $rassen_werte = array( + 'Mensch' => 1, ///0 + 'Saiyajin' => 2, ///1 + 'Dämon' => 3, ///2 + 'Mutant' => 4, ///3 + 'Cyborg' => 5, ///4 + 'Namekianer' => 6, ///5 + 'Pirat' => 7, ///6 + 'Shichibukai' => 8, ///7 + 'Kaioshin' => 9, ///8 + 'Schwertkämpfer' => 10,///9 + 'Grandline Maschine'=> 11,///10 + '01' => 12,///11 + 'Leaf Dorf' => 13,///12 + 'Sand Dorf' => 14,///13 + 'Sound Dorf' => 15///14 + ); + return $rassen_werte[$char['rasse']]; +} + +function getFusionRaceId($charid){ + $char = getChar($charid); + $rassen_werte = array( + 'Mensch' => 1, ///0 + 'Saiyajin' => 2, ///1 + 'Dämon' => 3, ///2 + 'Mutant' => 4, ///3 + 'Cyborg' => 5, ///4 + 'Namekianer' => 6, ///5 + 'Pirat' => 7, ///6 + 'Shichibukai' => 8, ///7 + 'Kaioshin' => 9, ///8 + 'Schwertkämpfer' => 10,///9 + 'Grandline Maschine'=> 11,///10 + '01' => 12,///11 + 'Leaf Dorf' => 13,///12 + 'Sand Dorf' => 14,///13 + 'Sound Dorf' => 15///14 + ); + return $rassen_werte[$char['fusion_rasse']]; + +} + +?> \ No newline at end of file diff --git a/cronjob/inclu/char.php b/cronjob/inclu/char.php new file mode 100644 index 0000000..34ad1c8 --- /dev/null +++ b/cronjob/inclu/char.php @@ -0,0 +1,184 @@ + + + + + +Angucken"; +} +if($chars_status[1] == "Frei") { $chars_status1[1] = "Frei"; } + +else { + +$chars_status1[1] = "Angucken"; +} +if($chars_status[2] == "Frei") { $chars_status1[2] = "Frei"; } + +else { + +$chars_status1[2] = "Angucken"; +} +if($chars_status[3] == "Frei") { $chars_status1[3] = "Frei"; } + +else { + +$chars_status1[3] = "Angucken"; +} +if($chars_status[4] == "Frei") { $chars_status1[4] = "Frei"; } + +else { + +$chars_status1[4] = "Angucken"; +} +if($chars_status[5] == "Frei") { $chars_status1[5] = "Frei"; } + +else { + +$chars_status1[5] = "Angucken"; +} +if($chars_status[6] == "Frei") { $chars_status1[6] = "Frei"; } + +else { + +$chars_status1[6] = "Angucken"; +} +if($chars_status[7] == "Frei") { $chars_status1[7] = "Frei"; } + +else { + +$chars_status1[7] = "Angucken"; +} +?> + + + + + + + + + + + + + + + + + "; +} ?> + + "; +} ?> + "; +} ?> + "; +} ?> + + + + + + + + + + + + + + + "; +} ?> + + "; +} ?> + "; +} ?> + "; +} ?> + +
+

+

+

+

+

+

+

+

+

+

+

+

+    +   +MP: $chars_mp[0]
   +Status: $chars_status1[0]
+    +   +MP: $chars_mp[1]
   +Status: $chars_status1[1]
+    +   +MP: $chars_mp[2]
   +Status: $chars_status1[2]
+    +   +MP: $chars_mp[3]
   +Status: $chars_status1[3]
+

+

+

+

+    +   +MP: $chars_mp[4]
   +Status: $chars_status1[4]
+    +   +MP: $chars_mp[5]
   +Status: $chars_status1[5]
+    +   +MP: $chars_mp[6]
   +Status: $chars_status1[6]
+    +   +MP: $chars_mp[7]
   +Status: $chars_status1[7]
+ + + + \ No newline at end of file diff --git a/cronjob/inclu/community.txt b/cronjob/inclu/community.txt new file mode 100644 index 0000000..e9cc24d --- /dev/null +++ b/cronjob/inclu/community.txt @@ -0,0 +1,23 @@ + + + + + + Forum
+ +FAQ
+ + + +Admin System + + diff --git a/cronjob/inclu/exp.inc.php b/cronjob/inclu/exp.inc.php new file mode 100644 index 0000000..25ce60b --- /dev/null +++ b/cronjob/inclu/exp.inc.php @@ -0,0 +1,196 @@ +'; + mysql_query($sql); + } + + // Sooo und nun gehts darum ob wir neue Attacken lernen können + + // Ersma die ganzen Infos laden + $sql = 'SELECT * FROM lernen where besitzer = '.$char_id; + $qry = mysql_query($sql); + while($row = mysql_fetch_assoc($qry)){ + $lern[$row['at_id']] = $row; // Zum späteren Check ob die Reqs erfüllt sind + $atkid[] = $row['at_id']; // Zum ausschliessen der Attacken + } + + // Wir können jetzt schon die Attacken ausschließen, die wir schon können!! + if(count($atkid) > 0){ + $zusatz = ' AND id NOT IN('.join($atkid,',').')'; + } + + // Lernbare Attacken auswählen + if(!is_null($char['frucht'])){ + $sql = 'select * from attacken where (Frucht is NULL or Frucht = (Select id from wochen_markt where item = \''.$char['frucht'].'\')) and (rassen != \'\' and rassen != \'0\') and level <= '.$char['level'].$zusatz; + } else { + $sql = 'select * from attacken where (Frucht is NULL) and (rassen != \'\' and rassen != \'0\') and level <= '.$char['level'].$zusatz; + } + +// echo $sql.'
'; + + $qry = mysql_query($sql); + + // Das geht leider nicht mit dieser Datenstruktur direkt auszuwählen + $raceid[] = getCharRaceId($char_id); + if(!is_null(getFusionRaceId($char_id))){ + $raceid[] = getFusionRaceId($char_id); + } + + // So und nun arbeite jede Attacke durch die nur im geringsten Lernbar sein könnte ... + while($row = mysql_fetch_assoc($qry)) { + // Erstmal checken ob es eine Fruchtattacke ist (durch die SQL-Anweisung werden alle nicht zutreffenden Früchte ausgeblockt) + $learnable = false; + if(!is_null($row['Frucht'])){ + // Ok es is ne Frucht-attacke :) Also können wir sie lernen :) + $learnable = true; + } else { + // Ok, dann müssen wir die Rasse checken :) + $races = preg_split('#,#', $row['rassen']); + for($i=0;$i'; + $learnable = false; + break; + } + } + } + + if($learnable){ + mysql_query('INSERT lernen SET name=\''.$row['name'].'\', at_id=\''.$row['id'].'\', besitzer=\''.$char_id.'\', aktiv=\'1\''); + echo ''; + } + } +} + +function addExpToChar($char_id, $n_exp){ + $char = getChar($char_id, false); // We really want the actual char!! + $char_exp = explode(',', $char['exp']); + $char_exp[0] += $n_exp; + $lvls = 0; + $tp = 0; + $lp = 0; + while($char_exp[0] >= $char_exp[1]){ + // Level UP!! + $lvls++; + $char['level']++; + + $char_exp[0] -= $char_exp[1]; + $char_exp[1] = calculateRequiredExpChars($char['level']); + $tp += calculateTrainingPoints($char['level']); + $lp += 10; + } + + if($lvls > 0){ // Ist Char um mindestens ein Level gestiegen? + echo ''; + $sql = 'Update chars set exp = \''.$char_exp[0].','.$char_exp[1].'\', lernpunkte = lernpunkte +'.$lp.', training_points = training_points + '.$tp.', level = level + '.$lvls.' where id = '.$char_id; + } else { + $sql = 'Update chars set exp = \''.$char_exp[0].','.$char_exp[1].'\' where id = '.$char_id; + } +// echo $sql.'
'; + mysql_query($sql); + + $char = getChar($char_id, false); // We really want the actual char!! + if($char['level'] > 25) { + // remove this char out of the registration of the beginners tournament + mysql_query('Delete from turnier1 where art = \'klein\' and charakter = \''.$char_id.'\''); + } +} + +function addExpToArena($user_id, $n_exp){ + $sql = 'SELECT * from arena where besitzer = '.$user_id; + $qry = mysql_query($sql); + $arena = mysql_fetch_assoc($qry); + $arena_exp = explode(',', $arena['exp']); + $arena_exp[0] += $n_exp; + $lvls = 0; + while($arena_exp[0] >= $arena_exp[1]){ + // Level UP!! + $lvls++; + $arena['level']++; + + $arena_exp[0] -= $arena_exp[1]; + $arena_exp[1] = calculateRequiredExpArena($arena['level']); + } + if($lvls > 0){ +// mysql_query("UPDATE arena SET exp='$ne_exp1,$new_exp', level='$level1', skill='$skill_points' WHERE besitzer='$user_ida[id]' LIMIT 1"); + echo ''; + mysql_query('Update arena set exp=\''.$arena_exp[0].','.$arena_exp[1].'\', level='.$arena['level'].', skill=skill+'.$lvls.' WHERE besitzer='.$user_id); + } else{ + mysql_query('Update arena set exp=\''.$arena_exp[0].','.$arena_exp[1].'\' WHERE besitzer='.$user_id); + } +} + +?> \ No newline at end of file diff --git a/cronjob/inclu/fruitdistribution.inc.php b/cronjob/inclu/fruitdistribution.inc.php new file mode 100644 index 0000000..e3b264c --- /dev/null +++ b/cronjob/inclu/fruitdistribution.inc.php @@ -0,0 +1,22 @@ + \ No newline at end of file diff --git a/cronjob/inclu/halloffame.inc.php b/cronjob/inclu/halloffame.inc.php new file mode 100644 index 0000000..40d1c7f --- /dev/null +++ b/cronjob/inclu/halloffame.inc.php @@ -0,0 +1,64 @@ +'; + $qry = mysql_query($sql); + return mysql_affected_rows() > 0; +} + +function getHallOfFame($title, $userid) { + $row = mysql_fetch_assoc(mysql_query('Select max(id) as round from online')); + return getHallOfFameFull($row['round'],$title, $userid); +} + +function getHallOfFameFull($round = '', $title = '', $userid = '') { + $sql = 'select count(*) from highscore where runde='.$round.' and userid='.$userid; + $row = mysql_fetch_row($sql); + return $row[0]; +} + +?> \ No newline at end of file diff --git a/cronjob/inclu/messagefunctions.inc.php b/cronjob/inclu/messagefunctions.inc.php new file mode 100644 index 0000000..0e8cb54 --- /dev/null +++ b/cronjob/inclu/messagefunctions.inc.php @@ -0,0 +1,50 @@ + \ No newline at end of file diff --git a/cronjob/kampf/SSJ.php b/cronjob/kampf/SSJ.php new file mode 100644 index 0000000..56fd738 --- /dev/null +++ b/cronjob/kampf/SSJ.php @@ -0,0 +1,52 @@ + \ No newline at end of file diff --git a/cronjob/kampf/Type_Controll.txt b/cronjob/kampf/Type_Controll.txt new file mode 100644 index 0000000..f90b9d9 --- /dev/null +++ b/cronjob/kampf/Type_Controll.txt @@ -0,0 +1,7 @@ +runde: HP = Wieviel runden; +kaioken2: Stärke,def,speed = wieviel % du Stärke bekommst, HP,MP =wieviel % du verlierst davon. +lose: Wert=xx% seiner HP verliert der Gegner. +copy: wert=1 für copy (z.b Stärke 1 = er kopiert Stärke vom Gegner) +majin: wert = x-0.5 damit der gegner es + bekommt dafür schlägt er sich selba. +lose2: Stärke= chance +tausch: stärke=chance \ No newline at end of file diff --git a/cronjob/kampf/andere_technik.php b/cronjob/kampf/andere_technik.php new file mode 100644 index 0000000..0d2f046 --- /dev/null +++ b/cronjob/kampf/andere_technik.php @@ -0,0 +1,89 @@ + $wert_select1_3) { + $new_tech1 = 0; + } else { + $new_tech1 = 1; + } + } + + if($k_select1_2[$x] == 2) { + if($wert_select1 < $wert_select1_3) { + $new_tech1 = 0; + } else { + $new_tech1 = 1; + } + } + +if($new_tech1 == 1) { +$technick1 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1_2[$x]' LIMIT 10")); +$prozent_technik1 = (20*$technick1[aktiv])-20; +$technick1 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10")); +} + +} + + +///////////// Technik spieler 2 +if($k_attacke2_2[$x]) { + if($k_select2_1[$x] == 1) { $wert_select2 = $k_hp[1]; $k_auswahl2 = $k_hp2[1]; } + elseif($k_select2_1[$x] == 2) { $wert_select2 = $k_mp[1]; $k_auswahl2 = $k_mp2[1]; } + elseif($k_select2_1[$x] == 3) { $wert_select2 = $k_starke[1]+$k_ver[1]+$k_speed[1]+$k_ausdauer[1]+$k_glueck[1]; $k_auswahl2 = $wert_select2; + } + + if($k_select2_3[$x] == 1) { $wert_select2_3 = $k_hp[0]; } + elseif($k_select2_3[$x] == 2) { $wert_select2_3 = $k_mp[0]; } + elseif($k_select2_3[$x] == 3) { $wert_select2_3 = $k_starke[0]+$k_ver[0]+$k_speed[0]+$k_ausdauer[0]+$k_glueck[0]; } + elseif($k_select2_3[$x] == 5) { $wert_select2_3 = ($k_auswahl2/100) * 5; } ////////5% + elseif($k_select2_3[$x] == 10) { $wert_select2_3 = ($k_auswahl2/100) * 10; } ////////10% + elseif($k_select2_3[$x] == 20) { $wert_select2_3 = ($k_auswahl2/100) * 20; } ////////20% + elseif($k_select2_3[$x] == 50) { $wert_select2_3 = ($k_auswahl2/100) * 50; ////////50% + } + if($k_select2_2[$x] == 1) { + if($wert_select2 > $wert_select2_3) { + $new_tech2 = 0; + } else { + $new_tech2 = 1; + } + } + + if($k_select2_2[$x] == 2) { + if($wert_select2 < $wert_select2_3) { + $new_tech2 = 0; + } else { + $new_tech2 = 1; + } + } + +if($new_tech2 == 1) { +$technick2 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2_2[$x]' LIMIT 10")); +$prozent_technik2 = (20*$technick2[aktiv])-20; +$technick2 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10")); +} + +} + +?> \ No newline at end of file diff --git a/cronjob/kampf/atk_wert.php b/cronjob/kampf/atk_wert.php new file mode 100644 index 0000000..a90eda5 --- /dev/null +++ b/cronjob/kampf/atk_wert.php @@ -0,0 +1,44 @@ +DEBUG (NICHT ALS BUG MELDEN!!): Speed Char1 '.$speed_char1.', Glueck Char1 = '.$k_glueck[0].', Att-Luck Char1 '.$lucka1.', Par-Luck Char1 '.$luckp1.'
'; +//echo '
DEBUG (NICHT ALS BUG MELDEN!!): ATTACK Char1 '.$zufall_pl1.', PARADE Char1 '.$play1_ausweich.'

'; +//echo '
DEBUG (NICHT ALS BUG MELDEN!!): Speed Char2 '.$speed_char2.', Glueck Char2 = '.$k_glueck[1].', Att-Luck Char2 '.$lucka2.', Par-Luck Char1 '.$luckp2.'
'; +//echo '
DEBUG (NICHT ALS BUG MELDEN!!): ATTACK Char2 '.$zufall_pl2.', PARADE Char2 '.$play2_ausweich.'

'; + +?> \ No newline at end of file diff --git a/cronjob/kampf/ausdauer.php b/cronjob/kampf/ausdauer.php new file mode 100644 index 0000000..011d688 --- /dev/null +++ b/cronjob/kampf/ausdauer.php @@ -0,0 +1,28 @@ + 0) { +################### PLAYER 1 + + +$k_starke[0] = round($k_starke[0] + (($k_ausdauer[0] / 20))-($k_starke[0]/50)); +$k_speed[0] = round($k_speed[0] + ($k_ausdauer[0] / 10)); +$k_ver[0] = round($k_ver[0] + ($k_ausdauer[0] / 10)); +$k_ausdauer[0] = round($k_ausdauer[0] - ($k_ausdauer[0] /20)); + +################### PLAYER 2 + + +$k_starke[1] = round($k_starke[1] + (($k_ausdauer[1] / 20))-($k_starke[1]/50)); +$k_speed[1] = round($k_speed[1] + ($k_ausdauer[1] / 10)); +$k_ver[1] = round($k_ver[1] + ($k_ausdauer[1] / 10)); +$k_ausdauer[1] = round($k_ausdauer[1] - ($k_ausdauer[1] /20)); + +} + +?> \ No newline at end of file diff --git a/cronjob/kampf/chat.php b/cronjob/kampf/chat.php new file mode 100644 index 0000000..209eeef --- /dev/null +++ b/cronjob/kampf/chat.php @@ -0,0 +1,107 @@ + + + + + + + + + + + + + + + + + + + + + +
+

"; +?> + function showfight1(){ + + var Info = window.open("../kampf4.php?char_id=","","status=no,hotkeys=no,Height=600,Width=820,scrollbars=yes"); + + } +"; +?> + +

+ +
+ +
+ +
?char_id= method=post> + + + + + + + +
+ + + +
+ + + + \ No newline at end of file diff --git a/cronjob/kampf/clan_exp.php b/cronjob/kampf/clan_exp.php new file mode 100644 index 0000000..120596d --- /dev/null +++ b/cronjob/kampf/clan_exp.php @@ -0,0 +1,26 @@ += $exp_rows1[max_exp] AND $exp_rows1[level] != 5) { +mysql_query("UPDATE clan SET level=level+1, max_exp='$new_max_exp1', member=member+2 WHERE id='$clan1[$iws]'"); +} + +if($EXP_new2+$exp_rows2[min_exp] >= $exp_rows2[max_exp] AND $exp_rows2[level] != 5) { +mysql_query("UPDATE clan SET level=level+1, max_exp='$new_max_exp2', member=member+2 WHERE id='$clan2[$iws]'"); +} + +?> \ No newline at end of file diff --git a/cronjob/kampf/clan_kampf.php b/cronjob/kampf/clan_kampf.php new file mode 100644 index 0000000..7594b6f --- /dev/null +++ b/cronjob/kampf/clan_kampf.php @@ -0,0 +1,224 @@ + $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) { + +$technick1 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10")); +$prozent_technik1 = (20*$technick1[aktiv])-20; +$technick1 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10")); + +$technick2 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10")); +$prozent_technik2 = (20*$technick2[aktiv])-20; +$technick2 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10")); + + +///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte +include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/andere_technik.php'); /////////////////// Wenn man ne andere technik sich aussuchen will... + + +$technick1[speed]=$technick1[speed]+(($technick1[speed]/100)*$prozent_technik1); +$technick2[speed]=$technick2[speed]+(($technick2[speed]/100)*$prozent_technik2); + +$technick1[verteidigung]=$technick1[verteidigung]+(($technick1[verteidigung]/100)*$prozent_technik1); +$technick2[verteidigung]=$technick2[verteidigung]+(($technick2[verteidigung]/100)*$prozent_technik2); + +$technick1[starke]=$technick1[starke]+(($technick1[starke]/100)*$prozent_technik1); +$technick2[starke]=$technick2[starke]+(($technick2[starke]/100)*$prozent_technik2); + + + +$speeds_char1 = ($k_speed[0] + $technick1[speed]); +$speeds_char2 = ($k_speed[1] + $technick2[speed]); + +$speeds_char1_4 = ($k_speed[0] + $technick1[speed]) / 1.5; +$speeds_char2_4 = ($k_speed[1] + $technick2[speed]) / 1.5; + +if($speeds_char1_4 < 1) { $speeds_char1_4 = 1; } +if($speeds_char2_4 < 1) { $speeds_char2_4 = 1; } + +$speed_char1 = mt_rand($speeds_char1_4,$speeds_char1); +$speed_char2 = mt_rand($speeds_char2_4,$speeds_char2); + + +$aussetzten_runde = ""; ////// MUSS SO BLEIBEN WICHTIG +##################################MP, SSJ Verwandlungen, HP, Koerper Tausch Technicken +include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/majin.php'); + +if(!$aussetzten_runde) { +include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/tausch2.php'); //////////////////Muss ganz oben sein wegen technik Tauschen +include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/gift.php'); +include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/frucht.php'); +include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/mp.php'); +include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/hp.php'); +include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/hp2.php'); +include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/SSJ.php'); +include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/kaioken.php'); +include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/kaioken2.php'); +include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/copy.php'); +include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/lose.php'); +include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/lose2.php'); +include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/ausdauer.php'); +include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/mpv.php'); +include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/tausch.php'); +include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/hpmp.php'); + +} +include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/atk_wert.php'); +#####################################KAMPF SYSTEM +include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/kampf_rechnung.php'); + + + +$db_query = mysql_fetch_array(mysql_query("SELECT * FROM clan_kampf WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1")); + +mysql_query("UPDATE clan_kampf SET hp1='$db_query[hp1],$k_hp7[0]', hp2='$db_query[hp2],$k_hp7[1]', mp1='$db_query[mp1],$k_mp7[0]', mp2='$db_query[mp2],$k_mp7[1]', schaden1='$db_query[schaden1],$schaden_1', schaden2='$db_query[schaden2],$schaden_2', attacke1='$db_query[attacke1],$technick1[name]', attacke2='$db_query[attacke2],$technick2[name]', starke1='$db_query[starke1],$k_starke[0]', starke2='$db_query[starke2],$k_starke[1]', ver1='$db_query[ver1],$k_ver[0]', ver2='$db_query[ver2],$k_ver[1]', speed1='$db_query[speed1],$k_speed[0]', speed2='$db_query[speed2],$k_speed[1]', ausdauer1='$db_query[ausdauer1],$k_ausdauer[0]', ausdauer2='$db_query[ausdauer2],$k_ausdauer[1]' WHERE id='$db_query[id]'"); + + +$x++; +} +###########################EXP VERTEILUNG +$s=0; +while($s < 2) { + +if($s == 1) { + +if($k_hp[0] > $k_hp[1]) { $X13 = HALLO; } else { $X23 = HALLO; } +} + +if($k_hp[1] < $k_aufgabe[1] OR $X13 == "HALLO") { +$clan1_win = 1; +$clan2_win = 0; +$k_exp[1] = 0; +$k_geld[1] = 2000; +$k_exp[0] = 0; +$k_geld[0] = 5000; + +$sieger = $chara_1[id]; +$verlierer = $chara_2[id]; + +} + +if($k_hp[0] < $k_aufgabe[0] OR $X23 == "HALLO") { + +$sieger = $chara_2[id]; +$verlierer = $chara_1[id]; + +$clan1_win= 0; +$clan2_win = 1; +$k_exp[1] = 0; +$k_geld[1] = 5000; +$k_exp[0] = 0; +$k_geld[0] = 2000; + + +} + +if($k_exp[0]) { $s=2; } else { $s++; } + +} +$iws = $iw-1; +mysql_query("UPDATE clan_kampf SET clan1_id='$clan1[$iws]', clan2_id='$clan2[$iws]', exp1='$k_exp[0]', win='$sieger', lose='$verlierer', exp2='$k_exp[1]', geld1='$k_geld[0]', geld2='$k_geld[1]', clan1_win='$clan1_win', clan2_win='$clan2_win' WHERE id='$db_query[id]'"); + + +if($yt == 3) { +$yt=0; +$win_rows1 = mysql_num_rows(mysql_query("SELECT id FROM clan_kampf WHERE clan1_win='1' AND clan1_id='$clan1[$iws]' LIMIT 2")); +$win_rows2 = mysql_num_rows(mysql_query("SELECT id FROM clan_kampf WHERE clan2_win='1' AND clan2_id='$clan2[$iws]' LIMIT 2")); + +if($win_rows1 > $win_rows2) { + +////CLAN 1 WINS +$exp_rows1 = mysql_fetch_array(mysql_query("SELECT siege, level, min_exp, max_exp FROM clan WHERE id='$clan1[$iws]' LIMIT 1")); +$exp_rows2 = mysql_fetch_array(mysql_query("SELECT siege, level, min_exp, max_exp FROM clan WHERE id='$clan2[$iws]' LIMIT 1")); + +$EXP_new1 = ($exp_rows2[siege]+1) * 10; +$EXP_new2 = ($exp_rows1[siege]+1) * 5; + +include "clan_exp.php"; +include($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf/kampf_rechnung.php'); + +mysql_query("UPDATE clan SET geld=geld+'5000', siege=siege+1, min_exp=min_exp+'$EXP1_new1' WHERE id='$clan1[$iws]'"); +mysql_query("UPDATE clan SET geld=geld+'2000', niederlagen=niederlagen+1, min_exp=min_exp+'$EXP1_new2' WHERE id='$clan2[$iws]'"); +} else { + +$exp_rows1 = mysql_fetch_array(mysql_query("SELECT siege, level, min_exp, max_exp FROM clan WHERE id='$clan1[$iws]' LIMIT 1")); +$exp_rows2 = mysql_fetch_array(mysql_query("SELECT siege, level, min_exp, max_exp FROM clan WHERE id='$clan2[$iws]' LIMIT 1")); + +$EXP_new2 = ($exp_rows1[siege]+1) * 10; +$EXP_new1 = ($exp_rows2[siege]+1) * 5; + + +include "clan_exp.php"; + +////CLAN 2 WINS +mysql_query("UPDATE clan SET geld=geld+'2000', niederlagen=niederlagen+1, min_exp=min_exp+'$EXP1_new1' WHERE id='$clan1[$iws]'"); +mysql_query("UPDATE clan SET geld=geld+'5000', siege=siege+1, min_exp=min_exp+'$EXP1_new2' WHERE id='$clan2[$iws]'"); +} + +} + +?> \ No newline at end of file diff --git a/cronjob/kampf/copy.php b/cronjob/kampf/copy.php new file mode 100644 index 0000000..d95c7e6 --- /dev/null +++ b/cronjob/kampf/copy.php @@ -0,0 +1,56 @@ += 0) { + + if ($technick1[starke] == 1) { /////Staerke wird kopiert + $k_starke[0] = $k_starke[0] + $k_starke[1]; + } + if ($technick1[speed] == 1) { /////Staerke wird kopiert + $k_speed[0] = $k_speed[0] + $k_speed[1]; + } + if ($technick1[verteidigung] == 1) { /////Staerke wird kopiert + $k_ver[0] = $k_ver[0] + $k_ver[1]; + } + $schaden_1 = "Power Kopiern!"; + } else { + $schaden_1 = "Kopiern Fehlgeschlagen"; + $k_mp[0] = 0; + } + + $aktion_AV1[$x] = "nein"; +} + +################### Spieler 2 + +if ($technick2[type] == copy) { + $k_mp[1] = $k_mp[1] - $technick2[mp]; + + if ($k_mp[1] >= 0) { + + if ($technick2[starke] == 1) { /////Staerke wird kopiert + $k_starke[1] = $k_starke[0] + $k_starke[1]; + } + if ($technick2[speed] == 1) { /////Staerke wird kopiert + $k_speed[1] = $k_speed[0] + $k_speed[1]; + } + if ($technick2[verteidigung] == 1) { /////Staerke wird kopiert + $k_ver[1] = $k_ver[0] + $k_ver[1]; + } + $schaden_2 = "Power Kopiern!"; + } else { + $schaden_2 = "Kopiern Fehlgeschlagen"; + $k_mp[1] = 0; + } + + $aktion_AV2[$x] = "nein"; +} \ No newline at end of file diff --git a/cronjob/kampf/fight_vorbei.php b/cronjob/kampf/fight_vorbei.php new file mode 100644 index 0000000..d5e2442 --- /dev/null +++ b/cronjob/kampf/fight_vorbei.php @@ -0,0 +1,98 @@ + diff --git a/cronjob/kampf/frucht.php b/cronjob/kampf/frucht.php new file mode 100644 index 0000000..cf39577 --- /dev/null +++ b/cronjob/kampf/frucht.php @@ -0,0 +1,49 @@ + \ No newline at end of file diff --git a/cronjob/kampf/gift.php b/cronjob/kampf/gift.php new file mode 100644 index 0000000..0d623f5 --- /dev/null +++ b/cronjob/kampf/gift.php @@ -0,0 +1,100 @@ + $x) { + $technick1_old = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$attacken_list[$runden_gif_technik1]' LIMIT 1")); + + $k_starke[1] = $k_starke[1] - $technick1_old[starke]; + $k_speed[1] = $k_speed[1] - $technick1_old[speed]; + $k_ver[1] = $k_ver[1] - $technick1_old[verteidigung]; + $k_hp[1] = $k_hp[1] - $technick1_old[hp]; + + } else { + $runden_gif1 = ""; + $runden_gif_technik1 = ""; + } + +} + + +if($technick1[type] == "gift") { + +$k_mp[0] = $k_mp[0] - $technick1[mp]; +if($k_mp[0] < 0) { +$schaden_2 = "Keinen Schaden"; +$schaden_1 = "Schädigen fehlgeschlagen"; +$aktion_AV1[$x] = "nein"; +$k_mp[0] = 0; +} else { + +$schaden_1 = "Schädigen"; + +$runden_gif1 = $x+$technick1[runden]; +$runden_gif_technik1 = $x; + +$k_starke[1] = $k_starke[1] - $technick1[starke]; +$k_speed[1] = $k_speed[1] - $technick1[speed]; +$k_ver[1] = $k_ver[1] - $technick1[verteidigung]; +$k_hp[1] = $k_hp[1] - $technick1[hp]; + +$aktion_AV1[$x] = "nein"; +}} + +####################GIFT SPIELER 2 + +if($runden_gif2) { + if($runden_gif2 > $x) { + $technick2_old = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$attacken_list[$runden_gif_technik2]' LIMIT 1")); + + $k_starke[0] = $k_starke[0] - $technick2_old[starke]; + $k_speed[0] = $k_speed[0] - $technick2_old[speed]; + $k_ver[0] = $k_ver[0] - $technick2_old[verteidigung]; + $k_hp[0] = $k_hp[0] - $technick2_old[hp]; + } else { + $runden_gif2 = ""; + $runden_gif_technik2 = ""; + } + +} + + +if($technick2[type] == "gift") { + +$k_mp[1] = $k_mp[1] - $technick2[mp]; + +if($k_mp[1] < 0) { +$schaden_1 = "Keinen Schaden"; +$schaden_2 = "Schädigen fehlgeschlagen"; +$aktion_AV2[$x] = "nein"; +$k_mp[1] = 0; +} else { + + +$schaden_2 = "Schädigen"; + +$runden_gif2 = $x+$technick2[runden]; +$runden_gif_technik2 = $x; + +$k_starke[0] = $k_starke[0] - $technick2[starke]; +$k_speed[0] = $k_speed[0] - $technick2[speed]; +$k_ver[0] = $k_ver[0] - $technick2[verteidigung]; +$k_hp[0] = $k_hp[0] - $technick2[hp]; + +$aktion_AV2[$x] = "nein"; +}} + + + + + + + + +?> \ No newline at end of file diff --git a/cronjob/kampf/hp.php b/cronjob/kampf/hp.php new file mode 100644 index 0000000..c216fd5 --- /dev/null +++ b/cronjob/kampf/hp.php @@ -0,0 +1,19 @@ + 0) { +$k_hp[0] = $k_hp[0] - $technick1[hp]; +} + +####################KAMPF HP SPIELER 2 + +if($technick2[type] == normal AND $technick2[hp] > 0) { +$k_hp[1] = $k_hp[1] - $technick2[hp]; +} +?> \ No newline at end of file diff --git a/cronjob/kampf/hp2.php b/cronjob/kampf/hp2.php new file mode 100644 index 0000000..70d176f --- /dev/null +++ b/cronjob/kampf/hp2.php @@ -0,0 +1,43 @@ + \ No newline at end of file diff --git a/cronjob/kampf/hpmp.php b/cronjob/kampf/hpmp.php new file mode 100644 index 0000000..08ad8dd --- /dev/null +++ b/cronjob/kampf/hpmp.php @@ -0,0 +1,36 @@ + diff --git a/cronjob/kampf/kaioken.php b/cronjob/kampf/kaioken.php new file mode 100644 index 0000000..5f54927 --- /dev/null +++ b/cronjob/kampf/kaioken.php @@ -0,0 +1,45 @@ + \ No newline at end of file diff --git a/cronjob/kampf/kaioken2.php b/cronjob/kampf/kaioken2.php new file mode 100644 index 0000000..573c46a --- /dev/null +++ b/cronjob/kampf/kaioken2.php @@ -0,0 +1,35 @@ + \ No newline at end of file diff --git a/cronjob/kampf/kampf_include.php b/cronjob/kampf/kampf_include.php new file mode 100644 index 0000000..68af9d8 --- /dev/null +++ b/cronjob/kampf/kampf_include.php @@ -0,0 +1,24 @@ + \ No newline at end of file diff --git a/cronjob/kampf/kampf_rechnung.php b/cronjob/kampf/kampf_rechnung.php new file mode 100644 index 0000000..32794e3 --- /dev/null +++ b/cronjob/kampf/kampf_rechnung.php @@ -0,0 +1,74 @@ + $play2_ausweich) { + +$alt_hp = $k_hp[1]; + +$charsa1_def = $k_ver[1]+$technick2[verteidigung]; +$charsa1_4_def = ($k_ver[1]+$technick2[verteidigung]) / 1.1; + +if($charsa1_def <= 2) { $charsa1_def = 2; } +if($charsa1_4_def < 1) { $charsa1_4_def = 1; } + +$charsa1_def = mt_rand($charsa1_4_def,$charsa1_def); + +$charsa1_str = $k_starke[0]*1.2+$technick1[starke]; +$charsa1_4_str = ($k_starke[0]*1.2+$technick1[starke])+1; + +if($charsa1_str <= 2) { $charsa1_str = 2; } + +if($charsa1_4_str < 1) { $charsa1_4_str = 1; } + +$charsa1_str = mt_rand($charsa1_4_str,$charsa1_str); + +$k_hp[1] = round(($k_hp[1] + $charsa1_def - $charsa1_str + mt_rand(1,20))); +$schaden_1 = $alt_hp - $k_hp[1]; +if($alt_hp < $k_hp[1]) { $k_hp[1] = $alt_hp; $schaden_1 = 0; } +} else { +$schaden_1 = "Keinen Schaden"; +} +} +if(!$aktion_AV2[$x]) { +if($zufall_pl2 > $play1_ausweich) { + + +$alt_hp = $k_hp[0]; + +$charsa2_def = $k_ver[0]+$technick1[verteidigung]; +$charsa2_4_def = ($k_ver[0]+$technick1[verteidigung]) / 1.1; + +if($charsa2_def <= 2) { $charsa2_def = 2; } +if($charsa2_4_def < 1) { $charsa2_4_def = 1; } + +$charsa2_def = mt_rand($charsa2_4_def,$charsa2_def); +$charsa2_str = $k_starke[1]*1.2+$technick2[starke]; +$charsa2_4_str = ($k_starke[1] *1.2 +$technick2[starke]) +1; + +if($charsa1_str <= 2) { $charsa1_str = 2; } +if($charsa2_4_str < 1) { $charsa2_4_str = 1; } + +$charsa2_str = mt_rand($charsa2_4_str,$charsa2_str); + +$k_hp[0] = round(($k_hp[0] + $charsa2_def - $charsa2_str + mt_rand(1,20))); +$schaden_2 = $alt_hp - $k_hp[0]; +if($alt_hp < $k_hp[0]) { $k_hp[0] = $alt_hp; $schaden_2 = 0; } +} else { +$schaden_2 = "Keinen Schaden"; +}} + +if(!$technick1[name]) { $technick1[name] = "Normaler Kick"; } +if(!$technick2[name]) { $technick2[name] = "Normaler Kick"; } + + + +if($k_hp[0]<0) { $k_hp7[0] = 0; } else { $k_hp7[0] = $k_hp[0]; } +if($k_mp[0]<0) { $k_mp7[0] = 0; } else { $k_mp7[0] = $k_mp[0]; } +if($k_hp[1]<0) { $k_hp7[1] = 0; } else { $k_hp7[1] = $k_hp[1]; } +if($k_mp[1]<0) { $k_mp7[1] = 0; } else { $k_mp7[1] = $k_mp[1]; } +?> \ No newline at end of file diff --git a/cronjob/kampf/liga_kampf.php b/cronjob/kampf/liga_kampf.php new file mode 100644 index 0000000..5b31233 --- /dev/null +++ b/cronjob/kampf/liga_kampf.php @@ -0,0 +1,193 @@ + $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) { + +$technick1 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10")); +$prozent_technik1 = (20*$technick1[aktiv])-20; +$technick1 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10")); + +$technick2 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10")); +$prozent_technik2 = (20*$technick2[aktiv])-20; +$technick2 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10")); + + +///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte +include "kampf/andere_technik.php"; /////////////////// Wenn man ne andere technik sich aussuchen will... + + +$technick1[speed]=$technick1[speed]+(($technick1[speed]/100)*$prozent_technik1); +$technick2[speed]=$technick2[speed]+(($technick2[speed]/100)*$prozent_technik2); + +$technick1[verteidigung]=$technick1[verteidigung]+(($technick1[verteidigung]/100)*$prozent_technik1); +$technick2[verteidigung]=$technick2[verteidigung]+(($technick2[verteidigung]/100)*$prozent_technik2); + +$technick1[starke]=$technick1[starke]+(($technick1[starke]/100)*$prozent_technik1); +$technick2[starke]=$technick2[starke]+(($technick2[starke]/100)*$prozent_technik2); + + + +$speeds_char1 = ($k_speed[0] + $technick1[speed]); +$speeds_char2 = ($k_speed[1] + $technick2[speed]); + +$speeds_char1_4 = ($k_speed[0] + $technick1[speed]) / 1.5; +$speeds_char2_4 = ($k_speed[1] + $technick2[speed]) / 1.5; + +if($speeds_char1_4 < 1) { $speeds_char1_4 = 1; } +if($speeds_char2_4 < 1) { $speeds_char2_4 = 1; } + +$speed_char1 = $speeds_char1; +$speed_char2 = $speeds_char2; + + +$aussetzten_runde = ""; ////// MUSS SO BLEIBEN WICHTIG +##################################MP, SSJ Verwandlungen, HP, Koerper Tausch Technicken +include "kampf/majin.php"; + +if(!$aussetzten_runde) { +include "kampf/atk_wert.php"; +include "kampf/tausch2.php"; //////////////////Muss ganz oben sein wegen technik Tauschen +include "kampf/frucht.php"; +include "kampf/runde.php"; +include "kampf/mp.php"; +include "kampf/hp.php"; +include "kampf/hp2.php"; +include "kampf/SSJ.php"; +include "kampf/kaioken.php"; +include "kampf/kaioken2.php"; +include "kampf/copy.php"; +include "kampf/lose.php"; +include "kampf/lose2.php"; +include "kampf/ausdauer.php"; +include "kampf/mpv.php"; +include "kampf/tausch.php"; +include "kampf/hpmp.php"; +} +include "kampf/atk_wert.php"; +#####################################KAMPF SYSTEM +include "kampf/kampf_rechnung.php"; + + + +$db_query = mysql_fetch_array(mysql_query("SELECT * FROM liga_kampf WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1")); + +mysql_query("UPDATE liga_kampf SET hp1='$db_query[hp1],$k_hp7[0]', hp2='$db_query[hp2],$k_hp7[1]', mp1='$db_query[mp1],$k_mp7[0]', mp2='$db_query[mp2],$k_mp7[1]', schaden1='$db_query[schaden1],$schaden_1', schaden2='$db_query[schaden2],$schaden_2', attacke1='$db_query[attacke1],$technick1[name]', attacke2='$db_query[attacke2],$technick2[name]', starke1='$db_query[starke1],$k_starke[0]', starke2='$db_query[starke2],$k_starke[1]', ver1='$db_query[ver1],$k_ver[0]', ver2='$db_query[ver2],$k_ver[1]', speed1='$db_query[speed1],$k_speed[0]', speed2='$db_query[speed2],$k_speed[1]', ausdauer1='$db_query[ausdauer1],$k_ausdauer[0]', ausdauer2='$db_query[ausdauer2],$k_ausdauer[1]' WHERE id='$db_query[id]'"); + + +$x++; +} +###########################EXP VERTEILUNG +$s=0; +while($s < 2) { + +if($s == 1) { + +if($k_hp[0] > $k_hp[1]) { $X13 = HALLO; } else { $X23 = HALLO; } +} + +if($k_hp[1] < $k_aufgabe[1] OR $X13 == "HALLO") { +$k_exp[1] = 0; +$k_geld[1] = 0; +$k_exp[0] = 0; +$k_geld[0] = 0; + + + +$sieger = $chara_1[id]; +$verlierer = $chara_2[id]; + +} + +if($k_hp[0] < $k_aufgabe[0] OR $X23 == "HALLO") { + +$sieger = $chara_2[id]; +$verlierer = $chara_1[id]; + + +$k_exp[1] = 0; +$k_geld[1] = 0; +$k_exp[0] = 0; +$k_geld[0] = 0; + + +} + +if($k_exp[0]) { $s=2; } else { $s++; } + +} +$punkt_sieger = (11-$x) + 500; +$punkt_verlierer = 0; + +$dauer_Z = time(); + +mysql_query("UPDATE chars SET liga_siege=liga_siege+1, liga_punkte=liga_punkte+'$punkt_sieger' WHERE id='$sieger' LIMIT 1"); +mysql_query("UPDATE chars SET liga_niederlagen=liga_niederlagen+1, liga_punkte=liga_punkte+'$punkt_verlierer' WHERE id='$verlierer' LIMIT 1"); + +mysql_query("UPDATE liga_kampf SET exp1='$k_exp[0]', win='$sieger', lose='$verlierer', exp2='$k_exp[1]', geld1='$k_geld[0]', geld2='$k_geld[1]', dauer='$dauer_Z' WHERE id='$db_query[id]'"); + + +?> \ No newline at end of file diff --git a/cronjob/kampf/lose.php b/cronjob/kampf/lose.php new file mode 100644 index 0000000..b507ab5 --- /dev/null +++ b/cronjob/kampf/lose.php @@ -0,0 +1,49 @@ + \ No newline at end of file diff --git a/cronjob/kampf/lose2.php b/cronjob/kampf/lose2.php new file mode 100644 index 0000000..55ce544 --- /dev/null +++ b/cronjob/kampf/lose2.php @@ -0,0 +1,44 @@ += mt_rand(1,100)) { +$schaden_1 = "Schwächen"; +$k_mp[1] = ($k_mp2[1] / 100) * 20; +} else { +$schaden_1 = "Schwächen fehlgeschlagen"; +} +} +$aktion_AV1[$x] = "nein"; +} +####################KAIOKEN-LOSE SPIELER 2 + +if($technick2[type] == "lose2") { +$k_mp[1] = $k_mp[1] - $technick2[mp]; +if($k_mp[1] < 0) { +$schaden_2 = "Schwächen fehlgeschlagen"; +$k_mp[1] = 0; +} else { + +if($technick2[starke] >= mt_rand(1,100)) { +$schaden_2 = "Schwächen"; +$k_mp[0] = ($k_mp1[1] / 100) * 20; +} else { +$schaden_2 = "Schwächen fehlgeschlagen"; + +} +} +$aktion_AV2[$x] = "nein"; +} +?> diff --git a/cronjob/kampf/majin.php b/cronjob/kampf/majin.php new file mode 100644 index 0000000..3d86322 --- /dev/null +++ b/cronjob/kampf/majin.php @@ -0,0 +1,62 @@ + \ No newline at end of file diff --git a/cronjob/kampf/mp.php b/cronjob/kampf/mp.php new file mode 100644 index 0000000..db118dd --- /dev/null +++ b/cronjob/kampf/mp.php @@ -0,0 +1,28 @@ + 0) { +$k_mp[0] = $k_mp[0] - $technick1[mp]; + +if($k_mp[0] < 0) { +$k_hp[0] = $k_hp[0] + ($k_mp[0] * 10); +$k_mp[0] = 0; +} +} +####################KAMPF MP SPIELER 2 + +if($technick2[type] == normal AND $technick2[mp] > 0) { +$k_mp[1] = $k_mp[1] - $technick2[mp]; + +if($k_mp[1] < 0) { +$k_hp[1] = $k_hp[1] + ($k_mp[1] * 10); +$k_mp[1] = 0; +} +} +?> \ No newline at end of file diff --git a/cronjob/kampf/mpv.php b/cronjob/kampf/mpv.php new file mode 100644 index 0000000..5d576f1 --- /dev/null +++ b/cronjob/kampf/mpv.php @@ -0,0 +1,24 @@ + \ No newline at end of file diff --git a/cronjob/kampf/normal2.jpg b/cronjob/kampf/normal2.jpg new file mode 100644 index 0000000..106a2bd Binary files /dev/null and b/cronjob/kampf/normal2.jpg differ diff --git a/cronjob/kampf/runde.php b/cronjob/kampf/runde.php new file mode 100644 index 0000000..32d5090 --- /dev/null +++ b/cronjob/kampf/runde.php @@ -0,0 +1,50 @@ + \ No newline at end of file diff --git a/cronjob/kampf/schatten.php b/cronjob/kampf/schatten.php new file mode 100644 index 0000000..eedc7b9 --- /dev/null +++ b/cronjob/kampf/schatten.php @@ -0,0 +1,78 @@ + $x) { + $play1_ausweich=$old_ausweich_wert; + } else { + $old_ausweich_wert = ""; + $schatten_runden = ""; + } +} +///////////////ENDE + + +if($technick1[type] == "schatten") { +$k_mp[0] = $k_mp[0] - $technick1[mp]; +$k_hp[0] = $k_hp[0] - $technick1[hp]; +if($k_mp[0] < 0) { +$schaden_2 = "Keinen Schaden"; +$schaden_1 = "Keine Kraft"; +$aktion_AV1[$x] = "nein"; +$k_mp[0] = 0; +} else { +///////////////////die rechnung sozusagen. + +if(!$old_ausweich_wert) { + $old_ausweich_wert = $technick1[speed]; + $schatten_runden = $x+$technick1[starke]; +} + + + +$play1_ausweich=$old_ausweich_wert; + +}} + +####################KAIOKEN SPIELER 2 + +///////////////Damit es fuer xxx runden bleibt! +if($old_ausweich_wert2) { + if($schatten_runde2 > $x) { + $play2_ausweich=$old_ausweich_wert2; + } else { + $old_ausweich_wert2 = ""; + $schatten_runden2 = ""; + } +} +///////////////ENDE + +if($technick2[type] == "schatten") { +$k_mp[1] = $k_mp[1] - $technick2[mp]; +$k_hp[1] = $k_hp[1] - $technick2[hp]; +if($k_mp[1] < 0) { +$schaden_1 = "Keinen Schaden"; +$schaden_2 = "Keine Kraft"; +$aktion_AV2[$x] = "nein"; +$k_mp[1] = 0; +} else { + + +if(!$old_ausweich_wert2) { + $old_ausweich_wert2 = $technick2[speed]; + $schatten_runden2 = $x+$technick2[starke]; +} + + +$play2_ausweich=$old_ausweich_wert2; + +}} + +?> \ No newline at end of file diff --git a/cronjob/kampf/summon.php b/cronjob/kampf/summon.php new file mode 100644 index 0000000..b8bab47 --- /dev/null +++ b/cronjob/kampf/summon.php @@ -0,0 +1,117 @@ +$technick1[maxlvl]) { + + $schaden_1 = "$user_summon_id[name] ist zu Stark"; + $aktion_AV1[$x] = "nein"; + } else { + $schaden_1 = "$user_summon_id[name]"; + $runden_summon1 = $x+$technick1[starke]; + + $k_starke[0] = $k_starke[0] + $user_summon_id[starke]; + $k_speed[0] = $k_speed[0] + $user_summon_id[speed]; + $k_ver[0] = $k_ver[0] + $user_summon_id[verteidigung]; + $k_ausdauer[0] = $k_ausdauer[0] + $user_summon_id[ausdauer]; + $k_hp[0] = $k_hp[0] + $user_summon_id[hp]; + $k_mp[0] = $k_mp[0] + $user_summon_id[mp]; + + $aktion_AV1[$x] = "nein"; + } + } +} + + +####################KAIOKEN SPIELER 2 + +if($runden_summon2) { + + if($runden_summon2 == $x) { + + $user_summon_id = mysql_fetch_array(mysql_query("SELECT f.starke, f.speed, f.verteidigung, f.ausdauer, f.hp, f.mp, f.level, m.name FROM user u LEFT JOIN quest_fang f ON(f.id=u.summon) LEFT JOIN quest_monster m ON(m.id=f.monster) WHERE u.id='$chara_2[besitzer]' LIMIT 1")); + + $k_starke[1] = $k_starke[1] - $user_summon_id[starke]; + $k_speed[1] = $k_speed[1] - $user_summon_id[speed]; + $k_ver[1] = $k_ver[1] - $user_summon_id[verteidigung]; + $k_ausdauer[1] = $k_ausdauer[1] - $user_summon_id[ausdauer]; + $k_hp[1] = $k_hp[1] - $user_summon_id[hp]; + $k_mp[1] = $k_mp[1] - $user_summon_id[mp]; + $runden_summon2 = 0; + } + +} + +if($technick2[type] == "summon") { + + $k_mp[1] = $k_mp[1] - $technick2[mp]; + $k_hp[1] = $k_hp[1] - $technick2[hp]; + + if($k_mp[1] < 0) { + $schaden_1 = "Keinen Schaden"; + $schaden_2 = "Summon fehlgeschlagen"; + $aktion_AV2[$x] = "nein"; + $k_mp[1] = 0; + } else { + + $user_summon_id = mysql_fetch_array(mysql_query("SELECT f.starke, f.speed, f.verteidigung, f.ausdauer, f.hp, f.mp, m.level, m.name FROM user u LEFT JOIN quest_fang f ON(f.id=u.summon) LEFT JOIN quest_monster m ON(m.id=f.monster) WHERE u.id='$chara_2[besitzer]' LIMIT 1")); + + if($user_summon_id[level]>$technick2[maxlvl]) { + $schaden_2 = "$user_summon_id[name] ist zu Stark"; + $aktion_AV2[$x] = "nein"; + } else { + + $schaden_2 = "$user_summon_id[name]"; + + $runden_summon2 = $x+$technick2[starke]; + + + $k_starke[1] = $k_starke[1] + $user_summon_id[starke]; + $k_speed[1] = $k_speed[1] + $user_summon_id[speed]; + $k_ver[1] = $k_ver[1] + $user_summon_id[verteidigung]; + $k_ausdauer[1] = $k_ausdauer[1] + $user_summon_id[ausdauer]; + $k_hp[1] = $k_hp[1] + $user_summon_id[hp]; + $k_mp[1] = $k_mp[1] + $user_summon_id[mp]; + + $aktion_AV2[$x] = "nein"; + } + } +} + + + +?> \ No newline at end of file diff --git a/cronjob/kampf/tausch.php b/cronjob/kampf/tausch.php new file mode 100644 index 0000000..8d2e4e6 --- /dev/null +++ b/cronjob/kampf/tausch.php @@ -0,0 +1,124 @@ + ($ktuser_luck*1.75)) { + $chance = 25; + } + return $chance; + } + +} + +################### Spieler 1 +$chance = getKTChance($k_glueck[0], $k_glueck[1]); +$random = mt_rand(0,100); + +if ($technick1['type'] == tausch) { + if ($k_mp[0] >= $technick1['mp']) { + if($random <= $chance) { //Trefferchance abhängig vom ausgewürfeltem Glück + if ($kampf_info['rasse'] != "NPC") { ///BEI NPCS WIRD KOERPER TAUSCH GEBLOCKT + $k_starke_alt[0] = $k_starke[0]; + $k_speed_alt[0] = $k_speed[0]; + $k_ver_alt[0] = $k_ver[0]; + $k_ausdauer_alt[0] = $k_ausdauer[0]; + $k_hp_alt[0] = $k_hp[0]; + + $k_starke_alt[1] = $k_starke[1]; + $k_speed_alt[1] = $k_speed[1]; + $k_ver_alt[1] = $k_ver[1]; + $k_ausdauer_alt[1] = $k_ausdauer[1]; + $k_hp_alt[1] = $k_hp[1]; + + $k_starke[0] = $k_starke_alt[1]; + $k_speed[0] = $k_speed_alt[1]; + $k_ver[0] = $k_ver_alt[1]; + $k_ausdauer[0] = $k_ausdauer_alt[1]; + $k_hp[0] = $k_hp_alt[1]; + + $k_starke[1] = $k_starke_alt[0]; + $k_speed[1] = $k_speed_alt[0]; + $k_ver[1] = $k_ver_alt[0]; + $k_ausdauer[1] = $k_ausdauer_alt[0]; + $k_hp[1] = $k_hp_alt[0]; + + $k_mp[0] = $k_mp[0] - $technick1['mp']; + $schaden_1 = "Körpertausch"; + } + } else { + $k_mp[0] = $k_mp[0] - $technick1['mp']; + if ($k_mp[0] < 0) { + $k_mp[0] = 0; + } + $schaden_1 = "Körpertausch fehlgeschlagen"; + } + } + else { + $schaden_1 = "Körpertausch fehlgeschlagen"; + } + $aktion_AV1[$x] = "nein"; +} + +################### Spieler 2 +$chance = getKTChance($k_glueck[1], $k_glueck[0]); +$random = mt_rand(0,100); + +if ($technick2['type'] == tausch) { + if ($k_mp[1] >= $technick2['mp']) { + if($random <= $chance) { //Trefferchance abhängig vom ausgewürfeltem Glück + + $k_starke_alt[0] = $k_starke[0]; + $k_speed_alt[0] = $k_speed[0]; + $k_ver_alt[0] = $k_ver[0]; + $k_ausdauer_alt[0] = $k_ausdauer[0]; + $k_hp_alt[0] = $k_hp[0]; + + $k_starke_alt[1] = $k_starke[1]; + $k_speed_alt[1] = $k_speed[1]; + $k_ver_alt[1] = $k_ver[1]; + $k_ausdauer_alt[1] = $k_ausdauer[1]; + $k_hp_alt[1] = $k_hp[1]; + + $k_starke[0] = $k_starke_alt[1]; + $k_speed[0] = $k_speed_alt[1]; + $k_ver[0] = $k_ver_alt[1]; + $k_ausdauer[0] = $k_ausdauer_alt[1]; + $k_hp[0] = $k_hp_alt[1]; + + $k_starke[1] = $k_starke_alt[0]; + $k_speed[1] = $k_speed_alt[0]; + $k_ver[1] = $k_ver_alt[0]; + $k_ausdauer[1] = $k_ausdauer_alt[0]; + $k_hp[1] = $k_hp_alt[0]; + + $k_mp[1] = $k_mp[1] - $technick2['mp']; + $schaden_2 = "Körpertausch"; + } else { + $k_mp[1] = $k_mp[1] - $technick2['mp']; + if ($k_mp[1] < 0) { + $k_mp[1] = 0; + } + $schaden_1 = "Körpertausch fehlgeschlagen"; + } + } + else { + $schaden_2 = "Körpertausch fehlgeschlagen"; + } + $aktion_AV2[$x] = "nein"; + +} + +?> \ No newline at end of file diff --git a/cronjob/kampf/tausch2.php b/cronjob/kampf/tausch2.php new file mode 100644 index 0000000..837a8aa --- /dev/null +++ b/cronjob/kampf/tausch2.php @@ -0,0 +1,59 @@ += 0) { + +$prozent_technik1 = 0; +$technick1 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick2[id]' LIMIT 10")); + + +$technick1[speed]=$technick1[speed]+(($technick1[speed]/100)*$prozent_technik1); +$technick1[verteidigung]=$technick1[verteidigung]+(($technick1[verteidigung]/100)*$prozent_technik1); +$technick1[starke]=$technick1[starke]+(($technick1[starke]/100)*$prozent_technik1); +$speeds_char1 = ($k_speed[0] + $technick1[speed]); +$speeds_char1_4 = ($k_speed[0] + $technick1[speed]) / 1.5; +if($speeds_char1_4 < 1) { $speeds_char1_4 = 1; } +$speed_char1 = mt_rand($speeds_char1_4,$speeds_char1); + + +} else { +$k_mp[0] = $k_mp[0] - $technick1[mp]; +$schaden_1 = "Techniktausch Fehlgeschlagen"; +$aktion_AV1[$x] = "nein"; +} + +} + +################### Spieler 2 + +if($technick2[type] == "tausch2") { +$k_mp[1] = $k_mp[1] - $technick2[mp]; +if($k_mp[1] >= 0) { + +$prozent_technik2 = 0; +$technick2 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick1[id]' LIMIT 10")); + +$technick2[speed]=$technick2[speed]+(($technick2[speed]/100)*$prozent_technik2); +$technick2[verteidigung]=$technick2[verteidigung]+(($technick2[verteidigung]/100)*$prozent_technik2); +$technick2[starke]=$technick2[starke]+(($technick2[starke]/100)*$prozent_technik2); +$speeds_char2 = ($k_speed[1] + $technick2[speed]); +$speeds_char2_4 = ($k_speed[1] + $technick2[speed]) / 1.5; +if($speeds_char2_4 < 1) { $speeds_char2_4 = 1; } +$speed_char2 = mt_rand($speeds_char2_4,$speeds_char2); + + +} else { +$k_mp[0] = $k_mp[0] - $technick1[mp]; +$schaden_2 = "Techniktausch Fehlgeschlagen"; +$aktion_AV2[$x] = "nein"; +} + +} diff --git a/cronjob/kampf/turnier_kampf.php b/cronjob/kampf/turnier_kampf.php new file mode 100644 index 0000000..cf651eb --- /dev/null +++ b/cronjob/kampf/turnier_kampf.php @@ -0,0 +1,193 @@ + $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) { + +$technick1 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10")); +$prozent_technik1 = (20*$technick1[aktiv])-20; +$technick1 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10")); + +$technick2 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10")); +$prozent_technik2 = (20*$technick2[aktiv])-20; +$technick2 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10")); + + +///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte +include "kampf/andere_technik.php"; /////////////////// Wenn man ne andere technik sich aussuchen will... + + +$technick1[speed]=$technick1[speed]+(($technick1[speed]/100)*$prozent_technik1); +$technick2[speed]=$technick2[speed]+(($technick2[speed]/100)*$prozent_technik2); + +$technick1[verteidigung]=$technick1[verteidigung]+(($technick1[verteidigung]/100)*$prozent_technik1); +$technick2[verteidigung]=$technick2[verteidigung]+(($technick2[verteidigung]/100)*$prozent_technik2); + +$technick1[starke]=$technick1[starke]+(($technick1[starke]/100)*$prozent_technik1); +$technick2[starke]=$technick2[starke]+(($technick2[starke]/100)*$prozent_technik2); + + + +$speeds_char1 = ($k_speed[0] + $technick1[speed]); +$speeds_char2 = ($k_speed[1] + $technick2[speed]); + +$speeds_char1_4 = ($k_speed[0] + $technick1[speed]) / 1.5; +$speeds_char2_4 = ($k_speed[1] + $technick2[speed]) / 1.5; + +if($speeds_char1_4 < 1) { $speeds_char1_4 = 1; } +if($speeds_char2_4 < 1) { $speeds_char2_4 = 1; } + +$speed_char1 = $speeds_char1; +$speed_char2 = $speeds_char2; + + +$aussetzten_runde = ""; ////// MUSS SO BLEIBEN WICHTIG +##################################MP, SSJ Verwandlungen, HP, Koerper Tausch Technicken +include "kampf/majin.php"; + + +if(!$aussetzten_runde) { +include "kampf/atk_wert.php"; +include "kampf/tausch2.php"; //////////////////Muss ganz oben sein wegen technik Tauschen +include "kampf/frucht.php"; +include "kampf/runde.php"; +include "kampf/mp.php"; +include "kampf/hp.php"; +include "kampf/hp2.php"; +include "kampf/SSJ.php"; +include "kampf/kaioken.php"; +include "kampf/kaioken2.php"; +include "kampf/copy.php"; +include "kampf/lose.php"; +include "kampf/lose2.php"; +include "kampf/ausdauer.php"; +include "kampf/mpv.php"; +include "kampf/tausch.php"; +include "kampf/hpmp.php"; +} +include "kampf/atk_wert.php"; +#####################################KAMPF SYSTEM +include "kampf/kampf_rechnung.php"; + + + +$db_query = mysql_fetch_array(mysql_query("SELECT * FROM turnier_kampf WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1")); + +mysql_query("UPDATE turnier_kampf SET hp1='$db_query[hp1],$k_hp7[0]', hp2='$db_query[hp2],$k_hp7[1]', mp1='$db_query[mp1],$k_mp7[0]', mp2='$db_query[mp2],$k_mp7[1]', schaden1='$db_query[schaden1],$schaden_1', schaden2='$db_query[schaden2],$schaden_2', attacke1='$db_query[attacke1],$technick1[name]', attacke2='$db_query[attacke2],$technick2[name]', starke1='$db_query[starke1],$k_starke[0]', starke2='$db_query[starke2],$k_starke[1]', ver1='$db_query[ver1],$k_ver[0]', ver2='$db_query[ver2],$k_ver[1]', speed1='$db_query[speed1],$k_speed[0]', speed2='$db_query[speed2],$k_speed[1]', ausdauer1='$db_query[ausdauer1],$k_ausdauer[0]', ausdauer2='$db_query[ausdauer2],$k_ausdauer[1]' WHERE id='$db_query[id]'"); + + +$x++; +} +###########################EXP VERTEILUNG +$s=0; +while($s < 2) { + +if($s == 1) { + +if($k_hp[0] > $k_hp[1]) { $X13 = HALLO; } else { $X23 = HALLO; } +} + +if($k_hp[1] < $k_aufgabe[1] OR $X13 == "HALLO") { +$k_exp[1] = (($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 4)) / 2) * 5; + +$k_geld[1] = (($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 6)) / 2) * 2; + +$k_exp[0] = ($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 4)) * 5; + +$k_geld[0] = ($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 6)) * 2; + +$sieger = $chara_1[id]; +$verlierer = $chara_2[id]; + +} + +if($k_hp[0] < $k_aufgabe[0] OR $X23 == "HALLO") { + +$sieger = $chara_2[id]; +$verlierer = $chara_1[id]; + + +$k_exp[1] = ($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 4)) * 5; + +$k_geld[1] = ($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 6)) * 2; + +$k_exp[0] = (($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 4)) / 2) * 5; + +$k_geld[0] = (($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 6)) / 2) * 2; + +} + +if($k_exp[0]) { $s=2; } else { $s++; } + +} + + +$dauer_Z = time(); +mysql_query("UPDATE turnier_kampf SET art='$art_1', round='$round', exp1='$k_exp[0]', win='$sieger', lose='$verlierer', exp2='$k_exp[1]', geld1='$k_geld[0]', geld2='$k_geld[1]', dauer='$dauer_Z' WHERE id='$db_query[id]'"); + + +?> \ No newline at end of file diff --git a/cronjob/kampf/wanted_kampf.php b/cronjob/kampf/wanted_kampf.php new file mode 100644 index 0000000..de87f81 --- /dev/null +++ b/cronjob/kampf/wanted_kampf.php @@ -0,0 +1,207 @@ + $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) { + +$technick1 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10")); +$prozent_technik1 = (20*$technick1[aktiv])-20; +$technick1 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10")); + +$technick2 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10")); +$prozent_technik2 = (20*$technick2[aktiv])-20; +$technick2 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10")); + + +///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte +include "kampf/andere_technik.php"; /////////////////// Wenn man ne andere technik sich aussuchen will... + + +$technick1[speed]=$technick1[speed]+(($technick1[speed]/100)*$prozent_technik1); +$technick2[speed]=$technick2[speed]+(($technick2[speed]/100)*$prozent_technik2); + +$technick1[verteidigung]=$technick1[verteidigung]+(($technick1[verteidigung]/100)*$prozent_technik1); +$technick2[verteidigung]=$technick2[verteidigung]+(($technick2[verteidigung]/100)*$prozent_technik2); + +$technick1[starke]=$technick1[starke]+(($technick1[starke]/100)*$prozent_technik1); +$technick2[starke]=$technick2[starke]+(($technick2[starke]/100)*$prozent_technik2); + + + +$speeds_char1 = ($k_speed[0] + $technick1[speed]); +$speeds_char2 = ($k_speed[1] + $technick2[speed]); + +$speeds_char1_4 = ($k_speed[0] + $technick1[speed]) / 1.5; +$speeds_char2_4 = ($k_speed[1] + $technick2[speed]) / 1.5; + +if($speeds_char1_4 < 1) { $speeds_char1_4 = 1; } +if($speeds_char2_4 < 1) { $speeds_char2_4 = 1; } + +$speed_char1 = $speeds_char1; +$speed_char2 = $speeds_char2; + + +$aussetzten_runde = ""; ////// MUSS SO BLEIBEN WICHTIG +##################################MP, SSJ Verwandlungen, HP, Koerper Tausch Technicken +include "kampf/majin.php"; + +if(!$aussetzten_runde) { +include "kampf/atk_wert.php"; +include "kampf/tausch2.php"; //////////////////Muss ganz oben sein wegen technik Tauschen +include "kampf/frucht.php"; +include "kampf/runde.php"; +include "kampf/mp.php"; +include "kampf/hp.php"; +include "kampf/hp2.php"; +include "kampf/SSJ.php"; +include "kampf/kaioken.php"; +include "kampf/kaioken2.php"; +include "kampf/copy.php"; +include "kampf/lose.php"; +include "kampf/lose2.php"; +include "kampf/ausdauer.php"; +include "kampf/mpv.php"; +include "kampf/tausch.php"; +include "kampf/hpmp.php"; +} +include "kampf/atk_wert.php"; +#####################################KAMPF SYSTEM +include "kampf/kampf_rechnung.php"; + + + +$db_query = mysql_fetch_array(mysql_query("SELECT * FROM wanted_kampf WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1")); + +mysql_query("UPDATE wanted_kampf SET hp1='$db_query[hp1],$k_hp7[0]', hp2='$db_query[hp2],$k_hp7[1]', mp1='$db_query[mp1],$k_mp7[0]', mp2='$db_query[mp2],$k_mp7[1]', schaden1='$db_query[schaden1],$schaden_1', schaden2='$db_query[schaden2],$schaden_2', attacke1='$db_query[attacke1],$technick1[name]', attacke2='$db_query[attacke2],$technick2[name]', starke1='$db_query[starke1],$k_starke[0]', starke2='$db_query[starke2],$k_starke[1]', ver1='$db_query[ver1],$k_ver[0]', ver2='$db_query[ver2],$k_ver[1]', speed1='$db_query[speed1],$k_speed[0]', speed2='$db_query[speed2],$k_speed[1]', ausdauer1='$db_query[ausdauer1],$k_ausdauer[0]', ausdauer2='$db_query[ausdauer2],$k_ausdauer[1]' WHERE id='$db_query[id]'"); + + +$x++; +} +###########################EXP VERTEILUNG +$s=0; +while($s < 2) { + +if($s == 1) { + +if($k_hp[0] > $k_hp[1]) { $X13 = HALLO; } else { $X23 = HALLO; } +} + +if($k_hp[1] < $k_aufgabe[1] OR $X13 == "HALLO") { +$k_exp[1] = 0; +$k_geld[1] = 0; +$k_exp[0] = 0; +$k_geld[0] = 0; + +$new_dead_list1 = "$chara_1[dead_list],$chara_2[name]"; +$new_dead_list2 = ""; + +$new_preis1 = $chara_1[preis] + (($chara_2[preis] / 100) * 10); +$new_preis2 = $chara_2[preis] - (($chara_2[preis] / 100) * 10); + +$sieger = $chara_1[id]; +$verlierer = $chara_2[id]; + +} + +if($k_hp[0] < $k_aufgabe[0] OR $X23 == "HALLO") { + +$new_dead_list2 = "$chara_2[dead_list],$chara_1[name]"; +$new_dead_list1 = ""; + +$new_preis2 = $chara_2[preis] + (($chara_1[preis] / 100) * 10); +$new_preis1 = $chara_1[preis] - (($chara_1[preis] / 100) * 10); + +$sieger = $chara_2[id]; +$verlierer = $chara_1[id]; + + +$k_exp[1] = 0; +$k_geld[1] = 0; +$k_exp[0] = 0; +$k_geld[0] = 0; + + +} + +if($k_exp[0]) { $s=2; } else { $s++; } + +} + + +$dauer_Z = time(); + + + +mysql_query("UPDATE chars SET preis='$new_preis1', dead_list='$new_dead_list1' WHERE id='$chara_1[id]' LIMIT 1"); +mysql_query("UPDATE chars SET preis='$new_preis2', dead_list='$new_dead_list2' WHERE id='$chara_2[id]' LIMIT 1"); + +mysql_query("UPDATE wanted_kampf SET exp1='$k_exp[0]', win='$sieger', lose='$verlierer', exp2='$k_exp[1]', geld1='$k_geld[0]', geld2='$k_geld[1]', dauer='$dauer_Z' WHERE id='$db_query[id]'"); + + +?> \ No newline at end of file diff --git a/cronjob/kampf_clan.php b/cronjob/kampf_clan.php new file mode 100644 index 0000000..31450ce --- /dev/null +++ b/cronjob/kampf_clan.php @@ -0,0 +1,183 @@ +Bug 1'; + exit; +} +################## Kaempfer 1 +$char1_quis_item = explode(",", $chara_1[kampf_item]); +$char1_item_helm = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[0]' LIMIT 1")); +$char1_item_rustung = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[1]' LIMIT 1")); +$char1_item_schild = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[2]' LIMIT 1")); +$char1_item_schwert = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[3]' LIMIT 1")); +$char1_item_schuhe = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char1_quis_item[4]' LIMIT 1")); + +$k_hp1 = explode(",", $chara_1[hp]); +$k_mp1 = explode(",", $chara_1[mp]); + +$k_starke[0] = $chara_1[starke] + $char1_item_helm[starke] + $char1_item_rustung[starke] + $char1_item_schild[starke] + $char1_item_schwert[starke] + $char1_item_schuhe[starke]; +$k_speed[0] = $chara_1[speed] + $char1_item_helm[speed] + $char1_item_rustung[speed] + $char1_item_schild[speed] + $char1_item_schwert[speed] + $char1_item_schuhe[speed]; +$k_ver[0] = $chara_1[verteidigung] + $char1_item_helm[verteidigung] + $char1_item_rustung[verteidigung] + $char1_item_schild[verteidigung] + $char1_item_schwert[verteidigung] + $char1_item_schuhe[verteidigung]; +$k_hp1[0] += $char1_item_helm[hp] + $char1_item_rustung[hp] + $char1_item_schild[hp] + $char1_item_schwert[hp] + $char1_item_schuhe[hp]; +$k_hp1[1] += $char1_item_helm[hp] + $char1_item_rustung[hp] + $char1_item_schild[hp] + $char1_item_schwert[hp] + $char1_item_schuhe[hp]; +$k_mp1[0] += $char1_item_helm[mp] + $char1_item_rustung[mp] + $char1_item_schild[mp] + $char1_item_schwert[mp] + $char1_item_schuhe[mp]; +$k_mp1[1] += $char1_item_helm[mp] + $char1_item_rustung[mp] + $char1_item_schild[mp] + $char1_item_schwert[mp] + $char1_item_schuhe[mp]; + +$k_ausdauer[0] = $chara_1[ausdauer]; +$k_glueck[0] = $chara_1[glueck]; + +$k_attacke1 = explode(",", $chara_1[attacken]); +$k_select1_1 = explode(",", $chara_1[auswahl1]); +$k_select1_2 = explode(",", $chara_1[auswahl2]); +$k_select1_3 = explode(",", $chara_1[auswahl3]); +$k_attacke1_2 = explode(",", $chara_1[attacken2]); + +$k_hp[0] = round($k_hp1[0]); +$k_mp[0] = round($k_mp1[0]); + +$k_aufgabe_a_1 = $k_hp1[1] / 100; +$k_aufgabe[0] = $k_aufgabe_a_1 * $chara_1[aufgeben]; + +################## Kaempfer 2 +$char2_quis_item = explode(",", $chara_2[kampf_item]); +$char2_item_helm = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[0]' LIMIT 1")); +$char2_item_rustung = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[1]' LIMIT 1")); +$char2_item_schild = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[2]' LIMIT 1")); +$char2_item_schwert = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[3]' LIMIT 1")); +$char2_item_schuhe = mysql_Fetch_Array(mysql_query("SELECT i.hp, i.mp, i.starke, i.verteidigung, i.speed FROM ware w LEFT JOIN item i ON(i.id=w.item_id) WHERE w.id='$char2_quis_item[4]' LIMIT 1")); + +$k_hp2 = explode(",", $chara_2[hp]); +$k_mp2 = explode(",", $chara_2[mp]); + +$k_starke[1] = $chara_2[starke] + $char2_item_helm[starke] + $char2_item_rustung[starke] + $char2_item_schild[starke] + $char2_item_schwert[starke] + $char2_item_schuhe[starke]; +$k_speed[1] = $chara_2[speed] + $char2_item_helm[speed] + $char2_item_rustung[speed] + $char2_item_schild[speed] + $char2_item_schwert[speed] + $char2_item_schuhe[speed]; +$k_ver[1] = $chara_2[verteidigung] + $char2_item_helm[verteidigung] + $char2_item_rustung[verteidigung] + $char2_item_schild[verteidigung] + $char2_item_schwert[verteidigung] + $char2_item_schuhe[verteidigung]; +$k_hp2[0] += $char2_item_helm[hp] + $char2_item_rustung[hp] + $char2_item_schild[hp] + $char2_item_schwert[hp] + $char2_item_schuhe[hp]; +$k_hp2[1] += $char2_item_helm[hp] + $char2_item_rustung[hp] + $char2_item_schild[hp] + $char2_item_schwert[hp] + $char2_item_schuhe[hp]; +$k_mp2[0] += $char2_item_helm[mp] + $char2_item_rustung[mp] + $char2_item_schild[mp] + $char2_item_schwert[mp] + $char2_item_schuhe[mp]; +$k_mp2[1] += $char2_item_helm[mp] + $char2_item_rustung[mp] + $char2_item_schild[mp] + $char2_item_schwert[mp] + $char2_item_schuhe[mp]; + +$k_ausdauer[1] = $chara_2[ausdauer]; +$k_glueck[1] = $chara_2[glueck]; + +$k_attacke2 = explode(",", $chara_2[attacken]); +$k_select2_1 = explode(",", $chara_2[auswahl1]); +$k_select2_2 = explode(",", $chara_2[auswahl2]); +$k_select2_3 = explode(",", $chara_2[auswahl3]); +$k_attacke2_2 = explode(",", $chara_2[attacken2]); + +$k_hp[1] = round($k_hp2[0]); +$k_mp[1] = round($k_mp2[0]); + +$k_aufgabe_a_2 = $k_hp2[1] / 100; +$k_aufgabe[1] = $k_aufgabe_a_2 * $chara_2[aufgeben]; + +$runden_type1 = 0; +$runden_type2 = 0; +$x = 0; + +$runden_summon1 = ""; +$runden_summon2 = ""; +$runden_gif1 = 0; +$runden_gif_technik1 = ""; +$runden_gif2 = 0; +$runden_gif_technik2 = ""; + +if ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) { + $sql = "INSERT clan_fights SET hp1='$k_hp[0]', hp2='$k_hp[1]', mp1='$k_mp[0]', mp2='$k_mp[1]', schaden1='$schaden_1', schaden2='$schaden_2', attacke1='$technick1[name]', attacke2='$technick2[name]', char1='$chara_1[id]', char2='$chara_2[id]', starke1='$k_starke[0]', starke2='$k_starke[1]', ver1='$k_ver[0]', ver2='$k_ver[1]', speed1='$k_speed[0]', speed2='$k_speed[1]', ausdauer1='$k_ausdauer[0]', ausdauer2='$k_ausdauer[1]', clanfight_id='$clanfight_id', runde='$runde', kampf='$kampf'"; + mysql_query($sql); +// echo $sql . '
'; + if (mysql_affected_rows() == 0) { + echo '"' . $sql . '" konnte nicht ausgefürt werden!
'; + } +} else { + echo "Unbekannter B.U.G"; + echo '
Bug 2'; + #displayErrorMessage(NULL, 'Unbekannter B.U.G!', displayHistoryBackLink()); + exit; +} + +while ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) { + + $technick1 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10")); + $prozent_technik1 = (20 * $technick1[aktiv]) - 20; + $technick1 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10")); + + $technick2 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10")); + $prozent_technik2 = (20 * $technick2[aktiv]) - 20; + $technick2 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10")); + + ///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte + include "kampf/andere_technik.php"; /////////////////// Wenn man ne andere technik sich aussuchen will... + + $technick1[speed] = $technick1[speed] + (($technick1[speed] / 100) * $prozent_technik1); + $technick2[speed] = $technick2[speed] + (($technick2[speed] / 100) * $prozent_technik2); + + $technick1[verteidigung] = $technick1[verteidigung] + (($technick1[verteidigung] / 100) * $prozent_technik1); + $technick2[verteidigung] = $technick2[verteidigung] + (($technick2[verteidigung] / 100) * $prozent_technik2); + + $technick1[starke] = $technick1[starke] + (($technick1[starke] / 100) * $prozent_technik1); + $technick2[starke] = $technick2[starke] + (($technick2[starke] / 100) * $prozent_technik2); + + $speed_char1 = ($k_speed[0] + $technick1[speed]); + $speed_char2 = ($k_speed[1] + $technick2[speed]); + + // Speedbug + // $speeds_char1_4 = ($k_speed[0] + $technick1[speed]) / 1.5; + // $speeds_char2_4 = ($k_speed[1] + $technick2[speed]) / 1.5; + // + // if ($speeds_char1_4 < 1) { + // $speeds_char1_4 = 1; + // } + // if ($speeds_char2_4 < 1) { + // $speeds_char2_4 = 1; + // } + // + // $speed_char1 = mt_rand($speeds_char1_4, $speeds_char1); + // $speed_char2 = mt_rand($speeds_char2_4, $speeds_char2); + + ///////rechnung selber + include "kampf_include.php"; + + #####################################KAMPF SYSTEM + include "kampf/kampf_rechnung.php"; + + #$db_query = mysql_fetch_array(mysql_query("SELECT * FROM clan_fights WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1")); + $db_query = mysql_fetch_array(mysql_query("SELECT * FROM clan_fights WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') order by id DESC LIMIT 1")); + + mysql_query("UPDATE clan_fights SET hp1='$db_query[hp1],$k_hp7[0]', hp2='$db_query[hp2],$k_hp7[1]', mp1='$db_query[mp1],$k_mp7[0]', mp2='$db_query[mp2],$k_mp7[1]', schaden1='$db_query[schaden1],$schaden_1', schaden2='$db_query[schaden2],$schaden_2', attacke1='$db_query[attacke1],$technick1[name]', attacke2='$db_query[attacke2],$technick2[name]', starke1='$db_query[starke1],$k_starke[0]', starke2='$db_query[starke2],$k_starke[1]', ver1='$db_query[ver1],$k_ver[0]', ver2='$db_query[ver2],$k_ver[1]', speed1='$db_query[speed1],$k_speed[0]', speed2='$db_query[speed2],$k_speed[1]', ausdauer1='$db_query[ausdauer1],$k_ausdauer[0]', ausdauer2='$db_query[ausdauer2],$k_ausdauer[1]' WHERE id='$db_query[id]'"); + + $x++; +} + +if ($k_hp[0] <= 0 AND $k_hp[1] <= 0) { + if ($k_hp[0] > $k_hp[1]) { + $k_hp[0] = $k_hp1[1]; + } else { + $k_hp[1] = $k_hp2[1]; + } +} + +if ($k_hp[1] < $k_aufgabe[1] OR $k_hp[1] < $k_hp[0]) { + $sieger = $chara_1['id']; + $verlierer = $chara_2['id']; +} + +if ($k_hp[0] < $k_aufgabe[0] OR $k_hp[0] < $k_hp[1]) { + $sieger = $chara_2['id']; + $verlierer = $chara_1['id']; +} + +mysql_query("UPDATE clan_fights SET win='$sieger', lose='$verlierer' WHERE id='$db_query[id]'"); + +?> \ No newline at end of file diff --git a/cronjob/kampf_clan1.php b/cronjob/kampf_clan1.php new file mode 100644 index 0000000..d3a33e7 --- /dev/null +++ b/cronjob/kampf_clan1.php @@ -0,0 +1,199 @@ + $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) { + $sql = "INSERT clan_fights SET hp1='$k_hp[0]', hp2='$k_hp[1]', mp1='$k_mp[0]', mp2='$k_mp[1]', schaden1='$schaden_1', schaden2='$schaden_2', attacke1='$technick1[name]', attacke2='$technick2[name]', char1='$chara_1[id]', char2='$chara_2[id]', starke1='$k_starke[0]', starke2='$k_starke[1]', ver1='$k_ver[0]', ver2='$k_ver[1]', speed1='$k_speed[0]', speed2='$k_speed[1]', ausdauer1='$k_ausdauer[0]', ausdauer2='$k_ausdauer[1]', clanfight_id='$clanfight_id', runde='$runde', kampf='$kampf'"; + mysql_query($sql); +// echo $sql . '
'; + if (mysql_affected_rows() == 0) { + echo '"' . $sql . '" konnte nicht ausgefürt werden!
'; + } +} else { + displayErrorMessage(NULL, 'Unbekannter B.U.G!', displayHistoryBackLink()); + exit; +} + +while ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) { + + $technick1 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10")); + $prozent_technik1 = (20 * $technick1[aktiv]) - 20; + $technick1 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10")); + + $technick2 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10")); + $prozent_technik2 = (20 * $technick2[aktiv]) - 20; + $technick2 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10")); + + ///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte + include "kampf/andere_technik.php"; /////////////////// Wenn man ne andere technik sich aussuchen will... + #include ($_SERVER['DOCUMENT_ROOT'] . '/ag/include/kampf/andere_technik.php'); /////////////////// Wenn man ne andere technik sich aussuchen will... + + $technick1[speed] = $technick1[speed] + (($technick1[speed] / 100) * $prozent_technik1); + $technick2[speed] = $technick2[speed] + (($technick2[speed] / 100) * $prozent_technik2); + + $technick1[verteidigung] = $technick1[verteidigung] + (($technick1[verteidigung] / 100) * $prozent_technik1); + $technick2[verteidigung] = $technick2[verteidigung] + (($technick2[verteidigung] / 100) * $prozent_technik2); + + $technick1[starke] = $technick1[starke] + (($technick1[starke] / 100) * $prozent_technik1); + $technick2[starke] = $technick2[starke] + (($technick2[starke] / 100) * $prozent_technik2); + + $speed_char1 = ($k_speed[0] + $technick1[speed]); + $speed_char2 = ($k_speed[1] + $technick2[speed]); + + // Speedbug + // $speeds_char1_4 = ($k_speed[0] + $technick1[speed]) / 1.5; + // $speeds_char2_4 = ($k_speed[1] + $technick2[speed]) / 1.5; + // + // if ($speeds_char1_4 < 1) { + // $speeds_char1_4 = 1; + // } + // if ($speeds_char2_4 < 1) { + // $speeds_char2_4 = 1; + // } + // + // $speed_char1 = mt_rand($speeds_char1_4, $speeds_char1); + // $speed_char2 = mt_rand($speeds_char2_4, $speeds_char2); + + ///////rechnung selber + include "kampf_include.php"; + + #####################################KAMPF SYSTEM + include "kampf/kampf_rechnung.php"; + + #$db_query = mysql_fetch_array(mysql_query("SELECT * FROM clan_fights WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1")); + $db_query = mysql_fetch_array(mysql_query("SELECT * FROM clan_fights WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') order by id DESC LIMIT 1")); + + mysql_query("UPDATE clan_fights SET hp1='$db_query[hp1],$k_hp7[0]', hp2='$db_query[hp2],$k_hp7[1]', mp1='$db_query[mp1],$k_mp7[0]', mp2='$db_query[mp2],$k_mp7[1]', schaden1='$db_query[schaden1],$schaden_1', schaden2='$db_query[schaden2],$schaden_2', attacke1='$db_query[attacke1],$technick1[name]', attacke2='$db_query[attacke2],$technick2[name]', starke1='$db_query[starke1],$k_starke[0]', starke2='$db_query[starke2],$k_starke[1]', ver1='$db_query[ver1],$k_ver[0]', ver2='$db_query[ver2],$k_ver[1]', speed1='$db_query[speed1],$k_speed[0]', speed2='$db_query[speed2],$k_speed[1]', ausdauer1='$db_query[ausdauer1],$k_ausdauer[0]', ausdauer2='$db_query[ausdauer2],$k_ausdauer[1]' WHERE id='$db_query[id]'"); + + $x++; +} + +if ($k_hp[0] <= 0 AND $k_hp[1] <= 0) { + if ($k_hp[0] > $k_hp[1]) { + $k_hp[0] = $k_hp1[1]; + } else { + $k_hp[1] = $k_hp2[1]; + } +} + +if ($k_hp[1] < $k_aufgabe[1] OR $k_hp[1] < $k_hp[0] OR $k_hp[1] == $k_hp[0]) { + $hp1_new= $k_hp[0].','.$k_hp1[1]; + $mp1_new= $k_mp[0].','.$k_mp1[1]; + $fighter_team_a_array[$fighter_a][hp]= $hp1_new; + $fighter_team_a_array[$fighter_a][mp]= $mp1_new; + $sieger = $chara_1['id']; + $verlierer = $chara_2['id']; +} + +if ($k_hp[0] < $k_aufgabe[0] OR $k_hp[0] < $k_hp[1]) { + $hp2_new= $k_hp[1].','.$k_hp2[1]; + $mp2_new= $k_mp[1].','.$k_mp2[1]; + $fighter_team_b_array[$fighter_b][hp]= $hp2_new; + $fighter_team_b_array[$fighter_b][mp]= $mp2_new; + $sieger = $chara_2['id']; + $verlierer = $chara_1['id']; +} + +mysql_query("UPDATE clan_fights SET win='$sieger', lose='$verlierer' WHERE id='$db_query[id]'"); + +?> \ No newline at end of file diff --git a/cronjob/kampf_include.php b/cronjob/kampf_include.php new file mode 100644 index 0000000..e14df9a --- /dev/null +++ b/cronjob/kampf_include.php @@ -0,0 +1,41 @@ + \ No newline at end of file diff --git a/cronjob/klein_Turnier2.php b/cronjob/klein_Turnier2.php new file mode 100644 index 0000000..ab9da46 --- /dev/null +++ b/cronjob/klein_Turnier2.php @@ -0,0 +1,130 @@ += 2) { + // remove all chars that are registered + mysql_query('delete from turnier1 where art = \'klein\' and besitzer = '.$win_user['besitzer']); +} + +$sql5 = 'Select count(win), win from turnier_kampf where art = \'klein\' 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); + + +$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'].')'; + +echo $sql.'
'; +$qry = mysql_query($sql); + +while($row = mysql_fetch_assoc($qry)){ + switch($row['id']){ + case $rang1['win']: + mysql_query('UPDATE user set pkt = pkt + 25 WHERE id = '.$row['userid']); + insertUserTickerMessage($row['userid'], '25 IP von Anfänger Turnier Sieg erhalten!'); + break; + case $rang2['win']: + mysql_query('UPDATE user set pkt = pkt + 20 WHERE id = '.$row['userid']); + insertUserTickerMessage($row['userid'], '20 IP von Anfänger Turnier 2.Platz erhalten!'); + break; + case $rang3['win']: + case $rang4['win']: + mysql_query('UPDATE user set pkt = pkt + 15 WHERE id = '.$row['userid']); + insertUserTickerMessage($row['userid'], '15 IP von Anfänger Turnier 3. oder 4. Platz erhalten!'); + break; + default: + break; + } +} +?> \ No newline at end of file diff --git a/cronjob/klein_turnier.php b/cronjob/klein_turnier.php new file mode 100644 index 0000000..9331bab --- /dev/null +++ b/cronjob/klein_turnier.php @@ -0,0 +1,127 @@ +=0; $i--) + { + if($i>0) $zufall=mt_rand(0,$i); + else $zufall=0; + $temp=$array[$i]; + $array[$i]=$array[$zufall]; + $array[$zufall]=$temp; + $newarray[]=$array[$i]; + array_pop($array); + } + return $newarray; +} + +include "db.php"; + +$max_charakter = mysql_num_rows(mysql_query("SELECT id FROM chars WHERE level<='25' and fusion='nein' AND char_type = '' LIMIT 32")); + +if($max_charakter<32) { +exit; +} +mysql_query("DELETE FROM turnier_kampf WHERE art='$art_1'"); + + + +$char1 = mysql_query("SELECT charakter FROM turnier1 WHERE art='$art_1'"); +while($row=mysql_fetch_array($char1)) +{ + $test2[]=$row['charakter']; +} + +do +{ + + if(count($test2)<32) + { // WHERE status='Frei' + list($count) = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM chars WHERE level<='25' and fusion='nein' AND char_type = '' ")); + + if(($count+count($test2))>=32) + { + $result = mysql_query("SELECT id FROM chars WHERE level<='25' AND char_type = '' and fusion='nein' ORDER BY RAND() LIMIT ".(32-count($test2))); + while($char_name2=mysql_fetch_array($result)) + { + $test2[]=$char_name2['id']; + } + } + } + $test2 = rand_array($test2); + $test2 = array_unique($test2); +} + + +while(count($test2)<32); + +$test3=$test2; +reset($test3); +while(current($test3)!=end($test2)) +{ + if(empty($list)) $list=current($test3); + else $list.=','.next($test3); +} + +$result=mysql_query("SELECT * FROM chars WHERE id IN(".$list.") LIMIT 32"); +while($row=mysql_fetch_array($result)) +{ + + $charas[$row['id']]=$row; +} + +$a8=0; +$b8=1; + +$round = 1; +while($a8 < 32) +{ + $chara_1 = $charas[$test2[$a8]]; + $chara_2 = $charas[$test2[$b8]]; + include "turnier_kampf.php"; + $a8+=2; + $b8+=2; +} + + + +while($round < 5) +{ + unset($test9); + + + $chars_win = mysql_Query("SELECT win FROM turnier_kampf WHERE round='$round' AND art='$art_1'"); + while($row9 = mysql_fetch_array($chars_win)) + { + $test9[]=$row9['win']; + } + $round++; + $k9=0; + $l9=1; + while($k9 < count($test9)) + { + $chara_1 = $charas[$test9[$k9]]; + $chara_2 = $charas[$test9[$l9]]; + include "turnier_kampf.php"; + $k9+=2; + $l9+=2; + } + + + + +} + +mysql_query("DELETE FROM turnier1 WHERE art='$art_1'"); +?> \ No newline at end of file diff --git a/cronjob/liga.php b/cronjob/liga.php new file mode 100644 index 0000000..1286432 --- /dev/null +++ b/cronjob/liga.php @@ -0,0 +1,38 @@ + \ No newline at end of file diff --git a/cronjob/liga1.php b/cronjob/liga1.php new file mode 100644 index 0000000..5927803 --- /dev/null +++ b/cronjob/liga1.php @@ -0,0 +1,81 @@ +=0; $i--) + { + if($i>0) $zufall=mt_rand(0,$i); + else $zufall=0; + $temp=$array[$i]; + $array[$i]=$array[$zufall]; + $array[$zufall]=$temp; + $newarray[]=$array[$i]; + array_pop($array); + } + return $newarray; +} + +include "db.php"; +$max_charakter = mysql_num_rows(mysql_query("SELECT id FROM chars WHERE rasse!='NPC' LIMIT 250")); + +if($max_charakter<250) { +exit; +} + +$charakter = mysql_query("SELECT name, id FROM chars WHERE rasse!='NPC' ORDER BY level DESC LIMIT $max_charakter"); + + + +while($row=mysql_fetch_array($charakter)) +{ + $test2[]=$row['id']; +} + + + $test2 = rand_array($test2); + $test2 = array_unique($test2); + +while(count($test2)<$max_charakter); + +$test3=$test2; +reset($test3); +while(current($test3)!=end($test2)) +{ + if(empty($list)) $list=current($test3); + else $list.=','.next($test3); +} + + +$result=mysql_query("SELECT * FROM chars WHERE id IN(".$list.") LIMIT 250"); +while($row=mysql_fetch_array($result)) +{ + + $charas[$row['id']]=$row; +} + + +$a8=0; +$b8=1; + +$round = 1; +while($a8 < $max_charakter) +{ + $chara_1 = $charas[$test2[$a8]]; + $chara_2 = $charas[$test2[$b8]]; + include "liga_kampf.php"; + $a8+=2; + $b8+=2; +} + + + + +?> \ No newline at end of file diff --git a/cronjob/liga_kampf.php b/cronjob/liga_kampf.php new file mode 100644 index 0000000..56e9053 --- /dev/null +++ b/cronjob/liga_kampf.php @@ -0,0 +1,184 @@ + $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) { + +$technick1 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10")); +$prozent_technik1 = (20*$technick1[aktiv])-20; +$technick1 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10")); + +$technick2 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10")); +$prozent_technik2 = (20*$technick2[aktiv])-20; +$technick2 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10")); + + +///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte +include "kampf/andere_technik.php"; /////////////////// Wenn man ne andere technik sich aussuchen will... + + +$technick1[speed]=$technick1[speed]+(($technick1[speed]/100)*$prozent_technik1); +$technick2[speed]=$technick2[speed]+(($technick2[speed]/100)*$prozent_technik2); + +$technick1[verteidigung]=$technick1[verteidigung]+(($technick1[verteidigung]/100)*$prozent_technik1); +$technick2[verteidigung]=$technick2[verteidigung]+(($technick2[verteidigung]/100)*$prozent_technik2); + +$technick1[starke]=$technick1[starke]+(($technick1[starke]/100)*$prozent_technik1); +$technick2[starke]=$technick2[starke]+(($technick2[starke]/100)*$prozent_technik2); + + + +$speeds_char1 = ($k_speed[0] + $technick1[speed]); +$speeds_char2 = ($k_speed[1] + $technick2[speed]); + +$speeds_char1_4 = ($k_speed[0] + $technick1[speed]) / 1.5; +$speeds_char2_4 = ($k_speed[1] + $technick2[speed]) / 1.5; + +if($speeds_char1_4 < 1) { $speeds_char1_4 = 1; } +if($speeds_char2_4 < 1) { $speeds_char2_4 = 1; } + +$speed_char1 = mt_rand($speeds_char1_4,$speeds_char1); +$speed_char2 = mt_rand($speeds_char2_4,$speeds_char2); + + +///////rechnung selber +include "kampf_include.php"; + +#####################################KAMPF SYSTEM +include "kampf/kampf_rechnung.php"; + + + +$db_query = mysql_fetch_array(mysql_query("SELECT * FROM liga_kampf WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1")); + +mysql_query("UPDATE liga_kampf SET hp1='$db_query[hp1],$k_hp7[0]', hp2='$db_query[hp2],$k_hp7[1]', mp1='$db_query[mp1],$k_mp7[0]', mp2='$db_query[mp2],$k_mp7[1]', schaden1='$db_query[schaden1],$schaden_1', schaden2='$db_query[schaden2],$schaden_2', attacke1='$db_query[attacke1],$technick1[name]', attacke2='$db_query[attacke2],$technick2[name]', starke1='$db_query[starke1],$k_starke[0]', starke2='$db_query[starke2],$k_starke[1]', ver1='$db_query[ver1],$k_ver[0]', ver2='$db_query[ver2],$k_ver[1]', speed1='$db_query[speed1],$k_speed[0]', speed2='$db_query[speed2],$k_speed[1]', ausdauer1='$db_query[ausdauer1],$k_ausdauer[0]', ausdauer2='$db_query[ausdauer2],$k_ausdauer[1]', glueck1='$db_query[glueck1],$k_glueck[0]', glueck2='$db_query[glueck2],$k_glueck[1]' WHERE id='$db_query[id]'"); + + +$x++; +} +###########################EXP VERTEILUNG + +if($k_hp[0] <= 0 AND $k_hp[1] <= 0) { + + if($k_hp[0] > $k_hp[1]) { + $k_hp[0] = $k_hp1[1]; + } else { + $k_hp[1] = $k_hp2[1]; + } +} + +$s=0; +while($s < 2) { + +if($s == 1) { + +if($k_hp[0] > $k_hp[1]) { $X13 = HALLO; } else { $X23 = HALLO; } +} + +if($k_hp[1] < $k_aufgabe[1] OR $X13 == "HALLO") { +$k_exp[1] = 0; +$k_geld[1] = 0; +$k_exp[0] = 0; +$k_geld[0] = 0; + + + +$sieger = $chara_1[id]; +$verlierer = $chara_2[id]; + +} + +if($k_hp[0] < $k_aufgabe[0] OR $X23 == "HALLO") { + +$sieger = $chara_2[id]; +$verlierer = $chara_1[id]; + + +$k_exp[1] = 0; +$k_geld[1] = 0; +$k_exp[0] = 0; +$k_geld[0] = 0; + + +} + +if($k_exp[0]) { $s=2; } else { $s++; } + +} +$punkt_sieger = (11-$x) + 500; +$punkt_verlierer = 0; + +$dauer_Z = time(); + +mysql_query("UPDATE chars SET liga_siege=liga_siege+1, liga_punkte=liga_punkte+'$punkt_sieger' WHERE id='$sieger' LIMIT 1"); +mysql_query("UPDATE chars SET liga_niederlagen=liga_niederlagen+1, liga_punkte=liga_punkte+'$punkt_verlierer' WHERE id='$verlierer' LIMIT 1"); + +mysql_query("UPDATE liga_kampf SET exp1='$k_exp[0]', win='$sieger', lose='$verlierer', exp2='$k_exp[1]', geld1='$k_geld[0]', geld2='$k_geld[1]', dauer='$dauer_Z' WHERE id='$db_query[id]'"); + + +?> \ No newline at end of file diff --git a/cronjob/mumble.php b/cronjob/mumble.php new file mode 100644 index 0000000..ac1c29f --- /dev/null +++ b/cronjob/mumble.php @@ -0,0 +1,152 @@ + 0 and u.nickname is null and p.server_id = '.$serverid; +$qry = mysql_query($search_lost_players); + +while($row = mysql_fetch_assoc($qry)){ + $player[] = $row['user_id']; +} + +if(count($player) > 0){ + $delete_sql = 'DELETE FROM '.$mumbledb.'.users where user_id IN ('.join(',',$player).') and server_id = '.$serverid; +} +//echo $delete_sql.'
'; +// Verbinde die Clanchannels mit den Clans + +//$clan_channels_sql = 'SELECT distinct(clanname) as name from '.$mumbledb.'.channels c right join '.$ag_db.'.clan cl on c.name = cl.clanname where name is null'; +$clan_channels_sql = 'SELECT distinct(clanname) as name, count(u.clan) anzahl, name is not null as existance from '.$mumbledb.'.channels c right join '.$ag_db.'.clan cl on c.name = cl.clanname left join '.$ag_db.'.user u on cl.id = u.clan group by clanname'; + +$qry = mysql_query($clan_channels_sql); +$insert_clan_channels = 'INSERT INTO '.$mumbledb.'.channels(server_id, channel_id, parent_id, name, inheritacl) values'; +$insert_clan_groups = 'INSERT INTO '.$mumbledb.'.groups(group_id, server_id, name, channel_id, inherit, inheritable) values'; +$insert_acl = 'INSERT INTO '.$mumbledb.'.acl(server_id, channel_id, priority, group_name, apply_here, apply_sub, grantpriv, revokepriv) values'; + +$i=1; +while($row = mysql_fetch_assoc($qry)){ + $channelid = ($max_channel + $i); + $groupid = ($max_group + $i); + if($row['existance'] == 0 && $row['anzahl'] >= $min_member_count_create){ + echo $row['name'].' ist gross genug!
'; + if($i==1){ + $insert_clan_channels .= '('.$serverid.', '.$channelid.', '.$clan_chan.', \''.$row['name'].'\',1)'; + $insert_clan_groups .= '('.$groupid.', '.$serverid.', \'member\', '.$channelid.', 1, 1)'; + $insert_acl .= '('.$serverid.','.$channelid.',5,\'member\',1,1,510,0), ('.$serverid.','.$channelid.',6,\'member\',0,1,1,0)'; + } else{ + $insert_clan_channels .= ', ('.$serverid.', '.$channelid.', '.$clan_chan.', \''.$row['name'].'\',1)'; + $insert_clan_groups .= ', ('.$groupid.', '.$serverid.', \'member\', '.$channelid.', 1, 1)'; + $insert_acl .= ', ('.$serverid.','.$channelid.',5,\'member\',1,1,510,0), ('.$serverid.','.$channelid.',6,\'member\',0,1,1,0)'; + } + $i++; + } else if($row['existance'] == 1 && $row['anzahl'] <= $max_member_count_delete){ + mysql_query('DELETE FROM '.$mumbledb.'.channels WHERE parent_id = '.$clan_chan. ' and name = \''.$row['name'].'\' and server_id = '.$serverid); + } +} + +// Delete nonexistant Clan-Channels! +$search_lost_channels = 'select channel_id FROM '.$mumbledb.'.channels left join '.$ag_db.'.clan on name = clanname where clanname is null and parent_id = '.$clan_chan.' and server_id = '.$serverid; +$qry = mysql_query($search_lost_channels); + +while($row = mysql_fetch_assoc($qry)){ + $channels[] = $row['channel_id']; +} + +if(count($channels) > 0){ + $remove_clan_channel_sql = 'DELETE FROM '.$mumbledb.'.channels where channel_id IN ('.join(',',$channels).') and server_id = '.$serverid; +} + +//echo $remove_clan_channel_sql.'
'; + +$sql_user_select = 'Select p.user_id, ch.name as ch_name, ch2.name as ch2_name, ch.parent_id as ch_parent_id, ch2.parent_id as ch2_parent_id, g.group_id as g_group_id, g2.group_id as g2_group_id from + ( '.$ag_db.'.user u inner join '.$mumbledb.'.users p on + u.id = p.user_id + ) + left join '.$ag_db.'.clan cl on + u.clan = cl.id + left join '.$mumbledb.'.group_members gm on + gm.user_id = p.user_id and p.server_id = gm.server_id + left join '.$mumbledb.'.groups g on + g.group_id = gm.group_id and g.server_id = p.server_id + left join '.$mumbledb.'.channels ch on + ch.channel_id = g.channel_id and p.server_id = ch.server_id + left join '.$mumbledb.'.channels ch2 on + ch2.name = cl.clanname and p.server_id = ch2.server_id + left join '.$mumbledb.'.groups g2 on + g2.channel_id = ch2.channel_id and g2.server_id = p.server_id + + where not (ch.name is null && ch2.name is null) and (ch.name is null || ch.parent_id = 2) and (ch2.name is null || ch2.parent_id = 2) and (ch.name is null || ch2.name is null or ch.name != ch2.name) and p.server_id = '.$serverid; + + + +/** + * So nun die Ausfuehrung! + */ + + +mysql_query($rename_sql); +if(isset($delete_sql)){ + mysql_query($delete_sql); +} +if($i!=1){ +// echo $insert_clan_channels.'
'; + mysql_query($insert_clan_channels); + mysql_query($insert_clan_groups); + mysql_query($insert_acl); +} +// Entferne Channels von Clans die es nicht mehr gibt! +mysql_query($remove_clan_channel_sql); + +// Nun die User :) +$qry = mysql_query($sql_user_select); + +while($row = mysql_fetch_assoc($qry)){ + // Zu Gruppe hinzufuegen oder aus gruppe entfernen? + if($row['ch_name'] == NULL){ + // Hinzufuegen + $sql = 'INSERT INTO '.$mumbledb.'.group_members(group_id, server_id, user_id, addit) values('.$row['g2_group_id'].', '.$serverid.', '.$row['user_id'].',1)'; +// echo $sql.'
'; + mysql_query($sql); + } else if($row['ch2_name'] == NULL){ + // Entfernen + $sql = 'DELETE FROM '.$mumbledb.'.group_members where group_id = '.$row['g_group_id'].' and server_id = '.$serverid.' and user_id = '.$row['user_id']; +// echo $sql.'
'; + mysql_query($sql); + } +} + + +?> \ No newline at end of file diff --git a/cronjob/pruf_Turnier2.php b/cronjob/pruf_Turnier2.php new file mode 100644 index 0000000..e2d457b --- /dev/null +++ b/cronjob/pruf_Turnier2.php @@ -0,0 +1,52 @@ + \ No newline at end of file diff --git a/cronjob/pruf_turnier.php b/cronjob/pruf_turnier.php new file mode 100644 index 0000000..13c3747 --- /dev/null +++ b/cronjob/pruf_turnier.php @@ -0,0 +1,111 @@ +=0; $i--) + { + if($i>0) $zufall=mt_rand(0,$i); + else $zufall=0; + $temp=$array[$i]; + $array[$i]=$array[$zufall]; + $array[$zufall]=$temp; + $newarray[]=$array[$i]; + array_pop($array); + } + return $newarray; +} + +include "db.php"; + +$max_charakter = mysql_num_rows(mysql_query("SELECT id FROM n_turnier_reg LIMIT 16")); + +if($max_charakter<16) { +echo "Turnier kann nicht beginn."; +exit; +} + +mysql_query("DELETE FROM turnier_kampf WHERE art='$art_1'"); + + + +$char1 = mysql_query("SELECT charakter FROM n_turnier_reg ORDER BY id ASC LIMIT 16"); +while($row=mysql_fetch_array($char1)) +{ + $test2[]=$row['charakter']; +} + + $test2 = rand_array($test2); + + +$test3=$test2; +reset($test3); +while(current($test3)!=end($test2)) +{ + if(empty($list)) $list=current($test3); + else $list.=','.next($test3); +} + +$result=mysql_query("SELECT * FROM chars WHERE id IN(".$list.") LIMIT 16"); + +while($row=mysql_fetch_array($result)) +{ + $charas[$row['id']]=$row; +} + + + +$a8=0; +$b8=1; + +$round = 1; +while($a8 < 16) +{ + $chara_1 = $charas[$test2[$a8]]; + $chara_2 = $charas[$test2[$b8]]; + include "turnier_kampf.php"; + $a8+=2; + $b8+=2; +} + + + +while($round < 4) +{ + unset($test9); + + $chars_win = mysql_Query("SELECT win FROM turnier_kampf WHERE round='$round' AND art='$art_1'"); + while($row9 = mysql_fetch_array($chars_win)) + { + $test9[]=$row9['win']; + } + $round++; + $k9=0; + $l9=1; + while($k9 < count($test9)) + { + $chara_1 = $charas[$test9[$k9]]; + $chara_2 = $charas[$test9[$l9]]; + include "turnier_kampf.php"; + $k9+=2; + $l9+=2; + } + + + + +} + +mysql_query("DELETE FROM n_turnier_reg ORDER BY id ASC LIMIT 16"); + +?> \ No newline at end of file diff --git a/cronjob/special_chars.php b/cronjob/special_chars.php new file mode 100644 index 0000000..ec895a1 --- /dev/null +++ b/cronjob/special_chars.php @@ -0,0 +1,13 @@ +######Special Charakter +Black Boo F: Magia +Brolly F: Saiyajins +Gold Rogger F: Gran Maschin +Monkey D. Ruffy F: Piraten +Lorendor Zorro F: Schwert Kämpfer +Mac Magia F: Hexe + +Babidi : Dämon +Vegeta (BLACK-BOO) Fusion F:Mutanten +Hildegarn Hälfte 1 F: namekianer +Hildegarn Hälfte 2 F: Cyborg +Grandcer F: Menschen \ No newline at end of file diff --git a/cronjob/training.php b/cronjob/training.php new file mode 100644 index 0000000..38ecfba --- /dev/null +++ b/cronjob/training.php @@ -0,0 +1,243 @@ +10000){ +// $IP = $row['preis']/1000; +// mysql_query("UPDATE user SET pkt= pkt + '$IP' WHERE id='$row[besitzer]'"); +// insertUserTickerMessage($row['besitzer'], ' '.$IP.' IP durch deinen Wanted erhalten, da du eine Grenze überschritten hast'); +// } +// } + $i = 5; +} +if ($test == "14") { + $i = 6; +} +if ($test == "16") { + $i = 7; +} +if ($test == "18") { + $i = 8; +} +if ($test == "20") { + $i = 9; +} +if ($test == "22") { + $i = 10; +} +if ($test == "00" || $_GET['midnight'] == 1) { + $i = 11; +} + +########################CLAN ITEMS BENUTZEN +if ($i == 11) { + // Erstmal Arena (auch wenns nix mit Training zu tun hat) + // select round(einnahmen*0.5/(1+EXP(2-einnahmen/100000))) from arena where einnahmen > 10000 + + // Kann erstmal bleiben! + mysql_query('Update arena set zustand = zustand - 1/4 where mietlasten >= 2 and einnahmen > 0'); + mysql_query('Update arena set zustand = 0 where zustand < 0'); // No negatives any more + $freibetrag = 300000; + $steuersatz_start = 25; + $faktor_level = 3; + $faktor_finanz = 2; + $sql = 'Update arena set mietlasten = mietlasten + 1, steuerlasten = steuerlasten + ceil((einnahmen - '.$freibetrag.') * (('.$steuersatz_start.' + level * '.$faktor_level.' -hausmeister * '.$faktor_finanz.')/100)) where ceil((einnahmen - '.$freibetrag.') * (('.$steuersatz_start.' + level * '.$faktor_level.' -hausmeister * '.$faktor_finanz.')/100)) > 0'; +// echo $sql.'
'; + mysql_query($sql); + + mysql_query('Update arena set einnahmen = 0'); + + // Inaktive Clans löschen (Clanräume werden automatisch gelöscht durch Fremdschlüssel) + mysql_query('delete from clan where id NOT IN(SELECT distinct(clan) from user )'); + // Räume die Ticker auf (Massivster Datenmüll!!) + mysql_query('DELETE FROM clan_ticker WHERE date < TIMESTAMPADD(day, -7, now())'); + mysql_query('DELETE FROM user_ticker WHERE date < TIMESTAMPADD(day, -7, now())'); + + // Benutze Clan items!! + // Folgende SQL-Anweisung ermittelt mit einer kleinen Hilfsfunktion die Summe der Miete und das Geld des Clans + $mindestchar = 12; // War vorher 40; + $sql = 'SELECT cw.id as clan_train, if(count(ch.id)<'.$mindestchar.','.$mindestchar.',count(ch.id)) * miete as mietkosten, c.id as clan, c.geld as geld from clan_ware cw inner join clan_item ci on cw.item_id = ci.id inner join clan c on cw.clan = c.id inner join user u on u.clan = c.id left join chars ch on ch.clan_train = cw.id and ch.besitzer = u.id group by c.id, cw.id order by c.id'; + // SQL-Anweisung, wenn Ungenutzte items nicht beruecksichtigt werden sollen -> 'SELECT ch.clan_train, if(count(ch.id)<40,40,count(ch.id)) * miete as mietkosten, c.id as clan, c.geld as geld from user u inner join clan c on u.clan = c.id inner join chars ch on u.id = ch.besitzer inner join clan_ware cw on cw.clan = c.id inner join clan_item ci on cw.item_id = ci.id and ch.clan_train = cw.id group by c.id, cw.id order by c.id' +// echo '
'.$sql.'
'; + $clan_kosten = mysql_query($sql); + + $clan_raum_array = array(); + while ($row = mysql_fetch_assoc($clan_kosten)){ + if($clan_raum_array[$row['clan']] === null){ + $clan_raum_array[$row['clan']] = $row; + } else{ + $clan_raum_array[$row['clan']]['mietkosten'] += $row['mietkosten']; + } + } + + $clans = array (); +// while ($row = mysql_fetch_assoc($clan_kosten)) { + foreach($clan_raum_array as $row){ +// print_r($row); + // Ermittle das Vermoegen und die Useranzahl des Clans! + if ($row['mietkosten'] > $row['geld']) { + // Clan is pleite! + // echo 'Clan '.$row['clan'].' is Pleite!'; + insertClanTickerMessage($row['clan'], 'Die Miete für die Räume ('.displayMoney($row['mietkosten']).') konnte nicht bezahlt werden!'); + } else { + // Clan kann miete bezahlen, also in Trainingsliste aufnehmen + $clans[] = $row['clan']; + // Clan die Miete abziehen + mysql_query('UPDATE clan SET geld = geld - ' . $row['mietkosten'] . ' WHERE id = ' . $row['clan']); + insertClanTickerMessage($row['clan'], 'Die Miete für die Räume ('.displayMoney($row['mietkosten']).') wurde bezahlt!'); + } + } + // Ermittle die Kosten fuer die Nutzer (es werden nur Chars beruecksichtigt, die genug TP haben) + $sql = 'select besitzer, user.geld, sum(1/(1+exp(3-level/12)) * nutzung) as nutzkosten from user inner join chars on chars.besitzer = user.id inner join clan_ware on chars.clan_train = clan_ware.id inner join clan_item on clan_ware.item_id = clan_item.id where user.clan = clan_ware.clan and user.clan IN (' . join(',', $clans) . ') and clan_item.tp <= chars.training_points group by besitzer order by besitzer'; + $user_kosten = mysql_query($sql); + // echo '
'.$sql.'
'; + $users = array (); + if (count($clans) != 0) { + while ($row = mysql_fetch_assoc($user_kosten)) { + if ($row['nutzkosten'] > $row['geld']) { + // User is pleite! + insertUserTickerMessage($row['besitzer'], 'Die Nutzungsgebühren ('.displayMoney($row['nutzkosten']).') für die Räume konnte nicht bezahlt werden!'); + } else { + // User kann Nutzkosten bezahlen, also in Trainingsliste aufnehmen + $users[] = $row['besitzer']; + // Clan die Miete abziehen + mysql_query('UPDATE user SET geld = geld - ' . $row['nutzkosten'] . ' WHERE id = ' . $row['besitzer']); + insertUserTickerMessage($row['besitzer'], 'Die Nutzungsgebühren ('.displayMoney($row['nutzkosten']).') für die Räume wurde bezahlt!'); + } + } + + $sql = 'Update chars inner join user on chars.besitzer = user.id inner join clan_ware on chars.clan_train = clan_ware.id inner join clan_item on clan_ware.item_id = clan_item.id SET chars.starke = clan_item.staerke + chars.starke, chars.speed = chars.speed + clan_item.geschwindigkeit, chars.verteidigung = chars.verteidigung + clan_item.verteidigung, chars.glueck = chars.glueck + clan_item.glueck, chars.ausdauer = chars.ausdauer + clan_item.ausdauer, chars.training_points = chars.training_points - clan_item.tp WHERE user.clan = clan_ware.clan and chars.besitzer IN(' . join(',', $users) . ') and chars.training_points >= clan_item.tp'; + $check = mysql_query($sql); + + } + // echo '
'.$sql.'
'; +} +#########################EXIT + +$char_info = mysql_query("SELECT training_points, id, training, starke, verteidigung, speed, ausdauer, glueck, mp, hp, level FROM chars"); +$x = 0; +while ($row = mysql_fetch_array($char_info)) { + $hp = explode(",", $row['hp']); + $mp = explode(",", $row['mp']); + $trains = explode(",", $row['training']); + if (!$trains[$i] || $trains[$i] == 'ausruhen') { + mysql_query("UPDATE chars SET hp='$hp[1],$hp[1]', mp='$mp[1],$mp[1]' WHERE id='$row[id]' LIMIT 1"); + } else { + + if ($row[training_points] > 1) { + if ($trains[$i] == 'hp' OR $trains[$i] == 'mp') { + if ($trains[$i] == hp) { + $zu[$x] = $hp[1] + 20; + $zu[$x] = "$hp[0],$zu[$x]"; + } else if ($trains[$i] == 'mp') { + $zu[$x] = $mp[1] + 10; + $zu[$x] = "$mp[0],$zu[$x]"; + } + // echo "UPDATE chars SET $trains[$i]='$zu[$x]', training_points=training_points-2 WHERE id='$row[id]' LIMIT 1
"; + mysql_query("UPDATE chars SET $trains[$i]='$zu[$x]', training_points=training_points-4 WHERE id='$row[id]' LIMIT 1"); + } else { + $event = mysql_fetch_assoc(mysql_query('SELECT CURRENT_TIMESTAMP between TIMESTAMP(\'2009-04-25 00:00:00\') and TIMESTAMP(\'2009-05-02 23:59:59\') as betw')); + $step = 2 + ($event['betw']*3); + $news2 = $trains[$i]; + $news[$x] = $row[$news2] + $step; + $step*=2; + $sql = "UPDATE chars SET $news2='$news[$x]', training_points=training_points-$step WHERE id='$row[id]' LIMIT 1"; + // echo $sql.'
'."\n"; + mysql_query($sql); + } + + } + } + $x++; +} + +mysql_query('DELETE FROM ag_chat where TIMESTAMPDIFF(Hour,zeit,now()) > 48'); +mysql_query('DELETE FROM user_activation where TIMESTAMPDIFF(day, registerdate, now()) > 7'); +// Loesche inaktive anons :) +mysql_query('DELETE FROM anon_chatter WHERE TIMESTAMPDIFF(day, online, now()) > 35'); // 5 Wochen + +// Loesche inaktive user! +$sql = 'Select * from user where TIMESTAMPDIFF(week, online_zeit, now()) > 10 and id > 2'; + + +//echo $sql; +$u_qry = mysql_query($sql); +if (mysql_num_rows($u_qry) != 0) { + $user = array (); + while ($row = mysql_fetch_assoc($u_qry)) { + $user[] = $row['id']; + } + $users = join(',', $user); +// echo 'Delete inactive Users ' . $users . '
'; + mysql_query('Delete from user where id in (' . $users . ')'); + mysql_query('Delete from arena where besitzer in (' . $users . ')'); + mysql_query('Delete from ware where user in (' . $users . ')'); + mysql_query('Delete from npc_ware where user in (' . $users . ')'); + mysql_query('Delete from sp_ware where user in (' . $users . ')'); + mysql_query('Delete from wochen_ware where user in (' . $users . ')'); + mysql_query('Delete from user_ticker where userid in (' . $users . ')'); + mysql_query('Delete from user_rename where userid in (' . $users . ')'); + mysql_query('Delete from user_clan where userid in (' . $users . ')'); + mysql_query('Delete from nachricht where besitzer in (' . $users . ')'); + mysql_query('Delete from ignolist where user in (' . $users . ') or besitzer in (' . $users . ')'); + + $char = array (); + $c_qry = mysql_query('Select * from chars where besitzer IN (' . $users . ')'); + while ($row = mysql_fetch_assoc($c_qry)) { + $char[] = $char['id']; + } + $chars = join(',', $char); + mysql_query('Delete from chars where id IN (' . $chars . ')'); + mysql_query('Delete from lernen where besitzer IN (' . $chars . ')'); + mysql_query('Delete from quests where charid IN (' . $chars . ')'); + mysql_query('Delete from quests_fights where charid IN (' . $chars . ')'); + mysql_query('Delete from quests_rounds where charid IN (' . $chars . ')'); + mysql_query('Delete from kampf where dbsatz IN (' . $chars . ')'); + mysql_query('Delete from kampf_list where charakter IN (' . $chars . ')'); + mysql_query('Delete from char_abholcodes where charid IN (' . $chars . ')'); +} + +$qry = mysql_query('SELECT id, zeitpunkt, clanfighttyp FROM clan_fight_list WHERE status=1'); +while($row = mysql_fetch_assoc($qry)){ + if ($row['zeitpunkt'] <= time()) { + $status_updaten= mysql_query('UPDATE clan_fight_list SET status=2 WHERE id='.$row['id'].' LIMIT 1'); + if ($row['clanfighttyp'] == 1) { + clanFightExecute($row['id']); + } elseif ($row['clanfighttyp'] == 2) { + clanFightExecute_survival($row['id']); + } + } +} + + +?> \ No newline at end of file diff --git a/cronjob/turnier.php b/cronjob/turnier.php new file mode 100644 index 0000000..de66901 --- /dev/null +++ b/cronjob/turnier.php @@ -0,0 +1,124 @@ +=0; $i--) + { + if($i>0) $zufall=mt_rand(0,$i); + else $zufall=0; + $temp=$array[$i]; + $array[$i]=$array[$zufall]; + $array[$zufall]=$temp; + $newarray[]=$array[$i]; + array_pop($array); + } + return $newarray; +} + +include "db.php"; + +$max_charakter = mysql_num_rows(mysql_query("SELECT id FROM chars LIMIT 64")); + +if($max_charakter<64) { +exit; +} +mysql_query("DELETE FROM turnier_kampf WHERE art='$art_1'"); + +$char1 = mysql_query("SELECT charakter FROM turnier1 WHERE art='$art_1'"); +while($row=mysql_fetch_array($char1)) +{ + $test2[]=$row['charakter']; +} + +do +{ + + if(count($test2)<64) + { // WHERE status='Frei' + list($count) = mysql_fetch_array(mysql_query("SELECT COUNT(id) FROM chars")); + + if(($count+count($test2))>=64) + { + $result = mysql_query("SELECT id FROM chars WHERE status='Frei' AND rasse !='NPC' ORDER BY RAND() LIMIT ".(64-count($test2))); + while($char_name2=mysql_fetch_array($result)) + { + $test2[]=$char_name2['id']; + } + } + } + $test2 = rand_array($test2); + $test2 = array_unique($test2); +} + + +while(count($test2)<64); + +$test3=$test2; +reset($test3); +while(current($test3)!=end($test2)) +{ + if(empty($list)) $list=current($test3); + else $list.=','.next($test3); +} + +$result=mysql_query("SELECT * FROM chars WHERE id IN(".$list.") LIMIT 64"); +while($row=mysql_fetch_array($result)) +{ + + $charas[$row['id']]=$row; +} + +$a8=0; +$b8=1; + +$round = 1; +while($a8 < 64) +{ + $chara_1 = $charas[$test2[$a8]]; + $chara_2 = $charas[$test2[$b8]]; + include "turnier_kampf.php"; + $a8+=2; + $b8+=2; +} + + + +while($round < 6) +{ + unset($test9); + + + $chars_win = mysql_Query("SELECT win FROM turnier_kampf WHERE round='$round' AND art='$art_1'"); + while($row9 = mysql_fetch_array($chars_win)) + { + $test9[]=$row9['win']; + } + $round++; + $k9=0; + $l9=1; + while($k9 < count($test9)) + { + $chara_1 = $charas[$test9[$k9]]; + $chara_2 = $charas[$test9[$l9]]; + include "turnier_kampf.php"; + + $k9+=2; + $l9+=2; + } + + + + +} + +mysql_query("DELETE FROM turnier1 WHERE art='$art_1' "); +?> diff --git a/cronjob/turnier_kampf.php b/cronjob/turnier_kampf.php new file mode 100644 index 0000000..f3647d9 --- /dev/null +++ b/cronjob/turnier_kampf.php @@ -0,0 +1,199 @@ +'; +} + +while ($k_hp[0] > $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) { + + $technick1 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10")); + $prozent_technik1 = (20 * $technick1[aktiv]) - 20; + $technick1 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10")); + + $technick2 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10")); + $prozent_technik2 = (20 * $technick2[aktiv]) - 20; + $technick2 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10")); + + ///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte + include "kampf/andere_technik.php"; /////////////////// Wenn man ne andere technik sich aussuchen will... + + $technick1[speed] = $technick1[speed] + (($technick1[speed] / 100) * $prozent_technik1); + $technick2[speed] = $technick2[speed] + (($technick2[speed] / 100) * $prozent_technik2); + + $technick1[verteidigung] = $technick1[verteidigung] + (($technick1[verteidigung] / 100) * $prozent_technik1); + $technick2[verteidigung] = $technick2[verteidigung] + (($technick2[verteidigung] / 100) * $prozent_technik2); + + $technick1[starke] = $technick1[starke] + (($technick1[starke] / 100) * $prozent_technik1); + $technick2[starke] = $technick2[starke] + (($technick2[starke] / 100) * $prozent_technik2); + + $speeds_char1 = ($k_speed[0] + $technick1[speed]); + $speeds_char2 = ($k_speed[1] + $technick2[speed]); + + $speeds_char1_4 = ($k_speed[0] + $technick1[speed]) / 1.5; + $speeds_char2_4 = ($k_speed[1] + $technick2[speed]) / 1.5; + + if ($speeds_char1_4 < 1) { + $speeds_char1_4 = 1; + } + if ($speeds_char2_4 < 1) { + $speeds_char2_4 = 1; + } + + $speed_char1 = mt_rand($speeds_char1_4, $speeds_char1); + $speed_char2 = mt_rand($speeds_char2_4, $speeds_char2); + + include "kampf_include.php"; ////Rechnung + + #####################################KAMPF SYSTEM + include "kampf/kampf_rechnung.php"; + + + $sql = "SELECT * FROM turnier_kampf WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1"; + + if(($qry = mysql_query($sql)) === false){ + echo $sql.' Failed!!
'; + } + + $db_query = mysql_fetch_array($qry); + + $sql = "UPDATE turnier_kampf SET hp1='$db_query[hp1],$k_hp7[0]', hp2='$db_query[hp2],$k_hp7[1]', mp1='$db_query[mp1],$k_mp7[0]', mp2='$db_query[mp2],$k_mp7[1]', schaden1='$db_query[schaden1],$schaden_1', schaden2='$db_query[schaden2],$schaden_2', attacke1='$db_query[attacke1],$technick1[name]', attacke2='$db_query[attacke2],$technick2[name]', starke1='$db_query[starke1],$k_starke[0]', starke2='$db_query[starke2],$k_starke[1]', ver1='$db_query[ver1],$k_ver[0]', ver2='$db_query[ver2],$k_ver[1]', speed1='$db_query[speed1],$k_speed[0]', speed2='$db_query[speed2],$k_speed[1]', ausdauer1='$db_query[ausdauer1],$k_ausdauer[0]', ausdauer2='$db_query[ausdauer2],$k_ausdauer[1]', glueck1='$db_query[glueck1],$k_glueck[0]', glueck2='$db_query[glueck2],$k_glueck[1]' WHERE id='$db_query[id]'"; +// echo $sql.'
'; + mysql_query($sql); + + $x++; +} + +###########################EXP VERTEILUNG + +if ($k_hp[0] <= 0 AND $k_hp[1] <= 0) { + + if ($k_hp[0] > $k_hp[1]) { + $k_hp[0] = $k_hp1[1]; + } else { + $k_hp[1] = $k_hp2[1]; + } +} + +$s = 0; +while ($s < 2) { + + if ($s == 1) { + + if ($k_hp[0] > $k_hp[1]) { + $X13 = HALLO; + } else { + $X23 = HALLO; + } + } + + if ($k_hp[1] < $k_aufgabe[1] OR $X13 == "HALLO") { + $k_exp[1] = (($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 4)) / 2) * 5; + + $k_geld[1] = (($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 6)) / 2) * 2; + + $k_exp[0] = ($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 4)) * 5; + + $k_geld[0] = ($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 6)) * 2; + + $sieger = $chara_1[id]; + $verlierer = $chara_2[id]; + + } + + if ($k_hp[0] < $k_aufgabe[0] OR $X23 == "HALLO") { + + $sieger = $chara_2[id]; + $verlierer = $chara_1[id]; + + $k_exp[1] = ($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 4)) * 5; + + $k_geld[1] = ($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 6)) * 2; + + $k_exp[0] = (($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 4)) / 2) * 5; + + $k_geld[0] = (($chara_1[starke] + $chara_1[verteidigung] + $chara_1[speed] + $chara_1[ausdauer] + $chara_1[glueck] + $chara_2[starke] + $chara_2[verteidigung] + $chara_2[speed] + $chara_2[ausdauer] + $chara_2[glueck] * ($x / 6)) / 2) * 2; + + } + + if ($k_exp[0]) { + $s = 2; + } else { + $s++; + } + +} + +$dauer_Z = time(); +mysql_query("UPDATE turnier_kampf SET art='$art_1', round='$round', exp1='$k_exp[0]', win='$sieger', lose='$verlierer', exp2='$k_exp[1]', geld1='$k_geld[0]', geld2='$k_geld[1]', dauer='$dauer_Z' WHERE id='$db_query[id]'"); + +?> \ No newline at end of file diff --git a/cronjob/viertelstunde.php b/cronjob/viertelstunde.php new file mode 100644 index 0000000..23a74d4 --- /dev/null +++ b/cronjob/viertelstunde.php @@ -0,0 +1,165 @@ +'; + } + return $tmp; +} + + +// Handelt eine einzelne Auktion ab +// @Return nichts +function bearbeiteAbgelaufeneAuktion($auktionsid){ +// echo '
bearbeite '.$auktionsid.'
'; + + $qry = database_query('SELECT u.nickname AS anbietername, u2.nickname AS bietername, a.auktionsid,a.anbieter,a.bieter,a.itemid,a.itemname,a.tablename,a.anzahl,a.startgebot,a.aktuellesgebot,a.deadline,a.startdate,a.cheatingverdacht, TIMESTAMPDIFF(Minute,now(),deadline) AS zeitdifferenz FROM auktion AS a INNER JOIN user as u ON a.anbieter = u.id LEFT JOIN user as u2 ON a.bieter = u2.id WHERE auktionsid = '.$auktionsid); + if(mysql_num_rows($qry) == 0){ return NULL; } + $result = mysql_fetch_assoc($qry); + $itemreceiver = ''; + + // Nun muss geprüft werden, ob überhaupt jemand geboten hat! + if($result['bieter'] == NULL){ // Wenn nicht, dann geht das item an den anbieter + $itemreceiver = $result['anbieter']; + } + else{ + // Ansonsten geht das Item an den Bietenden + $itemreceiver = $result['bieter']; + // Aber erst muss das Geld überwiesen werden + $erhalten = ceil($result['aktuellesgebot'] * 0.99); + $gebuehr = $result['aktuellesgebot'] - $erhalten; + + database_query('UPDATE user SET geld = geld - '.$result['aktuellesgebot'].' WHERE id = '.$result['bieter']); + database_query('UPDATE user SET geld = geld + '.$erhalten.' WHERE id = '.$result['anbieter']); + + if($result[cheatingverdacht] == 0){ // Wenn cheatingverdacht nicht besteht, dann pruefe ob Verdacht besteht!! + $avgprice = getAveragePrice($result[itemid], $result[tablename], $result[anzahl]); + if($avgprice != 0 && $avgprice * 1.2 < $result['aktuellesgebot'] && $result['anbieter'] != 1){ + $result[cheatingverdacht] = 1; + } + } + + //Transaktion verbuchen + $test = 'INSERT INTO auktion_transaktionen (anbieter, bieter, itemid, tablename, anzahl, betrag, deadline,cheatingverdacht) VALUES('.$result['anbieter'].','.$result['bieter'].','.$result['itemid'].',\''.$result['tablename'].'\','.$result['anzahl'].','.$result['aktuellesgebot'].',\''.$result['deadline'].'\','.$result['cheatingverdacht'].')'; + database_query($test); + //echo '

'.$test.'

'; + } + $anzahl = $result['anzahl']; + $item_row_name = 'item'; + if($result['tablename'] == 'ware'){$item_row_name = 'item_id';} + while($anzahl-- > 0){ + database_query('INSERT INTO '.$result['tablename'].' ('.$item_row_name.', user) VALUES('.$result['itemid'].','.$itemreceiver.')'); + } + + database_query('DELETE FROM auktion WHERE auktionsid = '.$auktionsid); + + if($result['bieter'] == NULL){ + database_query('INSERT INTO nachricht(von, besitzer, betreff, text) VALUES (\'Auktionsmarkt\', '.$result['anbieter'].', \'Item nicht verkauft\', \' Tut mir leid, doch Sie sind das Item '.$result['itemname'].' mit dem Startgebot '.$result['startgebot'].' nicht losgeworden. Deadline war '.$result['deadline'].'\')'); + } else{ + // Nun noch die Gluecklichen benachrichtigen + database_query('INSERT INTO nachricht(von, besitzer, betreff, text) VALUES (\'Auktionsmarkt\', '.$result['anbieter'].', \'Item erfolgreich verkauft\', \' Herzlichen Glückwunsch, Sie sind das Item '.$result['itemname'].' für ganze '.$result['aktuellesgebot'].' an '.$result['bietername'].' losgeworden. Anzahl war '.$result['anzahl'].'. Nach abzug der Gebühr von '.$gebuehr.' (ca. 1%) bleiben noch '.$erhalten.' über. Deadline war '.$result['deadline'].'\')'); + database_query('INSERT INTO nachricht(von, besitzer, betreff, text) VALUES (\'Auktionsmarkt\', '.$result['bieter'].', \'Item erfolgreich ersteigert\', \' Herzlichen Glückwunsch, Sie haben das Item '.$result['itemname'].' für ganze '.$result['aktuellesgebot'].' von '.$result['anbietername'].' ersteigert. Anzahl war '.$result['anzahl'].', Deadline war '.$result['deadline'].'\')'); + } + + +} + +//Sucht nach abgelaufenen Auktionen und handelt diese ab +// @Return nichts +function bearbeiteAlleAbgelaufenenAuktionen(){ + $qry = database_query('SELECT auktionsid from auktion where TIMESTAMPDIFF(Minute,now(),deadline) < 0'); + // Gehe alle Auktionen durch und bearbeite diese + $index = 0; + while($result = mysql_fetch_assoc($qry)){ + bearbeiteAbgelaufeneAuktion($result['auktionsid']); + $index++; + } + return $index; +} + +function insertAuktionen(){ + if(Date("D") == 'Sun'){ + $anzahl_auktionen = mt_rand(1,2); // anzahl der auktionen die gleichzeitig starten (ein oder zwei) + $startgebot = 1000000; + // Jeden Sonntag wird dieser Skript ausgefuehrt! + // erstmal checken obs schon Auktionen für kommende Woche gibt + $number = mysql_num_rows(database_query('SELECT * FROM auktion WHERE anbieter = 1 and TIMESTAMPDIFF(Second,startdate,now()) < 0')); +// echo $number.'= Number of effected rows'; + if($number == 0){ + // So, also es sind noch keine Auktionen vorhanden!! + // Nun 6 Auktionen erstellen 3x2 Auktionen (update 2x2) + $date = mysql_fetch_assoc(database_query('Select current_date AS date')); + $qry = database_query('SELECT id FROM `wochen_markt` WHERE aktiv = \'ja\''); + $fruchtcount = 0; + $frucht = array(); + while($result = mysql_fetch_assoc($qry)){ + $frucht[$fruchtcount++] = $result[id]; + } + for($i = 0; $i<$anzahl_auktionen;$i++){ + $id1[$i] = mt_rand(0,$fruchtcount-1); + $id2[$i] = mt_rand(0,$fruchtcount-1); + } + + // Termine festlegen + // Start Sonntag->0,Montag->1,Dienstag->2, Mittwoch->3, Donnerstag->4 + $off1 = mt_rand(0,4); + $off2 = mt_rand(0,4); + $start1 = 'TIMESTAMPADD(Day,'.$off1.',\''.$date[date].' 20:00:00\')'; + $deadline1 = 'TIMESTAMPADD(Day,'.($off1+3).',\''.$date[date].' 20:00:00\')'; + $start2 = 'TIMESTAMPADD(Day,'.$off2.',\''.$date[date].' 20:00:00\')'; + $deadline2 = 'TIMESTAMPADD(Day,'.($off2+3).',\''.$date[date].' 20:00:00\')'; + + + // Auktinoen der ersten Auktionswelle einfuegen + for($i=0;$i<$anzahl_auktionen;$i++){ + $test1 = 'INSERT INTO auktion (itemid, itemname, tablename, anbieter, anzahl, deadline, startgebot, startdate) VALUES('.$frucht[$id1[$i]].',\'Geheim!\',\'wochen_ware\',1,1,'.$deadline1.','.$startgebot.','.$start1.')'; + $test2 = 'INSERT INTO auktion (itemid, itemname, tablename, anbieter, anzahl, deadline, startgebot, startdate) VALUES('.$frucht[$id2[$i]].',\'Geheim!\',\'wochen_ware\',1,1,'.$deadline2.','.$startgebot.','.$start2.')'; + database_query($test1); + database_query($test2); +// echo $test1.'
'.$test2.'
'; + } + } else if($number > 6){ + database_query('DELETE FROM auktion WHERE anbieter = 1 LIMIT '.($number-6)); + } + } +} + +function detectMultiAccounts(){ + $sql = 'Select u1.id as uid1, u2.id as uid2, u1.nickname as n1, u2.nickname as n2 , u1.ip as ip1, u2.ip as ip2, u1.online_zeit as o1, u2.online_zeit as o2 from user as u1 inner join user as u2 on u1.ip = u2.ip and u1.id < u2.id and u1.ip != \'\' and abs(TIMESTAMPDIFF(HOUR, u1.online_zeit, u2.online_zeit)) < 24 and (abs(TIMESTAMPDIFF(HOUR, now(), u1.online_zeit)) < 1 || abs(TIMESTAMPDIFF(HOUR, now(), u2.online_zeit)) < 1)'; + $qry = mysql_query($sql); + while($tmp = mysql_fetch_assoc($qry)){ + $otime = min($tmp['o2'], $tmp['o1']); + $sql = 'INSERT INTO multiuser(user1, user2, occured, type) values(\'' . $tmp['uid1'] . '\', \''.$tmp['uid2'].'\',\''.$otime.'\', \'IP_'.$tmp['ip1'].'\')'; + mysql_query($sql); + } +} + +// sollte irgendwann mit der auktion_funktions verlinkt werden +function getAveragePrice($itemid, $tablename, $anzahl){ + $sql = 'SELECT avg(betrag) / avg(anzahl) AS average FROM auktion_transaktionen WHERE anbieter != 1 and itemid = '.$itemid.' and tablename = \''.$tablename.'\' and cheatingverdacht = 0'; + $qry = database_query($sql); + $row = mysql_fetch_assoc($qry); + return round($row['average']*$anzahl); +} + +// Starten der Auktionsverteilung +$i = bearbeiteAlleAbgelaufenenAuktionen(); +//$sql = 'INSERT INTO nachricht(von, besitzer, betreff, text) VALUES (\'GM-INFO\', 3735, \'Cronjob lief!\', \' Der Vierteilstunde-Cronjob wurde ausgefuehrt! Es wurden '.$i.' Anfragen bearbeitet!\')'; +//database_query($sql); +insertAuktionen(); +detectMultiAccounts(); + +?> \ No newline at end of file diff --git a/cronjob/wanted.php b/cronjob/wanted.php new file mode 100644 index 0000000..cda662b --- /dev/null +++ b/cronjob/wanted.php @@ -0,0 +1,78 @@ +=0; $i--) + { + if($i>0) $zufall=mt_rand(0,$i); + else $zufall=0; + $temp=$array[$i]; + $array[$i]=$array[$zufall]; + $array[$zufall]=$temp; + $newarray[]=$array[$i]; + array_pop($array); + } + return $newarray; +} + +include "db.php"; +$max_charakter = mysql_num_rows(mysql_query("SELECT id FROM chars WHERE rasse!='NPC' LIMIT 500")); + +if($max_charakter<500) { +exit; +} + +$charakter = mysql_query("SELECT name, id FROM chars WHERE rasse!='NPC' ORDER BY level DESC LIMIT $max_charakter"); + + +while($row=mysql_fetch_array($charakter)) +{ + $test2[]=$row['id']; +} + + + $test2 = rand_array($test2); + $test2 = array_unique($test2); + +while(count($test2)<$max_charakter); + +$test3=$test2; +reset($test3); +while(current($test3)!=end($test2)) +{ + if(empty($list)) $list=current($test3); + else $list.=','.next($test3); +} + + +$result=mysql_query("SELECT * FROM chars WHERE id IN(".$list.") LIMIT 500"); +while($row=mysql_fetch_array($result)) +{ + + $charas[$row['id']]=$row; +} + +$a8=0; +$b8=1; + +$round = 1; +while($a8 < $max_charakter) +{ + $chara_1 = $charas[$test2[$a8]]; + $chara_2 = $charas[$test2[$b8]]; + include "wanted_kampf.php"; + $a8+=2; + $b8+=2; +} + + + +?> \ No newline at end of file diff --git a/cronjob/wanted_kampf.php b/cronjob/wanted_kampf.php new file mode 100644 index 0000000..cb64cc7 --- /dev/null +++ b/cronjob/wanted_kampf.php @@ -0,0 +1,194 @@ + $k_aufgabe[0] AND $k_hp[1] > $k_aufgabe[1] AND $x < 10) { + +$technick1 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke1[$x]' LIMIT 10")); +$prozent_technik1 = (20*$technick1[aktiv])-20; +$technick1 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick1[at_id]' LIMIT 10")); + +$technick2 = mysql_fetch_array(mysql_query("SELECT at_id, aktiv FROM lernen WHERE id='$k_attacke2[$x]' LIMIT 10")); +$prozent_technik2 = (20*$technick2[aktiv])-20; +$technick2 = mysql_fetch_array(mysql_query("SELECT * FROM attacken WHERE id='$technick2[at_id]' LIMIT 10")); + + +///////////////////Hier laedt er den RELOAD der technik wenn die zusammen setzung nicht stimmen sollte +include "kampf/andere_technik.php"; /////////////////// Wenn man ne andere technik sich aussuchen will... + + +$technick1[speed]=$technick1[speed]+(($technick1[speed]/100)*$prozent_technik1); +$technick2[speed]=$technick2[speed]+(($technick2[speed]/100)*$prozent_technik2); + +$technick1[verteidigung]=$technick1[verteidigung]+(($technick1[verteidigung]/100)*$prozent_technik1); +$technick2[verteidigung]=$technick2[verteidigung]+(($technick2[verteidigung]/100)*$prozent_technik2); + +$technick1[starke]=$technick1[starke]+(($technick1[starke]/100)*$prozent_technik1); +$technick2[starke]=$technick2[starke]+(($technick2[starke]/100)*$prozent_technik2); + + + +$speeds_char1 = ($k_speed[0] + $technick1[speed]); +$speeds_char2 = ($k_speed[1] + $technick2[speed]); + +$speeds_char1_4 = ($k_speed[0] + $technick1[speed]) / 1.5; +$speeds_char2_4 = ($k_speed[1] + $technick2[speed]) / 1.5; + +if($speeds_char1_4 < 1) { $speeds_char1_4 = 1; } +if($speeds_char2_4 < 1) { $speeds_char2_4 = 1; } + +$speed_char1 = mt_rand($speeds_char1_4,$speeds_char1); +$speed_char2 = mt_rand($speeds_char2_4,$speeds_char2); + + +include "kampf_include.php"; ////Rechnung + +#####################################KAMPF SYSTEM +include "kampf/kampf_rechnung.php"; + + + +$db_query = mysql_fetch_array(mysql_query("SELECT * FROM wanted_kampf WHERE (char1='$chara_1[id]' OR char1='$chara_2[id]') AND dauer='0' order by id DESC LIMIT 1")); + +mysql_query("UPDATE wanted_kampf SET hp1='$db_query[hp1],$k_hp7[0]', hp2='$db_query[hp2],$k_hp7[1]', mp1='$db_query[mp1],$k_mp7[0]', mp2='$db_query[mp2],$k_mp7[1]', schaden1='$db_query[schaden1],$schaden_1', schaden2='$db_query[schaden2],$schaden_2', attacke1='$db_query[attacke1],$technick1[name]', attacke2='$db_query[attacke2],$technick2[name]', starke1='$db_query[starke1],$k_starke[0]', starke2='$db_query[starke2],$k_starke[1]', ver1='$db_query[ver1],$k_ver[0]', ver2='$db_query[ver2],$k_ver[1]', speed1='$db_query[speed1],$k_speed[0]', speed2='$db_query[speed2],$k_speed[1]', ausdauer1='$db_query[ausdauer1],$k_ausdauer[0]', ausdauer2='$db_query[ausdauer2],$k_ausdauer[1]', glueck1='$db_query[glueck1],$k_glueck[0]', glueck2='$db_query[glueck2],$k_glueck[1]' WHERE id='$db_query[id]'"); + + +$x++; +} +###########################EXP VERTEILUNG + +if($k_hp[0] <= 0 AND $k_hp[1] <= 0) { + + if($k_hp[0] > $k_hp[1]) { + $k_hp[0] = $k_hp1[1]; + } else { + $k_hp[1] = $k_hp2[1]; + } +} + +$s=0; +while($s < 2) { + +if($s == 1) { + +if($k_hp[0] > $k_hp[1]) { $X13 = HALLO; } else { $X23 = HALLO; } +} + +if($k_hp[1] < $k_aufgabe[1] OR $X13 == "HALLO") { +$k_exp[1] = 0; +$k_geld[1] = 0; +$k_exp[0] = 0; +$k_geld[0] = 0; + +$new_dead_list1 = "$chara_1[dead_list],$chara_2[name]"; +$new_dead_list2 = ""; + +$new_preis1 = $chara_1[preis] + (($chara_2[preis] / 100) * 10); +$new_preis2 = $chara_2[preis] - (($chara_2[preis] / 100) * 10); + +$sieger = $chara_1[id]; +$verlierer = $chara_2[id]; + +} + +if($k_hp[0] < $k_aufgabe[0] OR $X23 == "HALLO") { + +$new_dead_list2 = "$chara_2[dead_list],$chara_1[name]"; +$new_dead_list1 = ""; + +$new_preis2 = $chara_2[preis] + $chara_1[preis]; +$new_preis1 = 500; + +$sieger = $chara_2[id]; +$verlierer = $chara_1[id]; + + +$k_exp[1] = 0; +$k_geld[1] = 0; +$k_exp[0] = 0; +$k_geld[0] = 0; + + +} + +if($k_exp[0]) { $s=2; } else { $s++; } + +} + + +$dauer_Z = time(); + + + +mysql_query("UPDATE chars SET preis='$new_preis1', dead_list='$new_dead_list1' WHERE id='$chara_1[id]' LIMIT 1"); +mysql_query("UPDATE chars SET preis='$new_preis2', dead_list='$new_dead_list2' WHERE id='$chara_2[id]' LIMIT 1"); + +mysql_query("UPDATE wanted_kampf SET exp1='$k_exp[0]', win='$sieger', lose='$verlierer', exp2='$k_exp[1]', geld1='$k_geld[0]', geld2='$k_geld[1]', dauer='$dauer_Z' WHERE id='$db_query[id]'"); + + +?> \ No newline at end of file