Date: 2014/01/05 17:36:32 UTC-08:00
Type: Denizen Script
NPCLoot:
type: assignment
actions:
on damage:
- if !<npc.flag[attackers].as_list.contains[<player>]> flag <npc> attackers:->:<player>
on death:
- foreach <npc.flag[attackers].aslist> {
- give xp qty:10
- if <util.random.int[0].to[100]> < 101 {
- define item 'i@<proc[determine loot]>' player:%value%
- if %item% != i@null {
- give player:%value% %item%
- narrate player:%value% "<green>You receive (<white><%item%.qty><green>) <%item%.material.bukkit_enum.to_lowercase><green>."
}
}
}
- flag <npc> attackers:!
"Determine Loot":
type: procedure
script:
- define roll <util.random.int[1].to[100]>
- narrate %roll%
- if %roll% >= 0 && %roll% <= 35 define quality "Common"
lse if %roll% >= 36 && %roll% <= 51 define quality "Uncommon"
else if %roll% >= 52 && %roll% <= 57 define quality "Rare"
else if %roll% >= 58 && %roll% <= 100 define quality "Nothing"
- if %quality% == Common
determine "<li@stick[quantity=<util.random.int[1].to[4]>]|Coal[quantity=<util.random.int[1].to[6]>]|torch[quantity=<util.random.int[1].to[6]>].random>"
else if %quality% == Uncommon
determine "<li@iron_ingot[quantity=<util.random.int[1].to[6]>]|gold_ingot[quantity=<util.random.int[1].to[6]>]|iron_sword|iron_spade|iron_pickaxe|diamond.random>"
else if %quality% == Rare
determine "<li@diamond[quantity=<util.random.int[3].to[6]>]|Diamond_Sword|Diamond_Spade|Diamond_Pickaxe.random>"
else if %quality% == Nothing
determine "null"