Option Strict Off
Option Explicit On
Friend Class RuneEditor
	Inherits System.Windows.Forms.Form
	Private Runes(24) As Byte
	Private RuneMultipliers(6) As Byte
	
    Public Sub init()
        Dim i As Short

        For i = 1 To 24
            Runes(i) = App.graphics.f560.rune(i)
            ManaMultipliers(i - 1).Text = Str(Runes(i))
        Next

        For i = 1 To 6
            RuneMultipliers(i) = App.graphics.f560.runemultiplier(i)
            RuneDifficulty(i - 1).Text = Str(RuneMultipliers(i))
        Next
    End Sub
	
	
	'UPGRADE_WARNING: Event RuneDifficulty.TextChanged may fire when form is initialized. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="88B12AE1-6DE0-48A0-86F1-60C0686C026A"'
	Private Sub RuneDifficulty_TextChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles RuneDifficulty.TextChanged
		Dim Index As Short = RuneDifficulty.GetIndex(eventSender)
		RuneMultipliers(Index + 1) = App.EFChange8(RuneDifficulty(Index), 0, 255)
	End Sub
	'UPGRADE_WARNING: Event ManaMultipliers.TextChanged may fire when form is initialized. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="88B12AE1-6DE0-48A0-86F1-60C0686C026A"'
	Private Sub ManaMultipliers_TextChanged(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles ManaMultipliers.TextChanged
		Dim Index As Short = ManaMultipliers.GetIndex(eventSender)
		Runes(Index + 1) = App.EFChange8(ManaMultipliers(Index), 0, 255)
	End Sub
	
    Private Sub Cancel_ClickEvent(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Cancel.Click
        Hide()
    End Sub
	
	
	
	
    Private Sub Ok_ClickEvent(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Ok.Click
        Dim i As Integer
        For i = 1 To 24
            App.graphics.f560.setrune(i, Runes(i))
        Next
        For i = 1 To 6
            App.graphics.f560.setrunemultiplier(i, RuneMultipliers(i))
        Next
        App.graphics.f560.update()
        Hide()
    End Sub

    Private Sub RuneEditor_FormClosing(ByVal sender As System.Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles MyBase.FormClosing
        If e.CloseReason = CloseReason.UserClosing Then
            e.Cancel = True
            Hide()
        End If
    End Sub
End Class