本文整理汇总了C#中Zepheus.FiestaLib.Networking.Packet类的典型用法代码示例。如果您正苦于以下问题:C# Packet类的具体用法?C# Packet怎么用?C# Packet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Packet类属于Zepheus.FiestaLib.Networking命名空间,在下文中一共展示了Packet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendPartyMemberCordChange
public static void SendPartyMemberCordChange(ZoneClient client)
{
if (Program.Entity.Parties.Where(c => c.CharNo == client.Character.ID).Count() == 1)
{
Party PartyNo = Program.Entity.Parties.First(c => c.CharNo == client.Character.ID);
foreach (Party party in Program.Entity.Parties.Where(c => c.PartyNo == PartyNo.PartyNo))
{
using (var ppacket = new Packet(SH14Type.PartyLoginCord))
{
Character Pcharacter = Program.Entity.Characters.First(c => c.ID == party.CharNo);
ZoneClient otherLiveInfo = ClientManager.Instance.GetClientByName(Pcharacter.Name);
if (otherLiveInfo != null)
{
if (otherLiveInfo.Character.MapID == client.Character.MapID)
{
ppacket.WriteByte(1); //unk
ppacket.WriteString(client.Character.Name, 16);
ppacket.WriteInt(client.Character.Position.X);
ppacket.WriteInt(client.Character.Position.Y);
otherLiveInfo.SendPacket(ppacket);
}
}
}
}
}
}
示例2: Animation
public static Packet Animation(ZoneCharacter character, byte id)
{
Packet packet = new Packet(SH8Type.Emote);
packet.WriteUShort(character.MapObjectID);
packet.WriteByte(id);
return packet;
}
示例3: SendClientTime
public static void SendClientTime(WorldClient client, DateTime time)
{
using (var packet = new Packet(SH2Type.UpdateClientTime))
{
//pPacket.WriteUInt((59 << 25) | (23 << 19) | (31 << 13) | (12 << 8) | (254));
// * Minutes | Hours | Days | Months | Years
packet.WriteInt(3);
packet.WriteInt(time.Minute);//minutes
packet.WriteInt(time.Hour);//hourses
packet.WriteInt(time.Day);
packet.WriteInt(time.Month-1);
packet.WriteInt((time.Year - 1900));
packet.WriteInt((int)time.DayOfWeek);//wekday?
packet.WriteInt(105);
packet.WriteInt(2);
packet.WriteByte(1); //GMT 0-130 positive 130 -254 negative
// packet.WriteLong(2012);
// packet.WriteInt(4);//unk
//packet.WriteInt(1);//unk
//packet.WriteInt(3);//unk
//packet.WriteInt(46);
// packet.Fill(3, 0);//unk
// packet.WriteByte(2);
client.SendPacket(packet);
}
}
示例4: SendPing
public static void SendPing(WorldClient client)
{
using (var packet = new Packet(SH2Type.Ping))
{
client.SendPacket(packet);
}
}
示例5: CharacterSelectHandler
public static void CharacterSelectHandler(WorldClient client, Packet packet)
{
byte slot;
if (!packet.TryReadByte(out slot) || slot > 10 || !client.Characters.ContainsKey(slot))
{
Log.WriteLine(LogLevel.Warn, "{0} selected an invalid character.", client.Username);
return;
}
WorldCharacter character;
if (client.Characters.TryGetValue(slot, out character))
{
//generate transfer
ZoneConnection zone = Program.GetZoneByMap(character.Character.PositionInfo.Map);
if (zone != null)
{
client.Characters.Clear(); //we clear the other ones from memory
client.Character = character; //only keep the one selecte
//Database.Storage.Characters.AddChars(character.Character);
zone.SendTransferClientFromZone(client.AccountID, client.Username, client.Character.Character.Name,client.Character.ID, client.RandomID, client.Admin, client.Host);
ClientManager.Instance.AddClientByName(client); //so we can look them up fast using charname later.
SendZoneServerIP(client, zone);
}
else
{
Log.WriteLine(LogLevel.Warn, "Character tried to join unloaded map: {0}", character.Character.PositionInfo.Map);
SendConnectError(client, ConnectErrors.MapUnderMaintenance);
}
}
}
示例6: ShowDrops
public static Packet ShowDrops(List<Drop> drops)
{
Packet packet = new Packet(SH7Type.ShowDrops);
packet.WriteByte((byte)drops.Count);
drops.ForEach(d => d.Write(packet));
return packet;
}
示例7: GetAcademyGoldRewardList
public static void GetAcademyGoldRewardList(WorldClient client, Packet packet)
{
using (var pack = new Packet(SH38Type.SendAcademyGoldRewardList))
{
pack.WriteHexAsBytes("80 18");//responsecode
pack.WriteByte(1);//stat count
pack.WriteHexAsBytes("0A 0A CA 9A 3B 00 00 00 00");//unk
pack.WriteByte(10);//levelbreich
pack.WriteLong(1000);
pack.WriteByte(15);//level bereich
pack.WriteLong(1000);
pack.WriteByte(26);//level bereich
pack.WriteLong(1000);
pack.WriteByte(31);//level bereich
pack.WriteLong(1000);
pack.WriteByte(36);//levelbereich
pack.WriteLong(1000);
pack.WriteByte(41);//level bereich
pack.WriteLong(9000);
pack.WriteByte(46);//level bereich
pack.WriteLong(1000);
pack.WriteByte(51);//level bereich
pack.WriteLong(1000);
pack.WriteByte(56);//level bereich
pack.WriteLong(1000);
client.SendPacket(pack);
}
}
示例8: WriteLook
public static void WriteLook(WorldCharacter wchar, Packet packet)
{
packet.WriteByte(Convert.ToByte(0x01 | (wchar.Character.Job << 2) | (Convert.ToByte(wchar.Character.Male)) << 7));
packet.WriteByte(wchar.Character.Hair);
packet.WriteByte(wchar.Character.HairColor);
packet.WriteByte(wchar.Character.Face);
}
示例9: TradeLock
public static void TradeLock(ZoneClient pClient, Packet pPacket)
{
if (pClient.Character.Trade != null)
{
pClient.Character.Trade.TradeLock(pClient.Character);
}
}
示例10: TradeReqest
public static void TradeReqest(ZoneClient pClient, Packet pPacket)
{
ushort MapObjectID;
if (!pPacket.TryReadUShort(out MapObjectID))
return;
TradeManager.Instance.AddTradeRequest(pClient, MapObjectID);
}
示例11: TradeAgree
public static void TradeAgree(ZoneClient pClient, Packet pPacket)
{
if (pClient.Character.Trade == null)
return;
pClient.Character.Trade.AcceptTrade(pClient.Character);
}
示例12: ChangeDropMode
public static void ChangeDropMode(WorldClient client, Packet packet)
{
byte dropState;
if (packet.TryReadByte(out dropState)) {
client.Character.Group.ChangeDropType(client.Character, dropState);
}
}
示例13: WritePremiumInfo
public void WritePremiumInfo(Packet packet)
{
packet.WriteInt(this.UniqueID);
packet.WriteInt(this.ShopID);
packet.WriteInt(0);//unk
packet.WriteInt(0);//unk
}
示例14: sendPartyMessage
public static void sendPartyMessage(WorldClient client, Packet packet)
{
string mess;
byte len;
if (!packet.TryReadByte(out len) || !packet.TryReadString(out mess, len))
{
Log.WriteLine(LogLevel.Error, "PartyChat :: Can not parse party chat from {0}", client.Character.Character.Name);
return;
}
if(Program.Entity.Parties.Where(c => c.CharNo == client.Character.Character.ID).Count() == 1)
{
Party getPartyInfo = Program.Entity.Parties.First(c => c.CharNo == client.Character.Character.ID);
foreach (Party party in Program.Entity.Parties.Where(c => c.PartyNo == getPartyInfo.PartyNo))
{
Character character = Program.Entity.Characters.First(c => c.ID == party.CharNo);
WorldClient wclient = ClientManager.Instance.GetClientByCharname(character.Name);
using (var ppacket = new Packet(SH8Type.PartyChat))
{
ppacket.WriteString(client.Character.Character.Name, 16);
ppacket.WriteByte(len);
ppacket.WriteString(mess, len);
wclient.SendPacket(ppacket);
}
}
}
else
{
using (var ppacket = new Packet(SH8Type.PartyChatErr))
{
ppacket.WriteUShort(1985);
client.SendPacket(ppacket);
}
}
}
示例15: ClientReadyHandler
public static void ClientReadyHandler(ZoneClient client, Packet packet)
{
Handler4.SendUsablePoints(client);
if (!client.Character.IsDead)
{
// Just logged on.
client.Character.Map.FinalizeAdd(client.Character);
//Handler27.SendGameMessage(client.Character, "GAMEPLAY NOT FINAL :: WELCOME TO OSMO, " + client.Character.Name.ToUpper(), "Universal_2");
Handler9.SendUpdateHP(client.Character);
Handler9.SendUpdateSP(client.Character);
if (client.Character.Job == Job.Crusader)
{
Handler9.SendUpdateLP(client.Character);
}
Handler14.SendPartyInformation(client);
}
else
{
// Reviving, not readding for this one!
MapInfo mi;
if (DataProvider.Instance.MapsByID.TryGetValue(client.Character.MapID, out mi))
{
client.Character.State = PlayerState.Normal;
client.Character.Map.SendCharacterLeftMap(client.Character, false);
client.Character.Position.X = mi.RegenX;
client.Character.Position.Y = mi.RegenY;
client.Character.Map.SendCharacterEnteredMap(client.Character);
}
client.Character.SetHP(client.Character.MaxHP / 4);
}
}