Ejemplo n.º 1
0
        internal cMultiPartBody(IList <cBodyPart> pParts, string pSubType, cSection pSection, cMultiPartExtensionData pExtensionData) : base(kMimeType.Multipart, pSubType, pSection)
        {
            Parts = new cBodyParts(pParts);

            if (SubType.Equals("MIXED", StringComparison.InvariantCultureIgnoreCase))
            {
                SubTypeCode = eMultiPartBodySubTypeCode.mixed;
            }
            else if (SubType.Equals("DIGEST", StringComparison.InvariantCultureIgnoreCase))
            {
                SubTypeCode = eMultiPartBodySubTypeCode.digest;
            }
            else if (SubType.Equals("ALTERNATIVE", StringComparison.InvariantCultureIgnoreCase))
            {
                SubTypeCode = eMultiPartBodySubTypeCode.alternative;
            }
            else if (SubType.Equals("RELATED", StringComparison.InvariantCultureIgnoreCase))
            {
                SubTypeCode = eMultiPartBodySubTypeCode.related;
            }
            else
            {
                SubTypeCode = eMultiPartBodySubTypeCode.other;
            }

            ExtensionData = pExtensionData;
        }
Ejemplo n.º 2
0
        public bool Matches(MediaType t)
        {
            if (t == null)
            {
                return(false);
            }

            return((IsTopLevelWildcard || t.IsTopLevelWildcard || TopLevelType.Equals(t.TopLevelType, StringComparison.OrdinalIgnoreCase)) &&
                   (IsSubTypeWildcard || t.IsSubTypeWildcard || SubType.Equals(t.SubType, StringComparison.OrdinalIgnoreCase)));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets a value indicating whether this <see cref="MediaTypeHeaderValue"/> is a subset of
        /// <paramref name="otherMediaType"/>. A "subset" is defined as the same or a more specific media type
        /// according to the precedence described in https://www.ietf.org/rfc/rfc2068.txt section 14.1, Accept.
        /// </summary>
        /// <param name="otherMediaType">The <see cref="MediaTypeHeaderValue"/> to compare.</param>
        /// <returns>
        /// A value indicating whether this <see cref="MediaTypeHeaderValue"/> is a subset of
        /// <paramref name="otherMediaType"/>.
        /// </returns>
        /// <remarks>
        /// For example "multipart/mixed; boundary=1234" is a subset of "multipart/mixed; boundary=1234",
        /// "multipart/mixed", "multipart/*", and "*/*" but not "multipart/mixed; boundary=2345" or
        /// "multipart/message; boundary=1234".
        /// </remarks>
        public bool IsSubsetOf(MediaTypeHeaderValue otherMediaType)
        {
            if (otherMediaType == null)
            {
                return(false);
            }

            // "text/plain" is a subset of "text/plain", "text/*" and "*/*". "*/*" is a subset only of "*/*".
            if (!Type.Equals(otherMediaType.Type, StringComparison.OrdinalIgnoreCase))
            {
                if (!otherMediaType.MatchesAllTypes)
                {
                    return(false);
                }
            }
            else if (!SubType.Equals(otherMediaType.SubType, StringComparison.OrdinalIgnoreCase))
            {
                if (!otherMediaType.MatchesAllSubTypes)
                {
                    return(false);
                }
            }

            // "text/plain; charset=utf-8; level=1" is a subset of "text/plain; charset=utf-8". In turn
            // "text/plain; charset=utf-8" is a subset of "text/plain".
            if (otherMediaType._parameters != null && otherMediaType._parameters.Count != 0)
            {
                // Make sure all parameters in the potential superset are included locally. Fine to have additional
                // parameters locally; they make this one more specific.
                foreach (var parameter in otherMediaType._parameters)
                {
                    if (string.Equals(parameter.Name, "q", StringComparison.OrdinalIgnoreCase))
                    {
                        // "q" and later parameters are not involved in media type matching. Quoting the RFC: The first
                        // "q" parameter (if any) separates the media-range parameter(s) from the accept-params.
                        break;
                    }

                    var localParameter = NameValueHeaderValue.Find(_parameters, parameter.Name);
                    if (localParameter == null)
                    {
                        // Not found.
                        return(false);
                    }

                    if (!string.Equals(parameter.Value, localParameter.Value, StringComparison.OrdinalIgnoreCase))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Ejemplo n.º 4
0
        public bool IsSubsetOf(MediaTypeHeaderValue otherMediaType)
        {
            if (otherMediaType == null)
            {
                return(false);
            }

            if (!Type.Equals(otherMediaType.Type, StringComparison.OrdinalIgnoreCase))
            {
                if (!otherMediaType.MatchesAllTypes)
                {
                    return(false);
                }
            }
            else if (!SubType.Equals(otherMediaType.SubType, StringComparison.OrdinalIgnoreCase))
            {
                if (!otherMediaType.MatchesAllSubTypes)
                {
                    return(false);
                }
            }

            if (Parameters != null)
            {
                if (Parameters.Count != 0 && (otherMediaType.Parameters == null || otherMediaType.Parameters.Count == 0))
                {
                    return(false);
                }

                // Make sure all parameters listed locally are listed in the other one. The other one may have additional parameters.
                foreach (var param in _parameters)
                {
                    var otherParam = NameValueHeaderValue.Find(otherMediaType._parameters, param.Name);
                    if (otherParam == null)
                    {
                        return(false);
                    }
                    if (!string.Equals(param.Value, otherParam.Value, StringComparison.OrdinalIgnoreCase))
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Ejemplo n.º 5
0
        internal cTextBodyPart(string pSubType, cSection pSection, cBodyStructureParameters pParameters, string pContentId, cCulturedString pDescription, string pContentTransferEncoding, uint pSizeInBytes, uint pSizeInLines, cSinglePartExtensionData pExtensionData) : base(kMimeType.Text, pSubType, pSection, pParameters, pContentId, pDescription, pContentTransferEncoding, pSizeInBytes, pExtensionData)
        {
            if (SubType.Equals("PLAIN", StringComparison.InvariantCultureIgnoreCase))
            {
                SubTypeCode = eTextBodyPartSubTypeCode.plain;
            }
            else if (SubType.Equals("HTML", StringComparison.InvariantCultureIgnoreCase))
            {
                SubTypeCode = eTextBodyPartSubTypeCode.html;
            }
            else
            {
                SubTypeCode = eTextBodyPartSubTypeCode.other;
            }

            SizeInLines = pSizeInLines;
        }
Ejemplo n.º 6
0
        public void ApplyBCards(object session, object sender = null)
        {
            Type type = session.GetType();

            // int counterBuff = 0;
            if (type == null)
            {
                return;
            }
            switch ((BCardType.CardType)Type)
            {
            case BCardType.CardType.Buff:
            {
                if (type == typeof(Character) && session is Character character)
                {
                    Buff buff = null;
                    if (sender != null)
                    {
                        Type sType = sender.GetType();
                        if (sType != null)
                        {
                            if (sType == typeof(Character) && sender is Character sendingCharacter)
                            {
                                buff = new Buff((short)SecondData, sendingCharacter.Level);

                                //Todo: Get anti stats from BCard
                            }
                        }
                    }
                    else
                    {
                        buff = new Buff((short)SecondData, character.Level);
                    }
                    if (ServerManager.RandomNumber() < FirstData)
                    {
                        character.AddBuff(buff);
                    }
                }
                else if (type == typeof(MapMonster))
                {
                    if (ServerManager.RandomNumber() < FirstData && session is MapMonster mapMonster)
                    {
                        mapMonster.AddBuff(new Buff((short)SecondData, mapMonster.Monster.Level));
                    }
                }
                else if (type == typeof(MapNpc))
                {
                }
                else if (type == typeof(Mate))
                {
                }
                break;
            }

            case BCardType.CardType.Move:
            {
                if (type == typeof(Character) && session is Character character)
                {
                    character.LastSpeedChange = DateTime.Now;
                    character.Session.SendPacket(character.GenerateCond());
                }
            }
            break;

            case BCardType.CardType.Summons:
                if (type == typeof(Character))
                {
                }
                else if (type == typeof(MapMonster))
                {
                    if (session is MapMonster mapMonster)
                    {
                        List <MonsterToSummon> summonParameters = new List <MonsterToSummon>();
                        for (int i = 0; i < FirstData; i++)
                        {
                            short x = (short)(ServerManager.RandomNumber(-3, 3) + mapMonster.MapX);
                            short y = (short)(ServerManager.RandomNumber(-3, 3) + mapMonster.MapY);
                            summonParameters.Add(new MonsterToSummon((short)SecondData, new MapCell {
                                X = x, Y = y
                            }, -1, true));
                        }
                        if (ServerManager.RandomNumber() <= Math.Abs(ThirdData) || ThirdData == 0)
                        {
                            switch (SubType)
                            {
                            case 2:
                                EventHelper.Instance.RunEvent(new EventContainer(mapMonster.MapInstance, EventActionType.SPAWNMONSTERS, summonParameters));
                                break;

                            default:
                                if (!mapMonster.OnDeathEvents.Any(s => s.EventActionType == EventActionType.SPAWNMONSTERS))
                                {
                                    mapMonster.OnDeathEvents.Add(new EventContainer(mapMonster.MapInstance, EventActionType.SPAWNMONSTERS, summonParameters));
                                }
                                break;
                            }
                        }
                    }
                }
                else if (type == typeof(MapNpc))
                {
                }
                else if (type == typeof(Mate))
                {
                }
                break;

            case BCardType.CardType.SpecialAttack:
                break;

            case BCardType.CardType.SpecialDefence:
                break;

            case BCardType.CardType.AttackPower:
                break;

            case BCardType.CardType.Target:
                break;

            case BCardType.CardType.Critical:
                break;

            case BCardType.CardType.SpecialCritical:
                break;

            case BCardType.CardType.Element:
                break;

            case BCardType.CardType.IncreaseDamage:
                break;

            case BCardType.CardType.Defence:
                break;

            case BCardType.CardType.DodgeAndDefencePercent:
                break;

            case BCardType.CardType.Block:
                break;

            case BCardType.CardType.Absorption:
                break;

            case BCardType.CardType.ElementResistance:
                break;

            case BCardType.CardType.EnemyElementResistance:
                break;

            case BCardType.CardType.Damage:
                break;

            case BCardType.CardType.GuarantedDodgeRangedAttack:
                break;

            case BCardType.CardType.Morale:
                break;

            case BCardType.CardType.Casting:
                break;

            case BCardType.CardType.Reflection:
                break;

            case BCardType.CardType.DrainAndSteal:
                break;

            case BCardType.CardType.HealingBurningAndCasting:
                if (type == typeof(Character))
                {
                    if (session is Character character && character.Hp > 0)
                    {
                        int bonus = 0;
                        if (SubType == (byte)AdditionalTypes.HealingBurningAndCasting.RestoreHP / 10)
                        {
                            if (IsLevelScaled)
                            {
                                bonus = character.Level * FirstData;
                            }
                            else
                            {
                                bonus = FirstData;
                            }
                            if (character.Hp + bonus <= character.HPLoad())
                            {
                                character.Hp += bonus;
                            }
                            else
                            {
                                bonus        = (int)character.HPLoad() - character.Hp;
                                character.Hp = (int)character.HPLoad();
                            }
                            character.Session.CurrentMapInstance?.Broadcast(character.Session, character.GenerateRc(bonus));
                        }
                        if (SubType == (byte)AdditionalTypes.HealingBurningAndCasting.RestoreMP / 10)
                        {
                            if (IsLevelScaled)
                            {
                                bonus = character.Level * FirstData;
                            }
                            else
                            {
                                bonus = FirstData;
                            }
                            if (character.Mp + bonus <= character.MPLoad())
                            {
                                character.Mp += bonus;
                            }
                            else
                            {
                                bonus        = (int)character.MPLoad() - character.Mp;
                                character.Mp = (int)character.MPLoad();
                            }
                        }
                        character.Session.SendPacket(character.GenerateStat());
                    }
                }
                else if (type == typeof(MapMonster))
                {
                    if (ServerManager.RandomNumber() < FirstData && session is MapMonster mapMonster)
                    {
                        mapMonster.AddBuff(new Buff((short)SecondData, mapMonster.Monster.Level));
                    }
                }
                else if (type == typeof(MapNpc))
                {
                }
                else if (type == typeof(Mate))
                {
                }
                break;

            case BCardType.CardType.HPMP:
                break;

            case BCardType.CardType.SpecialisationBuffResistance:
                break;

            case BCardType.CardType.SpecialEffects:
                break;

            case BCardType.CardType.Capture:
                if (type == typeof(MapMonster))
                {
                    if (session is MapMonster mapMonster && sender is ClientSession senderSession)
                    {
                        NpcMonster mateNpc = ServerManager.GetNpc(mapMonster.MonsterVNum);
                        if (mateNpc != null)
                        {
                            if (mapMonster.Monster.Catch)
                            {
                                if (mapMonster.IsAlive && mapMonster.CurrentHp <= (int)((double)mapMonster.MaxHp / 2))
                                {
                                    if (mapMonster.Monster.Level < senderSession.Character.Level)
                                    {
#warning find a new algorithm
                                        int[] chance = { 100, 80, 60, 40, 20, 0 };
                                        if (ServerManager.RandomNumber() < chance[ServerManager.RandomNumber(0, 5)])
                                        {
                                            Mate mate = new Mate(senderSession.Character, mateNpc, (byte)(mapMonster.Monster.Level - 15 > 0 ? mapMonster.Monster.Level - 15 : 1), MateType.Pet);
                                            if (senderSession.Character.CanAddMate(mate))
                                            {
                                                senderSession.Character.AddPetWithSkill(mate);
                                                senderSession.SendPacket(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("CATCH_SUCCESS"), 0));
                                                senderSession.CurrentMapInstance?.Broadcast(StaticPacketHelper.GenerateEff(UserType.Player, senderSession.Character.CharacterId, 197));
                                                senderSession.CurrentMapInstance?.Broadcast(StaticPacketHelper.SkillUsed(UserType.Player, senderSession.Character.CharacterId, 3, mapMonster.MapMonsterId, -1, 0, 15, -1, -1, -1, true, (int)((float)mapMonster.CurrentHp / (float)mapMonster.MaxHp * 100), 0, -1, 0));
                                                mapMonster.SetDeathStatement();
                                                senderSession.CurrentMapInstance?.Broadcast(StaticPacketHelper.Out(UserType.Monster, mapMonster.MapMonsterId));
                                            }
                                            else
                                            {
                                                senderSession.SendPacket(senderSession.Character.GenerateSay(Language.Instance.GetMessageFromKey("PET_SLOT_FULL"), 10));
                                                senderSession.SendPacket(StaticPacketHelper.Cancel(2, mapMonster.MapMonsterId));
                                            }
                                        }
                                        else
                                        {
                                            senderSession.SendPacket(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("CATCH_FAIL"), 0));
                                            senderSession.CurrentMapInstance?.Broadcast(StaticPacketHelper.SkillUsed(UserType.Player, senderSession.Character.CharacterId, 3, mapMonster.MapMonsterId, -1, 0, 15, -1, -1, -1, true, (int)((float)mapMonster.CurrentHp / (float)mapMonster.MaxHp * 100), 0, -1, 0));
                                        }
                                    }
                                    else
                                    {
                                        senderSession.SendPacket(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("LEVEL_LOWER_THAN_MONSTER"), 0));
                                        senderSession.SendPacket(StaticPacketHelper.Cancel(2, mapMonster.MapMonsterId));
                                    }
                                }
                                else
                                {
                                    senderSession.SendPacket(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("CURRENT_HP_TOO_HIGH"), 0));
                                    senderSession.SendPacket(StaticPacketHelper.Cancel(2, mapMonster.MapMonsterId));
                                }
                            }
                            else
                            {
                                senderSession.SendPacket(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("MONSTER_CANT_BE_CAPTURED"), 0));
                                senderSession.SendPacket(StaticPacketHelper.Cancel(2, mapMonster.MapMonsterId));
                            }
                        }
                    }
                }
                break;

            case BCardType.CardType.SpecialDamageAndExplosions:
                break;

            case BCardType.CardType.SpecialEffects2:
                break;

            case BCardType.CardType.CalculatingLevel:
                break;

            case BCardType.CardType.Recovery:
                break;

            case BCardType.CardType.MaxHPMP:
                break;

            case BCardType.CardType.MultAttack:
                break;

            case BCardType.CardType.MultDefence:
                break;

            case BCardType.CardType.TimeCircleSkills:
                break;

            case BCardType.CardType.RecoveryAndDamagePercent:
                break;

            case BCardType.CardType.Count:
                break;

            case BCardType.CardType.NoDefeatAndNoDamage:
                break;

            case BCardType.CardType.SpecialActions:
                break;

            case BCardType.CardType.Mode:
                break;

            case BCardType.CardType.NoCharacteristicValue:
                break;

            case BCardType.CardType.LightAndShadow:
                break;

            case BCardType.CardType.Item:
                break;

            case BCardType.CardType.DebuffResistance:
                break;

            case BCardType.CardType.SpecialBehaviour:
                break;

            case BCardType.CardType.Quest:
                break;

            case BCardType.CardType.SecondSPCard:
                break;

            case BCardType.CardType.SPCardUpgrade:
                break;

            case BCardType.CardType.HugeSnowman:
                break;

            case BCardType.CardType.Drain:
                break;

            case BCardType.CardType.BossMonstersSkill:
                break;

            case BCardType.CardType.LordHatus:
                break;

            case BCardType.CardType.LordCalvinas:
                break;

            case BCardType.CardType.SESpecialist:
                break;

            case BCardType.CardType.FourthGlacernonFamilyRaid:
                break;

            case BCardType.CardType.SummonedMonsterAttack:
                break;

            case BCardType.CardType.BearSpirit:
                break;

            case BCardType.CardType.SummonSkill:
                break;

            case BCardType.CardType.InflictSkill:
                break;

            case BCardType.CardType.HideBarrelSkill:
                break;

            case BCardType.CardType.FocusEnemyAttentionSkill:
                break;

            case BCardType.CardType.TauntSkill:
                break;

            case BCardType.CardType.FireCannoneerRangeBuff:
                break;

            case BCardType.CardType.VulcanoElementBuff:
                break;

            case BCardType.CardType.DamageConvertingSkill:
                break;

            case BCardType.CardType.MeditationSkill:
            {
                if (type == typeof(Character) && session is Character character)
                {
                    if (SkillVNum.HasValue && SubType.Equals((byte)AdditionalTypes.MeditationSkill.CausingChance / 10) && ServerManager.RandomNumber() < FirstData)
                    {
                        Skill skill    = ServerManager.GetSkill(SkillVNum.Value);
                        Skill newSkill = ServerManager.GetSkill((short)SecondData);
                        Observable.Timer(TimeSpan.FromMilliseconds(100)).Subscribe(observer =>
                            {
                                foreach (QuicklistEntryDTO quicklistEntry in character.QuicklistEntries.Where(s => s.Pos.Equals(skill.CastId)))
                                {
                                    character.Session.SendPacket($"qset {quicklistEntry.Q1} {quicklistEntry.Q2} {quicklistEntry.Type}.{quicklistEntry.Slot}.{newSkill.CastId}.0");
                                }
                                character.Session.SendPacket($"mslot {newSkill.CastId} -1");
                            });
                        character.SkillComboCount++;
                        character.LastSkillComboUse = DateTime.Now;
                        if (skill.CastId > 10)
                        {
                            // HACK this way
                            Observable.Timer(TimeSpan.FromMilliseconds((skill.Cooldown * 100) + 500)).Subscribe(observer => character.Session.SendPacket(StaticPacketHelper.SkillReset(skill.CastId)));
                        }
                    }
                    switch (SubType)
                    {
                    case 2:
                        character.MeditationDictionary[(short)SecondData] = DateTime.Now.AddSeconds(4);
                        break;

                    case 3:
                        character.MeditationDictionary[(short)SecondData] = DateTime.Now.AddSeconds(8);
                        break;

                    case 4:
                        character.MeditationDictionary[(short)SecondData] = DateTime.Now.AddSeconds(12);
                        break;
                    }
                }
            }
            break;

            case BCardType.CardType.FalconSkill:
                break;

            case BCardType.CardType.AbsorptionAndPowerSkill:
                break;

            case BCardType.CardType.LeonaPassiveSkill:
                break;

            case BCardType.CardType.FearSkill:
                break;

            case BCardType.CardType.SniperAttack:
                break;

            case BCardType.CardType.FrozenDebuff:
                break;

            case BCardType.CardType.JumpBackPush:
                break;

            case BCardType.CardType.FairyXPIncrease:
                break;

            case BCardType.CardType.SummonAndRecoverHP:
                break;

            case BCardType.CardType.TeamArenaBuff:
                break;

            case BCardType.CardType.ArenaCamera:
                break;

            case BCardType.CardType.DarkCloneSummon:
                break;

            case BCardType.CardType.AbsorbedSpirit:
                break;

            case BCardType.CardType.AngerSkill:
                break;

            case BCardType.CardType.MeteoriteTeleport:
                break;

            case BCardType.CardType.StealBuff:
                break;

            case BCardType.CardType.Unknown:
                break;

            case BCardType.CardType.EffectSummon:
                break;

            default:
                Logger.Warn($"Card Type {Type} not defined!");
                break;
            }
        }
Ejemplo n.º 7
0
        public override Dictionary <string, object> ToUpdate(IMemoryCache memoryCache, out BaseModel updatedElement)
        {
            Dictionary <string, object> changes = new Dictionary <string, object>();

            Device refInCache = null;

            if (Id != Guid.Empty)
            {
                refInCache = CacheHelper.GetDeviceFromCache(memoryCache, Id);

                if (refInCache != null)
                {
                    if (Name != null && !Name.Equals(refInCache.Name))
                    {
                        changes.Add("Name", Name);
                        refInCache.Name = Name;
                    }
                    if (HardwareId != null && !HardwareId.Equals(refInCache.HardwareId))
                    {
                        changes.Add("HardwareId", HardwareId);
                        refInCache.HardwareId = HardwareId;
                    }
                    if (SpaceId != null && !SpaceId.Equals(refInCache.SpaceId))
                    {
                        changes.Add("SpaceId", SpaceId);
                        refInCache.SpaceId = SpaceId;
                    }
                    if (Type != null && !Type.Equals(refInCache.Type))
                    {
                        changes.Add("Type", Type);
                        refInCache.Type = Type;
                    }
                    if (SubType != null && !SubType.Equals(refInCache.SubType))
                    {
                        changes.Add("SubType", SubType);
                        refInCache.SubType = SubType;
                    }
                }
                else
                {
                    refInCache = this;

                    if (Name != null)
                    {
                        changes.Add("Name", Name);
                    }
                    if (HardwareId != null)
                    {
                        changes.Add("HardwareId", HardwareId);
                    }
                    if (SpaceId != null)
                    {
                        changes.Add("SpaceId", SpaceId);
                    }
                    if (Type != null)
                    {
                        changes.Add("Type", Type);
                    }
                    if (SubType != null)
                    {
                        changes.Add("SubType", SubType);
                    }
                }
            }
            updatedElement = refInCache;
            return(changes);
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Returns true if Route instances are equal
        /// </summary>
        /// <param name="other">Instance of Route to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Route other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Athlete == other.Athlete ||
                     Athlete != null &&
                     Athlete.Equals(other.Athlete)
                     ) &&
                 (
                     Description == other.Description ||
                     Description != null &&
                     Description.Equals(other.Description)
                 ) &&
                 (
                     Distance == other.Distance ||
                     Distance != null &&
                     Distance.Equals(other.Distance)
                 ) &&
                 (
                     ElevationGain == other.ElevationGain ||
                     ElevationGain != null &&
                     ElevationGain.Equals(other.ElevationGain)
                 ) &&
                 (
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                 ) &&
                 (
                     IdStr == other.IdStr ||
                     IdStr != null &&
                     IdStr.Equals(other.IdStr)
                 ) &&
                 (
                     Map == other.Map ||
                     Map != null &&
                     Map.Equals(other.Map)
                 ) &&
                 (
                     Name == other.Name ||
                     Name != null &&
                     Name.Equals(other.Name)
                 ) &&
                 (
                     _Private == other._Private ||
                     _Private != null &&
                     _Private.Equals(other._Private)
                 ) &&
                 (
                     Starred == other.Starred ||
                     Starred != null &&
                     Starred.Equals(other.Starred)
                 ) &&
                 (
                     Timestamp == other.Timestamp ||
                     Timestamp != null &&
                     Timestamp.Equals(other.Timestamp)
                 ) &&
                 (
                     Type == other.Type ||
                     Type != null &&
                     Type.Equals(other.Type)
                 ) &&
                 (
                     SubType == other.SubType ||
                     SubType != null &&
                     SubType.Equals(other.SubType)
                 ) &&
                 (
                     CreatedAt == other.CreatedAt ||
                     CreatedAt != null &&
                     CreatedAt.Equals(other.CreatedAt)
                 ) &&
                 (
                     UpdatedAt == other.UpdatedAt ||
                     UpdatedAt != null &&
                     UpdatedAt.Equals(other.UpdatedAt)
                 ) &&
                 (
                     EstimatedMovingTime == other.EstimatedMovingTime ||
                     EstimatedMovingTime != null &&
                     EstimatedMovingTime.Equals(other.EstimatedMovingTime)
                 ) &&
                 (
                     Segments == other.Segments ||
                     Segments != null &&
                     Segments.SequenceEqual(other.Segments)
                 ));
        }
Ejemplo n.º 9
0
        public override Dictionary <string, object> ToUpdate(IMemoryCache memoryCache, out BaseModel updatedElement)
        {
            Dictionary <string, object> changes = new Dictionary <string, object>();
            Space refInCache = null;

            if (Id != Guid.Empty)
            {
                refInCache = CacheHelper.GetSpaceFromCache(memoryCache, Id);

                if (refInCache != null)
                {
                    if (Name != null && !Name.Equals(refInCache.Name))
                    {
                        changes.Add("Name", Name);
                        refInCache.Name = Name;
                    }
                    if (FriendlyName != null && !FriendlyName.Equals(refInCache.FriendlyName))
                    {
                        changes.Add("FriendlyName", FriendlyName);
                        refInCache.FriendlyName = FriendlyName;
                    }
                    if (Type != null && !Type.Equals(refInCache.Type))
                    {
                        changes.Add("Type", Type);
                        refInCache.Type = Type;
                    }
                    if (SubType != null && !SubType.Equals(refInCache.SubType))
                    {
                        changes.Add("SubType", SubType);
                        refInCache.SubType = SubType;
                    }
                    if (ParentSpaceId != Guid.Empty && !ParentSpaceId.Equals(refInCache.ParentSpaceId))
                    {
                        changes.Add("ParentSpaceId", ParentSpaceId);
                        refInCache.ParentSpaceId = ParentSpaceId;
                    }
                    if (Status != null && !Status.Equals(refInCache.Status))
                    {
                        changes.Add("Status", Status);
                        refInCache.Status = Status;
                    }
                    if (PropertiesHasChanged)
                    {
                        changes.Add("Properties", Properties);
                        refInCache.Properties = Properties;
                    }
                }
                else
                {
                    refInCache = this;

                    if (Name != null)
                    {
                        changes.Add("Name", Name);
                    }
                    if (FriendlyName != null)
                    {
                        changes.Add("FriendlyName", FriendlyName);
                    }
                    if (Type != null)
                    {
                        changes.Add("Type", Type);
                    }
                    if (ParentSpaceId != Guid.Empty)
                    {
                        changes.Add("ParentSpaceId", ParentSpaceId);
                    }
                    if (SubType != null)
                    {
                        changes.Add("SubType", SubType);
                    }
                    if (Status != null)
                    {
                        changes.Add("Status", Status);
                    }
                    if (PropertiesHasChanged)
                    {
                        changes.Add("Properties", Properties);
                    }
                }
            }
            updatedElement = refInCache;
            return(changes);
        }
Ejemplo n.º 10
0
        public void ApplyBCards(object session, object sender = null)
        {
            //Console.WriteLine($"BCardId: {BCardId} Type: {(BCardType.CardType)Type} SubType: {SubType} CardId: {CardId?.ToString() ?? "null"} ItemVNum: {ItemVNum?.ToString() ?? "null"} SkillVNum: {SkillVNum?.ToString() ?? "null"} SessionType: {session?.GetType().ToString() ?? "null"} SenderType: {sender?.GetType().ToString() ?? "null"}");

            switch ((BCardType.CardType)Type)
            {
            case BCardType.CardType.Buff:
            {
                if (ServerManager.RandomNumber() < FirstData)
                {
                    Character senderCharacter = sender is ClientSession senderSession
                                ? senderSession.Character : sender as Character;

                    if (session is Character character)
                    {
                        short cardId = (short)SecondData;

                        // If either Berserk Spirit or Strong Berserk Spirit is active
                        // then don't add Weak Berserk Spirit

                        if (cardId == 601 &&
                            character.Buff?.Any(s => s?.Card?.CardId == 602 || s?.Card?.CardId == 603) == true)
                        {
                            break;
                        }

                        if (senderCharacter != null)
                        {
                            // TODO: Get anti stats from BCard

                            character.AddBuff(new Buff((short)SecondData, senderCharacter.Level, senderCharacter));
                        }
                        else
                        {
                            character.AddBuff(new Buff((short)SecondData, character.Level));
                        }
                    }
                    else if (session is MapMonster mapMonster)
                    {
                        if (senderCharacter != null)
                        {
                            mapMonster.AddBuff(new Buff((short)SecondData, senderCharacter.Level, senderCharacter));
                        }
                        else
                        {
                            mapMonster.AddBuff(new Buff((short)SecondData, mapMonster.Monster.Level));
                        }
                    }
                }
            }
            break;

            case BCardType.CardType.Move:
            {
                if (session is Character character)
                {
                    character.LastSpeedChange = DateTime.Now;
                    character.Session.SendPacket(character.GenerateCond());
                }
            }
            break;

            case BCardType.CardType.Summons:
            {
                if (session is Character character)
                {
                    if (character.MapInstance != null)
                    {
                        List <MonsterToSummon> monsterList = new List <MonsterToSummon>();

                        if (SubType == (byte)AdditionalTypes.Summons.Summons / 10)
                        {
                            int aliveTime = ServerManager.GetNpc((short)SecondData).RespawnTime;

                            for (int i = 0; i < FirstData; i++)
                            {
                                MapCell mapCell = new MapCell
                                {
                                    X = (short)(ServerManager.RandomNumber(-1, 2) + character.PositionX),
                                    Y = (short)(ServerManager.RandomNumber(-1, 2) + character.PositionY),
                                };

                                monsterList.Add(new MonsterToSummon((short)SecondData, mapCell, -1, true, false, false, true, false, -1, character, aliveTime, false));
                            }
                        }

                        if (monsterList.Any())
                        {
                            EventHelper.Instance.RunEvent(new EventContainer(character.MapInstance,
                                                                             EventActionType.SPAWNMONSTERS, monsterList));
                        }
                    }
                }
            }
            break;

            case BCardType.CardType.SpecialAttack:
                break;

            case BCardType.CardType.SpecialDefence:
                break;

            case BCardType.CardType.AttackPower:
                break;

            case BCardType.CardType.Target:
                break;

            case BCardType.CardType.Critical:
                break;

            case BCardType.CardType.SpecialCritical:
                break;

            case BCardType.CardType.Element:
                break;

            case BCardType.CardType.IncreaseDamage:
                break;

            case BCardType.CardType.Defence:
                break;

            case BCardType.CardType.DodgeAndDefencePercent:
                break;

            case BCardType.CardType.Block:
                break;

            case BCardType.CardType.Absorption:
                break;

            case BCardType.CardType.ElementResistance:
                break;

            case BCardType.CardType.EnemyElementResistance:
                break;

            case BCardType.CardType.Damage:
                break;

            case BCardType.CardType.GuarantedDodgeRangedAttack:
                break;

            case BCardType.CardType.Morale:
                break;

            case BCardType.CardType.Casting:
                break;

            case BCardType.CardType.Reflection:
                break;

            case BCardType.CardType.DrainAndSteal:
                break;

            case BCardType.CardType.HealingBurningAndCasting:
            {
                Character senderCharacter = sender is ClientSession senderSession
                            ? senderSession.Character : sender as Character;

                if (senderCharacter != null)
                {
                    #region Character

                    if (session is Character character)
                    {
                        void HealingBurningAndCastingAction()
                        {
                            if (!character.IsAlive ||
                                character.MapInstance == null ||
                                character.Session == null)
                            {
                                return;
                            }

                            int amount = 0;

                            if (SubType == (byte)AdditionalTypes.HealingBurningAndCasting.RestoreHP / 10 ||
                                SubType == (byte)AdditionalTypes.HealingBurningAndCasting.DecreaseHP / 10)
                            {
                                if (FirstData > 0)
                                {
                                    if (IsLevelScaled)
                                    {
                                        amount = senderCharacter.Level * FirstData;
                                    }
                                    else
                                    {
                                        amount = FirstData;
                                    }

                                    if (character.Hp + amount > character.HPMax)
                                    {
                                        amount = character.HPMax - character.Hp;
                                    }

                                    character.Hp += amount;

                                    character.MapInstance.Broadcast(character.GenerateRc(amount));
                                }
                                else
                                {
                                    if (IsLevelScaled)
                                    {
                                        amount = senderCharacter.Level * (FirstData - 1);
                                    }
                                    else
                                    {
                                        amount = FirstData;
                                    }

                                    amount *= -1;

                                    if (character.Hp - amount < 1)
                                    {
                                        amount = character.Hp - 1;
                                    }

                                    character.GetDamage(amount);

                                    character.MapInstance.Broadcast(character.GenerateDm(amount));
                                }

                                character.Session.SendPacket(character.GenerateStat());
                            }
                            else if (SubType == (byte)AdditionalTypes.HealingBurningAndCasting.RestoreMP / 10 ||
                                     SubType == (byte)AdditionalTypes.HealingBurningAndCasting.DecreaseMP / 10)
                            {
                                if (FirstData > 0)
                                {
                                    if (IsLevelScaled)
                                    {
                                        amount = senderCharacter.Level * FirstData;
                                    }
                                    else
                                    {
                                        amount = FirstData;
                                    }

                                    if (character.Mp + amount > character.MPMax)
                                    {
                                        amount = character.MPMax - character.Mp;
                                    }

                                    character.Mp += amount;
                                }
                                else
                                {
                                    if (IsLevelScaled)
                                    {
                                        amount = senderCharacter.Level * (FirstData - 1);
                                    }
                                    else
                                    {
                                        amount = FirstData;
                                    }

                                    amount *= -1;

                                    if (character.Mp - amount < 1)
                                    {
                                        amount = character.Mp - 1;
                                    }

                                    character.DecreaseMp(amount);
                                }

                                character.Session.SendPacket(character.GenerateStat());
                            }
                        }

                        HealingBurningAndCastingAction();

                        if (ThirdData > 0 &&
                            CardId != null)
                        {
                            IDisposable disposable = Observable.Interval(TimeSpan.FromSeconds(ThirdData * 2))
                                                     .Subscribe(s => HealingBurningAndCastingAction());

                            character.DisposeBCard(BCardId);
                            character.BCardDisposables[BCardId] = disposable;
                        }
                    }

                    #endregion

                    #region MapMonster

                    else if (session is MapMonster mapMonster)
                    {
                        void HealingBurningAndCastingAction()
                        {
                            if (!mapMonster.IsAlive ||
                                mapMonster.MapInstance == null)
                            {
                                return;
                            }

                            int amount = 0;

                            if (SubType == (byte)AdditionalTypes.HealingBurningAndCasting.RestoreHP / 10 ||
                                SubType == (byte)AdditionalTypes.HealingBurningAndCasting.DecreaseHP / 10)
                            {
                                if (FirstData > 0)
                                {
                                    if (IsLevelScaled)
                                    {
                                        amount = senderCharacter.Level * FirstData;
                                    }
                                    else
                                    {
                                        amount = FirstData;
                                    }

                                    if (mapMonster.CurrentHp + amount > mapMonster.MaxHp)
                                    {
                                        amount = mapMonster.MaxHp - mapMonster.CurrentHp;
                                    }

                                    mapMonster.CurrentHp += amount;

                                    mapMonster.MapInstance.Broadcast(mapMonster.GenerateRc(amount));
                                }
                                else
                                {
                                    if (IsLevelScaled)
                                    {
                                        amount = senderCharacter.Level * (FirstData - 1);
                                    }
                                    else
                                    {
                                        amount = FirstData;
                                    }

                                    amount *= -1;

                                    if (mapMonster.CurrentHp - amount < 1)
                                    {
                                        amount = mapMonster.CurrentHp - 1;
                                    }

                                    mapMonster.CurrentHp -= amount;

                                    mapMonster.MapInstance.Broadcast(mapMonster.GenerateDm(amount));
                                }
                            }

                            if (SubType == (byte)AdditionalTypes.HealingBurningAndCasting.RestoreMP / 10 ||
                                SubType == (byte)AdditionalTypes.HealingBurningAndCasting.DecreaseMP / 10)
                            {
                                if (FirstData > 0)
                                {
                                    if (IsLevelScaled)
                                    {
                                        amount = senderCharacter.Level * FirstData;
                                    }
                                    else
                                    {
                                        amount = FirstData;
                                    }

                                    if (mapMonster.CurrentMp + amount > mapMonster.MaxMp)
                                    {
                                        amount = mapMonster.MaxMp - mapMonster.CurrentMp;
                                    }

                                    mapMonster.CurrentMp += amount;
                                }
                                else
                                {
                                    if (IsLevelScaled)
                                    {
                                        amount = senderCharacter.Level * (FirstData - 1);
                                    }
                                    else
                                    {
                                        amount = FirstData;
                                    }

                                    amount *= -1;

                                    if (mapMonster.CurrentMp - amount < 1)
                                    {
                                        amount = mapMonster.CurrentMp - 1;
                                    }

                                    mapMonster.CurrentMp -= amount;
                                }
                            }
                        }

                        HealingBurningAndCastingAction();

                        if (ThirdData > 0 &&
                            CardId != null)
                        {
                            IDisposable disposable = Observable.Interval(TimeSpan.FromSeconds(ThirdData * 2))
                                                     .Subscribe(s => HealingBurningAndCastingAction());

                            mapMonster.DisposeBCard(BCardId);
                            mapMonster.BCardDisposables[BCardId] = disposable;
                        }
                    }

                    #endregion
                }
            }
            break;

            case BCardType.CardType.HPMP:
            {
                if (SubType == (byte)AdditionalTypes.HPMP.DecreaseRemainingMP / 10)
                {
                    if (FirstData < 0)
                    {
                        double multiplier = (FirstData * -1) / 100D;

                        if (session is Character character)
                        {
                            character.DecreaseMp((int)(character.Mp * multiplier));
                            character.Session?.SendPacket(character.GenerateStat());
                        }
                        else if (session is MapMonster mapMonster)
                        {
                            mapMonster.DecreaseMp((int)(mapMonster.CurrentMp * multiplier));
                        }
                    }
                }
            }
            break;

            case BCardType.CardType.SpecializationBuffResistance:
            {
                if (SubType == (byte)AdditionalTypes.SpecializationBuffResistance.RemoveGoodEffects / 10)
                {
                    if (session is Character character)
                    {
                        if (FirstData < 0)
                        {
                            if (ServerManager.RandomNumber() < (FirstData * -1))
                            {
                                character.Buff?.GetAllItems()?.Where(s => s?.Card?.BuffType == BuffType.Bad && s.Card.Level < SecondData)?
                                .ToList()?.ForEach(s => character.RemoveBuff(s.Card.CardId));
                            }
                        }
                        else
                        {
                            if (ServerManager.RandomNumber() < FirstData)
                            {
                                character.Buff?.GetAllItems()?.Where(s => s?.Card?.BuffType == BuffType.Good && s.Card.Level < SecondData)?
                                .ToList()?.ForEach(s => character.RemoveBuff(s.Card.CardId));
                            }
                        }
                    }
                }
            }
            break;

            case BCardType.CardType.SpecialEffects:
            {
                if (SubType == (byte)AdditionalTypes.SpecialEffects.ShadowAppears / 10)
                {
                    if (session is Character character)
                    {
                        character.NumberOfShadows = FirstData;
                        character.ShadowsDistance = SecondData;
                        character.MapInstance?.Broadcast(character.GenerateSpeed());
                    }
                }
            }
            break;

            case BCardType.CardType.Capture:
            {
                if (session is MapMonster mapMonster &&
                    sender is ClientSession senderSession)
                {
                    NpcMonster mateNpc = ServerManager.GetNpc(mapMonster.MonsterVNum);

                    if (mateNpc != null)
                    {
                        if (mapMonster.Monster.Catch)
                        {
                            if (mapMonster.IsAlive && mapMonster.CurrentHp <= (int)((double)mapMonster.MaxHp / 2))
                            {
                                if (mapMonster.Monster.Level < senderSession.Character.Level)
                                {
                                    // TODO: Find a new algorithm
                                    int[] chance = { 100, 80, 60, 40, 20, 0 };
                                    if (ServerManager.RandomNumber() < chance[ServerManager.RandomNumber(0, 5)])
                                    {
                                        Mate mate = new Mate(senderSession.Character, mateNpc, (byte)(mapMonster.Monster.Level - 15 > 0 ? mapMonster.Monster.Level - 15 : 1), MateType.Pet);
                                        if (senderSession.Character.CanAddMate(mate))
                                        {
                                            senderSession.Character.AddPetWithSkill(mate);
                                            senderSession.SendPacket(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("CATCH_SUCCESS"), 0));
                                            senderSession.CurrentMapInstance?.Broadcast(StaticPacketHelper.GenerateEff(UserType.Player, senderSession.Character.CharacterId, 197));
                                            senderSession.CurrentMapInstance?.Broadcast(StaticPacketHelper.SkillUsed(UserType.Player, senderSession.Character.CharacterId, 3, mapMonster.MapMonsterId, -1, 0, 15, -1, -1, -1, true, (int)((float)mapMonster.CurrentHp / (float)mapMonster.MaxHp * 100), 0, -1, 0));
                                            mapMonster.SetDeathStatement();
                                            senderSession.CurrentMapInstance?.Broadcast(StaticPacketHelper.Out(UserType.Monster, mapMonster.MapMonsterId));
                                        }
                                        else
                                        {
                                            senderSession.SendPacket(senderSession.Character.GenerateSay(Language.Instance.GetMessageFromKey("PET_SLOT_FULL"), 10));
                                            senderSession.SendPacket(StaticPacketHelper.Cancel(2, mapMonster.MapMonsterId));
                                        }
                                    }
                                    else
                                    {
                                        senderSession.SendPacket(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("CATCH_FAIL"), 0));
                                        senderSession.CurrentMapInstance?.Broadcast(StaticPacketHelper.SkillUsed(UserType.Player, senderSession.Character.CharacterId, 3, mapMonster.MapMonsterId, -1, 0, 15, -1, -1, -1, true, (int)((float)mapMonster.CurrentHp / (float)mapMonster.MaxHp * 100), 0, -1, 0));
                                    }
                                }
                                else
                                {
                                    senderSession.SendPacket(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("LEVEL_LOWER_THAN_MONSTER"), 0));
                                    senderSession.SendPacket(StaticPacketHelper.Cancel(2, mapMonster.MapMonsterId));
                                }
                            }
                            else
                            {
                                senderSession.SendPacket(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("CURRENT_HP_TOO_HIGH"), 0));
                                senderSession.SendPacket(StaticPacketHelper.Cancel(2, mapMonster.MapMonsterId));
                            }
                        }
                        else
                        {
                            senderSession.SendPacket(UserInterfaceHelper.GenerateMsg(Language.Instance.GetMessageFromKey("MONSTER_CANT_BE_CAPTURED"), 0));
                            senderSession.SendPacket(StaticPacketHelper.Cancel(2, mapMonster.MapMonsterId));
                        }
                    }
                }
            }
            break;

            case BCardType.CardType.SpecialDamageAndExplosions:
                break;

            case BCardType.CardType.SpecialEffects2:
            {
                if (SubType == (byte)AdditionalTypes.SpecialEffects2.TeleportInRadius / 10)
                {
                    if (session is Character character)
                    {
                        character.Teleport((short)FirstData);
                    }
                }
            }
            break;

            case BCardType.CardType.CalculatingLevel:
                break;

            case BCardType.CardType.Recovery:
                break;

            case BCardType.CardType.MaxHPMP:
            {
                if (session is Character character)
                {
                    if (SubType == (byte)AdditionalTypes.MaxHPMP.IncreasesMaximumHP / 10)
                    {
                        character.HPLoad();
                        character.Session?.SendPacket(character.GenerateStat());
                    }
                    else if (SubType == (byte)AdditionalTypes.MaxHPMP.IncreasesMaximumMP / 10)
                    {
                        character.MPLoad();
                        character.Session?.SendPacket(character.GenerateStat());
                    }
                }
            }
            break;

            case BCardType.CardType.MultAttack:
                break;

            case BCardType.CardType.MultDefence:
                break;

            case BCardType.CardType.TimeCircleSkills:
                break;

            case BCardType.CardType.RecoveryAndDamagePercent:
                break;

            case BCardType.CardType.Count:
                break;

            case BCardType.CardType.NoDefeatAndNoDamage:
                break;

            case BCardType.CardType.SpecialActions:
            {
                Character senderCharacter = sender is ClientSession senderSession
                            ? senderSession.Character : sender as Character;

                if (SubType == (byte)AdditionalTypes.SpecialActions.PushBack / 10)
                {
                    if (senderCharacter != null)
                    {
                        if (session is Character character)
                        {
                            if (character.ResistForcedMovementChance <= 0 ||
                                ServerManager.RandomNumber() < character.ResistForcedMovementChance)
                            {
                                character.PushBack((short)FirstData, senderCharacter);
                            }
                        }
                        else if (session is MapMonster mapMonster)
                        {
                            mapMonster.PushBack((short)FirstData, senderCharacter);
                        }
                    }
                }
                else if (SubType == (byte)AdditionalTypes.SpecialActions.FocusEnemies / 10)
                {
                    if (senderCharacter != null)
                    {
                        if (session is Character character)
                        {
                            if (character.ResistForcedMovementChance <= 0 ||
                                ServerManager.RandomNumber() < character.ResistForcedMovementChance)
                            {
                                character.Focus((short)FirstData, senderCharacter);
                            }
                        }
                        else if (session is MapMonster mapMonster)
                        {
                            mapMonster.Focus((short)FirstData, senderCharacter);
                        }
                    }
                }
                else if (SubType == (byte)AdditionalTypes.SpecialActions.Hide / 10)
                {
                    if (session is Character character)
                    {
                        character.SetInvisible(true);
                    }
                }
            }
            break;

            case BCardType.CardType.Transform:
                break;

            case BCardType.CardType.Mode:
                break;

            case BCardType.CardType.NoCharacteristicValue:
                break;

            case BCardType.CardType.LightAndShadow:
            {
                if (SubType == (byte)AdditionalTypes.LightAndShadow.RemoveBadEffects / 10)
                {
                    if (session is Character character)
                    {
                        character.Buff?.GetAllItems()?.Where(s => s?.Card?.BuffType == BuffType.Bad && s.Card.Level < FirstData)?
                        .ToList()?.ForEach(s => character.RemoveBuff(s.Card.CardId));
                    }
                }
            }
            break;

            case BCardType.CardType.Item:
                break;

            case BCardType.CardType.DebuffResistance:
                break;

            case BCardType.CardType.SpecialBehaviour:
                break;

            case BCardType.CardType.Quest:
                break;

            case BCardType.CardType.SecondSPCard:
            {
                if (session is Character character)
                {
                    if (character.MapInstance != null)
                    {
                        List <MonsterToSummon> monsterList = new List <MonsterToSummon>();

                        if (SubType == (byte)AdditionalTypes.SecondSPCard.PlantBomb / 10)
                        {
                            MapMonster bomb = character.MapInstance.Monsters.FirstOrDefault(m => m?.Owner?.CharacterId == character.CharacterId &&
                                                                                            m.MonsterVNum == (short)SecondData);

                            if (bomb == null)
                            {
                                for (int i = 0; i < FirstData; i++)
                                {
                                    monsterList.Add(new MonsterToSummon((short)SecondData, new MapCell {
                                            X = character.PositionX, Y = character.PositionY
                                        },
                                                                        -1, false, false, false, false, false, -1, character, 0, false));
                                }
                            }
                            else
                            {
                                bomb.Explode();
                                break;
                            }
                        }
                        else if (SubType == (byte)AdditionalTypes.SecondSPCard.PlantSelfDestructionBomb / 10)
                        {
                            int aliveTime = ServerManager.GetNpc((short)SecondData).RespawnTime;

                            for (int i = 0; i < FirstData; i++)
                            {
                                MapCell mapCell = new MapCell
                                {
                                    X = (short)(ServerManager.RandomNumber(-1, 2) + character.PositionX),
                                    Y = (short)(ServerManager.RandomNumber(-1, 2) + character.PositionY),
                                };

                                monsterList.Add(new MonsterToSummon((short)SecondData, mapCell, -1, true, false, false, true, false, -1, character, aliveTime, true));
                            }
                        }

                        if (monsterList.Any())
                        {
                            EventHelper.Instance.RunEvent(new EventContainer(character.MapInstance,
                                                                             EventActionType.SPAWNMONSTERS, monsterList));
                        }
                    }
                }
            }
            break;

            case BCardType.CardType.SPCardUpgrade:
                break;

            case BCardType.CardType.HugeSnowman:
                break;

            case BCardType.CardType.Drain:
                break;

            case BCardType.CardType.BossMonstersSkill:
                break;

            case BCardType.CardType.LordHatus:
                break;

            case BCardType.CardType.LordCalvinas:
                break;

            case BCardType.CardType.SESpecialist:
            {
                if (SubType == (byte)AdditionalTypes.SESpecialist.LowerHPStrongerEffect / 10)
                {
                    Character senderCharacter = sender is ClientSession senderSession
                                ? senderSession.Character : sender as Character;

                    if (senderCharacter != null)
                    {
                        if (session is Character character)
                        {
                            double percentage = (character.Hp * 100) / character.HPMax;

                            if (percentage < 35)
                            {
                                character.AddBuff(new Buff(274, senderCharacter.Level, senderCharacter));
                            }
                            else if (percentage < 67)
                            {
                                character.AddBuff(new Buff(273, senderCharacter.Level, senderCharacter));
                            }
                            else
                            {
                                character.AddBuff(new Buff(272, senderCharacter.Level, senderCharacter));
                            }
                        }
                    }
                }
            }
            break;

            case BCardType.CardType.FourthGlacernonFamilyRaid:
                break;

            case BCardType.CardType.SummonedMonsterAttack:
                break;

            case BCardType.CardType.BearSpirit:
            {
                if (session is Character character)
                {
                    if (SubType == (byte)AdditionalTypes.BearSpirit.IncreaseMaximumHP / 10)
                    {
                        character.HPLoad();
                        character.Session?.SendPacket(character.GenerateStat());
                    }
                    else if (SubType == (byte)AdditionalTypes.BearSpirit.IncreaseMaximumMP / 10)
                    {
                        character.MPLoad();
                        character.Session?.SendPacket(character.GenerateStat());
                    }
                }
            }
            break;

            case BCardType.CardType.SummonSkill:
                break;

            case BCardType.CardType.InflictSkill:
                break;

            case BCardType.CardType.HideBarrelSkill:
                break;

            case BCardType.CardType.FocusEnemyAttentionSkill:
                break;

            case BCardType.CardType.TauntSkill:
                break;

            case BCardType.CardType.FireCannoneerRangeBuff:
                break;

            case BCardType.CardType.VulcanoElementBuff:
                break;

            case BCardType.CardType.DamageConvertingSkill:
                break;

            case BCardType.CardType.MeditationSkill:
            {
                if (session is Character character)
                {
                    if (SkillVNum.HasValue && SubType.Equals((byte)AdditionalTypes.MeditationSkill.CausingChance / 10) && ServerManager.RandomNumber() < FirstData)
                    {
                        Skill skill    = ServerManager.GetSkill(SkillVNum.Value);
                        Skill newSkill = ServerManager.GetSkill((short)SecondData);

                        Observable.Timer(TimeSpan.FromMilliseconds(100)).Subscribe(observer =>
                            {
                                foreach (QuicklistEntryDTO quicklistEntry in character.QuicklistEntries.Where(s => s.Pos.Equals(skill.CastId)))
                                {
                                    character.Session.SendPacket($"qset {quicklistEntry.Q1} {quicklistEntry.Q2} {quicklistEntry.Type}.{quicklistEntry.Slot}.{newSkill.CastId}.0");
                                }

                                character.Session.SendPacket($"mslot {newSkill.CastId} -1");
                            });

                        character.SkillComboCount++;
                        character.LastSkillComboUse = DateTime.Now;

                        if (skill.CastId > 10)
                        {
                            Observable.Timer(TimeSpan.FromMilliseconds((skill.GetCooldown(character) * 100) + 500)).Subscribe(observer => character.Session.SendPacket(StaticPacketHelper.SkillReset(skill.CastId)));
                        }
                    }

                    switch (SubType)
                    {
                    case 2:
                        character.MeditationDictionary[(short)SecondData] = DateTime.Now.AddSeconds(4);
                        break;

                    case 3:
                        character.MeditationDictionary[(short)SecondData] = DateTime.Now.AddSeconds(8);
                        break;

                    case 4:
                        character.MeditationDictionary[(short)SecondData] = DateTime.Now.AddSeconds(12);
                        break;
                    }
                }
            }
            break;

            case BCardType.CardType.FalconSkill:
                break;

            case BCardType.CardType.AbsorptionAndPowerSkill:
                break;

            case BCardType.CardType.LeonaPassiveSkill:
                break;

            case BCardType.CardType.FearSkill:
                break;

            case BCardType.CardType.SniperAttack:
                break;

            case BCardType.CardType.FrozenDebuff:
                break;

            case BCardType.CardType.JumpBackPush:
                break;

            case BCardType.CardType.FairyXPIncrease:
                break;

            case BCardType.CardType.SummonAndRecoverHP:
                break;

            case BCardType.CardType.TeamArenaBuff:
                break;

            case BCardType.CardType.ArenaCamera:
                break;

            case BCardType.CardType.DarkCloneSummon:
                break;

            case BCardType.CardType.AbsorbedSpirit:
                break;

            case BCardType.CardType.AngerSkill:
                break;

            case BCardType.CardType.MeteoriteTeleport:
                break;

            case BCardType.CardType.StealBuff:
                break;

            case BCardType.CardType.Unknown:
                break;

            case BCardType.CardType.EffectSummon:
                break;

            default:
                Logger.Warn($"Card Type {Type} Not Found!");
                break;
            }
        }
Ejemplo n.º 11
0
        public void ApplyBCards(IBattleEntity session, IBattleEntity caster = null)
        {
            Mate mate;

            switch ((BCardType.CardType)Type)
            {
            case BCardType.CardType.Buff:
                if (ServerManager.Instance.RandomNumber() < FirstData)
                {
                    session?.BattleEntity.AddBuff(new Buff(SecondData, caster?.BattleEntity.Level ?? session.BattleEntity.Level));
                }
                break;

            case BCardType.CardType.Move:
                if (session.GetSession() is Character chara)
                {
                    chara.LastSpeedChange = DateTime.Now;
                    chara.LoadSpeed();
                    chara?.Session.SendPacket(chara.GenerateCond());
                }
                break;

            case BCardType.CardType.Summons:
                NpcMonster npcMonster = session.GetSession() is MapMonster mob ? mob.Monster : session.GetSession() is MapNpc npc ? npc.Npc : null;
                ConcurrentBag <ToSummon> summonParameters = new ConcurrentBag <ToSummon>();

                switch ((AdditionalTypes.Summons)SubType)
                {
                case AdditionalTypes.Summons.Summons:
                    for (int i = 0; i < FirstData; i++)
                    {
                        MapCell cell = session.GetPos();
                        cell.Y += (short)ServerManager.Instance.RandomNumber(-3, 3);
                        cell.X += (short)ServerManager.Instance.RandomNumber(-3, 3);
                        summonParameters.Add(new ToSummon((short)SecondData, cell, null, true, (byte)Math.Abs(ThirdData)));
                    }
                    EventHelper.Instance.RunEvent(new EventContainer(session.MapInstance, EventActionType.SPAWNMONSTERS, summonParameters));
                    break;

                case AdditionalTypes.Summons.SummonTrainingDummy:
                    if (npcMonster != null && session.BattleEntity.OnHitEvents.All(s => s?.EventActionType != EventActionType.SPAWNMONSTERS))
                    {
                        summonParameters.Add(new ToSummon((short)SecondData, session.GetPos(), null, true, (byte)Math.Abs(ThirdData)));
                        session.BattleEntity.OnHitEvents.Add(new EventContainer(session.MapInstance, EventActionType.SPAWNMONSTERS, summonParameters));
                    }
                    break;

                case AdditionalTypes.Summons.SummonUponDeathChance:
                case AdditionalTypes.Summons.SummonUponDeath:
                    if (npcMonster != null && session.BattleEntity.OnDeathEvents.All(s => s?.EventActionType != EventActionType.SPAWNMONSTERS))
                    {
                        for (int i = 0; i < FirstData; i++)
                        {
                            MapCell cell = session.GetPos();
                            cell.Y += (short)i;
                            summonParameters.Add(new ToSummon((short)SecondData, cell, null, true, (byte)Math.Abs(ThirdData)));
                        }
                        session.BattleEntity.OnDeathEvents.Add(new EventContainer(session.MapInstance, EventActionType.SPAWNMONSTERS, summonParameters));
                    }
                    break;

                default:
                    break;
                }
                break;

            case BCardType.CardType.SpecialAttack:
                break;

            case BCardType.CardType.SpecialDefence:
                break;

            case BCardType.CardType.AttackPower:
                break;

            case BCardType.CardType.Target:
                break;

            case BCardType.CardType.Critical:
                break;

            case BCardType.CardType.SpecialCritical:
                break;

            case BCardType.CardType.Element:
                break;

            case BCardType.CardType.IncreaseDamage:
                break;

            case BCardType.CardType.Defence:
                break;

            case BCardType.CardType.DodgeAndDefencePercent:
                break;

            case BCardType.CardType.Block:
                break;

            case BCardType.CardType.Absorption:
                break;

            case BCardType.CardType.ElementResistance:
                break;

            case BCardType.CardType.EnemyElementResistance:
                break;

            case BCardType.CardType.Damage:
                break;

            case BCardType.CardType.GuarantedDodgeRangedAttack:
                break;

            case BCardType.CardType.Morale:
                break;

            case BCardType.CardType.Casting:
                break;

            case BCardType.CardType.Reflection:
                break;

            case BCardType.CardType.DrainAndSteal:
                break;

            case BCardType.CardType.HealingBurningAndCasting:
                var       subtype = (AdditionalTypes.HealingBurningAndCasting)SubType;
                Character sess;
                switch (subtype)
                {
                case AdditionalTypes.HealingBurningAndCasting.RestoreHP:
                case AdditionalTypes.HealingBurningAndCasting.RestoreHPWhenCasting:
                    if (session.GetSession() is Character)
                    {
                        sess = (Character)session.GetSession();
                        int  heal   = FirstData;
                        bool change = false;
                        if (IsLevelScaled)
                        {
                            if (IsLevelDivided)
                            {
                                heal /= sess.Level;
                            }
                            else
                            {
                                heal *= sess.Level;
                            }
                        }
                        if (sess.Hp + heal < sess.HpLoad())
                        {
                            sess.Hp += heal;
                            sess.Session?.CurrentMapInstance?.Broadcast(sess.GenerateRc(heal));
                            change = true;
                        }
                        else
                        {
                            if (sess.Hp != (int)sess.HpLoad())
                            {
                                sess.Session?.CurrentMapInstance?.Broadcast(sess.GenerateRc((int)(sess.HpLoad() - sess.Hp)));
                                change = true;
                            }
                            sess.Hp = (int)sess.HpLoad();
                        }
                        if (change)
                        {
                            sess.Session?.SendPacket(sess.GenerateStat());
                        }
                    }

                    if (session.GetSession() is Mate)
                    {
                        mate = (Mate)session.GetSession();
                        int heal = FirstData;
                        if (IsLevelScaled)
                        {
                            if (IsLevelDivided)
                            {
                                heal /= mate.Level;
                            }
                            else
                            {
                                heal *= mate.Level;
                            }
                        }
                        if (mate.Hp + heal < mate.HpLoad())
                        {
                            mate.Hp += heal;
                        }
                        else
                        {
                            mate.Hp = mate.HpLoad();
                        }
                    }

                    break;

                case AdditionalTypes.HealingBurningAndCasting.RestoreMP:
                    if (session.GetSession() is Character)
                    {
                        sess = (Character)session.GetSession();
                        int  heal   = FirstData;
                        bool change = false;
                        if (IsLevelScaled)
                        {
                            if (IsLevelDivided)
                            {
                                heal /= sess.Level;
                            }
                            else
                            {
                                heal *= sess.Level;
                            }
                        }
                        if (sess.Mp + heal < sess.MpLoad())
                        {
                            sess.Mp += heal;
                            change   = true;
                        }
                        else
                        {
                            if (sess.Mp != (int)sess.MpLoad())
                            {
                                change = true;
                            }
                            sess.Mp = (int)sess.MpLoad();
                        }
                        if (change)
                        {
                            sess.Session?.SendPacket(sess.GenerateStat());
                        }
                    }

                    if (session.GetSession() is Mate)
                    {
                        mate = (Mate)session.GetSession();
                        int heal = FirstData;
                        if (IsLevelScaled)
                        {
                            if (IsLevelDivided)
                            {
                                heal /= mate.Level;
                            }
                            else
                            {
                                heal *= mate.Level;
                            }
                        }
                        if (mate.Mp + heal < mate.MpLoad())
                        {
                            mate.Mp += heal;
                        }
                        else
                        {
                            mate.Mp = mate.MpLoad();
                        }
                    }
                    break;
                }
                break;

            case BCardType.CardType.HPMP:
                break;

            case BCardType.CardType.SpecialisationBuffResistance:
                break;

            case BCardType.CardType.SpecialEffects:
                break;

            case BCardType.CardType.Capture:
                if (session is MapMonster monsterToCapture && caster is Character hunter)
                {
                    if (monsterToCapture.Monster.RaceType == 1 && (hunter.MapInstance.MapInstanceType == MapInstanceType.BaseMapInstance || hunter.MapInstance.MapInstanceType == MapInstanceType.TimeSpaceInstance))
                    {
                        if (monsterToCapture.Monster.Level < hunter.Level)
                        {
                            if (monsterToCapture.CurrentHp < (monsterToCapture.Monster.MaxHP / 2))
                            {
                                if (hunter.MaxMateCount > hunter.Mates.Count())
                                {
                                    // Algo
                                    int capturerate = 100 - (monsterToCapture.CurrentHp / monsterToCapture.Monster.MaxHP + 1) / 2;
                                    if (ServerManager.Instance.RandomNumber() <= capturerate)
                                    {
                                        if (hunter.Quests.Any(q => q.Quest.QuestType == (int)QuestType.Capture1 && q.Quest.QuestObjectives.Any(d => d.Data == monsterToCapture.MonsterVNum)))
                                        {
                                            hunter.IncrementQuests(QuestType.Capture1, monsterToCapture.MonsterVNum);
                                            return;
                                        }
                                        hunter.IncrementQuests(QuestType.Capture2, monsterToCapture.MonsterVNum);
                                        int  level       = monsterToCapture.Monster.Level - 15 < 1 ? 1 : monsterToCapture.Monster.Level - 15;
                                        Mate currentmate = hunter.Mates?.FirstOrDefault(m => m.IsTeamMember && m.MateType == MateType.Pet);
                                        if (currentmate != null)
                                        {
                                            currentmate.RemoveTeamMember();     // remove current pet
                                            hunter.MapInstance.Broadcast(currentmate.GenerateOut());
                                        }
                                        monsterToCapture.MapInstance.DespawnMonster(monsterToCapture);
                                        NpcMonster mateNpc = ServerManager.Instance.GetNpc(monsterToCapture.MonsterVNum);
                                        mate = new Mate(hunter, mateNpc, (byte)level, MateType.Pet);
                                        hunter.Mates?.Add(mate);
                                        mate.RefreshStats();
                                        hunter.Session.SendPacket($"ctl 2 {mate.PetId} 3");
                                        hunter.MapInstance.Broadcast(mate.GenerateIn());
                                        hunter.Session.SendPacket(hunter.GenerateSay(string.Format(Language.Instance.GetMessageFromKey("YOU_GET_PET"), mate.Name), 0));
                                        hunter.Session.SendPacket(UserInterfaceHelper.Instance.GeneratePClear());
                                        hunter.Session.SendPackets(hunter.GenerateScP());
                                        hunter.Session.SendPackets(hunter.GenerateScN());
                                        hunter.Session.SendPacket(hunter.GeneratePinit());
                                        hunter.Session.SendPackets(hunter.Mates.Where(s => s.IsTeamMember)
                                                                   .OrderBy(s => s.MateType)
                                                                   .Select(s => s.GeneratePst()));
                                    }
                                    else
                                    {
                                        hunter.Session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("CAPTURE_FAILED"), 0));
                                    }
                                }
                                else
                                {
                                    hunter.Session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("MAX_MATES_COUNT"), 0));
                                }
                            }
                            else
                            {
                                hunter.Session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("monsterToCapture_MUST_BE_LOW_HP"), 0));
                            }
                        }
                        else
                        {
                            hunter.Session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("monsterToCapture_LVL_MUST_BE_LESS"), 0));
                        }
                    }
                    else
                    {
                        hunter.Session.SendPacket(UserInterfaceHelper.Instance.GenerateMsg(Language.Instance.GetMessageFromKey("monsterToCapture_CANNOT_BE_CAPTURED"), 0));
                    }
                }
                break;

            case BCardType.CardType.SpecialDamageAndExplosions:
                break;

            case BCardType.CardType.SpecialEffects2:
                break;

            case BCardType.CardType.CalculatingLevel:
                break;

            case BCardType.CardType.Recovery:
                break;

            case BCardType.CardType.MaxHPMP:
                break;

            case BCardType.CardType.MultAttack:
                break;

            case BCardType.CardType.MultDefence:
                break;

            case BCardType.CardType.TimeCircleSkills:
                break;

            case BCardType.CardType.RecoveryAndDamagePercent:
                break;

            case BCardType.CardType.Count:
                break;

            case BCardType.CardType.NoDefeatAndNoDamage:
                break;

            case BCardType.CardType.SpecialActions:
                if (session.GetSession() is Character charact)
                {
                    if (SubType.Equals((byte)AdditionalTypes.SpecialActions.Hide))
                    {
                        charact.Invisible = true;
                        charact.Mates.Where(s => s.IsTeamMember).ToList().ForEach(s => charact.Session.CurrentMapInstance?.Broadcast(s.GenerateOut()));
                        charact.Session.CurrentMapInstance?.Broadcast(charact.GenerateInvisible());
                    }
                }
                break;

            case BCardType.CardType.Mode:
                break;

            case BCardType.CardType.NoCharacteristicValue:
                break;

            case BCardType.CardType.LightAndShadow:
                break;

            case BCardType.CardType.Item:
                break;

            case BCardType.CardType.DebuffResistance:
                break;

            case BCardType.CardType.SpecialBehaviour:
                break;

            case BCardType.CardType.Quest:
                break;

            case BCardType.CardType.SecondSPCard:
                break;

            case BCardType.CardType.SPCardUpgrade:
                break;

            case BCardType.CardType.HugeSnowman:
                break;

            case BCardType.CardType.Drain:
                break;

            case BCardType.CardType.BossMonstersSkill:
                break;

            case BCardType.CardType.LordHatus:
                break;

            case BCardType.CardType.LordCalvinas:
                break;

            case BCardType.CardType.SESpecialist:
                break;

            case BCardType.CardType.FourthGlacernonFamilyRaid:
                break;

            case BCardType.CardType.SummonedMonsterAttack:
                break;

            case BCardType.CardType.BearSpirit:
                break;

            case BCardType.CardType.SummonSkill:
                break;

            case BCardType.CardType.InflictSkill:
                break;

            case BCardType.CardType.HideBarrelSkill:
                break;

            case BCardType.CardType.FocusEnemyAttentionSkill:
                break;

            case BCardType.CardType.TauntSkill:
                break;

            case BCardType.CardType.FireCannoneerRangeBuff:
                break;

            case BCardType.CardType.VulcanoElementBuff:
                break;

            case BCardType.CardType.DamageConvertingSkill:
                break;

            case BCardType.CardType.MeditationSkill:
                if (session.GetSession().GetType() == typeof(Character))
                {
                    if (SubType.Equals((byte)AdditionalTypes.MeditationSkill.CausingChance))
                    {
                        if (ServerManager.Instance.RandomNumber() < FirstData)
                        {
                            if (!(session is Character character))
                            {
                                break;
                            }
                            if (SkillVNum.HasValue)
                            {
                                character.LastSkillCombo = DateTime.Now;
                                Skill skill    = ServerManager.Instance.GetSkill(SkillVNum.Value);
                                Skill newSkill = ServerManager.Instance.GetSkill((short)SecondData);
                                Observable.Timer(TimeSpan.FromMilliseconds(100)).Subscribe(observer =>
                                {
                                    foreach (QuicklistEntryDTO qe in character.QuicklistEntries.Where(s =>
                                                                                                      s.Pos.Equals(skill.CastId)))
                                    {
                                        character.Session.SendPacket(
                                            $"qset {qe.Q1} {qe.Q2} {qe.Type}.{qe.Slot}.{newSkill.CastId}.0");
                                    }
                                    character.Session.SendPacket($"mslot {newSkill.CastId} -1");
                                });

                                if (skill.CastId > 10)
                                {
                                    // HACK this way
                                    Observable.Timer(TimeSpan.FromMilliseconds(skill.Cooldown * 100 + 500))
                                    .Subscribe(observer =>
                                    {
                                        character.Session.SendPacket($"sr {skill.CastId}");
                                    });
                                }
                            }
                        }
                    }
                    else
                    {
                        if (!(session is Character character))
                        {
                            break;
                        }
                        switch (SubType)
                        {
                        case 21:
                            character.MeditationDictionary[(short)SecondData] = DateTime.Now.AddSeconds(4);
                            break;

                        case 31:
                            character.MeditationDictionary[(short)SecondData] = DateTime.Now.AddSeconds(8);
                            break;

                        case 41:
                            character.MeditationDictionary[(short)SecondData] = DateTime.Now.AddSeconds(12);
                            break;
                        }
                    }
                }
                break;

            case BCardType.CardType.FalconSkill:
                break;

            case BCardType.CardType.AbsorptionAndPowerSkill:
                break;

            case BCardType.CardType.LeonaPassiveSkill:
                break;

            case BCardType.CardType.FearSkill:
                break;

            case BCardType.CardType.SniperAttack:
                break;

            case BCardType.CardType.FrozenDebuff:
                break;

            case BCardType.CardType.JumpBackPush:
                break;

            case BCardType.CardType.FairyXPIncrease:
                break;

            case BCardType.CardType.SummonAndRecoverHP:
                break;

            case BCardType.CardType.TeamArenaBuff:
                break;

            case BCardType.CardType.ArenaCamera:
                break;

            case BCardType.CardType.DarkCloneSummon:
                break;

            case BCardType.CardType.AbsorbedSpirit:
                break;

            case BCardType.CardType.AngerSkill:
                break;

            case BCardType.CardType.MeteoriteTeleport:
                break;

            case BCardType.CardType.StealBuff:
                break;

            default:
                Logger.Error(new ArgumentOutOfRangeException($"Card Type {Type} not defined!"));
                //throw new ArgumentOutOfRangeException();
                break;
            }
        }
Ejemplo n.º 12
0
        public void ApplyBCards(object session, object sender = null, short buffLevel = 0)
        {
            Type type = session.GetType();

            // int counterBuff = 0;

            switch ((BCardType.CardType)Type)
            {
            case BCardType.CardType.Buff:
            {
                if (type == typeof(Character) && session is Character character)
                {
                    Buff buff = null;
                    if (sender != null)
                    {
                        Type sType = sender.GetType();
                        if (sType == typeof(Character) && sender is Character sendingCharacter)
                        {
                            buff = new Buff((short)((short)SecondData + buffLevel), sendingCharacter.Level);

                            //Todo: Get anti stats from BCard
                        }
                    }
                    else
                    {
                        buff = new Buff((short)((short)SecondData + buffLevel), character.Level);
                    }

                    int anti = 0;
                    if (buff?.Card.BuffType == BuffType.Bad)
                    {
                        anti += character.ShellEffectArmor?.FirstOrDefault(s =>
                                                                           s.Effect == (byte)ShellArmorEffectType.ReducedAllNegativeEffect)?.Value ??
                                0;
                        switch (SecondData)
                        {
                        case 1:
                            anti += character.ShellEffectArmor?.FirstOrDefault(s =>
                                                                               s.Effect == (byte)ShellArmorEffectType
                                                                               .ReducedBleedingAndMinorBleeding)
                                    ?.Value ?? 0;
                            anti += character.ShellEffectArmor?.FirstOrDefault(s =>
                                                                               s.Effect == (byte)ShellArmorEffectType.ReducedAllBleedingType)
                                    ?.Value ?? 0;
                            break;

                        case 7:
                            anti += character.ShellEffectArmor
                                    ?.FirstOrDefault(s =>
                                                     s.Effect == (byte)ShellArmorEffectType.ReducedStun)?.Value ?? 0;
                            anti += character.ShellEffectArmor?.FirstOrDefault(s =>
                                                                               s.Effect == (byte)ShellArmorEffectType.ReducedAllStun)?.Value ?? 0;
                            break;

                        case 21:
                            anti += character.ShellEffectArmor?.FirstOrDefault(s =>
                                                                               s.Effect == (byte)ShellArmorEffectType.ReducedMinorBleeding)?.Value ??
                                    0;
                            anti += character.ShellEffectArmor?.FirstOrDefault(s =>
                                                                               s.Effect == (byte)ShellArmorEffectType
                                                                               .ReducedBleedingAndMinorBleeding)
                                    ?.Value ?? 0;
                            anti += character.ShellEffectArmor?.FirstOrDefault(s =>
                                                                               s.Effect == (byte)ShellArmorEffectType.ReducedAllBleedingType)
                                    ?.Value ?? 0;
                            break;

                        case 27:
                            anti += character.ShellEffectArmor?.FirstOrDefault(s =>
                                                                               s.Effect == (byte)ShellArmorEffectType.ReducedFreeze)?.Value ?? 0;
                            break;

                        case 42:
                            anti += character.ShellEffectArmor?.FirstOrDefault(s =>
                                                                               s.Effect == (byte)ShellArmorEffectType.ReducedAllBleedingType)
                                    ?.Value ?? 0;
                            break;

                        case 66:
                            anti += character.ShellEffectArmor?.FirstOrDefault(s =>
                                                                               s.Effect == (byte)ShellArmorEffectType.ReducedAllStun)?.Value ?? 0;
                            break;
                        }
                    }

                    if (ServerManager.RandomNumber() < FirstData / 100D * (100 - anti))
                    {
                        character.AddBuff(buff);
                    }
                }
                else if (type == typeof(MapMonster))
                {
                    if (ServerManager.RandomNumber() < FirstData && session is MapMonster mapMonster)
                    {
                        mapMonster.AddBuff(new Buff((short)((short)SecondData + buffLevel), mapMonster.Monster.Level));
                    }
                }
                else if (type == typeof(MapNpc))
                {
                }
                else if (type == typeof(Mate))
                {
                }
            }
            break;

            case BCardType.CardType.Move:
            {
                if (type == typeof(Character) && session is Character character)
                {
                    character.LastSpeedChange = DateTime.UtcNow;
                    character.Session.SendPacket(character.GenerateCond());
                }
            }
            break;

            case BCardType.CardType.Summons:
            {
                if (type == typeof(Character))
                {
                    // jajamaru spawn
                    if (session is Character character && character.MapInstance != null)
                    {
                        List <MonsterToSummon> summonParameters = new List <MonsterToSummon>();
                        for (int i = 0; i < FirstData; i++)
                        {
                            short x, y;
                            byte  t = 0;
                            do
                            {
                                x = (short)(ServerManager.RandomNumber(-3, 3) + character.PositionX);
                                y = (short)(ServerManager.RandomNumber(-3, 3) + character.PositionY);
                                t++;
                            } while (!character.MapInstance.Map.IsBlockedZone(x, y) && t < byte.MaxValue);
                            summonParameters.Add(new MonsterToSummon((short)SecondData, new MapCell {
                                    X = x, Y = y
                                },
                                                                     -1, true));
                        }

                        if (ServerManager.RandomNumber() <= Math.Abs(ThirdData) || ThirdData == 0)
                        {
                            switch (SubType)
                            {
                            case 2:
                                EventHelper.Instance.RunEvent(new EventContainer(
                                                                  character.Session.CurrentMapInstance, EventActionType.SpawnMonsters,
                                                                  summonParameters));
                                break;
                            }
                        }
                    }
                }
                else if (type == typeof(MapMonster))
                {
                    if (session is MapMonster mapMonster && mapMonster.MapInstance != null)
                    {
                        List <MonsterToSummon> summonParameters = new List <MonsterToSummon>();
                        for (int i = 0; i < FirstData; i++)
                        {
                            short x, y;
                            byte  t = 0;
                            do
                            {
                                x = (short)(ServerManager.RandomNumber(-3, 3) + mapMonster.MapX);
                                y = (short)(ServerManager.RandomNumber(-3, 3) + mapMonster.MapY);
                                t++;
                            } while (!mapMonster.MapInstance.Map.IsBlockedZone(x, y) && t < byte.MaxValue);
                            summonParameters.Add(new MonsterToSummon((short)SecondData, new MapCell {
                                    X = x, Y = y
                                },
                                                                     -1, true));
                        }

                        if (ServerManager.RandomNumber() <= Math.Abs(ThirdData) || ThirdData == 0)
                        {
                            switch (SubType)
                            {
                            case 2:
                                EventHelper.Instance.RunEvent(new EventContainer(mapMonster.MapInstance,
                                                                                 EventActionType.SpawnMonsters, summonParameters));
                                break;

                            default:
                                if (mapMonster.OnDeathEvents.All(s =>
                                                                 s.EventActionType != EventActionType.SpawnMonsters))
                                {
                                    mapMonster.OnDeathEvents.Add(new EventContainer(mapMonster.MapInstance,
                                                                                    EventActionType.SpawnMonsters, summonParameters));
                                }

                                break;
                            }
                        }
                    }
                }
                else if (type == typeof(MapNpc))
                {
                }
                else if (type == typeof(Mate))
                {
                }
            }
            break;

            case BCardType.CardType.SpecialAttack:
                break;

            case BCardType.CardType.SpecialDefence:
                break;

            case BCardType.CardType.AttackPower:
                break;

            case BCardType.CardType.Target:
                break;

            case BCardType.CardType.Critical:
                break;

            case BCardType.CardType.SpecialCritical:
                break;

            case BCardType.CardType.Element:
                break;

            case BCardType.CardType.IncreaseDamage:
                break;

            case BCardType.CardType.Defence:
                break;

            case BCardType.CardType.DodgeAndDefencePercent:
                break;

            case BCardType.CardType.Block:
                break;

            case BCardType.CardType.Absorption:
                break;

            case BCardType.CardType.ElementResistance:
                break;

            case BCardType.CardType.EnemyElementResistance:
                break;

            case BCardType.CardType.Damage:
                break;

            case BCardType.CardType.GuarantedDodgeRangedAttack:
                break;

            case BCardType.CardType.Morale:
                break;

            case BCardType.CardType.Casting:
                break;

            case BCardType.CardType.Reflection:
                break;

            case BCardType.CardType.DrainAndSteal:
                break;

            case BCardType.CardType.HealingBurningAndCasting:
            {
                if (type == typeof(Character))
                {
                    if (session is Character character && character.Hp > 0)
                    {
                        int bonus;
                        if (SubType == (byte)AdditionalTypes.HealingBurningAndCasting.RestoreHP / 10)
                        {
                            if (IsLevelScaled)
                            {
                                bonus = character.Level * FirstData;
                            }
                            else
                            {
                                bonus = FirstData;
                            }

                            if (character.Hp + bonus <= character.HPLoad())
                            {
                                character.Hp += bonus;
                            }
                            else
                            {
                                bonus        = (int)character.HPLoad() - character.Hp;
                                character.Hp = (int)character.HPLoad();
                            }

                            character.Session.CurrentMapInstance?.Broadcast(character.Session,
                                                                            character.GenerateRc(bonus));
                        }

                        if (SubType == (byte)AdditionalTypes.HealingBurningAndCasting.RestoreMP / 10)
                        {
                            if (IsLevelScaled)
                            {
                                bonus = character.Level * FirstData;
                            }
                            else
                            {
                                bonus = FirstData;
                            }

                            if (character.Mp + bonus <= character.MPLoad())
                            {
                                character.Mp += bonus;
                            }
                            else
                            {
                                character.Mp = (int)character.MPLoad();
                            }
                        }

                        character.Session.SendPacket(character.GenerateStat());
                    }
                }
                else if (type == typeof(MapMonster))
                {
                    if (ServerManager.RandomNumber() < FirstData && session is MapMonster mapMonster)
                    {
                        mapMonster.AddBuff(new Buff((short)SecondData, mapMonster.Monster.Level));
                    }
                }
                else if (type == typeof(MapNpc))
                {
                }
                else if (type == typeof(Mate))
                {
                }
            }
            break;

            case BCardType.CardType.Hpmp:
                if (type == typeof(Character))
                {
                    if (session is Character c)
                    {
                        switch (SubType)
                        {
                        case (byte)AdditionalTypes.Hpmp.RestoreDecreasedMP / 10:
                        {
                            int bonus = (int)(FirstData * c.MPLoad() / 100);

                            c.Mp = c.Mp + bonus > 1 ? c.Mp + bonus : c.Mp = 1;
                        }
                        break;
                        }
                    }
                }

                break;

            case BCardType.CardType.SpecialisationBuffResistance:
            {
                switch (SubType)
                {
                case (byte)AdditionalTypes.SpecialisationBuffResistance.RemoveBadEffects / 10:
                {
                    if (session is Character c &&              /*&& sender is ClientSession senderSession*/
                        ServerManager.RandomNumber() < Math.Abs(FirstData))
                    {
                        c.DisableBuffs(FirstData > 0 ? BuffType.Good : BuffType.Bad, SecondData);
                    }
                }
                break;
                }
            }
            break;

            case BCardType.CardType.SpecialEffects:
                break;

            case BCardType.CardType.Capture:
            {
                if (type == typeof(MapMonster) && session is MapMonster mapMonster &&
                    sender is ClientSession senderSession)
                {
                    NpcMonster mateNpc = ServerManager.GetNpcMonster(mapMonster.MonsterVNum);
                    if (mateNpc != null)
                    {
                        if (mapMonster.Monster.Catch)
                        {
                            if (mapMonster.IsAlive &&
                                mapMonster.CurrentHp <= (int)((double)mapMonster.MaxHp / 2))
                            {
                                if (mapMonster.Monster.Level < senderSession.Character.Level)
                                {
                                    // TODO: find a new algorithm
                                    int[] chance = { 100, 80, 60, 40, 20, 0 };
                                    if (ServerManager.RandomNumber() < chance[ServerManager.RandomNumber(0, 5)])
                                    {
                                        Mate mate = new Mate(senderSession.Character, mateNpc,
                                                             (byte)(mapMonster.Monster.Level - 15 > 0
                                                        ? mapMonster.Monster.Level - 15
                                                        : 1), MateType.Pet);
                                        if (senderSession.Character.CanAddMate(mate))
                                        {
                                            senderSession.Character.AddPetWithSkill(mate);
                                            senderSession.SendPacket(
                                                UserInterfaceHelper.GenerateMsg(
                                                    Language.Instance.GetMessageFromKey("CATCH_SUCCESS"), 0));
                                            senderSession.CurrentMapInstance?.Broadcast(
                                                StaticPacketHelper.GenerateEff(UserType.Player,
                                                                               senderSession.Character.CharacterId, 197));
                                            senderSession.CurrentMapInstance?.Broadcast(
                                                StaticPacketHelper.SkillUsed(UserType.Player,
                                                                             senderSession.Character.CharacterId, 3,
                                                                             mapMonster.MapMonsterId, -1, 0, 15, -1, -1, -1, true,
                                                                             (int)(mapMonster.CurrentHp / (float)mapMonster.MaxHp * 100
                                                                                   ), 0, -1, 0));
                                            mapMonster.SetDeathStatement();
                                            senderSession.CurrentMapInstance?.Broadcast(
                                                StaticPacketHelper.Out(UserType.Monster,
                                                                       mapMonster.MapMonsterId));
                                        }
                                        else
                                        {
                                            senderSession.SendPacket(
                                                senderSession.Character.GenerateSay(
                                                    Language.Instance.GetMessageFromKey("PET_SLOT_FULL"), 10));
                                            senderSession.SendPacket(
                                                StaticPacketHelper.Cancel(2, mapMonster.MapMonsterId));
                                        }
                                    }
                                    else
                                    {
                                        senderSession.SendPacket(
                                            UserInterfaceHelper.GenerateMsg(
                                                Language.Instance.GetMessageFromKey("CATCH_FAIL"), 0));
                                        senderSession.CurrentMapInstance?.Broadcast(
                                            StaticPacketHelper.SkillUsed(UserType.Player,
                                                                         senderSession.Character.CharacterId, 3, mapMonster.MapMonsterId,
                                                                         -1, 0, 15, -1, -1, -1, true,
                                                                         (int)(mapMonster.CurrentHp / (float)mapMonster.MaxHp * 100),
                                                                         0, -1, 0));
                                    }
                                }
                                else
                                {
                                    senderSession.SendPacket(UserInterfaceHelper.GenerateMsg(
                                                                 Language.Instance.GetMessageFromKey("LEVEL_LOWER_THAN_MONSTER"), 0));
                                    senderSession.SendPacket(
                                        StaticPacketHelper.Cancel(2, mapMonster.MapMonsterId));
                                }
                            }
                            else
                            {
                                senderSession.SendPacket(UserInterfaceHelper.GenerateMsg(
                                                             Language.Instance.GetMessageFromKey("CURRENT_HP_TOO_HIGH"), 0));
                                senderSession.SendPacket(StaticPacketHelper.Cancel(2, mapMonster.MapMonsterId));
                            }
                        }
                        else
                        {
                            senderSession.SendPacket(UserInterfaceHelper.GenerateMsg(
                                                         Language.Instance.GetMessageFromKey("MONSTER_CANT_BE_CAPTURED"), 0));
                            senderSession.SendPacket(StaticPacketHelper.Cancel(2, mapMonster.MapMonsterId));
                        }
                    }
                }
            }
            break;

            case BCardType.CardType.SpecialDamageAndExplosions:
                break;

            case BCardType.CardType.SpecialEffects2:
                if (type == typeof(Character))
                {
                    if (session is Character c)
                    {
                        short destinationX = c.PositionX;
                        short destinationY = c.PositionY;
                        switch (SubType)
                        {
                        case (byte)AdditionalTypes.SpecialEffects2.TeleportInRadius / 10:
                        {
                            switch (c.Direction)
                            {
                            case 0:
                                // -y
                                destinationY -= (short)FirstData;
                                break;

                            case 1:
                                // +x
                                destinationX += (short)FirstData;
                                break;

                            case 2:
                                // +y
                                destinationY += (short)FirstData;
                                break;

                            case 3:
                                // -x
                                destinationX -= (short)FirstData;
                                break;

                            case 4:
                                // -x -y
                                destinationX -= (short)FirstData;
                                destinationY -= (short)FirstData;
                                break;

                            case 5:
                                // +x +y
                                destinationX += (short)FirstData;
                                destinationY += (short)FirstData;
                                break;

                            case 6:
                                // +x -y
                                destinationX += (short)FirstData;
                                destinationY -= (short)FirstData;
                                break;

                            case 7:
                                // -x +y
                                destinationX -= (short)FirstData;
                                destinationY += (short)FirstData;
                                break;
                            }

                            ServerManager.Instance.TeleportForward(c.Session, c.MapInstanceId, destinationX,
                                                                   destinationY);
                        }
                        break;
                        }
                    }
                }

                break;

            case BCardType.CardType.CalculatingLevel:
                break;

            case BCardType.CardType.Recovery:
                break;

            case BCardType.CardType.MaxHpmp:
                break;

            case BCardType.CardType.MultAttack:
                break;

            case BCardType.CardType.MultDefence:
                break;

            case BCardType.CardType.TimeCircleSkills:
                break;

            case BCardType.CardType.RecoveryAndDamagePercent:
                break;

            case BCardType.CardType.Count:
                break;

            case BCardType.CardType.NoDefeatAndNoDamage:
                break;

            case BCardType.CardType.SpecialActions:
            {
                switch (SubType)
                {
                case (byte)AdditionalTypes.SpecialActions.RunAway / 10:
                    if (session is MapMonster m)
                    {
                        m.MapInstance.Broadcast(StaticPacketHelper.Say(UserType.Monster, m.MapMonsterId, 0, "!!!"));
                        m.RemoveTarget();
                        for (int i = 0; i < 10; i++)
                        {
                            Observable.Timer(TimeSpan.FromSeconds(i)).Subscribe(o =>
                                {
                                    m.MapX++;
                                    m.MapY++;
                                    m.IgnoreTargetsUntil = DateTime.UtcNow.AddSeconds(10);
                                    m.RemoveTarget();
                                });
                        }
                    }
                    break;
                }
            }
            break;

            case BCardType.CardType.Mode:
                break;

            case BCardType.CardType.NoCharacteristicValue:
                break;

            case BCardType.CardType.LightAndShadow:
            {
                switch (SubType)
                {
                case (byte)AdditionalTypes.LightAndShadow.RemoveBadEffects / 10:
                {
                    if (session is Character c /*&& sender is ClientSession senderSession*/)
                    {
                        c.DisableBuffs(BuffType.Bad, FirstData);
                    }
                }
                break;
                }
            }
            break;

            case BCardType.CardType.Item:
                break;

            case BCardType.CardType.DebuffResistance:
                break;

            case BCardType.CardType.SpecialBehaviour:
                break;

            case BCardType.CardType.Quest:
                break;

            case BCardType.CardType.SecondSpCard:
                break;

            case BCardType.CardType.SpCardUpgrade:
                break;

            case BCardType.CardType.HugeSnowman:
                break;

            case BCardType.CardType.Drain:
                break;

            case BCardType.CardType.BossMonstersSkill:
                break;

            case BCardType.CardType.LordHatus:
                break;

            case BCardType.CardType.LordCalvinas:
                break;

            case BCardType.CardType.SeSpecialist:
                break;

            case BCardType.CardType.FourthGlacernonFamilyRaid:
                break;

            case BCardType.CardType.SummonedMonsterAttack:
                break;

            case BCardType.CardType.BearSpirit:
                break;

            case BCardType.CardType.SummonSkill:
                break;

            case BCardType.CardType.InflictSkill:
                break;

            case BCardType.CardType.HideBarrelSkill:
                break;

            case BCardType.CardType.FocusEnemyAttentionSkill:
                break;

            case BCardType.CardType.TauntSkill:
                break;

            case BCardType.CardType.FireCannoneerRangeBuff:
                break;

            case BCardType.CardType.VulcanoElementBuff:
                break;

            case BCardType.CardType.DamageConvertingSkill:
                break;

            case BCardType.CardType.MeditationSkill:
            {
                if (type == typeof(Character) && session is Character character)
                {
                    if (SkillVNum.HasValue &&
                        SubType.Equals((byte)AdditionalTypes.MeditationSkill.CausingChance / 10) &&
                        ServerManager.RandomNumber() < FirstData)
                    {
                        Skill skill    = ServerManager.GetSkill(SkillVNum.Value);
                        Skill newSkill = ServerManager.GetSkill((short)SecondData);
                        Observable.Timer(TimeSpan.FromMilliseconds(100)).Subscribe(observer =>
                            {
                                foreach (QuicklistEntryDTO quicklistEntry in character.QuicklistEntries.Where(s =>
                                                                                                              s.Morph == character.Morph && s.Pos.Equals(skill.CastId)))
                                {
                                    character.Session.SendPacket(
                                        $"qset {quicklistEntry.Q1} {quicklistEntry.Q2} {quicklistEntry.Type}.{quicklistEntry.Slot}.{newSkill.CastId}.0");
                                }

                                character.Session.SendPacket($"mslot {newSkill.CastId} -1");
                            });
                        character.SkillComboCount++;
                        character.LastSkillComboUse = DateTime.UtcNow;
                        if (skill.CastId > 10)
                        {
                            // HACK this way
                            Observable.Timer(TimeSpan.FromMilliseconds((skill.Cooldown * 100) + 500))
                            .Subscribe(observer =>
                                       character.Session.SendPacket(StaticPacketHelper.SkillReset(skill.CastId)));
                        }
                    }

                    switch (SubType)
                    {
                    case 2:
                        character.MeditationDictionary[(short)SecondData] = DateTime.UtcNow.AddSeconds(4);
                        break;

                    case 3:
                        character.MeditationDictionary[(short)SecondData] = DateTime.UtcNow.AddSeconds(8);
                        break;

                    case 4:
                        character.MeditationDictionary[(short)SecondData] = DateTime.UtcNow.AddSeconds(12);
                        break;
                    }
                }
            }
            break;

            case BCardType.CardType.FalconSkill:
            {
                if (session is Character c)
                {
                    switch (SubType)
                    {
                    case (byte)AdditionalTypes.FalconSkill.Hide:
                        c.Invisible = true;
                        c.Mates.Where(s => s.IsTeamMember).ToList().ForEach(s =>
                                                                            c.Session.CurrentMapInstance?.Broadcast(s.GenerateOut()));
                        c.Session.CurrentMapInstance?.Broadcast(c.GenerateInvisible());
                        c.Session.SendPacket(c.GenerateEq());
                        break;
                    }
                }
            }
            break;

            case BCardType.CardType.AbsorptionAndPowerSkill:
                break;

            case BCardType.CardType.LeonaPassiveSkill:
                break;

            case BCardType.CardType.FearSkill:
                break;

            case BCardType.CardType.SniperAttack:
                break;

            case BCardType.CardType.FrozenDebuff:
                break;

            case BCardType.CardType.JumpBackPush:
                break;

            case BCardType.CardType.FairyXPIncrease:
                break;

            case BCardType.CardType.SummonAndRecoverHP:
                break;

            case BCardType.CardType.TeamArenaBuff:
                break;

            case BCardType.CardType.ArenaCamera:
                break;

            case BCardType.CardType.DarkCloneSummon:
                break;

            case BCardType.CardType.AbsorbedSpirit:
                break;

            case BCardType.CardType.AngerSkill:
                break;

            case BCardType.CardType.MeteoriteTeleport:
                if (type == typeof(Character))
                {
                    if (session is Character character)
                    {
                        switch (SubType)
                        {
                        case ((byte)AdditionalTypes.MeteoriteTeleport.TeleportYouAndGroupToSavedLocation / 10):
                            if (character.TeleportSet == false)
                            {
                                character.TeleportX   = character.PositionX;
                                character.TeleportY   = character.PositionY;
                                character.TeleportMap = character.MapId;
                                character.MapInstance.Broadcast(StaticPacketHelper.GenerateEff(UserType.Player, character.CharacterId, 4497));
                                character.TeleportSet = true;
                                Observable.Timer(TimeSpan.FromSeconds(40)).Subscribe(o => character.TeleportSet = false);
                            }
                            else
                            {
                                if (character.MapInstance.IsPvp)
                                {
                                    if (character.MapInstance.MapInstanceType != MapInstanceType.BaseMapInstance)
                                    {
                                        character.TeleportSet = false;
                                        return;
                                    }

                                    character.MapInstance.Broadcast($"tp 1 {character.CharacterId} {character.TeleportX} {character.TeleportY} 0");
                                    character.PositionX   = character.TeleportX;
                                    character.PositionY   = character.TeleportY;
                                    character.TeleportSet = false;
                                }
                                else
                                {
                                    if (character.MapId == character.TeleportMap)
                                    {
                                        if (character.MapInstance.MapInstanceType == MapInstanceType.CaligorInstance)
                                        {
                                            character.TeleportSet = false;
                                            return;
                                        }
                                        character.MapInstance.Broadcast($"tp 1 {character.CharacterId} {character.TeleportX} {character.TeleportY} 0");
                                        character.PositionX   = character.TeleportX;
                                        character.PositionY   = character.TeleportY;
                                        character.TeleportSet = false;
                                    }
                                    else
                                    {
                                        character.TeleportSet = false;
                                    }
                                }
                            }
                            break;

                        case (byte)AdditionalTypes.MeteoriteTeleport.CauseMeteoriteFall / 10:
                        {
                            int amount = 10 + (character.Level / FirstData);

                            for (int i = 0; i < amount; i++)
                            {
                                Observable.Timer(TimeSpan.FromMilliseconds(i * 500)).Subscribe(o => character.SpawnMeteorite());
                            }
                        }
                        break;
                        }
                    }
                }
                break;

            case BCardType.CardType.StealBuff:
                break;

            case BCardType.CardType.Unknown:
                break;

            case BCardType.CardType.EffectSummon:
                break;

            default:
                Logger.Warn($"Card Type {Type} not defined!");
                break;
            }
        }