public override async Task Handle(RecvPacketOperations operation, IPacket packet, FieldUser user) { var templateID = packet.Decode <int>(); var template = user.Service.TemplateManager.Get <SkillTemplate>(templateID); var skillLevel = user.Character.GetSkillLevel(templateID); if (template == null) { return; } if (skillLevel <= 0) { return; } if (!SkillConstants.IsKeydownSkill(templateID)) { return; } using var p = new Packet(SendPacketOperations.UserSkillPrepare); p.Encode <int>(user.ID); p.Encode <int>(templateID); p.Encode <byte>(packet.Decode <byte>()); p.Encode <short>(packet.Decode <short>()); p.Encode <byte>(packet.Decode <byte>()); await user.Field.BroadcastPacket(user, p); }
public override async Task Handle(RecvPacketOperations operation, IPacket packet, FieldUser user) { var templateID = packet.Decode <int>(); var template = user.Service.TemplateManager.Get <SkillTemplate>(templateID); if (template == null) { return; } if (SkillConstants.IsKeydownSkill(templateID)) { using var p = new Packet(SendPacketOperations.UserSkillCancel); p.Encode <int>(user.ID); p.Encode <int>(templateID); await user.Field.BroadcastPacket(user, p); } else { await user.ModifyTemporaryStats(ts => ts.Reset(templateID)); } }
private void Decode(IPacket packet) { packet.Decode <byte>(); // fieldKey packet.Decode <int>(); // pDrInfo packet.Decode <int>(); // pDrInfo var v6 = packet.Decode <byte>(); DamagePerMob = v6 & 0xF; MobCount = v6 >> 4; packet.Decode <int>(); // pDrInfo packet.Decode <int>(); // pDrInfo SkillID = packet.Decode <int>(); packet.Decode <byte>(); // combatOrders if (_type == AttackType.Magic) { packet.Decode <int>(); packet.Decode <int>(); packet.Decode <int>(); packet.Decode <int>(); packet.Decode <int>(); packet.Decode <int>(); } packet.Decode <int>(); // rand packet.Decode <int>(); // crc? packet.Decode <int>(); packet.Decode <int>(); if (SkillConstants.IsKeydownSkill(SkillID)) { KeyDown = packet.Decode <int>(); } Option = packet.Decode <byte>(); if (_type == AttackType.Shoot) { packet.Decode <byte>(); // m_bNextShootExJablin } var v17 = packet.Decode <short>(); Left = Convert.ToBoolean((v17 >> 15) & 1); Action = v17 & 0x7FFF; packet.Decode <int>(); AttackActionType = packet.Decode <byte>(); AttackSpeed = packet.Decode <byte>(); AttackTime = packet.Decode <int>(); packet.Decode <int>(); // phase if (_type == AttackType.Shoot) { packet.Decode <short>(); packet.Decode <short>(); packet.Decode <byte>(); // if ( v459 && !is_shoot_skill_not_consuming_bullet(nSkillID) ) // packet.Decode<int>(); } DamageInfo = new DamageInfo[MobCount]; for (var i = 0; i < MobCount; i++) { var info = new DamageInfo(_type, _user); info.Decode(packet, DamagePerMob); DamageInfo[i] = info; } }