Ejemplo n.º 1
0
        // Show a specific Player:
        public ActionResult Show(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Player player = db.Players.SqlQuery("SELECT * FROM Players WHERE playerID=@playerID", new SqlParameter("@playerID", id)).FirstOrDefault();

            if (player == null)
            {
                return(HttpNotFound());
            }

            // Retrieve list of Positions each Player plays
            string          query           = "SELECT * FROM Positions INNER JOIN PositionPlayers on Positions.positionID = PositionPlayers.Position_positionID WHERE Player_playerID = @id";
            SqlParameter    param           = new SqlParameter("@id", id);
            List <Position> PositionPlayers = db.Positions.SqlQuery(query, param).ToList();

            ShowPlayer viewmodel = new ShowPlayer();

            viewmodel.Player    = player;
            viewmodel.Positions = PositionPlayers;

            return(View(viewmodel));
        }
Ejemplo n.º 2
0
        // GET: Player/Details/5
        public ActionResult Details(int id)
        {
            ShowPlayer          ViewModel = new ShowPlayer();
            string              url       = "playerdata/findplayer/" + id;
            HttpResponseMessage response  = client.GetAsync(url).Result;

            //Can catch the status code (200 OK, 301 REDIRECT), etc.
            //Debug.WriteLine(response.StatusCode);
            if (response.IsSuccessStatusCode)
            {
                //Put data into player data transfer object
                PlayerDto SelectedPlayer = response.Content.ReadAsAsync <PlayerDto>().Result;
                ViewModel.player = SelectedPlayer;


                url      = "playerdata/findteamforplayer/" + id;
                response = client.GetAsync(url).Result;
                TeamDto SelectedTeam = response.Content.ReadAsAsync <TeamDto>().Result;
                ViewModel.team = SelectedTeam;

                return(View(ViewModel));
            }
            else
            {
                return(RedirectToAction("Error"));
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Goes into a season folder, gets all files in the folder path, picks one and plays it if it is a video file
        /// </summary>
        /// <param name="folderPath">Path to pick file from</param>
        /// <param name="rnd">Random number generator</param>
        /// <returns>True if the video is started</returns>
        private bool PickAndPlayVideoFile(string folderPath)
        {
            // Stop the timer if it's running
            if (timer.Enabled)
            {
                timer.Stop();
            }

            // Get all files in the folder and pick one
            var files = Directory.GetFiles(folderPath, "*", SearchOption.AllDirectories).Where(f => IsVideoFile(f)).ToArray();
            var file  = files.Count() > 0 ? files[rnd.Next(files.Count())] : null;

            // If it's a video file, play it and break the loop
            try
            {
                // Open the file in the media player control, set and start timer
                new Thread(() =>
                {
                    Thread.CurrentThread.IsBackground = true;
                    ShowPlayer.currentMedia           = ShowPlayer.newMedia(file);
                }).Start();

                PlayLabel_Click(null, null);
                timer.Interval = (int)(ShowPlayer.newMedia(file).duration * 1000);
                timer.Start();

                return(true);
            }
            catch (Exception) { }
            return(false);
        }
Ejemplo n.º 4
0
        //public MediaElement MusicFlowME = new MediaElement();
        public MainPage()
        {
            backgroundAudioTaskStarted = new AutoResetEvent(false);
            this.NavigationCacheMode   = NavigationCacheMode.Required;
            this.InitializeComponent();
            titlebar = ApplicationView.GetForCurrentView().TitleBar;
            Color black = Color.FromArgb(0xFF, 0x00, 0x00, 0x00);
            Color white = new Color()
            {
                A = 255, R = 255, G = 255, B = 255
            };
            Color grey = new Color()
            {
                A = 255, R = 100, G = 100, B = 100
            };

            titlebar.BackgroundColor               = black;
            titlebar.InactiveBackgroundColor       = black;
            titlebar.ButtonBackgroundColor         = black;
            titlebar.ButtonInactiveBackgroundColor = black;
            titlebar.ForegroundColor               = white;
            titlebar.InactiveForegroundColor       = white;
            titlebar.ButtonForegroundColor         = white;
            titlebar.ButtonInactiveForegroundColor = white;
            titlebar.ButtonHoverForegroundColor    = grey;
            titlebar.ButtonHoverBackgroundColor    = black;

            SystemNavigationManager.GetForCurrentView().BackRequested += (s, e) =>
            {
                //var pageType = (Window.Current.Content as Frame).Content.GetType().Name;
                var currentPage = MainFrame.CurrentSourcePageType.ToString();
                switch (currentPage)
                {
                case "MusicFlow.AlbumView":
                    ShowPlayer.Begin();
                    break;

                case "MusicFlow.AlbumDetail":
                    ShowPlayer.Begin();
                    e.Handled = true;
                    MainFrame.GoBack();
                    break;

                case "MusicFlow.NowPlaying":
                    ShowPlayer.Begin();
                    e.Handled = true;
                    MainFrame.GoBack();
                    break;

                default:
                    break;
                }
            };
        }
Ejemplo n.º 5
0
 //查看玩家幸存状态
 public void GameCheck()
 {
     if (ShowPlayer.activeSelf)
     {
         ShowPlayer.SetActive(false);
     }
     else
     {
         ShowPlayer.SetActive(true);
         string tmp;
         int    i;
         GameObject.Find("ShowPlayer/ID").GetComponent <Text> ().text     = "";
         GameObject.Find("ShowPlayer/Name").GetComponent <Text> ().text   = "";
         GameObject.Find("ShowPlayer/Role").GetComponent <Text> ().text   = "";
         GameObject.Find("ShowPlayer/Alive").GetComponent <Text> ().text  = "";
         GameObject.Find("ShowPlayer/Police").GetComponent <Text> ().text = "";
         GameObject.Find("ShowPlayer/Lover").GetComponent <Text> ().text  = "";
         for (i = 0; i < PlayerNum; i++)
         {
             tmp = Player [i].GetComponent <PlayerCard> ().PlayerID.ToString() + "\n";
             GameObject.Find("ShowPlayer/ID").GetComponent <Text> ().text += tmp;
             tmp = Player [i].GetComponent <PlayerCard> ().Name + "\n";
             GameObject.Find("ShowPlayer/Name").GetComponent <Text> ().text += tmp;
             tmp = Player [i].GetComponent <PlayerCard> ().Role + "\n";
             GameObject.Find("ShowPlayer/Role").GetComponent <Text> ().text += tmp;
             if (Player [i].GetComponent <PlayerCard> ().IsAlive)
             {
                 GameObject.Find("ShowPlayer/Alive").GetComponent <Text> ().text += "存活\n";
             }
             else
             {
                 GameObject.Find("ShowPlayer/Alive").GetComponent <Text> ().text += "死亡\n";
             }
             if (Player [i] == jingzhang)
             {
                 GameObject.Find("ShowPlayer/Police").GetComponent <Text> ().text += "警长\n";
             }
             else
             {
                 GameObject.Find("ShowPlayer/Police").GetComponent <Text> ().text += "\n";
             }
             if (Player [i] == Lovers [0] || Player [i] == Lovers [1])
             {
                 GameObject.Find("ShowPlayer/Lover").GetComponent <Text> ().text += "情侣\n";
             }
             else
             {
                 GameObject.Find("ShowPlayer/Lover").GetComponent <Text> ().text += "\n";
             }
         }
     }
 }
Ejemplo n.º 6
0
 // Use this for initialization
 void Start()
 {
     //初始化游戏界面
     CanClick = true;
     ConfigUI.SetActive(false);
     PlayerUI.SetActive(false);
     ChoosePlayer.SetActive(false);
     ShowInfo.SetActive(false);
     ShowPlayer.SetActive(false);
     GameStage = "准备开始";
     GameMode  = "Player";
     GameObject.Find("MainCanvas/NextStage").GetComponent <Button> ().interactable = false;
 }
Ejemplo n.º 7
0
        public ActionResult Player(int?fedSeason, int?PlayerId)
        {
            try
            {
                ShowPlayer player = new ShowPlayer();
                if (fedSeason != null && PlayerId != null)
                {
                    player = new ServiceDatabase().ShowPlayer(Convert.ToInt32(fedSeason), Convert.ToInt32(PlayerId), null);
                }

                return(View(player));
            }
            catch (Exception e)
            {
                ViewBag.Error = e.Message;
                return(View("Error"));
            }
        }
Ejemplo n.º 8
0
        public PlayerWindow(string filepath)
        {
            InitializeComponent();
            Show();
            ShowPlayer.openPlayer(filepath);

            ShowPlayer.settings.autoStart = true;
            var show = ShowPlayer.newMedia(filepath);

            timer.Tick    += Timer_Tick;
            timer.Interval = (int)(show.duration * 1000) + 1;

            ShowPlayer.currentMedia = show;

            while (ShowPlayer.openState != WMPLib.WMPOpenState.wmposMediaOpen || ShowPlayer.playState != WMPLib.WMPPlayState.wmppsPlaying)
            {
            }
            timer.Start();

            ShowPlayer.fullScreen = true;
        }
Ejemplo n.º 9
0
        public void _RecvHandler(ProxySocket Socket, uint Serial, NewProxy Proxy, ref MemoryStream Buffer)
        {
            Packet Packet = new Packet(Buffer.ToArray());

            try
            {
                switch ((ServerAction)Packet.Action)
                {
                    #region Location
                case ServerAction.Location:
                {
                    PlayerLocation Loc = Packet.Read <PlayerLocation>(0);
                    Clients[Serial].Aisling.Location.X  = Loc.X;
                    Clients[Serial].Aisling.Location.Y  = Loc.Y;
                    Clients[Serial].Aisling.LastRefresh = DateTime.Now;
                } break;

                    #endregion
                    #region Map Info
                case ServerAction.MapInfo:
                {
                    MapInfo Info = Packet.Read <MapInfo>(0);
                    Clients[Serial].Aisling.Location.Map = Info.MapNumber;
                    //if (Clients[Serial].Aisling.Map.Number != Info.MapNumber)
                    Clients[Serial].Aisling.Map.Entities.Clear();
                    Clients[Serial].Aisling.Map.Number = Info.MapNumber;
                    Clients[Serial].Aisling.Map.Width  = Info.TileX;
                    Clients[Serial].Aisling.Map.Height = Info.TileY;
                    new System.Threading.Thread(new System.Threading.ThreadStart(Clients[Serial].WaitForMapLoad)).Start();
                    Clients[Serial].Aisling.LastRefresh = DateTime.Now;
                } break;

                    #endregion
                    #region Animation
                case ServerAction.Animation:
                {
                    string PString = Packet.GetPacketString(Packet.Data);
                    Net.ServerStructs.Animation AnimationStruct = Packet.Read <Net.ServerStructs.Animation>(0);
                    Types.Animation             Animation       = new Types.Animation(AnimationStruct.ToWho, AnimationStruct.FromWho, AnimationStruct.Number, AnimationStruct.Speed);
                    Clients[Serial].Aisling.Map.Entities[Animation.ToWho].Animations.Add(Animation);
                    if (Clients[Serial].Aisling.Map.Entities[Animation.ToWho].Animations.Count > 30)
                    {
                        Clients[Serial].Aisling.Map.Entities[Animation.ToWho].Animations =
                            new List <Types.Animation>(
                                from var
                                in Clients[Serial].Aisling.Map.Entities[Animation.ToWho].Animations
                                where var.TimeElapsed < new TimeSpan(0, 5, 0)
                                select var
                                );
                    }
                    if (AnimationStruct.ToWho == Clients[Serial].Aisling.Serial)
                    {
                        Clients[Serial].Aisling.Animations.Add(Animation);
                    }
                    else
                    {
                        if (Clients[Serial].Aisling.Map.Entities.ContainsKey(Animation.ToWho) &&
                            Clients[Serial].Aisling.Map.Entities.ContainsKey(Animation.FromWho))
                        {
                            if (Clients[Serial].Aisling.Map.Entities[Animation.FromWho].EntityType == MapEntity.Type.Player)
                            {
                                if (Clients[Serial].Aisling.Map.Entities[Animation.ToWho].EntityType == MapEntity.Type.Monster)
                                {
                                    if (!(Clients[Serial].Aisling.Map.Entities[Animation.FromWho] as AislingEntity).Targets.Contains(Animation.ToWho))
                                    {
                                        (Clients[Serial].Aisling.Map.Entities[Animation.FromWho] as AislingEntity).Targets.Add(Animation.ToWho);
                                    }
                                }
                                foreach (MapEntity Entity in Clients[Serial].Aisling.Map.FindEntities((MapEntity MapEnt) => MapEnt.EntityType == MapEntity.Type.Monster && MapEnt.Serial == Animation.ToWho))
                                {
                                    (Entity as Monster).Animations.Add(Animation);
                                }
                                (Clients[Serial].Aisling.Map.Entities[Animation.FromWho] as AislingEntity).Targets =
                                    new List <uint>
                                    (
                                        from var in (Clients[Serial].Aisling.Map.Entities[Animation.FromWho] as AislingEntity).Targets
                                        where Clients[Serial].Aisling.Map.Entities.ContainsKey(var)
                                        select var
                                    );
                            }
                        }
                    }
                } break;

                    #endregion
                    #region Skill Slot Info
                case ServerAction.SkillSlotInfo:
                {
                    SkillSlotInfo Info = Packet.Read <SkillSlotInfo>(0);
                    if (Info.Slot <= 36)
                    {
                        Clients[Serial].Aisling.TemSkills[(int)(Info.Slot - 1)] = new SkillSlot()
                        {
                            Icon = Info.Icon,
                            Name = Info.Name
                        };
                    }
                    else if (Info.Slot <= 72)
                    {
                        Clients[Serial].Aisling.MedSkills[(int)(Info.Slot - 37)] = new SkillSlot()
                        {
                            Icon = Info.Icon,
                            Name = Info.Name
                        };
                    }
                    else if (Info.Slot <= 90)
                    {
                        Clients[Serial].Aisling.WorldSkills[(int)(Info.Slot - 73)] = new SkillSlot()
                        {
                            Icon = Info.Icon,
                            Name = Info.Name
                        };
                    }
                } break;

                    #endregion
                    #region Spell Slot Info
                case ServerAction.SpellSlotInfo:
                {
                    SpellSlotInfo Info = Packet.Read <SpellSlotInfo>(0);
                    if (Info.Slot <= 36)
                    {
                        Clients[Serial].Aisling.TemSpells[Info.Slot - 1] = new SpellSlot()
                        {
                            Lines      = Info.Lines,
                            Name       = Info.Name,
                            Prompt     = Info.Prompt,
                            TargetType = Info.TargetType
                        };
                    }
                    else if (Info.Slot <= 72)
                    {
                        Clients[Serial].Aisling.MedSpells[Info.Slot - 37] = new SpellSlot()
                        {
                            Lines      = Info.Lines,
                            Name       = Info.Name,
                            Prompt     = Info.Prompt,
                            TargetType = Info.TargetType
                        };
                    }
                    else if (Info.Slot <= 90)
                    {
                        Clients[Serial].Aisling.WorldSpells[Info.Slot - 73] = new SpellSlot()
                        {
                            Lines      = Info.Lines,
                            Name       = Info.Name,
                            Prompt     = Info.Prompt,
                            TargetType = Info.TargetType
                        };
                    }
                } break;

                    #endregion
                    #region Remove Slot
                case ServerAction.RemoveItem:
                {
                    RemoveSlot Info = Packet.Read <RemoveSlot>(0);
                    Clients[Serial].Aisling.Inventory[Info.Slot - 1] = null;
                } break;

                case ServerAction.RemoveSpell:
                {
                    RemoveSlot Info = Packet.Read <RemoveSlot>(0);
                    if (Info.Slot <= 36)
                    {
                        Clients[Serial].Aisling.TemSpells[(int)(Info.Slot - 1)] = null;
                    }
                    else if (Info.Slot <= 72)
                    {
                        Clients[Serial].Aisling.MedSpells[(int)(Info.Slot - 37)] = null;
                    }
                    else if (Info.Slot <= 90)
                    {
                        Clients[Serial].Aisling.WorldSpells[(int)(Info.Slot - 73)] = null;
                    }
                } break;

                case ServerAction.RemoveSkill:
                {
                    RemoveSlot Info = Packet.Read <RemoveSlot>(0);
                    if (Info.Slot <= 36)
                    {
                        Clients[Serial].Aisling.TemSkills[(int)(Info.Slot - 1)] = null;
                    }
                    else if (Info.Slot <= 72)
                    {
                        Clients[Serial].Aisling.MedSkills[(int)(Info.Slot - 37)] = null;
                    }
                    else if (Info.Slot <= 90)
                    {
                        Clients[Serial].Aisling.WorldSkills[(int)(Info.Slot - 73)] = null;
                    }
                } break;

                    #endregion
                    #region Spell Bar
                case ServerAction.SpellBar:
                {
                    PlayerSpellBar PlayerBar = Packet.Read <PlayerSpellBar>(0);
                    Types.SpellBar SpellBar  = new SpellBar(PlayerBar.Icon, PlayerBar.Color);
                    if (!Clients[Serial].Aisling.SpellBar.ContainsKey(PlayerBar.Icon))
                    {
                        Clients[Serial].Aisling.SpellBar.Add(PlayerBar.Icon, SpellBar);
                    }
                    if (SpellBar.Color == PlayerSpellBar.SpellIconColor.Gone)
                    {
                        Clients[Serial].Aisling.SpellBar.Remove(SpellBar.Icon);
                    }
                } break;

                    #endregion
                    #region Client Walk
                case ServerAction.ClientWalk:
                {
                    ClientSpriteWalk WalkingDirection = Packet.Read <ClientSpriteWalk>(0);
                    Clients[Serial].Aisling.Location.AbsX = WalkingDirection.X;
                    Clients[Serial].Aisling.Location.AbsY = WalkingDirection.Y;
                    switch (WalkingDirection.Direction)
                    {
                    case FaceDirection.Down:
                        Clients[Serial].Aisling.Location.AbsY++;
                        break;

                    case FaceDirection.Up:
                        Clients[Serial].Aisling.Location.AbsY--;
                        break;

                    case FaceDirection.Left:
                        Clients[Serial].Aisling.Location.AbsX--;
                        break;

                    case FaceDirection.Right:
                        Clients[Serial].Aisling.Location.AbsX++;
                        break;
                    }
                    Clients[Serial].Aisling.Location.AbsLocation = WalkingDirection.Direction;
                    Clients[Serial].Aisling.LastBattle           = DateTime.Now;
                } break;

                    #endregion
                    #region HPBar Display
                case ServerAction.DisplayHPBAR:
                {
                    HPBAR EntityBar = Packet.Read <HPBAR>(0);
                    Console.WriteLine(EntityBar.Percent);
                    if (Clients[Serial].Aisling.Map.Entities.ContainsKey(EntityBar.Serial))
                    {
                        Clients[Serial].Aisling.Map.Entities[EntityBar.Serial].HPPercent = EntityBar.Percent;
                    }
                    if (EntityBar.Serial == Clients[Serial].Aisling.Serial)
                    {
                        Clients[Serial].HPPercent = EntityBar.Percent;
                    }
                    foreach (MapEntity Entity in Clients[Serial].Aisling.Map.FindEntities((MapEntity MapEnt) => MapEnt.EntityType == MapEntity.Type.Monster && MapEnt.Serial == EntityBar.Serial))
                    {
                        try
                        {
                            if (EntityBar.Percent < 100)
                            {
                                (Entity as Monster).WasHit = true;
                            }
                            (Clients[Serial].EntityFromSerial(EntityBar.Serial) as Monster).WasPramhed = false;
                            (Clients[Serial].EntityFromSerial(EntityBar.Serial) as Monster).HPPercent  = EntityBar.Percent;
                        }
                        catch { }
                    }
                    //if we hit our target, reset hit count to zero
                    if (Clients[Serial].Aisling.testSer == EntityBar.Serial)
                    {
                        Clients[Serial].Aisling.test = 0;
                        //we hit it, so it's not pramhed
                        Clients[Serial].Aisling.Map.Entities[EntityBar.Serial].WasPramhed = false;
                    }
                } break;

                    #endregion
                    #region Adding Sprites / Monsters / Npcs / Items
                case ServerAction.AddSprites:
                {
                    AddSprites Sprites = AddSprites.FromPacket(Packet);
                    foreach (AddSprites.MonsterSprite Monster in Sprites.Monsters)
                    {
                        if (!Clients[Serial].Aisling.Map.Entities.ContainsKey(Monster.Serial))
                        {
                            Clients[Serial].Aisling.Map.Entities.Add(Monster.Serial, new Monster()
                                {
                                    Icon      = Monster.Icon,
                                    IsPet     = Monster.IsPet,
                                    HPPercent = 100,
                                    Date      = DateTime.Now,
                                    Location  = new Location()
                                    {
                                        X         = Monster.X,
                                        Y         = Monster.Y,
                                        Direction = Monster.Direction,
                                        Map       = Clients[Serial].Aisling.Location.Map
                                    },
                                    Serial = Monster.Serial
                                }
                                                                     );
                        }
                    }
                    foreach (AddSprites.NPCSprite NPC in Sprites.NPCs)
                    {
                        if (Clients[Serial].Aisling.Map.Entities.ContainsKey(NPC.Serial))
                        {
                            Clients[Serial].Aisling.Map.Entities.Remove(NPC.Serial);
                        }
                        Clients[Serial].Aisling.Map.Entities.Add(NPC.Serial, new NPC()
                            {
                                Icon     = NPC.Icon,
                                Location = new Location()
                                {
                                    X         = NPC.X,
                                    Y         = NPC.Y,
                                    Direction = NPC.Direction,
                                    Map       = Clients[Serial].Aisling.Location.Map
                                },
                                Name   = NPC.Name,
                                Serial = NPC.Serial
                            }
                                                                 );
                    }
                    foreach (AddSprites.ItemSprite Item in Sprites.Items)
                    {
                        if (Clients[Serial].Aisling.Map.Entities.ContainsKey(Item.Serial))
                        {
                            Clients[Serial].Aisling.Map.Entities.Remove(Item.Serial);
                        }
                        Clients[Serial].Aisling.Map.Entities.Add(Item.Serial, new Item()
                            {
                                Icon     = Item.Icon,
                                Location = new Location()
                                {
                                    X         = Item.X,
                                    Y         = Item.Y,
                                    Direction = (FaceDirection)FaceDirection.Up,
                                    Map       = Clients[Serial].Aisling.Location.Map,
                                },
                                Serial = Item.Serial
                            }
                                                                 );
                    }
                } break;

                    #endregion
                    #region Adding Players
                case ServerAction.AddPlayer:
                {
                    if (Packet.Data[11] == 0x00 &&
                        Packet.Data[12] == 0x00 &&
                        Packet.Data[13] == 0x00 &&
                        Packet.Data[14] == 0x00)
                    {
                        Packet.Data[13] = 0x50;
                    }
                    if (Packet[11] == 0xFF && Packet[12] == 0xFF)
                    {
                        ShowPlayerForm Info = Packet.Read <ShowPlayerForm>(0);

                        if (Packet.Data[11] == 0x00 &&
                            Packet.Data[12] == 0x00 &&
                            Packet.Data[13] == 0x00 &&
                            Packet.Data[14] == 0x00)
                        {
                            Info.Name = "icube";
                        }
                        if (!(new Location()
                            {
                                X = Info.X, Y = Info.Y
                            }.OnScreenOf(Clients[Serial].Aisling.Location)))
                        {
                            break;
                        }
                        if (Info.Serial == Clients[Serial].Aisling.Serial)
                        {
                            Clients[Serial].Aisling.Location.X = Info.X;
                            Clients[Serial].Aisling.Location.Y = Info.Y;
                        }
                        else
                        {
                            if (Clients[Serial].Aisling.Map.Entities.ContainsKey(Info.Serial))
                            {
                                Clients[Serial].Aisling.Map.Entities.Remove(Info.Serial);
                            }
                            Clients[Serial].Aisling.Map.Entities.Add(Info.Serial, new AislingEntity()
                                {
                                    LegendInfo = new LegendInfo.Entry[0],
                                    Location   = new Location()
                                    {
                                        X         = Info.X,
                                        Y         = Info.Y,
                                        Map       = Clients[Serial].Aisling.Location.Map,
                                        Direction = Info.Direction
                                    },
                                    Name         = Info.Name.value,
                                    Serial       = Info.Serial,
                                    HoverMessage = Info.HoverMessage.value
                                }
                                                                     );
                        }
                    }
                    else
                    {
                        ShowPlayer Info = null;
                        Info = Packet.Read <ShowPlayer>(0);
                        Console.WriteLine(Info.Name);
                        if (!(new Location()
                            {
                                X = Info.X, Y = Info.Y
                            }.OnScreenOf(Clients[Serial].Aisling.Location)))
                        {
                            break;
                        }
                        if (Packet.Data[11] == 0x00 &&
                            Packet.Data[12] == 0x00 &&
                            Packet.Data[13] == 0x00 &&
                            Packet.Data[14] == 0x00)
                        {
                            Info.Name = "icube";
                        }
                        if (Info.Serial == Clients[Serial].Aisling.Serial)
                        {
                            Clients[Serial].Aisling.Location.X = Info.X;
                            Clients[Serial].Aisling.Location.Y = Info.Y;
                        }
                        else
                        {
                            if (Clients[Serial].Aisling.Map.Entities.ContainsKey(Info.Serial))
                            {
                                Clients[Serial].Aisling.Map.Entities.Remove(Info.Serial);
                            }
                            Clients[Serial].Aisling.Map.Entities.Add(Info.Serial, new AislingEntity()
                                {
                                    LegendInfo = new LegendInfo.Entry[0],
                                    Location   = new Location()
                                    {
                                        X         = Info.X,
                                        Y         = Info.Y,
                                        Map       = Clients[Serial].Aisling.Location.Map,
                                        Direction = Info.Direction
                                    },
                                    Name         = Info.Name.value,
                                    Serial       = Info.Serial,
                                    HoverMessage = Info.HoverMessage.value
                                }
                                                                     );
                        }
                    }
                } break;

                    #endregion
                    #region Remove Sprite
                case ServerAction.RemoveSprite:
                {
                    uint EntitySerial = Packet.Read <RemoveSprite>(0).ID;
                    if (Clients[Serial].Aisling.Map.Entities.ContainsKey(EntitySerial))
                    {
                        Clients[Serial].Aisling.Map.Entities.Remove(EntitySerial);
                    }
                } break;

                    #endregion
                    #region Stats Updated
                case ServerAction.StatsUpdated:
                {
                    bool[] Bools = Packet.Read <StatsUpdate>(0).BitMaskValues();
                    int    Index = 3;
                    if (Bools[2])
                    {
                        StatsStructA StructA = Packet.Read <StatsStructA>(Index);
                        Clients[Serial].Aisling.Stats.STR        = StructA.STR;
                        Clients[Serial].Aisling.Stats.INT        = StructA.INT;
                        Clients[Serial].Aisling.Stats.WIS        = StructA.WIS;
                        Clients[Serial].Aisling.Stats.CON        = StructA.CON;
                        Clients[Serial].Aisling.Stats.DEX        = StructA.DEX;
                        Clients[Serial].Aisling.Stats.Points     = StructA.Points;
                        Clients[Serial].Aisling.Stats.MaxHP      = StructA.HPMax;
                        Clients[Serial].Aisling.Stats.MaxMP      = StructA.MPMax;
                        Clients[Serial].Aisling.Stats.WeightCurr = StructA.WeightCurr;
                        Clients[Serial].Aisling.Stats.WeightMax  = StructA.WeightMax;
                        Clients[Serial].Aisling.Stats.Ability    = StructA.Ability;
                        Clients[Serial].Aisling.Stats.Level      = StructA.Level;
                        Index += 28;
                    }
                    if (Bools[3])
                    {
                        StatsStructB StructB = Packet.Read <StatsStructB>(Index);
                        Clients[Serial].Aisling.Stats.CurHP = StructB.HPCurr;
                        Clients[Serial].Aisling.Stats.CurMP = StructB.MPCurr;
                        Index += 8;
                    }
                    if (Bools[4])
                    {
                        StatsStructC StructC = Packet.Read <StatsStructC>(Index);
                        Clients[Serial].Aisling.Stats.AbilityExperience = StructC.AExp;
                        Clients[Serial].Aisling.Stats.LevelExperience   = StructC.EXP;
                        Clients[Serial].Aisling.Stats.Gold        = StructC.Gold;
                        Clients[Serial].Aisling.Stats.GP          = StructC.GP;
                        Clients[Serial].Aisling.Stats.NextLevel   = StructC.NextLev;
                        Clients[Serial].Aisling.Stats.NextAbility = StructC.NextAB;
                        Index += 24;
                    }
                    if (Bools[5])
                    {
                        StatsStructD StructD = Packet.Read <StatsStructD>(Index);
                        Clients[Serial].Aisling.Stats.AC             = StructD.AC;
                        Clients[Serial].Aisling.Stats.MR             = StructD.MR;
                        Clients[Serial].Aisling.Stats.HIT            = StructD.HIT;
                        Clients[Serial].Aisling.Stats.DAM            = StructD.DAM;
                        Clients[Serial].Aisling.Stats.AttackElement  = StructD.AEle;
                        Clients[Serial].Aisling.Stats.DefenseElement = StructD.DEle;
                        Index += 13;
                    }
                }
                break;

                    #endregion
                    #region Entity Walked
                case ServerAction.EntityWalked:
                {
                    SpriteWalk EntityWalk = Packet.Read <SpriteWalk>(0);
                    ushort     XDIFF = EntityWalk.X, YDIFF = EntityWalk.Y;
                    switch (EntityWalk.Direction)
                    {
                    case FaceDirection.Down:
                        YDIFF++;
                        break;

                    case FaceDirection.Left:
                        XDIFF--;
                        break;

                    case FaceDirection.Right:
                        XDIFF++;
                        break;

                    case FaceDirection.Up:
                        YDIFF--;
                        break;
                    }
                    if (Clients[Serial].Aisling.Map.Entities.ContainsKey(EntityWalk.Serial))
                    {
                        if (Clients[Serial].Aisling.Map.Entities[EntityWalk.Serial].EntityType == MapEntity.Type.Monster)
                        {
                            (Clients[Serial].Aisling.Map.Entities[EntityWalk.Serial] as Monster).WasHit = false;
                        }
                        Clients[Serial].Aisling.Map.Entities[EntityWalk.Serial].WasHit             = false;
                        Clients[Serial].Aisling.Map.Entities[EntityWalk.Serial].Location.X         = XDIFF;
                        Clients[Serial].Aisling.Map.Entities[EntityWalk.Serial].Location.Y         = YDIFF;
                        Clients[Serial].Aisling.Map.Entities[EntityWalk.Serial].Location.Direction = EntityWalk.Direction;
                    }
                    if (Clients[Serial].AttackTargetSerial == EntityWalk.Serial)
                    {
                        Clients[Serial].Aisling.AttackLoops = 0;
                        Clients[Serial].Aisling.test2       = false;
                    }
                } break;

                    #endregion
                    #region Appendage
                case ServerAction.Appendage:
                {
                    Appendage BodyItems = Packet.Read <Appendage>(0);
                    Clients[Serial].Aisling.Body[(Aisling.SpriteBody.Appendage.Slot)BodyItems.Slot]      = new Aisling.SpriteBody.Appendage(BodyItems.Icon, BodyItems.Name);
                    Clients[Serial].Aisling.Body[(Aisling.SpriteBody.Appendage.Slot)BodyItems.Slot].Icon = BodyItems.Icon;
                } break;

                    #endregion
                    #region Entity Turned
                case ServerAction.EntityTurn:
                {
                    EntityDirection EntityDir = Packet.Read <EntityDirection>(0);
                    if (Clients[Serial].Aisling.Map.Entities.ContainsKey(EntityDir.Serial))
                    {
                        Clients[Serial].Aisling.Map.Entities[EntityDir.Serial].Location.Direction = EntityDir.FaceDirection;
                        if (Clients[Serial].Aisling.Map.Entities[EntityDir.Serial].EntityType == MapEntity.Type.Monster)
                        {
                            (Clients[Serial].Aisling.Map.Entities[EntityDir.Serial] as Monster).WasSuained = false;
                        }
                    }
                } break;

                    #endregion
                    #region Body Animation
                case ServerAction.BodyAnimation:
                {
                    SpriteAnimation EntityAnimation = Packet.Read <SpriteAnimation>(0);
                    if (Clients[Serial].Aisling.Serial == EntityAnimation.ID)
                    {
                        Clients[Serial].Aisling.AttackLanded = true;
                    }
                    else
                    {
                        Clients[Serial].Aisling.AttackLanded = false;
                    }

                    //we enganged attacking
                    if (EntityAnimation.ID == Clients[Serial].Aisling.Serial)
                    {
                        if (EntityAnimation.Animation == 1 || EntityAnimation.Animation == 129 ||
                            EntityAnimation.Animation == 139 || EntityAnimation.Animation == 132)
                        {
                            Clients[Serial].Aisling.Swings++;
                            Clients[Serial].Aisling.EngagedCombat = true;
                        }
                        else
                        {
                            Clients[Serial].Aisling.EngagedCombat = false;
                        }
                    }
                    else
                    {
                        Clients[Serial].Aisling.EngagedCombat = false;
                        if (Clients[Serial].Aisling.Map.Entities[EntityAnimation.ID].EntityType == MapEntity.Type.Player)
                        {
                            var v =
                                from var
                                in Clients[Serial].Aisling.Map.EntityList
                                where
                                var.Location.X == Clients[Serial].Aisling.Map.Entities[EntityAnimation.ID].Location.InfrontOf.X &&
                                var.Location.Y == Clients[Serial].Aisling.Map.Entities[EntityAnimation.ID].Location.InfrontOf.Y
                                select var;
                            if (v.Count() > 0)
                            {
                                foreach (var ent in v)
                                {
                                    if (!(Clients[Serial].Aisling.Map.Entities[EntityAnimation.ID] as AislingEntity).Targets.Contains(ent.Serial))
                                    {
                                        (Clients[Serial].Aisling.Map.Entities[EntityAnimation.ID] as AislingEntity).Targets.Add(ent.Serial);
                                    }
                                }
                            }
                            (Clients[Serial].Aisling.Map.Entities[EntityAnimation.ID] as AislingEntity).Targets =
                                new List <uint>
                                (
                                    from var in (Clients[Serial].Aisling.Map.Entities[EntityAnimation.ID] as AislingEntity).Targets
                                    where Clients[Serial].Aisling.Map.Entities.ContainsKey(var)
                                    select var
                                );
                        }
                    }
                } break;

                    #endregion
                    #region Sound Played
                case ServerAction.SoundPlay:
                {
                    PlaySound SoundNumber = Packet.Read <PlaySound>(0);
                    Clients[Serial].Aisling.LastSound = new Sounds()
                    {
                        Number = SoundNumber.Number
                    };
                    if (Clients[Serial].AttackTargetSerial > 0)
                    {
                        Clients[Serial].Aisling.testSer = Clients[Serial].AttackTargetSerial;
                    }
                } break;

                    #endregion
                    #region Chat Messages
                case ServerAction.Chat:
                {
                    Chat ChatMessage = Packet.Read <Chat>(0);
                    Clients[Serial].Aisling.ChatMessages.Add(new Aisling.ChatMessage(Convert.ToBoolean(ChatMessage.Type), ChatMessage.Serial, ChatMessage.Message));
                } break;

                    #endregion
                    #region Bar Messages
                case ServerAction.Bar:
                {
                    BarMessage BarMessage = Packet.Read <BarMessage>(0);
                    Clients[Serial].Aisling.BarMessages.Add(new Aisling.BarMessage((Aisling.BarMessage.MessageType)BarMessage.Type, BarMessage.Message));
                    if (BarMessage.Message.value.ToLower().StartsWith("these items are cursed"))
                    {
                        if (Clients[Serial].Aisling.Map.Entities.ContainsKey(Clients[Serial].ItemTargetSerial))
                        {
                            (Clients[Serial].Aisling.Map.Entities[Clients[Serial].ItemTargetSerial] as Item).IsBanned = true;
                        }
                    }
                } break;

                    #endregion
                    #region Group
                case ServerAction.GroupRequest:
                {
                    GroupRequest Request = Packet.Read <GroupRequest>(0);
                } break;

                    #endregion
                    #region Remove Appendage
                case ServerAction.RemoveAppendage:
                {
                    if (Clients[Serial].Aisling.Body[(Aisling.SpriteBody.Appendage.Slot)Packet[2]] != null)
                    {
                        string ItemRemoved = Clients[Serial].Aisling.Body[(Aisling.SpriteBody.Appendage.Slot)Packet[2]].Name;
                    }
                    Clients[Serial].Aisling.Body[(Aisling.SpriteBody.Appendage.Slot)Packet[2]] = null;
                } break;

                    #endregion
                default:
                {
                } break;
                }
                if (Clients[Serial].Aisling.EngagedCombat)
                {
                    Clients[Serial].Aisling.test++;
                    Clients[Serial].Aisling.EngagedCombat = false;
                }
            }
            catch { }
        }