Paste #13899: Daily Quest - Fishing

Date: 2015/02/16 09:05:27 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


OFAssign:
    type: assignment
    interact scipts:
    - 10 DailyOFQuest

DailyOFQuest:
    type: interact
    steps:
        start*:
            click trigger:
                script:
                - chat "Greetings young'n"
                - wait 2
                - chat "I've been fishing these seas for many a year now and I see a familar glint in your eyes that tells me you're a keen fisherperson"
                - wait 1
                - narrate "<white>You can say, <green>Yes<white> or <green>No<white>."
            chat trigger:
                1:
                    trigger: /Yes/, we are kindred of the same reel old timer.
                    script:
                    - chat "This warms my salty heart!"
                    - wait 1
                    - chat "I'm not as young as I used to be, so I'll need help around here once a day if you've time to spare"
                    - wait 1
                    - chat "You'll be compensated of course"
                    - narrate "the old man cracks a smile"
                    - ^zap step:return
                    - ^flag server OFMembers:->:<player>

                2:
                    trigger: /No/, I'm more of a landlubber sir
                    script:
                    - chat "Aye, not everyone can handle the rod..."

        return:
            click trigger:
                script:
                - random {
                - chat "Aye?"
                - chat "Greetings <player.name>, come to help?"
                - chat "Want to earn those sea legs?"
                }
                - wait 3
                - chat "ready to earn your keep?"

            chat trigger:
                1:

                    trigger: /Yes/, I am.
                    script:
                    - chat "Great to hear!"
                    - wait 1
                    - "I need you to collect 20 Fish for me"
                    - wait 1
                    - chat "Return once they are collected."
                    - zap step:waiting

                2:

                    trigger: /No/, I am not.
                    script:
                    - chat "Please return when you are..."

        waiting:
            click trigger:
                script:
                - chat "How's the haul been so far?"
                - wait 1
                - chat "I'll be waiting"

        reward:
            click trigger:
                script:
                - chat "Good haul <player.name>, there are some sizely fish in here"
                - wait 2
                - chat "Here is your reward for helping the town"
                - ^narrate "<red>You recieved <gold>100$<red> from <npc.name>!"
                - ^give miney qty:100
                - ^flag player OFCooldown duration:20h
                - ^zap step:cooldown

        cooldown:
            click trigger:
                script:
                - chat "Come back tomorrow."
                - wait 2
                - narrate "nods"

OFCheck:
    type: interact
    script:
    - flag player OFCount:+:1
    - narrate: "**<player.flag[OFCount].asint>/20 Fish.**"
    - if <player.inventory.contains[Fish].qty[20]> run OFReward
      else run OFContinue

OFContinue:
    type: interact
    script:
    - ^listen item type:item target:Fish qty:1 script:OFCheck

OFReward:
    type: interact
    script: 
    - narrate "Return to the old man to claim your reward"
    - zap script:DailyOFQuest step:reward

OFWorld:
    type: world
    events:
        on time changes in w@world:
        - if <server.flag[OFMembers]> == "null" queue clear
        - foreach <server.flag[OFMembers].as_list> {
          - if !<%value%.as_player.flag[OFCooldown]> && <s@DailyOFQuest.step[%value%]> != "return" {
            - zap script:DailyOFQuest step:return player:%value%
            - if <%value%.as_player.is_online>  {
              - narrate player:%value% "The tide seems high"
              - narrate player:%value% "I should go see the old man"
              }
            }
          }