Example #1
0
        private Packet?FilterServerPacket(Packet rawPacket)
        {
            if (rawPacket.Id == PacketDefinitions.GeneralInformationPacket.Id && rawPacket.Payload[4] == 8)
            {
                var packet = new SetMapPacket();
                packet.Deserialize(rawPacket);
                reloginInfo.MapId = packet.MapId;
            }

            return(rawPacket);
        }
Example #2
0
        private Packet?FilterServerPackets(Packet rawPacket)
        {
            var discardCurrentPacket = false;

            if (rawPacket.Id == PacketDefinitions.GeneralInformationPacket.Id && rawPacket.Payload[4] == 8)
            {
                var packet = new SetMapPacket();
                packet.Deserialize(rawPacket);
                player.MapId = packet.MapId;
            }

            if (rawPacket.Id != PacketDefinitions.CharacterMoveAck.Id)
            {
                return(rawPacket);
            }

            if (player.WalkRequestQueue.TryDequeue(out var walkRequest))
            {
                try
                {
                    if (walkRequest.IssuedByProxy)
                    {
                        client.PauseClient(PauseClientChoice.Pause);
                        client.DrawGamePlayer(player.PlayerId, player.BodyType,
                                              player.Location, player.Direction, player.MovementType, player.Color);
                        foreach (var mobile in UO.Mobiles)
                        {
                            if (mobile.Id != player.PlayerId)
                            {
                                UO.Client.ObjectInfo(mobile.Id, mobile.Type, mobile.Location, mobile.Color);
                            }
                        }
                        client.PauseClient(PauseClientChoice.Resume);

                        discardCurrentPacket = true;
                    }

                    if (player.Direction != walkRequest.Direction)
                    {
                        player.Direction = walkRequest.Direction;
                    }
                    else
                    {
                        player.Location = player.Location.LocationInDirection(walkRequest.Direction);
                    }

                    if (gameObjects[player.PlayerId] is Mobile updatedMobile)
                    {
                        gameObjects.UpdateObject(updatedMobile.UpdateLocation(player.Location, player.Direction, player.MovementType));
                    }
                }
                finally
                {
                    OnWalkRequestDequeued();
                }
            }

            eventJournalSource.Publish(new PlayerMoveAcceptedEvent());

            return(discardCurrentPacket ? (Packet?)null : rawPacket);
        }
Example #3
0
        public void sendZoneInPackets(WorldManager world, ushort spawnType)
        {
            queuePacket(SetActorIsZoningPacket.buildPacket(actorId, actorId, false));
            queuePacket(_0x10Packet.buildPacket(actorId, 0xFF));
            queuePacket(SetMusicPacket.buildPacket(actorId, zone.bgmDay, 0x01));
            queuePacket(SetWeatherPacket.buildPacket(actorId, SetWeatherPacket.WEATHER_CLEAR, 1));

            queuePacket(SetMapPacket.buildPacket(actorId, zone.regionId, zone.actorId));

            queuePacket(getSpawnPackets(actorId, spawnType));
            getSpawnPackets(actorId, spawnType).debugPrintPacket();

            #region grouptest
            //Retainers
            List <ListEntry> retainerListEntries = new List <ListEntry>();
            retainerListEntries.Add(new ListEntry(actorId, 0xFFFFFFFF, 0x139E, false, true, customDisplayName));
            retainerListEntries.Add(new ListEntry(0x23, 0x0, 0xFFFFFFFF, false, false, "TEST1"));
            retainerListEntries.Add(new ListEntry(0x24, 0x0, 0xFFFFFFFF, false, false, "TEST2"));
            retainerListEntries.Add(new ListEntry(0x25, 0x0, 0xFFFFFFFF, false, false, "TEST3"));
            BasePacket retainerListPacket = BasePacket.createPacket(ListUtils.createRetainerList(actorId, 0xF4, 1, 0x800000000004e639, retainerListEntries), true, false);
            playerSession.queuePacket(retainerListPacket);

            //Party
            List <ListEntry> partyListEntries = new List <ListEntry>();
            partyListEntries.Add(new ListEntry(actorId, 0xFFFFFFFF, 0xFFFFFFFF, false, true, customDisplayName));
            partyListEntries.Add(new ListEntry(0x029B27D3, 0xFFFFFFFF, 0x195, false, true, "Valentine Bluefeather"));
            BasePacket partyListPacket = BasePacket.createPacket(ListUtils.createPartyList(actorId, 0xF4, 1, 0x8000000000696df2, partyListEntries), true, false);
            playerSession.queuePacket(partyListPacket);
            #endregion

            #region Inventory & Equipment
            queuePacket(InventoryBeginChangePacket.buildPacket(actorId));
            inventories[Inventory.NORMAL].sendFullInventory();
            inventories[Inventory.CURRENCY].sendFullInventory();
            inventories[Inventory.KEYITEMS].sendFullInventory();
            inventories[Inventory.BAZAAR].sendFullInventory();
            inventories[Inventory.MELDREQUEST].sendFullInventory();
            inventories[Inventory.LOOT].sendFullInventory();
            equipment.SendFullEquipment(false);
            playerSession.queuePacket(InventoryEndChangePacket.buildPacket(actorId), true, false);
            #endregion

            playerSession.queuePacket(getInitPackets(actorId));


            BasePacket areaMasterSpawn      = zone.getSpawnPackets(actorId);
            BasePacket debugSpawn           = world.GetDebugActor().getSpawnPackets(actorId);
            BasePacket worldMasterSpawn     = world.GetActor().getSpawnPackets(actorId);
            BasePacket weatherDirectorSpawn = new WeatherDirector(this, 8003).getSpawnPackets(actorId);
            BasePacket directorSpawn        = null;

            if (currentDirector != null)
            {
                directorSpawn = currentDirector.getSpawnPackets(actorId);
            }

            playerSession.queuePacket(areaMasterSpawn);
            playerSession.queuePacket(debugSpawn);
            if (directorSpawn != null)
            {
                //directorSpawn.debugPrintPacket();
                // currentDirector.getInitPackets(actorId).debugPrintPacket();
                queuePacket(directorSpawn);
                queuePacket(currentDirector.getInitPackets(actorId));
                //queuePacket(currentDirector.getSetEventStatusPackets(actorId));
            }
            playerSession.queuePacket(worldMasterSpawn);

            if (zone.isInn)
            {
                SetCutsceneBookPacket cutsceneBookPacket = new SetCutsceneBookPacket();
                for (int i = 0; i < 2048; i++)
                {
                    cutsceneBookPacket.cutsceneFlags[i] = true;
                }

                SubPacket packet = cutsceneBookPacket.buildPacket(actorId, "<Path Companion>", 11, 1, 1);

                packet.debugPrintSubPacket();
                queuePacket(packet);
            }

            playerSession.queuePacket(weatherDirectorSpawn);

/*
 #region hardcode
 *          BasePacket reply10 = new BasePacket("./packets/login/login10.bin"); //Item Storage, Inn Door created
 *          BasePacket reply11 = new BasePacket("./packets/login/login11.bin"); //NPC Create ??? Final init
 *          reply10.replaceActorID(actorId);
 *          reply11.replaceActorID(actorId);
 *          //playerSession.queuePacket(reply10);
 *         // playerSession.queuePacket(reply11);
 #endregion
 */
        }