Package lineage2.gameserver.network.serverpackets

Examples of lineage2.gameserver.network.serverpackets.NpcHtmlMessage


    int oldClassId = 0;
    int newClassId = AwakingManager.getInstance().childOf(player.getClassId());
    if (command.equalsIgnoreCase("Awaken"))
    {
      int essencesCount = AwakingManager.getInstance().giveGiantEssences(player, true);
      NpcHtmlMessage htmlMessage = new NpcHtmlMessage(getObjectId());
      htmlMessage.replace("%SP%", String.valueOf(Rnd.get(10000000)));
      htmlMessage.replace("%ESSENCES%", String.valueOf(essencesCount));
      String transferData = new String();
      if(_NPC.get(getNpcId()) != newClassId)
      {
        newClassId = _NPC.get(getNpcId());
        oldClassId = _DESTINYCHANGECLASSES.get(newClassId);
        player.unsetVar("awakenByStoneOfDestiny");
        player.unsetVar("classTarget");
        player.unsetVar("classKeepSkills");
        transferData = "I will ask again... do you wish to Awaken?<br><font color=af9878>(The "+ _NAMECLASSES.get(oldClassId) +"'s skills must be present before awakening as an " + _NAMECLASSES.get(newClassId)+ ").</font>";
      }
      else
      {     
        oldClassId = player.getClassId().getId();
        transferData = "You are not strong enough to receive the giant's power. You need to choose between the giant's power and the god's power.<br>In other words, you should be in the best shape to obtain all the power from the giant. Come back when you are ready.";
      }
      htmlMessage.replace("%TRANSFERDATA%", transferData);
      htmlMessage.setFile("default/" + getNpcId() + "-4.htm");
      player.sendPacket(htmlMessage);
    }
    else if (command.equalsIgnoreCase("Awaken1"))
    {
      NpcHtmlMessage htmlMessage = new NpcHtmlMessage(getObjectId());
      String skillList = new String();
      skillList = skillList + "<table border=0 cellpading=8 cellspacing=4>";
      if(_NPC.get(getNpcId()) != newClassId)
      {
        newClassId = _NPC.get(getNpcId());
        oldClassId = _DESTINYCHANGECLASSES.get(newClassId);   
        player.setVar("awakenByStoneOfDestiny","true", 120000);
        player.setVar("classTarget",String.valueOf(newClassId), 120000);
        player.setVar("classKeepSkills",String.valueOf(oldClassId), 120000);   
      }
      else
      {
        oldClassId = player.getClassId().getId();
      }
      List <Integer> skillListId = SkillAcquireHolder.getInstance().getMaintainSkillOnAwake(oldClassId, newClassId);
      for(int sId : skillListId)
      {
        String iconData = obtainIcon(sId);
        String name = new String();
        Skill skl = SkillTable.getInstance().getInfo(sId, SkillTable.getInstance().getBaseLevel(sId));
        if(skl != null)
        {
          name = skl.getName();
        }
        else
        {
          continue;
        }
        skillList = skillList + "<tr><td width=34 height=34><img src="+ iconData +" width=32 height=32></td><td width=200> " + name + " </td></tr><tr><td colspan=2><br></td></tr>";
      }
      skillList = skillList +"</table>";
      htmlMessage.replace("%SKILLIST%", skillList);
      htmlMessage.setFile("default/" + getNpcId() + "-5.htm");
      player.sendPacket(htmlMessage);
    }
    else if (command.equalsIgnoreCase("Awaken2"))
    {
      if(player.getVarB("awakenByStoneOfDestiny", false))
View Full Code Here


    {
      for (int medal : medals)
      {
        if (player.getInventory().getItemByItemId(medal) != null)
        {
          player.sendPacket(new NpcHtmlMessage(player, this).setHtml("Ingenious Contraption:<br><br>You already have one of the medals. Cannot proceed."));
          return;
        }
      }
      Functions.addItem(player, medals[Rnd.get(0, 4)], 1);
      player.sendPacket(new NpcHtmlMessage(player, this).setHtml("Ingenious Contraption:<br><br>The medal for access to Anomic Founrdy has been given."));
    }
    else if (command.startsWith("requestteleport"))
    {
      player.teleToLocation(-12220, 279713, -13595);
    }
View Full Code Here

  }

  @Override
  public void showChatWindow(Player player, int val, Object... replace)
  {
    NpcHtmlMessage htmlMessage = new NpcHtmlMessage(getObjectId());
    htmlMessage.setFile("default/33785.htm");
    if(player.getVar("Altar1") != null)
    {
      htmlMessage.setFile("default/33785-2.htm");
    }
    if(player.getVar("Altar2") != null)
    {
      htmlMessage.setFile("default/33785-3.htm");
    }
    if(player.getVar("Altar3") != null)
    {
      htmlMessage.setFile("default/33785-e.htm");
    }

    player.sendPacket(htmlMessage);
  }
View Full Code Here

    else
    {
      html = html.replaceFirst("%reason%", "Penalty for expelling clan member.");
      html = html.replaceFirst("%expiration%", format.format(activeChar.getClan().getExpelledMemberTime()));
    }
    NpcHtmlMessage msg = new NpcHtmlMessage(5);
    msg.setHtml(Strings.bbParse(html));
    activeChar.sendPacket(msg);
    return true;
  }
View Full Code Here

   
    StringTokenizer tokenizer = new StringTokenizer(command.replace("\r\n", "<br1>"));
    String actualCommand = tokenizer.nextToken();
    if (actualCommand.equalsIgnoreCase("map"))
    {
      NpcHtmlMessage msg = new NpcHtmlMessage(player, this);
      msg.setFile(getMapDialog());
      msg.replace("%lang%", player.getLang());
      player.sendPacket(msg);
    }
    else if (actualCommand.equalsIgnoreCase("list_all"))
    {
      int page = Integer.parseInt(tokenizer.nextToken());
     
      List<ClanHallAuctionEvent> events = new ArrayList<>();
      for (ClanHall ch : ResidenceHolder.getInstance().getResidenceList(ClanHall.class))
      {
        if ((ch.getSiegeEvent().getClass() == ClanHallAuctionEvent.class) && ch.getSiegeEvent().isInProgress())
        {
          events.add(ch.<ClanHallAuctionEvent> getSiegeEvent());
        }
      }
     
      if (events.isEmpty())
      {
        player.sendPacket(SystemMsg.THERE_ARE_NO_CLAN_HALLS_UP_FOR_AUCTION);
        showChatWindow(player, 0);
        return;
      }
     
      int min = CH_PAGE_SIZE * page;
      int max = min + CH_PAGE_SIZE;
      if (min > events.size())
      {
        min = 0;
        max = min + CH_PAGE_SIZE;
      }
     
      if (max > events.size())
      {
        max = events.size();
      }
     
      NpcHtmlMessage msg = new NpcHtmlMessage(player, this);
      msg.setFile("residence2/clanhall/auction_list_clanhalls.htm");
     
      StringBuilder b = new StringBuilder();
      for (int i = min; i < max; i++)
      {
        ClanHallAuctionEvent event = events.get(i);
        List<AuctionSiegeClanObject> attackers = event.getObjects(SiegeEvent.ATTACKERS);
        Calendar endDate = event.getEndSiegeDate();
       
        String out = CH_IN_LIST.replace("%id%", String.valueOf(event.getId())).replace("%min_bid%", String.valueOf(event.getResidence().getAuctionMinBid())).replace("%size%", String.valueOf(attackers.size())).replace("%date%", DATE_FORMAT.format(endDate.getTimeInMillis()));
       
        b.append(out);
      }
     
      msg.replace("%list%", b.toString());
      if (events.size() > max)
      {
        msg.replace("%next_button%", "<td>" + HtmlUtils.NEXT_BUTTON + "</td>");
        msg.replace("%next_bypass%", "-h npc_%objectId%_list_all " + (page + 1));
      }
      else
      {
        msg.replace("%next_button%", StringUtils.EMPTY);
      }
     
      if (page != 0)
      {
        msg.replace("%prev_button%", "<td>" + HtmlUtils.PREV_BUTTON + "</td>");
        msg.replace("%prev_bypass%", "-h npc_%objectId%_list_all " + (page - 1));
      }
      else
      {
        msg.replace("%prev_button%", StringUtils.EMPTY);
      }
     
      player.sendPacket(msg);
    }
    else if (actualCommand.equalsIgnoreCase("info"))
    {
      String fileName = null;
     
      ClanHall clanHall = null;
      SiegeClanObject siegeClan = null;
      if (tokenizer.hasMoreTokens())
      {
        int id = Integer.parseInt(tokenizer.nextToken());
        clanHall = ResidenceHolder.getInstance().getResidence(id);
       
        fileName = "residence2/clanhall/auction_clanhall_info_main.htm";
      }
      else
      {
        clanHall = player.getClan() == null ? null : player.getClan().getHasHideout() > 0 ? ResidenceHolder.getInstance().<ClanHall> getResidence(player.getClan().getHasHideout()) : null;
        if ((clanHall != null) && (clanHall.getSiegeEvent().getClass() == ClanHallAuctionEvent.class))
        {
          if (clanHall.getSiegeEvent().isInProgress())
          {
            fileName = "residence2/clanhall/auction_clanhall_info_owner_sell.htm";
          }
          else
          {
            fileName = "residence2/clanhall/auction_clanhall_info_owner.htm";
          }
        }
        else
        {
          for (ClanHall ch : ResidenceHolder.getInstance().getResidenceList(ClanHall.class))
          {
            if ((ch.getSiegeEvent().getClass() == ClanHallAuctionEvent.class) && ((siegeClan = ch.getSiegeEvent().getSiegeClan(SiegeEvent.ATTACKERS, player.getClan())) != null))
            {
              clanHall = ch;
              break;
            }
          }
         
          if (siegeClan == null)
          {
            player.sendPacket(SystemMsg.THERE_ARE_NO_OFFERINGS_I_OWN_OR_I_MADE_A_BID_FOR);
            showChatWindow(player, 0);
            return;
          }
         
          fileName = "residence2/clanhall/auction_clanhall_info_bidded.htm";
        }
      }
     
      ClanHallAuctionEvent auctionEvent = clanHall.getSiegeEvent();
      List<AuctionSiegeClanObject> attackers = auctionEvent.getObjects(SiegeEvent.ATTACKERS);
     
      NpcHtmlMessage msg = new NpcHtmlMessage(player, this);
      msg.setFile(fileName);
      msg.replace("%id%", String.valueOf(clanHall.getId()));
      msg.replace("%bigger_size%", String.valueOf(attackers.size()));
      msg.replace("%grade%", String.valueOf(clanHall.getGrade()));
      msg.replace("%rental_fee%", String.valueOf(clanHall.getRentalFee()));
     
      Clan owner = clanHall.getOwner();
     
      msg.replace("%owner%", owner == null ? StringUtils.EMPTY : owner.getName());
      msg.replace("%owner_leader%", owner == null ? StringUtils.EMPTY : owner.getLeaderName());
      msg.replace("%description%", clanHall.getAuctionDescription());
      msg.replace("%min_bid%", String.valueOf(clanHall.getAuctionMinBid()));
     
      Calendar c = auctionEvent.getEndSiegeDate();
     
      msg.replace("%date%", DATE_FORMAT.format(c.getTimeInMillis()));
      msg.replace("%hour%", String.valueOf(c.get(Calendar.HOUR_OF_DAY)));
     
      int remainingTime = (int) ((c.getTimeInMillis() - System.currentTimeMillis()) / 60000L);
     
      msg.replace("%remaining_hour%", String.valueOf(remainingTime / 60));
      msg.replace("%remaining_minutes%", String.valueOf(remainingTime % 60));
     
      if (siegeClan != null)
      {
        msg.replace("%my_bid%", String.valueOf(siegeClan.getParam()));
      }
     
      player.sendPacket(msg);
    }
    else if (actualCommand.equalsIgnoreCase("bidder_list"))
    {
      int id = Integer.parseInt(tokenizer.nextToken());
      int page = Integer.parseInt(tokenizer.nextToken());
     
      ClanHall clanHall = ResidenceHolder.getInstance().getResidence(id);
      ClanHallAuctionEvent auctionEvent = clanHall.getSiegeEvent();
      List<AuctionSiegeClanObject> attackers = auctionEvent.getObjects(SiegeEvent.ATTACKERS);
     
      if (!auctionEvent.isInProgress())
      {
        return;
      }
     
      int min = BIDDER_PAGE_SIZE * page;
      int max = min + BIDDER_PAGE_SIZE;
      if (min > attackers.size())
      {
        min = 0;
        max = min + BIDDER_PAGE_SIZE;
      }
     
      if (max > attackers.size())
      {
        max = attackers.size();
      }
     
      NpcHtmlMessage msg = new NpcHtmlMessage(player, this);
      msg.setFile("residence2/clanhall/auction_bidder_list.htm");
      msg.replace("%id%", String.valueOf(id));
     
      StringBuilder b = new StringBuilder();
      for (int i = min; i < max; i++)
      {
        AuctionSiegeClanObject siegeClan = attackers.get(i);
        String t = BIDDER_IN_LIST.replace("%id%", String.valueOf(id)).replace("%clan_name%", siegeClan.getClan().getName()).replace("%date%", DATE_FORMAT.format(siegeClan.getDate()));
        b.append(t);
      }
      msg.replace("%list%", b.toString());
     
      if (attackers.size() > max)
      {
        msg.replace("%next_button%", "<td>" + HtmlUtils.NEXT_BUTTON + "</td>");
        msg.replace("%next_bypass%", "-h npc_%objectId%_bidder_list " + id + " " + (page + 1));
      }
      else
      {
        msg.replace("%next_button%", StringUtils.EMPTY);
      }
     
      if (page != 0)
      {
        msg.replace("%prev_button%", "<td>" + HtmlUtils.PREV_BUTTON + "</td>");
        msg.replace("%prev_bypass%", "-h npc_%objectId%_bidder_list " + id + " " + (page - 1));
      }
      else
      {
        msg.replace("%prev_button%", StringUtils.EMPTY);
      }
     
      player.sendPacket(msg);
    }
    else if (actualCommand.equalsIgnoreCase("bid_start"))
    {
      if (!firstChecks(player))
      {
        showChatWindow(player, 0);
        return;
      }
     
      int id = Integer.parseInt(tokenizer.nextToken());
     
      ClanHall clanHall = ResidenceHolder.getInstance().getResidence(id);
      ClanHallAuctionEvent auctionEvent = clanHall.getSiegeEvent();
     
      if (!auctionEvent.isInProgress())
      {
        return;
      }
     
      long minBid = clanHall.getAuctionMinBid();
      AuctionSiegeClanObject siegeClan = auctionEvent.getSiegeClan(SiegeEvent.ATTACKERS, player.getClan());
      if (siegeClan != null)
      {
        minBid = siegeClan.getParam();
      }
     
      NpcHtmlMessage msg = new NpcHtmlMessage(player, this);
      msg.setFile("residence2/clanhall/auction_bid_start.htm");
      msg.replace("%id%", String.valueOf(id));
      msg.replace("%min_bid%", String.valueOf(minBid));
      msg.replace("%clan_adena%", String.valueOf(player.getClan().getWarehouse().getCountOf(ItemTemplate.ITEM_ID_ADENA)));
     
      player.sendPacket(msg);
    }
    else if (actualCommand.equalsIgnoreCase("bid_next"))
    {
      if (!firstChecks(player))
      {
        showChatWindow(player, 0);
        return;
      }
     
      int id = Integer.parseInt(tokenizer.nextToken());
      long bid = 0;
      if (tokenizer.hasMoreTokens())
      {
        try
        {
          bid = NUMBER_FORMAT.parse(tokenizer.nextToken()).longValue();
        }
        catch (ParseException e)
        {
          //
        }
      }
     
      ClanHall clanHall = ResidenceHolder.getInstance().getResidence(id);
      ClanHallAuctionEvent auctionEvent = clanHall.getSiegeEvent();
     
      if (!auctionEvent.isInProgress())
      {
        return;
      }
     
      if (!checkBid(player, auctionEvent, bid))
      {
        return;
      }
     
      long minBid = clanHall.getAuctionMinBid();
      AuctionSiegeClanObject siegeClan = auctionEvent.getSiegeClan(SiegeEvent.ATTACKERS, player.getClan());
      if (siegeClan != null)
      {
        minBid = siegeClan.getParam();
      }
     
      NpcHtmlMessage msg = new NpcHtmlMessage(player, this);
      msg.setFile("residence2/clanhall/auction_bid_confirm.htm");
      msg.replace("%id%", String.valueOf(id));
      msg.replace("%bid%", String.valueOf(bid));
      msg.replace("%min_bid%", String.valueOf(minBid));
     
      Calendar c = auctionEvent.getEndSiegeDate();
     
      msg.replace("%date%", DATE_FORMAT.format(c.getTimeInMillis()));
      msg.replace("%hour%", String.valueOf(c.get(Calendar.HOUR_OF_DAY)));
     
      player.sendPacket(msg);
    }
    else if (actualCommand.equalsIgnoreCase("bid_confirm"))
    {
      if (!firstChecks(player))
      {
        showChatWindow(player, 0);
        return;
      }
     
      int id = Integer.parseInt(tokenizer.nextToken());
      final long bid = Long.parseLong(tokenizer.nextToken());
     
      ClanHall clanHall = ResidenceHolder.getInstance().getResidence(id);
      ClanHallAuctionEvent auctionEvent = clanHall.getSiegeEvent();
     
      if (!auctionEvent.isInProgress())
      {
        return;
      }
     
      for (ClanHall ch : ResidenceHolder.getInstance().getResidenceList(ClanHall.class))
      {
        if ((clanHall != ch) && (ch.getSiegeEvent().getClass() == ClanHallAuctionEvent.class) && ch.getSiegeEvent().isInProgress() && (ch.getSiegeEvent().getSiegeClan(SiegeEvent.ATTACKERS, player.getClan()) != null))
        {
          player.sendPacket(SystemMsg.SINCE_YOU_HAVE_ALREADY_SUBMITTED_A_BID_YOU_ARE_NOT_ALLOWED_TO_PARTICIPATE_IN_ANOTHER_AUCTION_AT_THIS_TIME);
          onBypassFeedback(player, "bid_start " + id);
          return;
        }
      }
     
      if (!checkBid(player, auctionEvent, bid))
      {
        return;
      }
     
      long consumeBid = bid;
      AuctionSiegeClanObject siegeClan = auctionEvent.getSiegeClan(SiegeEvent.ATTACKERS, player.getClan());
      if (siegeClan != null)
      {
        consumeBid -= siegeClan.getParam();
        if (bid <= siegeClan.getParam())
        {
          player.sendPacket(SystemMsg.THE_BID_AMOUNT_MUST_BE_HIGHER_THAN_THE_PREVIOUS_BID);
          onBypassFeedback(player, "bid_start " + auctionEvent.getId());
          return;
        }
      }
     
      player.getClan().getWarehouse().destroyItemByItemId(ItemTemplate.ITEM_ID_ADENA, consumeBid);
     
      if (siegeClan != null)
      {
        siegeClan.setParam(bid);
       
        SiegeClanDAO.getInstance().update(clanHall, siegeClan);
      }
      else
      {
        siegeClan = new AuctionSiegeClanObject(SiegeEvent.ATTACKERS, player.getClan(), bid);
        auctionEvent.addObject(SiegeEvent.ATTACKERS, siegeClan);
       
        SiegeClanDAO.getInstance().insert(clanHall, siegeClan);
      }
     
      player.sendPacket(SystemMsg.YOUR_BID_HAS_BEEN_SUCCESSFULLY_PLACED);
     
      onBypassFeedback(player, "info");
    }
    else if (actualCommand.equalsIgnoreCase("cancel_bid"))
    {
      if (!firstChecks(player))
      {
        showChatWindow(player, 0);
        return;
      }
      int id = Integer.parseInt(tokenizer.nextToken());
     
      ClanHall clanHall = ResidenceHolder.getInstance().getResidence(id);
      ClanHallAuctionEvent auctionEvent = clanHall.getSiegeEvent();
     
      if (!auctionEvent.isInProgress())
      {
        return;
      }
     
      AuctionSiegeClanObject siegeClan = auctionEvent.getSiegeClan(SiegeEvent.ATTACKERS, player.getClan());
      if (siegeClan == null)
      {
        return;
      }
     
      long returnVal = siegeClan.getParam() - (long) (siegeClan.getParam() * 0.1);
      NpcHtmlMessage msg = new NpcHtmlMessage(player, this);
      msg.setFile("residence2/clanhall/auction_bid_cancel.htm");
      msg.replace("%id%", String.valueOf(id));
      msg.replace("%bid%", String.valueOf(siegeClan.getParam()));
      msg.replace("%return%", String.valueOf(returnVal));
     
      player.sendPacket(msg);
    }
    else if (actualCommand.equalsIgnoreCase("cancel_bid_confirm"))
    {
      if (!firstChecks(player))
      {
        showChatWindow(player, 0);
        return;
      }
      int id = Integer.parseInt(tokenizer.nextToken());
     
      ClanHall clanHall = ResidenceHolder.getInstance().getResidence(id);
      ClanHallAuctionEvent auctionEvent = clanHall.getSiegeEvent();
     
      if (!auctionEvent.isInProgress())
      {
        return;
      }
     
      AuctionSiegeClanObject siegeClan = auctionEvent.getSiegeClan(SiegeEvent.ATTACKERS, player.getClan());
      if (siegeClan == null)
      {
        return;
      }
     
      long returnVal = siegeClan.getParam() - (long) (siegeClan.getParam() * 0.1);
     
      player.getClan().getWarehouse().addItem(ItemTemplate.ITEM_ID_ADENA, returnVal);
      auctionEvent.removeObject(SiegeEvent.ATTACKERS, siegeClan);
      SiegeClanDAO.getInstance().delete(clanHall, siegeClan);
     
      player.sendPacket(SystemMsg.YOU_HAVE_CANCELED_YOUR_BID);
      showChatWindow(player, 0);
    }
    else if (actualCommand.equalsIgnoreCase("register_start"))
    {
      if (!firstChecks(player))
      {
        showChatWindow(player, 0);
        return;
      }
     
      ClanHall clanHall = ResidenceHolder.getInstance().getResidence(player.getClan().getHasHideout());
      if ((clanHall.getSiegeEvent().getClass() != ClanHallAuctionEvent.class) || clanHall.getSiegeEvent().isInProgress())
      {
        return;
      }
     
      if ((clanHall.getLastSiegeDate().getTimeInMillis() + WEEK) > System.currentTimeMillis())
      {
        player.sendPacket(SystemMsg.IT_HAS_NOT_YET_BEEN_SEVEN_DAYS_SINCE_CANCELING_AN_AUCTION);
        onBypassFeedback(player, "info");
        return;
      }
     
      NpcHtmlMessage msg = new NpcHtmlMessage(player, this);
      msg.setFile("residence2/clanhall/auction_clanhall_register_start.htm");
      msg.replace("%id%", String.valueOf(player.getClan().getHasHideout()));
      msg.replace("%adena%", String.valueOf(player.getClan().getWarehouse().getCountOf(ItemTemplate.ITEM_ID_ADENA)));
      msg.replace("%deposit%", String.valueOf(clanHall.getDeposit()));
     
      player.sendPacket(msg);
    }
    else if (actualCommand.equalsIgnoreCase("register_next"))
    {
      if (!firstChecks(player))
      {
        showChatWindow(player, 0);
        return;
      }
     
      ClanHall clanHall = ResidenceHolder.getInstance().getResidence(player.getClan().getHasHideout());
      if ((clanHall.getSiegeEvent().getClass() != ClanHallAuctionEvent.class) || clanHall.getSiegeEvent().isInProgress())
      {
        showChatWindow(player, 0);
        return;
      }
     
      if (player.getClan().getWarehouse().getCountOf(ItemTemplate.ITEM_ID_ADENA) < clanHall.getDeposit())
      {
        player.sendPacket(SystemMsg.THERE_IS_NOT_ENOUGH_ADENA_IN_THE_CLAN_HALL_WAREHOUSE);
        onBypassFeedback(player, "register_start");
        return;
      }
     
      NpcHtmlMessage msg = new NpcHtmlMessage(player, this);
      msg.setFile("residence2/clanhall/auction_clanhall_register_next.htm");
      msg.replace("%min_bid%", String.valueOf(clanHall.getBaseMinBid()));
      msg.replace("%last_bid%", String.valueOf(clanHall.getBaseMinBid())); // TODO [VISTALL] get last bid
     
      player.sendPacket(msg);
    }
    else if (actualCommand.equalsIgnoreCase("register_next2"))
    {
      if (!firstChecks(player))
      {
        showChatWindow(player, 0);
        return;
      }
     
      ClanHall clanHall = ResidenceHolder.getInstance().getResidence(player.getClan().getHasHideout());
      if ((clanHall.getSiegeEvent().getClass() != ClanHallAuctionEvent.class) || clanHall.getSiegeEvent().isInProgress())
      {
        showChatWindow(player, 0);
        return;
      }
     
      int day = Integer.parseInt(tokenizer.nextToken());
      long bid = -1;
      String comment = StringUtils.EMPTY;
      if (tokenizer.hasMoreTokens())
      {
        try
        {
          bid = Long.parseLong(tokenizer.nextToken());
        }
        catch (Exception e)
        {
        }
      }
     
      if (tokenizer.hasMoreTokens())
      {
        comment = tokenizer.nextToken();
        while (tokenizer.hasMoreTokens())
        {
          comment += " " + tokenizer.nextToken();
        }
      }
     
      comment = comment.substring(0, Math.min(comment.length(), Byte.MAX_VALUE));
      if (bid <= -1)
      {
        onBypassFeedback(player, "register_next");
        return;
      }
     
      Calendar cal = Calendar.getInstance();
      cal.add(Calendar.HOUR_OF_DAY, day);
     
      NpcHtmlMessage msg = new NpcHtmlMessage(player, this);
      msg.setFile("residence2/clanhall/auction_clanhall_register_confirm.htm");
      msg.replace("%description%", comment);
      msg.replace("%day%", String.valueOf(day));
      msg.replace("%bid%", String.valueOf(bid));
      msg.replace("%base_bid%", String.valueOf(clanHall.getBaseMinBid()));
      msg.replace("%hour%", String.valueOf(cal.get(Calendar.HOUR_OF_DAY)));
      msg.replace("%date%", DATE_FORMAT.format(cal.getTimeInMillis()));
     
      player.sendPacket(msg);
    }
    else if (actualCommand.equalsIgnoreCase("register_confirm"))
    {
      if (!firstChecks(player))
      {
        showChatWindow(player, 0);
        return;
      }
     
      ClanHall clanHall = ResidenceHolder.getInstance().getResidence(player.getClan().getHasHideout());
      if ((clanHall.getSiegeEvent().getClass() != ClanHallAuctionEvent.class) || clanHall.getSiegeEvent().isInProgress())
      {
        showChatWindow(player, 0);
        return;
      }
     
      if ((clanHall.getLastSiegeDate().getTimeInMillis() + WEEK) > System.currentTimeMillis())
      {
        player.sendPacket(SystemMsg.IT_HAS_NOT_YET_BEEN_SEVEN_DAYS_SINCE_CANCELING_AN_AUCTION);
        onBypassFeedback(player, "info");
        return;
      }
     
      int day = Integer.parseInt(tokenizer.nextToken());
      long bid = Long.parseLong(tokenizer.nextToken());
      String comment = StringUtils.EMPTY;
     
      if (tokenizer.hasMoreTokens())
      {
        comment = tokenizer.nextToken();
        while (tokenizer.hasMoreTokens())
        {
          comment += " " + tokenizer.nextToken();
        }
      }
     
      if (bid <= -1)
      {
        onBypassFeedback(player, "register_next");
        return;
      }
     
      clanHall.setAuctionMinBid(bid);
      clanHall.setAuctionDescription(comment);
      clanHall.setAuctionLength(day);
      clanHall.getSiegeDate().setTimeInMillis(System.currentTimeMillis());
      clanHall.setJdbcState(JdbcEntityState.UPDATED);
      clanHall.update();
     
      clanHall.getSiegeEvent().reCalcNextTime(false);
     
      onBypassFeedback(player, "info");
      player.sendPacket(SystemMsg.YOU_HAVE_REGISTERED_FOR_A_CLAN_HALL_AUCTION);
    }
    else if (actualCommand.equals("cancel_start"))
    {
      if (!firstChecks(player))
      {
        showChatWindow(player, 0);
        return;
      }
     
      ClanHall clanHall = ResidenceHolder.getInstance().getResidence(player.getClan().getHasHideout());
      if ((clanHall.getSiegeEvent().getClass() != ClanHallAuctionEvent.class) || !clanHall.getSiegeEvent().isInProgress())
      {
        showChatWindow(player, 0);
        return;
      }
     
      NpcHtmlMessage msg = new NpcHtmlMessage(player, this);
      msg.setFile("residence2/clanhall/auction_clanhall_cancel_confirm.htm");
      msg.replace("%deposit%", String.valueOf(clanHall.getDeposit()));
     
      player.sendPacket(msg);
    }
    else if (actualCommand.equals("cancel_confirm"))
    {
View Full Code Here

   * @param activeChar Player
   * @param path String
   */
  private static void playerHelp(Player activeChar, String path)
  {
    NpcHtmlMessage html = new NpcHtmlMessage(5);
    html.setFile(path);
    activeChar.sendPacket(html);
  }
View Full Code Here

    {
      return;
    }
    if (command.equalsIgnoreCase("get"))
    {
      NpcHtmlMessage msg = new NpcHtmlMessage(player, this);
      boolean has = true;
      if (_generated == -1)
      {
        has = false;
      }
      else
      {
        Word word = WORLD_LIST[_generated];
        for (int[] itemInfo : word.getItems())
        {
          if (player.getInventory().getCountOf(itemInfo[0]) < itemInfo[1])
          {
            has = false;
          }
        }
        if (has)
        {
          for (int[] itemInfo : word.getItems())
          {
            if (!player.consumeItem(itemInfo[0], itemInfo[1]))
            {
              return;
            }
          }
          int rnd = Rnd.get(100);
          if ((_generated >= 0) && (_generated <= 5))
          {
            if (rnd < 70)
            {
              addItem(player, 8030);
            }
            else if (rnd < 80)
            {
              addItem(player, 8031);
            }
            else if (rnd < 90)
            {
              addItem(player, 8032);
            }
            else
            {
              addItem(player, 8033);
            }
          }
          else
          {
            if (rnd < 10)
            {
              addItem(player, 8030);
            }
            else if (rnd < 40)
            {
              addItem(player, 8031);
            }
            else if (rnd < 70)
            {
              addItem(player, 8032);
            }
            else
            {
              addItem(player, 8033);
            }
          }
        }
      }
      if (!has)
      {
        msg.setFile("residence2/clanhall/watering_manager002.htm");
      }
      else
      {
        msg.setFile("residence2/clanhall/watering_manager004.htm");
      }
      player.sendPacket(msg);
    }
    else if (command.equalsIgnoreCase("see"))
    {
      NpcHtmlMessage msg = new NpcHtmlMessage(player, this);
      msg.setFile("residence2/clanhall/watering_manager005.htm");
      if (_generated == -1)
      {
        msg.replaceNpcString("%word%", NpcString.UNDECIDED);
      }
      else
      {
        msg.replace("%word%", WORLD_LIST[_generated].getName());
      }
      player.sendPacket(msg);
    }
    else
    {
View Full Code Here

    if (player == null)
    {
      return;
    }
    GameObject target = player.getTarget();
    NpcHtmlMessage npcReply = showQuestInfo ? new ExNpcQuestHtmlMessage(target == null ? 5 : target.getObjectId(), getQuestIntId()) : new NpcHtmlMessage(target == null ? 5 : target.getObjectId());
    npcReply.setFile("quests/" + getClass().getSimpleName() + "/" + fileName);
    if ((arg.length % 2) == 0)
    {
      for (int i = 0; i < arg.length; i += 2)
      {
        npcReply.replace(String.valueOf(arg[i]), String.valueOf(arg[i + 1]));
      }
    }
    player.sendPacket(npcReply);
  }
View Full Code Here

    sb.replaceFirst("%crossbowResist%", df.format(crossbowResist));
    sb.replaceFirst("%fistResist%", df.format(fistResist));
    sb.replaceFirst("%poleResist%", df.format(poleResist));
    sb.replaceFirst("%critChanceResist%", df.format(critChanceResist));
    sb.replaceFirst("%critDamResist%", df.format(critDamResist));
    NpcHtmlMessage msg = new NpcHtmlMessage(0);
    msg.setHtml(Strings.bbParse(sb.toString()));
    player.sendPacket(msg);
    return true;
  }
View Full Code Here

  {
    if (player == null)
    {
      return;
    }
    NpcHtmlMessage npcReply = new NpcHtmlMessage(5);
    npcReply.setFile(fileName);
    player.sendPacket(npcReply);
  }
View Full Code Here

TOP

Related Classes of lineage2.gameserver.network.serverpackets.NpcHtmlMessage

Copyright © 2018 www.massapicom. 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.