本文整理汇总了C#中Zepheus.FiestaLib.Networking.Packet.WriteShort方法的典型用法代码示例。如果您正苦于以下问题:C# Packet.WriteShort方法的具体用法?C# Packet.WriteShort怎么用?C# Packet.WriteShort使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zepheus.FiestaLib.Networking.Packet
的用法示例。
在下文中一共展示了Packet.WriteShort方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: BySPStoneHandler
public static void BySPStoneHandler(ZoneClient client, Packet packet)
{
short Amount;
if (packet.TryReadShort(out Amount))
{
client.Character.ChangeMoney(client.Character.Character.Money -= client.Character.BaseStats.PriceSPStone);
short Am = Amount += client.Character.StonesSP;
client.Character.StonesHP = Am;
using (var p = new Packet(SH20Type.ChangeSPStones))
{
p.WriteShort(Am);
client.SendPacket(p);
}
}
}
示例3: WriteBasicCharInfo
public static void WriteBasicCharInfo(WorldCharacter wchar, Packet packet)
{
packet.WriteInt(wchar.Character.ID); //charid
packet.FillPadding(wchar.Character.Name, 0x10);
packet.WriteInt(0);//unk
packet.WriteShort((short)wchar.Character.CharLevel); //level
packet.WriteByte(wchar.Character.Slot);
MapInfo mapinfo;
if (!DataProvider.Instance.Maps.TryGetValue(wchar.Character.PositionInfo.Map, out mapinfo))
{
Log.WriteLine(LogLevel.Warn, "{0} has an invalid MapID ({1})", wchar.Character.Name, wchar.Character.PositionInfo.Map);
wchar.Character.PositionInfo.Map = 0;
packet.FillPadding(mapinfo.ShortName, 0x0D); //townname
}
else
{
packet.FillPadding(mapinfo.ShortName, 0x0D); //townname
}
//packet.WriteByte(0); // UNK
packet.WriteInt(0); // Random seed
WriteLook(wchar,packet);
WriteEquipment(wchar,packet);
WriteRefinement(wchar,packet);
packet.WriteByte(0);
packet.WriteByte(0xF0);
packet.WriteByte(0xFF);//unk
packet.WriteByte(0xFF);
packet.FillPadding(mapinfo.ShortName, 0x0c);
packet.WriteInt(0); //pos
packet.WriteInt(0); //pos
packet.WriteUShort(0xdb78);
packet.WriteUShort(4910);//unk
packet.WriteUShort(25600);
packet.Fill(4, 0);
}
示例4: 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(0); // 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(81, 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);
packet.Fill(32, 0);
packet.Fill(2, 0xFF);
packet.WriteUShort(522);
}
示例5: VersionInfo
public static void VersionInfo(LoginClient pClient, Packet pPacket)
{
string year;
ushort version;
if (!pPacket.TryReadString(out year, 20) ||
!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);
}
}
示例6: UseTeleporter
public static void UseTeleporter(ZoneClient client, Packet packet)
{
byte anwser;
if (packet.TryReadByte(out anwser))
{
using (Packet Packet = new Packet(SH6Type.TelePorter))
{
Packet.WriteShort(6593);//code for normal teleport
client.SendPacket(Packet);
}
switch (anwser)
{
case 0:
client.Character.ChangeMap(0, 4199, 4769);//Roumen
break;
case 1:
client.Character.ChangeMap(9, 11802, 10466);//Eldrine
break;
case 2:
client.Character.ChangeMap(75, 9069, 9312);//EldGbl02
break;
case 3:
client.Character.ChangeMap(5,13658,7812);//RouVal01
break;
default:
Log.WriteLine(LogLevel.Warn,"Unkown Teleport Answer {1}",anwser);
break;
}
}
}
示例7: FriendListDelete
public static void FriendListDelete(WorldClient pClient, Packet pPacket)
{
string sender, target;
if (!pPacket.TryReadString(out sender, 16) ||
!pPacket.TryReadString(out target, 16))
{
Log.WriteLine(LogLevel.Warn, "Error parsing friend delete request.");
return;
}
if (pClient.Character.DeleteFriend(target))
{
WorldClient client = ClientManager.Instance.GetClientByCharname(target);
if (client != null)
{
using (var pack = new Packet(SH21Type.FriendDeleteSend))
{
pack.WriteString(sender, 16);
client.SendPacket(pack);
}
Friend friend = pClient.Character.Friends.Find(f => f.Name == target);
if(friend != null)
pClient.Character.Friends.Remove(friend);
}
using (var pack = new Packet(SH21Type.FriendDeleteSend))
{
pack.WriteString(sender, 16);
pack.WriteString(target, 16);
pack.WriteShort(0x0951);
pClient.SendPacket(pack);
}
}
else
{
using (var pack = new Packet(SH21Type.FriendInviteResponse))
{
pack.WriteString(target, 16);
pack.WriteString(sender, 16);
pack.WriteUShort(0x0946); // Cannot find ${Target}
pClient.SendPacket(pack);
}
}
}
示例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);
//(IsMale ? 1 : 0)
int mount = (this.Mount != null) ? (int) this.Mount.Handle : (int)0xffff;
packet.WriteUShort((ushort)mount); // 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(55, 0); // Buff Bits? Something like that
if (this.Character.GuildID > 1)
{
packet.WriteInt(this.Guild.ID);
}
else if (this.Character.AcademyID > 0)
{
packet.WriteInt(this.Character.AcademyID);
}
else
{
packet.WriteInt(0);
}
packet.WriteByte(0x02); // UNK (0x02)
packet.WriteBool(this.IsInaAcademy); // In Guild Academy (0 - No, 1 - Yes)
packet.WriteBool(true); // Pet AutoPickup (0 - Off, 1 - On)
packet.WriteByte(this.Level);
}
示例9: SendHandshake
private void SendHandshake(short pXorPos)
{
Packet packet = new Packet(SH2Type.SetXorKeyPosition);
packet.WriteShort(pXorPos);
SendPacket(packet);
}
示例10: 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:
packet.WriteByte(this.Upgrades); // Refinement
packet.WriteByte(0);
packet.WriteShort(0); // Or int?
packet.WriteShort(0);
packet.WriteByte(0);
packet.WriteInt(0); //Temp
packet.WriteByte(0x01); //Temp
break;
// 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.Fill(9, (byte)0xFF);
packet.Fill(7, 0x00);
//packet.WriteUInt(GetExpiringTime()); // Expiring time (1992027391 - never expires)
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;
//.........这里部分代码省略.........
示例11: sendPartyMatchingList
public static void sendPartyMatchingList(WorldClient client)
{
using (var packet = new Packet(SH14Type.PartyMatchingSystem))
{
packet.WriteShort(0); // UNK
packet.WriteShort(20);
packet.WriteShort(1);
packet.WriteInt(Program.Entity.PartyMatchingSystems.Count());
foreach (PartyMatchingSystem v in Program.Entity.PartyMatchingSystems)
{
packet.WriteInt(client.Character.ID); //unk
packet.WriteString(v.Name, 16);
packet.WriteString(v.Message, 128);
packet.WriteUShort(0); //unk
}
client.SendPacket(packet);
}
}
示例12: PartyInviteToCharacter
public static void PartyInviteToCharacter(WorldClient client, Packet packet)
{
string charname;
if (!packet.TryReadString(out charname, 16))
{
Log.WriteLine(LogLevel.Error, "PartySystem :: Got unknown Party request from Character {0}", client.Character.Character.Name);
return;
}
WorldClient otherclient = ClientManager.Instance.GetClientByCharname(charname);
if (otherclient != null)
{
if (Program.Entity.Parties.Count(c => c.CharNo == otherclient.Character.Character.ID) == 1)
{
using (var ppacket = new Packet(SH14Type.PartyInviteAnswer))
{
ppacket.WriteString(charname, 16);
ppacket.WriteByte(0);
ppacket.WriteShort(1220);
client.SendPacket(ppacket);
}
}
else
{
using (var ppacket = new Packet(SH14Type.PartyRequestFromCharacter))
{
ppacket.WriteString(client.CharacterName, 16);
otherclient.SendPacket(ppacket);
}
}
}
else
{
Log.WriteLine(LogLevel.Error, "PartySystem :: Client not found from {0}", client.CharacterName);
}
}
示例13: On_GameClient_LeaveGuild
public static void On_GameClient_LeaveGuild(WorldClient Client, Packet pPacket)
{
if (Client.Character.Guild == null)
{
return;
}
GuildMember member;
if (Client.Character.Guild.GetMember(Client.Character.Character.Name, out member))
{
Client.Character.Guild.RemoveMember(member, null, true);
using (var packet = new Packet(SH29Type.LeaveGuildResponse))
{
packet.WriteShort(3137);
Client.SendPacket(packet);
}
}
}
示例14: 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);
pPacket.WriteLong(this.Inventory.Money);
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);// -.
pPacket.WriteByte(this.End);// |
pPacket.WriteByte(this.Dex);// | Boni
pPacket.WriteByte(this.Int);// |
pPacket.WriteByte(this.Spr);// -'
pPacket.WriteShort(0); // UNK
pPacket.WriteUInt(0); // Killpoints (TODO)
pPacket.Fill(7, 0); // UNK
}
示例15: 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(0); // UNK
pPacket.WriteShort(this.StonesHP);
pPacket.WriteShort(this.StonesSP);
pPacket.WriteUInt(this.HP);
pPacket.WriteUInt(this.SP);
pPacket.Fill(4, 0); //UNK
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
}