本文整理汇总了C#中RealmPacketOut.WriteUInt方法的典型用法代码示例。如果您正苦于以下问题:C# RealmPacketOut.WriteUInt方法的具体用法?C# RealmPacketOut.WriteUInt怎么用?C# RealmPacketOut.WriteUInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RealmPacketOut
的用法示例。
在下文中一共展示了RealmPacketOut.WriteUInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SendTitleEarned
public static void SendTitleEarned(Character character, CharacterTitleEntry titleEntry, bool lost)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_TITLE_EARNED, 4 + 4))
{
packet.WriteUInt((uint) titleEntry.BitIndex);
packet.WriteUInt(lost ? 0 : 1);
character.Send(packet);
}
}
示例2: SendAchievementEarned
//SMSG_ACHIEVEMENT_EARNED
public static void SendAchievementEarned(AchievementEntryId achievementEntryId, Character chr)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ACHIEVEMENT_EARNED, 8 + 4 + 4))
{
chr.EntityId.WritePacked(packet);
packet.WriteUInt((uint)achievementEntryId);
packet.WriteDateTime(DateTime.Now);
packet.WriteUInt(0);
chr.SendPacketToArea(packet, true);
}
}
示例3: SendServerFirstAchievement
//SMSG_SERVER_FIRST_ACHIEVEMENT
public static void SendServerFirstAchievement(AchievementEntryId achievementEntryId, Character chr)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SERVER_FIRST_ACHIEVEMENT, chr.Name.Length + 1 + 8 + 4 + 4))
{
packet.WriteCString(chr.Name);
packet.Write(chr.EntityId);
packet.WriteUInt((uint)achievementEntryId);
packet.WriteUInt(0);
World.Broadcast(packet);
}
}
示例4: SendResult
/// <summary>
/// Sends result of actions connected with arenas
/// </summary>
/// <param name="client">the client to send to</param>
/// <param name="commandId">command executed</param>
/// <param name="name">name of player event has happened to</param>
/// <param name="resultCode">The <see cref="ArenaTeamResult"/> result code</param>
public static void SendResult(IPacketReceiver client, ArenaTeamCommandId commandId, string team, string player,
ArenaTeamResult resultCode)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ARENA_TEAM_COMMAND_RESULT))
{
packet.WriteUInt((uint)commandId);
packet.WriteCString(team);
packet.WriteCString(player);
packet.WriteUInt((uint)resultCode);
client.Send(packet);
}
}
示例5: CreateArenaTeamStatsResponsePacket
private static RealmPacketOut CreateArenaTeamStatsResponsePacket(ArenaTeam team)
{
var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ARENA_TEAM_STATS, 4*7);
packet.WriteUInt((byte)team.Id);
packet.WriteUInt(team.Stats.rating);
packet.WriteUInt(team.Stats.gamesWeek);
packet.WriteUInt(team.Stats.winsWeek);
packet.WriteUInt(team.Stats.gamesSeason);
packet.WriteUInt(team.Stats.winsSeason);
packet.WriteUInt(team.Stats.rank);
return packet;
}
示例6: CreateAchievementEarnedToGuild
public static RealmPacketOut CreateAchievementEarnedToGuild(AchievementEntryId achievementEntryId, Character chr)
{
// Must be a better way to do this.
const string msg = "|Hplayer:$N|h[$N]|h has earned the achievement $a!";
var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT);
packet.WriteByte((byte) ChatMsgType.Achievment);
packet.WriteUInt((uint) ChatLanguage.Universal);
packet.Write(chr.EntityId);
packet.WriteUInt(5);
packet.Write(chr.EntityId);
packet.WriteUIntPascalString(msg);
packet.WriteByte(0);
packet.WriteUInt((uint) achievementEntryId);
return packet;
}
示例7: SendRealmStateResponse
public static void SendRealmStateResponse(IPacketReceiver client, uint realmNo)
{
//uint realmSplitState = 0;
// realmNo = 0;
const RealmState realmState = RealmState.Normal;
var splitDate = "01/01/01";
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_REALM_SPLIT, 8 + 1 + splitDate.Length))
{
packet.WriteUInt(realmNo);
packet.WriteUInt((uint)realmState);
packet.WriteCString(splitDate);
client.Send(packet);
}
}
示例8: 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;
}
}
示例9: SendPeriodicDamage
/// <summary>
/// Used for Periodic leech effects, mostly Cannibalism
/// </summary>
/// <returns></returns>
public static void SendPeriodicDamage(WorldObject caster, WorldObject target, uint spellId, AuraTickFlags type,
int amount)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PERIODICAURALOG, 32))
{
caster.EntityId.WritePacked(packet);
target.EntityId.WritePacked(packet);
packet.WriteUInt(spellId);
packet.WriteUInt(1); // count
packet.WriteUInt((uint)type);
packet.WriteUInt(amount);
target.SendPacketToArea(packet, true);
}
}
示例10: SendPeriodicAuraLog
/// <summary>
/// Used for any PeriodicAura (repeating ticks)
/// </summary>
/// <param name="extra">Always seems to be one</param>
public static void SendPeriodicAuraLog(IPacketReceiver client, WorldObject caster, WorldObject target,
uint spellId, uint extra, AuraTickFlags flags, int amount)
{
// TODO: Update struct for 3.0.2
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_PERIODICAURALOG, 32))
{
caster.EntityId.WritePacked(packet);
target.EntityId.WritePacked(packet);
packet.WriteUInt(spellId);
packet.WriteUInt(extra);
packet.WriteUInt((uint)flags);
packet.WriteUInt(amount);
target.SendPacketToArea(packet, true);
}
}
示例11: CreateArenaTeamQueryResponsePacket
private static RealmPacketOut CreateArenaTeamQueryResponsePacket(ArenaTeam team)
{
var packet = new RealmPacketOut(RealmServerOpCode.SMSG_ARENA_TEAM_QUERY_RESPONSE, 4*7+team.Name.Length+1);
packet.WriteUInt((byte)team.Id);
packet.WriteCString(team.Name);
packet.WriteUInt(team.Type);
/* TO-DO : Implement Emblem
* packet.WriteUInt(team.Emblem.backgroundColor);
packet.WriteUInt(team.Emblem.emblemStyle);
packet.WriteUInt(team.Emblem.emblemColor);
packet.WriteUInt(team.Emblem.borderStyle);
packet.WriteUInt(team.Emblem.borderColor);
*/
return packet;
}
示例12: CreateChatPacket
/// <summary>
/// Creates a packet
/// </summary>
public static RealmPacketOut CreateChatPacket(ChatMsgType type, ChatLanguage language, string msg, ChatTag tag)
{
var packet = new RealmPacketOut(RealmServerOpCode.SMSG_MESSAGECHAT, 23 + msg.Length);
packet.WriteByte((byte)type); // 1
packet.WriteUInt((uint)language); // 5
packet.WriteUIntPascalString(msg); // 22 + msg.Length
packet.WriteByte((byte)tag); // 23 + msg.Length
return packet;
}
示例13: SendLearnedSpell
public static void SendLearnedSpell(IPacketReceiver client, uint spellId)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_LEARNED_SPELL, 4))
{
packet.WriteUInt(spellId);
packet.WriteUShort(0); // 3.3.3a
client.Send(packet);
}
}
示例14: SendWhoList
/// <summary>
/// Sends to the specified client the Who List based on the given characters
/// </summary>
/// <param name="client">The client to send the list</param>
/// <param name="characters">The list of characters that matched the Who List search</param>
public static void SendWhoList(IPacketReceiver client, ICollection<Character> characters)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_WHO))
{
packet.Write(characters.Count);
packet.Write(characters.Count);
foreach (Character character in characters)
{
packet.WriteCString(character.Name);
packet.WriteCString(character.Guild != null ? character.Guild.Name : string.Empty); //TODO: Add Guild name here
packet.Write(character.Level);
packet.WriteUInt((byte)character.Class);
packet.WriteUInt((byte)character.Race);
packet.WriteByte(0); //New in 2.4.x
packet.Write(character.Zone != null ? (uint)character.Zone.Id : 0);
}
client.Send(packet);
}
}
示例15: 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);
}
}
}