[Release]Comprare truppe con i gold per Travianx/Z

Stato
Discussione chiusa ad ulteriori risposte.

Roky2

Utente Electrum
23 Agosto 2012
181
21
11
107
Ultima modifica da un moderatore:
Grazie a questo script i giocatori potranno comprare le truppe con i gold direttamente dalla caserma
N.B.
QUESTO SCRIPT NON E' STATO CREATO DA ME
Andate in Templates/build/19.tpl cancellate tutto e incollateci questo
PHP:
<?php 
////////////////////////////////// 
////// Edit By: Eyas95 /////////// 
////////////////////////////////// 

$maxtroops = 2; 

$sql = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE id  = '".$session->uid."'")or die('You have not trained a hero yet'); 
while($row = mysql_fetch_array($sql)){ 
$tribe = $row["tribe"]; 
$gold = $row["gold"]; 
}; 
     


if (isset($_POST['clubtrain'])) { 
$ammount = $_POST['tr1'] * $maxtroops; 
$ammountb = $_POST['tr1'] / $maxtroops; 

if ($ammount < $gold){ 

} 

mysql_query("UPDATE ".TB_PREFIX."users SET `gold` = `gold` - ".$_POST['tr1']." WHERE id ='".$session->uid."'")or die(mysql_error()); 
mysql_query("UPDATE ".TB_PREFIX."units SET `u11` = $ammount + `u11` WHERE vref ='".$village->wid."'")or die(mysql_error());  

} 



if (isset($_POST['legotrain'])) { 
$ammount = $_POST['tr2'] * $maxtroops; 
$ammountb = $_POST['tr2'] / $maxtroops; 

if ($ammount < $gold){ 

} 

mysql_query("UPDATE ".TB_PREFIX."users SET `gold` = `gold` - ".$_POST['tr2']." WHERE id ='".$session->uid."'")or die(mysql_error()); 
mysql_query("UPDATE ".TB_PREFIX."units SET `u1` = $ammount + `u1` WHERE vref ='".$village->wid."'")or die(mysql_error());  

} 



if (isset($_POST['phatrain'])) { 
$ammount = $_POST['tr3'] * $maxtroops; 
$ammountb = $_POST['tr3'] / $maxtroops; 

if ($ammount < $gold){ 

} 

mysql_query("UPDATE ".TB_PREFIX."users SET `gold` = `gold` - ".$_POST['tr3']." WHERE id ='".$session->uid."'")or die(mysql_error()); 
mysql_query("UPDATE ".TB_PREFIX."units SET `u21` = $ammount + `u21` WHERE vref ='".$village->wid."'")or die(mysql_error());  

} 


//////////////////////////////////////////////////////////////////// 
/////////The End of PHP code for buying troops////////////////////// 
//////////////////////////////////////////////////////////////////// 

?> 






<div id="build" class="gid19"><a href="#" onClick="return Popup(19,4);" class="build_logo"> 
    <img class="building g19" src="img/x.gif" alt="Barracks" title="Barracks" /> 
</a> 
<h1>Barracks <span class="level">level <?php echo $village->resarray['f'.$id]; ?></span></h1> 
<p class="build_desc">All foot soldiers are trained in the barracks. The higher the level of the barracks, the faster the troops are trained.</p> 

<?php if ($building->getTypeLevel(19) > 0) { ?> 
<form method="POST" name="snd" action="build.php"> 
                <input type="hidden" name="id" value="<?php echo $id; ?>" /> 
                <input type="hidden" name="ft" value="t1" /> 
                <table cellpadding="1" cellspacing="1" class="build_details"> 
                <thead><tr> 
                    <td>Name</td> 
                    <td>Quantity</td> 
                    <td>Max</td> 
                </tr></thead><tbody> 
                 
                <?php 
                    include("19_train.tpl"); 
                ?></table> 
    <p><input type="image" id="btn_train" class="dynamic_img" value="ok" name="s1" src="img/x.gif" alt="train" onclick="this.disabled=true;this.form.submit();"/></form></p> 
     
     
     
     
     
    <?php 
////////////////////////////////// 
///////Troops buying template////// 
////////////////////////////////// 
    $sql = mysql_query("SELECT * FROM ".TB_PREFIX."users WHERE id  = '".$session->uid."'")or die('You have not trained a hero yet'); 
while($row = mysql_fetch_array($sql)){ 
$tribe = $row["tribe"]; 
$gold = $row["gold"]; 
}; 
    if ($tribe == 2){ 
    ?> 
     
    <h1> Buy troops </h1> 
    <form method="POST" name="teutonsbuy"> 
                <input type="hidden" name="id" value="33"> 
                <input type="hidden" name="ft" value="t1"> 
                <table cellpadding="1" cellspacing="1" class="build_details"> 
                <thead><tr> 
                    <td>Name</td> 
                    <td>Quantity</td> 
                    <td>Max</td> 
                </tr></thead><tbody> 
                 
                <tr><td class="desc"> 
<div class="tut"> 
<img class="unit u11" src="img/un/u/11.gif" alt="Clubswinger" title="Clubswinger"> 
<a>Clubswinger</a> <span class="info"></span> 
</div> 
<div class="details"> 
<img class="gold" src="gpack/travian_default/img/a/gold.gif" alt="gold" title="Gold">1 = 2<img class="unit 11" src="img/un/u/11.gif" alt="Clubswinger" title="Clubswinger"></div> 
</td> 
<td class="val"><input type="text" class="text" name="tr1" value="0" maxlength="100"></td> 
<td class="max"><?php $max = $gold * $maxtroops; ?> (<?php echo $max; ?>)</a></td></tr></tbody></table> 
    <p> <input type="submit" name="clubtrain" value="Buy Troops"></form><p></p> 

    <?php 
     
    } 
     
     
    ?> 
     
     
     
     
    <?php 
     
     
    if ($tribe == 1){ 
    ?> 
     
    <h1> Buy troops </h1> 
    <form method="POST" name="teutonsbuy"> 
                <input type="hidden" name="id" value="33"> 
                <input type="hidden" name="ft" value="t1"> 
                <table cellpadding="1" cellspacing="1" class="build_details"> 
                <thead><tr> 
                    <td>Name</td> 
                    <td>Quantity</td> 
                    <td>Max</td> 
                </tr></thead><tbody> 
                 
                <tr><td class="desc"> 
<div class="tut"> 
<img class="unit u1" src="img/un/u/1.gif" alt="Legionnaire" title="Legionnaire"> 
<a>Legionnaire</a> <span class="info"></span> 
</div> 
<div class="details"> 
<img class="gold" src="gpack/travian_default/img/a/gold.gif" alt="gold" title="Gold">1 = 2<img class="unit 11" src="img/un/u/1.gif" alt="Legionnaire" title="Legionnaire"></div> 
</td> 
<td class="val"><input type="text" class="text" name="tr2" value="0" maxlength="100"></td> 
<td class="max"><?php $max = $gold * $maxtroops; ?> (<?php echo $max; ?>)</a></td></tr></tbody></table> 
    <p> <input type="submit" name="legotrain" value="Buy Troops"></form><p></p> 

    <?php 
     
    } 
     
     
    ?> 
     
    <?php 
     
     
    if ($tribe == 3){ 
    ?> 
     
    <h1> Buy troops </h1> 
    <form method="POST" name="teutonsbuy"> 
                <input type="hidden" name="id" value="33"> 
                <input type="hidden" name="ft" value="t1"> 
                <table cellpadding="1" cellspacing="1" class="build_details"> 
                <thead><tr> 
                    <td>Name</td> 
                    <td>Quantity</td> 
                    <td>Max</td> 
                </tr></thead><tbody> 
                 
                <tr><td class="desc"> 
<div class="tut"> 
<img class="unit u21" src="img/un/u/21.gif" alt="phalanx" title="phalanx"> 
<a>Phalanx</a> <span class="info"></span> 
</div> 
<div class="details"> 
<img class="gold" src="gpack/travian_default/img/a/gold.gif" alt="gold" title="Gold">1 = 2<img class="unit 21" src="img/un/u/21.gif" alt="phalanx" title="phalanx"></div> 
</td> 
<td class="val"><input type="text" class="text" name="tr3" value="0" maxlength="100"></td> 
<td class="max"><?php $max = $gold * $maxtroops; ?> (<?php echo $max; ?>)</a></td></tr></tbody></table> 
    <p> <input type="submit" name="phatrain" value="Buy Troops"></form><p></p> 

    <?php 
     
    } 
     
/////////////////////////////////////////// 
///////End of Troops buying template////// 
///////////////////////////////////////// 
     
    ?> 
     
     

     
    <?php 
    } else { 
        echo "<b>Training can commence when barracks are completed.</b><br>\n"; 
    } 
    $trainlist = $technology->getTrainingList(1); 
    if(count($trainlist) > 0) { 
    //$timer = 2*count($trainlist); 
        echo " 
    <table cellpadding=\"1\" cellspacing=\"1\" class=\"under_progress\"> 
        <thead><tr> 
            <td>Training</td> 
            <td>Duration</td> 
            <td>Finished</td> 
        </tr></thead> 
        <tbody>"; 
        $TrainCount = 0; 
        foreach($trainlist as $train) { 
            $TrainCount++; 
            echo "<tr><td class=\"desc\">"; 
            echo "<img class=\"unit u".$train['unit']."\" src=\"img/x.gif\" alt=\"".$train['name']."\" title=\"".$train['name']."\" />"; 
            echo $train['amt']." ".$train['name']."</td><td class=\"dur\">"; 
            if ($TrainCount == 1 ) { 
                $NextFinished = $generator->getTimeFormat(($train['commence']+$train['eachtime'])-time()); 
                echo "<span id=timer1>".$generator->getTimeFormat(($train['commence']+($train['eachtime']*$train['amt']))-time())."</span>"; 
            } else { 
                echo $generator->getTimeFormat($train['eachtime']*$train['amt']); 
            } 
            echo "</td><td class=\"fin\">"; 
            $time = $generator->procMTime($train['commence']+($train['eachtime']*$train['amt'])); 
            if($time[0] != "today") { 
                echo "on ".$time[0]." at "; 
            } 
            echo $time[1]; 
        } ?> 
        </tr><tr class="next"><td colspan="3">The next unit will be finished in <span id="timer2"><?php echo $NextFinished; ?></span></td></tr> 
        </tbody></table> 
    <?php } 
include("upgrade.tpl"); 
?> 
</p></div>
La variabile $maxtroop contiene il numero di truppe che potete comprare con un gold es. se la variabile è due con 1 gold comprate 2 truppe. Potete comprare solo la prima truppa per tribù es. se siete romani comprerete solo legionari,se siete galli comprerete solo falangi e se siete teutoni comprerete solo combattenti.
TESTATO E FUNZIONANTE AL 100%
Fonte: Ragezone
 
puoi fare una guida tipo questa che però la metti nei plus tipo ce una coda di 5000000 mazze! tu con 2 gold la completi! :D si puo fare?
 
Cioè vorresti completare una parte di coda?
Non c'è una release ma sò che è già stato progettato, non in base alle truppe che sarebbe un casino ma un tot di ore...
Lo odio questo completamento ma non mi sembra difficile da fare ^^

- - - Updated - - -

puoi fare una guida tipo questa che però la metti nei plus tipo ce una coda di 5000000 mazze! tu con 2 gold la completi! :D si puo fare?
Cioè vorresti completare una parte di coda?
Non c'è una release ma sò che è già stato progettato, non in base alle truppe che sarebbe un casino ma un tot di ore...
Lo odio questo completamento ma non mi sembra difficile da fare ^^
 
si esatto quello li! :D :p
per caso sai se ci sono dei file dboor 100% decodificati? che non ci sia bisogno di inocube?
 
Stato
Discussione chiusa ad ulteriori risposte.