Package l2p.gameserver.model.entity.residence

Examples of l2p.gameserver.model.entity.residence.Castle


    if(player != null)
    {
      _item.setCustomFlags(0, false);
      player.getInventory().destroyItem(_item, 1, false);
      _item = null;
      Castle oldOwner = CastleManager.getInstance().getCastleByIndex(_currentTerritoryId);
      oldOwner.removeFlag(_baseTerritoryId);
      Castle newOwner = CastleManager.getInstance().getCastleByIndex(player.getTerritorySiege());
      newOwner.addFlag(_baseTerritoryId);
      TerritorySiege.removeFlag(this);
      TerritorySiege.spawnFlags(_baseTerritoryId); // Заспавнит только нужный нам флаг в замке
      TerritorySiege.setWardLoc(_baseTerritoryId, getLoc());
      TerritorySiege.refreshTerritorySkills();
      player.sendPacket(Msg.THE_EFFECT_OF_TERRITORY_WARD_IS_DISAPPEARING);
View Full Code Here


      String params = command.substring(command.indexOf("?") + 1);
      StringTokenizer st = new StringTokenizer(params, "&");
      int ask = Integer.parseInt(st.nextToken().split("=")[1]);
      int state = Integer.parseInt(st.nextToken().split("=")[1]);
      int time = Integer.parseInt(st.nextToken().split("=")[1]);
      Castle castle = getCastle();
      int castleId;
      if(state == -1) // info for current manor
      {
        castleId = castle.getId();
      }
      else
      // info for requested manor
      {
        castleId = state;
      }
      switch(ask)
      { // Main action
        case 1: // Seed purchase
          if(castleId != castle.getId())
          {
            player.sendPacket(Msg._HERE_YOU_CAN_BUY_ONLY_SEEDS_OF_S1_MANOR);
          }
          else
          {
            NpcTradeList tradeList = new NpcTradeList(0);
            GArray<SeedProduction> seeds = castle.getSeedProduction(CastleManorManager.PERIOD_CURRENT);
            for(SeedProduction s : seeds)
            {
              TradeItem item = new TradeItem();
              item.setItemId(s.getId());
              item.setOwnersPrice(s.getPrice());
              item.setCount(s.getCanProduce());
              if(item.getCount() > 0 && item.getOwnersPrice() > 0)
              {
                tradeList.addItem(item);
              }
            }
            BuyListSeed bl = new BuyListSeed(tradeList, castleId, player.getAdena());
            player.sendPacket(bl);
          }
          break;
        case 2: // Crop sales
          player.sendPacket(new ExShowSellCropList(player, castleId, castle.getCropProcure(CastleManorManager.PERIOD_CURRENT)));
          break;
        case 3: // Current seeds (Manor info)
          if(time == 1 && !CastleManager.getInstance().getCastleByIndex(castleId).isNextPeriodApproved())
          {
            player.sendPacket(new ExShowSeedInfo(castleId, null));
View Full Code Here

      return;
    }
    double taxRate = 0;
    if(tax)
    {
      Castle castle = getCastle(player);
      if(castle != null)
      {
        taxRate = castle.getTaxRate();
      }
    }
    player.tempInventoryDisable();
    NpcTradeList list = TradeController.getInstance().getBuyList(listId);
    if(list == null || list.getNpcId() == getNpcId())
View Full Code Here

      if(st.countTokens() < 1)
      {
        return;
      }
      int val = Integer.parseInt(st.nextToken());
      Castle castle = getCastle(player);
      L2Multisell.getInstance().SeparateAndSend(val, player, castle != null ? castle.getTaxRate() : 0);
    }
    else
    {
      super.onBypassFeedback(player, command);
    }
View Full Code Here

    int x = Integer.parseInt(param[0]);
    int y = Integer.parseInt(param[1]);
    int z = Integer.parseInt(param[2]);
    // Нельзя телепортироваться в города, где идет осада
    // Узнаем, идет ли осада в ближайшем замке к точке телепортации
    Castle castle = TownManager.getInstance().getClosestTown(x, y).getCastle();
    if(castle != null && castle.getSiege().isInProgress())
    {
      // Определяем, в город ли телепортируется чар
      boolean teleToTown = false;
      int townId = 0;
      for(L2Zone town : ZoneManager.getInstance().getZoneByType(ZoneType.Town))
      {
        if(town.checkIfInZone(x, y))
        {
          teleToTown = true;
          townId = town.getIndex();
          break;
        }
      }
      if(teleToTown && townId == castle.getTown())
      {
        player.sendPacket(Msg.YOU_CANNOT_TELEPORT_TO_A_VILLAGE_THAT_IS_IN_A_SIEGE);
        return;
      }
    }
View Full Code Here

      player.sendPacket(html);
    }
    else if(actualCommand.startsWith("Multisell") || actualCommand.startsWith("multisell"))
    {
      int listId = Integer.parseInt(command.substring(9).trim());
      Castle castle = getCastle(player);
      L2Multisell.getInstance().SeparateAndSend(listId, player, castle != null ? castle.getTaxRate() : 0);
    }
    else
    {
      super.onBypassFeedback(player, command);
    }
View Full Code Here

      catch(Exception e)
      {
      }
      if(castleId > 0)
      {
        Castle castle = CastleManager.getInstance().getCastleByIndex(castleId);
        castle.setCropProcure(new GArray<CropProcure>(), CastleManorManager.PERIOD_CURRENT);
        castle.setCropProcure(new GArray<CropProcure>(), CastleManorManager.PERIOD_NEXT);
        castle.setSeedProduction(new GArray<SeedProduction>(), CastleManorManager.PERIOD_CURRENT);
        castle.setSeedProduction(new GArray<SeedProduction>(), CastleManorManager.PERIOD_NEXT);
        castle.saveCropData();
        castle.saveSeedData();
        activeChar.sendMessage("Manor data for " + castle.getName() + " was nulled");
      }
      else
      {
        for(Castle castle : CastleManager.getInstance().getCastles().values())
        {
          castle.setCropProcure(new GArray<CropProcure>(), CastleManorManager.PERIOD_CURRENT);
          castle.setCropProcure(new GArray<CropProcure>(), CastleManorManager.PERIOD_NEXT);
          castle.setSeedProduction(new GArray<SeedProduction>(), CastleManorManager.PERIOD_CURRENT);
          castle.setSeedProduction(new GArray<SeedProduction>(), CastleManorManager.PERIOD_NEXT);
          castle.saveCropData();
          castle.saveSeedData();
        }
        activeChar.sendMessage("Manor data was nulled");
      }
      showMainPage(activeChar);
    }
View Full Code Here

      {
        String name = rs.getString("name");
        String taxPercent = rs.getString("taxPercent");
        String owner = "Нет владельца";
        String siegeDate = "";
        Castle c = CastleManager.getInstance().getCastleByIndex(rs.getInt("id"));
        if(c != null)
        {
          siegeDate = dateFormat.format(c.getSiege().getSiegeDate().getTime());
          L2Clan o = c.getOwner();
          if(o != null)
          {
            owner = o.getName();
          }
        }
View Full Code Here

        try {
            if (command.equalsIgnoreCase("TerritoryStatus")) {
                NpcHtmlMessage html = new NpcHtmlMessage(player, this);
                html.setFile("data/html/merchant/territorystatus.htm");
                html.replace("%npcname%", getName());
                Castle castle = getCastle(player);
                if (castle != null && castle.getId() > 0) {
                    html.replace("%castlename%", castle.getName());
                    html.replace("%taxpercent%", String.valueOf(castle.getTaxPercent()));
                    if (castle.getOwnerId() > 0) {
                        L2Clan clan = ClanTable.getInstance().getClan(castle.getOwnerId());
                        if (clan != null) {
                            html.replace("%clanname%", clan.getName());
                            html.replace("%clanleadername%", clan.getLeaderName());
                        } else {
                            html.replace("%clanname%", "unexistant clan");
                            html.replace("%clanleadername%", "None");
                        }
                    } else {
                        html.replace("%clanname%", "NPC");
                        html.replace("%clanleadername%", "None");
                    }
                } else {
                    html.replace("%castlename%", "Open");
                    html.replace("%taxpercent%", "0");
                    html.replace("%clanname%", "No");
                    html.replace("%clanleadername%", getName());
                }
                player.sendPacket(html);
            } else if (command.startsWith("Quest")) {
                String quest = command.substring(5).trim();
                if (quest.length() == 0) {
                    showQuestWindow(player);
                } else {
                    showQuestWindow(player, quest);
                }
            } else if (command.startsWith("Chat")) {
                try {
                    int val = Integer.parseInt(command.substring(5));
                    showChatWindow(player, val);
                } catch (NumberFormatException nfe) {
                    String filename = command.substring(5).trim();
                    if (filename.length() == 0) {
                        showChatWindow(player, "data/html/npcdefault.htm");
                    } else {
                        showChatWindow(player, filename);
                    }
                }
            } else if (command.startsWith("Loto")) {
                int val = Integer.parseInt(command.substring(5));
                showLotoWindow(player, val);
            } else if (command.startsWith("AttributeCancel")) {
                player.sendPacket(new ExShowBaseAttributeCancelWindow(player,
                        RequestExRemoveItemAttribute.UNENCHANT_PRICE));
            } else if (command.startsWith("CPRecovery")) {
                makeCPRecovery(player);
            } else if (command.startsWith("NpcLocationInfo")) {
                int val = Integer.parseInt(command.substring(16));
                L2NpcInstance npc = L2ObjectsStorage.getByNpcId(val);
                if (npc != null) {
                    // Убираем флажок на карте и стрелку на компасе
                    player.sendPacket(new RadarControl(2, 2, npc.getLoc()));
                    // Ставим флажок на карте и стрелку на компасе
                    player.sendPacket(new RadarControl(0, 1, npc.getLoc()));
                }
            } else if (command.startsWith("SupportMagic")) {
                makeSupportMagic(player);
            } else if (command.startsWith("ProtectionBlessing")) {
                // Не выдаём блессиг протекшена ПКшникам.
                if (player.getKarma() > 0) {
                    return;
                }
                if (player.getLevel() > 39 || player.getClassId().getLevel() >= 3) {
                    String content = "<html><body>Blessing of protection not available for characters whose level more than 39 or completed second class transfer.</body></html>";
                    NpcHtmlMessage html = new NpcHtmlMessage(player, this);
                    html.setHtml(content);
                    player.sendPacket(html);
                    return;
                }
                SkillTable.getInstance().getInfo(5182, 1).getEffects(player, player, false, false);
            } else if (command.startsWith("Multisell") || command.startsWith("multisell")) {
                String listId = command.substring(9).trim();
                Castle castle = getCastle(player);
                L2Multisell.getInstance().SeparateAndSend(Integer.parseInt(listId), player,
                        castle != null ? castle.getTaxRate() : 0);
            } else if (command.startsWith("EnterRift")) {
                StringTokenizer st = new StringTokenizer(command);
                st.nextToken(); // no need for "enterRift"
                Integer b1 = Integer.parseInt(st.nextToken()); // type
                DimensionalRiftManager.getInstance().start(player, b1, this);
View Full Code Here

      L2Clan clan = player.getClan();
      if(clan != null && SiegeManager.getSiege(actor, true) == clan.getSiege() && clan.isDefender())
      {
        return;
      }
      Castle castle = actor.getCastle();
      if(player.getTerritorySiege() > -1 && castle != null && player.getTerritorySiege() == castle.getId())
      {
        return;
      }
    }
    super.onEvtAggression(target, aggro);
View Full Code Here

TOP

Related Classes of l2p.gameserver.model.entity.residence.Castle

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.