Exemple #1
0
    private static void HandleRegionSkills(GameSession session, PacketReader packet)
    {
        long   skillSn     = packet.ReadLong();
        byte   mode        = packet.ReadByte();
        int    unknown     = packet.ReadInt();
        int    attackIndex = packet.ReadInt();
        CoordF position    = packet.Read <CoordF>();
        CoordF rotation    = packet.Read <CoordF>();
        // What are these values used? Check client vs server?

        // TODO: Verify rest of skills to proc correctly.
        // TODO: Send status correctly when Region attacks are proc.

        SkillCast parentSkill = session.Player.FieldPlayer.SkillCast;

        if (parentSkill is null || parentSkill.SkillSn != skillSn)
        {
            return;
        }

        SkillAttack skillAttack = parentSkill.GetSkillMotions().FirstOrDefault()?.SkillAttacks.FirstOrDefault();

        if (skillAttack is null)
        {
            return;
        }

        if (skillAttack.CubeMagicPathId == 0 && skillAttack.MagicPathId == 0)
        {
            return;
        }

        SkillCondition skillCondition = skillAttack.SkillConditions.FirstOrDefault(x => x.IsSplash);

        if (skillCondition is null)
        {
            return;
        }

        SkillCast skillCast = new(skillCondition.SkillId, skillCondition.SkillLevel, GuidGenerator.Long(), session.ServerTick, parentSkill)
        {
            CasterObjectId = session.Player.FieldPlayer.ObjectId,
            SkillAttack    = skillAttack,
            Duration       = skillCondition.FireCount * 1000,
            Interval       = skillCondition.Interval
        };

        RegionSkillHandler.HandleEffect(session, skillCast, attackIndex);
    }

    #endregion
}
Exemple #2
0
    public void SetSkill(int[] triggerIds, bool arg2)
    {
        if (arg2 is false) // Not sure what this means
        {
            return;
        }

        foreach (int triggerId in triggerIds)
        {
            IFieldObject <TriggerSkill> triggerSkill = Field.State.GetTriggerSkill(triggerId);
            if (triggerSkill != null)
            {
                // this is 100% not perfect.
                SkillCast skillCast = new(triggerSkill.Value.SkillId, triggerSkill.Value.SkillLevel, GuidGenerator.Long(), Environment.TickCount)
                {
                    SkillObjectId  = triggerSkill.ObjectId,
                    CasterObjectId = triggerSkill.ObjectId,
                    Position       = triggerSkill.Coord
                };
                RegionSkillHandler.HandleEffect(Field, skillCast, 0);
            }
        }
    }