示例#1
0
        void ParseStats(string strName, Stats.ActorElement actorOwner, int uidAttacker, int TalentID, int adjust)
        {
            if (actorOwner != null)
            {
                Stats.TalentElement talentDefense = actorOwner.talentDefense.Get(TalentID);
                SetTypeFieldValue(talentDefense, strName, adjust);
            }

            Stats.ActorElement actorAttacker = Global.FindActorElement(uidAttacker);
            if (actorAttacker != null)
            {
                Stats.TalentElement talentAttacker = actorAttacker.talentOffense.Get(TalentID);
                SetTypeFieldValue(talentAttacker, strName, adjust);
            }
        }
示例#2
0
文件: Talent.cs 项目: angel2230/ZZZ
        public TalentElement Add(int key)
        {
            TalentElement dummy;

            if (Index.TryGetValue(key, out dummy))
            {
                // already exist
                return(null);
            }

            TalentElement t = new TalentElement();

            t.ID = key;
            XML.XMLTalentElement te = Global.Storage_TalentInfo.Get(key);
            t.Name = te != null?te.name:"unknown";
            XML.XMLTalentHitElement th = Global.Storage_TalentHitInfo.Get(key);
            t.HitSegmentQty = th != null ? th.SegmentQty : 0;
            talents.Add(t);
            Index[key] = t;
            return(t);
        }
示例#3
0
        void ParseXML(string strText)
        {
            XmlParserContext context = new XmlParserContext(null, null, null, XmlSpace.None);
            XmlTextReader    reader  = new XmlTextReader(strText, XmlNodeType.Element, context);

            if (!reader.Read())
            {
                return;
            }

            switch (reader.LocalName)
            {
            case "Command":
                Types.Command command;
                command = GetDeserialize <Types.Command>(strText);
                switch (command.Type)
                {
                case "start":
                    OnStart();
                    break;

                case "stop":
                    OnStop();
                    break;
                }
                break;

            case "Player":
            {
                Types.Player        xml_player = GetDeserialize <Types.Player>(strText);
                Stats.PlayerElement e          = new Stats.PlayerElement();
                e.proto = xml_player;
                if (Global.Storage_Player.Add(e.proto.UIID, e) &&
                    !Global.IsPrepareMode)
                {
                    MakeTreeViewItems();
                }
            }
            break;

            case "NPC":
            {
                NPC xml_npc        = GetDeserialize <Types.NPC>(strText);
                Stats.NPCElement e = new Stats.NPCElement();
                e.proto = xml_npc;
                if (Global.Storage_NPC.Add(e.proto.ID, e) &&
                    !Global.IsPrepareMode)
                {
                    MakeTreeViewItems();
                }
            }

            break;

            case "Stats":
            {
                Types.Stats xml_stats = GetDeserialize <Types.Stats>(strText);
                string      strType   = xml_stats.Type;

                Stats.ActorElement actorOwner = Global.FindActorElement(xml_stats.Owner);
                if (xml_stats.SourceType == "talent")
                {
                    int TalentID = xml_stats.SourceID;

                    switch (strType)
                    {
                    case "UseTalent":
                    {
                        Stats.TalentElement talentOwner = actorOwner.talentOffense.Get(TalentID);
                        ++talentOwner.Use;
                    }
                    break;

                    case "ActTalent":
                    {
                        Stats.TalentElement talentOwner = actorOwner.talentOffense.Get(TalentID);
                        ++talentOwner.Act;
                    }
                    break;

                    case "Damage":
                    {
                        Stats.ActorElement actorAttacker = Global.FindActorElement(xml_stats.Attacker);
                        if (actorAttacker != null)
                        {
                            Stats.TalentElement talentAttacker = actorAttacker.talentOffense.Get(TalentID);
                            talentAttacker.Damage += xml_stats.Damage;
                            Stats.TalentElement talentDefense = actorOwner.talentDefense.Get(TalentID);
                            talentDefense.Damage += xml_stats.Damage;
                        }
                    }
                    break;

                    default:
                    {
                        ParseStats(strType, actorOwner, xml_stats.Attacker, TalentID, 1);
                    }
                    break;
                    }
                }
                else if (xml_stats.SourceType == "combat_time")
                {
                    switch (strType)
                    {
                    case "Start":
                    {
                        if (actorOwner != null)
                        {
                            actorOwner.IsNowCombat = true;
                        }
                    }
                    break;

                    case "End":
                    {
                        if (actorOwner != null)
                        {
                            actorOwner.IsNowCombat = false;
                        }
                    }
                    break;
                    }
                }

                if (Global.ViewInfo.IsList)
                {
                    if (Global.ViewInfo.IsNPC)
                    {
                        Global.listReportsAnlaysis = Global.Storage_NPC.ExtractReportAnalysis();
                    }
                    else
                    {
                        Global.listReportsAnlaysis = Global.Storage_Player.ExtractReportAnalysis();
                    }
                    MakeInfomationView();
                }
                else
                {
                    if (!Global.ViewInfo.IsLeaf)
                    {
                        if (Global.ViewInfo.ActorID == xml_stats.Owner)
                        {
                            if (actorOwner != null)
                            {
                                if (Global.ViewInfo.IsAttack)
                                {
                                    MakeTalentView(actorOwner.talentOffense);
                                }
                                else
                                {
                                    MakeTalentView(actorOwner.talentDefense);
                                }
                            }
                        }
                        else if (Global.ViewInfo.ActorID == xml_stats.Attacker)
                        {
                            Stats.ActorElement actorAttacker = Global.FindActorElement(xml_stats.Attacker);
                            if (actorAttacker != null)
                            {
                                if (Global.ViewInfo.IsAttack)
                                {
                                    MakeTalentView(actorAttacker.talentOffense);
                                }
                                else
                                {
                                    MakeTalentView(actorAttacker.talentDefense);
                                }
                            }
                        }
                    }
                }
            }

            break;
            }

            reader.Close();
        }