예제 #1
0
  @Override
  public boolean useItem(Playable playable, ItemInstance item, boolean ctrl) {
    Player player;
    if (playable.isPlayer()) player = (Player) playable;
    else if (playable.isPet()) player = playable.getPlayer();
    else return false;

    GameObject target = player.getTarget();
    if (target == null || !target.isMonster()) {
      player.sendPacket(SystemMsg.THAT_IS_AN_INCORRECT_TARGET);
      return false;
    }

    MonsterInstance monster = (MonsterInstance) player.getTarget();

    if (!monster.isDead()) {
      player.sendPacket(SystemMsg.THAT_IS_AN_INCORRECT_TARGET);
      return false;
    }

    Skill skill = SkillTable.getInstance().getInfo(HARVESTER_SKILL_ID, 1);
    if (skill != null && skill.checkCondition(player, monster, false, false, true)) {
      player.getAI().Cast(skill, monster);
      return true;
    }
    return false;
  }
예제 #2
0
  @Override
  protected void thinkActive() {
    Player actor = getActor();
    // FPCInfo player	= FPCInfo.getInstance(actor);

    if (actor.isActionsDisabled()) {
      return;
    }

    if (_def_think) {
      if (doTask()) {
        clearTasks();
      }
      return;
    }

    // player.cancelShop();

    if (Rnd.chance(0.5)) {
      actor.standUp();
      if (Rnd.chance(20)) randomWalk(1000);
      else {
        List<GameObject> chars = World.getAroundObjects(actor, 2000, 500);
        if (chars.size() == 0) return;
        GameObject randomChar = chars.get(Rnd.get(chars.size()));
        if (!randomChar.isDoor()) actor.moveToLocation(randomChar.getLoc(), 50, true);
      }
    }
  }
예제 #3
0
  @Override
  public boolean useUserCommand(int id, Player activeChar) {
    if (id != COMMAND_IDS[0]) return false;

    GameObject objectTarget = Config.OLYMPIAD_OLDSTYLE_STAT ? activeChar : activeChar.getTarget();
    if (objectTarget == null || !objectTarget.isPlayer() || !objectTarget.getPlayer().isNoble()) {
      activeChar.sendPacket(SystemMsg.THIS_COMMAND_CAN_ONLY_BE_USED_BY_A_NOBLESSE);
      return true;
    }

    Player playerTarget = objectTarget.getPlayer();

    SystemMessage2 sm =
        new SystemMessage2(
            SystemMsg
                .FOR_THE_CURRENT_GRAND_OLYMPIAD_YOU_HAVE_PARTICIPATED_IN_S1_MATCHES_S2_WINS_S3_DEFEATS_YOU_CURRENTLY_HAVE_S4_OLYMPIAD_POINTS);
    sm.addInteger(Olympiad.getCompetitionDone(playerTarget.getObjectId()));
    sm.addInteger(Olympiad.getCompetitionWin(playerTarget.getObjectId()));
    sm.addInteger(Olympiad.getCompetitionLoose(playerTarget.getObjectId()));
    sm.addInteger(Olympiad.getNoblePoints(playerTarget.getObjectId()));

    activeChar.sendPacket(sm);

    int[] ar = Olympiad.getWeekGameCounts(playerTarget.getObjectId());
    sm =
        new SystemMessage2(
            SystemMsg
                .YOU_HAVE_S1_MATCHES_REMAINING_THAT_YOU_CAN_PARTICIPATE_IN_THIS_WEEK_S2_1_VS_1_CLASS_MATCHES_S3_1_VS_1_MATCHES__S4_3_VS_3_TEAM_MATCHES);
    sm.addInteger(ar[0]);
    sm.addInteger(ar[1]);
    sm.addInteger(ar[2]);
    sm.addInteger(0 /*ar[3]*/);
    activeChar.sendPacket(sm);
    return true;
  }
예제 #4
0
 public MyTargetSelectedPacket(Player player, GameObject target) {
   _objectId = target.getObjectId();
   if (target.isCreature()) _color = player.getLevel() - ((Creature) target).getLevel();
   else _color = 0;
 }