public override void OnUpdate(AchievementCollection achievements, uint value1, uint value2, ObjectBase involved) { if (CreatureId != (NPCId)value1) { return; } achievements.SetCriteriaProgress(this, value2, ProgressType.ProgressAccumulate); }
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(); }
/// <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); } }
public override void OnUpdate(AchievementCollection achievements, uint value1, uint value2, ObjectBase involved) { achievements.SetCriteriaProgress(this, achievements.Owner.Reputations.GetVisibleReputations(), ProgressType.ProgressHighest); }
public override void OnUpdate(AchievementCollection achievements, uint value1, uint value2, ObjectBase involved) { if (value1 != (uint)FactionId) return; int reputation = achievements.Owner.Reputations.GetValue(FactionMgr.GetFactionIndex(FactionId)); achievements.SetCriteriaProgress(this, (uint)reputation, ProgressType.ProgressHighest); }
public override void OnUpdate(AchievementCollection achievements, uint value1, uint value2, ObjectBase involved) { achievements.SetCriteriaProgress(this, achievements.Owner.BankBagSlots, ProgressType.ProgressHighest); }
public override void OnUpdate(AchievementCollection achievements, uint value1, uint value2, ObjectBase involved) { if (value1 == 0 || (SkillId)value1 != SkillId) return; achievements.SetCriteriaProgress(this, value2); }
public override void OnUpdate(AchievementCollection achievements, uint value1, uint value2, ObjectBase involved) { if ((SpellId)value1 != SpellId) return; if (!achievements.Owner.PlayerSpells.Contains((uint)SpellId)) return; achievements.SetCriteriaProgress(this, 1, ProgressType.ProgressHighest); }
public override void OnUpdate(AchievementCollection achievements, uint value1, uint value2, ObjectBase involved) { if (value1 == 0) return; achievements.SetCriteriaProgress(this, value1, ProgressType.ProgressHighest); }
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); } }
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); }
/// <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); } } } }
public void SetValues(ObjectBase obj) { m_values = obj.UpdateValues; }
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); } }
public void PushFieldUpdateToPlayer(Character character, UpdateFieldId field, byte[] value) { using (UpdatePacket fieldUpdatePacket = this.GetFieldUpdatePacket(field, value)) ObjectBase.SendUpdatePacket(character, fieldUpdatePacket); }
private static void WriteGODynamic(ObjectBase obj, Character receiver, UpdatePacket packet) { packet.Write(obj.GetUInt32(GameObjectFields.DYNAMIC)); }
// 23 public override void OnUpdate(AchievementCollection achievements, uint value1, uint value2, ObjectBase involved) { if (value1 == 0) return; if (achievements.Owner.FactionGroup == (FactionGroup)value1) return; achievements.SetCriteriaProgress(this, 1, ProgressType.ProgressAccumulate); }
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); }
public override void OnUpdate(AchievementCollection achievements, uint value1, uint value2, ObjectBase involved) { if (value1 == 0) return; if ((EnviromentalDamageType)value1 != EnviromentalDamageType) return; achievements.SetCriteriaProgress(this, value2, ProgressType.ProgressAccumulate); }
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); } }
public override void OnUpdate(AchievementCollection achievements, uint value1, uint value2, ObjectBase involved) { if (ItemId != (ItemId)value1) return; var itemCount = (uint)achievements.Owner.Inventory.GetAmount(ItemId); if (itemCount == 0) return; achievements.SetCriteriaProgress(this, itemCount, ProgressType.ProgressHighest); }
/// <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); }*/ }
public override void OnUpdate(AchievementCollection achievements, uint value1, uint value2, ObjectBase involved) { if (value1 != (uint)WorldMapOverlayId) return; var worldMapOverlayEntry = World.s_WorldMapOverlayEntries[value1]; if (worldMapOverlayEntry == null) return; bool matchFound = false; foreach (var zoneTemplateId in worldMapOverlayEntry.ZoneTemplateId) { if (zoneTemplateId == 0) // no more areaids to come, let's stop the search break; var zoneTemplate = World.GetZoneInfo(zoneTemplateId); if (zoneTemplate.ExplorationBit < 0) continue; if (achievements.Owner.IsZoneExplored(zoneTemplate.ExplorationBit)) { matchFound = true; break; } } if (!matchFound) return; achievements.SetCriteriaProgress(this, 1); }
/// <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); packet.Write(0); } if (cast.TargetFlags.Has(SpellTargetFlags.DestinationLocation)) { packet.Write((byte)0); // unk 3.3.x? } cast.Caster.SendPacketToArea(packet, true); } }
public virtual void OnUpdate(AchievementCollection achievements, uint value1, uint value2, ObjectBase involved) { }
public override void OnUpdate(AchievementCollection achievements, uint value1, uint value2, ObjectBase involved) { if (!AchievementEntry.IsRealmFirstType() || AchievementCollection.ClassSpecificAchievementId[(int)achievements.Owner.Class] == AchievementEntryId || AchievementCollection.RaceSpecificAchievementId[(int)achievements.Owner.Race] == AchievementEntryId) { achievements.SetCriteriaProgress(this, value1); } }
public override void OnUpdate(AchievementCollection achievements, uint value1, uint value2, ObjectBase involved) { if (value1 == 0 || value1 != (uint)emoteId) return; achievements.SetCriteriaProgress(this, 1, ProgressType.ProgressAccumulate); }
public override void OnUpdate(AchievementCollection achievements, uint value1, uint value2, ObjectBase involved) { if (ZoneId == (ZoneId)value1) achievements.SetCriteriaProgress(this, value2); }
public override void OnUpdate(AchievementCollection achievements, uint value1, uint value2, ObjectBase involved) { achievements.SetCriteriaProgress(this, 1, ProgressType.ProgressAccumulate); }
public override void OnUpdate(AchievementCollection achievements, uint value1, uint value2, ObjectBase involved) { if (value1 == 0) return; if (MapId != (MapId)value1) return; achievements.SetCriteriaProgress(this, value2, ProgressType.ProgressAccumulate); }
/// <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); } }
public bool Equals(ObjectBase obj) { return(obj.EntityId == EntityId); }