Paste #2137: Untitled Paste

Date: 2014/02/19 14:24:47 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


"bosshealthscroll":
    type: task
    debug: false
    script:
    - ^if <global.flag[stopbosshealthscroll]> queue clear
    - ^if <server.has_flag[healthscroll1]> == false flag server healthscroll1:0
    - ^if <global.flag[healthscroll1].asint> >= <server.flag[newsbarcurrentstring].length.add[64].as_int||0> {
      - ^flag server newsbarcurrentstring:<server.flag[healthscroll1].as_list.random[1].formatted>
      - ^flag server bosshealthscrollHP:<el@val[200].div[<server.flag[newsbarcurrentstring].length.add[63]>]>
      - ^flag server healthscroll1:0
      }
    - if <server.list_online_players.size> > 0 {
      - foreach <server.list_online_players> {
        - if li@off|hints !contains <%value%.flag[currentsidebar]> adjust %value% 'show_boss_bar:<el@val[200].sub[<global.flag[bosshealthscrollHP].mul[<global.flag[healthscroll1]>]>].as_int>|<&6><el@val[                                                               <server.flag[newsbarcurrentstring]>                                                                                        ].substring[<global.flag[healthscroll1].asint>,<global.flag[healthscroll1].add[63].asint>]>'
        }
      }
    - ^flag server healthscroll1:++
    - ^run bosshealthscroll

derpcommand:    
    type: world
    events:
        on newsbar command:
        - if !<player.has_permission[lumiboard.newsbar]> {
          - narrate "<&c>You do not have the permission to do this."
          - determine fulfilled
          - queue clear
          }
        - if <context.args.get[1]> == add {
          - if <global.flag[healthscroll1].as_list> !contains <context.args.get[2]> {
            - flag server 'healthscroll1:->:<context.args.get[2].to[500].replace[li@].replace[|].with[ ]>'
            - narrate "<&6>Added '<context.args.get[2].to[500].replace[li@].replace[|].with[ ]>' as a news string."
            } else {
            - narrate "<&c>This news string was already found."
            }
          } else if '<context.args.get[1]>' == set {
          - flag server 'healthscroll1:<context.args.get[2].to[500].replace[li@].replace[|].with[ ]>'
          - narrate "<&6>Set '<context.args.get[2].to[500].replace[li@].replace[|].with[ ]>' as the news string."
          } else if <context.args.get[1]> == delete || <context.args.get[1]> == remove || <context.args.get[1]> == del {
          - if <global.flag[healthscroll1].as_list> contains '<context.args.get[2].to[500].replace[li@].replace[|].with[ ]>' {
            - flag server 'healthscroll1:<-:<context.args.get[2].to[500].replace[li@].replace[|].with[ ]>'
            - narrate "<&6>Removed '<context.args.get[2].to[500].replace[li@].replace[|].with[ ]>' from the news strings."
            } else {
            - narrate "<&c>This news string was not found."
            }
          } else if <context.args.get[1]> == list {
          - narrate ""
          - narrate "<&6>Listing all current news strings<&co>"
          - foreach <server.flag[healthscroll1].as_list> {
            - narrate "<&e>%value%"
            }
          } else {
          - narrate "<&c> invalid arguments. do /newsbar add/set/delete [news string] or /newsbar list."
          }
        - determine fulfilled