当前位置: 首页>>代码示例>>C#>>正文


C# Networking.Packet类代码示例

本文整理汇总了C#中Solar.FiestaLib.Networking.Packet的典型用法代码示例。如果您正苦于以下问题:C# Packet类的具体用法?C# Packet怎么用?C# Packet使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Packet类属于Solar.FiestaLib.Networking命名空间,在下文中一共展示了Packet类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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);
            }
        }
开发者ID:iFeddy,项目名称:SolarFiesta,代码行数:29,代码来源:Handler6.cs

示例2: CreateWorldMessage

 public static Packet CreateWorldMessage(WorldMessageTypes pType, string pMessage)
 {
     var packet = new Packet(SH25Type.WorldMessage);
     packet.WriteByte((byte)pType);
     packet.WriteStringLen(pMessage, true);
     return packet;
 }
开发者ID:iFeddy,项目名称:SolarFiesta,代码行数:7,代码来源:Handler25.cs

示例3: 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);
            }
        }
开发者ID:iFeddy,项目名称:SolarFiesta,代码行数:34,代码来源:Handler4.cs

示例4: 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;
 }
开发者ID:iFeddy,项目名称:SolarFiesta,代码行数:7,代码来源:Handler7.cs

示例5: EquipHandler

 public static void EquipHandler(ZoneClient client, Packet packet)
 {
     sbyte slot;
     if (!packet.TryReadSByte(out slot))
     {
         Log.WriteLine(LogLevel.Warn, "Error reading equipping slot.");
         return;
     }
     Item item;
     if (client.Character.InventoryItems.TryGetValue(slot, out item))
     {
         if (item is Equip)
         {
             if (((Equip)item).Info.Level > client.Character.Level)
             {
                 FailedEquip(client.Character, 645); // 85 02
             }
             else
             {
                 client.Character.EquipItem((Equip)item);
             }
         }
         else
         {
             FailedEquip(client.Character);
             Log.WriteLine(LogLevel.Warn, "{0} equippped an item. What a moron.", client.Character.Name);
         }
     }
 }
开发者ID:iFeddy,项目名称:SolarFiesta,代码行数:29,代码来源:Handler12.cs

示例6: SendPing

 public static void SendPing(WorldClient client)
 {
     using (var packet = new Packet(SH2Type.Ping))
     {
         client.SendPacket(packet);
     }
 }
开发者ID:iFeddy,项目名称:SolarFiesta,代码行数:7,代码来源:Handler2.cs

示例7: WriteLook

 public static void WriteLook(WorldCharacter wchar, Packet packet)
 {
     packet.WriteByte(Convert.ToByte(0x00001 | (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);
 }
开发者ID:iFeddy,项目名称:SolarFiesta,代码行数:7,代码来源:PacketHelper.cs

示例8: Animation

 public static Packet Animation(ZoneCharacter character, byte id)
 {
     Packet packet = new Packet(SH8Type.Emote);
     packet.WriteUShort(character.MapObjectID);
     packet.WriteByte(id);
     return packet;
 }
开发者ID:iFeddy,项目名称:SolarFiesta,代码行数:7,代码来源:Handler8.cs

示例9: SendPing

 public static void SendPing(ZoneClient character)
 {
     using (var packet = new Packet(SH2Type.Ping))
     {
         character.SendPacket(packet);
     }
 }
开发者ID:iFeddy,项目名称:SolarFiesta,代码行数:7,代码来源:Handler2.cs

示例10: 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.Map);
                if (zone != null)
                {
                    client.Characters.Clear(); //we clear the other ones from memory
                    client.Character = character; //only keep the one selected
                    zone.SendTransferClientFromZone(client.AccountID, client.Username, client.Character.Character.Name, 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.Map);
                    SendConnectError(client, ConnectErrors.MapUnderMaintenance);
                }
            }
        }
开发者ID:iFeddy,项目名称:SolarFiesta,代码行数:31,代码来源:Handler4.cs

示例11: SendCharacterChunkEnd

 public static void SendCharacterChunkEnd(ZoneCharacter character)
 {
     using (var packet = new Packet(SH4Type.CharacterInfoEnd))
     {
         packet.WriteUShort(0xFFFF);
         character.Client.SendPacket(packet);
     }
 }
开发者ID:iFeddy,项目名称:SolarFiesta,代码行数:8,代码来源:Handler4.cs

示例12: FailedUnequip

 public static void FailedUnequip(ZoneCharacter character)
 {
     using (var packet = new Packet(SH12Type.FailedUnequip))
     {
         packet.WriteUShort(706);
         character.Client.SendPacket(packet);
     }
 }
开发者ID:iFeddy,项目名称:SolarFiesta,代码行数:8,代码来源:Handler12.cs

示例13: FailedEquip

 public static void FailedEquip(ZoneCharacter character, ushort val = 0)
 {
     using (var packet = new Packet(SH12Type.FailedEquip))
     {
         packet.WriteUShort(val);
         character.Client.SendPacket(packet);
     }
 }
开发者ID:iFeddy,项目名称:SolarFiesta,代码行数:8,代码来源:Handler12.cs

示例14: BeginDisplayRest

 public static Packet BeginDisplayRest(ZoneCharacter character)
 {
     Packet packet = new Packet(SH8Type.BeginDisplayRest);
     packet.WriteUShort(character.MapObjectID);
     packet.WriteUShort(character.House.ItemID);
     packet.Fill(10, 0xff);
     return packet;
 }
开发者ID:iFeddy,项目名称:SolarFiesta,代码行数:8,代码来源:Handler8.cs

示例15: SendDetailedCharacterInfo

 public static void SendDetailedCharacterInfo(ZoneCharacter character)
 {
     using (var packet = new Packet(SH6Type.DetailedCharacterInfo))
     {
         character.WriteDetailedInfoExtra(packet);
         character.Client.SendPacket(packet);
     }
 }
开发者ID:iFeddy,项目名称:SolarFiesta,代码行数:8,代码来源:Handler6.cs


注:本文中的Solar.FiestaLib.Networking.Packet类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。