daily pastebin goal
41%
SHARE
TWEET

Untitled

a guest Jun 19th, 2017 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Global $DelNpcFrom, $InsertInto, $Item, $ItemVenCode, $NPCEntry, $DirScanFileOpen, $LineRead, $Divider, $LineRead
  2.  
  3. ;Dim $StringNPC = FileReadLine(FileOpen(@WorkingDir & "\temp.sql", 0))
  4. Dim $StartingNPC = "WDBVerified`) VALUES ("
  5. Dim $EndingNPC = ","
  6. ;Dim $String = FileReadLine(FileOpen(@WorkingDir & "\temp.sql", 0))
  7. ;Dim $String = FileReadLine(FileOpen(@WorkingDir & "\temp.sql", 0))
  8. ;MsgBox(0, "NPC", $String)
  9. Dim $Starting = 'StatsCount) VALUES ('
  10. Dim $Ending = ','
  11.  
  12. ;Dim $Item = _GetStringBetween($String, $Starting, $Ending)
  13.  
  14. ;Dim $NPCEntry = _GetNpcEntry($StringNPC, $StartingNPC, $EndingNPC)
  15. ;Dim $NPCEntry = 2600
  16. Dim $DelNpcFrom = "DELETE FROM `npc_vendor` WHERE (`entry`=" & ('') & $NPCEntry & ('') & ");"
  17. Dim $InsertInto = "INSERT INTO `npc_vendor` (`entry`, `slot`, `item`, `maxcount`, `incrtime`, `ExtendedCost`) VALUES"
  18. Dim $Divider = "-- ---------" & @CRLF & "-- Vendoring" & @CRLF & "-- ---------"
  19. ;Dim $ItemVenCode = "(" & ('') & $NPCEntry & ('') & ", 0, " & ('') & $Item & ('') & ", 0, 0, 0),"
  20.  
  21.  
  22. ;Divider($Divider)
  23. ;WriteEntryDel($DelNpcFrom)
  24. ;WriteEntryInsert($InsertInto)
  25.  
  26.  
  27. ;ItemID($Item)
  28. ;WriteEntryVen($ItemVenCode)
  29. Blag()
  30.  
  31.  
  32.  
  33. Func Blag()
  34.     $FileToRead = FileOpen(@WorkingDir & "\temp.sql", 0)
  35.     $LineRead = FileReadLine($FileToRead)
  36.     FileWrite(FileOpen(@WorkingDir & "\ItemEntry.txt", 1), $LineRead & @CRLF & @CRLF)
  37.  
  38.     $NPCEntry = _GetStringBetween($LineRead, $StartingNPC, $EndingNPC)
  39.     MsgBox(0, "$FileToRead = FileOpen", $NPCEntry)
  40.  
  41.     Divider($Divider)
  42.     WriteEntryDel($DelNpcFrom)
  43.     WriteEntryInsert($InsertInto)
  44.  
  45.     While 1
  46.         $LineRead = FileReadLine($FileToRead)
  47.         If @error = -1 Then ExitLoop
  48.  
  49.         $Item = _GetStringBetween($LineRead, $Starting, $Ending)
  50.         ItemID($Item)
  51.         $ItemVenCode = "(" & ('') & $NPCEntry & ('') & ", 0, " & ('') & $Item & ('') & ", 0, 0, 0),"
  52.         WriteEntryVen($ItemVenCode)
  53.         MsgBox(0, "$LineRead = FileReadLine", $LineRead)
  54.         ;   FileWrite($MergeFileMake, FileRead($LineRead))
  55.         ;   WriteEntryVen($ItemVenCode)
  56.         ;   MsgBox(0, "Line read:", $LineRead)
  57.  
  58.     WEnd
  59. EndFunc   ;==>Blag
  60.  
  61.  
  62.  
  63. Func _GetStringBetween($String, $Starting, $Ending)
  64.     If StringInStr($String, $Starting) And StringInStr($String, $Ending) Then
  65.         $StL = StringTrimLeft($String, StringInStr($String, $Starting) - 1)
  66.         $SeL = StringLeft($StL, StringInStr($StL, $Ending) + 0)
  67.         $StringBetween = StringTrimLeft(StringTrimRight($SeL, StringLen($Ending)), StringLen($Starting))
  68.         Return $StringBetween
  69.     Else
  70.         Return 0
  71.     EndIf
  72. EndFunc   ;==>_GetStringBetween
  73.  
  74. #cs ----------------------------------------------------------------------------
  75.     Func _GetNpcEntry($StringNPC, $StartingNPC, $EndingNPC)
  76.     If StringInStr($StringNPC, $StartingNPC) And StringInStr($StringNPC, $EndingNPC) Then
  77.     $StL = StringTrimLeft($StringNPC, StringInStr($StringNPC, $StartingNPC) - 1)
  78.     $SeL = StringLeft($StL, StringInStr($StL, $EndingNPC) + 0)
  79.     $StringBetween = StringTrimLeft(StringTrimRight($SeL, StringLen($EndingNPC)), StringLen($StartingNPC))
  80.     Return $StringBetween
  81.     Else
  82.     Return 0
  83.     EndIf
  84.     EndFunc   ;==>_GetNpcEntry
  85. #ce ----------------------------------------------------------------------------
  86.  
  87. Func Divider($String)
  88.     FileWrite(FileOpen(@WorkingDir & "\ItemEntry.txt", 1), $String & @CRLF)
  89.     MsgBox(0, "Header", $String)
  90. EndFunc   ;==>Divider
  91. Func WriteEntryDel($String)
  92.     FileWrite(FileOpen(@WorkingDir & "\ItemEntry.txt", 1), $String & @CRLF)
  93.     MsgBox(0, "Delete Code", $String)
  94. EndFunc   ;==>WriteEntryDel
  95. Func WriteEntryInsert($String)
  96.     FileWrite(FileOpen(@WorkingDir & "\ItemEntry.txt", 1), $String & @CRLF)
  97.     MsgBox(0, "Insert Code", $String)
  98. EndFunc   ;==>WriteEntryInsert
  99.  
  100.  
  101.  
  102.  
  103. Func WriteEntryVen($String)
  104.     FileWrite(FileOpen(@WorkingDir & "\ItemEntry.txt", 1), $String & @CRLF)
  105.     MsgBox(0, "VenCode", $String)
  106. EndFunc   ;==>WriteEntryVen
  107.  
  108. Func NpcID($String)
  109.     ;FileWrite(FileOpen(@WorkingDir & "\ItemEntry.txt", 1), $string)
  110.     MsgBox(0, "NPC ID", $String)
  111. EndFunc   ;==>NpcID
  112.  
  113.  
  114.  
  115. Func ItemID($String)
  116.     ;FileWrite(FileOpen(@WorkingDir & "\ItemEntry.txt", 1), $string)
  117.     MsgBox(0, "Item ID", $String)
  118. EndFunc   ;==>ItemID
RAW Paste Data
Top