/// <summary> /// Lets the given Character roll for the item at the given index /// </summary> /// <param name="index"></param> /// <param name="type"></param> public void Roll(Character chr, uint index, LootRollType type) { LootItem lootItem = this.Items[index]; if (lootItem.RollProgress == null) { return; } lootItem.RollProgress.Roll(chr, type); if (!lootItem.RollProgress.IsRollFinished) { return; } Character highestParticipant = lootItem.RollProgress.HighestParticipant; if (highestParticipant != null) { LootHandler.SendRollWon(highestParticipant, this, lootItem, lootItem.RollProgress.HighestEntry); this.HandoutItem(highestParticipant, lootItem, (BaseInventory)null, (int)byte.MaxValue); } else { this.RemoveItem(lootItem); } lootItem.RollProgress.Dispose(); }
/// <summary> /// Lets the given Character roll for the item at the given index /// </summary> /// <param name="index"></param> /// <param name="type"></param> public void Roll(Character chr, uint index, LootRollType type) { var item = Items[index]; if (item.RollProgress != null) { // item is actually being rolled for item.RollProgress.Roll(chr, type); if (item.RollProgress.IsRollFinished) { // handout the item, once the Roll finished var highest = item.RollProgress.HighestParticipant; if (highest != null) { LootHandler.SendRollWon(highest, this, item, item.RollProgress.HighestEntry); HandoutItem(highest, item, null, BaseInventory.INVALID_SLOT); } else { // no one online to receive the item (odd) -> Simply remove it RemoveItem(item); } item.RollProgress.Dispose(); } } }
/// <summary> /// Lets the given Character roll /// </summary> /// <param name="chr"></param> /// <param name="type"></param> public void Roll(Character chr, LootRollType type) { /* * if (m_RemainingParticipants.Remove(chr.LooterEntry)) * { * var roll = Utility.Random(1, LootMgr.HighestRoll); * * m_rolls[new LootRollEntry(roll, type)] = chr.LooterEntry; * LootHandler.SendRoll(chr, m_loot, m_lootItem, roll, type); * }*/ }
/// <summary> /// Lets the given Character roll /// </summary> /// <param name="chr"></param> /// <param name="type"></param> public void Roll(Character chr, LootRollType type) { if (m_RemainingParticipants.Remove(chr.LooterEntry)) { var roll = Utility.Random(1, LootMgr.HighestRoll); m_rolls[new LootRollEntry(roll, type)] = chr.LooterEntry; LootHandler.SendRoll(chr, m_loot, m_lootItem, roll, type); } }
public static void SendRoll(Character looter, Loot loot, LootItem item, int rollNumber, LootRollType rollType) { using (RealmPacketOut packet = new RealmPacketOut(RealmServerOpCode.SMSG_LOOT_ROLL)) { packet.Write((ulong)loot.Lootable.EntityId); packet.Write(item.Index); packet.Write((ulong)looter.EntityId); packet.Write(item.Template.Id); packet.Write(item.Template.RandomSuffixFactor); packet.Write(item.Template.RandomSuffixFactor > 0U ? (int)-item.Template.RandomSuffixId : (int)item.Template.RandomPropertiesId); packet.Write(rollNumber); packet.Write((byte)rollType); foreach (LooterEntry looter1 in (IEnumerable <LooterEntry>)loot.Looters) { if (looter1.Owner != null) { looter1.Owner.Client.Send(packet, false); } } } }
public LootRollEntry(int num, LootRollType type) { m_num = num; m_type = type; }
public static void SendRoll(Character looter, Loot loot, LootItem item, int rollNumber, LootRollType rollType) { using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_LOOT_ROLL)) { packet.Write(loot.Lootable.EntityId); packet.Write(item.Index); packet.Write(looter.EntityId); packet.Write(item.Template.Id); packet.Write(item.Template.RandomSuffixFactor); packet.Write((int)(item.Template.RandomSuffixFactor > 0 ? -item.Template.RandomSuffixId : item.Template.RandomPropertiesId)); packet.Write(rollNumber); packet.Write((byte)rollType); foreach (var looterEntry in loot.Looters) { if (looterEntry.Owner != null) { looterEntry.Owner.Client.Send(packet); } } } }
/// <summary>Lets the given Character roll</summary> /// <param name="chr"></param> /// <param name="type"></param> public void Roll(Character chr, LootRollType type) { }
public LootRollEntry(int num, LootRollType type) { this.m_num = num; this.m_type = type; }