本文整理汇总了C#中RealmPacketOut.WriteULong方法的典型用法代码示例。如果您正苦于以下问题:C# RealmPacketOut.WriteULong方法的具体用法?C# RealmPacketOut.WriteULong怎么用?C# RealmPacketOut.WriteULong使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RealmPacketOut
的用法示例。
在下文中一共展示了RealmPacketOut.WriteULong方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendBattlegroundWindow
/// <summary>
/// Sends the packet to show the battleground window
/// </summary>
/// <param name="client"></param>
/// <param name="speaker"></param>
/// <param name="character"></param>
/// <returns></returns>
public bool SendBattlegroundWindow(IRealmClient client, NPC speaker, Character character)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_BATTLEFIELD_LIST))
{
packet.WriteULong(speaker != null ? speaker.EntityId.Full : 0);
packet.WriteUInt((uint)m_bgqueue.Template.BgID);
packet.WriteByte(m_battlegroupId); //Battle group
// TODO: Add sync'ing?
//m_syncLock.EnterReadLock();
try
{
packet.WriteUInt(m_battlegrounds.Count); //Count
foreach (var bg in m_battlegrounds.Values)
{
packet.WriteUInt(bg.InstanceId);
}
}
finally
{
//m_syncLock.ExitReadLock();
}
client.Send(packet);
return true;
}
}
示例2: SendInventoryError
/// <summary>
/// item1 and item2 can be null, but item1 must be set in case of YOU_MUST_REACH_LEVEL_N.
/// </summary>
/// <param name="client"></param>
/// <param name="error"></param>
public static void SendInventoryError(IPacketReceiver client, InventoryError error)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_INVENTORY_CHANGE_FAILURE,
error == InventoryError.YOU_MUST_REACH_LEVEL_N ? 22 : 18))
{
packet.WriteByte((byte)error);
packet.WriteULong(0);
packet.WriteULong(0);
packet.WriteByte(0);
client.Send(packet);
}
}
示例3: SendPetitionRename
public static void SendPetitionRename(IPacketReceiver client, PetitionCharter petition)
{
var name = petition.Petition.Name;
using (var packet = new RealmPacketOut(RealmServerOpCode.MSG_PETITION_RENAME, 8 + name.Length + 1))
{
packet.WriteULong(petition.EntityId.Full);
packet.WriteCString(name);
client.Send(packet);
}
}
示例4: SendPetitionQueryResponse
public static void SendPetitionQueryResponse(IPacketReceiver client, PetitionCharter charter)
{
string name = charter.Petition.Name;
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PETITION_QUERY_RESPONSE, 4 + 8 + name.Length + 1 + 1 + 4 * 12 + 2 + 10))
{
packet.WriteUInt(charter.EntityId.Low);
packet.WriteULong(charter.Owner.EntityId.Full);
packet.WriteCString(name);
packet.WriteByte(0);
var type = (uint)charter.Petition.Type;
if(type == (uint)PetitionType.Guild)
{
packet.WriteUInt(type);
packet.WriteUInt(type);
packet.WriteUInt(0);
}
else
{
packet.WriteUInt(type-1);
packet.WriteUInt(type-1);
packet.WriteUInt(type);
}
packet.WriteUInt(0);
packet.WriteUInt(0);
packet.WriteUInt(0);
packet.WriteUInt(0);
packet.WriteUShort(0);
packet.WriteUInt(0);
packet.WriteUInt(0);
packet.WriteUInt(0);
for(int i = 0; i < 10; ++i)
packet.WriteByte(0);
packet.WriteUInt(0);
if(type == (uint)PetitionType.Guild)
packet.WriteUInt(0);
else
packet.WriteUInt(1);
client.Send(packet);
}
}
示例5: SendPetitionSignatures
public static void SendPetitionSignatures(IPacketReceiver client, PetitionCharter charter)
{
var signs = charter.Petition.SignedIds;
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PETITION_SHOW_SIGNATURES, 8+8+4+1+signs.Count*12))
{
packet.WriteULong(charter.EntityId.Full);
packet.WriteULong(charter.Owner.EntityId.Full);
packet.WriteUInt(charter.EntityId.Low);
packet.WriteByte(signs.Count);
foreach(var guid in signs)
{
packet.WriteULong(guid);
packet.WriteUInt(0);
}
client.Send(packet);
}
}
示例6: SendPetitionDecline
public static void SendPetitionDecline(IPacketReceiver client, Character chr, PetitionRecord record)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.MSG_PETITION_DECLINE, 8))
{
var character = World.GetCharacter(record.OwnerId);
if(character != null)
{
packet.WriteULong(chr.EntityId.Full);
character.Client.Send(packet);
}
}
}
示例7: SendEnvironmentDamage
/// <summary>
/// Usually caused by jumping too high, diving too long, standing too close to fire etc
/// </summary>
public static void SendEnvironmentDamage(WorldObject target, EnviromentalDamageType type, uint totalDamage)
{
using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_ENVIRONMENTALDAMAGELOG, 21)) {
target.EntityId.WritePacked(packet);
packet.WriteByte((byte)type);
packet.WriteUInt(totalDamage);
packet.WriteULong(0);
target.PushPacketToSurroundingArea(packet, true, false);
}
}
示例8: BuildAuctionPacket
public static bool BuildAuctionPacket(Auction auction, RealmPacketOut packet)
{
var item = AuctionMgr.Instance.AuctionItems[auction.ItemLowId];
if (item == null)
return false;
var timeleft = auction.TimeEnds - DateTime.Now;
if (timeleft.TotalMilliseconds < 0)
return false;
packet.Write(auction.ItemLowId);
packet.Write(item.Template.Id);
for (var i = 0; i < 7; i++)
{
if (item.EnchantIds != null)
{
packet.Write(item.EnchantIds[i]);
packet.Write(i); // enchant duration
packet.Write(item.GetEnchant((EnchantSlot)i).Charges); // TODO: Fix enchant charges
}
else
{
packet.Write(0);
packet.Write(0);
packet.Write(0);
}
}
packet.Write(item.RandomProperty);
packet.Write(item.RandomSuffix);
packet.Write(item.Amount);
packet.Write((uint)item.Charges);
packet.WriteUInt(0); //Unknown
packet.WriteULong(auction.OwnerLowId);
packet.Write(auction.CurrentBid); //auction start bid
packet.WriteUInt(AuctionMgr.GetMinimumNewBidIncrement(auction)); //amount required to outbid
packet.Write(auction.BuyoutPrice);
packet.Write((int)timeleft.TotalMilliseconds);
packet.WriteULong(auction.BidderLowId);
packet.Write(auction.CurrentBid);
return true;
}
示例9: BuildAuctionPacket
public static void BuildAuctionPacket(Auction auction, RealmPacketOut packet)
{
var item = AuctionMgr.Instance.AuctionItems[auction.ItemLowId];
if (item == null)
return;
var timeleft = auction.TimeEnds - DateTime.Now;
if (timeleft.Milliseconds < 0)
return;
packet.Write(auction.ItemLowId);
packet.Write(item.Template.Id);
for (var i = 0; i < 6; i++)
{
if (item.EnchantIds != null)
{
packet.Write(item.EnchantIds[i]);
packet.Write(i); // enchant slot?
packet.Write(3); // TODO: Fix enchant charges
}
else
{
packet.Write(0);
packet.Write(0);
packet.Write(0);
}
}
//packet.Write(item.RandomPropertiesId);
packet.Write(0);
packet.Write(item.RandomSuffix);
packet.WriteUInt(0);
packet.WriteUInt(0);
packet.WriteUInt(0);
packet.Write(item.Amount);
packet.WriteUInt(0);
packet.WriteUInt(0);
packet.WriteULong(auction.OwnerLowId);
packet.Write(auction.CurrentBid); //auction start bid
packet.Write(50);
packet.Write(auction.BuyoutPrice);
packet.Write(timeleft.Milliseconds);
packet.WriteULong(auction.BidderLowId);
packet.Write(auction.CurrentBid);
}
示例10: CreateArenaTeamRosterResponsePacket
private static RealmPacketOut CreateArenaTeamRosterResponsePacket(ArenaTeam team)
{
var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ARENA_TEAM_ROSTER, 100);
packet.WriteUInt(team.Id);
packet.WriteByte(0);
packet.WriteUInt(team.MemberCount);
packet.WriteUInt(team.Type);
foreach (var member in team.Members.Values)
{
packet.WriteULong(member.Character.EntityId.Full);
var pl = World.GetCharacter(member.Character.EntityId.Low);
packet.WriteByte((pl != null) ? 1 : 0);
packet.WriteCString(member.Character.Name);
packet.WriteByte((team.Leader == member) ? 0 : 1);
packet.WriteByte((pl != null) ? pl.Level : 0);
packet.WriteUInt((uint)member.Class);
packet.WriteUInt(member.GamesWeek);
packet.WriteUInt(member.WinsWeek);
packet.WriteUInt(member.GamesSeason);
packet.WriteUInt(member.WinsSeason);
packet.WriteUInt(member.PersonalRating);
packet.WriteFloat(0.0f);
packet.WriteFloat(0.0f);
}
return packet;
}
示例11: SendInventoryError
public static void SendInventoryError(RealmClient client, Item item1, Item item2, InventoryError error)
{
using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_INVENTORY_CHANGE_FAILURE,
error == InventoryError.YOU_MUST_REACH_LEVEL_N ? 22 : 18))
{
packet.WriteByte((byte)error);
if (error == InventoryError.YOU_MUST_REACH_LEVEL_N)
{
packet.WriteUInt(item1.Template.RequiredLevel);
}
if (item1 != null)
{
packet.Write(item1.EntityId.Full);
}
else
{
packet.WriteULong(0);
}
if (item2 != null)
{
packet.Write(item2.EntityId.Full);
}
else
{
packet.WriteULong(0);
}
packet.WriteByte(0);
client.Send(packet);
}
}