Paste #7505: Untitled Paste

Date: 2014/07/27 14:20:20 UTC-07: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
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698


#0 = weapon (0 = club 1 = spear 2 = mace 3 = sword 4 = naginata 5 = knife 6 = wand 7 = shrunken head 8 = bow 9 = staff)
#First segment of the flag list determines which items the prefix is NOT allowed to spawn on.
#If it cannot spawn, it rerandoms the prefix until it does.
ReloadPrefixSuffixFlags:
  type: task
  script:
  - ^flag global WeaponPrefixes:!
  - ^narrate "<red>Deleted old flag values."
  - ^repeat 16 {
       - ^flag global WeaponPrefixes%value%:!
     }
  #prefix complete
  #Begin prefix fire.
  - ^flag global WeaponPrefixes1:!
  - ^flag global WeaponPrefixes1:->:-1
  - ^flag global WeaponPrefixes1:->:Smoking
  - ^flag global WeaponPrefixes1:->:Smoldering
  - ^flag global WeaponPrefixes1:->:Burning
  - ^flag global WeaponPrefixes1:->:Searing
  - ^flag global WeaponPrefixes1:->:Red-Hot
  - ^flag global WeaponPrefixes1:->:Scalding
  - ^flag global WeaponPrefixes1:->:Thermal
  - ^flag global WeaponPrefixes1:->:Incinerating
  #Prefix complete.
  #Begin prefix +lightning damage
  - ^flag global WeaponPrefixes2:->:-1
  - ^flag global WeaponPrefixes2:->:Static
  - ^flag global WeaponPrefixes2:->:Glowing
  - ^flag global WeaponPrefixes2:->:Buzzing
  - ^flag global WeaponPrefixes2:->:Arcing
  - ^flag global WeaponPrefixes2:->:Shocking
  - ^flag global WeaponPrefixes2:->:Electrified
  - ^flag global WeaponPrefixes2:->:Galvanizing
  - ^flag global WeaponPrefixes2:->:Zeus&sq
  #Prefix complete.
  #Begin prefix Poison damage.
  - ^flag global WeaponPrefixes3:->:2,9
  - ^flag global WeaponPrefixes3:->:Septic
  - ^flag global WeaponPrefixes3:->:Foul
  - ^flag global WeaponPrefixes3:->:Poisonous
  - ^flag global WeaponPrefixes3:->:Corrosive
  - ^flag global WeaponPrefixes3:->:Toxic
  - ^flag global WeaponPrefixes3:->:Noxious
  - ^flag global WeaponPrefixes3:->:Virulent
  - ^flag global WeaponPrefixes3:->:Mephitic
  #Prefix complete.
  #Begin prefix +Damage
  - ^flag global WeaponPrefixes4:->:6,7,9
  - ^flag global WeaponPrefixes4:->:Jagged
  - ^flag global WeaponPrefixes4:->:Deadly
  - ^flag global WeaponPrefixes4:->:Vicious
  - ^flag global WeaponPrefixes4:->:Brutal
  - ^flag global WeaponPrefixes4:->:Savage
  - ^flag global WeaponPrefixes4:->:Merciless
  - ^flag global WeaponPrefixes4:->:Ferocious
  - ^flag global WeaponPrefixes4:->:Cruel
  #Prefix complete.
  #Begin prefix +Maximum damage
  - ^flag global WeaponPrefixes5:->:6,7,9
  - ^flag global WeaponPrefixes5:->:Fine
  - ^flag global WeaponPrefixes5:->:Warrior&sqs
  - ^flag global WeaponPrefixes5:->:Soldier&sqs
  - ^flag global WeaponPrefixes5:->:Knight&sqs
  - ^flag global WeaponPrefixes5:->:Lord&sqs
  - ^flag global WeaponPrefixes5:->:King&sqs
  - ^flag global WeaponPrefixes5:->:Master&sqs
  - ^flag global WeaponPrefixes5:->:Grandmaster&sqs
  #Prefix complete
  #Begin prefix +Damage versus zombies
  - ^flag global WeaponPrefixes6:->:7
  - ^flag global WeaponPrefixes6:->:Lunar
  - ^flag global WeaponPrefixes6:->:Arcadian
  - ^flag global WeaponPrefixes6:->:Unearthly
  - ^flag global WeaponPrefixes6:->:Sacred
  - ^flag global WeaponPrefixes6:->:Pure
  - ^flag global WeaponPrefixes6:->:Celestial
  - ^flag global WeaponPrefixes6:->:Hallowed
  - ^flag global WeaponPrefixes6:->:Divine
  #Prefix complete.
  #begin prefix +damage versus Skeletons
  - ^flag global WeaponPrefixes7:->:7
  - ^flag global WeaponPrefixes7:->:Warding
  - ^flag global WeaponPrefixes7:->:Sturdy
  - ^flag global WeaponPrefixes7:->:Strong
  - ^flag global WeaponPrefixes7:->:Glorious
  - ^flag global WeaponPrefixes7:->:Blessed
  - ^flag global WeaponPrefixes7:->:Saintly
  - ^flag global WeaponPrefixes7:->:Holy
  - ^flag global WeaponPrefixes7:->:Godly
  #Prefix complete
  #begin prefix +Necromancer summon duration
  #must spawn on weapon type shrunken head, otherwise re-roll
  - ^flag global WeaponPrefixes8:->:0,1,2,3,4,5,6,8,9
  - ^flag global WeaponPrefixes8:->:Unholy
  - ^flag global WeaponPrefixes8:->:Rotten
  - ^flag global WeaponPrefixes8:->:Decomposing
  - ^flag global WeaponPrefixes8:->:Undying
  - ^flag global WeaponPrefixes8:->:Summoner&sqs
  - ^flag global WeaponPrefixes8:->:Necromancer&sqs
  - ^flag global WeaponPrefixes8:->:Blighting
  - ^flag global WeaponPrefixes8:->:Graverobber&sqs
  #Prefix complete
  #begin prefix +Mage spell effective level
  - ^flag global WeaponPrefixes9:->:0,1,2,3,4,5,7,8,9
  - ^flag global WeaponPrefixes9:->:Magical
  - ^flag global WeaponPrefixes9:->:Enchanted
  - ^flag global WeaponPrefixes9:->:Charged
  - ^flag global WeaponPrefixes9:->:Runic
  - ^flag global WeaponPrefixes9:->:Burning
  - ^flag global WeaponPrefixes9:->:Blazing
  - ^flag global WeaponPrefixes9:->:Volcanic
  - ^flag global WeaponPrefixes9:->:Powered
  #prefix complete
  #begin prefix +Rogue damage when sneak attacking
  - ^flag global WeaponPrefixes10:->:0,1,2,3,4,6,7,8,9
  - ^flag global WeaponPrefixes10:->:Entrapping
  - ^flag global WeaponPrefixes10:->:Trickster&sqs
  - ^flag global WeaponPrefixes10:->:Cunning
  - ^flag global WeaponPrefixes10:->:Quiet
  - ^flag global WeaponPrefixes10:->:Concealed
  - ^flag global WeaponPrefixes10:->:Undetectable
  - ^flag global WeaponPrefixes10:->:Assassin&sqs
  - ^flag global WeaponPrefixes10:->:Magekiller&sqs
  #prefix complete
  #begin prefix +Brute life regeneration on hit
  - ^flag global WeaponPrefixes11:->:1,2,3,4,5,6,7,8,9
  - ^flag global WeaponPrefixes11:->:Durable
  - ^flag global WeaponPrefixes11:->:Rugged
  - ^flag global WeaponPrefixes11:->:Toughened
  - ^flag global WeaponPrefixes11:->:Vigorous
  - ^flag global WeaponPrefixes11:->:Tireless
  - ^flag global WeaponPrefixes11:->:Perpetual
  - ^flag global WeaponPrefixes11:->:Unstoppable
  - ^flag global WeaponPrefixes11:->:Ageless
  #Prefix complete
  #Begin prefix +Kensai effective skill level
  - ^flag global WeaponPrefixes12:->:0,1,2,3,5,6,7,8,9
  - ^flag global WeaponPrefixes12:->:Honorable
  - ^flag global WeaponPrefixes12:->:Kensai&sqs
  - ^flag global WeaponPrefixes12:->:Kenshi&sqs
  - ^flag global WeaponPrefixes12:->:Shogukusha&sqs
  - ^flag global WeaponPrefixes12:->:Renowned
  - ^flag global WeaponPrefixes12:->:Efficient
  - ^flag global WeaponPrefixes12:->:Specialized
  - ^flag global WeaponPrefixes12:->:Sensei&sqs
  #Prefix complete
  #Begin prefix +Ranger bow damage and range
  - ^flag global WeaponPrefixes13:->:0,1,2,3,4,5,6,7,8
  - ^flag global "WeaponPrefixes13:->:Long Ranged"
  - ^flag global WeaponPrefixes13:->:Ranger&sqs
  - ^flag global WeaponPrefixes13:->:Distant
  - ^flag global "WeaponPrefixes13:->:Well Sighted"
  - ^flag global WeaponPrefixes13:->:Fletcher&sqs
  - ^flag global WeaponPrefixes13:->:Bowyer&sqs
  - ^flag global WeaponPrefixes13:->:Archer&sqs
  - ^flag global WeaponPrefixes13:->:Sniper&sqs
  #prefix complete
  #begin prefix +Paladin aura range
  - ^flag global WeaponPrefixes14:->:0,1,3,4,5,6,7,8,9
  - ^flag global "WeaponPrefixes14:->:Lion Branded"
  - ^flag global "WeaponPrefixes14:->:Hawk Branded"
  - ^flag global "WeaponPrefixes14:->:Rose Branded"
  - ^flag global "WeaponPrefixes14:->:Crimson"
  - ^flag global "WeaponPrefixes14:->:Captain&sqs"
  - ^flag global "WeaponPrefixes14:->:Commander&sqs"
  - ^flag global "WeaponPrefixes14:->:Marshal&sqs"
  - ^flag global "WeaponPrefixes14:->:Preserver&sqs"
  #Prefix complete
  #Begin prefix +Priest healing bonus
  - ^flag global WeaponPrefixes15:->:0,1,2,3,4,5,6,7,9
  - ^flag global "WeaponPrefixes15:->:Clerical"
  - ^flag global "WeaponPrefixes15:->:Priest&sqs"
  - ^flag global "WeaponPrefixes15:->:Bishop&sqs"
  - ^flag global "WeaponPrefixes15:->:Devout"
  - ^flag global "WeaponPrefixes15:->:Righteous"
  - ^flag global "WeaponPrefixes15:->:Angelic"
  - ^flag global WeaponPrefixes15:->:Sacrosanct
  - ^flag global WeaponPrefixes15:->:Ordained
  #prefix complete
  #Begin prefix +Knight damage reduced if held while striking
  - ^flag global WeaponPrefixes16:->:0,1,2,3,5,6,7,8,9
  - ^flag global WeaponPrefixes16:->:Cavalier
  - ^flag global WeaponPrefixes16:->:Horseman&sqs
  - ^flag global WeaponPrefixes16:->:Lord&sqs
  - ^flag global WeaponPrefixes16:->:Gallant
  - ^flag global WeaponPrefixes16:->:Valiant
  - ^flag global WeaponPrefixes16:->:Dauntless
  - ^flag global WeaponPrefixes16:->:Fearless
  - ^flag global WeaponPrefixes16:->:Audacious
  #prefix complete
  - ^flag global WeaponPrefixCount:16
  #Begin suffix calculation
  - ^repeat 16 {
       - ^flag global WeaponSuffixes%value%:!
     }
  - ^narrate "<red>Weapon Suffix data reset."
  #Begin suffix +Strength
  - ^flag global WeaponPrefixes1:->:-1
  - ^flag global WeaponPrefixes1:->:Strength
  - ^flag global WeaponPrefixes1:->:Might
  - ^flag global WeaponPrefixes1:->:Ox
  - ^flag global WeaponPrefixes1:->:Giant
  - ^flag global "WeaponPrefixes1:->:The Titan"
  - ^flag global WeaponPrefixes1:->:Surestrength
  - ^flag global "WeaponPrefixes1:->:The Ogre"
  - ^flag global WeaponPrefixes1:->:Atlas
  #Suffix complete
  #Begin suffix +Intelligence
  - ^flag global WeaponPrefixes2:->:-1
  - ^flag global WeaponPrefixes2:->:Energy
  - ^flag global WeaponPrefixes2:->:Mind
  - ^flag global WeaponPrefixes2:->:Brilliance
  - ^flag global WeaponPrefixes2:->:Sorcery
  - ^flag global WeaponPrefixes2:->:Wizardry
  - ^flag global WeaponPrefixes2:->:Enlightenment
  - ^flag global WeaponPrefixes2:->:Intelligence
  - ^flag global WeaponPrefixes2:->:Omnipotence
  #Suffix complete
  #Begin suffix +Maximum Damage
  - ^flag global WeaponPrefixes3:->:-1
  - ^flag global WeaponPrefixes3:->:Craftsmanship
  - ^flag global WeaponPrefixes3:->:Quality
  - ^flag global WeaponPrefixes3:->:Maiming
  - ^flag global WeaponPrefixes3:->:Slaying
  - ^flag global WeaponPrefixes3:->:Gore
  - ^flag global WeaponPrefixes3:->:Carnage
  - ^flag global WeaponPrefixes3:->:Slaughter
  - ^flag global WeaponPrefixes3:->:Butchery
  #Suffix complete
  #Begins suffix +Dexterity
  - ^flag global WeaponPrefixes4:->:-1
  - ^flag global WeaponPrefixes4:->:Dexterity
  - ^flag global WeaponPrefixes4:->:Skill
  - ^flag global WeaponPrefixes4:->:Accuracy
  - ^flag global WeaponPrefixes4:->:Precision
  - ^flag global WeaponPrefixes4:->:Perfection
  - ^flag global WeaponPrefixes4:->:Agility
  - ^flag global WeaponPrefixes4:->:Alacrity
  - ^flag global WeaponPrefixes4:->:Nirvana
  #suffix complete
  #begin suffix +Cold damage
  - ^flag global WeaponPrefixes5:->:-1
  - ^flag global WeaponPrefixes5:->:Frost
  - ^flag global WeaponPrefixes5:->:Icicle
  - ^flag global WeaponPrefixes5:->:Glacier
  - ^flag global WeaponPrefixes5:->:Winter
  - ^flag global WeaponPrefixes5:->:Freezing
  - ^flag global "WeaponPrefixes5:->:Snowfall"
  - ^flag global "WeaponPrefixes5:->:Blizzard"
  #Suffix complete
  #begin suffix Life stolen per hit
  - ^flag global WeaponPrefixes6:->:-1
  - ^flag global WeaponPrefixes6:->:Draining
  - ^flag global WeaponPrefixes6:->:Leeching
  - ^flag global WeaponPrefixes6:->:Locust
  - ^flag global WeaponPrefixes6:->:Lamprey
  - ^flag global WeaponPrefixes6:->:Bat
  - ^flag global WeaponPrefixes6:->:Wraith
  - ^flag global WeaponPrefixes6:->:Vampire
  - ^flag global "WeaponPrefixes6:->:The Sycophant"
  - ^flag global WeaponSuffixCount:6
  - ^foreach <server.flag[WeaponSuffixes].as_list> {
       - if <def[value]> contains , || contains - {
           - ^flag global WeaponSuffixCount:++
         }
     }
  #Suffix complete
  #begin Armor Prefixes
  #begin prefix Damage enemies when struck, flat value
  #1 = armor (0 = leather boots 1 = leather leggings 2 = leather tunic 3 = leather helm 4 = iron boots 5 = iron greaves 
  #6 = iron chestplate 7 = iron helmet 8 = chainmail boots 9 = chainmail greaves 10 = chainmail chestplate 
  #11 = chainmail helmet 12 = diamond boots 13 = diamond greaves 14 = diamond chestplate 15 = diamond helmet
  - ^flag global ArmorPrefixes:!
  - ^flag global ArmorPrefixes:4,7,11,15
  - ^flag global ArmorPrefixes:->:Jagged
  - ^flag global ArmorPrefixes:->:Pointed
  - ^flag global ArmorPrefixes:->:Sharp
  - ^flag global ArmorPrefixes:->:Spiked
  - ^flag global ArmorPrefixes:->:Counterattacking
  - ^flag global ArmorPrefixes:->:Retaliating
  - ^flag global ArmorPrefixes:->:Exacting
  - ^flag global ArmorPrefixes:->:Vengeful
  #prefix complete
  #begin prefix +Percentage chance to be extinguished when damaged by fire
  #+Fire resistance from fire type mobs
  - ^flag global ArmorPrefixes:->:-1
  - ^flag global "ArmorPrefixes:->:Fire Resistant"
  - ^flag global ArmorPrefixes:->:Russet
  - ^flag global ArmorPrefixes:->:Rouge
  - ^flag global ArmorPrefixes:->:Garnet
  - ^flag global "ArmorPrefixes:->:Vermilion"
  - ^flag global ArmorPrefixes:->:Scarlet
  - ^flag global ArmorPrefixes:->:Sanguine
  - ^flag global ArmorPrefixes:->:Crimson
  #Prefix complete
  #begin prefix +lightning resist from mobs that deal lightning damage
  - ^flag global ArmorPrefixes:->:-1
  - ^flag global "ArmorPrefixes:->:Shock Resistant"
  - ^flag global ArmorPrefixes:->:Copper
  - ^flag global ArmorPrefixes:->:Bronze
  - ^flag global ArmorPrefixes:->:Insulating
  - ^flag global ArmorPrefixes:->:Tangerine
  - ^flag global ArmorPrefixes:->:Coral
  - ^flag global ArmorPrefixes:->:Amber
  - ^flag global ArmorPrefixes:->:Ochre
  #PREFIX COMPLETE
  #Begin prefix +poison resistance- when applied, reduces poison duration
  - ^flag global ArmorPrefixes:->:-1
  - ^flag global ArmorPrefixes:->:Intoxicating
  - ^flag global ArmorPrefixes:->:Olive
  - ^flag global ArmorPrefixes:->:Lime
  - ^flag global ArmorPrefixes:->:Green
  - ^flag global ArmorPrefixes:->:Beryl
  - ^flag global ArmorPrefixes:->:Viridian
  - ^flag global ArmorPrefixes:->:Jade
  - ^flag global ArmorPrefixes:->:Emerald
  #prefix complete
  #begin prefix +Resist poison, fire and lightning slightly
  - ^flag global ArmorPrefixes:->:-1
  - ^flag global ArmorPrefixes:->:Glowing
  - ^flag global ArmorPrefixes:->:Virtual
  - ^flag global ArmorPrefixes:->:Chimera&sqs
  - ^flag global ArmorPrefixes:->:Shimmering
  - ^flag global ArmorPrefixes:->:Rainbow
  - ^flag global ArmorPrefixes:->:Scintillating
  - ^flag global ArmorPrefixes:->:Prismatic
  - ^flag global ArmorPrefixes:->:Chromatic
  #prefix complete
  #begin prefix +Magic torch that follows you around (once per update tick)
  - ^flag global ArmorPrefixes:->:-1
  - ^flag global ArmorPrefixes:->:Bright
  - ^flag global ArmorPrefixes:->:Brightening
  - ^flag global ArmorPrefixes:->:Illuminating
  - ^flag global ArmorPrefixes:->:Glimmering
  - ^flag global ArmorPrefixes:->:Luminous
  - ^flag global ArmorPrefixes:->:Brilliant
  - ^flag global ArmorPrefixes:->:Dazzling
  - ^flag global ArmorPrefixes:->:Refulgent
  #prefix complete
  #begin prefix +Intelligence when calculating intelligence
  - ^flag global ArmorPrefixes:->:-1
  - ^flag global ArmorPrefixes:->:Clever
  - ^flag global ArmorPrefixes:->:Smart
  - ^flag global ArmorPrefixes:->:Astute
  - ^flag global ArmorPrefixes:->:Able
  - ^flag global ArmorPrefixes:->:Superior
  - ^flag global ArmorPrefixes:->:Intellectual
  - ^flag global ArmorPrefixes:->:Intelligent
  - ^flag global ArmorPrefixes:->:Omnipotent
  #prefix complete
  #begin prefix +Maximum Mana
  - ^flag global ArmorPrefixes:->:-1
  - ^flag global ArmorPrefixes:->:Lizard&sqs
  - ^flag global ArmorPrefixes:->:Snake&sqs
  - ^flag global ArmorPrefixes:->:Serpent&sqs
  - ^flag global ArmorPrefixes:->:Drake&sqs
  - ^flag global ArmorPrefixes:->:Dragon&sqs
  - ^flag global ArmorPrefixes:->:Wyrm&sqs
  - ^flag global "ArmorPrefixes:->:Great Wyrm&sqs"
  - ^flag global "ArmorPrefixes:->:Bahamut&sqs"
  #prefix complete
  #begin prefix +Mana per character level
  - ^flag global ArmorPrefixes:->:-1
  - ^flag global ArmorPrefixes:->:Mnemonic
  - ^flag global ArmorPrefixes:->:Mnemonic
  - ^flag global ArmorPrefixes:->:Mnemonic
  - ^flag global ArmorPrefixes:->:Mnemonic
  - ^flag global ArmorPrefixes:->:Mnemonic
  - ^flag global ArmorPrefixes:->:Mnemonic
  - ^flag global ArmorPrefixes:->:Mnemonic
  - ^flag global ArmorPrefixes:->:Mnemonic
  #prefix complete
  #begin prefix +bonus AC
  - ^flag global ArmorPrefixes:->:-1
  - ^flag global ArmorPrefixes:->:Sturdy
  - ^flag global ArmorPrefixes:->:Strong
  - ^flag global ArmorPrefixes:->:Glorious
  - ^flag global ArmorPrefixes:->:Blessed
  - ^flag global ArmorPrefixes:->:Saintly
  - ^flag global ArmorPrefixes:->:Holy
  - ^flag global ArmorPrefixes:->:Unbreaking
  - ^flag global ArmorPrefixes:->:Godly
  #prefix complete
  #begin prefix +defense (based on character level)
  - ^flag global ArmorPrefixes:->:-1
  - ^flag global ArmorPrefixes:->:Unending
  - ^flag global ArmorPrefixes:->:Unending
  - ^flag global ArmorPrefixes:->:Unending
  - ^flag global ArmorPrefixes:->:Unending
  - ^flag global ArmorPrefixes:->:Unending
  - ^flag global ArmorPrefixes:->:Unending
  - ^flag global ArmorPrefixes:->:Unending
  - ^flag global ArmorPrefixes:->:Unending
  #prefix complete
  #begin prefix +cold resist
  - ^flag global ArmorPrefixes:->:-1
  - ^flag global ArmorPrefixes:->:Comfortable
  - ^flag global ArmorPrefixes:->:Insulating
  - ^flag global ArmorPrefixes:->:Warm
  - ^flag global ArmorPrefixes:->:Arctic
  - ^flag global ArmorPrefixes:->:Azure
  - ^flag global ArmorPrefixes:->:Lapis
  - ^flag global ArmorPrefixes:->:Cobalt
  - ^flag global ArmorPrefixes:->:Sapphire
  #prefix complete
  #begin prefix +Killing enemies grants regeneration
  - ^flag global ArmorPrefixes:->:-1
  - ^flag global ArmorPrefixes:->:Triumphant
  - ^flag global ArmorPrefixes:->:Triumphant
  - ^flag global ArmorPrefixes:->:Triumphant
  - ^flag global ArmorPrefixes:->:Triumphant
  - ^flag global ArmorPrefixes:->:Victorious
  - ^flag global ArmorPrefixes:->:Victorious
  - ^flag global ArmorPrefixes:->:Victorious
  - ^flag global ArmorPrefixes:->:Victorious
  - ^flag global ArmorPrefixCount:0
  - ^foreach <server.flag[ArmorPrefixes].as_list> {
       - if <def[value]> contains , || contains - {
           - ^flag global ArmorPrefixCount:++
         }
     }
  #prefix complete
  - ^narrate "<red>Armor prefixes cleared."
  - ^flag global ArmorSuffixes:!
  - ^flag global ArmorSuffixes:-1
  - ^flag global ArmorSuffixes:->:
  - ^narrate "<red>Armor suffixes cleared."
  #Begin suffix +Strength
  - ^flag global ArmorSuffixes:->:-1
  - ^flag global ArmorSuffixes:->:Strength
  - ^flag global ArmorSuffixes:->:Might
  - ^flag global ArmorSuffixes:->:Ox
  - ^flag global ArmorSuffixes:->:Giant
  - ^flag global "ArmorSuffixes:->:The Titan"
  - ^flag global ArmorSuffixes:->:Surestrength
  - ^flag global "ArmorSuffixes:->:The Ogre"
  - ^flag global ArmorSuffixes:->:Atlas
  #Suffix complete
  #Begin suffix +Intelligence
  - ^flag global ArmorSuffixes:->:-1
  - ^flag global ArmorSuffixes:->:Energy
  - ^flag global ArmorSuffixes:->:Mind
  - ^flag global ArmorSuffixes:->:Brilliance
  - ^flag global ArmorSuffixes:->:Sorcery
  - ^flag global ArmorSuffixes:->:Wizardry
  - ^flag global ArmorSuffixes:->:Enlightenment
  - ^flag global ArmorSuffixes:->:Intelligence
  - ^flag global ArmorSuffixes:->:Omnipotence
  #Suffix complete
  #Begin suffix +Maximum Damage
  - ^flag global ArmorSuffixes:->:-1
  - ^flag global ArmorSuffixes:->:Craftsmanship
  - ^flag global ArmorSuffixes:->:Quality
  - ^flag global ArmorSuffixes:->:Maiming
  - ^flag global ArmorSuffixes:->:Slaying
  - ^flag global ArmorSuffixes:->:Gore
  - ^flag global ArmorSuffixes:->:Carnage
  - ^flag global ArmorSuffixes:->:Slaughter
  - ^flag global ArmorSuffixes:->:Butchery
  #Suffix complete
  #Begins suffix +Dexterity
  - ^flag global ArmorSuffixes:->:-1
  - ^flag global ArmorSuffixes:->:Dexterity
  - ^flag global ArmorSuffixes:->:Skill
  - ^flag global ArmorSuffixes:->:Accuracy
  - ^flag global ArmorSuffixes:->:Precision
  - ^flag global ArmorSuffixes:->:Perfection
  - ^flag global ArmorSuffixes:->:Agility
  - ^flag global ArmorSuffixes:->:Alacrity
  - ^flag global ArmorSuffixes:->:Nirvana
  #suffix complete
  #begin suffix +Cold damage
  - ^flag global ArmorSuffixes:->:-1
  - ^flag global ArmorSuffixes:->:Frost
  - ^flag global ArmorSuffixes:->:Icicle
  - ^flag global ArmorSuffixes:->:Glacier
  - ^flag global ArmorSuffixes:->:Winter
  - ^flag global ArmorSuffixes:->:Freezing
  - ^flag global "ArmorSuffixes:->:Snowfall"
  - ^flag global "ArmorSuffixes:->:Blizzard"
  #Suffix complete
  #begin suffix Life stolen per hit
  - ^flag global ArmorSuffixes:->:-1
  - ^flag global ArmorSuffixes:->:Draining
  - ^flag global ArmorSuffixes:->:Leeching
  - ^flag global ArmorSuffixes:->:Locust
  - ^flag global ArmorSuffixes:->:Lamprey
  - ^flag global ArmorSuffixes:->:Bat
  - ^flag global ArmorSuffixes:->:Wraith
  - ^flag global ArmorSuffixes:->:Vampire
  - ^flag global "ArmorSuffixes:->:The Sycophant"
  - ^flag global ArmorSuffixCount:0
  - ^foreach <server.flag[ArmorSuffixes].as_list> {
       - if <def[value]> contains , || contains - {
           - ^flag global ArmorSuffixCount:++
         }
     }
#Returns a number between 1 and 10000.
#At 10K, items always drop, and at 1, they are least likely to drop.
#Bonus Fire Damage (Prefix)
#Subprefixes Smoking, Smoldering, Burning, Searing, Red-Hot, Scalding, Thermal, Incinerating
#Bonus Fire Damage (Suffix)
#Subprefixes [Of] Ash, Embers, Slag, Flames, Brand, Firebrand, Melting, Hellfire
ShouldItemDrop:
  type: procedure 
  definitions: level|playerLevel
  script:
  - ^define base 100
  - ^define levelModifier <def[level].power[2]>
  - ^define playerLevelModifier <def[playerLevel].power[2]>
  - ^define sum <def[levelModifier].add[<def[playerLevelModifier]>]>
  - ^define chance <def[base].mul[<def[sum].sqrt>].asint>
  - ^if <util.random.int[1].to[10000]> <= <def[chance]> {
       - determine true
     }
  - ^if <util.random.int[1].to[10000]> > <def[chance]> {
       - determine false
     }
ItemTier:
  type: procedure 
  definitions: level
  script:
  - ^if <def[level]> < 15 {
       - determine 1
     }
  - ^if <def[level]> >= 15 && <def[level]> < 25 {
       - determine 2
     }
  - ^if <def[level]> >= 25 && <def[level]> <= 28 {
       - determine 3
     }
  - ^if <def[level]> > 28 && <def[level]> < 40 {
       - determine 4
     }
  - ^if <def[level]> >= 40 && <def[level]> < 55 {
       - determine 5
     }
  - ^if <def[level]> >= 55 && <def[level]> < 70 {
       - determine 6
     }
  - ^if <def[level]> >= 70 && <def[level]> < 90 {
       - determine 7
     }
  - ^if <def[level]> >= 90 {
       - determine 8
     }
#Returns a value from 0 to 2, and depending on those values picks what the subtype should be.
#psuedo;
#as level increases, the tier of an item becomes progressively higher. At high enough levels, new item types begin to drop.
RandomizeItemType:
  type: procedure 
  definitions: level|playerLevel
  script:
  - ^if <def[level]> < 15 {
       - determine 0
     }
  - ^if <def[level]> > 15 && <def[level]> < 22 {
       - random 3
       - determine 0
       - determine 0
       - determine 1
     }
  - ^if <def[level]> > 22 {
       - random 10
       - determine 0
       - determine 0
       - determine 0
       - determine 0
       - determine 3
       - determine 1
       - determine 1
       - determine 1
       - determine 1
       - determine 1
     }
GetNameByTier:
  type: procedure
  definitions: tier
  script:
  - ^if %tier% == 0 determine null
  - ^if %tier% == 1 determine Crude
  - ^if %tier% == 1 determine "Low Quality"
  - ^if %tier% == 1 determine "Common"
  - ^if %tier% == 1 determine "Well Crafted"
  - ^if %tier% == 1 determine "Flawless"
  - ^if %tier% == 1 determine "Masterwork"
  - ^if %tier% == 1 determine "Perfect"
  - ^if %tier% == 1 determine "Primogenitor"
GeneratePrefix:
  type: procedure
  definitions: itemClass|subItem|prefixSelection
  script:
  - ^while true {
       - ^define prefixFlag <server.flag[<def[itemClass]>Prefixes<def[prefixSelection]>].as_list>
       - ^narrate "<red>%prefixFlag% tier <blue> %tier% <green>selection %prefixSelection%"
       - ^narrate "<red><def[prefixFlag].get[<def[tier].add[1].asint>]>"
       - ^define prefix "<def[prefixFlag].get[<def[tier].add[1].asint>]>"
       - narrate "<red>This is either the first loop or the generation failed."
       - if !<def[prefixFlag].get[1].replace[,].with[|].as_list> contains <def[subItem]> {
           - while stop
         }
     }
  - determine %prefix%
GenerateSuffix:
  type: procedure
  definitions: itemClass|subItem|SuffixSelection
  script:
  - ^while true {
       - ^define SuffixFlag <server.flag[<def[itemClass]>Suffixes<def[SuffixSelection]>].as_list>
       - ^narrate "<red>%SuffixFlag% tier <blue> %tier% <green>selection %SuffixSelection%"
       - ^narrate "<red><def[SuffixFlag].get[<def[tier].add[1].asint>]>"
       - ^define "Suffix <def[SuffixFlag].get[<def[tier].add[1].asint>]>"
       - narrate "<red>This is either the first loop or the generation failed."
       - if !<def[SuffixFlag].get[1].replace[,].with[|].as_list> contains <def[subItem]> {
           - while stop
         }
     }
  - determine %Suffix%    
#Now we know what tier the weapon or armor is. Now to randomize the item type and subitem type..
#Psuedo-enum;
#0 = weapon (0 = club 1 = spear 2 = mace 3 = sword 4 = naginata 5 = knife 6 = wand 7 = shrunken head 8 = bow 9 = staff)
#1 = armor (0 = leather boots 1 = leather leggings 2 = leather tunic 3 = leather helm 4 = iron boots 5 = iron greaves 6 = iron chestplate 7 = iron helmet 8 = chainmail boots 9 = chainmail greaves 10 = chainmail chestplate 11 = chainmail helmet 12 = diamond boots 13 = diamond greaves 14 = diamond chestplate 15 = diamond helmet
#2 = charm/jewelry (0 = amulet 1 = small charm 2 = ring 3)
#okay, so after we know that, we need to decide if the item is rare to that.
#Rare chance = (mob level) / 2 - 10 brought up to 1% if less
#Rare items always drop with 1 tier higher than the tier that should drop, have a unique name (chosen from a huge list)
#Data regarding the prefix information is stored in the fourth line of lore, in black.
#The weapon/armor type is designated by the material, and the tier is designated already in the third line of lore.
#The fourth line of lore stores the prefix data in this format: prefix,prefixlevel;suffix,suffixlevel
#Prefixes and suffixes have tiers, too. It matches the tier of the weapon.
#Example;
#Bonus Fire Damage (Prefix)
#Subprefixes Smoking, Smoldering, Burning, Searing, Red-Hot, Scalding, Thermal, Incinerating
#Bonus Fire Damage (Suffix)
#Subprefixes [Of] Ash, Embers, Slag, Flames, Brand, Firebrand, Melting, Hellfire
#list is defined like this,
#li@Smoking|Smoldering|Burning|Searing|Red-Hot|Scalding|Thermal|Incinerating
#First it picks a random base prefix. Then, the position in the array should be (8 * picked) and the offset should be the tier. 
GenerateItem:
  type: task
  definitions: location|player
  script:
  - ^narrate "<red>Script ran."
  - ^define level <proc[MobLevel].context[%location%]>
  - ^if !<proc[ShouldItemDrop].context[%level%|%player%]> {
       - narrate "<red>Item should have failed to drop. Disabled for debug."
     }
  - ^if <util.random.int[1].to[100]> > 0 {
       - define doPrefix true
     } else {
       - define doPrefix false
     }
  - ^if <util.random.int[1].to[100]> > 50 && <def[doPrefix]> {
       - ^define doSuffix true
     } else {
       - ^define doSuffix false
     }
  - ^if <util.random.int[1].to[100]> > 50 && !<def[doPrefix]> {
       - ^define doSuffix true
     } else {
       - ^define doSuffix false
     }
  #Get the prefix.
  - ^define tier <proc[ItemTier].context[%level%]>
  - ^define tier 1
  - ^define itemType <proc[RandomizeItemType].context[%level%|<player[%player%].flag[Level]>]>
  - ^if <def[itemType]> == 0 define itemClass Weapon
  - ^if <def[itemType]> == 1 define itemClass Armor
  - ^if <def[itemType]> == 2 define itemClass Weapon
  - ^if <def[itemClass]> == Weapon {
       - define itemSubClass <util.random.int[0].to[9]>
       - define itemMaterialList li@m@wooden_sword|m@stone_sword|m@gold_sword|m@iron_sword|m@diamond_sword|m@shears|m@blaze_rod|m@skull|m@stick|m@bow
       - define material <def[itemMaterialList].as_list.get[<def[itemSubClass].add[1]>]>
       - define itemDisplayName "li@Club|Spear|Mace|Sword|Naginata|Knife|Wand|Shrunken Head|Bow|Staff"
       - define displayname <def[itemDisplayName].get[<def[itemSubClass].add[1]>]>
     }
  - ^if <def[itemClass]> == Armor {
       - define itemSubClass <util.random.int[0].to[15]>
       - define itemMaterialList li@m@leather_boots|m@leather_leggings|m@leather_chestplate|m@leather_helmet|m@iron_boots|m@iron_leggings|m@iron_chestplate|m@iron_helmet|m@chainmail_boots|m@chainmail_leggings|m@chainmail_Helmet|m@diamond_boots|m@diamond_leggings|m@diamond_chestplate|m@diamond_helmet
       - define material <def[itemMaterialList].as_list.get[<util.random.int[0].to[15].add[1]>]>
       - define itemDisplayName "li@Leather Boots|Leather Leggings|Leather Tunic|Leather Helm|Iron Boots|Iron Greaves|Iron Curiass|Iron Helmet|Chainmail Treads|Chainmail Greaves|Chainmail Breastplate|Chainmail Helmet|Diamond Boots|Diamond Greaves|Diamond Curiass|Diamond Helmet"
       - define displayName <def[itemDisplayName].get[<def[itemSubClass].add[1]>]>
     }
  - ^if <def[doPrefix]> {
      - define prefixSelection <util.random.int[0].to[<server.flag[<def[itemClass]>PrefixCount].asint>]>
      - define prefix <proc[GeneratePrefix].context[<def[itemClass]>|<def[subItem]>|<def[prefixSelection]>]>
     }
  - ^if <def[doSuffix]> {
      - define SuffixSelection <util.random.int[0].to[<server.flag[<def[itemClass]>SuffixCount].asint>]>
      - define Suffix <proc[GenerateSuffix].context[<def[itemClass]>|<def[subItem]>|<def[prefixSelection]>]>
     }
  - ^if <def[prefix]> == null define prefix " "
  - ^if <def[suffix]> == null define suffix " "
  - define loreLineOne "This item was looted from a level <def[level].asint> monster."
  - define loreLineTwo " "
  - adjust <def[material]> "display_name:<yellow>Crude <def[displayname]>" save:alteredName
  - adjust <entry[altered].result> "lore:%lorelineone%|%lorelinetwo%|<yellow>Tier 1" save:alteredlore
  - give <entry[alteredlore].result>