Пример #1
0
 @Override
 public void removeSkills() {
   // Dismount
   getPlayer().removeSkill(SkillTable.getInstance().getInfo(619, 1), false);
   // Decrease Bow/Crossbow Attack Speed
   getPlayer().removeSkill(SkillTable.getInstance().getInfo(5491, 1), false);
   getPlayer().setTransformAllowedSkills(EMPTY_ARRAY);
 }
Пример #2
0
 @Override
 public void transformedSkills() {
   // Decrease Bow/Crossbow Attack Speed
   getPlayer().addSkill(SkillTable.getInstance().getInfo(5491, 1), false);
   // Dismount
   getPlayer().addSkill(SkillTable.getInstance().getInfo(9210, 1), false);
   // Horse Windwalk
   getPlayer().addSkill(SkillTable.getInstance().getInfo(9206, 1), false);
   getPlayer().setTransformAllowedSkills(Skills);
 }
Пример #3
0
 @Override
 public void removeSkills() {
   // Spear
   getPlayer().removeSkill(SkillTable.getInstance().getInfo(559, 2), false);
   // Power Slash
   getPlayer().removeSkill(SkillTable.getInstance().getInfo(560, 2), false);
   // Bless of Angel
   getPlayer().removeSkill(SkillTable.getInstance().getInfo(561, 2), false, false);
   // Wind of Angel
   getPlayer().removeSkill(SkillTable.getInstance().getInfo(562, 2), false, false);
   // Transfrom Dispel
   getPlayer().removeSkill(SkillTable.getInstance().getInfo(619, 1), false);
   // Decrease Bow/Crossbow Attack Speed
   getPlayer().removeSkill(SkillTable.getInstance().getInfo(5491, 1), false);
   getPlayer().setTransformAllowedSkills(EMPTY_ARRAY);
 }
Пример #4
0
  public GameServerStartup() throws Exception {
    long serverLoadStart = System.currentTimeMillis();

    gameServer = this;

    printSection("Database Engine");
    L2DatabaseFactory.getInstance();

    printSection("IDFactory Engine");
    IdFactory.getInstance();
    _log.log(Level.INFO, "IdFactory: Free ObjectID's remaining: " + IdFactory.getInstance().size());

    ThreadPoolManager.getInstance();

    printSection("Engines");
    ScriptsManager.getInstance();
    ServerPacketOpCodeManager.getInstance();

    printSection("World Engine");
    Colors.loadColors();
    GameTimeController.init();
    InstanceManager.getInstance();
    WorldManager.getInstance();
    MapRegionManager.getInstance();
    Announcements.getInstance();
    GlobalVariablesManager.getInstance();
    AccountShareDataTable.getInstance();
    DynamicSpawnData.getInstance();
    ResidenceFunctionData.getInstance();

    printSection("Skills Engine");
    BuffStackGroupData.getInstance();
    EnchantSkillGroupsTable.getInstance();
    SkillTable.getInstance().load(false);
    SkillTreesData.getInstance();

    printSection("Items Engine");
    ItemTable.getInstance().loadClient();
    ItemTable.getInstance().load(false);
    SummonItemsData.getInstance();
    EnchantBonusData.getInstance();
    BuyListData.getInstance();
    MultiSellData.getInstance();
    RecipeData.getInstance();
    // PrimeShopTable.getInstance(); TODO
    ArmorSetsTable.getInstance();
    FishData.getInstance();
    FishingRodsData.getInstance();
    EnchantItemData.getInstance();
    EnchantEffectTable.getInstance();
    CrystallizationData.getInstance();
    SoulCrystalData.getInstance();
    ShapeShiftingItemsData.getInstance();
    HennaTable.getInstance();
    HennaTreeTable.getInstance();
    AugmentationData.getInstance();
    ItemPriceData.getInstance();
    AbilityPointsData.getInstance();
    AlchemyDataTable.getInstance();

    printSection("Characters Engine");
    CharTemplateTable.getInstance();
    ClassTemplateTable.getInstance();
    CharNameTable.getInstance();
    ExperienceTable.getInstance();
    AdminTable.getInstance();
    RaidBossPointsManager.getInstance();
    RelationListManager.getInstance();
    PetDataTable.getInstance();
    CharSummonTable.getInstance();
    SummonPointsTable.getInstance();
    HitConditionBonus.getInstance();
    ObsceneFilterTable.getInstance();

    printSection("Clans Engine");
    ClanTable.getInstance();
    ClanTable.getInstance().restoreWars();
    ClanHallSiegeManager.getInstance();
    ClanHallManager.getInstance();
    AuctionManager.getInstance();

    printSection("Geodata Engine");
    GeoEngine.init();
    PathFinding.init();
    DoorGeoEngine.init();

    printSection("NPCs Engine");
    HerbDropTable.getInstance();
    NpcTable.getInstance();
    AutoChatDataTable.getInstance();
    NpcWalkerRoutesData.getInstance();
    WalkingManager.getInstance();
    ZoneManager.getInstance();
    StaticObjectsData.getInstance();
    ItemAuctionManager.getInstance();
    CastleManager.getInstance();
    FortManager.getInstance().init();
    SpawnTable.getInstance();
    AutoSpawnHandler.getInstance();
    HellboundManager.getInstance();
    RaidBossSpawnManager.getInstance();
    DayNightSpawnManager.getInstance().trim().notifyChangeMode();
    GrandBossManager.getInstance().initZones();
    FourSepulchersManager.getInstance().init();
    TeleportListTable.getInstance();
    BeautyShopData.getInstance();
    CustomDropListDataXml.getInstance();

    printSection("Residence Siege Engine");
    CastleSiegeManager.getInstance().getSieges();
    FortSpawnList.getInstance();
    FortSiegeManager.getInstance();
    CastleManorManager.getInstance();
    CastleMercTicketManager.getInstance();
    ManorData.getInstance();
    ResidenceSiegeMusicList.getInstance();

    printSection("Olympiad Engine");
    Olympiad.getInstance();
    HeroManager.getInstance();

    printSection("Cache Engine");
    CrestCache.getInstance();
    HtmCache.getInstance();

    PartyMatchWaitingList.getInstance();
    PartyMatchRoomList.getInstance();
    PetitionManager.getInstance();
    CursedWeaponsManager.getInstance();
    CommunityBuffTable.getInstance();
    CommunityTeleportData.getInstance();

    printSection("Mods Engine");
    PcCafePointsManager.getInstance();

    if (Config.MMO_TOP_MANAGER_ENABLED) {
      MMOTopManager.getInstance();
    }
    if (Config.L2_TOP_MANAGER_ENABLED) {
      L2TopManager.getInstance();
    }

    printSection("Handlers Engine");
    ActionHandler.getInstance();
    ActionShiftHandler.getInstance();
    AdminCommandHandler.getInstance();
    BypassCommandManager.getInstance();
    ChatCommandManager.getInstance();
    EffectHandler.getInstance();
    ItemHandler.getInstance();
    SkillHandler.getInstance();
    TargetHandler.getInstance();
    TransformHandler.getInstance();
    UserCommandManager.getInstance();
    VoicedHandlerManager.getInstance();

    printSection("Transformations Engine");
    TransformationManager.getInstance();
    TransformationManager.getInstance().report();

    printSection("Jump Engine");
    CharJumpRoutesTable.getInstance();

    printSection("Commission Engine");
    CommissionManager.getInstance();

    printSection("ClanSearch Engine");
    ClanSearchManager.getInstance();

    printSection("Awakening Engine");
    AwakeningManager.getInstance();

    printSection("World Statistics Engine");
    if (ConfigWorldStatistic.WORLD_STATISTIC_ENABLED) {
      WorldStatisticsManager.getInstance();
    } else {
      _log.log(Level.INFO, "World Statistic Engine Disabled");
    }

    printSection("Quests Engine");
    QuestManager.getInstance();
    DynamicQuestManager.getInstance();
    BoatManager.getInstance();
    AirShipManager.getInstance();
    ShuttleManager.getInstance();
    GraciaSeedsManager.getInstance();
    if (Config.ALLOW_WEDDING) {
      WeddingManager.getInstance();
    }
    AutoChatDataTable.getInstance().setAutoChatActive(true);

    printSection("Scripts Engine");
    ScriptsManager.getInstance().executeCoreScripts();

    TaskManager.getInstance();

    QuestManager.getInstance().report();

    if (Config.SAVE_DROPPED_ITEM) {
      ItemsOnGroundManager.getInstance();
    }

    if (Config.AUTODESTROY_ITEM_AFTER > 0 || Config.HERB_AUTO_DESTROY_TIME > 0) {
      ItemsOnGroundAutoDestroyManager.getInstance();
    }

    CastleManager.getInstance().spawnDoors();
    FortManager.getInstance().spawnDoors();

    if (Config.ALLOW_MAIL) {
      MailManager.getInstance();
    }

    MentorManager.getInstance();
    DuelManager.getInstance();

    Runtime.getRuntime().addShutdownHook(GameServerShutdown.getInstance());

    _log.log(Level.INFO, "IdFactory: Free ObjectID's remaining: " + IdFactory.getInstance().size());

    EventManager.getEventsInstances();

    KnownListUpdateTaskManager.getInstance();

    if ((Config.OFFLINE_TRADE_ENABLE || Config.OFFLINE_CRAFT_ENABLE) && Config.RESTORE_OFFLINERS) {
      OfflineTradersTable.restoreOfflineTraders();
    }

    if (Config.DEADLOCK_DETECTOR) {
      _deadDetectThread = new DeadLockDetector();
      _deadDetectThread.setDaemon(true);
      _deadDetectThread.start();
    } else {
      _deadDetectThread = null;
    }

    printSection("Finalization");
    System.runFinalization();
    System.gc();
    Util.printMemoryInfo();
    Util.printCpuInfo();
    Util.printOSInfo();
    Toolkit.getDefaultToolkit().beep();

    printSection("Server Thread");
    LoginServerThread.getInstance().start();

    SelectorConfig sc = new SelectorConfig();
    sc.MAX_READ_PER_PASS = Config.MMO_MAX_READ_PER_PASS;
    sc.MAX_SEND_PER_PASS = Config.MMO_MAX_SEND_PER_PASS;
    sc.SLEEP_TIME = Config.MMO_SELECTOR_SLEEP_TIME;
    sc.HELPER_BUFFER_COUNT = Config.MMO_HELPER_BUFFER_COUNT;
    sc.TCP_NODELAY = Config.MMO_TCP_NODELAY;

    _gamePacketHandler = new L2GamePacketHandler();
    _selectorThread =
        new SelectorThread<>(
            sc, _gamePacketHandler, _gamePacketHandler, _gamePacketHandler, new IPv4Filter());

    InetAddress bindAddress = null;
    if (!Config.GAMESERVER_HOSTNAME.equals("*")) {
      try {
        bindAddress = InetAddress.getByName(Config.GAMESERVER_HOSTNAME);
      } catch (UnknownHostException e1) {
        _log.log(
            Level.ERROR,
            "GameServerStartup: The GameServer bind address is invalid, using all avaliable IPs. Reason: "
                + e1.getMessage(),
            e1);
      }
    }

    try {
      _selectorThread.openServerSocket(bindAddress, Config.PORT_GAME);
    } catch (IOException e) {
      _log.log(
          Level.FATAL,
          "GameServerStartup:: Failed to open server socket. Reason: " + e.getMessage(),
          e);
      System.exit(1);
    }
    _selectorThread.start();
    _log.log(Level.INFO, "Maximum Numbers of Connected Players: " + Config.MAXIMUM_ONLINE_USERS);
    long serverLoadEnd = System.currentTimeMillis();
    _log.log(
        Level.INFO, "Server Loaded in " + (serverLoadEnd - serverLoadStart) / 1000L + " seconds");

    AutoAnnounceTaskManager.getInstance();

    XMLRPCServer.getInstance();
  }
Пример #5
0
  @Override
  public void useSkill(L2Character activeChar, L2Skill skill, L2Object[] targets) {
    boolean acted = true;

    L2PcInstance player = null;
    if (activeChar instanceof L2PcInstance) {
      player = (L2PcInstance) activeChar;
    }

    if (skill.getEffectId() != 0) {
      L2Skill sk =
          SkillTable.getInstance()
              .getInfo(skill.getEffectId(), skill.getEffectLvl() == 0 ? 1 : skill.getEffectLvl());

      if (sk != null) {
        skill = sk;
      }
    }

    boolean ss = activeChar.isSoulshotCharged(skill);
    boolean sps = activeChar.isSpiritshotCharged(skill);
    boolean bss = activeChar.isBlessedSpiritshotCharged(skill);

    L2Character target;
    for (L2Object obj : targets) {
      if (obj instanceof L2Character) {
        target = (L2Character) obj;
      } else {
        continue;
      }

      byte shld = 0;

      if (Reflect.calcSkillReflect(target, skill) == Variables.SKILL_REFLECT_SUCCEED) {
        target = activeChar;
      }

      // Персонаж, владеющий ПО, не может быть бафнутым и не сам не может никого бафать
      if (skill.getSkillType() == L2SkillType.BUFF
          && activeChar.isNpc()
          && ((L2Npc) activeChar).getClanHall() != null) {
        if (!target.equals(activeChar)) {
          if (target instanceof L2PcInstance) {
            L2PcInstance trg = (L2PcInstance) target;
            if (trg.isCursedWeaponEquipped()) {
              continue;
            }
            // Avoiding block checker players get buffed from outside
            else if (trg.getEventController().isInHandysBlockCheckerEventArena()) {
              continue;
            }
          } else if (player != null && player.isCursedWeaponEquipped()) {
            continue;
          }
        }
      }

      switch (skill.getSkillType()) {
        case HOT:
        case CPHOT:
        case MPHOT:
          if (activeChar.isInvul()) {
            continue;
          }
          break;
      }

      if (skill.isOffensive() || skill.isDebuff()) {
        shld = Shield.calcShldUse(activeChar, target, skill);
        acted = Skills.calcSkillSuccess(activeChar, target, skill, shld, ss, sps, bss);
      }

      if (acted) {
        if (skill.isToggle()) {
          for (L2Effect e : target.getAllEffects()) {
            if (e != null && e.getSkill().getId() == skill.getId()) {
              e.exit();
              return;
            }
          }
        }

        // if this is a debuff let the duel manager know about it
        // so the debuff can be removed after the duel
        // (player & target must be in the same duel)
        if (target instanceof L2PcInstance
            && ((L2PcInstance) target).isInDuel()
            && (skill.getSkillType() == L2SkillType.DEBUFF
                || skill.getSkillType() == L2SkillType.BUFF)
            && player != null
            && player.getDuelId() == ((L2PcInstance) target).getDuelId()) {
          DuelManager dm = DuelManager.getInstance();
          for (L2Effect buff : skill.getEffects(activeChar, target, new Env(shld, ss, sps, bss))) {
            if (buff != null) {
              dm.onBuff((L2PcInstance) target, buff);
            }
          }
        } else {
          L2Effect[] effects = skill.getEffects(activeChar, target, new Env(shld, ss, sps, bss));

          if (target instanceof L2PcInstance && !target.getPets().isEmpty()) {
            for (L2Summon pet : target.getPets()) {
              if (!pet.equals(activeChar)
                  && pet instanceof L2SummonInstance
                  && effects.length > 0) {
                if (effects[0].canBeStolen() || skill.isHeroSkill() || skill.isStatic()) {
                  skill.getEffects(activeChar, pet, new Env(shld, ss, sps, bss));
                }
              }
            }
          }
        }

        if (skill.getSkillType() == L2SkillType.AGGDEBUFF) {
          if (target instanceof L2Attackable) {
            target
                .getAI()
                .notifyEvent(CtrlEvent.EVT_AGGRESSION, activeChar, (int) skill.getPower());
          } else if (target instanceof L2Playable) {
            if (target.getTarget().equals(activeChar)) {
              target.getAI().setIntention(CtrlIntention.AI_INTENTION_ATTACK, activeChar);
            } else {
              target.setTarget(activeChar);
            }
          }
        }
      } else {
        activeChar.sendPacket(SystemMessageId.ATTACK_FAILED);
      }

      // Possibility of a lethal strike
      BlowDamage.calcLethalHit(activeChar, target, skill);
    }

    // self Effect :]
    if (skill.hasSelfEffects()) {
      L2Effect effect = activeChar.getFirstEffect(skill.getId());
      if (effect != null && effect.isSelfEffect()) {
        // Replace old effect with new one.
        effect.exit();
      }
      skill.getEffectsSelf(activeChar);
    }

    activeChar.spsUncharge(skill);
  }