summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/HoloDrone.java
diff options
context:
space:
mode:
authorFuwn <[email protected]>2021-05-03 16:38:41 -0700
committerFuwn <[email protected]>2021-05-03 16:38:41 -0700
commite1e781bb2135ef78592226f1a3eaba4925702f1f (patch)
tree8a5b590463ed413e1c6eabb719130e701b95ca63 /NET/worlds/scape/HoloDrone.java
downloadworlds.jar-main.tar.xz
worlds.jar-main.zip
:star:HEADmain
Diffstat (limited to 'NET/worlds/scape/HoloDrone.java')
-rw-r--r--NET/worlds/scape/HoloDrone.java444
1 files changed, 444 insertions, 0 deletions
diff --git a/NET/worlds/scape/HoloDrone.java b/NET/worlds/scape/HoloDrone.java
new file mode 100644
index 0000000..6c9acdc
--- /dev/null
+++ b/NET/worlds/scape/HoloDrone.java
@@ -0,0 +1,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
+ */ \ No newline at end of file