public IWarpAgreePacketData WithWarpAnimation(WarpAnimation warpAnimation)
        {
            var newData = MakeCopy(this);

            newData.WarpAnimation = warpAnimation;
            return(newData);
        }
Esempio n. 2
0
        // Handles PLAYERS_AGREE packet which is sent when a player enters a map by warp or upon spawning
        private void _handlePlayersAgree(Packet pkt)
        {
            if (pkt.GetByte() != 255 || OnPlayerEnterMap == null)
            {
                return;
            }

            CharacterData newGuy = new CharacterData(pkt);

            byte          nextByte = pkt.GetByte();
            WarpAnimation anim     = WarpAnimation.None;

            if (nextByte != 255)             //next byte was the warp animation: sent on Map::Enter in eoserv
            {
                pkt.Skip(-1);
                anim = (WarpAnimation)pkt.GetChar();
                if (pkt.GetByte() != 255)                 //the 255 still needs to be read...
                {
                    return;
                }
            }
            //else... //next byte was a 255. proceed normally.

            if (pkt.GetChar() == 1)             //0 for NPC, 1 for player. In eoserv it is never 0.
            {
                OnPlayerEnterMap(newGuy, anim);
            }
        }
Esempio n. 3
0
        private void _handleWarpAgree(Packet pkt)
        {
            if (pkt.GetChar() != 2 || OnWarpAgree == null)
            {
                return;
            }

            short         mapID = pkt.GetShort();
            WarpAnimation anim  = (WarpAnimation)pkt.GetChar();

            int numOtherCharacters = pkt.GetChar();

            if (pkt.GetByte() != 255)
            {
                return;
            }

            List <CharacterData> otherCharacters = new List <CharacterData>(numOtherCharacters - 1);

            for (int i = 0; i < numOtherCharacters; ++i)
            {
                CharacterData newChar = new CharacterData(pkt);
                otherCharacters.Add(newChar);
                if (pkt.GetByte() != 255)
                {
                    return;
                }
            }

            List <NPCData> otherNPCs = new List <NPCData>();

            while (pkt.PeekByte() != 255)
            {
                otherNPCs.Add(new NPCData(pkt));
            }
            if (pkt.GetByte() != 255)
            {
                return;
            }

            List <MapItem> otherItems = new List <MapItem>();

            while (pkt.ReadPos < pkt.Length)
            {
                otherItems.Add(new MapItem
                {
                    uid    = pkt.GetShort(),
                    id     = pkt.GetShort(),
                    x      = pkt.GetChar(),
                    y      = pkt.GetChar(),
                    amount = pkt.GetThree(),
                    //turn off drop protection for items coming into view - server will validate
                    time     = DateTime.Now.AddSeconds(-5),
                    npcDrop  = false,
                    playerID = -1
                });
            }

            OnWarpAgree(mapID, anim, otherCharacters, otherNPCs, otherItems);
        }
Esempio n. 4
0
        public void NotifyMapChanged(WarpAnimation warpAnimation, bool differentMapID)
        {
            StopAllAnimations();
            ClearCharacterRenderersAndCache();
            ClearNPCRenderersAndCache();
            ShowMapNameIfAvailable(differentMapID);
            //todo: show message if map is a PK map
            ShowMapTransition(differentMapID);

            //todo: render warp animation on main character renderer
        }
Esempio n. 5
0
        //mapping of warp animations to actual GFX values in the file.
        public static int ConvertWarpAnimToGFX(WarpAnimation anim, out bool multiGfx)
        {
            multiGfx = false;

            if (anim == WarpAnimation.Admin)
            {
                return(9);                //12 is also the same
            }
            //todo: other warp animations?

            return(0);
        }
Esempio n. 6
0
        // Remove a player from view (sent by server when someone is out of range)
        private void _handleAvatarRemove(Packet pkt)
        {
            if (OnPlayerAvatarRemove == null)
            {
                return;
            }

            short         id   = pkt.GetShort();
            WarpAnimation anim = (WarpAnimation)(pkt.Length > pkt.ReadPos ? pkt.GetChar() : 0);

            OnPlayerAvatarRemove(id, anim);
        }
Esempio n. 7
0
        public void WarpAgreeAction(short mapID, WarpAnimation anim, List <CharacterData> chars, List <NPCData> npcs, List <MapItem> items)
        {
            if (mapID >= 0)
            {
                if (!_tryLoadMap(mapID))
                {
                    EOGame.Instance.LostConnectionDialog();
                    EODialog.Show("Something went wrong when loading the map. Try logging in again.", "Map Load Error");
                }

                MainPlayer.ActiveCharacter.CurrentMap = mapID;
                if (!_tryLoadMap(mapID))
                {
                    EOGame.Instance.LostConnectionDialog();
                    return;
                }
                ActiveMapRenderer.SetActiveMap(MapCache[mapID]);
            }

            ActiveMapRenderer.ClearOtherPlayers();
            ActiveMapRenderer.ClearOtherNPCs();
            ActiveMapRenderer.ClearMapItems();

            foreach (var data in chars)
            {
                if (data.ID == MainPlayer.ActiveCharacter.ID)
                {
                    MainPlayer.ActiveCharacter.ApplyData(data);
                }
                else
                {
                    ActiveMapRenderer.AddOtherPlayer(data);
                }
            }

            foreach (var data in npcs)
            {
                ActiveMapRenderer.AddOtherNPC(data);
            }

            foreach (MapItem mi in items)
            {
                ActiveMapRenderer.AddMapItem(mi);
            }
        }
Esempio n. 8
0
        public void WarpAgreeAction(short mapID, WarpAnimation anim, List <CharacterData> chars, List <NPCData> npcs, List <MapItem> items)
        {
            if (mapID >= 0)
            {
                if (!_tryLoadMap(mapID))
                {
                    throw new IOException("Something was wrong with the map file...");
                }

                MainPlayer.ActiveCharacter.CurrentMap = mapID;
                ActiveMapRenderer.SetActiveMap(ActiveMap);
            }

            ActiveMapRenderer.ClearOtherPlayers();
            ActiveMapRenderer.ClearOtherNPCs();
            ActiveMapRenderer.ClearMapItems();

            foreach (var data in chars)
            {
                if (data.ID == MainPlayer.ActiveCharacter.ID)
                {
                    MainPlayer.ActiveCharacter.ApplyData(data);
                }
                else
                {
                    ActiveMapRenderer.AddOtherPlayer(data);
                }
            }

            foreach (var data in npcs)
            {
                ActiveMapRenderer.AddOtherNPC(data);
            }

            foreach (MapItem mi in items)
            {
                ActiveMapRenderer.AddMapItem(mi);
            }
        }
Esempio n. 9
0
 private void _playerAvatarRemove(short id, WarpAnimation anim)
 {
     World.Instance.ActiveMapRenderer.RemoveOtherPlayer(id, anim);
 }
Esempio n. 10
0
 private void _playerEnterMap(CharacterData data, WarpAnimation anim)
 {
     World.Instance.ActiveMapRenderer.AddOtherPlayer(data, anim);
 }
Esempio n. 11
0
		public void WarpAgreeAction(short mapID, WarpAnimation anim, List<CharacterData> chars, List<NPCData> npcs, List<MapItem> items)
		{
			if (!_tryLoadMap(mapID, false))
			{
				EOGame.Instance.DoShowLostConnectionDialogAndReturnToMainMenu();
				return;
			}

			if(mapID > 0)
				MainPlayer.ActiveCharacter.CurrentMap = mapID;

			if(ActiveMapRenderer.MapRef != MapCache[MainPlayer.ActiveCharacter.CurrentMap])
				ActiveMapRenderer.SetActiveMap(MapCache[MainPlayer.ActiveCharacter.CurrentMap]);

			ActiveMapRenderer.ClearOtherPlayers();
			ActiveMapRenderer.ClearOtherNPCs();
			ActiveMapRenderer.ClearMapItems();

			foreach (var data in chars)
			{
				if (data.ID == MainPlayer.ActiveCharacter.ID)
					MainPlayer.ActiveCharacter.ApplyData(data);
				else
					ActiveMapRenderer.AddOtherPlayer(data);
			}

			foreach (var data in npcs)
				ActiveMapRenderer.AddOtherNPC(data);

			foreach (MapItem mi in items)
				ActiveMapRenderer.AddMapItem(mi);

			if (anim == WarpAnimation.Admin)
			{
				var effectRenderer = new EffectRenderer(EOGame.Instance, ActiveCharacterRenderer, delegate { });
				effectRenderer.SetEffectInfoTypeAndID(EffectType.WarpDestination, 0);
				effectRenderer.ShowEffect();
			}
		}
Esempio n. 12
0
		public void RemoveOtherPlayer(short id, WarpAnimation anim = WarpAnimation.None)
		{
			lock (_characterListLock)
			{
				int ndx;
				if ((ndx = _characterRenderers.FindIndex(cc => cc.Character.ID == id)) >= 0)
				{
					var rend = _characterRenderers[ndx];
					rend.HideChatBubble();
					rend.Visible = false;
					_characterRenderers.Remove(rend);

					if (anim == WarpAnimation.Admin)
					{
						rend.ShowWarpLeave();
					}
					else
					{
						rend.Close();
					}
				}
			}
		}
 private void _playerAvatarRemove(short id, WarpAnimation anim)
 {
     World.Instance.ActiveMapRenderer.RemoveOtherPlayer(id, anim);
 }
Esempio n. 14
0
        //mapping of warp animations to actual GFX values in the file.
        public static int ConvertWarpAnimToGFX(WarpAnimation anim, out bool multiGfx)
        {
            multiGfx = false;

            if (anim == WarpAnimation.Admin)
                return 9; //12 is also the same
            //todo: other warp animations?

            return 0;
        }
Esempio n. 15
0
        public void WarpAgreeAction(short mapID, WarpAnimation anim, List<CharacterData> chars, List<NPCData> npcs, List<MapItem> items)
        {
            if (mapID >= 0)
            {
                if (!_tryLoadMap(mapID))
                {
                    EOGame.Instance.LostConnectionDialog();
                    EODialog.Show("Something went wrong when loading the map. Try logging in again.", "Map Load Error");
                }

                MainPlayer.ActiveCharacter.CurrentMap = mapID;
                if (!_tryLoadMap(mapID))
                {
                    EOGame.Instance.LostConnectionDialog();
                    return;
                }
                ActiveMapRenderer.SetActiveMap(MapCache[mapID]);
            }

            ActiveMapRenderer.ClearOtherPlayers();
            ActiveMapRenderer.ClearOtherNPCs();
            ActiveMapRenderer.ClearMapItems();

            foreach (var data in chars)
            {
                if (data.ID == MainPlayer.ActiveCharacter.ID)
                    MainPlayer.ActiveCharacter.ApplyData(data);
                else
                    ActiveMapRenderer.AddOtherPlayer(data);
            }

            foreach (var data in npcs)
                ActiveMapRenderer.AddOtherNPC(data);

            foreach (MapItem mi in items)
                ActiveMapRenderer.AddMapItem(mi);
        }
Esempio n. 16
0
 public void NotifyMapChanged(WarpAnimation warpAnimation, bool differentMapID)
 {
 }
Esempio n. 17
0
		public void AddOtherPlayer(CharacterData c, WarpAnimation anim = WarpAnimation.None)
		{
			CharacterRenderer otherRend = null;
			lock (_rendererListLock)
			{
				Character other = otherRenderers.Select(x => x.Character).FirstOrDefault(x => x.Name == c.Name && x.ID == c.ID);
				if (other == null)
				{
					other = new Character(m_api, c);
					lock (_rendererListLock)
					{
						otherRenderers.Add(otherRend = new CharacterRenderer(other));
						otherRenderers[otherRenderers.Count - 1].Visible = true;
						otherRenderers[otherRenderers.Count - 1].Initialize();
					}
					other.RenderData.SetUpdate(true);
				}
				else
				{
					other.ApplyData(c);
				}
			}

			if (anim == WarpAnimation.Admin && otherRend != null)
			{
				var effectRenderer = new EffectRenderer((EOGame) Game, otherRend, delegate { });
				effectRenderer.SetEffectInfoTypeAndID(EffectType.WarpDestination, 0);
				effectRenderer.ShowEffect();
			}
		}
Esempio n. 18
0
		public void RemoveOtherPlayer(short id, WarpAnimation anim = WarpAnimation.None)
		{
			lock (_rendererListLock)
			{
				int ndx;
				if ((ndx = otherRenderers.FindIndex(cc => cc.Character.ID == id)) >= 0)
				{
					var rend = otherRenderers[ndx];
					rend.HideChatBubble();
					rend.Visible = false;
					otherRenderers.Remove(rend);

					Action closeRenderer = () => { rend.Close(); };
					if (anim == WarpAnimation.Admin)
					{
						var effectRenderer = new EffectRenderer((EOGame)Game, rend, closeRenderer);
						effectRenderer.SetEffectInfoTypeAndID(EffectType.WarpOriginal, 0);
						effectRenderer.ShowEffect();
					}
					else
					{
						closeRenderer();
					}
				}
			}
		}
 private void _playerEnterMap(CharacterData data, WarpAnimation anim)
 {
     World.Instance.ActiveMapRenderer.AddOtherPlayer(data, anim);
 }
Esempio n. 20
0
		public void AddOtherPlayer(CharacterData c, WarpAnimation anim = WarpAnimation.None)
		{
			CharacterRenderer otherRend = null;
			lock (_characterListLock)
			{
				Character other = _characterRenderers.Select(x => x.Character).FirstOrDefault(x => x.Name == c.Name && x.ID == c.ID);
				if (other == null)
				{
					other = new Character(_api, c);
					lock (_characterListLock)
					{
						_characterRenderers.Add(otherRend = new CharacterRenderer(other));
						_characterRenderers[_characterRenderers.Count - 1].Visible = true;
						_characterRenderers[_characterRenderers.Count - 1].Initialize();
					}
					other.RenderData.SetUpdate(true);
				}
				else
				{
					other.ApplyData(c);
				}
			}

			if (anim == WarpAnimation.Admin && otherRend != null)
				otherRend.ShowWarpArrive();
		}