コード例 #1
0
        public static AccountData FetchAccount(SyncReceiver sync, string name, string pass)
        {
            var packet = sync.CreateIPC(IPC.FetchAccount);

            packet.Write(name);
            packet.Write(pass);
            sync.Send(packet);

            var recv = sync.ReadIPC();

            AccountData data = new AccountData();

            data.id     = -1;
            data.name   = name;
            data.status = AuthStatus.Unverified;
            data.online = false;

            if (recv == null)
            {
                return(data);
            }

            data.id     = recv.ReadInt32();                 // we should change to uint; and use "id = 0" for invalid/non exist account
            data.status = (AuthStatus)recv.ReadByte();
            data.online = recv.ReadBoolean();

            return(data);
        }
コード例 #2
0
        public static CashItem[] GetCashItem(SyncReceiver sync, int server, int id)
        {
            var packet = sync.CreateIPC(IPC.GetCashItemList);

            packet.Write((byte)server);
            packet.Write(id);

            sync.Send(packet);


            var recv = sync.ReadIPC();

            if (recv == null)
            {
                return(null);
            }

            var itens = recv.ReadInt32();

            var ItemList = new CashItem[itens];

            for (int i = 0; i < itens; i++)
            {
                ItemList[i]          = new CashItem();
                ItemList[i].ID       = recv.ReadInt32();
                ItemList[i].itemid   = recv.ReadInt32();
                ItemList[i].itemopt  = recv.ReadBytes(8);
                ItemList[i].itemopt2 = recv.ReadInt32();
                ItemList[i].duration = recv.ReadInt32();
            }
            return(ItemList);
        }
コード例 #3
0
ファイル: Authentication.cs プロジェクト: lKnuckles/minerva
        public static AccountData FetchAccount(SyncReceiver sync, string name, string pass)
        {
            var packet = sync.CreateIPC(IPC.FetchAccount);

            packet.Write(name);
            packet.Write(pass);
            sync.Send(packet);

            var recv = sync.ReadIPC();

            AccountData data = new AccountData();

            data.id     = -1;
            data.name   = name;
            data.status = AuthStatus.Unverified;

            if (recv == null)
            {
                return(data);
            }

            data.id     = recv.ReadInt32();
            data.status = (AuthStatus)recv.ReadByte();

            return(data);
        }
コード例 #4
0
        public static DeleteCharacterStatus DeleteCharacter(SyncReceiver sync, int server, int id, int slot)
        {
            var packet = sync.CreateIPC(IPC.DeleteCharacter);

            packet.Write((byte)server);
            packet.Write(id);
            packet.Write((byte)slot);

            sync.Send(packet);

            var recv = sync.ReadIPC();

            if (recv == null)
            {
                return(DeleteCharacterStatus.DBError);
            }

            var status = (DeleteCharacterStatus)recv.ReadByte();

            switch (status)
            {
            case DeleteCharacterStatus.Success: return(DeleteCharacterStatus.Success);

            default: return(DeleteCharacterStatus.DBError);
            }
        }
コード例 #5
0
        public static void RemoveSubPass(SyncReceiver sync, int id)
        {
            var packet = sync.CreateIPC(IPC.RemoveSubPass);

            packet.Write(id);

            sync.Send(packet);
        }
コード例 #6
0
        public static void SetSubPassTime(SyncReceiver sync, int id, int time)
        {
            var packet = sync.CreateIPC(IPC.SetSubPassTime);

            packet.Write(id);
            packet.Write((byte)time);

            sync.Send(packet);
        }
コード例 #7
0
        public static void SetCashItem(SyncReceiver sync, int server, int ID)
        {
            var packet = sync.CreateIPC(IPC.SetCashItem);

            packet.Write((byte)server);
            packet.Write(ID);

            sync.Send(packet);
        }
コード例 #8
0
        public static void UpdateOnline(SyncReceiver sync, int id, bool online)
        {
            var packet = sync.CreateIPC(IPC.UpdateOnline);

            packet.Write(id);
            packet.Write(online);

            sync.Send(packet);
        }
コード例 #9
0
        public static void AddUser(SyncReceiver sync, ulong key, int id)
        {
            var packet = sync.CreateIPC(IPC.AddUser);

            packet.Write(key);
            packet.Write(id);

            sync.Send(packet);
        }
コード例 #10
0
        public static void SetSlotOrder(SyncReceiver sync, int server, int id, int order)
        {
            var packet = sync.CreateIPC(IPC.SetSlotOrder);

            packet.Write((byte)server);
            packet.Write(id);
            packet.Write(order);

            sync.Send(packet);
        }
コード例 #11
0
        public static void UpdateIPDate(SyncReceiver sync, int id, string ip, DateTime date)
        {
            var packet = sync.CreateIPC(IPC.UpdateIPDate);

            packet.Write(id);   // change to uint..?
            packet.Write(ip);   // ip should be uint
            packet.Write(date.ToBinary());

            sync.Send(packet);
        }
コード例 #12
0
        public static void SetQuickSlots(SyncReceiver sync, int server, int id, int quickslot, int position)
        {
            var packet = sync.CreateIPC(IPC.SetQuickSlots);

            packet.Write((byte)server);
            packet.Write(id);
            packet.Write(quickslot);
            packet.Write(position);

            sync.Send(packet);
        }
コード例 #13
0
        public static void SetSubPass(SyncReceiver sync, int id, string subpw, int question, string answer)
        {
            var packet = sync.CreateIPC(IPC.SetSubPass);

            packet.Write(id);
            packet.Write(subpw);
            packet.Write((byte)question);
            packet.Write(answer);

            sync.Send(packet);
        }
コード例 #14
0
        public static void UpdateSkillPoints(SyncReceiver sync, int server, int charId, ushort skillid, ushort level, byte slot)
        {
            var packet = sync.CreateIPC(IPC.UpdateSkillPoints);

            packet.Write((byte)server);
            packet.Write(charId);
            packet.Write(skillid);
            packet.Write(level);
            packet.Write(slot);

            sync.Send(packet);
        }
コード例 #15
0
        public static void UpdateStatPoints(SyncReceiver sync, int server, int id, int str, int intel, int dex, int points)
        {
            var packet = sync.CreateIPC(IPC.UpdateStatPoints);

            packet.Write((byte)server);
            packet.Write(id);
            packet.Write(str);
            packet.Write(intel);
            packet.Write(dex);
            packet.Write(points);

            sync.Send(packet);
        }
コード例 #16
0
        public static void RegisterChannel(SyncReceiver sync, int server, int channel, int type, uint ip, int port, int maxPlayers)
        {
            var packet = sync.CreateIPC(IPC.RegisterChannel);

            packet.Write((byte)server);
            packet.Write((byte)channel);
            packet.Write(type);
            packet.Write(ip);
            packet.Write((ushort)port);
            packet.Write((ushort)maxPlayers);

            sync.Send(packet);
        }
コード例 #17
0
        public static void UpdatePosition(SyncReceiver sync, int server, int id, byte slot, byte map, byte x, byte y)
        {
            var packet = sync.CreateIPC(IPC.UpdatePosition);

            packet.Write((byte)server);
            packet.Write(id);
            packet.Write(slot);
            packet.Write(map);
            packet.Write(x);
            packet.Write(y);

            sync.Send(packet);
        }
コード例 #18
0
        public static Character[] GetCharacters(SyncReceiver sync, int server, int id)
        {
            var packet = sync.CreateIPC(IPC.GetCharacterList);

            packet.Write((byte)server);
            packet.Write(id);

            sync.Send(packet);

            var recv = sync.ReadIPC();

            if (recv == null)
            {
                return(null);
            }

            var num      = recv.ReadInt32();
            var charList = new Character[num];

            for (int i = 0; i < num; i++)
            {
                charList[i]         = new Character();
                charList[i].account = id;
                charList[i].id      = recv.ReadInt32();
                charList[i].slot    = recv.ReadByte();
                charList[i].name    = recv.ReadString();
                charList[i].level   = recv.ReadUInt32();
                charList[i]._class  = recv.ReadByte();
                charList[i].face    = recv.ReadByte();
                charList[i].hair    = recv.ReadByte();
                charList[i].colour  = recv.ReadByte();
                charList[i].gender  = recv.ReadBoolean();
                charList[i].map     = recv.ReadByte();
                charList[i].x       = recv.ReadByte();
                charList[i].y       = recv.ReadByte();
                charList[i].created = DateTime.FromBinary(recv.ReadInt64());

                charList[i].equipment           = new Equipment();
                charList[i].equipment.head      = recv.ReadBytes(15);
                charList[i].equipment.body      = recv.ReadBytes(15);
                charList[i].equipment.hands     = recv.ReadBytes(15);
                charList[i].equipment.feet      = recv.ReadBytes(15);
                charList[i].equipment.righthand = recv.ReadBytes(15);
                charList[i].equipment.lefthand  = recv.ReadBytes(15);
                charList[i].equipment.back      = recv.ReadBytes(15);
            }

            return(charList);
        }
コード例 #19
0
ファイル: ServerList.cs プロジェクト: lKnuckles/minerva
        public static ServerData[] GetChannels(SyncReceiver sync)
        {
            var packet = sync.CreateIPC(IPC.ChannelList);

            sync.Send(packet);

            var recv = sync.ReadIPC();

            if (recv == null)
            {
                return(null);
            }

            var num = recv.ReadInt32();

            if (num <= 0)
            {
                return(null);
            }

            var serverList = new ServerData[num];

            for (var i = 0; i < num; i++)
            {
                var serverId      = recv.ReadInt32();
                var channelLength = recv.ReadInt32();

                if (serverId < 0)
                {
                    continue;
                }

                serverList[i] = new ServerData(serverId, channelLength);

                for (var j = 0; j < channelLength; j++)
                {
                    var id         = recv.ReadInt32();
                    var type       = recv.ReadInt32();
                    var ip         = recv.ReadUInt32();
                    var port       = recv.ReadInt16();
                    var maxPlayers = recv.ReadInt16();
                    var curPlayers = recv.ReadInt16();
                    serverList[i].channels[j] = new ChannelData(id, type, ip, port, maxPlayers, curPlayers);
                }
            }

            return(serverList);
        }
コード例 #20
0
        public static bool VerifyPassword(SyncReceiver sync, int id, string pass)
        {
            var packet = sync.CreateIPC(IPC.VerifyPassword);

            packet.Write(id);
            packet.Write(pass);
            sync.Send(packet);

            var recv = sync.ReadIPC();

            if (recv == null)
            {
                return(false);
            }

            var tmp = recv.ReadBoolean();

            return(tmp);
        }
コード例 #21
0
        public static int GetSubPassQuestion(SyncReceiver sync, int id)
        {
            var packet = sync.CreateIPC(IPC.GetSubPassQuestion);

            packet.Write(id);

            sync.Send(packet);

            var recv = sync.ReadIPC();

            if (recv == null)
            {
                return(-1);
            }

            var sub = recv.ReadByte();

            return(sub);
        }
コード例 #22
0
        public static bool GetSubpass(SyncReceiver sync, int id)
        {
            var packet = sync.CreateIPC(IPC.GetSubPass);

            packet.Write(id);

            sync.Send(packet);

            var recv = sync.ReadIPC();

            if (recv == null)
            {
                return(false);
            }

            var sub = recv.ReadBoolean();

            return(sub);
        }
コード例 #23
0
        public static int GetSlotOrder(SyncReceiver sync, int server, int id)
        {
            var packet = sync.CreateIPC(IPC.GetSlotOrder);

            packet.Write((byte)server);
            packet.Write(id);

            sync.Send(packet);

            var recv = sync.ReadIPC();

            if (recv == null)
            {
                return(-1);
            }

            var slotorder = recv.ReadInt32();

            return(slotorder);
        }
コード例 #24
0
ファイル: Authentication.cs プロジェクト: lKnuckles/minerva
        public static int GetUser(SyncReceiver sync, ulong key)
        {
            var id     = -1;
            var packet = sync.CreateIPC(IPC.GetUser);

            packet.Write(key);

            sync.Send(packet);

            var recv = sync.ReadIPC();

            if (recv == null)
            {
                return(id);
            }

            id = recv.ReadInt32();

            return(id);
        }
コード例 #25
0
        public static bool CheckSubPwAnswer(SyncReceiver sync, int id, string answer)
        {
            var packet = sync.CreateIPC(IPC.CheckSubPassAnswer);

            packet.Write(id);
            packet.Write(answer);

            sync.Send(packet);

            var recv = sync.ReadIPC();

            if (recv == null)
            {
                return(false);
            }

            var sub = recv.ReadBoolean();

            return(sub);
        }
コード例 #26
0
        public static CreateCharacterStatus CreateCharacter(SyncReceiver sync, int server, int id, byte slot, string name, byte _class, bool gender, byte face, byte hair, byte colour)
        {
            var packet = sync.CreateIPC(IPC.CreateCharacter);

            packet.Write((byte)server);
            packet.Write(id);
            packet.Write(slot);
            packet.Write(name);
            packet.Write(_class);
            packet.Write(gender);
            packet.Write(face);
            packet.Write(hair);
            packet.Write(colour);

            sync.Send(packet);

            var recv = sync.ReadIPC();

            if (recv == null)
            {
                return(CreateCharacterStatus.DBError);
            }

            var status = (CreateCharacterStatus)recv.ReadByte();

            switch (status)
            {
            case CreateCharacterStatus.NameInUse: return(CreateCharacterStatus.NameInUse);

            case CreateCharacterStatus.SlotInUse: return(CreateCharacterStatus.SlotInUse);

            case CreateCharacterStatus.Success: return(CreateCharacterStatus.Success);

            default: return(CreateCharacterStatus.DBError);
            }
        }
コード例 #27
0
        public static Character GetFullCharacter(SyncReceiver sync, int server, int id, int slot)
        {
            var packet = sync.CreateIPC(IPC.GetFullCharacter);

            packet.Write((byte)server);
            packet.Write(id);
            packet.Write((byte)slot);

            sync.Send(packet);

            var recv = sync.ReadIPC();

            if (recv == null)
            {
                return(null);
            }

            Character character = new Character();

            character.account = id;
            character.id      = recv.ReadInt32();
            character.slot    = recv.ReadByte();
            character.name    = recv.ReadString();
            character.level   = recv.ReadUInt32();
            character._class  = recv.ReadByte();
            character.face    = recv.ReadByte();
            character.hair    = recv.ReadByte();
            character.colour  = recv.ReadByte();
            character.gender  = recv.ReadBoolean();
            character.map     = recv.ReadByte();
            character.x       = recv.ReadByte();
            character.y       = recv.ReadByte();
            character.created = DateTime.FromBinary(recv.ReadInt64());

            character.equipment           = new Equipment();
            character.equipment.head      = recv.ReadBytes(15);
            character.equipment.body      = recv.ReadBytes(15);
            character.equipment.hands     = recv.ReadBytes(15);
            character.equipment.feet      = recv.ReadBytes(15);
            character.equipment.righthand = recv.ReadBytes(15);
            character.equipment.lefthand  = recv.ReadBytes(15);
            character.equipment.back      = recv.ReadBytes(15);

            character.equipment.card = recv.ReadBytes(15);

            character.equipment.neck       = recv.ReadBytes(15);
            character.equipment.finger1    = recv.ReadBytes(15);
            character.equipment.finger2    = recv.ReadBytes(15);
            character.equipment.finger3    = recv.ReadBytes(15);
            character.equipment.finger4    = recv.ReadBytes(15);
            character.equipment.leftear    = recv.ReadBytes(15);
            character.equipment.rightear   = recv.ReadBytes(15);
            character.equipment.leftwrist  = recv.ReadBytes(15);
            character.equipment.rightwrist = recv.ReadBytes(15);

            character.equipment.belt          = recv.ReadBytes(15);
            character.equipment.charm         = recv.ReadBytes(15);
            character.equipment.lefteffector  = recv.ReadBytes(15);
            character.equipment.righteffector = recv.ReadBytes(15);
            character.equipment.cornalina     = recv.ReadBytes(15);
            character.equipment.talisman      = recv.ReadBytes(15);

            character.equipment.leftarcane  = recv.ReadBytes(15);
            character.equipment.rightarcane = recv.ReadBytes(15);

            character.stats       = new Stats();
            character.stats.curhp = recv.ReadUInt16();
            character.stats.maxhp = recv.ReadUInt16();
            character.stats.curmp = recv.ReadUInt16();
            character.stats.maxmp = recv.ReadUInt16();
            character.stats.cursp = recv.ReadUInt16();
            character.stats.maxsp = recv.ReadUInt16();

            character.stats.exp = recv.ReadUInt64();


            character.stats.str_stat = recv.ReadUInt32();
            character.stats.int_stat = recv.ReadUInt32();
            character.stats.dex_stat = recv.ReadUInt32();
            character.stats.pnt_stat = recv.ReadUInt32();

            character.stats.honour = recv.ReadUInt32();
            character.stats.rank   = recv.ReadUInt32();

            character.stats.swordrank = recv.ReadByte();
            character.stats.swordxp   = recv.ReadUInt16();
            character.stats.swordpts  = recv.ReadUInt16();
            character.stats.magicrank = recv.ReadByte();
            character.stats.magicxp   = recv.ReadUInt16();
            character.stats.magicpts  = recv.ReadUInt16();

            character.stats.alz   = recv.ReadUInt64();
            character.stats.wexp  = recv.ReadUInt64();
            character.stats.honor = recv.ReadUInt64();


            var num = recv.ReadInt32();

            character.inv = new Inventory[num];

            for (int i = 0; i < num; i++)
            {
                character.inv[i]        = new Inventory();
                character.inv[i].item   = recv.ReadBytes(15);
                character.inv[i].amount = recv.ReadUInt16();
                character.inv[i].slot   = recv.ReadByte();
            }

            num = recv.ReadInt32();
            character.skills = new Skills[num];

            for (int i = 0; i < num; i++)
            {
                character.skills[i]       = new Skills();
                character.skills[i].skill = recv.ReadUInt16();
                character.skills[i].level = recv.ReadByte();
                character.skills[i].slot  = recv.ReadByte();
            }

            num = recv.ReadInt32();
            character.qslots = new QuickSlots[num];

            for (int i = 0; i < num; i++)
            {
                character.qslots[i]       = new QuickSlots();
                character.qslots[i].skill = recv.ReadByte();
                character.qslots[i].slot  = recv.ReadByte();
            }

            return(character);
        }