K grab a comfortable chair, a drink, and a sandwich, and snuggle up to the PC for a moment. I want to take you through a little on how I crafting will work
First
Code: Select all
$tag = $_GET['tag'];
$weapon = $_GET['type'];
$hammer = $_GET['hammer'];
$surface = $_GET['surface'];
$pid = $_GET['pid'];
we then do some checks to see who owns the forge and if the player can afford to craft but I put it here so you could see anyways.
Code: Select all
$inn="SELECT * from weaponforges WHERE pid='$pid' AND sid = '$tag'";
$inn2=mysql_query($inn) or die("Could not get weapon forge");
$inn3=mysql_fetch_array($inn2);
if ($inn3[pname] == $playerinfo3[name]){$inn3[price] = 0;}
if ($playerinfo3[credits] < $inn3[price])
{
echo "You cannot afford to use this Weapon Forge.<br>";
echo "<center><br><A href='/locations/map.php'>Go Back";
$updatecheat="Update anticheat set weaponforge=0 where id='$id'";
mysql_query($updatecheat) or die("Could not update cheat");
exit;
}
else
{
$updateplayers="Update players set credits=credits-'$inn3[price]' where id='$id'";
mysql_query($updateplayers) or die("Could not update player stats");
$updateowner="Update players set credits=credits+'$inn3[price]' where name='$inn3[pname]'";
mysql_query($updateowner) or die("Could not update owner stats");
$updateinn="Update weaponforges set total=total+'$inn3[price]' where pid='$pid' AND sid = '$tag'";
mysql_query($updateinn) or die("Could not update weapon forge stats");
Okay back on track
We next query for the players skill in weapon crafting and the recipes difficulty...
Code: Select all
$skills="SELECT weapon_craft from skills where id='$id'";
$skills2=mysql_query($skills) or die("Could not get user skills");
$skills3=mysql_fetch_array($skills2);
$recipeinfo="SELECT * from recipes where name='$weapon'";
$recipeinfo2=mysql_query($recipeinfo) or die("Could not get recipe stats");
$recipeinfo3=mysql_fetch_array($recipeinfo2);
Next we modify the players skill roll based on the difficulty of the recipe
Code: Select all
/////skills roll/////////////////////////
///////////////////////////////////////////////////////////////
if ($skills3[0] >= $recipeinfo3[difficulty])
{
$modify = ($skills3[0] - $recipeinfo3[difficulty]) * 5;
$modify2= 50 + $modify;
}
else
{
$modify = ($recipeinfo3[difficulty] - $skills3[0]) * 5;
$modify2= 50 - $modify;
}
if ($modify2 <= 10){$modify2 = 10;}
if ($modify2 >= 90){$modify2 = 90;}
Next I assign the database name to the modifier name so that when we update backpack it matches database and then i create base stats per weapon..
Code: Select all
if ($weapon == 'Blade'){$name = 'One Handed Blade'; $speed = 8; $damage = 3; $rating = 2;}
if ($weapon == 'TwoH_Blade'){$name = 'Two Handed Blade';$speed = 4;$damage = 7; $rating = 4;}
if ($weapon == 'Axe'){$name = 'Axe';$speed = 7;$damage = 4; $rating = 2;}
if ($weapon == 'Pole_Arm'){$name = 'Pole Arm';$speed = 5;$damage = 5; $rating = 4;}
if ($weapon == 'Bow'){$name = 'Bow';$speed = 5;$damage = 3; $rating = 3;}
if ($weapon == 'Blunt'){$name = 'Blunt Weapon';$speed = 9;$damage = 4; $rating = 2;}
if ($weapon == 'Knife'){$name = 'Knife';$speed = 10;$damage = 2; $rating = 1;}
if ($weapon == 'Crossbow'){$name = 'Crossbow';$speed = 3;$damage = 4; $rating = 3;}
if ($weapon == 'Light_Pistol'){$name = 'Light Pistol';$speed = 9;$damage = 6; $rating = 5;}
if ($weapon == 'Heavy_Pistol'){$name = 'Heavy Pistol';$speed = 5;$damage = 9; $rating = 5;}
if ($weapon == 'Energy_Pistol'){$name = 'Energy Pistol';$speed = 9;$damage = 10; $rating = 7;}
if ($weapon == 'Energy_Rifle'){$name = 'Energy Rifle';$speed = 6;$damage = 13; $rating = 7;}
if ($weapon == 'Light_Rifle'){$name = 'Light Rifle';$speed = 7;$damage = 9; $rating = 6;}
if ($weapon == 'Heavy_Rifle'){$name = 'Heavy Rifle';$speed = 2;$damage = 13; $rating = 6;}
if ($weapon == 'Shotgun'){$name = 'Shotgun';$speed = 4;$damage = 16; $rating = 4;}
Okay new here is where the players skill gets checked per every forge level
each level affects a stat
Here is how the levels work
1. Melting = durability
2. Forming = Rating
3. Hammer = Speed
4. Temper = Damage
5. Quenching = Craft Points
checks forsucceed or fail
Code: Select all
$meltroll = rand(1,100);
if ($meltroll < $modify2){$melt = 1;}
$form = rand(1,100);
if ($formroll < $modify2){$form = 1;}
$hammerroll = rand(1,100);
if ($hammerroll < $modify2){$hammered = 1;}
$temperroll = rand(1,100);
if ($temperroll < $modify2){$temper = 1;}
$quenchroll = rand(1,100);
if ($quenchroll < $modify2){$quench = 1;}
Code: Select all
///////////////////////////Melting///////////////////////
$duramod = rand(1,$skills3[0]);
$duramod2 = rand(1,$skills3[0]);
if ($duramod < 3){$duramod = 3;}
if ($duramod2 < 3){$duramod2 = 3;}
if ($melt == 1)
{
$durability = $modify2 - $meltroll;
if ($durability < 6){$durability = 6;}
if ($durability > 20){$durability = 20;}
if ($hammer == "durability"){$durability = $durability + $duramod;}
if ($surface == "durability"){$durability = $durability + $duramod2;}
}
Code: Select all
if ($melt != 1)
{
$basedura = rand(1,$skills3[0]);
if ($basedura < 2){$basedura = 2;}
if ($basedura > 6){$basedura = 6;}
$durability = $durability + $basedura;
if ($hammer == "durability"){$durability = $durability + $duramod;}
if ($surface == "durability"){$durability = $durability + $duramod2;}
}
////////////////////////////////////////////////////////
Code: Select all
///////////////////////////Forming///////////////////////
$formmod = rand(1,$skills3[0]);
$formmod2 = rand(1,$skills3[0]);
$formmod = $formmod/2;
$formmod2 = $formmod2/2;
if ($formmod < 1){$formmod = 1;}
if ($formmod2 < 1){$formmod2 = 1;}
if ($form == 1)
{
if ($hammer == "rating"){$rating = $rating + $formmod;}
if ($surface == "rating"){$rating = $rating + $formmod2;}
}
if ($form != 1)
{
$baserate = rand(1,$rating);
$rating = $baserate;
if ($hammer == "rating"){$rating = $rating + $formmod;}
if ($surface == "rating"){$rating = $rating + $formmod2;}
}
////////////////////////////////////////////////////////
Forming and the rest are much the same except it work off the base stat.
Code: Select all
///////////////////////////hammering///////////////////////
$hammermod = rand(1,$skills3[0]);
$hammermod2 = rand(1,$skills3[0]);
$hammermod = $hammermod/2;
$hammermod2 = $hammermod2/2;
if ($hammermod < 1){$hammermod = 1;}
if ($hammermod2 < 1){$hammermod2 = 1;}
if ($hammered == 1)
{
if ($hammer == "speed"){$speed = $speed + $formmod;}
if ($surface == "speed"){$speed = $speed + $formmod2;}
}
if ($hammered != 1)
{
$baserate = rand(1,$speed);
$speed = $baserate;
if ($hammer == "speed"){$speed = $speed + $hammermod;}
if ($surface == "speed"){$speed = $speed + $hammermod2;}
}
////////////////////////////////////////////////////////
so as you can see this gives the armor and weapons much more of a dynamic craft. Players could create a wonderful item but fail in one place. They would have to craft a material into the weapon or armor to bring that stat up.