Result |
---|
"; echo " "; $trial=0; while($isok && $nbtimes > 0) { $nbtimes--; $trial++; $r=$db->Execute("SELECT NBITEMS,ITEM FROM OBJECT_FORMULA WHERE OBJECTID = $id AND TYPE = 'C'"); while(!$r->EOF) { if(inventory_check($r->fields[1]) < ($r->fields[0]+0)) { $isok=false; echo "Trial $trial: Sorry... but you do not have the required materials to create this object. \n"; break; } $r->MoveNext(); } $r->Close(); if($isok) { $r=$db->Execute("SELECT NBITEMS,ITEM FROM OBJECT_FORMULA WHERE OBJECTID = $id AND TYPE = 'C'"); while(!$r->EOF) { inventory_add($r->fields[1],-$r->fields[0]); $r->MoveNext(); } $r->Close(); $r=$db->Execute("SELECT PRICE FROM OBJECTS WHERE ID = $id"); $price=$r->fields[0]+0; $r->Close(); //$prob=$uservals["DEXTERITY"]+$uservals["INTELLIGENCE"]; $prob=$uservals["DEXTERITY"]+$uservals["DEXMOD"]+$uservals["TEMP_DEX"]+$uservals["INTELLIGENCE"]+$uservals["INTMOD"]+$uservals["TEMP_INT"]; $perc=ceil($prob/ceil($price/160)*100); if($perc > 100) $perc=100; $didit=false; if($perc == 100 || mt_rand(0,100) < $perc) { inventory_add($id,1); echo "Trial $trial: You created the object ! \n"; $didit=true; } else { echo "Trial $trial: You were unable to craft the item and lost all the raw materials used for it. \n"; } if($nbprints >= 0 && $didit == true) // Decrease the counter for the number of times the player can still create this object. { $nbprints--; if($nbprints <= 0) { $db->Execute("DELETE FROM PLAYER_BLUEPRINTS WHERE USERID=$userid AND OBJECTID = $id"); $isok=false; } else $db->Execute("UPDATE PLAYER_BLUEPRINTS SET NBTIMES = $nbprints WHERE USERID=$userid AND OBJECTID = $id"); } } } echo " |