You are browsing as a guest.
Login | Register
~ mcmonkey's simpler pastebin ~ Inspired by Hastebin ~ home page ~ Denizen help ~
click to use the normal pastebin instead ~ Click to make your own paste ~ click to duplicate and edit this paste


Title:
Type:
Date:
By:
Raw:
Other:
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
15700

Lottery 1.0
Denizen Script
2018/06/05 08:07:31 UTC-07:00
Guest
Click here to view this paste as a raw text file | Or download the script


lottery_command:
  type: command
  name: Lottery
  description: Main command for Lottery plugin
  usage"/lottery help"
  script:
  - define opt <context.args.get[1]>
  - if li@gui|buy|credits| !contains <def[opt]> {
    - define opt help
    }
  - inject locally path:<def[opt]>
  help:
    - narrate "<&6>Lottery help - Commands:"
    - narrate "<&6>/lottery help - <&7>Displays this page"
    - narrate "<&6>/lottery gui - <&7>Opens lottery inventory GUI"
    - narrate "<&6>/lottery buy (amount) - <&7>Buy lottery credits"
    - narrate "<&7> 1 credit = 10$"
    - narrate "<&6>/lottery credits - <&7>Check your credits balance"
  gui:
    - inventory open d:in@lottery_gui
  credits: 
    - narrate "<&6>[<&b>Lottery<&6>] <&e>You have <&6><player.flag[credits].round> <&e>credits."
  buy:
    - if !<context.args.get[2].matches[[0-9]+]||false> || <context.args.get[2].length||0> >= 4 {
      - narrate "<&6>[<&b>Lottery<&6>] <&e>You didn't specify an amount, or the specified was either invalid or too big"
      - queue clear
      }
    - if <player.money> >= <context.args.get[2].mul[10]> {
      - execute as_op "eco take <player.name> <context.args.get[2].mul[10]>"
      - flag player credits:+:<context.args.get[2]>
      - narrate "<&6>[<&b>Lottery<&6>] <&6><context.args.get[2].round> <&e>credits has been added to your account."
      - if <player.has_flag[extracredits].not> {
        - flag player extracredits:1
        } 
        else if <player.has_flag[extracredits]> {
        - determine passively cancelled 
        }
      - queue clear
      }
      else {
      - narrate "<&6>[<&b>Lottery<&6>] <&e>You don't have enough money"
      - determine cancelled
      }
  
extracredits_handler:
  type: world
  events:
    on system time hourly:
    - if <server.get_players_flagged[extracredits].size> >= 3 {
      - define randomplayer <server.get_players_flagged[extracredits].random>
      - flag <def[randomplayer]> credits:+:10
      - announce "<&6>[<&b>Lottery<&6>] <&e><def[randomplayer].name> recieved 10 extra credits!"
      - foreach <server.get_players_flagged[extracredits]> {
        - flag <def[value]> extracredits:!
        }

rtd_gui_task: 
  type: task 
  debug: false 
  speed: 0 
  prefix'&ss1&ss2&ss1&ss5&ss2&ss0&ss2&ss0&ss0&ss5&ss1&ss8&ss2&ss5&ss0&ss7&ss2&ss1&ss0&ss9&ssr' 
  script: 
  - define base_inv '' 
  #- define base_inv 'in@generic[title=<&6><&l>Lottery GUI;size=27;contents=li@i@air]' 
  - inventory open 'd:in@generic[title=<script.yaml_key[prefix].unescaped><&6><&l>Lottery GUI;size=27]' 
  - wait 1t 
  - repeat 50 { 
    - define rng '<util.random.decimal>' 
    # 10% chance 
    - if <def[rng]> < 0.1 { 
      - define item 'i@iron_sword[display_name=&sseLottery Sword;lore=&ss6Whippity whoopity, you now have a sword!;enchantments=DURABILITY,2|DAMAGE_ALL,3]' 
    } 
    # 25% chance 
    else if <def[rng]> < 0.35 { 
      - define item 'i@magma_cream[display_name=<&e>Relic;lore=<&8>Screams can be heard within|<&8> Â» <&7>Right-click while holding|<&8> Â» <&7>this to reveal!;enchantments=DURABILITY,10]' 
    } 
    # 20% chance 
    else if <def[rng]> < 0.55 { 
      - define item 'i@diamond_chestplate[display_name=&ssaLottery Chestplate;nbt_attributes=generic.armor/chest/0/1]' 
    } 
    # 15% chance 
    else if <def[rng]> < 0.7 { 
      - define item 'i@glass_bottle[display_name=<&7>[<&5>+<&7>] <&5>Token of Insight <&7>[<&5>+<&7>];lore=<&5>• <&7>Right-click to recieve a random item!|<&e>• <&e>Small chance of recieving an OP item!||<&3><&o>Legendary Artifact]'
    }
    # 10% chance 
    else if <def[rng]> < 0.8 { 
      - define item 'i@potion[display_name=<&7>Fart Potion;lore=<&f>Why would anyone drink this?;potion_effects=jump,false,true;flags=li@HIDE_POTION_EFFECTS]' 
    } 
    # 5% chance 
    else if <def[rng]> < 0.85 { 
      - define item 'i@gold_nugget[displayname=<&e>Lesser Lifegem <&7>(Right-Click);lore=<&7>Regenerate 10 health|<&7>over 25 seconds||<&d><&o>Rare Artifact]' 
    } 
    # 15% chance 
    else { 
      - define item 'i@paper[display_name=<&8>(<&e><&l>Lucky<&8>);lore=<&8> Â» <&7>Right click to redeem title;enchantments=DURABILITY,10]' 
    } 
    - if <def[item]> != <def[prev_item]||i@air> { 
      - inventory open 
        'd:in@generic[title=<script.yaml_key[prefix].unescaped><&6><&l>Lottery GUI;size=27;contents=li@i@air|i@air|i@air|i@air|i@air|i@air|i@air|i@air|i@air|i@air|i@air|i@air|i@air|<def[item]>]' 
    } 
    - define prev_item '<def[item]>' 
    - wait <el@2.71828182846.power[<def[value].mul[0.125].sub[3]>].round_up>t 
  } 
  - wait 1s 
  - narrate "<&6>[<&b>Lottery<&6>] <&e><Congratulations! You got <def[item].display>!"
  - give <def[item]> 
  - flag player can_close_inv 
  - inventory close 

rtd_gui_evts: 
  type: world 
  debug: false 
  events: 
    on player closes inventory: 
    - if <context.inventory.title.escaped.starts_with[&ss1&ss2&ss1&ss5&ss2&ss0&ss2&ss0&ss0&ss5&ss1&ss8&ss2&ss5&ss0&ss7&ss2&ss1&ss0&ss9&ssr]> { 
      - if !<player.has_flag[can_close_inv]> { 
        - determine cancelled 
      } 
      - flag player can_close_inv:! 
    } 


runscript:
  type: item
  material: i@diamond[flags=HIDE_ATTRIBUTES|HIDE_ENCHANTS;enchantments=ARROW_DAMAGE,1]
  display name<&d>Play lottery for 10 credits!

lottery_gui:
  type: inventory
  title: Lottery
  size: 27
  slots:
  - "[wgs] [wgs] [] [] [] [] [] [wgs] [wgs]"
  - "[wgs] [] [] [] [runscript] [] [] [] [wgs]"
  - "[wgs] [wgs] [] [] [] [] [] [wgs] [wgs]"
  definitions:
    wgs: i@black_stained_glass_pane

roll_handler:
  type: world
  events:
    on player clicks in lottery_gui:
    - determine cancelled
    on player drags in lottery_gui:
    - determine cancelled
    on player clicks runscript in lottery_gui:
    - if <player.flag[credits].round> >= 10 {
      - inventory close    
      - flag player credits:-:10
      - run rtd_gui_task instantly player:<player>
      }
      else if <player.flag[credits].round> < 10 {
      - inventory close
      - narrate "<&6>[<&b>Lottery<&6>] <&e>You don't have enough credits!"
      }