Paste #11982: Untitled Paste

Date: 2014/12/10 21:00:08 UTC-08:00
Type: Denizen Script

View Raw Paste Download This Paste
Copy Link


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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503


# Barkeep
# 
# The barkeep will sell a player a selection of bar drinks and food from
# the bar menu of which each have a different effect on the player, but
# there is a limit to the number of drinks the player can consume. When
# the drink limit has been reached the player will become violently ill
# and will lose reputation. 
# After buying an item from the bar the player can tip the barkeep and
# earn some reputation. 
# The bartender can be attacked and will attack back, and after a short 
# period of time the bartender will cool off. 
# If the barkeep is killed he will respawn, attack the player, and
# the player will lose reputation.
# If the player is killed the barkeep will cool off.
# Use the NPC name "BarkeepNPC" if you want it has a bartender skin. 
# I created it for this script or any other bartender script.
# 
# Todo
# - Maybe refuse to serve people if they are below a certain rep.
# DONE - Add an option for the barkeep to describe the menu items.
# - If the player has high enough reputation a quest will be opened.
# - Create a questing option if the player tips the barkeep, maybe search
#   for menu ingredients
# - Randomize the quests
# DONE (but need to test further) - Engage and disengage NPC during attack. Makes no sense to be
#   attacking and serving drinks.
#
#
# Date Aug10-2013
# Author: PrimerBlock
#
# Attacking timeouts
# Player damages NPC - NPC attacks for 60 seconds
# Player kills NPC - NPC responds and attacks for 3600 seconds (1 hour)
# Player damages NPC and runs away - NPC  - NPC attacks for 60 seconds

"The Bar Keep":
    type: assignment

    interact scripts:
    - 10 First visit to the barkeep
    - 20 Welcome back to the bar
    - 30 Describe a menu item
    - 40 Buy a bar item
    - 50 Barkeep on the attack

    default constants:
        # This is the starting point for the NPC
        # set it with the command /npc anchor --save BarkeepStart
        BarkeepStart: <anchor:BarkeepStart>
        DrinkLimit: 6
        DrinkLimitWarn: 4
        BarName: "The Vrovonic Bar"
        NPCclr: "<blue>"
        # Change this to whatever you want to sell as a drink item 5 is food
        # Remember you can use constants to change per-npc
        # /npc cons --set "MenuItem1" --value "Squirrel Blood"
        MenuItem1: "Zombie Mead"
        MenuItem1Price: 5
        MenuItem1Desc: "Zombie Mead is a jigger of fermented zombie drool poured into a dirty glass."
        MenuItem2: "Apple Cider"
        MenuItem2Price: 10
        MenuItem2Desc: "Apple Cider contains freshly pressed digital apples. It may have side effects!"
        MenuItem3: "Squid Juice"
        MenuItem3Price: 15
        MenuItem3Desc: "Squid ink topped with a layer of milled coco beans. Yum!"
        MenuItem4: "Squirrel Milk"
        MenuItem4Price: 15
        MenuItem4Desc: "Fresh squirrel milk shaken with a dollop of fermented spider eye jelly over ice. It<&sq>s a house speciality"
        MenuItem5: "Ham Sandwich"
        MenuItem5Price: 20
        MenuItem5Desc: "Zombie Pigman flank, thinly sliced on freshly baked bread."

    actions:
        on assignment:
        - if '<cons:BarkeepStart>' matches location
          runtask "script:Barkeep Init" instant
          else runtask 'script:Template Invalid Init' instant
        - if <flag.n:loaded> true
         - narrate "NPC Template '<npc.name>' is ready to go!"
        on assignment:
            - runtask "script:Barkeep Init" instant

        on spawn:
            - runtask "script:Barkeep Init" instant


"First visit to the barkeep":
    type: interact
    requirements:
        Mode: All
        List:
        - -flagged player "BarVisited:true"
    steps:
        'WelcomeFirstVisitToBar*':
            click trigger:
                script:
                - chat "<cons:NPCclr>I don<&sq>t think I have seen you in here before."
                - narrate "<cons:NPCclr>Well, welcome visitor to the <blue><cons:BarName><cons:NPCclr>. What will ya have today?"
                - narrate "<yellow><&lb>Hint <&co> menu, describe, buy<&rb>"
                - flag player "BarVisited:true"
            proximity trigger:
                entry radius: 6
                entry:
                    script:
                    - random 3
                    - chat "<cons:NPCclr>Welcome, come on in!"
                    - chat "<cons:NPCclr>We<&sq>re open, have a seat."
                    - chat "<cons:NPCclr>Welcome visitor, best grub in town."
                    - ^attack stop
                    - ^disengage

"Welcome back to the bar":
    type: interact
    requirements:
        Mode: All
        List:
        - flagged player "BarVisited:true"
    steps:
        'VisitingTheBarkeep*':
            click trigger:
                script:
                - random 6
                - chat "<cons:NPCclr>What can I do ya?"
                - chat "<cons:NPCclr>How<&sq>s it going?"
                - chat "<cons:NPCclr>Lil<&sq> hair o<&sq> the squirrel?"
                - chat "<cons:NPCclr>Hey <light_purple><player.name><cons:NPCclr>! What will ya have?"
                - chat "<cons:NPCclr>I don<&sq>t think I<&sq>ve seen you in here before??? Ah, I<&sq>m kidding <light_purple><player.name><cons:NPCclr>. I know who you are."
                - chat "<cons:NPCclr>How<&sq>s it going <light_purple><player.name><cons:NPCclr>? What will you have today?"
                - narrate "<yellow><&lb>Hint <&co> menu, describe, buy<&rb>"
            proximity trigger:
                entry radius: 6
                exit radius: 9
                entry:
                    script:
                    - lookclose toggle:true
                    - random 3
                    - chat "<cons:NPCclr>Hey <light_purple><player.name><cons:NPCclr>, come on in!"
                    - chat "<cons:NPCclr>Have a seat <light_purple><player.name><cons:NPCclr>."
                    - chat "<cons:NPCclr>Welcome back <light_purple><player.name><cons:NPCclr>."
                exit:
                    script:
                    - random 3
                    - chat "<cons:NPCclr>See you later <light_purple><player.name><cons:NPCclr>."
                    - chat "<cons:NPCclr>Good seeing ya <light_purple><player.name><cons:NPCclr>."
                    - chat "<cons:NPCclr>Take it easy <light_purple><player.name><cons:NPCclr>."
                    - lookclose toggle:false
                    - flag player BuyABarItem:!
                    - flag player barkeepTip:!
                    - flag player TotalBarTab:!
                    - walkto location:<cons:BarkeepStart>
            chat trigger:
                'bar menu':
                    trigger: "What<&sq>s on the /menu/?"
                    script:
                    - chat "<cons:NPCclr>Here have a look."
                    - runtask "script:Bar Menu"
                    - chat "<cons:NPCclr>Let me know when you want to <light_purple>buy <cons:NPCclr>a menu item."
                    - narrate "<yellow><&lb>Hint <&co> menu, describe, buy<&rb>"
                'buy from bar':
                    trigger: "I<&sq>m ready to /buy/ from the menu."
                    script:
                    - chat "<cons:NPCclr>Sure, just choose from the menu."
                    - runtask "script:Bar Menu"
                    - narrate "<yellow><&lb>Hint <&co> 1 - 5<&rb>"
                    - flag player "BuyABarItem:true" duration:300
                'describe menu items':
                    trigger: "Can you /describe/ one of the menu items for me?"
                    script:
                    - chat "<cons:NPCclr>OK, just tell me the item number you want to know more about."
                    - runtask "script:Bar Menu"
                    - narrate "<yellow><&lb>Hint <&co> 1 - 5<&rb>"
                    - flag player "DescribeBarMenuItem:true" duration:300
                'tip barkeep':
                    trigger: "Thanks for the service! Here<&sq>s a /tip/ for you."
                    script:
                    - if <flag.p:TotalBarTab> == true runtask "script:Calc Bar Tip"
                    - if !<flag.p:TotalBarTab.asint> == true narrate "<red>You need to buy something before you tip. If you walked away before leaving a tip your bar tab total was forgotten."
                      else if <player.money.asint> <= 0 narrate "<red>Oops! Your broke, you don<&sq>t have enough <player.money.currency> to leave a tip!"
                      else if <player.money.asint> < <flag.p:barkeepTip.asint> narrate "<red>Nice gesture, but your broke. You only have <player.money> <player.money.currency>."
                      else runtask "script:Give a tip to the barkeep"
                ## Working on enabling the barkeep to search for and use a chest as an ice-chest to pull drinks from. 
                ## I think this may be too resource intensive so the search should be a one time event such as when assigning the script.
                'What is your location Barkeep':
                    trigger: "What is your /location/ barkeep?"
                    script:
                    - narrate "<red> Debug code... remove before release"
                    - chat "My starting point is <blue><cons:BarkeepStart>"
                    - walkto location:<cons:BarkeepStart>
                    # standing_on now show location instead of materials
                    #- chat "I<&sq>m standing on <blue><npc.location.standing_on>"
                    - chat "I<&sq>m standing at <blue><npc.location>"
                    - chat "I<&sq>m standing at X <blue><npc.location.x.asint>"
                    - chat "I<&sq>m standing at Y <blue><npc.location.y.asint>"
                    - chat "I<&sq>m standing at Z <blue><npc.location.z.asint>"
                    - chat "<blue><util.substr[<thisisatest>].from[1].to[4]>"
                    - chat "I<&sq>m standing in world <blue><npc.location.world.name>"
                    #- chat "<blue><location.block.below>"
                    #- chat "<blue><location.find.blocks[54].within[5]>"
                    #- chat "<blue><location.block.54>"
                    #- chat "<location.block.x>"
                    - chat "Barkeep is standing on material <blue><location[<cons:BarkeepStart>].block.material>"

                'I cant understand you':
                    trigger: /REGEX:\w+/
                    script:
                    - chat "<cons:NPCclr>Sorry, I don<&sq>t understand <white><player.chat_history><cons:NPCclr>. Why don<&sq>t you just <gold>buy <cons:NPCclr>something?"
                    - narrate "<yellow><&lb>Hint <&co> menu, describe, buy<&rb>"
"Calc Bar Tip":
    type: task
    script:
    - flag player barkeepTip:<flag.p:TotalBarTab>
    - flag player barkeepTip:*:0.1

"Describe a menu item":
    type: interact
    requirements:
        mode: all
        list:
        - flagged player "BarVisited:true"
        - flagged player "DescribeBarMenuItem:true"
    steps:
        'BarkeepDescribesItems*':
            click trigger:
                script:
                - chat "<cons:NPCclr><player.name> just tell me what item you want to know more about."
                - runtask "script:Bar Menu"
                - narrate "<yellow><&lb>Hint <&co> 1 - 5<&rb>"
            chat trigger:
                'Menu Item 1':
                    trigger: "What is in item /1/?"
                    script:
                    - chat "<cons:NPCclr> <cons:NPCclr><cons:MenuItem1Desc>"
                    - ^flag player "DescribeBarMenuItem:!"
                'Menu Item 2':
                    trigger: "Number /2/ looks good. Tell me about it?"
                    script:
                    - chat "<cons:NPCclr> <cons:NPCclr><cons:MenuItem2Desc>"
                    - ^flag player "DescribeBarMenuItem:!"
                'Menu Item 3':
                    trigger: "Item /3/, <cons:MenuItem3>"
                    script:
                    - chat "<cons:NPCclr> <cons:NPCclr><cons:MenuItem3Desc>"
                    - ^flag player "DescribeBarMenuItem:!"
                'Menu Item 4':
                    trigger: "Item /4/ looks interesting."
                    script:
                    - chat "<cons:NPCclr> <cons:NPCclr><cons:MenuItem4Desc>"
                    - ^flag player "DescribeBarMenuItem:!"
                'Menu Item 5':
                    trigger: "What is item /5/?"
                    script:
                    - chat "<cons:NPCclr> <cons:NPCclr><cons:MenuItem5Desc>"
                    - ^flag player "DescribeBarMenuItem:!"
                'We dont serve that':
                    trigger: /REGEX:\w+/
                    script:
                    - chat "<cons:NPCclr>Sorry, we don<&sq>t serve <white><player.chat_history><cons:NPCclr>."
                    - narrate "<yellow><&lb>Hint <&co> menu, describe, buy<&rb>"
                    - ^flag player "DescribeBarMenuItem:!"
"Buy a bar item":
    type: interact
    requirements:
        Mode: All
        list:
        - flagged player "BarVisited:true"
        - flagged player "BuyABarItem:true"
    steps:
        'OrderFromTheBarMenu*':
            click trigger:
                script:
                - chat "<cons:NPCclr>You didn<&sq>t get a menu? Well, here you go <player.name>."
                - runtask "script:Bar Menu"
                - narrate "<yellow><&lb>Hint <&co> 1 - 5<&rb>"

            chat trigger:
                'Menu Item 1':
                    trigger: I<&sq>ll have a number /1/ <cons:MenuItem1> for <cons:MenuItem1Price> <player.money.currency>
                    script:
                    - ^flag player BarItemPrice:<cons:MenuItem1Price> duration:300
                    - ^flag player BarItemName:<cons:MenuItem1> duration:300
                    - ^flag player DrinkEffect:->:confusion
                    - ^flag player DrinkEffect:->:hunger
                    - ^flag player DrinkEffect:->:night_vision
                    - ^if <player.money> > <cons:MenuItem1Price> runtask script:CompleteMenuDrinkOrder
                      else if <player.money> = <cons:MenuItem1Price> runtask script:CompleteMenuDrinkOrder
                      else chat "<red>You don<&sq>t have enough for <cons:MenuItem1>. You need <cons:MenuItem1Price> <player.money.currency> and you only have <player.money> <player.money.currency>."
                    - ^flag player "BarItemPrice:!"
                    - ^flag player "BarFoodItem:!"
                    - ^flag player "BarItemName:!"
                    - ^flag player "DrinkEffect:!"
                    - chat "<cons:NPCclr>Do you want anything else?"
                    - narrate "<yellow><&lb>Hint <&co> yes, no, 1 - 5, tip<&rb>"
                    - ^equip hand:0 chest:0 boots:0 head:0 legs:0

                'Menu Item 2':
                    trigger: I<&sq>ll have a number /2/ <cons:MenuItem2> for <cons:MenuItem2Price> <player.money.currency>
                    script:
                    - flag player BarItemPrice:<cons:MenuItem2Price> duration:300
                    - flag player BarItemName:<cons:MenuItem2> duration:300
                    - flag player DrinkEffect:->:confusion
                    - flag player DrinkEffect:->:heal
                    - flag player DrinkEffect:->:blindness
                    - if <player.money> > <cons:MenuItem2Price> runtask script:CompleteMenuDrinkOrder
                      else if <player.money> = <cons:MenuItem2Price> runtask script:CompleteMenuDrinkOrder
                      else chat "<red>You don<&sq>t have enough for <cons:MenuItem2>. You need <cons:MenuItem2Price> <player.money.currency> and you only have <player.money> <player.money.currency>."
                    - ^flag player "BarItemPrice:!"
                    - ^flag player "BarFoodItem:!"
                    - ^flag player "BarItemName:!"
                    - ^flag player "DrinkEffect:!"
                    - chat "<cons:NPCclr>Do you want anything else?"
                    - narrate "<yellow><&lb>Hint <&co> yes, no, 1 - 5, tip<&rb>"
                    - ^equip hand:0 chest:0 boots:0 head:0 legs:0

                'Menu Item 3':
                    trigger: I<&sq>ll have a number /3/ <cons:MenuItem3> for <cons:MenuItem3Price> <player.money.currency>
                    script:
                    - flag player BarItemPrice:<cons:MenuItem3Price> duration:300
                    - flag player BarItemName:<cons:MenuItem3> duration:300
                    - flag player DrinkEffect:->:confusion
                    - flag player DrinkEffect:->:heal
                    - flag player DrinkEffect:->:poison
                    - if <player.money> > <cons:MenuItem3Price> runtask script:CompleteMenuDrinkOrder
                      else if <player.money> = <cons:MenuItem3Price> runtask script:CompleteMenuDrinkOrder
                      else chat "<red>You don<&sq>t have enough for <cons:MenuItem3>. You need <cons:MenuItem3Price> <player.money.currency> and you only have <player.money> <player.money.currency>."
                    - ^flag player "BarItemPrice:!"
                    - ^flag player "BarFoodItem:!"
                    - ^flag player "BarItemName:!"
                    - ^flag player "DrinkEffect:!"
                    - chat "<cons:NPCclr>Do you want anything else?"
                    - narrate "<yellow><&lb>Hint <&co> yes, no, 1 - 5, tip<&rb>"
                    - ^equip hand:0 chest:0 boots:0 head:0 legs:0

                'Menu Item 4':
                    trigger: I<&sq>ll have a number /4/ <cons:MenuItem4> for <cons:MenuItem4Price> <player.money.currency>
                    script:
                    - flag player BarItemPrice:<cons:MenuItem4Price> duration:300
                    - flag player BarItemName:<cons:MenuItem4> duration:300
                    - flag player DrinkEffect:->:confusion
                    - flag player DrinkEffect:->:jump
                    - flag player DrinkEffect:->:regeneration
                    - if <player.money> > <cons:MenuItem4Price> runtask script:CompleteMenuDrinkOrder
                      else if <player.money> = <cons:MenuItem4Price> runtask script:CompleteMenuDrinkOrder
                      else chat "<red>You don<&sq>t have enough for <cons:MenuItem4>. You need <cons:MenuItem4Price> <player.money.currency> and you only have <player.money> <player.money.currency>."
                    - ^flag player "BarItemPrice:!"
                    - ^flag player "BarFoodItem:!"
                    - ^flag player "BarItemName:!"
                    - ^flag player "DrinkEffect:!"
                    - chat "<cons:NPCclr>Do you want anything else?"
                    - narrate "<yellow><&lb>Hint <&co> yes, no, 1 - 5, tip<&rb>"
                    - ^equip hand:0 chest:0 boots:0 head:0 legs:0

                'Menu Item 5':
                    trigger: I<&sq>ll have a number /5/ - <cons:MenuItem5> for <cons:MenuItem5Price> <player.money.currency>
                    script:
                    - flag player BarItemPrice:<cons:MenuItem5Price> duration:300
                    - flag player BarItemName:<cons:MenuItem5> duration:300
                    - flag player BarFoodItem:->:320 duration:300
                    - flag player BarFoodItem:->:297 duration:300
                    - if <player.money> > <cons:MenuItem5Price> runtask script:CompleteMenuFoodOrder
                      else if <player.money> = <cons:MenuItem5Price> runtask script:CompleteMenuFoodOrder
                      else chat "<red>You don<&sq>t have enough for <cons:MenuItem5>. You need <cons:MenuItem5Price> <player.money.currency> and you only have <player.money> <player.money.currency>."
                    - flag player "BarItemPrice:!"
                    - ^flag player "BarFoodItem:!"
                    - ^flag player "BarItemName:!"
                    - chat "<cons:NPCclr>Do you want anything else?"
                    - narrate "<yellow><&lb>Hint <&co> yes, no, 1 - 5, tip<&rb>"
                    - ^equip hand:0 chest:0 boots:0 head:0 legs:0

                'Still ordering from the bar':
                    trigger: "/Yes/, I want something else from the menu."
                    script:
                    - chat "<cons:NPCclr>OK, here you go."
                    - runtask "script:Bar Menu"
                    - narrate "<yellow><&lb>Hint <&co> yes, no, 1 - 5, tip<&rb>"

                'Im done ordering from the bar':
                    trigger: /no/
                    script:
                    - equip HAND item:0
                    - flag player "BuyABarItem:!"
                    - chat "<cons:NPCclr>OK just let me know when you are ready"
                    - narrate "<yellow><&lb>Hint <&co> menu, describe, buy<&rb>"
                    - ^zap "step:VisitingTheBarkeep" "script:Welcome back to the bar"

                'Cant order that from the menu':
                    trigger: /REGEX:\w+/
                    script:
                    - chat "<cons:NPCclr>Sorry, I don<&sq>t have <white><player.chat_history><cons:NPCclr> on the menu."
                    - narrate "<yellow><&lb>Hint <&co> yes, no, 1 - 5, tip<&rb>"

                'tip barkeep':
                    trigger: "Thanks for the service! Here<&sq>s a /tip/ for you."
                    script:
                    - flag player barkeepTip:<flag.p:TotalBarTab>
                    - flag player barkeepTip:*:0.1
                    # need to first determine if player bought anything and check that they have enough money to tip
                    - if <flag.p:TotalBarTab.asint> >= 0 && <player.money.asint> >= <flag.p:barkeepTip.asint> runtask "script:Give a tip to the barkeep"
                      else narrate "<red>Oops! you don<&sq>t have enough <player.money.currency> or you have not bought anything yet. Try buying something first."
                    # later this may be replaced with paying bar tab script
                    - narrate "<yellow><&lb>Hint <&co> yes, no, 1 - 5, tip<&rb>"

"Give a tip to the barkeep":
    type: task
    script:
        - chat "<cons:NPCclr>Hey thanks!"
        - ^narrate "Current bar tab paid<&co> <flag.p:TotalBarTab> <player.money.currency>."
        - ^narrate "Tip given to <npc.name><&co> <flag.p:barkeepTip> <player.money.currency>. <gold>Your rep has gone up!"
        - flag player TotalBarTab:!
        - flag player barkeepTip:!
        - flag player reputation:+:1
        - execute as_server "denizen save"

"Barracho":
    type: task
    script:
        - chat "<red>Hey buddy! You<&sq>re turning <dark_green>green<red>. Don<&sq>t get sick in here!"
        - cast confusion
        - narrate "<dark_green>You begin to feel violently ill as your stomach begins to turn!"
        - cast blindness
        - cast poison duration:10 power:1
        - ^flag player reducedRep:<flag.p:reputation>
        - ^flag player reducedRep:-:10
        - ^if <flag.p:reputation.asint> <= 0 flag player reputation:0 
          else flag player reputation:<flag.p:reducedRep>
        - narrate "<red>Getting <dark_green>sick <red>in public does not look good! You lost some reputation."
        - ^execute as_server "denizen save"

"CompleteMenuFoodOrder":
    type: task
    script:
        - equip hand:297
        - chat "<cons:NPCclr>Here<&sq>s your <flag.p:BarItemName>."
        - equip hand:0
        - ^runtask 'loop through' "context:ServingBarFood|BarFoodItem|player"
        - ^take money "qty:<flag.p:BarItemPrice>"
        - ^narrate "<flag.p:BarItemPrice> <player.money.currency> have been removed from your account."
        - ^flag player TotalBarTab:+:<flag.p:BarItemPrice>
        - ^chat "Item Price <flag.p:BarItemPrice>"
        - ^narrate "Paid bar tab total<&co> <flag.p:TotalBarTab>"

"ServingBarFood":
    type: task
    context: yumbarfood
    script:
    - give item:<context.yumbarfood> qty:1

"CompleteMenuDrinkOrder":
    type: task
    script:
        - equip hand:384
        - wait 1
        - chat "<cons:NPCclr>Here<&sq>s your <flag.p:BarItemName>."
        - equip hand:374
        - ^runtask 'loop through' "context:ServingBarDrink|DrinkEffect|player"
        - ^take money "qty:<flag.p:BarItemPrice>"
        - ^narrate "<flag.p:BarItemPrice> <player.money.currency> have been removed from your account."
        - ^flag player TotalBarTab:+:<flag.p:BarItemPrice>
        - ^flag player TotalDrinksConsumed:+:1 duration:3600
        - ^if <flag.p:TotalDrinksConsumed.asint> >= <cons:DrinkLimit.asint> runtask "script:Barracho"
          else if <flag.p:TotalDrinksConsumed.asint> >= <cons:DrinkLimitWarn.asint>
        - chat "<red>Are you getting sick? Maybe you should quit?"
          else chat "<cons:NPCclr>Enjoy <player.name>."

"ServingBarDrink":
    type: task
    context: BarDrinkItem
    script:
    - cast <context.BarDrinkItem> duration:20 power:1

"Bar Menu":
    type: task
    script:
        - ^narrate "<light_purple><cons:BarName> Menu"
        - ^narrate "<green>=========================="
        - ^narrate "<light_purple>1<cons:NPCclr> - <cons:MenuItem1> -- <gold><cons:MenuItem1Price> <cons:NPCclr><player.money.currency>"
        - ^narrate "<light_purple>2<cons:NPCclr> - <cons:MenuItem2> -- <gold><cons:MenuItem2Price> <cons:NPCclr><player.money.currency>"
        - ^narrate "<light_purple>3<cons:NPCclr> - <cons:MenuItem3> -- <gold><cons:MenuItem3Price> <cons:NPCclr><player.money.currency>"
        - ^narrate "<light_purple>4<cons:NPCclr> - <cons:MenuItem4> -- <gold><cons:MenuItem4Price> <cons:NPCclr><player.money.currency>"
        - ^narrate "<light_purple>5<cons:NPCclr> - <cons:MenuItem5> -- <gold><cons:MenuItem5Price> <cons:NPCclr><player.money.currency>"


"Barkeep Init":
    type: task
    script:
        trigger name:chat toggle:true radius:5
        trigger name:click toggle:true radius:5
        trigger name:proximity toggle:true
        trigger name:damage toggle:false
        - vulnerable toggle:false
        - execute as_npc "npc select <npc.id>"
        - execute as_npc "npc health --respawndelay 30s"
        - health 50
        - walkto location:<cons:BarkeepStart>


"Barkeep Invalid Init":
    type: task
    script:
    - narrate "<red>[X] <white>Oops! Barkeep failed to initialize<&cm>"
    - narrate "<red>Assignment removed."
    - assignment remove
    - flag npc loaded:false