summaryrefslogtreecommitdiff
path: root/NET/worlds/scape/SelectAvatarAction.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/SelectAvatarAction.java
downloadworlds.jar-main.tar.xz
worlds.jar-main.zip
:star:HEADmain
Diffstat (limited to 'NET/worlds/scape/SelectAvatarAction.java')
-rw-r--r--NET/worlds/scape/SelectAvatarAction.java223
1 files changed, 223 insertions, 0 deletions
diff --git a/NET/worlds/scape/SelectAvatarAction.java b/NET/worlds/scape/SelectAvatarAction.java
new file mode 100644
index 0000000..f4caec2
--- /dev/null
+++ b/NET/worlds/scape/SelectAvatarAction.java
@@ -0,0 +1,223 @@
+/* */ package NET.worlds.scape;
+/* */
+/* */ import NET.worlds.console.Console;
+/* */ import NET.worlds.console.OkCancelDialog;
+/* */ import NET.worlds.console.PolledDialog;
+/* */ import NET.worlds.core.ServerTableManager;
+/* */ import NET.worlds.network.URL;
+/* */ import java.io.IOException;
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */ public class SelectAvatarAction
+/* */ extends DialogAction
+/* */ {
+/* 47 */ URL url = null;
+/* */
+/* */
+/* */
+/* */ String description;
+/* */
+/* */
+/* */
+/* */
+/* */ private URL getURLVal()
+/* */ {
+/* 58 */ URL val = this.url;
+/* 59 */ if (val == null) {
+/* 60 */ SuperRoot o = getOwner();
+/* 61 */ if ((o instanceof Drone)) {
+/* 62 */ val = ((Drone)o).getSourceURL();
+/* 63 */ } else if ((o instanceof PosableShape)) {
+/* 64 */ val = ((Shape)o).getURL();
+/* 65 */ } else if ((o instanceof Hologram))
+/* 66 */ val = ((Hologram)o).getMovieName();
+/* */ }
+/* 68 */ return val;
+/* */ }
+/* */
+/* */ public void doIt() {
+/* 72 */ Console console = Console.getActive();
+/* 73 */ URL val = getURLVal();
+/* 74 */ if ((console != null) && (val != null))
+/* 75 */ console.setAvatar(val);
+/* */ }
+/* */
+/* */ public PolledDialog getDialog() {
+/* 79 */ URL val = getURLVal();
+/* */
+/* 81 */ if ((!Console.getActive().getVIP()) &&
+/* 82 */ (val.getInternal().toLowerCase().endsWith(".rwg")))
+/* */ {
+/* 84 */ return new OkCancelDialog(Console.getFrame(), this,
+/* 85 */ Console.message("Cant-change-AV"), Console.message("OK"),
+/* 86 */ null, Console.message("Only-VIPs-change"),
+/* 87 */ false);
+/* */ }
+/* 89 */ String desc = this.description;
+/* */
+/* 91 */ if ((desc == null) || (desc.length() == 0)) {
+/* 92 */ desc = getPrettyAvatarName(val.getBase());
+/* */ }
+/* 94 */ return new ChangeAvatarDialog(Console.getFrame(), this, desc);
+/* */ }
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* */
+/* 105 */ static String[] avatarAliases = ServerTableManager.instance().getTable("avatarAliases");
+/* */
+/* */ public static String getPrettyAvatarName(String name)
+/* */ {
+/* 109 */ int extIndex = name.indexOf('.');
+/* */
+/* 111 */ if (extIndex >= 0) {
+/* 112 */ name = name.substring(0, extIndex).toLowerCase();
+/* */ } else {
+/* 114 */ name = name.toLowerCase();
+/* */ }
+/* */
+/* 117 */ for (int i = 0; i < avatarAliases.length; i += 2)
+/* */ {
+/* 119 */ if (avatarAliases[i].equals(name)) {
+/* 120 */ return avatarAliases[(i + 1)];
+/* */ }
+/* */ }
+/* 123 */ String properName = name.substring(0, 1).toUpperCase();
+/* 124 */ if (name.length() > 1) {
+/* 125 */ properName = properName + name.substring(1);
+/* */ }
+/* 127 */ return properName;
+/* */ }
+/* */
+/* */ public Persister trigger(Event e, Persister seqID)
+/* */ {
+/* 132 */ URL val = getURLVal();
+/* */
+/* 134 */ if (val == null) {
+/* 135 */ return null;
+/* */ }
+/* 137 */ return super.trigger(e, seqID);
+/* */ }
+/* */
+/* */
+/* */
+/* */ public Object properties(int index, int offset, int mode, Object value)
+/* */ throws NoSuchPropertyException
+/* */ {
+/* 145 */ Object ret = null;
+/* 146 */ switch (index - offset) {
+/* */ case 0:
+/* 148 */ if (mode == 0) {
+/* 149 */ ret = URLPropertyEditor.make(
+/* 150 */ new Property(this, index, "Avatar URL").allowSetNull(),
+/* 151 */ "pilot;drone;rwx;rwg;mov");
+/* */ }
+/* 153 */ else if (mode == 1) {
+/* 154 */ ret = this.url;
+/* 155 */ } else if (mode == 2)
+/* 156 */ this.url = ((URL)value);
+/* 157 */ break;
+/* */ default:
+/* 159 */ ret = super.properties(index, offset + 1, mode, value);
+/* */ }
+/* 161 */ return ret;
+/* */ }
+/* */
+/* */ public String toString() {
+/* 165 */ return
+/* 166 */ super.toString() + "[url " + (this.url == null ? "null" : new StringBuilder(String.valueOf(this.url.getRelativeTo(this))).append("]").toString());
+/* */ }
+/* */
+/* */
+/* 170 */ private static Object classCookie = new Object();
+/* */
+/* */ public void saveState(Saver s) throws IOException
+/* */ {
+/* 174 */ s.saveVersion(4, classCookie);
+/* 175 */ super.saveState(s);
+/* */
+/* 177 */ URL.save(s, this.url);
+/* 178 */ s.saveString(this.description);
+/* */ }
+/* */
+/* */ public void restoreState(Restorer r) throws IOException, TooNewException
+/* */ {
+/* 183 */ int ver = r.restoreVersion(classCookie);
+/* 184 */ switch (ver) {
+/* */ case 3:
+/* */ case 4:
+/* 187 */ super.restoreState(r);
+/* 188 */ this.url = URL.restore(r, ".world");
+/* 189 */ if (ver >= 4)
+/* 190 */ this.description = r.restoreString();
+/* 191 */ break;
+/* */
+/* */ case 2:
+/* 194 */ dialogActionSkipRestore(r);
+/* 195 */ this.url = URL.restore(r, ".world");
+/* 196 */ this.showDialog = r.restoreBoolean();
+/* 197 */ this.cancelOnly = r.restoreBoolean();
+/* 198 */ break;
+/* */
+/* */ case 1:
+/* 201 */ r.setOldFlag();
+/* 202 */ dialogActionSkipRestore(r);
+/* 203 */ this.url = URL.restore(r, ".world");
+/* 204 */ this.showDialog = r.restoreBoolean();
+/* 205 */ break;
+/* */
+/* */ case 0:
+/* 208 */ r.setOldFlag();
+/* 209 */ dialogActionSkipRestore(r);
+/* 210 */ this.url = URL.restore(r, ".world");
+/* 211 */ break;
+/* */
+/* */ default:
+/* 214 */ throw new TooNewException();
+/* */ }
+/* */ }
+/* */ }
+
+
+/* Location: C:\Program Files (x86)\Worlds Inc\WorldsPlayer - Win7\lib\worlds.jar!\NET\worlds\scape\SelectAvatarAction.class
+ * Java compiler version: 6 (50.0)
+ * JD-Core Version: 0.7.1
+ */ \ No newline at end of file