Пример #1
0
        private void OnCastEnded(bool _, LogLineEventArgs logInfo)
        {
            if (state != States.In905P)
            {
                return;
            }
            string log = logInfo.logLine;
            Match  m   = OnCast2.Match(log);

            if (m.Success)
            {
                lock (lock1)
                {
                    uint id = Convert.ToUInt32(m.Groups[1].Value, 16);
                    if (map.ContainsKey(id))
                    {
                        int index = map[id];
                        Pod pod   = pods[index];
                        if (pod.isActive)
                        {
                            pod.isActive = false;
                            count--;
                            PlaceKupo.Log("辅助机" + id.ToString("X") + "已施放" + (pod.isLaser ? "激光。" : "重锤。"));
                        }
                    }
                    if (count == 0)
                    {
                        PlaceKupo.WriteWaymark(Preset.Reset);
                        PlaceKupo.Log("场地标点已重置。");
                    }
                }
            }
        }
Пример #2
0
        //void Countdown(bool _, LogLineEventArgs logInfo)
        //{
        //    string log = logInfo.logLine;
        //    if (Regex.IsMatch(log, ".{14} 00:0044:905P:装备重型陆战装置[::]安装通信官21O自我数据! 强行连接自卫系统!"))
        //    {
        //        System.Threading.Thread.Sleep(2000);
        //        PlaceKupo.SendCommand("/e countdown 30");
        //    }
        //}

        private void OnCombatantAdded(bool _, LogLineEventArgs logInfo)
        {
            if (state != States.In905P)
            {
                return;
            }
            string log = logInfo.logLine;
            Match  m   = OnAdded.Match(log);

            if (m.Success)
            {
                Pod pod = new Pod
                {
                    Id = Convert.ToUInt32(m.Groups[1].Value, 16)
                };
                float x = float.Parse(m.Groups[2].Value);
                float y = float.Parse(m.Groups[4].Value);
                float z = float.Parse(m.Groups[3].Value);
                pod.Loc      = new Point(x, y, z);
                pod.isActive = false;
                int index = GetLoc(pod);
                pods[index] = pod;
                map.Add(pod.Id, index);
                PlaceKupo.Log("已添加辅助机: " + pod.Id.ToString("X") + ", 位置: " + pod.Loc.ToString() + ", 编号: " + index);
            }
        }
Пример #3
0
 private void MarkExistence(float x, float z, int mark)
 {
     if (x == 164.9F || x == 234.9F)
     {
         if (Zpos.ContainsKey(z))
         {
             Znum[Zpos[z]] += mark;
         }
         else
         {
             PlaceKupo.Log("Error: Invalid Position of Pod: z: " + z.ToString());
         }
     }
     if (z == -665F || z == -735F)
     {
         if (Xpos.ContainsKey(x))
         {
             Xnum[Xpos[x]] += mark;
         }
         else
         {
             PlaceKupo.Log("Error: Invalid Position of Pod: x: " + x.ToString());
         }
     }
 }
Пример #4
0
 void IPlaceFunc.AddDelegates()
 {
     ActGlobals.oFormActMain.OnLogLineRead += DelegateManager;
     ActGlobals.oFormActMain.OnLogLineRead += R010;
     ActGlobals.oFormActMain.OnLogLineRead += R011;
     PlaceKupo.subscription.ParsedLogLine  += OnCastStarted;
     PlaceKupo.Log("人偶军事基地组件加载完成。");
 }
Пример #5
0
 void IPlaceFunc.RemoveDelegates()
 {
     ActGlobals.oFormActMain.OnLogLineRead -= R010;
     ActGlobals.oFormActMain.OnLogLineRead -= R011;
     PlaceKupo.subscription.ParsedLogLine  -= OnCastStarted;
     ActGlobals.oFormActMain.OnLogLineRead -= DelegateManager;
     PlaceKupo.Log("人偶军事基地组件移除完成。");
     sw.Close();
 }
Пример #6
0
        private void OnTeleportCasted(bool _, LogLineEventArgs logInfo)
        {
            if (state != States.In2P)
            {
                return;
            }
            string log = logInfo.logLine;
            Match  m   = OnTeleport.Match(log);

            if (m.Success)
            {
                lock (lock2)
                {
                    uint id1 = Convert.ToUInt32(m.Groups[1].Value, 16);
                    uint id2 = Convert.ToUInt32(m.Groups[2].Value, 16);
                    if (list == null)
                    {
                        list = PlaceKupo.repository.GetCombatantList();
                    }
                    var cmb = list.FirstOrDefault(x => x.ID == id1);
                    if (cmb != null)
                    {
                        MarkExistence(cmb.PosX, cmb.PosY, 1);
                        PlaceKupo.Log(string.Format("已添加 {3}({4}): ({0},{1},{2})", cmb.PosX.ToString(), cmb.PosZ.ToString(), cmb.PosY.ToString(), cmb.Name, cmb.ID.ToString("X")));
                    }
                    cmb = list.FirstOrDefault(x => x.ID == id2);
                    if (cmb != null)
                    {
                        MarkExistence(cmb.PosX, cmb.PosY, -1);
                        PlaceKupo.Log(string.Format("已移除 {3}({4}): ({0},{1},{2})", cmb.PosX.ToString(), cmb.PosZ.ToString(), cmb.PosY.ToString(), cmb.Name, cmb.ID.ToString("X")));
                    }
                    teleport++;
                    if (teleport == 2)
                    {
                        int cnt = 0;
                        for (int i = 0; i < 4; i++)
                        {
                            if (Xnum[i] == 0)
                            {
                                for (int j = 0; j < 4; j++)
                                {
                                    if (Znum[j] == 0)
                                    {
                                        PlaceKupo.WriteWaymark(new Waymark(Xenum[i], -480F, Zenum[j], 0, true), cnt++);
                                        PlaceKupo.Log(string.Format("已标记安全点: ({0},-480,{1})。", Xenum[i], Zenum[j]));
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #7
0
        private void OnCombatantAdded2(bool _, LogLineEventArgs logInfo)
        {
            if (state != States.In2P)
            {
                return;
            }
            string log = logInfo.logLine;
            Match  m   = OnAdded2.Match(log);

            if (m.Success)
            {
                float x = float.Parse(m.Groups[1].Value);
                float z = float.Parse(m.Groups[2].Value);
                MarkExistence(x, z, 1);
                PlaceKupo.Log(string.Format("已添加辅助机: ({0},-480,{1})", x, z));
            }
        }
Пример #8
0
        private void OnCastStarted(uint _, int type, string log)
        {
            if (state != States.In905P)
            {
                return;
            }
            if (type != 20)
            {
                return;            //20
            }
            Match m = OnCast1.Match(log);

            if (m.Success)
            {
                lock (lock1)
                {
                    bool isLaser = m.Groups[2].Value == "4FF0";
                    uint id      = Convert.ToUInt32(m.Groups[1].Value, 16);
                    if (map.ContainsKey(id))
                    {
                        int index = map[id];
                        Pod pod   = pods[index];
                        pod.isActive = true;
                        pod.isLaser  = isLaser;
                        count++;
                        PlaceKupo.Log("辅助机" + id.ToString("X") + "开始咏唱" + (isLaser ? "激光。" : "重锤。"));
                    }
                    if (count == 8)
                    {
                        int cnt = 0;
                        for (int i = 0; i < 8; i++)
                        {
                            var x = pods[i];
                            var y = pods[(i + 1) % 8];
                            if (x.isActive && y.isActive && x.isLaser && y.isLaser)
                            {
                                Point mid = Point.Midpoint(x.Loc, y.Loc);
                                PlaceKupo.WriteWaymark(new Waymark(mid, 0, true), cnt++);
                                PlaceKupo.Log("已标记安全点: " + mid.ToString());
                            }
                        }
                    }
                }
            }
        }
Пример #9
0
        /// <summary>
        /// 在盛夏农庄对木人做出动作后会在聊天栏默语Hello World!
        /// </summary>
        /// <param name="isImport"></param>
        /// <param name="logInfo"></param>
        private void HelloWorld(bool isImport, LogLineEventArgs logInfo)
        {
            string log = logInfo.logLine;//ACT日志行

            if (Regex.IsMatch(log, "^.{14} 00:001d:.*?木人"))
            {
                if (cmb == null)
                {
                    var list = PlaceKupo.repository.GetCombatantList();
                    cmb = list.FirstOrDefault(cmb => cmb.ID == PlaceKupo.repository.GetCurrentPlayerID());
                }
                PlaceKupo.SendCommand("/e Hello World!");
            }
#if DEBUG
            if (Regex.IsMatch(log, "testbar"))
            {
                PlaceKupo.Log(log);
            }
#endif
        }
Пример #10
0
        private void OnCombatantRemoved(bool _, LogLineEventArgs logInfo)
        {
            if (state != States.In905P)
            {
                return;
            }
            string log = logInfo.logLine;
            Match  m   = OnRemoved.Match(log);

            if (m.Success)
            {
                uint id = Convert.ToUInt32(m.Groups[1].Value, 16);
                if (map.ContainsKey(id))
                {
                    int index = map[id];
                    pods[index] = null;
                    map.Remove(id);
                }
                PlaceKupo.Log("已移除辅助机: " + id.ToString("X") + '。');
            }
        }
Пример #11
0
        private void DelegateManager(bool _, LogLineEventArgs logInfo)
        {
            string log = logInfo.logLine;

            if (PlaceKupo.Wipe.IsMatch(log))
            {
                state = States.Idle;
                map.Clear();
                pods = new Pod[10];
                Xnum = new int[4];
                Znum = new int[4];
                Zpos.Clear();
                Xpos.Clear();
                count    = 0;
                teleport = 0;
                list     = null;
                return;
            }
            if (On905P.IsMatch(log))
            {
                count = 0;
                state = States.In905P;
                PlaceKupo.Log("905P组件加载完成。");
                return;
            }
            if (On905PDead.IsMatch(log))
            {
                count = 0;
                state = States.Idle;
                PlaceKupo.Log("905P组件移除完成。");
                return;
            }
            if (On2P.IsMatch(log))
            {
                teleport = 0;
                state    = States.In2P;
                PlaceKupo.Log("2P融合体组件加载完成。");
                return;
            }
        }