Esempio n. 1
0
        public async Task <Unit> Handle(ShowMyQuestCommand command, CancellationToken cancellationToken)
        {
            var playerId = command.PlayerId;
            var type     = command.Type;


            var playerQuests = await _playerQuestDomainService.GetPlayerQuests(playerId);

            var ids = playerQuests.Where(x => x.Status == QuestStateEnum.已领取进行中).Select(x => x.QuestId).ToList();

            var questQuery = await _questDomainService.GetAll();

            var quests = questQuery.Where(x => x.Type == type && ids.Contains(x.Id));

            var myQuest = new MyQuest
            {
                Quests = _mapper.Map <List <QuestModel> >(quests),
                Type   = type
            };

            await _mudProvider.ShowQuests(playerId, myQuest);

            return(Unit.Value);
        }
Esempio n. 2
0
        public static void ProcessMemoryDump(Session MySession)
        {
            //Let's get remaining character data before preparing it for transport
            //Hotkeys
            SQLOperations.GetPlayerHotkeys(MySession);

            //Quests, skip for now
            //Weaponhotbars
            SQLOperations.GetPlayerWeaponHotbar(MySession);

            //Auctions go here, skip for now
            //Spells
            SQLOperations.GetPlayerSpells(MySession);

            MySession.MyDumpData.AddRange(MySession.MyCharacter.PullCharacter());
            MySession.MyDumpData.Add((byte)(MySession.MyCharacter.MyHotkeys.Count() * 2));

            //cycle over all our hotkeys and append them
            foreach (Hotkey MyHotkey in MySession.MyCharacter.MyHotkeys)
            {
                MySession.MyDumpData.AddRange(MyHotkey.PullHotkey());
            }
            //Unknown at this time 4 byte null
            MySession.MyDumpData.AddRange(BitConverter.GetBytes(0));

            //Unknown at this time 4 byte null
            MySession.MyDumpData.AddRange(BitConverter.GetBytes(0));

            //Quest Count
            MySession.MyDumpData.AddRange(BitConverter.GetBytes(MySession.MyCharacter.MyQuests.Count()));

            //Iterate over quest data and append (Should be 0 for now...)
            foreach (Quest MyQuest in MySession.MyCharacter.MyQuests)
            {
                MySession.MyDumpData.AddRange(MyQuest.PullQuest());
            }

            //Get Inventory Item count
            MySession.MyDumpData.Add((byte)(MySession.MyCharacter.InventoryItems.Count() * 2));
            MySession.MyDumpData.AddRange(BitConverter.GetBytes(MySession.MyCharacter.InventoryItems.Count()));
            foreach (Item MyItem in MySession.MyCharacter.InventoryItems)
            {
                MySession.MyDumpData.AddRange(MyItem.PullItem());
            }

            foreach (WeaponHotbar MyWeaponHotbar in MySession.MyCharacter.WeaponHotbars)
            {
                MySession.MyDumpData.AddRange(MyWeaponHotbar.PullWeaponHotbar());
            }

            //Get Bank Item count
            MySession.MyDumpData.Add((byte)(MySession.MyCharacter.BankItems.Count() * 2));
            MySession.MyDumpData.AddRange(BitConverter.GetBytes(MySession.MyCharacter.BankItems.Count()));
            foreach (Item MyItem in MySession.MyCharacter.BankItems)
            {
                MySession.MyDumpData.AddRange(MyItem.PullItem());
            }

            // end of bank? or could be something else for memory dump
            MySession.MyDumpData.Add((byte)0);

            //Buying auctions
            MySession.MyDumpData.Add((byte)(MySession.MyCharacter.MyBuyingAuctions.Count()));
            foreach (Auction MyAuction in MySession.MyCharacter.MyBuyingAuctions)
            {
                MySession.MyDumpData.AddRange(MyAuction.PullAuction());
            }

            //Selling auctions
            MySession.MyDumpData.Add((byte)(MySession.MyCharacter.MySellingAuctions.Count()));
            foreach (Auction MyAuction in MySession.MyCharacter.MySellingAuctions)
            {
                MySession.MyDumpData.AddRange(MyAuction.PullAuction());
            }

            //Spell count and Spells
            MySession.MyDumpData.AddRange(Utility_Funcs.Technique(MySession.MyCharacter.MySpells.Count()));
            foreach (Spell MySpell in MySession.MyCharacter.MySpells)
            {
                MySession.MyDumpData.AddRange(MySpell.PullSpell());
                //Indicates end of spell?
                MySession.MyDumpData.Add((byte)0);
            }

            MySession.MyDumpData.AddRange(new byte[] { 0x55, 0x55, 0x0d, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00,
                                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00,
                                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x01,
                                                       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00,
                                                       0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00,
                                                       0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x00,
                                                       0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
                                                       0x00, 0x00, 0x00, 0x00, 0xa0, 0x0f, 0xae, 0x98, 0x4c, 0x00, 0x55, 0x55, 0x0d, 0x41, 0xe6,
                                                       0x01, 0x96, 0x01, 0x78, 0x96, 0x01, 0x00, 0x00, 0x00, 0xde, 0x02, 0xde, 0x02, 0x00, 0xfa,
                                                       0x01, 0x00, 0x00, 0x00, 0xe8, 0x07, 0x00, 0x5a, 0x00, 0x00, 0x04, 0x00, 0x0c, 0x4f, 0x00,
                                                       0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0x02, 0xde, 0x02, 0x00, 0xfa, 0x01, 0x00, 0x00, 0x00 });

            MySession.Dumpstarted = true;

            //Get our timestamp opcode in queue
            RdpCommOut.PackMessage(MySession, DNP3Creation.CreateDNP3TimeStamp(), MessageOpcodeTypes.ShortReliableMessage, GameOpcode.Time);

            List <byte> ThisChunk;

            //Gather our dump data
            if (MySession.MyDumpData.Count() > 500)
            {
                ThisChunk = MySession.MyDumpData.GetRange(0, 500);
                MySession.MyDumpData.RemoveRange(0, 500);

                //Set this to true to send packet to client
                MySession.ClientFirstConnect = true;

                ///Handles packing message into outgoing packet
                RdpCommOut.PackMessage(MySession, ThisChunk, MessageOpcodeTypes.MultiShortReliableMessage, GameOpcode.MemoryDump);
            }

            //Dump data is smaller then 500 bytes
            else
            {
                ThisChunk = MySession.MyDumpData.GetRange(0, MySession.MyDumpData.Count());
                MySession.MyDumpData.Clear();

                //Set this to true to send packet to client
                MySession.ClientFirstConnect = true;

                //Appears dump is short, end it here
                MySession.Dumpstarted = false;

                ///Handles packing message into outgoing packet
                RdpCommOut.PackMessage(MySession, ThisChunk, MessageOpcodeTypes.ShortReliableMessage, GameOpcode.MemoryDump);
            }
        }