Beispiel #1
0
  @Override
  public void onDeath(Creature actor, Creature killer) {
    if (getOrderByTargetName(actor.getName()) != null
        && !actor.getName().equals(killer.getName())) {
      final Order order = getOrderByTargetName(actor.getName());
      Functions.addItem(killer.getPlayer(), order.getItemId(), order.getItemCount());
      Announcements.getInstance()
          .announceToAll(
              new CustomMessage(
                      "scripts.events.Hitman.AnnounceKill",
                      killer.getPlayer(),
                      killer.getName(),
                      actor.getName(),
                      order.getItemCount(),
                      ItemFunctions.createItem(order.getItemId()).getTemplate().getName())
                  .toString());

      if (order.getKillsCount() > 1) order.decrementKillsCount();
      else {
        _orderMap.remove(World.getPlayer(order.getOwner()).getObjectId());
        _inList.remove((Object) World.getPlayer(order.getOwner()).getObjectId());
        deleteFromDatabase(actor.getName());
      }
    }
  }
 private void updateAgression() {
   Player _player = World.getPlayer(agressor);
   if (_player != null) {
     if (agressors_pet != null
         && _player.getSummonList().getPet() != null
         && _player.getSummonList().getPet().getName().equalsIgnoreCase(agressors_pet))
       AddAgression(_player.getSummonList().getPet(), 10);
     AddAgression(_player, 2);
   }
   if (agressors_party != null)
     for (String _agressor : agressors_party) AddAgression(World.getPlayer(_agressor), 1);
 }
Beispiel #3
0
  public static int addOrder(
      Player player, String name, int killsCount, int itemcount, String itemname) {
    if (!checkPlayer(player)) return -1;

    if (Functions.getItemCount(player, Config.EVENT_HITMAN_COST_ITEM_ID)
        < Config.EVENT_HITMAN_COST_ITEM_COUNT) return 0;

    if (Functions.getItemCount(player, _allowedItems.get(itemname)) < itemcount) return 0;

    if (isRegistered(player)) return 1;

    if (World.getPlayer(name) == null) return 2;

    if (World.getPlayer(name).getObjectId() == player.getObjectId()) return 3;

    final Order order =
        new Order(player.getName(), name, _allowedItems.get(itemname), itemcount, killsCount);

    _orderMap.put(player.getObjectId(), order);
    _inList.add(0, player.getObjectId());
    saveToDatabase(
        player.getObjectId(),
        player.getName(),
        name,
        _allowedItems.get(itemname),
        itemcount,
        killsCount);
    Functions.removeItem(
        player, Config.EVENT_HITMAN_COST_ITEM_ID, Config.EVENT_HITMAN_COST_ITEM_COUNT);
    Functions.removeItem(player, _allowedItems.get(itemname), itemcount * killsCount);

    Announcements.getInstance()
        .announceToAll(
            new CustomMessage(
                    "scripts.events.Hitman.Announce",
                    player,
                    player.getName(),
                    itemcount,
                    itemname,
                    name)
                .toString());

    World.getPlayer(name).setIsOrdered(true);

    return 5;
  }
Beispiel #4
0
 public static boolean deleteOrder(int storedId) {
   if (!_orderMap.containsKey(storedId)) return false;
   Functions.addItem(
       World.getPlayer(storedId),
       _orderMap.get(storedId).getItemId(),
       _orderMap.get(storedId).getItemCount() * _orderMap.get(storedId).getKillsCount());
   _orderMap.remove(storedId);
   _inList.remove((Object) storedId);
   deleteFromDatabase(storedId);
   GameObjectsStorage.getPlayer(storedId).setIsOrdered(false);
   return true;
 }
  @Override
  protected void onEvtAttacked(Creature attacker, int damage) {
    if (attacker == null || attacker.getPlayer() == null) return;

    for (NpcInstance minion : World.getAroundNpc(getActor(), 3000, 2000))
      if (minion.getNpcId() == 22358 || minion.getNpcId() == 22357)
        minion.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, attacker, 5000);

    if (!_attacked) {
      Functions.npcSay(getActor(), "Fool, you and your friends will die! Attack!");
      _attacked = true;
    }
  }
Beispiel #6
0
 private Player getTargetChar(String[] wordList, int wordListIndex, Player activeChar) {
   // цель задана аргументом
   if (wordListIndex >= 0 && wordList.length > wordListIndex) {
     Player player = World.getPlayer(wordList[wordListIndex]);
     if (player == null) activeChar.sendMessage("Can't find player: " + wordList[wordListIndex]);
     return player;
   }
   // цель задана текущим таргетом
   GameObject my_target = activeChar.getTarget();
   if (my_target != null && my_target.isPlayer()) return (Player) my_target;
   // в качестве цели сам админ
   return activeChar;
 }
  @Override
  protected boolean thinkActive() {
    NpcInstance actor = getActor();
    if (actor == null || actor.isDead()) return true;

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

    if (diedTeredor < 3 || currentPoint >= MOVE_LOC.length - 1) {
      List<Creature> list =
          World.getAroundCharacters(
              getActor(), getActor().getAggroRange(), getActor().getAggroRange());
      for (Creature target : list) {
        if (target != null
            && !target.isDead()
            && ArrayUtils.contains(ATTACK_IDS, target.getNpcId())) {
          Skill sk = SkillTable.getInstance().getInfo(SKILL_ID, 1);
          if (lastCastTime + sk.getHitTime() + sk.getReuseDelay() <= System.currentTimeMillis()) {
            lastCastTime = System.currentTimeMillis();
            clearTasks();
            addTaskCast(target, sk);
            return true;
          }
          return false;
        }
      }
    } else if (diedTeredor >= 3 && currentPoint < MOVE_LOC.length - 1) {
      if (loc == null || getActor().getDistance(loc) <= 100) {
        currentPoint++;
        loc =
            new Location(
                MOVE_LOC[currentPoint].getX() + Rnd.get(50) - Rnd.get(50),
                MOVE_LOC[currentPoint].getY() + Rnd.get(50) - Rnd.get(50),
                MOVE_LOC[currentPoint].getZ() + Rnd.get(50) - Rnd.get(50));
        if (currentPoint == 0) {
          Reflection r = getActor().getReflection();
          if (r instanceof MemoryOfDisaster) {
            ((MemoryOfDisaster) r).spawnTransparentTeredor();
          }
        }
      }
      actor.setWalking();
      clearTasks();
      addTaskMove(loc, true);
      doTask();
      return true;
    }
    return false;
  }
 @Override
 protected void onEvtThink() {
   super.onEvtThink();
   if (!getActor().getAggroList().isEmpty()) {
     List<Creature> chars = World.getAroundCharacters(getActor());
     CollectionUtils.eqSort(chars, _nearestTargetComparator);
     for (Creature cha : chars) {
       if (getActor().getAggroList().get(cha) != null && checkAggression(cha)) {
         Skill sk = SkillTable.getInstance().getInfo(SKILL_ID, 1);
         if (lastCastTime + sk.getHitTime() + sk.getReuseDelay() <= System.currentTimeMillis()) {
           lastCastTime = System.currentTimeMillis();
           addTaskCast(cha, sk);
         }
       }
     }
   }
 }
Beispiel #9
0
  @Override
  protected boolean thinkActive() {
    NpcInstance actor = getActor();
    if (actor == null) {
      return true;
    }

    for (Player player : World.getAroundPlayers(actor, 500, 500)) {
      if (player == null || !player.isInParty()) {
        continue;
      }

      if (player.getParty().getMemberCount() >= 5 && _tele) {
        _tele = false;
        player.teleToLocation(Rnd.get(locs));
      }
    }

    return true;
  }