/// <summary> /// Sends the list of characters /// </summary> /// <param name="client"></param> /// <param name="charList"></param> public void CharacterList(Player client, LobbyCharacterInfo[] charList, ushort lastLoginIndex) { PacketStream stream = new PacketStream(0x07D4); stream.WriteUInt32(0); // currentSvTime stream.WriteUInt16(lastLoginIndex); stream.WriteUInt16((ushort)charList.Length); for (int i = 0; i < charList.Length; i++) { stream.WriteInt32(charList[i].ModelInfo.Sex); stream.WriteInt32(charList[i].ModelInfo.Race); for (int j = 0; j < 5; j++) stream.WriteInt32(charList[i].ModelInfo.ModelId[j]); stream.WriteInt32(charList[i].ModelInfo.TextureId); for (int j = 0; j < 24; j++) stream.WriteInt32(charList[i].ModelInfo.WearInfo[j]); stream.WriteInt32(charList[i].Level); stream.WriteInt32(charList[i].Job); stream.WriteInt32(charList[i].JobLevel); stream.WriteInt32(charList[i].ExpPercentage); stream.WriteInt32(charList[i].Hp); stream.WriteInt32(charList[i].Mp); stream.WriteInt32(charList[i].Permission); stream.WriteBool(charList[i].IsBanned); stream.WriteString(charList[i].Name, 19); stream.WriteUInt32(charList[i].SkinColor); stream.WriteString(charList[i].CreateTime, 30); stream.WriteString(charList[i].DeleteTime, 30); for (int j = 0; j < 24; j++) stream.WriteInt32(charList[i].WearItemEnhanceInfo[j]); for (int j = 0; j < 24; j++) stream.WriteInt32(charList[i].WearItemLevelInfo[j]); for (int j = 0; j < 24; j++) stream.WriteByte(charList[i].WearItemElementalType[j]); } ClientManager.Instance.Send(client, stream, BroadcastArea.Self); }
/// <summary> /// Sets a property /// </summary> /// <param name="player">target player</param> /// <param name="name">property name</param> /// <param name="value">value</param> /// <param name="isInt">send as int?</param> internal void Property(Player player, string name, object value, bool isInt) { PacketStream stream = new PacketStream(0x01FB); stream.WriteUInt32(player.Handle); stream.WriteBool(isInt); stream.WriteString(name, 16); if (isInt) { stream.WriteInt64(Convert.ToInt64(value)); } else { stream.WriteInt64(0); string val = (string)value; stream.WriteString(val, val.Length + 1); } ClientManager.Instance.Send(player, stream, BroadcastArea.Self); }
/* TODO : add struct // 0x0258 struct TS_SC_QUEST_LIST { TS_MESSAGE baseclass_0; unsigned __int16 count_active; unsigned __int16 count_pending; //TS_SC_QUEST_LIST::TS_QUEST_INFO actives[count_active]; //TS_SC_QUEST_LIST::TS_PENDING_QUEST_INFO pendings[count_pending]; }; struct TS_SC_QUEST_LIST::TS_QUEST_INFO { int code; int nStartID; int nRandomValue[6]; int nStatus[6]; char nProgress; unsigned int nTimeLimit; }; struct TS_SC_QUEST_LIST::TS_PENDING_QUEST_INFO { int code; int nStartID; };*/ internal void Chat(Player player, string sender, byte type, string message) { PacketStream stream = new PacketStream(0x0016); stream.WriteString(sender, 21); stream.WriteUInt16((ushort)message.Length); stream.WriteByte(type); stream.WriteString(message, message.Length+1); ClientManager.Instance.Send(player, stream, BroadcastArea.Self); }
internal void LoginResult(Player player) { PacketStream stream = new PacketStream(0x0004); stream.WriteByte(1); stream.WriteUInt32(player.Handle); stream.WriteSingle(168344f);//player.Position.X); stream.WriteSingle(55400f);//player.Position.Y); stream.WriteSingle(player.Position.Z); stream.WriteByte(1);//player.Position.Layer); stream.WriteSingle(0f); // TODO : face_direction stream.WriteInt32(Globals.RegionSize); stream.WriteInt32(100);//player.Hp); stream.WriteInt16(100);//player.Mp); stream.WriteInt32(100);//player.MaxHp); stream.WriteInt16(100);// player.MaxMp); stream.WriteInt32(player.Havoc); stream.WriteInt32(Globals.MaxHavoc); // TODO : Is this constant? stream.WriteInt32(player.Sex); stream.WriteInt32(player.Race); stream.WriteUInt32(player.SkinColor); stream.WriteInt32(player.FaceId); stream.WriteInt32(player.HairId); stream.WriteString(player.Name, 19); stream.WriteInt32(Globals.CellSize); stream.WriteInt32(player.GuildId); ClientManager.Instance.Send(player, stream, BroadcastArea.Self); }
/// <summary> /// Sends a list of URLs /// </summary> /// <param name="client"></param> public void UrlList(Player player) { PacketStream stream = new PacketStream(0x2329); stream.WriteUInt16((ushort)Server.UrlList.Length); stream.WriteString(Server.UrlList); ClientManager.Instance.Send(player, stream, BroadcastArea.Self); }