Paste #3867: Untitled Paste

Date: 2014/04/30 00:09:44 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


Blacksmith:
  type: assignment

  default constants:
    durability_multiplier: 5
    enchantment_multiplier: 500

  interact scripts:
  - 10 BlacksmithInteract

  actions:
    on assignment:
    - trigger name:chat toggle:true
    - trigger name:click toggle:true
    - trigger name:proximity toggle:true radius:2

    on enter proximity:
    - chat '<white>Hello<&cm> <player.name>. What can I do for you?'
    - narrate '<white> - I<&sq>d like an item <gold>repaired<white>.'
    - if <player.flag[job]> != 'blacksmith' {
        - narrate '<white> - I<&sq>d like to become a <gold>smith<white>.'
      }

    on exit proximity:
    - zap s@BlacksmithInteract step:default

BlacksmithInteract:
  type: interact
  steps:
    default:
      chat trigger:
        Repair:
          trigger: 'I<&sq>d like the have this /repair/ed.'
          script:
            - chat '<white>Hmmm<&cm> let<&sq>s see...'
            - wait 1s
            - if <player.item_in_hand.repairable> == true {
                - inject s@CalcCost instantly
              } else {
                - chat '<white>Sorry<&cm> but I<&sq>m afraid I can<&sq>t repair that.'
              }

            - if <player.flag[repair_cost]> > 0 {
                - chat '<white>Yeah<&cm> I can fix that. It<&sq>ll cost <gold><player.flag[repair_cost]> <white>coins to repair<&cm> though.'
                - narrate '<gold>Yes <white>or <gold>No'
                - zap repair
              } else {
                - chat '<white>Your item looks fine to me!'
              }

        Job:
          trigger: 'I<&sq>d like to become a /smith/.'
          script:
            - chat '<white>Great<&cm> we always need more smiths<white>. Would you like to join our brotherhood?'
            - narrate '<gold>Yes <white>or <gold>No'
            - zap job

    job:
      chat trigger:
        Yes:
          trigger: '/Yes/<&cm> I would.'
          script:
            - chat '<white>Great!'
            - narrate <player.flag[job]>
            - jobs join blacksmith
            - flag player job:'blacksmith'
            - chat '<white>Welcome to the brotherhood!'

        No:
          trigger: '/No/<&cm> sorry.'
          script:
            - chat '<white>Oh well. I<&sq>m sure you<&sq>ll find something that fits.'

    repair:
      chat trigger:
        Yes:
          trigger: '/Yes/<&cm> repair it.'
          script:
            - narrate '<player.money>'
            - narrate '<player.flag[repair_cost]>'
            - if <player.money> > <player.flag[repair_cost]> {
                - adjust <player.item_in_hand> durability:0 save:newitem
                - take iteminhand
                - playsound <player.location> sound:anvil_use
                - wait 3s
                - playsound <player.location> sound:anvil_use
                - wait 3s
                - playsound <player.location> sound:anvil_use
                - wait 3s
                - take money qty:<player.flag[repair_cost]>
                - give <entry[newitem].result>
                - chat '<white>Here you go! Come back if you need any more repairs.'
                - zap default
              } else {
                - chat '<white>Hey<&cm> you don<&sq>t have enough money! Come back when you can afford it...'
                - zap default
              }

        No:
          trigger: '/No/<&cm> I don<&sq>t want to repair it.'
          script:
            - chat '<white>Well... alright. Come back if you change your mind.'