Exemplo n.º 1
0
        public Map(Game game, long firstSpawnTime, long spawnInterval, long firstGoldTime, bool hasFountainHeal, int id)
        {
            this.objects = new Dictionary<int, GameObject>();
            this.champions = new Dictionary<int, Champion>();
            this.visionUnits = new Dictionary<int, Unit>[3];
            this.expToLevelUp = new List<int>();
            this.waveNumber = 0;
            this.firstSpawnTime = firstSpawnTime;
            this.firstGoldTime = firstGoldTime;
            this.spawnInterval = spawnInterval;
            this.gameTime = 0;
            this.nextSpawnTime = firstSpawnTime;
            this.nextSyncTime = 10 * 1000;
            this.announcerEvents = new List<Pair<bool, Tuple<long, byte, bool>>>();
            this.game = game;
            this.firstBlood = true;
            this.killReduction = true;
            this.hasFountainHeal = hasFountainHeal;
            this.collisionHandler = new CollisionHandler(this);
            this.fountain = new Fountain();
            this.id = id;

            for (var i = 0; i < visionUnits.Length; i++)
                visionUnits[i] = new Dictionary<int, Unit>();
        }
Exemplo n.º 2
0
        internal void InitHandlers(Game g)
        {
            _handlerTable = new Dictionary<PacketCmdC2S, Dictionary<Channel, IPacketHandler>>();

            registerHandler(new HandleKeyCheck(), PacketCmdC2S.PKT_C2S_KeyCheck, Channel.CHL_HANDSHAKE);
            registerHandler(new HandleLoadPing(), PacketCmdC2S.PKT_C2S_Ping_Load_Info, Channel.CHL_C2S);
            registerHandler(new HandleSpawn(), PacketCmdC2S.PKT_C2S_CharLoaded, Channel.CHL_C2S);
            registerHandler(new HandleMap(), PacketCmdC2S.PKT_C2S_ClientReady, Channel.CHL_LOADING_SCREEN);
            registerHandler(new HandleSynch(), PacketCmdC2S.PKT_C2S_SynchVersion, Channel.CHL_C2S);
            registerHandler(new HandleCastSpell(), PacketCmdC2S.PKT_C2S_CastSpell, Channel.CHL_C2S);
            //registerHandler(new HandleGameNumber(),      PacketCmd.PKT_C2S_GameNumberReq, Channel.CHL_C2S);
            registerHandler(new HandleQueryStatus(), PacketCmdC2S.PKT_C2S_QueryStatusReq, Channel.CHL_C2S);
            registerHandler(new HandleStartGame(), PacketCmdC2S.PKT_C2S_StartGame, Channel.CHL_C2S);
            registerHandler(new HandleNull(), PacketCmdC2S.PKT_C2S_Exit, Channel.CHL_C2S);
            registerHandler(new HandleView(), PacketCmdC2S.PKT_C2S_ViewReq, Channel.CHL_C2S);
            registerHandler(new HandleNull(), PacketCmdC2S.PKT_C2S_Click, Channel.CHL_C2S);
            //registerHandler(new HandleNull(),            PacketCmd.PKT_C2S_OpenShop, Channel.CHL_C2S);
            registerHandler(new HandleAttentionPing(), PacketCmdC2S.PKT_C2S_AttentionPing, Channel.CHL_C2S);
            registerHandler(new HandleChatBoxMessage(), PacketCmdC2S.PKT_C2S_ChatBoxMessage, Channel.CHL_COMMUNICATION);
            registerHandler(new HandleMove(), PacketCmdC2S.PKT_C2S_MoveReq, Channel.CHL_C2S);
            registerHandler(new HandleNull(), PacketCmdC2S.PKT_C2S_MoveConfirm, Channel.CHL_C2S);
            registerHandler(new HandleSkillUp(), PacketCmdC2S.PKT_C2S_SkillUp, Channel.CHL_C2S);
            registerHandler(new HandleEmotion(), PacketCmdC2S.PKT_C2S_Emotion, Channel.CHL_C2S);
            registerHandler(new HandleBuyItem(), PacketCmdC2S.PKT_C2S_BuyItemReq, Channel.CHL_C2S);
            registerHandler(new HandleSellItem(), PacketCmdC2S.PKT_C2S_SellItem, Channel.CHL_C2S);
            registerHandler(new HandleSwapItems(), PacketCmdC2S.PKT_C2S_SwapItems, Channel.CHL_C2S);
            registerHandler(new HandleNull(), PacketCmdC2S.PKT_C2S_LockCamera, Channel.CHL_C2S);
            registerHandler(new HandleNull(), PacketCmdC2S.PKT_C2S_StatsConfirm, Channel.CHL_C2S);
            registerHandler(new HandleClick(), PacketCmdC2S.PKT_C2S_Click, Channel.CHL_C2S);
            registerHandler(new HandleHeartBeat(), PacketCmdC2S.PKT_C2S_HeartBeat, Channel.CHL_GAMEPLAY);
            //registerHandler(new ?, PacketCmdC2S.PKT_C2S_PauseReq, Channel.?);

            game = g;
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Console.WriteLine("Yorick " + SERVER_VERSION);
            WriteToLog.ExecutingDirectory = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            WriteToLog.LogfileName = "IntWarsSharp.txt";
            WriteToLog.CreateLogFile();
            ExecutingDirectory = WriteToLog.ExecutingDirectory;

            System.AppDomain.CurrentDomain.FirstChanceException += Logger.CurrentDomain_FirstChanceException;
            System.AppDomain.CurrentDomain.UnhandledException += Logger.CurrentDomain_UnhandledException;

            Logger.LogCoreInfo("Loading Config.");
            Config.LoadConfig();

            Logger.LogCoreInfo("Loading RAF files in filearchives/.");

            //var basePath = RAFManager.getInstance().findGameBasePath();
            var basePath = @"C:\LolPatcherProxy\Base\RADS\projects\lol_game_client";
            if (!RAFManager.getInstance().init(System.IO.Path.Combine(basePath, "filearchives")))
            {
                Logger.LogCoreError("Couldn't load RAF files. Make sure you have a 'filearchives' directory in the server's root directory. This directory is to be taken from RADS/projects/lol_game_client/");
                return;
            }

            ItemManager.getInstance().init();

            Logger.LogCoreInfo("Game started");

            Game g = new Game();
            var address = new ENetAddress();
            address.host = SERVER_HOST;
            address.port = SERVER_PORT;


            if (!g.initialize(address, SERVER_KEY))
            {
                Logger.LogCoreError("Couldn't listen on port " + SERVER_PORT + ", or invalid key");
                return;
            }

            Sniffer.getInstance().setGame(g);
            // var p = Process.Start("SnifferApp.exe");

            g.netLoop();

            PathNode.DestroyTable(); // Cleanup
        }
Exemplo n.º 4
0
 public void setGame(Game game)
 {
     this.game = game;
 }
Exemplo n.º 5
0
        public SummonersRift(Game game) : base(game, /*90*/5 * 1000, 30 * 1000, 90 * 1000, true, 1)
        {
            if (!RAFManager.getInstance().readAIMesh("LEVELS/Map1/AIPath.aimesh", out mesh))
            {
                Logger.LogCoreError("Failed to load SummonersRift data.");
                return;
            }
            collisionHandler.init(3); // Needs to be initialised after AIMesh

            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_T1_R_03_A", 10097.62f, 808.73f, 2550, 156, 0));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_T1_R_02_A", 6512.53f, 1262.62f, 2550, 170, 0));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_T1_C_07_A", 3747.26f, 1041.04f, 2550, 190, 0));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_T2_R_03_A", 13459.0f, 4284.0f, 2550, 156, 1));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_T2_R_02_A", 12920.0f, 8005.0f, 2550, 170, 1));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_T2_R_01_A", 13205.0f, 10474.0f, 2550, 190, 1));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_T1_C_05_A", 5448.02f, 6169.10f, 2550, 156, 0));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_T1_C_04_A", 4657.66f, 4591.91f, 2550, 170, 0));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_T1_C_03_A", 3233.99f, 3447.24f, 2550, 190, 0));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_T1_C_01_A", 1341.63f, 2029.98f, 2425, 180, 0));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_T1_C_02_A", 1768.19f, 1589.47f, 2425, 180, 0));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_T2_C_05_A", 8548.0f, 8289.0f, 2550, 156, 1));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_T2_C_04_A", 9361.0f, 9892.0f, 2550, 170, 1));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_T2_C_03_A", 10743.0f, 11010.0f, 2550, 190, 1));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_T2_C_01_A", 12662.0f, 12442.0f, 2425, 180, 1));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_T2_C_02_A", 12118.0f, 12876.0f, 2425, 180, 1));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_OrderTurretShrine_A", -236.05f, -53.32f, 9999, 999, 0));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_ChaosTurretShrine_A", 14157.0f, 14456.0f, 9999, 999, 1));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_T1_L_03_A", 574.66f, 10220.47f, 2550, 156, 0));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_T1_L_02_A", 1106.26f, 6485.25f, 2550, 170, 0));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_T1_C_06_A", 802.81f, 4052.36f, 2550, 190, 0));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_T2_L_03_A", 3911.0f, 13654.0f, 2550, 156, 1));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_T2_L_02_A", 7536.0f, 13190.0f, 2550, 170, 1));
            addObject(new Turret(this, Game.GetNewNetID(), "@Turret_T2_L_01_A", 10261.0f, 13465.0f, 2550, 190, 1));

            addObject(new LevelProp(this, Game.GetNewNetID(), 12465.0f, 14422.257f, 101.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, "LevelProp_Yonkey", "Yonkey"));
            addObject(new LevelProp(this, Game.GetNewNetID(), -76.0f, 1769.1589f, 94.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, "LevelProp_Yonkey1", "Yonkey"));
            addObject(new LevelProp(this, Game.GetNewNetID(), 13374.17f, 14245.673f, 194.9741f, 224.0f, 33.33f, 0.0f, 0.0f, -44.44f, "LevelProp_ShopMale", "ShopMale"));
            addObject(new LevelProp(this, Game.GetNewNetID(), -99.5613f, 855.6632f, 191.4039f, 158.0f, 0.0f, 0.0f, 0.0f, 0.0f, "LevelProp_ShopMale1", "ShopMale"));

            // Start at xp to reach level 1
            expToLevelUp = new List<int> { 0, 280, 660, 1140, 1720, 2400, 3180, 4060, 5040, 6120, 7300, 8580, 9960, 11440, 13020, 14700, 16480, 18360 };

            // Announcer events
            announcerEvents.Add(new Pair<bool, Tuple<long, byte, bool>> { Item1 = false, Item2 = new Tuple<long, byte, bool>(30 * 1000, 119, true) }); // Welcome to SR
            if (firstSpawnTime - 30 * 1000 >= 0.0f)
                announcerEvents.Add(new Pair<bool, Tuple<long, byte, bool>> { Item1 = false, Item2 = new Tuple<long, byte, bool>(firstSpawnTime - 30 * 1000, 120, true) }); // 30 seconds until minions spawn
            announcerEvents.Add(new Pair<bool, Tuple<long, byte, bool>> { Item1 = false, Item2 = new Tuple<long, byte, bool>(firstSpawnTime, 127, false) }); // Minions have spawned (90 * 1000)
            announcerEvents.Add(new Pair<bool, Tuple<long, byte, bool>> { Item1 = false, Item2 = new Tuple<long, byte, bool>(firstSpawnTime, 118, false) }); // Minions have spawned [2] (90 * 1000)

            fountain.setHealLocations(this);
        }