protected Group(Character leader, byte maxGroupUnits) { // m_syncLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); syncLock = new ReaderWriterLockWrapper(); m_subGroups = new SubGroup[maxGroupUnits]; for (byte i = 0; i < maxGroupUnits; i++) { m_subGroups[i] = new SubGroup(this, i); } m_targetIcons = new EntityId[TargetIconCount]; for (int i = 0; i < m_targetIcons.Length; i++) { m_targetIcons[i] = EntityId.Zero; } m_lootMethod = LootMethod.GroupLoot; m_lootThreshold = ItemQuality.Uncommon; m_DungeonDifficulty = 0; var member = AddMember(leader, false); Leader = member; m_masterLooter = null; // update will follow when the 2nd guy joins }
/// <summary> /// Sets the given Looting-parameters and updates the Group. /// </summary> public void SetLootMethod(LootMethod method, GroupMember masterLooter, ItemQuality lootThreshold) { using (syncLock.EnterWriteLock()) { LootMethod = method; m_masterLooter = masterLooter; LootThreshold = lootThreshold; } SendUpdate(); }
/// <summary> /// Adds all initial Looters of nearby Characters who may loot this Loot. /// When all of the initial Looters gave up the Loot, the Loot becomes free for all. /// </summary> public void Initialize(Character chr, IList <LooterEntry> looters, MapId mapid) { Looters = looters; if (IsGroupLoot) { var groupMember = chr.GroupMember; if (groupMember != null) { Group = groupMember.Group; Method = Group.LootMethod; Threshold = Group.LootThreshold; var decision = Method == LootMethod.MasterLoot ? LootDecision.Master : LootDecision.Rolling; IList <LooterEntry> nearbyLooters = null; // TODO: masterlooter foreach (var item in Items) { if (item.Template.Flags.HasFlag(ItemFlags.MultiLoot) || item.Template.Quality >= Threshold) { if (UsesRoundRobin) { nearbyLooters = new List <LooterEntry>(); Group.GetNearbyLooters(Lootable, chr, nearbyLooters); } else { nearbyLooters = Looters; } } if (item.Template.Flags.HasFlag(ItemFlags.MultiLoot)) { item.AddMultiLooters(nearbyLooters); } else if (item.Template.Quality >= Threshold) { item.Decision = decision; if (decision == LootDecision.Rolling) { item.RollProgress = new LootRollProgress(this, item, nearbyLooters); LootHandler.SendStartRoll(this, item, nearbyLooters, mapid); } } } return; } } Method = LootMethod.FreeForAll; }
/// <summary> /// Adds all initial Looters of nearby Characters who may loot this Loot. /// When all of the initial Looters gave up the Loot, the Loot becomes free for all. /// </summary> public void Initialize(Character chr, IList <Asda2LooterEntry> looters, MapId mapid) { this.Looters = looters; this.AutoLoot = chr.AutoLoot; if (this.IsGroupLoot) { GroupMember groupMember = chr.GroupMember; if (groupMember != null) { this.Group = groupMember.Group; this.Method = this.Group.LootMethod; this.Threshold = this.Group.LootThreshold; return; } } this.Method = LootMethod.FreeForAll; }
protected Group(Character leader, byte maxGroupUnits) { syncLock = new ReaderWriterLockWrapper(); m_subGroups = new SubGroup[maxGroupUnits]; for (byte groupUnitId = 0; (int)groupUnitId < (int)maxGroupUnits; ++groupUnitId) { m_subGroups[groupUnitId] = new SubGroup(this, groupUnitId); } m_targetIcons = new EntityId[8]; for (int index = 0; index < m_targetIcons.Length; ++index) { m_targetIcons[index] = EntityId.Zero; } m_lootMethod = LootMethod.GroupLoot; m_lootThreshold = ItemQuality.Uncommon; m_DungeonDifficulty = 0U; Leader = AddMember(leader, false); m_masterLooter = null; }
/// <summary>Handles an incoming request on loot method change</summary> /// <param name="client">the Session the incoming packet belongs to</param> /// <param name="packet">the full packet</param> public static void GroupSetLootMethod(IRealmClient client, RealmPacketIn packet) { GroupMember groupMember1 = client.ActiveCharacter.GroupMember; if (groupMember1 == null) { return; } LootMethod method = (LootMethod)packet.ReadUInt32(); EntityId entityId = packet.ReadEntityId(); ItemQuality lootThreshold = (ItemQuality)packet.ReadUInt32(); Group group = groupMember1.Group; GroupMember groupMember2 = group[entityId.Low]; if (!(groupMember2 == null ? group.CheckPrivs(groupMember1, GroupPrivs.Leader) : group.CheckAction(groupMember1, groupMember2, groupMember2.Name, GroupPrivs.Leader) == GroupResult.NoError)) { return; } group.SetLootMethod(method, groupMember2, lootThreshold); }
protected Group(Character leader, byte maxGroupUnits) { // m_syncLock = new ReaderWriterLockSlim(LockRecursionPolicy.SupportsRecursion); m_syncLock = new ReaderWriterLockSlim(); m_subGroups = new SubGroup[maxGroupUnits]; for (byte i = 0; i < maxGroupUnits; i++) { m_subGroups[i] = new SubGroup(this, i); } m_targetIcons = new EntityId[TargetIconCount]; for (int i = 0; i < m_targetIcons.Length; i++) m_targetIcons[i] = EntityId.Zero; m_lootMethod = LootMethod.GroupLoot; m_lootThreshold = ItemQuality.Uncommon; m_DungeonDifficulty = 0; var member = AddMember(leader, false); Leader = member; m_masterLooter = null; // update will follow when the 2nd guy joins }
/// <summary> /// Adds all initial Looters of nearby Characters who may loot this Loot. /// When all of the initial Looters gave up the Loot, the Loot becomes free for all. /// </summary> public void Initialize(Character chr, IList<LooterEntry> looters, MapId mapid) { Looters = looters; if (IsGroupLoot) { var groupMember = chr.GroupMember; if (groupMember != null) { Group = groupMember.Group; Method = Group.LootMethod; Threshold = Group.LootThreshold; var decision = Method == LootMethod.MasterLoot ? LootDecision.Master : LootDecision.Rolling; IList<LooterEntry> nearbyLooters = null; // TODO: masterlooter foreach (var item in Items) { if (item.Template.Flags.HasFlag(ItemFlags.MultiLoot) || item.Template.Quality >= Threshold) { if (UsesRoundRobin) { nearbyLooters = new List<LooterEntry>(); Group.GetNearbyLooters(Lootable, chr, nearbyLooters); } else { nearbyLooters = Looters; } } if (item.Template.Flags.HasFlag(ItemFlags.MultiLoot)) { item.AddMultiLooters(nearbyLooters); } else if (item.Template.Quality >= Threshold) { item.Decision = decision; if (decision == LootDecision.Rolling) { item.RollProgress = new LootRollProgress(this, item, nearbyLooters); LootHandler.SendStartRoll(this, item, nearbyLooters, mapid); } } } return; } } Method = LootMethod.FreeForAll; }
/// <summary> /// Sets the given Looting-parameters and updates the Group. /// </summary> public void SetLootMethod(LootMethod method, GroupMember masterLooter, ItemQuality lootThreshold) { m_syncLock.EnterWriteLock(); try { LootMethod = method; m_masterLooter = masterLooter; LootThreshold = lootThreshold; } finally { m_syncLock.ExitWriteLock(); } SendUpdate(); }