(version 2)
(include "sci.sh")
(exports
    0 proc233_0
)
(use "Main")
(use "GloryWindow")
(use "IconI")
(use "GameControls")
(script 233)


(local
    local0
    local1
    local2

)
(procedure public (proc233_0)
    (var temp0, theGCursorNumber)
    = theGCursorNumber gCursorNumber
    = temp0 Message(2 230 1 6 70 1)
    = local1 Memory(2 temp0)
    Message(0 230 1 6 70 1 local1)
    = temp0 Message(2 230 1 6 71 1)
    = local2 Memory(2 temp0)
    Message(0 230 1 6 71 1 local2)
    (quest:
        init()
        show()
        dispose()
    )
    Memory(3 local1)
    Memory(3 local2)
    (if (local0)
        (if (global424)
            (send gOwner:solvePuzzle(213 4))
            (send ((send gInv:at(0))):
                amount(/ (* 9 global424) 10)
                message(10)
            )
            = global424 0
        )(else
            (send ((send gInv:at(0))):amount((+ (send ((send gInv:at(0))):amount) (/ global410 100))))
            = global410 (% global410 100)
        )
        (send gQg3Messager:say(1 6 19))
    )
    (send gGame:setCursor(theGCursorNumber))
    DisposeScript(233)
)


(instance quest of GameControls
    (properties)

    (method (init param1)
        (send gGame:setCursor(999))
        (send (= window (GloryWindow:new())):
            top(60)
            left(80)
            bottom(145)
            right(240)
            priority(15)
            yourself()
        )
        (self:add(moneyIcon yesIcon noIcon))
        (super:init(rest param1))
    )

)
(instance moneyIcon of IconI
    (properties
        view 935
        loop 2
        cel 0
        nsTop 0
        signal $0004
        maskView 361
        maskLoop 3
    )

    (method (show)
        (var temp0[30], temp30[30], temp60[40], temp100[30], temp130[30])
        Graph(grDRAW_LINE 13 1 13 160 58 -1 -1)
        Graph(grUPDATE_BOX 12 1 14 160 1)
        Message(0 230 1 6 69 1 @temp60)
        Display(@temp60 100 5 3 102 0)
        Message(0 230 1 6 70 3 @temp60)
        Display(@temp60 100 0 20 102 17)
        (if (global424)
            Message(0 230 1 6 86 1 @temp0)
            Format(@temp100 @temp0 global424)
            Display(@temp100 100 0 36 102 19)
        )(else
            Message(0 230 1 6 87 1 @temp0)
            Format(@temp100 @temp0 (send ((send gInv:at(0))):amount))
            Message(0 230 1 6 88 1 @temp30)
            Format(@temp130 @temp30 global410)
            Display(@temp100 100 0 30 102 19)
            Display(@temp130 100 0 40 102 19)
        )
    )

)
(instance yesIcon of IconI
    (properties
        view 935
        loop 2
        cel 0
        nsTop 55
        signal $0101
        maskView 361
        maskLoop 3
    )

    (method (show)
        = nsRight 80
        = nsBottom (+ nsTop 15)
        DrawCel(view loop cel nsLeft nsTop -1)
        Display(local1 100 20 + nsTop 3 102 17)
        (if (& signal $0004)
            (self:mask())
        )
        (if (gPseudoMouse and (send gPseudoMouse:respondsTo(#stop)))
            (send gPseudoMouse:stop())
        )
    )


    (method (select)
        = local0 1
        (quest:state((& (quest:state) $ffdf)))
    )


    (method (highlight param1)
        (var temp0)
        (if (param1)
            DrawCel(view loop 1 nsLeft nsTop -1)
            = temp0 46
        )(else
            DrawCel(view loop 0 nsLeft nsTop -1)
            = temp0 17
        )
        Display(local1 100 20 + nsTop 3 102 temp0)
    )

)
(instance noIcon of IconI
    (properties
        view 935
        loop 2
        cel 0
        nsTop 70
        signal $0101
        maskView 361
        maskLoop 3
    )

    (method (show)
        (var temp0[15])
        = nsRight 80
        = nsBottom (+ nsTop 15)
        DrawCel(view loop cel nsLeft nsTop -1)
        Display(local2 100 20 + nsTop 3 102 17)
        (if (& signal $0004)
            (self:mask())
        )
        (if (gPseudoMouse and (send gPseudoMouse:respondsTo(#stop)))
            (send gPseudoMouse:stop())
        )
    )


    (method (select)
        = local0 0
        (quest:state((& (quest:state) $ffdf)))
    )


    (method (highlight param1)
        (var temp0)
        (if (param1)
            DrawCel(view loop 1 nsLeft nsTop -1)
            = temp0 46
        )(else
            DrawCel(view loop 0 nsLeft nsTop -1)
            = temp0 17
        )
        Display(local2 100 20 + nsTop 3 102 temp0)
    )

)
