Exemple #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());
      }
    }
  }
Exemple #2
0
 public Order getOrderByTargetName(String name) {
   for (final Order order : _orderMap.values())
     if (name.equals(order.getTargetName())) return order;
   return null;
 }