本文整理汇总了C#中Bunny.Core.Client类的典型用法代码示例。如果您正苦于以下问题:C# Client类的具体用法?C# Client怎么用?C# Client使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Client类属于Bunny.Core命名空间,在下文中一共展示了Client类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessDeleteChar
public static void ProcessDeleteChar(Client client, PacketReader packetReader)
{
var uid = packetReader.ReadMuid();
var index = packetReader.ReadInt32();
var name = packetReader.ReadString();
var result = Results.Accepted;
if (uid != client.GetMuid() || !Globals.AcceptedString.IsMatch(name) || index < 0 || index > 4)
{
client.Disconnect();
return;
}
var cid = Globals.GunzDatabase.GetCid(client.ClientPlayer.PlayerAccount.AccountId, index);
if (cid == 0)
{
result = Results.CharacterDeleteDisabled;
}
else
{
Globals.GunzDatabase.DeleteCharacter(client.ClientPlayer.PlayerAccount.AccountId, cid);
}
Match.ResponseDeleteCharacter(client, result);
}
示例2: ProcessCreateChar
public static void ProcessCreateChar(Client client, PacketReader packetReader)
{
var uid = packetReader.ReadMuid();
var index = packetReader.ReadInt32();
var name = packetReader.ReadString();
var sex = packetReader.ReadInt32();
var hair = packetReader.ReadInt32();
var face = packetReader.ReadInt32();
var costume = packetReader.ReadInt32();
var result = Results.Accepted;
if (uid != client.GetMuid() || index < 0 || index > 4 || sex < 0 || sex > 1)
{
client.Disconnect();
return;
}
if (!Globals.AcceptedString.IsMatch(name))
result = Results.CharacterEnterName;
else if (Globals.GunzDatabase.GetCharacterCount(client.ClientPlayer.PlayerAccount.AccountId) >= 4)
result = Results.CharacterNameNonExistant;
else if (Globals.GunzDatabase.CharacterExists(name))
result = Results.CharacterNameInUse;
else if (!Globals.GunzDatabase.CreateCharacter(client.ClientPlayer.PlayerAccount.AccountId, (byte)index, name, sex, hair, face, costume))
result = Results.CharacterInvalidName;
Match.ResponseCreateChar(client, result, name);
}
示例3: ProcessAccountCharList
public static void ProcessAccountCharList(Client client, PacketReader packetReader)
{
client.Unload();
var characters = Globals.GunzDatabase.GetCharacterList(client.ClientPlayer.PlayerAccount.AccountId);
Match.ResponseCharList(client, characters);
}
示例4: AddToQueue
public void AddToQueue(Client client)
{
lock (_objectLock)
{
WaitQueue.Enqueue(client);
}
}
示例5: ClanInfo
public static void ClanInfo(Client client, string clanName)
{
var player = client.ClientPlayer;
var info = new ClanInfo();
var clanId = Globals.GunzDatabase.GetClanId(clanName);
Globals.GunzDatabase.GetClanInfo(clanId, ref info);
if (info == null)
return;
info.ConnectedMembers = Convert.ToInt16(TcpServer.GetClanMembers(clanId).Count);
using (var packet = new PacketWriter(Operation.MatchClanResponseClanInfo, CryptFlags.Encrypt))
{
packet.Write(1, 78);
packet.Write(info.Name, 16);
packet.Write(info.Level);
packet.Write(info.Points);
packet.Write(info.TotalPoints);
packet.Write(info.Ranking);
packet.Write(info.Master, 32);
packet.Write(info.Wins);
packet.Write(info.Losses);
packet.Write(info.MemberCount);
packet.Write(info.ConnectedMembers);
packet.Write(info.ClanId);
packet.Write(info.EmblemChecksum);
client.Send(packet);
}
}
示例6: Remove
public static void Remove(Client client)
{
lock (_objectLock)
{
Clients.Remove(client);
}
}
示例7: Chat
public void Chat(Client client, string message)
{
if (message.StartsWith("/dtrank "))
{
var args = message.Substring(message.IndexOf(" ") + 1);
var dtrank = Int32.Parse(args);
client.GetCharacter().DuelRank = dtrank;
Refresh();
}
if (message.StartsWith("/cw "))
{
var args = message.Substring(message.IndexOf(" ") + 1);
var c = Network.TcpServer.GetClientFromName(args);
List<Client> red = new List<Client>();
List<Client> blue = new List<Client>();
red.Add(c);
blue.Add(client);
_stages.CreateClanwar(red, blue);
}
lock (_objectLock)
ChannelPackets.ResponseChat(_traits.Playerlist, _traits.ChannelId, client.GetCharacter().Name, message, client.ClientPlayer.PlayerAccount.Access);
}
示例8: GameLeaveBattle
public override void GameLeaveBattle(Client client)
{
if (CurrentBerserker == client)
CurrentBerserker = null;
base.GameLeaveBattle(client);
}
示例9: GameInfoCallback
public virtual void GameInfoCallback(Client client)
{
var traits = _stage.GetTraits();
lock (_stage.ObjectLock)
{
Battle.BattleResponseInfo(client, _teamScores[0], _teamScores[1], traits.Players);
}
client.ClientPlayer.PlayerStats.Spawned = true;
client.ClientPlayer.PlayerStats.RequestedInfo = true;
client.ClientPlayer.PlayerStats.Loaded = true;
ProcessRoundState();
if ((!IsTeam() && !IsQuestDerived() && !IsDuel()) || IsExtreme())
{
Battle.StageRoundUpdate(client, traits.StageId, traits.CurrentRound, traits.Round);
Spawn(client);
}
else if (IsTeam())
{
if (_roundState != RoundState.Play)
{
client.ClientPlayer.PlayerStats.Entered = true;
}
else
{
client.ClientPlayer.PlayerStats.Entered = false;
client.ClientPlayer.PlayerStats.Spawned = false;
Battle.StageRoundUpdate(client, traits.StageId, traits.CurrentRound, traits.Round);
}
}
}
示例10: OnGameKill
public override void OnGameKill(Client killer, Client victim)
{
if (killer == CurrentBerserker && CurrentStage.GetTraits().Name.ToLower().Contains("[sb]"))
{
lock (CurrentStage.ObjectLock)
{
Battle.AssignBerserker(CurrentStage.GetTraits().Players, CurrentBerserker.GetMuid());
}
}
if (victim == CurrentBerserker || CurrentBerserker == null)
{
lock (CurrentStage.ObjectLock)
{
CurrentBerserker = killer;
Battle.AssignBerserker(CurrentStage.GetTraits().Players, CurrentBerserker.GetMuid());
}
}
if (killer.ClientPlayer.PlayerStats.Kills == CurrentStage.GetTraits().RoundCount)
{
GameInProgress = false;
ItemSpawns.Abort();
GameOver();
}
else
{
Spawn(victim, 5);
}
}
示例11: ResponseChannelList
public static void ResponseChannelList(Client client, List<Channel> channels)
{
using (var packet = new PacketWriter(Operation.ChannelList, CryptFlags.Decrypt))
{
packet.Write(channels.Count, 88);
Int16 index = 0;
foreach (var c in channels)
{
var traits = c.GetTraits();
packet.Write(traits.ChannelId);
packet.Write(++index);
packet.Write((Int16)traits.Playerlist.Count);
packet.Write((Int16)traits.MaxUsers);
packet.Write((Int16)traits.MinLevel);
packet.Write((Int16)traits.MaxLevel);
packet.Write((byte)traits.Type);
packet.Write(traits.ChannelName, 64);
packet.Write(false);
packet.Write(0);
}
client.Send(packet);
}
}
示例12: ResponseAllPlayerList
public static void ResponseAllPlayerList(Client client, List<Client> clients, Muid channelId)
{
using (var packet = new PacketWriter(Operation.ChannelResponseAllPlayerList, CryptFlags.Encrypt))
{
packet.Write(channelId);
packet.Write(clients.Count, 73);
foreach (var c in clients)
{
packet.Write(c.GetMuid());
packet.Write(c.GetCharacter().Name, 32);
packet.Write(c.GetCharacter().ClanName, 16);
packet.Write((byte)c.GetCharacter().Level);
packet.Write((byte)c.GetCharacter().DuelRank);//dagger for duel tourney.
packet.Write((Int32)c.ClientPlayer.PlayerLocation);
packet.Write((byte)c.ClientPlayer.PlayerAccount.Access);
packet.Write((byte)2);
packet.Write(c.GetCharacter().ClanId);
packet.Write(0);//unknown.
packet.Write((byte)3);//unknown
}
client.Send(packet);
}
}
示例13: ResponseCharacterItemList
public static void ResponseCharacterItemList(Client client)
{
using (var packet = new PacketWriter(Operation.MatchResponseCharacterItemList, CryptFlags.Decrypt))
{
packet.Write(client.GetCharacter().Bp);
packet.Write(17, 8);
for (var i = 0; i < 17; ++i)
{
packet.Write(0);
packet.Write(client.GetCharacter().EquippedItems[i].ItemCid);
}
packet.Write(client.GetCharacter().Items.Count, 24);
foreach (var i in client.GetCharacter().Items)
{
packet.Write(0);
packet.Write(i.ItemCid);
packet.Write(i.ItemId);
packet.Write(i.RentHour);
packet.Write(0);
packet.Write(i.Quantity);
}
packet.Write(0, 12);
client.Send(packet);
}
}
示例14: GameKillCallback
public virtual void GameKillCallback(Client killer, Client victim)
{
victim.ClientPlayer.PlayerStats.Spawned = false;
if (_gameType == ObjectStageGameType.Training)
{
var uids = new Pair<Muid, Muid>(killer.GetMuid(), victim.GetMuid());
var args = new Pair<UInt32, UInt32>(0, 0);
lock (CurrentStage.ObjectLock)
{
Battle.GameDie(CurrentStage.GetTraits().Players, uids, args);
}
}
else
{
if (killer != victim)
{
var exp = ExpManager.GetExpFromKill(killer.GetCharacter().Level,
victim.GetCharacter().Level);
killer.GetCharacter().Xp += exp;
var uids = new Pair<Muid, Muid>(killer.GetMuid(), victim.GetMuid());
var args = new Pair<UInt32, UInt32>((exp << 16), 0);
lock (CurrentStage.ObjectLock)
{
Battle.GameDie(CurrentStage.GetTraits().Players, uids, args);
//killer.GetCharacter().Level =
// (Int16) ExpManager.GetLevel((Int32) killer.GetCharacter().Xp);
Log.Write("Exp Gained: {0} | Exp To Next Level: {1} | Current Exp: {2}", exp, ExpManager.GetExp(killer.GetCharacter().Level + 1), killer.GetCharacter().Xp);
if (ExpManager.Level(killer.GetCharacter().Level,
killer.GetCharacter().Xp))
{
killer.GetCharacter().Level++;
Battle.GameLevelUp(CurrentStage.GetTraits().Players, killer.GetMuid(),
killer.GetCharacter().Level);
EventManager.AddCallback(
() =>
Globals.GunzDatabase.UpdateLevel(killer.GetCharacter().CharacterId,
killer.GetCharacter().Xp,
killer.GetCharacter().Level));
}
}
killer.ClientPlayer.PlayerStats.Kills++;
victim.ClientPlayer.PlayerStats.Deaths++;
if (killer.ClientPlayer.PlayerStats.Kills%20 == 0)
{
EventManager.AddCallback(
() =>
Globals.GunzDatabase.UpdateLevel(killer.GetCharacter().CharacterId,
killer.GetCharacter().Xp,
killer.GetCharacter().Level));
}
}
}
OnGameKill(killer, victim);
}
示例15: Notify
public static void Notify(Client client, Int32 error)
{
using (var packet = new PacketWriter(Operation.MatchNotify, CryptFlags.Encrypt))
{
packet.Write(error);
client.Send(packet);
}
}