Skip to content

Commit 76181df

Browse files
committed
Merge remote-tracking branch 'origin/master' into beta
2 parents c6f765a + 39b5ca0 commit 76181df

File tree

1 file changed

+182
-0
lines changed
  • modules/mods/scriptrunner/src/dist/scriptrunner/imports

1 file changed

+182
-0
lines changed
Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,182 @@
1+
function ActionBehaviourParameters(a) {
2+
function log(message) {
3+
java.util.logging.Logger.getLogger('script.actions').info(message && message.toString() || 'null');
4+
}
5+
6+
this.args = [].slice.call(a);
7+
log(this.args);
8+
}
9+
10+
ActionBehaviourParameters.prototype.getTile = function() {
11+
var args = this.args;
12+
var types = this.types;
13+
14+
if (args.length === 4 && types[0] === 'number' && types[1] === 'number' && types[2] === 'boolean' && types[3] === 'number') {
15+
// Behaviour on tile
16+
return {
17+
tilex : args[0],
18+
tiley : args[1],
19+
onSurface : args[2],
20+
tile : args[3]
21+
};
22+
} else if (args.length === 5 && types[0] === 'number' && types[1] === 'number' && types[2] === 'boolean' && types[3] === 'number' && types[4] === 'number') {
23+
// Behaviour on a corner of a tile
24+
return {
25+
tilex : args[0],
26+
tiley : args[1],
27+
onSurface : args[2],
28+
tile : args[3],
29+
dir : args[4]
30+
};
31+
}
32+
}
33+
34+
ActionBehaviourParameters.prototype.getItem = function() {
35+
var args = this.args;
36+
var types = this.types;
37+
38+
if (args.length === 1 && args[0] instanceof com.wurmonline.server.items.Item) {
39+
return {
40+
item : args[0]
41+
};
42+
}
43+
}
44+
45+
ActionBehaviourParameters.prototype.getWound = function() {
46+
var args = this.args;
47+
var types = this.types;
48+
49+
if (args.length === 1 && args[0] instanceof com.wurmonline.server.bodys.Wound) {
50+
return {
51+
wound : args[0]
52+
};
53+
}
54+
}
55+
56+
ActionBehaviourParameters.prototype.getCreature = function() {
57+
var args = this.args;
58+
var types = this.types;
59+
60+
if (args.length === 1 && args[0] instanceof com.wurmonline.server.creatures.Creature) {
61+
return {
62+
creature : args[0]
63+
};
64+
}
65+
}
66+
67+
ActionBehaviourParameters.prototype.getWall = function() {
68+
var args = this.args;
69+
var types = this.types;
70+
71+
if (args.length === 1 && args[0] instanceof com.wurmonline.server.structures.Wall) {
72+
return {
73+
wall : args[0]
74+
};
75+
}
76+
}
77+
78+
ActionBehaviourParameters.prototype.getFence = function() {
79+
var args = this.args;
80+
var types = this.types;
81+
82+
if (args.length === 1 && args[0] instanceof com.wurmonline.server.structures.Fence) {
83+
return {
84+
fence : args[0]
85+
};
86+
}
87+
}
88+
89+
ActionBehaviourParameters.prototype.getFloor = function() {
90+
var args = this.args;
91+
var types = this.types;
92+
93+
if (args.length === 2 && types[0] === 'boolean' && args[1] instanceof com.wurmonline.server.structures.Floor) {
94+
return {
95+
onSurface : args[0],
96+
floor : args[1]
97+
};
98+
}
99+
}
100+
101+
ActionBehaviourParameters.prototype.getBridgePart = function() {
102+
var args = this.args;
103+
var types = this.types;
104+
105+
if (args.length === 2 && types[0] === 'boolean' && args[1] instanceof com.wurmonline.server.structures.BridgePart) {
106+
return {
107+
onSurface : args[0],
108+
bridgePart : args[1]
109+
};
110+
}
111+
}
112+
113+
ActionBehaviourParameters.prototype.getBorder = function() {
114+
var args = this.args;
115+
var types = this.types;
116+
117+
if (args.length === 6 && types[0] === 'number' && types[1] === 'number' && types[2] === 'boolean' && args[3] instanceof com.wurmonline.mesh.Tiles.TileBorderDirection && types[4] === 'boolean' && types[5] === 'number') {
118+
return {
119+
tilex : args[0],
120+
tiley : args[1],
121+
onSurface : args[2],
122+
dir : args[3],
123+
border : args[4],
124+
heightOffset : args[5]
125+
};
126+
}
127+
}
128+
129+
ActionBehaviourParameters.prototype.getPlanet = function() {
130+
var args = this.args;
131+
var types = this.types;
132+
133+
if (args.length === 1 && types[0] === 'number') {
134+
return {
135+
planet : args[0]
136+
};
137+
}
138+
}
139+
140+
function BehaviourParameters(a) {
141+
ActionBehaviourParameters.call(this, a);
142+
143+
function log(message) {
144+
java.util.logging.Logger.getLogger('script.actions.behaviour').info(message && message.toString() || 'null');
145+
}
146+
147+
var args = this.args;
148+
this.performer = args.shift();
149+
150+
if (args.length && args[0] instanceof com.wurmonline.server.items.Item && args.length > 1) {
151+
this.activeItem = args.shift();
152+
}
153+
154+
this.types = args.map(function(arg) { return typeof arg; });
155+
log(this.types);
156+
}
157+
BehaviourParameters.prototype = Object.create(ActionBehaviourParameters.prototype);
158+
BehaviourParameters.prototype.constructor = BehaviourParameters;
159+
160+
function ActionParameters(a) {
161+
ActionBehaviourParameters.call(this, a);
162+
163+
function log(message) {
164+
java.util.logging.Logger.getLogger('script.actions.action').info(message && message.toString() || 'null');
165+
}
166+
167+
var args = this.args;
168+
this.action = args.shift();
169+
this.performer = args.shift();
170+
this.counter = args.pop();
171+
this.num = args.pop();
172+
173+
if (args.length && args[0] instanceof com.wurmonline.server.items.Item && args.length > 1) {
174+
this.activeItem = args.shift();
175+
}
176+
177+
this.types = args.map(function(arg) { return typeof arg; });
178+
log(this.types);
179+
}
180+
ActionParameters.prototype = Object.create(ActionBehaviourParameters.prototype);
181+
ActionParameters.prototype.constructor = ActionParameters;
182+

0 commit comments

Comments
 (0)