'-------------------------------------------------------------------------'
' '
' [jTool] - Offline Map Konverter '
' jMapKonverter.vbs '
' '
' Version 1.0 - 13.04.2015 '
' '
' © Jeffry '
' '
'-------------------------------------------------------------------------'
'======================================================================================'
'Für Änderungen am Ausgabe-Layout die Einstellungen hier vornehmen: '
'======================================================================================'
objectOutStr = "CreateDynamicObject($model, $x, $y, $z, $rx, $ry, $rz);" '
vehicleOutStr = "CreateVehicle($model, $x, $y, $z, $ra, $color1, $color2, -1);" '
pickupOutStr = "AddStaticPickup($model, $x, $y, $z);" '
'======================================================================================'
Set fs = CreateObject("Scripting.FileSystemObject")
pfad = fs.GetParentFolderName(Wscript.ScriptFullName)
objects = 0
vehicles = 0
pickups = 0
allobjects = 0
allvehicles = 0
allpickups = 0
emptystr = " "
findstr = ""
out_id = ""
out_x = ""
out_y = ""
out_z = ""
out_rx = ""
out_ry = ""
out_rz = ""
out_col1 = ""
out_col2 = ""
out_type = ""
Set sDir = fs.getfolder(pfad)
For Each file In sDir.Files
If LCase(Right(file.path, 4)) = ".map" Then
fail = 0
Set rFile = fs.OpenTextFile(file.path, 1)
Set wFile = fs.CreateTextFile(Left(file.path, Len(file.path)-3) & "txt", True)
Do While rFile.AtEndOfStream <> True
str = rFile.ReadLine
If InStr(str, "<object id") > 0 And InStr(str, "</object>") > 0 Then
objects = objects + 1
findstr = "id="""
find = InStr(str, findstr)+Len(findstr)
out_type = Mid(str, find, InStr(find, str, """")-find)
findstr = "model="""
find = InStr(str, findstr)+Len(findstr)
out_id = Mid(str, find, InStr(find, str, """")-find)
findstr = "posX="""
find = InStr(str, findstr)+Len(findstr)
out_x = Mid(str, find, InStr(find, str, """")-find)
If InStr(out_x, ".") = 0 Then out_x = out_x & ".0"
findstr = "posY="""
find = InStr(str, findstr)+Len(findstr)
out_y = Mid(str, find, InStr(find, str, """")-find)
If InStr(out_y, ".") = 0 Then out_y = out_y & ".0"
findstr = "posZ="""
find = InStr(str, findstr)+Len(findstr)
out_z = Mid(str, find, InStr(find, str, """")-find)
If InStr(out_z, ".") = 0 Then out_z = out_z & ".0"
findstr = "rotX="""
find = InStr(str, findstr)+Len(findstr)
out_rx = Mid(str, find, InStr(find, str, """")-find)
If InStr(out_rx, ".") = 0 Then out_rx = out_rx & ".0"
findstr = "rotY="""
find = InStr(str, findstr)+Len(findstr)
out_ry = Mid(str, find, InStr(find, str, """")-find)
If InStr(out_ry, ".") = 0 Then out_ry = out_ry & ".0"
findstr = "rotZ="""
find = InStr(str, findstr)+Len(findstr)
out_rz = Mid(str, find, InStr(find, str, """")-find)
If InStr(out_rz, ".") = 0 Then out_rz = out_rz & ".0"
str = objectOutStr
str = Replace(str, "$model", out_id)
str = Replace(str, "$x", out_x)
str = Replace(str, "$y", out_y)
str = Replace(str, "$z", out_z)
str = Replace(str, "$rx", out_rx)
str = Replace(str, "$ry", out_ry)
str = Replace(str, "$rz", out_rz)
str = str & " //" & Replace(Replace(out_type, "(", "["), ")", "]")
wFile.WriteLine str
End If
Loop
rFile.Close
Set rFile = fs.OpenTextFile(file.path, 1)
Do While rFile.AtEndOfStream <> True
str = rFile.ReadLine
If InStr(str, "<vehicle id") > 0 And InStr(str, "</vehicle>") > 0 Then
vehicles = vehicles + 1
findstr = "id="""
find = InStr(str, findstr)+Len(findstr)
out_type = Mid(str, find, InStr(find, str, """")-find)
findstr = "model="""
find = InStr(str, findstr)+Len(findstr)
out_id = Mid(str, find, InStr(find, str, """")-find)
findstr = "posX="""
find = InStr(str, findstr)+Len(findstr)
out_x = Mid(str, find, InStr(find, str, """")-find)
If InStr(out_x, ".") = 0 Then out_x = out_x & ".0"
findstr = "posY="""
find = InStr(str, findstr)+Len(findstr)
out_y = Mid(str, find, InStr(find, str, """")-find)
If InStr(out_y, ".") = 0 Then out_y = out_y & ".0"
findstr = "posZ="""
find = InStr(str, findstr)+Len(findstr)
out_z = Mid(str, find, InStr(find, str, """")-find)
If InStr(out_z, ".") = 0 Then out_z = out_z & ".0"
findstr = "rotZ="""
find = InStr(str, findstr)+Len(findstr)
out_rz = Mid(str, find, InStr(find, str, """")-find)
If InStr(out_rz, ".") = 0 Then out_rz = out_rz & ".0"
findstr = "color="""
find = InStr(str, findstr)+Len(findstr)
out_col1 = Mid(str, find, InStr(find, str, ",")-find)
find = InStr(find, str, ",")+1
out_col2 = Mid(str, find, InStr(find, str, ",")-find)
str = vehicleOutStr
str = Replace(str, "$model", out_id)
str = Replace(str, "$x", out_x)
str = Replace(str, "$y", out_y)
str = Replace(str, "$z", out_z)
str = Replace(str, "$ra", out_rz)
str = Replace(str, "$color1", out_col1)
str = Replace(str, "$color2", out_col2)
str = str & " //" & Replace(Replace(out_type, "(", "["), ")", "]")
wFile.WriteLine str
End If
Loop
rFile.Close
Set rFile = fs.OpenTextFile(file.path, 1)
Do While rFile.AtEndOfStream <> True
str = rFile.ReadLine
If InStr(str, "<pickup id") > 0 And InStr(str, "</pickup>") > 0 Then
pickups = pickups + 1
findstr = "id="""
find = InStr(str, findstr)+Len(findstr)
out_type = Mid(str, find, InStr(find, str, """")-find)
findstr = "type="""
find = InStr(str, findstr)+Len(findstr)
out_id = Mid(str, find, InStr(find, str, """")-find)
findstr = "posX="""
find = InStr(str, findstr)+Len(findstr)
out_x = Mid(str, find, InStr(find, str, """")-find)
If InStr(out_x, ".") = 0 Then out_x = out_x & ".0"
findstr = "posY="""
find = InStr(str, findstr)+Len(findstr)
out_y = Mid(str, find, InStr(find, str, """")-find)
If InStr(out_y, ".") = 0 Then out_y = out_y & ".0"
findstr = "posZ="""
find = InStr(str, findstr)+Len(findstr)
out_z = Mid(str, find, InStr(find, str, """")-find)
If InStr(out_z, ".") = 0 Then out_z = out_z & ".0"
Select case out_id
case "10": out_id = "321" 'Dildo
case "11": out_id = "322" 'Dildo
case "12": out_id = "323" 'Vibrator
case "13": out_id = "324" 'Vibrator
case "14": out_id = "325" 'Flower
case "15": out_id = "326" 'Cane
case "1": out_id = "331" 'Brassknuckle
case "2": out_id = "333" 'Golfclub
case "3": out_id = "334" 'Nightstick
case "4": out_id = "335" 'Knife
case "5": out_id = "336" 'Bat
case "6": out_id = "337" 'Shovel
case "7": out_id = "338" 'Poolstick
case "8": out_id = "339" 'Katana
case "9": out_id = "341" 'Chainsaw
case "16": out_id = "342" 'Grenade
case "17": out_id = "343" 'Teargas
case "18": out_id = "344" 'Molotov
case "22": out_id = "346" 'Colt 45
case "23": out_id = "347" 'Silenced
case "24": out_id = "348" 'Deagle
case "25": out_id = "349" 'Shotgun
case "26": out_id = "350" 'Sawed-off
case "27": out_id = "351" 'Combat Shotgun
case "28": out_id = "352" 'UZI
case "29": out_id = "353" 'MP5
case "30": out_id = "355" 'AK-47
case "31": out_id = "356" 'M4
case "33": out_id = "357" 'Rifle
case "34": out_id = "358" 'Sniper
case "35": out_id = "359" 'Rocket Launcher
case "36": out_id = "360" 'Rocket Launcher HS
case "37": out_id = "361" 'Flamethrower
case "38": out_id = "362" 'Minigun
case "39": out_id = "363" 'Satchel
case "40": out_id = "364" 'Bomb
case "41": out_id = "365" 'Spraycan
case "42": out_id = "366" 'Fire Extinguisher
case "43": out_id = "367" 'Camera
case "44": out_id = "368" 'Nightvision
case "45": out_id = "369" 'Infrared
case "46": out_id = "371" 'Parachute
case "32": out_id = "372" 'Tec-9
case "health": out_id = "1240" 'Health
case "armor": out_id = "1242" 'Armor
case else: out_id = "???" 'Unknown?
End Select
str = pickupOutStr
str = Replace(str, "$model", out_id)
str = Replace(str, "$x", out_x)
str = Replace(str, "$y", out_y)
str = Replace(str, "$z", out_z)
str = str & " //" & Replace(Replace(out_type, "(", "["), ")", "]")
wFile.WriteLine str
End If
Loop
wFile.WriteLine ""
str = "/*************************************************"
wFile.WriteLine str
str = "* Die folgenden Items wurden konvertiert: *"
wFile.WriteLine str
If objects = 1 Then
str = ""
Else:
str = "e"
End If
str = "* - " & objects & " Objekt" & str & " " & Left(emptystr, 33-Len(objects)-Len(str)) & "*"
wFile.WriteLine str
If vehicles = 1 Then
str = ""
Else:
str = "e"
End If
str = "* - " & vehicles & " Fahrzeug" & str & " " & Left(emptystr, 31-Len(vehicles)-Len(str)) & "*"
wFile.WriteLine str
If pickups = 1 Then
str = ""
Else:
str = "s"
End If
str = "* - " & pickups & " Pickup" & str & " " & Left(emptystr, 33-Len(pickups)-Len(str)) & "*"
wFile.WriteLine str
str = "* *"
wFile.WriteLine str
str = "* Datum: " & Date() & " - " & Time() & " *"
wFile.WriteLine str
str = "* Konvertiert durch jTool - jMapKonverter.vbs *"
wFile.WriteLine str
str = "*************************************************/"
wFile.WriteLine str
wFile.Close
allobjects = allobjects + objects
allvehicles = allvehicles + vehicles
allpickups = allpickups + pickups
End If
Next
str = Chr(10) & "Die Konvertierung wurde erfolgreich abgeschlossen!" & Chr(10) & Chr(10) & "Es wurden folgende Items konvertiert:" & Chr(10)
If allobjects = 1 Then
emptystr = ""
Else:
emptystr = "e"
End If
str = str & " - " & allobjects & " Objekt" & emptystr & Chr(10)
If allvehicles = 1 Then
emptystr = ""
Else:
emptystr = "e"
End If
str = str & " - " & allvehicles & " Fahrzeug" & emptystr & Chr(10)
If allpickups = 1 Then
emptystr = ""
Else:
emptystr = "s"
End If
str = str & " - " & allpickups & " Pickup" & emptystr & Chr(10) & Chr(10) & Chr(10)
str = str & "Vielen Dank f" & Chr(252) & "r die Verwendung von jTool - jMapKonverter.vbs!" & Chr(10)
str = str & Chr(169) & "Jeffry - April 2015"
Msgbox str, vbInformation , "Konvertierung erfolgreich!"
Alles anzeigen