예제 #1
0
        public override ResponseData CheckedEvent(GameScript handle)
        {
            ResponseData result = new ResponseData("event");

            if (!isEvented)
            {
                try
                {
                    switch (this.TypeInEvent)
                    {
                    case TypeInEventX.E_Crack:
                    {
                        EnemyComp e = inEventData as EnemyComp;
                        IEnumerable <EnemyComp> query = from ec in handle.ListEnemy
                                                        where ec.Addr == e.Addr
                                                        where ec.IsAllHack == true && ec.IsOffFirewall == true
                                                        select ec;
                        if (query.Count() > 0)
                        {
                            result = EventedData(handle);
                        }
                        break;
                    }

                    case TypeInEventX.E_Scan:
                    {
                        EnemyComp e = inEventData as EnemyComp;
                        IEnumerable <EnemyComp> query = from ec in handle.ListEnemy
                                                        where ec.Addr == e.Addr
                                                        where ec.isScaning == true
                                                        select ec;
                        if (query.Count() > 0)
                        {
                            result = EventedData(handle);
                        }
                        break;
                    }

                    case TypeInEventX.File:
                    {
                        FileX file = inEventData as FileX;
                        IEnumerable <FileX> query = from f in handle.player.Computer.FileList
                                                    where f.Name == file.Name
                                                    select f;
                        if (query.Count() > 0)
                        {
                            result = EventedData(handle);
                        }
                        break;
                    }

                    case TypeInEventX.Time:
                    {
                        if (isOk)
                        {
                            result = EventedData(handle);
                        }
                        break;
                    }

                    case TypeInEventX.Wanted:
                    {
                        int wanted = int.Parse(inEventData.ToString());
                        if (handle.player.Wanted >= wanted)
                        {
                            result = EventedData(handle);
                        }
                        break;
                    }

                    case TypeInEventX.Connected:
                    {
                        EnemyComp eComp = inEventData as EnemyComp;
                        if (eComp.isScaning)
                        {
                            if (handle.player.isConnected)
                            {
                                if ((handle.player.ConnectedEnemy.IsOffFirewall) && (handle.player.ConnectedEnemy.IsAllHack))
                                {
                                    if (handle.player.ConnectedEnemy.Addr == eComp.Addr)
                                    {
                                        result = EventedData(handle);
                                    }
                                }
                            }
                        }
                        break;
                    }

                    case TypeInEventX.Service_off:
                    {
                        ServiceX serv    = inEventData as ServiceX;
                        var      servOff = from ec in handle.ListEnemy
                                           where ec.Addr == serv.Parrent.Addr
                                           select ec into enC
                                           from ser in enC.Services
                                           where ser.Port == serv.Port
                                           select ser;
                        if (servOff.Count() > 0)
                        {
                            ServiceX s = servOff.ElementAt <ServiceX>(0);
                            if (s.isRun == false)
                            {
                                result = EventedData(handle);
                            }
                        }


                        break;
                    }
                    }
                }
                catch (Exception ex) { LOG.Error("Error event to: " + ex.Message); }
            }

            return(result);
        }