Paste #58308: Untitled Paste

Date: 2019/09/15 21:36:54 UTC-07:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


Altar_prayer_start:
  type: world
  events:
    on player right clicks diamond_block in altar:
      - if !<player.has_flag[Religious]>:
        - narrate "Only religious leaders can start prayers."
        - stop
      - if <player.has_flag[Religious]>:
        - if <context.location.cuboids.get[1].list_npcs.size> > 1:
          - narrate "There are too many NPCs in the altar area! Only the cleric is allowed inside during prayer."
          - stop
        - if <context.location.cuboids.get[1].list_npcs.size> < 1:
          - narrate "Your altar is missing a cleric NPC."
          - stop
        - if !<context.location.cuboids.get[1].list_npcs.get[1].has_flag[Cleric]>:
          - narrate "The NPC in the altar area is not a cleric."
          - stop
        - define players <context.location.cuboids.get[1].list_players>
        - define npc <context.location.cuboids.get[1].list_npcs.get[1]>
        - define list li@
        - if <context.location.cuboids.get[1].list_players.size> >= 1:
          - if <def[npc].flag[Worship]> >= 0 && <def[npc].flag[Worship]> < 1000:
            - if <context.location.cuboids.get[1].list_players.size> > 10:
              - narrate "This altar hasn't been used enough to allow more than 10 players to pray at a time!"
              - stop
          - if <def[npc].flag[Worship]> >= 1000 && <context.location.cuboids.get[1].list_players.size> > 15:
            - if <context.location.cuboids.get[1].list_players.size> > 10:
              - narrate "Only 15 players can pray at once!"
              - stop
          - foreach <def[players]>:
            - flag <def[npc]> Worship:+:1
            - define quantity:+:1
          - foreach <def[players]>:
            - if <player.item_in_hand.contains_text[leather]>:
              - if !<player.has_flag[CattleAnimist]>:
                - flag player CattleAnimist:+:1
              - if <player.flag[CattleAnimist]> >= 0 && <player.flag[CattleAnimist]> < 50:
                - if <util.random.int[1].to[12]> != 12:
                  - define item leather
                - else:
                  - define item milk_bucket
                - define list:->:<[item]>
                - drop <[item]> <player.location.above[2]> quantity:<[quantity]>
                - flag server AnimismCattle:+:1
                - flag player CattleAnimist:+:1
                - flag <def[npc]> AnimismCattle:+:1
          - narrate "Ritual starts"
          - drop <[list]> <player.location.above[2]> quantity:<def[quantity]>
          - stop