Paste #15202: Mining Diamonds

Date: 2015/04/24 13:48:34 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


"miner":
  type: assignment

  default constants:

    diamondQty: 25
    miningRewardQty: 2000
    diamondCheatRewardQty: 500
    mining Quest Repeat Timeout: 24h

  interact scripts:
  - 10 mine diamond

  actions:
    on assignment:

    - trigger name:chat toggle:true
    - trigger name:click toggle:true
    - trigger name:proximity toggle:true

    - equip i@IRON_AXE

"mine diamond":
  type: interact

  steps:
    1:
      proximity trigger:
        entry:
          script:
          - ^run "miner Greeting Requirements"

      click trigger:
        script:
        - ^run "miner Quest Requirement Check"

    2:
      chat trigger:
        'Start Questline':
          Trigger: /Yes/, let us start our hunt for diamonds!
          script:

          - flag <player> mining:Started
          - ^listen block "id:mining Listener" type:break block:DIAMOND_ORE qty:<npc.constant[diamondQty]> "script:mining Completion Reminder"
          - chat "<yellow>Alright <white><player.name><yellow>! Bring me <red><npc.constant[diamondQty]><yellow> diamonds!"
          - narrate "<red> mining - Quest Started"
          - ^zap step:1
        'Deny Questline':
          Trigger: /No/, I have to go... sheer a 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." }
          - ^zap step:1

        'What Did You Say':
          trigger: /REGEX:\w+/
          script:
          - chat "<white><player.name><yellow>, I don<&sq>t what <&sq><white><context.message><yellow><&sq> means."
          - ^narrate "<red>Say<&co>"
          - ^narrate "  <blue>Yes<blue> <gray>or<red> No"

      proximity trigger:
        exit:
          script:
          - ^zap step:1

      click trigger:
        script:
        - ^run "miner Quest Requirement Check"

"miner Greeting Requirements":
  type: task
  speed: 0

  script:

  - if <player.flag[mining]> == Started chat "<yellow>Diamonds comin easy for ya?"
    else if <player.flag[mining]> == Claimed chat "<yellow>See you again soon <yellow><player.name><yellow>."

    else {
      - random {
        - chat "<yellow>Whatcha been up to?"
        - chat "<yellow>I should really quit this job."
        - chat "<yellow>Who would actually want to do this all day?"
        - chat "<yellow>Dinner? we just started!"
        - chat "<yellow>You really don't know me to well."
        - chat "<yellow>Whistle while you work? No, don't do that."
        - chat "<yellow>...Well, this is gettin old."
        }
    }

"miner Quest Requirement Check":
  type: task

  script:
  - ^if <player.flag[diamondQuestCounter]||0> >= <npc.constant[diamondQty]> && <player.flag[mining]> == Started run "mining Reward"
    else if <player.flag[mining]> == Started && <player.inventory.contains[diamond]> run "diamond Counter"
    else if <player.flag[mining]> == Started chat "<yellow>You<&sq>ve mined me <white><player.flag[diamondQuestCounter].asint || no><yellow> diamond ores so far, I asked for <white><player.flag[diamondCountLeft].asint || <npc.constant[diamondQty]>><yellow> more."
    else if <player.flag[mining]> == Claimed chat "<yellow>That's good <white><player.name><yellow>, Come back in <red><player.flag[mining].expiration.formatted><yellow> to do this quest again."
    else run "Present mining Quest"

"Present mining Quest":
  type: task

  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.constant[miningRewardQty]><yellow> <player.money.currency> if you can get <gray><npc.constant[diamondQty]><yellow>diamonds back to me."
    - ^chat "<yellow>Money? you can get <gold>$<npc.constant[miningRewardQty]><yellow> <player.money.currency> for mining <gray><npc.constant[diamondQty]><yellow> diamonds."
    - ^chat "<yellow>I need them diamonds, if you get <gray><npc.constant[diamondQty]><yellow> diamonds, I'll give <gold>$<npc.constant[miningRewardQty]><yellow> <player.money.currency>." }
  - ^narrate "<red>Say<&co>"
  - ^narrate "  <blue>Yes<blue> <gray>or<red> No"
  - ^zap step:2 "s@mine diamond"

"mining Completion Reminder":
  type: task
  speed: 0

  script:
  - ^narrate "<red>You should have finished the <white>mining<red> Quest. Head back to <white><npc.name><red> for your reward."
  - ^flag <player> Playerminedalldiamonds

"diamond Counter":
  type: task

  script:

  - ^flag <player> diamondTempCount:<player.inventory.qty[diamond]>

  - ^if <player.flag[diamondCountLeft]||0> == 0 flag <player> diamondCountLeft:<npc.constant[diamondQty]>

  - ^if <player.inventory.qty[diamond]> >= <player.flag[diamondCountLeft]> take i@diamond qty:<player.flag[diamondCountLeft]>
    else take i@DIAMOND qty:<player.flag[diamondTempCount]>

  - ^flag <player> diamondCountLeft:-:<player.flag[diamondTempCount]>

  - ^flag <player> diamondQuestCounter:+:<player.flag[diamondTempCount]>

  - ^flag <player> diamondTempCount:!

  - ^if <player.flag[diamondQuestCounter]> < <npc.constant[diamondQty]> narrate "<red>You got <white><npc.name><red> a total of <gold><player.flag[diamondQuestCounter].asint><red> Diamonds, with <gold><player.flag[diamondCountLeft].asint><red> remaining."
    else run "miner Quest Requirement Check"

"mining Reward":
  type: task

  script:
  - ^flag <player> mining:Claimed "duration:<npc.constant[mining Quest Repeat Timeout]>"
  - ^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." }
  - ^if <player.flag[Playerminedalldiamonds]> give money qty:<npc.constant[miningRewardQty]>
    else give money qty:<npc.constant[diamondCheatRewardQty]>
  - ^if <player.flag[Playerminedalldiamonds]> mcmmo add levels skill:woodmining qty:5
  - ^if <player.flag[Playerminedalldiamonds]> narrate "<red>You are rewarded 2 tokens, 5 levels of woodmining and <gold><npc.constant[miningRewardQty]><red> <player.money.currency> getting <white><npc.name><red> diamonds you mined yourself."
    else narrate "<red>You are only rewarded <gold><npc.constant[diamondCheatRewardQty]><red> <player.money.currency> getting <white><npc.name><red> old already mined diamonds."
  - ^run "Reset mining Flags"
  - wait 2
  - narrate "<red> Mining - Quest Completed"

"Reset mining Flags":
  type: task

  script:
  - ^flag <player> Playerminedalldiamonds:!
  - ^flag <player> diamondQuestCounter:!
  - ^flag <player> diamondTempCount:!
  - ^flag <player> diamondCountLeft:!
  - ^listen cancel "id:mining Listener"