Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Global $DelNpcFrom, $InsertInto, $Item, $ItemVenCode, $NPCEntry, $DirScanFileOpen, $LineRead, $Divider, $LineRead
- ;Dim $StringNPC = FileReadLine(FileOpen(@WorkingDir & "\temp.sql", 0))
- Dim $StartingNPC = "WDBVerified`) VALUES ("
- Dim $EndingNPC = ","
- ;Dim $String = FileReadLine(FileOpen(@WorkingDir & "\temp.sql", 0))
- ;Dim $String = FileReadLine(FileOpen(@WorkingDir & "\temp.sql", 0))
- ;MsgBox(0, "NPC", $String)
- Dim $Starting = 'StatsCount) VALUES ('
- Dim $Ending = ','
- ;Dim $Item = _GetStringBetween($String, $Starting, $Ending)
- ;Dim $NPCEntry = _GetNpcEntry($StringNPC, $StartingNPC, $EndingNPC)
- ;Dim $NPCEntry = 2600
- Dim $DelNpcFrom = "DELETE FROM `npc_vendor` WHERE (`entry`=" & ('') & $NPCEntry & ('') & ");"
- Dim $InsertInto = "INSERT INTO `npc_vendor` (`entry`, `slot`, `item`, `maxcount`, `incrtime`, `ExtendedCost`) VALUES"
- Dim $Divider = "-- ---------" & @CRLF & "-- Vendoring" & @CRLF & "-- ---------"
- ;Dim $ItemVenCode = "(" & ('') & $NPCEntry & ('') & ", 0, " & ('') & $Item & ('') & ", 0, 0, 0),"
- ;Divider($Divider)
- ;WriteEntryDel($DelNpcFrom)
- ;WriteEntryInsert($InsertInto)
- ;ItemID($Item)
- ;WriteEntryVen($ItemVenCode)
- Blag()
- Func Blag()
- $FileToRead = FileOpen(@WorkingDir & "\temp.sql", 0)
- $LineRead = FileReadLine($FileToRead)
- FileWrite(FileOpen(@WorkingDir & "\ItemEntry.txt", 1), $LineRead & @CRLF & @CRLF)
- $NPCEntry = _GetStringBetween($LineRead, $StartingNPC, $EndingNPC)
- MsgBox(0, "$FileToRead = FileOpen", $NPCEntry)
- Divider($Divider)
- WriteEntryDel($DelNpcFrom)
- WriteEntryInsert($InsertInto)
- While 1
- $LineRead = FileReadLine($FileToRead)
- If @error = -1 Then ExitLoop
- $Item = _GetStringBetween($LineRead, $Starting, $Ending)
- ItemID($Item)
- $ItemVenCode = "(" & ('') & $NPCEntry & ('') & ", 0, " & ('') & $Item & ('') & ", 0, 0, 0),"
- WriteEntryVen($ItemVenCode)
- MsgBox(0, "$LineRead = FileReadLine", $LineRead)
- ; FileWrite($MergeFileMake, FileRead($LineRead))
- ; WriteEntryVen($ItemVenCode)
- ; MsgBox(0, "Line read:", $LineRead)
- WEnd
- EndFunc ;==>Blag
- Func _GetStringBetween($String, $Starting, $Ending)
- If StringInStr($String, $Starting) And StringInStr($String, $Ending) Then
- $StL = StringTrimLeft($String, StringInStr($String, $Starting) - 1)
- $SeL = StringLeft($StL, StringInStr($StL, $Ending) + 0)
- $StringBetween = StringTrimLeft(StringTrimRight($SeL, StringLen($Ending)), StringLen($Starting))
- Return $StringBetween
- Else
- Return 0
- EndIf
- EndFunc ;==>_GetStringBetween
- #cs ----------------------------------------------------------------------------
- Func _GetNpcEntry($StringNPC, $StartingNPC, $EndingNPC)
- If StringInStr($StringNPC, $StartingNPC) And StringInStr($StringNPC, $EndingNPC) Then
- $StL = StringTrimLeft($StringNPC, StringInStr($StringNPC, $StartingNPC) - 1)
- $SeL = StringLeft($StL, StringInStr($StL, $EndingNPC) + 0)
- $StringBetween = StringTrimLeft(StringTrimRight($SeL, StringLen($EndingNPC)), StringLen($StartingNPC))
- Return $StringBetween
- Else
- Return 0
- EndIf
- EndFunc ;==>_GetNpcEntry
- #ce ----------------------------------------------------------------------------
- Func Divider($String)
- FileWrite(FileOpen(@WorkingDir & "\ItemEntry.txt", 1), $String & @CRLF)
- MsgBox(0, "Header", $String)
- EndFunc ;==>Divider
- Func WriteEntryDel($String)
- FileWrite(FileOpen(@WorkingDir & "\ItemEntry.txt", 1), $String & @CRLF)
- MsgBox(0, "Delete Code", $String)
- EndFunc ;==>WriteEntryDel
- Func WriteEntryInsert($String)
- FileWrite(FileOpen(@WorkingDir & "\ItemEntry.txt", 1), $String & @CRLF)
- MsgBox(0, "Insert Code", $String)
- EndFunc ;==>WriteEntryInsert
- Func WriteEntryVen($String)
- FileWrite(FileOpen(@WorkingDir & "\ItemEntry.txt", 1), $String & @CRLF)
- MsgBox(0, "VenCode", $String)
- EndFunc ;==>WriteEntryVen
- Func NpcID($String)
- ;FileWrite(FileOpen(@WorkingDir & "\ItemEntry.txt", 1), $string)
- MsgBox(0, "NPC ID", $String)
- EndFunc ;==>NpcID
- Func ItemID($String)
- ;FileWrite(FileOpen(@WorkingDir & "\ItemEntry.txt", 1), $string)
- MsgBox(0, "Item ID", $String)
- EndFunc ;==>ItemID
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement