Skocz do zawartości
  • 👋 Witaj na MPCForum!

    Przeglądasz forum jako gość, co oznacza, że wiele świetnych funkcji jest jeszcze przed Tobą! 😎

    • Pełny dostęp do działów i ukrytych treści
    • Możliwość pisania i odpowiadania w tematach
    • System prywatnych wiadomości
    • Zbieranie reputacji i rozwijanie swojego profilu
    • Członkostwo w jednej z największych społeczności graczy

    👉 Dołączenie zajmie Ci mniej niż minutę – a zyskasz znacznie więcej!

    Zarejestruj się teraz

Twlan 1.5 - OpenSource - Silnik na zwykłą stronę


MultiGamer

Rekomendowane odpowiedzi

Opublikowano

spróbujcie tego snob.php wrzucić do actions/snob.php

 

 

 

<?php

// Sicherheits Ausführungscheck:

if ($ACTIONS_MASSIVKEY_HIGHAAASSDD!='sdjahsdk[JHSAJDKHALKJHSADJHSADNsjdhaksjdlhJNASDKL') {

die("Aktions - Ausführung EXEC!");

}

 

$buildname="snob";

 

// Vorraussetzungen checken:

$show_build = ($cl_builds->check_needed($buildname,$village) && $village[$buildname]>0)?true:false;

if ($show_build) {

 

// Alle Einheiten die im gebäude gebaut werden können ermitteln:

$units = $cl_units->get_recruit_in_units($buildname);

 

// Sql vorbereiten für Einheiten im Dorf

$sql = "SELECT ";

$i=0;

foreach ($units as $key=>$value) {

$i++;

if (count($units)==$i) {

$sql .= "$key";

}

else

{

$sql .= "$key,";

}

}

$sql .= " from unit_place where villages_from_id='".$village['id']."' AND villages_to_id='".$village['id']."'";

$result = $db->query("$sql");

$units_in_village = $db->Fetch($result);

 

// Sql vorbereiten alle einheiten

$sql = "SELECT ";

$i=0;

foreach ($units as $key=>$value) {

$i++;

// Schauen ob Tech bei der Einheit aktiviert ist:

if (in_array("no_investigate", $cl_units->get_specials($key))) {

if (count($units)==$i) {

$sql .= "all_$key";

}

else

{

$sql .= "all_$key";

}

}

else

{

if (count($units)==$i) {

$sql .= "all_$key,".$key."_tec_level";

}

else

{

$sql .= "all_$key,".$key."_tec_level,";

}

}

}

$sql .= " from villages where id='".$village['id']."'";

$result = $db->query("$sql");

$units_all = $db->Fetch($result);

 

$village = $village + $units_all;

 

foreach ($units as $key=>$value) {

$units_all[$key] = $units_all["all_".$key];

}

// Alle Werte für SDS AG Style (so viele ags wie ag stufen insgesamt)

if ($config->get('ag_style')==1) {

// Summe Adelshöfer, Summe AGs vorhanden, -Summe ags vorhanden + in produktion-, kontrollierte Dörfer:

$result = $db->query("SELECT SUM(snob) AS stages,SUM(all_unit_snob) AS snob_sum,SUM(recruited_snobs) AS rec_snobs from villages where userid=".$user['id']."");

$row = $db->Fetch($result);

$village['snob_info']['stage_snobs'] = $row['stages']; // Stufen

$village['snob_info']['all_snobs'] = $row['snob_sum']; // anzahl ags

$village['snob_info']['ags_in_prod'] = $row['rec_snobs']-$row['snob_sum']; // ags in produktion

$village['snob_info']['control_villages'] = $user['villages']-1; // kontrolierte dörfer

$village['snob_info']['recruited_snobs'] = $row['rec_snobs']; // ags vorhanden + in produktion

$village['snob_info']['can_prod'] = $row['stages']-$row['rec_snobs']-$village['snob_info']['control_villages']; // können noch erzeugt werden

}

// Goldmünzen

elseif ($config->get('ag_style') == 2) {

require_once("./lib/coins.php");

 

//Anzahl Goldmünzen

$getCoins = $db->query("SELECT coins FROM users WHERE id = ".$user['id']."");

while ($rowCoin = $db->fetch($getCoins)) {

$coinsAll = $rowCoin['coins'];

}

//Anzahl an gebauten AGs holen

$getAllSnobs = $db->query("SELECT snobs FROM users WHERE id = ".$user['id']."");

while ($rowGetAllSnobs = $db->fetch($getAllSnobs)) {

$allRecruitedSnobs = $rowGetAllSnobs['snobs'];

}

//tatsächliche Anzahl an AGs in den Dörfern

$getTotal = $db->query("SELECT snobs FROM users WHERE id = ".$user['id']."");

while ($row = $db->fetch($getTotal)) {

$totalSnobs = $row['snobs'];

}

 

$getNow = $db->query("SELECT SUM(all_unit_snob) AS allSnobs FROM villages WHERE userid = ".$user['id']."");

while ($rowN = $db->fetch($getNow)) {

$snobsNow = $rowN['allSnobs'];

}

 

if ($snobsNow < $totalSnobs) {

$new = $totalSnobs - $snobsNow;

$db->query("UPDATE users SET snobs = $new WHERE id = ".$user['id']."");

}

# alle dörfer des spielers holen

$getAllVillages = $db->query("SELECT * FROM villages WHERe userid = ".$user['id']."");

while ($rowVilles = $db->fetch($getAllVillages)) {

$villages[] = $rowVilles;

}

$inRecruit = 0;

for($i=0;$i<count($villages);$i++) {

$recruit = $db->query("SELECT SUM(num_unit) AS unit FROM recruit WHERE unit = 'unit_snob' AND villageid = ".$villages[$i]['id']."");

while ($rowR = $db->fetch($recruit)) {

$inRecruit += $rowR['unit'];

}

}

 

$amountSnobsCanBeRecruited = snobs_per_coins_recruited($snobsNow, $coinsAll);

if($amountSnobsCanBeRecruited != 0) {

$amountSnobsCanBeRecruited -= $inRecruit;

//sind dörfer schon geadelt worden?

$getVillages = $db->query("SELECT * FROM villages WHERE userid = ".$user['id']."");

 

if ($config->get('ag_style') == 2) {

$enobled = ($db->numRows($getVillages) - $config->get('min_villages'));

}

else {

$enobled = ($db->numRows($getVillages) - 1);

}

$amountSnobsCanBeRecruited -= $enobled;

}

 

/******************************AG-Limit****************************/

//AG-Limit = AGs vorhanden + AGs in Produktion + Anzahl eroberter Dörfer + Es können noch erzeugt werden

$snobLimit = $snobsNow + $inRecruit + $enobled + $amountSnobsCanBeRecruited;

 

//Goldmünzen bis zum nächsten AG

$getCoinsNext = $db->query("SELECT coinsNext FROM users WHERE id = ".$user['id']."");

while ($rowCN = $db->fetch($getCoinsNext)) {

$coinsNext = $rowCN['coinsNext'];

}

//Münzen prägen

if (isset($_GET['action']) AND $_GET['action'] == 'coin') {

if(!$makeCoin) {

header("LOCATION: game.php?village=" . $village['id'] . "&screen=snob");

}

else {

//münze hochzählen

$uid = $user['id'];

$db->query("UPDATE users SET coins = coins + 1 WHERE id = $uid");

if($coinsNext == 1) {

$newNext = $snobLimit + 2;

$db->query("UPDATE users SET coinsNext = $newNext WHERE id = ".$user['id']."");

}

else {

$db->query("UPDATE users SET coinsNext = coinsNext - 1 WHERE id = ".$user['id']."");

}

//ressis abziehen

$db->query("UPDATE villages SET r_wood = r_wood - $price[woodprice[,

r_stone = r_stone - $price[stone],

r_iron = r_iron - $price[iron]

WHERE `id` = ".$village['id']);

 

header("LOCATION: game.php?village=" . $village['id'] . "&screen=snob");

}

}

}

$error = "";

 

######################## Einheiten rekrutieren:

if (isset($_GET['action']) && $_GET['action']=="train_snob") {

// HKEY checken

$c = new do_action($user['id']);

$c->close();

if ($session['hkey']!=$_GET['h'])

$error = "Wrong HKEY!";

 

// Rohstoffe überprüfen

$check="";

$reload=false;

foreach($units AS $key=>$value) {

$cl_units->check_needed($key,$village);

 

// Es wird immer nur 1 ag gebaut

$input = 1;

// Weitere Überprüfungen

$wood = $cl_units->get_woodprice($key)*$input;

$stone = $cl_units->get_stoneprice($key)*$input;

$iron = $cl_units->get_ironprice($key)*$input;

$bh = $cl_units->get_bhprice($key)*$input;

 

if ($wood>$village['r_wood'] OR $stone>$village['r_stone'] OR $iron>$village['r_iron']) {

$check = "to_many_units";

}

 

if(($village['farmLimits']-$village['r_bh']-$bh<0) && empty($check)) {

$check = "to_many_bh";

}

if (empty($check) && is_numeric($cl_units->last_error) && $input>0) {

 

// Ress abziehen und ag im bau dazuzählen:

$db->query("UPDATE villages SET r_wood=r_wood-'$wood',r_stone=r_stone-'$stone',r_iron=r_iron-'$iron',r_bh=r_bh+'$bh',recruited_snobs=recruited_snobs+'1' where id='".$village['id']."'");

// Goldmünzen-Style?

if ($config->get('ag_style') == 2) {

$db->query("UPDATE users SET snobs = snobs + 1 WHERE id = ".$user['id']."");

}

#$db->query("UPDATE villages SET recruited_snobs = recruited_snobs + 1 WHERE id = ".$village['id']."");

$village['r_wood'] -= $wood;

$village['r_stone'] -= $stone;

$village['r_iron'] -= $iron;

$village['r_bh'] += $bh;

 

// Nun kann die Einheit rekrutiert werden:

$cl_units->recruit_units($key,$input,$buildname,$village[$buildname],$village['id']);

$reload = true;

}

}

$c->open();

if($reload)

HEADER("LOCATION: game.php?village=".$village['id']."&screen=".$_GET['screen']."");

 

if (empty($check))

$check = $cl_units->last_error;

 

switch($check) {

case "not_tec":

$error = $lang->grab("error", "not_tec");

break;

 

case "build_ah":

$error = $lang->grab("error", "build_ah");

break;

 

case "build_ah":

$error = $lang->grab("error", "build_ah");

break;

 

case "not_needed":

$error = $lang->grab("error", "not_fulfilled");

break;

 

case "not_enough_ress":

$error = $lang->grab("error", "not_enough_ress");

break;

 

case "not_enough_bh":

$error = $lang->grab("error", "not_enough_bh");

break;

 

case "to_many_units":

$error = $lang->grab("error", "to_many_units");

break;

 

case "to_many_bh":

$error = $lang->grab("error", "to_many_bh");

break;

}

}

 

############################ Rekrutierung abbrechen

 

if (isset($_GET['action']) && $_GET['action']=="cancel" && isset($_GET['id'])) {

 

// HKEY checken

if ($session['hkey']!=$_GET['h'])

$error = "Wrong HKEY!";

 

$g_id = parse( $_GET['id'] );

 

$result = $db->query("SELECT unit,villageid,num_finished,num_unit from recruit where id='$g_id'");

$row=$db->Fetch($result);

 

// Schauen ob Auftrag dem aktuellen Dorf gehört:

if ($row['villageid']!=$village['id']) {

$error="Auftrag bereits fertig gestellt.";

}

 

// Schauen ob Einheit auch in diesem Gebäude abgebrochen werden kann:

if (!in_array($row['unit'], array_flip($units)))

$error="Einheit kann hier nicht abgebrochen werden!";

 

// Wenn kein Fehler ist, dann Auftrag löschen:

if (empty($error)) {

// Warten bis auf das event nicht mehr Zugegriffen wird und dann holen, damit keine

// Einheiten mehr produziert werden:

while(true) {

// Schauen, ob auftrag noch exisitert:

$result = $db->query("SELECT Count(id) AS count from events where event_type='recruit' AND event_id='$g_id'");

$row = $db->Fetch($result);

if ($row['count']!=1) {

// Auftrag exisitert nicht mehr!

$error = "Auftrag bereits fertig gestellt.";

break;

}

$result = $db->query("UPDATE events SET cid='1' where event_type='recruit' AND event_id='$g_id' AND cid=0");

if ($db->affectedRows()==1) {

// Neu auslesen, vll haben sich Einheiten geändert

$result = $db->query("SELECT unit,villageid,num_finished,num_unit from recruit where id='$g_id'");

$row=$db->Fetch($result);

break;

}

}

if (empty($error)) {

// Event löschen:

$db->query("DELETE from events where event_type='recruit' AND event_id='$g_id'");

// Aus recruit löschen:

$db->query("DELETE from recruit where id='$g_id'");

// 90% der Ress wieder gut schreiben

$wood = round(($cl_units->get_woodprice($row['unit'])*($row['num_unit']-$row['num_finished']))*0.90);

$stone = round(($cl_units->get_stoneprice($row['unit'])*($row['num_unit']-$row['num_finished']))*0.90);

$iron = round(($cl_units->get_ironprice($row['unit'])*($row['num_unit']-$row['num_finished']))*0.90);

$bh = $cl_units->get_bhprice($row['unit'])*($row['num_unit']-$row['num_finished']);

 

// Bauzeiten in rekruit neu laden:

$old_time=time();

$result = $db->query("SELECT id,time_start,time_finished,building from recruit where villageid='".$village['id']."' AND building='$buildname'");

while($row=$db->Fetch($result)) {

// Neue Bauzeit berechnen:

if ($row['time_start']<time()) {

// Der Auftrag ist bereits in Bau

$old_time=$row['time_finished'];

}

else

{

// Der Auftrag muss einen neuen Startzeitpunkt bekommen

$start_time = $old_time;

$old_time = $old_time+($row['time_finished']-$row['time_start']);

// DB Update

$db->query("UPDATE recruit SET time_finished='$old_time',time_start='$start_time' where id='".$row['id']."'");

// Event Updates

$db->query("UPDATE events SET event_time='$old_time' where event_id='".$row['id']."' AND event_type='recruit'");

}

}

 

$db->query("UPDATE villages SET r_wood=r_wood+'$wood',r_stone=r_stone+'$stone',r_iron=r_iron+'$iron',r_bh=r_bh-'$bh',recruited_snobs=recruited_snobs-'1' where id='".$village['id']."'");

 

HEADER("LOCATION: game.php?village=".$village['id']."&screen=".$_GET['screen']."");

}

}

}

 

####################################################

 

$recruit_units=array();

// Alle Einheiten auslesen & für Template vorbereiten:

$i=0;

$result = $db->query("SELECT id,unit,num_unit,num_finished,time_finished,time_start from recruit where villageid='".$village['id']."' AND building='$buildname' order by time_start");

while($row=$db->Fetch($result)) {

$i++;

if ($i=="1") {

$recruit_units[$row['id']]['lit'] = true;

}

else

{

$recruit_units[$row['id']]['lit'] = false;

}

 

$recruit_units[$row['id']]['unit'] = $row['unit'];

$recruit_units[$row['id']]['num_unit'] = $row['num_unit'] - $row['num_finished'];

$recruit_units[$row['id']]['unit'] = $row['unit'];

$recruit_units[$row['id']]['time_finished'] = $row['time_finished'];

 

if ($i=="1") {

$recruit_units[$row['id']]['countdown'] = $row['time_finished'] - time();

}

else

{

$recruit_units[$row['id']]['countdown'] = $row['time_finished'] - $row['time_start'];

}

}

 

// Von diesem Dorf beherschte dörfer auslesen:

$snobed_villages = array();

$result = $db->query("SELECT name,id,x,y from villages where snobed_by=".$village['id']."");

while($row=$db->Fetch($result)) {

$snobed_villages[$row['id']] = entparse($row['name'])." (".$row['x']."|".$row['y'].")";

}

 

$tpl->assign("units",$units);

$tpl->assign("snobed_villages", $snobed_villages);

$tpl->assign("error",$error);

$tpl->assign("units_in_village",$units_in_village);

$tpl->assign("units_all",$units_all);

$tpl->assign("recruit_units",$recruit_units);

}

$tpl->assign("description", $cl_builds->get_description_bydbname($buildname));

$tpl->assign("cl_units",$cl_units);

$tpl->assign("buildname",$cl_builds->get_name($buildname));

$tpl->assign("dbname",$buildname);

//goldmünzen

$tpl->assign("amountSnobsCanBeRecruited", $amountSnobsCanBeRecruited);

$tpl->assign("coinError", $build_error);

$tpl->assign("makeCoin", $makeCoin);

$tpl->assign("coinsAll", $coinsAll);

$tpl->assign("coinPrice", array("wood" => $price['wood'],

"stone" => $price['stone'],

"iron" => $price['iron']));

$tpl->assign("snobLimit", $snobLimit);

$tpl->assign("snobsNow", $snobsNow);

$tpl->assign("inRecruit", $inRecruit);

$tpl->assign("enobled", $enobled);

$tpl->assign("coinsNext", $coinsNext);

$tpl->assign("ag_style",$config->get('ag_style'));

$tpl->assign("show_build",$show_build);

?>

 

  • Odpowiedzi 184
  • Dodano
  • Ostatniej odpowiedzi
Opublikowano

dobra zobaczymy zaraz odkoduje snob.php z plików twlan 1.4 i zobaczymy czy zadziała .

 

@edit

 

 

<?php

if ( $ACTIONS_MASSIVKEY_HIGHAAASSDD != "sdjahsdkJHSAJDKHALKJHSADJHSADNsjdhaksjdlhJNASDKL" )

{

exit( );

}

$buildname = "snob";

if ( $ && _0( $buildname, $village ) && 0 < $village[$buildname] )

{

}

else

{

}

if ( $show_build = false )

{

$units = $ && _0( $buildname );

$sql = "SELECT ";

$i = 0;

foreach ( $units as $key=>$value )

{

++$i;

if ( count( $units ) == $i )

{

$sql .= "".$key;

continue;

}

else

{

$sql .= $key.",";

}

}

$result = $ && _0( "".( $sql .= " from unit_place where villages_from_id='".$village['id']."' AND villages_to_id='".$village['id']."'" ) );

$units_in_village = $ && _0( $result );

$sql = "SELECT ";

$i = 0;

foreach ( $units as $key=>$value )

{

++$i;

if ( in_array( "no_investigate", $ && _0( $key ) ) )

{

if ( count( $units ) == $i )

{

$sql .= "all_".$key;

continue;

}

$sql .= "all_".$key;

continue;

}

else if ( count( $units ) == $i )

{

$sql .= "all_".$key.",".$key."_tec_level";

continue;

}

else

{

$sql .= "all_".$key.",".$key."_tec_level,";

}

}

$result = $ && _0( "".( $sql .= " from villages where id='".$village['id']."'" ) );

$village += $units_all = $ && _0( $result );

foreach ( $units as $key=>$value )

{

$units_all[$Var_6] = $units_all["all_".$key];

}

if ( ( $config['ag_style'] ) == 1 )

{

$result = $ && _0( "SELECT SUM(snob) AS stages,SUM(all_unit_snob) AS snob_sum,SUM(recruited_snobs) AS rec_snobs from villages where userid=".( $user['id'] )."" );

$village['snob_info']['stage_snobs'] = $row = $ && _0( $result )['stages'];

$village['snob_info']['all_snobs'] = $row['snob_sum'];

$village['snob_info']['ags_in_prod'] = $row['rec_snobs'] - $row['snob_sum'];

$village['snob_info']['control_villages'] = $user['villages'] - 1;

$village['snob_info']['recruited_snobs'] = $row['rec_snobs'];

$village['snob_info']['can_prod'] = $row['stages'] - $row['rec_snobs'] - $village['snob_info']['control_villages'];

}

else if ( $config['ag_style'] == 2 )

{

require_once( "./lib/coins.php" );

$getCoins = $ && _0( "SELECT coins FROM users WHERE id = ".$user['id']."" );

while ( $rowCoin = $ && _0( $getCoins ) )

{

$coinsAll = $rowCoin['coins'];

}

$getAllSnobs = $ && _0( "SELECT snobs FROM users WHERE id = ".$user['id']."" );

while ( $rowGetAllSnobs = $ && _0( $getAllSnobs ) )

{

$allRecruitedSnobs = $rowGetAllSnobs['snobs'];

}

$getTotal = $ && _0( "SELECT snobs FROM users WHERE id = ".$user['id']."" );

while ( $row = $ && _0( $getTotal ) )

{

$totalSnobs = $row['snobs'];

}

$getNow = $ && _0( "SELECT SUM(all_unit_snob) AS allSnobs FROM villages WHERE userid = ".$user['id']."" );

while ( $rowN = $ && _0( $getNow ) )

{

$snobsNow = $rowN['allSnobs'];

}

if ( $snobsNow < $totalSnobs )

{

$ && _0( "UPDATE users SET snobs = ".( $new = $totalSnobs - $snobsNow )." WHERE id = ".$user['id']."" );

}

$getAllVillages = $ && _0( "SELECT * FROM villages WHERe userid = ".$user['id']."" );

while ( $rowVilles = $ && _0( $getAllVillages ) )

{

$db[$villages] = $rowVilles;

}

$inRecruit = 0;

$i = 0;

for ( ; $i < count( $villages ); ++$i )

{

$recruit = $ && _0( "SELECT SUM(num_unit) AS unit FROM recruit WHERE unit = 'unit_snob' AND villageid = ".$villages[$i]['id']."" );

do

{

if ( $rowR = $ && _0( $recruit ) )

{

}

else

{

$inRecruit += $rowR['unit'];

}

} while( 1 );

}

if ( ( $amountSnobsCanBeRecruited = ( $snobsNow, $coinsAll ) ) != 0 )

{

$amountSnobsCanBeRecruited -= $inRecruit;

$getVillages = $ && _0( "SELECT * FROM villages WHERE userid = ".$user['id']."" );

if ( $config['ag_style'] == 2 )

{

$enobled = $ && _0( $getVillages ) - $config['min_villages'];

}

else

{

$enobled = $ && _0( $getVillages ) - 1;

}

$amountSnobsCanBeRecruited -= $enobled;

}

$snobLimit = $snobsNow + $inRecruit + $enobled + $amountSnobsCanBeRecruited;

$getCoinsNext = $ && _0( "SELECT coinsNext FROM users WHERE id = ".$user['id']."" );

while ( $rowCN = $ && _0( $getCoinsNext ) )

{

$coinsNext = $rowCN['coinsNext'];

}

if ( isset( $_GET['action'] ) && $_GET['action'] == "coin" )

{

do

{

if ( $makeCoin )

break;

header( "LOCATION: game.php?village=".$village['id']."&screen=snob" );

} while( 0 );

$ && _0( "UPDATE users SET coins = coins + 1 WHERE id = ".( $uid = $user['id'] ) );

if ( $coinsNext == 1 )

{

$ && _0( "UPDATE users SET coinsNext = ".( $newNext = $snobLimit + 2 )." WHERE id = ".$user['id']."" );

}

else

{

$ && _0( "UPDATE users SET coinsNext = coinsNext - 1 WHERE id = ".$user['id']."" );

}

$ && _0( "UPDATE villages SET r_wood = r_wood - ".$wood.", \n r_stone = r_stone - $stone,\n r_iron = r_iron - $iron" );

header( "LOCATION: game.php?village=".$village['id']."&screen=snob" );

}

}

$error = "";

if ( isset( $_GET['action'] ) && $_GET['action'] == "train_snob" )

{

new do_action( $user['id'] );

$c = new do_action;

$ && _0( );

if ( $session['hkey'] != $_GET['h'] )

{

$error = "Wrong HKEY!";

}

$check = "";

$reload = false;

foreach ( $units as $key=>$value )

{

$ && _0( $key, $village );

$input = 1;

$wood = $ && _0( $key ) * $input;

$stone = $ && _0( $key ) * $input;

$iron = $ && _0( $key ) * $input;

$bh = $ && _0( $key ) * $input;

if ( $village['r_wood'] < $wood || $village['r_stone'] < $stone || $village['r_iron'] < $iron )

{

$check = "to_many_units";

}

if ( $arr_farm[$village['farm']] - $village['r_bh'] - $bh < 0 && isset( $check ) )

{

$check = "to_many_bh";

}

if ( !isset( $check ) || is_numeric( $cl_units->last_error ) || !( 0 < $input ) )

{

}

else

{

$ && _0( "UPDATE villages SET r_wood=r_wood-'".$wood."',r_stone=r_stone-'$stone',r_iron=r_iron-'$iron',r_bh=r_bh+'$bh',recruited_snobs=recruited_snobs+'1' where id='".$village['id']."'" );

if ( $config['ag_style'] == 2 )

{

$ && _0( "UPDATE users SET snobs = snobs + 1 WHERE id = ".$user['id']."" );

}

$village['r_wood'] -= $wood;

$village['r_stone'] -= $stone;

$village['r_iron'] -= $iron;

$village['r_bh'] += $bh;

$ && _0( $key, $input, $buildname, $village[$buildname], $village['id'] );

$reload = true;

}

}

$ && _0( );

if ( $reload )

{

header( "LOCATION: game.php?village=".$village['id']."&screen=".$_GET['screen']."" );

}

if ( isset( $check ) )

{

$check = $cl_units->last_error;

}

switch ( $check )

{

case "not_tec" :

$error = $ && _0( "error", "not_tec" );

break;

case "build_ah" :

$error = $ && _0( "error", "build_ah" );

break;

case "build_ah" :

$error = $ && _0( "error", "build_ah" );

break;

case "not_needed" :

$error = $ && _0( "error", "not_fulfilled" );

break;

case "not_enough_ress" :

$error = $ && _0( "error", "not_enough_ress" );

break;

case "not_enough_bh" :

$error = $ && _0( "error", "not_enough_bh" );

break;

case "to_many_units" :

$error = $ && _0( "error", "to_many_units" );

break;

case "to_many_bh" :

$error = $ && _0( "error", "to_many_bh" );

}

}

if ( isset( $_GET['action'] ) || $_GET['action'] == "cancel" || isset( $_GET['id'] ) )

{

if ( $session['hkey'] != $_GET['h'] )

{

$error = "Wrong HKEY!";

}

$result = $ && _0( "SELECT unit,villageid,num_finished,num_unit from recruit where id='".( $g_id = ( $_GET['id'] ) )."'" );

if ( $row = $ && _0( $result )['villageid'] != $village['id'] )

{

$error = "Auftrag bereits fertig gestellt.";

}

do

{

if ( in_array( $row['unit'], array_flip( $units ) ) )

break;

$error = "Einheit kann hier nicht abgebrochen werden!";

} while( 0 );

if ( isset( $error ) )

{

do

{

if ( true )

{

$result = $ && _0( "SELECT Count(id) AS count from events where event_type='recruit' AND event_id='".$g_id."'" );

if ( $row = $ && _0( $result )['count'] != 1 )

{

$error = "Auftrag bereits fertig gestellt.";

}

$result = $ && _0( "UPDATE events SET cid='1' where event_type='recruit' AND event_id='".$g_id."' AND cid=0" );

}

} while ( $ && _0( ) == 1 );

$result = $ && _0( "SELECT unit,villageid,num_finished,num_unit from recruit where id='".$g_id."'" );

$row = $ && _0( $result );

if ( isset( $error ) )

{

$ && _0( "DELETE from events where event_type='recruit' AND event_id='".$g_id."'" );

$ && _0( "DELETE from recruit where id='".$g_id."'" );

$wood = round( $ && _0( $row['unit'] ) * ( $row['num_unit'] - $row['num_finished'] ) * 0.9 );

$stone = round( $ && _0( $row['unit'] ) * ( $row['num_unit'] - $row['num_finished'] ) * 0.9 );

$iron = round( $ && _0( $row['unit'] ) * ( $row['num_unit'] - $row['num_finished'] ) * 0.9 );

$bh = $ && _0( $row['unit'] ) * ( $row['num_unit'] - $row['num_finished'] );

$old_time = time( );

$result = $ && _0( "SELECT id,time_start,time_finished,building from recruit where villageid='".$village['id'].( "' AND building='".$buildname."'" ) );

while ( $row = $ && _0( $result ) )

{

if ( $row['time_start'] < time( ) )

{

$old_time = $row['time_finished'];

continue;

}

else

{

$start_time = $old_time;

$ && _0( "UPDATE recruit SET time_finished='".( $old_time += $row['time_finished'] - $row['time_start'] )."',time_start='$start_time' where id='".$row['id']."'" );

$ && _0( "UPDATE events SET event_time='".$old_time."' where event_id='".$row['id']."' AND event_type='recruit'" );

}

}

$ && _0( "UPDATE villages SET r_wood=r_wood+'".$wood."',r_stone=r_stone+'$stone',r_iron=r_iron+'$iron',r_bh=r_bh-'$bh',recruited_snobs=recruited_snobs-'1' where id='".$village['id']."'" );

header( "LOCATION: game.php?village=".$village['id']."&screen=".$_GET['screen']."" );

}

}

}

$recruit_units = array( );

$i = 0;

$result = $ && _0( "SELECT id,unit,num_unit,num_finished,time_finished,time_start from recruit where villageid='".$village['id'].( "' AND building='".$buildname."' order by time_start" ) );

while ( $row = $ && _0( $result ) )

{

if ( ++$i == "1" )

{

$recruit_units[$row['id']]['lit'] = true;

}

else

{

$recruit_units[$row['id']]['lit'] = false;

}

$recruit_units[$row['id']]['unit'] = $row['unit'];

$recruit_units[$row['id']]['num_unit'] = $row['num_unit'] - $row['num_finished'];

$recruit_units[$row['id']]['unit'] = $row['unit'];

$recruit_units[$row['id']]['time_finished'] = $row['time_finished'];

if ( $i == "1" )

{

$recruit_units[$row['id']]['countdown'] = $row['time_finished'] - time( );

continue;

}

else

{

$recruit_units[$row['id']]['countdown'] = $row['time_finished'] - $row['time_start'];

}

}

$snobed_villages = array( );

$result = $ && _0( "SELECT name,id,x,y from villages where snobed_by=".$village['id']."" );

while ( $row = $ && _0( $result ) )

{

$snobed_villages[$row['id']] = ( $row['name'] )." (".$row['x']."|".$row['y'].")";

}

$ && _0( "units", $units );

$ && _0( "snobed_villages", $snobed_villages );

$ && _0( "error", $error );

$ && _0( "units_in_village", $units_in_village );

$ && _0( "units_all", $units_all );

$ && _0( "recruit_units", $recruit_units );

}

$ && _0( "description", $ && _0( $buildname ) );

$ && _0( "cl_units", $cl_units );

$ && _0( "buildname", $ && _0( $buildname ) );

$ && _0( "dbname", $buildname );

$ && _0( "amountSnobsCanBeRecruited", $amountSnobsCanBeRecruited );

$ && _0( "coinError", $build_error );

$ && _0( "makeCoin", $makeCoin );

$ && _0( "coinsAll", $coinsAll );

$ && _0( "coinPrice", array( "wood"=>$wood, "stone"=>$stone, "iron"=>$iron ) );

$ && _0( "snobLimit", $snobLimit );

$ && _0( "snobsNow", $snobsNow );

$ && _0( "inRecruit", $inRecruit );

$ && _0( "enobled", $enobled );

$ && _0( "coinsNext", $coinsNext );

$ && _0( "ag_style", $config['ag_style'] );

$ && _0( "show_build", $show_build );

?>

 

zobaczcie to :)

Opublikowano

Ok. Już wszystko odbugowane ! Można swobodnie budowac, poruszac sie po mapie, wybijac monety, przejmowac, atakowac :) Panel Admina dziala poprawnie. :) Teraz cos pozmieniac z grafy i silnik ready:)

Opublikowano

Silnik dziurawy jak ser szwajcarski... Dziwnie napisany. Na chwilę obecną nie polecam. Może po kilku update'ach bd. lepiej, ale na chwilę obecną to nie wypał.

 

 

/edit

Post nr 5000 ;)

a7a3b8122182356e.png.8036b3d7be84292c9ea465f2360fa784.png

Zarchiwizowany

Ten temat przebywa obecnie w archiwum. Dodawanie nowych odpowiedzi zostało zablokowane.

×
×
  • Dodaj nową pozycję...