Date: 2014/04/04 19:06:32 UTC-07:00
Type: Denizen Script
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
"Stonefellow":
type: assignment
default constants:
durability_multiplier: 5
enchantment_multiplier: 500
interact scripts:
- 10 SmithCheck
actions:
on assignment:
- trigger name:chat toggle:true
- trigger name:click toggle:true
- trigger name:proximity toggle:true radius:2
on enter proximity:
- chat "<white>Hello<&cm> <player.name>. What can I do for you?"
- narrate "<white> - I<&sq>d like an item <gold>repaired<white>."
- narrate "<white> - I<&sq>d like to <gold>buy <white>smithing supplies"
- narrate "<white> - I<&sq>d like to become a <gold>smith<white>."
- if <p@player.jobs[<blacksmith>]> == null {
- narrate "<white> - I<&sq>d like to become a <gold>smith<white>."
}
- narrate "<player.item_in_hand.durability>"
on exit proximity:
- zap 's@SmithCheck' step:default
"SmithCheck":
type: interact
steps:
default:
chat trigger:
'Repair':
trigger: "I<&sq>d like the have this /repair/ed."
script:
- chat "<white>Hmmm<&cm> let<&sq>s see..."
- wait 1s
- if <player.item_in_hand.repairable> == true {
- inject s@CalcCost instantly
} else {
- chat "<white>Sorry<&cm> but I'm afraid I can<&sq>t repair that."
}
- if %repair_cost% > 0 {
- chat "<white>Yeah<&cm> I can fix that. It<&sq>ll cost <gold><%repair_cost%> <white>coins to repair<&cm> though."
- narrate "<gold>Yes <white>or <gold>No"
- narrate ""
- zap repair
} else {
- chat "<white>Your item looks fine to me!"
}
'Job':
trigger: "I'd like to become a /smith/."
script:
- chat "<white>Great<&cm> we always need more smiths<white>. Would you like to join our brotherhood?"
- narrate "<gold>Yes <white>or <gold>No"
- zap job
job:
chat trigger:
'Yes':
trigger: "/Yes/<&cm> I would."
script:
- chat "<white>Great!"
- jobs join blacksmith
- chat "<white>Welcome to the brotherhood!"
'No':
trigger: "/No/<&cm> sorry."
script:
- chat "<white>Oh well. I<&sq>m sure you<&sq>ll find something that fits."
repair:
chat trigger:
'Yes':
trigger: "/Yes/<&cm> repair it."
script:
- if <player.money> OR_MORE <%repair_cost%> {
- adjust <player.item_in_hand> durability:0 save:newitem
- take iteminhand
- playsound <player.location> sound:anvil_use
- wait 3s
- playsound <player.location> sound:anvil_use
- wait 3s
- playsound <player.location> sound:anvil_use
- wait 3s
- take money qty:<%repair_cost%>
- give <entry[newitem].result>
- chat "<white>Here you go! Come back if you need anymore repairs."
- zap default
} else {
- chat "<white>Hey<&cm> you don't have enough money! Come back when you can afford it..."
- zap default
}
'No':
trigger: "/No/<&cm> I don<&sq>t want to repair it."
script:
- chat "<white>Well... alright. Come back if you change your mind."
"CalcCost":
type: task
script:
- define durability_cost 0
- define enchantment_levels 0
- define enchantment_cost 0
- define repair_cost 0
- if <player.item_in_hand.durability> > 0 {
- define durability_cost <player.item_in_hand.durability.mul[<s@script.constant[durability_multiplier]>]>
- narrate "Durability Cost %durability_cost%"
- if <player.item_in_hand.enchantments> != null {
- foreach <player.item_in_hand.enchantments.levels> {
- define enchantment_levels <def[enchantment_levels].add[%value%]>
- narrate "Enchantment level %enchantment_levels%"
}
- define enchantment_levels <def[enchantment_levels].mul[<s@script.constant[enchantment_multiplier]>]>
- narrate "Enchantment Cost %enchantment_levels%"
}
}
- define repair_cost <def[repair_cost].add[%durability_cost%].add[%enchantment_cost%]>
- narrate "Repair Cost %repair_cost%"