예제 #1
0
        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
        }
예제 #2
0
        /// <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();
        }
예제 #3
0
        /// <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;
        }
예제 #4
0
        /// <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;
        }
예제 #5
0
 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;
 }
예제 #6
0
        /// <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);
        }
예제 #7
0
파일: Group.cs 프로젝트: ray2006/WCell
		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
		}
예제 #8
0
파일: Loot.cs 프로젝트: ebakkedahl/WCell
        /// <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;
        }
예제 #9
0
파일: Group.cs 프로젝트: ray2006/WCell
		/// <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();
		}