public void WritePremiumInfo(Packet packet) { packet.WriteInt(this.UniqueID); packet.WriteInt(this.ShopID); packet.WriteInt(0);//unk packet.WriteInt(0);//unk }
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 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 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 SendClientTime(WorldClient client, DateTime time) { using (var packet = new Packet(SH2Type.UpdateClientTime)) { //pPacket.WriteUInt((59 << 25) | (23 << 19) | (31 << 13) | (12 << 8) | (254)); // * Minutes | Hours | Days | Months | Years packet.WriteInt(3); packet.WriteInt(time.Minute);//minutes packet.WriteInt(time.Hour);//hourses packet.WriteInt(time.Day); packet.WriteInt(time.Month-1); packet.WriteInt((time.Year - 1900)); packet.WriteInt((int)time.DayOfWeek);//wekday? packet.WriteInt(105); packet.WriteInt(2); packet.WriteByte(1); //GMT 0-130 positive 130 -254 negative // packet.WriteLong(2012); // packet.WriteInt(4);//unk //packet.WriteInt(1);//unk //packet.WriteInt(3);//unk //packet.WriteInt(46); // packet.Fill(3, 0);//unk // packet.WriteByte(2); 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(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 SendPartyInformation(ZoneClient client) { if (Program.Entity.Parties.Where(c => c.CharNo == client.Character.ID).Count() == 1) { Party PartyNo = Program.Entity.Parties.First(c => c.CharNo == client.Character.ID); foreach (Party party in Program.Entity.Parties.Where(c => c.PartyNo == PartyNo.PartyNo)) { Character Pcharacter = Program.Entity.Characters.First(c => c.ID == party.CharNo); ZoneClient otherLiveInfo = ClientManager.Instance.GetClientByName(Pcharacter.Name); if (otherLiveInfo != null) { if (otherLiveInfo.Character.MapID == client.Character.MapID) { using (var ppacket = new Packet(SH14Type.PartyInformationShort)) { ppacket.WriteByte(1); ppacket.WriteString(otherLiveInfo.Character.Name, 16); ppacket.WriteUInt(otherLiveInfo.Character.HP); ppacket.WriteUInt(otherLiveInfo.Character.SP); ppacket.WriteUInt(otherLiveInfo.Character.LP); client.SendPacket(ppacket); } using (var ppacket = new Packet(SH14Type.PartyInformation)) { ppacket.WriteByte(1); //unk ppacket.WriteString(otherLiveInfo.Character.Name, 16); ppacket.WriteByte((byte)otherLiveInfo.Character.Job); ppacket.WriteByte(otherLiveInfo.Character.Level); ppacket.WriteUInt(otherLiveInfo.Character.HP); ppacket.WriteUInt(otherLiveInfo.Character.SP); ppacket.WriteUInt(otherLiveInfo.Character.LP); ppacket.WriteByte(1); //unk client.SendPacket(ppacket); } using (var ppacket = new Packet(SH14Type.PartyLoginCord)) { ppacket.WriteByte(1); //unk ppacket.WriteString(otherLiveInfo.Character.Name, 16); ppacket.WriteInt(otherLiveInfo.Character.Position.X); ppacket.WriteInt(otherLiveInfo.Character.Position.Y); client.SendPacket(ppacket); } } } } } }
public void BroadcastGuildName() { var packet = new Packet(SH29Type.GuildNameResult); packet.WriteInt(Academy.Guild.ID); packet.WriteString(Academy.Guild.Name, 16); Character.BroucastPacket(packet); }
public static void SendUnknown(WorldClient client) { using (var packet = new Packet(SH31Type.LoadUnkown)) { packet.WriteInt(0xbd1); //lolwut?! charid or sumtin' client.SendPacket(packet); } }
public void BroadcastGuildName() { var packet = new Packet(SH29Type.GuildNameResult); packet.WriteInt(Guild.ID); packet.WriteString(Guild.Name, 16); BroadcastManager.Instance.BroadcastInRange(Character, packet, false); }
public static void SendChatBlock(ZoneCharacter character, int seconds) { using (var packet = new Packet(SH2Type.Chatblock)) { packet.WriteInt(seconds); character.Client.SendPacket(packet); } }
public static void WriteBasicCharInfo(WorldCharacter wchar, Packet packet) { packet.WriteInt(wchar.Character.ID); packet.WriteString(wchar.Character.Name, 20); 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(2, 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); packet.WriteInt(0); packet.WriteByte(1); wchar.Detach(); }
public static void SendGuildNameResult(WorldClient client, int pID, string pName) { using (var packet = new Packet(SH29Type.GuildNameResult)) { packet.WriteInt(pID); packet.WriteString(pName, 16); client.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 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 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 SendGameMessage(ZoneCharacter character, string Message, string script) { using (var packet = new Packet(SH27Type.GameMessage)) { packet.WriteString(script, 31); packet.WriteByte(24); packet.WriteInt(Message.Length); packet.WriteByte(0); packet.WriteString(Message, Message.Length); character.Client.SendPacket(packet); } }
public static void WriteBasicCharInfo(WorldCharacter wchar, Packet packet) { packet.WriteInt(wchar.Character.ID); //charid packet.FillPadding(wchar.Character.Name, 0x10); packet.WriteInt(0);//unk packet.WriteShort((short)wchar.Character.CharLevel); //level packet.WriteByte(wchar.Character.Slot); MapInfo mapinfo; if (!DataProvider.Instance.Maps.TryGetValue(wchar.Character.PositionInfo.Map, out mapinfo)) { Log.WriteLine(LogLevel.Warn, "{0} has an invalid MapID ({1})", wchar.Character.Name, wchar.Character.PositionInfo.Map); wchar.Character.PositionInfo.Map = 0; packet.FillPadding(mapinfo.ShortName, 0x0D); //townname } else { packet.FillPadding(mapinfo.ShortName, 0x0D); //townname } //packet.WriteByte(0); // UNK packet.WriteInt(0); // Random seed WriteLook(wchar,packet); WriteEquipment(wchar,packet); WriteRefinement(wchar,packet); packet.WriteByte(0); packet.WriteByte(0xF0); packet.WriteByte(0xFF);//unk packet.WriteByte(0xFF); packet.FillPadding(mapinfo.ShortName, 0x0c); packet.WriteInt(0); //pos packet.WriteInt(0); //pos packet.WriteUShort(0xdb78); packet.WriteUShort(4910);//unk packet.WriteUShort(25600); packet.Fill(4, 0); }
public static void SendActiveSkillList(ZoneCharacter character) { using (var packet = new Packet(SH4Type.CharacterActiveSkillList)) { var list = character.SkillsActive.Values; packet.WriteByte(0); packet.WriteInt(character.ID); packet.WriteUShort((ushort)list.Count); // Skill count (max 300) foreach (var skill in list) { skill.Write(packet); } character.Client.SendPacket(packet); } }
public static void SendInterfaceClock(WorldClient client) { DateTime dt = DateTime.Now; using (var packet = new Packet(SH2Type.InterfaceClock)) { packet.WriteInt(DateTime.Now.DayOfYear); //unk packet.WriteInt(DateTime.Now.Minute); packet.WriteInt(DateTime.Now.Hour); packet.WriteInt(DateTime.Now.Day); packet.WriteInt((DateTime.Now.Month - 1)); packet.WriteInt((DateTime.Now.Year - 1900)); packet.WriteInt((int)DateTime.Now.DayOfWeek); packet.WriteInt((DateTime.Now.DayOfYear - 1)); packet.Fill(4, 0); //unk packet.WriteSByte(Convert.ToSByte((DateTime.Now - DateTime.UtcNow).ToString().Split(':')[0])); //Timezone client.SendPacket(packet); } }
public static void MasterList(WorldClient client, Packet packet) { Dictionary<string, string> list = new Dictionary<string, string> { {"Char1", "hier ist Char1"}, {"Char2", "hier ist Char2"} }; using (var ppacket = new Packet(SH14Type.GroupList)) { ppacket.WriteHexAsBytes("00 00 14 01 01 00 01 00 00 00"); ppacket.WriteInt(list.Count); foreach (KeyValuePair<string, string> stat in list) { // Note - teh f**k? ppacket.WriteHexAsBytes(""); ppacket.WriteString("haha", 16); ppacket.WriteString("1234567890123456789012345678901234567890123456", 46); ppacket.WriteHexAsBytes("00 00 00 00 44 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 8C 8E CD 00 88 49 DF 4E B3 08 4C 00 78 26 43 00 01 00 00 00 5A 68 42 00 18 FE 64 02 40 55 DF 4E 08 27 4D 00 94 FF 64 02 24 00 00 00 BD 68 42 00 87 BE"); } list.Clear(); client.SendPacket(ppacket); } }
public void Write(Packet packet) { packet.WriteUShort(this.MapObjectID); packet.WriteByte(2); packet.WriteUShort(ID); packet.WriteInt(this.Position.X); packet.WriteInt(this.Position.Y); packet.WriteByte(this.Rotation); packet.Fill(119, 0); packet.WriteUShort(2); }
public static void ObtainedItem(ZoneCharacter character, DroppedItem item, ObtainedItemStatus status) { using (var packet = new Packet(SH12Type.ObtainedItem)) { packet.WriteUShort(item.ItemID); packet.WriteInt(item.Amount); packet.WriteUShort((ushort)status); packet.WriteUShort(0xffff); character.Client.SendPacket(packet); } }
public void WriteDetailedInfoExtra(Packet packet, bool levelUP = false) { if (!levelUP) { packet.WriteUShort(this.MapObjectID); } packet.WriteLong(this.Exp); packet.WriteULong(DataProvider.Instance.GetMaxExpForLevel(this.Level)); packet.WriteInt(BaseStats.Strength); packet.WriteInt(BaseStats.Strength + GetExtraStr()); packet.WriteInt(BaseStats.Endurance); packet.WriteInt(BaseStats.Endurance + GetExtraEnd()); packet.WriteInt(BaseStats.Dexterity); packet.WriteInt(BaseStats.Dexterity + GetExtraDex()); packet.WriteInt(BaseStats.Intelligence); packet.WriteInt(BaseStats.Intelligence + GetExtraInt()); packet.WriteInt(0); // Wizdom. It isn't set in the server so it can contain shit from old buffers... :D packet.WriteInt(0); // I once had a name here :P packet.WriteInt(BaseStats.Spirit); packet.WriteInt(BaseStats.Spirit + GetExtraSpr()); packet.WriteInt(GetWeaponDamage()); //base damage packet.WriteInt(GetWeaponDamage(true)); //increased damage (e.g. buffs) packet.WriteInt(GetMagicDamage()); //magic dmg packet.WriteInt(GetMagicDamage(true)); //inc magic dmg packet.WriteInt(GetWeaponDefense()); //todo equip stats loading (weapondef) packet.WriteInt(GetWeaponDefense(true)); //weapondef inc packet.WriteInt(GetAim()); //TODO: basestats aim + dex? packet.WriteInt(GetAim(true)); //aim inc (calcuate later based on dex) packet.WriteInt(GetEvasion()); //evasion packet.WriteInt(GetEvasion(true)); //evasion inc packet.WriteInt(GetWeaponDamage()); //damage block again packet.WriteInt(GetWeaponDamage(true)); packet.WriteInt(GetMagicDamage()); //magic damage packet.WriteInt(GetMagicDamage(true)); packet.WriteInt(GetMagicDefense()); //magic def packet.WriteInt(GetMagicDefense(true)); //magic def inc packet.WriteInt(1); packet.WriteInt(20); packet.WriteInt(2); packet.WriteInt(40); packet.WriteUInt(BaseStats.MaxHP); //max HP packet.WriteUInt(BaseStats.MaxSP); //max SP if (character.Job == (int)Job.Crusader) packet.WriteInt(100); // max LP else packet.WriteInt(0); // max LP packet.WriteInt(0); // UNK packet.WriteInt(BaseStats.MAXSoulHP); // Max HP Stones packet.WriteInt(BaseStats.MAXSoulSP); // Max SP Stones packet.Fill(64, 0); if (!levelUP) { packet.WriteInt(this.Position.X); packet.WriteInt(this.Position.Y); } }
public void WriteDetailedInfo(Packet pPacket) { pPacket.WriteInt(ID); pPacket.WriteString(this.Name, 16); pPacket.WriteByte(this.Slot); pPacket.WriteByte(this.Level); pPacket.WriteLong(this.Exp); pPacket.WriteInt(0); // UNK pPacket.WriteShort(this.StonesHP); pPacket.WriteShort(this.StonesSP); pPacket.WriteUInt(this.HP); pPacket.WriteUInt(this.SP); pPacket.Fill(4, 0); //UNK pPacket.WriteInt(this.Fame); // Fame pPacket.WriteLong(this.Money); //TODO: inventory class pPacket.WriteString(this.Map.MapInfo.ShortName, 12); pPacket.WriteInt(this.Position.X); pPacket.WriteInt(this.Position.Y); pPacket.WriteByte(this.Rotation); pPacket.WriteByte(this.Str); // Str bonus pPacket.WriteByte(this.End); // End bonus pPacket.WriteByte(this.Dex); // Dex bonus pPacket.WriteByte(this.Int); // Int bonus pPacket.WriteByte(this.Spr); // Spr bonus pPacket.WriteShort(0); // UNK pPacket.WriteUInt(0); // Killpoints pPacket.Fill(7, 0); // UNK }
public void WriteCharacterDisplay(Packet packet) { packet.WriteUShort(MapObjectID); packet.WriteString(Name, 16); packet.WriteInt(Position.X); packet.WriteInt(Position.Y); packet.WriteByte(Rotation); // Rotation packet.WriteByte((byte)State); // Player State (1,2 - Player, 3 - Dead, 4 - Resting, 5 - Vendor, 6 - On Mount) packet.WriteByte((byte)Job); if (State != PlayerState.Resting && State != PlayerState.Vendor && this.House == null) { WriteLook(packet); WriteEquipment(packet); } else { this.House.WritePacket(packet); } WriteRefinement(packet); packet.WriteUShort(0); // Mount Handle packet.WriteUShort(0xffff); packet.WriteByte(0xff); // Emote (0xff = nothing) packet.WriteUShort(0xffff); packet.WriteShort(0); packet.WriteUShort(0); // Mob ID (title = 10) packet.Fill(81, 0); // Buff Bits? Something like that packet.WriteInt(character.GuildID.HasValue ? character.GuildID.Value : 0); // Guild ID packet.WriteByte(0x02); // UNK (0x02) packet.WriteBool(false); // In Guild Academy (0 - No, 1 - Yes) packet.WriteBool(true); // Pet AutoPickup (0 - Off, 1 - On) packet.WriteByte(this.Level); packet.Fill(32, 0); packet.Fill(2, 0xFF); packet.WriteUShort(522); }
public static Packet InventoryMessage(ushort pMessage, ushort pID = ushort.MaxValue, ushort pCount = (ushort) 1) { /* 0x0341 Item Obtained 0x0342 Failed to obtain 0x0346 Inventory Full */ Packet pack = new Packet(); pack.WriteUShort(0x300a); pack.WriteUShort(pID); pack.WriteInt(pCount); pack.WriteUShort(pMessage); pack.Fill(2, 0xff); return pack; }
private void Testg(ZoneCharacter character, params string[] param) { //05 58 00 04 0A 7A 0F 00 90 2B using (var pack = new Packet(SH38Type.AcademyMemberJoined)) { pack.WriteString("invider", 16); pack.WriteString("Create", 16); pack.WriteByte(6);//rank pack.WriteInt(0);//unk pack.WriteUShort(9000);//korp pack.Fill(64, 0x00);//unk pack.WriteByte(95);// (this.isOnline ? (byte)0x95 : (byte)0x00); pack.Fill(3, 0x00);//unk pack.WriteByte(21); pack.WriteByte(255); pack.Fill(13, 0x00);//unk character.Client.SendPacket(pack); } }