/* */ package NET.worlds.scape; /* */ /* */ import NET.worlds.console.AvMenu; /* */ import NET.worlds.console.Console; /* */ import NET.worlds.console.DefaultConsole; /* */ import NET.worlds.core.IniFile; /* */ import NET.worlds.core.ServerTableManager; /* */ import NET.worlds.core.Std; /* */ import NET.worlds.core.Timer; /* */ import NET.worlds.core.TimerCallback; /* */ import NET.worlds.network.Cache; /* */ import NET.worlds.network.CacheFile; /* */ import NET.worlds.network.Galaxy; /* */ import NET.worlds.network.NetUpdate; /* */ import NET.worlds.network.URL; /* */ import NET.worlds.network.WorldServer; /* */ import java.awt.Color; /* */ import java.io.IOException; /* */ import java.io.PrintStream; /* */ import java.io.RandomAccessFile; /* */ import java.net.MalformedURLException; /* */ import java.util.Enumeration; /* */ import java.util.Hashtable; /* */ import java.util.StringTokenizer; /* */ import java.util.Vector; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public class PosableShape /* */ extends Shape /* */ implements FrameHandler, Prerenderable, MouseDownHandler, ShapeLoaderListener, TimerCallback /* */ { /* 145 */ protected int figureType = -1; /* 146 */ private float closestView = 10000.0F; /* */ /* */ private int farViewCount; /* */ /* */ private Vector animationList; /* */ /* */ private boolean COG; /* */ /* 154 */ private boolean setPrepFigure = true; /* */ /* */ /* 157 */ private boolean runPrepFigure = this.setPrepFigure; /* */ /* */ /* */ private static URL defaultURL; /* */ /* */ /* */ public static URL getDefaultURL() /* */ { /* 165 */ return defaultURL; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* 173 */ protected DroneAnimator animator = null; /* */ /* */ public PosableShape(URL url) { /* 176 */ setURL(url); /* */ } /* */ /* */ public PosableShape(URL url, boolean isAW) /* */ { /* 181 */ this.setPrepFigure = isAW; /* */ /* */ /* 184 */ this.runPrepFigure = this.setPrepFigure; /* */ /* 186 */ setURL(url); /* */ } /* */ /* */ /* */ /* */ /* */ public void loadInit() /* */ { /* 194 */ setURL(defaultURL); /* */ } /* */ /* */ public void markVoid() /* */ throws ClassCastException /* */ { /* 200 */ if (this.animator != null) { /* 201 */ this.animator.endanimations(); /* 202 */ if (this.figureType != -1) /* 203 */ this.animator.delayedDeltype(this.figureType); /* */ } /* 205 */ this.animator = null; /* */ /* 207 */ getRoom().removePrerenderHandler(this); /* */ /* 209 */ super.markVoid(); /* */ } /* */ /* */ public synchronized void recursiveAddRwChildren(WObject parent) /* */ { /* 214 */ if (hasClump()) { /* 215 */ return; /* */ } /* 217 */ super.recursiveAddRwChildren(parent); /* */ /* 219 */ getRoom().addPrerenderHandler(this); /* */ /* */ /* 222 */ if ((isFullyLoaded()) && (this.figureType != -1)) { /* 223 */ DroneAnimator.addtype(this.figureType); /* 224 */ if (this.runPrepFigure) /* 225 */ DroneAnimator.prepFigure(this, this.COG); /* 226 */ this.animator = new DroneAnimator(); /* */ } /* */ } /* */ /* 230 */ private boolean recomputeHeight = false; /* */ private Shape subparts; /* */ public static Color[] colorTable; /* */ private int scanPos; /* */ private static Material origMat; /* */ /* 236 */ public void notifyShapeLoaded(Shape s) { this.recomputeHeight = true; } /* */ /* */ public Transform getObjectToWorldMatrix() /* */ { /* 240 */ if (this.clumpID != 0) { /* 241 */ return getJointedObjectToWorldMatrix(Transform.make()); /* */ } /* 243 */ return super.getObjectToWorldMatrix(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int getFigureType(URL url) /* */ { /* 253 */ String bodyType = getBodyType(url); /* 254 */ return bodyType == null ? -1 : DroneAnimator.getnameindex(bodyType); /* */ } /* */ /* */ public static int getFigureType(String bodyType) { /* 258 */ bodyType = getBodyType(bodyType); /* 259 */ return bodyType == null ? -1 : DroneAnimator.getnameindex(bodyType); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ protected void download(URL pUrl) /* */ { /* 270 */ PendingDrone pd = PosableDroneLoader.makePendingDrone(null, pUrl); /* */ /* */ /* */ /* */ /* 275 */ Enumeration e = getComponentAvatars(pd.getUrl()); /* 276 */ if (e != null) { /* 277 */ while (e.hasMoreElements()) { /* 278 */ String avURL = (String)e.nextElement(); /* */ /* */ /* */ /* */ /* 283 */ pd.download(URL.make(avURL)); /* */ } /* */ } /* */ } /* */ /* */ public synchronized void setURL(URL newName) /* */ { /* 290 */ if ((newName == this.url) || ((newName != null) && (newName.equals(this.url)))) { /* 291 */ return; /* */ } /* */ /* */ /* */ /* 296 */ if ((newName == null) || (!newName.toString().startsWith("avatar:lod"))) { /* 297 */ if (newName != null) /* */ { /* */ /* */ /* */ /* */ /* */ /* 304 */ download(newName); /* */ /* 306 */ int newType = getFigureType(newName); /* 307 */ if (newType != this.figureType) { /* 308 */ if (this.animator != null) { /* 309 */ this.animator.endanimations(); /* 310 */ if (this.figureType != -1) /* 311 */ this.animator.delayedDeltype(this.figureType); /* */ } /* 313 */ this.animator = null; /* */ /* 315 */ this.figureType = newType; /* */ /* 317 */ this.animationList = null; /* */ } /* */ } /* */ /* 321 */ setBaseLODURL(newName); /* 322 */ if ((forceLODLevel != -1) && (this.numDetailLevels > 0) && (this.doLOD)) { /* 323 */ setLOD(0.0F); /* 324 */ return; /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* 333 */ removeSubparts(); /* */ /* 335 */ if ((newName != null) && (newName.getAbsolute().startsWith("avatar:"))) { /* */ try { /* 337 */ createSubparts(newName); /* */ } catch (MalformedURLException e) { /* 339 */ System.out.println("Received bogus PosableShape URL: " + /* 340 */ newName); /* 341 */ return; /* */ } /* */ } /* */ /* 345 */ super.setURL(newName); /* */ } /* */ /* */ /* */ /* */ /* */ public static String base64; /* */ /* */ /* */ private static String[] permittedList; /* */ /* */ /* */ private static String[] faceList; /* */ /* */ /* */ private static String[] humanList; /* */ /* */ /* */ private static String[] secretList; /* */ /* */ /* */ private static Hashtable permittedHash; /* */ /* */ /* */ private static Vector permittedNames; /* */ /* */ /* */ private static Vector faceNames; /* */ /* */ /* */ private static Hashtable humanHash; /* */ /* */ /* */ private static Hashtable> worldHash; /* */ /* */ /* */ private static Hashtable secretNames; /* */ /* */ /* */ private static Hashtable faceTextures; /* */ /* */ /* */ private String scanName(String s) /* */ { /* 389 */ int start = this.scanPos; /* */ char c; /* 391 */ while ((((c = s.charAt(this.scanPos)) >= 'a') && (c <= 'z')) || (c == '_')) { char c; /* 392 */ this.scanPos += 1; } /* 393 */ return s.substring(start, this.scanPos); /* */ } /* */ /* */ /* */ /* */ /* */ public static String readName(String s, int pos) /* */ { /* 401 */ int start = pos; /* */ try { /* */ char c; /* */ do { do { char c; /* 405 */ pos++; /* 404 */ } while (((c = s.charAt(pos)) >= 'a') && (c <= 'z')); } while (c == '_'); /* */ } /* */ catch (StringIndexOutOfBoundsException localStringIndexOutOfBoundsException) {} /* */ /* 408 */ return s.substring(start, pos); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ private int scanInt(String s) /* */ { /* 418 */ int val = 0; /* 419 */ char c; for (; ((c = s.charAt(this.scanPos)) >= '0') && (c <= '9'); this.scanPos += 1) { char c; /* 420 */ val = 10 * val + (c - '0'); } /* 421 */ return val; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static Material scanTexture(String name, int frame) /* */ { /* 435 */ if (frame <= 0) { /* 436 */ name = "avatar:" + name + ".cmp"; /* */ } else { /* 438 */ name = "avatar:" + name + frame + "s*.mov"; /* */ } /* 440 */ Material m = new Material(0.32F, 0.55F, 0.0F, colorTable[3], null, 1.0F, /* 441 */ true, false); /* 442 */ m.loadTexture(URL.make(name)); /* */ /* 444 */ return m; /* */ } /* */ /* */ public static Material readTexture(String s, int p) /* */ { /* 449 */ int frame = 0; /* 450 */ char c; for (; ((c = s.charAt(p)) >= '0') && (c <= '9'); p++) { char c; /* 451 */ frame = 10 * frame + (c - '0'); /* */ } /* 453 */ return scanTexture(readName(s, p), frame); /* */ } /* */ /* */ /* */ /* */ /* */ public static boolean isValidTexture(String s) /* */ { /* 461 */ int len = s.length(); /* */ /* */ /* */ /* */ /* 466 */ for (int i = 0; i < len; i++) { char c; /* 467 */ if (((c = s.charAt(i)) < '0') || (c > '9')) /* */ break; /* */ } /* 470 */ for (; i < len; i++) { char c; /* 471 */ if ((((c = s.charAt(i)) < 'a') || (c > 'z')) && (c != '_')) /* 472 */ return false; /* */ } /* 474 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ private static int scanBase64(char c) /* */ { /* 484 */ int i = base64.indexOf(c); /* 485 */ if (i < 0) /* 486 */ return 0; /* 487 */ return i; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static Material readColor(String s, int p) /* */ { /* 504 */ char c = s.charAt(p++); /* 505 */ Material m = null; /* */ /* 507 */ if (c == '_') { /* 508 */ int color = s.charAt(p++) - 'A'; /* 509 */ if ((color < 0) || (color >= colorTable.length)) { /* 510 */ m = origMat; /* */ } else /* 512 */ m = new Material(0.32F, 0.55F, 0.0F, colorTable[color], null, /* 513 */ 1.0F, true, false); /* */ } else { /* 515 */ int r = 4 * scanBase64(c); /* 516 */ int g = 4 * scanBase64(s.charAt(p++)); /* 517 */ int b = 4 * scanBase64(s.charAt(p++)); /* 518 */ m = new Material(0.32F, 0.55F, 0.0F, new Color(r, g, b), null, 1.0F, /* 519 */ true, false); /* */ } /* */ /* 522 */ return m; /* */ } /* */ /* */ private Material scanColor(String s) { /* 526 */ Material m = readColor(s, this.scanPos); /* 527 */ if (s.charAt(this.scanPos) == '_') { /* 528 */ this.scanPos += 2; /* */ } else /* 530 */ this.scanPos += 3; /* 531 */ return m; /* */ } /* */ /* */ /* */ /* */ private float getScale(char c) /* */ { /* 538 */ if ((c >= 'a') && (c <= 'z')) /* 539 */ return 1.0F - (c - 'a' + 1) * 0.025615385F; /* 540 */ if ((c >= 'A') && (c <= 'Z')) { /* 541 */ return 1.0F / (1.0F - (c - 'A' + 1) * 0.025615385F); /* */ } /* 543 */ return 1.0F; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ private Material getMat(char c, Vector mats) /* */ { /* 553 */ int matNum = c - 'a'; /* 554 */ if (matNum < mats.size()) { /* 555 */ Material m = (Material)mats.elementAt(matNum); /* 556 */ if (m == origMat) { /* 557 */ return origMat; /* */ } /* 559 */ return (Material)m.clone(); /* */ } /* */ /* 562 */ return null; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private Shape getLimb(String s, String bodyType, int pos, int partNum, Shape parent, Vector mats, boolean loadNow) /* */ { /* 578 */ int end = s.length() - 4; /* */ /* 580 */ if (bodyType == null) /* */ { /* 582 */ if ((parent instanceof PosableShape)) { /* 583 */ bodyType = ""; /* */ } else { /* 585 */ bodyType = Shape.getBodBase(parent.getURL()); /* */ /* 587 */ if (parent.getURL().toString().indexOf("lod/") != -1) { /* 588 */ bodyType = "lod/" + bodyType; /* */ } /* */ } /* */ } /* */ /* 593 */ Shape shape = new Shape(); /* 594 */ Shape subshape = shape; /* 595 */ shape.setURL(URL.make("avatar:" + bodyType + partNum / 10 + partNum % /* 596 */ 10 + ".bod")); /* */ /* 598 */ int clumpsUsed = 0; /* 599 */ Material lastMat = null; /* 600 */ int delay = 0; /* 601 */ int lastTime = 0; /* 602 */ String actName = null; /* 603 */ boolean haveAddedChange = false; /* */ /* 605 */ if (pos > 0) { /* 606 */ this.scanPos = (pos + 1); /* */ do { /* 608 */ char c = s.charAt(this.scanPos++); /* 609 */ if ((c >= 'A') && (c <= 'Z')) { /* 610 */ if (c == 'G') { /* 611 */ int num = scanInt(s); /* 612 */ if ((num <= 0) || (num > 99)) /* 613 */ num = partNum; /* 614 */ bodyType = scanName(s); /* */ /* */ /* 617 */ if (bodyType.equals("")) { /* */ break; /* */ } /* 620 */ subshape.setURL( /* 621 */ URL.make("avatar:" + bodyType + num / 10 + num % /* 622 */ 10 + ".bod")); /* 623 */ } else if (c == 'S') /* */ { /* 625 */ char xScale = s.charAt(this.scanPos++); /* 626 */ char yScale = s.charAt(this.scanPos++); /* 627 */ char zScale = s.charAt(this.scanPos++); /* */ /* 629 */ if ((xScale == 'Z') && (yScale == 'Z') && /* 630 */ (zScale == 'Z')) { /* 631 */ this.runPrepFigure = false; /* */ } /* */ /* 634 */ subshape.scale(getScale(xScale), getScale(yScale), /* 635 */ getScale(zScale)); /* 636 */ } else if (c != 'Q') /* */ { /* 638 */ if (c == 'C') { /* 639 */ if (!$assertionsDisabled) throw new AssertionError(); /* 640 */ } else if (c == 'D') /* */ { /* 642 */ delay += (int)(1000.0D * (Math.pow(1.0932D, /* 643 */ scanBase64(s.charAt(this.scanPos++))) - 0.8999999761581421D)); /* 644 */ } else if (c == 'A') { /* 645 */ actName = scanName(s); /* */ /* */ /* 648 */ this.animationList = null; /* 649 */ } else if ((c == 'T') || (c == 'C')) /* */ { /* 651 */ System.out.println("Illegal av " + this.url); /* */ } /* */ else { /* 654 */ this.scanPos -= 1; /* 655 */ break; /* */ } /* 657 */ } } else if (c >= 'a') /* */ { /* 659 */ Material m = getMat(c, mats); /* 660 */ if (m != null) { /* 661 */ if (delay == 0) /* 662 */ delay = 50; /* 663 */ lastTime += delay; /* */ /* */ /* */ /* */ /* 668 */ if (lastMat != null) { /* 669 */ if (!haveAddedChange) { /* 670 */ haveAddedChange = true; /* 671 */ addChange(lastTime - delay, lastMat, subshape); /* */ } /* */ /* 674 */ addChange(lastTime, m, subshape); /* */ } /* 676 */ if (m != origMat) /* 677 */ subshape.setMaterial(m); /* 678 */ lastMat = m; /* 679 */ delay = 0; /* */ } /* 681 */ } else { if ((c < '0') || (c > '9')) break; /* 682 */ this.scanPos -= 1; /* 683 */ int clumpNum = scanInt(s) - clumpsUsed; /* 684 */ clumpsUsed++; /* */ /* 686 */ subshape = new SubclumpShape(); /* 687 */ subshape.setURL(URL.make("system:subclump" + clumpNum)); /* 688 */ shape.add(subshape); /* */ /* 690 */ lastMat = null; /* 691 */ haveAddedChange = false; /* 692 */ lastTime = 0; /* 693 */ delay = 0; /* */ /* */ } /* */ /* */ } /* 698 */ while (this.scanPos <= end); /* 699 */ this.scanPos = end; /* 700 */ return parent; /* */ } /* */ /* */ /* */ /* */ /* 706 */ if (bodyType.equals("")) { /* 707 */ return parent; /* */ } /* 709 */ shape.addLoadListener(this); /* */ /* 711 */ if ((ProgressiveAdder.get().enabled()) && (!loadNow)) { /* 712 */ ProgressiveAdder.get().scheduleForAdd(parent, shape); /* */ } else { /* 714 */ parent.add(shape); /* */ } /* 716 */ if (this.subparts == null) { /* 717 */ this.subparts = shape; /* */ } /* 719 */ return shape; /* */ } /* */ /* */ /* */ /* */ /* */ private void addChange(int when, Material mat, Shape s) /* */ { /* 727 */ TimedMatChange t = new TimedMatChange(); /* 728 */ t.when = when; /* 729 */ t.mat = mat; /* 730 */ t.limb = s; /* 731 */ mat.setKeepLoaded(true); /* */ /* */ /* 734 */ int i = 0; /* 735 */ if (this.expressionChanges == null) { /* 736 */ this.expressionChanges = new Vector(); /* 737 */ this.expressionStart = Std.getRealTime(); /* 738 */ this.nextChange = 0; /* */ } else { /* 740 */ for (i = this.expressionChanges.size(); i > 0; i--) { /* 741 */ TimedMatChange o = /* 742 */ (TimedMatChange)this.expressionChanges.elementAt(i - 1); /* 743 */ if (when >= o.when) { /* */ break; /* */ } /* */ } /* */ } /* 748 */ this.expressionChanges.insertElementAt(t, i); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public static Enumeration getComponentAvatars(URL pUrl) /* */ { /* 757 */ if (pUrl == null) { /* 758 */ return null; /* */ } /* 760 */ Vector v = new Vector(); /* */ /* 762 */ String urlString = pUrl.getAbsolute(); /* 763 */ if ((!urlString.startsWith("avatar:")) || (!urlString.endsWith(".rwg"))) { /* 764 */ return null; /* */ } /* 766 */ String baseAv = urlString.substring(7, urlString.indexOf('.')); /* 767 */ v.addElement("avatar:" + baseAv + ".rwg"); /* */ /* 769 */ int pos = urlString.indexOf('.'); /* 770 */ int len = urlString.length() - 4; /* 771 */ while (pos < len) { /* 772 */ char c = urlString.charAt(pos++); /* 773 */ if ((c >= 'A') && (c <= 'Z')) { /* 774 */ switch (c) { /* */ case 'C': /* 776 */ c = urlString.charAt(pos++); /* 777 */ if (c == '_') { /* 778 */ pos++; /* */ } else /* 780 */ pos += 2; /* 781 */ break; /* */ case 'D': /* 783 */ pos++; /* 784 */ break; /* */ case 'S': /* 786 */ pos += 3; /* 787 */ break; /* */ /* */ case 'A': /* */ case 'Q': /* */ case 'T': /* */ break; /* */ /* */ /* */ case 'G': /* 796 */ while (pos < len) /* */ { /* 798 */ c = urlString.charAt(pos); /* 799 */ if ((c < '0') || (c > '9')) /* */ break; /* 801 */ pos++; /* */ } /* */ /* */ /* 805 */ String bodyType = ""; /* */ /* 807 */ while (pos < len) /* */ { /* 809 */ c = urlString.charAt(pos); /* */ /* 811 */ if ((c >= '0') && (c <= '9')) { /* */ break; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* 820 */ if ((c < 'a') || (c > 'z')) { /* */ break; /* */ } /* 823 */ bodyType = bodyType + c; /* 824 */ pos++; /* */ } /* */ /* 827 */ if ((bodyType != "") && (bodyType.length() > 1)) /* */ { /* */ /* 830 */ v.addElement("avatar:" + bodyType + ".rwg"); /* */ } /* */ /* */ break; /* */ } /* */ /* */ } /* */ } /* 838 */ return v.elements(); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static int skipLimb(String s, int pos) /* */ { /* 849 */ int len = s.length() - 4; /* 850 */ while (pos < len) { /* 851 */ char c = s.charAt(pos++); /* 852 */ if ((c >= 'A') && (c <= 'Z')) {} /* 853 */ switch (c) { /* */ case 'C': /* 855 */ c = s.charAt(pos++); /* 856 */ if (c == '_') { /* 857 */ pos++; /* */ } else /* 859 */ pos += 2; /* 860 */ break; /* */ case 'D': /* 862 */ pos++; /* 863 */ break; /* */ case 'S': /* 865 */ pos += 3; /* 866 */ break; /* */ case 'A': /* */ case 'G': /* */ case 'Q': /* */ case 'T': /* */ break; /* */ default: /* 873 */ return pos - 1; /* */ /* 875 */ continue; if (((c < 'a') || (c > 'z')) && ((c < '0') || (c > '9'))) { /* */ break label178; /* */ } /* */ } /* */ } /* */ label178: /* 881 */ return -1; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ private String findStarts(String s, int end, int[] offs, String bodyType, Vector mats) /* */ { /* 893 */ String lastTextureName = bodyType; /* */ /* 895 */ while (this.scanPos < end) { /* 896 */ char section = s.charAt(this.scanPos); /* 897 */ if ((section < 'A') || (section > 'Z')) { /* 898 */ return s; /* */ } /* 900 */ offs[(section - 'A')] = (this.scanPos++); /* */ /* */ /* 903 */ while (this.scanPos < end) { /* 904 */ char c = s.charAt(this.scanPos++); /* 905 */ if ((c >= 'A') && (c <= 'Z')) { /* 906 */ if (c == 'G') /* */ { /* 908 */ scanInt(s); /* 909 */ scanName(s); /* 910 */ } else if (c == 'S') /* */ { /* 912 */ this.scanPos += 3; /* 913 */ } else if (c != 'Q') /* */ { /* 915 */ if ((c == 'C') || (c == 'T')) { /* 916 */ int start = this.scanPos - 1; /* */ /* */ /* */ /* 920 */ char letter = (char)(97 + mats.size()); /* */ /* */ Material mat; /* */ /* */ Material mat; /* 925 */ if (c == 'C') { /* 926 */ mat = scanColor(s); /* */ } /* */ else { /* 929 */ int num = scanInt(s); /* */ /* */ /* */ /* 933 */ String name = scanName(s); /* 934 */ if (name.equals("")) { /* 935 */ name = lastTextureName; /* */ } else /* 937 */ lastTextureName = name; /* 938 */ mat = scanTexture(name, num); /* */ } /* 940 */ mats.addElement(mat); /* */ /* 942 */ s = s.substring(0, start) + 'Q' + letter + /* 943 */ s.substring(this.scanPos); /* 944 */ int cutLen = this.scanPos - start - 2; /* 945 */ this.scanPos -= cutLen; /* 946 */ end -= cutLen; /* 947 */ } else if (c == 'D') /* */ { /* 949 */ this.scanPos += 1; /* 950 */ } else if (c == 'A') { /* 951 */ scanName(s); /* */ } /* */ else { /* 954 */ this.scanPos -= 1; /* 955 */ break; /* */ } /* 957 */ } } else if ((c < '0') || (c > '9')) /* */ { /* 959 */ if ((c < 'a') || (c > 'z')) /* */ { /* 961 */ return s.substring(0, this.scanPos - 1) + ".rwg"; /* */ } /* */ } /* */ } /* */ } /* 966 */ return s; /* */ } /* */ /* */ static /* */ { /* 162 */ defaultURL = URL.make("avatar:aura.0PG.rwg"); /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 350 */ colorTable = new Color[] { new Color(0, 0, 0), /* 351 */ new Color(51, 102, 204), /* 352 */ new Color(234, 162, 115), /* 353 */ new Color(255, 102, 51), /* 354 */ new Color(255, 153, 204), /* 355 */ new Color(139, 232, 0), /* 356 */ new Color(43, 131, 0), /* 357 */ new Color(51, 51, 153), /* 358 */ new Color(145, 51, 204), /* 359 */ new Color(153, 204, 255), /* 360 */ new Color(204, 51, 102), /* 361 */ new Color(0, 204, 102), /* 362 */ new Color(255, 204, 102), /* 363 */ new Color(102, 102, 102), /* 364 */ new Color(254, 123, 26), /* 365 */ new Color(255, 51, 153), /* 366 */ new Color(188, 51, 204), /* 367 */ new Color(204, 0, 38), /* 368 */ new Color(118, 0, 0), /* 369 */ new Color(153, 102, 51), /* 370 */ new Color(196, 196, 196), /* 371 */ new Color(204, 153, 255), /* 372 */ new Color(255, 255, 255), /* 373 */ new Color(255, 179, 2), /* 374 */ new Color(247, 227, 2), /* 375 */ new Color(255, 255, 153) }; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 428 */ origMat = new Material(null); /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 477 */ base64 = "-0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ+"; /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 982 */ permittedList = ServerTableManager.instance() /* 983 */ .getTable("permittedList"); /* */ /* */ /* */ /* 987 */ faceList = ServerTableManager.instance().getTable( /* 988 */ "faceList"); /* */ /* 990 */ humanList = ServerTableManager.instance().getTable( /* 991 */ "humanList"); /* */ /* */ /* 994 */ secretList = ServerTableManager.instance() /* 995 */ .getTable("secretList"); /* */ /* 997 */ permittedHash = new Hashtable(); /* 998 */ permittedNames = new Vector(); /* 999 */ faceNames = new Vector(); /* 1000 */ humanHash = new Hashtable(); /* 1001 */ worldHash = new Hashtable(); /* 1002 */ secretNames = new Hashtable(); /* 1003 */ faceTextures = new Hashtable(); /* */ /* */ /* 1006 */ if (!NetUpdate.isInternalVersion()) { /* 1007 */ for (int i = 0; i < secretList.length; i++) { /* 1008 */ secretNames.put(secretList[i], secretList[i]); /* */ } /* */ } /* */ /* 1012 */ for (int i = 0; i < permittedList.length; i += 2) { /* 1013 */ if (secretNames.get(permittedList[i]) == null) { /* 1014 */ permittedNames.addElement(permittedList[i]); /* 1015 */ if (permittedList[(i + 1)].indexOf("DgT") >= 0) { /* 1016 */ faceNames.addElement(permittedList[i]); /* */ } /* */ } /* 1019 */ if (permittedList[(i + 1)] != null) { /* 1020 */ permittedHash.put(permittedList[i], permittedList[(i + 1)]); /* */ } /* */ } /* 1023 */ for (int i = 1; i < humanList.length; i += 2) { /* 1024 */ humanHash.put(humanList[(i - 1)], humanList[i]); /* */ } /* 1026 */ for (int i = 0; i < faceList.length; i += 2) { /* 1027 */ faceTextures.put(faceList[i], faceList[(i + 1)]); /* */ } /* */ } /* */ /* */ /* */ /* */ public static Vector getPermittedNames() /* */ { /* 1035 */ return permittedNames; /* */ } /* */ /* */ /* */ /* */ public static String[] getPermittedList() /* */ { /* 1042 */ return permittedList; /* */ } /* */ /* 1045 */ static boolean gotServerAvatarList = false; /* 1046 */ static boolean serverAvatarListError = false; /* */ /* */ private Enumeration animations; /* */ /* */ public static void downloadPermittedNames() /* */ { /* 1052 */ if (gotServerAvatarList) { /* 1053 */ return; /* */ } /* 1055 */ serverAvatarListError = false; /* */ /* */ /* 1058 */ WorldServer w = Pilot.getActive().getServer(); /* 1059 */ if ((w != null) && (w.getGalaxy() != null)) { /* 1060 */ String avatarList = Console.getActive().getScriptServer() + /* 1061 */ "getavlist.pl?u=" + w.getGalaxy().getChatname(); /* */ /* 1063 */ if (w.getGalaxy().getSerialNum() != null) { /* 1064 */ avatarList = avatarList + "&s=" + w.getGalaxy().getSerialNum(); /* */ } /* */ /* 1067 */ URL avatarListURL = URL.make(avatarList); /* 1068 */ CacheFile cf = Cache.getFile(avatarListURL, true); /* 1069 */ cf.waitUntilLoaded(); /* 1070 */ if (!cf.error()) /* */ { /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 1079 */ permittedNames.removeAllElements(); /* 1080 */ humanHash.clear(); /* 1081 */ worldHash.clear(); /* */ try /* */ { /* 1084 */ RandomAccessFile f = new RandomAccessFile( /* 1085 */ cf.getLocalName(), "r"); /* 1086 */ while (f.getFilePointer() < f.length()) { /* 1087 */ String line = f.readLine(); /* */ /* */ /* 1090 */ if (!line.startsWith("//")) /* */ { /* 1092 */ StringTokenizer st = new StringTokenizer(line); /* 1093 */ if (st.countTokens() > 2) { /* 1094 */ String name = st.nextToken(); /* 1095 */ permittedNames.addElement(name); /* 1096 */ String gender = st.nextToken(); /* 1097 */ if ((gender.equals("m")) || (gender.equals("f"))) /* 1098 */ humanHash.put(name, gender); /* 1099 */ Vector worldList = new Vector(); /* 1100 */ while (st.hasMoreTokens()) { /* 1101 */ worldList.addElement(st.nextToken()); /* */ } /* 1103 */ worldHash.put(name, worldList); /* */ } /* */ } /* */ } /* 1107 */ f.close(); /* */ } catch (Exception e) { /* 1109 */ System.out.println("Error parsing avatar list: " + /* 1110 */ e.toString()); /* 1111 */ serverAvatarListError = true; /* 1112 */ return; /* */ } /* */ /* 1115 */ gotServerAvatarList = true; /* */ /* */ /* */ /* */ /* 1120 */ Console c = Console.getActive(); /* 1121 */ if ((c instanceof DefaultConsole)) { /* 1122 */ DefaultConsole dc = (DefaultConsole)c; /* 1123 */ dc.getAvatarMenu().rebuildVIPMenu(); /* */ } /* */ /* */ /* */ /* 1128 */ if (c.getPilot() != null) { /* 1129 */ c.getPilot().resetAvatarNow(); /* */ } /* */ /* */ /* */ /* 1134 */ AvMenu.rebuildHeadList(); /* */ } else { /* 1136 */ serverAvatarListError = true; /* */ } /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ public static URL getPermitted(URL in, World world) /* */ { /* 1146 */ if (in.endsWith(".mov")) { /* 1147 */ return in; /* */ } /* */ /* 1150 */ if (NetUpdate.isInternalVersion()) { /* 1151 */ return in; /* */ } /* 1153 */ if ((!gotServerAvatarList) && (!serverAvatarListError)) /* */ { /* 1155 */ return in; /* */ } /* */ /* 1158 */ if (serverAvatarListError) /* */ { /* */ /* */ /* 1162 */ if (validateAvatar(in.getAbsolute())) { /* 1163 */ return in; /* */ } /* 1165 */ return getDefAv(); /* */ } /* */ /* */ /* */ /* 1170 */ Enumeration e = getComponentAvatars(in); /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* 1183 */ while ((e != null) && (e.hasMoreElements())) { /* 1184 */ String baseAv = (String)e.nextElement(); /* */ /* 1186 */ String s = getBodyType(URL.make(baseAv)); /* 1187 */ if (s == null) /* */ { /* */ /* 1190 */ return getDefAv(); /* */ } /* */ /* 1193 */ Vector allowedWorlds = (Vector)worldHash.get(s); /* 1194 */ if (allowedWorlds == null) /* */ { /* */ /* 1197 */ return getDefAv(); /* */ } /* */ /* 1200 */ boolean worldOK = false; /* 1201 */ Enumeration we = allowedWorlds.elements(); /* 1202 */ while (we.hasMoreElements()) { /* 1203 */ String thisWorld = (String)we.nextElement(); /* 1204 */ if (thisWorld == null) { /* 1205 */ return getDefAv(); /* */ } /* 1207 */ if (thisWorld.equals("all")) { /* 1208 */ worldOK = true; /* 1209 */ break; /* */ } /* */ /* */ /* */ /* 1214 */ thisWorld = thisWorld.replace('_', ' ').toLowerCase().trim(); /* */ /* 1216 */ if (world != null) { /* 1217 */ if (thisWorld.equals(world.toString().toLowerCase().trim())) { /* 1218 */ worldOK = true; /* 1219 */ break; /* */ } /* */ } else { /* 1222 */ worldOK = true; /* */ } /* */ } /* */ /* 1226 */ if (!worldOK) { /* 1227 */ return getDefAv(); /* */ } /* */ } /* 1230 */ return in; /* */ } /* */ /* */ /* */ /* */ public static Vector getFaceNames() /* */ { /* 1237 */ return faceNames; /* */ } /* */ /* */ /* */ /* */ /* */ public static URL getAvURL(String bodyType) /* */ { /* 1245 */ Object newName = permittedHash.get(bodyType); /* 1246 */ if ((newName instanceof String)) { /* 1247 */ return URL.make("avatar:" + (String)newName); /* */ } /* 1249 */ return null; /* */ } /* */ /* */ /* */ /* */ public static boolean validateAvatar(String av) /* */ { /* 1256 */ System.out.println("Validating " + av); /* 1257 */ String baseAv = getBodyType(URL.make(av)); /* 1258 */ if (baseAv == null) /* 1259 */ return false; /* 1260 */ if (permittedHash.get(baseAv) != null) { /* 1261 */ return true; /* */ } /* 1263 */ return false; /* */ } /* */ /* */ /* */ /* */ /* */ public static String convertLODToParent(String bodyType) /* */ { /* 1271 */ String result = bodyType; /* */ /* 1273 */ if (result.startsWith("lod/")) /* */ { /* 1275 */ result = result.substring(4, result.length() - 1); /* */ } /* 1277 */ return result; /* */ } /* */ /* */ /* */ /* */ /* */ public static String getBodyType(URL url) /* */ { /* 1285 */ if (url == null) { /* 1286 */ return null; /* */ } /* */ /* 1289 */ String str = url.getAbsolute(); /* */ /* 1291 */ if ((!str.startsWith("avatar:")) || ((!str.endsWith(".rwg")) && /* 1292 */ (!str.endsWith(".RWG"))) || (str.charAt(7) == '.')) { /* 1293 */ return null; /* */ } /* 1295 */ int pos = str.indexOf(".", 7); /* 1296 */ String bodyType = str.substring(7, pos).toLowerCase(); /* 1297 */ bodyType = convertLODToParent(bodyType); /* 1298 */ if (str.charAt(pos + 1) != '0') /* */ { /* 1300 */ bodyType = getBodyType(bodyType); /* */ } /* */ /* 1303 */ return bodyType; /* */ } /* */ /* */ static URL getDefAv() /* */ { /* 1308 */ return URL.make(IniFile.override().getIniString("DefaultArticAv", /* 1309 */ "avatar:willy.rwg")); /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static URL getHuman(URL url) /* */ { /* 1321 */ if (url.endsWith(".mov")) { /* 1322 */ return HoloDrone.getHuman(url); /* */ } /* 1324 */ String s = getBodyType(url); /* 1325 */ if (s == null) { /* 1326 */ return getDefAv(); /* */ } /* 1328 */ String gender = (String)humanHash.get(s); /* 1329 */ if (gender == null) { /* 1330 */ return getDefAv(); /* */ } /* 1332 */ URL def = URL.make("avatar:" + s + ".rwg"); /* */ /* */ /* 1335 */ String str = url.getAbsolute(); /* 1336 */ int pos = str.indexOf(".0EC_"); /* 1337 */ if ((pos < 0) || (str.length() < pos + 7) || /* 1338 */ ("_AC".indexOf(str.charAt(pos + 5)) < 0)) { /* 1339 */ return def; /* */ } /* */ /* 1342 */ if ((gender.equals("m")) && (str.indexOf("yank") >= 0) && ( /* 1343 */ (!str.regionMatches(pos + 6, "TyankshirtC_", 0, 12)) || /* */ /* 1345 */ (!str.regionMatches(pos + 19, "C-2bTyankstripe", 0, 15)))) { /* 1346 */ return def; /* */ } /* */ /* */ /* 1350 */ pos = str.lastIndexOf("HDgT2"); /* 1351 */ if ((pos < 0) || (str.length() < pos + 7)) { /* 1352 */ return def; /* */ } /* 1354 */ String faceGender = (String)humanHash.get(readName(str, pos + 5)); /* 1355 */ if ((faceGender == null) || (!faceGender.equals(gender))) { /* 1356 */ return def; /* */ } /* */ /* 1359 */ pos = str.lastIndexOf("NS"); /* 1360 */ if ((pos < 0) || (str.length() < pos + 3) || /* 1361 */ ("0abcdABCD".indexOf(str.charAt(pos + 2)) < 0)) { /* 1362 */ return def; /* */ } /* */ /* 1365 */ pos += 5; /* 1366 */ if (str.length() < pos + 2) { /* 1367 */ return def; /* */ } /* 1369 */ if (str.charAt(pos) == 'G') { /* 1370 */ String headGender = (String)humanHash.get(readName(str, /* 1371 */ pos + 1)); /* 1372 */ if ((headGender == null) || (!headGender.equals(gender))) { /* 1373 */ return def; /* */ } /* */ } /* 1376 */ return url; /* */ } /* */ /* */ /* */ /* */ /* */ public URL getHuman() /* */ { /* 1384 */ return getHuman(getURL()); /* */ } /* */ /* */ /* */ /* */ /* */ public static String getBodyType(String basename) /* */ { /* 1392 */ String str = (String)permittedHash.get(basename); /* 1393 */ if (str != null) { /* 1394 */ basename = str.substring(0, str.indexOf(".")); /* */ } /* 1396 */ return basename; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public static int getMatPosition(String str, char type) /* */ { /* 1405 */ int index = "abcdef".indexOf(type); /* 1406 */ if (index >= 0) { /* 1407 */ int p = str.indexOf(".0E"); /* 1408 */ if (p >= 0) { /* 1409 */ p += 3; /* */ /* 1411 */ for (int i = 0; i < index; i++) /* 1412 */ p = skipMat(str, p); /* */ } /* 1414 */ return p; /* */ } /* 1416 */ int p = str.indexOf(".0E"); /* 1417 */ if (p >= 0) { /* 1418 */ p += 2; /* 1419 */ while (p >= 0) { /* 1420 */ if (str.charAt(p++) == type) { /* 1421 */ return p; /* */ } /* 1423 */ p = skipLimb(str, p); /* */ } /* */ } /* 1426 */ return p; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public static String getCurrentAvCustomizable() /* */ { /* 1437 */ URL av = Pilot.getActive().getSourceURL(); /* */ /* 1439 */ String str = av.getAbsolute(); /* */ /* 1441 */ if ((!str.startsWith("avatar:")) || ((!str.endsWith(".rwg")) && /* 1442 */ (!str.endsWith(".RWG"))) || (str.charAt(7) == '.')) { /* 1443 */ Console.println(Console.message("non-cust-av")); /* 1444 */ return null; /* */ } /* */ /* 1447 */ int pos = str.indexOf(".", 7); /* */ /* 1449 */ if (!str.regionMatches(pos, ".0E", 0, 3)) /* */ { /* 1451 */ av = getAvURL(str.substring(7, pos).toLowerCase()); /* 1452 */ if (av == null) /* */ { /* 1454 */ if (!str.substring(pos).equalsIgnoreCase(".rwg")) { /* 1455 */ Console.println(Console.message("cant-cust-av")); /* 1456 */ return null; /* */ } /* */ /* 1459 */ str = /* */ /* */ /* 1462 */ "avatar:" + str.substring(7, pos) + ".0EC__C__C__C__C__C__" + "PeBbLcMcOaRcUcVaWeXeYIeJeK" + "NS000QaHDgT2tonyT3T2T1Q0f.rwg"; /* */ } else { /* 1464 */ str = av.getAbsolute(); /* */ } /* */ } /* 1467 */ return str; /* */ } /* */ /* */ /* */ /* */ /* */ public static int skipMat(String s, int i) /* */ { /* 1475 */ char c = s.charAt(i); /* 1476 */ int matEnd = i; /* 1477 */ if (c == 'C') { /* 1478 */ c = s.charAt(i + 1); /* 1479 */ if (c == '_') { /* 1480 */ matEnd = i + 3; /* */ } else /* 1482 */ matEnd = i + 4; /* 1483 */ } else if (c == 'T') { /* 1484 */ matEnd = i + 1; /* 1485 */ for (;;) { matEnd++; if ((c = s.charAt(matEnd)) >= '0') if (c > '9') break; /* */ } /* 1487 */ do { matEnd++; if ((c = s.charAt(matEnd)) < 'a') break; } while (c <= 'z'); /* */ } /* 1489 */ else if ((c >= 'a') && (c <= 'z')) { /* 1490 */ matEnd = i + 1; /* */ } /* 1492 */ return matEnd; /* */ } /* */ /* */ public static String getFace(String bodyType) { /* 1496 */ Object face = faceTextures.get(bodyType); /* 1497 */ if (face != null) { /* 1498 */ return (String)face; /* */ } /* */ /* 1501 */ return "1" + bodyType; /* */ } /* */ /* */ /* */ /* */ /* */ private void createSubparts(URL url) /* */ throws MalformedURLException /* */ { /* 1510 */ String str = url.getAbsolute(); /* 1511 */ int len = str.length(); /* */ /* 1513 */ String bodyType = null; /* */ /* */ /* 1516 */ this.runPrepFigure = this.setPrepFigure; /* */ /* */ /* 1519 */ if ((!str.startsWith("avatar:")) || ((!str.endsWith(".rwg")) && /* 1520 */ (!str.endsWith(".RWG"))) || (str.charAt(7) == '.')) { /* 1521 */ this.scanPos = 0; /* 1522 */ str = ".rwg"; /* 1523 */ bodyType = "aura"; /* */ } else { /* 1525 */ this.scanPos = str.indexOf(".", 7); /* 1526 */ bodyType = str.substring(7, this.scanPos).toLowerCase(); /* */ /* 1528 */ if (str.charAt(this.scanPos + 1) != '0') { /* 1529 */ this.scanPos = (len - 4); /* */ /* */ /* 1532 */ Object newName = permittedHash.get(bodyType); /* 1533 */ if (newName != null) { /* 1534 */ str = (String)newName; /* 1535 */ this.scanPos = 0; /* 1536 */ bodyType = scanName(str); /* 1537 */ if (str.charAt(this.scanPos) != '.') /* 1538 */ throw new MalformedURLException(); /* 1539 */ if (str.charAt(this.scanPos + 1) != '0') /* 1540 */ throw new MalformedURLException(); /* 1541 */ this.scanPos += 2; /* */ } /* */ } else { /* 1544 */ this.scanPos += 2; /* */ } /* */ } /* */ /* */ /* */ /* 1550 */ Vector mats = new Vector(); /* */ /* */ /* 1553 */ int[] offsets = new int[26]; /* 1554 */ str = findStarts(str, str.length() - 4, offsets, bodyType, mats); /* */ /* 1556 */ if (this.subparts != null) { /* 1557 */ throw new MalformedURLException(); /* */ } /* */ /* */ /* 1561 */ Shape groi = getLimb(str, bodyType, offsets[15], 1, this, mats, true); /* */ /* 1563 */ Shape back = getLimb(str, null, offsets[1], 2, groi, mats, false); /* 1564 */ Shape neck = getLimb(str, null, offsets[13], 3, back, mats, false); /* 1565 */ Shape head = getLimb(str, null, offsets[7], 4, neck, mats, false); /* 1566 */ Shape lupa = getLimb(str, null, offsets[11], 11, back, mats, false); /* 1567 */ Shape lfor = getLimb(str, null, offsets[12], 12, lupa, mats, false); /* 1568 */ Shape lhan = getLimb(str, null, offsets[14], 13, lfor, mats, false); /* 1569 */ Shape rupa = getLimb(str, null, offsets[17], 6, back, mats, false); /* 1570 */ Shape rfor = getLimb(str, null, offsets[20], 7, rupa, mats, false); /* 1571 */ Shape rhan = getLimb(str, null, offsets[21], 8, rfor, mats, false); /* 1572 */ Shape lthi = getLimb(str, null, offsets[8], 19, groi, mats, false); /* 1573 */ Shape lcal = getLimb(str, null, offsets[9], 20, lthi, mats, false); /* 1574 */ Shape lfoo = getLimb(str, null, offsets[10], 21, lcal, mats, false); /* 1575 */ Shape rthi = getLimb(str, null, offsets[22], 15, groi, mats, false); /* 1576 */ Shape rcal = getLimb(str, null, offsets[23], 16, rthi, mats, false); /* 1577 */ Shape rfoo = getLimb(str, null, offsets[24], 17, rcal, mats, false); /* 1578 */ Shape tail = getLimb(str, null, offsets[25], 24, groi, mats, false); /* */ } /* */ /* */ protected void removeSubparts() /* */ { /* 1583 */ if (this.subparts != null) { /* 1584 */ this.subparts.discard(); /* 1585 */ this.subparts = null; /* 1586 */ this.actions = null; /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ /* */ /* */ public void prerender(Camera cam) /* */ { /* 1598 */ if (!getVisible()) { /* 1599 */ return; /* */ } /* 1601 */ Point3Temp p = inCamSpace(cam); /* */ /* */ /* */ /* 1605 */ boolean v = (p != null) && (p.z > 1.0F) && (p.x < p.z) && (-p.x < p.z); /* */ /* */ /* */ /* */ /* 1610 */ if (v) { /* 1611 */ if (this.closestView > p.z) /* 1612 */ this.closestView = p.z; /* 1613 */ if ((p.z > 700.0F) && /* 1614 */ (++this.farViewCount > 10)) { /* 1615 */ if (this.closestView > 400.0F) /* 1616 */ this.closestView = 400.0F; /* 1617 */ this.farViewCount = 0; /* */ } /* */ } /* */ } /* */ /* */ /* */ /* */ /* */ /* */ public float animate(String action) /* */ { /* 1628 */ if (this.animator != null) /* */ { /* */ /* 1631 */ if (action.length() == 1) { /* 1632 */ char lower = action.toLowerCase().charAt(0); /* 1633 */ char upper = action.toUpperCase().charAt(0); /* 1634 */ Vector al = getAnimationList(); /* 1635 */ int len = al.size(); /* 1636 */ for (int i = 0; i < len; i++) { /* 1637 */ String[] actionAliases = ServerTableManager.instance() /* 1638 */ .getTable("actionAliases"); /* */ /* 1640 */ String displayName = (String)al.elementAt(i); /* */ /* 1642 */ if (actionAliases != null) { /* 1643 */ for (int j = 0; j < actionAliases.length; j += 2) /* */ { /* 1645 */ if (displayName.toLowerCase().equals(actionAliases[j].toLowerCase())) { /* 1646 */ displayName = actionAliases[(j + 1)]; /* 1647 */ break; /* */ } /* */ } /* */ } /* */ /* 1652 */ char c = displayName.charAt(0); /* 1653 */ if ((c == lower) || (c == upper)) { /* 1654 */ action = (String)al.elementAt(i); /* 1655 */ break; /* */ } /* */ } /* */ } /* */ /* 1660 */ return performAnimationSequence(action); /* */ } /* */ /* */ /* 1664 */ return 0.0F; /* */ } /* */ /* */ /* */ public void timerDone() /* */ { /* 1670 */ if (this.animations.hasMoreElements()) { /* 1671 */ String nextAnim = (String)this.animations.nextElement(); /* 1672 */ float time = this.animator.getAnimationTime(this.figureType, nextAnim); /* 1673 */ this.animator.animate(this.figureType, nextAnim, Std.getRealTime()); /* 1674 */ Timer tm = new Timer(time, this); /* 1675 */ tm.start(); /* */ } /* */ } /* */ /* */ private float performAnimationSequence(String action) { /* 1680 */ float totalTime = 0.0F; /* */ /* 1682 */ Vector vanimations = new Vector(); /* */ /* 1684 */ StringTokenizer tok = new StringTokenizer(action, "&\t\n\r"); /* 1685 */ while (tok.hasMoreTokens()) { /* 1686 */ String subAction = tok.nextToken(); /* 1687 */ totalTime += this.animator.getAnimationTime(this.figureType, subAction); /* 1688 */ vanimations.addElement(subAction); /* */ } /* */ /* 1691 */ this.animations = vanimations.elements(); /* */ /* 1693 */ timerDone(); /* */ /* 1695 */ return totalTime; /* */ } /* */ /* */ public Vector getAnimationList() { /* 1699 */ if (this.animationList != null) { /* 1700 */ return this.animationList; /* */ } /* 1702 */ this.animationList = DroneAnimator.getActionList(this.figureType); /* 1703 */ return this.animationList; /* */ } /* */ /* 1706 */ private boolean doLOD = false; /* */ protected int expressionStart; /* */ /* 1709 */ public void enableLOD(boolean flag) { this.doLOD = flag; } /* */ /* */ /* */ /* */ public boolean handle(MouseDownEvent e) /* */ { /* 1715 */ return false; /* */ } /* */ /* */ /* */ public boolean handle(FrameEvent fe) /* */ { /* 1721 */ float dist = this.closestView; /* 1722 */ this.closestView = 10000.0F; /* */ /* 1724 */ if ((this.animator == null) || (dist > 900.0F) || (!hasClump())) { /* 1725 */ return true; /* */ } /* 1727 */ if (this.recomputeHeight) { /* 1728 */ if (this.runPrepFigure) /* 1729 */ DroneAnimator.prepFigure(this, this.COG); /* 1730 */ this.recomputeHeight = false; /* */ } /* */ /* */ /* 1734 */ if ((this.doLOD) && /* 1735 */ (setLOD(dist))) { /* 1736 */ return true; /* */ } /* */ /* 1739 */ int time = Std.getRealTime(); /* */ /* */ /* */ /* */ /* 1744 */ Transform t = getObjectToWorldMatrix(); /* */ /* 1746 */ this.animator.moveto(this.figureType, (short)(int)t.getX(), (short)(int)t.getY(), /* 1747 */ (short)(int)t.getZ(), (short)(int)-t.getYaw(), time - 1); /* */ /* */ /* */ /* 1751 */ this.animator.update(null, this, time, t.getScaleX(), dist > 700.0F); /* 1752 */ t.recycle(); /* */ /* */ /* 1755 */ if (this.expressionStart > 0) /* */ { /* 1757 */ time -= this.expressionStart; /* */ do { /* 1759 */ TimedMatChange t = /* 1760 */ (TimedMatChange)this.expressionChanges.elementAt(this.nextChange); /* 1761 */ if (time < t.when) { /* */ break; /* */ } /* */ /* 1765 */ if (t.mat != origMat) { /* 1766 */ t.limb.setMaterial(t.mat); /* */ } /* 1768 */ } while (++this.nextChange < this.expressionChanges.size()); /* */ /* 1770 */ this.nextChange = 0; /* */ /* */ /* */ /* 1774 */ this.expressionStart += time; /* */ } /* */ /* */ /* */ /* */ /* 1780 */ return true; /* */ } /* */ /* */ /* */ /* */ /* */ /* */ protected int nextChange; /* */ /* */ /* */ /* */ /* */ protected Vector expressionChanges; /* */ /* */ /* */ /* */ /* 1797 */ private static Object classCookie = new Object(); /* */ /* */ public Object properties(int index, int offset, int mode, Object value) throws NoSuchPropertyException /* */ { /* 1801 */ Object ret = null; /* 1802 */ switch (index - offset) { /* */ case 0: /* 1804 */ if (mode == 0) { /* 1805 */ ret = BooleanPropertyEditor.make(new Property(this, index, /* 1806 */ "Center of Gravity"), "No", "Yes"); /* 1807 */ } else if (mode == 1) { /* 1808 */ ret = new Boolean(this.COG); /* 1809 */ } else if (mode == 2) { /* 1810 */ this.COG = ((Boolean)value).booleanValue(); /* */ /* 1812 */ URL u = getURL(); /* 1813 */ setURL(defaultURL); /* 1814 */ setURL(u); /* */ } /* 1816 */ break; /* */ default: /* 1818 */ ret = super.properties(index, offset + 1, mode, value); /* */ } /* 1820 */ return ret; /* */ } /* */ /* */ public void saveState(Saver s) throws IOException { /* 1824 */ s.saveVersion(1, classCookie); /* 1825 */ s.saveBoolean(this.COG); /* */ /* 1827 */ if (this.subparts != null) { /* 1828 */ this.subparts.detach(); /* 1829 */ super.saveState(s); /* 1830 */ add(this.subparts); /* */ } else { /* 1832 */ super.saveState(s); /* */ } /* */ } /* */ /* 1836 */ public void restoreState(Restorer r) throws IOException, TooNewException { switch (r.restoreVersion(classCookie)) { /* */ case 1: /* 1838 */ this.COG = r.restoreBoolean(); /* */ case 0: /* 1840 */ super.restoreState(r); /* 1841 */ break; /* */ /* */ default: /* 1844 */ throw new TooNewException(); /* */ } /* */ } /* */ /* */ public String toString() { /* 1849 */ return getName(); /* */ } /* */ /* */ public PosableShape() {} /* */ /* */ class TimedMatChange /* */ { /* */ Shape limb; /* */ Material mat; /* */ int when; /* */ /* */ TimedMatChange() {} /* */ } /* */ } /* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\PosableShape.class * Java compiler version: 6 (50.0) * JD-Core Version: 0.7.1 */