本文整理汇总了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);
}
}
}
示例2: SendPing
public static void SendPing(WorldClient client)
{
using (var packet = new Packet(SH2Type.Ping))
{
client.SendPacket(packet);
}
}
示例3: AddClient
public void AddClient(WorldClient client)
{
lock (clients)
{
clients.Add(client);
}
}
示例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();
}
示例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);
}
}
示例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);
}
示例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;
}
示例8: ChangeDropMode
public static void ChangeDropMode(WorldClient client, Packet packet)
{
byte dropState;
if (packet.TryReadByte(out dropState)) {
client.Character.Group.ChangeDropType(client.Character, dropState);
}
}
示例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);
}
}
示例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);
}
}
}
示例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.");
}
示例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);
}
}
示例13: PartyDecline
public static void PartyDecline(WorldClient client, Packet packet)
{
string inviteChar;
if (packet.TryReadString(out inviteChar, 0x10))
{
GroupManager.Instance.DeclineInvite(client, inviteChar);
}
}
示例14: sendUnk14
public static void sendUnk14(WorldClient client)
{
using (var packet = new Packet(SH2Type.Unk14))
{
packet.WriteHexAsBytes("07 2C 2A");
client.SendPacket(packet);
}
}
示例15: SendConnectError
public static void SendConnectError(WorldClient client, ConnectErrors error)
{
using (var packet = new Packet(SH4Type.ConnectError))
{
packet.WriteUShort((ushort)error);
client.SendPacket(packet);
}
}