Jump to content
cyberpro98

[SQL NPC GENERATOR]

Recommended Posts

Hi there 

I am here to share one part of PHP SCRIPT  made by ME and the biggest part made by Tim Levinsson

 

Biggest part of credit - Tim Levinsson

Smaller part - Cyberpro98

 

This script is working on the latest OregonCore revision.

You just need to go to your XAMPP folder and open up htdocs folder and drop inside of it  : 

index.php ; npcinsert.php ; images (u can add whichever image but u must to edit the php file )

So, open up your Program NOTEPAD  or Notepad++ 

and just place this code inside of it 

<?php
$host = "127.0.0.1";
$dbuser = "yourdbuser";   //mine is root
$dbpass = "yourdbpassword"; //mine password is roooooooot
$dbname = "yourdatabaseworldname"; //mine database name is world

$conn = mysqli_connect($host, $dbuser, $dbpass, $dbname);

$inputs = array(
"entry", "modelid1", "name", "subname", "IconName", "gossip_menu_id", "minlevel", "maxlevel", "minhealth",
"maxhealth", "minmana", "maxmana", "armor", "faction", "npcflag", "scale", "rank", "mindmg", "maxdmg",
 "rangeattacktime", "unit_class", "minrangedmg", "maxrangedmg", "lootid",
"mingold", "maxgold", "ManaModifier", "HealthModifier", "mechanic_immune_mask");


//added
if(empty($_POST['baseattacktime'])) {
   $baseattacktime = 2000;
 }else{
   $baseattacktime = $_POST ['baseattacktime'];
}

//added
if(empty($_POST['attackpower'])) {
   $attackpower = 100;
 }else{
   $attackpower = $_POST ['attackpower'];
}
//added
if(empty($_POST['rangedattackpower'])) {
   $rangedattackpower = 100;
 }else{
   $rangedattackpower = $_POST ['rangedattackpower'];
}

//added
if(empty($_POST['speed_walk'])) {
   $speed_walk = 1;
 }else{
   $speed_walk = $_POST ['speed_walk'];
}

//added
if(empty($_POST['speed_run'])) {
   $speed_run = 1.14286;
 }else{
   $speed_run = $_POST ['speed_run'];
}








foreach($inputs as $input) {
  ${$input} = (!empty($_POST[$input])) ? $_POST[$input] : "";
}

$stmt = $conn->prepare("INSERT INTO `creature_template` (
entry, `modelid1`, name, subname, IconName, gossip_menu_id, minlevel, maxlevel, minhealth, maxhealth,
minmana, maxmana, armor, faction, npcflag, speed_walk, speed_run, scale, rank, mindmg, maxdmg, attackpower,
baseattacktime, rangeattacktime, unit_class, minrangedmg, maxrangedmg, rangedattackpower, lootid, mingold, maxgold, ManaModifier,
HealthModifier, mechanic_immune_mask) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)");
$stmt->bind_param("iisssiiiiiiiiiiiiiiiiiiiiiiiiiiiii", $entry, $modelid1, $name, $subname, $IconName, $gossip_menu_id, $minlevel, $maxlevel, $minhealth, $maxhealth, $minmana, $maxmana, $armor, $faction, $npcflag, $speed_walk, $speed_run, $scale, $rank, $mindmg, $maxdmg, $attackpower, $baseattacktime, $rangeattacktime, $unit_class, $minrangedmg, $maxrangedmg, $rangedattackpower, $lootid, $mingold, $maxgold, $ManaModifier, $HealthModifier, $mechanic_immune_mask);
if($stmt->execute()) {
echo "Success";
header('location: index.php');
}else{
echo "Failed" . $stmt->error;
}
$stmt->close();
?>

close it and save it with name :  npcinsert.php 

And now  that file put it into folder nammed  htdocs ( its located in  C:\xampp\htdocs )

Open again NOTEPAD++ or Notepad 

and put this code inside 

 

<!DOCTYPE html>
<html>
<head>
<title>SQL Generator</title>
<style>
  * {
    margin:0;
    padding:0;
  }
  
body {
background-image:url(images/background-3.jpg);


}
  #wrapper {
    width:868px;
    margin:100px auto;
  }

  [type=text] {
    width:200px;
    height:25px;
    padding:0 5px;
  }

  select {
    width:214px;
    height:29px;
  }

  [type=submit] {
    width:100px;
    height:30px;
  }
</style>
<meta charset="UTF-8">
</head>
<body>
  <div id="wrapper">
    <form action="npcinsert.php" method="POST">
      <input type="text" name="entry" placeholder="Creature Entry">
      <input type="text" name="modelid1" placeholder="model id 1">
      <input type="text" name="name" placeholder="Creature Name">
      <input type="text" name="subname" placeholder="Subname">
      <select name="IconName">
        <option value="" selected hidden disabled>Icon Name</option>
        <option value="">None</option>
        <option value="Directions">Directions</option>
        <option value="Gunner">Gunner</option>
        <option value="vehichleCursor">vehichleCursor</option>
        <option value="Driver">Driver</option>
        <option value="Attack">Attack</option>
        <option value="Buy">Buy</option>
        <option value="Speak">Speak</option>
        <option value="Pickup">Pickup</option>
        <option value="Interact">Interact</option>
        <option value="Trainer">Trainer</option>
        <option value="Taxi">Taxi</option>
        <option value="Repair">Repair</option>
        <option value="LootAll">LootAll</option>
        <option value="Quest">Quest</option>
      </select>
      <input type="text" name="gossip_menu_id" placeholder="gossip_menu_id">
      <input type="text" name="minlevel" placeholder="min level">
      <input type="text" name="maxlevel" placeholder="max level">
      <input type="text" name="minhealth" placeholder="minhealth">
      <input type="text" name="maxhealth" placeholder="maxhealth">
      <input type="text" name="minmana" placeholder="minmana">
      <input type="text" name="maxmana" placeholder="maxmana">
      <input type="text" name="armor" placeholder="armor">
      <input type="text" name="faction" placeholder="faction">
      <select name="npcflag">
        <option value="" selected hidden disabled>NPC Flag</option>
        <option value="">None</option>
        <option value="1">Gossip</option>
        <option value="2">Quest Giver</option>
        <option value="16">Trainer</option>
        <option value="32">Class Trainer</option>
        <option value="64">Profession Trainer</option>
        <option value="128">Vendor</option>
        <option value="256">Vendor Ammo</option>
        <option value="512">Vendor Food</option>
        <option value="1024">Vendor Poison</option>
        <option value="2048">Vendor Reagent</option>
        <option value="4096">Repairer</option>
        <option value="8192">Flight Master</option>
        <option value="16384">Spirit Healer</option>
        <option value="32768">Spirit Guide</option>
        <option value="65536">Innkeeper</option>
        <option value="131072">Banker</option>
        <option value="262144">Petitioner</option>
        <option value="524288">Tabard Designer</option>
        <option value="1048576">Battlemaster</option>
        <option value="2097152">Auctioneer</option>
        <option value="4194304">Stable Master</option>
        <option value="8388608">Guild Banker</option>
        <option value="16777216">Spellclick</option>
        <option value="67108864">Mailbox</option>
      </select>
      <input type="text" name="scale" placeholder="scale">
      <select name="rank">
        <option value="" hidden selected disabled>Rank</option>
        <option value="">None</option>
        <option value="">Normal</option>
        <option value="">Elite</option>
        <option value="">Rare Elite</option>
        <option value="">Boss</option>
        <option value="">Rare</option>
      </select>
      <input type="text" name="mindmg" placeholder="mindmg">
      <input type="text" name="maxdmg" placeholder="maxdmg">
      <input type="text" name="attackpower" placeholder="attackpower">
      <input type="text" name="baseattacktime" placeholder="baseattacktime">
      <input type="text" name="rangeattacktime" placeholder="rangeattacktime">
      <select name="unit_class">
        <option value="" hidden selected disabled>Unit Class</option>
        <option value="">None</option>
        <option value="1">Warrior</option>
        <option value="2">Paladin</option>
        <option value="4">Rogue</option>
        <option value="8">Mage</option>
      </select>
      <input type="text" name="minrangedmg" placeholder="maxrangedmg">
      <input type="text" name="maxrangedmg" placeholder="maxrangedmg">
      <input type="text" name="rangedattackpower" placeholder="rangedattackpower">
      <input type="text" name="lootid" placeholder="lootid">
      <input type="text" name="mingold" placeholder="mingold">
      <input type="text" name="maxgold" placeholder="maxgold">
      <input type="text" name="ManaModifier" placeholder="ManaModifier">
      <input type="text" name="HealthModifier" placeholder="HealthModifier">
      <input type="text" name="mechanic_immune_mask" placeholder="mechanic_immune_mask">
      <select name="mechanic_immune_mask">
        <option value="" selected hidden disabled>Mechanic Immune Mask</option>
        <option value="">None</option>
        <option value="1">MECHANIC_CHARM</option>
        <option value="2">MECHANIC_DISORIENTED</option>
        <option value="4">MECHANIC_DISARM</option>
        <option value="8">MECHANIC_DISTRACT</option>
        <option value="16">MECHANIC_FEAR</option>
        <option value="32">MECHANIC_GRIP</option>
        <option value="64">MECHANIC_ROOT</option>
        <option value="128">MECHANIC_PACIFY</option>
        <option value="256">MECHANIC_SILENCE</option>
        <option value="512">MECHANIC_SLEEP</option>
        <option value="1024">MECHANIC_SNARE</option>
        <option value="2048">MECHANIC_STUN</option>
        <option value="4096">MECHANIC_FREEZE</option>
        <option value="8192">MECHANIC_KNOCKOUT</option>
        <option value="16384">MECHANIC_BLEED</option>
        <option value="32768">MECHANIC_BANDAGE</option>
        <option value="65536">MECHANIC_POLYMORPH</option>
        <option value="131072">MECHANIC_BANISH</option>
        <option value="262144">MECHANIC_SHIELD</option>
        <option value="524288">MECHANIC_SHACKLE</option>
        <option value="1048576">MECHANIC_MOUNT</option>
        <option value="2097152">MECHANIC_INFECTED</option>
        <option value="4194304">MECHANIC_TURN</option>
        <option value="8388608">MECHANIC_HORROR</option>
        <option value="16777216">MECHANIC_INVULNERABILITY</option>
        <option value="33554432">MECHANIC_INTERRUPT</option>
        <option value="67108864">MECHANIC_DAZE</option>
        <option value="134217728">MECHANIC_DISCOVERY</option>
        <option value="268435456">MECHANIC_IMMUNE_SHIELD</option>
        <option value="536870912">MECHANIC_SAPPED</option>
        <option value="1073741824">MECHANIC_ENRAGED</option>
      </select><br>
      <center><input type="submit" value="Insert"></center>
    </form>
  </div>
</body>
</html>

Close it and save it with name  index.php

and this file add TOO to htdocs folder.

 

And the latest part 

IN htdocs folder create 1 new folder nammed images and inside of it put any image named " background-3.jpg " 

And that's IT ! 

 

  • Upvote 2

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...