Exemplo n.º 1
0
    private void ProcessBuffs()
    {
        Color avatarColor = GameDefines.defaultAvatarColor;

        foreach (var kvp in bufDct)
        {
            ClientServerCommon.Buff buffCfg = ConfigDatabase.DefaultCfg.ActionConfig.GetBuffById(kvp.Value.bufID);
            if (buffCfg == null)
            {
                continue;
            }

            for (int modifierSetIdx = 0; modifierSetIdx < buffCfg.modifierSets.Count; ++modifierSetIdx)
            {
                ClientServerCommon.PropertyModifierSet modifierSetCfg = buffCfg.modifierSets[modifierSetIdx];

                for (int idx = 0; idx < modifierSetCfg.modifiers.Count; ++idx)
                {
                    PropertyModifier modifier = modifierSetCfg.modifiers[idx];
                    if (modifier.type != PropertyModifier._Type.ColorModifier)
                    {
                        continue;
                    }
                    avatarColor = new UnityEngine.Color(modifier.color.r, modifier.color.g, modifier.color.b, modifier.color.a);
                }
            }
        }

        avatar.SetColor(avatarColor);
    }
Exemplo n.º 2
0
 public static void replacePropertyModifierHp(PropertyModifierSet propertyModifierSet, int hp)
 {
     if ((propertyModifierSet.modifiers != null) && (propertyModifierSet.modifiers.Count >= 1))
     {
         propertyModifierSet.modifiers[0].attributeValue = hp;
     }
 }
Exemplo n.º 3
0
 private AssembleSetting.Assemble LoadSuiteAssembleFromXml(SecurityElement element)
 {
     return(new AssembleSetting.Assemble {
         RequiredCount = StrParser.ParseDecInt(element.Attribute("RequiredCount"), 0),
         AssembleEffectDesc = StrParser.ParseStr(element.Attribute("AssembleEffectDesc"), string.Empty, true),
         ModifierSet = PropertyModifierSet.LoadFromXml(element.SearchForChildByTag("ModifierSet")),
         AssemblePower = StrParser.ParseDecInt(element.Attribute("AssemblePower"), 0),
         AssemblePowerPercent = StrParser.ParseFloat(element.Attribute("AssemblePowerPercent"), 0f)
     });
 }
Exemplo n.º 4
0
        private Npc LoadNpcFromXml(SecurityElement element)
        {
            Npc npc = new Npc {
                id                = StrParser.ParseHexInt(element.Attribute("Id"), 0),
                level             = StrParser.ParseDecInt(element.Attribute("Level"), 1),
                avatarId          = StrParser.ParseHexInt(element.Attribute("AvatarId"), 0),
                breakthroughLevel = StrParser.ParseDecInt(element.Attribute("BreakthroughLevel"), 0),
                name              = StrParser.ParseStr(element.Attribute("Name"), "NPCNAME")
            };

            npc.evaluation              = StrParser.ParseDecInt(element.Attribute("Evaluation"), npc.evaluation);
            npc.avatarDefaultSkillId    = StrParser.ParseHexInt(element.Attribute("AvatarDefaultSkillId"), npc.avatarDefaultSkillId);
            npc.avatarDefaultSkillLevel = StrParser.ParseDecInt(element.Attribute("AvatarDefaultSkillLevel"), npc.avatarDefaultSkillLevel);
            npc.breakthroughLevel       = StrParser.ParseDecInt(element.Attribute("BreakthroughLevel"), 0);
            npc.scale = StrParser.ParseFloat(element.Attribute("Scale"), 0f);
            if (element.Children != null)
            {
                foreach (SecurityElement element2 in element.Children)
                {
                    string tag = element2.Tag;
                    if (tag != null)
                    {
                        if (tag != "Equipment")
                        {
                            if (tag == "Attribute")
                            {
                                goto Label_017F;
                            }
                            if (tag == "Skill")
                            {
                                goto Label_0192;
                            }
                            if (tag == "ModifierSet")
                            {
                                goto Label_01A6;
                            }
                        }
                        else
                        {
                            npc.equipments.Add(this.LoadEquipmentFromXml(element2));
                        }
                    }
                    continue;
Label_017F:
                    npc.attribs.Add(ClientServerCommon.Attribute.LoadFromXml(element2));
                    continue;
Label_0192:
                    npc.skills.Add(this.LoadSkillFromXml(element2));
                    continue;
Label_01A6:
                    npc.modifierSet = PropertyModifierSet.LoadFromXml(element2);
                }
            }
            return(npc);
        }
Exemplo n.º 5
0
        public static PropertyModifierSet CopyFrom(PropertyModifierSet other)
        {
            PropertyModifierSet set = new PropertyModifierSet {
                levelFilter = other.levelFilter
            };

            foreach (PropertyModifier modifier in other.modifiers)
            {
                set.modifiers.Add(PropertyModifier.CopyFrom(modifier));
            }
            return(set);
        }
Exemplo n.º 6
0
        private ClientServerCommon.Buff LoadBuffFromXml(SecurityElement element, int sourceTurnId)
        {
            ClientServerCommon.Buff buff = new ClientServerCommon.Buff {
                id                = StrParser.ParseHexInt(element.Attribute("Id"), 0),
                buffType          = TypeNameContainer <ClientServerCommon.Buff._BuffType> .Parse(element.Attribute("BuffType"), 1),
                superpositionType = TypeNameContainer <ClientServerCommon.Buff._SuperpositionType> .Parse(element.Attribute("SuperpositionType"), 1),
                conflictStrategy  = TypeNameContainer <ClientServerCommon.Buff._ConflictStrategy> .Parse(element.Attribute("ConflictStrategy"), 1),
                uiName            = StrParser.ParseStr(element.Attribute("UIName"), "")
            };
            if (element.Children != null)
            {
                foreach (SecurityElement element2 in element.Children)
                {
                    AvatarAction.Effect effect;
                    AvatarAction        action;
                    string tag = element2.Tag;
                    if (tag != null)
                    {
                        if (tag != "ModifierSet")
                        {
                            if (tag == "Effect")
                            {
                                goto Label_00F1;
                            }
                            if (tag == "Action")
                            {
                                goto Label_010A;
                            }
                        }
                        else
                        {
                            buff.modifierSets.Add(PropertyModifierSet.LoadFromXml(element2));
                        }
                    }
                    continue;
Label_00F1:
                    effect = this.LoadEffectFromXml(element2);
                    if (effect != null)
                    {
                        buff.effects.Add(effect);
                    }
                    continue;
Label_010A:
                    action = this.LoadActionFromXml(element2, sourceTurnId);
                    if (action != null)
                    {
                        buff.actions.Add(action);
                    }
                }
            }
            return(buff);
        }
Exemplo n.º 7
0
        public static PropertyModifierSet genPropertyModifierSetBySp(int sp)
        {
            PropertyModifierSet set = new PropertyModifierSet {
                _levelFilter = 0
            };
            PropertyModifier mf = new PropertyModifier {
                type           = 1,
                attributeType  = 0x11,
                modifyType     = 1,
                attributeValue = sp
            };

            set.AddOneModifier(mf);
            return(set);
        }
Exemplo n.º 8
0
        public static PropertyModifierSet LoadFromXml(SecurityElement element)
        {
            PropertyModifierSet set = new PropertyModifierSet {
                levelFilter = StrParser.ParseDecInt(element.Attribute("LevelFilter"), 0)
            };

            if (element.Children != null)
            {
                foreach (SecurityElement element2 in element.Children)
                {
                    if (element2.Tag == "Modifier")
                    {
                        set.modifiers.Add(PropertyModifier.LoadFromXml(element2));
                    }
                }
            }
            return(set);
        }
Exemplo n.º 9
0
        public static List <PropertyModifier> GetIncreasedModifier(List <PropertyModifierSet> increaseList, int step)
        {
            PropertyModifierSet set = null;

            foreach (PropertyModifierSet set2 in increaseList)
            {
                if (((set == null) || (set._levelFilter <= set2._levelFilter)) && (step >= set2._levelFilter))
                {
                    set = set2;
                }
            }
            List <PropertyModifier> list = new List <PropertyModifier>();

            if (set != null)
            {
                foreach (PropertyModifier modifier in set.modifiers)
                {
                    PropertyModifier item = PropertyModifier.CopyFrom(modifier);
                    item.attributeValue += (step - set._levelFilter) * modifier.attributeIncrease;
                    list.Add(item);
                }
            }
            return(list);
        }
Exemplo n.º 10
0
        private Buff LoadBuffFromXml(SecurityElement element)
        {
            Buff buff = new Buff {
                id = StrParser.ParseHexInt(element.Attribute("Id"), 0),
                meridianPowerPercent = StrParser.ParseFloat(element.Attribute("MeridianPowerPercent"), 0f)
            };

            if (element.Children != null)
            {
                foreach (SecurityElement element2 in element.Children)
                {
                    string str;
                    if (((str = element2.Tag) != null) && (str == "ModifierSet"))
                    {
                        PropertyModifierSet set = PropertyModifierSet.LoadFromXml(element2);
                        if (buff.modifierSet == null)
                        {
                            buff.modifierSet = set;
                        }
                    }
                }
            }
            return(buff);
        }
Exemplo n.º 11
0
 public List <PropertyModifier> GetLevelModifers(int level)
 {
     return(PropertyModifierSet.GetIncreasedModifier(this._levelModiferSets, level));
 }
Exemplo n.º 12
0
        private Skill LoadSkillFromXml(SecurityElement element)
        {
            Skill skill = new Skill {
                id           = StrParser.ParseHexInt(element.Attribute("Id"), 0),
                type         = TypeNameContainer <CombatTurn._Type> .Parse(element.Attribute("Type"), 0),
                sortIndex    = StrParser.ParseDecInt(element.Attribute("SortIndex"), 0),
                qualityLevel = StrParser.ParseDecInt(element.Attribute("QualityLevel"), 0)
            };

            skill.uiPfxName = StrParser.ParseStr(element.Attribute("UIPfxName"), skill.uiPfxName);
            skill.needSkillScrollToRobShow = StrParser.ParseBool(element.Attribute("NeedSkillScrollToRobShow"), false);
            skill.activeableAssembleDesc   = StrParser.ParseStr(element.Attribute("ActiveableAssembleDesc"), string.Empty);
            skill.isSuperSkill             = StrParser.ParseBool(element.Attribute("IsSuperSkill"), false);
            skill.roleVoiceName            = element.Attribute("RoleVoiceName");
            if (element.Children != null)
            {
                foreach (SecurityElement element2 in element.Children)
                {
                    string tag = element2.Tag;
                    if (tag != null)
                    {
                        if (tag != "LevelDesc")
                        {
                            if (tag == "LevelModiferSets")
                            {
                                goto Label_0163;
                            }
                            if (tag == "GetWay")
                            {
                                goto Label_0176;
                            }
                            if (tag == "SkillUnlockDesc")
                            {
                                goto Label_0189;
                            }
                            if (tag == "PowerAttribute")
                            {
                                goto Label_019D;
                            }
                        }
                        else
                        {
                            skill.levelDescs.Add(IncreaseString.LoadFromXml(element2));
                        }
                    }
                    continue;
Label_0163:
                    skill.levelModiferSets.Add(PropertyModifierSet.LoadFromXml(element2));
                    continue;
Label_0176:
                    skill.getways.Add(GetWay.LoadFromXml(element2));
                    continue;
Label_0189:
                    skill.skillUnlockDescs.Add(this.LoadSkillUnlockDescFromXml(element2));
                    continue;
Label_019D:
                    skill.powerAttributes = PowerAttribute.LoadFromXml(element2);
                }
            }
            return(skill);
        }
Exemplo n.º 13
0
        public AvatarAction.Event LoadEventFromXml(SecurityElement element, int eventIdx, int sourceTurnID)
        {
            AvatarAction.Event event2 = new AvatarAction.Event {
                sourceTurnId = sourceTurnID,
                index        = eventIdx
            };
            event2.keyFrameId = StrParser.ParseDecInt(element.Attribute("KeyFrameId"), event2.keyFrameId);
            event2.eventType  = TypeNameContainer <AvatarAction.Event._Type> .Parse(element.Attribute("Type"), 0);

            event2.delay           = StrParser.ParseFloat(element.Attribute("Delay"), 0f);
            event2.loop            = StrParser.ParseBool(element.Attribute("Loop"), event2.loop);
            event2.playOnAllTarget = StrParser.ParseBool(element.Attribute("PlayOnAllTarget"), event2.playOnAllTarget);
            event2.weaponId        = StrParser.ParseHexInt(element.Attribute("WeaponId"), 0);
            event2.boneName        = StrParser.ParseStr(element.Attribute("BoneName"), "");
            event2.buffType        = TypeNameContainer <ClientServerCommon.Buff._BuffType> .ParseBitList(element.Attribute("BuffType"), 0);

            event2.modifyType = TypeNameContainer <PropertyModifier._ValueModifyType> .Parse(element.Attribute("ModifyType"), 2);

            if (element.Children != null)
            {
                foreach (SecurityElement element2 in element.Children)
                {
                    int    num;
                    string tag = element2.Tag;
                    if (tag != null)
                    {
                        if (tag != "Effect")
                        {
                            if (tag == "Buff")
                            {
                                goto Label_017E;
                            }
                            if (tag == "ModifierSet")
                            {
                                goto Label_0193;
                            }
                            if (tag == "TestType")
                            {
                                goto Label_01A6;
                            }
                        }
                        else
                        {
                            event2.effects.Add(this.LoadEffectFromXml(element2));
                        }
                    }
                    continue;
Label_017E:
                    this.buffs.Add(this.LoadBuffFromXml(element2, sourceTurnID));
                    continue;
Label_0193:
                    event2.modifierSets.Add(PropertyModifierSet.LoadFromXml(element2));
                    continue;
Label_01A6:
                    num = TypeNameContainer <CombatTurn._TestType> .Parse(element2.Text, 0);

                    if (num != 0)
                    {
                        event2.testType |= num;
                    }
                }
            }
            event2.buffId = StrParser.ParseHexInt(element.Attribute("BuffId"), 0);
            return(event2);
        }