Beispiel #1
0
 public Server(Logger logger, RAFManager rafManager, ServerContext serverContext, Game game)
 {
     _logger        = logger;
     _rafManager    = rafManager;
     _serverContext = serverContext;
     _game          = game;
 }
Beispiel #2
0
        public Monster(Map map, int id, float x, float y, float facingX, float facingY, string model, string name) : base(map, id, model, new Stats(), 40, x, y)
        {
            setTeam(Convert.toTeamId(2));
            for (int i = 0; i < 3; i++)
            {
                setVisibleByTeam(i, true);
            }
            setMoveOrder(MoveOrder.MOVE_ORDER_MOVE);
            facing = new Vector2(facingX, facingY);
            stats.setAttackSpeedMultiplier(1.0f);
            this.name = name;

            Inibin inibin;

            if (!RAFManager.getInstance().readInibin("DATA/Characters/" + model + "/" + model + ".inibin", out inibin))
            {
                Logger.LogCoreError("couldn't find monster stats for " + model);
                return;
            }

            stats.setCurrentHealth(inibin.getFloatValue("Data", "BaseHP"));
            stats.setMaxHealth(inibin.getFloatValue("Data", "BaseHP"));
            // stats.setCurrentMana(inibin.getFloatValue("Data", "BaseMP"));
            // stats.setMaxMana(inibin.getFloatValue("Data", "BaseMP"));
            stats.setBaseAd(inibin.getFloatValue("DATA", "BaseDamage"));
            stats.setRange(inibin.getFloatValue("DATA", "AttackRange"));
            stats.setBaseMovementSpeed(inibin.getFloatValue("DATA", "MoveSpeed"));
            stats.setArmor(inibin.getFloatValue("DATA", "Armor"));
            stats.setMagicArmor(inibin.getFloatValue("DATA", "SpellBlock"));
            stats.setHp5(inibin.getFloatValue("DATA", "BaseStaticHPRegen"));
            stats.setMp5(inibin.getFloatValue("DATA", "BaseStaticMPRegen"));

            stats.setHealthPerLevel(inibin.getFloatValue("DATA", "HPPerLevel"));
            stats.setManaPerLevel(inibin.getFloatValue("DATA", "MPPerLevel"));
            stats.setAdPerLevel(inibin.getFloatValue("DATA", "DamagePerLevel"));
            stats.setArmorPerLevel(inibin.getFloatValue("DATA", "ArmorPerLevel"));
            stats.setMagicArmorPerLevel(inibin.getFloatValue("DATA", "SpellBlockPerLevel"));
            stats.setHp5RegenPerLevel(inibin.getFloatValue("DATA", "HPRegenPerLevel"));
            stats.setMp5RegenPerLevel(inibin.getFloatValue("DATA", "MPRegenPerLevel"));
            stats.setBaseAttackSpeed(0.625f / (1 + inibin.getFloatValue("DATA", "AttackDelayOffsetPercent")));

            setMelee(inibin.getBoolValue("DATA", "IsMelee"));
            setCollisionRadius(inibin.getIntValue("DATA", "PathfindingCollisionRadius"));

            Inibin autoAttack;

            if (!RAFManager.getInstance().readInibin("DATA/Characters/" + model + "/Spells/" + model + "BasicAttack.inibin", out autoAttack))
            {
                if (!RAFManager.getInstance().readInibin("DATA/Spells/" + model + "BasicAttack.inibin", out autoAttack))
                {
                    Logger.LogCoreError("Couldn't find monster auto-attack data for " + model);
                    return;
                }
            }

            autoAttackDelay           = autoAttack.getFloatValue("SpellData", "castFrame") / 30.0f;
            autoAttackProjectileSpeed = autoAttack.getFloatValue("SpellData", "MissileSpeed");
        }
Beispiel #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("Settings/GameInfo.json");

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

            var settings = Settings.Load("Settings/Settings.json");

            if (!RAFManager.getInstance().init(System.IO.Path.Combine(settings.RadsPath, "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
        }
Beispiel #4
0
        public Champion(string type, Map map, int id, int playerId) : base(map, id, type, new Stats(), 30, 0, 0, 1200)
        {
            this.type     = type;
            this.playerId = playerId;

            stats.setGold(475.0f);
            stats.setAttackSpeedMultiplier(1.0f);
            stats.setGoldPerSecond(map.getGoldPerSecond());
            stats.setGeneratingGold(false);

            Inibin inibin;

            if (!RAFManager.getInstance().readInibin("DATA/Characters/" + type + "/" + type + ".inibin", out inibin))
            {
                Logger.LogCoreError("couldn't find champion stats for " + type);
                return;
            }

            stats.setCurrentHealth(inibin.getFloatValue("Data", "BaseHP"));
            stats.setMaxHealth(inibin.getFloatValue("Data", "BaseHP"));
            stats.setCurrentMana(inibin.getFloatValue("Data", "BaseMP"));
            stats.setMaxMana(inibin.getFloatValue("Data", "BaseMP"));
            stats.setBaseAd(inibin.getFloatValue("DATA", "BaseDamage"));
            stats.setRange(inibin.getFloatValue("DATA", "AttackRange"));
            stats.setBaseMovementSpeed(inibin.getFloatValue("DATA", "MoveSpeed"));
            stats.setArmor(inibin.getFloatValue("DATA", "Armor"));
            stats.setMagicArmor(inibin.getFloatValue("DATA", "SpellBlock"));
            stats.setHp5(inibin.getFloatValue("DATA", "BaseStaticHPRegen"));
            stats.setMp5(inibin.getFloatValue("DATA", "BaseStaticMPRegen"));

            stats.setHealthPerLevel(inibin.getFloatValue("DATA", "HPPerLevel"));
            stats.setManaPerLevel(inibin.getFloatValue("DATA", "MPPerLevel"));
            stats.setAdPerLevel(inibin.getFloatValue("DATA", "DamagePerLevel"));
            stats.setArmorPerLevel(inibin.getFloatValue("DATA", "ArmorPerLevel"));
            stats.setMagicArmorPerLevel(inibin.getFloatValue("DATA", "SpellBlockPerLevel"));
            stats.setHp5RegenPerLevel(inibin.getFloatValue("DATA", "HPRegenPerLevel"));
            stats.setMp5RegenPerLevel(inibin.getFloatValue("DATA", "MPRegenPerLevel"));
            stats.setBaseAttackSpeed(0.625f / (1 + inibin.getFloatValue("DATA", "AttackDelayOffsetPercent")));

            spells.Add(new Spell(this, inibin.getStringValue("Data", "Spell1"), 0));
            spells.Add(new Spell(this, inibin.getStringValue("Data", "Spell2"), 1));
            spells.Add(new Spell(this, inibin.getStringValue("Data", "Spell3"), 2));
            spells.Add(new Spell(this, inibin.getStringValue("Data", "Spell4"), 3));

            setMelee(inibin.getBoolValue("DATA", "IsMelee"));
            setCollisionRadius(inibin.getIntValue("DATA", "PathfindingCollisionRadius"));

            Inibin autoAttack;

            if (!RAFManager.getInstance().readInibin("DATA/Characters/" + type + "/Spells/" + type + "BasicAttack.inibin", out autoAttack))
            {
                if (!RAFManager.getInstance().readInibin("DATA/Spells/" + type + "BasicAttack.inibin", out autoAttack))
                {
                    Logger.LogCoreError("Couldn't find champion auto-attack data for " + type);
                    return;
                }
            }

            autoAttackDelay           = autoAttack.getFloatValue("SpellData", "castFrame") / 30.0f;
            autoAttackProjectileSpeed = autoAttack.getFloatValue("SpellData", "MissileSpeed");

            //F**k LUA

            /* var scriptloc = "../../lua/champions/" + getType() + "/Passive.lua";
             * Logger.LogCoreInfo("Loading " + scriptloc);
             * try
             * {
             *   unitScript = LuaScript(true);//fix
             *
             *   unitScript.lua.set("me", this);
             *
             *   unitScript.loadScript(scriptloc);
             *
             *   unitScript.lua.set_function("dealMagicDamage", [this](Unit * target, float amount) { this.dealDamageTo(target, amount, DAMAGE_TYPE_MAGICAL, DAMAGE_SOURCE_SPELL); });
             *   unitScript.lua.set_function("addBuff", [this](Buff b, Unit * target){
             *       target.addBuff(new Buff(b));
             *       return;
             *   });
             *
             *   unitScript.lua.set_function("addParticleTarget", [this](const std::string&particle, Target* u) {
             *       this.getMap().getGame().notifyParticleSpawn(this, u, particle);
             *       return;
             *   });
             *
             *   // unitScript.lua.set ("me", this);
             * }
             * catch
             * {
             *
             * }*/
        }
Beispiel #5
0
 /**
  * @return Spell's unique ID
  */
 public int getId()
 {
     return((int)RAFManager.getInstance().getHash(spellName));
 }
Beispiel #6
0
        public void addProjectileTarget(Target target)
        {
            Projectile p = new Projectile(owner.getMap(), Game.GetNewNetID(), owner.getX(), owner.getY(), (int)lineWidth, owner, target, this, projectileSpeed, (int)RAFManager.getInstance().getHash(spellName + "Missile"), projectileFlags != 0 ? projectileFlags : flags);

            owner.getMap().addObject(p);
            PacketNotifier.notifyProjectileSpawn(p);
        }
Beispiel #7
0
        public Spell(Champion owner, string spellName, byte slot)
        {
            this.owner     = owner;
            this.spellName = spellName;
            this.slot      = slot;

            Inibin inibin;

            if (!RAFManager.getInstance().readInibin("DATA/Spells/" + spellName + ".inibin", out inibin))
            {
                if (!RAFManager.getInstance().readInibin("DATA/Characters/" + owner.getType() + "/Spells/" + spellName + ".inibin", out inibin))
                {
                    if (!RAFManager.getInstance().readInibin("DATA/Characters/" + owner.getType() + "/" + spellName + ".inibin", out inibin))
                    {
                        Logger.LogCoreError("Couldn't find spell stats for " + spellName);
                        return;
                    }
                }
            }

            var i = 0;

            // Generate cooldown values for each level of the spell
            for (i = 0; i < cooldown.Length; ++i)
            {
                cooldown[i] = inibin.GetValue <float>("SpellData", "Cooldown" + (i + 1));
            }

            castTime = ((1.0f + inibin.GetValue <float>("SpellData", "DelayCastOffsetPercent"))) / 2.0f;

            flags           = inibin.GetValue <int>("SpellData", "Flags");
            castRange       = inibin.GetValue <float>("SpellData", "CastRange");
            projectileSpeed = inibin.GetValue <float>("SpellData", "MissileSpeed");
            coefficient     = inibin.GetValue <float>("SpellData", "Coefficient");
            lineWidth       = inibin.GetValue <float>("SpellData", "LineWidth");

            i = 1;
            while (true)
            {
                string key = "Effect" + (0 + i) + "Level0Amount";
                if (inibin.GetValue <object>("SpellData", key) == null)
                {
                    break;
                }


                List <float> effectValues = new List <float>();
                for (var j = 0; j < 6; ++j)
                {
                    key = "Effect" + (0 + i) + "Level" + (0 + j) + "Amount";
                    effectValues.Add(inibin.GetValue <float>("SpellData", key));
                }

                effects.Add(effectValues);
                ++i;
            }

            targetType = (float)Math.Floor(inibin.GetValue <float>("SpellData", "TargettingType") + 0.5f);


            // This is starting to get ugly. How many more names / paths to go ?
            if (!RAFManager.getInstance().readInibin("DATA/Spells/" + spellName + "Missile.inibin", out inibin))
            {
                if (!RAFManager.getInstance().readInibin("DATA/Spells/" + spellName + "Mis.inibin", out inibin))
                {
                    if (!RAFManager.getInstance().readInibin("DATA/Characters/" + owner.getType() + "/Spells/" + spellName + "Missile.inibin", out inibin))
                    {
                        if (!RAFManager.getInstance().readInibin("DATA/Characters/" + owner.getType() + "/" + spellName + "Missile.inibin", out inibin))
                        {
                            if (!RAFManager.getInstance().readInibin("DATA/Characters/" + owner.getType() + "/Spells/" + spellName + "Mis.inibin", out inibin))
                            {
                                if (!RAFManager.getInstance().readInibin("DATA/Characters/" + owner.getType() + "/" + spellName + "Mis.inibin", out inibin))
                                {
                                    return;
                                }
                            }
                        }
                    }
                }
            }

            castRange       = inibin.GetValue <float>("SpellData", "CastRange");
            projectileSpeed = inibin.GetValue <float>("SpellData", "MissileSpeed");
            projectileFlags = inibin.GetValue <int>("SpellData", "Flags");
        }
Beispiel #8
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(game, game.GetNewNetID(), "@Turret_T1_R_03_A", 10097.62f, 808.73f, 2550, 156, TeamId.TEAM_BLUE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_T1_R_02_A", 6512.53f, 1262.62f, 2550, 170, TeamId.TEAM_BLUE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_T1_C_07_A", 3747.26f, 1041.04f, 2550, 190, TeamId.TEAM_BLUE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_T2_R_03_A", 13459.0f, 4284.0f, 2550, 156, TeamId.TEAM_PURPLE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_T2_R_02_A", 12920.0f, 8005.0f, 2550, 170, TeamId.TEAM_PURPLE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_T2_R_01_A", 13205.0f, 10474.0f, 2550, 190, TeamId.TEAM_PURPLE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_T1_C_05_A", 5448.02f, 6169.10f, 2550, 156, TeamId.TEAM_BLUE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_T1_C_04_A", 4657.66f, 4591.91f, 2550, 170, TeamId.TEAM_BLUE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_T1_C_03_A", 3233.99f, 3447.24f, 2550, 190, TeamId.TEAM_BLUE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_T1_C_01_A", 1341.63f, 2029.98f, 2425, 180, TeamId.TEAM_BLUE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_T1_C_02_A", 1768.19f, 1589.47f, 2425, 180, TeamId.TEAM_BLUE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_T2_C_05_A", 8548.0f, 8289.0f, 2550, 156, TeamId.TEAM_PURPLE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_T2_C_04_A", 9361.0f, 9892.0f, 2550, 170, TeamId.TEAM_PURPLE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_T2_C_03_A", 10743.0f, 11010.0f, 2550, 190, TeamId.TEAM_PURPLE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_T2_C_01_A", 12662.0f, 12442.0f, 2425, 180, TeamId.TEAM_PURPLE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_T2_C_02_A", 12118.0f, 12876.0f, 2425, 180, TeamId.TEAM_PURPLE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_OrderTurretShrine_A", -236.05f, -53.32f, 9999, 999, TeamId.TEAM_BLUE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_ChaosTurretShrine_A", 14157.0f, 14456.0f, 9999, 999, TeamId.TEAM_PURPLE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_T1_L_03_A", 574.66f, 10220.47f, 2550, 156, TeamId.TEAM_BLUE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_T1_L_02_A", 1106.26f, 6485.25f, 2550, 170, TeamId.TEAM_BLUE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_T1_C_06_A", 802.81f, 4052.36f, 2550, 190, TeamId.TEAM_BLUE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_T2_L_03_A", 3911.0f, 13654.0f, 2550, 156, TeamId.TEAM_PURPLE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_T2_L_02_A", 7536.0f, 13190.0f, 2550, 170, TeamId.TEAM_PURPLE));
            AddObject(new Turret(game, game.GetNewNetID(), "@Turret_T2_L_01_A", 10261.0f, 13465.0f, 2550, 190, TeamId.TEAM_PURPLE));

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

            //TODO
            var COLLISION_RADIUS = 0;
            var SIGHT_RANGE      = 1700;

            AddObject(new Inhibitor(game, 0xffd23c3e, "OrderInhibitor", TeamId.TEAM_BLUE, COLLISION_RADIUS, 835, 3400, SIGHT_RANGE));      //top
            AddObject(new Inhibitor(game, 0xff4a20f1, "OrderInhibitor", TeamId.TEAM_BLUE, COLLISION_RADIUS, 2785, 3000, SIGHT_RANGE));     //mid
            AddObject(new Inhibitor(game, 0xff9303e1, "OrderInhibitor", TeamId.TEAM_BLUE, COLLISION_RADIUS, 3044, 1070, SIGHT_RANGE));     //bot
            AddObject(new Inhibitor(game, 0xff6793d0, "ChaosInhibitor", TeamId.TEAM_PURPLE, COLLISION_RADIUS, 10960, 13450, SIGHT_RANGE)); //top
            AddObject(new Inhibitor(game, 0xffff8f1f, "ChaosInhibitor", TeamId.TEAM_PURPLE, COLLISION_RADIUS, 11240, 11490, SIGHT_RANGE)); //mid
            AddObject(new Inhibitor(game, 0xff26ac0f, "ChaosInhibitor", TeamId.TEAM_PURPLE, COLLISION_RADIUS, 13200, 11200, SIGHT_RANGE)); //bot

            AddObject(new Nexus(game, 0xfff97db5, "OrderNexus", TeamId.TEAM_BLUE, COLLISION_RADIUS, 1170, 1470, SIGHT_RANGE));
            AddObject(new Nexus(game, 0xfff02c0f, "ChaosNexus", TeamId.TEAM_PURPLE, COLLISION_RADIUS, 12800, 13100, SIGHT_RANGE));

            // 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 Announce(game, 30 * 1000, Announces.WelcomeToSR, true)); // Welcome to SR
            if (_firstSpawnTime - 30 * 1000 >= 0.0f)
            {
                _announcerEvents.Add(new Announce(game, _firstSpawnTime - 30 * 1000, Announces.ThirySecondsToMinionsSpawn, true)); // 30 seconds until minions spawn
            }
            _announcerEvents.Add(new Announce(game, _firstSpawnTime, Announces.MinionsHaveSpawned, false));                        // Minions have spawned (90 * 1000)
            _announcerEvents.Add(new Announce(game, _firstSpawnTime, Announces.MinionsHaveSpawned2, false));                       // Minions have spawned [2] (90 * 1000)
        }
Beispiel #9
0
        public void init()
        {
            itemTemplates = new Dictionary <int, ItemTemplate>();
            // TODO : this is highly inefficient
            var inibins = RAFManager.getInstance().SearchFileEntries("DATA/items/");

            /* for (var i = 1000; i < 4000; ++i)*/
            foreach (var ini in inibins)
            {
                //Inibin inibin;
                //if (!RAFManager.getInstance().readInibin("DATA/items/" + i + ".inibin", out inibin))
                if (!System.Text.RegularExpressions.Regex.IsMatch(ini.FileName, "items/\\d.*.inibin", System.Text.RegularExpressions.RegexOptions.IgnoreCase))
                {
                    continue;
                }
                var id = int.Parse(ini.ShortFileName.Replace(".inibin", ""));
                if ((id <= 1000 && id >= 4000) || itemTemplates.ContainsKey(id))
                {
                    continue;
                }

                var  inibin   = new Inibin(ini);
                var  maxStack = inibin.getIntValue("DATA", "MaxStack");
                var  price    = inibin.GetValue <int>("DATA", "Price");
                var  type     = inibin.GetValue <string>(3471506188);
                bool trinket  = false;
                if (type != null && type.ToLower() == "RelicBase".ToLower())
                {
                    trinket = true;
                }

                float sellBack = 0.7f;

                if (inibin.KeyExists("DATA", "SellBackModifier"))
                {
                    sellBack = inibin.getFloatValue("DATA", "SellBackModifier");
                }

                var statMods = new List <StatMod>();

                statMods.Add(new StatMod {
                    blockId = MasterMask.MM_Two, mask = FieldMask.FM2_Bonus_Ad_Flat, value = inibin.getFloatValue("DATA", "FlatPhysicalDamageMod")
                });
                statMods.Add(new StatMod {
                    blockId = MasterMask.MM_Two, mask = FieldMask.FM2_Bonus_Ad_Pct, value = inibin.getFloatValue("DATA", "PercentPhysicalDamageMod")
                });
                statMods.Add(new StatMod {
                    blockId = MasterMask.MM_Two, mask = FieldMask.FM2_Bonus_Ap_Flat, value = inibin.getFloatValue("DATA", "FlatMagicDamageMod")
                });
                statMods.Add(new StatMod {
                    blockId = MasterMask.MM_Two, mask = FieldMask.FM2_Hp5, value = inibin.getFloatValue("DATA", "FlatHPRegenMod")
                });
                statMods.Add(new StatMod {
                    blockId = MasterMask.MM_Two, mask = FieldMask.FM2_Crit_Chance, value = inibin.getFloatValue("DATA", "FlatCritChanceMod")
                });
                statMods.Add(new StatMod {
                    blockId = MasterMask.MM_Two, mask = FieldMask.FM2_Armor, value = inibin.getFloatValue("DATA", "FlatArmorMod")
                });
                statMods.Add(new StatMod {
                    blockId = MasterMask.MM_Two, mask = FieldMask.FM2_Magic_Armor, value = inibin.getFloatValue("DATA", "FlatSpellBlockMod")
                });
                statMods.Add(new StatMod {
                    blockId = MasterMask.MM_Two, mask = FieldMask.FM2_Atks_multiplier, value = inibin.getFloatValue("DATA", "PercentAttackSpeedMod")
                });
                statMods.Add(new StatMod {
                    blockId = MasterMask.MM_Two, mask = FieldMask.FM2_LifeSteal, value = inibin.getFloatValue("DATA", "PercentLifeStealMod")
                });

                statMods.Add(new StatMod {
                    blockId = MasterMask.MM_Four, mask = FieldMask.FM4_MaxHp, value = inibin.getFloatValue("DATA", "FlatHPPoolMod")
                });
                statMods.Add(new StatMod {
                    blockId = MasterMask.MM_Four, mask = FieldMask.FM4_MaxMp, value = inibin.getFloatValue("DATA", "FlatMPPoolMod")
                });
                statMods.Add(new StatMod {
                    blockId = MasterMask.MM_Four, mask = FieldMask.FM4_Speed, value = inibin.getFloatValue("DATA", "FlatMovementSpeedMod")
                });

                var recipes = new List <int>();

                var c = 1;
                while (inibin.KeyExists("DATA", "RecipeItem" + c))
                {
                    var componentId = inibin.getIntValue("DATA", "RecipeItem" + c);
                    if (componentId > 0)
                    { // sometimes there are "0" entries
                        recipes.Add(componentId);
                    }
                    ++c;
                }

                itemTemplates.Add(id, new ItemTemplate(id, maxStack, price, sellBack, trinket, statMods, recipes));
            }


            Logger.LogCoreInfo("Loaded " + itemTemplates.Count + " items");
        }
Beispiel #10
0
        public void addProjectileTarget(string nameMissile, Target target)
        {
            Projectile p = new Projectile(owner.GetGame(), owner.GetGame().GetNewNetID(), owner.getX(), owner.getY(), (int)lineWidth, owner, target, this, projectileSpeed, (int)RAFManager.getInstance().getHash(nameMissile), projectileFlags != 0 ? projectileFlags : flags);

            owner.GetGame().GetMap().AddObject(p);
            owner.GetGame().PacketNotifier.notifyProjectileSpawn(p);
        }
Beispiel #11
0
        public Monster(Game game, uint id, float x, float y, float facingX, float facingY, string model, string name) : base(game, id, model, new Stats(), 40, x, y)
        {
            setTeam(TeamId.TEAM_NEUTRAL);

            var teams = Enum.GetValues(typeof(TeamId)).Cast <TeamId>();

            foreach (var team in teams)
            {
                setVisibleByTeam(team, true);
            }

            setMoveOrder(MoveOrder.MOVE_ORDER_MOVE);
            facing    = new Vector2(facingX, facingY);
            this.name = name;

            Inibin inibin;

            if (!RAFManager.getInstance().readInibin("DATA/Characters/" + model + "/" + model + ".inibin", out inibin))
            {
                Logger.LogCoreError("couldn't find monster stats for " + model);
                return;
            }

            stats.HealthPoints.BaseValue       = inibin.getFloatValue("Data", "BaseHP");
            stats.CurrentHealth                = stats.HealthPoints.Total;
            stats.ManaPoints.BaseValue         = inibin.getFloatValue("Data", "BaseMP");
            stats.CurrentMana                  = stats.ManaPoints.Total;
            stats.AttackDamage.BaseValue       = inibin.getFloatValue("DATA", "BaseDamage");
            stats.Range.BaseValue              = inibin.getFloatValue("DATA", "AttackRange");
            stats.MoveSpeed.BaseValue          = inibin.getFloatValue("DATA", "MoveSpeed");
            stats.Armor.BaseValue              = inibin.getFloatValue("DATA", "Armor");
            stats.MagicResist.BaseValue        = inibin.getFloatValue("DATA", "SpellBlock");
            stats.HealthRegeneration.BaseValue = inibin.getFloatValue("DATA", "BaseStaticHPRegen");
            stats.ManaRegeneration.BaseValue   = inibin.getFloatValue("DATA", "BaseStaticMPRegen");
            stats.AttackSpeedFlat              = 0.625f / (1 + inibin.getFloatValue("DATA", "AttackDelayOffsetPercent"));

            stats.HealthPerLevel             = inibin.getFloatValue("DATA", "HPPerLevel");
            stats.ManaPerLevel               = inibin.getFloatValue("DATA", "MPPerLevel");
            stats.AdPerLevel                 = inibin.getFloatValue("DATA", "DamagePerLevel");
            stats.ArmorPerLevel              = inibin.getFloatValue("DATA", "ArmorPerLevel");
            stats.MagicResistPerLevel        = inibin.getFloatValue("DATA", "SpellBlockPerLevel");
            stats.HealthRegenerationPerLevel = inibin.getFloatValue("DATA", "HPRegenPerLevel");
            stats.ManaRegenerationPerLevel   = inibin.getFloatValue("DATA", "MPRegenPerLevel");
            stats.GrowthAttackSpeed          = inibin.getFloatValue("DATA", "AttackSpeedPerLevel");

            setMelee(inibin.getBoolValue("DATA", "IsMelee"));
            setCollisionRadius(inibin.getIntValue("DATA", "PathfindingCollisionRadius"));

            Inibin autoAttack;

            if (!RAFManager.getInstance().readInibin("DATA/Characters/" + model + "/Spells/" + model + "BasicAttack.inibin", out autoAttack))
            {
                if (!RAFManager.getInstance().readInibin("DATA/Spells/" + model + "BasicAttack.inibin", out autoAttack))
                {
                    Logger.LogCoreError("Couldn't find monster auto-attack data for " + model);
                    return;
                }
            }

            autoAttackDelay           = autoAttack.getFloatValue("SpellData", "castFrame") / 30.0f;
            autoAttackProjectileSpeed = autoAttack.getFloatValue("SpellData", "MissileSpeed");
        }
Beispiel #12
0
 public void Init(RAFManager.RAFManagerClass rafManager)
 {
 }
Beispiel #13
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);
        }
Beispiel #14
0
        public Champion(Game game, string type, uint id, uint playerId) : base(game, id, type, new Stats(), 30, 0, 0, 1200)
        {
            this.type     = type;
            this.playerId = playerId;

            Inventory = InventoryManager.CreateInventory(game, this);
            Shop      = Shop.CreateShop(this);

            stats.Gold = 475.0f;
            stats.GoldPerSecond.BaseValue = game.GetMap().GetGoldPerSecond();
            stats.SetGeneratingGold(false);

            Inibin inibin;

            if (!RAFManager.getInstance().readInibin("DATA/Characters/" + type + "/" + type + ".inibin", out inibin))
            {
                Logger.LogCoreError("couldn't find champion stats for " + type);
                return;
            }

            stats.HealthPoints.BaseValue          = inibin.getFloatValue("Data", "BaseHP");
            stats.CurrentHealth                   = stats.HealthPoints.Total;
            stats.ManaPoints.BaseValue            = inibin.getFloatValue("Data", "BaseMP");
            stats.CurrentMana                     = stats.ManaPoints.Total;
            stats.AttackDamage.BaseValue          = inibin.getFloatValue("DATA", "BaseDamage");
            stats.Range.BaseValue                 = inibin.getFloatValue("DATA", "AttackRange");
            stats.MoveSpeed.BaseValue             = inibin.getFloatValue("DATA", "MoveSpeed");
            stats.Armor.BaseValue                 = inibin.getFloatValue("DATA", "Armor");
            stats.MagicResist.BaseValue           = inibin.getFloatValue("DATA", "SpellBlock");
            stats.HealthRegeneration.BaseValue    = inibin.getFloatValue("DATA", "BaseStaticHPRegen");
            stats.ManaRegeneration.BaseValue      = inibin.getFloatValue("DATA", "BaseStaticMPRegen");
            stats.AttackSpeedFlat                 = 0.625f / (1 + inibin.getFloatValue("DATA", "AttackDelayOffsetPercent"));
            stats.AttackSpeedMultiplier.BaseValue = 1.0f;

            stats.HealthPerLevel             = inibin.getFloatValue("DATA", "HPPerLevel");
            stats.ManaPerLevel               = inibin.getFloatValue("DATA", "MPPerLevel");
            stats.AdPerLevel                 = inibin.getFloatValue("DATA", "DamagePerLevel");
            stats.ArmorPerLevel              = inibin.getFloatValue("DATA", "ArmorPerLevel");
            stats.MagicResistPerLevel        = inibin.getFloatValue("DATA", "SpellBlockPerLevel");
            stats.HealthRegenerationPerLevel = inibin.getFloatValue("DATA", "HPRegenPerLevel");
            stats.ManaRegenerationPerLevel   = inibin.getFloatValue("DATA", "MPRegenPerLevel");
            stats.GrowthAttackSpeed          = inibin.getFloatValue("DATA", "AttackSpeedPerLevel");

            spells.Add(new Spell(this, inibin.getStringValue("Data", "Spell1"), 0));
            spells.Add(new Spell(this, inibin.getStringValue("Data", "Spell2"), 1));
            spells.Add(new Spell(this, inibin.getStringValue("Data", "Spell3"), 2));
            spells.Add(new Spell(this, inibin.getStringValue("Data", "Spell4"), 3));
            spells.Add(new Spell(this, "SummonerHeal", 4));
            spells.Add(new Spell(this, "SummonerFlash", 5));
            spells.Add(new Spell(this, "Recall", 13));

            setMelee(inibin.getBoolValue("DATA", "IsMelee"));
            setCollisionRadius(inibin.getIntValue("DATA", "PathfindingCollisionRadius"));

            Inibin autoAttack;

            if (!RAFManager.getInstance().readInibin("DATA/Characters/" + type + "/Spells/" + type + "BasicAttack.inibin", out autoAttack))
            {
                if (!RAFManager.getInstance().readInibin("DATA/Spells/" + type + "BasicAttack.inibin", out autoAttack))
                {
                    Logger.LogCoreError("Couldn't find champion auto-attack data for " + type);
                    return;
                }
            }

            autoAttackDelay           = autoAttack.getFloatValue("SpellData", "castFrame") / 30.0f;
            autoAttackProjectileSpeed = autoAttack.getFloatValue("SpellData", "MissileSpeed");

            LoadLua();
        }