本文整理汇总了C#中IRealmClient.Send方法的典型用法代码示例。如果您正苦于以下问题:C# IRealmClient.Send方法的具体用法?C# IRealmClient.Send怎么用?C# IRealmClient.Send使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRealmClient
的用法示例。
在下文中一共展示了IRealmClient.Send方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendQuestConfirmAccept
public static void SendQuestConfirmAccept(IRealmClient client)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_QUEST_CONFIRM_ACCEPT))
{
packet.Write(0);
client.Send(packet);
}
}
示例2: HandleSystemStatusPacket
public static void HandleSystemStatusPacket(IRealmClient client, RealmPacketIn packet)
{
using (var repPacket = new RealmPacketOut(RealmServerOpCode.SMSG_GMTICKET_SYSTEMSTATUS, 4))
{
// TODO: Add indicator to Account for whether person may use ticket system
repPacket.Write(1);
client.Send(repPacket);
}
}
示例3: SendQueryTimeReply
/// <summary>
/// Send a "time query" reply to the client.
/// </summary>
/// <param name="client">the client to send to</param>
public static void SendQueryTimeReply(IRealmClient client)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_QUERY_TIME_RESPONSE, 4))
{
packet.Write(Utility.GetEpochTime());
//packet.Write(Utility.GetSystemTime());
client.Send(packet);
}
}
示例4: SendMirrorImageData
public static void SendMirrorImageData(IRealmClient client, NPC mirrorimage)
{
var owner = mirrorimage.PlayerOwner;
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MIRRORIMAGE_DATA, 68))
{
packet.Write(mirrorimage.EntityId);
packet.Write(owner.DisplayId);
if (owner != null) //player
{
packet.Write((byte)owner.Race);
packet.Write((byte)owner.Gender);
packet.Write((byte)owner.Class);
packet.Write(owner.Skin);
packet.Write(owner.Facial);
packet.Write(owner.HairStyle);
packet.Write(owner.HairColor);
packet.Write(owner.FacialHair);
packet.Write(owner.GuildId);
foreach(VisibleEquipmentSlot slot in Enum.GetValues(typeof(VisibleEquipmentSlot)))
{
var item = owner.Inventory.Equipment[(EquipmentSlot)slot];
if (slot == VisibleEquipmentSlot.Head && ((owner.PlayerFlags & PlayerFlags.HideHelm) != 0))
{
packet.Write(0);
}
else if (slot == VisibleEquipmentSlot.Back && ((owner.PlayerFlags & PlayerFlags.HideCloak) != 0))
{
packet.Write(0);
}
else if (item != null)
{
packet.Write(item.Template.DisplayId);
}
else
packet.Write(0);
}
}
else //creature
{
for (int i = 0; i < 14; i++)
{
packet.Write(0);
}
}
client.Send(packet);
}
}
示例5: SendTo
/// <summary>
/// Sends packet (might be compressed)
/// </summary>
/// <returns></returns>
public void SendTo(IRealmClient client)
{
if (TotalLength <= WCellDef.MAX_UNCOMPRESSED_UPDATE_PACKET)
{
client.Send(GetFinalizedPacket());
}
else
{
var segment = ((SegmentStream)BaseStream).Segment;
//var input = ((MemoryStream)BaseStream).ToArray();
var inputOffset = HeaderSize;
//Compression.CompressZLib(packetBuffer, outputBuffer, RealmServer.Instance.Configuration.CompressionLevel, out deflatedLength);
var length = ContentLength;
if (length > 0x7FFF)
{
log.Warn("Sent UpdatePacket with Length {0} to {1} in {2}", length, client,
client.ActiveCharacter.Zone as IWorldSpace ?? client.ActiveCharacter.Region);
}
var maxOutputLength = length + FullUpdatePacketHeaderSize;
var outSegment = BufferManager.GetSegment(maxOutputLength);
var deflater = new Deflater(RealmServerConfiguration.CompressionLevel);
deflater.SetInput(segment.Buffer.Array, segment.Offset + inputOffset, length);
//deflater.SetInput(input, 0 + inputOffset, length);
deflater.Finish();
int deflatedLength = deflater.Deflate(outSegment.Buffer.Array,
outSegment.Offset + FullUpdatePacketHeaderSize, length);
var totalLength = deflatedLength + FullUpdatePacketHeaderSize;
if (totalLength > MaxPacketSize)
{
//TODO: Split up packet if packet size exceeds max length
throw new Exception("Compressed Update packet exceeded max length: " + totalLength);
}
SendPacket(client, outSegment, totalLength, length);
outSegment.DecrementUsage();
}
}
示例6: HandleAuctionListPendingSales
public static void HandleAuctionListPendingSales(IRealmClient client, RealmPacketIn packet)
{
var chr = client.ActiveCharacter;
var auctioneerId = packet.ReadEntityId();
var auctioneer = chr.Map.GetObject(auctioneerId) as NPC;
var count = 1u;
using (var packetOut = new RealmPacketOut(RealmServerOpCode.SMSG_AUCTION_LIST_PENDING_SALES, 14 * (int)count))
{
packetOut.Write(count);
for (var i = 0; i < count; ++i)
{
packetOut.Write("");
packetOut.Write("");
packetOut.WriteUInt(0);
packetOut.WriteUInt(0);
packetOut.WriteFloat(0f);
client.Send(packetOut);
}
}
}
示例7: SendAddOnInfoPacket
public static void SendAddOnInfoPacket(IRealmClient client)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ADDON_INFO))
{
int unk;
using (var binReader = new BinaryReader(new MemoryStream(client.Addons)))
{
ClientAddOn addon;
var addonCount = binReader.ReadInt32();
for (var i = 0; i < addonCount; i++)
{
addon = ReadAddOn(binReader);
WriteAddOnInfo(packet, addon);
}
unk = binReader.ReadInt32();
}
Console.WriteLine("CMSG ADDON Unk: " + unk);
const int count = 0;
packet.Write(count);
for (int i = 0; i < count; i++)
{
packet.Write(0);
packet.Write(new byte[16]);
packet.Write(new byte[16]);
packet.Write(0);
packet.Write(0);
}
client.Send(packet);
}
client.Addons = null;
}
示例8: SendUnitCastStart
public static void SendUnitCastStart(IRealmClient client, SpellCast cast, WorldObject target)
{
// TODO: research and implement this.
// maybe sent for all targets in SpellCast object?
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_UNIT_SPELLCAST_START, 28))
{
cast.Caster.EntityId.WritePacked(packet); // caster pguid
target.EntityId.WritePacked(packet); // target pguid
packet.Write(cast.Spell.Id); // spell id
packet.Write(cast.Spell.CastDelay); // cast time?
packet.Write(cast.Spell.CastDelay); // cast time mod?
client.Send(packet);
}
}
示例9: SendSpellCooldown
/// <summary>
/// Send a custom cooldown time to the client
/// </summary>
public static void SendSpellCooldown(WorldObject caster, IRealmClient client, uint spellId, ushort cooldown)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SPELL_COOLDOWN, 14))
{
packet.Write(caster.EntityId.Full);
packet.WriteByte(0x00);// 1 = use category cooldown
packet.Write(spellId);
packet.Write((uint)cooldown); // if > 0, use this. If 0, use spell.RecoveryTime
client.Send(packet);
}
}
示例10: SendAuthChallenge
/// <summary>
/// Send packet generated by the server to initialize authentification
/// </summary>
/// <param name="client">the client to send to</param>
public static void SendAuthChallenge(IRealmClient client)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_AUTH_CHALLENGE))
{
packet.Write(1); // 1...31
packet.Write(RealmServer.Instance.AuthSeed);
// new 3.2.2 random data
packet.WriteUInt(0xF3539DA3);
packet.WriteUInt(0x6E8547B9);
packet.WriteUInt(0x9A6AA2F8);
packet.WriteUInt(0xA4F170F4);
packet.WriteUInt(0xF3539DA3);
packet.WriteUInt(0x6E8547B9);
packet.WriteUInt(0x9A6AA2F8);
packet.WriteUInt(0xA4F170F4);
client.Send(packet);
}
}
示例11: 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;
}
}
示例12: SendAuthSuccessful
public static void SendAuthSuccessful(IRealmClient client)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_AUTH_RESPONSE, 11))
{
packet.WriteByte((byte)LoginErrorCode.AUTH_OK);
//BillingTimeRemaining
packet.Write(0);
packet.Write((byte)0x02);// BillingPlan Flags
// 0x2, 0x4, 0x10 mutually exclusive. Order of Precedence: 0x2 > 0x4 > 0x10
// 0x2 -> No Time left?
// 0x20
// 0x8
// BillingTimeRested
packet.Write(0);
packet.Write((byte)client.Account.ClientId);
client.Send(packet);
}
ClientAddonHandler.SendAddOnInfoPacket(client);
RealmServer.Instance.OnClientAccepted(null, null);
}
示例13: SendAuthQueueStatus
/// <summary>
/// Sends the number of currently queued clients.
/// </summary>
/// <param name="client">the client to send to</param>
public static void SendAuthQueueStatus(IRealmClient client)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_AUTH_RESPONSE))
{
packet.WriteByte((byte)LoginErrorCode.AUTH_WAIT_QUEUE);
packet.Write(AuthQueue.QueuedClients + 1);
client.Send(packet);
}
}
示例14: SendLogoutCancelReply
/// <summary>
/// Sends a "logout cancel" reply to the client.
/// </summary>
/// <param name="client">the client to send to</param>
public static void SendLogoutCancelReply(IRealmClient client)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_LOGOUT_CANCEL_ACK, 0))
{
client.Send(packet);
}
}
示例15: SendWorldStateUITimerUpdate
public static void SendWorldStateUITimerUpdate(IRealmClient client)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_WORLD_STATE_UI_TIMER_UPDATE, 0))
{
packet.WriteDateTime(DateTime.Now); // unk?
client.Send(packet);
}
}