Guest User

Untitled

a guest
Apr 8th, 2020
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 29.04 KB | None | 0 0
  1. <?php
  2. error_reporting(E_ALL & ~E_NOTICE);
  3.  
  4. require_once('config.php');
  5. $conn = sqlsrv_connect($svName, $conn_info);
  6. if(! $conn)
  7. {
  8.    //echo "Connection could not be established.\n";
  9.    die( print_r( sqlsrv_errors(), true));
  10.    exit();
  11. }
  12.  
  13. $data = simplexml_load_file('./itemsDB.xml');
  14.  
  15. foreach( $data->WeaponsArmory->Weapon as $tmp_data ){
  16.    $sql = "SELECT * FROM [dbo].[Items_Weapons] WHERE [ItemID] = '".$tmp_data['itemID']."'";
  17.    $stmt = sqlsrv_query($conn, $sql , array(), array("Scrollable"=>"buffered"));
  18.  
  19.    echo "ItemID: ".$tmp_data['itemID']." Name: ".$tmp_data->Store['name'];
  20.    if(sqlsrv_num_rows($stmt) == 0){
  21.       $sql_cmd = "INSERT INTO [dbo].[Items_Weapons] VALUES (
  22.         ".$tmp_data['itemID']."
  23.         ,N'".($tmp_data['FNAME']?$tmp_data['FNAME']:substr($tmp_data->Model['file'],26,strlen($tmp_data->Model['file'])-30))."'
  24.         ,".$tmp_data['category']."
  25.         ,N'".$tmp_data->Store['name']."'
  26.         ,N'".str_replace("'","''",$tmp_data->Store['desc'])."'
  27.         ,N'".trim($tmp_data->Model['muzzlerOffset.x']." "
  28.             .$tmp_data->Model['muzzlerOffset.y']." "
  29.             .$tmp_data->Model['muzzlerOffset.z'])."'
  30.         ,N'".$tmp_data->MuzzleModel['file']."'
  31.         ,N'".$tmp_data->Animation['type']."'
  32.         ,N'".$tmp_data->PrimaryFire['bullet']."'
  33.         ,N'".$tmp_data->Sound['shoot']."'
  34.         ,N'".$tmp_data->Sound['reload']."'
  35.         ,".(double)$tmp_data->PrimaryFire['damage']."
  36.         ,".($tmp_data->PrimaryFire['immediate'] == 'true'?1:0)."
  37.         ,".(double)$tmp_data->PrimaryFire['mass']."
  38.         ,".(int)$tmp_data->PrimaryFire['speed']."
  39.         ,".(double)$tmp_data->PrimaryFire['decay']."
  40.         ,".(double)$tmp_data->PrimaryFire['area']."
  41.         ,".(double)$tmp_data->PrimaryFire['delay']."
  42.         ,".(double)$tmp_data->PrimaryFire['timeout']."
  43.         ,".(int)$tmp_data->PrimaryFire['numShells']."
  44.         ,".(int)$tmp_data->PrimaryFire['clipSize']."
  45.         ,".(double)$tmp_data->PrimaryFire['reloadTime']."
  46.         ,".(double)$tmp_data->PrimaryFire['activeReloadTick']."
  47.         ,".(double)$tmp_data->PrimaryFire['rateOfFire']."
  48.         ,".(double)$tmp_data->PrimaryFire['spread']."
  49.         ,".(double)$tmp_data->PrimaryFire['recoil']."
  50.         ,".(double)$tmp_data->PrimaryFire['numgrenades']."
  51.         ,N'".$tmp_data->PrimaryFire['grenadename']."'
  52.         ,N'".$tmp_data->PrimaryFire['firemode']."'
  53.         ,30
  54.         ,N'".$tmp_data->PrimaryFire['ScopeType']."'
  55.         ,".(double)$tmp_data->PrimaryFire['ScopeZoom']."
  56.         ,0 ,0 ,0 ,0 ,0
  57.         ,".(double)$tmp_data->Store['LevelRequired']."
  58.         ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0
  59.         ,".(double)$tmp_data['upgrade']."
  60.         ,".(double)$tmp_data->FPS['IsFPS']."
  61.         ,".(double)$tmp_data->FPS['i0']."
  62.         ,".(double)$tmp_data->FPS['i1']."
  63.         ,".(double)$tmp_data->FPS['i2']."
  64.         ,".(double)$tmp_data->FPS['i3']."
  65.         ,".(double)$tmp_data->FPS['i4']."
  66.         ,".(double)$tmp_data->FPS['i5']."
  67.         ,".(double)$tmp_data->FPS['i6']."
  68.         ,".(double)$tmp_data->FPS['i7']."
  69.         ,".(double)$tmp_data->FPS['i8']."
  70.         ,".(double)$tmp_data->FPS['d0']."
  71.         ,".(double)$tmp_data->FPS['d1']."
  72.         ,".(double)$tmp_data->FPS['d2']."
  73.         ,".(double)$tmp_data->FPS['d3']."
  74.         ,".(double)$tmp_data->FPS['d4']."
  75.         ,".(double)$tmp_data->FPS['d5']."
  76.         ,".(double)$tmp_data->FPS['d6']."
  77.         ,".(double)$tmp_data->FPS['d7']."
  78.         ,".(double)$tmp_data->FPS['d8']."
  79.         ,N'".($tmp_data->Model['AnimPrefix']?$tmp_data->Model['AnimPrefix']:$tmp_data['FNAME'])."'
  80.         ,".(int)$tmp_data['Weight']."
  81.         ,".(int)$tmp_data->Dur['u']."
  82.         ,".(int)$tmp_data->Dur['r1']."
  83.         ,".(int)$tmp_data->Dur['r2']."
  84.         ,".(int)$tmp_data->Dur['r3']."
  85.         ,".(int)$tmp_data->Res['r1']."
  86.         ,".(int)$tmp_data->Res['r2']."
  87.         ,".(int)$tmp_data->Res['r3'].")";
  88.       echo " Status: New!<br>";
  89.    }else{
  90.       $sql_cmd = "UPDATE [dbo].[Items_Weapons]
  91.      SET [FNAME] = N'".($tmp_data['FNAME']?$tmp_data['FNAME']:substr($tmp_data->Model['file'],26,strlen($tmp_data->Model['file'])-30))."'
  92.         ,[Category] = ".$tmp_data['category']."
  93.         ,[Name] = N'".$tmp_data->Store['name']."'
  94.         ,[Description] = N'".str_replace("'","''",$tmp_data->Store['desc'])."'
  95.         ,[MuzzleOffset] = N'".trim($tmp_data->Model['muzzlerOffset.x']." ".$tmp_data->Model['muzzlerOffset.y']." ".$tmp_data->Model['muzzlerOffset.z'])."'
  96.         ,[MuzzleParticle] = N'".$tmp_data->MuzzleModel['file']."'
  97.         ,[Animation] = N'".$tmp_data->Animation['type']."'
  98.         ,[BulletID] = N'".$tmp_data->PrimaryFire['bullet']."'
  99.         ,[Sound_Shot] = N'".$tmp_data->Sound['shoot']."'
  100.         ,[Sound_Reload] = N'".$tmp_data->Sound['reload']."'
  101.         ,[Damage] = ".(double)$tmp_data->PrimaryFire['damage']."
  102.         ,[isImmediate] = ".($tmp_data->PrimaryFire['immediate'] == 'true'?1:0)."
  103.         ,[Mass] = ".(double)$tmp_data->PrimaryFire['mass']."
  104.         ,[Speed] = ".(int)$tmp_data->PrimaryFire['speed']."
  105.         ,[DamageDecay] = ".(double)$tmp_data->PrimaryFire['decay']."
  106.         ,[Area] = ".(double)$tmp_data->PrimaryFire['area']."
  107.         ,[Delay] = ".(double)$tmp_data->PrimaryFire['delay']."
  108.         ,[Timeout] = ".(double)$tmp_data->PrimaryFire['timeout']."
  109.         ,[NumClips] = ".(int)$tmp_data->PrimaryFire['numShells']."
  110.         ,[Clipsize] = ".(int)$tmp_data->PrimaryFire['clipSize']."
  111.         ,[ReloadTime] = ".(double)$tmp_data->PrimaryFire['reloadTime']."
  112.         ,[ActiveReloadTick] = ".(double)$tmp_data->PrimaryFire['activeReloadTick']."
  113.         ,[RateOfFire] = ".(double)$tmp_data->PrimaryFire['rateOfFire']."
  114.         ,[Spread] = ".(double)$tmp_data->PrimaryFire['spread']."
  115.         ,[Recoil] = ".(double)$tmp_data->PrimaryFire['recoil']."
  116.         ,[NumGrenades] = ".(double)$tmp_data->PrimaryFire['numgrenades']."
  117.         ,[GrenadeName] = N'".$tmp_data->PrimaryFire['grenadename']."'
  118.         ,[Firemode] = N'".$tmp_data->PrimaryFire['firemode']."'
  119.         ,[ScopeType] = N'".$tmp_data->PrimaryFire['ScopeType']."'
  120.         ,[ScopeZoom] = ".(double)$tmp_data->PrimaryFire['ScopeZoom']."
  121.         ,[LevelRequired] = ".(double)$tmp_data->Store['LevelRequired']."
  122.         ,[IsUpgradeable] = ".(double)$tmp_data['upgrade']."
  123.         ,[IsFPS] = ".(double)$tmp_data->FPS['IsFPS']."
  124.         ,[FPSSpec0] = ".(double)$tmp_data->FPS['i0']."
  125.         ,[FPSSpec1] = ".(double)$tmp_data->FPS['i1']."
  126.         ,[FPSSpec2] = ".(double)$tmp_data->FPS['i2']."
  127.         ,[FPSSpec3] = ".(double)$tmp_data->FPS['i3']."
  128.         ,[FPSSpec4] = ".(double)$tmp_data->FPS['i4']."
  129.         ,[FPSSpec5] = ".(double)$tmp_data->FPS['i5']."
  130.         ,[FPSSpec6] = ".(double)$tmp_data->FPS['i6']."
  131.         ,[FPSSpec7] = ".(double)$tmp_data->FPS['i7']."
  132.         ,[FPSSpec8] = ".(double)$tmp_data->FPS['i8']."
  133.         ,[FPSAttach0] = ".(double)$tmp_data->FPS['d0']."
  134.         ,[FPSAttach1] = ".(double)$tmp_data->FPS['d1']."
  135.         ,[FPSAttach2] = ".(double)$tmp_data->FPS['d2']."
  136.         ,[FPSAttach3] = ".(double)$tmp_data->FPS['d3']."
  137.         ,[FPSAttach4] = ".(double)$tmp_data->FPS['d4']."
  138.         ,[FPSAttach5] = ".(double)$tmp_data->FPS['d5']."
  139.         ,[FPSAttach6] = ".(double)$tmp_data->FPS['d6']."
  140.         ,[FPSAttach7] = ".(double)$tmp_data->FPS['d7']."
  141.         ,[FPSAttach8] = ".(double)$tmp_data->FPS['d8']."
  142.         ,[AnimPrefix] = N'".($tmp_data->Model['AnimPrefix']?$tmp_data->Model['AnimPrefix']:$tmp_data['FNAME'])."'
  143.         ,[Weight] = ".(int)$tmp_data['Weight']."
  144.         ,[DurabilityUse] = ".(double)$tmp_data->Dur['u']."
  145.         ,[RepairAmount] = ".(double)$tmp_data->Dur['r1']."
  146.         ,[PremRepairAmount] = ".(double)$tmp_data->Dur['r2']."
  147.         ,[RepairPriceGD] = ".(double)$tmp_data->Dur['r3']."
  148.         ,[ResWood] = ".(int)$tmp_data->Res['r1']."
  149.         ,[ResStone] = ".(int)$tmp_data->Res['r2']."
  150.         ,[ResMetal] = ".(int)$tmp_data->Res['r3']."
  151.   WHERE [ItemID] = '".$tmp_data['itemID']."'";
  152.    echo " Status: Update<br>";
  153.    }
  154.    $stmt = sqlsrv_query($conn, $sql_cmd); }
  155.  
  156. foreach( $data->FoodArmory->Item as $tmp_data ){
  157.    $sql = "SELECT * FROM [dbo].[Items_Weapons] WHERE [ItemID] = '".$tmp_data['itemID']."'";
  158.    $stmt = sqlsrv_query($conn, $sql , array(), array("Scrollable"=>"buffered"));
  159.  
  160.    echo "ItemID: ".$tmp_data['itemID']." Name: ".$tmp_data->Store['name'];
  161.    if(sqlsrv_num_rows($stmt) == 0){
  162.       $sql_cmd = "INSERT INTO [dbo].[Items_Weapons] VALUES (
  163.         ".$tmp_data['itemID']."
  164.         ,N'".substr($tmp_data->Model['file'],26,strlen($tmp_data->Model['file'])-30)."'
  165.         ,".$tmp_data['category']."
  166.         ,N'".$tmp_data->Store['name']."'
  167.         ,N'".str_replace("'","''",$tmp_data->Store['desc'])."'
  168.         ,N'' ,N'' ,N'' ,N'' ,N'' ,N'' ,0 ,0 ,0 ,0 ,0
  169.         ,".(double)$tmp_data->Property['stamina']."
  170.         ,0 ,0 ,0
  171.         ,".(int)$tmp_data->Property['shopSS']."
  172.         ,".(double)$tmp_data->Property['health']."
  173.         ,0
  174.         ,".(double)$tmp_data->Property['toxicity']."
  175.         ,".(double)$tmp_data->Property['water']."
  176.         ,".(double)$tmp_data->Property['food']."
  177.         ,0 ,N'' ,N'' ,30 ,N'' ,0 ,0 ,0 ,0 ,0 ,0
  178.         ,".(double)$tmp_data->Store['LevelRequired']."
  179.         ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,N''
  180.         ,".(int)$tmp_data['Weight']."
  181.         ,0 ,0 ,0 ,0 ,0 ,0 ,0)";
  182.       echo " Status: New!<br>";
  183.    }else{
  184.       $sql_cmd = "UPDATE [dbo].[Items_Weapons]
  185.       SET [FNAME] = N'".substr($tmp_data->Model['file'],26,strlen($tmp_data->Model['file'])-30)."'
  186.         ,[Category] = ".$tmp_data['category']."
  187.         ,[Name] = N'".$tmp_data->Store['name']."'
  188.         ,[Description] = N'".str_replace("'","''",$tmp_data->Store['desc'])."'
  189.         ,[Area] = ".(double)$tmp_data->Property['stamina']."
  190.         ,[Clipsize] = ".(int)$tmp_data->Property['shopSS']."
  191.         ,[ReloadTime] = ".(double)$tmp_data->Property['health']."
  192.         ,[RateOfFire] = ".(double)$tmp_data->Property['toxicity']."
  193.         ,[Spread] = ".(double)$tmp_data->Property['water']."
  194.         ,[Recoil] = ".(double)$tmp_data->Property['food']."
  195.         ,[LevelRequired] = ".(double)$tmp_data->Store['LevelRequired']."      
  196.         ,[Weight] = ".(int)$tmp_data['Weight']."
  197.      WHERE [ItemID] = ".$tmp_data['itemID'];
  198.    echo " Status: Update<br>";
  199.    }
  200.    $stmt = sqlsrv_query($conn, $sql_cmd);
  201. }
  202.  
  203. foreach( $data->VehicleArmory->Item as $tmp_data ){
  204.    $sql = "SELECT * FROM [dbo].[Items_Weapons] WHERE [ItemID] = '".$tmp_data['itemID']."'";
  205.    $stmt = sqlsrv_query($conn, $sql , array(), array("Scrollable"=>"buffered"));
  206.  
  207.    echo "ItemID: ".$tmp_data['itemID']." Name: ".$tmp_data->Store['name'];
  208.    if(sqlsrv_num_rows($stmt) == 0){
  209.       $sql_cmd = "INSERT INTO [dbo].[Items_Weapons] VALUES (
  210.         ".$tmp_data['itemID']."
  211.         ,N'".$tmp_data->Property['fname']."'
  212.         ,".$tmp_data['category']."
  213.         ,N'".$tmp_data->Store['name']."'
  214.         ,N'".str_replace("'","''",$tmp_data->Store['desc'])."'
  215.         ,N'' ,N'' ,N'' ,N'' ,N'' ,N'' ,0 ,0 ,0 ,0 ,0
  216.         ,".(double)$tmp_data->Property['fuel']."
  217.         ,0 ,0 ,0 ,0
  218.         ,".(double)$tmp_data->Property['durability']."
  219.         ,".(double)$tmp_data->Property['armor']."
  220.         ,0
  221.         ,".(double)$tmp_data->Property['torque']."
  222.         ,".(double)$tmp_data->Property['omega']."
  223.         ,0 ,N'' ,N'' ,30 ,N'' ,0 ,0 ,0 ,0 ,0 ,0 ,0
  224.         ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,N''
  225.         ,".(int)$tmp_data['Weight']."
  226.         ,0 ,0 ,0 ,0 ,0 ,0 ,0)";
  227.       echo " Status: New!<br>";
  228.    }else{
  229.       $sql_cmd = "UPDATE [dbo].[Items_Weapons]
  230.      SET [FNAME] = N'".$tmp_data->Property['fname']."'
  231.         ,[Category] = ".$tmp_data['category']."
  232.        ,[Name] = N'".$tmp_data->Store['name']."'
  233.        ,[Description] = N'".str_replace("'","''",$tmp_data->Store['desc'])."'
  234.        ,[Area] = ".(double)$tmp_data->Property['fuel']."
  235.        ,[ReloadTime] = ".(double)$tmp_data->Property['durability']."
  236.        ,[ActiveReloadTick] = ".(double)$tmp_data->Property['armor']."
  237.        ,[Spread] = ".(double)$tmp_data->Property['torque']."
  238.        ,[Recoil] = ".(double)$tmp_data->Property['omega']."
  239.      WHERE [ItemID] = ".$tmp_data['itemID'];
  240.       echo " Status: Update<br>";
  241.    }
  242.    $stmt = sqlsrv_query($conn, $sql_cmd);
  243. }
  244.  
  245. foreach( $data->CraftComponentsArmory->Item as $tmp_data ){
  246.    $sql = "SELECT * FROM [dbo].[Items_Generic] WHERE [ItemID] = '".$tmp_data['itemID']."'";
  247.    $stmt = sqlsrv_query($conn, $sql , array(), array("Scrollable"=>"buffered"));
  248.  
  249.    echo "ItemID: ".$tmp_data['itemID']." Name: ".$tmp_data->Store['name'];
  250.    if(sqlsrv_num_rows($stmt) == 0){
  251.       $sql_cmd = "INSERT INTO [dbo].[Items_Generic] VALUES (
  252.         ".$tmp_data['itemID']."
  253.         ,N'".substr($tmp_data->Model['file'],26,strlen($tmp_data->Model['file'])-30)."'
  254.         ,".$tmp_data['category']."
  255.         ,N'".$tmp_data->Store['name']."'
  256.         ,N'".str_replace("'","''",$tmp_data->Store['desc'])."'
  257.         ,0 ,0 ,0 ,0 ,0
  258.         ,".(double)$tmp_data->Store['LevelRequired']."
  259.         ,0 ,0 ,0 ,0
  260.         ,".(int)$tmp_data['Weight']."
  261.         ,0 ,0 ,0)";
  262.       echo " Status: New!<br>";
  263.    }else{
  264.       $sql_cmd = "UPDATE [dbo].[Items_Generic]
  265.       SET [FNAME] = N'".substr($tmp_data->Model['file'],26,strlen($tmp_data->Model['file'])-30)."'
  266.         ,[Category] = ".$tmp_data['category']."
  267.         ,[Name] = N'".$tmp_data->Store['name']."'
  268.         ,[Description] = N'".str_replace("'","''",$tmp_data->Store['desc'])."'
  269.         ,[LevelRequired] = ".(double)$tmp_data->Store['LevelRequired']."
  270.         ,[Weight] = ".(int)$tmp_data['Weight']."
  271.      WHERE [ItemID] = ".$tmp_data['itemID'];
  272.       echo " Status: Update<br>";
  273.    }
  274.    $stmt = sqlsrv_query($conn, $sql_cmd);
  275. }
  276.  
  277. foreach( $data->CraftRecipeArmory->Item as $tmp_data ){
  278.    $sql = "SELECT * FROM [dbo].[Items_Generic] WHERE [ItemID] = '".$tmp_data['itemID']."'";
  279.    $stmt = sqlsrv_query($conn, $sql , array(), array("Scrollable"=>"buffered"));
  280.  
  281.    echo "ItemID: ".$tmp_data['itemID']." Name: ".$tmp_data->Store['name'];
  282.    if(sqlsrv_num_rows($stmt) == 0){
  283.       $sql_cmd = "INSERT INTO [dbo].[Items_Generic] VALUES (
  284.         ".$tmp_data['itemID']."
  285.         ,N'".substr($tmp_data->Model['file'],26,strlen($tmp_data->Model['file'])-30)."'
  286.         ,".$tmp_data['category']."
  287.         ,N'".$tmp_data->Store['name']."'
  288.         ,N'".str_replace("'","''",$tmp_data->Store['desc'])."'
  289.         ,0 ,0 ,0 ,0 ,0
  290.         ,".(double)$tmp_data->Store['LevelRequired']."
  291.         ,0 ,0 ,0 ,0
  292.         ,".(int)$tmp_data['Weight']."
  293.         ,0 ,0 ,0)";
  294.       echo " Status: New!<br>";
  295.    }else{
  296.       $sql_cmd = "UPDATE [dbo].[Items_Generic]
  297.         SET [FNAME] = N'".substr($tmp_data->Model['file'],26,strlen($tmp_data->Model['file'])-30)."'
  298.            ,[Category] = ".$tmp_data['category']."
  299.            ,[Name] = N'".$tmp_data->Store['name']."'
  300.            ,[Description] = N'".str_replace("'","''",$tmp_data->Store['desc'])."'
  301.            ,[LevelRequired] = ".(double)$tmp_data->Store['LevelRequired']."
  302.            ,[Weight] = ".(int)$tmp_data['Weight']."
  303.         WHERE [ItemID] = ".$tmp_data['itemID'];
  304.       echo " Status: Update<br>";
  305.    }
  306.    $stmt = sqlsrv_query($conn, $sql_cmd);
  307. }
  308.  
  309. foreach( $data->GearArmory->Gear as $tmp_data ){
  310.    $sql = "SELECT * FROM [dbo].[Items_Gear] WHERE [ItemID] = '".$tmp_data['itemID']."'";
  311.    $stmt = sqlsrv_query($conn, $sql , array(), array("Scrollable"=>"buffered"));
  312.  
  313.    echo "ItemID: ".$tmp_data['itemID']." Name: ".$tmp_data->Store['name'];
  314.    if(sqlsrv_num_rows($stmt) == 0){
  315.       $sql_cmd = "INSERT INTO [dbo].[Items_Gear] VALUES (
  316.         ".$tmp_data['itemID']."
  317.         ,N'".substr($tmp_data->Model['file'],29,strlen($tmp_data->Model['file'])-33)."'
  318.         ,N'".str_replace("'","''",$tmp_data->Store['name'])."'
  319.         ,N'".str_replace("'","''",$tmp_data->Store['desc'])."'
  320.         ,".$tmp_data['category']."
  321.         ,".(int)$tmp_data['Weight']."
  322.         ,".(int)$tmp_data->Armor['damagePerc']."
  323.         ,".(int)$tmp_data->Armor['damageMax']."
  324.         ,".(int)$tmp_data->Armor['bulkiness']."
  325.         ,".(int)$tmp_data->Armor['inaccuracy']."
  326.         ,".(int)$tmp_data->Armor['stealth']."
  327.         ,0 ,0 ,0 ,0 ,0
  328.         ,".(int)$tmp_data->Armor['ProtectionLevel']."
  329.         ,".(double)$tmp_data->Store['LevelRequired']."
  330.         ,0 ,0 ,0 ,0
  331.         ,".(int)$tmp_data->Dur['u']."
  332.         ,".(int)$tmp_data->Dur['r1']."
  333.         ,".(int)$tmp_data->Dur['r2']."
  334.         ,".(int)$tmp_data->Dur['r3']."
  335.         ,0 ,0 ,0)";
  336.       echo " Status: New!<br>";
  337.    }else{
  338.       $sql_cmd = "UPDATE [dbo].[Items_Gear]
  339.         SET [FNAME] = N'".substr($tmp_data->Model['file'],29,strlen($tmp_data->Model['file'])-33)."'
  340.            ,[Name] = N'".str_replace("'","''",$tmp_data->Store['name'])."'
  341.            ,[Description] = N'".str_replace("'","''",$tmp_data->Store['desc'])."'
  342.            ,[Category] = ".$tmp_data['category']."
  343.            ,[Weight] = ".(int)$tmp_data['Weight']."
  344.            ,[DamagePerc] = ".(int)$tmp_data->Armor['damagePerc']."
  345.            ,[DamageMax] = ".(int)$tmp_data->Armor['damageMax']."
  346.            ,[Bulkiness] = ".(int)$tmp_data->Armor['bulkiness']."
  347.            ,[Inaccuracy] = ".(int)$tmp_data->Armor['inaccuracy']."
  348.            ,[Stealth] = ".(int)$tmp_data->Armor['stealth']."
  349.            ,[ProtectionLevel] = ".(int)$tmp_data->Armor['ProtectionLevel']."
  350.            ,[LevelRequired] = ".(double)$tmp_data->Store['LevelRequired']."
  351.            ,[DurabilityUse] = ".(int)$tmp_data->Dur['u']."
  352.            ,[RepairAmount] = ".(int)$tmp_data->Dur['r1']."
  353.            ,[PremRepairAmount] = ".(int)$tmp_data->Dur['r2']."
  354.            ,[RepairPriceGD] = ".(int)$tmp_data->Dur['r3']."
  355.         WHERE [ItemID] = ".$tmp_data['itemID'];
  356.       echo " Status: Update<br>";
  357.    }
  358.    $stmt = sqlsrv_query($conn, $sql_cmd);
  359. }
  360.  
  361. foreach( $data->HeroArmory->Hero as $tmp_data ){
  362.    $sql = "SELECT * FROM [dbo].[Items_Gear] WHERE [ItemID] = '".$tmp_data['itemID']."'";
  363.    $stmt = sqlsrv_query($conn, $sql , array(), array("Scrollable"=>"buffered"));
  364.  
  365.    echo "ItemID: ".$tmp_data['itemID']." Name: ".$tmp_data->Store['name'];
  366.    if(sqlsrv_num_rows($stmt) == 0){
  367.       $sql_cmd = "INSERT INTO [dbo].[Items_Gear] VALUES (
  368.         ".$tmp_data['itemID']."
  369.         ,N'".substr($tmp_data->Model['file'],29,strlen($tmp_data->Model['file'])-29)."'
  370.         ,N'".str_replace("'","''",$tmp_data->Store['name'])."'
  371.         ,N'".str_replace("'","''",$tmp_data->Store['desc'])."'
  372.         ,".$tmp_data['category']."
  373.         ,".(int)$tmp_data['Weight']."
  374.         ,".(int)$tmp_data->HeroDesc['damagePerc']."
  375.         ,".(int)$tmp_data->HeroDesc['damageMax']."
  376.         ,".(int)$tmp_data->HeroDesc['maxHeads']."
  377.         ,".(int)$tmp_data->HeroDesc['maxBodys']."
  378.         ,".(int)$tmp_data->HeroDesc['maxLegs']."
  379.         ,0 ,0 ,0 ,0 ,0
  380.         ,".(int)$tmp_data->HeroDesc['ProtectionLevel']."
  381.         ,".(double)$tmp_data->Store['LevelRequired']."
  382.         ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0)";
  383.       echo " Status: New!<br>";
  384.    }else{
  385.          $sql_cmd = "UPDATE [dbo].[Items_Gear]
  386.         SET [FNAME] = N'".substr($tmp_data->Model['file'],29,strlen($tmp_data->Model['file'])-29)."'
  387.            ,[Name] = N'".str_replace("'","''",$tmp_data->Store['name'])."'
  388.            ,[Description] = N'".str_replace("'","''",$tmp_data->Store['desc'])."'
  389.            ,[Category] = ".$tmp_data['category']."
  390.            ,[Weight] = ".(int)$tmp_data['Weight']."
  391.            ,[DamagePerc] = ".(int)$tmp_data->HeroDesc['damagePerc']."
  392.            ,[DamageMax] = ".(int)$tmp_data->HeroDesc['damageMax']."
  393.            ,[Bulkiness] = ".(int)$tmp_data->HeroDesc['maxHeads']."
  394.            ,[Inaccuracy] = ".(int)$tmp_data->HeroDesc['maxBodys']."
  395.            ,[Stealth] = ".(int)$tmp_data->HeroDesc['maxLegs']."
  396.            ,[ProtectionLevel] = ".(int)$tmp_data->HeroDesc['ProtectionLevel']."
  397.            ,[LevelRequired] = ".(double)$tmp_data->Store['LevelRequired']."
  398.            ,[DurabilityUse] = ".(int)$tmp_data->Dur['u']."
  399.            ,[RepairAmount] = ".(int)$tmp_data->Dur['r1']."
  400.            ,[PremRepairAmount] = ".(int)$tmp_data->Dur['r2']."
  401.            ,[RepairPriceGD] = ".(int)$tmp_data->Dur['r3']."
  402.         WHERE [ItemID] = ".$tmp_data['itemID'];
  403.       echo " Status: Update<br>";
  404.    }
  405.    $stmt = sqlsrv_query($conn, $sql_cmd);
  406. }
  407.  
  408. foreach( $data->BackpackArmory->Backpack as $tmp_data ){
  409.    $sql = "SELECT * FROM [dbo].[Items_Gear] WHERE [ItemID] = '".$tmp_data['itemID']."'";
  410.    $stmt = sqlsrv_query($conn, $sql , array(), array("Scrollable"=>"buffered"));
  411.  
  412.    echo "ItemID: ".$tmp_data['itemID']." Name: ".$tmp_data->Store['name'];
  413.    if(sqlsrv_num_rows($stmt) == 0){
  414.       $sql_cmd = "INSERT INTO [dbo].[Items_Gear] VALUES (
  415.         ".$tmp_data['itemID']."
  416.         ,N'".substr($tmp_data->Model['file'],29,strlen($tmp_data->Model['file'])-33)."'
  417.         ,N'".str_replace("'","''",$tmp_data->Store['name'])."'
  418.         ,N'".str_replace("'","''",$tmp_data->Store['desc'])."'
  419.         ,".$tmp_data['category']."
  420.         ,".(int)$tmp_data['Weight']."
  421.         ,0 ,0
  422.         ,".(int)$tmp_data->Desc['maxSlots']."
  423.         ,".(int)$tmp_data->Desc['maxWeight']."
  424.         ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0)";
  425.       echo " Status: New!<br>";
  426.    }else{
  427.       $sql_cmd = "UPDATE [dbo].[Items_Gear]
  428.         SET [FNAME] = N'".substr($tmp_data->Model['file'],29,strlen($tmp_data->Model['file'])-33)."'
  429.            ,[Name] = N'".str_replace("'","''",$tmp_data->Store['name'])."'
  430.            ,[Description] = N'".str_replace("'","''",$tmp_data->Store['desc'])."'
  431.            ,[Category] = ".$tmp_data['category']."
  432.            ,[Weight] = ".(int)$tmp_data['Weight']."
  433.            ,[Bulkiness] = ".(int)$tmp_data->Desc['maxSlots']."
  434.            ,[Inaccuracy] = ".(int)$tmp_data->Desc['maxWeight']."
  435.         WHERE [ItemID] = ".$tmp_data['itemID'];
  436.       echo " Status: Update<br>";
  437.    }
  438.    $stmt = sqlsrv_query($conn, $sql_cmd);
  439. }
  440.  
  441. foreach( $data->ItemsDB->Item as $tmp_data ){
  442.    $sql = "SELECT * FROM [dbo].[Items_Generic] WHERE [ItemID] = '".$tmp_data['itemID']."'";
  443.    $stmt = sqlsrv_query($conn, $sql , array(), array("Scrollable"=>"buffered"));
  444.  
  445.    echo "ItemID: ".$tmp_data['itemID']." Name: ".$tmp_data->Store['name'];
  446.    if(sqlsrv_num_rows($stmt) == 0){
  447.       $sql_cmd = "INSERT INTO [dbo].[Items_Generic] VALUES (
  448.         ".$tmp_data['itemID']."
  449.         ,N'".substr($tmp_data->Store['icon'],25,strlen($tmp_data->Store['icon'])-29)."'
  450.         ,".$tmp_data['category']."
  451.         ,N'".$tmp_data->Store['name']."'
  452.         ,N'".str_replace("'","''",$tmp_data->Store['desc'])."'
  453.         ,0 ,0 ,0 ,0 ,0
  454.         ,".(double)$tmp_data->Store['LevelRequired']."
  455.         ,0 ,0 ,0 ,0
  456.         ,".(int)$tmp_data['Weight']."
  457.         ,0 ,0 ,0)";
  458.       echo " Status: New!<br>";
  459.    }else{
  460.       $sql_cmd = "UPDATE [dbo].[Items_Generic]
  461.         SET [FNAME] = N'".substr($tmp_data->Store['icon'],25,strlen($tmp_data->Store['icon'])-29)."'
  462.            ,[Category] = ".$tmp_data['category']."
  463.            ,[Name] = N'".$tmp_data->Store['name']."'
  464.            ,[Description] = N'".str_replace("'","''",$tmp_data->Store['desc'])."'
  465.            ,[LevelRequired] = ".(double)$tmp_data->Store['LevelRequired']."
  466.            ,[Weight] = ".(int)$tmp_data['Weight']."
  467.         WHERE [ItemID] = ".$tmp_data['itemID'];
  468.       echo " Status: Update<br>";
  469.    }
  470.    $stmt = sqlsrv_query($conn, $sql_cmd);
  471. }
  472.  
  473. foreach( $data->AttachmentArmory->Attachment as $tmp_data ){
  474.    $sql = "SELECT * FROM [dbo].[Items_Attachments] WHERE [ItemID] = '".$tmp_data['itemID']."'";
  475.    $stmt = sqlsrv_query($conn, $sql , array(), array("Scrollable"=>"buffered"));
  476.  
  477.    echo "ItemID: ".$tmp_data['itemID']." Name: ".$tmp_data->Store['name'];
  478.    if(sqlsrv_num_rows($stmt) == 0){
  479.       $sql_cmd = "INSERT INTO [dbo].[Items_Attachments] VALUES (
  480.         ".$tmp_data['itemID']."
  481.         ,N'".substr($tmp_data->Model['file'],26,strlen($tmp_data->Model['file'])-30)."'
  482.         ,".(int)$tmp_data['type']."
  483.         ,N'".$tmp_data->Store['name']."'
  484.         ,N'".str_replace("'","''",$tmp_data->Store['desc'])."'
  485.         ,N'".$tmp_data->Model['MuzzleParticle']."'
  486.         ,N'".$tmp_data->Model['FireSound']."'
  487.         ,".(double)$tmp_data->Upgrade['damage']."
  488.         ,".(double)$tmp_data->Upgrade['range']."
  489.         ,".(double)$tmp_data->Upgrade['firerate']."
  490.         ,".(double)$tmp_data->Upgrade['recoil']."
  491.         ,".(double)$tmp_data->Upgrade['spread']."
  492.         ,".(double)$tmp_data->Upgrade['clipsize']."
  493.         ,".(double)$tmp_data->Upgrade['ScopeMag']."
  494.         ,N'".$tmp_data->Upgrade['ScopeType']."'
  495.         ,N'".$tmp_data->Model['ScopeAnim']."'
  496.         ,".(int)$tmp_data['SpecID']."
  497.         ,".($tmp_data['category']?$tmp_data['category']:19)."
  498.         ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0
  499.         ,".(double)$tmp_data->Store['LevelRequired']."
  500.         ,".(int)$tmp_data['Weight']."
  501.         ,".(int)$tmp_data->Dur['u']."
  502.         ,".(int)$tmp_data->Dur['r1']."
  503.         ,".(int)$tmp_data->Dur['r2']."
  504.         ,".(int)$tmp_data->Dur['r3']."
  505.         ,0 ,0 ,0)";
  506.       echo " Status: New!<br>";
  507.    }else{
  508.       $sql_cmd = "UPDATE [dbo].[Items_Attachments]
  509.         SET [FNAME] = N'".substr($tmp_data->Model['file'],26,strlen($tmp_data->Model['file'])-30)."'
  510.            ,[Type] = ".(int)$tmp_data['type']."
  511.            ,[Name] = N'".$tmp_data->Store['name']."'
  512.            ,[Description] = N'".str_replace("'","''",$tmp_data->Store['desc'])."'
  513.            ,[MuzzleParticle] = N'".$tmp_data->Model['MuzzleParticle']."'
  514.            ,[FireSound] = N'".$tmp_data->Model['FireSound']."'
  515.            ,[Damage] = ".(double)$tmp_data->Upgrade['damage']."
  516.            ,[Range] = ".(double)$tmp_data->Upgrade['range']."
  517.            ,[Firerate] = ".(double)$tmp_data->Upgrade['firerate']."
  518.            ,[Recoil] = ".(double)$tmp_data->Upgrade['recoil']."
  519.            ,[Spread] = ".(double)$tmp_data->Upgrade['spread']."
  520.            ,[Clipsize] = ".(double)$tmp_data->Upgrade['clipsize']."
  521.            ,[ScopeMag] = ".(double)$tmp_data->Upgrade['ScopeMag']."
  522.            ,[ScopeType] = N'".$tmp_data->Upgrade['ScopeType']."'
  523.            ,[AnimPrefix] = N'".$tmp_data->Model['ScopeAnim']."'
  524.            ,[SpecID] = ".(int)$tmp_data['SpecID']."
  525.            ,[Category] = ".($tmp_data['category']?$tmp_data['category']:19)."
  526.            ,[LevelRequired] = ".(double)$tmp_data->Store['LevelRequired']."
  527.            ,[Weight] = ".(int)$tmp_data['Weight']."
  528.            ,[DurabilityUse] = ".(int)$tmp_data->Dur['u']."
  529.            ,[RepairAmount] = ".(int)$tmp_data->Dur['r1']."
  530.            ,[PremRepairAmount] = ".(int)$tmp_data->Dur['r2']."
  531.            ,[RepairPriceGD] = ".(int)$tmp_data->Dur['r3']."
  532.         WHERE [ItemID] = ".$tmp_data['itemID'];
  533.       echo " Status: Update<br>";
  534.    }
  535.    $stmt = sqlsrv_query($conn, $sql_cmd);
  536. }
  537.  
  538. foreach( $data->LootBoxDB->LootBox as $tmp_data ){
  539.    $sql = "SELECT * FROM [dbo].[Items_Generic] WHERE [ItemID] = '".$tmp_data['itemID']."'";
  540.    $stmt = sqlsrv_query($conn, $sql , array(), array("Scrollable"=>"buffered"));
  541.  
  542.    echo "ItemID: ".$tmp_data['itemID']." Name: ".$tmp_data->Store['name'];
  543.    if(sqlsrv_num_rows($stmt) == 0){
  544.       $sql_cmd = "INSERT INTO [dbo].[Items_Generic] VALUES (
  545.         ".$tmp_data['itemID']."
  546.         ,N'".substr($tmp_data->Model['file'],26,strlen($tmp_data->Model['file'])-30)."'
  547.         ,".$tmp_data['category']."
  548.         ,N'".$tmp_data->Store['name']."'
  549.         ,N'".str_replace("'","''",$tmp_data->Store['desc'])."'
  550.         ,0 ,0 ,0 ,0 ,0
  551.         ,".(double)$tmp_data->Store['LevelRequired']."
  552.         ,0 ,0 ,0 ,0
  553.         ,".(int)$tmp_data['Weight']."
  554.         ,0 ,0 ,0)";
  555.       echo " Status: New!<br>";
  556.    }else{
  557.       $sql_cmd = "UPDATE [dbo].[Items_Generic]
  558.         SET [FNAME] = N'".substr($tmp_data->Model['file'],26,strlen($tmp_data->Model['file'])-30)."'
  559.            ,[Category] = ".$tmp_data['category']."
  560.            ,[Name] = N'".$tmp_data->Store['name']."'
  561.            ,[Description] = N'".str_replace("'","''",$tmp_data->Store['desc'])."'
  562.            ,[LevelRequired] = ".(double)$tmp_data->Store['LevelRequired']."
  563.            ,[Weight] = ".(int)$tmp_data['Weight']."
  564.         WHERE [ItemID] = ".$tmp_data['itemID'];
  565.       echo " Status: Update<br>";
  566.    }
  567.    $stmt = sqlsrv_query($conn, $sql_cmd);
  568. }
  569.  
  570. foreach( $data->LootBoxDB->LootBox as $tmp_data ){
  571.    $sql = "SELECT * FROM [dbo].[Items_LootSrvModifiers] WHERE [LootID] = '".$tmp_data['itemID']."'";
  572.    $stmt = sqlsrv_query($conn, $sql , array(), array("Scrollable"=>"buffered"));
  573.  
  574.    echo "ItemID: ".$tmp_data['itemID']." Name: ".$tmp_data->Store['name'];
  575.    if(sqlsrv_num_rows($stmt) == 0){
  576.       $sql_cmd = "INSERT INTO [dbo].[Items_LootSrvModifiers] VALUES (
  577.         ".$tmp_data['itemID']."
  578.         ,100 ,100 ,200)";
  579.    }else{
  580.       $sql_cmd = "UPDATE [dbo].[Items_LootSrvModifiers]
  581.         SET [SrvNormal] = 100
  582.            ,[SrvTrial] = 100
  583.            ,[SrvPremium] = 200
  584.         WHERE [LootID] = ".$tmp_data['itemID'];
  585.       echo " Status: Update<br>";
  586.    }
  587.    $stmt = sqlsrv_query($conn, $sql_cmd);
  588. }
  589. ?>
Add Comment
Please, Sign In to add comment