本文整理汇总了C#中Solar.FiestaLib.Networking.Packet.WriteShort方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.WriteShort方法的具体用法?C# Packet.WriteShort怎么用?C# Packet.WriteShort使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Solar.FiestaLib.Networking.Packet
的用法示例。
在下文中一共展示了Packet.WriteShort方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendError
public static void SendError(WorldClient client, ServerError error)
{
using (Packet pack = new Packet(SH3Type.Error))
{
pack.WriteShort((byte)error);
client.SendPacket(pack);
}
}
示例2: WriteEquipStats
public void WriteEquipStats(Packet packet)
{
byte StatCount = 0;
if (Str > 0) StatCount++;
if (End > 0) StatCount++;
if (Dex > 0) StatCount++;
if (Spr > 0) StatCount++;
if (Int > 0) StatCount++;
packet.WriteUShort(ItemID);
switch (this.SlotType)
{
case ItemSlot.Helm:
case ItemSlot.Armor:
case ItemSlot.Pants:
case ItemSlot.Boots:
// case ItemSlot.Bow: // Shield = same
case ItemSlot.Weapon2:
case ItemSlot.Weapon:
packet.WriteByte(this.Upgrades); // Refinement
packet.WriteByte(0);
packet.WriteShort(0); // Or int?
packet.WriteShort(0);
if (this.SlotType == ItemSlot.Weapon || (this.SlotType == ItemSlot.Weapon2 && Info.TwoHand))
{
packet.WriteByte(0);
// Licence data
packet.WriteUShort(0xFFFF); // Nr.1 - Mob ID
packet.WriteUInt(0); // Nr.1 - Kill count
packet.WriteUShort(0xFFFF); // Nr.2 - Mob ID
packet.WriteUInt(0); // Nr.2 - Kill count
packet.WriteUShort(0xFFFF); // Nr.3 - Mob ID
packet.WriteUInt(0); // Nr.3 - Kill count
packet.WriteUShort(0xFFFF); // UNK
packet.WriteString("", 16); // First licence adder name
}
packet.WriteByte(0);
packet.WriteUInt(GetExpiringTime()); // Expiring time (1992027391 - never expires)
//packet.WriteShort(0);
break;
case ItemSlot.Pet:
packet.WriteByte(this.Upgrades); // Pet Refinement Lol
packet.Fill(2, 0); // UNK
packet.WriteUInt(GetExpiringTime()); // Expiring time (1992027391 - never expires)
packet.WriteUInt(0); // Time? (1992027391 - never expires)
break;
case ItemSlot.Earings:
case ItemSlot.Necklace:
case ItemSlot.Ring:
packet.WriteUInt(GetExpiringTime()); // Expiring time (1992027391 - never expires)
packet.WriteUInt(0); // Time? (1992027391 - never expires)
packet.WriteByte(this.Upgrades); // Refinement
// Stats added while refining
packet.WriteUShort(0); // it may be byte + byte too (some kind of counter when item downgrades)
packet.WriteUShort(0); // STR
packet.WriteUShort(0); // END
packet.WriteUShort(0); // DEX
packet.WriteUShort(0); // INT
packet.WriteUShort(0); // SPR
break;
case ItemSlot.CostumeWeapon:
case ItemSlot.CostumeShield:
packet.WriteUInt(25000); // Skin Durability
break;
default:
packet.WriteUInt(GetExpiringTime()); // Expiring time (1992027391 - never expires)
packet.WriteUInt(0); // Time? (1992027391 - never expires)
break;
}
// Random stats data (Not those what were added in refinement)
switch (this.SlotType)
{ // Stat count (StatCount << 1 | Visible(0 or 1 are stats shown or not))
case ItemSlot.Earings:
packet.WriteByte((byte)(StatCount << 1 | 1));
break;
case ItemSlot.Necklace:
case ItemSlot.Ring:
packet.WriteByte((byte)(StatCount << 1 | 1));
break;
case ItemSlot.Helm:
case ItemSlot.Armor:
case ItemSlot.Pants:
case ItemSlot.Boots:
case ItemSlot.Weapon2:
case ItemSlot.Weapon:
packet.WriteByte((byte)(StatCount << 1 | 1));
break;
case ItemSlot.Pet: // Yes!! Its possible to give stats to pet also (It overrides default one(s)).
packet.WriteByte((byte)(StatCount << 1 | 1));
break;
}
// foreach stat
//pPacket.WriteByte(type); // Stat type ( 0 = STR, 1 = END, 2 = DEX, 3 = INT, 4 = SPR )
//pPacket.WriteUShort(amount); // Amount
// end foreach
if (Str > 0) { packet.WriteByte(0); packet.WriteUShort(Str); }
if (End > 0) { packet.WriteByte(1); packet.WriteUShort(End); }
if (Dex > 0) { packet.WriteByte(2); packet.WriteUShort(Dex); }
if (Spr > 0) { packet.WriteByte(3); packet.WriteUShort(Spr); }
//.........这里部分代码省略.........
示例3: VersionInfo
public static void VersionInfo(LoginClient pClient, Packet pPacket)
{
ushort year;
ushort version;
if (!pPacket.TryReadUShort(out year) ||
!pPacket.TryReadUShort(out version))
{
Log.WriteLine(LogLevel.Warn, "Invalid client version.");
pClient.Disconnect();
return;
}
Log.WriteLine(LogLevel.Debug, "Client version {0}:{1}.", year, version);
using (Packet response = new Packet(SH3Type.VersionAllowed))
{
response.WriteShort(1);
pClient.SendPacket(response);
}
}
示例4: SendTitleList
public static void SendTitleList(ZoneCharacter character)
{
using (var packet = new Packet(SH4Type.CharacterTitles))
{
packet.WriteInt(0); //current title ID
packet.WriteShort(0); //title count
//here comes shit loop (see old Solar)
character.Client.SendPacket(packet);
}
}
示例5: SendQuestListDone
public static void SendQuestListDone(ZoneCharacter character)
{
using (var packet = new Packet(SH4Type.CharacterQuestsDone))
{
packet.WriteInt(character.ID);
packet.WriteShort(0); //quest count
character.Client.SendPacket(packet);
}
}
示例6: SendHandshake
private void SendHandshake(short pXorPos)
{
Packet packet = new Packet(SH2Type.SetXorKeyPosition);
packet.WriteShort(pXorPos);
SendPacket(packet);
}
示例7: WriteDetailedInfo
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(12345678); // UNK
pPacket.WriteShort(this.StonesHP);
pPacket.WriteShort(this.StonesSP);
pPacket.WriteUInt(this.HP);
pPacket.WriteUInt(this.SP);
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
}
示例8: WriteCharacterDisplay
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(0xffff); // 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(53, 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);
}