本文整理汇总了C#中IRealmClient类的典型用法代码示例。如果您正苦于以下问题:C# IRealmClient类的具体用法?C# IRealmClient怎么用?C# IRealmClient使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IRealmClient类属于命名空间,在下文中一共展示了IRealmClient类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: HandleTextEmote
public static void HandleTextEmote(IRealmClient client, RealmPacketIn packet)
{
var chr = client.ActiveCharacter;
if (!chr.CanMove || !chr.CanInteract) return;
var emote = (TextEmote)packet.ReadUInt32();
packet.SkipBytes(4);
var targetId = packet.ReadEntityId();
var target = chr.Map.GetObject(targetId) as INamed;
if (target != null)
{
SendTextEmote(chr, emote, target);
}
EmoteType animation;
EmoteDBC.EmoteRelationReader.Entries.TryGetValue((int)emote, out animation);
switch (animation)
{
//The client seems to handle these on its own.
case EmoteType.StateSleep:
case EmoteType.StateSit:
case EmoteType.StateKneel:
case EmoteType.StateDance:
chr.EmoteState = animation;
break;
default:
chr.Emote(animation);
break;
}
//todo: Achievement and scripting hooks/events.
}
开发者ID:ebakkedahl,项目名称:WCell,代码行数:33,代码来源:EmoteHandler.cs
示例2: HandleGossipHello
public static void HandleGossipHello(IRealmClient client, RealmPacketIn packet)
{
var targetEntityId = packet.ReadEntityId();
var chr = client.ActiveCharacter;
var target = chr.Region.GetObject(targetEntityId) as Unit;
if (target == null)
return;
if (chr.GossipConversation != null)
{
chr.GossipConversation = null;
}
var menu = target.GossipMenu;
if (menu == null)
return;
if (target is NPC)
{
if (!((NPC)target).CanInteractWith(chr))
{
return;
}
}
else if (!chr.Role.IsStaff)
{
return;
}
chr.OnInteract(target);
var conversation = new GossipConversation(menu, chr, target, menu.KeepOpen);
client.ActiveCharacter.GossipConversation = conversation;
conversation.DisplayCurrentMenu();
}
开发者ID:pallmall,项目名称:WCell,代码行数:35,代码来源:GossipHandler.cs
示例3: HandleGossipSelectOption
public static void HandleGossipSelectOption(IRealmClient client, RealmPacketIn packet)
{
var targetEntityId = packet.ReadEntityId();
var unknown = packet.ReadUInt32(); // usually Zero, sometimes in the thousands for quest givers, Same as the first int sent in SMSG_GOSSIP_MESSAGE
var selectedOption = packet.ReadUInt32();
string extra = string.Empty;
if (packet.Position < packet.Length)
{
extra = packet.ReadCString();
}
var chr = client.ActiveCharacter;
var worldObject = chr.Region.GetObject(targetEntityId);
if (worldObject == null)
return;
var conversation = chr.GossipConversation;
if (conversation == null || conversation.Speaker != worldObject)
return;
conversation.HandleSelectedItem(selectedOption, extra);
}
开发者ID:pallmall,项目名称:WCell,代码行数:25,代码来源:GossipHandler.cs
示例4: NameQueryRequest
public static void NameQueryRequest(IRealmClient client, RealmPacketIn packet)
{
var id = packet.ReadEntityId();
ILivingEntity entity = client.ActiveCharacter;
if (entity.EntityId.Low != id.Low)
{
entity = World.GetNamedEntity(id.Low) as ILivingEntity;
}
if (entity != null)
{
SendNameQueryReply(client, entity);
}
else
{
RealmServer.IOQueue.AddMessage(new Message(() =>
{
var record = CharacterRecord.LoadRecordByEntityId(id.Low);
if (record == null)
{
s_log.Warn("{0} queried name of non-existing Character: " + id, client);
}
else
{
SendNameQueryReply(client, record);
}
}));
}
}
开发者ID:Jeroz,项目名称:WCell,代码行数:31,代码来源:QueryHandler.cs
示例5: RepairItem
public static void RepairItem(IRealmClient client, NPC armorer, EntityId itemId, bool useGuildFunds)
{
var curChar = client.ActiveCharacter;
uint totalCost = 0;
if (itemId.Low != 0)
{
// Repairing an individual item.
var item = GetItemByEntityId(curChar, itemId);
if (item == null)
return;
if (!ArmorerCheatChecks(curChar, armorer, item))
return;
totalCost += RepairItem(curChar, armorer, item, useGuildFunds);
}
else
{
// Case Repair all
if (!ArmorerCheatChecks(curChar, armorer))
return;
totalCost += RepairAllItems(curChar, armorer, useGuildFunds);
}
if (useGuildFunds)
{
/****************************
* TODO: record the funds usage in the guild log
****************************/
}
}
开发者ID:KroneckerX,项目名称:WCell,代码行数:30,代码来源:ArmorerMgr.cs
示例6: HandleStopWatchingFaction
public static void HandleStopWatchingFaction(IRealmClient client, RealmPacketIn packet)
{
var reputationIndex = (FactionReputationIndex)packet.ReadInt32();
bool isInactive = packet.ReadBoolean();
client.ActiveCharacter.Reputations.SetInactive(reputationIndex, isInactive);
}
开发者ID:KroneckerX,项目名称:WCell,代码行数:7,代码来源:FactionHandler.cs
示例7: HandleJoin
public static void HandleJoin(IRealmClient client, RealmPacketIn packet)
{
var roles = packet.ReadUInt32();
packet.SkipBytes(2);
var dungeonsCount = packet.ReadByte();
if (dungeonsCount == 0)
return;
for (byte i = 0; i < dungeonsCount; ++i)
{
// dungeons id/type
var packedDungeon = packet.ReadUInt32();
var id = packedDungeon & 0x00FFFFFF;
var type = packedDungeon & 0xFF000000;
}
byte counter2 = packet.ReadByte();
packet.SkipBytes(counter2); // lua: GetLFGInfoLocal
string comment = packet.ReadCString();
//SendLfgJoinResult();
//SendLfgUpdate();
}
开发者ID:KroneckerX,项目名称:WCell,代码行数:25,代码来源:LFGHandler.cs
示例8: GroupAccept
public static void GroupAccept(IRealmClient client, RealmPacketIn packet)
{
var invitee = client.ActiveCharacter;
var listInviters = Singleton<RelationMgr>.Instance.GetPassiveRelations(invitee.EntityId.Low,
CharacterRelationType.GroupInvite);
var invite = listInviters.FirstOrDefault();
//Check if we got invited
if (invite == null)
return;
//Removes the group invite relation between the inviter and invitee
RelationMgr.Instance.RemoveRelation(invite);
var inviter = World.GetCharacter(invite.CharacterId);
if (inviter == null)
return;
//If the inviter isnt in a group already we create a new one
var inviterGroup = inviter.Group ?? new PartyGroup(inviter);
//Add the invitee to the group
inviterGroup.AddMember(invitee, true);
}
开发者ID:Stika,项目名称:WCell,代码行数:26,代码来源:GroupHandler.cs
示例9: HandleCancel
public static void HandleCancel(IRealmClient client, RealmPacketIn packet)
{
if (client.ActiveCharacter.Duel != null)
{
client.ActiveCharacter.Duel.Finish(DuelWin.Knockout, client.ActiveCharacter);
}
}
开发者ID:ray2006,项目名称:WCell,代码行数:7,代码来源:DuelHandler.cs
示例10: HandleCreateTicketPacket
public static void HandleCreateTicketPacket(IRealmClient client, RealmPacketIn packet)
{
var chr = client.ActiveCharacter;
if (chr.Ticket == null)
{
var map = (MapId)packet.ReadUInt32();
var x = packet.ReadFloat();
var y = packet.ReadFloat();
var z = packet.ReadFloat();
var msg = packet.ReadCString();
var type = (TicketType)packet.ReadUInt32(); // prev. unk0
var unk1 = packet.ReadByte(); // unk1, 1
var unk2 = packet.ReadUInt32(); // unk2, 0
var unk3 = packet.ReadUInt32(); // unk3, 0
var ticket = new Ticket(chr, msg, type);
TicketMgr.Instance.AddTicket(ticket);
chr.Ticket = ticket;
SendCreateResponse(client, TicketInfoResponse.Saved);
}
else
{
SendCreateResponse(client, TicketInfoResponse.Fail);
}
}
开发者ID:KroneckerX,项目名称:WCell,代码行数:27,代码来源:TicketHandler.cs
示例11: HandleDungeonDifficulty
public static void HandleDungeonDifficulty(IRealmClient client, RealmPacketIn packet)
{
var chr = client.ActiveCharacter;
if (chr.Map.IsInstance)
{
// Cannot change difficulty while in instance
return;
}
var difficultyIndex = packet.ReadUInt32();
var group = chr.Group;
if (group != null)
{
if (group.Leader.Character != chr)
{
// Only leader can change difficulty
return;
}
}
var instances = chr.Instances;
if (instances.TryResetInstances())
{
if (group != null)
{
group.DungeonDifficulty = difficultyIndex;
}
else
{
chr.DungeonDifficulty = (DungeonDifficulty)difficultyIndex;
}
}
}
开发者ID:ebakkedahl,项目名称:WCell,代码行数:35,代码来源:InstanceHandler.cs
示例12: HandleRemoveGlyph
public static void HandleRemoveGlyph(IRealmClient client, RealmPacketIn packet)
{
var slot = packet.ReadUInt32();
var chr = client.ActiveCharacter;
chr.RemoveGlyph((byte)slot);
SendTalentGroupList(chr.Talents);
}
开发者ID:ebakkedahl,项目名称:WCell,代码行数:7,代码来源:TalentHandler.cs
示例13: HandleLoot
public static void HandleLoot(IRealmClient client, RealmPacketIn packet)
{
var objId = packet.ReadEntityId();
var chr = client.ActiveCharacter;
var looter = chr.LooterEntry;
var looted = chr.Region.GetObject(objId);
if (looted != null)
{
looter.Release(); // make sure that the Character is not still looting something else
var loot = looted.Loot;
if (loot == null)
{
SendLootFail(chr, looted);
// TODO: Kneel and unkneel?
}
else if (looter.MayLoot(loot))
{
// we are either already a looter or become a new one
chr.CancelAllActions();
looter.Loot = loot;
SendLootResponse(chr, loot);
}
else
{
SendLootFail(chr, looted);
}
}
}
开发者ID:pallmall,项目名称:WCell,代码行数:31,代码来源:LootHandler.cs
示例14: GroupInviteRequest
public static void GroupInviteRequest(IRealmClient client, RealmPacketIn packet)
{
var inviteeName = packet.ReadCString();
var inviter = client.ActiveCharacter;
var group = inviter.Group;
Character invitee;
if (Group.CheckInvite(inviter, out invitee, inviteeName) == GroupResult.NoError)
{
var listInvitees = Singleton<RelationMgr>.Instance.GetRelations(inviter.EntityId.Low,
CharacterRelationType.GroupInvite);
if (group == null || listInvitees.Count < group.InvitesLeft)
{
BaseRelation inviteRelation = RelationMgr.CreateRelation(inviter.EntityId.Low,
invitee.EntityId.Low, CharacterRelationType.GroupInvite);
Singleton<RelationMgr>.Instance.AddRelation(inviteRelation);
// Target has been invited
Group.SendResult(inviter.Client, GroupResult.NoError, inviteeName);
SendGroupInvite(invitee.Client, inviter.Name);
}
}
}
开发者ID:Stika,项目名称:WCell,代码行数:26,代码来源:GroupHandler.cs
示例15: WhoListRequest
public static void WhoListRequest(IRealmClient client, RealmPacketIn packet)
{
var search = new WhoSearch {
MaxResultCount = WhoList.MaxResultCount,
Faction = client.ActiveCharacter.Faction.Group,
MinLevel = (byte)packet.ReadUInt32(),
MaxLevel = (byte)packet.ReadUInt32(),
Name = packet.ReadCString(),
GuildName = packet.ReadCString(),
RaceMask = (RaceMask2)packet.ReadUInt32(),
ClassMask = (ClassMask2)packet.ReadUInt32()
};
uint zoneCount = packet.ReadUInt32();
if (zoneCount > 0 && zoneCount <= 10)
{
for (int i = 0; i < zoneCount; i++)
search.Zones.Add((ZoneId)packet.ReadUInt32());
}
uint nameCount = packet.ReadUInt32();
if (nameCount > 0 && nameCount <= 10)
{
for (int i = 0; i < nameCount; i++)
search.Names.Add(packet.ReadCString().ToLower());
}
//Performs the search and retrieves matching characters
var characters = search.RetrieveMatchedCharacters();
//Send the character list to the client
SendWhoList(client, characters);
}
开发者ID:pallmall,项目名称:WCell,代码行数:33,代码来源:WhoHandler.cs
示例16: HandleAction
public static void HandleAction(IRealmClient client, RealmPacketIn packet)
{
var entityId = packet.ReadEntityId();
var chr = client.ActiveCharacter;
var pet = chr.Map.GetObject(entityId) as NPC;
if (pet != null && pet == chr.ActivePet && pet.IsAlive)
{
var record = pet.PetRecord;
if (record != null)
{
var data = (PetActionEntry)packet.ReadUInt32();
switch (data.Type)
{
case PetActionType.SetMode:
// mode
pet.SetPetAttackMode(data.AttackMode);
break;
case PetActionType.SetAction:
// action
var targetAction = data.Action;
pet.SetPetAction(targetAction);
break;
default:
// spell cast
var target = chr.Map.GetObject(packet.ReadEntityId());
pet.CastPetSpell(data.SpellId, target);
break;
}
}
}
}
开发者ID:KroneckerX,项目名称:WCell,代码行数:34,代码来源:PetHandler.cs
示例17: EnqueueClient
/// <summary>
/// Adds a client to the queue.
/// </summary>
/// <param name="client">the client to add to the queue</param>
public static void EnqueueClient(IRealmClient client)
{
client.Account.IsEnqueued = true;
s_queuedClients.Enqueue(client);
LoginHandler.SendAuthQueueStatus(client);
}
开发者ID:pallmall,项目名称:WCell,代码行数:11,代码来源:AuthQueue.cs
示例18: Accept
public static void Accept(IRealmClient client, RealmPacketIn packet)
{
var invitee = client.ActiveCharacter;
var listInviters = RelationMgr.Instance.GetPassiveRelations(invitee.EntityId.Low,
CharacterRelationType.GuildInvite);
var invite = listInviters.FirstOrDefault();
if (invite == null)
return;
Character inviter = World.GetCharacter(invite.CharacterId);
if (inviter == null)
return;
//Removes the guild invite relation between the inviter and invitee
RelationMgr.Instance.RemoveRelation(invite);
var guildMember = inviter.GuildMember;
if (guildMember == null)
return;
var guild = guildMember.Guild;
//Add the invitee to the guild
guild.AddMember(invitee);
}
开发者ID:Zakkgard,项目名称:WCell,代码行数:29,代码来源:GuildHandler.cs
示例19: AddIgnoreRequest
public static void AddIgnoreRequest(IRealmClient client, RealmPacketIn packet)
{
string relCharacterName = packet.ReadCString();
RelationMgr.Instance.AddRelation(client.ActiveCharacter, relCharacterName,
string.Empty, CharacterRelationType.Ignored);
}
开发者ID:pallmall,项目名称:WCell,代码行数:7,代码来源:RelationHandler.cs
示例20: HandleInstanceReset
public static void HandleInstanceReset(IRealmClient client, RealmPacketIn packet)
{
if (client.ActiveCharacter != null && client.ActiveCharacter.HasInstanceCollection)
{
client.ActiveCharacter.Instances.TryResetInstances();
}
}
开发者ID:ebakkedahl,项目名称:WCell,代码行数:7,代码来源:InstanceHandler.cs
注:本文中的IRealmClient类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论