本文整理汇总了C#中Estrella.FiestaLib.Networking.Packet类的典型用法代码示例。如果您正苦于以下问题:C# Packet类的具体用法?C# Packet怎么用?C# Packet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Packet类属于Estrella.FiestaLib.Networking命名空间,在下文中一共展示了Packet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
示例2: ChangeDropMode
public static void ChangeDropMode(WorldClient client, Packet packet)
{
byte dropState;
if (packet.TryReadByte(out dropState)) {
client.Character.Group.ChangeDropType(client.Character, dropState);
}
}
示例3: SendPing
public static void SendPing(WorldClient client)
{
using (var packet = new Packet(SH2Type.Ping))
{
client.SendPacket(packet);
}
}
示例4: WritePremiumInfo
public void WritePremiumInfo(Packet packet)
{
packet.WriteInt(this.UniqueID);
packet.WriteInt(this.ShopID);
packet.WriteInt(0);//unk
packet.WriteInt(0);//unk
}
示例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: HandleSetStatPoint
public static void HandleSetStatPoint(ZoneClient client, Packet packet)
{
byte stat;
if (!packet.TryReadByte(out stat))
{
Log.WriteLine(LogLevel.Warn, "Couldn't read HandleSetStatPoint packet. {0}", client);
return;
}
if (client.Character.Character.UsablePoints == 0)
{
Log.WriteLine(LogLevel.Warn, "User tried to set stat point while not having any left. {0}", client);
}
else
{
// LETS DO ET
switch (stat)
{
case 0: client.Character.Str++; break;
case 1: client.Character.Dex++; break;
case 2: client.Character.End++; break;
case 3: client.Character.Int++; break;
case 4: client.Character.Spr++; break;
default:
{
Log.WriteLine(LogLevel.Warn, "User tried to set stat point on unknown stat {0} {1}", stat, client);
return;
}
}
client.Character.Character.UsablePoints--;
//Program.Entity.SaveChanges();
SendSetUsablePoint(client, stat);
}
}
示例7: 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);
}
}
示例8: 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);
}
}
示例9: WriteRefinement
public static void WriteRefinement(WorldCharacter wchar, Packet pPacket)
{
//TODO: pPacket.WriteByte(Convert.ToByte(this.Inventory.GetEquippedUpgradesByType(ItemType.Weapon) << 4 | this.Inventory.GetEquippedUpgradesByType(ItemType.Shield)));
pPacket.WriteByte(0xff); //this must be the above, but currently not cached
pPacket.WriteByte(0xff); // UNK
pPacket.WriteByte(0xff); // UNK
}
示例10: WriteLook
public static void WriteLook(WorldCharacter wchar, Packet packet)
{
packet.WriteByte(Convert.ToByte(0x01 | (wchar.Character.Job << 2) | (Convert.ToByte(wchar.Character.LookInfo.Male)) << 7));
packet.WriteByte(wchar.Character.LookInfo.Hair);
packet.WriteByte(wchar.Character.LookInfo.HairColor);
packet.WriteByte(wchar.Character.LookInfo.Face);
}
示例11: SelectObjectHandler
public static void SelectObjectHandler(ZoneClient client, Packet packet)
{
ushort id;
if (!packet.TryReadUShort(out id))
{
Log.WriteLine(LogLevel.Warn, "Could not read entity select request.");
return;
}
MapObject mo;
// Try to see if there is a map object with this ID
if (!client.Character.Map.Objects.TryGetValue(id, out mo))
{
client.Character.CharacterInTarget = mo;
return; // Nothing found. Just return lawl
}
mo.SelectedBy.Add(client.Character);
if (mo is ZoneCharacter || mo is Mob)
{
client.Character.SelectedObject = mo;
SendStatsUpdate(mo, client, false);
}
}
示例12: Animation
public static Packet Animation(ZoneCharacter character, byte id)
{
Packet packet = new Packet(SH8Type.Emote);
packet.WriteUShort(character.MapObjectID);
packet.WriteByte(id);
return packet;
}
示例13: TradeAgree
public static void TradeAgree(ZoneClient pClient, Packet pPacket)
{
if (pClient.Character.Trade == null)
return;
pClient.Character.Trade.AcceptTrade(pClient.Character);
}
示例14: MasterRemove
public static void MasterRemove(WorldClient client, Packet packet)
{
string removename;
if(!packet.TryReadString(out removename,16))
return;
MasterManager.Instance.RemoveMasterMember(client.Character, removename);
}
示例15: ClientReadyHandler
public static void ClientReadyHandler(ZoneClient client, Packet packet)
{
if (client.Admin > 0)
{
client.Character.DropMessage("AdminLevel = {0}; ClientLoad = {1};", client.Admin, ClientManager.Instance.ZoneLoad);
}
Handler4.SendUsablePoints(client);
if (!client.Character.IsDead)
{
// Just logged on.
client.Character.Map.FinalizeAdd(client.Character);
}
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);
}
}