Example #1
0
        /*
         * [XmlAttribute]
         * [DefaultValue(null)]
         * public HitType attacktype;
         *
         *
         * [XmlAttribute]
         * public int probability;
         *
         *
         * [XmlAttribute]
         * [DefaultValue(null)]
         * public string hittype;
         */

        public override void Import(ClientEffect importObject, IEnumerable <FieldInfo> getters)
        {
            base.Import(importObject, getters);
            percent = importObject.reserved[5] != null && importObject.reserved[5].Trim() == "1";
            if (importObject.cond_race != null)
            {
                cond_race = (SkillTargetRace)Enum.Parse(typeof(SkillTargetRace), importObject.cond_race.Trim(),
                                                        true);
            }

            HitType hitType = (HitType)Enum.Parse(typeof(HitType), importObject.reserved_cond1.Trim(), true);

            /*
             *          if (Enum.IsDefined(typeof(HitType), hitType)) {
             *                  attacktype = (AttackType)hitType;
             *                  probability = importObject.reserved_cond1_prob[1].Value;
             *          }
             *
             *
             *          if (importObject.reserved_cond1 != null) {
             *                  string type = importObject.reserved_cond1.Trim().ToUpper();
             *                  if (type != "EVERYHIT") this.hittype = type;
             *          }
             */

            if (this.GetType().Equals(typeof(ProtectEffect)) ||
                this.GetType().Equals(typeof(ReflectorEffect)))
            {
                if (importObject.reserved[8] == null)
                {
                    if (importObject.reserved[7] != null)
                    {
                        value = Int32.Parse(importObject.reserved[7].Trim());
                    }
                    if (importObject.reserved[6] != null)
                    {
                        delta = Int32.Parse(importObject.reserved[6].Trim());
                    }
                }
                else
                {
                    value = Int32.Parse(importObject.reserved[8].Trim());
                    delta = Int32.Parse(importObject.reserved[7].Trim());
                }
            }
            else if (this.GetType() != typeof(ProvokerEffect))
            {
                value = Int32.Parse(importObject.reserved[7].Trim());
                if (importObject.reserved[6] != null)
                {
                    delta = Int32.Parse(importObject.reserved[6].Trim());
                }
                hitvalue = Int32.Parse(importObject.reserved[1].Trim());
                if (importObject.reserved[0] != null)
                {
                    hitdelta = Int32.Parse(importObject.reserved[0].Trim());
                }
            }
        }
Example #2
0
        public override void Import(ClientEffect importObject, IEnumerable<FieldInfo> getters)
        {
            base.Import(importObject, getters);
            percent = importObject.reserved[5] != null && importObject.reserved[5].Trim() == "1";
            if (importObject.cond_race != null)
                cond_race = (SkillTargetRace)Enum.Parse(typeof(SkillTargetRace), importObject.cond_race.Trim(),
                                                        true);

            HitType hitType = (HitType)Enum.Parse(typeof(HitType), importObject.reserved_cond1.Trim(), true);
            if (Enum.IsDefined(typeof(HitType), hitType)) {
                attacktype = (AttackType)hitType;
                probability = importObject.reserved_cond1_prob[1].Value;
            }
            if (this.GetType().Equals(typeof(ProtectEffect)) ||
                this.GetType().Equals(typeof(ReflectorEffect))) {
                if (importObject.reserved[8] == null) {
                    if (importObject.reserved[7] != null)
                        value = Int32.Parse(importObject.reserved[7].Trim());
                    if (importObject.reserved[6] != null)
                        delta = Int32.Parse(importObject.reserved[6].Trim());
                } else {
                    value = Int32.Parse(importObject.reserved[8].Trim());
                    delta = Int32.Parse(importObject.reserved[7].Trim());
                }
            } else if (this.GetType() != typeof(ProvokerEffect)) {
                value = Int32.Parse(importObject.reserved[7].Trim());
                delta = Int32.Parse(importObject.reserved[6].Trim());
                hitvalue = Int32.Parse(importObject.reserved[1].Trim());
                hitdelta = Int32.Parse(importObject.reserved[0].Trim());
            }
        }
Example #3
0
        public void AddModifiers(string condition, ClientEffect importObject, int valuePos, int deltaPos)
        {
            string[] condParts = condition.Split(new string[] { ",", " " }, StringSplitOptions.RemoveEmptyEntries);
            this.modifiers = new ActionModifiers();

            foreach (string cond in condParts)
            {
                if (cond.StartsWith("_race_"))
                {
                    string          race       = cond.Remove(0, 6);
                    SkillTargetRace targetRace = SkillTargetRace.PC_ALL;
                    if (race == "pc_light")
                    {
                        targetRace = SkillTargetRace.ELYOS;
                    }
                    else if (race == "pc_dark")
                    {
                        targetRace = SkillTargetRace.ASMODIANS;
                    }
                    else
                    {
                        targetRace = (SkillTargetRace)Enum.Parse(typeof(SkillTargetRace), race, true);
                    }
                    if (targetRace != SkillTargetRace.PC_ALL)
                    {
                        if (this.modifiers.targetrace == null)
                        {
                            this.modifiers.targetrace = new List <TargetRaceDamageModifier>();
                        }
                        var mod = new TargetRaceDamageModifier();
                        mod.race = targetRace;
                        if (importObject.reserved[valuePos] != null)
                        {
                            mod.value = Int32.Parse(importObject.reserved[valuePos].Trim());
                        }
                        if (importObject.reserved[deltaPos] != null)
                        {
                            mod.delta = Int32.Parse(importObject.reserved[deltaPos].Trim());
                        }
                        this.modifiers.targetrace.Add(mod);
                    }
                }
                else
                {
                    try {
                        TargetState targetState = new NamedEnum <TargetState>(cond);
                        if (targetState == TargetState.BACK)
                        {
                            this.modifiers.backdamage       = new BackDamageModifier();
                            this.modifiers.backdamage.value = Int32.Parse(importObject.reserved[valuePos].Trim());
                            this.modifiers.backdamage.delta = Int32.Parse(importObject.reserved[deltaPos].Trim());
                        }
                        else if (targetState == TargetState.FRONT)
                        {
                            this.modifiers.frontdamage       = new FrontDamageModifier();
                            this.modifiers.frontdamage.value = Int32.Parse(importObject.reserved[valuePos].Trim());
                            this.modifiers.frontdamage.delta = Int32.Parse(importObject.reserved[deltaPos].Trim());
                        }
                        else if (targetState == TargetState.FLYING)
                        {
                            this.modifiers.flyingdamage = new FlyingDamageModifier();
                            if (importObject.reserved[valuePos] != null)
                            {
                                this.modifiers.flyingdamage.value = Int32.Parse(importObject.reserved[valuePos].Trim());
                            }
                            if (importObject.reserved[deltaPos] != null)
                            {
                                this.modifiers.flyingdamage.delta = Int32.Parse(importObject.reserved[deltaPos].Trim());
                            }
                        }
                        else if (targetState == TargetState.NON_FLYING)
                        {
                            this.modifiers.nonflyingdamage = new NonFlyingDamageModifier();
                            if (importObject.reserved[valuePos] != null)
                            {
                                this.modifiers.nonflyingdamage.value = Int32.Parse(importObject.reserved[valuePos].Trim());
                            }
                            if (importObject.reserved[deltaPos] != null)
                            {
                                this.modifiers.nonflyingdamage.delta = Int32.Parse(importObject.reserved[deltaPos].Trim());
                            }
                        }
                        else
                        {
                            if (this.modifiers.abnormaldamage == null)
                            {
                                this.modifiers.abnormaldamage = new List <AbnormalDamageModifier>();
                            }
                            var abnormaldamage = new AbnormalDamageModifier();
                            abnormaldamage.type = targetState;
                            if (importObject.reserved[valuePos] != null)
                            {
                                abnormaldamage.value = Int32.Parse(importObject.reserved[valuePos].Trim());
                            }
                            if (importObject.reserved[deltaPos] != null)
                            {
                                abnormaldamage.delta = Int32.Parse(importObject.reserved[deltaPos].Trim());
                            }
                            this.modifiers.abnormaldamage.Add(abnormaldamage);
                        }
                        if (condParts.Length > 1)
                        {
                            Debug.Print("WARN: More than 1 modifier for skill: {0}", importObject.Skill.id);
                        }
                    } catch {
                        Debug.Print("Modifier '{0}' not handled", cond);
                    }
                }
            }

            if (!this.modifiers.Present)
            {
                this.modifiers = null;
            }
        }