Paste #15449: Edit of P#15368 - miner

Date: 2015/05/02 20:54:35 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


miner:
  type: assignment
  interact scripts:
  - 10 minediamonds
  actions:
    on assignment:
    - trigger name:chat toggle:true
    - trigger name:click toggle:true
    - trigger name:proximity toggle:true
    - equip i@IRON_AXE

minediamonds:
  type: interact
  steps:
    1:
      proximity trigger:
      - chat "<aqua>Shouldn<&sq>t you be somewhere?"

      click trigger:
        script:
        - ^random {
          - chat "<yellow>Hey <white><player.name><yellow> you should learn how to find diamonds. You up for a quest?"
          - chat "<yellow>Aye, <white><player.name><yellow>, diamonds are out there, you should farm me some. Are you up for it?"
          - chat "<yellow>You know when you've gotten tired. Finish mining for me and I'll reward ya, what do ya say?"
          - chat "<yellow>You going mining? bring me some diamonds back would ya?"
          - chat "<yellow>How are ya? Get me diamonds so I can pay to get food would ya?"
          }
        - ^random {
          - chat "<yellow>Why I'll give ya <gold>$<npc.flag[miningRewardQty]><yellow> <player.money.currency> if you can get <gray><npc.flag[diamondQty]><yellow> back to me."
          - chat "<yellow>Money? you can get <gold>$<npc.flag[miningRewardQty]><yellow> <player.money.currency> for mining <gray><npc.flag[diamondQty]><yellow> diamonds."
          - chat "<yellow>I need them diamonds, if you get <gray><npc.flag[diamondQty]><yellow> diamonds, I'll give <gold>$<npc.flag[miningRewardQty]><yellow> <player.money.currency>."
          }
        - ^narrate "<red>Say<&co>"
        - ^narrate "<blue>Yes<blue> <gray>or<red> No"
      chat trigger:
        Start Questline:
          Trigger: /Yes/, I<&sq>ll go hunt for diamonds!
          script:
          - ^flag <player> MiningForDiamonds
          - ^if <server.flag[advancedmining].as_list> !contains <player> {
            - ^flag server advancedmining:->:<player>
            }
          - chat "<yellow>Alright <white><player.name><yellow>! Bring me <red><npc.flag[diamondQty]><yellow> diamonds!"
          - title stay:3s 'subtitle:<&a>Mining For Diamonds Finished'
          - ^zap step:2
        Deny Questline:
          Trigger: /No/, I have to go... sheer sheep.
          script:
          - random {
            - chat "<yellow>Fine, come back when you're man enough."
            - chat "<yellow>Tired of little girls like ya anyway."
            - chat "<yellow>Go on then, be gone."
            }
          - random {
            - narrate "<white><npc.name><red> raises a diamond to inspect it."
            - narrate "<aqua><npc.name><&sq><red> dusts off shoulder and yawns."
            - narrate "<aqua><npc.name><red> Shakes head and sighs."
            }

          What did you say:
            trigger: /REGEX:\w+/
            script:
            - chat "<white><player.name><yellow>, I don<&sq>t know what <&sq><white><context.message><yellow><&sq> means."
            - ^narrate "<red>Say<&co>"
            - ^narrate "  <blue>Yes<blue> <gray>or<red> No"
    2:
      click trigger:
        script:
        - chat "<aqua>Why are you back already?"
        - wait 1
        - chat "<aqua>You only mined me <player.flag[MiningForDiamonds].as_int> diamonds."
    3:
      click trigger:
        script:
        - ^take i@diamond qty:25
        - ^random {
          - ^chat "<yellow>A real good miner ya are <white><player.name><yellow>. I may have somethin more for ya tomorrow."
          - ^chat "<yellow>Good job, come back tomorrow for another quest."
          - ^chat "<yellow>Alright, I got nothin else for ya. Come back tomorrow."
          }
        - wait 1
        - title stay:3s 'subtitle:<&6>Mining For Diamonds Complete'
        - execute as_server "token add <player.name> 2"
        - give money qty:2000
        - narrate "<aqua>You have received 2 tokens and $2000 for completing this quest."
        - ^flag player minercooldown duration:2m
        - ^flag player MiningForDiamonds:!
        - ^zap step:4
    4:
      click trigger:
        script:
        - chat "<yellow>I have no more quests for you at this time, check with another quest giver."

Quest_MineForDiamonds_World:
  type: world
  events:
    on time changes in world:
    - foreach <server.flag[advancedmining].as_list||li@> {
      - if <def[value].as_player.has_flag[minercooldown]> && <def[value].as_player.has_flag[MiningForDiamonds]> {
        - foreach next
        }
      - if <def[value].as_player.is_online> {
        - narrate "<red>The mining quest at spawn is now available."
        }
      - zap player:<def[value].as_player> step:1 script:minediamonds
      }

    on player breaks diamond_ore:
    - if !<player.has_flag[MiningForDiamonds]> queue clear
    - run locally delay:1t Count


  Count:
    - ^flag player MiningForDiamonds:++
    - ^if <player.flag[MiningForDiamonds].as_int> == 25 {
      - title stay:3s 'subtitle:<&6>Mining For Diamonds Finished'
      - wait 5s
      - title stay:3s 'subtitle:<&6>Return to Spawn to Complete'
      - zap step:3 "script:minediamonds"
      - queue clear
      }
    - ^if <player.flag[MiningForDiamonds].as_int> > 25 {
      - narrate "<red>Mining for Diamonds is completed. Please return to spawn and cash in your diamonds."
      }
    - ^narrate "<red>You mined <player.flag[MiningForDiamonds].as_int>/25 diamonds."



#