Пример #1
0
        public SkillComponent(IEntity entity)
        {
            Entity = entity;

            if (!(entity is IPlayerEntity player))
            {
                return;
            }

            int tmp = 200 + 20 * (byte)player.Character.Class;

            this.AddSkill(SkillService.GetById(tmp));
            this.AddSkill(SkillService.GetById(tmp + 1));

            if (player.Character.Class != CharacterClassType.Adventurer)
            {
                return;
            }

            this.AddSkill(SkillService.GetById(tmp + 9));

            IEnumerable <SkillDto> skills = SkillService.GetByClassIdAsync((byte)player.Character.Class).ConfigureAwait(false).GetAwaiter().GetResult();

            foreach (SkillDto skillDto in skills.Where(s => s.LevelMinimum < player.JobLevel && s.Id >= 200 && s.Id != 209 && s.Id <= 210))
            {
                this.AddSkill(skillDto);
            }
        }
Пример #2
0
        public static async Task LearnAdventurerSkillsAsync(this IPlayerEntity player)
        {
            if (player.Character.Class != CharacterClassType.Adventurer)
            {
                return;
            }

            IEnumerable <SkillDto> skills = await SkillService.GetByClassIdAsync((byte)player.Character.Class);

            foreach (SkillDto skillDto in skills.Where(s => s.LevelMinimum < player.JobLevel && s.Id >= 200 && s.Id != 209 && s.Id <= 210))
            {
                player.AddSkill(skillDto);
            }

            await player.ActualizeUiSkillList();
        }
        protected override async Task Handle(SpTransformEvent e, CancellationToken cancellation)
        {
            if (!(e.Sender is IPlayerEntity player))
            {
                return;
            }

            if (!player.HasSpWeared)
            {
                Log.Info("[SP_TRANSFORM] You need to wear a SpecialistCard");
                return;
            }

            if (player.IsTransformedLocomotion)
            {
                Log.Info("[SP_TRANSFORM] Remove your locomotion");
                return;
            }

            if (player.IsTransformedSp)
            {
                player.LastMorphUtc = DateTime.UtcNow;
                await player.EmitEventAsync(new SpRemoveEvent());

                return;
            }

            TimeSpan timeSpanSinceLastMorph = DateTime.UtcNow - player.LastMorphUtc;

            if (timeSpanSinceLastMorph <= TimeSpan.FromSeconds(player.SpCoolDown))
            {
                Log.Info($"[SP_TRANSFORM] Cooldown SP needs to be clean {player.SpCoolDown}");
                return;
            }

            if (player.SkillComponent.CooldownsBySkillId.Any())
            {
                Log.Info("[SP_TRANSFORM] Cooldown needs to be clean");
                // should have no cooldowns
                return;
            }

            if (e.Wait)
            {
                await player.GenerateDelay(5000, DelayPacketType.Locomotion, $"#sl^0");

                return;
            }

            ItemInstanceDto fairy = player.Inventory.GetWeared(EquipmentType.Fairy);

            if (player.Sp.ElementType != ElementType.Neutral && fairy.ElementType != player.Sp.ElementType)
            {
                return;
            }

            player.SetMorph(player.Sp.Item.Morph);
            await player.SendPacketAsync(player.GenerateLevPacket());

            await player.BroadcastAsync(player.GenerateCModePacket());

            await player.BroadcastAsync(player.GenerateEffectPacket(196));

            await player.SendGuri(GuriPacketType.Unknow2, 1, (int)player.Id);

            await player.ActualiseUiSpPoints();

            // remove buffs
            // transform
            await player.SendPacketAsync(player.GenerateLevPacket());

            await player.SendPacketAsync(player.GenerateCondPacket());

            await player.SendPacketAsync(player.GenerateStatPacket());

            await player.ActualizeUiStatChar();

            // LoadSpSkills()
            SkillDto[] skills = await _skillService.GetByClassIdAsync(player.GetSpClassId());

            player.AddSkills(skills);

            await player.ActualizeUiSkillList();

            await player.ActualizeUiQuicklist();

            // WingsBuff
            // LoadPassive
        }