コード例 #1
0
 public void enableInterface(boolean multi) {
   if (inMulti == multi) {
     return;
   }
   inMulti = multi;
   ActionSender.sendInterfaceConfig(player, 745, 3, false);
   ActionSender.sendInterfaceConfig(player, 745, 6, false);
   ActionSender.sendInterfaceConfig(player, 745, 1, !multi); // multi zone
 }
コード例 #2
0
 @Override
 public boolean castSpell(Interaction interaction) {
   MagicFormulae.setDamage(interaction);
   int speed =
       (int)
           (46
               + interaction
                       .getSource()
                       .getLocation()
                       .getDistance(interaction.getVictim().getLocation())
                   * 10);
   ProjectileManager.sendProjectile(
       Projectile.create(
           interaction.getSource(), interaction.getVictim(), 380, 43, 0, 51, speed, 16, 64));
   interaction.getSource().animate(1978);
   if (interaction.getDamage().getHit() > -1
       && interaction.getVictim().isPlayer()
       && RANDOM.nextInt(20) < 4) {
     Player p = interaction.getVictim().getPlayer();
     ActionSender.sendMessage(p, "You have been blinded.");
     int attackLevel = p.getSkills().getLevel(Skills.ATTACK);
     attackLevel -= attackLevel * 0.1;
     p.getSkills().set(Skills.ATTACK, attackLevel);
   }
   interaction.setEndGraphic(Graphic.create(381));
   return true;
 }
コード例 #3
0
ファイル: IconManager.java プロジェクト: mitch112/SmexyServer
 public static int iconOnMob(Player player, Mob mob, int arrowId, int modelId) {
   int slot = freeIconSlot(player, mob);
   if (slot > -1) {
     Icon icon = new Icon(slot, mob.getIndex(), mob.isPlayer() ? 10 : 1, arrowId, modelId);
     player.setAttribute("icon_slot" + slot, icon);
     ActionSender.sendHintIcon(player, icon);
   }
   return slot;
 }
コード例 #4
0
ファイル: IconManager.java プロジェクト: mitch112/SmexyServer
 public static int iconOnCoordinate(Player player, Location l, int arrowId, int modelId) {
   int slot = freeIconSlot(player, l);
   if (slot > -1) {
     Icon icon = new Icon(slot, l, 2, arrowId, modelId);
     player.setAttribute("icon_slot" + slot, icon);
     ActionSender.sendHintIcon(player, icon);
   }
   return slot;
 }
コード例 #5
0
ファイル: IconManager.java プロジェクト: mitch112/SmexyServer
 public static void removeIcon(Player player, Location l) {
   if (l == null) {
     return;
   }
   int slot = freeIconSlot(player, l);
   Icon icon = player.getAttribute("icon_slot" + slot);
   if (icon != null) {
     icon.targetType = 0;
     ActionSender.sendHintIcon(player, icon);
     player.removeAttribute("icon_slot" + slot);
   }
 }
コード例 #6
0
ファイル: IconManager.java プロジェクト: mitch112/SmexyServer
 public static void removeIcon(Player player, Mob mob) {
   if (mob == null) {
     return;
   }
   int slot = freeIconSlot(player, mob);
   Icon icon = player.getAttribute("icon_slot" + slot);
   if (icon != null) {
     icon.targetType = 0;
     // icon.index = -1;
     ActionSender.sendHintIcon(player, icon);
     player.removeAttribute("icon_slot" + slot);
   }
 }
コード例 #7
0
ファイル: Obelisks.java プロジェクト: epicscape/Hello-World
  public static boolean handle(final Player player, final GameObject object) {
    int index = -1;
    outer_loop:
    for (int i = 0; i < OBELISKS.length; i++) {
      for (Location l : OBELISKS[i]) {
        if (l == object.getLocation()) {
          index = i;
          break outer_loop;
        }
      }
    }
    if (index != -1) {
      if (obeliskActivated[index]) {
        player.sendMessage("The obelisk is already active.");
        return true;
      }

      obeliskActivated[index] = true;

      player.sendMessage("The obelisk is now activated.");
      for (Player p : Region.getLocalPlayers(player.getLocation(), 10)) {
        for (Location position : OBELISKS[index]) {
          ActionSender.sendObject(
              p, 14825, position.getX(), position.getY(), position.getZ(), 10, 0);
        }
      }

      int random = index;
      while (random == index) {
        random = r.nextInt(OBELISKS.length);
      }

      final Location[][] startingPositions = OBELISK_POSITIONS[index];
      final Location[][] endingPositions = OBELISK_POSITIONS[random];
      final int fIndex = index;
      World.getWorld()
          .submit(
              new Tick(6) {
                @Override
                public void execute() {
                  for (final Player p : Region.getLocalPlayers(player.getLocation(), 5)) {
                    for (Location position : OBELISKS[fIndex]) {
                      ActionSender.sendObject(
                          p,
                          object.getId(),
                          position.getX(),
                          position.getY(),
                          position.getZ(),
                          10,
                          0);
                    }
                    for (int posIndex1 = 0; posIndex1 < startingPositions.length; posIndex1++) {
                      for (int posIndex2 = 0;
                          posIndex2 < startingPositions[posIndex1].length;
                          posIndex2++) {
                        final int fPosindex1 = posIndex1;
                        final int fPosindex2 = posIndex2;
                        if (startingPositions[posIndex1][posIndex2] == p.getLocation()) {
                          if (p.getAttribute("teleblock", 0) > World.getTicks()) {
                            p.sendMessage("You're currently teleblocked.");
                            return;
                          }
                          p.animate(8939);
                          World.getWorld()
                              .submit(
                                  new Tick(3) {
                                    @Override
                                    public void execute() {
                                      p.teleport(endingPositions[fPosindex1][fPosindex2]);
                                      p.animate(8941, 0);
                                      stop();
                                    }
                                  });
                        }
                      }
                    }
                    stop();
                  }
                  obeliskActivated[fIndex] = false;
                  this.stop();
                }
              });
      return true;
    } else {
      return false;
    }
  }
コード例 #8
0
 @Override
 public void execute() {
   if (player.isOnline()) {
     if (player.getAttribute("looted_barrows") == Boolean.TRUE
         && !World.getWorld()
             .getAreaManager()
             .getAreaByName("BarrowsUnderground")
             .contains(player.getLocation())) {
       player.removeAttribute("looted_barrows");
       ActionSender.resetCamera(player);
     }
     if (World.getWorld().getAreaManager().getAreaByName("Duel").contains(player.getLocation())) {
       if (!inDuelArena) {
         inDuelArena = true;
         updateWildernessState(false);
         ActionSender.sendPlayerOption(player, "Challenge", 1, false);
         ActionSender.sendOverlay(player, 638);
         ActionSender.sendInterfaceConfig(player, 638, 1, true);
       } else {
         if (player.getAttribute("isInDuelArena", Boolean.FALSE) == Boolean.TRUE) {
           ActionSender.sendPlayerOption(player, "Attack", 1, true);
         }
       }
     } else if (World.getWorld()
         .getAreaManager()
         .getAreaByName("Godwars")
         .contains(player.getLocation())) {
       if (player.getAttribute("inGod", Boolean.FALSE) == Boolean.FALSE) {
         ActionSender.sendOverlay(player, 601);
         player.setAttribute("inGod", Boolean.TRUE);
       }
       ActionSender.sendString(
           player, "" + player.getSettings().getKillCount()[Constants.ARMADYL_KILL_COUNT], 601, 8);
       ActionSender.sendString(
           player, "" + player.getSettings().getKillCount()[Constants.BANDOS_KILL_COUNT], 601, 9);
       ActionSender.sendString(
           player, "" + player.getSettings().getKillCount()[Constants.SARA_KILL_COUNT], 601, 10);
       ActionSender.sendString(
           player, "" + player.getSettings().getKillCount()[Constants.ZAMMY_KILL_COUNT], 601, 11);
     } else if (World.getWorld()
             .getAreaManager()
             .getAreaByName("WGuild")
             .contains(player.getLocation())
         || World.getWorld()
             .getAreaManager()
             .getAreaByName("WGuildCatapult")
             .contains(player.getLocation())) {
       if (player.getAttribute("inWGuild", Boolean.FALSE) == Boolean.FALSE) {
         ActionSender.sendOverlay(player, 1057);
         player.setAttribute("inWGuild", Boolean.TRUE);
       }
       ActionSender.sendString(player, "" + player.getSettings().getTokens()[0], 1057, 13);
       ActionSender.sendString(player, "" + player.getSettings().getTokens()[1], 1057, 16);
       ActionSender.sendString(player, "" + player.getSettings().getTokens()[2], 1057, 19);
       ActionSender.sendString(player, "" + player.getSettings().getTokens()[3], 1057, 22);
       ActionSender.sendString(player, "" + player.getSettings().getTokens()[4], 1057, 25);
       /*            } else if (World.getWorld().getAreaManager().getAreaByName("BarrowsUnderground").contains(player.getLocation())) {
       if (player.getAttribute("looted_barrows") == Boolean.TRUE) {
           ActionSender.shakeCamera(player, 10);
           return;
       }
       if (player.getLocation().getZ() == 0 && player.getAttribute(Barrows.TUNNEL_CRYPT) == null && player.getAttribute("canLoot") != Boolean.TRUE) {
           player.teleport(3565, 3307, 0);
           inBarrows = false;
       }
       if (!inBarrows || updateBarrows) {
           inBarrows = true;
           ActionSender.sendCloseOverlay(player);
           ActionSender.sendOverlay(player, 24);
           ActionSender.sendBConfig(player, 1043, -1);
           ActionSender.sendConfig(player, 453, slayedBrothers());
           //ActionSender.sendString(player, Integer.toString(player.getSettings().getKillCount()[Constants.BARROW_KILL_COUNT]), 24, 6);
           currentBlackout = ActionSender.BLACKOUT_MAP;
           updateBarrows = false;
       } else {
           if (barrowsDrainTime > 0) {
               barrowsDrainTime--;
           } else {
               List<Integer> killedBrothers = null;
               for (int i = 0; i < player.getSettings().getKilledBrothers().length; i++) {
                   if (!player.getSettings().getKilledBrothers()[i]) {
                       continue;
                   }
                   if (killedBrothers == null) {
                       killedBrothers = new ArrayList<Integer>();
                   }
                   killedBrothers.add(i);
               }
               if (killedBrothers != null) {
                   int head = 4761 + (killedBrothers.get(player.getRandom().nextInt(killedBrothers.size())) * 2);
                   if (player.getLocation().getZ() == 0) {
                       head++;
                   }
                   ActionSender.sendCloseOverlay(player);
                   ActionSender.sendOverlay(player, 24);
                   ActionSender.sendBConfig(player, 1043, head);
               }
               barrowsDrainTime = 13 + Misc.random(5);
           }
       }*/
     } else if (!(player.getActivity() instanceof BarrowsActivity)
         && BarrowsConstants.isInBarrowsZone(player)) {
       ActivityManager.getSingleton().register(new BarrowsActivity(player));
     } else if (World.getWorld()
         .getAreaManager()
         .getAreaByName("Wilderness")
         .contains(player.getLocation())) {
       if (!inWilderness) {
         updateWildernessState(true);
         ActionSender.sendPlayerOption(player, "Attack", 1, true);
         sendWildyInterface(player);
       }
     } else if (World.getWorld()
         .getAreaManager()
         .getAreaByName("Puro-Puro")
         .contains(player.getLocation())) {
       currentBlackout = ActionSender.BLACKOUT_MAP;
     } else if (player.getActivity().getActivityId() != 0) {
       currentBlackout = ActionSender.NO_BLACKOUT;
       if (inWilderness
           || inBarrows
           || inDuelArena
           || player.getAttribute("inGod", false)
           || player.getAttribute("inWGuild", false)) {
         ActionSender.sendCloseOverlay(player);
         player.removeAttribute("inGod");
         player.removeAttribute("inWGuild");
       }
       inDuelArena = false;
       inBarrows = false;
       updateWildernessState(false); // k done
       if (World.getWorld().getAreaManager().getAreaByName("Nex").contains(player.getLocation())) {
         enableInterface(false);
       } else {
         enableInterface(true);
       }
       ActionSender.sendPlayerOption(player, "null", 1, true);
       ActionSender.sendInterfaceConfig(player, 381, 1, true);
       ActionSender.sendInterfaceConfig(player, 381, 2, true);
     }
     if (World.getWorld()
         .getAreaManager()
         .getAreaByName("SafePk")
         .contains(player.getLocation())) {
       updateWildernessState(true);
       ActionSender.sendPlayerOption(player, "Attack", 1, true);
       sendWildyInterface(player);
       multi = false;
       enableInterface(true);
     }
     if (lastBlackout != currentBlackout) {
       lastBlackout = currentBlackout;
       ActionSender.updateMinimap(player, currentBlackout);
     }
     if (!player.isMulti() && multi) {
       multi = false;
       enableInterface(true);
     } else if (!multi && player.isMulti()) {
       multi = true;
       enableInterface(false);
     }
     if (player.inWilderness()) {
       if (player.getAttribute("overloads", Boolean.FALSE) == Boolean.TRUE) {
         for (int i = 0;
             i < Drinking.Drink.OVERLOAD.getSkills().length;
             i++) { // HOLY SHIT IM DUMBBB
           int skill = Drinking.Drink.OVERLOAD.getSkill(i);
           if (skill == Skills.RANGE || skill == Skills.MAGIC) {
             player.getSkills().increaseLevelToMaximumModification(skill, 0);
           } else {
             int modification =
                 (int) Math.floor(5 + (player.getSkills().getLevelForExperience(skill) * 0.15));
             player
                 .getSkills()
                 .set(skill, player.getSkills().getLevelForExperience(skill) + modification);
           }
         }
         player.removeAttribute("overloads");
       } else if (player.getAttribute("extremeType") != null) {
         Drink drink = player.getAttribute("extremeType");
         for (int i = 0; i < drink.getSkills().length; i++) { // HOLY SHIT IM DUMBBB
           int skill = drink.getSkill(i);
           if (skill == Skills.RANGE || skill == Skills.MAGIC) {
             player.getSkills().increaseLevelToMaximumModification(skill, 0);
           } else {
             int modification =
                 (int) Math.floor(5 + (player.getSkills().getLevelForExperience(skill) * 0.15));
             player
                 .getSkills()
                 .set(skill, player.getSkills().getLevelForExperience(skill) + modification);
           }
         }
         player.removeAttribute("extremeType");
       }
     }
   } else {
     this.stop();
   }
 }
コード例 #9
0
  private void sendWildyInterface(Player p) {
    ActionSender.sendOverlay(p, 381);
    // ActionSender.sendInterfaceConfig(p, 381, 1, false);
    // ActionSender.sendInterfaceConfig(p, 381, 2, false);

  }