Esempio n. 1
0
        public static SubPacket buildPacket(uint sourceActorId, uint targetActorId, uint targettedActorId, uint emoteID)
        {
            byte[] data = new byte[PACKET_SIZE - 0x20];

            if (targettedActorId == 0xC0000000)
            {
                targettedActorId = sourceActorId;
            }

            using (MemoryStream mem = new MemoryStream(data))
            {
                using (BinaryWriter binWriter = new BinaryWriter(mem))
                {
                    uint realAnimID = 0x5000000 | ((emoteID - 100) << 12);
                    uint realDescID = 20000 + ((emoteID - 1) * 10) + (targettedActorId == sourceActorId ? (uint)2 : (uint)1);
                    binWriter.Write((UInt32)realAnimID);
                    binWriter.Write((UInt32)targettedActorId);
                    binWriter.Write((UInt32)realDescID);
                }
            }

            SubPacket packet = new SubPacket(OPCODE, sourceActorId, targetActorId, data);

            packet.debugPrintSubPacket();
            return(packet);
        }
Esempio n. 2
0
        public void runEventFunction(string functionName, params object[] parameters)
        {
            List <LuaParam> lParams = LuaUtils.createLuaParamList(parameters);
            SubPacket       spacket = RunEventFunctionPacket.buildPacket(actorId, currentEventOwner, currentEventName, functionName, lParams);

            spacket.debugPrintSubPacket();
            queuePacket(spacket);
        }
Esempio n. 3
0
        public void sendRequestedInfo(params object[] parameters)
        {
            List <LuaParam> lParams = LuaUtils.createLuaParamList(parameters);
            SubPacket       spacket = InfoRequestResponsePacket.buildPacket(actorId, actorId, lParams);

            spacket.debugPrintSubPacket();
            queuePacket(spacket);
        }
Esempio n. 4
0
        public void endCommand()
        {
            SubPacket p = EndEventPacket.buildPacket(actorId, currentCommand, currentCommandName);

            p.debugPrintSubPacket();
            queuePacket(p);

            currentCommand     = 0;
            currentCommandName = "";
        }
Esempio n. 5
0
        public void endEvent()
        {
            SubPacket p = EndEventPacket.buildPacket(actorId, currentEventOwner, currentEventName);

            p.debugPrintSubPacket();
            queuePacket(p);

            currentEventOwner = 0;
            currentEventName  = "";
            eventMenuId       = 0;
        }
Esempio n. 6
0
        public void kickEvent(Actor actor, string conditionName, params object[] parameters)
        {
            if (actor == null)
            {
                return;
            }

            List <LuaParam> lParams = LuaUtils.createLuaParamList(parameters);
            SubPacket       spacket = KickEventPacket.buildPacket(actorId, actor.actorId, conditionName, lParams);

            spacket.debugPrintSubPacket();
            queuePacket(spacket);
        }
Esempio n. 7
0
        private void ProcessSessionAcknowledgement(ClientConnection client, SubPacket packet)
        {
            packet.debugPrintSubPacket();
            SessionPacket sessionPacket = new SessionPacket(packet.data);
            String        clientVersion = sessionPacket.version;

            Log.info(String.Format("Got acknowledgment for secure session."));
            Log.info(String.Format("CLIENT VERSION: {0}", clientVersion));

            uint userId = Database.getUserIdFromSession(sessionPacket.session);

            client.currentUserId       = userId;
            client.currentSessionToken = sessionPacket.session;;

            if (userId == 0)
            {
                ErrorPacket errorPacket     = new ErrorPacket(sessionPacket.sequence, 0, 0, 13001, "Your session has expired, please login again.");
                SubPacket   subpacket       = errorPacket.buildPacket();
                BasePacket  errorBasePacket = BasePacket.createPacket(subpacket, true, false);
                BasePacket.encryptPacket(client.blowfish, errorBasePacket);
                client.queuePacket(errorBasePacket);

                Log.info(String.Format("Invalid session, kicking..."));
                return;
            }

            Log.info(String.Format("USER ID: {0}", userId));

            List <Account> accountList    = new List <Account>();
            Account        defaultAccount = new Account();

            defaultAccount.id   = 1;
            defaultAccount.name = "FINAL FANTASY XIV";
            accountList.Add(defaultAccount);
            AccountListPacket listPacket = new AccountListPacket(1, accountList);
            BasePacket        basePacket = BasePacket.createPacket(listPacket.buildPackets(), true, false);

            BasePacket.encryptPacket(client.blowfish, basePacket);
            client.queuePacket(basePacket);
        }
Esempio n. 8
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
 */
        }