New summon script support
This commit is contained in:
@@ -1262,7 +1262,7 @@ endlineTest:
|
||||
Public Function makeSummonUniversalLine(ByVal inputBytes As Byte(), commented As Boolean)
|
||||
|
||||
Dim reader As Integer = 0
|
||||
Dim str = If(commented, "// ", "")
|
||||
Dim str = If(commented, "\\ ", "")
|
||||
|
||||
Do While reader < UBound(inputBytes)
|
||||
Dim code = BitConverter.ToInt16(inputBytes, reader)
|
||||
@@ -1282,7 +1282,7 @@ endlineTest:
|
||||
|
||||
If code And &H1000 Then
|
||||
|
||||
If code = &H1101 Then str &= vbCrLf & If(commented, "// ", "") : Continue Do
|
||||
If code = &H1101 Then str &= vbCrLf & If(commented, "\\ ", "") : Continue Do
|
||||
If code = &H1131 Then str &= vbTab : Continue Do
|
||||
|
||||
Dim hex = code.ToString("X4")
|
||||
@@ -1323,80 +1323,30 @@ endlineTest:
|
||||
Dim x = 0
|
||||
Dim accum = New List(Of Byte)
|
||||
Dim linesAccum = New List(Of String)
|
||||
Dim currentDialog As Integer
|
||||
|
||||
Do
|
||||
|
||||
'Comments to end of line!
|
||||
If tx(x) = "\" And tx(x + 1) = "\" Then
|
||||
getEndOfLine(tx, x)
|
||||
idsection = True
|
||||
Continue Do
|
||||
End If
|
||||
If tx(x) = "#" Then TextPointers.Add(accum.Count) : x += 3 : currentDialog += 1 : Continue Do 'SimpleClose
|
||||
'SPEC_CODES
|
||||
If tx(x) = "[" Then
|
||||
Dim skRes = getFromSkobki(tx, x)
|
||||
If IsNumeric(skRes) And idsection Then
|
||||
idsection = False
|
||||
DialCount += 1
|
||||
x = x + 2
|
||||
Continue Do 'its simple ID
|
||||
End If
|
||||
|
||||
If skRes = "END623" Or skRes = "END" Or skRes = "311" Then
|
||||
Dim curCount = accum.Count
|
||||
currentDialog += 1
|
||||
x += 2
|
||||
Select Case skRes
|
||||
Case "END623"
|
||||
accum.AddRange({&H6, &H11, &H2, &H11, &H3, &H11})
|
||||
Case "END"
|
||||
accum.AddRange({&H6, &H11, &H3, &H11})
|
||||
Case "311"
|
||||
accum.AddRange({&H3, &H11})
|
||||
End Select
|
||||
Exit Do
|
||||
End If
|
||||
|
||||
Dim spl = Split(skRes, "=")
|
||||
|
||||
If UBound(spl) = 1 Then 'Code = parsing
|
||||
|
||||
Select Case spl(0)
|
||||
Case "0e"
|
||||
accum.AddRange({&HE, &H12, spl(1), 0})
|
||||
Case "1e"
|
||||
accum.AddRange({&H1E, &H12, spl(1), 0})
|
||||
Case "p"
|
||||
accum.AddRange({&H5, &H12, spl(1), 0})
|
||||
Case "c"
|
||||
accum.AddRange({&H1D, &H12, spl(1), 0})
|
||||
Case "col"
|
||||
Dim ind = ColorCodes.Find(Function(q) q.value = spl(1)).code 'old style color
|
||||
accum.AddRange({&H1D, &H12, ind, 0})
|
||||
End Select
|
||||
|
||||
|
||||
Continue Do
|
||||
|
||||
Else '2 hex codes parsing
|
||||
|
||||
'test specCodes
|
||||
If Len(skRes) > 4 Then
|
||||
Dim spec As CodeObject = SpecialCodes.Find(Function(q) q.value = skRes) 'Special code convert IF
|
||||
If Not IsNothing(spec) Then
|
||||
accum.AddRange(BitConverter.GetBytes(Convert.ToInt16(spec.code)).ToList)
|
||||
Continue Do
|
||||
End If
|
||||
|
||||
If skRes.Length = 4 Then 'Try to parse other hex codes
|
||||
accum.AddRange(SoapHexBinary.Parse(skRes).Value.ToList)
|
||||
'x += 2
|
||||
Continue Do
|
||||
End If
|
||||
|
||||
End If
|
||||
If skRes = "col=pink" Then accum.AddRange({&H2E, &H12, 5, 0}) : Continue Do
|
||||
If skRes = "col=white" Then accum.AddRange({&H2E, &H12, 1, 0}) : Continue Do
|
||||
Dim code = SoapHexBinary.Parse(skRes).Value.ToList
|
||||
accum.AddRange({code(1), code(0)})
|
||||
|
||||
If code(1) = 3 & code(0) = &H11 Then Exit Do
|
||||
Continue Do
|
||||
End If
|
||||
|
||||
|
||||
@@ -1404,10 +1354,6 @@ endlineTest:
|
||||
If tx(x) & tx(x + 1) = vbCrLf Then accum.AddRange({&H1, &H11}) : x += 2 : Continue Do
|
||||
If tx(x) = vbLf Then accum.AddRange({&H1, &H11}) : x += 1 : Continue Do
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'SIMPLE TEXT ADDING
|
||||
|
||||
Dim SimpleTextAccum = New List(Of Byte)
|
||||
@@ -1428,15 +1374,9 @@ endlineTest:
|
||||
accum.AddRange(SimpleTextAccum) 'attach textline
|
||||
If SimpleTextAccum.Count And 1 Then accum.Add(0) ' if and 1 - add empty byte
|
||||
|
||||
|
||||
|
||||
x += 1
|
||||
Loop While x < tx.Length - 1
|
||||
|
||||
|
||||
'TextPointers.RemoveAt(TextPointers.Count - 1) 'Remove Last Pointer
|
||||
|
||||
'updateing text pointers
|
||||
'Сохраняем выходной файл
|
||||
My.Computer.FileSystem.WriteAllBytes(inputJfile & ".SummonTRNSL", accum.ToArray, False)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user