示例#1
0
文件: MapService.cs 项目: tbs005/Temu
        public static Npc CreateNpc(SpawnTemplate spawnTemplate)
        {
            var npc = new Npc
            {
                NpcId         = spawnTemplate.NpcId,
                SpawnTemplate = spawnTemplate,
                NpcTemplate   = Data.Data.NpcTemplates[spawnTemplate.Type][spawnTemplate.NpcId],

                Position = new WorldPosition
                {
                    MapId = spawnTemplate.MapId,
                    X     = spawnTemplate.X,
                    Y     = spawnTemplate.Y,
                    Z     =
                        spawnTemplate.Z +
                        ((spawnTemplate.FullId == 6301151 ||
                          spawnTemplate.FullId == 6301152 ||
                          spawnTemplate.FullId == 6301153)
                             ? 0
                             : 25),
                    Heading = spawnTemplate.Heading,
                }
            };

            npc.BindPoint = npc.Position.Clone();

            npc.GameStats = CreatureLogic.InitGameStats(npc);
            CreatureLogic.UpdateCreatureStats(npc);

            AiLogic.InitAi(npc);

            return(npc);
        }
示例#2
0
        public static Npc CreateNpc(SpawnTemplate spawnTemplate)
        {
            NpcTemplate npcTemplate = (Data.Data.NpcTemplates.ContainsKey(spawnTemplate.NpcId))
                ? Data.Data.NpcTemplates[spawnTemplate.NpcId]
                : new NpcTemplate();

            var npc = new Npc
            {
                NpcId         = spawnTemplate.NpcId,
                SpawnTemplate = spawnTemplate,
                NpcTemplate   = npcTemplate,

                Position = new WorldPosition
                {
                    MapId = spawnTemplate.MapId,
                    X     = spawnTemplate.X,
                    Y     = spawnTemplate.Y,
                    Z     = spawnTemplate.Z,
                },
            };

            npc.BindPoint = npc.Position.Clone();

            npc.GameStats = CreatureLogic.InitGameStats(npc);
            CreatureLogic.UpdateCreatureStats(npc);

            AiLogic.InitAi(npc);

            return(npc);
        }
示例#3
0
        public void InitPlayer(Player player)
        {
            player.GameStats = CreatureLogic.InitGameStats(player);
            CreatureLogic.UpdateCreatureStats(player);

            AiLogic.InitAi(player);

            PlayersOnline.Add(player);
        }
        public void InitPlayer(Player player, bool isProlog)
        {
            player.PlayerLevel = 1;
            while ((player.PlayerLevel + 1) != Data.Data.PlayerExperience.Count - 1 && player.PlayerExp >= Data.Data.PlayerExperience[player.PlayerLevel])
            {
                player.PlayerLevel++;
            }

            if (player.Skills.Count == 0)
            {
                for (int i = 0; i < Data.Data.DefaultSkillSets[player.TemplateId].SkillSet.Count; i++)
                {
                    player.Skills.Add(Data.Data.DefaultSkillSets[player.TemplateId].SkillSet[i]);
                }
            }

            player.GameStats = CreatureLogic.InitGameStats(player);
            CreatureLogic.UpdateCreatureStats(player);
            AiLogic.InitAi(player);
            PlayersOnline.Add(player);
        }