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


C# Networking.WorldClient类代码示例

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


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

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

示例2: SendPing

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

示例3: AddClient

 public void AddClient(WorldClient client)
 {
     lock (clients)
     {
         clients.Add(client);
     }
 }
开发者ID:Zepheus,项目名称:Zepheus_Fiesta,代码行数:7,代码来源:ClientManager.cs

示例4: LeaveParty

        public static void LeaveParty(WorldClient client, Packet packet)
        {
            Party party;
            party = Program.Entity.Parties.First(c => c.CharNo == client.Character.Character.ID);

            foreach (Party PartyListFromDB in Program.Entity.Parties.Where(c => c.PartyNo == party.PartyNo).OrderBy(c => c.MasterNo))
            {
                Character character;
                character = Program.Entity.Characters.First(c => c.ID == PartyListFromDB.CharNo);
                WorldClient Partyclient = ClientManager.Instance.GetClientByCharname(character.Name);
                using (var ppacket = new Packet(SH14Type.LeaveParty))
                {
                    ppacket.WriteString(client.Character.Character.Name, 16);
                    ppacket.WriteUShort(1281);
                    Partyclient.SendPacket(ppacket);
                }
            }

            if(Program.Entity.Parties.Where(c => c.PartyNo == party.PartyNo).Count() == 2){
                Party OtherClientParty;
                OtherClientParty = Program.Entity.Parties.First(c => c.CharNo != client.Character.Character.ID);
                Program.Entity.DeleteObject(OtherClientParty);
            }

            Program.Entity.DeleteObject(party);
            Program.Entity.SaveChanges();
        }
开发者ID:Canic,项目名称:Zepheus_2k15,代码行数:27,代码来源:Handler14.cs

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

示例6: MasterRemove

 public static void MasterRemove(WorldClient client, Packet packet)
 {
     string removename;
     if(!packet.TryReadString(out removename,16))
         return;
     MasterManager.Instance.RemoveMasterMember(client.Character, removename);
 }
开发者ID:Dextan,项目名称:Estrella,代码行数:7,代码来源:Handler37.cs

示例7: GroupRequest

 public GroupRequest(WorldClient pFrom, Group pGroup, string pInvited)
 {
     this.CrationTimeStamp = DateTime.Now;
     this.InvitedClient = ClientManager.Instance.GetClientByCharname(pInvited);
     this.InviterClient = pFrom;
     this.Group = pGroup;
 }
开发者ID:Dextan,项目名称:Estrella,代码行数:7,代码来源:GroupRequest.cs

示例8: ChangeDropMode

 public static void ChangeDropMode(WorldClient client, Packet packet)
 {
     byte dropState;
     if (packet.TryReadByte(out dropState)) {
         client.Character.Group.ChangeDropType(client.Character, dropState);
     }
 }
开发者ID:Dextan,项目名称:Estrella,代码行数:7,代码来源:Handler14.cs

示例9: 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);
            }
        }
开发者ID:Dextan,项目名称:Estrella,代码行数:27,代码来源:Handler2.cs

示例10: 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);
                }
            }
        }
开发者ID:Canic,项目名称:Zepheus_2k15,代码行数:35,代码来源:Handler8.cs

示例11: AddClientByName

 public void AddClientByName(WorldClient client)
 {
     if (client.Character != null && !clientsByName.ContainsKey(client.CharacterName))
     {
         clientsByName.TryAdd(client.CharacterName, client);
     }
     else Log.WriteLine(LogLevel.Warn, "Trying to register client by name without having Character object.");
 }
开发者ID:Zepheus,项目名称:Zepheus_Fiesta,代码行数:8,代码来源:ClientManager.cs

示例12: SendUnknown

 public static void SendUnknown(WorldClient client)
 {
     using (var packet = new Packet(SH31Type.LoadUnkown))
     {
         packet.WriteInt(0xbd1); //lolwut?!  charid or sumtin'
         client.SendPacket(packet);
     }
 }
开发者ID:Canic,项目名称:Zepheus_2k15,代码行数:8,代码来源:Handler31.cs

示例13: PartyDecline

 public static void PartyDecline(WorldClient client, Packet packet)
 {
     string inviteChar;
     if (packet.TryReadString(out inviteChar, 0x10))
     {
         GroupManager.Instance.DeclineInvite(client, inviteChar);
     }
 }
开发者ID:Dextan,项目名称:Estrella,代码行数:8,代码来源:Handler14.cs

示例14: sendUnk14

 public static void sendUnk14(WorldClient client)
 {
     using (var packet = new Packet(SH2Type.Unk14))
     {
         packet.WriteHexAsBytes("07 2C 2A");
         client.SendPacket(packet);
     }
 }
开发者ID:Canic,项目名称:Zepheus_2k15,代码行数:8,代码来源:Handler2.cs

示例15: SendConnectError

 public static void SendConnectError(WorldClient client, ConnectErrors error)
 {
     using (var packet = new Packet(SH4Type.ConnectError))
     {
         packet.WriteUShort((ushort)error);
         client.SendPacket(packet);
     }
 }
开发者ID:Dextan,项目名称:Estrella,代码行数:8,代码来源:Handler4.cs


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