コード例 #1
0
        public string Solve(string[] input)
        {
            var initialPosition = new Position(0, 0);
            var position        = initialPosition;
            var direction       = Direction.North;
            var moves           =
                input[0].Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries)
                .Select(move => new { turn = Dnum <Turn.Dir> .Parse(move.Substring(0, 1)), distance = ushort.Parse(move.Substring(1)) });

            ISet <Position> visited = new HashSet <Position> {
                initialPosition
            };

            foreach (var instruction in moves)
            {
                direction = new Turn(instruction.turn).ResultingDirection(direction);
                foreach (var step in new Move(direction, instruction.distance).StepsToResulting(position))
                {
                    position = step;
                    if (visited.Contains(position))
                    {
                        return(position.DistanceFrom(initialPosition).ToString());
                    }
                    visited.Add(position);
                }
            }

            return("No luck");
        }
コード例 #2
0
        public void SetValue(string slug)
        {
            var rawValue = StringHelpers.Unslugify(slug);
            var value    = Dnum <T> .Parse(rawValue, true);

            _value = value;
        }
コード例 #3
0
        public static int GetLowerBound <TEnum>() where TEnum : struct
        {
            Condition.Requires(typeof(TEnum)).Evaluate(t => t.IsEnum);

            var values = Dnum <TEnum> .GetValues();

            return(values.First());
        }
コード例 #4
0
        public static int GetUpperBound <TEnum>() where TEnum : struct
        {
            Condition.Requires(typeof(TEnum),
                               "TEnum").
            Evaluate(t => !t.IsEnum);

            var values = Dnum <TEnum> .GetValues();

            return(values.Last());
        }
コード例 #5
0
        private Destination ReadDestination(string instructionPart)
        {
            var             match = DestinationRegex.Match(instructionPart);
            int             destId;
            DestinationKind?kind;

            if (!match.Success || !int.TryParse(match.Groups[2].Value, out destId) ||
                !Dnum <DestinationKind> .TryParse(match.Groups[1].Value, out kind))
            {
                throw new InvalidDataException();
            }
            return(new Destination(kind.Value, destId));
        }
コード例 #6
0
 public CombatAction(int SwingType, bool Critical, string Special, string Attacker, string theAttackType, Dnum Damage, DateTime Time, int TimeSorter, string Victim, string theDamageType)
 {
     this.SwingType = SwingType;
     this.Critical = Critical;
     this.Special = Special;
     this.Attacker = Attacker;
     this.theAttackType = theAttackType;
     this.Damage = Damage;
     this.Time = Time;
     this.TimeSorter = TimeSorter;
     this.Victim = Victim;
     this.theDamageType = theDamageType;
 }
コード例 #7
0
 public CombatAction(int SwingType, bool Critical, string Special, string Attacker, string theAttackType, Dnum Damage, DateTime Time, int TimeSorter, string Victim, string theDamageType)
 {
     this.SwingType     = SwingType;
     this.Critical      = Critical;
     this.Special       = Special;
     this.Attacker      = Attacker;
     this.theAttackType = theAttackType;
     this.Damage        = Damage;
     this.Time          = Time;
     this.TimeSorter    = TimeSorter;
     this.Victim        = Victim;
     this.theDamageType = theDamageType;
 }
コード例 #8
0
 public static void SetNum(this Dnum dnum, long num)
 {
     try
     {
         var fieldInfo = dnum.GetType().GetField("num", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
         if (fieldInfo != null)
         {
             fieldInfo.SetValue(dnum, num);
         }
     }
     catch (Exception e)
     {
         Debug.WriteLine(e.Message);
     }
 }
コード例 #9
0
        public void AddCombatAction(int SwingType, bool Critical, string Special, string Attacker, string theAttackType, Dnum Damage, DateTime Time, int TimeSorter, string Victim, string theDamageType)
        {
            if(romanjiSplit.IsMatch(theDamageType)){
                theDamageType = translateForMultiple(theDamageType);
            }
            if(romanjiSplit.IsMatch(theAttackType)){
                theAttackType = translateForMultiple(theAttackType);
            }
            if(romanjiSplit.IsMatch(Attacker)){
                Attacker = translateForMultiple(Attacker);
            }
            if(romanjiSplit.IsMatch(Victim)){
                Victim = translateForMultiple(Victim);
            }

            ActGlobals.oFormActMain.AddCombatAction(SwingType, Critical, Special, Attacker, theAttackType, Damage, Time, TimeSorter, Victim, theDamageType);
        }
コード例 #10
0
        public string Solve(string[] input)
        {
            var         pad          = this.UsedPad;
            List <char> code         = new List <char>();
            char        initialDigit = '5';
            var         key          = pad[initialDigit];

            foreach (string keyInstructions in input)
            {
                foreach (char instruction in keyInstructions)
                {
                    var dir = Dnum <Direction> .Parse(instruction.ToString());

                    key = pad[key.Neighbor(dir)];
                }
                code.Add(key.Key);
            }
            return(string.Join("", code));
        }
コード例 #11
0
        public string Solve(string[] input)
        {
            var initialPosition = new Position(0, 0);
            var position        = initialPosition;
            var direction       = Direction.North;
            var moves           =
                input[0].Split(new[] { ", " }, StringSplitOptions.RemoveEmptyEntries)
                .Select(move => new { turn = Dnum <Turn.Dir> .Parse(move.Substring(0, 1)), distance = ushort.Parse(move.Substring(1)) });

            foreach (var instruction in moves)
            {
                direction = new Turn(instruction.turn).ResultingDirection(direction);
                position  = new Move(direction, instruction.distance).ResultingPosition(position);
            }

            var distanceFromInitial = position.DistanceFrom(initialPosition);

            return(distanceFromInitial.ToString());
        }
コード例 #12
0
        void oFormActMain_BeforeLogLineRead(bool isImport, LogLineEventArgs logInfo)
        {
            string InputStr = logInfo.logLine;

            //File.AppendAllText("rappelz.log", InputStr + "\r\n");

            string[] datas = InputStr.Split('\t');


            int SwingType = (int)SwingTypeEnum.Melee;

            switch (datas[4])
            {
            case "Melee": SwingType = (int)SwingTypeEnum.Melee; break;

            case "NonMelee": SwingType = (int)SwingTypeEnum.NonMelee; break;

            case "Healing": SwingType = (int)SwingTypeEnum.Healing; break;

            case "ManaDrain": SwingType = (int)SwingTypeEnum.PowerDrain; break;

            case "ManaHealing": SwingType = (int)SwingTypeEnum.PowerHealing; break;
            }
            bool     Critical      = datas[7] == "crit";
            string   Special       = datas[8];
            string   Attacker      = getDisplayName(datas[1]);
            string   theAttackType = getDisplayName(datas[3]);
            Dnum     Damage        = new Dnum(Int64.Parse(datas[6]));
            DateTime Time          = EPOCH.AddMilliseconds(Int64.Parse(datas[0])).ToLocalTime();
            int      TimeSorter    = ActGlobals.oFormActMain.GlobalTimeSorter;
            string   Victim        = getDisplayName(datas[2]);
            string   theDamageType = datas[5] == "" ? "None" : datas[5];

            if (ActGlobals.oFormActMain.SetEncounter(Time, Attacker, Victim))
            {
                ActGlobals.oFormActMain.AddCombatAction(SwingType, Critical, Special, Attacker, theAttackType, Damage, Time, TimeSorter, Victim, theDamageType);
            }
        }
コード例 #13
0
        public IInstruction Parse(string instruction)
        {
            var match = InstructionRe.Match(instruction);

            Debug.Assert(match.Success);
            var code = Dnum <InstructionCode> .Parse(match.Groups[1].Value);

            switch (code)
            {
            case InstructionCode.inc:
                return(new Inc(Register(match.Groups[2].Value)));

            case InstructionCode.dec:
                return(new Dec(Register(match.Groups[2].Value)));

            case InstructionCode.cpy:
                return(new Cpy(Source(match.Groups[2].Value), Register(match.Groups[3].Value)));

            case InstructionCode.jnz:
            default:
                return(new Jnz(Source(match.Groups[2].Value), int.Parse(match.Groups[3].Value)));
            }
        }
コード例 #14
0
 public void AddCombatAction(int SwingType, bool Critical, string Special, string Attacker, string theAttackType, Dnum Damage, DateTime Time, int TimeSorter, string Victim, string theDamageType)
 {
     Advanced_Combat_Tracker.ActGlobals.oFormActMain.AddCombatAction(SwingType, Critical, Special, Attacker, theAttackType, Damage, Time, TimeSorter, Victim, theDamageType);
 }
コード例 #15
0
 public void AddCombatAction(int SwingType, bool Critical, string Special, string Attacker, string theAttackType, Dnum Damage, DateTime Time, int TimeSorter, string Victim, string theDamageType)
 {
     CombatActions.Add(new CombatAction(SwingType, Critical, Special, Attacker, theAttackType, Damage, Time, TimeSorter, Victim, theDamageType));
 }
コード例 #16
0
        private void LogExeJpn(int logMatched, string logLine, bool isImport)
        {
            // 追加する処理の分岐フラグ
            int NONE_DAMAGE = 0;
            int ADD_DAMAGE = 1;
            int SKIP_DAMAGE = 2;

            bool isSelfAttack = false;

            int branchFlag = NONE_DAMAGE;

            string attacker, victim, damage, skillType, why, special, damageType, crit;
            Regex rE = regexArray[logMatched - 1];
            int swingType = 0;
            bool critical = false;
            List<DamageAndType> damageAndTypeArr = new List<DamageAndType>();

            DateTime time = ActGlobals.oFormActMain.LastKnownTime;

            Dnum addCombatInDamage = null;

            int gts = ActGlobals.oFormActMain.GlobalTimeSorter;

            // 初期化
            attacker = string.Empty;
            victim = string.Empty;
            damage = string.Empty;
            skillType = string.Empty;
            why = string.Empty;
            special = string.Empty;
            damageType = string.Empty;
            crit = string.Empty;

            switch (logMatched) {
            #region Case 1 [unsourced skill attacks]
            case 1:
                branchFlag = ADD_DAMAGE;
                attacker = "不明";
                victim = rE.Replace(logLine, "$1");
                skillType = rE.Replace(logLine, "$2");
                damage = rE.Replace(logLine, "$3");
                special = rE.Replace(logLine, "$4");
                special = String.IsNullOrEmpty(special) ? "None" : special;
                crit = special;
                swingType = (int)SwingTypeEnum.NonMelee;

                if (!ActGlobals.oFormActMain.InCombat && !isImport) {
                    ActGlobals.oFormSpellTimers.NotifySpell(attacker.ToLower(), skillType, victim.Contains("あなた"), victim.ToLower(), true);
                    branchFlag = NONE_DAMAGE;
                    break;
                }

                break;
            #endregion
            #region Case 2 [melee attacks by yourself]
            case 2:
                attacker = rE.Replace(logLine, "$1");
                victim = rE.Replace(logLine, "$2");
                damage = rE.Replace(logLine, "$3");
                special = rE.Replace(logLine, "$4");
                crit = special;
                special = special.Replace("クリティカルヒット・", string.Empty).Trim();
                special = special.Replace("クリティカル・", string.Empty).Trim();
                special = special.Replace("クリティカルヒット", string.Empty).Trim();
                special = special.Replace("クリティカル", string.Empty).Trim();
                if(special.Trim() == ""){
                    special = "None";
                }
                swingType = (int)SwingTypeEnum.Melee;
                isSelfAttack = true;
                if (ActGlobals.oFormActMain.SetEncounter(time, attacker, victim)) {
                    branchFlag = ADD_DAMAGE;
                }
                break;
            #endregion
            #region Case 3 [melee/non-melee attacks by expect yourself]
            case 3:
                attacker = rE.Replace(logLine, "$1");
                skillType = rE.Replace(logLine, "$2");
                victim = rE.Replace(logLine, "$3");
                damage = rE.Replace(logLine, "$4");
                special = rE.Replace(logLine, "$5");
                crit = special;
                special = special.Replace("クリティカルヒット・", string.Empty).Trim();
                special = special.Replace("クリティカル・", string.Empty).Trim();
                special = special.Replace("クリティカルヒット", string.Empty).Trim();
                special = special.Replace("クリティカル", string.Empty).Trim();
                if(special.Trim() == ""){
                    special = "None";
                }
                isSelfAttack = true;
                if (skillType == "攻撃") {
                    swingType = (int)SwingTypeEnum.Melee;
                }else{
                    swingType = (int)SwingTypeEnum.NonMelee;
                }
                if (ActGlobals.oFormActMain.SetEncounter(time, attacker, victim)) {
                    branchFlag = ADD_DAMAGE;
                }
                break;
            #endregion
            #region Case 4 [healing]
            case 4:
                if (!ActGlobals.oFormActMain.InCombat) {
                    branchFlag = NONE_DAMAGE;
                    break;
                }
                branchFlag = SKIP_DAMAGE;
                attacker = rE.Replace(logLine, "$1");
                skillType = rE.Replace(logLine, "$2");
                victim = rE.Replace(logLine, "$3");
                damage = rE.Replace(logLine, "$4");
                damageType = "Hitpoints";
                swingType = (int)SwingTypeEnum.Healing;
                special = "None";
                if (attacker == "あなた" && logLine.Contains("自分を")) {
                    victim = attacker;
                }
                addCombatInDamage = Int32.Parse(damage);
                break;
            #endregion
            #region Case 5 [critical healing]
            case 5:
                if (!ActGlobals.oFormActMain.InCombat) {
                    branchFlag = NONE_DAMAGE;
                    break;
                }
                branchFlag = SKIP_DAMAGE;
                attacker = rE.Replace(logLine, "$1");
                skillType = rE.Replace(logLine, "$2");
                victim = rE.Replace(logLine, "$3");
                damage = rE.Replace(logLine, "$4");
                damageType = "Hitpoints";
                swingType = (int)SwingTypeEnum.Healing;
                special = "None";
                addCombatInDamage = Int32.Parse(damage);
                critical = true;
                break;
            #endregion
            #region Case 6 [misses]
            case 6:
                attacker = rE.Replace(logLine, "$1");
                victim = rE.Replace(logLine, "$2");
                why = rE.Replace(logLine, "$3");
                special = rE.Replace(logLine, "$4");
                addCombatInDamage = Dnum.Miss;

                isSelfAttack = true;
                if (why == "攻撃" )
                {
                    swingType = (int)SwingTypeEnum.Melee;
                    skillType = why.Trim();
                }
                else { // スキルmiss
                    swingType = (int)SwingTypeEnum.NonMelee;
                    skillType = (Regex.Split( why , "で攻撃" ))[0].Trim();
                }
                if (ActGlobals.oFormActMain.SetEncounter(time, attacker, victim)) {
                    branchFlag = SKIP_DAMAGE;
                }
                break;
            #endregion
            #region Case 7 [melee misses by interfer]
            case 7:
                attacker = rE.Replace(logLine, "$1");
                victim = rE.Replace(logLine, "$2");
                why = rE.Replace(logLine, "$3");
                special = rE.Replace(logLine, "$4");
                crit = special;
                skillType = "攻撃";
                damageType = "melee";
                swingType = (int)SwingTypeEnum.Melee;

                why = why.Replace(victim, string.Empty);
                why = why.Trim() + " " + special;
                addCombatInDamage = new Dnum(Dnum.Unknown, why.Trim());
                isSelfAttack = true;
                if (ActGlobals.oFormActMain.SetEncounter(time, attacker, victim)) {
                    branchFlag = SKIP_DAMAGE;
                }
                break;
            #endregion
            #region Case 8 [non-melee misses by interfer]
            case 8:
                attacker = rE.Replace(logLine, "$1");
                victim = rE.Replace(logLine, "$2");
                skillType = rE.Replace(logLine, "$3");
                why = special = rE.Replace(logLine, "$4");
                special = rE.Replace(logLine, "$5");
                crit = special;
                damageType = "non-melee";
                swingType = (int)SwingTypeEnum.NonMelee;

                why = why.Replace(victim, string.Empty);
                why = why.Trim() + " " + special;
                addCombatInDamage = new Dnum(Dnum.Unknown, why.Trim());
                isSelfAttack = true;
                if (ActGlobals.oFormActMain.SetEncounter(time, attacker, victim)) {
                    branchFlag = SKIP_DAMAGE;
                }
                break;
            #endregion
            #region Case 9 [killing]
            case 9:
                if (!ActGlobals.oFormActMain.InCombat) {
                    branchFlag = NONE_DAMAGE;
                    break;
                }
                branchFlag = SKIP_DAMAGE;
                attacker = rE.Replace(logLine, "$1");
                string zone = rE.Replace(logLine, "$2");
                string xpos = rE.Replace(logLine, "$3");
                string zpos = rE.Replace(logLine, "$4");
                string ypos = rE.Replace(logLine, "$5");
                victim = rE.Replace(logLine, "$6");
                swingType = (int)SwingTypeEnum.NonMelee;
                ActGlobals.oFormSpellTimers.RemoveTimerMods(victim);
                ActGlobals.oFormSpellTimers.DispellTimerMods(victim);
                special = "None";
                skillType = "Killing";
                addCombatInDamage = Dnum.Death;
                damageType = "Death";
                break;
            #endregion
            #region Case 10 [killed]
            case 10:
                if (!ActGlobals.oFormActMain.InCombat) {
                    branchFlag = NONE_DAMAGE;
                    break;
                }
                branchFlag = SKIP_DAMAGE;
                victim = rE.Replace(logLine, "$1");
                attacker = rE.Replace(logLine, "$2");
                swingType = (int)SwingTypeEnum.NonMelee;
                ActGlobals.oFormSpellTimers.RemoveTimerMods(victim);
                ActGlobals.oFormSpellTimers.DispellTimerMods(victim);
                special = "None";
                skillType = "Killing";
                addCombatInDamage = Dnum.Death;
                damageType = "Death";
                break;
            #endregion
            #region Case 11 [killing yourself]
            case 11:
                if (!ActGlobals.oFormActMain.InCombat) {
                    branchFlag = NONE_DAMAGE;
                    break;
                }
                branchFlag = SKIP_DAMAGE;
                victim = "あなた";
                attacker = rE.Replace(logLine, "$1");
                swingType = (int)SwingTypeEnum.NonMelee;
                ActGlobals.oFormSpellTimers.RemoveTimerMods(victim);
                ActGlobals.oFormSpellTimers.DispellTimerMods(victim);
                special = "None";
                skillType = "Killing";
                addCombatInDamage = Dnum.Death;
                damageType = "Death";
                break;
            #endregion
            #region Case 12 [act commands]
            case 12:
                branchFlag = NONE_DAMAGE;
                ActGlobals.oFormActMain.ActCommands(rE.Replace(logLine, "$1"));
                break;
            #endregion
            #region Case 13 [power drain]
            case 13:
                branchFlag = SKIP_DAMAGE;
                attacker = rE.Replace(logLine, "$1");
                skillType = rE.Replace(logLine, "$2");
                victim = rE.Replace(logLine, "$3");
                damage = rE.Replace(logLine, "$4");
                special = rE.Replace(logLine, "$5");
                crit = special;
                special = "None";
                swingType = (int)SwingTypeEnum.PowerDrain;
                isSelfAttack = true;

                if (ActGlobals.oFormActMain.SetEncounter(time, attacker, victim)) {
                    if (CheckWardedHit(victim, time)) {
                        addCombatInDamage = new Dnum(Int32.Parse(damage) + lastWardAmount, String.Format("{0}/{1}", lastWardAmount, damage));
                        damageType = "warded/non-melee";
                        lastWardAmount = 0;
                    } else {
                        addCombatInDamage = Int32.Parse(damage);
                        damageType = "non-melee";
                    }
                }
                break;
            #endregion
            #region Case 14 [ward absorbtion]
            case 14:
                if (!ActGlobals.oFormActMain.InCombat) {
                    branchFlag = NONE_DAMAGE;
                    break;
                }
                branchFlag = SKIP_DAMAGE;
                victim = rE.Replace(logLine, "$1");
                damage = rE.Replace(logLine, "$2");
                attacker = rE.Replace(logLine, "$3");
                skillType = rE.Replace(logLine, "$4");
                swingType = (int)SwingTypeEnum.Healing;
                special = "None";
                damageType = "Absorption";
                addCombatInDamage = Int32.Parse(damage);

                if (CheckWardedHit(victim, time)) {
                    lastWardAmount += Int32.Parse(damage);
                } else {
                    lastWardAmount = Int32.Parse(damage);
                }
                lastWardedTarget = victim;
                lastWardTime = time;
                break;
            #endregion
            #region Case 15 [ward absorbtion your spell]
            case 15:
                if (!ActGlobals.oFormActMain.InCombat) {
                    branchFlag = NONE_DAMAGE;
                    break;
                }
                branchFlag = SKIP_DAMAGE;
                skillType = rE.Replace(logLine, "$1");
                damage = rE.Replace(logLine, "$2");
                victim = rE.Replace(logLine, "$3");

                attacker = "あなた";
                swingType = (int)SwingTypeEnum.Healing;
                special = "None";
                damageType = "Absorption";
                addCombatInDamage = Int32.Parse(damage);

                if (CheckWardedHit(victim, time)) {
                    lastWardAmount += Int32.Parse(damage);
                } else {
                    lastWardAmount = Int32.Parse(damage);
                }
                lastWardedTarget = victim;
                lastWardTime = time;
                break;
            #endregion
            #region Case 16 [zone change]
            case 16:
                branchFlag = NONE_DAMAGE;
                if (logLine.Contains(" combat by "))
                    break;
                string zoneName = rE.Replace(logLine, "$1").Trim();
                if(romanjiSplit.IsMatch(zoneName)){
                    zoneName = translateForMultiple(zoneName);
                }
                ActGlobals.oFormActMain.ChangeZone(zoneName);
                break;
            #endregion
            #region Case 17 [power healing]
            case 17:
                if (!ActGlobals.oFormActMain.InCombat) {
                    branchFlag = NONE_DAMAGE;
                    break;
                }
                branchFlag = SKIP_DAMAGE;
                attacker = rE.Replace(logLine, "$1");
                skillType = rE.Replace(logLine, "$2");
                victim = rE.Replace(logLine, "$3");
                damage = rE.Replace(logLine, "$4");
                special = rE.Replace(logLine, "$5");
                swingType = (int)SwingTypeEnum.PowerHealing;
                damageType = "Power";
                // クリティカル
                if (special == "クリティカル")
                {
                    critical = true;
                }

                addCombatInDamage = Int32.Parse(damage);
                break;
            #endregion
            #region case 18 [self power healing]
            case 18:
                if (!ActGlobals.oFormActMain.InCombat) {
                    branchFlag = NONE_DAMAGE;
                    break;
                }
                branchFlag = SKIP_DAMAGE;
                attacker = rE.Replace(logLine, "$1");
                skillType = rE.Replace(logLine, "$2");
                victim = attacker;
                damage = rE.Replace(logLine, "$3");
                special = rE.Replace(logLine, "$4");
                swingType = (int)SwingTypeEnum.PowerHealing;
                damageType = "Power";
                // クリティカル
                if (special == "クリティカル")
                {
                    critical = true;
                }
                addCombatInDamage = Int32.Parse(damage);
                break;
            #endregion
            #region Case 19 [threat]
            case 19:
                branchFlag = NONE_DAMAGE;
                string owner = rE.Replace(logLine, "$1");
                skillType = rE.Replace(logLine, "$2");
                victim = rE.Replace(logLine, "$3");
                attacker = rE.Replace(logLine, "$4");
                damage = rE.Replace(logLine, "$5");
                string dtype = rE.Replace(logLine, "$6");
                special = rE.Replace(logLine, "$7");
                string direction = rE.Replace(logLine, "$8");
                swingType = (int)SwingTypeEnum.Threat;

                if (attacker.Contains("相手") || attacker.Contains("あなた")) {
                    attacker = owner;
                }
                isSelfAttack = true;

                bool increase = direction == "増加";
                critical = special.StartsWith("大幅に");
                special = "None";

                Dnum dDamage;
                bool positionChange = dtype == "position";
                if (positionChange) {
                    dDamage = new Dnum(Dnum.ThreatPosition, String.Format("{0} Positions", Int32.Parse(damage)));
                }
                else {
                    dDamage = new Dnum(Int32.Parse(damage));
                }

                direction = increase ? "Increase" : "Decrease";

                if (ActGlobals.oFormActMain.SetEncounter(time, attacker, victim) || ActGlobals.oFormActMain.SetEncounter(time, owner, victim)) {
                    branchFlag = SKIP_DAMAGE;
                    damageType = direction;
                    addCombatInDamage = dDamage;
                }
                break;
            #endregion
            #region Case 20 [dispell/cure]
            case 20:
                branchFlag = NONE_DAMAGE;
                attacker = rE.Replace(logLine, "$1");
                skillType = rE.Replace(logLine, "$2");
                victim = rE.Replace(logLine, "$3");
                string attackType = rE.Replace(logLine, "$4");
                direction = rE.Replace(logLine, "$5");
                swingType = (int)SwingTypeEnum.CureDispel;

                if (attackType.Contains("Traumatic Swipe") || attackType.Contains("トラウマティック・スワイプ")){
                    ActGlobals.oFormSpellTimers.DispellTimerMods(victim);
                }

                bool cont = false;
                if (direction.Contains("治療")) {
                    cont = ActGlobals.oFormActMain.InCombat;
                } else {
                    cont = ActGlobals.oFormActMain.SetEncounter(time, attacker, victim);
                }
                if (cont) {
                    branchFlag = SKIP_DAMAGE;
                    special = attackType;
                    addCombatInDamage = 1;
                    damageType = direction;
                }
                break;
            #endregion
            default:
                branchFlag = NONE_DAMAGE;
                break;
            }

            if (attacker.Contains("あなた")){
                attacker = ActGlobals.charName;
            }
            if (victim.Contains("あなた") || victim.Contains("自分")){
                victim = ActGlobals.charName;
            }
            if(!critical){
                critical = crit.Contains("クリティカル");
            }

            if (isSelfAttack && (attacker == victim || attacker == petSplit.Replace(victim, "$2"))) {
                branchFlag = NONE_DAMAGE;
            }

            if(branchFlag == ADD_DAMAGE){
                damageAndTypeArr = EngGetDamageAndTypeArr(damage);
                AddDamageAttack(swingType, critical, special, attacker, skillType, damageAndTypeArr, time, gts, victim);
            }else if(branchFlag == SKIP_DAMAGE){
                AddCombatAction(swingType, critical, special, attacker, skillType, addCombatInDamage, time, gts, victim, damageType);
            }
        }
コード例 #17
0
        void oFormActMain_BeforeLogLineRead(bool isImport, LogLineEventArgs logInfo)
        {
            Action aAction = new Action();
            string logLine = logInfo.logLine;

            string[] tmp = logInfo.logLine.Split(',');

            if (tmp[0].Equals("timestamp"))
            {
                return;
            }
            try
            {
                aAction.timestamp  = Convert.ToUInt32(tmp[0]);
                aAction.instanceID = Convert.ToUInt16(tmp[1]);
                aAction.sourceID   = Convert.ToUInt32(tmp[2]);
                aAction.sourceName = tmp[3];
                aAction.targetID   = Convert.ToUInt32(tmp[4]);
                aAction.targetName = tmp[5];
                aAction.attackID   = Convert.ToUInt32(tmp[6]);
                aAction.damage     = Convert.ToInt32(tmp[7]);
                aAction.isJA       = (Convert.ToInt32(tmp[8]) == 1);
                aAction.isCrit     = (Convert.ToInt32(tmp[9]) == 1);
                aAction.isMultiHit = (Convert.ToInt32(tmp[10]) == 1);
                aAction.isMisc     = (Convert.ToInt32(tmp[11]) == 1);
                aAction.isMisc2    = (Convert.ToInt32(tmp[12]) == 1);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message + "\n" + logLine);
                return;
            }

            //TODO: deal with when the first thing they do is counter
            if (aAction.targetID == 0 ||
                (aAction.instanceID == 0 && currInstID == 0xFFFF))
            {
                return;
            }

            DateTime time = ActGlobals.oFormActMain.LastKnownTime;
            int      gts  = ActGlobals.oFormActMain.GlobalTimeSorter;

            if (aAction.instanceID == 0)
            {
                aAction.instanceID = currInstID;
            }
            SwingTypeEnum e;

            string sourceName = aAction.sourceName == "YOU" ? "YOU" : aAction.sourceName + "_" + aAction.sourceID.ToString();
            string targetName = aAction.targetName == "YOU" ? "YOU" : aAction.targetName + "_" + aAction.targetID.ToString();

            string actionType = aAction.attackID.ToString();
            string damageType = aAction.attackID.ToString();

            if (aAction.damage < 0 && aAction.isMisc)
            {
                e = SwingTypeEnum.Healing;
            }
            else
            {
                e = SwingTypeEnum.Melee;
            }

            Dnum dmg = new Dnum(aAction.damage) * ((e == SwingTypeEnum.Healing) ? -1 : 1);

            if (skillDict.ContainsKey(aAction.attackID))
            {
                actionType = skillDict[aAction.attackID].Name;
                damageType = skillDict[aAction.attackID].Type;
            }

            MasterSwing ms = new MasterSwing(
                Convert.ToInt32(e),
                aAction.isCrit,
                "",
                dmg,
                time,
                gts,
                actionType,
                sourceName,
                damageType,
                targetName
                );

            if (aAction.instanceID != currInstID)
            {
                currInstID = aAction.instanceID;
                ActGlobals.oFormActMain.ChangeZone(aAction.instanceID.ToString());
            }

            if (ActGlobals.oFormActMain.SetEncounter(time, sourceName, targetName))
            {
                ActGlobals.oFormActMain.AddCombatAction(ms);
            }
        }
コード例 #18
0
        private void ProcessActionShields(ParsedLine l)
        {
            int magAdj = (int)Math.Round(l.mag);
            int magBaseAdj = (int)Math.Round(l.magBase);

            // Shielding goes first and acts like a heal to cancel coming damage.  Attacker has his own damage line.  example:

            // 13:07:02:10:48:49.1::Neston,P[200243656@6371989 Neston@adamtech],,*,Flemming Fedtgebis,P[201082649@7532407 Flemming Fedtgebis@feehavregroed],Forgemaster's Flame,Pn.Lbf9ic,Shield,,-349.348,-154.608
            // 13:07:02:10:48:49.1::SorXian,P[201063397@7511146 SorXian@sorxian],,*,Flemming Fedtgebis,P[201082649@7532407 Flemming Fedtgebis@feehavregroed],Entangling Force,Pn.Oonws91,Shield,,-559.613,-247.663
            // 13:07:02:10:48:49.1::Neston,P[200243656@6371989 Neston@adamtech],,*,Flemming Fedtgebis,P[201082649@7532407 Flemming Fedtgebis@feehavregroed],Forgemaster's Flame,Pn.Lbf9ic,Radiant,,154.608,349.348
            // 13:07:02:10:48:49.1::SorXian,P[201063397@7511146 SorXian@sorxian],,*,Flemming Fedtgebis,P[201082649@7532407 Flemming Fedtgebis@feehavregroed],Entangling Force,Pn.Oonws91,Arcane,,247.663,559.613

            // NOTE:
            // Notice that the mag and magBase numbers are swap in the shield line verse the damage line.
            // Therefore the amount shield == magBase ???
            // The mag is meaningless ???
            // If mag > magBase on the attack is all damage not shielded ???  (ie high armor pen)

            // NOTE:
            // NW Patch on 7/17/2013 changed shield to report blocked damage in the mag field.
            // 13:07:18:10:25:54.2::Miner,C[1445 Mindflayer_Duergarminerthrall],,*,Largoevo,P[201228983@6531604 Largoevo@largoevo],Melee Attack,Pn.M7kie6,Shield,,-242.837,0
            // Actuall not sure on this....

            //
            // Target prevented damage.
            //

            l.logInfo.detectedType = l.critical ? Color.Green.ToArgb() : Color.DarkGreen.ToArgb();

            ProcessNamesOST(l);

            // Use encounter names attacker and target here.  This allows filtering
            // Hostile action triggered.  Use SetEncounter().
            if (ActGlobals.oFormActMain.SetEncounter(l.logInfo.detectedTime, l.encAttackerName, l.encTargetName))
            {
                // Put the attacker and the attack type in the special field.
                string special = l.unitAttackerName + " : " + l.attackType;

                Dnum shielded = null;
                float mag = 0;
                float magBase = 0;

                // This is just weird...
                if (l.magBase == 0) // Don't use magBaseAdj here.  Rounded to zero is not zero.
                {
                    shielded = new Dnum( -magAdj );
                    mag = -l.mag;
                    magBase = -l.magBase;
                }
                else
                {
                    shielded = new Dnum(-magBaseAdj);
                    mag = -l.magBase;
                    magBase = -l.mag;
                }

                // SwingType = Heal
                // special = attacker
                // attacker & victim = target
                MasterSwing ms = new MasterSwing(
                    (int)SwingTypeEnum.Healing,
                    l.critical, special, shielded, l.logInfo.detectedTime, l.ts, l.type, l.unitTargetName, l.type, l.unitTargetName);

                ms.Tags.Add("DamageF", mag);
                ms.Tags.Add("Flank", l.flank);

                ActGlobals.oFormActMain.AddCombatAction(ms);

                unmatchedShieldLines.AddShield(ms, l);
            }
        }
コード例 #19
0
 private void AddCombatAction(LogLineEventArgs logInfo, string attacker, string victim, string theAttackType, bool critical, string special, Dnum damage, SwingTypeEnum swingType)
 {
     AddCombatAction(logInfo, attacker, victim, theAttackType, critical, special, damage, swingType, string.Empty);
 }
コード例 #20
0
ファイル: PSO2ACT.cs プロジェクト: TyroneSama/PSO2ACT
        void oFormActMain_BeforeLogLineRead(bool isImport, LogLineEventArgs logInfo)
        {
            Action aAction = new Action();
            string logLine = logInfo.logLine;
            string[] tmp = logInfo.logLine.Split(',');

            if (tmp[0].Equals("timestamp"))
                return;
            try
            {
                aAction.timestamp = Convert.ToUInt32(tmp[0]);
                aAction.instanceID = Convert.ToUInt16(tmp[1]);
                aAction.sourceID = Convert.ToUInt32(tmp[2]);
                aAction.sourceName = tmp[3];
                aAction.targetID = Convert.ToUInt32(tmp[4]);
                aAction.targetName = tmp[5];
                aAction.attackID = Convert.ToUInt32(tmp[6]);
                aAction.damage = Convert.ToInt32(tmp[7]);
                aAction.isJA = (Convert.ToInt32(tmp[8]) == 1);
                aAction.isCrit = (Convert.ToInt32(tmp[9]) == 1);
                aAction.isMultiHit = (Convert.ToInt32(tmp[10]) == 1);
                aAction.isMisc = (Convert.ToInt32(tmp[11]) == 1);
                aAction.isMisc2 = (Convert.ToInt32(tmp[12]) == 1);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message + "\n" + logLine);
                return;
            }

            //TODO: deal with when the first thing they do is counter
            if (aAction.targetID == 0 ||
                (aAction.instanceID == 0 && currInstID == 0xFFFF))
                return;

            DateTime time = ActGlobals.oFormActMain.LastKnownTime;
            int gts = ActGlobals.oFormActMain.GlobalTimeSorter;
            if (aAction.instanceID == 0)
                aAction.instanceID = currInstID;
            SwingTypeEnum e;

            string sourceName = aAction.sourceName + "_" + aAction.sourceID.ToString();
            string targetName = aAction.targetName + "_" + aAction.targetID.ToString();

            string actionType = aAction.attackID.ToString();
            string damageType = aAction.attackID.ToString();

            if (aAction.damage < 0 && aAction.isMisc)
                e = SwingTypeEnum.Healing;
            else
                e = SwingTypeEnum.Melee;

            Dnum dmg = new Dnum(aAction.damage) * ((e == SwingTypeEnum.Healing) ? -1 : 1);

            if (skillDict.ContainsKey(aAction.attackID))
            {
                actionType = skillDict[aAction.attackID].Name;
                damageType = skillDict[aAction.attackID].Type;
            }

            MasterSwing ms = new MasterSwing(
                Convert.ToInt32(e),
                aAction.isCrit,
                "",
                dmg,
                time,
                gts,
                actionType,
                sourceName,
                damageType,
                targetName
                );

            if (aAction.instanceID != currInstID)
            {
                currInstID = aAction.instanceID;
                ActGlobals.oFormActMain.ChangeZone(aAction.instanceID.ToString());
            }

            if (ActGlobals.oFormActMain.SetEncounter(time, sourceName, targetName))
                ActGlobals.oFormActMain.AddCombatAction(ms);
        }
コード例 #21
0
        private void AddCombatAction(LogLineEventArgs logInfo, string attacker, string victim, string theAttackType, bool critical, string special, Dnum damage, SwingTypeEnum swingType, string damageType)
        {
            DateTime now = logInfo.detectedTime;
            if (ActGlobals.oFormActMain.SetEncounter(now, attacker, victim))
            {
                // attempt to guess the party member's class
                if (GuessChanter)
                {
                    PartyMembers.SetClass(attacker, theAttackType);
                }

                // redirect attacks from pets/servants as coming from summoner
                if (SummonerRecordSet.IsSummonedPet(attacker))
                {
                    var summonerRecord = SummonerRecordSet.GetSummonerRecord(victim, attacker, now);
                    if (summonerRecord != null)
                    {
                        string pet = attacker;
                        if (AionData.Pet.IsTargettedPet(pet))
                        {
                            attacker = summonerRecord.Actor;
                            theAttackType = summonerRecord.Skill;
                        }
                        else if (LinkPets)
                        {
                            attacker = summonerRecord.Actor;
                            if (summonerRecord.Duration <= 60)
                                theAttackType = summonerRecord.Skill;
                            else
                                theAttackType += "(" + pet + ")";
                        }
                    }
                }
                else if (SummonerRecordSet.IsSummonedPet(victim))
                {
                    if (AionData.Pet.IsPet(victim))
                    {
                        // handle player pets
                        if (AionData.Pet.PetDurations[victim] <= 60) return; // ignore damage done to short-duration temporary pets // TODO: this should be a checkbox as this will decrease the dps of the attacker

                        var summonerRecord = SummonerRecordSet.GetSummonerRecord(null, victim, now);
                        if (LinkPets)
                        {
                            ////return; // TODO: how do we treat damage done to spiritmaster's pets?
                        }
                    }
                    else
                    {
                        // handle monster/unknown pets
                        if (LinkPets)
                        {
                            // TODO: how do we treat damage done to mob's pets?
                        }
                        else
                        {
                            ////victim += " (inc)"; // TODO: this should be a checkbox if we want damage shown to mob pets
                        }
                    }
                }

                int globalTime = ActGlobals.oFormActMain.GlobalTimeSorter++;
                ActGlobals.oFormActMain.AddCombatAction((int)swingType, critical, special, attacker, theAttackType, damage, now, globalTime, victim, damageType);
            }
        }
コード例 #22
0
        public static TEnum GetRandom <TEnum>() where TEnum : struct
        {
            var values = Dnum <TEnum> .GetValues().ToArray();

            return(Dnum <TEnum> .ToConstant(values[_random.Next(0, values.Length)]));
        }
コード例 #23
0
ファイル: COEvent.cs プロジェクト: quasimojo/CO-ACTLib
        public COEvent(string logLine, bool UseAccountNames = false)
        {
            #region logline examples
            /*
             
            * damage example
            14:02:12:21:21:01.1::Mackenzie,P[11052553@2142550 Mackenzie@Avianos],,*,Gravitar,C[2 Alert_Gravitar],,Pn.Yxr66e,Crushing,,376.483,393.682
            
            * healing device example
            14:02:12:21:20:37.1::,,,,Gigazeon,P[10064257@3338963 Gigazeon@Oyo32],Necrullitic Elixer,Pn.L02l82,HitPoints,,-206.25,0
            
             * idf
            14:02:12:21:36:05.5::Double Tap,P[1416054@142085 Double Tap@MindCryme],,*,Pandra Pendragon,P[10359895@3350514 Pandra Pendragon@DaZee],Inertial Dampening Field,Pn.Lkgzw51,Shield,,-0,-111.272
            
             * endurance mastery
            14:02:12:21:35:55.6::Lethal MK III,P[11190175@3312675 Lethal MK III@Viridian_Flame],,*,,*,Endurance Mastery,Pn.5kioi91,Power,,-11.4501,0
             
             * sentinel master
            14:02:12:21:25:49.7::Gravitar,C[2 Alert_Gravitar],,*,Zeromancer,P[228613@190519 Zeromancer@Mojohama],Sentinel Mastery,Pn.Nnijtp,HitPoints,,-482.387,0
             
             
            */
            #endregion
            rawLogLine = logLine;

            string[] split = logLine.Split(separatorLog, StringSplitOptions.None);

            DateTime tmpTimeStamp;
            if (DateTime.TryParseExact(split[0], "yy:MM:dd:HH:mm:ss.f", cultureDisplay, DateTimeStyles.AssumeLocal, out tmpTimeStamp))
            {
                timestamp = tmpTimeStamp;
            }

            ownerDisplay = split[1].Trim();
            ownerInternal = split[2];
            sourceDisplay = split[3].Trim();
            sourceInternal = split[4];
            targetDisplay = split[5].Trim();
            targetInternal = split[6];
            eventDisplay = split[7].Trim();
            eventInternal = split[8];
            type = split[9];
            flags = split[10];
            magnitude = float.Parse(split[11], cultureLog);
            magnitudeBase = float.Parse(split[12], cultureLog);

            // set owner & targets
            if (ownerDisplay == "" || ownerDisplay == "*") { ownerDisplay = sourceDisplay; ownerInternal = sourceInternal; }
            if (sourceDisplay == "" || sourceDisplay == "*") { sourceDisplay = ownerDisplay; sourceInternal = ownerInternal; }
            if (targetDisplay == "" || targetDisplay == "*") { targetDisplay = sourceDisplay; targetInternal = sourceInternal; }
            if (eventDisplay == "") { eventDisplay = unkAbility; }
            if (!ownerInternal.Contains("@"))
            {
                if (!IsImportantNPC(ownerInternal))
                {
                    ownerInternal = unk;
                    ownerDisplay = unk;
                }
                else ownerDisplay = "[" + ownerDisplay + "]";
            }
            else
            {
                if (UseAccountNames)
                {
                    ownerDisplay = ownerDisplay + GetAccountName(ownerInternal);
                }
            }
            if (!targetInternal.Contains("@"))
            {
                if (!IsImportantNPC(targetInternal))
                    targetDisplay = unk;
                else targetDisplay = "[" + targetDisplay + "]";

            }
            else
            {
                if (UseAccountNames)
                {
                    targetDisplay = targetDisplay + GetAccountName(targetInternal);
                }
            }
            if (ownerInternal.Contains("@") && !targetInternal.Contains("@") && ownerDisplay != unk) COParser.AddAlly(ownerDisplay);

            // set effect type
            if (magnitude >= 0 && (!type.Contains("Shield")))
            {
                effectType = EffectType.Attack;
                swingtype = (int)effectType; // (!sourceInternal.Contains("@")) ? (int)SwingTypeEnum.NonMelee : (int)SwingTypeEnum.Melee;
                resistPct = (int)(1 - (magnitude / magnitudeBase));
                if (magnitudeBase == 0 && magnitude > 0) magnitudeBase = magnitude;
                flags += (flags.Length == 0) ? magnitudeBase.ToString() : "|" + ((int)magnitudeBase).ToString();
                dnum = new Dnum((int)magnitude);
                dnum.DamageString2 = ((int)magnitudeBase).ToString();
            }
            else if (magnitude < 0 && magnitudeBase <= 0 && type.Contains("HitPoints"))
            {
                effectType = EffectType.Heal;
                swingtype = swingtype = (int)effectType;
                dnum = new Dnum((int)magnitude * -1);
                if (sourceDisplay == targetDisplay || ownerDisplay == targetDisplay)
                {
                    flags += (flags.Length > 0) ? "|Self" : "Self";
                    effectType = EffectType.HealSelf;
                    swingtype = (int)effectType;
                }
            }
            else if (magnitude < 0 && magnitudeBase == 0 && type.Contains("Power"))
            {
                effectType = EffectType.PowerGain;
                swingtype = swingtype = (int)effectType;
                dnum = new Dnum((int)magnitude * -1);
            }
            else if (magnitude > 0 && magnitudeBase > 0 && type.Contains("Power"))
            {
                effectType = EffectType.PowerDrain;
                swingtype = swingtype = (int)effectType;
                dnum = new Dnum((int)magnitude * 1);
            }
            else if (type.Contains("Shield"))
            {
                effectType = EffectType.Shield;
                swingtype = swingtype = (int)effectType;
                dnum = new Dnum((int)magnitude * -1);
                dnum.DamageString2 = ((int)magnitudeBase * -1).ToString();
                flags += (flags.Length == 0) ? magnitudeBase.ToString() : "|" + ((int)magnitudeBase).ToString();
                if (sourceDisplay == targetDisplay || ownerDisplay == targetDisplay)
                {
                    flags += (flags.Length > 0) ? "|Self" : "Self";
                    effectType = EffectType.ShieldSelf;
                    swingtype = (int)effectType;
                }
            }
            else
            {
                dnum = Dnum.Unknown;
            }


            // set flags
            critical = flags.Contains("Critical");
            dodge = flags.Contains("Dodge");
            block = flags.Contains("Block");
            kill = (flags.Contains("Kill"));
            if (flags.Length == 0) flags = "None";

            if (type.Contains("BreakFree") || targetInternal.Contains("Object_Destructable")) ignore = true;
            if (kill && targetDisplay == unk) ignore = true;
            //if (effectType == EffectType.Healing && flags.Contains("Self")) ignore = true;
        }
コード例 #24
0
        private void AddCombatAction(LogLineEventArgs logInfo, string attacker, string victim, string theAttackType, bool critical, string special, string damage, SwingTypeEnum swingType, string damageType)
        {
            Dnum dnumDamage = NewDnum(damage, null);

            AddCombatAction(logInfo, attacker, victim, theAttackType, critical, special, dnumDamage, swingType, damageType);
        }
コード例 #25
0
        // Wrapper around AddCombatAction to add extra Tags that are used in the NW plugin.
        private void AddCombatActionNW(
            int swingType, bool critical, bool flank, string special, string attacker, string theAttackType, 
            Dnum damage, float realDamage, float baseDamage,
            DateTime time, int timeSorter, string victim, string theDamageType)
        {
            MasterSwing ms = new MasterSwing(swingType, critical, special, damage, time, timeSorter, theAttackType, attacker, theDamageType, victim);

            ms.Tags.Add("DamageF", realDamage);
            ms.Tags.Add("BaseDamage", baseDamage);
            ms.Tags.Add("Flank", flank);

            if (baseDamage > 0)
            {
                float eff = realDamage / baseDamage;
                ms.Tags.Add("Effectiveness", eff);
            }

            ActGlobals.oFormActMain.AddCombatAction(ms);
        }
コード例 #26
0
        // For hostile actions only.  Handles the SetEncounter().
        private void AddCombatActionHostile(
            ParsedLine line, int swingType, bool critical, string special, string theAttackType, Dnum Damage, float realDamage, string theDamageType, float baseDamage=0)
        {
            // Use encounter names attacker and target here.  This allows filtering
            if (ActGlobals.oFormActMain.SetEncounter(line.logInfo.detectedTime, line.encAttackerName, line.encTargetName))
            {
                // add Flank to AttackType if setting is set
                string tempAttack = theAttackType;
                if (line.flank && this.checkBox_flankSkill.Checked) tempAttack = theAttackType + ": Flank";

                AddCombatActionNW(
                    swingType, line.critical, line.flank, special, line.unitAttackerName,
                    tempAttack, Damage, realDamage, baseDamage, line.logInfo.detectedTime,
                    line.ts, line.unitTargetName, theDamageType);
            }
        }
コード例 #27
0
 public EnumRouteConstraint() : base(string.Join("|", Dnum <TEnum> .GetNames().Select(StringHelpers.Slugify)))
 {
 }
コード例 #28
0
 private void AddCombatAction(LogLineEventArgs logInfo, string attacker, string victim, string theAttackType, bool critical, string special, Dnum damage, SwingTypeEnum swingType)
 {
     AddCombatAction(logInfo, attacker, victim, theAttackType, critical, special, damage, swingType, string.Empty);
 }
コード例 #29
0
        private void ProcessLogLineEntry(LogLineEventArgs logInfo, ref string victim, ref string attacker, ref int attackType, ref string attackName, ref string special, ref Boolean SelfAttack, ref Int64 Amount, ref Boolean critical, Boolean colorlog, string attackSuffix, int eventType, MatchCollection matches)
        {
            if (eventType != -1) // Filtering
            {

                ActGlobals.oFormActMain.GlobalTimeSorter++;

                GroupCollection groups = matches[0].Groups;
                attacker = groups["actor"].Value.Trim(' ', '"');
                victim = groups["actee"].Value.Trim(' ', '"');
                attackName = removeFont(groups["attackName"].Value);
                if (("".Equals(attacker)) && !(attackName.Contains("\"")) && (SecretLanguage.Language == SecretLanguage.German))
                {
                    attacker = victim;
                }
                attackName = attackName.Trim(' ', '"', '\'') + attackSuffix;
                string damageTypeStr = TrimBrackets(groups["damageType"].Value);
                string damageClassStr = TrimBrackets(groups["damageClass"].Value);
                string blockTypeStr = TrimBrackets(groups["blockType"].Value);
                string amountStr = TrimBrackets(groups["amount"].Value);

                try
                {
                    if (amountStr == "")
                    {
                        Amount = 0;
                    }
                    else
                    {
                        Amount = Int64.Parse(amountStr);
                    }
                }
                catch (Exception)
                {
                    Amount = 0;
                }

                critical = false;
                if (groups["crit"].Length > 0)
                {
                    critical = true;
                }

                attacker = ConvertCharName(attacker);

                if ("Ihres".Equals(victim))
                {
                    victim = attacker;
                }
                else
                {
                    victim = ConvertCharName(victim);
                }

                // Ignore unknown attacks
                if (eventType == 12)
                {
                    if (attacker.Length < 1)
                    {
                        return;
                    }
                }
                else
                {
                    if (attacker.Length < 1 || victim.Length < 1)
                    {
                        return;
                    }
                }

                // Filter the results if enabled
                if (filterNames.Count > 0 && checkBox_Filter.Checked)
                {
                    if (checkBox_filterExclude.Checked)
                    {
                        if (filterNames.Contains(attacker) || filterNames.Contains(victim))
                        {
                            return;
                        }
                    }
                    else
                    {
                        if (!(filterNames.Contains(attacker) || filterNames.Contains(victim)))
                        {
                            return;
                        }
                    }
                }

                string DamageType;
                if (damageClassStr.Length > 0)
                {
                    DamageType = damageClassStr.Trim();
                }
                else
                {
                    DamageType = SecretLanguage.none;
                }

                if (SecretLanguage.Glancing.Equals(damageTypeStr))
                {
                    special = AddSpecial(special, damageTypeStr);
                }

                if (SecretLanguage.Penetrated.Equals(blockTypeStr))
                {
                    special = AddSpecial(special, blockTypeStr);
                }

                if (SecretLanguage.Blocked.Equals(blockTypeStr))
                {
                    special = AddSpecial(special, blockTypeStr);
                }

                // AEGIS
                if (victim.IndexOf(SecretLanguage.AegisShieldLine) != -1)
                {
                    foreach (var aegisShieldLine in SecretLanguage.aegisShieldLines)
                    {
                        matches = aegisShieldLine.Matches(victim);
                        if (matches != null && matches.Count > 0)
                        {
                            GroupCollection aegisGroup = matches[0].Groups;
                            string actee = aegisGroup["actee"].Value.Trim(' ', '"', '\'', '.');
                            string aegis = aegisGroup["aegis"].Value.Trim(' ', '"', '\'', '.');

                            if ((actee.Length > 0) && (aegis.Length > 0))
                            {
                                special = AddSpecial(special, SecretLanguage.Aegis);
                                if (DamageType == SecretLanguage.none)
                                {
                                    DamageType = (Amount > 0) ? aegis : "Aegis Mismatch";
                                }
                                actee = ConvertCharName(actee);
                                victim = (checkBox_ReduceAegis.Checked)? actee : actee + " - " + aegis + " AEGIS";
                                break;
                            }
                        }
                    }
                }

                // Ignore self hits
                if (attacker.Equals(victim))
                {
                    SelfAttack = true;
                }

                #region Main Parsing coding
                // Parsing codes
                //
                switch (eventType)
                {
                    #region Case 3 [Hit]
                    case 3:
                        // Normal attack
                        // <Attacker> , <Vicitim> , <Amount> , <Spell ID> , <Spell Name> )
                        // <attacker>'s <spell name> hits <Victim> for <Amount> damage.
                        if (Amount < 0) Amount = 0;

                        if ((((SelfAttack && ActGlobals.oFormActMain.InCombat) || !SelfAttack) && "" != attacker && "" != victim && ActGlobals.oFormActMain.SetEncounter(logInfo.detectedTime, attacker, victim)) || (ActGlobals.oFormActMain.InCombat && ("" == attacker || "" == victim))) // Altuslumen 1.3.0.3.2 one line edit
                        {
                            if (SelfAttack)
                            {
                                if (checkBox_SelfDamage.Checked)
                                {
                                    string newAttacker = "";
                                    if (checkBox_SelfPlayerDamage.Checked)
                                    {
                                        newAttacker = attacker;
                                    }
                                    newAttacker += "_self_";
                                    ActGlobals.oFormActMain.AddCombatAction(attackType, critical, special, newAttacker, attackName, Amount, logInfo.detectedTime, ActGlobals.oFormActMain.GlobalTimeSorter, victim, DamageType);
                                }
                                else
                                {
                                    ActGlobals.oFormActMain.AddCombatAction(attackType, critical, special, attacker, attackName, new Dnum(0, "0 (" + Amount + ")"), logInfo.detectedTime, ActGlobals.oFormActMain.GlobalTimeSorter, victim, DamageType);
                                }
                                //ActGlobals.oFormActMain.AddDamageToGraph(attacker, 0);
                            }
                            else
                            {
                                ActGlobals.oFormActMain.AddCombatAction(attackType, critical, special, attacker, attackName, Amount, logInfo.detectedTime, ActGlobals.oFormActMain.GlobalTimeSorter, victim, DamageType);
                                //ActGlobals.oFormActMain.AddDamageToGraph(attacker, Amount);
                            }

                            if (colorlog) logInfo.detectedType = System.Drawing.Color.Red.ToArgb();
                        }
                        break;
                    #endregion

                    #region Case 5 [Heals]
                    case 5:
                        // Someone is healed
                        // <Attacker> , <Vicitim> , <Amount> , <Spell ID> , <Spell Name> )
                        // <Attacker>'s <Spell Name> heals <Vicitim> for <Amount>.

                        // Check if overheal exists
                        Dnum DamN = new Dnum(Amount);
                        attackType = (int)SwingTypeEnum.Healing;

                        if (ActGlobals.oFormActMain.InCombat)
                        {
                            ActGlobals.oFormActMain.AddCombatAction(attackType, critical, special, attacker, attackName, DamN, logInfo.detectedTime, ActGlobals.oFormActMain.GlobalTimeSorter, victim, DamageType);
                            if (colorlog) logInfo.detectedType = System.Drawing.Color.Green.ToArgb();
                        }
                        break;
                    #endregion

                    #region Case 10 [Miss]
                    case 10:
                        // An attack misses
                        // 10 , T=N#R=O#<ID Number of attacker> , T=P#R=O#<ID Number of Victim> , T=X#R=X#<ID Number of attacker's owner if pet> , T=X#R=X#<ID Number of attacker's owner if pet> ,
                        // <Attacker> , <Vicitim> , <Amount> , <Spell ID> , <Spell Name> )
                        // <Attacker>'s <Spell Name> misses <Vicitim>.
                        if (ActGlobals.oFormActMain.SetEncounter(logInfo.detectedTime, attacker, victim))
                        {
                            ActGlobals.oFormActMain.AddCombatAction(attackType, critical, special, attacker, attackName, new Dnum(Dnum.Miss, SecretLanguage.Miss), logInfo.detectedTime, ActGlobals.oFormActMain.GlobalTimeSorter, victim, DamageType); // Altuslumen 1.3.0.3.2
                            if (colorlog) logInfo.detectedType = System.Drawing.Color.Blue.ToArgb();
                        }
                        break;
                    #endregion

                    #region Case 12 [Death]
                    case 12:
                        // Someone died
                        // 12 , T=N#R=O#<ID Number of attacker> , T=P#R=O#<ID Number of Victim> , T=X#R=X#<ID Number of attacker's owner if pet> , T=X#R=X#<ID Number of attacker's owner if pet> ,
                        // <Attacker> , <Vicitim> , <Amount> , <Spell ID> , <Spell Name> )

                        if (ActGlobals.oFormActMain.InCombat)
                        {
                            ActGlobals.oFormActMain.AddCombatAction(attackType, critical, SecretLanguage.none, attacker, SecretLanguage.Killing, Dnum.Death, logInfo.detectedTime, ActGlobals.oFormActMain.GlobalTimeSorter, attacker, DamageType); // Altuslumen 1.3.0.3.2
                            if (colorlog) logInfo.detectedType = System.Drawing.Color.Red.ToArgb();
                            //if (ActGlobals.oFormActMain.CbKillEnd_Checked && ActGlobals.oFormActMain.ActiveZone.ActiveEncounter.GetAllies().Contains(new CombatantData(CodeList[5], null))) ActGlobals.oFormActMain.EndCombat(true);
                        }
                        break;
                    #endregion

                }
                #endregion
            }
        }
コード例 #30
0
 public void AddCombatAction(int SwingType, bool Critical, string Special, string Attacker, string theAttackType, Dnum Damage, DateTime Time, int TimeSorter, string Victim, string theDamageType)
 {
     Advanced_Combat_Tracker.ActGlobals.oFormActMain.AddCombatAction(SwingType, Critical, Special, Attacker, theAttackType, Damage, Time, TimeSorter, Victim, theDamageType);
 }
コード例 #31
0
 private Rotate.RotateDirection Direction(Match match, int group)
 => Dnum <Rotate.RotateDirection> .Parse(match.Groups[group].Value);
コード例 #32
0
 public void AddCombatAction(int SwingType, bool Critical, string Special, string Attacker, string theAttackType, Dnum Damage, DateTime Time, int TimeSorter, string Victim, string theDamageType)
 {
     CombatActions.Add(new CombatAction(SwingType, Critical, Special, Attacker, theAttackType, Damage, Time, TimeSorter, Victim, theDamageType));
 }
コード例 #33
0
ファイル: COEvent.cs プロジェクト: Wodahsehtmai/CO-ACTLib
        public COEvent(string logLine, bool UseAccountNames = false)
        {
            #region logline examples

            /*
             *
             * damage example
             * 14:02:12:21:21:01.1::Mackenzie,P[11052553@2142550 Mackenzie@Avianos],,*,Gravitar,C[2 Alert_Gravitar],,Pn.Yxr66e,Crushing,,376.483,393.682
             *
             * healing device example
             * 14:02:12:21:20:37.1::,,,,Gigazeon,P[10064257@3338963 Gigazeon@Oyo32],Necrullitic Elixer,Pn.L02l82,HitPoints,,-206.25,0
             *
             * idf
             * 14:02:12:21:36:05.5::Double Tap,P[1416054@142085 Double Tap@MindCryme],,*,Pandra Pendragon,P[10359895@3350514 Pandra Pendragon@DaZee],Inertial Dampening Field,Pn.Lkgzw51,Shield,,-0,-111.272
             *
             * endurance mastery
             * 14:02:12:21:35:55.6::Lethal MK III,P[11190175@3312675 Lethal MK III@Viridian_Flame],,*,,*,Endurance Mastery,Pn.5kioi91,Power,,-11.4501,0
             *
             * sentinel master
             * 14:02:12:21:25:49.7::Gravitar,C[2 Alert_Gravitar],,*,Zeromancer,P[228613@190519 Zeromancer@Mojohama],Sentinel Mastery,Pn.Nnijtp,HitPoints,,-482.387,0
             *
             *
             */
            #endregion
            rawLogLine = logLine;

            string[] split = logLine.Split(separatorLog, StringSplitOptions.None);

            DateTime tmpTimeStamp;
            if (DateTime.TryParseExact(split[0], "yy:MM:dd:HH:mm:ss.f", cultureDisplay, DateTimeStyles.AssumeLocal, out tmpTimeStamp))
            {
                timestamp = tmpTimeStamp;
            }

            ownerDisplay   = split[1].Trim();
            ownerInternal  = split[2];
            sourceDisplay  = split[3].Trim();
            sourceInternal = split[4];
            targetDisplay  = split[5].Trim();
            targetInternal = split[6];
            eventDisplay   = split[7].Trim();
            eventInternal  = split[8];
            type           = split[9];
            flags          = split[10];
            magnitude      = float.Parse(split[11], cultureLog);
            magnitudeBase  = float.Parse(split[12], cultureLog);

            // set owner & targets
            if (ownerDisplay == "" || ownerDisplay == "*")
            {
                ownerDisplay = sourceDisplay; ownerInternal = sourceInternal;
            }
            if (sourceDisplay == "" || sourceDisplay == "*")
            {
                sourceDisplay = ownerDisplay; sourceInternal = ownerInternal;
            }
            if (targetDisplay == "" || targetDisplay == "*")
            {
                targetDisplay = sourceDisplay; targetInternal = sourceInternal;
            }
            if (eventDisplay == "")
            {
                eventDisplay = unkAbility;
            }
            if (!ownerInternal.Contains("@"))
            {
                if (!IsImportantNPC(ownerInternal))
                {
                    ownerInternal = unk;
                    ownerDisplay  = unk;
                }
                else
                {
                    ownerDisplay = "[" + ownerDisplay + "]";
                }
            }
            else
            {
                if (UseAccountNames)
                {
                    ownerDisplay = ownerDisplay + GetAccountName(ownerInternal);
                }
            }
            if (!targetInternal.Contains("@"))
            {
                if (!IsImportantNPC(targetInternal))
                {
                    targetDisplay = unk;
                }
                else
                {
                    targetDisplay = "[" + targetDisplay + "]";
                }
            }
            else
            {
                if (UseAccountNames)
                {
                    targetDisplay = targetDisplay + GetAccountName(targetInternal);
                }
            }
            if (ownerInternal.Contains("@") && !targetInternal.Contains("@") && ownerDisplay != unk)
            {
                COParser.AddAlly(ownerDisplay);
            }

            // set effect type
            if (magnitude >= 0 && (!type.Contains("Shield")))
            {
                effectType = EffectType.Attack;
                swingtype  = (int)effectType; // (!sourceInternal.Contains("@")) ? (int)SwingTypeEnum.NonMelee : (int)SwingTypeEnum.Melee;
                resistPct  = (int)(1 - (magnitude / magnitudeBase));
                if (magnitudeBase == 0 && magnitude > 0)
                {
                    magnitudeBase = magnitude;
                }
                flags += (flags.Length == 0) ? magnitudeBase.ToString() : "|" + ((int)magnitudeBase).ToString();
                dnum   = new Dnum((int)magnitude);
                dnum.DamageString2 = ((int)magnitudeBase).ToString();
            }
            else if (magnitude < 0 && magnitudeBase <= 0 && type.Contains("HitPoints"))
            {
                effectType = EffectType.Heal;
                swingtype  = swingtype = (int)effectType;
                dnum       = new Dnum((int)magnitude * -1);
                if (sourceDisplay == targetDisplay || ownerDisplay == targetDisplay)
                {
                    flags     += (flags.Length > 0) ? "|Self" : "Self";
                    effectType = EffectType.HealSelf;
                    swingtype  = (int)effectType;
                }
            }
            else if (magnitude < 0 && magnitudeBase == 0 && type.Contains("Power"))
            {
                effectType = EffectType.PowerGain;
                swingtype  = swingtype = (int)effectType;
                dnum       = new Dnum((int)magnitude * -1);
            }
            else if (magnitude > 0 && magnitudeBase > 0 && type.Contains("Power"))
            {
                effectType = EffectType.PowerDrain;
                swingtype  = swingtype = (int)effectType;
                dnum       = new Dnum((int)magnitude * 1);
            }
            else if (type.Contains("Shield"))
            {
                effectType         = EffectType.Shield;
                swingtype          = swingtype = (int)effectType;
                dnum               = new Dnum((int)magnitude * -1);
                dnum.DamageString2 = ((int)magnitudeBase * -1).ToString();
                flags             += (flags.Length == 0) ? magnitudeBase.ToString() : "|" + ((int)magnitudeBase).ToString();
                if (sourceDisplay == targetDisplay || ownerDisplay == targetDisplay)
                {
                    flags     += (flags.Length > 0) ? "|Self" : "Self";
                    effectType = EffectType.ShieldSelf;
                    swingtype  = (int)effectType;
                }
            }
            else
            {
                dnum = Dnum.Unknown;
            }


            // set flags
            critical = flags.Contains("Critical");
            dodge    = flags.Contains("Dodge");
            block    = flags.Contains("Block");
            kill     = (flags.Contains("Kill"));
            if (flags.Length == 0)
            {
                flags = "None";
            }

            if (type.Contains("BreakFree") || targetInternal.Contains("Object_Destructable"))
            {
                ignore = true;
            }
            if (kill && targetDisplay == unk)
            {
                ignore = true;
            }
            //if (effectType == EffectType.Healing && flags.Contains("Self")) ignore = true;
        }
コード例 #34
0
        private void AddCombatAction(LogLineEventArgs logInfo, string attacker, string victim, string theAttackType, bool critical, string special, Dnum damage, SwingTypeEnum swingType, string damageType)
        {
            DateTime now = logInfo.detectedTime;

            if (ActGlobals.oFormActMain.SetEncounter(now, attacker, victim))
            {
                // attempt to guess the party member's class
                if (GuessChanter)
                {
                    PartyMembers.SetClass(attacker, theAttackType);
                }

                // redirect attacks from pets/servants as coming from summoner
                if (SummonerRecordSet.IsSummonedPet(attacker))
                {
                    var summonerRecord = SummonerRecordSet.GetSummonerRecord(victim, attacker, now);
                    if (summonerRecord != null)
                    {
                        string pet = attacker;
                        if (AionData.Pet.IsTargettedPet(pet))
                        {
                            attacker      = summonerRecord.Actor;
                            theAttackType = summonerRecord.Skill;
                        }
                        else if (LinkPets)
                        {
                            attacker = summonerRecord.Actor;
                            if (summonerRecord.Duration <= 60)
                            {
                                theAttackType = summonerRecord.Skill;
                            }
                            else
                            {
                                theAttackType += "(" + pet + ")";
                            }
                        }
                    }
                }
                else if (SummonerRecordSet.IsSummonedPet(victim))
                {
                    if (AionData.Pet.IsPet(victim))
                    {
                        // handle player pets
                        if (AionData.Pet.PetDurations[victim] <= 60)
                        {
                            return;                                          // ignore damage done to short-duration temporary pets // TODO: this should be a checkbox as this will decrease the dps of the attacker
                        }
                        var summonerRecord = SummonerRecordSet.GetSummonerRecord(null, victim, now);
                        if (LinkPets)
                        {
                            ////return; // TODO: how do we treat damage done to spiritmaster's pets?
                        }
                    }
                    else
                    {
                        // handle monster/unknown pets
                        if (LinkPets)
                        {
                            // TODO: how do we treat damage done to mob's pets?
                        }
                        else
                        {
                            ////victim += " (inc)"; // TODO: this should be a checkbox if we want damage shown to mob pets
                        }
                    }
                }

                int globalTime = ActGlobals.oFormActMain.GlobalTimeSorter++;
                ActGlobals.oFormActMain.AddCombatAction((int)swingType, critical, special, attacker, theAttackType, damage, now, globalTime, victim, damageType);
            }
        }