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
|
/* */ package NET.worlds.scape;
/* */
/* */ import NET.worlds.console.Console;
/* */ import NET.worlds.console.Main;
/* */ import NET.worlds.core.IniFile;
/* */ import NET.worlds.core.ServerTableManager;
/* */ import NET.worlds.network.ObjID;
/* */ import NET.worlds.network.URL;
/* */ import NET.worlds.network.WorldServer;
/* */ import java.io.IOException;
/* */ import java.io.PrintStream;
/* */ import java.util.Enumeration;
/* */ import java.util.Hashtable;
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public class HoloDrone
/* */ extends Drone
/* */ implements HoloCallback
/* */ {
/* */ private WObject _avatar;
/* 59 */ private WObject _realAvatar = null;
/* */
/* */
/* 62 */ private boolean _isConstructing = false;
/* */
/* */
/* */
/* */
/* 67 */ private Hologram _proxyHCnewImage = null;
/* 68 */ private boolean _proxyHCok = false;
/* */
/* */
/* */
/* */
/* */
/* */ private static int _debugLevel;
/* */
/* */
/* */
/* */
/* 79 */ private boolean permitAnyAvatar = IniFile.gamma().getIniInt(
/* 80 */ "permitAnyAvatar", 0) != 0;
/* */
/* */
/* */ private static String[] permittedList;
/* */
/* */
/* */ private static String[] humanList;
/* */
/* */ private static Hashtable<String, Object> permittedHash;
/* */
/* */ private static Hashtable<String, String> humanHash;
/* */
/* */
/* */ public HoloDrone(ObjID objID, WorldServer serv)
/* */ {
/* 95 */ super(objID, serv);
/* */
/* 97 */ assert (Main.isMainThread());
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* 105 */ if (this._proxyHCnewImage != null) {
/* 106 */ holoCallback(this._proxyHCnewImage, this._proxyHCok);
/* 107 */ this._proxyHCnewImage = null;
/* */ }
/* */ }
/* */
/* */ static
/* */ {
/* 73 */ _debugLevel = IniFile.gamma().getIniInt("dronedebug", 0);
/* 74 */ if (_debugLevel > 0) {
/* 75 */ System.out.println("DRONE DEBUGGING LEVEL = " + _debugLevel);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* 116 */ permittedList =
/* 117 */ ServerTableManager.instance().getTable("permittedHoloList");
/* */
/* 119 */ humanList =
/* 120 */ ServerTableManager.instance().getTable("humanHoloList");
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* 128 */ permittedHash = new Hashtable();
/* 129 */ humanHash = new Hashtable();
/* */
/* */
/* 132 */ for (int i = 0; i < permittedList.length; i += 2) {
/* 133 */ if (permittedList[(i + 1)] != null) {
/* 134 */ permittedHash.put(permittedList[i], permittedList[(i + 1)]);
/* */ } else {
/* 136 */ permittedHash.put(permittedList[i], permittedList);
/* */ }
/* */ }
/* 139 */ for (int i = 0; i < humanList.length; i++)
/* 140 */ humanHash.put(humanList[i], humanList[i]);
/* */ }
/* */
/* */ public static String[] getPermittedList() {
/* 144 */ String[] result = new String[permittedList.length / 2];
/* */
/* 146 */ for (int i = 0; i < result.length; i++) {
/* 147 */ result[i] = permittedList[(2 * i)];
/* */ }
/* 149 */ return result;
/* */ }
/* */
/* */
/* */
/* */
/* */ static URL permission(URL url)
/* */ {
/* 157 */ String name = url.getAbsolute().toLowerCase();
/* 158 */ if ((!name.startsWith("avatar:")) || (!name.endsWith(".mov"))) {
/* 159 */ return null;
/* */ }
/* 161 */ name = name.substring(7, name.length() - 4);
/* 162 */ Object newName = permittedHash.get(name);
/* 163 */ if (newName == null) {
/* 164 */ return null;
/* */ }
/* 166 */ if ((newName instanceof String)) {
/* 167 */ return URL.make((String)newName);
/* */ }
/* 169 */ return url;
/* */ }
/* */
/* */
/* */ public static URL getHuman(URL url)
/* */ {
/* 175 */ if (!url.endsWith(".mov")) {
/* 176 */ return PosableShape.getHuman(url);
/* */ }
/* 178 */ if (permission(url) == null) {
/* 179 */ return URL.make("avatar:holden.mov");
/* */ }
/* */
/* */
/* 183 */ String s = url.getAbsolute().toLowerCase();
/* 184 */ int len = s.length();
/* 185 */ for (int i = 7; i < len; i++) {
/* 186 */ if ("0123456789.".indexOf(s.charAt(i)) >= 0) {
/* 187 */ if (humanHash.get(s.substring(7, i)) != null)
/* 188 */ return url;
/* 189 */ return URL.make(IniFile.override().getIniString(
/* 190 */ "defaultHumanAv", "avatar:holden.mov"));
/* */ }
/* */ }
/* 193 */ return url;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */ public Drone setAvatarNow(URL url)
/* */ {
/* 202 */ if ((!shouldBeMuted()) && (url.endsWith(".mov")))
/* */ {
/* */
/* 205 */ if (shouldBeForcedHuman()) {
/* 206 */ url = getHuman(url);
/* */ }
/* 208 */ url = PosableShape.getPermitted(url, getWorld());
/* */
/* 210 */ if (url.equals(getSourceURL()))
/* 211 */ return this;
/* 212 */ setSourceURL(url);
/* */
/* 214 */ URL replacementURL = permission(url);
/* 215 */ if (replacementURL != null) {
/* 216 */ url = replacementURL;
/* 217 */ } else if (!this.permitAnyAvatar) {
/* 218 */ url = Console.getDefaultURL();
/* */ }
/* */
/* */
/* 222 */ this._realAvatar = makeAvatar(url);
/* */
/* */
/* 225 */ if (this._proxyHCnewImage != null)
/* */ {
/* 227 */ if ((_debugLevel & 0x1) > 0) {
/* 228 */ System.out.println("Holo.stAvNow(" + url +
/* 229 */ "): doing proxy");
/* */ }
/* 231 */ holoCallback(this._proxyHCnewImage, this._proxyHCok);
/* 232 */ this._proxyHCnewImage = null;
/* */ }
/* */
/* 235 */ return this;
/* */ }
/* 237 */ return super.setAvatarNow(url);
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public WObject makeAvatar(URL url)
/* */ {
/* 247 */ if ((_debugLevel & 0x1) > 0) {
/* 248 */ System.out.println("HoloDrone.makeAvatar(" + url + ")");
/* */ }
/* 250 */ this._isConstructing = true;
/* 251 */ WObject bgAvatar = new Hologram(url, this);
/* 252 */ this._isConstructing = false;
/* 253 */ bgAvatar.setVisible(true);
/* 254 */ bgAvatar.setBumpable(false);
/* 255 */ return bgAvatar;
/* */ }
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */ public void holoCallback(Hologram newImage, boolean ok)
/* */ {
/* 266 */ if ((_debugLevel & 0x1) > 0) {
/* 267 */ System.out.println("HoloDrone.holoCallback(" +
/* 268 */ newImage + "," + ok + ")");
/* */ }
/* */
/* 271 */ if (this._isConstructing)
/* */ {
/* 273 */ assert (this._proxyHCnewImage == null);
/* 274 */ this._proxyHCnewImage = newImage;
/* 275 */ this._proxyHCok = ok;
/* */
/* 277 */ if ((_debugLevel & 0x1) > 0) {
/* 278 */ System.out.println("holoCallback: requesting proxy");
/* */ }
/* 280 */ return;
/* */ }
/* */
/* 283 */ if (this._realAvatar == this._avatar)
/* */ {
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* */
/* 293 */ if ((_debugLevel & 0x1) > 0) {
/* 294 */ System.out.println("holoCb: real avatar already loaded");
/* */ }
/* 296 */ return;
/* */ }
/* */
/* */
/* 300 */ if (!ok) {
/* 301 */ if (newImage == this._realAvatar) {
/* 302 */ this._realAvatar = null;
/* */ }
/* 304 */ if ((_debugLevel & 0x1) > 0) {
/* 305 */ System.out.println("holoCb: not ok");
/* */ }
/* 307 */ return;
/* */ }
/* */
/* */
/* 311 */ if ((_debugLevel & 0x1) > 0) {
/* 312 */ System.out.println("holoCb: swapping avatars");
/* */ }
/* */
/* 315 */ if (this._avatar != null) {
/* 316 */ this._avatar.detach();
/* */ }
/* */
/* 319 */ float avatarW = newImage.getW();
/* 320 */ float avatarH = newImage.getH();
/* */ float factor;
/* 322 */ float factor; if (avatarH < avatarW) {
/* 323 */ factor = (float)Math.sqrt(25600.0F / (avatarW * avatarH));
/* */ } else {
/* 325 */ factor = 160.0F / avatarH;
/* */ }
/* 327 */ avatarH *= factor;
/* 328 */ avatarW *= factor;
/* 329 */ float heightAdj = 0.0F;
/* 330 */ if (newImage == this._avatar)
/* 331 */ heightAdj = -this._avatar.getZ();
/* 332 */ this._avatar =
/* 333 */ ((WObject)newImage.scale(factor).raise(avatarH / 2.0F + heightAdj));
/* 334 */ add(this._avatar);
/* */
/* 336 */ avatarHeightChangedTo(avatarH);
/* */ }
/* */
/* */
/* */
/* */ public float getMinXYExtent()
/* */ {
/* 343 */ if (this._avatar == null) {
/* 344 */ return 0.0F;
/* */ }
/* 346 */ return this._avatar.getMinXYExtent();
/* */ }
/* */
/* */
/* */
/* */
/* */ public Object properties(int index, int offset, int mode, Object value)
/* */ throws NoSuchPropertyException
/* */ {
/* 355 */ Object ret = null;
/* 356 */ (index - offset);
/* */
/* 358 */ ret = super.properties(index, offset + 0, mode, value);
/* */
/* 360 */ return ret;
/* */ }
/* */
/* */
/* */
/* */
/* 366 */ private static Object classCookie = new Object();
/* */
/* */ public void saveState(Saver s) throws IOException
/* */ {
/* 370 */ s.saveVersion(0, classCookie);
/* 371 */ super.saveState(s);
/* */ }
/* */
/* */ public void restoreState(Restorer r) throws IOException, TooNewException
/* */ {
/* 376 */ switch (r.restoreVersion(classCookie)) {
/* */ case 0:
/* 378 */ super.restoreState(r);
/* 379 */ break;
/* */
/* */ default:
/* 382 */ throw new TooNewException();
/* */ }
/* */
/* */
/* 386 */ for (Enumeration<WObject> e = getContents(); e.hasMoreElements();) {
/* 387 */ WObject w = (WObject)e.nextElement();
/* 388 */ if ((w instanceof Hologram)) {
/* 389 */ Hologram h = (Hologram)w;
/* 390 */ if (h.getMovieName() != null) {
/* 391 */ this._avatar = h;
/* */ }
/* */ }
/* */ }
/* */ }
/* */
/* */ public HoloDrone() {}
/* */ }
/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\HoloDrone.class
* Java compiler version: 6 (50.0)
* JD-Core Version: 0.7.1
*/
|