Paste #58377: Untitled Paste

Date: 2019/09/17 00:12:37 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:
      - determine passively cancelled
      - 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@
        - define quantity <context.location.cuboids.get[1].list_players.size>
        - if <def[quantity]> >= 1:
          - if <def[npc].flag[Worship]> >= 0 && <def[npc].flag[Worship]> < 1000:
            - if <def[quantity]> > 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 && <def[quantity]> > 15:
            - if <def[quantity]> > 15:
              - narrate "Only 15 players can pray at once!"
              - stop
          - flag player LeadingPrayer
          - foreach <def[players]> as:player:
            - if <[player].has_flag[LeadingPrayer]>:
              - foreach next
            - 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]> < 1000:
                - if <util.random.int[1].to[12]> != 12:
                  - define item leather
                - else:
                  - define item milk_bucket
                - define list:->:<def[item]>
                - drop <def[item]> <[player].location.above[2]> quantity:<def[quantity]>
                - take <[player].item_in_hand>
                - flag server AnimismCattle:+:1
                - flag <[player]> CattleAnimist:+:1
                - flag <def[npc]> AnimismCattle:+:1
          - narrate "Ritual starts"
          - drop <def[list]> <player.location.above[2]> quantity:<def[quantity]>
          - flag player Worship:+:<def[quantity]>
          - flag <def[npc]> Worship:+:<def[quantity]>
          - narrate "+<player.flag[Worship]> Worship!"
          - flag player LeadingPrayer:!
          - stop