Attack Weapons </TH> <TH class=subh align=right> Quantity </TH> <TH class=subh> Strength </TH> <TH class=subh> Repair </TH> <TH class=subh> Scrap/Sell </TH> </TR> <? $wep = getUserWeapon($user); $totalWCount = 0; for ($i = 0;$i < count($wep);$i++) { $totalWCount+= $wep[$i]->weaponCount; printf("<TR><TD>%s</TD>", $conf["race"][$user->race]["weapon"][$wep[$i]->weaponID]["name"]); ?> <TD align=right> <? numecho($wep[$i]->weaponCount) ?> </TD> <? $x = $wep[$i]->weaponStrength; $y = $conf["weapon{$wep[$i]->weaponID}strength"]; $torepair = $torepairm = $y - $x; $cost = $costm = round($conf["weapon{$wep[$i]->weaponID}pp"] * $wep[$i]->weaponCount * $torepair); if ($cost > $user->gold) { $torepairm = floor($user->gold / ($conf["weapon{$wep[$i]->weaponID}pp"] * $wep[$i]->weaponCount));
$weapontype2 = $aW[0]->weaponID; $rnda = rand(0, 55) / 1000; $weaponamount = floor($rnda * $aW[0]->weaponCount); if ($aW[0]->weaponCount <= 15) { $weaponamount = 0; } //setWeapon($aw[0]->ID," weaponCount=weaponCount-'$weaponamount' "); if ($aW[0]->weaponCount - $weaponamount <= 0) { $sql = "DELETE FROM Weapon WHERE weaponID='$weapontype2' AND userID='$defender->ID' AND isAttack='$weapontype';"; } else { $sql = "UPDATE Weapon SET weaponCount=weaponCount-'$weaponamount' WHERE weaponID='$weapontype2' AND userID='$defender->ID' AND isAttack='$weapontype';"; } mysql_query($sql) or die(mysql_error()); // print $sql; if ($weapontype == 1) { $a = getUserWeapon($attacker); } else { $a = getDefUserWeapon($attacker); } $in = true; // print_r($a); for ($x = - 1;$x <= count($a);$x++) { if ($a[$x]->weaponID == $aW[0]->weaponID) { setWeapon($a[$x]->ID, " weaponCount=weaponCount+$weaponamount "); $in = false; } } if ($in == true AND $weaponamount > 0) { $str = $conf["weapon$weapontype2" . "strength"]; $q = @mysql_query("insert into `Weapon` (weaponID, weaponStrength, weaponCount, isAttack, userID) values ('$weapontype2', '$str', '$weaponamount', '$weapontype', '$attacker->ID')"); }