Exemplo n.º 1
0
        public override void OnAgentRemoved(Agent affectedAgent, Agent affectorAgent, AgentState agentState, KillingBlow blow)
        {
            if (Mission.Current.CombatType != Mission.MissionCombatType.Combat)
            {
                return;
            }
            if (affectedAgent == null)
            {
                return;
            }
            try
            {
                if ((affectedAgent.IsMainAgent == false && !affectedAgent.IsMount))
                {
                    //Don't get your companion equipment
                    if (affectedAgent.IsHero && affectedAgent.Team == Agent.Main.Team)
                    {
                        return;
                    }

                    for (int i = 0; i < 12; i++)
                    {
                        EquipmentIndex   equipmentIndex = (EquipmentIndex)i;
                        var              rdm            = MBRandom.RandomFloatRanged(BMRandomTweaksConfiguration.Instance.LootRandomMaxRoll);
                        EquipmentElement equipmentFromSlot;
                        if (rdm < PlayerDropRate) //Might as well use the player loot rate.  If player looses they get no loot anyway.
                        {
                            if (affectedAgent.Character.Equipment.GetEquipmentFromSlot(equipmentIndex).Item != null)
                            {
                                equipmentFromSlot = affectedAgent.Character.Equipment.GetEquipmentFromSlot(equipmentIndex);
                                if (!BMRandomTweaksConfiguration.Instance.HorseDropEnabled)
                                {
                                    if (equipmentFromSlot.Item.ItemType == ItemObject.ItemTypeEnum.HorseHarness ||
                                        equipmentFromSlot.Item.ItemType == ItemObject.ItemTypeEnum.Horse)
                                    {
                                        continue;
                                    }
                                }

                                float itemValue = equipmentFromSlot.Item.Value + 0.1f;
                                if (itemValue > 1.3f * PlayerMaxValue || itemValue < 0.8f * PlayerMaxValue)
                                {
                                    equipmentFromSlot = this.GetEquipmentWithModifier(equipmentFromSlot.Item, PlayerMaxValue / itemValue);
                                    itemValue         = equipmentFromSlot.ItemValue;
                                }
                                if (itemValue > PlayerMaxValue * 1.3f)
                                {
                                    float single = PlayerMaxValue / (Math.Max(PlayerMaxValue, itemValue));
                                    if (MBRandom.RandomFloatRanged(itemValue) < single)
                                    {
                                        LootedItems.Add(equipmentFromSlot);
                                    }
                                }
                                else
                                {
                                    LootedItems.Add(equipmentFromSlot);
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ErrorLog.Log("Error OnAgentRemoval");
                ErrorLog.Log(ex.ToStringFull());
            }
        }
Exemplo n.º 2
0
 private void OnWoWLoot(object sender, WoWEventHandler.OnLootArgs args)
 {
     Application.Current.Dispatcher.BeginInvoke(DispatcherPriority.Normal,
                                                (Action)(() => { LootedItems.Add(args); }));
 }