public GuardiansSpawner(NpcInstance npc, QuestState st, int _count) {
      NpcTemplate template = NpcHolder.getInstance().getTemplate(Soul_of_Tree_Guardian);
      if (template == null) return;
      try {
        _spawn = new SimpleSpawner(template);
      } catch (Exception e) {
        e.printStackTrace();
      }
      for (int i = 0; i < _count; i++) {
        _spawn.setLoc(Location.findPointToStay(npc, 50, 200));
        _spawn.setHeading(Rnd.get(0, 0xFFFF));
        _spawn.setAmount(1);
        _spawn.doSpawn(true);

        agressor = st.getPlayer().getName();
        if (st.getPlayer().getSummonList().getPet() != null)
          agressors_pet = st.getPlayer().getSummonList().getPet().getName();
        if (st.getPlayer().getParty() != null) {
          agressors_party = new ArrayList<String>();
          for (Player _member : st.getPlayer().getParty().getPartyMembers())
            if (!_member.equals(st.getPlayer())) agressors_party.add(_member.getName());
        }
      }
      _spawn.stopRespawn();
      updateAgression();
    }
Ejemplo n.º 2
0
  @Override
  protected void onEvtAttacked(Creature attacker, int damage) {
    NpcInstance actor = getActor();

    if (!_attacked) {
      for (int i = 0; i < 4; i++) {
        try {
          SimpleSpawner sp = new SimpleSpawner(NpcHolder.getInstance().getTemplate(18493));
          sp.setLoc(Location.findPointToStay(actor, 150, 250));
          sp.setReflection(actor.getReflection());
          sp.doSpawn(true);
          sp.stopRespawn();
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
      _attacked = true;
    }
  }
 @Override
 public void runImpl() throws Exception {
   if (_spawn == null) return;
   tiks++;
   if (tiks < 600) {
     updateAgression();
     ThreadPoolManager.getInstance().schedule(this, 1000);
     return;
   }
   _spawn.deleteAll();
 }
Ejemplo n.º 4
0
  public void setSCE_POT_ON(int i) {
    if (i == i_ai1 && i_ai0 == 1) {
      if (i_quest9 == 1) {}
      i_ai0 = 2;
    } else if (i == i_ai2 && i_ai0 == 2) {
      if (i_quest9 == 1) {}
      i_ai0 = 3;
    } else if (i == i_ai3 && i_ai0 == 3) {
      if (i_quest9 == 1) {}
      i_ai0 = 4;
    } else if (i == i_ai4 && i_ai0 == 4) {
      if (i_quest9 == 1) {}
      i_ai0 = 5;
    } else if (i == i_ai5 && i_ai0 == 5) {
      if (i_quest9 == 1) {}
      i_ai0 = 6;
    } else if (i == i_ai6 && i_ai0 == 6) {
      if (i_quest9 == 1) {}
      i_ai0 = 7;
    } else if (i == i_ai7 && i_ai0 == 7) {
      if (i_quest9 == 1) {}
      i_ai0 = 8;
    } else if (i == i_ai8 && i_ai0 == 8) {
      if (i_quest9 == 1) {}
      i_ai0 = 9;
    } else if (i == i_ai9 && i_ai0 == 9) {
      if (i_quest9 == 1) {}
      for (NpcInstance npc : GameObjectsStorage.getAllNpcs()) {
        if (npc != null && npc.getNpcId() == 18913 && getDistance(npc) <= 1200) {
          ((FurnfaceInstance) npc).setSCE_GAME_END();
        }
      }

      SimpleSpawner sp = new SimpleSpawner(NpcHolder.getInstance().getTemplate(18934));
      switch (getAISpawnParam()) {
        case 1:
          sp.setLoc(new Location(110772, -82063, -1584));
          break;
        case 2:
          sp.setLoc(new Location(114915, -70998, -544));
          break;
      }
      sp.doSpawn(true);
      Functions.npcShout(this, NpcString.FURNFACE6);
      switch (getAISpawnParam()) {
        case 1:
          if (HURRY_UP_1 != null) {
            HURRY_UP_1.cancel(false);
            HURRY_UP_1 = null;
          }
          if (HURRY_UP2_1 != null) {
            HURRY_UP2_1.cancel(false);
            HURRY_UP2_1 = null;
          }
          break;
        case 2:
          if (HURRY_UP_2 != null) {
            HURRY_UP_2.cancel(false);
            HURRY_UP_2 = null;
          }
          if (HURRY_UP2_2 != null) {
            HURRY_UP2_2.cancel(false);
            HURRY_UP2_2 = null;
          }
          break;
      }
      c_ai0 = null;
      i_quest0 = 0;
      i_quest1 = 0;
    } else {
      for (NpcInstance npc : GameObjectsStorage.getAllNpcs()) {
        if (npc != null && npc.getNpcId() == 18913 && getDistance(npc) <= 1200) {
          ((FurnfaceInstance) npc).setSCE_GAME_FAILURE();
        }
      }
      if (i_quest9 == 1) {
      } else if (i_quest0 < 2) {
        i_quest0 = i_quest0 + 1;
        Functions.npcShout(this, NpcString.FURNFACE7);
        i_quest1 = 0;
      } else {
        switch (getAISpawnParam()) {
          case 1:
            if (HURRY_UP_1 != null) {
              HURRY_UP_1.cancel(false);
              HURRY_UP_1 = null;
            }
            if (HURRY_UP2_1 != null) {
              HURRY_UP2_1.cancel(false);
              HURRY_UP2_1 = null;
            }
            break;
          case 2:
            if (HURRY_UP_2 != null) {
              HURRY_UP_2.cancel(false);
              HURRY_UP_2 = null;
            }
            if (HURRY_UP2_2 != null) {
              HURRY_UP2_2.cancel(false);
              HURRY_UP2_2 = null;
            }
            break;
        }
        Functions.npcShout(this, NpcString.FURNFACE8);
        c_ai0 = null;
        i_quest0 = 0;
        i_quest1 = 0;
      }
    }
  }
 private void AddAgression(Playable player, int aggro) {
   if (player == null) return;
   for (NpcInstance mob : _spawn.getAllSpawned()) {
     mob.getAI().notifyEvent(CtrlEvent.EVT_AGGRESSION, player, aggro);
   }
 }