本文整理汇总了C#中FrameWork.PacketIn.Read方法的典型用法代码示例。如果您正苦于以下问题:C# PacketIn.Read方法的具体用法?C# PacketIn.Read怎么用?C# PacketIn.Read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FrameWork.PacketIn
的用法示例。
在下文中一共展示了PacketIn.Read方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandlePacket
public static void HandlePacket(BaseClient client, PacketIn packet)
{
LobbyClient cclient = client as LobbyClient;
byte freeslot = Program.CharMgr.GetFreeSlot(cclient.Account.Id);
if (freeslot == 0 || cclient.CreateChar == null)
ANS_CHARACTER_CREATE.Send(cclient);
else
{
cclient.CreateChar.SlotId = freeslot;
cclient.CreateChar.Faction = packet.GetUint8();
cclient.CreateChar.Gender = packet.GetUint8();
cclient.CreateChar.Version = (int)packet.GetUint32R();
cclient.CreateChar.Seconds = (int)packet.GetUint32R();
byte[] Custom = new byte[packet.Length - packet.Position];
packet.Read(Custom, 0, Custom.Length);
cclient.CreateChar.Custom = BitConverter.ToString(Custom);
Program.CharMgr.CreateCharacter(cclient.CreateChar);
ANS_CHARACTER_CREATE.Send(cclient);
}
}
示例2: 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);
}
示例3: CL_START
static public void CL_START(BaseClient client, PacketIn packet)
{
Client cclient = client as Client;
string Username = packet.GetString();
UInt32 Len = packet.GetUint32();
byte[] Password = packet.Read((int)Len);
bool result = Program.AcctMgr.CheckAccount(Username, Password);
Log.Debug("CL_START", "Lancement du client : " + Username + " " + result);
PacketOut Out = new PacketOut((byte)Opcodes.LCR_START);
if (result == true)
{
Out.WriteByte(0);
Out.WriteString(Program.AcctMgr.GenerateToken(Username));
}
else
Out.WriteByte(1);
cclient.SendPacket(Out);
}
示例4: F_CREATE_CHARACTER
static public void F_CREATE_CHARACTER(BaseClient client, PacketIn packet)
{
GameClient cclient = client as GameClient;
CreateInfo Info;
Info.slot = packet.GetUint8();
Info.race = packet.GetUint8();
Info.career = packet.GetUint8();
Info.sex = packet.GetUint8();
Info.model = packet.GetUint8();
Info.NameSize = packet.GetUint16();
packet.Skip(2);
byte[] Traits = new byte[8];
packet.Read(Traits, 0, Traits.Length);
packet.Skip(7);
string Name = packet.GetString(Info.NameSize);
if (Name.Length > 2 && !CharMgr.NameIsUsed(Name))
{
CharacterInfo CharInfo = CharMgr.GetCharacterInfo(Info.career);
if (CharInfo == null)
{
Log.Error("ON_CREATE", "Can not find career :" + Info.career);
}
else
{
Log.Success("OnCreate", "New Character : " + Name);
Character Char = new Character();
Char.AccountId = cclient._Account.AccountId;
Char.bTraits = Traits;
Char.Career = Info.career;
Char.CareerLine = CharInfo.CareerLine;
Char.ModelId = Info.model;
Char.Name = Name;
Char.Race = Info.race;
Char.Realm = CharInfo.Realm;
Char.RealmId = Program.Rm.RealmId;
Char.Sex = Info.sex;
Char.FirstConnect = true;
if (!CharMgr.CreateChar(Char))
{
Log.Error("CreateCharacter", "Hack : can not create more than 10 characters!");
}
else
{
Character_item Citm = null;
List < CharacterInfo_item > Items = CharMgr.GetCharacterInfoItem(Char.CareerLine);
foreach (CharacterInfo_item Itm in Items)
{
if (Itm == null)
continue;
Citm = new Character_item();
Citm.Counts = Itm.Count;
Citm.CharacterId = Char.CharacterId;
Citm.Entry = Itm.Entry;
Citm.ModelId = Itm.ModelId;
Citm.SlotId = Itm.SlotId;
CharMgr.CreateItem(Citm);
}
Character_value CInfo = new Character_value();
CInfo.CharacterId = Char.CharacterId;
CInfo.Level = 1;
CInfo.Money = 0;
CInfo.Online = false;
CInfo.RallyPoint = CharInfo.RallyPt;
CInfo.RegionId = CharInfo.Region;
CInfo.Renown = 0;
CInfo.RenownRank = 1;
CInfo.RestXp = 0;
CInfo.Skills = CharInfo.Skills;
CInfo.Speed = 100;
CInfo.WorldO = CharInfo.WorldO;
CInfo.WorldX = CharInfo.WorldX;
CInfo.WorldY = CharInfo.WorldY;
CInfo.WorldZ = CharInfo.WorldZ;
CInfo.Xp = 0;
CInfo.ZoneId = CharInfo.ZoneId;
CharMgr.Database.AddObject(CInfo);
Program.AcctMgr.UpdateRealmCharacters(Program.Rm.RealmId, (uint)CharMgr.Database.GetObjectCount<Character>(" Realm=1"), (uint)CharMgr.Database.GetObjectCount<Character>(" Realm=2"));
Char.Value = CInfo;
PacketOut Out = new PacketOut((byte)Opcodes.F_SEND_CHARACTER_RESPONSE);
Out.WritePascalString(cclient._Account.Username);
cclient.SendPacket(Out);
}
}
}
else
{
//.........这里部分代码省略.........
示例5: F_ENCRYPTKEY
static public void F_ENCRYPTKEY(BaseClient client, PacketIn packet)
{
GameClient cclient = client as GameClient;
sEncrypt Result = BaseClient.ByteToType<sEncrypt>(packet);
string Version = Result.major + "." + Result.minor + "." + Result.revision;
Log.Debug("F_ENCRYPTKEY", "Version = " + Version);
if (Result.cipher == 0)
{
PacketOut Out = new PacketOut((byte)Opcodes.F_RECEIVE_ENCRYPTKEY);
Out.WriteByte(1);
cclient.SendPacket(Out);
}
else if (Result.cipher == 1)
{
byte[] EncryptKey = new byte[256];
packet.Read(EncryptKey, 0, EncryptKey.Length);
cclient.AddCrypt("RC4Crypto", new CryptKey(EncryptKey), new CryptKey(EncryptKey));
}
}
示例6: F_CREATE_CHARACTER
public static void F_CREATE_CHARACTER(BaseClient client, PacketIn packet)
{
GameClient cclient = client as GameClient;
CreateInfo Info;
Info.slot = packet.GetUint8();
Info.race = packet.GetUint8();
Info.career = packet.GetUint8();
Info.sex = packet.GetUint8();
Info.model = packet.GetUint8();
Info.NameSize = packet.GetUint16();
packet.Skip(2);
byte[] Traits = new byte[8];
packet.Read(Traits, 0, Traits.Length);
packet.Skip(7);
string Name = packet.GetString(Info.NameSize);
if (!CharMgr.NameIsUsed(Name))
{
CharacterInfo CharInfo = CharMgr.GetCharacterInfo(Info.career);
if (CharInfo == null)
{
Log.Error("ON_CREATE", "Can not find career :" + Info.career);
return;
}
Log.Success("OnCreate", "Creating new Character : " + Name);
Character Char = new Character();
Char.AccountId = cclient._Account.AccountId;
Char.bTraits = Traits;
Char.Career = Info.career;
Char.CareerLine = CharInfo.CareerLine;
Char.ModelId = Info.model;
Char.Name = Name;
Char.Race = Info.race;
Char.Realm = CharInfo.Realm;
Char.RealmId = Program.Rm.RealmId;
Char.Sex = Info.sex;
if (!CharMgr.CreateChar(Char))
{
Log.Error("CreateCharacter", "Hack : can not create more than 10 characters!");
return;
}
Character_items Citm = null;
CharacterInfo_item[] Items = CharMgr.GetCharacterInfoItem(Char.CareerLine);
for (int i = 0; i < Items.Length; ++i)
{
if (Items[i] == null)
continue;
Citm = new Character_items();
Citm.Counts = Items[i].Count;
Citm.CharacterId = Char.CharacterId;
Citm.Entry = Items[i].Entry;
Citm.ModelId = Items[i].ModelId;
Citm.SlotId = Items[i].SlotId;
CharMgr.CreateItem(Citm);
}
Character_value CInfo = new Character_value();
CInfo.CharacterId = Char.CharacterId;
CInfo.Level = 1;
CInfo.Money = 0;
CInfo.Online = false;
CInfo.RallyPoint = CharInfo.RallyPt;
CInfo.RegionId = CharInfo.Region;
CInfo.Renown = 0;
CInfo.RenownRank = 1;
CInfo.RestXp = 0;
CInfo.Skills = CharInfo.Skills;
CInfo.Speed = 100;
CInfo.WorldO = CharInfo.WorldO;
CInfo.WorldX = CharInfo.WorldX;
CInfo.WorldY = CharInfo.WorldY;
CInfo.WorldZ = CharInfo.WorldZ;
CInfo.Xp = 0;
CInfo.ZoneId = CharInfo.ZoneId;
CharMgr.Database.AddObject(CInfo);
Char.Value = new Character_value[1] { CInfo };
}
PacketOut Out = new PacketOut((byte)Opcodes.F_SEND_CHARACTER_RESPONSE);
Out.WritePascalString(cclient._Account.Username);
cclient.SendTCP(Out);
}