Package org.mozilla.javascript

Examples of org.mozilla.javascript.ScriptableObject$Slot


      throws GameEngineException {
    Step step = MiniProfiler.step("API.createPlayer");

    try {
      // createPlayer
      final ScriptableObject player = (ScriptableObject) ge.invoke(
          "Player", new String[] { username, });
      final LinkedHashMap<String, ScriptableObject[]> disks = new LinkedHashMap<String, ScriptableObject[]>();

      // Knights
      // Pikemen
      disks.put("Pikemen",
          new ScriptableObject[] { createPoint(-3.2, -6.2),
              createPoint(-1.2, -5), createPoint(-2.6, -3.6), });

      // Heavy Horse Cavalry
      disks.put("Heavy Horse Cavalry", new ScriptableObject[] {
          createPoint(-4.5, -4.5), createPoint(-5.7, -2.9),
          createPoint(-4.1, -1.7), createPoint(-6, -.8) });

      // Elf
      // Deepwood Warriors x3
      disks.put("Deepwood Warriors", new ScriptableObject[] {
          createPoint(3.6, -6.4), createPoint(2.4, -5.4),
          createPoint(3.6, -3.8), });
      // Riders of the Wood x4
      disks.put("Riders of the Wood", new ScriptableObject[] {
          createPoint(4.6, -5.4), createPoint(6.5, -4.0),
          createPoint(5.1, -2.1), createPoint(6.5, -.6) });
      // Deepwood Archers x2
      disks.put("Deepwood Archers",
          new ScriptableObject[] { createPoint(7.5, -2.3),
              createPoint(8.8, -1) });

      // Dwarf
      // Damlo Hammerfist
      disks.put("Damlo Hammerfist",
          new ScriptableObject[] { createPoint(-8.7, 1.3), });
      // Grovan of the Deep
      disks.put("Grovan of the Deep",
          new ScriptableObject[] { createPoint(-9.7, 2.2), });
      // Stalwarts x1
      disks.put("Stalwarts",
          new ScriptableObject[] { createPoint(-9.1, 3.8), });

      // Regiment of the Anvil x5
      disks.put("Regiment of the Anvil",
          new ScriptableObject[] { createPoint(-7.6, 2.9),
              createPoint(-6.8, 4.2), createPoint(-8.2, 5),
              createPoint(-7.2, 6.5), createPoint(-5.7, 5.7), });

      // Orc
      // Urgg the Really Mean x1[+][-]
      disks.put("Urgg the Really Mean",
          new ScriptableObject[] { createPoint(9.4, 1.3), });
      // Shieldgrogs x2[+][-]
      disks.put("Shieldgrogs",
          new ScriptableObject[] { createPoint(9.8, 3.4),
              createPoint(10.5, 2.5), });
      // Ghash Zzurkan x1[+][-]
      disks.put("Ghash Zzurkan",
          new ScriptableObject[] { createPoint(8.4, 2.5), });
      // Grugs x5
      disks.put("Grugs",
          new ScriptableObject[] { createPoint(6.6, 6.7),
              createPoint(6.6, 5), createPoint(7.9, 6.1),
              createPoint(7.5, 3.8), createPoint(8.8, 4.8), });

      // Dragon
      // Dragonflight
      disks.put(
          "Dragonflight",
          new ScriptableObject[] { createPoint(-3, 7),
              createPoint(-3, 8.5), createPoint(-1.5, 8.5),
              createPoint(-1.5, 7) });

      // Drake Warriors
      disks.put(
          "Drake Warriors",
          new ScriptableObject[] { createPoint(0, 7),
              createPoint(0, 8.5), createPoint(1.5, 8.5), });

      // Dragonling
      disks.put("Dragonling", new ScriptableObject[] {
          createPoint(1.5, 7), createPoint(3, 7),
          createPoint(3, 8.5), });

      final String knights = "Starter Knights";
      final String elves = "Starter Elf";
      final String dwarfs = "Starter Dwarf";
      final String dragons = "Starter Dragons";
      final String orcs = "Starter Orc";

      for (final Entry<String, ScriptableObject[]> entry : disks
          .entrySet()) {
        final ScriptableObject disk = getDisk(entry.getKey());
        if (disk.get("name") != null) {

          for (final ScriptableObject location : entry.getValue()) {

            // addDisk
            Object diskNumber = ge.invoke(player, "addDisk",
                new Object[] { disk, location });

            // knight disk
            if (disk.get("faction").equals("Knight")) {
              ge.invoke(player, "addDiskToArmy", new Object[] {
                  knights, diskNumber, location });
            }
            // dragon disk
            else if (disk.get("faction").equals("Dragon")) {
              ge.invoke(player, "addDiskToArmy", new Object[] {
                  dragons, diskNumber, location });
            }
            // dwarf disk
            else if (disk.get("faction").equals("Dwarf")) {
              ge.invoke(player, "addDiskToArmy", new Object[] {
                  dwarfs, diskNumber, location });
            }

            // elf disk
            else if (disk.get("faction").equals("Elf")) {
              ge.invoke(player, "addDiskToArmy", new Object[] {
                  elves, diskNumber, location });
            }

            // orc disk
            else if (disk.get("faction").equals("Orc")) {
              ge.invoke(player, "addDiskToArmy", new Object[] {
                  orcs, diskNumber, location });
            }
          }
        }
View Full Code Here


  }

  private ScriptableObject createTable() throws GameEngineException {
    Step step = MiniProfiler.step("API.createTable");
    try {
      final ScriptableObject table = (ScriptableObject) ge
          .invoke("Table");

      return table;
    } finally {
      step.close();
View Full Code Here

      final String startingDisks, final String reinforcements,
      final String alignmentRestriction, final String scenario)
      throws GameEngineException {
    Step step = MiniProfiler.step("API.createTable(...)");
    try {
      final ScriptableObject table = (ScriptableObject) ge.invoke(
          "Table", new String[] { maxPlayers, maxPoints, activations,
              startingDisks, reinforcements,
              alignmentRestriction, scenario, });
      ge.invoke(table, "placeStagingDisks", new String[] {});
      return table;
View Full Code Here

  private ScriptableObject getDisk(final String name)
      throws GameEngineException {
    Step step = MiniProfiler.step("API.getDisk");
    try {
      final ScriptableObject disk = (ScriptableObject) ge.invoke("Disk");

      final HashMap<String, Object> hashMap = ge.persistence.get("Disk",
          name);
      final String text = (String) hashMap.get("json");
      if (text != null) {
View Full Code Here

  private ScriptableObject getPlayer(final String username)
      throws GameEngineException {
    Step step = MiniProfiler.step("API.getPlayer");
    try {
      ScriptableObject player = null;
      if (username != null && !username.equals("")) {
        final HashMap<String, Object> hashMap = ge.persistence.get(
            "Player", username);
        // handle player being null
        if (!hashMap.isEmpty()) {
View Full Code Here

    Step step = MiniProfiler.step("API.getTable");
    try {
      final HashMap<String, Object> hashMap = ge.persistence.get("Table",
          tableId);

      final ScriptableObject table = createTable();

      String json = (String) hashMap.get("json");
      // convert the json string to an object
      Object jsonObject = ge.parse(json);
      restoreTable(table, jsonObject);

      Integer currentMementoId = (Integer) table.get("mementoId");
      if (currentMementoId == null) {
        currentMementoId = -1;
      }

      // if mementoId is greater then the tables mementoId
      if (mementoId < currentMementoId) {
        // get the mementos that are greater then mementoId
        PreparedQuery mementos = getMementos(tableId, mementoId);
        addMementos(table, mementos);
        // redo the json attribute
        json = stringify(table);
        // ScriptableObject.putProperty(table, "json", json2);
      }
      table.put("json", table, json);

      return table;
    } finally {
      step.close();
    }
View Full Code Here

    try {

      // Table.join returns an object that indicates success or failure
      // and failure messages
      ScriptableObject joinResult = (ScriptableObject) ge.invoke(table,
          "join", new Object[] { player, armyName });

      // don't save armies and disks
      ScriptableObject.deleteProperty(player, "armies");
      ScriptableObject.deleteProperty(player, "cart");
View Full Code Here

      final String pointString, final String missileName)
      throws GameEngineException {

    Step step = MiniProfiler.step("API.fireMissiles");
    try {
      final ScriptableObject point = ge.execute("_=" + pointString);

      ScriptableObject missile = this.getDisk(missileName);

      ge.invoke(table, "fireMissiles", new Object[] { playerName,
          diskNumber, point, missile });
      saveTable(table);
View Full Code Here

      final String pointString) throws GameEngineException {

    Step step = MiniProfiler.step("API.move");
    try {
      // MOVE_DISK
      final ScriptableObject point = ge.execute("_=" + pointString);

      final Object moveResult = ge.invoke(table, "move", new Object[] {
          playerName, diskNumber, point });
      saveTable(table);
View Full Code Here

        Long mementoId = getMementoId(parameters);

        json.append("\"table\":");

        if (tableId != null) {
          ScriptableObject table = null;
          try {
            table = getTable(tableId, mementoId);
            // final ScriptableObject excludedKeys =
            // ge.execute("[\"actions\"]");
            // make sure any mementos we looked up and added
            // get sent too
            json.append(table.get("json"));
            // json.append(stringify(table, excludedKeys));
          } catch (GameEngineException gee) {
            json.append("{}");
            // GameEngineException
            mailUnitTest(createUnitTest(table));
            throw gee;
          }
        } else {
          json.append("{}");
        }

        final ScriptableObject player = getPlayer(userName);

        if (player != null) {
          json.append(",\"player\":");
          json.append(stringify(player));
        }

        break;
      }
      case JOIN_TABLE: {
        // JOIN_TABLE
        final Long tableId = getTableId(parameters);
        final String armyName = (String) API.getParameter("army",
            parameters);
        if (userName == null || userName == "") {

          try {
            response.sendRedirect("/login.html?return_to=battledisks%252Fapi%253Faction%253DJOIN_TABLE%2526id%253D"
                + tableId + "%2526army%253D" + armyName);
            return null;
          } catch (IOException e1) {
            e1.printStackTrace();
          }

        }
        ScriptableObject table = null;
        try {
          // make sure the player is allowed to join another table
          String tablesStringJson = getOpenAndActiveTables(userName);
          NativeArray tables = (NativeArray) ge
              .execute(tablesStringJson);
          if (tables.size() >= MAX_TABLES) {
            // tell the player they are not allowed to join another
            // table
            json.append("\"messages\":[\"You are already in "
                + MAX_TABLES + " active tables.\"],");
          } else {
            ScriptableObject player = getPlayer(userName);
            final Long mementoId = getMementoId(parameters);
            table = getTable(tableId, mementoId);

            ScriptableObject joinResult = join(table, player,
                armyName);

            if (!(Boolean) joinResult.get("success")) {
              // TODO give joinResult to the user
            }

          }
        } catch (GameEngineException gee) {
          // GameEngineException
          mailUnitTest(createUnitTest(table));
          throw gee;
        }
        //
        json.append("\"id\":");
        json.append(tableId);
      }
        break;

      case CREATE_TABLE: {
        if (userName != null && !userName.equals("")) {

          ScriptableObject player = getPlayer(userName);
          final String maxPlayers = (String) getParameter(
              "maxPlayers", parameters);
          final String armyName = (String) getParameter("armyName",
              parameters);
          final String activations = (String) getParameter(
              "activations", parameters);
          final String startingDisks = (String) getParameter(
              "startingDisks", parameters);
          final String reinforcements = (String) getParameter(
              "reinforcements", parameters);
          final String alignmentRestriction = (String) getParameter(
              "alignmentRestriction", parameters);
          final String maxPoints = (String) getParameter("maxPoints",
              parameters);
          final String scenario = (String) getParameter("scenario",
              parameters);

          ScriptableObject table = null;
          try {
            // make sure the player is allowed to create a new table
            String tablesStringJson = getOpenAndActiveTables(userName);
            NativeArray tables = (NativeArray) ge
                .execute(tablesStringJson);
            if (tables.size() >= 4) {
              // tell the player they are not allowed to create
              // more
              // tables

              json.append("\"messages\":[\"You are already in 4 active tables.\"]");

            } else {
              table = createTable(maxPlayers, maxPoints,
                  activations, startingDisks, reinforcements,
                  alignmentRestriction, scenario);

              ScriptableObject joinResult = join(table, player,
                  armyName);

              Object success = joinResult.get("success");
              if ((Boolean) success) {

                final Long tableId = getId(table);

                json.append("\"id\":");
                json.append(tableId);
              } else {
                json.append(",\"messages\":[");
                // TODO give joinResult to the user
                NativeArray messages = (NativeArray) joinResult
                    .get("messages");
                for (Object message : messages) {
                  json.append("\"" + message + "\",");
                }
                json.append("]");
              }
            }

          } catch (GameEngineException gee) {
            // GameEngineException
            mailUnitTest(createUnitTest(table));
            throw gee;
          }

        }
      }
        break;
      case GET_ALL_TABLES: {
        json.append("\"openTables\":");

        // only get open tables
        String fd = getOpenTables();
        json.append(fd);

        json.append(",\"activeTables\":");

        // only get open tables
        fd = getActiveTables();
        json.append(fd);

        final ScriptableObject player = getPlayer(userName);

        if (player != null) {
          json.append(",\"player\":");
          json.append(stringify(player));
        }
      }
        break;
      case CREATE_DISK: {

        final String name = (String) getParameter("name", parameters);

        if (name == null || name.equals("")) {
          break;
        }

        final String type = (String) getParameter("type", parameters);

        final Integer attack = Integer.parseInt((String) getParameter(
            "attack", parameters));
        final Integer defense = Integer.parseInt((String) getParameter(
            "defense", parameters));
        final Integer toughness = Integer
            .parseInt((String) getParameter("toughness", parameters));
        final Integer movement = Integer
            .parseInt((String) getParameter("movement", parameters));
        final Integer wounds = Integer.parseInt((String) getParameter(
            "wounds", parameters));
        final Boolean flying = getParameter("flying", parameters) == null ? false
            : Boolean.parseBoolean((String) getParameter("flying",
                parameters));
        final Boolean swashbuckler = getParameter("swashbuckler",
            parameters) == null ? false : Boolean
            .parseBoolean((String) getParameter("swashbuckler",
                parameters));
        final Boolean archer = getParameter("archer", parameters) == null ? false
            : Boolean.parseBoolean((String) getParameter("archer",
                parameters));

        final Integer arrows = getParameter("arrows", parameters) == null ? 0
            : Integer.parseInt((String) getParameter("arrows",
                parameters));

        final Integer bolts = getParameter("bolts", parameters) == null ? 0
            : Integer.parseInt((String) getParameter("bolts",
                parameters));

        final Integer fireballs = getParameter("fireballs", parameters) == null ? 0
            : Integer.parseInt((String) getParameter("fireballs",
                parameters));

        final Integer boulders = getParameter("boulders", parameters) == null ? 0
            : Integer.parseInt((String) getParameter("boulders",
                parameters));

        final Integer spellcaster = Integer
            .parseInt((String) getParameter("spellcaster",
                parameters));

        final Integer limit = Integer.parseInt((String) getParameter(
            "limit", parameters));

        String parameter = (String) getParameter("missileImmunity",
            parameters);
        final Boolean missileImmunity = getParameter("missileImmunity",
            parameters) == null ? false : Boolean
            .parseBoolean(parameter);

        final Boolean firstblow = getParameter("firstblow", parameters) == null ? false
            : Boolean.parseBoolean((String) getParameter(
                "firstblow", parameters));

        final Integer cost = Integer.parseInt((String) getParameter(
            "cost", parameters));
        final String faction = (String) getParameter("faction",
            parameters);
        final String alignment = (String) getParameter("alignment",
            parameters);
        final String diameter = (String) getParameter("diameter",
            parameters);
        final String description = (String) getParameter("description",
            parameters);
        final String price = (String) getParameter("price", parameters);

        // name, attack, defense, toughness, movement, wounds, flying,
        // swashbuckler, archer, arrows, bolts, fireballs, boulders,
        // missileImmunity, firstblow, spellcaster, cost, faction,
        // alignment, diameter, description, price
        try {
          createDisk(name, type, attack, defense, toughness,
              movement, wounds, flying, swashbuckler, archer,
              arrows, bolts, fireballs, boulders,
              missileImmunity, firstblow, spellcaster, limit,
              cost, faction, alignment, diameter, description,
              price);

          // redirect to a better place
          response.sendRedirect("/battledisks/disk.jsp#!" + name);
        } catch (GameEngineException gee) {
          // GameEngineException CREATE_DISK
          throw new APIException(gee);
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
        break;
      case LOG_IN: {
        try {
          final ScriptableObject player = getPlayer(userName);
          if (player == null) {
            createPlayer(userName);
          }
          response.sendRedirect("/battledisks/profile.html");
          return null;
        } catch (GameEngineException gee) {
          throw new APIException(gee);
        } catch (IOException e) {
          e.printStackTrace();
        }
      }
        break;
      case PROFILE: {

        try {
          final ScriptableObject player = getPlayer(userName);

          if (player != null) {
            json.append("\"player\":");
            String f = getOpenAndActiveTables(userName);

            NativeArray na = (NativeArray) ge.execute(f);
            player.put("activeTables", player, na);

            json.append(stringify(player));
            json.append(",");
          }
          json.replace(json.length() - 1, json.length(), "");

        } catch (GameEngineException gee) {
          // GameEngineException GET_MY_DISKS
          throw new APIException(gee);
        }
        break;
      }

      case SAVE_ARMY: {
        // SAVE_ARMY
        final ScriptableObject player = getPlayer(userName);

        if (player != null) {

          final String armyName = (String) getParameter("armyName",
              parameters);

          final String disks = (String) getParameter("disks",
              parameters);

          ge.invoke(player, "saveArmy",
              new Object[] { armyName, ge.execute(disks) });

          savePlayer(player);

          json.append("\"player\":");
          json.append(player.get("json"));
          json.append(",");

        }
        json.replace(json.length() - 1, json.length(), "");
        break;
      }

      case DELETE_ARMY: {
        final ScriptableObject player = getPlayer(userName);

        if (player != null) {

          final String armyName = (String) getParameter("armyName",
              parameters);

          ge.invoke(player, "deleteArmy", new Object[] { armyName });

          savePlayer(player);

          json.append("\"player\":");
          json.append(player.get("json"));
          json.append(",");

        }
        json.replace(json.length() - 1, json.length(), "");
        break;
      }

      case SAVE_REINFORCEMENT: {
        ScriptableObject table = null;
        try {
          Long mementoId = getMementoId(parameters);
          table = getTable(getTableId(parameters), mementoId);
          final String pointString = (String) getParameter("point",
              parameters);
          final String diskNumber = (String) getParameter(
              "diskNumber", parameters);

          saveReinforcement(table, userName, diskNumber, pointString);

          json.append("\"table\":");
          // final ScriptableObject excludedKeys = ge
          // .execute("[\"actions\"]");
          json.append(table.get("json"));
        } catch (GameEngineException gee) {
          // GameEngineException
          mailUnitTest(createUnitTest(table));
          throw gee;
        }
      }
        break;

      case END_REINFORCEMENTS: {
        ScriptableObject table = null;
        try {
          final Long mementoId = getMementoId(parameters);
          table = getTable(getTableId(parameters), mementoId);
          endReinforcements(table, userName);

          json.append("\"table\":");
          json.append(table.get("json"));
        } catch (GameEngineException gee) {
          // GameEngineException
          mailUnitTest(createUnitTest(table));
          throw gee;
        }

        break;
      }

      case END_MISSILES: {
        ScriptableObject table = null;
        try {
          final Long mementoId = getMementoId(parameters);
          table = getTable(getTableId(parameters), mementoId);
          endMissiles(table, userName);

          json.append("\"table\":");
          json.append(table.get("json"));
        } catch (GameEngineException gee) {
          // GameEngineException
          mailUnitTest(createUnitTest(table));
          throw gee;
        }

        break;
      }

      case FIRE_MISSILES: {
        // FIRE_MISSILES
        ScriptableObject table = null;
        try {
          final Long mementoId = getMementoId(parameters);
          table = getTable(getTableId(parameters), mementoId);

          final String diskNumber = (String) getParameter(
              "diskNumber", parameters);

          final String point = (String) getParameter("point",
              parameters);

          final String missileName = (String) getParameter("missile",
              parameters);

          fireMissiles(table, userName, diskNumber, point,
              missileName);

          json.append("\"table\":");
          json.append(table.get("json"));
        } catch (GameEngineException gee) {
          // GameEngineException
          mailUnitTest(createUnitTest(table));
          throw gee;
        }

        break;
      }

      case MOVE_DISK: {
        final String diskNumber = (String) getParameter("diskNumber",
            parameters);
        final Long mementoId = getMementoId(parameters);
        final ScriptableObject table = getTable(getTableId(parameters),
            mementoId);
        // "diskNumber" : movedDiskNumber,

        // "point" : tableClickPoint
        final String point = (String) getParameter("point", parameters);

        move(table, userName, diskNumber, point);

        json.append("\"table\":");
        // final ScriptableObject excludedKeys = ge
        // .execute("[\"actions\"]");
        // json.append(stringify(table, excludedKeys));
        json.append(table.get("json"));
      }
        break;

      case JWT: {
        try {
          final ScriptableObject player = getPlayer(userName);
          if (player == null) {
            json.append("\"jwt\":\"" + "\"");
            break;
          }

          final String s = saveCart(
              (String) getParameter("disks", parameters), player);
          json.append("\"jwt\":\"" + s + "\"");

        } catch (GameEngineException gee) {
          // GameEngineException JWT
          throw new APIException(gee);
        } catch (InvalidKeyException e) {
          e.printStackTrace();
        } catch (SignatureException e) {
          e.printStackTrace();
        }
      }
        break;
      case CONFIRM: {
        final String jwt = (String) getParameter("jwt", parameters);
        try {
          return confirm(jwt, userName);
        } catch (GameEngineException gee) {
          // GameEngineException CONFIRM
          throw new APIException(gee);
        }
      }
      case GET_ALL_DISKS: {
        json.append("\"disks\":{");

        final HashMap<Object, HashMap<String, Object>> disks = ge.persistence
            .getAll("Disk");

        for (HashMap<String, Object> disk : disks.values()) {
          final String diskJson = (String) disk.get("json");
          final Object diskName = disk.get("name");
          json.append("\"" + diskName + "\":" + diskJson + ",");
        }
        if (disks.size() > 0) {
          // json = json.substring(0, json.length() - 1);
          json.replace(json.length() - 1, json.length(), "");
        }
        json.append("},");

        json.append("\"player\":");
        try {
          final ScriptableObject player = getPlayer(userName);
          json.append(stringify(player));
        } catch (GameEngineException gee) {
          json.append("{}");
          // GameEngineException GET_ALL_DISKS
          throw new APIException(gee);
        }
      }
        break;
      case GET_DISK: {
        final String diskName = (String) getParameter("diskName",
            parameters);

        json.append("\"disk\":");

        final HashMap<String, Object> disk = ge.persistence.get("Disk",
            diskName);
        if (disk != null && disk.get("json") != null) {
          final String text = (String) disk.get("json");
          json.append(text);
        } else {
          json.append("{}");
        }

      }
        break;
      case ACTIVATE_DISK: {
        ScriptableObject table = null;
        try {
          final Long mementoId = getMementoId(parameters);
          table = getTable(getTableId(parameters), mementoId);
          // "diskNumber" : movedDiskNumber,
          final String diskNumber = (String) getParameter(
              "diskNumber", parameters);

          activateDisk(table, diskNumber, userName);

          json.append("\"table\":");
          json.append(table.get("json"));
        } catch (GameEngineException gee) {
          // GameEngineException
          mailUnitTest(createUnitTest(table));
          throw gee;
        }
      }
        break;
      case END_ACTIVATIONS: {
        ScriptableObject table = null;
        try {
          final Long mementoId = getMementoId(parameters);
          table = getTable(getTableId(parameters), mementoId);
          endActivations(table, userName);

          json.append("\"table\":");
          json.append(table.get("json"));
        } catch (GameEngineException gee) {
          // GameEngineException
          mailUnitTest(createUnitTest(table));
          throw gee;
        }
      }
        break;

      case UPLOAD_DISKS: {
        uploadDisks((BlobKey) parameters.get("csv"));
        try {
          response.sendRedirect("/battledisks/disk.jsp");
          return "";
        } catch (IOException e) {
          e.printStackTrace();
        }
        return "";
      }
      case DOWNLOAD_DISKS: {
        downloadDisks(response);
        return "";
      }
      case UNIT_TEST:
      // get the unit test code
      {
        ScriptableObject table = null;
        try {
          final Long mementoId = getMementoId(parameters);
          table = getTable(getTableId(parameters), mementoId);
          return createUnitTest(table);

        } catch (GameEngineException gee) {
          // GameEngineException
          mailUnitTest(createUnitTest(table));
          throw gee;
        }
      }
      case SET_ATTACKEE:
      //
      {
        final Long mementoId = getMementoId(parameters);
        final ScriptableObject table = getTable(getTableId(parameters),
            mementoId);
        final String attacker = (String) getParameter("attacker",
            parameters);
        final String attackee = (String) getParameter("attackee",
            parameters);

        setAttackee(table, userName, attacker, attackee);

        json.append("\"table\":");
        json.append(table.get("json"));
      }
        break;
      case SET_DEFENDEE:
      //
      {
        final Long mementoId = getMementoId(parameters);
        final ScriptableObject table = getTable(getTableId(parameters),
            mementoId);
        final String defender = (String) getParameter("defender",
            parameters);
        final String defendee = (String) getParameter("defendee",
            parameters);

        setDefendee(table, userName, defender, defendee);

        json.append("\"table\":");
        json.append(table.get("json"));
      }
        break;
      case LEADERBOARD: {

        json.append("\"players\":[");
View Full Code Here

TOP

Related Classes of org.mozilla.javascript.ScriptableObject$Slot

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.