本文整理汇总了C#中FrameWork.PacketOut.Write方法的典型用法代码示例。如果您正苦于以下问题:C# PacketOut.Write方法的具体用法?C# PacketOut.Write怎么用?C# PacketOut.Write使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameWork.PacketOut
的用法示例。
在下文中一共展示了PacketOut.Write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Send
public static void Send(LobbyClient client)
{
Log.Debug("LOGIN_SALT", "Send to " + client.Account.Email);
MakeSalt(client);
PacketOut Out = new PacketOut((UInt32)Opcodes.LOGIN_SALT);
Out.WriteInt32R(client.Account.Id);
Out.Write(client.B, 0, 64);
Out.WriteByte(0x40);
Out.WriteByte(0);
Out.Write(client.Salt, 0, 10);
client.SendTCP(Out);
}
示例2: CMSG_VerifyProtocolReq
static public void CMSG_VerifyProtocolReq(BaseClient client, PacketIn packet)
{
Client cclient = client as Client;
PacketOut Out = new PacketOut((byte)Opcodes.SMSG_VerifyProtocolReply);
byte[] IV_HASH1 = { 0x01, 0x53, 0x21, 0x4d, 0x4a, 0x04, 0x27, 0xb7, 0xb4, 0x59, 0x0f, 0x3e, 0xa7, 0x9d, 0x29, 0xe9 };
byte[] IV_HASH2 = { 0x49, 0x18, 0xa1, 0x2a, 0x64, 0xe1, 0xda, 0xbd, 0x84, 0xd9, 0xf4, 0x8a, 0x8b, 0x3c, 0x27, 0x20 };
ByteString iv1 = ByteString.CopyFrom(IV_HASH1);
ByteString iv2 = ByteString.CopyFrom(IV_HASH2);
VerifyProtocolReply.Builder verify = VerifyProtocolReply.CreateBuilder();
verify.SetResultCode(VerifyProtocolReply.Types.ResultCode.RES_SUCCESS);
verify.SetIv1(ByteString.CopyFrom(IV_HASH1));
verify.SetIv2(ByteString.CopyFrom(IV_HASH2));
Out.Write(verify.Build().ToByteArray());
cclient.SendTCPCuted(Out);
}
示例3: OnWorldPlayerEvent
public override void OnWorldPlayerEvent(string EventName, Player Plr, object Data)
{
if (EventName == "SEND_PACKAGES")
{
List<PacketInfo> P;
if (Packets.TryGetValue(Plr._Info.Career, out P))
{
foreach (PacketInfo Packet in P)
{
PacketOut Out = new PacketOut(Packet.Opcode);
Out.Write(Packet.Data, 3, Packet.Data.Length - 3);
Plr.SendPacket(Out);
}
}
if (Plr._Info.FirstConnect && Plr.GmLevel == 0)
{
Plr._Info.FirstConnect = false;
PacketInfo Packet = Intros[Plr._Info.Career];
PacketOut Out = new PacketOut(Packet.Opcode);
Out.Write(Packet.Data, 3, Packet.Data.Length - 3);
Plr.SendPacket(Out);
}
}
}
示例4: HandlePacket
public static void HandlePacket(BaseClient client, PacketIn packet)
{
LobbyClient cclient = (LobbyClient)client;
byte FileId = packet.GetUint8();
UInt32 Version = packet.GetUint32R();
byte[] File = new byte[packet.Length - packet.Position];
packet.Read(File, 0, File.Length);
File = ZlibMgr.Decompress(File);
Log.Debug("ConfigSave", "Config saved : fileid=" + FileId + ", Version=" + Version + ",Size=" + File.Length);
Program.FileMgr.SaveInfo(cclient.Account.Id, FileId, File);
PacketOut Out = new PacketOut((UInt32)Opcodes.ANS_CONFIGFILE_SAVE);
Out.WriteUInt32R(0);
Out.WriteByte(FileId);
Out.Write(File, 0, File.Length);
cclient.SendTCP(Out);
}
示例5: CMSG_AuthSessionTokenReq
static public void CMSG_AuthSessionTokenReq(BaseClient client, PacketIn packet)
{
Client cclient = client as Client;
PacketOut Out = new PacketOut((byte)Opcodes.SMSG_AuthSessionTokenReply);
AuthSessionTokenReq.Builder authReq = AuthSessionTokenReq.CreateBuilder();
authReq.MergeFrom(packet.ToArray());
string session = Encoding.ASCII.GetString(authReq.SessionToken.ToByteArray());
// Log.Debug("AuthSession", "session " + session);
cclient.Username = ""; //username is not important anymore in 1.4.8
cclient.Token = session;
AuthSessionTokenReply.Builder authReply = AuthSessionTokenReply.CreateBuilder();
authReply.SetResultCode(AuthSessionTokenReply.Types.ResultCode.RES_SUCCESS);
Out.Write(authReply.Build().ToByteArray());
cclient.SendTCPCuted(Out);
/* //TODO: need auth check
if (Result != AuthResult.AUTH_SUCCESS)
cclient.Disconnect();
else
{
cclient.Username = Username;
cclient.Token = Token;
}*/
}
示例6: SendMeTo
public override void SendMeTo(Player Plr)
{
Log.Success("SendMeTo", "[" + Plr.Name + "] voit : " + Name);
PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_PLAYER);
Out.WriteUInt16((UInt16)_Client.Id);
Out.WriteUInt16(Oid);
Out.WriteUInt16(_Info.ModelId);
Out.WriteUInt16(_Info.CareerLine);
Out.WriteUInt16((UInt16)Z);
Out.WriteUInt16(Zone.ZoneId);
Out.WriteUInt16((UInt16)X);
Out.WriteUInt16((UInt16)Y);
Out.WriteUInt16(Heading);
Out.WriteByte(_Value.Level); // Level
Out.WriteByte(0); // Level
Out.WriteByte(0);
Out.WriteByte(Faction);
Out.WriteByte(0);
Out.WriteByte(Faction);
Out.Write(_Info.bTraits, 0, _Info.bTraits.Length);
Out.Fill(0, 12);
Out.WriteByte(_Info.Race);
Out.Fill(0, 11);
Out.WritePascalString(_Info.Name);
Out.WritePascalString("");
Out.WriteByte(0);
Out.Fill(0, 4);
Plr.SendPacket(Out);
base.SendMeTo(Plr);
}
示例7: SendCopy
public void SendCopy(PacketOut Out)
{
Out.WritePacketLength();
PacketOut packet = new PacketOut(0);
packet.Position = 0;
packet.Write(Out.ToArray(), 0, Out.ToArray().Length);
SendPacket(packet);
}
示例8: Update
public void Update()
{
Log.Debug("Group", "Updating Group");
if (Leader == null || Members.Count < 1 || (Members.Count == 1 && Leader == Members.First()))
{
Delete();
return;
}
PacketOut Out = new PacketOut((byte)Opcodes.F_CHARACTER_INFO);
Out.WriteUInt16(0x0602); // Group info
Out.WriteUInt16(0xB536); // Group id
Out.WriteByte((byte)Members.Count);
foreach (Player Plr in Members)
{
Out.WriteUInt32(0xA8BF3B0C);
Out.WriteByte((byte)Plr._Info.ModelId);
Out.WriteByte((byte)Plr._Info.Race);
Out.WriteByte((byte)Plr.Level);
Out.WriteUInt16((ushort)Plr._Info.CareerLine);
Out.WriteByte(1);
Out.WriteByte(0); // Will be 1 for at least one member. Perhaps Leader?
Out.WriteByte(0);
Out.WriteByte(1); // Online = 1, Offline = 0
Out.WriteByte((byte)Plr.Name.Length);
Out.Fill(0, 3);
Out.WriteStringBytes(Plr.Name);
Out.WriteByte(0); // Name length. Pet? Target?
Out.Fill(0, 3);
//Out.WriteStringBytes(Pet name? Target?);
Out.WriteByte(0x8B);
Out.WriteUInt16R((ushort)650); // X ?
Out.WriteByte(0xD3);
Out.WriteUInt16R((ushort)650); // y ?
byte[] data = { 0xC8, 0x50, 0x27, 0x25, 0x05, 0x40, 0x01, 0x02 };
Out.Write(data);
Out.WriteByte((byte)(Plr._Value.ZoneId*2));
Out.WriteByte(1);
Out.WriteByte(1);
Out.WriteByte((byte)Plr.PctHealth);
Out.WriteByte((byte)Plr.PctAp); // action points
Out.WriteByte(0);
}
SendToGroup(Out);
}
示例9: BuildCharactersList
public static byte[] BuildCharactersList(int AccountId)
{
Log.Debug("BuildCharactersList", "AcocuntId = " + AccountId);
Character[] Chars = GetAccountChar(AccountId)._Chars;
int count = 0;
PacketOut Out = new PacketOut(0);
Out.Position = 0;
Character Char = null;
for (int k = 0; k < MAX_SLOT; ++k)
{
Char = Chars[k];
if (Char != null)
{
List<Character_items> Items = CharMgr.GetItemChar(Char.CharacterId);
/**** char slot start ****/
Out.FillString(Char.Name, 48); // name
Out.WriteByte(Char.Value[0].Level); // Level
Out.WriteByte(Char.Career); //career
Out.WriteByte(Char.Realm); // realm
Out.WriteByte(Char.Sex); // gender
Out.WriteUInt16R(Char.ModelId); //model id
Out.WriteUInt16R(Char.Value[0].ZoneId); // zone id
Out.Fill(0, 12); // unk
Character_items Item = null;
for (UInt16 SlotId = 14; SlotId < 30; ++SlotId)
{
Item = Items.Find(item => item != null && item.SlotId == SlotId);
if (Item == null)
{
Out.WriteInt32(0);
Out.WriteInt32(0);
}
else
{
Out.WriteInt32((int)Item.ModelId);
Out.WriteUInt16R(0); // primary dye
Out.WriteUInt16R(0); // secondary dye
}
}
Out.WriteUInt32(0x00); // 0x00000000
for (int i = 0; i < 4; i++)
{
Out.WriteUInt32(0xFF000000);
Out.WriteUInt32(0x00);
}
Out.WriteUInt32(0xFF000000);
//weapons
for (UInt16 SlotId = 10; SlotId < 13; ++SlotId)
{
Item = Items.Find(item => item != null && item.SlotId == SlotId);
if (Item == null)
Out.WriteUInt32(0);
else
{
Out.WriteUInt16R((ushort)Item.ModelId);
Out.WriteUInt16(0);
}
}
Out.Fill(0, 8);
Out.WriteUInt16(0xFF00);
Out.WriteByte(0);
Out.WriteByte(Char.Race); // char slot position
Out.WriteUInt16(0x00); //unk
/* //Traits [8 bytes]
Out.WriteByte(1); //face
Out.WriteByte(4); //jewel
Out.WriteByte(4); //scar
Out.WriteByte(0); //hair
Out.WriteByte(3); //hair color
Out.WriteByte(2); //skin color
Out.WriteByte(0); //eye color
Out.WriteByte(5); //metal color
*/
Out.Write(Char.bTraits, 0, Char.bTraits.Length);
Out.Fill(0, 14); //unk
count++;
}
}
for (int i = 0; i < (MAX_SLOT - count); ++i)
Out.Write(new byte[284], 0, 284);
return Out.ToArray();
}
示例10: CMSG_GetCharSummaryListReq
static public void CMSG_GetCharSummaryListReq(BaseClient client, PacketIn packet)
{
Client cclient = client as Client;
PacketOut Out = new PacketOut((byte)Opcodes.SMSG_GetCharSummaryListReply);
Out.Write(new byte[2] { 0x08, 00 });
cclient.SendTCPCuted(Out);
}
示例11: F_REQUEST_CHAR
static public void F_REQUEST_CHAR(BaseClient client, PacketIn packet)
{
GameClient cclient = client as GameClient;
cclient.State = (int)eClientState.CharScreen;
UInt16 Operation = packet.GetUint16();
if (Operation == 0x2D58)
{
PacketOut Out = new PacketOut((byte)Opcodes.F_REQUEST_CHAR_ERROR);
Out.WriteByte((byte)CharMgr.GetAccountRealm(cclient._Account.AccountId));
cclient.SendPacket(Out);
}
else
{
PacketOut Out = new PacketOut((byte)Opcodes.F_REQUEST_CHAR_RESPONSE);
Out.FillString(cclient._Account.Username, 21);
Out.WriteByte(0);
Out.WriteByte(0);
Out.WriteByte(0);
Out.WriteByte(4);
if (cclient._Account.GmLevel == 0 && !Program.Config.CreateBothRealms)
Out.WriteByte((byte)CharMgr.GetAccountRealm(cclient._Account.AccountId));
else
Out.WriteByte(0);
byte[] Chars = CharMgr.BuildCharacters(cclient._Account.AccountId);
Out.Write(Chars, 0, Chars.Length);
Out.WritePacketLength();
cclient.SendPacket(Out);
}
}
示例12: SendMeTo
public override void SendMeTo(Player Plr)
{
//Log.Success("Creature", "SendMe " + Name);
PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_MONSTER);
Out.WriteUInt16(Oid);
Out.WriteUInt16(0);
Out.WriteUInt16((UInt16)Heading);
Out.WriteUInt16((UInt16)WorldPosition.Z);
Out.WriteUInt32((UInt32)WorldPosition.X);
Out.WriteUInt32((UInt32)WorldPosition.Y);
Out.WriteUInt16(0); // Speed Z
// 18
Out.WriteUInt16(Spawn.Proto.Model1);
Out.WriteByte((byte)Spawn.Proto.MinScale);
Out.WriteByte(Level);
Out.WriteByte(Faction);
Out.Fill(0, 4);
Out.WriteByte(Spawn.Emote);
Out.WriteByte(0); // ?
Out.WriteUInt16(Spawn.Proto._Unks[1]);
Out.WriteByte(0);
Out.WriteUInt16(Spawn.Proto._Unks[2]);
Out.WriteUInt16(Spawn.Proto._Unks[3]);
Out.WriteUInt16(Spawn.Proto._Unks[4]);
Out.WriteUInt16(Spawn.Proto._Unks[5]);
Out.WriteUInt16(Spawn.Proto._Unks[6]);
Out.WriteUInt16(Spawn.Title);
long TempPos = Out.Position;
byte TempLen = (byte)(Spawn.bBytes.Length + States.Count);
Out.WriteByte(TempLen);
Out.Write(Spawn.bBytes, 0, Spawn.bBytes.Length);
Out.Write(States.ToArray(), 0, States.Count);
if (QtsInterface.CreatureHasStartQuest(Plr))
{
Out.WriteByte(5);
Out.Position = TempPos;
Out.WriteByte((byte)(TempLen + 1));
}
else if (QtsInterface.CreatureHasQuestToAchieve(Plr))
{
Out.WriteByte(4);
Out.Position = TempPos;
Out.WriteByte((byte)(TempLen + 1));
}
else if (QtsInterface.CreatureHasQuestToComplete(Plr))
{
Out.WriteByte(7);
Out.Position = TempPos;
Out.WriteByte((byte)(TempLen + 1));
}
Out.Position = Out.Length;
Out.WriteByte(0);
Out.WriteStringBytes(Name);
Out.Fill(0, 48);
Plr.SendPacket(Out);
base.SendMeTo(Plr);
}
示例13: SendBuffer
private void SendBuffer(Player Plr,ref PacketOut Buffer,ref byte Count)
{
// On Envoi le Packet des items
byte[] ArrayBuf = Buffer.ToArray();
PacketOut Packet = new PacketOut((byte)Opcodes.F_GET_ITEM);
Packet.WriteByte(Count);
Packet.Fill(0, 3);
Packet.Write(ArrayBuf, 0, ArrayBuf.Length);
Packet.WritePacketLength();
Plr.SendPacket(Packet);
// On Remet le compteur a zero
Count = 0;
// On Initalise un nouveau buffer
Buffer = new PacketOut(0);
Buffer.Position = 0;
}
示例14: SendMeTo
public override void SendMeTo(Player Plr)
{
List<byte> TmpState = new List<byte>();
if (QtsInterface.CreatureHasStartQuest(Plr))
TmpState.Add(5);
else if (QtsInterface.CreatureHasQuestToComplete(Plr))
TmpState.Add(7);
PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_MONSTER);
Out.WriteUInt16(Oid);
Out.WriteUInt16(0);
Out.WriteUInt16((UInt16)Heading);
Out.WriteUInt16((UInt16)WorldPosition.Z);
Out.WriteUInt32((UInt32)WorldPosition.X);
Out.WriteUInt32((UInt32)WorldPosition.Y);
Out.WriteUInt16(0); // Speed Z
// 18
Out.WriteUInt16(Spawn.Proto.Model1);
Out.WriteByte((byte)Spawn.Proto.MinScale);
Out.WriteByte(Spawn.Proto.MinLevel);
Out.WriteByte(Faction);
Out.Fill(0, 4);
Out.WriteByte(Spawn.Emote);
Out.WriteByte(0); // ?
Out.WriteUInt16(Spawn.Proto._Unks[1]);
Out.WriteByte(0);
Out.WriteUInt16(Spawn.Proto._Unks[2]);
Out.WriteUInt16(Spawn.Proto._Unks[3]);
Out.WriteUInt16(Spawn.Proto._Unks[4]);
Out.WriteUInt16(Spawn.Proto._Unks[5]);
Out.WriteUInt16(Spawn.Proto._Unks[6]);
Out.WriteUInt16(Spawn.Title);
Out.WriteByte((byte)(Spawn.bBytes.Length + States.Count + TmpState.Count));
Out.Write(Spawn.bBytes, 0, Spawn.bBytes.Length);
Out.Write(States.ToArray(), 0, States.Count);
Out.Write(TmpState.ToArray(), 0, TmpState.Count);
Out.WriteByte(0);
Out.WriteStringBytes(Name);
Out.WriteByte(0); // ?
Out.WriteByte(1); // ?
Out.WriteByte(10); // ?
Out.WriteByte(0); // ?
Out.WriteUInt16(0); // ?
Out.WriteByte(Spawn.Icone);
Out.WriteByte((byte)Spawn.Proto._Unks[0]);
Out.WriteByte(0);
Out.Fill(0, 8); // Flags;
Out.WriteByte(100); // Health %
Out.WriteUInt16(Zone.ZoneId);
Out.Fill(0, 48);
Plr.SendPacket(Out);
base.SendMeTo(Plr);
}
示例15: SendMaxInventory
// 1.3.5
public void SendMaxInventory(Player Plr)
{
PacketOut Out = new PacketOut((byte)Opcodes.F_BAG_INFO);
Out.WriteByte(0x0F);
Out.WriteByte(GetTotalSlot()); // Nombre de slots disponibles
Out.WriteUInt16((UInt16)INVENTORY_SLOT_COUNT);
Out.WriteByte(0);
Out.WriteUInt16R(GetBagPrice());
byte[] Data = new byte[]
{
0x00,0x00,
0x50,0x00,0x08,
0x00,0x60,
0xEA,
0x00,0x00
};
Out.Write(Data, 0, Data.Length);
Plr.SendPacket(Out);
}