public void GetChannels(IPCReceiver receiver, IPCReader data) { lock (channels) { var packet = new IPCWriter(IPC.ChannelList); packet.Write(channels.Count); // server count foreach (var server in channels) { packet.Write((int)server.Key); // server id packet.Write(server.Value.Count); // channel count foreach (var channel in server.Value) { packet.Write(channel.Value.id); packet.Write(channel.Value.type); packet.Write((int)channel.Value.ip); packet.Write(channel.Value.port); packet.Write(channel.Value.maxPlayers); packet.Write(channel.Value.curPlayers); } } receiver.Send(packet); } }
public void CreateCharacter(IPCReceiver receiver, IPCReader data) { var server = data.ReadByte(); var id = data.ReadInt32(); var slot = data.ReadByte(); var name = data.ReadString(); var _class = data.ReadByte(); var gender = data.ReadBoolean(); var face = data.ReadByte(); var hair = data.ReadByte(); var colour = data.ReadByte(); var stats = initialCharStats[_class]; var items = initialCharItems[_class]; var skills = initialCharSkills[_class]; var quickslots = initialCharQuickslots[_class]; var status = serverdbs[server].CreateCharacter(id, slot, name, _class, gender, face, hair, colour, stats.ToArray(), items, skills, quickslots); var packet = new IPCWriter(IPC.CreateCharacter); packet.Write((byte)status); receiver.Send(packet); }
public void SetSubPassTime(IPCReceiver receiver, IPCReader data) { var id = data.ReadInt32(); var time = data.ReadByte(); logindb.SetSubPassTime(id, time); }
/*CharacterStats GetStats(IPCReceiver receiver, IPCReader data, DatabaseHandler database) * { * serverdbs[server].GetStats(charId); * serverdbs[server].ReadRow(); * * return new CharacterStats((serverdbs[server]["curhp"] as ushort?).Value, * (serverdbs[server]["maxhp"] as ushort?).Value, * (serverdbs[server]["curmp"] as ushort?).Value, * (serverdbs[server]["maxmp"] as ushort?).Value, * (serverdbs[server]["cursp"] as ushort?).Value, * (serverdbs[server]["maxsp"] as ushort?).Value, * (serverdbs[server]["exp"] as ulong?).Value, * new Tuple<uint, uint, uint, uint, uint, byte, ushort, Tuple<ushort, byte, ushort, ushort, ulong, uint>>((serverdbs[server]["str_stat"] as uint?).Value, * (serverdbs[server]["int_stat"] as uint?).Value, * (serverdbs[server]["dex_stat"] as uint?).Value, * (serverdbs[server]["honour"] as uint?).Value, * (serverdbs[server]["rank"] as uint?).Value, * (serverdbs[server]["swordrank"] as byte?).Value, * (serverdbs[server]["swordxp"] as ushort?).Value, * Tuple.Create((serverdbs[server]["swordpoints"] as ushort?).Value, * (serverdbs[server]["magicrank"] as byte?).Value, * (serverdbs[server]["magicxp"] as ushort?).Value, * (serverdbs[server]["magicpoints"] as ushort?).Value, * (serverdbs[server]["alz"] as ulong?).Value, * (serverdbs[server]["pnt_stat"] as uint?).Value * ) * ) * ); * }*/ void CreateCharacter(IPCReceiver receiver, IPCReader data, SyncHandler sync) { var serverId = data.ReadByte(); var id = data.ReadInt32(); var slot = data.ReadByte(); var name = data.ReadString(); var _class = data.ReadByte(); var gender = data.ReadBoolean(); var face = data.ReadByte(); var hair = data.ReadByte(); var colour = data.ReadByte(); var stats = sync.GetInitialCharStats(_class); var items = sync.GetInitialCharItems(_class); var skills = sync.GetInitialCharSkills(_class); var quickslots = sync.GetInitialCharQuickSlots(_class); var serverDB = sync.GetServerDBHandler(serverId); var status = serverDB.CreateCharacter(id, slot, name, _class, gender, face, hair, colour, stats.ToArray(), items, skills, quickslots); var packet = new IPCWriter(IPC.CreateCharacter); packet.Write((byte)status); receiver.Send(packet); }
void GetCashItemList(IPCReceiver receiver, IPCReader data, SyncHandler sync) { var serverId = data.ReadByte(); var id = data.ReadInt32(); var serverDB = sync.GetServerDBHandler(serverId); var CashCount = serverDB.GetCashItemCount(id); var packet = new IPCWriter(IPC.GetCashItemList); packet.Write(CashCount); serverDB.GetCashItem(id); while (serverDB.ReadRow()) { packet.Write((serverDB["ID"] as int?).Value); packet.Write((serverDB["itemid"] as int?).Value); packet.Write(serverDB["itemopt"] as byte[]); packet.Write((serverDB["itemopt2"] as int?).Value); packet.Write((serverDB["duration"] as int?).Value); } receiver.Send(packet); }
public void FetchAccount(IPCReceiver receiver, IPCReader data) { var name = data.ReadString(); var pass = data.ReadString(); var packet = new IPCWriter(IPC.FetchAccount); if (!logindb.FetchAccount(name)) { packet.Write(0x00); packet.Write((byte)0x03); } else { logindb.ReadRow(); var id = (logindb["id"] as int?).Value; var _pass = logindb["password"].ToString(); var auth = (logindb["auth"] as byte?).Value; if (pass != _pass) { packet.Write(0x00); packet.Write((byte)0x04); } else { packet.Write(id); packet.Write(auth); } } receiver.Send(packet); }
public void GetSubPassTime(IPCReceiver receiver, IPCReader data, SyncHandler sync) { var id = data.ReadInt32(); var logindb = sync.GetLoginDBHandler(); var packet = new IPCWriter(IPC.GetSubPassTime); var time = logindb.GetSubPassTime(id); var debug = Configuration.masterLog; if (!debug) { if (time == null) { packet.Write(true); } if (time >= DateTime.Now) { packet.Write(true); } if (time < DateTime.Now) { packet.Write(false); } } else { packet.Write(true); } receiver.Send(packet); }
public void RemoveSubPass(IPCReceiver receiver, IPCReader data, SyncHandler sync) { var id = data.ReadInt32(); var logindb = sync.GetLoginDBHandler(); logindb.RemoveSubPass(id); }
void UpdateOnline(IPCReceiver receiver, IPCReader data, SyncHandler sync) { var id = data.ReadInt32(); var online = data.ReadBoolean(); var logindb = sync.GetLoginDBHandler(); logindb.UpdateOnline(id, online); }
public void UpdateIPDate(IPCReceiver receiver, IPCReader data) { var id = data.ReadInt32(); var ip = data.ReadString(); var date = DateTime.FromBinary(data.ReadInt64()); logindb.UpdateIPDate(id, ip, date); }
public void SetSlotOrder(IPCReceiver receiver, IPCReader data) { var server = data.ReadByte(); var id = data.ReadInt32(); var order = data.ReadInt32(); serverdbs[server].SetSlotOrder(id, order); }
void UpdateIPDate(IPCReceiver receiver, IPCReader data, SyncHandler sync) { var id = data.ReadInt32(); var ip = data.ReadString(); var date = DateTime.FromBinary(data.ReadInt64()); var logindb = sync.GetLoginDBHandler(); logindb.UpdateIPDate(id, ip, date); }
public void SetSubPass(IPCReceiver receiver, IPCReader data) { var id = data.ReadInt32(); var subpw = data.ReadString(); var question = data.ReadByte(); var answer = data.ReadString(); logindb.SetSubPass(id, subpw, question, answer); }
public void SetQuickSlots(IPCReceiver receiver, IPCReader data) { var server = data.ReadByte(); var id = data.ReadInt32(); var quickslot = data.ReadInt32(); var position = data.ReadInt32(); serverdbs[server].SetQuickSlots(id, quickslot, position); }
public void SetSubPassTime(IPCReceiver receiver, IPCReader data, SyncHandler sync) { var id = data.ReadInt32(); var time = data.ReadByte(); var logindb = sync.GetLoginDBHandler(); logindb.SetSubPassTime(id, time); }
void SetCashItem(IPCReceiver receiver, IPCReader data, SyncHandler sync) { var serverId = data.ReadByte(); var ID = data.ReadInt32(); var serverDB = sync.GetServerDBHandler(serverId); serverDB.SetCashItem(ID); }
public void UpdateSkillPoints(IPCReceiver receiver, IPCReader data) { var server = data.ReadByte(); var id = data.ReadInt32(); var skillid = data.ReadUInt16(); var level = data.ReadUInt16(); var slot = data.ReadByte(); serverdbs[server].UpdateSkillPoints(id, skillid, level, slot); }
void SetSlotOrder(IPCReceiver receiver, IPCReader data, SyncHandler sync) { var serverId = data.ReadByte(); var id = data.ReadInt32(); var order = data.ReadInt32(); var serverDB = sync.GetServerDBHandler(serverId); serverDB.SetSlotOrder(id, order); }
public void SetSubPass(IPCReceiver receiver, IPCReader data, SyncHandler sync) { var id = data.ReadInt32(); var subpw = data.ReadString(); var question = data.ReadByte(); var answer = data.ReadString(); var logindb = sync.GetLoginDBHandler(); logindb.SetSubPass(id, subpw, question, answer); }
void SetQuickSlots(IPCReceiver receiver, IPCReader data, SyncHandler sync) { var serverId = data.ReadByte(); var id = data.ReadInt32(); var quickslot = data.ReadInt32(); var position = data.ReadInt32(); var serverDB = sync.GetServerDBHandler(serverId); serverDB.SetQuickSlots(id, quickslot, position); }
public void UpdateStatPoints(IPCReceiver receiver, IPCReader data) { var server = data.ReadByte(); var id = data.ReadInt32(); var str = data.ReadInt32(); var dex = data.ReadInt32(); var intel = data.ReadInt32(); var pnt = data.ReadInt32(); serverdbs[server].UpdateStatPoints(id, str, dex, intel, pnt); }
public void UpdateCharacterPosition(IPCReceiver receiver, IPCReader data) { var server = data.ReadByte(); var id = data.ReadInt32(); var slot = data.ReadByte(); var map = data.ReadByte(); var x = data.ReadByte(); var y = data.ReadByte(); serverdbs[server].UpdateCharacterPosition(id, slot, map, x, y); }
public void GetSubPassQuestion(IPCReceiver receiver, IPCReader data) { var id = data.ReadInt32(); var packet = new IPCWriter(IPC.GetSubPassQuestion); var question = logindb.GetSubPassQuestion(id); packet.Write((byte)question); receiver.Send(packet); }
public void HandlePacket(IPCReceiver receiver, IPCReader data, IPC opcode) { if (ipcPackets.ContainsKey(opcode)) { ipcPackets[opcode].Invoke(receiver, data, syncHandler); } else { Log.Error("Unknown IPC received: " + opcode, "[Master::IPCProtocol::HandlePacket()]"); } }
public void CheckSubPass(IPCReceiver receiver, IPCReader data) { var id = data.ReadInt32(); string pass = data.ReadString(); var packet = new IPCWriter(IPC.CheckSubPass); var status = logindb.CheckSubPw(id, pass); packet.Write(status); receiver.Send(packet); }
public void GetSlotOrder(IPCReceiver receiver, IPCReader data) { var server = data.ReadByte(); var id = data.ReadInt32(); var packet = new IPCWriter(IPC.GetSlotOrder); var order = serverdbs[server].GetSlotOrder(id); packet.Write(order); receiver.Send(packet); }
public void VerifyPassword(IPCReceiver receiver, IPCReader data) { var id = data.ReadInt32(); var pass = data.ReadString(); var packet = new IPCWriter(IPC.VerifyPassword); var status = logindb.VerifyPassword(id, pass); packet.Write(status); receiver.Send(packet); }
void UpdateSkillPoints(IPCReceiver receiver, IPCReader data, SyncHandler sync) { var serverId = data.ReadByte(); var id = data.ReadInt32(); var skillid = data.ReadUInt16(); var level = data.ReadUInt16(); var slot = data.ReadByte(); var serverDB = sync.GetServerDBHandler(serverId); serverDB.UpdateSkillPoints(id, skillid, level, slot); }
void Listen() { syncServer = AweSock.TcpListen(port); Thread.Sleep(3000); Log.Notice("Master Server is listening on {0}:{1}", ip, port); while (true) { var client = AweSock.TcpAccept(syncServer); var receiver = new IPCReceiver(client, this); } }
void UpdateStatPoints(IPCReceiver receiver, IPCReader data, SyncHandler sync) { var serverId = data.ReadByte(); var id = data.ReadInt32(); var str = data.ReadInt32(); var dex = data.ReadInt32(); var intel = data.ReadInt32(); var pnt = data.ReadInt32(); var serverDB = sync.GetServerDBHandler(serverId); serverDB.UpdateStatPoints(id, str, dex, intel, pnt); }