(include "sci.sh")
(use "Main")
(use "Class_255_0")
(use "Cycle")
(use "Game")
(use "Obj")
(script 512)


(local
    local0
    gEgoViewer

)
(instance public riverReg of Rgn
    (properties)

    (method (init)
        (super:init())
        (self:setScript(riverActions))
        Load(rsVIEW 21)
    )


    (method (dispose)
        (send (ScriptID(0 4)):
            dispose()
            delete()
        )
        (super:dispose())
    )


    (method (handleEvent pEvent)
        (super:handleEvent(pEvent))
        (if ((send pEvent:claimed()))
            return 1
        )
        return 
            (if (== (send pEvent:type()) 128)
                (if (Said('look<in/brook'))
                    (if ((((& (= local0 proc0_2(gEgo 20)) $0008) or (& local0 $0800)) or (& local0 $0002)) or (& local0 $0200))
                        Print(512 0)
                    )(else
                        proc0_15()
                    )
                )(else
                    (if (Said('look/brook') or Said('look/water'))
                        Print(512 1)
                    )(else
                        (if ((Said('bathe/brook') or Said('bathe')) or Said('enter/bathe'))
                            Print(512 2)
                        )(else
                            (if (((Said('fish[/!*]') or Said('fish<enter')) or Said('look,capture/fish')) or Said('cast/pole'))
                                Print(512 3)
                            )(else
                                (if (Said('wade/brook'))
                                    (if (== global105 0)
                                        Print(512 4)
                                    )(else
                                        Print(512 5)
                                    )
                                )(else
                                    (if (Said('drink') or Said('get/drink'))
                                        (if (<> global105 0)
                                            Print(512 6)
                                        )(else
                                            (if ((((& (= local0 proc0_2(gEgo 10)) $0008) or (& local0 $0800)) or (& local0 $0002)) or (& local0 $0200))
                                                = global120 Print(512 7 134 -1 20 172)
                                                (riverActions:changeState(1))
                                            )(else
                                                proc0_15()
                                            )
                                        )
                                    )(else
                                        (if (Said('get/water'))
                                            Print(512 8)
                                        )
                                    )
                                )
                            )
                        )
                    )
                )
            )(else
                0
            )
    )

)
(instance riverActions of Script
    (properties)

    (method (changeState newState)
        (switch (= state newState)
            (case 1
                (proc0_10() = gEgoViewer (send gEgo:viewer()) (send gEgo:
                    viewer(0)
                    view(21)
                    cel(0)
                    setCycle(End self)
                )
  )
            )
            (case 2
                ((send (ScriptID(0 4)):setReal(self 6))  )
            )
            (case 3
                ((send gEgo:setCycle(Beg self))  )
            )
            (case 4
                ((send gEgo:
                    view(2)
                    setCycle(Walk)
                    viewer(gEgoViewer)
                )
 proc0_23() proc0_11() )
            )
        )
    )

)
