當前位置: 首頁>>代碼示例>>C#>>正文


C# Networking.ZoneClient類代碼示例

本文整理匯總了C#中Zepheus.Zone.Networking.ZoneClient的典型用法代碼示例。如果您正苦於以下問題:C# ZoneClient類的具體用法?C# ZoneClient怎麽用?C# ZoneClient使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ZoneClient類屬於Zepheus.Zone.Networking命名空間,在下文中一共展示了ZoneClient類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: 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:Dextan,項目名稱:Estrella,代碼行數:34,代碼來源:Handler4.cs

示例2: 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:Canic,項目名稱:Zepheus_2k15,代碼行數:29,代碼來源:Handler12.cs

示例3: 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:Dextan,項目名稱:Estrella,代碼行數:29,代碼來源:Handler6.cs

示例4: TradeAgree

        public static void TradeAgree(ZoneClient pClient, Packet pPacket)
        {
            if (pClient.Character.Trade == null)
                return;

            pClient.Character.Trade.AcceptTrade(pClient.Character);
        }
開發者ID:Dextan,項目名稱:Estrella,代碼行數:7,代碼來源:Handler19.cs

示例5: SendPing

 public static void SendPing(ZoneClient character)
 {
     using (var packet = new Packet(SH2Type.Ping))
     {
         character.SendPacket(packet);
     }
 }
開發者ID:Dextan,項目名稱:Estrella,代碼行數:7,代碼來源:Handler2.cs

示例6: 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);
                     }
                 }
             }
         }
     }
 }
開發者ID:Canic,項目名稱:Zepheus_2k15,代碼行數:26,代碼來源:Handler14.cs

示例7: TradeLock

 public static void TradeLock(ZoneClient pClient, Packet pPacket)
 {
     if (pClient.Character.Trade != null)
     {
         pClient.Character.Trade.TradeLock(pClient.Character);
     }
 }
開發者ID:Dextan,項目名稱:Estrella,代碼行數:7,代碼來源:Handler19.cs

示例8: AddTradeRequest

 public void AddTradeRequest(ZoneClient pClient,ushort  MapObjectIDto)
 {
     Log.WriteLine(LogLevel.Debug, "{0} AddTradeReqest {1}", pClient.Character.Character.Name, MapObjectIDto);
        TradeReqest pRequest = new TradeReqest(pClient.Character, MapObjectIDto);
        this.TradeReqests.Add(pRequest);
        SendTradeRequest(pRequest);
 }
開發者ID:Dextan,項目名稱:Estrella,代碼行數:7,代碼來源:TradeManager.cs

示例9: 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);
            }
        }
開發者ID:Canic,項目名稱:Zepheus_2k15,代碼行數:35,代碼來源:Handler6.cs

示例10: 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);
            }
        }
開發者ID:Dextan,項目名稱:Estrella,代碼行數:25,代碼來源:Handler9.cs

示例11: TradeReqest

 public static void TradeReqest(ZoneClient pClient, Packet pPacket)
 {
     ushort MapObjectID;
     if (!pPacket.TryReadUShort(out MapObjectID))
         return;
     TradeManager.Instance.AddTradeRequest(pClient, MapObjectID);
 }
開發者ID:Dextan,項目名稱:Estrella,代碼行數:7,代碼來源:Handler19.cs

示例12: OnClientConnect

        public override void OnClientConnect(Socket socket)
        {
            ZoneClient client = new ZoneClient(socket);

             //  ClientManager.Instance.AddClient(client); //They register once authenticated now
            Log.WriteLine(LogLevel.Debug, "Client connected from {0}", client.Host);
               // ClientManager.Instance.AddClient(client); //They register once authenticated now
        }
開發者ID:Dextan,項目名稱:Estrella,代碼行數:8,代碼來源:ZoneAcceptor.cs

示例13: TradeBreak

        public static void TradeBreak(ZoneClient pClient, Packet pPacket)
        {
            if (pClient.Character.Trade == null)
                return;

            pClient.Character.Trade.TradeBreak(pClient.Character);
            pClient.Character.Trade = null;
        }
開發者ID:Dextan,項目名稱:Estrella,代碼行數:8,代碼來源:Handler19.cs

示例14: DeselectObjectHandler

 public static void DeselectObjectHandler(ZoneClient client, Packet packet)
 {
     if (client.Character.SelectedObject != null)
     {
         client.Character.SelectedObject.SelectedBy.Remove(client.Character);
         client.Character.SelectedObject = null;
     }
 }
開發者ID:Zepheus,項目名稱:Zepheus_Fiesta,代碼行數:8,代碼來源:Handler9.cs

示例15: RemoveReqest

 public void RemoveReqest(ZoneClient pClient)
 {
     TradeReqest Request = TradeReqests.Find(r => r.MapID == pClient.Character.MapID && r.pToTradeClient.MapObjectID== pClient.Character.MapObjectID);
        if (TradeReqests.Contains(Request))
        {
        TradeReqests.Remove(Request);
        }
 }
開發者ID:Dextan,項目名稱:Estrella,代碼行數:8,代碼來源:TradeManager.cs


注:本文中的Zepheus.Zone.Networking.ZoneClient類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。