[PHP] Code to create NPCs vendors.

As I said in my last topic, for those who read it know, I’m starting to Trinity and I have a very slight knowledge of PHP, so while raising my server too lazy created this PHP code that creates NPCs vendors and NPCs reagents sellers of your recipes and MySQL code provided in the right order, according to the chosen user ID it is increasing every item, so it’s something very useful and practical. It’s quite simple, nothing fancy, but still decided to leave here if you help someone, or give rise to new ideas. I believe it is very practical for anyone in need of time. Hope that helps someone.

Hugs,

bigCheat.

[CODE]

code{

text-transform:uppercase;

}

ID INICIAL:

EXPANSÃO:

3 (Cataclysm) 2 (WoTLK) <?php function mostrar_ids_profissoes($id_INICIO) { global $p; echo ""; echo "IDs
"; echo ""; for($i=0;$i<count($p);$i++) { global $p; $l = $i+$id_INICIO; echo $l." - ".$p[$i]."
"; } echo "
"; } if($_GET['expansao'] == 3) // SE A EXPANSÃO FOR CATACLYSM { $p = array( "Alchemy", "Jewelcrafting", "Leatherworking", "Tailoring", "Blacksmithing", "Inscription", "Enchanting", "Engineering", "Herbalism", "Mining", "Skinning", "Cooking", "Archaelogy", //NOVA PROFISSÃO "First Aid", "Fishing" ); } if($_GET['expansao'] == 2) // SE A EXPANSÃO FOR WoTLK { $p = array( "Alchemy", "Jewelcrafting", "Leatherworking", "Tailoring", "Blacksmithing", "Inscription", "Enchanting", "Engineering", "Herbalism", "Mining", "Skinning", "Cooking", "First Aid", "Fishing" ); } if($_GET['entrar'] == "Enviar" && isset($_GET['id_escolhido'])) { $id_escolhido = $_GET['id_escolhido']; $ultimo_id = $id_escolhido+count($p)-1; echo "(TRINIYCORE) NPCS VENDEDORES DE REAGENTES [".$id_escolhido."-".$ultimo_id."]"; echo ""; for($i=0;$i<count($p);$i++) { global $p,$id_escolhido; $l = $i+$id_escolhido; $o = "REPLACE INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `Armor_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `WDBVerified`) VALUES (".$l.", 0, 0, 0, 0, 0, 24365, 24365, 24365, 24365, '".$p[$i]."', 'Vendedor de Reagentes', '', 0, 80, 80, 0, 35, 35, 131, 1, 1.14286, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 80000, 80000, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, '', 12340);"; echo $o; echo " "; } echo ""; mostrar_ids_profissoes($id_escolhido); echo "
"; echo "
"; echo "
"; echo "
"; echo "
"; $id_escolhido_2 = $id_escolhido+count($p); $ultimo_id_2 = $ultimo_id+count($p); echo "(TRINIYCORE) NPCS VENDEDORES DE RECIPES [".$id_escolhido_2."-".$ultimo_id_2."]"; echo ""; for($i=0;$i<count($p);$i++) { global $p,$id_escolhido; $l = $i+$id_escolhido_2; $o = "REPLACE INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `Armor_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `WDBVerified`) VALUES (".$l.", 0, 0, 0, 0, 0, 24365, 24365, 24365, 24365, '".$p[$i]."', 'Vendedor de Recipes', '', 0, 80, 80, 0, 35, 35, 131, 1, 1.14286, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 80000, 80000, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, '', 12340);"; echo $o; echo " "; } echo ""; mostrar_ids_profissoes($id_escolhido_2); } ?>[/CODE]

@Update

So folks, just enough to evolve the project and added some features to it, added in a database all reagents from all professions, then the script has the ability to select all these reagents and split them into NPCs in accordance with appropriate professions, many of the items at an NPC in the emulator is 128 TrinityCore correct? Perfect. If the number of reagents in the table npc_vendor exceed this number (128) it will create another NPC and will divide the remaining reagents in the NPC so getting something very practical and useful! In fine this weekend I was doing it just for fun and also creating an SVN repository to the script where your link is at the end of the post, it ended up being very large, has not added any design in the script I hope someone help me Because I’m still lay in the area. So this is personal I hope you enjoy, and to help me improve even more this script because it can help many people, as well as helping me.

SVN Repository:

https://subversion.assembla.com/svn/zptu/

Hugs,

bigCheat.

So guys, I gave an enhanced in the script and I confess that helped me a lot because I’m restarting my server from scratch and is very useful. Hope that helps someone.

index.php

[CODE]<?php

include “config.php”;

$npcs = “criador-de-npcs-vendedores-de-recipes-e-de-npcs-vendedores-de-reagentes”;

$retirar_drop_do_item = “retirar-drop-do-item”;

?>

<?php echo "
"; if($_GET['pg'] == $retirar_drop_do_item) { ?>

ID DO ITEM:

RETIRAR DE VENDA DOS NPCS: NãoSim

RETIRAR DAS BAGS DOS PLAYERS: NãoSim

<?php if(isset($_GET['ir']) == "ir" && isset($_GET['id_item'])) { echo " DELETE FROM creature_loot_template WHERE item='".$_REQUEST['id_item']."';"; if($_GET['retirar_venda'] == "sim") { echo " DELETE FROM npc_vendor WHERE item='".$_REQUEST['id_item']."';"; } if($_GET['retirar_players'] == "sim") { echo " DELETE FROM ".$DATABASE_C.".character_inventory WHERE item='".$_REQUEST['id_item']."';"; } echo ""; } } if($_GET['pg'] == $npcs) { ?> code{ text-transform:uppercase; }

ID INICIAL:

EXPANSÃO:

2 (WoTLK) 3 (Cataclysm)


COM ITENS DE RECIPE:

Sim Não

EXTENDEDCOST:


<?php function mostrar_ids_profissoes($id_INICIO) { global $p; echo ""; echo "IDs
"; echo ""; for($i=0;$i<count($p);$i++) { global $p; $l = $i+$id_INICIO; echo $l." - ".$p[$i]."
"; } echo "
"; } if(isset($_GET['expansao']) == 3) // SE A EXPANSÃO FOR CATACLYSM { $p = array( "Alchemy", // Alchemy "Jewelcrafting", // Jewelcrafting "Leatherworking", // Leatherworking "Tailoring", // Tailoring "Blacksmithing", // Blacksmithing "Inscription", // Inscription "Enchanting", // Enchanting "Engineering", // Engineering "Herbalism", // Herbalism "Mining", // Mining "Skinning", // Skinning "Cooking", // Cooking "Archaelogy", // NOVA PROFISSÃO "First Aid", // First Aid "Fishing" // Fishing ); $f = array( "171", // Alchemy "755", // Jewelcrafting "165", // Leatherworking "197", // Tailoring "164", // Blacksmithing "773", // Inscription "333", // Enchanting "202", // Engineering "182", // Herbalism "186", // Mining "393", // Skinning "185", // Cooking "", // NOVA PROFISSÃO "129", // First Aid "356" // Fishing ); $class = array( "9", // Alchemy "9", // Jewelcrafting "9", // Leatherworking "9", // Tailoring "9", // Blacksmithing "9", // Inscription "9", // Enchanting "9", // Engineering "9", // Herbalism "9", // Mining "9", // Skinning "9", // Cooking "9", // NOVA PROFISSÃO "9", // First Aid "9" // Fishing ); $sub = array( "6", // Alchemy "10", // Jewelcrafting "1", // Leatherworking "2", // Tailoring "4", // Blacksmithing "", // Inscription "8", // Enchanting "3", // Engineering "", // Herbalism "", // Mining "", // Skinning "5", // Cooking "", // NOVA PROFISSÃO "7", // First Aid "" // Fishing ); } if(isset($_GET['expansao']) == 2) // SE A EXPANSÃO FOR WoTLK { $p = array( "Alchemy", // Alchemy "Jewelcrafting", // Jewelcrafting "Leatherworking", // Leatherworking "Tailoring", // Tailoring "Blacksmithing", // Blacksmithing "Inscription", // Inscription "Enchanting", // Enchanting "Engineering", // Engineering "Herbalism", // Herbalism "Mining", // Mining "Skinning", // Skinning "Cooking", // Cooking "First Aid", // First Aid "Fishing" // Fishing ); $f = array( "171", // Alchemy "755", // Jewelcrafting "165", // Leatherworking "197", // Tailoring "164", // Blacksmithing "773", // Inscription "333", // Enchanting "202", // Engineering "182", // Herbalism "186", // Mining "393", // Skinning "185", // Cooking "129", // First Aid "356" // Fishing ); $class = array( "9", // Alchemy "9", // Jewelcrafting "9", // Leatherworking "9", // Tailoring "9", // Blacksmithing "9", // Inscription "9", // Enchanting "9", // Engineering "9", // Herbalism "9", // Mining "9", // Skinning "9", // Cooking "9", // First Aid "9" // Fishing ); $sub = array( "6", // Alchemy "10", // Jewelcrafting "1", // Leatherworking "2", // Tailoring "4", // Blacksmithing "", // Inscription "8", // Enchanting "3", // Engineering "", // Herbalism "", // Mining "", // Skinning "5", // Cooking "7", // First Aid "" // Fishing ); } if(isset($_GET['entrar']) == "Enviar" && isset($_GET['id_escolhido'])) { $id_escolhido = $_GET['id_escolhido']; $ultimo_id = $id_escolhido+count($p)-1; echo "(TRINIYCORE) NPCS VENDEDORES DE REAGENTES [".$id_escolhido."-".$ultimo_id."]"; echo ""; for($i=0;$i<count($p);$i++) { global $p,$id_escolhido; $l = $i+$id_escolhido; $o = "REPLACE INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `Armor_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `WDBVerified`) VALUES (".$l.", 0, 0, 0, 0, 0, 24365, 24365, 24365, 24365, '".$p[$i]."', 'Vendedor de Reagentes', '', 0, 80, 80, 0, 35, 35, 131, 1, 1.14286, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 80000, 80000, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, '', 12340);"; echo $o; echo " "; } echo ""; mostrar_ids_profissoes($id_escolhido); echo "
"; echo "
"; echo "
"; echo "
"; echo "
"; $id_escolhido_2 = $id_escolhido+count($p); $ultimo_id_2 = $ultimo_id+count($p); echo "(TRINIYCORE) NPCS VENDEDORES DE RECIPES [".$id_escolhido_2."-".$ultimo_id_2."]"; echo ""; for($i=0;$i<count($p);$i++) { global $p,$id_escolhido; $l = $i+$id_escolhido_2; $o = "REPLACE INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `Armor_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `WDBVerified`) VALUES (".$l.", 0, 0, 0, 0, 0, 24365, 24365, 24365, 24365, '".$p[$i]."', 'Vendedor de Recipes', '', 0, 80, 80, 0, 35, 35, 131, 1, 1.14286, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 80000, 80000, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, '', 12340);"; echo $o; echo " "; } echo ""; mostrar_ids_profissoes($id_escolhido_2); if($_GET['recipes_itens'] == "sim") { echo "
(TRINIYCORE) ITENS npc_vendor VENDEDORES DE RECIPES [".$id_escolhido_2."-".$ultimo_id_2."]"; echo ''; for($i=0;$i<count($f);$i++) { global $f,$class,$sub; $id = $id_escolhido_2+$i; $sql_pegar = mysql_query("SELECT * FROM ".$DATABASE_W.".item_template WHERE RequiredSkill='".$f[$i]."' AND class='".$class[$i]."' AND subclass='".$sub[$i]."'") or die (mysql_error()); if($sub[$i] != null) { $script = '-- '.$id.' -- '.$p[$i].' '; $script .= 'DELETE FROM npc_vendor WHERE entry='.$id.';'.' '; while($fet_pegar = mysql_fetch_array($sql_pegar)) { $script .= 'INSERT INTO npc_vendor (entry, slot, item, maxcount, incrtime, ExtendedCost) VALUES '; $script .= '('.$id.','.$fet_pegar['entry'].', 0, 0, 0, '.$_GET['extendedcost'].');'.' '; } $script .= ' '; echo $script; } } echo ''; } } } ?>[/CODE]

config.php

[CODE]<?php

$SERVIDOR = “localhost”;

$USUARIO = “root”;

$SENHA = “”;

$DATABASE_W = “world”;

$DATABASE_C = “characters”;

$CONEXAO_W = mysql_connect (

$SERVIDOR,

$USUARIO,

$SENHA

);

$CONEXAO_C = mysql_connect (

$SERVIDOR,

$USUARIO,

$SENHA

);

$W = mysql_select_db ($DATABASE_W,$CONEXAO_W);

$C = mysql_select_db ($DATABASE_C,$CONEXAO_C);

?>[/CODE]

Hugs,

bigCheat.

Testing here at home I found some bugs, then fix and added new features, I hope someone likes it. For helping me and I think that might help others.

Hugs,

bigCheat.

index.php

[CODE]<?php

include “config.php”;

$npcs = “criador-de-npcs-vendedores-de-recipes-e-de-npcs-vendedores-de-reagentes”;

$retirar_drop_do_item = “retirar-drop-do-item”;

?>

<?php echo "
"; if($_GET['pg'] == $retirar_drop_do_item) { ?>

ID DO ITEM:

RETIRAR DE VENDA DOS NPCS: NãoSim

RETIRAR DAS BAGS DOS PLAYERS: NãoSim

<?php if(isset($_GET['ir']) == "ir" && isset($_GET['id_item'])) { echo " DELETE FROM creature_loot_template WHERE item='".$_REQUEST['id_item']."';"; if($_GET['retirar_venda'] == "sim") { echo " DELETE FROM npc_vendor WHERE item='".$_REQUEST['id_item']."';"; } if($_GET['retirar_players'] == "sim") { echo " DELETE FROM ".$DATABASE_C.".character_inventory WHERE item='".$_REQUEST['id_item']."';"; } echo ""; } } if($_GET['pg'] == $npcs) { ?> code{ text-transform:uppercase; }

ID INICIAL:

EXPANSÃO:

2 (WoTLK) 3 (Cataclysm)


COM ITENS DE RECIPE:

Sim Não

EXTENDEDCOST:


<?php function mostrar_ids_profissoes($id_INICIO) { global $p; echo ""; echo "IDs
"; echo ""; for($i=0;$i<count($p);$i++) { global $p; $l = $i+$id_INICIO; echo $l." - ".$p[$i]."
"; } echo "
"; } if(isset($_GET['expansao']) == 3) // SE A EXPANSÃO FOR CATACLYSM { $p = array( "Alchemy", // Alchemy "Jewelcrafting", // Jewelcrafting "Leatherworking", // Leatherworking "Tailoring", // Tailoring "Blacksmithing", // Blacksmithing "Inscription", // Inscription "Enchanting", // Enchanting "Engineering", // Engineering "Herbalism", // Herbalism "Mining", // Mining "Skinning", // Skinning "Cooking", // Cooking "Archaelogy", // NOVA PROFISSÃO "First Aid", // First Aid "Fishing" // Fishing ); $f = array( "171", // Alchemy "755", // Jewelcrafting "165", // Leatherworking "197", // Tailoring "164", // Blacksmithing "773", // Inscription "333", // Enchanting "202", // Engineering "182", // Herbalism "186", // Mining "393", // Skinning "185", // Cooking "", // NOVA PROFISSÃO "129", // First Aid "356" // Fishing ); $class = array( "9", // Alchemy "9", // Jewelcrafting "9", // Leatherworking "9", // Tailoring "9", // Blacksmithing "9", // Inscription "9", // Enchanting "9", // Engineering "9", // Herbalism "9", // Mining "9", // Skinning "9", // Cooking "9", // NOVA PROFISSÃO "9", // First Aid "9" // Fishing ); $sub = array( "6", // Alchemy "10", // Jewelcrafting "1", // Leatherworking "2", // Tailoring "4", // Blacksmithing "", // Inscription "8", // Enchanting "3", // Engineering "", // Herbalism "", // Mining "", // Skinning "5", // Cooking "", // NOVA PROFISSÃO "7", // First Aid "" // Fishing ); } if(isset($_GET['expansao']) == 2) // SE A EXPANSÃO FOR WoTLK { $p = array( "Alchemy", // Alchemy "Jewelcrafting", // Jewelcrafting "Leatherworking", // Leatherworking "Tailoring", // Tailoring "Blacksmithing", // Blacksmithing "Inscription", // Inscription "Enchanting", // Enchanting "Engineering", // Engineering "Herbalism", // Herbalism "Mining", // Mining "Skinning", // Skinning "Cooking", // Cooking "First Aid", // First Aid "Fishing" // Fishing ); $f = array( "171", // Alchemy "755", // Jewelcrafting "165", // Leatherworking "197", // Tailoring "164", // Blacksmithing "773", // Inscription "333", // Enchanting "202", // Engineering "182", // Herbalism "186", // Mining "393", // Skinning "185", // Cooking "129", // First Aid "356" // Fishing ); $class = array( "9", // Alchemy "9", // Jewelcrafting "9", // Leatherworking "9", // Tailoring "9", // Blacksmithing "9", // Inscription "9", // Enchanting "9", // Engineering "9", // Herbalism "9", // Mining "9", // Skinning "9", // Cooking "9", // First Aid "9" // Fishing ); $sub = array( "6", // Alchemy "10", // Jewelcrafting "1", // Leatherworking "2", // Tailoring "4", // Blacksmithing "", // Inscription "8", // Enchanting "3", // Engineering "", // Herbalism "", // Mining "", // Skinning "5", // Cooking "7", // First Aid "" // Fishing ); } if(isset($_GET['ids_personalizados']) == "IDS PERSONALIZADOS") { global $p; ?> <?php echo "REAGENTES
"; for($i=0;$i<count($p);$i++) { global $p; $id_padrao = $i+90000; echo $p[$i].'
'; } echo '
'; echo '
'; echo '
'; echo '
'; echo "RECIPES
"; global $id_padrao; $id_padrao = $id_padrao+1; for($i=0;$i<count($p);$i++) { global $p,$id_padrao; $id_padrao = $id_padrao+1; echo $p[$i].'
'; } ?>


<?php if($_GET['enviar_dados_ids_personalizados'] == "ENVIAR DADOS") { $p_2 = str_replace(" ","_",$p); # REAGENTES (INICIO) $ids_regs = ''; for($i=0;$i<count($p_2);$i++) { $ids_regs .= $_REQUEST[$p_2[$i]."_regs"].','; } $ids_regs_virgs = substr_replace($ids_regs,'',strlen($ids_regs)-1,1); // TIRAR A ÚLTIMA VÍRGULA. $ids_regs = explode(',',$ids_regs_virgs); // TRANSFORMAR EM ARRAY # REAGENTES (FIM) ########################################################## # RECIPES (INICIO) $ids_recps = ''; for($i=0;$i<count($p_2);$i++) { $ids_recps .= $_REQUEST[$p_2[$i]."_recps"].','; } $ids_recps_virgs = substr_replace($ids_recps,'',strlen($ids_recps)-1,1); // TIRAR A ÚLTIMA VÍRGULA. $ids_recps = explode(',',$ids_recps_virgs); // TRANSFORMAR EM ARRAY # RECIPES (FIM) for($i=0;$i<count($p_2);$i++){ global $p_2; $id_inicial_regs = $ids_regs[count($ids_regs)-count($ids_regs)]; $id_final_regs = $ids_regs[count($ids_regs)-1]; echo "(TRINIYCORE) NPCS VENDEDORES DE REAGENTES [".$id_inicial_regs."-".$id_final_regs."]"; echo ""; for($i=0;$i<count($p_2);$i++) { global $p_2,$p,$ids_regs; $o = "REPLACE INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `Armor_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `WDBVerified`) VALUES (".$ids_regs[$i].", 0, 0, 0, 0, 0, 24365, 24365, 24365, 24365, '".$p[$i]."', 'Vendedor de Reagentes', '', 0, 80, 80, 0, 35, 35, 131, 1, 1.14286, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 80000, 80000, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, '', 12340);"; echo $o; echo " "; } echo ""; } #mostrar_ids_profissoes_personalizados($ids_regs_virgs); echo "
"; echo "
"; echo "
"; echo "
"; echo "
"; global $ids_recps; $id_inicial_recps = $ids_recps[count($ids_recps)-count($ids_recps)]; $id_final_recps = $ids_recps[count($ids_recps)-1]; echo "(TRINIYCORE) NPCS VENDEDORES DE RECIPES [".$id_inicial_recps."-".$id_final_recps."]"; echo ""; for($i=0;$i<count($p);$i++) { global $p,$ids_recps; $o = "REPLACE INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `Armor_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `WDBVerified`) VALUES (".$ids_recps[$i].", 0, 0, 0, 0, 0, 24365, 24365, 24365, 24365, '".$p[$i]."', 'Vendedor de Recipes', '', 0, 80, 80, 0, 35, 35, 131, 1, 1.14286, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 80000, 80000, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, '', 12340);"; echo $o; echo " "; } echo ""; #mostrar_ids_profissoes_personalizados($ids_regs_virgs_2); if($_GET['recipes_itens'] == "sim") { echo "


(TRINIYCORE) ITENS npc_vendor VENDEDORES DE RECIPES [".$id_inicial_recps."-".$id_final_recps."]"; echo ''; for($i=0;$i<count($f);$i++) { global $f,$class,$sub; $id = $ids_recps[$i]; $sql_pegar = mysql_query("SELECT * FROM ".$DATABASE_W.".item_template WHERE RequiredSkill='".$f[$i]."' AND class='".$class[$i]."' AND subclass='".$sub[$i]."'") or die (mysql_error()); if($sub[$i] != null) { $script = '-- '.$id.' -- '.$p[$i].' '; $script .= 'DELETE FROM npc_vendor WHERE entry='.$id.';'.' '; while($fet_pegar = mysql_fetch_array($sql_pegar)) { $script .= 'INSERT INTO npc_vendor (entry, slot, item, maxcount, incrtime, ExtendedCost) VALUES '; $script .= '('.$id.', 0, '.$fet_pegar['entry'].', 0, 0, '.$_GET['extendedcost'].');'.' '; } $script .= ' '; echo $script; } } echo ''; } } exit; } ############################################################ if(isset($_GET['entrar']) == "Enviar" && isset($_GET['id_escolhido']) && !isset($_GET['ids_personalizados'])) { $id_escolhido = $_GET['id_escolhido']; $ultimo_id = $id_escolhido+count($p)-1; echo "(TRINIYCORE) NPCS VENDEDORES DE REAGENTES [".$id_escolhido."-".$ultimo_id."]"; echo ""; for($i=0;$i<count($p);$i++) { global $p,$id_escolhido; $l = $i+$id_escolhido; $o = "REPLACE INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `Armor_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `WDBVerified`) VALUES (".$l.", 0, 0, 0, 0, 0, 24365, 24365, 24365, 24365, '".$p[$i]."', 'Vendedor de Reagentes', '', 0, 80, 80, 0, 35, 35, 131, 1, 1.14286, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 80000, 80000, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, '', 12340);"; echo $o; echo " "; } echo ""; mostrar_ids_profissoes($id_escolhido); echo "
"; echo "
"; echo "
"; echo "
"; echo "
"; $id_escolhido_2 = $id_escolhido+count($p); $ultimo_id_2 = $ultimo_id+count($p); echo "(TRINIYCORE) NPCS VENDEDORES DE RECIPES [".$id_escolhido_2."-".$ultimo_id_2."]"; echo ""; for($i=0;$i<count($p);$i++) { global $p,$id_escolhido; $l = $i+$id_escolhido_2; $o = "REPLACE INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `Armor_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `WDBVerified`) VALUES (".$l.", 0, 0, 0, 0, 0, 24365, 24365, 24365, 24365, '".$p[$i]."', 'Vendedor de Recipes', '', 0, 80, 80, 0, 35, 35, 131, 1, 1.14286, 1, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, '', 0, 3, 80000, 80000, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, '', 12340);"; echo $o; echo " "; } echo ""; mostrar_ids_profissoes($id_escolhido_2); if($_GET['recipes_itens'] == "sim") { echo "
(TRINIYCORE) ITENS npc_vendor VENDEDORES DE RECIPES [".$id_escolhido_2."-".$ultimo_id_2."]"; echo ''; for($i=0;$i<count($f);$i++) { global $f,$class,$sub; $id = $id_escolhido_2+$i; $sql_pegar = mysql_query("SELECT * FROM ".$DATABASE_W.".item_template WHERE RequiredSkill='".$f[$i]."' AND class='".$class[$i]."' AND subclass='".$sub[$i]."'") or die (mysql_error()); if($sub[$i] != null) { $script = '-- '.$id.' -- '.$p[$i].' '; $script .= 'DELETE FROM npc_vendor WHERE entry='.$id.';'.' '; while($fet_pegar = mysql_fetch_array($sql_pegar)) { $script .= 'INSERT INTO npc_vendor (entry, slot, item, maxcount, incrtime, ExtendedCost) VALUES '; $script .= '('.$id.', 0, '.$fet_pegar['entry'].', 0, 0, '.$_GET['extendedcost'].');'.' '; } $script .= ' '; echo $script; } } echo ''; } } } ?>[/CODE]

config.php

[CODE]<?php

$SERVIDOR = “localhost”;

$USUARIO = “root”;

$SENHA = “”;

$DATABASE_W = “world”;

$DATABASE_C = “characters”;

$CONEXAO_W = mysql_connect (

$SERVIDOR,

$USUARIO,

$SENHA

);

$CONEXAO_C = mysql_connect (

$SERVIDOR,

$USUARIO,

$SENHA

);

$W = mysql_select_db ($DATABASE_W,$CONEXAO_W);

$C = mysql_select_db ($DATABASE_C,$CONEXAO_C);

?>[/CODE]

You should use http://pastebin.com/index my friend

I created a new project on Google Code.

http://code.google.com/p/zorieuqs-php-trinitycore-utilities/

I just need to improve more and more and then I will start to host the files there.

SVN Repository:

https://subversion.assembla.com/svn/zptu/

Upgrade to rev. 3

[ul][li]Check items missing in the database but exist in DBCs (useful for creating custom items or weapons) [support for version 3.3.5a].[/li]
[/ul]

Important

IF YOU ARE IN A REVISION ZPTU BEHIND THE REVISION 3, RUN THE FILE itens_dbc.sql (IN FOLDER sql/335a) IN THE DATABASE OF YOUR ZPTU.

Hugs,

bigCheat.