コード例 #1
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();
  }
コード例 #2
0
ファイル: Walking.java プロジェクト: MilboWca/Area59
  @Override
  public void processPacket(Client c, int packetType, int packetSize) {
    /*if(c.openDuel) {
    	Client o = (Client) Server.playerHandler.players[c.duelingWith];
    	c.openDuel = false;
    	o.openDuel = false;
    	c.getPA().closeAllWindows();
    	o.getPA().closeAllWindows();
    }*/
    if (c.getAgility().doingAgility) {
      return;
    }

    if (c.loggedIn == 0) {
      c.getDH().sendDialogues(691, 2244);
      return;
    }
    c.walkingToItem = false;
    c.isWc = false;
    c.clickNpcType = 0;
    c.clickObjectType = 0;
    if (c.isBanking) c.isBanking = false;
    if (c.tradeStatus >= 0) {
      c.tradeStatus = 0;
    }
    if (c.inTrade) {
      Client o = (Client) Server.playerHandler.players[c.tradeWith];
      o.tradeAccepted = false;
      c.tradeAccepted = false;
      o.tradeStatus = 0;
      c.tradeStatus = 0;
      c.tradeConfirmed = false;
      c.tradeConfirmed2 = false;
      c.sendMessage("@red@Trade has been declined.");
      o.sendMessage("@red@Other player has declined the trade.");
      // Misc.println("trade reset");
      c.getTradeAndDuel().declineTrade();
      return;
    }
    if (packetType == 248 || packetType == 164) {
      c.faceUpdate(0);
      c.npcIndex = 0;
      c.playerIndex = 0;
      if (c.followId > 0 || c.followId2 > 0) c.getPA().resetFollow();
    }
    if (c.canWalk == false) {
      return;
    }
    c.getPA().removeAllWindows();
    if (c.duelRule[1] && c.duelStatus == 5) {
      if (Server.playerHandler.players[c.duelingWith] != null) {
        if (!c.goodDistance(
                c.getX(),
                c.getY(),
                Server.playerHandler.players[c.duelingWith].getX(),
                Server.playerHandler.players[c.duelingWith].getY(),
                1)
            || c.attackTimer == 0) {
          c.sendMessage("Walking has been disabled in this duel!");
        }
      }
      c.playerIndex = 0;
      return;
    }
    if (c.stopPlayerSkill) {
      SkillHandler.resetPlayerSkillVariables(c);
      c.stopPlayerSkill = false;
    }

    if (c.freezeTimer > 0) {
      if (Server.playerHandler.players[c.playerIndex] != null) {
        if (c.goodDistance(
                c.getX(),
                c.getY(),
                Server.playerHandler.players[c.playerIndex].getX(),
                Server.playerHandler.players[c.playerIndex].getY(),
                1)
            && packetType != 98) {
          c.playerIndex = 0;
          return;
        }
      }
      if (packetType != 98) {
        c.sendMessage("A magical force stops you from moving.");
        c.playerIndex = 0;
      }
      return;
    }

    if (System.currentTimeMillis() - c.lastSpear < 4000) {
      c.sendMessage("You have been stunned.");
      c.playerIndex = 0;
      return;
    }

    if (packetType == 98) {
      c.mageAllowed = true;
    }

    if (c.duelStatus == 6) {
      c.getTradeAndDuel().claimStakedItems();
      return;
    }

    if (c.duelStatus >= 1 && c.duelStatus <= 4) {
      Client o = (Client) Server.playerHandler.players[c.duelingWith];
      c.duelStatus = 0;
      o.duelStatus = 0;
      // c.sendMessage("@red@The challange has been declined.");
      // o.sendMessage("@red@Other player has declined the challange.");
      // Misc.println("trade reset");
      o.getTradeAndDuel().declineDuel();
      c.getTradeAndDuel().declineDuel();
      // return;
    }

    if (c.respawnTimer > 3) {
      return;
    }
    if (c.inTrade) {
      return;
    }
    if (packetType == 248) {
      packetSize -= 14;
    }
    c.newWalkCmdSteps = (packetSize - 5) / 2;
    if (++c.newWalkCmdSteps > c.walkingQueueSize) {
      c.newWalkCmdSteps = 0;
      return;
    }

    c.getNewWalkCmdX()[0] = c.getNewWalkCmdY()[0] = 0;

    int firstStepX = c.getInStream().readSignedWordBigEndianA() - c.getMapRegionX() * 8;
    for (int i = 1; i < c.newWalkCmdSteps; i++) {
      c.getNewWalkCmdX()[i] = c.getInStream().readSignedByte();
      c.getNewWalkCmdY()[i] = c.getInStream().readSignedByte();
    }

    int firstStepY = c.getInStream().readSignedWordBigEndian() - c.getMapRegionY() * 8;
    c.setNewWalkCmdIsRunning((c.getInStream().readSignedByteC() == 1));
    // c.isResting = false;
    for (int i1 = 0; i1 < c.newWalkCmdSteps; i1++) {
      c.getNewWalkCmdX()[i1] += firstStepX;
      c.getNewWalkCmdY()[i1] += firstStepY;
    }
  }