本文整理汇总了C#中WCell.RealmServer.Entities.ObjectBase类的典型用法代码示例。如果您正苦于以下问题:C# ObjectBase类的具体用法?C# ObjectBase怎么用?C# ObjectBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectBase类属于WCell.RealmServer.Entities命名空间,在下文中一共展示了ObjectBase类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnUpdate
public override void OnUpdate(AchievementCollection achievements, uint value1, uint value2, ObjectBase involved)
{
if (CreatureId != (NPCId)value1)
{
return;
}
achievements.SetCriteriaProgress(this, value2, ProgressType.ProgressAccumulate);
}
示例2: GetSerializedFields
public static byte[] GetSerializedFields(ObjectBase obj)
{
MemoryStream outputStream = new MemoryStream();
BinaryFormatter bFormatter = new BinaryFormatter();
SerializedFields sUpdates = new SerializedFields();
sUpdates.SetValues(obj);
bFormatter.Serialize(outputStream, sUpdates);
return outputStream.ToArray();
}
示例3: SendSpellOrDamageImmune
/// <summary>
/// Correct for 3.0.9
/// </summary>
/// <param name="client"></param>
/// <param name="obj1"></param>
/// <param name="obj2"></param>
/// <param name="spellId"></param>
/// <param name="b1"></param>
public static void SendSpellOrDamageImmune(IPacketReceiver client, ObjectBase obj1, ObjectBase obj2, int spellId, bool b1)
{
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SPELLORDAMAGE_IMMUNE, 21))
{
packet.Write(obj1.EntityId);
packet.Write(obj2.EntityId);
packet.Write(spellId);
packet.Write(b1);
client.Send(packet);
}
}
示例4: WriteGODynamic
private static void WriteGODynamic(ObjectBase obj, Character receiver, UpdatePacket packet)
{
var go = (GameObject)obj;
if (go is Transport || !go.Flags.HasAnyFlag(GameObjectFlags.ConditionalInteraction))
{
packet.Write(obj.GetUInt32(GameObjectFields.DYNAMIC));
}
else
{
GODynamicLowFlags lowFlags;
if (go.CanBeUsedBy(receiver))
{
lowFlags = GODynamicLowFlags.Clickable | GODynamicLowFlags.Sparkle;
}
else
{
lowFlags = GODynamicLowFlags.None;
}
packet.Write((ushort)lowFlags);
packet.Write(ushort.MaxValue);
}
}
示例5: WriteUnitDynFlags
private static void WriteUnitDynFlags(ObjectBase obj, Character receiver, UpdatePacket packet)
{
var unit = (Unit)obj;
//var flags = UnitDynamicFlags.None;
var flags = unit.DynamicFlags;
var loot = obj.Loot;
if (loot != null && receiver.LooterEntry.MayLoot(loot) && !unit.IsAlive)
{
flags |= UnitDynamicFlags.Lootable;
}
else
{
var firstAttacker = unit.FirstAttacker;
if (firstAttacker != null)
{
if ((firstAttacker == receiver ||
firstAttacker.IsAlliedWith(receiver)) &&
unit.IsAlive)
{
flags |= UnitDynamicFlags.TaggedByMe;
}
else
{
flags |= UnitDynamicFlags.TaggedByOther;
}
}
}
// TODO: TrackUnit, SpecialInfo
packet.Write((uint)flags);
}
示例6: WriteGODynamic
private static void WriteGODynamic(ObjectBase obj, Character receiver, UpdatePacket packet)
{
packet.Write(obj.GetUInt32(GameObjectFields.DYNAMIC));
}
示例7: WriteGOFlags
private static void WriteGOFlags(ObjectBase obj, Character receiver, UpdatePacket packet)
{
var go = (GameObject)obj;
if (go.Flags.HasFlag(GameObjectFlags.ConditionalInteraction))
{
if (go.CanInteractWith(receiver))
{
// remove conditional flag, if receiver may use the GO
packet.Write((uint) (go.Flags ^ GameObjectFlags.ConditionalInteraction));
}
else
{
packet.Write((uint)go.Flags);
}
}
else
{
packet.Write((uint)go.Flags);
}
}
示例8: WriteNPCFlags
private static void WriteNPCFlags(ObjectBase obj, Character chr, UpdatePacket packet)
{
var flags = (NPCFlags)obj.GetUInt32(UnitFields.NPC_FLAGS);
if (obj is NPC)
{
var npc = (NPC)obj;
if (npc.IsTrainer && !npc.TrainerEntry.CanTrain(chr))
{
// Cannot talk to this Guy
flags = 0;
}
}
packet.Write((uint)flags);
}
示例9: CheckPossibleAchievementUpdates
/// <summary>
/// A method that will try to update the progress of all the related criterias.
/// </summary>
/// <param name="type">The Criteria Type.</param>
/// <param name="value1"></param>
/// <param name="value2"></param>
/// <param name="involved"></param>
internal void CheckPossibleAchievementUpdates(AchievementCriteriaType type, uint value1 = 0u, uint value2 = 0u, ObjectBase involved = null)
{
// Get all the related criterions.
var list = AchievementMgr.GetEntriesByCriterion(type);
if (list != null)
{
foreach (var entry in list)
{
if (IsAchieveable(entry))
{
entry.OnUpdate(this, value1, value2, involved);
}
}
}
}
示例10: SetValues
public void SetValues(ObjectBase obj)
{
m_values = obj.UpdateValues;
}
示例11: WriteCorpseDynFlags
private static void WriteCorpseDynFlags(ObjectBase obj, Character receiver, UpdatePacket packet)
{
if (((Corpse)obj).Owner == receiver)
{
packet.Write((uint)CorpseDynamicFlags.PlayerLootable);
}
else
{
packet.Write((uint)CorpseDynamicFlags.None);
}
}
示例12: SendCastSuccess
/// <summary>
/// Sent to hit targets before CastGo
/// </summary>
public static void SendCastSuccess(ObjectBase caster, uint spellId, Character target)
{
IRealmClient client = target.Client;
if (client == null) return;
/*using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_CLEAR_EXTRA_AURA_INFO, 12))
{
caster.EntityId.WritePacked(packet);
packet.WriteUInt(spellId);
client.Send(packet);
}*/
}
示例13: SendSpellGo
/// <summary>
/// Sent after spell start. Triggers the casting animation
/// </summary>
public static void SendSpellGo(ObjectBase caster2, SpellCast cast,
ICollection<WorldObject> hitTargets, ICollection<CastMiss> missedTargets)
{
// TODO: Dynamic packet length?
if (!cast.IsCasting)
{
return;
}
//int len = 200;
int len = 24 + (hitTargets != null ? hitTargets.Count * 8 : 0) + (missedTargets != null ? missedTargets.Count * 10 : 0);
using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SPELL_GO, len))
{
//caster1.EntityId.WritePacked(packet);
cast.Caster.EntityId.WritePacked(packet);
caster2.EntityId.WritePacked(packet);
packet.Write(cast.Id);
packet.Write(cast.Spell.Id);
var castGoFlags = cast.GoFlags;
packet.Write((int)castGoFlags);
//packet.Write(Util.Utility.GetEpochTime());
packet.Write(Utility.GetEpochTime());
//packet.Write(cast.CastDelay);
packet.WriteByte(hitTargets != null ? hitTargets.Count : 0);
if (hitTargets != null)
{
foreach (var target in hitTargets)
{
packet.Write(target.EntityId);
if (target is Character)
{
SendCastSuccess(cast.Caster, cast.Spell.Id, target as Character);
}
}
}
packet.WriteByte(missedTargets != null ? missedTargets.Count : 0);
if (missedTargets != null)
{
foreach (var miss in missedTargets)
{
packet.Write(miss.Target.EntityId);
packet.Write((byte)miss.Reason);
if (miss.Reason == CastMissReason.Reflect)
{
packet.Write((byte)0);// relfectreason
}
}
}
WriteTargets(packet, cast);
if ((castGoFlags & CastFlags.Flag_0x800) != 0)
{
packet.Write(0);
}
if ((castGoFlags & CastFlags.Flag_0x200000) != 0)
{
byte b1 = 0;
byte b2 = 0;
packet.Write(b1);
packet.Write(b2);
for (int i = 0; i < 6; i++)
{
byte mask = (byte)(1 << i);
if ((mask & b1) != 0)
{
if (!((mask & b2) != 0))
{
packet.WriteByte(0);
}
}
}
}
if ((castGoFlags & CastFlags.Flag_0x20000) != 0)
{
packet.WriteFloat(0);
packet.Write(0);
}
if ((cast.StartFlags & CastFlags.Ranged) != 0)
{
WriteAmmoInfo(cast, packet);
}
if ((castGoFlags & CastFlags.Flag_0x80000) != 0)
{
packet.Write(0);
//.........这里部分代码省略.........
示例14: SendUpdateInteractionCount
/// <summary>
/// Sends the quest update add kill, this should actually cover both GameObject interaction
/// together with killing the objectBase.
/// </summary>
/// <param name="quest">The QST.</param>
/// <param name="chr">The client.</param>
/// <param name="obj">The unit.</param>
public static void SendUpdateInteractionCount(Quest quest,
ObjectBase obj, QuestInteractionTemplate interaction, uint currentCount, Character chr)
{
using (var pckt = new RealmPacketOut(RealmServerOpCode.SMSG_QUESTUPDATE_ADD_KILL))
{
pckt.Write(quest.Template.Id);
pckt.Write(interaction.RawId); // ID of interaction
pckt.Write(currentCount); // current count
pckt.Write(interaction.Amount); // total count
pckt.Write(obj != null ? obj.EntityId : EntityId.Zero); // guid of object
chr.Client.Send(pckt);
}
}