Jump to content

orsino

Members
  • Content Count

    99
  • Joined

  • Last visited

Posts posted by orsino


  1. hey 

    i have this line in my daily cron 

    $db->query("UPDATE `users` SET `steps`=`steps`= 100 WHERE `steps` < 100");

     

    so steps in users schould get 100 each day 

    but the line doesnt work 

    did i overlook something ?  or is it sql related ? 

     

    sql is  steps int11 unsigned 

     


  2. so i fixed the bug 

    i moved the line given by KylleMassacre 

    now the only thing i need is the images in equiped items

    <?php
    require("globals.php");
    
    
    echo "<h3>Your Equipment</h3><hr />
    <div class='row'>
    	<div class='col-sm-4'>
    		<div class='card'>
    			<div class='card-header'>
    				Primary Weapon ";
    if (!empty($ir['equip_primary'])) {
        echo "(<a href='unequip.php?type=equip_primary'>Unequip</a>)";
    }
    echo "
    			</div>
    			<div class='card-body'>";
    if (!empty($ir['equip_primary'])) {
        echo $api->SystemItemIDtoName($ir['equip_primary']);
    } else {
        echo "No Weapon";
    }
    echo "
    			</div>
    		</div>
    	</div>";
    echo "
    	<div class='col-sm-4'>
    		<div class='card'>
    			<div class='card-header'>
    				Secondary Weapon ";
    if (!empty($ir['equip_secondary'])) {
        echo "(<a href='unequip.php?type=equip_secondary'>Unequip</a>)";
    }
    echo "
    			</div>
    			<div class='card-body'>";
    if (!empty($ir['equip_secondary'])) {
        echo $api->SystemItemIDtoName($ir['equip_secondary']);
    } else {
        echo "No Weapon";
    }
    echo "
    			</div>
    		</div>
    	</div>";
    echo "
    	<div class='col-sm-4'>
    		<div class='card'>
    			<div class='card-header'>
    				Armor ";
    if (!empty($ir['equip_armor'])) {
        echo "(<a href='unequip.php?type=equip_armor'>Unequip</a>)";
    }
    echo "
    			</div>
    			<div class='card-body'>";
    if (!empty($ir['equip_armor'])) {
        echo $api->SystemItemIDtoName($ir['equip_armor']);
    } else {
        echo "No Armor";
    }
    echo "
    			</div>
    		</div>
    	</div>
    </div><br/>";
    echo "<div class='row'>
    <div class='col-sm-4'>
    		<div class='card'>
    			<div class='card-header'>
    				Pet ";
    if (!empty($ir['equip_pet'])) {
        echo "(<a href='unequip.php?type=equip_pet'>Unequip</a>)";
    }
    echo "
    			</div>
    			<div class='card-body'>";
    if (!empty($ir['equip_pet'])) {
        echo $api->SystemItemIDtoName($ir['equip_pet']);
    } else {
        echo "No pet";
    }
    echo "
    			</div>
    		</div>
    	</div>";
    echo "<div class='col-sm-4'>
    		<div class='card'>
    			<div class='card-header'>
    				Head ";
    if (!empty($ir['equip_head'])) {
        echo "(<a href='unequip.php?type=equip_head'>Unequip</a>)";
    }
    echo "
    			</div>
    			<div class='card-body'>";
    if (!empty($ir['equip_head'])) {
        echo $api->SystemItemIDtoName($ir['equip_head']);
    } else {
        echo "No head";
    }
    echo "
    			</div>
    		</div>
                 </div>
    	</div>";
    echo "<hr />
    <h3>Your Inventory</h3><hr />";
    $inv =
        $db->query(
            "SELECT `inv_qty`, `itmsellprice`, `itmid`, `inv_id`,
                     `effect1_on`, `effect2_on`, `effect3_on`,
                     `weapon`, `armor`, `pet`, `head`, `itmtypename`, `itmdesc`, `itmpic`
                     FROM `inventory` AS `iv`
                     INNER JOIN `items` AS `i`
                     ON `iv`.`inv_itemid` = `i`.`itmid`
                     INNER JOIN `itemtypes` AS `it`
                     ON `i`.`itmtype` = `it`.`itmtypeid`
                     WHERE `iv`.`inv_userid` = {$userid}
                     ORDER BY `i`.`itmtype` ASC, `i`.`itmname` ASC");
    echo "<b>Your items are listed below.</b><br />
    	<table class='table table-bordered table-striped'>
    	    <thead>
    		<tr>
                            <th>Item Img</th>
    			<th>Item (Qty)</th>
    			<th class='hidden-xs-down'>Item Cost (Total)</th>
    			<th>Links</th>
    		</tr></thead>";
    $lt = "";
    while ($i = $db->fetch_row($inv)) {
        if ($lt != $i['itmtypename']) {
            $lt = $i['itmtypename'];
            echo "\n<thead><tr>
                			<th colspan='4'>
                				<b>{$lt}</b>
                			</th>
                		</tr></thead>";
        }
        $i['itmdesc'] = htmlentities($i['itmdesc'], ENT_QUOTES);
    $itmpic = ($i['itmpic']) ? "<img src='{$i['itmpic']}' class='thumbnail' style='background-color: transparent;' width='50px' height='50px'>" : '';
        echo "<tr>
       <td>     	
    {$itmpic}
    </td>	
    <td>
    					<a href='iteminfo.php?ID={$i['itmid']}' data-toggle='tooltip' data-placement='right' title='{$i['itmdesc']}'>
    						{$api->SystemItemIDtoName($i['itmid'])}
                                                       
    					</a>";
        if ($i['inv_qty'] > 1) {
            echo " (" . number_format($i['inv_qty']) . ")";
        }
        echo "</td>
            	  <td class='hidden-xs-down'>" . number_format($i['itmsellprice']);
        echo "  (" . number_format($i['itmsellprice'] * $i['inv_qty']) . ")";
        echo "</td>
            	  <td>
            	  	[<a href='itemsend.php?ID={$i['inv_id']}'>Send</a>]
            	  	[<a href='itemsell.php?ID={$i['inv_id']}'>Sell</a>]";
        if ($i['effect1_on'] == 'true' || $i['effect2_on'] == 'true' || $i['effect3_on'] == 'true') {
            echo " [<a href='itemuse.php?item={$i['inv_id']}'>Use</a>]";
        }
        if ($i['weapon'] > 0) {
            echo " [<a href='equip.php?slot=weapon&ID={$i['inv_id']}'>Equip Weapon</a>]";
        }
        if ($i['armor'] > 0) {
            echo " [<a href='equip.php?slot=armor&ID={$i['inv_id']}'>Equip armor</a>]";
        }
        if ($i['pet'] > 0) {
            echo " [<a href='equip.php?slot=pet&ID={$i['inv_id']}'>Equip pet</a>]";
        }
        if ($i['head'] > 0) {
            echo " [<a href='equip.php?slot=head&ID={$i['inv_id']}'>Equip head</a>]";
        }
        echo "</td>
            </tr>";
    }
    echo "</table>";
    $db->free_result($inv);
    $h->endpage();

     


  3. this changed something indeed 

    only now it shows the 1 img of that images type 

    i will see into the code you gave to see the changes as i want to learn what i did wrong and maybe i can work from there on further 


  4. so i did like you said ( thx alot for your help )

    bug is still there 

     

    <?php
    require("globals.php");
    
    
    echo "<h3>Your Equipment</h3><hr />
    <div class='row'>
    	<div class='col-sm-4'>
    		<div class='card'>
    			<div class='card-header'>
    				Primary Weapon ";
    if (!empty($ir['equip_primary'])) {
        echo "(<a href='unequip.php?type=equip_primary'>Unequip</a>)";
    }
    echo "
    			</div>
    			<div class='card-body'>";
    if (!empty($ir['equip_primary'])) {
        echo $api->SystemItemIDtoName($ir['equip_primary']);
    } else {
        echo "No Weapon";
    }
    echo "
    			</div>
    		</div>
    	</div>";
    echo "
    	<div class='col-sm-4'>
    		<div class='card'>
    			<div class='card-header'>
    				Secondary Weapon ";
    if (!empty($ir['equip_secondary'])) {
        echo "(<a href='unequip.php?type=equip_secondary'>Unequip</a>)";
    }
    echo "
    			</div>
    			<div class='card-body'>";
    if (!empty($ir['equip_secondary'])) {
        echo $api->SystemItemIDtoName($ir['equip_secondary']);
    } else {
        echo "No Weapon";
    }
    echo "
    			</div>
    		</div>
    	</div>";
    echo "
    	<div class='col-sm-4'>
    		<div class='card'>
    			<div class='card-header'>
    				Armor ";
    if (!empty($ir['equip_armor'])) {
        echo "(<a href='unequip.php?type=equip_armor'>Unequip</a>)";
    }
    echo "
    			</div>
    			<div class='card-body'>";
    if (!empty($ir['equip_armor'])) {
        echo $api->SystemItemIDtoName($ir['equip_armor']);
    } else {
        echo "No Armor";
    }
    echo "
    			</div>
    		</div>
    	</div>
    </div><br/>";
    echo "<div class='row'>
    <div class='col-sm-4'>
    		<div class='card'>
    			<div class='card-header'>
    				Pet ";
    if (!empty($ir['equip_pet'])) {
        echo "(<a href='unequip.php?type=equip_pet'>Unequip</a>)";
    }
    echo "
    			</div>
    			<div class='card-body'>";
    if (!empty($ir['equip_pet'])) {
        echo $api->SystemItemIDtoName($ir['equip_pet']);
    } else {
        echo "No pet";
    }
    echo "
    			</div>
    		</div>
    	</div>";
    echo "<div class='col-sm-4'>
    		<div class='card'>
    			<div class='card-header'>
    				Head ";
    if (!empty($ir['equip_head'])) {
        echo "(<a href='unequip.php?type=equip_head'>Unequip</a>)";
    }
    echo "
    			</div>
    			<div class='card-body'>";
    if (!empty($ir['equip_head'])) {
        echo $api->SystemItemIDtoName($ir['equip_head']);
    } else {
        echo "No head";
    }
    echo "
    			</div>
    		</div>
                 </div>
    	</div>";
    echo "<hr />
    <h3>Your Inventory</h3><hr />";
    $inv =
        $db->query(
            "SELECT `inv_qty`, `itmsellprice`, `itmid`, `inv_id`,
                     `effect1_on`, `effect2_on`, `effect3_on`,
                     `weapon`, `armor`, `pet`, `head`, `itmtypename`, `itmdesc`, `itmpic`
                     FROM `inventory` AS `iv`
                     INNER JOIN `items` AS `i`
                     ON `iv`.`inv_itemid` = `i`.`itmid`
                     INNER JOIN `itemtypes` AS `it`
                     ON `i`.`itmtype` = `it`.`itmtypeid`
                     WHERE `iv`.`inv_userid` = {$userid}
                     ORDER BY `i`.`itmtype` ASC, `i`.`itmname` ASC");
            $id = $db->fetch_row($inv);
    echo "<b>Your items are listed below.</b><br />
    	<table class='table table-bordered table-striped'>
    	    <thead>
    		<tr>
                            <th>Item Img</th>
    			<th>Item (Qty)</th>
    			<th class='hidden-xs-down'>Item Cost (Total)</th>
    			<th>Links</th>
    		</tr></thead>";
    $lt = "";
    while ($i = $db->fetch_row($inv)) {
        if ($lt != $i['itmtypename']) {
            $lt = $i['itmtypename'];
    $itmpic = ($id['itmpic']) ? "<img src='{$id['itmpic']}' class='thumbnail' style='background-color: transparent width='50' height='50'>" : '';
            echo "\n<thead><tr>
                			<th colspan='4'>
                				<b>{$lt}</b>
                			</th>
                		</tr></thead>";
        }
        $i['itmdesc'] = htmlentities($i['itmdesc'], ENT_QUOTES);
        echo "<tr>
       <td>     	
    {$itmpic}
    </td>	
    <td>
    					<a href='iteminfo.php?ID={$i['itmid']}' data-toggle='tooltip' data-placement='right' title='{$i['itmdesc']}'>
    						{$api->SystemItemIDtoName($i['itmid'])}
                                                       
    					</a>";
        if ($i['inv_qty'] > 1) {
            echo " (" . number_format($i['inv_qty']) . ")";
        }
        echo "</td>
            	  <td class='hidden-xs-down'>" . number_format($i['itmsellprice']);
        echo "  (" . number_format($i['itmsellprice'] * $i['inv_qty']) . ")";
        echo "</td>
            	  <td>
            	  	[<a href='itemsend.php?ID={$i['inv_id']}'>Send</a>]
            	  	[<a href='itemsell.php?ID={$i['inv_id']}'>Sell</a>]";
        if ($i['effect1_on'] == 'true' || $i['effect2_on'] == 'true' || $i['effect3_on'] == 'true') {
            echo " [<a href='itemuse.php?item={$i['inv_id']}'>Use</a>]";
        }
        if ($i['weapon'] > 0) {
            echo " [<a href='equip.php?slot=weapon&ID={$i['inv_id']}'>Equip Weapon</a>]";
        }
        if ($i['armor'] > 0) {
            echo " [<a href='equip.php?slot=armor&ID={$i['inv_id']}'>Equip armor</a>]";
        }
        if ($i['pet'] > 0) {
            echo " [<a href='equip.php?slot=pet&ID={$i['inv_id']}'>Equip pet</a>]";
        }
        if ($i['head'] > 0) {
            echo " [<a href='equip.php?slot=head&ID={$i['inv_id']}'>Equip head</a>]";
        }
        echo "</td>
            </tr>";
    }
    echo "</table>";
    $db->free_result($inv);
    $h->endpage();

     


  5. On 1/24/2020 at 1:01 PM, KingKong said:
    $inv =
        $db->query(
            "SELECT `inv_qty`, `itmsellprice`, `itmid`, `inv_id`,
                     `effect1_on`, `effect2_on`, `effect3_on`,
                     `weapon`, `armor`, `pet`, `head`, `itmtypename`, `itmdesc`, `itmpic`
                     FROM `inventory` AS `iv`
                     INNER JOIN `items` AS `i`
                     ON `iv`.`inv_itemid` = `i`.`itmid`
                     INNER JOIN `itemtypes` AS `it`
                     ON `i`.`itmtype` = `it`.`itmtypeid`
                     WHERE `iv`.`inv_userid` = {$userid}
                     ORDER BY `i`.`itmtype` ASC, `i`.`itmname` ASC");
            $id = $db->fetch_row($inv); 
    

    //this is getting the img url so it should work if he fixes his markup 

     

    can you help me on that please

     


  6. hello   i need some help on my inventory page 

    im trying to get img of the items on my inventory page 

     

    all items already have images  and in iteminfo they can already see the images 

     

    on this inventory page in code below  i need2 changes 

    1 showing img on equiped items 

    2 bug fix on img showing 

    the bug is that the page only shows the img of the first item i have in inventory 

    and repeats showing the img of item 1 in inventory 

     

    <?php
    require("globals.php");
    
    
    echo "<h3>Your Equipment</h3><hr />
    <div class='row'>
    	<div class='col-sm-4'>
    		<div class='card'>
    			<div class='card-header'>
    				Primary Weapon ";
    if (!empty($ir['equip_primary'])) {
        echo "(<a href='unequip.php?type=equip_primary'>Unequip</a>)";
    }
    echo "
    			</div>
    			<div class='card-body'>";
    if (!empty($ir['equip_primary'])) {
        echo $api->SystemItemIDtoName($ir['equip_primary']);
    } else {
        echo "No Weapon";
    }
    echo "
    			</div>
    		</div>
    	</div>";
    echo "
    	<div class='col-sm-4'>
    		<div class='card'>
    			<div class='card-header'>
    				Secondary Weapon ";
    if (!empty($ir['equip_secondary'])) {
        echo "(<a href='unequip.php?type=equip_secondary'>Unequip</a>)";
    }
    echo "
    			</div>
    			<div class='card-body'>";
    if (!empty($ir['equip_secondary'])) {
        echo $api->SystemItemIDtoName($ir['equip_secondary']);
    } else {
        echo "No Weapon";
    }
    echo "
    			</div>
    		</div>
    	</div>";
    echo "
    	<div class='col-sm-4'>
    		<div class='card'>
    			<div class='card-header'>
    				Armor ";
    if (!empty($ir['equip_armor'])) {
        echo "(<a href='unequip.php?type=equip_armor'>Unequip</a>)";
    }
    echo "
    			</div>
    			<div class='card-body'>";
    if (!empty($ir['equip_armor'])) {
        echo $api->SystemItemIDtoName($ir['equip_armor']);
    } else {
        echo "No Armor";
    }
    echo "
    			</div>
    		</div>
    	</div>
    </div><br/>";
    echo "<div class='row'>
    <div class='col-sm-4'>
    		<div class='card'>
    			<div class='card-header'>
    				Pet ";
    if (!empty($ir['equip_pet'])) {
        echo "(<a href='unequip.php?type=equip_pet'>Unequip</a>)";
    }
    echo "
    			</div>
    			<div class='card-body'>";
    if (!empty($ir['equip_pet'])) {
        echo $api->SystemItemIDtoName($ir['equip_pet']);
    } else {
        echo "No pet";
    }
    echo "
    			</div>
    		</div>
    	</div>";
    echo "<div class='col-sm-4'>
    		<div class='card'>
    			<div class='card-header'>
    				Head ";
    if (!empty($ir['equip_head'])) {
        echo "(<a href='unequip.php?type=equip_head'>Unequip</a>)";
    }
    echo "
    			</div>
    			<div class='card-body'>";
    if (!empty($ir['equip_head'])) {
        echo $api->SystemItemIDtoName($ir['equip_head']);
    } else {
        echo "No head";
    }
    echo "
    			</div>
    		</div>
                 </div>
    	</div>";
    echo "<hr />
    <h3>Your Inventory</h3><hr />";
    $inv =
        $db->query(
            "SELECT `inv_qty`, `itmsellprice`, `itmid`, `inv_id`,
                     `effect1_on`, `effect2_on`, `effect3_on`,
                     `weapon`, `armor`, `pet`, `head`, `itmtypename`, `itmdesc`, `itmpic`
                     FROM `inventory` AS `iv`
                     INNER JOIN `items` AS `i`
                     ON `iv`.`inv_itemid` = `i`.`itmid`
                     INNER JOIN `itemtypes` AS `it`
                     ON `i`.`itmtype` = `it`.`itmtypeid`
                     WHERE `iv`.`inv_userid` = {$userid}
                     ORDER BY `i`.`itmtype` ASC, `i`.`itmname` ASC");
            $id = $db->fetch_row($inv);
    $itmpic = ($id['itmpic']) ? "<img src='{$id['itmpic']}' class='thumbnail style='background-color: transparent width='50' height='50'>" : '';
    echo "<b>Your items are listed below.</b><br />
    	<table class='table table-bordered table-striped'>
    	    <thead>
    		<tr>
                            <th>Item Img</th>
    			<th>Item (Qty)</th>
    			<th class='hidden-xs-down'>Item Cost (Total)</th>
    			<th>Links</th>
    		</tr></thead>";
    $lt = "";
    while ($i = $db->fetch_row($inv)) {
        if ($lt != $i['itmtypename']) {
            $lt = $i['itmtypename'];
            echo "\n<thead><tr>
                			<th colspan='4'>
                				<b>{$lt}</b>
                			</th>
                		</tr></thead>";
        }
        $i['itmdesc'] = htmlentities($i['itmdesc'], ENT_QUOTES);
        echo "<tr>
       <td>     	
    {$itmpic}
    </td>	
    <td>
    					<a href='iteminfo.php?ID={$i['itmid']}' data-toggle='tooltip' data-placement='right' title='{$i['itmdesc']}'>
    						{$api->SystemItemIDtoName($i['itmid'])}
                                                       
    					</a>";
        if ($i['inv_qty'] > 1) {
            echo " (" . number_format($i['inv_qty']) . ")";
        }
        echo "</td>
            	  <td class='hidden-xs-down'>" . number_format($i['itmsellprice']);
        echo "  (" . number_format($i['itmsellprice'] * $i['inv_qty']) . ")";
        echo "</td>
            	  <td>
            	  	[<a href='itemsend.php?ID={$i['inv_id']}'>Send</a>]
            	  	[<a href='itemsell.php?ID={$i['inv_id']}'>Sell</a>]";
        if ($i['effect1_on'] == 'true' || $i['effect2_on'] == 'true' || $i['effect3_on'] == 'true') {
            echo " [<a href='itemuse.php?item={$i['inv_id']}'>Use</a>]";
        }
        if ($i['weapon'] > 0) {
            echo " [<a href='equip.php?slot=weapon&ID={$i['inv_id']}'>Equip Weapon</a>]";
        }
        if ($i['armor'] > 0) {
            echo " [<a href='equip.php?slot=armor&ID={$i['inv_id']}'>Equip armor</a>]";
        }
        if ($i['pet'] > 0) {
            echo " [<a href='equip.php?slot=pet&ID={$i['inv_id']}'>Equip pet</a>]";
        }
        if ($i['head'] > 0) {
            echo " [<a href='equip.php?slot=head&ID={$i['inv_id']}'>Equip head</a>]";
        }
        echo "</td>
            </tr>";
    }
    echo "</table>";
    $db->free_result($inv);
    $h->endpage();

     


  7. Yes there is one row mine_power_use in mining_data

    well i have an update for this 

     

    the line does work   i changed the power use to 50  instead of 10 

    it takes away 50 from miningpower

    only it fills up very very fast  ( in seconds) 

     

    more info     the systems gives back 10 each time i click a random page 

    when no pages are loaded it stays 

     


  8. 7 minutes ago, Magictallguy said:

    This is a user-created module, not an original part of the engine.
    The code appears to check out at first glance.

    Does the corresponding row in your database have a value for mine_power_use?

    No not in mining. 

     

    It's mining power that needs to go down when they do something 

    I have tryed to change that line and added miningpower = miningpower - 10 

    But that didn't work as well 


  9. hello   i have a problem 

     

    i have a mining page  

    1 line on that page only works 50 procent 🙂 

                    $db->query("UPDATE `mining` SET `miningxp`=`miningxp`+ {$xpgain}, `miningpower`=`miningpower`-'{$MSI['mine_power_use']}' WHERE `userid` = {$userid}");
    users do get there mining xp   but it doesnt take away the needed mining power use 

    <?php
    $macropage = ('mine.php');
    require('globals.php');
    $UIDB = $db->query("SELECT * FROM `mining` WHERE `userid` = {$userid}");
    if (!($db->num_rows($UIDB))) {
        $db->query("INSERT INTO `mining` (`userid`, `max_miningpower`, `miningpower`, `miningxp`, `buyable_power`, `mining_level`) 
        VALUES ('{$userid}', '100', '100', '0', '1', '1');");
    }
    $MUS = ($db->fetch_row($db->query("SELECT * FROM `mining` WHERE `userid` = {$userid} LIMIT 1")));
    mining_levelup();
    echo "<h2>Dangerous Mines</h2><hr />";
    if ($api->UserStatus($userid, 'infirmary')) {
        alert('danger', "Unconscious!", "You cannot go mining if you're in the infirmary.");
        die($h->endpage());
    }
    if ($api->UserStatus($userid, 'dungeon')) {
        alert('danger', "Locked Up!", "You cannot go mining if you're in the dungeon.");
        die($h->endpage());
    }
    if (!isset($_GET['action'])) {
        $_GET['action'] = '';
    }
    switch ($_GET['action']) {
        case 'mine':
            mine();
            break;
        case 'buypower':
            buypower();
            break;
        default:
            home();
            break;
    }
    function home()
    {
        global $MUS, $db, $api;
        $mineen = min(round($MUS['miningpower'] / $MUS['max_miningpower'] * 100), 100);
        $minexp = min(round($MUS['miningxp'] / $MUS['xp_needed'] * 100), 100);
        $mineenp = 100 - $mineen;
        $minexpp = 100 - $minexp;
        echo "Welcome to the dangerous mines, brainless moron! If you're lucky, you'll strike riches. If not... the mine
            will eat you alive.
        <br />
    	<table class='table table-bordered'>
    		<tr>
    			<th colspan='2'>
    				You are mining level {$MUS['mining_level']}.
    			</th>
    		</tr>
    		<tr>
    			<th>
    				Mining Power
    			</th>
    			<td>
    				<div class='progress'>
    					<div class='progress-bar bg-success' role='progressbar' aria-valuenow='{$MUS['miningpower']}' aria-valuemin='0' aria-valuemax='100' style='width:{$mineen}%'>
    						{$mineen}% ({$MUS['miningpower']} / {$MUS['max_miningpower']})
    					</div>
    				</div>
    			</td>
    		</tr>
    		<tr>
    			<th>
    				Mining Experience
    			</th>
    			<td>
    				<div class='progress'>
    					<div class='progress-bar bg-success' role='progressbar' aria-valuenow='{$MUS['miningxp']}' aria-valuemin='0' aria-valuemax='100' style='width:{$minexp}%'>
    						{$minexp}% ({$MUS['miningxp']} / {$MUS['xp_needed']})
    					</div>
    				</div>
    			</td>
    		</tr>
    	</table>
        <u>Open Mines</u><br />";
        $minesql = $db->query("SELECT * FROM `mining_data` ORDER BY `mine_level` ASC");
        while ($mines = $db->fetch_row($minesql)) {
            echo "[<a href='?action=mine&spot={$mines['mine_id']}'>" . $api->SystemTownIDtoName($mines['mine_location']) . " - Level {$mines['mine_level']}</a>]<br />";
        }
    
        echo "<br /><br />
        [<a href='?action=buypower'>Buy Power Sets</a>]";
    
    }
    
    function buypower()
    {
        global $userid, $db, $ir, $MUS, $h, $api;
        $CostForPower = $MUS['mining_level'] * 75 + 10 + $MUS['mining_level']; //Cost formula, in IQ.
        if (isset($_POST['sets']) && ($_POST['sets'] > 0)) {
            $sets = abs($_POST['sets']);
            $totalcost = $sets * $CostForPower;
            if ($sets > $MUS['buyable_power']) {
                alert('danger', "Uh Oh!", "You are trying to buy more sets of power than you currently have available to you.");
                die($h->endpage());
            } elseif (($ir['iq'] < $totalcost)) {
                alert('danger', "Uh Oh!", "You need " . number_format($totalcost) . " to buy the amount of sets you want to. You only have " . number_format($ir['iq']));
                die($h->endpage());
    
            } else {
                $db->query("UPDATE `userstats` SET `iq` = `iq` - '{$totalcost}' WHERE `userid` = {$userid}");
                $db->query("UPDATE `mining` SET `buyable_power` = `buyable_power` - '$sets', 
    						`max_miningpower` = `max_miningpower` + ($sets*10) 
    						WHERE `userid` = {$userid}");
                $api->SystemLogsAdd($userid, 'mining', "Exchanged {$totalcost} IQ for {$sets} sets of mining power.");
                alert('success', "Success!", "You have traded " . number_format($totalcost) . " IQ for {$sets} of mining power.", true, 'mine.php');
            }
        } else {
            echo "You can buy {$MUS['buyable_power']} sets of mining power. One set is equal to 10 mining power. You unlock
                more sets by leveling your mining level. Each set will cost you " . number_format($CostForPower) . " IQ.
                How many do you wish to buy?";
            echo "<br />
            <form method='post'>
                <input type='number' class='form-control' value='{$MUS['buyable_power']}' min='1' max='{$MUS['buyable_power']}' name='sets' required='1'>
                <br />
                <input type='submit' class='btn btn-primary' value='Buy Power'>
            </form>";
        }
    }
    
    function mine()
    {
        global $db, $MUS, $ir, $userid, $api, $h;
        if (!isset($_GET['spot']) || empty($_GET['spot'])) {
            alert('danger', "Uh Oh!", "Please select the mine you wish to mine at.", true, 'mine.php');
            die($h->endpage());
        } else {
            $spot = abs($_GET['spot']);
            $mineinfo = $db->query("SELECT * FROM `mining_data` WHERE `mine_id` = {$spot}");
            if (!($db->num_rows($mineinfo))) {
                alert('danger', "Uh Oh!", "The mine you are trying to mine at does not exist.", true, 'mine.php');
                die($h->endpage());
            } else {
                $MSI = $db->fetch_row($mineinfo);
                $query = $db->query("SELECT `inv_itemid` FROM `inventory` where `inv_itemid` = {$MSI['mine_pickaxe']} && `inv_userid` = {$userid}");
                $i = $db->fetch_row($query);
                if ($MUS['mining_level'] < $MSI['mine_level']) {
                    alert('danger', "Uh Oh!", "You are too low level to mine here. You need mining level {$MSI['mine_level']} to mine here.", true, 'mine.php');
                    die($h->endpage());
                } elseif ($ir['location'] != $MSI['mine_location']) {
                    alert('danger', "Uh Oh!", "To mine at a mine, you need to be in the same town its located.", true, 'mine.php');
                    die($h->endpage());
                } elseif ($ir['iq'] < $MSI['mine_iq']) {
                    alert('danger', "Uh Oh!", "Your IQ is too low to mine here. You need {$MSI['mine_iq']} IQ.", true, 'mine.php');
                    die($h->endpage());
                } elseif ($MUS['miningpower'] < $MSI['mine_power_use']) {
                    alert('danger', "Uh Oh!", "You do not have enough mining power to mine here. You need {$MSI['mine_power_use']}.", true, 'mine.php');
                    die($h->endpage());
                } elseif (!$i['inv_itemid'] == $MSI['mine_pickaxe']) {
                    alert('danger', "Uh Oh!", "You do not have the required pickaxe to mine here. You need a " . $api->SystemItemIDtoName($MSI['mine_pickaxe']), true, "mine.php");
                    die($h->endpage());
                } else {
                    if (!isset($xpgain)) {
                        $xpgain = 0;
                    }
                    if ($ir['iq'] <= $MSI['mine_iq'] + ($MSI['mine_iq'] * .3)) {
                        $Rolls = Random(3, 5);
                    } elseif ($ir['iq'] >= $MSI['mine_iq'] + ($MSI['mine_iq'] * .3) && ($ir['iq'] <= $MSI['mine_iq'] + ($MSI['mine_iq'] * .6))) {
                        $Rolls = Random(3, 10);
                    } else {
                        $Rolls = Random(4, 15);
                    }
                    if ($Rolls <= 1) {
                        $NegRolls = Random(1, 3);
                        $NegTime = Random(5, 25) * ($MUS['mining_level'] * .25);
                        if ($NegRolls == 1) {
                            alert('danger', "Uh Oh!", "You begin to mine and touch off a natural gas leak. Kaboom.", false);
                            $api->SystemLogsAdd($userid, 'mining', "Mined at {$api->SystemTownIDtoName($MSI['mine_location'])} [{$MSI['mine_location']}] and was put into the infirmary for {$NegTime} minutes.");
                            $api->UserStatusSet($userid, 'infirmary', $NegTime, "Mining Explosion");
                        } elseif ($NegRolls == 2) {
                            alert('danger', "Uh Oh!", "You hit a vein of gems, except a miner nearby gets jealous and tries to take your gems! You knock them out cold, and a guard arrests you. Wtf.", false);
                            $api->SystemLogsAdd($userid, 'mining', "Mined at {$api->SystemTownIDtoName($MSI['mine_location'])} [{$MSI['mine_location']}] and was put into the dungeon for {$NegTime} minutes.");
                            $api->UserStatusSet($userid, 'dungeon', $NegTime, "Mining Selfishness");
                        } else {
                            alert('danger', "Uh Oh!", "You failed to mine anything of use.", false);
                            $api->SystemLogsAdd($userid, 'mining', "Mined at {$api->SystemTownIDtoName($MSI['mine_location'])} [{$MSI['mine_location']}] and was unsuccessful.");
                        }
                    } elseif ($Rolls >= 3 && $Rolls <= 14) {
                        $PosRolls = Random(1, 3);
                        if ($PosRolls == 1) {
                            $flakes = Random($MSI['mine_copper_min'], $MSI['mine_copper_max']);
                            alert('success', "Success!", "You have successfully mined up " . number_format($flakes) . " " . $api->SystemItemIDtoName($MSI['mine_copper_item']), false);
                            $api->UserGiveItem($userid, $MSI['mine_copper_item'], $flakes);
                            $api->SystemLogsAdd($userid, 'mining', "Mined at {$api->SystemTownIDtoName($MSI['mine_location'])} [{$MSI['mine_location']}] and mined {$flakes}x {$api->SystemItemIDtoName($MSI['mine_copper_item'])}.");
                            $xpgain = $flakes * 0.15;
    
                        } elseif ($PosRolls == 2) {
                            $flakes = Random($MSI['mine_silver_min'], $MSI['mine_silver_max']);
                            alert('success', "Success!", "You have successfully mined up " . number_format($flakes) . " " . $api->SystemItemIDtoName($MSI['mine_silver_item']), false);
                            $api->UserGiveItem($userid, $MSI['mine_silver_item'], $flakes);
                            $api->SystemLogsAdd($userid, 'mining', "Mined at {$api->SystemTownIDtoName($MSI['mine_location'])} [{$MSI['mine_location']}] and mined {$flakes}x {$api->SystemItemIDtoName($MSI['mine_silver_item'])}.");
                            $xpgain = $flakes * 0.35;
                        } else {
                            $flakes = Random($MSI['mine_gold_min'], $MSI['mine_gold_max']);
                            alert('success', "Success!", "You have successfully mined up " . number_format($flakes) . " " . $api->SystemItemIDtoName($MSI['mine_gold_item']), false);
                            $api->UserGiveItem($userid, $MSI['mine_gold_item'], $flakes);
                            $api->SystemLogsAdd($userid, 'mining', "Mined at {$api->SystemTownIDtoName($MSI['mine_location'])} [{$MSI['mine_location']}] and mined {$flakes}x {$api->SystemItemIDtoName($MSI['mine_gold_item'])}.");
                            $xpgain = $flakes * 0.45;
                        }
                    } else {
                        alert('success', "Success!", "You have carefully excavated out a single" . $api->SystemItemIDtoName($MSI['mine_gem_item']), false);
                        $api->UserGiveItem($userid, $MSI['mine_gem_item'], 1);
                        $api->SystemLogsAdd($userid, 'mining', "Mined at {$api->SystemTownIDtoName($MSI['mine_location'])} [{$MSI['mine_location']}] and mined 1x {$api->SystemItemIDtoName($MSI['mine_gem_item'])}.");
                        $xpgain = 3 * $MUS['mining_level'];
                    }
                    echo "<hr />
                    [<a href='?action=mine&spot={$spot}'>Mine Again</a>]<br />
                    [<a href='mine.php'>Pack it Up</a>]";
                    $db->query("UPDATE `mining` SET `miningxp`=`miningxp`+ {$xpgain}, `miningpower`=`miningpower`-'{$MSI['mine_power_use']}' WHERE `userid` = {$userid}");
    
                }    
            }
        }
    }
    
    function mining_levelup()
    {
        global $db, $userid, $MUS;
        $MUS['xp_needed'] = round(($MUS['mining_level'] + 1) * ($MUS['mining_level'] + 1) * ($MUS['mining_level'] + 1) * 4.4);
        if ($MUS['miningxp'] >= $MUS['xp_needed']) {
            $expu = $MUS['miningxp'] - $MUS['xp_needed'];
            $MUS['mining_level'] += 1;
            $MUS['miningxp'] = $expu;
            $MUS['buyable_power'] += 1;
            $MUS['xp_needed'] =
                round(($MUS['mining_level'] + 1) * ($MUS['mining_level'] + 1) * ($MUS['mining_level'] + 1) * 4.4);
            $db->query("UPDATE `mining` SET `mining_level` = `mining_level` + 1, `miningxp` = {$expu},
                     `buyable_power` = `buyable_power` + 1 WHERE `userid` = {$userid}");
        }
    }
    
    $h->endpage();

     


  10. tested the module and disabled it again

    why ?

    1 i can play it even with 0 currency

    2 the txt is not worked out good says 1-100 and says However if you lose, you lose double the amount i guessed! needs to be you guessed

    3 when i win or lose it says you won !currency or you lost !currency

    numbers 2 and 3 are not that bad next time please work it out better

×
×
  • Create New...