Example #1
0
 /** Method runImpl. */
 @Override
 protected void runImpl() {
   Player activeChar = getClient().getActiveChar();
   Creature target = activeChar;
   if (activeChar == null) {
     return;
   }
   if (activeChar.getObjectId() != _objectId) {
     for (Summon summon : activeChar.getSummonList()) {
       if (summon.getObjectId() == _objectId) {
         target = summon;
         break;
       }
     }
     if (target == null) {
       return;
     }
   }
   for (Effect e : target.getEffectList().getAllEffects()) {
     if ((e.getDisplayId() == _id) && (e.getDisplayLevel() == _level)) {
       if (!e.isOffensive()
           && !e.getSkill().isMusic()
           && e.getSkill().isSelfDispellable()
           && (e.getSkill().getSkillType() != SkillType.TRANSFORMATION)
           && (e.getTemplate().getEffectType() != EffectType.Hourglass)) {
         e.exit();
       } else {
         return;
       }
     }
   }
 }
Example #2
0
 /**
  * Method doSupportMagic.
  *
  * @param npc NpcInstance
  * @param player Player
  * @param servitor boolean
  */
 public static void doSupportMagic(NpcInstance npc, Player player, boolean servitor) {
   if (player.isCursedWeaponEquipped()) {
     return;
   }
   int lvl = player.getLevel();
   if (servitor && (player.getSummonList().getFirstServitor() == null)) {
     show("default/newbie_nosupport_servitor.htm", player, npc);
     return;
   }
   if (lvl < minSupLvl) {
     show("default/newbie_nosupport_min.htm", player, npc);
     return;
   }
   if (lvl > maxSupLvl) {
     show("default/newbie_nosupport_max.htm", player, npc);
     return;
   }
   List<Creature> target = new ArrayList<>();
   if (servitor) {
     for (Summon summon : player.getSummonList()) {
       target.add(summon);
       for (int[] buff : _summonBuff) {
         if ((lvl >= buff[0]) && (lvl <= buff[1])) {
           npc.broadcastPacket(new MagicSkillUse(npc, summon, buff[2], buff[3], 0, 0));
           npc.callSkill(SkillTable.getInstance().getInfo(buff[2], buff[3]), target, true);
         }
       }
     }
   } else {
     target.add(player);
     if (!player.isMageClass() || (player.getTemplate().getRace() == Race.orc)) {
       for (int[] buff : _warrBuff) {
         if ((lvl >= buff[0]) && (lvl <= buff[1])) {
           npc.broadcastPacket(new MagicSkillUse(npc, player, buff[2], buff[3], 0, 0));
           npc.callSkill(SkillTable.getInstance().getInfo(buff[2], buff[3]), target, true);
         }
       }
     } else {
       for (int[] buff : _mageBuff) {
         if ((lvl >= buff[0]) && (lvl <= buff[1])) {
           npc.broadcastPacket(new MagicSkillUse(npc, player, buff[2], buff[3], 0, 0));
           npc.callSkill(SkillTable.getInstance().getInfo(buff[2], buff[3]), target, true);
         }
       }
     }
   }
 }
 /** Method setUpPlayers. */
 private void setUpPlayers() {
   HandysBlockCheckerManager.getInstance().setArenaBeingUsed(_arena);
   _redPoints = _spawns.size() / 2;
   _bluePoints = _spawns.size() / 2;
   final ExCubeGameChangePoints initialPoints =
       new ExCubeGameChangePoints(300, _bluePoints, _redPoints);
   ExCubeGameExtendedChangePoints clientSetUp;
   for (Player player : _holder.getAllPlayers()) {
     if (player == null) {
       continue;
     }
     player.addListener(_listener);
     boolean isRed = _holder.getRedPlayers().contains(player);
     clientSetUp =
         new ExCubeGameExtendedChangePoints(300, _bluePoints, _redPoints, isRed, player, 0);
     player.sendPacket(clientSetUp);
     player.sendActionFailed();
     int tc = _holder.getPlayerTeam(player) * 2;
     int x = _arenaCoordinates[_arena][tc];
     int y = _arenaCoordinates[_arena][tc + 1];
     player.teleToLocation(x, y, _zCoord);
     if (isRed) {
       _redTeamPoints.put(player, 0);
       player.setTeam(TeamType.RED);
     } else {
       _blueTeamPoints.put(player, 0);
       player.setTeam(TeamType.BLUE);
     }
     player.getEffectList().stopAllEffects();
     for (Summon summon : player.getSummonList()) {
       summon.unSummon();
     }
     _freeze.getEffects(player, player, false, false);
     if (_holder.getPlayerTeam(player) == 0) {
       _transformationRed.getEffects(player, player, false, false);
     } else {
       _transformationBlue.getEffects(player, player, false, false);
     }
     player.setBlockCheckerArena((byte) _arena);
     player.sendPacket(initialPoints);
     player.sendPacket(_closeUserInterface);
     player.sendPacket(new ExBasicActionList(player));
     broadcastRelationChanged(player);
     player.broadcastCharInfo();
   }
 }