![]() |
|
LastChaos GameServer EP2 Patcher - Printable Version +- LCKB (https://lckb.dev/forum) +-- Forum: ** OLD LCKB DATABASE ** (https://lckb.dev/forum/forumdisplay.php?fid=109) +--- Forum: Release Zone (https://lckb.dev/forum/forumdisplay.php?fid=190) +---- Forum: Episode 2 Releases (https://lckb.dev/forum/forumdisplay.php?fid=186) +----- Forum: Tools (https://lckb.dev/forum/forumdisplay.php?fid=179) +----- Thread: LastChaos GameServer EP2 Patcher (/showthread.php?tid=1480) Pages:
1
2
|
- Paramount - 01-04-2013 LastChaos GameServer EP2 Patcher | Written on Visual Basic | Credits: Falo Imports System Imports System.IO Imports System.Text Public Class frmMain #Region "Structures" Private Structure UpgradeStones Dim ks As Int32 Dim hs_1 As Int32 Dim hs_2 As Int32 Dim purified_rune As Int32 Dim devil_rune As Int32 Dim ks_save As Byte Dim hs_save As Byte Dim rs_save As Byte Dim cs_max As Byte Dim es_max As Byte End Structure Private Structure PetEXP Dim pow1 As Double Dim exp_1_100 As Double Dim pow2 As Double Dim exp_101_165 As Double End Structure Private Structure GMCommands Dim rva_base As UInt32 Dim level() As Double Dim pName() As UInt32 Dim name() As String End Structure Structure SubJob Dim MinLvl As Integer Dim MaxLvl As Integer Dim Loya As Integer Dim SP As Integer Dim Gold1 As UInteger Dim Gold2 As UInteger Dim GoldReal As Int64 End Structure Const MAX_GM_COMMAND As Integer = 91 Const MAX_DROP_SEALS As Integer = 4 Dim stones_rate As UpgradeStones Dim p1_pet As PetEXP Dim p2_pet As PetEXP Dim gmcom As GMCommands Dim merchant As SubJob Dim iDropSealRate_Factor(MAX_DROP_SEALS) As Int32 Dim iDropSealRate_Limit(MAX_DROP_SEALS) As Int32 Dim iDropMaxItem As Int32 Dim IsChanged As Boolean = False #End Region Dim currFolder As String = Directory.GetCurrentDirectory() Dim sGameserver As String = currFolder & "\GameServer_d" Private Sub frmMain_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load Me.Text = "Last Chaos EP2 Gameserver Patcher by Falo v1.00" If File.Exists(sGameserver) = False Then MsgBox("Cant open " & sGameserver & "!") Me.Close() End If ReadValues() UpdateForms() End Sub Private Sub btnSave_Click(sender As System.Object, e As System.EventArgs) Handles btnSave.Click WriteValues() MsgBox("Saving finished!") End Sub Private Sub ReadValues() IsChanged = True Dim br As New BinaryReader(File.OpenRead(sGameserver)) Dim tempoffset As Long = 0 With stones_rate .ks = ReadInt32Value(br, &H216239) mov eax, 50 .hs_1 = ReadInt32Value(br, &H216445) mov eax, 60 .hs_2 = ReadInt32Value(br, &H21639F) mov [ebp+var_54], 18 .ks_save = ReadByteValue(br, &H21628B) mov [ebp+var_70], 2 .hs_save = ReadByteValue(br, &H2164B3) cmp eax, 2 .purified_rune = ReadInt32Value(br, &H216899) mov eax, 75 .devil_rune = ReadInt32Value(br, &H216961) mov eax, 95 .cs_max = ReadByteValue(br, &H2166C4) cmp eax, 11 .es_max = ReadByteValue(br, &H2166FF) cmp eax, 13 .rs_save = ReadByteValue(br, &H2167D7) cmp eax, 4 End With tempoffset = &H26BA10 With p1_pet .pow1 = ReadDoubleValue(br, tempoffset, True) .exp_1_100 = ReadDoubleValue(br, tempoffset, True) .pow2 = ReadDoubleValue(br, tempoffset, True) .exp_101_165 = ReadDoubleValue(br, tempoffset, True) End With tempoffset = &H26D2E0 With p2_pet .pow1 = ReadDoubleValue(br, tempoffset, True) .exp_1_100 = ReadDoubleValue(br, tempoffset, True) .pow2 = ReadDoubleValue(br, tempoffset, True) .exp_101_165 = ReadDoubleValue(br, tempoffset, True) End With GM Commands With gmcom .rva_base = &H8048000 Base address for memory space Array.Resize(.level, MAX_GM_COMMAND) Array.Resize(.pName, MAX_GM_COMMAND) Array.Resize(.name, MAX_GM_COMMAND) Read Level tempoffset = &H280920 For i As Integer = 0 To MAX_GM_COMMAND - 1 .level(i) = ReadDoubleValue(br, tempoffset, True) Next i Read Name Pointer tempoffset = &H2B0460 For i As Integer = 0 To MAX_GM_COMMAND - 1 .pName(i) = ReadInt32Value(br, tempoffset, True) Next i Read Names For i As Integer = 0 To MAX_GM_COMMAND - 1 .name(i) = ReadString(br, (.pName(i) - .rva_base), False) Next i End With Droprate tempoffset = &H26C240 For i As Integer = 0 To MAX_DROP_SEALS - 1 iDropSealRate_Limit(i) = ReadInt32Value(br, tempoffset, True) Next i For i As Integer = 0 To MAX_DROP_SEALS - 1 iDropSealRate_Factor(i) = ReadInt32Value(br, tempoffset, True) Next i iDropMaxItem = ReadInt32Value(br, &H38732) mov [ebp+var_68], 4 Sub Job With merchant .text:082237D9 mov [ebp+var_28], 32h ; Minimum Level .text:082237E0 mov [ebp+var_24], 37h ; Maximum Level .text:082237E7 mov [ebp+var_20], 5 ; Loyality .text:082237EE mov [ebp+var_1C], 1312D00h ; SP ( / 10.000 = FP) .text:082237F5 mov dword ptr [ebp+var_18], 5F5E100h ; Gold Part1 .text:082237FC mov dword ptr [ebp+var_18+4], 0 ; Gold Part2 .MinLvl = ReadInt32Value(br, &H1DB7DC) .MaxLvl = ReadInt32Value(br, &H1DB7E3) .Loya = ReadInt32Value(br, &H1DB7EA) .SP = ReadInt32Value(br, &H1DB7F1) .Gold1 = ReadInt32Value(br, &H1DB7F8) .Gold2 = ReadInt32Value(br, &H1DB7FF) .GoldReal = CLng(.Gold2) << 32L .GoldReal += CLng(.Gold1) End With br.Close() IsChanged = False End Sub Private Sub WriteValues() IsChanged = True Dim bw As New BinaryWriter(File.OpenWrite(sGameserver)) Dim tempoffset As Long = 0 With stones_rate WriteValue(bw, .ks, &H216239) WriteValue(bw, .hs_1, &H216445) WriteValue(bw, .hs_2, &H21639F) WriteValue(bw, .ks_save, &H21628B) WriteValue(bw, .hs_save, &H2164B3) WriteValue(bw, .purified_rune, &H216899) WriteValue(bw, .devil_rune, &H216961) WriteValue(bw, .cs_max, &H2166C4) WriteValue(bw, .es_max, &H2166FF) WriteValue(bw, .rs_save, &H2167D7) End With tempoffset = &H26BA10 With p1_pet WriteValue(bw, .pow1, tempoffset, True) WriteValue(bw, .exp_1_100, tempoffset, True) WriteValue(bw, .pow2, tempoffset, True) WriteValue(bw, .exp_101_165, tempoffset, True) End With tempoffset = &H26D2E0 With p2_pet WriteValue(bw, .pow1, tempoffset, True) WriteValue(bw, .exp_1_100, tempoffset, True) WriteValue(bw, .pow2, tempoffset, True) WriteValue(bw, .exp_101_165, tempoffset, True) End With GM Commands With gmcom tempoffset = &H280920 For i As Integer = 0 To MAX_GM_COMMAND - 1 WriteValue(bw, .level(i), tempoffset, True) Next i End With Droprate tempoffset = &H26C240 For i As Integer = 0 To MAX_DROP_SEALS - 1 WriteValue(bw, iDropSealRate_Limit(i), tempoffset, True) Next i For i As Integer = 0 To MAX_DROP_SEALS - 1 WriteValue(bw, iDropSealRate_Factor(i), tempoffset, True) Next i WriteValue(bw, iDropMaxItem, &H38732) Sub Job With merchant .Gold1 = CInt(.GoldReal And &HFFFFFFFFL) .Gold2 = CInt((.GoldReal And &HFFFFFFFF00000000L) >> 32) WriteValue(bw, .MinLvl, &H1DB7DC) WriteValue(bw, .MaxLvl, &H1DB7E3) WriteValue(bw, .Loya, &H1DB7EA) WriteValue(bw, .SP, &H1DB7F1) WriteValue(bw, .Gold1, &H1DB7F8) WriteValue(bw, .Gold2, &H1DB7FF) End With bw.Close() IsChanged = False End Sub Private Sub UpdateForms() IsChanged = True With stones_rate txtKS1.Text = .ks txtKS2.Text = .ks_save txtHS1.Text = .hs_1 txtHS2.Text = .hs_2 txtHS3.Text = .hs_save txtRoon1.Text = .purified_rune txtRoon2.Text = .devil_rune txtCS.Text = .cs_max txtES.Text = .es_max txtRS.Text = .rs_save End With With p1_pet txtP1Pow1.Text = .pow1 txtP1Value1.Text = .exp_1_100 txtP1Pow2.Text = .pow2 txtP1Value2.Text = .exp_101_165 End With With p2_pet txtP2Pow1.Text = .pow1 txtP2Value1.Text = .exp_1_100 txtP2Pow2.Text = .pow2 txtP2Value2.Text = .exp_101_165 End With With lstGMCommands .Items.Clear() For i As Integer = 0 To MAX_GM_COMMAND - 1 .Items.Add(gmcom.name(i)) Next i .SelectedIndex = 0 End With With lstDropSealRate .Items.Clear() For i As Integer = 0 To MAX_DROP_SEALS - 1 .Items.Add("Seal " & i + 1) Next i .SelectedIndex = 0 End With txtMaxDropItems.Text = iDropMaxItem Sub Job With merchant txtSubJobMinLevel.Text = .MinLvl txtSubJobMaxLevel.Text = .MaxLvl txtSubJobLoya.Text = .Loya txtSubJobSP.Text = .SP txtSubJobGold.Text = .GoldReal End With IsChanged = False End Sub #Region "Read Functions" Private Function ReadByteValue(ByVal br As BinaryReader, ByRef Offset As Long, Optional ByVal bUpdate As Boolean = False) br.BaseStream.Seek(Offset, SeekOrigin.Begin) If bUpdate = False Then Return br.ReadByte() Else Offset += 1 Return br.ReadByte() End If End Function Private Function ReadInt16Value(ByVal br As BinaryReader, ByRef Offset As Long, Optional ByVal bUpdate As Boolean = False) br.BaseStream.Seek(Offset, SeekOrigin.Begin) If bUpdate = False Then Return br.ReadInt16() Else Offset += 2 Return br.ReadInt16() End If End Function Private Function ReadInt32Value(ByVal br As BinaryReader, ByRef Offset As Long, Optional ByVal bUpdate As Boolean = False) br.BaseStream.Seek(Offset, SeekOrigin.Begin) If bUpdate = False Then Return br.ReadInt32() Else Offset += 4 Return br.ReadInt32() End If End Function Private Function ReadInt64Value(ByVal br As BinaryReader, ByRef Offset As Long, Optional ByVal bUpdate As Boolean = False) br.BaseStream.Seek(Offset, SeekOrigin.Begin) If bUpdate = False Then Return br.ReadInt64() Else Offset += 8 Return br.ReadInt64() End If End Function Private Function ReadFloatValue(ByVal br As BinaryReader, ByRef Offset As Long, Optional ByVal bUpdate As Boolean = False) br.BaseStream.Seek(Offset, SeekOrigin.Begin) If bUpdate = False Then Return br.ReadSingle() Else Offset += 4 Return br.ReadSingle() End If End Function Private Function ReadDoubleValue(ByVal br As BinaryReader, ByRef Offset As Long, Optional ByVal bUpdate As Boolean = False) br.BaseStream.Seek(Offset, SeekOrigin.Begin) If bUpdate = False Then Return br.ReadDouble() Else Offset += 8 Return br.ReadDouble() End If End Function Private Function ReadString(ByVal br As BinaryReader, ByRef Offset As Long, Optional ByVal bUpdate As Boolean = False) br.BaseStream.Seek(Offset, SeekOrigin.Begin) Dim sTemp As String = "", bTemp As Byte, iLength As Integer For i As Integer = 0 To 256 - 1 bTemp = br.ReadByte() If bTemp = 0 Then iLength = i Else Return "" string longer than 256 lettern, abort... End If Next i br.BaseStream.Seek(Offset, SeekOrigin.Begin) If bUpdate = False Then Return Encoding.ASCII.GetString(br.ReadBytes(iLength)) Else Offset += iLength Return Encoding.ASCII.GetString(br.ReadBytes(iLength)) End If End Function #End Region #Region "Write Functions" Private Sub WriteValue(ByVal br As BinaryWriter, ByVal newValue As SByte, ByRef Offset As Long, Optional ByVal bUpdate As Boolean = False) br.BaseStream.Seek(Offset, SeekOrigin.Begin) If bUpdate = False Then br.Write(newValue) Else Offset += 1 br.Write(newValue) End If End Sub Private Sub WriteValue(ByVal br As BinaryWriter, ByVal newValue As Byte, ByRef Offset As Long, Optional ByVal bUpdate As Boolean = False) br.BaseStream.Seek(Offset, SeekOrigin.Begin) If bUpdate = False Then br.Write(newValue) Else Offset += 1 br.Write(newValue) End If End Sub Private Sub WriteValue(ByVal br As BinaryWriter, ByVal newValue As Int16, ByRef Offset As Long, Optional ByVal bUpdate As Boolean = False) br.BaseStream.Seek(Offset, SeekOrigin.Begin) If bUpdate = False Then br.Write(newValue) Else Offset += 2 br.Write(newValue) End If End Sub Private Sub WriteValue(ByVal br As BinaryWriter, ByVal newValue As UInt16, ByRef Offset As Long, Optional ByVal bUpdate As Boolean = False) br.BaseStream.Seek(Offset, SeekOrigin.Begin) If bUpdate = False Then br.Write(newValue) Else Offset += 2 br.Write(newValue) End If End Sub Private Sub WriteValue(ByVal br As BinaryWriter, ByVal newValue As Int32, ByRef Offset As Long, Optional ByVal bUpdate As Boolean = False) br.BaseStream.Seek(Offset, SeekOrigin.Begin) If bUpdate = False Then br.Write(newValue) Else Offset += 4 br.Write(newValue) End If End Sub Private Sub WriteValue(ByVal br As BinaryWriter, ByVal newValue As UInt32, ByRef Offset As Long, Optional ByVal bUpdate As Boolean = False) br.BaseStream.Seek(Offset, SeekOrigin.Begin) If bUpdate = False Then br.Write(newValue) Else Offset += 4 br.Write(newValue) End If End Sub Private Sub WriteValue(ByVal br As BinaryWriter, ByVal newValue As Int64, ByRef Offset As Long, Optional ByVal bUpdate As Boolean = False) br.BaseStream.Seek(Offset, SeekOrigin.Begin) If bUpdate = False Then br.Write(newValue) Else Offset += 8 br.Write(newValue) End If End Sub Private Sub WriteValue(ByVal br As BinaryWriter, ByVal newValue As UInt64, ByRef Offset As Long, Optional ByVal bUpdate As Boolean = False) br.BaseStream.Seek(Offset, SeekOrigin.Begin) If bUpdate = False Then br.Write(newValue) Else Offset += 8 br.Write(newValue) End If End Sub Private Sub WriteValue(ByVal br As BinaryWriter, ByVal newValue As Single, ByRef Offset As Long, Optional ByVal bUpdate As Boolean = False) br.BaseStream.Seek(Offset, SeekOrigin.Begin) If bUpdate = False Then br.Write(newValue) Else Offset += 4 br.Write(newValue) End If End Sub Private Sub WriteValue(ByVal br As BinaryWriter, ByVal newValue As Double, ByRef Offset As Long, Optional ByVal bUpdate As Boolean = False) br.BaseStream.Seek(Offset, SeekOrigin.Begin) If bUpdate = False Then br.Write(newValue) Else Offset += 8 br.Write(newValue) End If End Sub #End Region #Region "Changes" Private Sub lstGMCommands_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles lstGMCommands.SelectedIndexChanged Dim x As Integer = lstGMCommands.SelectedIndex If x > -1 Then txtGMComLevel.Text = CInt(gmcom.level(x)) End If End Sub Private Sub lstDroprate_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles lstDropSealRate.SelectedIndexChanged Dim x As Integer = lstDropSealRate.SelectedIndex If x > -1 Then txtDropSealRateFactor.Text = iDropSealRate_Factor(x) txtDropSealRateLimit.Text = iDropSealRate_Limit(x) End If End Sub Private Sub txtGMComLevel_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtGMComLevel.TextChanged Dim x As Integer = lstGMCommands.SelectedIndex If x > -1 Then If txtGMComLevel.Text <> "" Then gmcom.level(x) = CDbl(txtGMComLevel.Text) End If End If End Sub Private Sub txtDropRateFactor_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtDropSealRateFactor.TextChanged Dim x As Integer = lstDropSealRate.SelectedIndex If x > -1 Then If txtDropSealRateFactor.Text <> "" Then iDropSealRate_Factor(x) = txtDropSealRateFactor.Text End If End If End Sub Private Sub txtDropRateLimit_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtDropSealRateLimit.TextChanged Dim x As Integer = lstDropSealRate.SelectedIndex If x > -1 Then If txtDropSealRateLimit.Text <> "" Then iDropSealRate_Limit(x) = txtDropSealRateLimit.Text End If End If End Sub Private Sub txtKS1_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtKS1.TextChanged SaveChanges() End Sub Private Sub txtKS2_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtKS2.TextChanged SaveChanges() End Sub Private Sub txtHS1_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtHS1.TextChanged SaveChanges() End Sub Private Sub txtHS2_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtHS2.TextChanged SaveChanges() End Sub Private Sub txtHS3_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtHS3.TextChanged SaveChanges() End Sub Private Sub txtCS_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtCS.TextChanged SaveChanges() End Sub Private Sub txtES_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtES.TextChanged SaveChanges() End Sub Private Sub txtRoon1_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtRoon1.TextChanged SaveChanges() End Sub Private Sub txtRoon2_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtRoon2.TextChanged SaveChanges() End Sub Private Sub txtRS_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtRS.TextChanged SaveChanges() End Sub Private Sub txtP1Pow1_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtP1Pow1.TextChanged SaveChanges() End Sub Private Sub txtP1Value1_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtP1Value1.TextChanged SaveChanges() End Sub Private Sub txtP1Pow2_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtP1Pow2.TextChanged SaveChanges() End Sub Private Sub txtP1Value2_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtP1Value2.TextChanged SaveChanges() End Sub Private Sub txtP2Pow1_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtP2Pow1.TextChanged SaveChanges() End Sub Private Sub txtP2Value1_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtP2Value1.TextChanged SaveChanges() End Sub Private Sub txtP2Pow2_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtP2Pow2.TextChanged SaveChanges() End Sub Private Sub txtP2Value2_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtP2Value2.TextChanged SaveChanges() End Sub Private Sub txtMaxDropItems_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtMaxDropItems.TextChanged SaveChanges() End Sub Private Sub txtSubJobMinLevel_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtSubJobMinLevel.TextChanged SaveChanges() End Sub Private Sub txtSubJobMaxLevel_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtSubJobMaxLevel.TextChanged SaveChanges() End Sub Private Sub txtSubJobLoya_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtSubJobLoya.TextChanged SaveChanges() End Sub Private Sub txtSubJobSP_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtSubJobSP.TextChanged SaveChanges() End Sub Private Sub txtSubJobGold_TextChanged(sender As System.Object, e As System.EventArgs) Handles txtSubJobGold.TextChanged SaveChanges() End Sub Private Sub SaveChanges() If IsChanged = False Then IsChanged = True With stones_rate .ks = txtKS1.Text .hs_1 = txtHS1.Text .hs_2 = txtHS2.Text .ks_save = txtKS2.Text .hs_save = txtHS3.Text .purified_rune = txtRoon1.Text .devil_rune = txtRoon2.Text .cs_max = txtCS.Text .es_max = txtES.Text .rs_save = txtRS.Text End With With p1_pet .pow1 = txtP1Pow1.Text .exp_1_100 = txtP1Value1.Text .pow2 = txtP1Pow2.Text .exp_101_165 = txtP1Value2.Text End With With p2_pet .pow1 = txtP2Pow1.Text .exp_1_100 = txtP2Value1.Text .pow2 = txtP2Pow2.Text .exp_101_165 = txtP2Value2.Text End With iDropMaxItem = txtMaxDropItems.Text Sub Job With merchant .MinLvl = txtSubJobMinLevel.Text .MaxLvl = txtSubJobMaxLevel.Text .Loya = txtSubJobLoya.Text .SP = txtSubJobSP.Text .GoldReal = txtSubJobGold.Text End With IsChanged = False End If End Sub #End Region End Class - luoo - 01-04-2013 The source isnt from Fabi he is from falo aka dsgdf - iFlash - 01-05-2013 when i compile i kept on getting errors - luoo - 01-05-2013 The Code is incomplete. You need to set up the event handlers. - filix_93 - 01-06-2013 That should be the GS source code? - luoo - 01-06-2013 GS PATCHER Source Code Falo make this for 777 Admin that he can change things on mystery and 777 - Douglas Farias - 01-07-2013 *-* - Creep - 01-07-2013 dont seems to be workin like you said - KaPaTeJIb777 - 01-14-2013 ñûѠð Ѡ÷ýðю чтþ Ñ ÑÂтøü ôõûðть,ÿрþÑÂòõтø - Garfield - 01-26-2013 One prob this prob is wiht the Gm Commands can mee pls where help |