(version 2)
(include "sci.sh")
(exports
    0 rm450
)
(use "Main")
(use "TellerIcon")
(use "n026")
(use "OccasionalCycle")
(use "PolyPath")
(use "Polygon")
(use "CueObj")
(use "n958")
(use "Sound")
(use "Cycle")
(use "Game")
(use "User")
(use "View")
(use "Obj")
(script 450)


(local
    local0
    local1
    local2
    local3
    local4
    local5
    local6
    local7
    local8
    local9
    local10
    local11
    local12
    local13[20] = (0 -7 -8 -9 -3 -12 -20 -65 -25 -26 -38 -39 -47 -48 -42 -49 -40 -59 -58 999 )
    local33[4]
    local37[3] = (0 -12 999 )
    local40[5] = (0 -13 -14 -15 999 )
    local45[15] = (0 -45 -1 -18 -19 -11 -5 -68 -67 -66 -10 -22 -44 26 999 )
    local60[2]
    local62[4] = (0 5 6 999 )
    local66[2]
    local68[3] = (0 7 999 )
    local71[2]
    local73[4] = (0 58 59 999 )
    local77[2]

)
(instance public rm450 of Rm
    (properties
        noun 10
        picture 450
    )

    (method (init)
        = local33[0] @local13
        = local33[1] @local40
        = local60[0] @local45
        = local66[0] @local62
        = local71[0] @local68
        = local77[0] @local73
        Load(143 450)
        proc958_0(128 450 451 423)
        proc0_3()
        (super:init())
        (send global2:addObstacle((send ((Polygon:new())):
                type(2)
                init(116 136 126 128 173 128 185 141 183 150 142 154 116 152)
                yourself()
            )
 (send ((Polygon:new())):
                type(3)
                init(267 189 267 163 290 163 290 142 275 142 253 130 239 122 164 111 160 101 135 101 135 113 67 125 42 125 42 149 77 149 77 163 108 163 108 189)
                yourself()
            )
))
        (send (ScriptID(42 0)):y(100))
        (if (global121 and proc0_6(50))
            = local11 7
        )(else
            (if (proc0_6(16) and not proc0_6(163))
                = local11 8
            )(else
                (if (((((not (== global392 4) and (== global392 1)) and (send gOwner:has(21))) and (send gOwner:has(40))) and (send gOwner:has(3))) and (>= (send ((send gInv:at(21))):amount) 5))
                    = global392 2
                    = local11 6
                )(else
                    (if ((proc0_6(29) and not proc0_6(38)) and (== global392 0))
                        = local11 3
                    )(else
                        (if (((proc0_6(38) and not proc0_6(11)) and (send gOwner:has(22))) and ((== global362 0) or (== global362 3)))
                            = local11 5
                        )(else
                            (if (not proc0_6(65) and proc0_6(38))
                                = global392 1
                                = local11 4
                            )(else
                                (if ((not proc0_6(74) and proc0_6(49)) and not global121)
                                    = local11 1
                                )(else
                                    = local11 2
                                )
                            )
                        )
                    )
                )
            )
        )
        (if (not 
        (if ((send gOwner:has(46)) or proc0_6(13))
        )(else
            proc0_6(74)
        )
)
            (drum:
                init()
                stopUpd()
            )
        )
        (if (not proc0_6(49))
            = local11 0
        )
        (fire:
            setCycle(Fwd)
            init()
        )
        (trunkLid:
            init()
            stopUpd()
        )
        (crack:init())
        (leopardhide:init())
        (shields:init())
        (send gLongSong:
            number(913)
            setLoop(-1)
            play(127)
        )
        (if ((== local11 7) and proc0_6(50))
            (send gLongSong:
                setLoop(-1)
                number(400)
                play()
            )
        )(else
            (send gLongSong:
                setLoop(-1)
                number(450)
                play()
            )
        )
        (laibonTell:init(ScriptID(42 1) @local13 @local33 @local37))
        (egoTell:init(gOwner @local45 @local60))
        (if (== local11 0)
            = global392 0
            (rakeeshTell:init(ScriptID(35 1) @local62 @local66))
            (uhuraTell:init(native @local68 @local71))
            (send (ScriptID(34 0)):
                x(196)
                y(10)
                textX(-175)
                textY(3)
                talkWidth(140)
            )
            (send (ScriptID(35 0)):
                x(196)
                y(80)
                textX(-175)
                textY(3)
                talkWidth(140)
            )
            (send (ScriptID(42 1)):
                view(451)
                x(80)
                y(116)
                setPri(6)
                setScale()
                scaleX(154)
                scaleY(154)
                noun(4)
                init()
            )
            (laibonArm:
                setScale()
                scaleX(154)
                scaleY(154)
                init()
                setCycle(Snooze self 1 10 200)
            )
            (native:
                setScale(160)
                setScale()
                scaleX(156)
                scaleY(156)
                init()
                noun(1)
                stopUpd()
            )
            (send (ScriptID(35 1)):
                view(964)
                loop(3)
                cel(3)
                x(209)
                y(150)
                noun(2)
                setScale()
                scaleX(156)
                scaleY(156)
                init()
            )
            (send gOwner:
                loop(1)
                setScale()
                scaleX(156)
                scaleY(156)
                setHeading(315)
                x(105)
                y(150)
                noun(3)
                init()
                normalize(7)
            )
            (send global2:setScript(enterFirstTime))
        )(else
            (if (proc999_5(local11 1 2 3 4 5 6))
                (send global2:setScript(enterRoom))
            )(else
                (if (== local11 7)
                    (send (ScriptID(42 1)):
                        view(453)
                        x(216)
                        y(109)
                        setCycle(Snooze self 1 10 150)
                        setScript(laibonSnoozes)
                        init()
                    )
                    (if (proc0_6(50))
                        (crack:dispose())
                        (hole:
                            init()
                            stopUpd()
                        )
                        (send gOwner:
                            x(213)
                            y(120)
                            normalize()
                            setScale()
                            scaleX(156)
                            scaleY(156)
                            init()
                            code(sneakCheck)
                        )
                    )(else
                        (send gGame:setScript(enterNormal))
                    )
                )(else
                    (if (== local11 8)
                        (yesufuTell:init(ScriptID(39 1) @local73 @local77))
                        (send global2:setScript(afterContest))
                    )
                )
            )
        )
    )


    (method (doit param1)
        (if ((not (send gOwner:script) and (== local11 3)) and (== local2 5))
            (send gOwner:setScript(egoExits))
        )(else
            (if ((not (send gOwner:script) and (== local11 4)) and (== local2 4))
                (send gOwner:setScript(egoExits))
            )(else
                (if ((not local1 and (== local11 5)) and (== local2 4))
                    = local1 1
                    (send gQg3Messager:say(4 6 46))
                )(else
                    (if (((not (send gOwner:script) and not (send global2:script)) and (<> local11 7)) and (> (send gOwner:y) 170))
                        (send global2:setScript(egoExits))
                    )
                )
            )
        )
        (super:doit(rest param1))
    )


    (method (dispose)
        (if ((send gGame:script))
            (send gGame:setScript(0))
        )
        (send gLongSong:stop())
        (send gLongSong3:stop())
        UnLoad(143 450)
        UnLoad(128 450)
        UnLoad(128 451)
        UnLoad(128 423)
        (send (ScriptID(42 1)):setCycle(0))
        (laibonArm:setCycle(0))
        proc958_0(0 35 13 12 34 33 42 939 39)
        (if (gNewList)
            (send gNewList:eachElementDo(111))
        )
        (super:dispose())
    )


    (method (doVerb theVerb)
        (switch (theVerb)
            (case 75
                (if ((send gOwner:castSpell(19)))
                    proc0_14((send ((User:curEvent)):x) (send ((User:curEvent)):y))
                    (send gOwner:setScript(ScriptID(13) 0 trunkLid))
                )
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )

)
(instance exitThief of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gQg3Messager:say(8 4 0 0 self))
            )
            (case 1
                (send global2:newRoom(420))
            )
        )
    )

)
(instance laibonSnoozes of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (sFx:
                    number(941)
                    play()
                )
                = state -1
                = seconds Random(5 15)
            )
        )
    )

)
(instance afterContest of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send (ScriptID(39 1)):
                    x(148)
                    y(110)
                    loop(2)
                    setScale()
                    scaleX(156)
                    scaleY(156)
                    noun(6)
                    init()
                )
                (send (ScriptID(42 1)):
                    view(451)
                    x(80)
                    y(116)
                    setPri(6)
                    setScale()
                    scaleX(154)
                    scaleY(154)
                    noun(4)
                    init()
                )
                (laibonArm:
                    setScale()
                    scaleX(154)
                    scaleY(154)
                    init()
                    setCycle(Snooze self 1 10 200)
                )
                (send gOwner:
                    x(250)
                    y(180)
                    view(0)
                    normalize()
                    setScale()
                    scaleX(156)
                    scaleY(156)
                    noun(3)
                    init()
                    setMotion(PolyPath 140 130 self)
                )
            )
            (case 1
                = cycles 18
            )
            (case 2
                (send gQg3Messager:say(4 6 58 0 self))
            )
            (case 3
                (if (global406)
                    (send gQg3Messager:say(4 6 64 0 self))
                )(else
                    (send gQg3Messager:say(4 6 62 0 self))
                )
            )
            (case 4
                (send gQg3Messager:say(4 6 59 0 self))
            )
            (case 5
                (if (not global406 and proc0_6(30))
                    (send gOwner:get(46))
                    proc0_4(163)
                    (send gQg3Messager:say(6 6 60 0 self))
                )(else
                    (if (not global406 and not proc0_6(30))
                        (send gQg3Messager:say(6 6 61 0 self))
                    )(else
                        (if (global406)
                            (send gOwner:get(46))
                            proc0_4(163)
                            (self:cue())
                        )
                    )
                )
            )
            (case 6
                (if (not global406 and proc0_6(30))
                    (send global2:newRoom(420))
                )(else
                    (if (not global406)
                        proc26_0(72)
                    )(else
                        (send gQg3Messager:say(4 6 63 0 self))
                    )
                )
            )
            (case 7
                proc0_13()
                = seconds 20
            )
            (case 8
                (send global2:setScript(egoExits))
            )
        )
    )

)
(instance eventFour of Script
    (properties)

    (method (doit)
        (if (local0 or (== state 4))
            = local0 0
            (self:changeState((= state 2)))
        )
        (super:doit())
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_3()
                (send gOwner:setHeading(315 self))
            )
            (case 1
                (send gOwner:normalize())
                = seconds 5
            )
            (case 2
                = cycles 250
            )
            (case 3
                (send gQg3Messager:say(4 6 16 0 self))
                (send gOwner:addHonor(-10))
            )
            (case 4
                0
            )
        )
    )

)
(instance enterRoom of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send (ScriptID(42 1)):
                    x(80)
                    y(116)
                    setPri(6)
                    setScale()
                    scaleX(154)
                    scaleY(154)
                    noun(4)
                    init()
                )
                (laibonArm:
                    setScale()
                    scaleX(154)
                    scaleY(154)
                    init()
                    setCycle(Snooze self 1 10 200)
                )
                (send gOwner:
                    normalize()
                    setScale()
                    scaleX(156)
                    scaleY(156)
                    x(260)
                    y(185)
                    noun(3)
                    setMotion(PolyPath 240 140 self)
                    init()
                )
            )
            (case 1
                (send gOwner:setMotion(PolyPath 142 128 self))
            )
            (case 2
                (if (proc999_5(local11 4 5 6))
                    (send gGame:setScript(eventFour))
                )(else
                    (send gGame:setScript(eventsTwoAndThree))
                )
                (self:dispose())
            )
        )
    )

)
(instance eventsTwoAndThree of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_3()
                (send gOwner:
                    code(outCheck)
                    setHeading(315)
                )
                = seconds 5
            )
            (case 1
                ++local9
            )
            (case 2
                (send gOwner:normalize())
                = seconds 30
            )
            (case 3
                (if (== local11 3)
                    (send gQg3Messager:say(4 6 25))
                    = seconds 10
                )(else
                    (if (== local11 1)
                        (self:cue())
                    )(else
                        (if (== local10 0)
                            (send gQg3Messager:say(4 6 16))
                            = seconds 10
                        )
                    )
                )
            )
            (case 4
                (if (== local10 0)
                    (send gQg3Messager:say(4 6 17 0 self))
                )(else
                    (self:cue())
                )
            )
            (case 5
                (send gQg3Messager:say(4 6 21 0 self))
            )
            (case 6
                (send global2:setScript(egoExits))
                (self:dispose())
            )
        )
    )

)
(instance egoExits of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gGame:setScript(0))
                (if ((== local2 5) and (== local11 3))
                    (send gQg3Messager:say(4 6 25 0 self))
                )(else
                    (if ((((== local2 4) and (== local11 4)) and (== global362 0)) and not proc0_6(16))
                        (send gQg3Messager:say(4 6 43 0 self))
                    )(else
                        (if ((((((== global362 0) and (send gOwner:has(21))) and (send gOwner:has(40))) and (send gOwner:has(3))) and proc0_6(16)) and (== global392 2))
                            (send gQg3Messager:say(4 6 40))
                            (self:setScript(egoBuysJohari self))
                        )(else
                            (if (((((<> global362 0) and (send gOwner:has(21))) and (send gOwner:has(40))) and (send gOwner:has(3))) and (== global392 2))
                                (send gQg3Messager:say(4 6 40))
                                (self:setScript(egoBuysJohari self))
                            )(else
                                (if ((== local11 5) and not proc0_6(11))
                                    (self:setScript(egoGivesHorn))
                                )(else
                                    = cycles 1
                                )
                            )
                        )
                    )
                )
            )
            (case 1
                (if ((== local2 4) and (== local11 4))
                    (send gQg3Messager:say(4 6 26 0 self))
                )(else
                    = cycles 1
                )
            )
            (case 2
                (send gOwner:setMotion(PolyPath 290 220 self))
            )
            (case 3
                (send global2:newRoom(420))
            )
        )
    )

)
(instance egoBows of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:addHonor(5))
                (send gOwner:
                    view(32)
                    loop(1)
                    setCycle(End self)
                )
            )
            (case 1
                (send gOwner:normalize(7))
                = cycles 6
            )
            (case 2
                = local12 1
                (switch (register)
                    (case -1
                        (send gQg3Messager:say(3 5 1 0 self))
                    )
                    (case -18
                        (send gQg3Messager:say(3 5 18 0 self))
                    )
                    (case -19
                        (send gQg3Messager:say(3 5 19 0 self))
                    )
                    (default 
                        = cycles 1
                    )
                )
            )
            (case 3
                (self:dispose())
            )
        )
    )

)
(instance egoBuysJohari of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:
                    drop(21 5)
                    drop(40 1)
                    drop(3 1)
                )
                = global366 11
                (send gOwner:solvePuzzle(272 3))
                (send gOwner:solvePuzzle(274 3))
                (send gOwner:solvePuzzle(273 3))
                (send gMainIconBar:advanceCurIcon())
                (send gOwner:setMotion(PolyPath 89 132 self))
            )
            (case 1
                (laibonArm:hide())
                (send (ScriptID(42 1)):
                    cel(0)
                    loop(2)
                    setCycle(End self)
                )
            )
            (case 2
                (send gQg3Messager:say(4 6 29 0 self))
            )
            (case 3
                (send (ScriptID(42 1)):setCycle(Beg self))
            )
            (case 4
                (laibonArm:show())
                = global392 4
                (send (ScriptID(42 1)):loop(0))
                (if (<> client egoExits)
                    proc0_3()
                )
                (self:dispose())
            )
        )
    )

)
(instance pickLock of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:setMotion(PolyPath 232 140 self))
            )
            (case 1
                proc0_3()
                (send gLongSong2:
                    number(311)
                    setLoop(1)
                    play()
                )
                (send gQg3Messager:say(7 17))
                = local7 1
                (self:dispose())
            )
        )
    )

)
(instance egoOilsChest of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:setMotion(PolyPath 232 140 self))
            )
            (case 1
                proc0_3()
                (send gQg3Messager:say(7 35))
                = local5 1
                (self:dispose())
            )
        )
    )

)
(instance castOpenOnChest of Script
    (properties)

    (method (changeState newState)
        (var temp0)
        (switch (= state newState)
            (case 0
                proc0_2()
                (if (not local5)
                    (send gLongSong2:
                        number(311)
                        setLoop(1)
                        play()
                    )
                    (if (not local7)
                        = local7 1
                        (send gQg3Messager:say(7 75 78))
                    )(else
                        (send gQg3Messager:say(7 75 54))
                        (sFx:
                            number(640)
                            play()
                        )
                        (trunkLid:setCel(1))
                        (send global2:setScript(wakeUpChuckSpear 0 56))
                        (self:dispose())
                    )
                )(else
                    (if (not local7)
                        = local7 1
                        (send gLongSong2:
                            number(311)
                            setLoop(1)
                            play()
                        )
                        (send gQg3Messager:say(7 75 74))
                    )(else
                        (send gQg3Messager:say(7 75 53))
                        (trunkLid:setCel(1))
                        (send gOwner:get(2))
                        = global410 (+ global410 700)
                        (send ((send gInv:at(0))):amount((+ (send ((send gInv:at(0))):amount) 60)))
                        (send ((send gInv:at(0))):message(10))
                    )
                )
            )
            (case 1
                proc0_3()
                (send gOwner:normalize())
                (self:dispose())
            )
        )
    )

)
(instance castOpenOnCrack of Script
    (properties)

    (method (changeState newState)
        (var temp0)
        (switch (= state newState)
            (case 0
                proc0_2()
                proc0_14(220 78)
                = temp0 (send gOwner:castSpell(19))
                (if (== temp0 1)
                    (send gQg3Messager:say(9 6 35))
                    (self:setScript(ScriptID(13 0) self))
                )(else
                    (if (== temp0 -1)
                        (self:setScript(ScriptID(13 0) self))
                    )
                )
            )
            (case 1
                (if (== temp0 0)
                    proc0_3()
                    (send gOwner:normalize())
                    (self:dispose())
                )
                (crack:dispose())
                (hole:
                    init()
                    stopUpd()
                )
                proc0_3()
                (send gOwner:normalize())
                (self:dispose())
            )
        )
    )

)
(instance enterFirstTime of Script
    (properties)

    (method (doit)
        (if ((send gOwner:script))
            0
        )(else
            (super:doit())
        )
    )


    (method (changeState newState)
        (switch (= state newState)
            (case 0
                0
                proc0_2()
                = cycles 3
            )
            (case 1
                1
                (send gQg3Messager:say(1 6 1))
                = cycles 1
            )
            (case 2
                2
                (send (ScriptID(35 1)):
                    cycleSpeed(10)
                    setCycle(Beg self)
                )
            )
            (case 3
                3
                (send (ScriptID(35 1)):setCycle(End self))
            )
            (case 4
                4
                (send (ScriptID(35 1)):stopUpd())
                (laibonArm:
                    cycleSpeed(8)
                    setCycle(End self)
                )
            )
            (case 5
                (send gQg3Messager:say())
            )
            (case 6
                6
                proc0_13()
                (send gMainIconBar:curIcon((send gMainIconBar:at(4))))
                (send gGame:setCursor((send ((send gMainIconBar:curIcon)):cursor)))
                = ticks 600
            )
            (case 7
                7
                (send gQg3Messager:say(2 6 2 0 self))
            )
            (case 8
                8
                (send gQg3Messager:say(4 6 3 0 self))
            )
            (case 9
                9
                = ticks 960
            )
            (case 10
                10
                (send gOwner:cycleSpeed(6))
                proc0_2()
                (laibonArm:setCycle(End self))
            )
            (case 11
                11
                (send gQg3Messager:say(2 6 4))
                (laibonArm:setCycle(Beg self))
            )
            (case 12
                12
                proc0_4(49)
                (send gGQg3KDHandler:eachElementDo(111))
                (send global2:drawPic(0 9))
                = cycles 2
            )
            (case 13
                13
                (send gQg3Messager:say(9 6 71 0 self))
            )
            (case 14
                14
                (send global2:newRoom(440))
            )
        )
    )

)
(instance laibonPissed of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (if ((send global2:script))
                    (send ((send global2:script)):dispose())
                )
                (laibonArm:hide())
                (send (ScriptID(42 1)):
                    view(451)
                    loop(2)
                    cel(0)
                    setCycle(End self)
                )
            )
            (case 1
                (send gOwner:
                    solvePuzzle(276 -5)
                    normalize()
                    setMotion(PolyPath 290 190 self)
                )
            )
            (case 2
                proc0_2()
                (send global2:newRoom(420))
            )
        )
    )

)
(instance wakeUpChuckSpear of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                = cycles 10
            )
            (case 1
                proc0_2()
                (send gOwner:
                    code(0)
                    changeGait(1)
                    setMotion(PolyPath 143 123 self)
                )
                (send (ScriptID(42 1)):
                    view(453)
                    loop(1)
                    cycleSpeed(10)
                    setCycle(End)
                )
            )
            (case 2
                (send gOwner:setMotion(PolyPath 120 124 self))
            )
            (case 3
                (send gLongSong2:
                    number(916)
                    setLoop(1)
                    play()
                )
                (send (ScriptID(42 1)):
                    view(453)
                    loop(2)
                    cel(0)
                    cycleSpeed(3)
                    setCycle(CT 4 1 self)
                )
            )
            (case 4
                (send (ScriptID(42 1)):setCel(5))
                (spear:
                    setStep(22 2)
                    setMotion(MoveTo 120 81 self)
                    init()
                )
            )
            (case 5
                (spear:dispose())
                (send gLongSong2:
                    number(920)
                    setLoop(1)
                    play(self)
                )
            )
            (case 6
                (send gLongSong2:
                    number(912)
                    play()
                )
                (send gOwner:
                    view(43)
                    loop(1)
                    setCycle(End self)
                )
            )
            (case 7
                proc26_0(register 0 455 End)
            )
        )
    )

)
(instance enterNormal of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send (ScriptID(42 1)):
                    setCycle(Snooze self 1 10 200)
                    noun(4)
                    init()
                )
                (send gOwner:
                    x(234)
                    y(172)
                    setScale()
                    init()
                    setMotion(PolyPath 143 124 self)
                )
            )
            (case 1
                (send gOwner:
                    setHeading(315)
                    normalize(7)
                )
                proc0_3()
                (if (== local11 7)
                    (send gOwner:code(sneakCheck))
                )
                (self:dispose())
            )
        )
    )

)
(instance checkOutChest of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:setMotion(PolyPath 232 140 self))
            )
            (case 1
                (if (== local7 0)
                    (send gQg3Messager:say(7 4 52))
                    proc0_3()
                    (self:dispose())
                )
                = cycles 1
            )
            (case 2
                (if (== local5 0)
                    (send gQg3Messager:say(7 4 54))
                    ++local6
                    (sFx:
                        number(640)
                        play()
                    )
                    (if (== local6 2)
                        (trunkLid:setCel(1))
                        (send global2:setScript(wakeUpChuckSpear 0 56))
                    )
                    proc0_3()
                    (self:dispose())
                )
                = cycles 1
            )
            (case 3
                (trunkLid:setCel(1))
                = cycles 6
            )
            (case 4
                (send gQg3Messager:say(7 4 53 0 self))
            )
            (case 5
                (send gOwner:get(2))
                = global410 (+ global410 700)
                (send ((send gInv:at(0))):amount((+ (send ((send gInv:at(0))):amount) 60)))
                (send ((send gInv:at(0))):message(10))
                proc0_3()
                (self:dispose())
            )
        )
    )

)
(instance hoarkDrum of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:setMotion(PolyPath 114 122 self))
            )
            (case 1
                (send gQg3Messager:say(5 4 0 0 self))
            )
            (case 2
                (if (<= (send gOwner:trySkill(8 125)) 0)
                    (send global2:setScript(wakeUpChuckSpear 0 34))
                )(else
                    (if (proc0_6(50))
                        proc0_4(74)
                    )
                    (send gOwner:get(46))
                    proc0_4(163)
                    (drum:dispose())
                    = global470 global122
                    (send gOwner:solvePuzzle(275 8 4))
                    proc0_3()
                    (self:dispose())
                )
            )
        )
    )

)
(instance egoGivesHorn of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                proc0_2()
                (send gOwner:setMotion(PolyPath 89 132 self))
            )
            (case 1
                (laibonArm:hide())
                (send (ScriptID(42 1)):
                    loop(2)
                    setCycle(End)
                )
                = seconds 3
            )
            (case 2
                (send (ScriptID(42 1)):setCycle(Beg self))
            )
            (case 3
                (send gOwner:drop(22 1))
                proc0_4(11)
                (send gOwner:solvePuzzle(271 3 9))
                (send (ScriptID(42 1)):loop(0))
                (laibonArm:
                    show()
                    setCycle(Snooze self 1 20 290)
                )
                = cycles 1
            )
            (case 4
                (send gQg3Messager:say(4 6 27 0 self))
            )
            (case 5
                (send gQg3Messager:say(4 6 28 0 self))
            )
            (case 6
                (send gOwner:setMotion(PolyPath 290 220 self))
            )
            (case 7
                (send gGQg3KDHandler:eachElementDo(111))
                (send global2:drawPic(0 9))
                = cycles 3
            )
            (case 8
                (send (ScriptID(7 4)):init(6 0))
                = gGOwnerMaxStamina[18] (send gOwner:maxMana())
                = gGOwnerMaxStamina[17] (send gOwner:maxStamina())
                = gGOwnerMaxStamina[16] (send gOwner:maxHealth())
                (send gQg3Messager:say(9 6 27 0 self))
            )
            (case 9
                (send global2:newRoom(420))
            )
        )
    )

)
(instance getDrum of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gQg3Messager:say(3 5 register 0 self))
            )
            (case 1
                (if (not (send gOwner:has(46)))
                    (send gOwner:get(46))
                    proc0_4(163)
                )
                (send global2:newRoom(420))
            )
        )
    )

)
(instance bridePrice of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gQg3Messager:say(4 5 40 0 self))
            )
            (case 1
                (if ((== global362 0) and not proc0_6(16))
                    (send gQg3Messager:say(4 6 41 0 self))
                )(else
                    = cycles 1
                )
            )
            (case 2
                (self:dispose())
            )
        )
    )

)
(instance moveEgoBack of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 0
                (send gOwner:setMotion(PolyPath (- (send gOwner:x) 10) (- (send gOwner:y) 20) self))
            )
            (case 1
                (self:dispose())
            )
        )
    )

)
(instance spear of Actor
    (properties
        x 163
        y 81
        view 453
        loop 3
        signal $0800
    )
)
(instance native of Prop
    (properties
        x 250
        y 140
        view 970
        loop 4
        cel 3
        signal $4000
    )
)
(instance fire of Prop
    (properties
        x 148
        y 140
        noun 11
        view 423
        cel 12
        signal $4000
    )
)
(instance hole of View
    (properties
        x 200
        y 64
        noun 12
        view 450
        signal $4000
    )

    (method (doVerb theVerb)
        (if (== theVerb 4)
            (send global2:setScript(exitThief))
        )(else
            (super:doVerb(theVerb))
        )
    )

)
(instance drum of View
    (properties
        x 105
        y 74
        noun 5
        view 450
        cel 1
        signal $4000
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 4
                (if (== local11 7)
                    (send global2:setScript(hoarkDrum))
                )(else
                    (send gQg3Messager:say(4 6 12))
                    (send (ScriptID(42 1)):setScript(laibonPissed))
                )
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )

)
(instance trunkLid of Prop
    (properties
        x 277
        y 126
        noun 7
        view 450
        loop 1
        signal $4000
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 4
                (if (<> local11 7)
                    (send gQg3Messager:say(7 4 73))
                )(else
                    (if (not == cel 1)
                        (send global2:setScript(checkOutChest))
                    )
                )
            )
            (case -75
                (if (<> local11 7)
                    (send gQg3Messager:say(9 6 73))
                )(else
                    (if (not == cel 1)
                        (send global2:setScript(castOpenOnChest))
                    )
                )
            )
            (case 17
                (if ((> (send gOwner:trySkill(9 75)) 0) and (== local7 0))
                    (send global2:setScript(pickLock))
                )(else
                    (send gQg3Messager:say(9 6 74))
                )
            )
            (case 35
                (send global2:setScript(egoOilsChest))
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )

)
(instance laibonArm of Prop
    (properties
        x 59
        y 77
        view 451
        loop 1
        priority 7
        signal $0010
    )
)
(instance crack of Feature
    (properties
        x 216
        y 85
        noun 8
        nsTop 68
        nsLeft 206
        nsBottom 103
        nsRight 227
        sightAngle 40
    )

    (method (doVerb theVerb)
        (switch (theVerb)
            (case 1
                (if (not (send gGQg3KDHandler:contains(hole)))
                    (send global2:doVerb(theVerb))
                )(else
                    (super:doVerb(theVerb))
                )
            )
            (case 75
                (send global2:setScript(castOpenOnCrack))
            )
            (case 4
                (if (global121)
                    (hole:
                        init()
                        stopUpd()
                    )
                )
            )
            (default 
                (super:doVerb(theVerb))
            )
        )
    )

)
(instance leopardhide of Feature
    (properties
        x 226
        y 54
        noun 13
        nsTop 35
        nsLeft 193
        nsBottom 73
        nsRight 259
        sightAngle 180
    )
)
(instance shields of Feature
    (properties
        x 146
        y 66
        noun 14
        nsTop 33
        nsLeft 124
        nsBottom 99
        nsRight 169
        sightAngle 180
    )
)
(instance laibonTell of Teller
    (properties)

    (method (showDialog)
        (super:showDialog(-20 
            (if (> local11 0)
                (> local8 0)
            )(else
                0
            )
 -59 (== local11 8) -58 (== local11 8) -12 
            (if ((< 0 local11) and (< local11 4))
                (== local8 0)
            )(else
                0
            )
 -9 (< local11 4) -39 
            (if (< 3 local11)
                (< local11 6)
            )(else
                0
            )
 -47 (== global392 2) -49 (== global392 2) -40 
            (if (< 3 local11)
                (< local11 6)
            )(else
                0
            )
 -25 (== local11 3) -26 
            (if (< 3 local11)
                (< local11 6)
            )(else
                0
            )
 -42 
            (if (((== global362 0) and (< 3 local11)) and (< local11 6))
                not proc0_6(16)
            )(else
                0
            )
 -7 (<= local11 1) -3 (< local11 4) -38 
            (if (< 3 local11)
                (< local11 6)
            )(else
                0
            )
 -48 (== global392 4) -65 proc0_6(74) -8 (< local11 3)))
    )


    (method (doChild)
        = local0 1
        return 
            (switch (query)
                (case -20
                    (if (== local3 255)
                        (send gQg3Messager:say(4 6 37))
                        (send global2:setScript(egoExits))
                        return 0
                    )(else
                        (send (ScriptID(42 1)):setScript(laibonPissed))
                    )
                )
                (case -13
                    ++local2
                    = local3 (| local3 $0020)
                    return 1
                )
                (case -12
                    ++local2
                    = local3 (| local3 $0002)
                    ++local8
                    (send gOwner:solvePuzzle(269 2))
                    (super:doChild(query))
                )
                (case -9
                    ++local2
                    = local3 (| local3 $0010)
                    return 1
                )
                (case -39
                    ++local2
                    return 1
                )
                (case -15
                    ++local2
                    = local3 (| local3 $0080)
                    return 1
                )
                (case -49
                    (if ((== global362 0) and not proc0_6(16))
                        return = query -30
                    )(else
                        (if ((((((== global362 0) and (send gOwner:has(21))) and (send gOwner:has(3))) and (send gOwner:has(40))) and (== global392 2)) and proc0_6(16))
                            (send gOwner:setScript(egoBuysJohari))
                            return 0
                        )(else
                            (if (((((<> global362 0) and (send gOwner:has(21))) and (send gOwner:has(3))) and (send gOwner:has(40))) and (== global392 2))
                                (send gOwner:setScript(egoBuysJohari))
                            )
                        )
                    )
                )
                (case -14
                    ++local2
                    = local3 (| local3 $0040)
                    return 1
                )
                (case -68
                    return query
                    (send global2:newRoom(420))
                )
                (case -40
                    ++local2
                    (send gOwner:setScript(bridePrice))
                    return 0
                )
                (case -26
                    ++local2
                    return 1
                )
                (case -42
                    ++local2
                    return 1
                )
                (case -7
                    = local3 (| local3 $0004)
                    return 1
                )
                (case -3
                    ++local2
                    = local3 (| local3 $0001)
                    (send gOwner:solvePuzzle(270 2))
                    return query
                )
                (case -38
                    ++local2
                    return 1
                )
                (case -8
                    = local3 (| local3 $0008)
                    return 1
                )
                (default 
                    ++local10
                    return query
                )
            )
    )


    (method (doVerb theVerb)
        return 
            (switch (theVerb)
                (case 32
                    (if (== local11 5)
                        (send global2:setScript(egoGivesHorn))
                    )(else
                        (send gQg3Messager:say(9 6 75))
                    )
                    return 1
                )
                (case 31
                    (if ((((== global392 2) and (send gOwner:has(3))) and (send gOwner:has(40))) and (<> global362 0))
                        (send global2:setScript(egoBuysJohari))
                    )(else
                        (if (((((== global392 2) and (send gOwner:has(3))) and (send gOwner:has(40))) and proc0_6(16)) and (== global362 0))
                            (send global2:setScript(egoBuysJohari))
                        )(else
                            (if (((((== global392 2) and (send gOwner:has(3))) and (send gOwner:has(40))) and not proc0_6(16)) and (== global362 0))
                                (send gQg3Messager:say(4 6 30))
                            )(else
                                (send gQg3Messager:say(4 6 77))
                            )
                        )
                    )
                    return 1
                )
                (case 51
                    (if ((((== global392 2) and (send gOwner:has(3))) and (send gOwner:has(21))) and (<> global362 0))
                        (send global2:setScript(egoBuysJohari))
                    )(else
                        (if (((((== global392 2) and (send gOwner:has(3))) and (send gOwner:has(21))) and proc0_6(16)) and (== global362 0))
                            (send global2:setScript(egoBuysJohari))
                        )(else
                            (if (((((== global392 2) and (send gOwner:has(3))) and (send gOwner:has(21))) and not proc0_6(16)) and (== global362 0))
                                (send gQg3Messager:say(4 6 30))
                            )(else
                                (send gQg3Messager:say(4 6 77))
                            )
                        )
                    )
                    return 1
                )
                (case 13
                    (if ((((== global392 2) and (send gOwner:has(40))) and (send gOwner:has(21))) and (<> global362 0))
                        (send global2:setScript(egoBuysJohari))
                    )(else
                        (if (((((== global392 2) and (send gOwner:has(40))) and (send gOwner:has(21))) and proc0_6(16)) and (== global362 0))
                            (send global2:setScript(egoBuysJohari))
                        )(else
                            (if (((((== global392 2) and (send gOwner:has(40))) and (send gOwner:has(21))) and not proc0_6(16)) and (== global362 0))
                                (send gQg3Messager:say(4 6 30))
                            )(else
                                (send gQg3Messager:say(4 6 77))
                            )
                        )
                    )
                    return 1
                )
                (case 4
                    (if (global121)
                        (send global2:setScript(wakeUpChuckSpear 0 55))
                    )(else
                        (super:doVerb(theVerb))
                    )
                )
                (default 
                    (super:doVerb(theVerb))
                )
            )
    )

)
(instance egoTell of Teller
    (properties)

    (method (showDialog)
        (super:showDialog(-45 (== local11 5) -1 
            (if (not not local12 or (== local11 0))
            )(else
                (== local11 5)
            )
 -18 
            (if ((not not local12 or not not local9) or ((< 0 local11) and (< local11 5)))
            )(else
                (== local11 6)
            )
 -19 
            (if (not local12)
                local9
            )(else
                0
            )
 -11 (< local11 3) -5 (< local11 3) -10 (== local11 0) -22 
            (if (< 0 local11)
                (< local11 3)
            )(else
                0
            )
 -44 
            (if (< 2 local11)
                (< local11 5)
            )(else
                0
            )
 -67 
            (if (== local11 8)
                global406
            )(else
                0
            )
 -68 
            (if (== local11 8)
                global406
            )(else
                0
            )
 -66 
            (if ((== local11 8) and global406)
            )(else
                proc0_6(30)
            )
 26 (== local11 4)))
    )


    (method (doChild)
        = local0 1
        return 
            (switch (query)
                (case -45
                    (send global2:setScript(0))
                    (send global2:setScript(egoGivesHorn))
                    return query
                )
                (case -10
                    (send gOwner:addHonor(-10))
                    return 1
                )
                (case -22
                    (send gOwner:addHonor(2))
                    (send global2:setScript(egoExits))
                    return 1
                )
                (case -44
                    (if (== local11 4)
                        = local2 4
                    )(else
                        = local2 5
                    )
                    (send gOwner:addHonor(2))
                    (send gQg3Messager:say(3 5 44))
                    (send gOwner:setScript(egoExits))
                    return 0
                )
                (case -1
                    (send gOwner:setScript(egoBows 0 query))
                    = local12 0
                    ++local10
                    return 0
                )
                (case -18
                    (send gOwner:setScript(egoBows 0 query))
                    = local12 0
                    ++local10
                    return 0
                )
                (case -19
                    (send gOwner:setScript(egoBows 0 query))
                    = local12 0
                    ++local10
                    return 0
                )
                (case -11
                    ++local10
                )
                (case -5
                    (send gOwner:addHonor(20))
                    ++local10
                )
                (case -67
                    (send gOwner:setScript(getDrum 0 (- 0 query)))
                    return 0
                )
                (case -68
                    (send gOwner:setScript(getDrum 0 (- 0 query)))
                    return 0
                )
                (default 
                    ++local10
                    return query
                )
            )
    )

)
(instance rakeeshTell of Teller
    (properties)
)
(instance uhuraTell of Teller
    (properties)
)
(instance yesufuTell of Teller
    (properties)
)
(instance sFx of Sound
    (properties)
)
(instance Snooze of OccasionalCycle
    (properties)

    (method (cycleDone)
        = cycleDir (- 0 cycleDir)
        = waitCycles Random(lowerEnd upperEnd)
        = cycleCnt GetTime()
    )

)
(instance sneakCheck of Code
    (properties)

    (method (doit)
        (if (<> (send gOwner:view) 2)
            (send global2:setScript(wakeUpChuckSpear 0 36))
            (send gOwner:code(0))
        )
        (if ((send gOwner:inRect(0 175 320 190)))
            (if (not (send gOwner:script) and local4)
                proc26_0(76)
            )(else
                (if (not (send gOwner:script))
                    (send gQg3Messager:say(9 6 33))
                    = local4 1
                    (send gOwner:setScript(moveEgoBack))
                )
            )
        )
    )

)
(instance outCheck of Code
    (properties)

    (method (doit)
        (if ((send gOwner:inRect(200 175 250 190)))
            (send global2:newRoom(420))
        )
    )

)
