Beispiel #1
0
        public override void Execute(GameCommandTrigger trigger)
        {
            int id = trigger.Get <int>("id");

            if (SkillMetadataStorage.GetSkill(id) == null)
            {
                trigger.Session.SendNotice($"No skill found with id: {id}");
                return;
            }

            short level = trigger.Get <short>("level") <= 10 && trigger.Get <short>("level") != 0 ? trigger.Get <short>("level") : (short)1;
            // The Status packet needs this in miliseconds, we are converting them here for the user to just input the actual seconds.
            int duration = trigger.Get <int>("duration") <= 3600 && trigger.Get <int>("duration") != 0 ? trigger.Get <int>("duration") * 1000 : 10000;
            int stacks   = trigger.Get <int>("stacks") == 0 ? 1 : trigger.Get <int>("stacks");

            SkillCast skillCast = new SkillCast(id, level);

            if (skillCast.IsBuffToOwner() || skillCast.IsBuffToEntity() || skillCast.IsBuffShield() || skillCast.IsGM() || skillCast.IsGlobal() || skillCast.IsHealFromBuff())
            {
                Status status = new Status(skillCast, trigger.Session.FieldPlayer.ObjectId, trigger.Session.FieldPlayer.ObjectId, stacks);
                StatusHandler.Handle(trigger.Session, status);
                return;
            }

            trigger.Session.SendNotice($"Skill with id: {id} is not a buff to the owner.");
        }
        public override void Handle(GameSession session, PacketReader packet)
        {
            byte function = packet.ReadByte();

            if (function == 0)
            {
                // This count seems to increase for each skill used
                int counter = packet.ReadInt();
                // objectId for climb, 13641 (0x3549 for swim dash)
                int objectId   = packet.ReadInt();
                int clientTime = packet.ReadInt();
                int skillId    = packet.ReadInt();
                packet.ReadShort();                                // 1
                session.Player.Animation = (byte)packet.ReadInt(); // Animation
                int clientTick = packet.ReadInt();
                packet.ReadLong();                                 // 0

                if (SkillMetadataStorage.GetSkill(skillId).State == "gosGlide")
                {
                    session.Player.OnAirMount = true;
                }

                // TODO: Broadcast this to all field players
            }
        }
Beispiel #3
0
        public override void Execute(GameCommandTrigger trigger)
        {
            int   id    = trigger.Get <int>("id");
            short level = trigger.Get <short>("level") > 0 ? trigger.Get <short>("level") : (short)1;

            if (SkillMetadataStorage.GetSkill(id) == null)
            {
                trigger.Session.SendNotice($"Skill with id: {id} is not defined.");
                return;
            }

            SkillCast             skillCast = new SkillCast(id, level, GuidGenerator.Long(), trigger.Session.ServerTick, trigger.Session.FieldPlayer.ObjectId, trigger.Session.ClientTick);
            CoordF                empty     = CoordF.From(0, 0, 0);
            IFieldObject <Player> player    = trigger.Session.FieldPlayer;

            trigger.Session.FieldManager.BroadcastPacket(SkillUsePacket.SkillUse(skillCast, player.Coord, empty, empty));
        }
Beispiel #4
0
    public override void Execute(GameCommandTrigger trigger)
    {
        GameSession           gameSession = trigger.Session;
        IFieldObject <Player> player      = gameSession.Player.FieldPlayer;

        int   id    = trigger.Get <int>("id");
        short level = trigger.Get <short>("level") > 0 ? trigger.Get <short>("level") : (short)1;

        if (SkillMetadataStorage.GetSkill(id) is null)
        {
            gameSession.SendNotice($"Skill with id: {id} is not defined.");
            return;
        }

        SkillCast skillCast = new(id, level, GuidGenerator.Long(), gameSession.ServerTick, player.ObjectId, gameSession.ClientTick)
        {
            Position  = player.Coord,
            Direction = default,
Beispiel #5
0
 public double GetDamageRate() => SkillMetadataStorage.GetSkill(SkillId).SkillLevels.Find(x => x.Level == SkillLevel).DamageRate;
 private SkillMetadata GetSkillMetadata() => SkillMetadataStorage.GetSkill(SkillId);
Beispiel #7
0
 public bool IsSpRecovery() => SkillMetadataStorage.GetSkill(SkillId).IsSpRecovery;
Beispiel #8
0
 public bool IsBuff() => SkillMetadataStorage.GetSkill(SkillId).IsBuff;
Beispiel #9
0
 public ElementId GetElement() => (ElementId)SkillMetadataStorage.GetSkill(SkillId).Element;
Beispiel #10
0
 public DamageTypeId GetSkillDamageType() => (DamageTypeId)SkillMetadataStorage.GetSkill(SkillId).DamageType;
Beispiel #11
0
 public int GetStaCost() => SkillMetadataStorage.GetSkill(SkillId).SkillLevels.Find(s => s.Level == SkillLevel).Stamina;
Beispiel #12
0
 public int GetSpCost() => SkillMetadataStorage.GetSkill(SkillId).SkillLevels.Find(s => s.Level == SkillLevel).Spirit;
Beispiel #13
0
 private SkillMetadata GetSkillMetadata()
 {
     return(SkillMetadataStorage.GetSkill(SkillId));
 }