public static Packet BeginDisplayRest(ZoneCharacter character) { Packet packet = new Packet(SH8Type.BeginDisplayRest); packet.WriteUShort(character.MapObjectID); packet.WriteUShort(character.House.ItemID); packet.Fill(10, 0xff); return packet; }
public void Write(Packet pPacket) { pPacket.WriteUShort(ID); pPacket.WriteInt(60000); // Cooldown //pPacket.WriteShort(Upgrades); pPacket.WriteUShort(GetUpgrades(4, 3, 2, 1)); pPacket.WriteInt(9000); // Skill exp??? }
public static void SendCharacterChunkEnd(ZoneCharacter character) { using (var packet = new Packet(SH4Type.CharacterInfoEnd)) { packet.WriteUShort(0xFFFF); packet.WriteUShort(0xFFFF); character.Client.SendPacket(packet); } }
public void Write(Packet packet) { packet.WriteUShort(ID); packet.WriteUShort(Item.ItemID); packet.WriteInt(Position.X); packet.WriteInt(Position.Y); packet.WriteUShort((DroppedBy != null) ? DroppedBy.MapObjectID : (ushort)0xffff); packet.WriteByte(CanTake ? (byte)0x08 : (byte)0x00); }
public static Packet Equip(ZoneCharacter character, Item equip) { //B2 00 - AB 38 - 07 - 0D 00 04 Packet packet = new Packet(SH7Type.ShowEquip); packet.WriteUShort(character.MapObjectID); packet.WriteUShort(equip.ID); packet.WriteByte(equip.UpgradeStats.Upgrades); packet.Fill(3, 0xff); return packet; }
public static void SendChangeZone(ZoneCharacter character, ushort mapid, int x, int y, string ip, ushort port, ushort randomid) { using (var packet = new Packet(SH6Type.ChangeZone)) { packet.WriteUShort(mapid); packet.WriteInt(x); packet.WriteInt(y); packet.WriteString(Settings.Instance.IP, 16); packet.WriteUShort(port); packet.WriteUShort(randomid); character.Client.SendPacket(packet); } }
public static void SendChangeZone(ZoneCharacter character, ushort mapid, int x, int y, string IP, ushort port, ushort randomid) { using (var packet = new Packet(SH6Type.ChangeZone)) { packet.WriteUShort(mapid); packet.WriteInt(x); packet.WriteInt(y); packet.WriteString(character.Client.Host == "127.0.0.1" ? "127.0.0.1" : IP, 16); packet.WriteUShort(port); packet.WriteUShort(randomid); character.Client.SendPacket(packet); } }
public static void SendAttackAnimation(MapObject from, ushort objectID, ushort attackspeed, byte stance) { using (var packet = new Packet(SH9Type.AttackAnimation)) { packet.WriteUShort(from.MapObjectID); packet.WriteUShort(objectID); packet.WriteByte(stance); packet.WriteUShort(attackspeed); packet.WriteByte(4); packet.WriteByte(100); from.MapSector.Broadcast(packet); } }
public static void WriteBasicCharInfo(WorldCharacter wchar, Packet packet) { packet.WriteInt(wchar.Character.ID); packet.WriteString(wchar.Character.Name, 16); packet.WriteUShort(wchar.Character.CharLevel); packet.WriteByte(wchar.Character.Slot); MapInfo mapinfo; if (!DataProvider.Instance.Maps.TryGetValue(wchar.Character.Map, out mapinfo)) { Log.WriteLine(LogLevel.Warn, "{0} has an invalid MapID ({1})", wchar.Character.Name, wchar.Character.Map); wchar.Character.Map = 0;//we reset packet.WriteString("Rou", 12); } else { packet.WriteString(mapinfo.ShortName, 12); } packet.WriteByte(0); // UNK packet.WriteInt(0x00000000); // Random seed WriteLook(wchar, packet); WriteEquipment(wchar, packet); WriteRefinement(wchar, packet); packet.Fill(4, 0xff); // UNK packet.WriteString("Rou", 12); //TODO: load from mapinfo.shn packet.WriteInt(0); // X, doesn't matter packet.WriteInt(0); // Y, neither packet.WriteInt(0x63dd45ca); packet.WriteByte(0); packet.WriteInt(100); // Test later! packet.WriteByte(0); wchar.Detach(); }
public static Packet Animation(ZoneCharacter character, byte id) { Packet packet = new Packet(SH8Type.Emote); packet.WriteUShort(character.MapObjectID); packet.WriteByte(id); return packet; }
public static void AddBlock(WorldClient client, Packet packet) { string AddBlockname; if (packet.TryReadString(out AddBlockname, 16)) { client.Character.BlocketUser.Add(AddBlockname); using (var pp = new Packet(SH42Type.AddToBlockList)) { pp.WriteUShort(7168);//unk pp.WriteString(AddBlockname, 16); pp.WriteUShort(0);//unk client.SendPacket(pp); } Program.DatabaseManager.GetClient().ExecuteQuery("INSERT INTO BlockUser (CharID,BlockCharname) VALUES ('" + client.Character.ID + "','" + AddBlockname + "')"); } }
public static void LeaveParty(WorldClient client, Packet packet) { Party party; party = Program.Entity.Parties.First(c => c.CharNo == client.Character.Character.ID); foreach (Party PartyListFromDB in Program.Entity.Parties.Where(c => c.PartyNo == party.PartyNo).OrderBy(c => c.MasterNo)) { Character character; character = Program.Entity.Characters.First(c => c.ID == PartyListFromDB.CharNo); WorldClient Partyclient = ClientManager.Instance.GetClientByCharname(character.Name); using (var ppacket = new Packet(SH14Type.LeaveParty)) { ppacket.WriteString(client.Character.Character.Name, 16); ppacket.WriteUShort(1281); Partyclient.SendPacket(ppacket); } } if(Program.Entity.Parties.Where(c => c.PartyNo == party.PartyNo).Count() == 2){ Party OtherClientParty; OtherClientParty = Program.Entity.Parties.First(c => c.CharNo != client.Character.Character.ID); Program.Entity.DeleteObject(OtherClientParty); } Program.Entity.DeleteObject(party); Program.Entity.SaveChanges(); }
public static void FailedUnequip(ZoneCharacter character) { using (var packet = new Packet(SH12Type.FailedUnequip)) { packet.WriteUShort(706); character.Client.SendPacket(packet); } }
public static void SendConnectError(WorldClient client, ConnectErrors error) { using (var packet = new Packet(SH4Type.ConnectError)) { packet.WriteUShort((ushort)error); client.SendPacket(packet); } }
public static void FailedEquip(ZoneCharacter character, ushort val = 0) { using (var packet = new Packet(SH12Type.FailedEquip)) { packet.WriteUShort(val); character.Client.SendPacket(packet); } }
public static void SendAcademyResponse(WorldClient pClient,string GuildName, GuildAcademyResponse Response) { using (var packet = new Packet(SH38Type.AcademyResponse)) { packet.WriteString(GuildName, 16); packet.WriteUShort((ushort)Response); pClient.SendPacket(packet); } }
public static void SendQuestion(ZoneCharacter character, Question question, ushort range) { using (var packet = new Packet(SH15Type.Question)) { packet.WriteString(question.Text, 129); packet.WriteUShort(character.MapObjectID); // Obj id packet.WriteInt(character.Position.X); packet.WriteInt(character.Position.Y); packet.WriteUShort(range); // Distance how far your allowed to run when the question window is closed by Client packet.WriteByte((byte)question.Answers.Count); for (byte i = 0; i < question.Answers.Count; ++i) { packet.WriteByte(i); packet.WriteString(question.Answers[i], 32); } character.Client.SendPacket(packet); } }
public static void SendTradeRequest(ZoneClient client, ushort ObjID) { using(var packet = new Packet(SH19Type.TradeRequest)) { ZoneClient otherclient = ClientManager.Instance.GetClientByObj(ObjID); packet.WriteUShort(client.Character.MapObjectID); otherclient.SendPacket(packet); } }
public static void SendSkillLearnt(ZoneCharacter character, ushort skillid) { using (var packet = new Packet(SH18Type.LearnSkill)) { packet.WriteUShort(skillid); packet.WriteByte(0); //unk character.Client.SendPacket(packet); } }
public static void SendZoneServerIP(WorldClient client, ZoneConnection info) { using (var packet = new Packet(SH4Type.ServerIP)) { packet.WriteString(info.IP, 16); packet.WriteUShort(info.Port); client.SendPacket(packet); } }
public static void SendBackToWorldSelect(WorldClient client) { using(Packet packet = new Packet(SH3Type.BackToWorldSelect)) { packet.WriteUShort(7768); packet.WriteString(client.AccountKey); client.SendPacket(packet); } }
public static void SendConnectError(WorldClient client, ConnectErrors error) { Log.WriteLine(LogLevel.Error, error.ToString()); using (var packet = new Packet(SH4Type.ConnectError)) { packet.WriteUShort((ushort)error); client.SendPacket(packet); } }
public static void FriendInvite(WorldClient pClient, Packet pPacket) { string sender, receiver; if (!pPacket.TryReadString(out sender, 16) || !pPacket.TryReadString(out receiver, 16)) { Log.WriteLine(LogLevel.Warn, "Error reading friend invite."); return; } WorldCharacter inviter = pClient.Character; WorldClient invitee = ClientManager.Instance.GetClientByCharname(receiver); if (invitee == null) { //character not found using (var pack = new Packet(SH21Type.FriendInviteResponse)) { pack.WriteString(sender, 16); pack.WriteString(receiver, 16); pack.WriteUShort(0x0946); // Cannot find ${Target} pClient.SendPacket(pack); } } else if (receiver == sender) { using (var pack = new Packet(SH21Type.FriendInviteResponse)) { pack.WriteString(sender, 16); pack.WriteString(receiver, 16); pack.WriteUShort(0x0942); // You cannot add yourself to your Buddy List. pClient.SendPacket(pack); } } else if (inviter.Friends.Find(f => f.Name == receiver) != null) { using (var pack = new Packet(SH21Type.FriendInviteResponse)) { pack.WriteString(sender, 16); pack.WriteString(receiver, 16); pack.WriteUShort(0x0945); // {Target} is already registered in the friends list. pClient.SendPacket(pack); } } else { using (var pack = new Packet(SH21Type.FriendInviteRequest)) { pack.WriteString(receiver, 16); pack.WriteString(sender, 16); invitee.SendPacket(pack); } } }
public static void ChangeFromGuildAcademyToResponse(WorldClient client, Packet packet) { string GuildName; string RequestName; bool answer; if (!packet.TryReadString(out GuildName, 16) || !packet.TryReadString(out RequestName, 16)|| (!packet.TryReadBool(out answer) || !client.Character.IsInGuildAcademy)) return; if (answer) { GuildAcademyMember pMember = client.Character.GuildAcademy.Members.Find(m => m.Character.Character.Name == RequestName); if (pMember == null) return; pMember.Character.IsInGuildAcademy = false; pMember.Academy.RemoveMember(pMember); pMember.Character.GuildAcademy.Guild.AddMember(pMember.Character, GuildRank.Member, Program.DatabaseManager.GetClient().GetConnection(), true, true); pMember.Character.Guild = pMember.Character.GuildAcademy.Guild; pMember.Character.IsInGuild = true; using (var pack = new Packet(SH38Type.SendJoinGuildFromAcademy)) { //this packet remove character from academy List and added to GuildList pack.WriteString(RequestName, 16); pack.WriteString(client.Character.Character.Name, 16); pack.WriteByte(6);//rank pack.WriteInt(0);//unk pack.WriteUShort(0);//korp pack.Fill(64, 0x00);//unk pack.WriteByte(true ? (byte)0x95 : (byte)0x00);// (this.isOnline ? (byte)0x95 : (byte)0x00); pack.Fill(3, 0x00);//unk pack.WriteByte(pMember.Character.Character.Job); pack.WriteByte(pMember.Character.Character.CharLevel); pack.Fill(13, 0x00);//unk client.Character.GuildAcademy.Guild.Broadcast(pack); client.Character.GuildAcademy.Broadcast(pack); } } using (var p2 = new Packet(SH4Type.CharacterGuildinfo)) { client.Character.Guild.WriteGuildInfo(packet); client.SendPacket(p2); } using (var pack = new Packet(SH29Type.GuildMemberJoined)) { pack.WriteString(client.Character.Character.Name, 16); client.Character.GuildAcademy.Guild.Broadcast(pack); client.Character.GuildAcademy.Broadcast(pack); } using (var pack = new Packet(SH29Type.ChangeResponse)) { pack.WriteUShort(3137);//unk pack.WriteByte(3); pack.Fill(2, 0x00);//unk client.SendPacket(pack); } }
public static void SendChangeMap(ZoneCharacter character, ushort mapid, int x, int y) { using (var packet = new Packet(SH6Type.ChangeMap)) { packet.WriteUShort(mapid); packet.WriteInt(x); packet.WriteInt(y); character.Client.SendPacket(packet); } }
public static void clearBlock(WorldClient client, Packet packet) { using (var pp = new Packet(SH42Type.ClearBlockList)) { pp.WriteUShort(7200);//unk client.SendPacket(packet); } Program.DatabaseManager.GetClient().ExecuteQuery("DELETE FROM BlockUser WHERE CharID = '" + client.Character.ID + "'"); client.Character.BlocketUser.Clear(); }
public void Write(Packet packet) { packet.WriteUShort(this.MapObjectID); packet.WriteByte(2); //always 2 (type i bet shown / transparent?) packet.WriteUShort(ID); packet.WriteInt(this.Position.X); packet.WriteInt(this.Position.Y); packet.WriteByte(this.Rotation); //TODO: rotation for NPC (from txt official files?) if (Gate != null) { packet.WriteByte(1); packet.WriteString(Gate.MapClient, 12); packet.Fill(41, 0); } else { packet.Fill(54, 0); //find out later } }
public void Write(Packet packet) { packet.WriteUShort(this.MapObjectID); packet.WriteByte(2); //always 2 (type i bet shown / transparent?) -> test it packet.WriteUShort(this.ID); packet.WriteInt(this.Position.X); packet.WriteInt(this.Position.Y); packet.WriteByte(this.Rotation); if (Gate != null) { packet.WriteByte(1); packet.WriteString(Gate.MapClient, 12); packet.Fill(43, 0); } else { packet.Fill(56, 0); //find out later } }
public static void MasterRequestAcceptCoper(ZoneClient client, Packet pPacket) { client.Character.Character.ReviveCoper = 0; InterServer.InterHandler.SendReciveCoper(client.Character.Character.Name, client.Character.Character.ReviveCoper,true); using(var packet = new Packet(37,65)) { packet.WriteUShort(7272);//unk packet.WriteLong(client.Character.RecviveCoper); client.SendPacket(packet); } }
public static void MasterRequestCoper(ZoneClient client, Packet pPacket) { byte unk; if (!pPacket.TryReadByte(out unk)) return; using (var packet = new Packet(SH37Type.SendRecivveCopper)) { packet.WriteUShort(7264);//unk packet.WriteLong(client.Character.Character.ReviveCoper); client.SendPacket(packet); } }