Ejemplo n.º 1
0
        //Modified, base from here: https://github.com/Ralzar81/SkillBooks/blob/cf024383284c12fbf4f27e6611ba2384c96508b9/SkillBooks/SkillBooks.cs.
        static void BestiaryLoot_OnEnemyDeath(object sender, EventArgs e)
        {
            if (!SettingSpawnItem)
            {
                return;
            }

            EnemyDeath enemyDeath = sender as EnemyDeath;

            if (enemyDeath != null)
            {
                DaggerfallEntityBehaviour entityBehaviour = enemyDeath.GetComponent <DaggerfallEntityBehaviour>();
                if (entityBehaviour != null)
                {
                    EnemyEntity enemyEntity = entityBehaviour.Entity as EnemyEntity;
                    if (enemyEntity != null)
                    {
                        if (enemyEntity.MobileEnemy.Affinity == MobileAffinity.Human || HumanoidCheck(enemyEntity.MobileEnemy.ID))
                        {
                            int luckRoll = UnityEngine.Random.Range(1, 20) + ((playerEntity.Stats.LiveLuck / 10) - 5);
                            if (luckRoll > 18)
                            {
                                DaggerfallUnityItem bestiaryItem = ItemBuilder.CreateItem(ItemGroups.UselessItems2, BestiaryItem.templateIndex);
                                entityBehaviour.CorpseLootContainer.Items.AddItem(bestiaryItem);
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public static void EnemyDeath_OnEnemyDeath(object sender, EventArgs e)
        {
            EnemyDeath enemyDeath = sender as EnemyDeath;

            if (enemyDeath != null)
            {
                DaggerfallEntityBehaviour entityBehaviour = enemyDeath.GetComponent <DaggerfallEntityBehaviour>();
                if (entityBehaviour != null)
                {
                    EnemyEntity enemyEntity = entityBehaviour.Entity as EnemyEntity;
                    if (enemyEntity != null)
                    {
                        if (entityBehaviour.GetComponent <EnemySenses>().Target == GameManager.Instance.PlayerEntityBehaviour)
                        {
                            string monsterName = AllTextClass.MonsterCareerIndexToString(enemyEntity.CareerIndex);
                            if (killCounts.ContainsKey(monsterName))
                            {
                                killCounts[monsterName] += 1;
                                for (int i = 0; i < AllText.Pages.Count; i++)
                                {
                                    AllText.Pages[i].PageSummary = new Summary(AllText.Pages[i].PageSummary.Name);
                                }
                            }
                            else
                            {
                                if (SettingEntries == 1 && monsterName != "false")
                                {
                                    DaggerfallUI.AddHUDText(String.Format("{0} has been added to the Bestiary.", new List <string>(mod.GetAsset <TextAsset>(monsterName).text.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries))[2]));
                                }

                                killCounts.Add(monsterName, 1);
                                InitializeUI();
                            }
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public static void UnlevelDroppedLoot_OnEnemyDeath(object sender, EventArgs e)
        {
            EnemyDeath enemyDeath = sender as EnemyDeath;

            if (enemyDeath != null)
            {
                DaggerfallEntityBehaviour entityBehaviour = enemyDeath.GetComponent <DaggerfallEntityBehaviour>();
                if (entityBehaviour != null)
                {
                    EnemyEntity enemyEntity = entityBehaviour.Entity as EnemyEntity;
                    if (enemyEntity != null)
                    {
                        luckMod = GameManager.Instance.PlayerEntity.Stats.LiveLuck / 10;

                        if (enemyEntity.MobileEnemy.Affinity == MobileAffinity.Daedra)
                        {
                            AddDaedric(entityBehaviour.CorpseLootContainer.Items, enemyEntity.MobileEnemy.ID);
                        }
                        else if (enemyEntity.MobileEnemy.Team == MobileTeams.Orcs)
                        {
                            AddOrcish(entityBehaviour.CorpseLootContainer.Items, enemyEntity.MobileEnemy.ID);
                        }

                        //Code for possibly unleveled gold.
                        List <DaggerfallUnityItem> goldPile = entityBehaviour.CorpseLootContainer.Items.SearchItems(ItemGroups.Currency, (int)Currency.Gold_pieces);
                        foreach (DaggerfallUnityItem gold in goldPile)
                        {
                            gold.stackCount /= GameManager.Instance.PlayerEntity.Level;
                            if (gold.stackCount < 1)
                            {
                                gold.stackCount = 1;
                            }
                            gold.stackCount *= UnityEngine.Random.Range(1, luckMod + 1);
                        }
                    }
                }
            }
        }