public virtual void GenerateLoot(Player looter, float dropMod) { lootContainer = LootsMgr.GenerateLoot(this, looter, dropMod); if (lootContainer != null) { SetLootable(true, looter); } }
public override void SendMeTo(Player Plr) { // Log.Info("GO", "go = " + Name + " Oid = " + Oid + " X= " + Spawn.WorldX + " Y= " + Spawn.WorldY + " Z= " + Spawn.WorldZ + " DoorId= " + Spawn.DoorId); PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_STATIC); Out.WriteUInt16(Oid); Out.WriteUInt16((byte)(DoorOpen ? 1 : Spawn.DoorOpen)); Out.WriteUInt16((UInt16)Spawn.WorldO); Out.WriteUInt16((UInt16)Spawn.WorldZ); Out.WriteUInt32((UInt32)Spawn.WorldX); Out.WriteUInt32((UInt32)Spawn.WorldY); Out.WriteUInt16((ushort)Spawn.DisplayID); Out.WriteUInt16(Spawn.GetUnk(0)); Out.WriteUInt16(Spawn.GetUnk(1)); Out.WriteUInt16(Spawn.GetUnk(2)); Out.WriteByte(Spawn.Unk1); int flags = Spawn.GetUnk(3); Loot Loots = LootsMgr.GenerateLoot(this, Plr); if ((Loots != null && Loots.IsLootable()) || (Plr.QtsInterface.GetPublicQuest() != null) || Plr.QtsInterface.GameObjectNeeded(Spawn.Entry) || Spawn.DoorId != 0) { flags = flags | 4; } Out.WriteUInt16((ushort)flags); Out.WriteByte(Spawn.Unk2); Out.WriteUInt32(Spawn.Unk3); Out.WriteUInt16(Spawn.GetUnk(4)); Out.WriteUInt16(Spawn.GetUnk(5)); Out.WriteUInt32(Spawn.Unk4); Out.WritePascalString(Name); if (Spawn.DoorId != 0) { Out.WriteByte(0x04); Out.WriteUInt32((uint)(Spawn.DoorId)); } else { Out.WriteByte(0x00); } Plr.SendPacket(Out); base.SendMeTo(Plr); }
public void GenerateLoot(Unit Killer) { if (Killer == null) { return; } Loots = LootsMgr.GenerateLoot(this, Killer); if (Loots != null && Killer.IsPlayer()) { SetLootable(true, Killer.GetPlayer()); } }
public override void TryLoot(Player player, InteractMenu menu) { LootContainer lootsContainer = LootsMgr.GenerateLoot(this, player, 1); if (lootsContainer != null) { lootsContainer.SendInteract(player, menu); // If object has been looted, make it unlootable // and then Reset its lootable staus in XX seconds if (!lootsContainer.IsLootable()) { Looted = true; EvtInterface.AddEvent(ResetLoot, RELOOTABLE_TIME, 1); } } }
// For quests which require you to loot GameObjects this will update any objects // around you and make them lootable if they have items you need for a quest. // Notes: We could minimise the amount of SendMeTo's by checking if object are already // flagged and unflag them or unflagged and need flagging. However it isnt possible // to see if its already been flagged at the moment. public void updateObjects() { GameObject GameObject; foreach (Object Obj in _Owner._ObjectRanged) { if (Obj.IsGameObject()) { GameObject = Obj.GetGameObject(); Loot Loots = LootsMgr.GenerateLoot(GameObject, _Owner.GetPlayer()); if (Loots != null && Loots.IsLootable()) { GameObject.SendMeTo(_Owner.GetPlayer()); } } } }
/* * |00 3D 71 * 06 90 * 00 00 * 00 00 * 1F E3 * 00 0C E3 29 * 00 0E 59 90 * FF FF * 1E 00 00 00 35 F3 00 03 04 00 00 |00 00 64 8B 76 09 CD 00 00 00 00 0F 45 6D 70 69 |..d.v.......Empi| |72 65 20 42 61 72 20 44 6F 6F 72 04 06 AB DD 00 |re Bar Door.....| * ------------------------------------------------------------------- * */ public override void SendMeTo(Player Plr) { PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_STATIC); Out.WriteUInt16(Oid); Out.WriteUInt16(0); Out.WriteUInt16((UInt16)Spawn.WorldO); Out.WriteUInt16((UInt16)Spawn.WorldZ); Out.WriteUInt32((UInt32)Spawn.WorldX); Out.WriteUInt32((UInt32)Spawn.WorldY); Out.WriteUInt16((ushort)Spawn.DisplayID); Out.WriteUInt16(Spawn.GetUnk(0)); Out.WriteUInt16(Spawn.GetUnk(1)); Out.WriteUInt16(Spawn.GetUnk(2)); Out.WriteByte(Spawn.Unk1); int flags = Spawn.GetUnk(3); Loot Loots = LootsMgr.GenerateLoot(this, Plr); if (Loots != null && Loots.IsLootable()) { flags = flags | 4; } Out.WriteUInt16((ushort)flags); Out.WriteByte(Spawn.Unk2); Out.WriteUInt32(Spawn.Unk3); Out.WriteUInt16(Spawn.GetUnk(4)); Out.WriteUInt16(Spawn.GetUnk(5)); Out.WriteUInt32(Spawn.Unk4); Out.WritePascalString(Name); Out.WriteByte(0); Plr.SendPacket(Out); base.SendMeTo(Plr); }
public override void SendInteract(Player Plr, InteractMenu Menu) { Tok_Info Info = WorldMgr.GetTok(Spawn.Proto.TokUnlock); if (!IsDead) { Plr.QtsInterface.HandleEvent(Objective_Type.QUEST_USE_GO, Spawn.Entry, 1); } if (Spawn.Proto.TokUnlock != 0) { Plr.TokInterface.AddTok(Info); } Loot Loots = LootsMgr.GenerateLoot(this, Plr); if (Loots != null) { Loots.SendInteract(Plr, Menu); // If object has been looted, make it unlootable // and then Reset its lootable staus in XX seconds if (!Loots.IsLootable()) { Looted = true; foreach (Object Obj in this._ObjectRanged) { if (Obj.IsPlayer()) { this.SendMeTo(Obj.GetPlayer()); } } EvtInterface.AddEvent(ResetLoot, RELOOTABLE_TIME, 1); } } base.SendInteract(Plr, Menu); }
public override void SendMeTo(Player plr) { // Log.Info("STATIC", "Creating static oid=" + Oid + " name=" + Name + " x=" + Spawn.WorldX + " y=" + Spawn.WorldY + " z=" + Spawn.WorldZ + " doorID=" + Spawn.DoorId); PacketOut Out = new PacketOut((byte)Opcodes.F_CREATE_STATIC, 46 + (Name?.Length ?? 0)); Out.WriteUInt16(Oid); Out.WriteUInt16(VfxState); //ie: red glow, open door, lever pushed, etc Out.WriteUInt16((ushort)Spawn.WorldO); Out.WriteUInt16((ushort)Spawn.WorldZ); Out.WriteUInt32((uint)Spawn.WorldX); Out.WriteUInt32((uint)Spawn.WorldY); Out.WriteUInt16((ushort)Spawn.DisplayID); Out.WriteByte((byte)(Spawn.GetUnk(0) >> 8)); // Get the database if the value hasnt been changed (currently only used for keep doors) if (Realm == GameData.Realms.REALMS_REALM_NEUTRAL) { Out.WriteByte((byte)(Spawn.GetUnk(0) & 0xFF)); } else { Out.WriteByte((byte)Realm); } Out.WriteUInt16(Spawn.GetUnk(1)); Out.WriteUInt16(Spawn.GetUnk(2)); Out.WriteByte(Spawn.Unk1); int flags = Spawn.GetUnk(3); if (Realm != GameData.Realms.REALMS_REALM_NEUTRAL && !IsInvulnerable) { flags |= 8; // Attackable (stops invalid target errors) } LootContainer lootsContainer = LootsMgr.GenerateLoot(this, plr, 1); if ((lootsContainer != null && lootsContainer.IsLootable()) || ((plr.QtsInterface.PublicQuest != null) && Interactable) || (plr.QtsInterface.GameObjectNeeded(Spawn.Entry) && Interactable) || Spawn.Entry == 188 || Spawn.DoorId != 0) { flags |= 4; // Interactable } if (Flags.HasValue) { Out.WriteUInt16(Flags.Value); } else { Out.WriteUInt16((ushort)flags); } Out.WriteByte(Spawn.Unk2); Out.WriteUInt32(Spawn.Unk3); Out.WriteUInt16(Spawn.GetUnk(4)); Out.WriteUInt16(Spawn.GetUnk(5)); Out.WriteUInt32(Spawn.Unk4); Out.WritePascalString(Name); if (Spawn.DoorId != 0) { Out.WriteByte(0x04); Out.WriteUInt32(Spawn.DoorId); } else { Out.WriteByte(0x00); } plr.SendPacket(Out); base.SendMeTo(plr); }
public override void SendInteract(Player Plr, InteractMenu Menu) { Log.Success("SendInteract", "" + Name + " -> " + Plr.Name + ",Type=" + InteractType); PacketOut Out = new PacketOut((byte)Opcodes.F_SET_ABILITY_TIMER); Out.WriteByte(0); // 00 Out.WriteByte(1); // 01 Out.WriteByte(1); // 01 Out.WriteByte(5); // 05 Out.WriteUInt16(0); //00 00 Out.WriteUInt16(Spawn.GameObjTimer); // 13 88 =5000 Out.WriteUInt16(Oid); Out.WriteUInt16(0); Plr.SendPacket(Out); if (Spawn.GameObjTimer == 0) { Out = new PacketOut((byte)Opcodes.F_SET_ABILITY_TIMER); Out.WriteByte(0); // 00 Out.WriteByte(1); // 01 Out.WriteByte(1); // 01 Out.WriteUInt16(0); //00 00 Out.WriteUInt16(0); // 13 88 Out.WriteUInt16(0); Out.WriteUInt16(0); Out.WriteByte(0); Plr.SendPacket(Out); } Out = new PacketOut((byte)Opcodes.F_PLAY_EFFECT); Out.WriteUInt16((UInt16)0x0144); Out.WriteByte(0);// 00 Out.WriteUInt16((UInt16)Spawn.WorldZ); Out.WriteUInt32((UInt32)Spawn.WorldX); Out.WriteUInt32((UInt32)Spawn.WorldY); Out.WriteUInt16(0x0017);// 00 17 Out.Fill(0, 5); Plr.SendPacket(Out); Tok_Info Info = WorldMgr.GetTok(Spawn.Proto.TokUnlock); if (!IsDead) { Plr.QtsInterface.HandleEvent(Objective_Type.QUEST_USE_GO, Spawn.Entry, 1); } if (Spawn.Proto.TokUnlock != 0) { Plr.TokInterface.AddTok(Info); } Loot Loots = LootsMgr.GenerateLoot(this, Plr); if (Loots != null) { Loots.SendInteract(Plr, Menu); // If object has been looted, make it unlootable // and then Reset its lootable staus in XX seconds if (!Loots.IsLootable()) { Looted = true; foreach (Object Obj in this._ObjectRanged) { if (Obj.IsPlayer()) { this.SendMeTo(Obj.GetPlayer()); } } EvtInterface.AddEvent(ResetLoot, RELOOTABLE_TIME, 1); } } if (Spawn.DoorId != 0) { if (DoorOpen) { CloseDoor(); } else { OpenDoor(); } } base.SendInteract(Plr, Menu); }