-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathStruct Spell Book Of Smith Craft.j
More file actions
184 lines (146 loc) · 7.19 KB
/
Copy pathStruct Spell Book Of Smith Craft.j
File metadata and controls
184 lines (146 loc) · 7.19 KB
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
library StructSpellsSpellBookOfSmithCraft requires StructSpellsSpellBookCraftingSpell
struct SpellBookOfSmithCraftIron extends SpellBookCraftingSpell
public static constant integer abilityId = 'A1BD'
private method condition takes nothing returns boolean
if (this.character().inventory().hasItemType('I05Y')) then
debug call Print("Success")
return true
endif
debug call Print("Fail")
call this.character().displayMessage(ACharacter.messageTypeError, tre("Benötigte Rohstoffe fehlen.", "Required resources are missing."))
return false
endmethod
private method action takes nothing returns nothing
call this.character().inventory().removeItemType('I05Y')
call Character(this.character()).displayItemAcquired(GetObjectName('I05Z'), tre("Hergestellt.", "Crafted."))
call Character(this.character()).giveItem('I05Z')
call Character(this.character()).craftItem('I05Z')
endmethod
public static method create takes Character character returns thistype
return thistype.allocate(character, thistype.abilityId, thistype.condition, thistype.action)
endmethod
endstruct
struct SpellBookOfSmithCraftAxe extends SpellBookCraftingSpell
public static constant integer abilityId = 'A1R2'
public static constant integer itemTypeId = 'I00Q'
private method condition takes nothing returns boolean
if (this.character().inventory().totalItemTypeCharges('I05Z') >= 1 and this.character().inventory().totalItemTypeCharges('I02P') >= 1) then
debug call Print("Success")
return true
endif
debug call Print("Fail")
call this.character().displayMessage(ACharacter.messageTypeError, tre("Benötigte Rohstoffe fehlen.", "Required resources are missing."))
return false
endmethod
private method action takes nothing returns nothing
call this.character().inventory().removeItemType('I05Z')
call this.character().inventory().removeItemType('I02P')
call Character(this.character()).displayItemAcquired(GetObjectName(thistype.itemTypeId), tre("Hergestellt.", "Crafted."))
call Character(this.character()).giveItem(thistype.itemTypeId)
call Character(this.character()).craftItem(thistype.itemTypeId)
endmethod
public static method create takes Character character returns thistype
return thistype.allocate(character, thistype.abilityId, thistype.condition, thistype.action)
endmethod
endstruct
struct SpellBookOfSmithCraftShortSword extends SpellBookCraftingSpell
public static constant integer abilityId = 'A1BC'
private method condition takes nothing returns boolean
if (this.character().inventory().totalItemTypeCharges('I05Z') >= 2) then
debug call Print("Success")
return true
endif
debug call Print("Fail")
call this.character().displayMessage(ACharacter.messageTypeError, tre("Benötigte Rohstoffe fehlen.", "Required resources are missing."))
return false
endmethod
private method action takes nothing returns nothing
call this.character().inventory().removeItemType('I05Z')
call this.character().inventory().removeItemType('I05Z')
call Character(this.character()).displayItemAcquired(GetObjectName('I01Y'), tre("Hergestellt.", "Crafted."))
call Character(this.character()).giveItem('I01Y')
call Character(this.character()).craftItem('I01Y')
endmethod
public static method create takes Character character returns thistype
return thistype.allocate(character, thistype.abilityId, thistype.condition, thistype.action)
endmethod
endstruct
struct SpellBookOfSmithCraftLongSword extends SpellBookCraftingSpell
public static constant integer abilityId = 'A1C2'
private method condition takes nothing returns boolean
if (this.character().inventory().totalItemTypeCharges('I05Z') >= 4) then
debug call Print("Success")
return true
endif
debug call Print("Fail")
call this.character().displayMessage(ACharacter.messageTypeError, tre("Benötigte Rohstoffe fehlen.", "Required resources are missing."))
return false
endmethod
private method action takes nothing returns nothing
call this.character().inventory().removeItemType('I05Z')
call this.character().inventory().removeItemType('I05Z')
call this.character().inventory().removeItemType('I05Z')
call this.character().inventory().removeItemType('I05Z')
call Character(this.character()).displayItemAcquired(GetObjectName('I012'), tre("Hergestellt.", "Crafted."))
call Character(this.character()).giveItem('I012')
call Character(this.character()).craftItem('I012')
endmethod
public static method create takes Character character returns thistype
return thistype.allocate(character, thistype.abilityId, thistype.condition, thistype.action)
endmethod
endstruct
struct SpellBookOfSmithIronHelmet extends SpellBookCraftingSpell
public static constant integer abilityId = 'A1R3'
public static constant integer itemTypeId = 'I02E'
private method condition takes nothing returns boolean
if (this.character().inventory().totalItemTypeCharges('I05Z') >= 3) then
debug call Print("Success")
return true
endif
debug call Print("Fail")
call this.character().displayMessage(ACharacter.messageTypeError, tre("Benötigte Rohstoffe fehlen.", "Required resources are missing."))
return false
endmethod
private method action takes nothing returns nothing
call this.character().inventory().removeItemType('I05Z')
call this.character().inventory().removeItemType('I05Z')
call this.character().inventory().removeItemType('I05Z')
call Character(this.character()).displayItemAcquired(GetObjectName(thistype.itemTypeId), tre("Hergestellt.", "Crafted."))
call Character(this.character()).giveItem(thistype.itemTypeId)
call Character(this.character()).craftItem(thistype.itemTypeId)
endmethod
public static method create takes Character character returns thistype
return thistype.allocate(character, thistype.abilityId, thistype.condition, thistype.action)
endmethod
endstruct
struct SpellBookOfSmithCraftEinarsSword extends SpellBookCraftingSpell
public static constant integer abilityId = 'A1R1'
private method condition takes nothing returns boolean
if (this.character().inventory().totalItemTypeCharges('I05Z') >= 2) then
debug call Print("Success")
return true
endif
debug call Print("Fail")
call this.character().displayMessage(ACharacter.messageTypeError, tre("Benötigte Rohstoffe fehlen.", "Required resources are missing."))
return false
endmethod
private method action takes nothing returns nothing
call this.character().inventory().removeItemType('I05Z')
call this.character().inventory().removeItemType('I05Z')
call Character(this.character()).displayItemAcquired(GetObjectName('I060'), tre("Hergestellt.", "Crafted."))
call Character(this.character()).giveItem('I060')
call Character(this.character()).craftItem('I060')
endmethod
public static method create takes Character character returns thistype
return thistype.allocate(character, thistype.abilityId, thistype.condition, thistype.action)
endmethod
private static method onInit takes nothing returns nothing
local integer i = 0
loop
exitwhen (i == MapSettings.maxPlayers())
call SetPlayerAbilityAvailable(Player(i), thistype.abilityId, false)
set i = i + 1
endloop
endmethod
endstruct
endlibrary