Example #1
0
 public string GetID()
 {
     if (string.IsNullOrEmpty(_ID))
     {
         _ID = BattleReport.UnPackID(UnitId);
     }
     return(_ID);
 }
Example #2
0
 public string GetCasterID()
 {
     if (string.IsNullOrEmpty(_casterID))
     {
         _casterID = BattleReport.UnPackID(Caster);
     }
     return(_casterID);
 }
Example #3
0
        //sometimes no skillID in effect data;
        protected void ProduceEvents(List <N2.BattleRoundAction_Effect> effects, int skillIDFromParent)
        {
            //UtilLog.Log("ProduceEvents BattleRoundActionEffect ");
            foreach (N2.BattleRoundAction_Effect eff in effects)
            {
                //UtilLog.Log("working on eff:"+eff.ToString());
                string effectStr        = "";
                int    eventInteralType = EVENT_Effect_BuffAuraDot;

                ActiveSkillEventArgs args = null;
                if (!string.IsNullOrEmpty(eff.TypeName))
                {
                    effectStr = eff.TypeName;

                    if (eff.AuraEffectType != null && eff.AuraEffectType.Count > 0 ||
                        eff.BuffEffectType != null && eff.BuffEffectType.Count > 0 ||
                        eff.DotEffectType != null && eff.DotEffectType.Count > 0 ||
                        eff.TypeName.Equals("ExitEffectType"))
                    {
                        args             = new Effect_BuffAuraDotEventArgs();
                        eventInteralType = EVENT_Effect_BuffAuraDot;
                    }
                    else if (eff.Damage != null && eff.Damage.Count > 0 ||
                             eff.Recover != null && eff.Recover.Count > 0)
                    {
                        args             = new Effect_DamageCureEventArgs();
                        eventInteralType = EVENT_Effect_DamageCure;
                    }
                    else if (eff.Value != null && eff.Value.Count > 0 ||
                             eff.ResultValue != null && eff.ResultValue.Count > 0)
                    {
                        //todo need more check on data
                        args             = new Effect_BuffAuraDotValueEventArgs();
                        eventInteralType = EVENT_Effect_BuffAuraDotValue;
                    }
                    else
                    {
                        UtilLog.Log("Effect neither damge/cure nor buffAuraDot");
                    }
                }
                else if (!string.IsNullOrEmpty(eff.StateName))
                {
                    effectStr        = eff.StateName;
                    args             = new Effect_STATEEventArgs();
                    eventInteralType = EVENT_Effect_State;
                }
                else
                {
                    UtilLog.Log("Effect neither typename, nore statename");
                }
                args.effName = effectStr;
                if (eff.Caster != null)
                {
                    args.Caster = int.Parse(eff.GetCasterID());
                }
                //sometimes no skillID in effect data;
                if (eff.SkillID == 0)
                {
                    args.SkillID = skillIDFromParent;
                }
                else
                {
                    args.SkillID = eff.SkillID;
                }

                args.EffectID     = eff.EffectID;
                args.EffectTypeID = eff.EffectTypeID;
                if (eventInteralType == EVENT_Effect_BuffAuraDot)
                {
                    Effect_BuffAuraDotEventArgs buffAuraDotArgs = args as Effect_BuffAuraDotEventArgs;
                }
                else if (eventInteralType == EVENT_Effect_State)
                {
                    Effect_STATEEventArgs stateArgs = args as Effect_STATEEventArgs;
                    stateArgs.StateID = eff.StateID;
                }

                //pattern = reportFromationTable.GetEffectStatePattern(effectStr);
                if (eff.Targets != null && eff.Targets.Count > 0)
                {
                    for (int i = 0; i < eff.Targets.Count; i++)
                    {
                        if (eventInteralType == EVENT_Effect_DamageCure)
                        {
                            Effect_DamageCureEventArgs dmgCureArgs = args as Effect_DamageCureEventArgs;
                            if (eff.Damage != null)
                            {
                                dmgCureArgs.HPChange.Add(eff.Damage[i]);
                            }
                            else if (eff.Recover != null)
                            {
                                dmgCureArgs.HPChange.Add(eff.Recover[i]);
                            }
                            if (eff.LeftHP != null)
                            {
                                dmgCureArgs.LeftHP.Add(eff.LeftHP[i]);
                            }
                        }
                        else if (eventInteralType == EVENT_Effect_BuffAuraDot)
                        {
                            Effect_BuffAuraDotEventArgs buffAuraDotArgs = args as Effect_BuffAuraDotEventArgs;
                            if (eff.AuraEffectType != null && eff.AuraEffectType.Count > 0)
                            {
                                //UtilLog.Log("auraEffect has size " + eff.AuraEffectType.Count +" ,we're index:" + i);
                                buffAuraDotArgs.eventType.Add(BuffAuraDot_TYPE.Aura);
                                buffAuraDotArgs.BuffAuraDotID.Add(eff.AuraEffectType[i]);
                            }
                            else if (eff.BuffEffectType != null && eff.BuffEffectType.Count > 0)
                            {
                                buffAuraDotArgs.eventType.Add(BuffAuraDot_TYPE.Buff);
                                buffAuraDotArgs.BuffAuraDotID.Add(eff.BuffEffectType[i]);
                            }
                            else if (eff.DotEffectType != null && eff.DotEffectType.Count > 0)
                            {
                                buffAuraDotArgs.eventType.Add(BuffAuraDot_TYPE.Dot);
                                buffAuraDotArgs.BuffAuraDotID.Add(eff.DotEffectType[i]);
                            }
                            else if (eff.RemoveEffectTypeID != null && eff.RemoveEffectTypeID.Count > 0)
                            {
                                buffAuraDotArgs.eventType.Add(BuffAuraDot_TYPE.RemoveEffect);
                                buffAuraDotArgs.BuffAuraDotID.Add(eff.RemoveEffectTypeID[i]);
                            }
                            else if (eff.TypeName.Equals("ExitEffectType"))
                            {
                                buffAuraDotArgs.eventType.Add(BuffAuraDot_TYPE.RemoveEffect);
                                buffAuraDotArgs.BuffAuraDotID.Add(eff.EffectTypeID);
                            }
                            //aura/dot/buff has no value
                        }
                        else if (eventInteralType == EVENT_Effect_BuffAuraDotValue)
                        {
                            Effect_BuffAuraDotValueEventArgs buffAuraDotArgs = args as Effect_BuffAuraDotValueEventArgs;
                            if (eff.Value != null)
                            {
                                buffAuraDotArgs.ValueChange.Add(eff.Value[i]);
                            }
                            if (eff.ResultValue != null)
                            {
                                buffAuraDotArgs.ResultValue.Add(eff.ResultValue[i]);
                            }
                            if (eff.Result != null && eff.Result.Count > 0)
                            {
                                buffAuraDotArgs.bUsePercent = (eff.Result[0] == 0);
                            }
                        }
                        args.TargetPlayerIDs.Add(int.Parse(BattleReport.UnPackPlayerID(eff.Targets[i])));
                        args.Targets.Add(int.Parse(BattleReport.UnPackID(eff.Targets[i])));
                    }
                }
                m_eventQueue.Enqueue(new EventItem(m_timer.NextTimeStampEffect(), eventInteralType, args));
                //UtilLog.Log(m_eventQueue.Last().ToString());
            }
        }