예제 #1
0
  @Override
  public void spawnObject(GlobalEvent event) {
    if (_flag == null) {
      _flag = new NpcInstance(IdFactory.getInstance().getNextId(), _flagTemplate);
      _flag.setCurrentHpMp(_flag.getMaxHp(), _flag.getMaxMp());
      _flag.setHasChatWindow(false);
      _flag.spawnMe(_flagLoc);
    } else if (_mob == null) {
      NpcTemplate template =
          _siegeClan == null || _siegeClan.getParam() == 0
              ? _mobTemplate
              : NpcHolder.getInstance().getTemplate((int) _siegeClan.getParam());

      _mob = (CTBBossInstance) template.getNewInstance();
      _mob.setCurrentHpMp(_mob.getMaxHp(), _mob.getMaxMp());
      _mob.setMatchTeamObject(this);
      _mob.addEvent(event);

      int x =
          (int) (_flagLoc.x + 300 * Math.cos(_mob.headingToRadians(_flag.getHeading() - 32768)));
      int y =
          (int) (_flagLoc.y + 300 * Math.sin(_mob.headingToRadians(_flag.getHeading() - 32768)));

      Location loc = new Location(x, y, _flag.getZ(), _flag.getHeading());
      _mob.setSpawnedLoc(loc);
      _mob.spawnMe(loc);
    } else throw new IllegalArgumentException("Cant spawn twice");
  }
    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();
    }
예제 #3
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;
    }
  }
예제 #4
0
 public CTBTeamObject(int mobTemplate, int flagTemplate, Location flagLoc) {
   _mobTemplate = NpcHolder.getInstance().getTemplate(mobTemplate);
   _flagTemplate = NpcHolder.getInstance().getTemplate(flagTemplate);
   _flagLoc = flagLoc;
 }
예제 #5
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;
      }
    }
  }