rendered paste body<?
$A9CSV = "A9_out.txt";
$map=530;
$A9fcontent=file($A9CSV);
$fcr=fopen("creat.sql","w");
$fcrt=fopen("creat_temp.sql","w");
$fgot=fopen("go_temp.sql","w");
$fgo=fopen("gameobj.sql","w");
for($i=0;$i<sizeof($A9fcontent);$i++)
{
if(strstr($A9fcontent[$i],"objectTypeId"))
{
if($entry_cr)
{
if(!$maxhealth)$maxhealth=$minhealth;
fwrite($fcrt,"UPDATE `creature_template` SET `minlevel` = '".$minlevel."', `maxlevel` = '".$maxlevel."', `minhealth` = '".$minhealth."', `maxhealth` = '".$maxhealth."', `minmana` = '".$minmana."', `maxmana` = '".$maxmana."', `faction` = '".$faction."', `npcflag` = '".$npcflag."', `mindmg` = '".$mindmg."', `maxdmg` = '".
$maxdmg."', `maxdmg` = '".$maxdmg."', `baseattacktime` = '".$baseattacktime."', `rangeattacktime` = '".$rangeattacktime."', `flags` = '".$flags."', `mount` = '".$mount."', `speed` = '".$speed."', `dynamicflags` = '".
$dynamicflags."', `size` = '".$size."', `bounding_radius` = '".$bounding_radius."', `minrangedmg` = '".$minrangedmg."', `maxrangedmg` = '".$maxrangedmg."', `rangedattackpower` = '".$rangedattackpower."', `combat_reach` = '".
$combat_reach."', `equipmodel1` = '".$equipmodel1."', `equipmodel2` = '".$equipmodel2."', `equipmodel3` = '".$equipmodel3."', `equipinfo1` = '".$equipinfo1."', `equipslot1` = '".$equipslot1."', `equipinfo2` = '".$equipinfo2."', `equipslot2` = '".$equipslot2."', `equipinfo3` = '".$equipinfo3."', `equipslot3` = '".$equipslot3."' WHERE `entry` = '".$entry_cr."';\n");
if(!($pos_x==0&&$pos_y==0&&$pos_z==0&&$pos_o==0))
fwrite($fcr,"INSERT IGNORE INTO `creature` (guid,id, map, position_x, position_y, position_z, orientation, spawntimesecs, spawndist, spawn_position_x, spawn_position_y, spawn_position_z, spawn_orientation, curhealth, curmana, emote_state) VALUES
('".$guidcr."', '".$entry_cr."', '".$map."', '".$pos_x."', '".$pos_y."', '".$pos_z."', '".$pos_o."', '600000', '10', '".$pos_x."', '".$pos_y."', '".$pos_z."', '".$pos_o."', '".$maxhealth."', '".$maxmana."', '".$npcemote."');\n");
}
if($entry_go)
{
fwrite($fgot,"UPDATE `gameobject_template` SET `faction` = '".$faction_go."', `flags` = '".$flags_go."', `size` = '".$size_go."' WHERE `entry` = '".$entry_go."';\n");
fwrite($fgo,"INSERT IGNORE INTO `gameobject` (guid,id, map, position_x, position_y, position_z, orientation, rotation0, rotation1, rotation2, rotation3, spawntimesecs, animprogress, dynflags) VALUES ('".$guidgo."', '".$entry_go."','".$map."','".$pos_xgo."','".$pos_ygo."','".$pos_zgo."','".$pos_ogo."','".$rotation0."','".$rotation1."','".$rotation2."','".$rotation3."','300000','".$animprogress."','".$dynflags."');\n");
}
$mode=0;
//Creatures
$guidcr=0;
$pos_x=0;$pos_y=0;$pos_z=0;$pos_o=0;$minlevel=1;$maxlevel=1;$entry_cr=0;$minhealth=1;$maxhealth=1;$minmana=0;$maxmana=0;$faction=0;$npcflag=0;
$mindmg=1;$maxdmg=1;$attackpower=1;$baseattacktime=1;$rangeattacktime=0;$flags=0;
$mount=0;$dynamicflags=0;$size=1;$bounding_radius=0;$minrangedmg=0;$maxrangedmg=0;$speed=1;
$rangedattackpower=0;$combat_reach=0;$npcemote=0;
//equip
$equipmodel1=0;$equipmodel2=0;$equipmodel3=0;
$equipinfo1=0;$equipinfo2=0;$equipinfo3=0;
$equipslot1=0;$equipslot2=0;$equipslot3=0;
//Game Objects
$guidgo=0;$entry_go=0;
$pos_xgo=0;$pos_ygo=0;$pos_zgo=0;$pos_ogo=0;$faction_go=0;$flags_go=0;$size_go=0;
$rotation0=0;$rotation1=0;$rotation2=0;$rotation3=0;$animprogress=0;$dynflags=0;
}
if(strstr($A9fcontent[$i],"objectTypeId TYPEID_UNIT")&&strstr($A9fcontent[$i-2],"Updatetype: UPDATETYPE_CREATE_OBJECT"))
$mode=1;
if(strstr($A9fcontent[$i],"objectTypeId TYPEID_GAMEOBJECT")&&strstr($A9fcontent[$i-2],"Updatetype: UPDATETYPE_CREATE_OBJECT"))
$mode=2;
if($mode==1)
{
$temp=explode(":",$A9fcontent[$i]);for($j=0;$j<sizeof($temp);$j++)$temp[$j]=trim($temp[$j]);
if(strstr($A9fcontent[$i],"pos_x"))$pos_x=str_replace(',', '.', $temp[1]);
if(strstr($A9fcontent[$i],"pos_y"))$pos_y=str_replace(',', '.', $temp[1]);
if(strstr($A9fcontent[$i],"pos_z"))$pos_z=str_replace(',', '.', $temp[1]);
if(strstr($A9fcontent[$i],"pos_o"))$pos_o=str_replace(',', '.', $temp[1]);
if(strstr($A9fcontent[$i],"UNIT_FIELD_GUID_LOW"))$guidcr=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_FIELD_LEVEL"))$minlevel=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_FIELD_LEVEL"))$maxlevel=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_FIELD_ENTRY"))$entry_cr=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_FIELD_HEALTH"))$minhealth=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_FIELD_MAXHEALTH"))$maxhealth=$temp[$i];
if(strstr($A9fcontent[$i],"UNIT_FIELD_BASE_MANA"))$minmana=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_FIELD_BASE_MANA"))$maxmana=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_FIELD_FACTIONTEMPLATE"))$faction=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_NPC_FLAGS"))$npcflag=$temp[1];
//if(strstr($A9fcontent[$i],""))$speed=$A9fcontent[$i]; //?
//if(strstr($A9fcontent[$i],""))$rank=$A9fcontent[$i]; //wdbFeild10?
if(strstr($A9fcontent[$i],"UNIT_FIELD_MINDAMAGE"))$mindmg=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_FIELD_MAXDAMAGE"))$maxdmg=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_FIELD_ATTACK_POWER"))$attackpower=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_FIELD_BASEATTACKTIME"))$baseattacktime=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_FIELD_RANGEDATTACKTIME"))$rangeattacktime=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_FIELD_FLAGS"))$flags=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_FIELD_MOUNTDISPLAYID"))$mount=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_DYNAMIC_FLAGS"))$dynamicflags=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_FIELD_SCALE_X"))$size=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_FIELD_BOUNDINGRADIUS"))$bounding_radius=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_FIELD_MINRANGEDDAMAGE"))$minrangedmg=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_FIELD_MAXRANGEDDAMAGE"))$maxrangedmg=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_FIELD_RANGED_ATTACK_POWER"))$rangedattackpower=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_FIELD_COMBATREACH"))$combat_reach=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_VIRTUAL_ITEM_SLOT_DISPLAY1"))$equipmodel1=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_VIRTUAL_ITEM_SLOT_DISPLAY2"))$equipmodel2=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_VIRTUAL_ITEM_SLOT_DISPLAY3"))$equipmodel3=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_VIRTUAL_ITEM_INFO1"))$equipinfo1=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_VIRTUAL_ITEM_INFO2"))$equipslot1=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_VIRTUAL_ITEM_INFO3"))$equipinfo2=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_VIRTUAL_ITEM_INFO4"))$equipslot2=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_VIRTUAL_ITEM_INFO5"))$equipinfo3=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_VIRTUAL_ITEM_INFO6"))$equipslot3=$temp[1];
if(strstr($A9fcontent[$i],"UNIT_NPC_EMOTESTATE"))$npcemote=$temp[1];
}
if($mode==2)
{
$temp=explode(":",$A9fcontent[$i]);for($j=0;$j<sizeof($temp);$j++)$temp[$j]=trim($temp[$j]);
if(strstr($A9fcontent[$i],"pos_x"))$pos_xgo=str_replace(',', '.', $temp[1]);
if(strstr($A9fcontent[$i],"pos_y"))$pos_ygo=str_replace(',', '.', $temp[1]);
if(strstr($A9fcontent[$i],"pos_z"))$pos_zgo=str_replace(',', '.', $temp[1]);
if(strstr($A9fcontent[$i],"pos_o"))$pos_ogo=str_replace(',', '.', $temp[1]);
if(strstr($A9fcontent[$i],"UNIT_FIELD_GUID_LOW"))$guidgo=$temp[1];
if(strstr($A9fcontent[$i],"GAMEOBJECT_SCALE_X"))$size_go=$temp[1];
if(strstr($A9fcontent[$i],"GAMEOBJECT_ENTRY"))$entry_go=$temp[1];
if(strstr($A9fcontent[$i],"GAMEOBJECT_FLAGS"))$flags_go=$temp[1];
if(strstr($A9fcontent[$i],"GAMEOBJECT_FACTION"))$faction_go=$temp[1];
if(strstr($A9fcontent[$i],"GAMEOBJECT_ROTATION1"))$rotation0=str_replace(',', '.', $temp[1]);
if(strstr($A9fcontent[$i],"GAMEOBJECT_ROTATION2"))$rotation1=str_replace(',', '.', $temp[1]);
if(strstr($A9fcontent[$i],"GAMEOBJECT_ROTATION3"))$rotation2=str_replace(',', '.', $temp[1]);
if(strstr($A9fcontent[$i],"GAMEOBJECT_ROTATION4"))$rotation3=str_replace(',', '.', $temp[1]);
if(strstr($A9fcontent[$i],"GAMEOBJECT_ANIMPROGRESS"))$animprogress=$temp[1];
if(strstr($A9fcontent[$i],"GAMEOBJECT_DYN_FLAGS"))$dynflags=$temp[1];
}
}
echo "ok";
?>