Пример #1
0
        private PlayerState MakePlayer()
        {
            HeroTypeConfig herotypeconfig = new HeroTypeConfig(vitality: 20, strength: 20, dexterity: 20,
                                                               energy: 20, health: 50, mana: 40, stamina: 30, manaRegen: 20,
                                                               perlevelhealth: 3, perlevelmana: 1.5, perlevelstamina: 1,
                                                               pervitalityhealth: 2, pervitalitystamina: 1, perenergymana: 1.5,
                                                               perLevelStatPoints: 5,
                                                               baseatkrating: -30, basedefrating: -30, perdexterityatkrating: 5, perdexteritydefrating: 4,
                                                               walkVelocity: 6, runVelocity: 9, runDrain: 20, walkFrames: 8, runFrames: 8, swingFrames: 8,
                                                               spellFrames: 8, getHitFrames: 8, bowFrames: 8, startingSkill: "",
                                                               startingSkills: new string[] { },
                                                               allSkillsBonusString: "", firstTabBonusString: "", secondTabBonusString: "",
                                                               thirdTabBonusString: "", classOnlyBonusString: "", baseWeaponClass: "hth",
                                                               initialEquipment: new List <InitialEquipment>());
            LevelExperienceConfig expconfig = new LevelExperienceConfig(new List <long>()
            {
                0,    // level 0
                0,    // level 1
                500,  // level 2
                1500, // level 3
                2250,
                4125,
            });
            PlayerState ps = new PlayerState(0, "player1", id: 1, level: 1, x: 0, y: 0,
                                             vitality: herotypeconfig.StartingVitality,
                                             strength: herotypeconfig.StartingStrength,
                                             energy: herotypeconfig.StartingEnergy,
                                             dexterity: herotypeconfig.StartingDexterity,
                                             experience: 0,
                                             herotype: Enums.eHero.Amazon,
                                             heroconfig: herotypeconfig,
                                             expconfig: expconfig);

            return(ps);
        }
Пример #2
0
        public int SpawnNewPlayer(int clientHash, string playerName, eHero heroType)
        {
            ILevelExperienceConfig expConfig  = null;
            IHeroTypeConfig        heroConfig = null;

            if (engineDataManager.ExperienceConfigs.ContainsKey(heroType))
            {
                expConfig = engineDataManager.ExperienceConfigs[heroType];
            }
            else
            {
                log.Error("Error: Experience Config not loaded for '" + heroType.ToString() + "'.");
                expConfig = new LevelExperienceConfig(new List <long>()
                {
                    100
                });
                // TODO: should we have a more robust default experience config?
                // or should we just fail in some way here?
            }
            if (engineDataManager.HeroTypeConfigs.ContainsKey(heroType))
            {
                heroConfig = engineDataManager.HeroTypeConfigs[heroType];
            }
            else
            {
                log.Error("Error: Hero Config not loaded for '" + heroType.ToString() + "'.");
                // Do we even need a default?
                //heroConfig = new HeroTypeConfig(10, 10, 10, 10, 10, 10, 10, 10, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 6, 9,
                //    1, 10, 10, 10, 10, 10, 10, 0, "hth");
                // TODO: should we have a more robust default hero config?
                // or should we just fail in some way here?
                // ... we should probably just fail here
            }

            var newPlayer = new PlayerState(clientHash, playerName, mobManager.GetNextAvailableMobId(), 1, 20.5f, 20.5f, 10, 10, 10, 10, 0, heroType,
                                            heroConfig, expConfig);

            // This is probably not the right place to do this.
            // Only add items with a location set, the other ones go into the inventory - that we do not support yet
            foreach (var item in heroConfig.InitialEquipment)
            {
                if (item.location.Length > 0)
                {
                    newPlayer.UpdateEquipment(item.location, itemManager.getItemInstance(item.name));
                }
            }

            // TODO: Default torso for testing. Remove when... we're done testing.
            newPlayer.UpdateEquipment("tors", itemManager.getItemInstance("aar"));

            mobManager.AddPlayer(newPlayer);
            return(newPlayer.Id);
        }