本文整理汇总了C#中Packet.WriteUtf8StringOn方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.WriteUtf8StringOn方法的具体用法?C# Packet.WriteUtf8StringOn怎么用?C# Packet.WriteUtf8StringOn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Packet
的用法示例。
在下文中一共展示了Packet.WriteUtf8StringOn方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConstructBroadcastPacket
private static Packet ConstructBroadcastPacket(ChatType type, Boolean isGm, String sender, Int64 sendercoid, String msg)
{
var msglen = (Int16) msg.Length;
var p = new Packet(Opcode.Broadcast);
p.WriteInteger((UInt32) type);
p.WriteLong(sendercoid);
p.WriteBoolean(isGm);
p.WritePadding(1).WriteShort(msglen);
p.WriteUtf8StringOn(sender, 17);
p.WriteUtf8StringOn(msg, msglen);
p.WriteByte(0);
return p;
}
示例2: RequestInfo
public static void RequestInfo(TNLConnection conn)
{
var resp = new Packet(Opcode.RequestClanInfoResponse); // todo: No response, if the character has no clan?
resp.WriteInteger(-1); // Clan Id
resp.WriteUtf8StringOn("", 51); // Clan Name
resp.WriteUtf8StringOn("", 251); // Clan Motd
resp.WriteUtf8StringOn("", 51); // Rank One
resp.WriteUtf8StringOn("", 51); // Rank Two
resp.WriteUtf8StringOn("", 51); // Rank Three
resp.WritePadding(1);
resp.WriteInteger(-1); // Monthly Dues
resp.WriteInteger(-1); // Monthly Upkeep
resp.WriteLong(-1L); // Clan Owner
resp.WriteInteger(0); // Num members
resp.WritePadding(4);
for (var i = 0; i < 0; ++i)
{
resp.WriteLong(-1L); // Member Coid
resp.WriteUtf8StringOn("", 17); // Character Name
resp.WritePadding(3);
resp.WriteInteger(0); // Continent Id
resp.WriteInteger(0); // Xp
resp.WriteInteger(0); // Clan Rank
resp.WriteLong(0); // Last Paid Dues
resp.WriteInteger(-1); // Cbid
resp.WriteBoolean(false); // Online
resp.WritePadding(3);
resp.WriteLong(0); // Last Online
resp.WriteLong(0); // Join Date
}
conn.SendPacket(resp, RPCGuaranteeType.RPCGuaranteedOrdered);
}
示例3: GetEnemies
public static void GetEnemies(TNLConnection session)
{
//return;
var coid = session.CurrentCharacter.GetCOID();
CheckCache(coid);
var packet = new Packet(Opcode.GetEnemiesResponse);
var t = Cache[coid];
var enemyEntries = t.Item2.Where(e => e.Type == SocialType.Enemy).ToList();
var count = enemyEntries.Count;
packet.WriteInteger(count >= 20 ? 20 : count);
var j = 0;
foreach (var se in enemyEntries)
{
if (!(se is EnemyEntry)) // should never happen
continue;
packet.WriteLong(se.Character);
packet.WriteLong(se.OtherCharacter);
packet.WriteInteger(se.Level);
packet.WriteInteger(se.LastContinentId);
packet.WriteInteger((se as EnemyEntry).TimesKilled);
packet.WriteInteger((se as EnemyEntry).TimesKilledBy);
packet.WriteByte((se as EnemyEntry).Race);
packet.WriteByte(se.Class);
packet.WriteBoolean(se.Online);
packet.WriteUtf8StringOn(se.Name, 17);
packet.WritePadding(4);
if (++j == 20)
break;
}
for (var i = 0; i < 20 - j; ++i)
packet.WritePadding(56);
session.SendPacket(packet, RPCGuaranteeType.RPCGuaranteedOrdered);
}
示例4: WriteToCreatePacket
public override void WriteToCreatePacket(Packet packet, Boolean extended = false)
{
base.WriteToCreatePacket(packet, extended);
#region Create Armor
ArmorSpecific.WriteToPacket(packet);
packet.WriteSingle(CloneBaseObject.SimpleObjectSpecific.Mass);
packet.WriteUtf8StringOn(MangledName, 100);
packet.WriteShort(_varianceDefenseBonus);
packet.WritePadding(2);
#endregion Create Armor
}
示例5: WriteToCreatePacket
public override void WriteToCreatePacket(Packet packet, Boolean extended = false)
{
base.WriteToCreatePacket(packet, extended);
#region Create Wheel Set
packet.WriteSingle(_frictionGravel); // friction gravel
packet.WriteSingle(_frictionIce); // friction ice
packet.WriteSingle(_frictionMud); // friction mud
packet.WriteSingle(_frictionPaved); // friction paved
packet.WriteSingle(_frictionPlains); // friction plains
packet.WriteSingle(_frictionSand); // friction sand
packet.WriteBoolean(_isDefault); // is default
packet.WriteUtf8StringOn(MangledName, 100); // name
packet.WritePadding(3);
#endregion Create Wheel Set
}
示例6: GetFriends
public static void GetFriends(TNLConnection session)
{
//return;
var coid = session.CurrentCharacter.GetCOID();
CheckCache(coid);
var packet = new Packet(Opcode.GetFriendsResponse);
var t = Cache[coid];
var friendEntries = t.Item2.Where(e => e.Type == SocialType.Friend).ToList();
var count = friendEntries.Count;
packet.WriteInteger(count >= 20 ? 20 : count);
var j = 0;
foreach (var se in friendEntries)
{
packet.WriteLong(se.Character);
packet.WriteLong(se.OtherCharacter);
packet.WriteInteger(se.Level);
packet.WriteInteger(se.LastContinentId);
packet.WriteByte(se.Class);
packet.WriteBoolean(se.Online);
packet.WriteUtf8StringOn(se.Name, 17);
packet.WritePadding(5);
if (++j == 20)
break;
}
for (var i = 0; i < 20 - j; ++i)
packet.WritePadding(48);
session.SendPacket(packet, RPCGuaranteeType.RPCGuaranteedOrdered);
}
示例7: GetIgnored
public static void GetIgnored(TNLConnection session)
{
//return;
var coid = session.CurrentCharacter.GetCOID();
CheckCache(coid);
var packet = new Packet(Opcode.GetIgnoredResponse);
var t = Cache[coid];
var ignoredEntries = t.Item2.Where(e => e.Type == SocialType.Ignore).ToList();
var count = ignoredEntries.Count;
packet.WriteInteger(count >= 20 ? 20 : count);
var j = 0;
foreach (var se in ignoredEntries)
{
packet.WriteLong(se.OtherCharacter);
if (++j == 20)
break;
}
for (var i = 0; i < 20 - j; ++i)
packet.WritePadding(8);
packet.WriteUtf8StringOn("", 17);
packet.WritePadding(7);
session.SendPacket(packet, RPCGuaranteeType.RPCGuaranteedOrdered);
}
示例8: ConstructChatPacket
private static Packet ConstructChatPacket(ChatType type, Boolean isGm, String recipient, String sender, String msg)
{
var msglen = (Int16) msg.Length;
var p = new Packet(Opcode.Chat);
p.WriteInteger((UInt32) type);
p.WriteBoolean(isGm);
p.WriteUtf8StringOn(recipient, 17);
p.WriteUtf8StringOn(sender, 17);
p.WritePadding(1).WriteShort(msglen);
p.WriteUtf8StringOn(msg, msglen);
p.WriteByte(0);
return p;
}
示例9: WriteToCreatePacket
public override void WriteToCreatePacket(Packet packet, Boolean extended = false)
{
base.WriteToCreatePacket(packet, extended);
#region Create Weapon
packet.WriteSingle(_varianceRange);
packet.WriteSingle(_varianceRefireRate);
packet.WriteSingle(_varianceDamageMinimum);
packet.WriteSingle(_varianceDamageMaximum);
packet.WriteShort(_varianceOffensiveBonus);
packet.WritePadding(2);
packet.WriteSingle(_prefixAccurayBonus);
packet.WriteShort(_prefixPenetrationBonus);
packet.WritePadding(2);
packet.WriteInteger(_rechargeInterval);
packet.WriteSingle(CloneBaseObject.SimpleObjectSpecific.Mass);
packet.WriteSingle(_rangeMinimum);
packet.WriteSingle(_rangeMaximum);
packet.WriteSingle(_validArc);
_dmgMinimum.WriteToPacket(packet);
_dmgMaximum.WriteToPacket(packet);
packet.WriteUtf8StringOn("", 100);
packet.WritePadding(4);
#endregion Create Weapon
}
示例10: WritePacket
public void WritePacket(Packet packet)
{
//packet.WritePadding(4);
// SVOG header begin -->
packet.WriteInteger(0); // Region Id
packet.WriteInteger(0); // Region Type
packet.WriteByte(1); // Region Level
packet.WritePadding(3);
packet.WriteInteger(0); // Layer Id
packet.WriteInteger(_continentObject.Objective); // Objective Index
packet.WriteUtf8StringOn(String.Format("{0}.fam", _continentObject.MapFileName), 65); // Map Name
packet.WriteBoolean(_continentObject.IsTown); // Is Town
packet.WriteBoolean(_continentObject.IsArena); // Is Arena
packet.WritePadding(1);
packet.WriteInteger(_continentObject.OwningFaction); // Race Faction
packet.WriteInteger(ContinentId); // Continent Object ID
packet.WriteBoolean(_continentObject.IsPersistent); // Is Persistent
packet.WritePadding(3);
packet.WriteInteger(MapEntry.IterationVersion); // Map Iteration Version
packet.WriteInteger(_continentObject.ContestedMission); // Contested Mission Id
packet.WritePadding(4);
packet.WriteLong(ContinentId); // COID Map
// SVOG header end <--
packet.WriteInteger(123456789); // Temporal Random Seed
packet.WriteLong(ContinentId); // COID Map
packet.WriteShort(0); // Number of Module Selections
// for NumberOfModuleSelections { 24 byte }
// CND Unaligned Vector 3 begin -->
packet.WriteSingle(0.0f);
packet.WriteSingle(0.0f);
packet.WriteSingle(0.0f);
// CND Unaligned Vector 3 end <--
packet.WriteShort(0);
/*packet.WriteShort(36); // Weather Count
// Weather Update begin -->
packet.WriteInteger(0x2069);
packet.WriteLong(0);
packet.WriteLong(0);
packet.WriteLong(0);
packet.WriteLong(0);*/
// Weather Update end <--
}
示例11: WriteToCreatePacket
//.........这里部分代码省略.........
if (_wheelSet != null) // Wheel set
_wheelSet.WriteToCreatePacket(packet);
else
Debug.Assert(false, "WHEELSETNEK KELL LENNIE!");
#endregion
#region Armor
packet.WriteOpcode(Opcode.CreateArmor);
if (_armor != null) // Armor
_armor.WriteToCreatePacket(packet);
else
Armor.WriteEmptyObjectToPacket(packet);
#endregion
#region Melee Weapon
packet.WriteOpcode(Opcode.CreateWeapon);
if (_meleeWeapon != null) // Weapon Melee
_meleeWeapon.WriteToCreatePacket(packet);
else
Weapon.WriteEmptyObjectToPacket(packet);
#endregion
#region Front Weapon
packet.WriteOpcode(Opcode.CreateWeapon);
if (_weapons[0] != null) // Weapon Front
_weapons[0].WriteToCreatePacket(packet);
else
Weapon.WriteEmptyObjectToPacket(packet);
#endregion
#region Turret Weapon
packet.WriteOpcode(Opcode.CreateWeapon);
if (_weapons[1] != null) // Weapon Turret
_weapons[1].WriteToCreatePacket(packet);
else
Weapon.WriteEmptyObjectToPacket(packet);
#endregion
#region Rear Weapon
packet.WriteOpcode(Opcode.CreateWeapon);
if (_weapons[2] != null) // Weapon Rear
_weapons[2].WriteToCreatePacket(packet);
else
Weapon.WriteEmptyObjectToPacket(packet);
#endregion
packet.WriteInteger(CurrentPathId); // current path id
packet.WriteInteger(ExtraPathId); // extra path id
packet.WriteSingle(PatrolDistance); // patrol distance
packet.WriteBoolean(PathReversing); // path reversing
packet.WriteBoolean(PathIsRoad); // path is road
packet.WritePadding(2);
packet.WriteInteger(VehicleTemplateId);
packet.WritePadding(4);
packet.WriteLong(GetTFIDMurderer().Coid);
if (_weapons[0] != null)
packet.WriteInteger(_weapons[0].GetCBID());
else
packet.WriteInteger(-1); // front weapon cbid
if (_weapons[1] != null)
packet.WriteInteger(_weapons[1].GetCBID());
else
packet.WriteInteger(-1); // turret weapon cbid
if (_weapons[2] != null)
packet.WriteInteger(_weapons[2].GetCBID());
else
packet.WriteInteger(-1); // rear weapon cbid
packet.WriteUtf8StringOn(VehicleName, 33);
packet.WritePadding(3);
#endregion Create Vehicle
if (!extended)
return;
#region Create Vehicle Extended
packet.WriteShort(0); // num inventory slots
packet.WriteShort(0); // inventory size
packet.WritePadding(4);
for (var i = 0; i < 512; ++i)
packet.WriteLong(0);
#endregion Create Vehicle Extended
}
示例12: WriteToCreatePacket
public override void WriteToCreatePacket(Packet packet, Boolean extended = false)
{
packet.WriteInteger(CBID);
packet.WriteLong(-1L); // coid Store
packet.WriteInteger(GetCurrentHP() + 100);
packet.WriteInteger(GetMaximumHP() + 100);
packet.WriteInteger(GetValue());
packet.WriteInteger(GetIDFaction());
packet.WriteInteger(TeamFaction);
packet.WriteInteger(CustomValue);
for (var i = 0; i < 5; ++i) // prefix id
packet.WriteInteger(-1);
for (var i = 0; i < 5; ++i) // gadget id
packet.WriteInteger(-1);
for (var i = 0; i < 5; ++i) // prefix level
packet.WriteShort(0);
for (var i = 0; i < 5; ++i) // gadget level
packet.WriteShort(0);
packet.WriteSingle(Position.X);
packet.WriteSingle(Position.Y);
packet.WriteSingle(Position.Z);
packet.WriteSingle(Rotation.X);
packet.WriteSingle(Rotation.Y);
packet.WriteSingle(Rotation.Z);
packet.WriteSingle(Rotation.W);
packet.WriteSingle(Scale);
packet.WriteInteger(GetQuantity());
packet.WriteByte(InventoryPositionX);
packet.WriteByte(InventoryPositionY);
packet.WriteBoolean(GetIsCorpse()); // is corpse
packet.WritePadding(5);
packet.WriteTFID(COID);
packet.WriteBoolean(false); // will equip
packet.WriteBoolean(false); // is item link
packet.WriteBoolean(false); // is in inventory
packet.WriteByte(SkillLevel1);
packet.WriteByte(SkillLevel2);
packet.WriteByte(SkillLevel3);
packet.WriteBoolean(false); // is identified
packet.WriteBoolean(false); // possible mission item
packet.WriteBoolean(false); // tempitem
packet.WriteBoolean((UnkFlags & UnkFlags.IsKit) != 0);
packet.WriteBoolean(false); // isinfinite
packet.WriteBoolean((UnkFlags & UnkFlags.IsBound) != 0);
packet.WriteShort(UsesLeft);
packet.WriteUtf8StringOn(CustomizedName, 17);
packet.WriteBoolean(MadeFromMemory);
packet.WriteBoolean(false); // is mail
packet.WritePadding(1);
packet.WriteShort((Int16)MaxGadgets);
packet.WriteShort((Int16)RequiredLevel);
packet.WriteShort((Int16)RequiredCombat);
packet.WriteShort((Int16)RequiredPerception);
packet.WriteShort((Int16)RequiredTech);
packet.WriteShort((Int16)RequiredTheory);
packet.WritePadding(2);
packet.WriteInteger(ItemTemplateId);
packet.WritePadding(4);
}