Examples of ClanHallMiniGameEvent


Examples of lineage2.gameserver.model.entity.events.impl.ClanHallMiniGameEvent

   */
  @Override
  public void onSpawn()
  {
    super.onSpawn();
    ClanHallMiniGameEvent event = getEvent(ClanHallMiniGameEvent.class);
    if (event == null)
    {
      return;
    }
    List<Player> around = World.getAroundPlayers(this, 750, 100);
    for (Player player : around)
    {
      CMGSiegeClanObject siegeClanObject = event.getSiegeClan(SiegeEvent.ATTACKERS, player.getClan());
      if ((siegeClanObject == null) || !siegeClanObject.getPlayers().contains(player.getObjectId()))
      {
        player.teleToLocation(event.getResidence().getOtherRestartPoint());
      }
    }
    _task = ThreadPoolManager.getInstance().scheduleAtFixedRate(new GenerateTask(), 10000L, 300000L);
  }
View Full Code Here

Examples of lineage2.gameserver.model.entity.events.impl.ClanHallMiniGameEvent

  /**
   * Method teleportFromArena.
   */
  public void teleportFromArena()
  {
    ClanHallMiniGameEvent event = getEvent(ClanHallMiniGameEvent.class);
    if (event == null)
    {
      return;
    }
    List<Player> around = World.getAroundPlayers(this, 750, 100);
    for (Player player : around)
    {
      player.teleToLocation(event.getResidence().getOtherRestartPoint());
    }
  }
View Full Code Here

Examples of lineage2.gameserver.model.entity.events.impl.ClanHallMiniGameEvent

   * @param player Player
   * @param itemId int
   */
  private void addItem(Player player, int itemId)
  {
    ClanHallMiniGameEvent event = getEvent(ClanHallMiniGameEvent.class);
    if (event == null)
    {
      return;
    }
    ItemInstance item = ItemFunctions.createItem(itemId);
View Full Code Here

Examples of lineage2.gameserver.model.entity.events.impl.ClanHallMiniGameEvent

    if (!canBypassCheck(player, this))
    {
      return;
    }
    ClanHall clanHall = getClanHall();
    ClanHallMiniGameEvent miniGameEvent = clanHall.getSiegeEvent();
    if (miniGameEvent == null)
    {
      return;
    }
    if (miniGameEvent.isArenaClosed())
    {
      showChatWindow(player, "residence2/clanhall/game_manager003.htm");
      return;
    }
    List<CMGSiegeClanObject> siegeClans = miniGameEvent.getObjects(SiegeEvent.ATTACKERS);
    CMGSiegeClanObject siegeClan = miniGameEvent.getSiegeClan(SiegeEvent.ATTACKERS, player.getClan());
    if (siegeClan == null)
    {
      showChatWindow(player, "residence2/clanhall/game_manager014.htm");
      return;
    }
    if (siegeClan.getPlayers().isEmpty())
    {
      Party party = player.getParty();
      if (party == null)
      {
        showChatWindow(player, player.isClanLeader() ? "residence2/clanhall/game_manager005.htm" : "residence2/clanhall/game_manager002.htm");
        return;
      }
      if (!player.isClanLeader())
      {
        showChatWindow(player, "residence2/clanhall/game_manager004.htm");
        return;
      }
      if (party.getMemberCount() < 5)
      {
        showChatWindow(player, "residence2/clanhall/game_manager003.htm");
        return;
      }
      if (party.getPartyLeader() != player)
      {
        showChatWindow(player, "residence2/clanhall/game_manager006.htm");
        return;
      }
      for (Player member : party.getPartyMembers())
      {
        if (member.getClan() != player.getClan())
        {
          showChatWindow(player, "residence2/clanhall/game_manager007.htm");
          return;
        }
      }
      int index = siegeClans.indexOf(siegeClan);
      SpawnExObject spawnEx = miniGameEvent.getFirstObject("arena_" + index);
      Location loc = (Location) spawnEx.getSpawns().get(0).getCurrentSpawnRange();
      for (Player member : party.getPartyMembers())
      {
        siegeClan.addPlayer(member.getObjectId());
        member.teleToLocation(Location.coordsRandomize(loc, 100, 200));
View Full Code Here

Examples of lineage2.gameserver.model.entity.events.impl.ClanHallMiniGameEvent

   */
  @Override
  public void onEvtSeeSpell(Skill skill, Creature character)
  {
    final RainbowYetiInstance actor = (RainbowYetiInstance) getActor();
    final ClanHallMiniGameEvent miniGameEvent = actor.getEvent(ClanHallMiniGameEvent.class);
    if (miniGameEvent == null)
    {
      return;
    }
    if (!character.isPlayer())
    {
      return;
    }
   
    final Player player = character.getPlayer();
   
    CMGSiegeClanObject siegeClan = null;
    final List<CMGSiegeClanObject> attackers = miniGameEvent.getObjects(SiegeEvent.ATTACKERS);
    for (CMGSiegeClanObject $ : attackers)
    {
      if ($.isParticle(player))
      {
        siegeClan = $;
      }
    }
   
    if (siegeClan == null)
    {
      return;
    }
   
    final int index = attackers.indexOf(siegeClan);
    int warIndex = Integer.MIN_VALUE;
   
    RainbowGourdInstance gourdInstance = null;
    RainbowGourdInstance gourdInstance2 = null;
    switch (skill.getId())
    {
      case 2240: // nectar
        if (Rnd.chance(90))
        {
          gourdInstance = getGourd(index);
          if (gourdInstance == null)
          {
            return;
          }
         
          gourdInstance.doDecrease(player);
        }
        else
        {
          actor.addMob(NpcUtils.spawnSingle(35592, actor.getX() + 10, actor.getY() + 10, actor.getZ(), 0));
        }
        break;
      case 2241: // mineral water
        warIndex = rndEx(attackers.size(), index);
        if (warIndex == Integer.MIN_VALUE)
        {
          return;
        }
       
        gourdInstance2 = getGourd(warIndex);
        if (gourdInstance2 == null)
        {
          return;
        }
        gourdInstance2.doHeal();
        break;
      case 2242: // water
        warIndex = rndEx(attackers.size(), index);
        if (warIndex == Integer.MIN_VALUE)
        {
          return;
        }
       
        gourdInstance = getGourd(index);
        gourdInstance2 = getGourd(warIndex);
        if ((gourdInstance2 == null) || (gourdInstance == null))
        {
          return;
        }
       
        gourdInstance.doSwitch(gourdInstance2);
        break;
      case 2243: // sulfur
        warIndex = rndEx(attackers.size(), index);
        if (warIndex == Integer.MIN_VALUE)
        {
          return;
        }
       
        final ZoneObject zone = miniGameEvent.getFirstObject("zone_" + warIndex);
        if (zone == null)
        {
          return;
        }
        zone.setActive(true);
View Full Code Here

Examples of lineage2.gameserver.model.entity.events.impl.ClanHallMiniGameEvent

   * @param index int
   * @return RainbowGourdInstance
   */
  private RainbowGourdInstance getGourd(int index)
  {
    final ClanHallMiniGameEvent miniGameEvent = getActor().getEvent(ClanHallMiniGameEvent.class);
   
    final SpawnExObject spawnEx = miniGameEvent.getFirstObject("arena_" + index);
   
    return (RainbowGourdInstance) spawnEx.getSpawns().get(1).getFirstSpawned();
  }
View Full Code Here

Examples of lineage2.gameserver.model.entity.events.impl.ClanHallMiniGameEvent

   */
  @Override
  public void onDeath(Creature killer)
  {
    super.onDeath(killer);
    ClanHallMiniGameEvent miniGameEvent = getEvent(ClanHallMiniGameEvent.class);
    if (miniGameEvent == null)
    {
      return;
    }
    Player player = killer.getPlayer();
    CMGSiegeClanObject siegeClanObject = miniGameEvent.getSiegeClan(SiegeEvent.ATTACKERS, player.getClan());
    if (siegeClanObject == null)
    {
      return;
    }
    _winner = siegeClanObject;
    List<CMGSiegeClanObject> attackers = miniGameEvent.getObjects(SiegeEvent.ATTACKERS);
    for (int i = 0; i < attackers.size(); i++)
    {
      if (attackers.get(i) == siegeClanObject)
      {
        continue;
      }
      String arenaName = "arena_" + i;
      SpawnExObject spawnEx = miniGameEvent.getFirstObject(arenaName);
      RainbowYetiInstance yetiInstance = (RainbowYetiInstance) spawnEx.getSpawns().get(0).getFirstSpawned();
      yetiInstance.teleportFromArena();
      miniGameEvent.spawnAction(arenaName, false);
    }
  }
View Full Code Here

Examples of lineage2.gameserver.model.entity.events.impl.ClanHallMiniGameEvent

   */
  @Override
  public void onDecay()
  {
    super.onDecay();
    final ClanHallMiniGameEvent miniGameEvent = getEvent(ClanHallMiniGameEvent.class);
    if (miniGameEvent == null)
    {
      return;
    }
    if (_winner == null)
    {
      return;
    }
    List<CMGSiegeClanObject> attackers = miniGameEvent.getObjects(SiegeEvent.ATTACKERS);
    int index = attackers.indexOf(_winner);
    String arenaName = "arena_" + index;
    miniGameEvent.spawnAction(arenaName, false);
    SpawnExObject spawnEx = miniGameEvent.getFirstObject(arenaName);
    Spawner spawner = spawnEx.getSpawns().get(0);
    Location loc = (Location) spawner.getCurrentSpawnRange();
    miniGameEvent.removeBanishItems();
    final NpcInstance npc = NpcUtils.spawnSingle(35600, loc.x, loc.y, loc.z, 0);
    ThreadPoolManager.getInstance().schedule(new RunnableImpl()
    {
      @Override
      public void runImpl()
      {
        List<Player> around = World.getAroundPlayers(npc, 750, 100);
        npc.deleteMe();
        for (Player player : around)
        {
          player.teleToLocation(miniGameEvent.getResidence().getOwnerRestartPoint());
        }
        miniGameEvent.processStep(_winner.getClan());
      }
    }, 10000L);
  }
View Full Code Here

Examples of lineage2.gameserver.model.entity.events.impl.ClanHallMiniGameEvent

    if (!canBypassCheck(player, this))
    {
      return;
    }
    ClanHall clanHall = getClanHall();
    ClanHallMiniGameEvent miniGameEvent = clanHall.getSiegeEvent();
    if (command.equalsIgnoreCase("register"))
    {
      if (miniGameEvent.isRegistrationOver())
      {
        showChatWindow(player, "residence2/clanhall/messenger_yetti014.htm");
        return;
      }
      Clan clan = player.getClan();
      if ((clan == null) || (clan.getLevel() < 3) || (clan.getAllSize() <= 5))
      {
        showChatWindow(player, "residence2/clanhall/messenger_yetti011.htm");
        return;
      }
      if (clan.getLeaderId() != player.getObjectId())
      {
        showChatWindow(player, "residence2/clanhall/messenger_yetti010.htm");
        return;
      }
      if (clan.getHasHideout() > 0)
      {
        showChatWindow(player, "residence2/clanhall/messenger_yetti012.htm");
        return;
      }
      if (miniGameEvent.getSiegeClan(SiegeEvent.ATTACKERS, clan) != null)
      {
        showChatWindow(player, "residence2/clanhall/messenger_yetti013.htm");
        return;
      }
      long count = player.getInventory().getCountOf(ITEM_ID);
      if (count == 0)
      {
        showChatWindow(player, "residence2/clanhall/messenger_yetti008.htm");
      }
      else
      {
        if (!player.consumeItem(ITEM_ID, count))
        {
          return;
        }
        CMGSiegeClanObject siegeClanObject = new CMGSiegeClanObject(SiegeEvent.ATTACKERS, clan, count);
        miniGameEvent.addObject(SiegeEvent.ATTACKERS, siegeClanObject);
        SiegeClanDAO.getInstance().insert(clanHall, siegeClanObject);
        showChatWindow(player, "residence2/clanhall/messenger_yetti009.htm");
      }
    }
    else if (command.equalsIgnoreCase("cancel"))
    {
      if (miniGameEvent.isRegistrationOver())
      {
        showChatWindow(player, "residence2/clanhall/messenger_yetti017.htm");
        return;
      }
      Clan clan = player.getClan();
      if ((clan == null) || (clan.getLevel() < 3))
      {
        showChatWindow(player, "residence2/clanhall/messenger_yetti011.htm");
        return;
      }
      if (clan.getLeaderId() != player.getObjectId())
      {
        showChatWindow(player, "residence2/clanhall/messenger_yetti010.htm");
        return;
      }
      SiegeClanObject siegeClanObject = miniGameEvent.getSiegeClan(SiegeEvent.ATTACKERS, clan);
      if (siegeClanObject == null)
      {
        showChatWindow(player, "residence2/clanhall/messenger_yetti016.htm");
      }
      else
      {
        miniGameEvent.removeObject(SiegeEvent.ATTACKERS, siegeClanObject);
        SiegeClanDAO.getInstance().delete(clanHall, siegeClanObject);
        ItemFunctions.addItem(player, ITEM_ID, siegeClanObject.getParam() / 2L, true);
        showChatWindow(player, "residence2/clanhall/messenger_yetti005.htm");
      }
    }
    else if (command.equalsIgnoreCase("refund"))
    {
      if (miniGameEvent.isRegistrationOver())
      {
        showChatWindow(player, "residence2/clanhall/messenger_yetti010.htm");
        return;
      }
      Clan clan = player.getClan();
      if ((clan == null) || (clan.getLevel() < 3))
      {
        showChatWindow(player, "residence2/clanhall/messenger_yetti011.htm");
        return;
      }
      if (clan.getLeaderId() != player.getObjectId())
      {
        showChatWindow(player, "residence2/clanhall/messenger_yetti010.htm");
        return;
      }
      SiegeClanObject siegeClanObject = miniGameEvent.getSiegeClan(ClanHallMiniGameEvent.REFUND, clan);
      if (siegeClanObject == null)
      {
        showChatWindow(player, "residence2/clanhall/messenger_yetti020.htm");
      }
      else
      {
        miniGameEvent.removeObject(ClanHallMiniGameEvent.REFUND, siegeClanObject);
        SiegeClanDAO.getInstance().delete(clanHall, siegeClanObject);
        ItemFunctions.addItem(player, ITEM_ID, siegeClanObject.getParam(), true);
        showChatWindow(player, "residence2/clanhall/messenger_yetti019.htm");
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.