本文整理汇总了C#中Bunny.Core.Client.GetCharacter方法的典型用法代码示例。如果您正苦于以下问题:C# Client.GetCharacter方法的具体用法?C# Client.GetCharacter怎么用?C# Client.GetCharacter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Bunny.Core.Client
的用法示例。
在下文中一共展示了Client.GetCharacter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
示例2: CreateClan
public int CreateClan(string clanName, Client master, Client member1, Client member2, Client member3, Client member4)
{
Execute(string.Format("INSERT INTO Clan (Name,MasterCID,RegDate) VALUES ('{0}',{1},GetDate())", clanName, master.GetCharacter().CharacterId));
var clanId = GetIdentity(string.Format("select @@identity"));
Execute(string.Format("INSERT INTO ClanMember (CLID,CID,Grade,RegDate) VALUES ({0},{1}, 1, GetDate())", clanId, master.GetCharacter().CharacterId));
Execute(string.Format("INSERT INTO ClanMember (CLID,CID,Grade,RegDate) VALUES ({0},{1}, 9, GetDate())", clanId, member1.GetCharacter().CharacterId));
Execute(string.Format("INSERT INTO ClanMember (CLID,CID,Grade,RegDate) VALUES ({0},{1}, 9, GetDate())", clanId, member2.GetCharacter().CharacterId));
Execute(string.Format("INSERT INTO ClanMember (CLID,CID,Grade,RegDate) VALUES ({0},{1}, 9, GetDate())", clanId, member3.GetCharacter().CharacterId));
Execute(string.Format("INSERT INTO ClanMember (CLID,CID,Grade,RegDate) VALUES ({0},{1}, 9, GetDate())", clanId, member4.GetCharacter().CharacterId));
return clanId;
}
示例3: ProcessCharInfo
public static void ProcessCharInfo(Client client, PacketReader packetReader)
{
var index = packetReader.ReadByte();
if (index < 0 || index > 4)
{
client.Disconnect();
return;
}
client.GetCharacter().CharNum = index;
client.GetCharacter().UGrade = client.ClientPlayer.PlayerAccount.Access;
Globals.GunzDatabase.GetCharacter(client.ClientPlayer.PlayerAccount.AccountId, index, client.GetCharacter());
Match.ResponseCharInfo(client);
}
示例4: ProcessRecommendedChannel
public static void ProcessRecommendedChannel(Client client, PacketReader packet)
{
if (client.GetCharacter().ClanId == 0)
client.ClientPlayer.PlayerChannel = ChannelList.Recommend(client.GetCharacter().Level);
else
{
client.ClientPlayer.PlayerChannel = ChannelList.Recommend(client.GetCharacter().Level, true, client.GetCharacter().ClanName);
}
Match.ResponseRecommendedChannel(client, client.GetChannel().GetTraits().ChannelId);
if (client.GetCharacter().ClanId != 0)
{
ClanPackets.MemberConnected(client, client.GetCharacter().Name);
}
}
示例5: 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);
}
示例6: ProcessEquipItem
public static void ProcessEquipItem(Client client, PacketReader packetReader)
{
var uidChar = packetReader.ReadUInt64();
var nItemLow = packetReader.ReadInt32();
var nItemHigh = packetReader.ReadInt32();
var nItemSlot = packetReader.ReadInt32();
Results result = Results.Accepted;
if (!Enum.IsDefined(typeof(ItemSlotType), nItemSlot))
{
client.Disconnect();
return;
}
Items.Item nItem = client.GetCharacter().Items.Find(i => i.ItemCid == nItemHigh);
if (nItem == null)
result = Results.ShopItemNonExistant;
else if (nItem.Level > client.GetCharacter().Level)
{
result = Results.ShopLevelTooLow;
}
else if ((ItemSlotType)nItemSlot == ItemSlotType.primary_slot && nItem.ItemId == client.GetCharacter().EquippedItems[(int)ItemSlotType.secondary_slot].ItemId)
{
result = Results.ShopInvalidItem;
}
else if ((ItemSlotType)nItemSlot == ItemSlotType.secondary_slot && nItem.ItemId == client.GetCharacter().EquippedItems[(int)ItemSlotType.primary_slot].ItemId)
{
result = Results.ShopInvalidItem;
}
else
{
client.GetCharacter().EquippedItems[nItemSlot].ItemCid = nItemHigh;
client.GetCharacter().EquippedItems[nItemSlot].ItemId = nItem.ItemId;
Globals.GunzDatabase.UpdateSlot(client.GetCharacter().CharacterId, (ItemSlotType)nItemSlot, nItemHigh);
}
Match.ResponseEquipItem(client, result);
Match.ResponseCharacterItemList(client);
}
示例7: Join
public void Join(Client client)
{
var result = Results.Accepted;
if (_traits.Players.Count == _traits.MaxPlayers && _traits.MaxPlayers != 0)
{
result = Results.StageRoomFull;
StagePackets.ResponseStageJoin(client, result);
}
else if (_traits.Level != 0 && !(client.GetCharacter().Level > _traits.Level && client.GetCharacter().Level < _traits.Level + 10))
{
result = Results.StageInvalidLevel;
StagePackets.ResponseStageJoin(client, result);
}
else
{
client.ClientPlayer.PlayerStage = this;
client.ClientFlags = PacketFlags.Stage;
client.ClientPlayer.PlayerLocation = Place.Stage;
_traits.Players.Add(client);
lock (ObjectLock)
{
StagePackets.ResponseStageJoin(client, result);
StagePackets.ResponseObjectCache(client, ObjectCache.Expire, _traits.Players);
StagePackets.ResponseStageMaster(_traits.Players, this);
var clients = _traits.Players.FindAll(c => c != client);
StagePackets.ResponseObjectCacheExclusive(clients, ObjectCache.Keep, client);
StagePackets.ResponseStageMaster(_traits.Players, this);
Channel.Refresh(client);
}
}
}
示例8: AskAgreement
public static void AskAgreement(List<Client> clients, Client proposer, int mode, int request)
{
using (var packet = new PacketWriter(Operation.MatchAskAgreement, CryptFlags.Encrypt))
{
packet.Write(proposer.GetMuid());
packet.Write(clients.Count+1, 32);
clients.ForEach(c => packet.Write(c.GetCharacter().Name, 32));
packet.Write(proposer.GetCharacter().Name, 32);
packet.Write(mode);
packet.Write(request);
clients.ForEach(c => c.Send(packet));
}
}
示例9: ProcessBuyItem
public static void ProcessBuyItem(Client client, PacketReader packetReader)
{
var uid = packetReader.ReadUInt64();
var itemid = packetReader.ReadInt32();
var count = packetReader.ReadInt32();
Results result = Results.Accepted;
Items.Item item = ItemList.Find(itemid);
if (item == null)
result = Results.ShopItemNonExistant;
else if ((item.Price > client.GetCharacter().Bp && Globals.Config.Items.UseBounty) || count > 0 && item.Price * count > client.GetCharacter().Bp && Globals.Config.Items.UseBounty)
result = Results.ShopInsufficientBounty;
else if (client.GetCharacter().Items.Count == Globals.Config.Character.MaxItems)
result = Results.ShopInventoryFull;
else
{
var temp = new Items.Item();
temp.ItemId = item.ItemId;
temp.Level = item.Level;
temp.MaxWeight = item.MaxWeight;
temp.Weight = item.Weight;
temp.Price = item.Price;
temp.Quantity = count;
temp.ItemCid = Globals.GunzDatabase.AddItem(client.GetCharacter().CharacterId, item.ItemId, count);
client.GetCharacter().Items.Add(temp);
if (Globals.Config.Items.UseBounty)
{
client.GetCharacter().Bp -= item.Price;
Globals.GunzDatabase.UpdateBp(client.GetCharacter().Bp, client.GetCharacter().CharacterId);
}
}
Match.ResponseBuyItem(client, result);
Match.ResponseCharacterItemList(client);
}
示例10: ResponseMySimpleCharInfo
public static void ResponseMySimpleCharInfo(Client client)
{
using (var packet = new PacketWriter(Operation.MatchResponseMySimpleCharInfo, CryptFlags.Encrypt))
{
packet.Write(1, 9);
packet.Write((int)client.GetCharacter().Xp);
packet.Write((int)client.GetCharacter().Bp);
packet.Write((byte)client.GetCharacter().Level);
client.Send(packet);
}
}
示例11: ResponseSelectCharacter
public static void ResponseSelectCharacter(Client client)
{
using (var packet = new PacketWriter(Operation.MatchResponseSelectChar, CryptFlags.Encrypt))
{
packet.Write(0);
packet.Write(client.GetCharacter(), false);
packet.Write(1,1);
packet.Write((byte)ExpManager.PercentToNextLevel((int)client.GetCharacter().Xp));
client.Send(packet);
}
}
示例12: ProcessResponseAgreement
public static void ProcessResponseAgreement(Client client, PacketReader packetReader)
{
var uidProposer = packetReader.ReadMuid();
var uidChar = packetReader.ReadMuid();
var name = packetReader.ReadString();
var proposal = packetReader.ReadInt32();
var request = packetReader.ReadInt32();
var agreement = packetReader.ReadBoolean();
PendingClanWarRequest pc = Globals.PendingClanWar.Find(p => p.ClanName == client.GetCharacter().ClanName);
if (agreement == true)
{
lock (Globals.PendingClanWar)
{
pc.Players.Find(p => p.First == client).Second = true;
}
}
lock (Globals.PendingClanWar)
{
if (pc.Players.FindAll(p => p.Second).Count == pc.Players.Count)
{
List<Client> players = new List<Client>();
foreach (var p in pc.Players)
players.Add(p.First);
players.Add(pc.Requester);
ClanPackets.SearchRival(players);
Globals.PendingClanWar.Remove(pc);
ClanWarHandler.FindMatch(players);
}
}
}
示例13: RequestJoin
public static void RequestJoin(Client client, Client target, string clanName)
{
using (var packet = new PacketWriter(Operation.MatchClanAskJoinAgreement, CryptFlags.Encrypt))
{
packet.Write(clanName);
packet.Write(client.GetMuid());
packet.Write(client.GetCharacter().Name);
target.Send(packet);
}
}
示例14: ProcessPromoteMember
public static void ProcessPromoteMember(Client client, PacketReader packetReader)
{
if (client.GetCharacter().ClanId < 1 || client.GetCharacter().ClanGrade != ClanGrade.Master)
return;
var sender = packetReader.ReadMuid();
var member = packetReader.ReadString();
var rank = packetReader.ReadInt32();
if (!Enum.IsDefined(typeof(ClanGrade), rank))
{
client.Disconnect();
return;
}
Client memberClient = TcpServer.GetClientFromName(member);
if (memberClient != null)
{
memberClient.GetCharacter().ClanGrade = (ClanGrade)rank;
Globals.GunzDatabase.UpdateMember(memberClient.GetCharacter().CharacterId, rank);
}
ClanPackets.ResponseChangeGrade(client);
ClanPackets.UpdateClanCharInfo(memberClient);
ClanPackets.SendMemberList(client);
}
示例15: ProcessRequestProposal
public static void ProcessRequestProposal(Client client, PacketReader packetReader)
{
var uid = packetReader.ReadMuid();
var mode = packetReader.ReadInt32();
var request = packetReader.ReadInt32();
var memberCount = packetReader.ReadInt32();
var totalSize = packetReader.ReadInt32();
var blobSize = packetReader.ReadInt32();
var blobCount = packetReader.ReadInt32();
List<byte[]> blob = new List<byte[]>();
if (memberCount == blobCount)
{
for (int i = 0; i < blobCount; ++i)
{
var temp = new byte[blobSize];
packetReader.Read(temp, 0, blobSize);
blob.Add(temp);
}
}
else
{
client.Disconnect();
return;
}
List<Client> requests = new List<Client>();
foreach (byte[] b in blob)
{
string s = System.Text.ASCIIEncoding.ASCII.GetString(b);
s = s.Substring(0, s.IndexOf('\0'));
requests.Add(TcpServer.GetClientFromName(s));
}
if (requests.FindAll(c => c.GetCharacter().ClanId == client.GetCharacter().ClanId).Count == memberCount)
{
List<Pair<Client, bool>> list = new List<Pair<Client, bool>>();
foreach (Client c in requests)
{
list.Add(new Pair<Client, bool>(c, false));
}
list.Add(new Pair<Client, bool>(client, true));
ClanPackets.AskAgreement(requests, client, mode, request);
ClanPackets.ResponseProposal(client, 0, mode, request);
PendingClanWarRequest pc = new PendingClanWarRequest();
pc.RequestId = request;
pc.Players = list;
pc.ClanName = client.GetCharacter().ClanName;
pc.Requester = client;
pc.RequestMode = mode;
lock(Globals.PendingClanWar)
Globals.PendingClanWar.Add(pc);
var responsetimer = new Timer(30000);
responsetimer.Elapsed += (s, o) => CancelClanWarRequest(client, pc, responsetimer);
responsetimer.Start();
}
}