Sign in to follow this  
Followers 0
JoshDB

D&d Tools Suite

9 posts in this topic

#1 ·  Posted (edited)

Hey guys, I play AGoT D&D (D&D in George R. R. Martin's fantasy world), and I've decided to make a program for my laptop to help me out with menial tasks :idiot:

It's not finished yet, but the GUI is working. I'll update the code as it gets done!

So far, character creation is done. It's coming along very fast!

UPDATES:

Feats and additional 1st level notes added to Character Generation!

Virtual Dice Roller added (up to 300d100's!)

Mass Battle Handler added (almost infinite army sizes duking it out round-by-round!)

Treasure Generator added (add custom lists, set min/max worth in gold, min/max items, and more!)

EXE: http://joshdb.com/downloads/D&D%20AGOT%20Suite.exe

#Include <GUIConstants.au3>
#Include <Misc.au3>
#Include <File.au3>
#Include <Math.au3>

HotkeySet("{F1}","Restart")

$SplashJPG = _TempFile ()
$ArrowJPG = _TempFile ()
$AltBG = _TempFile ()

If FileExists("Splash.jpg") Then $SplashJPG = "Splash.jpg"
If FileExists("Arrow.jpg") Then $ArrowJPG = "Arrow.jpg"
If FileExists("AltBG.jpg") Then $AltBG = "AltBG.jpg"

FileInstall("Splash.jpg", $SplashJPG)
FileInstall("Arrow.jpg", $ArrowJPG)
FileInstall("AltBG.jpg", $AltBG)

$GUI = GUICreate("D&D AGoT Tools", 600, 300, -1, -1, $WS_POPUP + $WS_SYSMENU + $WS_MINIMIZEBOX)

GUISetBkColor(0x16303D)

$BG = GUICtrlCreatePic($SplashJPG, 0, 0, 600, 300)

$Arrow = GUICtrlCreatePic($ArrowJPG, 303, 142, 18, 18)

$Description = GUICtrlCreateLabel("Generate a character", 277, 65, 231, 49)
GUICtrlSetFont($Description, 9, 1200, -1, "Arial")
GUICtrlSetColor($Description, 0xFFFFFF)

Global $Stat[100]
Global $HotSpot[4]
Global $Output[100]

;=============================================================== GUI HOTSPOTS

$HotSpot[0] = 303 + 20 * 0
$HotSpot[1] = 303 + 20 * 1
$HotSpot[2] = 303 + 20 * 2
$HotSpot[3] = 303 + 20 * 3

GuiRoundCorners($GUI, 0, 0, 12, 12)

DllCall("user32.dll", "int", "ShowCursor", "int", 0);HIDE CURSOR

DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUI, "int", 200, "long", 0x00080000)

GUISetState()

MouseMove(@DesktopWidth / 2, @DesktopHeight / 2)

Global $ArrowCoord[2]
Global $label[300]

$HotSpotSet = 0
$loopnum = 0
$height = 0
$heightset = 0
$dicenum = 0

While 1
    $Message = GUIGetMsg()
    
    $MouseCoord = MouseGetPos()
    
    $ArrowCoord[0] = $MouseCoord[0] - 338
    
    If $ArrowCoord[0] < 303 Then $ArrowCoord[0] = 303
    If $ArrowCoord[0] > 582 Then $ArrowCoord[0] = 582
    
    If $ArrowCoord[0] <> $ArrowCoord[1] Then GUICtrlSetPos($Arrow, $ArrowCoord[0], 142)
    
    For $HotSpotNumber = 0 To 3
        If $ArrowCoord[0] > $HotSpot[$HotSpotNumber] And $ArrowCoord[0] < $HotSpot[$HotSpotNumber] + 12 And $HotSpotSet <> $HotSpotNumber Then
            If $HotSpotNumber = 0 Then GUICtrlSetData($Description, "Generate a character")
            If $HotSpotNumber = 1 Then GUICtrlSetData($Description, "Roll virtual dice")
            If $HotSpotNumber = 2 Then GUICtrlSetData($Description, "Mass battle handler")
            If $HotSpotNumber = 3 Then GUICtrlSetData($Description, "Treasure Generator")
            $HotSpotSet = $HotSpotNumber
        EndIf
    Next
    
    If _IsPressed ("01") And $HotSpotSet = 0 Then CharacterGeneration()
    If _IsPressed ("01") And $HotSpotSet = 1 Then VirtualDice()
    If _IsPressed ("01") And $HotSpotSet = 2 Then BattleHandler()
    If _IsPressed ("01") And $HotSpotSet = 3 Then TreasureGenerator()
    
    Select
        Case $Message = $GUI_EVENT_CLOSE
            DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUI, "int", 100, "long", 0x00090000)
            If Not $SplashJPG = "Splash.jpg" Then FileDelete($SplashJPG)
            If Not $ArrowJPG = "Arrow.jpg" Then FileDelete($ArrowJPG)
            If Not $AltBG = "AltBG.jpg" Then FileDelete($AltBG)
            Exit
    EndSelect
    
    $ArrowCoord[1] = $ArrowCoord[0]
WEnd

Func CharacterGeneration()
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUI, "int", 100, "long", 0x00090000)
    GUIDelete($GUI)
    
    DllCall("user32.dll", "int", "ShowCursor", "int", 1)
    
    $GUI = GUICreate("D&D AGoT Character Generation", 600, 300, -1, -1, $WS_POPUP + $WS_SYSMENU + $WS_MINIMIZEBOX)
    
    GUISetBkColor(0x30373E)
    
    GUICtrlCreateLabel("Chargen", 430, 246)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetBkColor(-1, 0x16303D)
    GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
    GUICtrlSetColor(-1, 0xFFFFFF)
    
    GUICtrlCreateLabel("Class:", 12, 12)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Class = GUICtrlCreateCombo("Artisan", 50, 10, 100)
    GUICtrlSetData($Class, "Godsworn|Hunter|Knave|Maester|Man-at-arms|Noble|Raider")
    GUICtrlSetStyle($Class, -1, $WS_EX_TRANSPARENT)
    $GenerateButton = GUICtrlCreateButton("Generate", 160, 11, 60, 20)
    GUICtrlSetStyle($GenerateButton, -1, $WS_EX_TRANSPARENT)
    
    GUISetState()
    
    $BG = GUICtrlCreatePic($AltBG, 0, 0, 600, 300)
    
    GuiRoundCorners($GUI, 0, 0, 12, 12)
    
    GUISetState()
    
    While 1
        $Message = GUIGetMsg()
        
        Select
            Case $Message = $GUI_EVENT_CLOSE
                DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUI, "int", 100, "long", 0x00090000)
                If Not $SplashJPG = "Splash.jpg" Then FileDelete($SplashJPG)
                If Not $ArrowJPG = "Arrow.jpg" Then FileDelete($ArrowJPG)
                If Not $AltBG = "AltBG.jpg" Then FileDelete($AltBG)
                Exit
                ;================================================================= CHARGEN STATS
            Case $Message = $GenerateButton
                Select
                    Case GUICtrlRead($Class) = "Artisan"
                        $Stat[0] = "Level 1 Artisan"
                        $Stat[1] = 8 + 1
                        $Stat[2] = 8
                        $Stat[3] = 8
                        $Stat[4] = 8 + 7
                        $Stat[5] = 8 + 7
                        $Stat[6] = 8 + 7
                        $Stat[7] = Modifier($Stat[6], 6)
                        $Stat[8] = 0
                        $Stat[9] = 0
                        $Stat[10] = 0
                        $Stat[11] = 2
                        $Stat[12] = "+0"
                        $Stat[13] = "An artisan gains a +4 bonus to one Skill, chosen from the following list:  Appraise, Craft (Any), Forgery, Knowledge (Any), and Perform."
                        $Stat[40] = 7
                    Case GUICtrlRead($Class) = "Godsworn"
                        $Stat[0] = "Level 1 Godsworn"
                        $Stat[1] = 8
                        $Stat[2] = 8
                        $Stat[3] = 8 + 1
                        $Stat[4] = 8 + 5
                        $Stat[5] = 8 + 8
                        $Stat[6] = 8 + 7
                        $Stat[7] = Modifier($Stat[6], 6)
                        $Stat[8] = 0
                        $Stat[9] = 2
                        $Stat[10] = 0
                        $Stat[11] = 2
                        $Stat[12] = "+1"
                        $Stat[13] = "A Godsworn recieves the Literacy feat at 1st level.  They also gain an ability to, once a day, add +1 to any check.  The player may decide to add the modifier to any situation immediately after seeing the die roll outcome."
                        $Stat[40] = 8
                    Case GUICtrlRead($Class) = "Hunter"
                        $Stat[0] = "Level 1 Hunter"
                        $Stat[1] = 8 + 7
                        $Stat[2] = 8 + 8
                        $Stat[3] = 8 + 1
                        $Stat[4] = 8
                        $Stat[5] = 8 + 5
                        $Stat[6] = 8
                        $Stat[7] = Modifier($Stat[6], 2)
                        $Stat[8] = 1
                        $Stat[9] = 2
                        $Stat[10] = 2
                        $Stat[11] = 0
                        $Stat[12] = "+0"
                        $Stat[13] = "Hunters can choose a region in which he or she has exceptional experience at 1st level.  When in that region, the Hunter gains a +2 dodge bonus to defence.  In situations where the Dexterity modifier is lost, this effect is lost as well.  In adition, they gain a +2 modifier to  to any Knowledge: Nature, Search, Spot, or Survival checks made within the chosen region."
                        $Stat[40] = 7
                    Case GUICtrlRead($Class) = "Knave"
                        $Stat[0] = "Level 1 Knave"
                        $Stat[1] = 8 + 1
                        $Stat[2] = 8 + 8
                        $Stat[3] = 8
                        $Stat[4] = 8 + 7
                        $Stat[5] = 8
                        $Stat[6] = 8 + 5
                        $Stat[7] = Modifier($Stat[6], 3)
                        $Stat[8] = 0
                        $Stat[9] = 0
                        $Stat[10] = 2
                        $Stat[11] = 0
                        $Stat[12] = "+0"
                        $Stat[13] = "At 1st level, the Knave gains a +5 bonus to all Diplomacy checks made to find, buy, or sell illicit or illegal goods."
                        $Stat[40] = 9
                    Case GUICtrlRead($Class) = "Maester"
                        $Stat[0] = "Level 1 Maester"
                        $Stat[1] = 8
                        $Stat[2] = 8
                        $Stat[3] = 8 + 1
                        $Stat[4] = 8 + 8
                        $Stat[5] = 8 + 7
                        $Stat[6] = 8 + 5
                        $Stat[7] = Modifier($Stat[6], 5)
                        $Stat[8] = 0
                        $Stat[9] = 2
                        $Stat[10] = 0
                        $Stat[11] = 2
                        $Stat[12] = "+1"
                        $Stat[13] = "Maesters gain both the Literacy and Rookery Feats.  He must make a Handle Animal check (DC 15) to successfully send a raven.  He may also choose a bonus feat of the following:  Authority, Fame, Favoured, Leechcraft, Political Connections, or Skill Mastery."
                        $Stat[40] = 9
                    Case GUICtrlRead($Class) = "Man-at-arms"
                        $Stat[0] = "Level 1 Man-at-arms"
                        $Stat[1] = 8 + 8
                        $Stat[2] = 8 + 6
                        $Stat[3] = 8 + 3
                        $Stat[4] = 8 + 5
                        $Stat[5] = 8
                        $Stat[6] = 8
                        $Stat[7] = Modifier($Stat[6], 4)
                        $Stat[8] = 1
                        $Stat[9] = 2
                        $Stat[10] = 0
                        $Stat[11] = 0
                        $Stat[12] = "+0"
                        $Stat[13] = "A Man-at-arms can choose any Feat at 1st level, as long as he or she meets the prerequisites."
                        $Stat[40] = 3
                    Case GUICtrlRead($Class) = "Noble"
                        $Stat[0] = "Level 1 Noble"
                        $Stat[1] = 8 + 5
                        $Stat[2] = 8 + 5
                        $Stat[3] = 8 + 5
                        $Stat[4] = 8 + 5
                        $Stat[5] = 8 + 5
                        $Stat[6] = 8 + 5
                        $Stat[7] = Modifier($Stat[6], 8)
                        $Stat[8] = 0
                        $Stat[9] = 0
                        $Stat[10] = 0
                        $Stat[11] = 2
                        $Stat[12] = "+1"
                        $Stat[13] = "A Noble can select any two Cross-Class skills and designate them as Class Skills.  The also gain the Literacy Feat at 1st level, and gain the following Skill ranks:  Knowledge: History (2), Knowledge: Nobility (3), Knowledge: Stewardship (2), and Perform (Any, 2)."
                        $Stat[40] = 6
                    Case GUICtrlRead($Class) = "Raider"
                        $Stat[0] = "Level 1 Raider"
                        $Stat[1] = 8 + 8
                        $Stat[2] = 8 + 3
                        $Stat[3] = 8 + 6
                        $Stat[4] = 8
                        $Stat[5] = 8 + 5
                        $Stat[6] = 8
                        $Stat[7] = Modifier($Stat[6], 1)
                        $Stat[8] = 1
                        $Stat[9] = 2
                        $Stat[10] = 2
                        $Stat[11] = 0
                        $Stat[12] = "+0"
                        $Stat[13] = "Raiders gain the ability to move an aditional 10 feet whe nwearing light or no armor.  They also gain the Weapon Focus Feat with a single weapon of his or her choice. "
                        $Stat[40] = 4
                EndSelect
                
                GUICtrlCreateLabel("Class and Level: " & $Stat[0], 20, 40, 300)
                GUICtrlSetFont(-1, 9, 400, 2)
                GUICtrlSetColor(-1, 0xFFFFFF)
                GUICtrlCreateLabel("Influence: " & $Stat[7], 20, 55)
                GUICtrlSetFont(-1, 9, 400, 2)
                GUICtrlSetColor(-1, 0xFFFFFF)
                
                GUICtrlCreateLabel("Strength:", 20, 70, 200) ; STR
                GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
                GUICtrlSetColor(-1, 0xFFFFFF)
                GUICtrlCreateLabel($Stat[1], 100, 70, 200) ; STR
                GUICtrlSetFont(-1, 9, 400, 3, "Arial Bold")
                GUICtrlSetColor(-1, 0xFFFFFF)
                GUICtrlCreateLabel("Modifier:   " & Modifier($Stat[1]), 140, 70, 200) ; CHA
                GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
                GUICtrlSetColor(-1, 0xFFFFFF)
                
                GUICtrlCreateLabel("Dexterity:", 20, 85, 200) ; DEX
                GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
                GUICtrlSetColor(-1, 0xFFFFFF)
                GUICtrlCreateLabel($Stat[2], 100, 85, 200) ; DEX
                GUICtrlSetFont(-1, 9, 400, 3, "Arial Bold")
                GUICtrlSetColor(-1, 0xFFFFFF)
                GUICtrlCreateLabel("Modifier:   " & Modifier($Stat[2]), 140, 85, 200) ; CHA
                GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
                GUICtrlSetColor(-1, 0xFFFFFF)
                
                GUICtrlCreateLabel("Constitution:", 20, 100, 200) ; CON
                GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
                GUICtrlSetColor(-1, 0xFFFFFF)
                GUICtrlCreateLabel($Stat[3], 100, 100, 200) ; CON
                GUICtrlSetFont(-1, 9, 400, 3, "Arial Bold")
                GUICtrlSetColor(-1, 0xFFFFFF)
                GUICtrlCreateLabel("Modifier:   " & Modifier($Stat[3]), 140, 100, 200) ; CHA
                GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
                GUICtrlSetColor(-1, 0xFFFFFF)
                
                GUICtrlCreateLabel("Intelligence:", 20, 115, 200) ; INT
                GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
                GUICtrlSetColor(-1, 0xFFFFFF)
                GUICtrlCreateLabel($Stat[4], 100, 115, 200) ; INT
                GUICtrlSetFont(-1, 9, 400, 3, "Arial Bold")
                GUICtrlSetColor(-1, 0xFFFFFF)
                GUICtrlCreateLabel("Modifier:   " & Modifier($Stat[4]), 140, 115, 200) ; CHA
                GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
                GUICtrlSetColor(-1, 0xFFFFFF)
                
                GUICtrlCreateLabel("Wisdom:", 20, 130, 200) ; WIS
                GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
                GUICtrlSetColor(-1, 0xFFFFFF)
                GUICtrlCreateLabel($Stat[5], 100, 130, 200) ; WIS
                GUICtrlSetFont(-1, 9, 400, 3, "Arial Bold")
                GUICtrlSetColor(-1, 0xFFFFFF)
                GUICtrlCreateLabel("Modifier:   " & Modifier($Stat[5]), 140, 130, 200) ; CHA
                GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
                GUICtrlSetColor(-1, 0xFFFFFF)
                
                GUICtrlCreateLabel("Charisma:", 20, 145, 200) ; CHA
                GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
                GUICtrlSetColor(-1, 0xFFFFFF)
                GUICtrlCreateLabel($Stat[6], 100, 145, 200) ; CHA
                GUICtrlSetFont(-1, 9, 400, 3, "Arial Bold")
                GUICtrlSetColor(-1, 0xFFFFFF)
                GUICtrlCreateLabel("Modifier:   " & Modifier($Stat[6]), 140, 145, 200) ; CHA
                GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
                GUICtrlSetColor(-1, 0xFFFFFF)
                
                GUICtrlCreateLabel("Base Attack Bonus: +" & $Stat[8], 20, 160, 200)
                GUICtrlSetFont(-1, 9, 400, 4)
                GUICtrlSetColor(-1, 0xFFFFFF)
                GUICtrlCreateLabel("Fort Save:         " & Modifier($Stat[3], $Stat[9]) & "      Base:   +" & $Stat[9], 40, 175, 200)
                GUICtrlSetFont(-1, 9, 400, 6)
                GUICtrlSetColor(-1, 0xFFFFFF)
                GUICtrlCreateLabel("Ref Save:          " & Modifier($Stat[2], $Stat[10]) & "      Base:   +" & $Stat[10], 40, 190, 200)
                GUICtrlSetFont(-1, 9, 400, 6)
                GUICtrlSetColor(-1, 0xFFFFFF)
                GUICtrlCreateLabel("Will Save:         " & Modifier($Stat[5], $Stat[11]) & "      Base:   +" & $Stat[11], 40, 205, 200)
                GUICtrlSetFont(-1, 9, 400, 6)
                GUICtrlSetColor(-1, 0xFFFFFF)
                GUICtrlCreateLabel("Reputation: " & $Stat[12], 20, 220)
                GUICtrlSetColor(-1, 0xFFFFFF)
                GUICtrlCreateLabel("Initiative Modifier: " & $Stat[2], 20, 235)
                GUICtrlSetColor(-1, 0xFFFFFF)
                GUICtrlCreateLabel("Skill points: " & Modifier($Stat[4], $Stat[40]) * 4 + 4, 20, 250)
                GUICtrlSetColor(-1, 0xFFFFFF)
                
                GUICtrlCreateLabel("Aditional 1st level notes:", 280, 40, 200)
                GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
                GUICtrlSetColor(-1, 0xFFFFFF)
                
                GUICtrlCreateEdit($Stat[13],250,55,200,150,$ES_MULTILINE + $ES_CENTER + $ES_READONLY)
                GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
                GUICtrlSetBkColor(-1, 0x30373E)
                GUICtrlSetFont(-1, 7, 400, -1, "Arial")
                GUICtrlSetColor(-1, 0xFFFFFF)
        EndSelect
    WEnd
EndFunc   ;==>CharacterGeneration

Func VirtualDice()
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUI, "int", 100, "long", 0x00090000)
    GUIDelete($GUI)
    
    DllCall("user32.dll", "int", "ShowCursor", "int", 1)
    
    $GUI = GUICreate("D&D Virtual Dice Roller", 600, 300, -1, -1, $WS_POPUP + $WS_SYSMENU + $WS_MINIMIZEBOX)
    
    GUISetBkColor(0x30373E)
    
    GUICtrlCreateLabel("Dice", 430, 246)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetBkColor(-1, 0x16303D)
    GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
    GUICtrlSetColor(-1, 0xFFFFFF)
    
    GUICtrlCreateLabel("Roll", 24, 12)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
    GUICtrlSetColor(-1, 0xFFFFFF)
    $DiceNumber = GUICtrlCreateCombo("1", 50, 10, 50)
    GUICtrlSetData($DiceNumber, "2|3|4|5|6|7|8|9|10|11|12|13|14|15|16|17|18|19|20|50|100|200|300")
    GUICtrlSetStyle($DiceNumber, -1, $WS_EX_TRANSPARENT)
    GUICtrlCreateLabel("d", 104, 12)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
    GUICtrlSetColor(-1, 0xFFFFFF)
    $DiceSides = GUICtrlCreateCombo("4", 114, 10, 45)
    GUICtrlSetData($DiceSides, "6|8|10|12|20|50|100")
    GUICtrlSetStyle($DiceSides, -1, $WS_EX_TRANSPARENT)
    
    $Status = GUICtrlCreateLabel("1d4", 74, 42, 80)
    GUICtrlSetStyle($Status, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetFont($Status, 9, 400, -1, "Arial Bold")
    GUICtrlSetColor($Status, 0xFFFFFF)
    
    $RollButton = GUICtrlCreateButton("Roll the dice", 170, 11, 80, 20)
    GUICtrlSetStyle($RollButton, -1, $WS_EX_TRANSPARENT)
    
    GUISetState()
    
    $BG = GUICtrlCreatePic($AltBG, 0, 0, 600, 300)
    
    GuiRoundCorners($GUI, 0, 0, 12, 12)
    
    GUISetState()
    
    While 1
        $Message = GUIGetMsg()
        
        Select
            Case $Message = $GUI_EVENT_CLOSE
                DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUI, "int", 100, "long", 0x00090000)
                If Not $SplashJPG = "Splash.jpg" Then FileDelete($SplashJPG)
                If Not $ArrowJPG = "Arrow.jpg" Then FileDelete($ArrowJPG)
                If Not $AltBG = "AltBG.jpg" Then FileDelete($AltBG)
                Exit
            Case GUICtrlRead($Status) <> GUICtrlRead($DiceNumber) & "d" & GUICtrlRead($DiceSides)
                GUICtrlSetData($Status, GUICtrlRead($DiceNumber) & "d" & GUICtrlRead($DiceSides))
            Case $Message = $RollButton
                If $loopnum > 0 Then
                    $loopnum = 0
                    $height = 0
                    $heightset = 0
                    
                    For $i = 0 To $dicenum
                        GUICtrlSetColor($label[$i], 0xAAAAAA)
                    Next
                EndIf
                
                $dicenum = GUICtrlRead($DiceNumber) - 1
                
                For $i = 0 To GUICtrlRead($DiceNumber) - 1
                    For $t = 1 To 20
                        If _Floor ($loopnum / 18) = $t And $heightset < $t Then
                            $height = 0
                            $heightset = $t
                        EndIf
                    Next
                    $label[$i] = GUICtrlCreateLabel(Round(Random(0, GUICtrlRead($DiceSides))), 20 + 23 * _Floor ($loopnum / 18), 60 + 12 * $height, 20, 12)
                    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
                    GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
                    GUICtrlSetColor(-1, 0xFFFFFF)
                    $loopnum = $loopnum + 1
                    $height = $height + 1
                Next
        EndSelect
    WEnd
EndFunc   ;==>VirtualDice

Func BattleHandler()
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUI, "int", 100, "long", 0x00090000)
    GUIDelete($GUI)
    
    DllCall("user32.dll", "int", "ShowCursor", "int", 1)
    
    $GUI = GUICreate("D&D Virtual Dice Roller", 600, 300, -1, -1, $WS_POPUP + $WS_SYSMENU + $WS_MINIMIZEBOX)
    
    GUISetBkColor(0x30373E)
    
    $MSBLabel = GUICtrlCreateLabel("MSB", 430, 246)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetBkColor(-1, 0x16303D)
    GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
    GUICtrlSetColor(-1, 0xFFFFFF)
    
    $SideA = GUICtrlCreateInput("Side A", 20, 20, 100, 18)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlCreateLabel("has", 124, 22)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
    GUICtrlSetColor(-1, 0xFFFFFF)
    $SideANumber = GUICtrlCreateInput("24", 150, 20, 50, 18)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlCreateLabel("combatants", 204, 22, 80)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
    GUICtrlSetColor(-1, 0xFFFFFF)
    
    $SideB = GUICtrlCreateInput("Side B", 20, 40, 100, 18)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlCreateLabel("has", 124, 42)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
    GUICtrlSetColor(-1, 0xFFFFFF)
    $SideBNumber = GUICtrlCreateInput("24", 150, 40, 50, 18)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlCreateLabel("combatants", 204, 42, 80)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
    GUICtrlSetColor(-1, 0xFFFFFF)
    
    GUICtrlCreateLabel("Rounds to fight:", 290, 32, 90)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
    GUICtrlSetColor(-1, 0xFFFFFF)
    $Rounds = GUICtrlCreateInput(4, 390, 30, 20, 18)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetLimit($Rounds, 18, 1)
    
    $FightButton = GUICtrlCreateButton("Fight!", 430, 30, 60, 20)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    
    GUISetState()
    
    $BG = GUICtrlCreatePic($AltBG, 0, 0, 600, 300)
    
    GuiRoundCorners($GUI, 0, 0, 12, 12)
    
    GUISetState()
    
    While 1
        $Message = GUIGetMsg()
        
        Select
            Case $Message = $GUI_EVENT_CLOSE
                DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUI, "int", 100, "long", 0x00090000)
                If Not $SplashJPG = "Splash.jpg" Then FileDelete($SplashJPG)
                If Not $ArrowJPG = "Arrow.jpg" Then FileDelete($ArrowJPG)
                If Not $AltBG = "AltBG.jpg" Then FileDelete($AltBG)
                Exit
            Case $Message = $FightButton
                GUICtrlDelete($MSBLabel)
                
                Local $ANum = GUICtrlRead($SideANumber)
                Local $BNum = GUICtrlRead($SideBNumber)
                
                Local $ANumTemp
                Local $BNumTemp
                
                GUICtrlCreateLabel("",0,60,600,220)
                
                For $i = 0 To GUICtrlRead($Rounds) - 1
                    GUICtrlDelete($Output[$i])
                Next
                
                For $i = 0 To GUICtrlRead($Rounds) - 1
                    $ANumTemp = $ANum - Round(Random($BNum / 4, $BNum / 2))
                    $BNumTemp = $BNum - Round(Random($ANum / 4, $ANum / 2))
                    $ANum = $ANumTemp
                    $BNum = $BNumTemp
                    If $ANum <= 0 Then
                        $Output[$i] = GUICtrlCreateLabel(GUICtrlRead($SideA) & " has lost the battle.  All of their combatants have died, leaving " & GUICtrlRead($SideB) & " to win with " & $BNum & " combatants", 20, 60 + 16 * $i, 580, 20)
                        GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
                        GUICtrlSetBkColor(-1, 0x30373F)
                        GUICtrlSetFont(-1, 8, 400, -1, "Arial Bold")
                        GUICtrlSetColor(-1, 0xFFFFFF)
                        ExitLoop
                    ElseIf $BNum <= 0 Then
                        $Output[$i] = GUICtrlCreateLabel(GUICtrlRead($SideB) & " has lost the battle.  All of their combatants have died, leaving " & GUICtrlRead($SideA) & " to win with " & $ANum & " combatants", 20, 60 + 16 * $i, 580, 20)
                        GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
                        GUICtrlSetBkColor(-1, 0x30373F)
                        GUICtrlSetFont(-1, 8, 400, -1, "Arial Bold")
                        GUICtrlSetColor(-1, 0xFFFFFF)
                        ExitLoop
                    Else
                        If $i = GUICtrlRead($Rounds) Then
                            If _Max ($ANum, $BNum) = $ANum Then
                                $Output[$i] = GUICtrlCreateLabel(GUICtrlRead($SideA) & " wins in the final round with " & $ANum & " combatants, while " & GUICtrlRead($SideB) & " has " & $BNum & " combatants.", 20, 60 + 16 * $i, 580, 20)
                            Else
                                $Output[$i] = GUICtrlCreateLabel(GUICtrlRead($SideB) & " wins in the final round with " & $BNum & " combatants, while " & GUICtrlRead($SideA) & " has " & $ANum & " combatants.", 20, 60 + 16 * $i, 580, 20)
                            EndIf
                        Else
                            If _Max ($ANum, $BNum) = $ANum Then
                                $Output[$i] = GUICtrlCreateLabel(GUICtrlRead($SideA) & " wins in round " & $i & " with " & $ANum & " combatants, while " & GUICtrlRead($SideB) & " has " & $BNum & " combatants.", 20, 60 + 16 * $i, 580, 20)
                            Else
                                $Output[$i] = GUICtrlCreateLabel(GUICtrlRead($SideB) & " wins in round " & $i & " with " & $BNum & " combatants, while " & GUICtrlRead($SideA) & " has " & $ANum & " combatants.", 20, 60 + 16 * $i, 580, 20)
                            EndIf
                        EndIf
                    EndIf
                    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
                    GUICtrlSetBkColor(-1, 0x30373F)
                    GUICtrlSetFont(-1, 8, 400, -1, "Arial Bold")
                    GUICtrlSetColor(-1, 0xFFFFFF)
                Next
        EndSelect
    WEnd
EndFunc   ;==>BattleHandler

Func TreasureGenerator()
    DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUI, "int", 100, "long", 0x00090000)
    GUIDelete($GUI)
    
    DllCall("user32.dll", "int", "ShowCursor", "int", 1)
    
    If NOT FileExists("D&DAGoTToolsSuite.ini") Then IniWrite("D&DAGoTToolsSuite.ini","TG","index",0)
    
    $GUI = GUICreate("D&D Treasure Generator", 600, 300, -1, -1, $WS_POPUP + $WS_SYSMENU + $WS_MINIMIZEBOX)
    
    GUISetBkColor(0x30373E)
    
    GUICtrlCreateLabel("Treasure", 450, 246)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetBkColor(-1, 0x16303D)
    GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
    GUICtrlSetColor(-1, 0xFFFFFF)
    
    GUICtrlCreateLabel("Path to treasure list:", 50, 2, 100, 18)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $ListInput = GUICtrlCreateInput(@ScriptDir, 15, 20, 500, 18)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    $ListOpen = GUICtrlCreateButton("Browse...",525, 10, 60, 20)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    $ListAdd = GUICtrlCreateButton("Add",525, 30, 60, 20)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    
    GUICtrlCreateLabel("Lists available", 10, 48, 100, 16)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $List=GUICtrlCreateList("",20,65,150,150)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    
    $ListMoveO = GUICtrlCreateButton(">>",178, 120, 20, 20)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    $ListMoveX = GUICtrlCreateButton("<<",178, 140, 20, 20)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    
    GUICtrlCreateLabel("Lists to read from", 195, 48, 100, 16)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetColor(-1, 0xFFFFFF)
    $UseList=GUICtrlCreateList("",205,65,150,150)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    
    $UseLists = StringSplit(IniRead("D&DAGoTToolsSuite.ini","TG","UseLists",""),"|")
    
    For $i = 1 To $UseLists[0] - 1
        GUICtrlSetData($UseList,$UseLists[$i] & "|")
    Next
    
    $Gold = GUICtrlCreateCheckbox("",60,215)
    GUICtrlSetState (-1,IniRead("D&DAGoTToolsSuite.ini","TG","Gold",$GUI_CHECKED))
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    $Armor = GUICtrlCreateCheckbox("",60,235)
    GUICtrlSetState (-1,IniRead("D&DAGoTToolsSuite.ini","TG","Armor",$GUI_CHECKED))
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    $Weapons = GUICtrlCreateCheckbox("",60,255)
    GUICtrlSetState (-1,IniRead("D&DAGoTToolsSuite.ini","TG","Weapons",$GUI_CHECKED))
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    $Misc = GUICtrlCreateCheckbox("",60,275)
    GUICtrlSetState (-1,IniRead("D&DAGoTToolsSuite.ini","TG","Misc",$GUI_CHECKED))
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    
    GUICtrlCreateLabel("Include:", 10, 225, 45, 14)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetFont(-1, 9, 400, -1, "Arial Bold")
    GUICtrlSetColor(-1, 0xFFFFFF)
    
    GUICtrlCreateLabel("Gold", 80, 220, 50, 14)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetColor(-1, 0xFFFFFF)
    
    GUICtrlCreateLabel("Armor", 80, 240, 50, 14)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetColor(-1, 0xFFFFFF)
    
    GUICtrlCreateLabel("Weapons", 80, 260, 50, 14)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetColor(-1, 0xFFFFFF)
    
    GUICtrlCreateLabel("Misc Items", 80, 280, 50, 14)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetColor(-1, 0xFFFFFF)
    
    $Targets = GUICtrlCreateInput(IniRead("D&DAGoTToolsSuite.ini","TG","Targets",1), 365, 80, 40, 18)
    GUICtrlSetStyle($Targets, -1, $WS_EX_TRANSPARENT)
    GUICtrlCreateUpdown(-1)
    GUICtrlSetLimit(-1,100,1)
    
    GUICtrlCreateLabel("Number of targets to generate loot for:", 360, 62, 1000, 16)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetColor(-1, 0xFFFFFF)
    
    $MinItems = GUICtrlCreateInput(IniRead("D&DAGoTToolsSuite.ini","TG","MinItems",1), 365, 120, 40, 18)
    GUICtrlSetStyle($MinItems, -1, $WS_EX_TRANSPARENT)
    GUICtrlCreateUpdown(-1)
    GUICtrlSetLimit(-1,100,0)
    
    GUICtrlCreateLabel("Min # of items of each type on each target", 410, 122)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetFont(-1, 7, 400)
    GUICtrlSetColor(-1, 0xFFFFFF)
    
    $MaxItems = GUICtrlCreateInput(IniRead("D&DAGoTToolsSuite.ini","TG","MaxItems",5), 365, 140, 40, 18)
    GUICtrlSetStyle($MaxItems, -1, $WS_EX_TRANSPARENT)
    GUICtrlCreateUpdown(-1)
    GUICtrlSetLimit(-1,100,1)
    
    GUICtrlCreateLabel("Max # of items of each type on each target", 410, 142)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetFont(-1, 7, 400)
    GUICtrlSetColor(-1, 0xFFFFFF)
    
    $MinGold = GUICtrlCreateInput(IniRead("D&DAGoTToolsSuite.ini","TG","MinGold",3), 365, 160, 40, 18)
    GUICtrlSetStyle($MinGold, -1, $WS_EX_TRANSPARENT)
    GUICtrlCreateUpdown(-1)
    GUICtrlSetLimit(-1,100,0)
    
    GUICtrlCreateLabel("Minimum gold on each target (if checked)", 410, 162)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetFont(-1, 7, 400)
    GUICtrlSetColor(-1, 0xFFFFFF)
    
    $MaxGold = GUICtrlCreateInput(IniRead("D&DAGoTToolsSuite.ini","TG","MaxGold",12), 365, 180, 40, 18)
    GUICtrlSetStyle($MaxGold, -1, $WS_EX_TRANSPARENT)
    GUICtrlCreateUpdown(-1)
    GUICtrlSetLimit(-1,100,1)
    
    GUICtrlCreateLabel("Maximum gold on each target (if checked)", 410, 182)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetFont(-1, 7, 400)
    GUICtrlSetColor(-1, 0xFFFFFF)
    
    $GenButton = GUICtrlCreateButton("Generate!",362, 232, 80, 40)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    
    GUICtrlCreateLabel("Min total worth of loot on each target (in gold)", 150, 214, 200, 13)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetFont(-1, 7, 400)
    GUICtrlSetColor(-1, 0xFFFFFF)
    
    $MinWorth = GUICtrlCreateInput(IniRead("D&DAGoTToolsSuite.ini","TG","MinWorth",3),245, 232, 40, 18)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlCreateUpdown(-1)
    
    GUICtrlCreateLabel("Max total worth of loot on each target (in gold)", 150, 254, 200, 13)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlSetFont(-1, 7, 400)
    GUICtrlSetColor(-1, 0xFFFFFF)
    
    $MaxWorth = GUICtrlCreateInput(IniRead("D&DAGoTToolsSuite.ini","TG","MaxWorth",50),245, 272, 40, 18)
    GUICtrlSetStyle(-1, -1, $WS_EX_TRANSPARENT)
    GUICtrlCreateUpdown(-1)
    
    GUICtrlSetState($ListInput,$GUI_FOCUS)
    
    For $i = 1 to IniRead("D&DAGoTToolsSuite.ini","TG","index",0)
        GUICtrlSetData($List,IniRead("D&DAGoTToolsSuite.ini","TG",$i & "a","Unnamed List #" & IniRead("D&DAGoTToolsSuite.ini","TG","index",0) + $i) & "|")
    Next
    
    GUISetState()
    
    $BG = GUICtrlCreatePic($AltBG, 0, 0, 600, 300)
    
    GuiRoundCorners($GUI, 0, 0, 12, 12)
    
    GUISetState()
    
    While 1
        $Message = GUIGetMsg()
        
        Select
            Case $Message = $GUI_EVENT_CLOSE
                DllCall("user32.dll", "int", "AnimateWindow", "hwnd", $GUI, "int", 100, "long", 0x00090000)
                If Not $SplashJPG = "Splash.jpg" Then FileDelete($SplashJPG)
                If Not $ArrowJPG = "Arrow.jpg" Then FileDelete($ArrowJPG)
                If Not $AltBG = "AltBG.jpg" Then FileDelete($AltBG)
                IniWrite("D&DAGoTToolsSuite.ini","TG","Gold",GUICtrlRead($Gold))
                IniWrite("D&DAGoTToolsSuite.ini","TG","Armor",GUICtrlRead($Armor))
                IniWrite("D&DAGoTToolsSuite.ini","TG","Weapons",GUICtrlRead($Weapons))
                IniWrite("D&DAGoTToolsSuite.ini","TG","Misc",GUICtrlRead($Misc))
                IniWrite("D&DAGoTToolsSuite.ini","TG","Targets",GUICtrlRead($Targets))
                IniWrite("D&DAGoTToolsSuite.ini","TG","MinItems",GUICtrlRead($MinItems))
                IniWrite("D&DAGoTToolsSuite.ini","TG","MaxItems",GUICtrlRead($MaxItems))
                IniWrite("D&DAGoTToolsSuite.ini","TG","MinGold",GUICtrlRead($MinGold))
                IniWrite("D&DAGoTToolsSuite.ini","TG","MaxGold",GUICtrlRead($MaxGold))
                IniWrite("D&DAGoTToolsSuite.ini","TG","MinWorth",GUICtrlRead($MinWorth))
                IniWrite("D&DAGoTToolsSuite.ini","TG","MaxWorth",GUICtrlRead($MaxWorth))
                Exit
            Case $Message = $ListOpen
                $OpenDialog = FileOpenDialog("Please select your INI file containing the treasure lists.", @ScriptDir, "INI File (*.ini)", 1 + 2)

                If @error Then
                    MsgBox(4096,"","No file chosen!")
                Else
                    GUICtrlSetData($ListInput,$OpenDialog)
                EndIf
            Case $Message = $ListAdd
                If StringRight(GUICtrlRead($ListInput),4) = ".ini" Then
                    $File = FileOpen(GUICtrlRead($ListInput),0)
                    
                    If $File = -1 Then
                        GUICtrlSetData($ListInput,"Invalid .ini file!")
                    Else
                        If FileReadLine($File) = "[equipment]" Then
                            $Index = IniRead("D&DAGoTToolsSuite.ini","TG","index",0)
                            $ListName = IniRead(GUICtrlRead($ListInput),"equipment","List","Unnamed List #" & $Index + 1)
                            
                            IniWrite("D&DAGoTToolsSuite.ini","TG","index",$Index + 1)
                            IniWrite("D&DAGoTToolsSuite.ini","TG",$Index + 1,GUICtrlRead($ListInput))
                            IniWrite("D&DAGoTToolsSuite.ini","TG",$Index + 1 & "a",$ListName)
                            
                            GUICtrlSetData($List,$ListName & "|")
                        Else
                            GUICtrlSetData($ListInput,"Invalid .ini file!")
                        EndIf   
                    EndIf
                Else
                    GUICtrlSetData($ListInput,"Invalid .ini file!")
                EndIf
            Case $Message = $ListMoveO
                GUICtrlSetData($UseList,GUICtrlRead($List) & "|")
                IniWrite("D&DAGoTToolsSuite.ini","TG","UseLists",IniRead("D&DAGoTToolsSuite.ini","TG","UseLists","") & GUICtrlRead($List) & "|")
            Case $Message = $ListMoveX
                GUICtrlSetData($UseList,"")
                IniWrite("D&DAGoTToolsSuite.ini","TG","UseLists",StringReplace(IniRead("D&DAGoTToolsSuite.ini","TG","UseLists",""),GUICtrlRead($List) & "|",""))
            Case GUICtrlRead($MinItems) > GUICtrlRead($MaxItems)
                GUICtrlSetData($MaxItems,GUICtrlRead($MinItems) + 1)
            Case $Message = $GenButton
                
                $Lists = StringSplit(IniRead("D&DAGoTToolsSuite.ini","TG","UseLists",""),"|")
                
                $ListArmor = ""
                $ListWeapons = ""
                $ListMisc = ""
                
                For $i = 1 To $Lists[0]
                    For $l = 1 to IniRead("D&DAGoTToolsSuite.ini","TG","index",1)
                        If IniRead("D&DAGoTToolsSuite.ini","TG",$l & "a","") = $Lists[$i] Then
                            $ListArmor = $ListArmor & IniRead(IniRead("D&DAGoTToolsSuite.ini","TG",$l,""),"equipment","Armor","")
                            $ListWeapons = $ListWeapons & IniRead(IniRead("D&DAGoTToolsSuite.ini","TG",$l,""),"equipment","Weapons","")
                            $ListMisc = $ListMisc & IniRead(IniRead("D&DAGoTToolsSuite.ini","TG",$l,""),"equipment","Misc","")
                        EndIf
                    Next
                Next
                
                $ListArmor = StringSplit($ListArmor,";")
                
                Global $ArmorName[$ListArmor[0]]
                Global $ArmorPrice[$ListArmor[0]]
                Global $ArmorRarity[$ListArmor[0]]
                $ArmorName[0] = 0
                
                $Count = 1
                
                For $i = 1 To $ListArmor[0] - 1 Step 3
                    $ArmorName[$Count] = $ListArmor[$i]
                    $ArmorPrice[$Count] = $ListArmor[$i + 1]
                    $ArmorRarity[$Count] = $ListArmor[$i + 2]
                    
                    $ArmorName[0] = $Count
                    
                    $Count = $Count + 1
                Next
                
                $ListWeapons = StringSplit($ListWeapons,";")
                
                Global $WeaponsName[$ListWeapons[0]]
                Global $WeaponsPrice[$ListWeapons[0]]
                Global $WeaponsRarity[$ListWeapons[0]]
                $WeaponsName[0] = 0
                
                $Count = 1
                
                For $i = 1 To $ListWeapons[0] - 1 Step 3
                    $WeaponsName[$Count] = $ListWeapons[$i]
                    $WeaponsPrice[$Count] = $ListWeapons[$i + 1]
                    $WeaponsRarity[$Count] = $ListWeapons[$i + 2]
                    
                    $WeaponsName[0] = $Count
                    
                    $Count = $Count + 1
                Next
                
                $ListMisc = StringSplit($ListMisc,";")
                
                Global $MiscName[$ListMisc[0]]
                Global $MiscPrice[$ListMisc[0]]
                Global $MiscRarity[$ListMisc[0]]
                $MiscName[0] = 0
                
                $Count = 1
                
                For $i = 1 To $ListMisc[0] - 1 Step 3
                    $MiscName[$Count] = $ListMisc[$i]
                    $MiscPrice[$Count] = $ListMisc[$i + 1]
                    $MiscRarity[$Count] = $ListMisc[$i + 2]
                    
                    $MiscName[0] = $Count
                    
                    $Count = $Count + 1
                Next
                
                _FileCreate("Treasure.txt")
                
                $Output = FileOpen("Treasure.txt",1)
                
                FileWrite($Output,"D&D AGoT Tools Suite Treasure Generator Output File" & @CRLF)
                
                $Go = 0
                
                For $m = 1 To GUICtrlRead($Targets)
                    FileWrite($Output,@CRLF & "---Target #" & $m & @CRLF)
                
                    $TotalWorth = 0
                    
                    For $t = 1 To GUICtrlRead($MaxItems)
                        If $t <= GUICtrlRead($MinItems) Then
                            $Go = 10
                        Else
                            $Go = Random(1,10,1)
                        EndIf
                        
                        If $Go >= 6 Or $TotalWorth < GUICtrlRead($MinWorth) Then
                            $SelectedArmor = Random(1,$ArmorName[0],1)
                            $SelectedArmorOdds = Random(1,100,1) + $Go * 3
                            
                            If $SelectedArmorOdds - $ArmorRarity[$SelectedArmor] > $ArmorRarity[$SelectedArmor] And $TotalWorth < GUICtrlRead($MaxWorth) Then
                                FileWrite($Output,$ArmorName[$SelectedArmor] & @CRLF)
                                $TotalWorth = $TotalWorth + $ArmorPrice[$SelectedArmor]
                            EndIf
                            
                            $SelectedWeapons = Random(1,$WeaponsName[0],1)
                            $SelectedWeaponsOdds = Random(1,100,1) + $Go * 3
                            
                            If $SelectedWeaponsOdds - $WeaponsRarity[$SelectedWeapons] > $WeaponsRarity[$SelectedWeapons] And $TotalWorth < GUICtrlRead($MaxWorth)  Then
                                FileWrite($Output,$WeaponsName[$SelectedWeapons] & @CRLF)
                                $TotalWorth = $TotalWorth + $WeaponsPrice[$SelectedArmor]
                            EndIf
                            
                            $SelectedMisc = Random(1,$MiscName[0],1)
                            $SelectedMiscOdds = Random(1,100,1) + $Go * 3
                            
                            If $SelectedMiscOdds - $MiscRarity[$SelectedMisc] > $MiscRarity[$SelectedMisc] And $TotalWorth < GUICtrlRead($MaxWorth)  Then
                                FileWrite($Output,$MiscName[$SelectedMisc] & @CRLF)
                                $TotalWorth = $TotalWorth + $MiscPrice[$SelectedArmor]
                            EndIf
                        EndIf
                    Next
                Next
                
                FileClose($Output)
                
                Run("Notepad.exe Treasure.txt")
        EndSelect
    WEnd
EndFunc   ;==>VirtualDice

Func Modifier($Number, $Opt = 0, $Signs = 1)
    Local $Return
    
    If $Number = 1 Then $Return = -5 + $Opt
    If $Number = 2 Then $Return = -4 + $Opt
    If $Number = 3 Then $Return = -4 + $Opt
    If $Number = 4 Then $Return = -3 + $Opt
    If $Number = 5 Then $Return = -3 + $Opt
    If $Number = 6 Then $Return = -4 + $Opt
    If $Number = 7 Then $Return = -4 + $Opt
    If $Number = 8 Then $Return = -2 + $Opt
    If $Number = 9 Then $Return = -2 + $Opt
    If $Number = 10 Then $Return = 0 + $Opt
    If $Number = 11 Then $Return = 0 + $Opt
    If $Number = 12 Then $Return = 1 + $Opt
    If $Number = 13 Then $Return = 1 + $Opt
    If $Number = 14 Then $Return = 2 + $Opt
    If $Number = 15 Then $Return = 2 + $Opt
    If $Number = 16 Then $Return = 3 + $Opt
    If $Number = 17 Then $Return = 3 + $Opt
    If $Number = 18 Then $Return = 4 + $Opt
    If $Number = 19 Then $Return = 4 + $Opt
    If $Number = 20 Then $Return = 5 + $Opt
    If $Number = 21 Then $Return = 5 + $Opt
    If $Number = 22 Then $Return = 6 + $Opt
    If $Number = 23 Then $Return = 6 + $Opt
    If $Number = 24 Then $Return = 7 + $Opt
    If $Number = 25 Then $Return = 7 + $Opt
    If $Number = 26 Then $Return = 8 + $Opt
    If $Number > 28 Then $Return = 9 + $Opt
    
    If $Signs = 1 Then
        If StringLeft($Return, 1) = Chr(45) Then
            Return $Return
        Else
            Return "+" & $Return
        EndIf
    Else
        Return $Return
    EndIf
EndFunc   ;==>Modifier

Func GuiRoundCorners($h_win, $i_x1, $i_y1, $i_x3, $i_y3)
    Dim $pos, $ret, $ret2
    $pos = WinGetPos($h_win)
    $ret = DllCall("gdi32.dll", "long", "CreateRoundRectRgn", "long", $i_x1, "long", $i_y1, "long", $pos[2], "long", $pos[3], "long", $i_x3, "long", $i_y3)
    If $ret[0] Then
        $ret2 = DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $ret[0], "int", 1)
        If $ret2[0] Then
            Return 1
        Else
            Return 0
        EndIf
    Else
        Return 0
    EndIf
EndFunc   ;==>GuiRoundCorners

Func Restart()
    If @Compiled = 1 Then
        If Not $SplashJPG = "Splash.jpg" Then FileDelete($SplashJPG)
        If Not $ArrowJPG = "Arrow.jpg" Then FileDelete($ArrowJPG)
        If Not $AltBG = "AltBG.jpg" Then FileDelete($AltBG)
        Run( FileGetShortName(@ScriptFullPath))
    Else
        If Not $SplashJPG = "Splash.jpg" Then FileDelete($SplashJPG)
        If Not $ArrowJPG = "Arrow.jpg" Then FileDelete($ArrowJPG)
        If Not $AltBG = "AltBG.jpg" Then FileDelete($AltBG)
        Run( FileGetShortName(@AutoItExe) & " " & FileGetShortName(@ScriptFullPath))
    EndIf
    Exit
EndFunc

REQUIRES BETA

Anyways, hope you guys like what's finished so far.

Edited by JoshDB

Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite

Share this post


Link to post
Share on other sites



Woo updated :)


Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Alright guys, updated the proggie with a mass battle handler. I've also changed out Chargen.jpg for AltBG.jpg :)

EDIT: Whoops, forgot to change out Splash.jpg for the new version. Anyways, I did it just now.

Edited by JoshDB

Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite

Share this post


Link to post
Share on other sites

I've added tons of features. As always, be sure to replace the images.

I think I'm gonna stop posting here and just continue on the Wizards.com forums... Nobody seems to care :D


Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite

Share this post


Link to post
Share on other sites

I've added tons of features. As always, be sure to replace the images.

I think I'm gonna stop posting here and just continue on the Wizards.com forums... Nobody seems to care :D

No man, dont stop posting. They may not care, but I think this is the ownage. (For rezile!) But really man, although I play normal D&D and not this one, I still think this is a sweet tool. You put alot of time and effort into it. (The mouse thing is sweet, thump up for that!) And hey man it really rocks. GREAT JOB! :D:P

Share this post


Link to post
Share on other sites

No man, dont stop posting. They may not care, but I think this is the ownage. (For rezile!) But really man, although I play normal D&D and not this one, I still think this is a sweet tool. You put alot of time and effort into it. (The mouse thing is sweet, thump up for that!) And hey man it really rocks. GREAT JOB! :D:P

Thanks a lot ;) lol atleast somebody likes it :D

P.S. I made something like this for generic D&D for PSP - If you want I could port it.


Ha, I haven't been on these forums since... 2006, almost. Behold, my legacy signature:My AutoIt idol is Valuater. You know you love him, too.My Stuff: D&D AGoT Tools Suite

Share this post


Link to post
Share on other sites

Thanks a lot :P lol atleast somebody likes it :D

P.S. I made something like this for generic D&D for PSP - If you want I could port it.

Well id, love to see it. (But you know, if you have the time.) :D

Share this post


Link to post
Share on other sites

Wow, what a pretty GUI. lol, Good Job on that. Although I don't have the game this works for so.. i could'nt really test out its core functions..

but anyways.. NICE*!

Share this post


Link to post
Share on other sites

Very cool! One thing I noticed in the die roller is that the results are off by one, so 3d6 returned 0,5,5.

If you set random's minimum range to 1 and max to the die's size that should do it.


"I'm not even supposed to be here today!" -Dante (Hicks)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0