Inheritance: MonoBehaviour
Example #1
0
 public void ShowLoot(Loot loot)
 {
     for (int i = 0; i < slots.Length; i++)
     {
         slots[i].SetLoot(loot);
     }
 }
Example #2
0
 public Recipe(string name, int id, RecipeType recipeType, Ingredients ingredients, Loot output)
 {
     this.name = name;
     this.id = id;
     this.recipeType = recipeType;
     this.ingredients = ingredients;
     this.output = output;
 }
Example #3
0
    public bool addLoot(Loot obj)
    {
        if (loot.Count > this.size)
            return (false);

        loot.Add ( Loot.toMemory(obj) );
        GameObject.Destroy(obj.gameObject);
        return (true);
    }
Example #4
0
    private Inventory.Slot GetItem( Loot piece )
    {
        Inventory.Slot tempSlot = Inventory.Slot.CreateSlot ();
        tempSlot.item = piece.prefab.GetItem ();
        tempSlot.count = piece.maxCount == -1 ? piece.prefab.maxStack : Random.Range (piece.minCount, piece.maxCount + 1);
        tempSlots.Add (tempSlot);

        if (piece.metadata.Length > 0)
            tempSlot.item.metadata = piece.metadata;
        return tempSlot;
    }
Example #5
0
 public void Populate(Loot loot, IList<LootDef> defs)
 {
     defs = new List<LootDef>();
     foreach (var i in children)
         i.Populate(loot, defs);
     loot.LootConsidering += (sender, e) =>
     {
         if (e.PlayerData.Item2 / (double)e.Enemy.ObjectDesc.MaxHP >= threshold)
             foreach (var i in defs)
                 e.LootDefs.Add(i);
     };
 }
Example #6
0
    public static LootMemory toMemory(Loot cpy)
    {
        LootMemory result = new LootMemory();

        result.damage = cpy.damage;
        result.speed = cpy.speed;
        result.rank = cpy.rank;
        result.weapon = cpy.weapon;
        result.sprite = cpy.sprite;
        result.subname = cpy.subname;

        return (result);
    }
Example #7
0
 public _ Init(string objType, State rootState, params ILootDef[] defs)
 {
     rootState.Resolve(new Dictionary<string, State>());
     if (defs.Length > 0)
     {
         var loot = new Loot();
         foreach (var i in defs)
             i.Populate(loot, loot);
         rootState.Death += (sender, e) => loot.Handle((Enemy)e.Host, e.Time);
         Definitions.Add(XmlDatas.IdToType[objType], new Tuple<State, Loot>(rootState, loot));
     }
     else
         Definitions.Add(XmlDatas.IdToType[objType], new Tuple<State, Loot>(rootState, null));
     return this;
 }
 public void SetLoot(Loot loot)
 {
     this.loot = loot;
     Item item = loot.GetItem(index);
     if (item == null)
     {
         takeButtonObject.SetActive(false);
         transform.GetChild(0).GetComponent<Image>().sprite = itemImages.GetItemSprite("Null");
     }
     else
     {
         takeButtonObject.SetActive(true);
         transform.GetChild(0).GetComponent<Image>().sprite = itemImages.GetItemSprite(item.Name);
     }
 }
Example #9
0
 public ctor Init(string objType, State rootState, params ILootDef[] defs)
 {
     var d = new Dictionary<string, State>();
     rootState.Resolve(d);
     rootState.ResolveChildren(d);
     var dat = InitDb.Manager.GameData;
     if (defs.Length > 0)
     {
         var loot = new Loot(defs);
         rootState.Death += (sender, e) => loot.Handle((Enemy)e.Host, e.Time);
         InitDb.Definitions.Add(dat.IdToObjectType[objType], new Tuple<State, Loot>(rootState, loot));
     }
     else
         InitDb.Definitions.Add(dat.IdToObjectType[objType], new Tuple<State, Loot>(rootState, null));
     return this;
 }
 public static void RecieveLoot(Loot loot)
 {
     switch (loot.LootType)
     {
         case LootType.Artefact:
             loot.Artifact.Status = ArtifactStatus.Found;
             break;
         case LootType.MineralA:
             State.MineralA += loot.MineralA;
             break;
         case LootType.MineralB:
             State.MineralB += loot.MineralB;
             break;
         case LootType.MineralC:
             State.MineralC += loot.MineralC;
             break;
     }
 }
    public static void GenerateLoot(int sectorID, out List<Loot> lootList)
    {
        var sectorParameters = State.SectorsParameters.Find(x => x.SectorID == sectorID);
        lootList = new List<Loot>();
        List<Artifact> chosenArtifacts = new List<Artifact>();
        int artefactsLeft = State.Artifacts.FindAll(artifact => artifact.Status == ArtifactStatus.NotFound && (artifact.Sector == 0 || artifact.Sector == sectorID)).Count;

        for (int i = 0; i < sectorParameters.LootSpotCount; i++)
        {
            var loot = new Loot();

            // static artifact spawn rate for now
            if (Rand.RND.Next(0, 4) == 0 && artefactsLeft > 0)
            {
                loot.LootType = LootType.Artefact;
                var newArtifacts = State.Artifacts.FindAll(artifact =>
                    artifact.Status == ArtifactStatus.NotFound &&
                    (artifact.Sector == 0 || artifact.Sector == sectorID) &&
                    !chosenArtifacts.Contains(artifact));
                loot.Artifact = newArtifacts[Rand.RND.Next(0, newArtifacts.Count - 1)];
                chosenArtifacts.Add(loot.Artifact);
                artefactsLeft--;
            }
            else
            {
                // 33% probability for each not-zero mineral
                while (true)
                {
                    LootType[] values = (LootType[])Enum.GetValues(typeof(LootType));
                    loot.LootType = values[Rand.RND.Next(0, 3)];

                    int mineralCount = sectorParameters.GetMineralByType(loot.LootType);
                    if (mineralCount != 0)
                    {
                        loot.AddMineralsByType(loot.LootType, mineralCount);
                        break;
                    }
                }
            }

            lootList.Add(loot);
        }
    }
Example #12
0
 /// <summary>
 /// Attempts to remove the first found match for a Loot object.
 /// </summary>
 /// <param name="loot"></param>
 public void RemoveLoot(Loot loot)
 {
     if (this.Loots.Contains(loot))
     {
         this.Loots.Remove(loot);
         if (this.LootRemoved != null) this.LootRemoved(loot);
     }
 }
Example #13
0
 /// <summary>
 /// Loads data (waypoints, loot, targets, settings) from a binary file loaded into a Objects.Packet object.
 /// </summary>
 /// <param name="version">The version of LibreBot which created the file.</param>
 /// <param name="p">The Objects.Packet object.</param>
 /// <returns></returns>
 private bool Load(ushort version, Objects.Packet p)
 {
     while (p.GetPosition < p.Length)
     {
         Enums.CavebotDatType type = (Enums.CavebotDatType)p.GetByte();
         ushort count = 0;
         switch (type)
         {
             case Enums.CavebotDatType.Settings:
                 switch (version)
                 {
                     case 212:
                     case 213:
                         this.CurrentSettings.EatFood = p.GetBool();
                         this.CurrentSettings.Exhaust = p.GetUInt16();
                         this.CurrentSettings.MinimumHealthToShoot = p.GetUInt16();
                         this.CurrentSettings.NodeRadius = p.GetByte();
                         this.CurrentSettings.NodeSkipRange = p.GetByte();
                         this.CurrentSettings.OpenContainers = p.GetBool();
                         this.CurrentSettings.PrioritizeDanger = p.GetBool();
                         this.CurrentSettings.StickToCreature = p.GetBool();
                         this.CurrentSettings.StopAttackingWhenOutOfRange = p.GetBool();
                         this.CurrentSettings.UseGoldStacks = p.GetBool();
                         this.CurrentSettings.CanUseMagicRope = p.GetBool();
                         this.CurrentSettings.UseAlternateNodeFinder = p.GetBool();
                         this.CurrentSettings.KillBeforeLooting = p.GetBool();
                         break;
                     default:
                         this.CurrentSettings.EatFood = p.GetBool();
                         this.CurrentSettings.Exhaust = p.GetUInt16();
                         this.CurrentSettings.MinimumHealthToShoot = p.GetUInt16();
                         this.CurrentSettings.NodeRadius = p.GetByte();
                         this.CurrentSettings.NodeSkipRange = p.GetByte();
                         this.CurrentSettings.OpenContainers = p.GetBool();
                         this.CurrentSettings.PrioritizeDanger = p.GetBool();
                         this.CurrentSettings.StickToCreature = p.GetBool();
                         this.CurrentSettings.StopAttackingWhenOutOfRange = p.GetBool();
                         this.CurrentSettings.UseGoldStacks = p.GetBool();
                         this.CurrentSettings.CanUseMagicRope = p.GetBool();
                         break;
                 }
                 break;
             case Enums.CavebotDatType.Loot:
                 count = p.GetUInt16();
                 for (int i = 0; i < count; i++)
                 {
                     switch (version)
                     {
                         default:
                             Loot l = new Loot();
                             l.ID = p.GetUInt16();
                             l.Name = p.GetString();
                             l.Cap = p.GetUInt16();
                             string destination = p.GetString();
                             switch (destination.ToLower())
                             {
                                 case "ground":
                                     l.Destination = Loot.Destinations.Ground;
                                     break;
                                 default:
                                     l.Destination = Loot.Destinations.EmptyContainer;
                                     l.Index = byte.Parse(destination[1].ToString());
                                     break;
                             }
                             this.AddLoot(l);
                             break;
                         case 213:
                             this.AddLoot(new Loot(p.GetUInt16(),
                                 p.GetString(),
                                 p.GetUInt16(),
                                 (Loot.Destinations)p.GetByte(),
                                 p.GetByte()));
                             break;
                     }
                 }
                 break;
             case Enums.CavebotDatType.Targetting:
                 count = p.GetUInt16();
                 for (int i = 0; i < count; i++)
                 {
                     Target t = new Target(this);
                     t.Name = p.GetString();
                     if (version < 212) // load old settings (single setting environment)
                     {
                         Target.Setting setting = new Target.Setting(t);
                         setting.Count = p.GetByte();
                         setting.Range = p.GetByte();
                         setting.DistanceRange = 3;
                         setting.FightMode = (Enums.FightMode)p.GetByte();
                         setting.FightStance = (Enums.FightStance)p.GetByte();
                         p.GetString(); // ring
                         p.GetString(); // rune
                         setting.Spell = p.GetString();
                         setting.DangerLevel = p.GetByte();
                         p.GetBool(); // friendly mode
                         setting.MustBeReachable = p.GetBool();
                         setting.MustBeShootable = p.GetBool();
                         t.DoLoot = p.GetBool();
                         setting.UseThisSetting = true;
                         p.GetBool(); // alarm, deprecated
                         t.SetSettings(new List<Target.Setting>() { setting });
                     }
                     else // load new settings (multiple setting environment)
                     {
                         ushort settingsCount = p.GetUInt16();
                         List<Target.Setting> settings = new List<Target.Setting>();
                         for (int j = 0; j < settingsCount; j++)
                         {
                             Target.Setting setting = new Target.Setting(t);
                             setting.Count = p.GetByte();
                             setting.Range = p.GetByte();
                             setting.DistanceRange = 3;
                             setting.FightMode = (Enums.FightMode)p.GetByte();
                             setting.FightStance = (Enums.FightStance)p.GetByte();
                             p.GetString(); // ring
                             p.GetString(); // rune
                             setting.Spell = p.GetString();
                             setting.DangerLevel = p.GetByte();
                             p.GetBool(); // friendly mode
                             setting.MustBeReachable = p.GetBool();
                             setting.MustBeShootable = p.GetBool();
                             t.DoLoot = p.GetBool();
                             setting.UseThisSetting = true;
                             settings.Add(setting);
                         }
                         t.SetSettings(settings);
                     }
                     this.AddTarget(t);
                 }
                 break;
             case Enums.CavebotDatType.Waypoints:
                 count = p.GetUInt16();
                 for (int i = 0; i < count; i++)
                 {
                     Modules.Cavebot.Waypoint.Types wpType = (Modules.Cavebot.Waypoint.Types)p.GetByte();
                     Objects.Location wpLocation = new Objects.Location(p.GetUInt16(), p.GetUInt16(), p.GetByte());
                     string wpLabel = p.GetString();
                     List<Objects.Location> wpNodes = new List<Objects.Location>();
                     string wpScript = string.Empty;
                     switch (wpType)
                     {
                         case Modules.Cavebot.Waypoint.Types.Node:
                             switch (version)
                             {
                                 case 200:
                                     this.AddWaypoint(new Waypoint(this, wpLocation, wpType));
                                     break;
                                 case 201:
                                 default:
                                     ushort nodeCount = p.GetUInt16();
                                     for (int j = 0; j < nodeCount; j++) wpNodes.Add(new Objects.Location(p.GetUInt16(), p.GetUInt16(), p.GetByte()));
                                     this.AddWaypoint(new Waypoint(this, wpLocation, wpNodes));
                                     break;
                             }
                             break;
                         case Modules.Cavebot.Waypoint.Types.Script:
                             if (version == 211)
                             {
                                 ushort scriptCount = p.GetUInt16();
                                 List<Objects.Script> scripts = new List<Objects.Script>();
                                 string filePath = p.GetString();
                                 string contents = System.IO.File.Exists(filePath) ?
                                     System.IO.File.ReadAllText(filePath) :
                                     string.Empty;
                                 /*for (int j = 0; j < scriptCount; j++)
                                 {
                                     string fileName = p.GetString();
                                     if (!System.IO.File.Exists(fileName)) continue;
                                     Objects.Script script = new Objects.Script(this.Client, fileName, wpLocation);
                                     scripts.Add(script);
                                 }*/
                                 this.AddWaypoint(new Waypoint(this, wpLocation, contents));
                             }
                             else
                             {
                                 wpScript = p.GetString();
                                 this.AddWaypoint(new Waypoint(this, wpLocation, wpScript));
                             }
                             break;
                         default:
                             this.AddWaypoint(new Waypoint(this, wpLocation, wpType));
                             break;
                     }
                 }
                 break;
             default:
                 return false;
         }
     }
     return true;
 }
        public override void GiveRewards()
        {
            //Give Gold to player in form of a bank check
            BankCheck gold = new BankCheck(Utility.RandomMinMax(500, 1000));

            if (!Owner.AddToBackpack(gold))
            {
                gold.MoveToWorld(Owner.Location, Owner.Map);
            }

            Item item;

            //Random Magic Item #1
            item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
            if (item is BaseWeapon)
            {
                BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, 3, 10, 50);
            }
            if (item is BaseArmor)
            {
                BaseRunicTool.ApplyAttributesTo((BaseArmor)item, 3, 10, 50);
            }
            if (item is BaseJewel)
            {
                BaseRunicTool.ApplyAttributesTo((BaseJewel)item, 3, 10, 50);
            }
            if (item is BaseHat)
            {
                BaseRunicTool.ApplyAttributesTo((BaseHat)item, 3, 10, 50);
            }
            if (!Owner.AddToBackpack(item))
            {
                item.MoveToWorld(Owner.Location, Owner.Map);
            }

            //Random Magic Item #2
            item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
            if (item is BaseWeapon)
            {
                BaseRunicTool.ApplyAttributesTo((BaseWeapon)item, 3, 10, 50);
            }
            if (item is BaseArmor)
            {
                BaseRunicTool.ApplyAttributesTo((BaseArmor)item, 3, 10, 50);
            }
            if (item is BaseJewel)
            {
                BaseRunicTool.ApplyAttributesTo((BaseJewel)item, 3, 10, 50);
            }
            if (item is BaseHat)
            {
                BaseRunicTool.ApplyAttributesTo((BaseHat)item, 3, 10, 50);
            }
            if (!Owner.AddToBackpack(item))
            {
                item.MoveToWorld(Owner.Location, Owner.Map);
            }

            //Chance of Special Item
            if (Utility.RandomMinMax(1, 1) == 1)
            {
                item = new RalphiesWelcomeNecklace(  );
                if (!Owner.AddToBackpack(item))
                {
                    item.MoveToWorld(Owner.Location, Owner.Map);
                }
            }


            base.GiveRewards();
        }
Example #15
0
        public TreasureChestLevel1()
            : base(0xE41)
        {
            SetChestAppearance();
            Movable = false;

            TrapType  = TrapType.DartTrap;
            TrapPower = m_Level * Utility.Random(1, 25);
            Locked    = true;

            RequiredSkill = 57;
            LockLevel     = RequiredSkill - Utility.Random(1, 10);
            MaxLockLevel  = RequiredSkill + Utility.Random(1, 10);

            // According to OSI, loot in level 1 chest is:
            //  Gold 25 - 50
            //  Bolts 10
            //  Gems
            //  Normal weapon
            //  Normal armour
            //  Normal clothing
            //  Normal jewelry

            // Gold
            DropItem(new Gold(Utility.Random(30, 100)));

            // Drop bolts
            // DropItem( new Bolt( 10 ) );

            // Gems
            if (Utility.RandomBool())
            {
                var GemLoot = Loot.RandomGem();
                GemLoot.Amount = Utility.Random(1, 3);
                DropItem(GemLoot);
            }

            // Weapon
            if (Utility.RandomBool())
            {
                DropItem(Loot.RandomWeapon());
            }

            // Armour
            if (Utility.RandomBool())
            {
                DropItem(Loot.RandomArmorOrShield());
            }

            // Clothing
            if (Utility.RandomBool())
            {
                DropItem(Loot.RandomClothing());
            }

            // Jewelry
            if (Utility.RandomBool())
            {
                DropItem(Loot.RandomJewelry());
            }
        }
        protected void LootDropGUI(string lootId, Loot l, LootDrop drop, int index)
        {
            string errorString;

            GUILayout.BeginVertical();

            GUILayout.BeginHorizontal("Box");
            // DROP ROW - REMOVE BUTTON
            if (GUILayout.Button("-", GUILayout.Width(15), GUILayout.Height(15)))
            {
                if (EditorUtility.DisplayDialog("Delete Drop Row",
                                                "Are you sure?",
                                                "Delete",
                                                "Cancel"))
                {
                    l.dropTable.Remove(drop);
                }
            }

            // DROP ROW - PREFAB NAME
            drop.prefabName = GUILayout.TextField(drop.prefabName, GUILayout.Width(150));

            // DROP ROW - QUANTITY
            bool   quantityValid = false;
            string quantityKey   = lootId + "Quantity" + index;

            if (!temporaryStrings.ContainsKey(quantityKey))
            {
                temporaryStrings[quantityKey] = drop.quantity.ToString();
            }

            GUILayout.Label("Quantity: ");
            temporaryStrings[quantityKey] = GUILayout.TextField(temporaryStrings[quantityKey], GUILayout.Width(25));
            int result = 0;

            if (int.TryParse(temporaryStrings[quantityKey], out result))
            {
                drop.quantity = (uint)Mathf.Max(0, result);
                quantityValid = true;
            }

            // DROP ROW - WEIGHT
            bool   weightValid = false;
            string weightKey   = lootId + "Weight" + index;

            if (!temporaryStrings.ContainsKey(weightKey))
            {
                temporaryStrings[weightKey] = drop.weight.ToString();
            }

            GUILayout.Label("Weight: ");
            temporaryStrings[weightKey] = GUILayout.TextField(temporaryStrings[weightKey], GUILayout.Width(40));
            if (int.TryParse(temporaryStrings[weightKey], out result))
            {
                drop.weight = (uint)Mathf.Max(0, result);
                weightValid = true;
            }

            if (weightValid && quantityValid && drop.IsValid(out errorString, prefabList))
            {
                GUILayout.Label("✓");
            }
            else
            {
                GUILayout.Label("✖");
            }
            GUILayout.EndHorizontal();

            if (errorString != null && !errorString.Trim().Equals(""))
            {
                GUILayout.Label("<color=red>" + errorString + "</color>", richTextStyle);
            }
            GUILayout.EndVertical();
        }
        private void xmlToGeneric(TFSXmlMonster tfsMonster, out Monster monster)
        {
            monster = new Monster()
            {
                Name       = tfsMonster.name,
                Health     = (uint)tfsMonster.health.max,
                Experience = (uint)tfsMonster.experience,
                Speed      = (uint)tfsMonster.speed,
                Race       = tfsToGenericBlood(tfsMonster.race),
            };

            if (!string.IsNullOrEmpty(tfsMonster.nameDescription))
            {
                monster.Description = tfsMonster.nameDescription;
            }
            if (!string.IsNullOrEmpty(tfsMonster.namedescription))
            {
                monster.Description = tfsMonster.namedescription;
            }

            if (tfsMonster.targetchange != null)
            {
                monster.RetargetChance = (uint)tfsMonster.targetchange.chance;

                if ((tfsMonster.targetchange.interval != 0) &&
                    (tfsMonster.targetchange.speed == 0))
                {
                    monster.RetargetInterval = (uint)tfsMonster.targetchange.interval;
                }
                else if ((tfsMonster.targetchange.interval == 0) &&
                         (tfsMonster.targetchange.speed != 0))
                {
                    monster.RetargetInterval = (uint)tfsMonster.targetchange.speed;
                }
                else if ((tfsMonster.targetchange.interval != 0) &&
                         (tfsMonster.targetchange.speed != 0))
                {
                    System.Diagnostics.Debug.WriteLine("Warning duplicate target speed and target interval");
                }
            }

            if (tfsMonster.look != null)
            {
                monster.CorpseId         = (uint)tfsMonster.look.corpse;
                monster.OutfitIdLookType = (uint)tfsMonster.look.type;
                monster.LookTypeDetails  = new DetailedLookType()
                {
                    Head   = (ushort)tfsMonster.look.head,
                    Body   = (ushort)tfsMonster.look.body,
                    Legs   = (ushort)tfsMonster.look.legs,
                    Feet   = (ushort)tfsMonster.look.feet,
                    Addons = (ushort)tfsMonster.look.addons,
                    Mount  = (ushort)tfsMonster.look.mount
                };
                monster.ItemIdLookType = (uint)tfsMonster.look.typeex;
            }

            // flags
            if ((tfsMonster.flags != null) &&
                (tfsMonster.flags.flag != null))
            {
                foreach (var x in tfsMonster.flags.flag)
                {
                    int value;
                    if (int.TryParse(x.attr[0].Value, out value))
                    {
                        if (x.attr[0].Name == "summonable")
                        {
                            monster.SummonCost = (uint)tfsMonster.manacost;
                        }
                        else if (x.attr[0].Name == "attackable")
                        {
                            monster.Attackable = value == 1;
                        }
                        else if (x.attr[0].Name == "hostile")
                        {
                            monster.Hostile = value == 1;
                        }
                        else if (x.attr[0].Name == "illusionable")
                        {
                            monster.Illusionable = value == 1;
                        }
                        else if (x.attr[0].Name == "convinceable")
                        {
                            monster.ConvinceCost = (uint)tfsMonster.manacost;
                        }
                        else if (x.attr[0].Name == "pushable")
                        {
                            monster.Pushable = value == 1;
                        }
                        else if (x.attr[0].Name == "canpushitems")
                        {
                            monster.PushItems = value == 1;
                        }
                        else if (x.attr[0].Name == "canpushcreatures")
                        {
                            monster.PushCreatures = value == 1;
                        }
                        else if (x.attr[0].Name == "targetdistance")
                        {
                            monster.TargetDistance = (uint)value;
                        }
                        else if (x.attr[0].Name == "staticattack")
                        {
                            monster.StaticAttack = (uint)value;
                        }
                        else if (x.attr[0].Name == "lightlevel")
                        {
                            monster.LightLevel = (uint)value;
                        }
                        else if (x.attr[0].Name == "lightcolor")
                        {
                            monster.LightColor = (uint)value;
                        }
                        else if (x.attr[0].Name == "runonhealth")
                        {
                            monster.RunOnHealth = (uint)value;
                        }
                        else if (x.attr[0].Name == "hidehealth")
                        {
                            monster.HideHealth = value == 1;
                        }
                        else if (x.attr[0].Name == "canwalkonenergy")
                        {
                            monster.AvoidEnergy = value != 1;
                        }
                        else if (x.attr[0].Name == "canwalkonfire")
                        {
                            monster.AvoidFire = value != 1;
                        }
                        else if (x.attr[0].Name == "canwalkonpoison")
                        {
                            monster.AvoidPoison = value != 1;
                        }
                        else if (x.attr[0].Name == "isboss")
                        {
                            monster.IsBoss = value == 1;
                        }
                        else
                        {
                            Console.WriteLine($"Unknown name {x.attr[0].Name}");
                        }
                    }
                }
            }

            // sounds
            if ((tfsMonster.voices != null) &&
                (tfsMonster.voices.voice != null))
            {
                foreach (VoiceXml sound in tfsMonster.voices.voice)
                {
                    Voice voice = new Voice();
                    voice.Sound = sound.sentence;
                    if (!(string.IsNullOrEmpty(sound.yell)) &&
                        ((sound.yell == "1") || (sound.yell == "true")))
                    {
                        voice.SoundLevel = SoundLevel.Yell;
                    }
                    else
                    {
                        voice.SoundLevel = SoundLevel.Say;
                    }
                    monster.Voices.Add(voice);
                }
            }

            // summons
            if (tfsMonster.summons != null)
            {
                monster.MaxSummons = (uint)tfsMonster.summons.maxSummons;
                foreach (TFSXmlSummon summon in tfsMonster.summons.summon)
                {
                    monster.Summons.Add(new Summon()
                    {
                        Name   = summon.name,
                        Chance = Math.Min(1, (double)summon.chance / 100),
                        Rate   = (uint)((summon.interval > 0) ? summon.interval : summon.speed),
                        Max    = summon.max,
                        Force  = summon.force
                    });
                }
            }
            else
            {
                monster.MaxSummons = 0;
            }

            if (tfsMonster.attacks != null)
            {
                XmlSpellsToGeneric(ref monster, tfsMonster.attacks.attack, SpellCategory.Offensive);
            }

            // Defenses
            if (tfsMonster.defenses != null)
            {
                monster.TotalArmor = tfsMonster.defenses.armor;
                monster.Shielding  = tfsMonster.defenses.defense;
                XmlSpellsToGeneric(ref monster, tfsMonster.defenses.defenses, SpellCategory.Defensive);
            }

            #region parseElements
            if ((tfsMonster.elements != null) &&
                (tfsMonster.elements.element != null))
            {
                foreach (var x in tfsMonster.elements.element)
                {
                    int value;
                    if (int.TryParse(x.attr[0].Value, out value))
                    {
                        if (x.attr[0].Name == "physicalPercent")
                        {
                            monster.Physical = tfstoGenericElementalPercent(value);
                        }
                        else if (x.attr[0].Name == "icePercent")
                        {
                            monster.Ice = tfstoGenericElementalPercent(value);
                        }
                        else if (x.attr[0].Name == "poisonPercent")
                        {
                            monster.Earth = tfstoGenericElementalPercent(value);
                        }
                        else if (x.attr[0].Name == "earthPercent")
                        {
                            monster.Earth = tfstoGenericElementalPercent(value);
                        }
                        else if (x.attr[0].Name == "firePercent")
                        {
                            monster.Fire = tfstoGenericElementalPercent(value);
                        }
                        else if (x.attr[0].Name == "energyPercent")
                        {
                            monster.Energy = tfstoGenericElementalPercent(value);
                        }
                        else if (x.attr[0].Name == "holyPercent")
                        {
                            monster.Holy = tfstoGenericElementalPercent(value);
                        }
                        else if (x.attr[0].Name == "deathPercent")
                        {
                            monster.Death = tfstoGenericElementalPercent(value);
                        }
                        else if (x.attr[0].Name == "drownPercent")
                        {
                            monster.Drown = tfstoGenericElementalPercent(value);
                        }
                        else if (x.attr[0].Name == "lifedrainPercent")
                        {
                            monster.LifeDrain = tfstoGenericElementalPercent(value);
                        }
                        else if (x.attr[0].Name == "manadrainPercent")
                        {
                            monster.ManaDrain = tfstoGenericElementalPercent(value);
                        }
                    }
                }
            }
            #endregion

            #region paraseImmunities
            if ((tfsMonster.immunities != null) &&
                (tfsMonster.immunities.immunity != null))
            {
                foreach (Immunity immunity in tfsMonster.immunities.immunity)
                {
                    if (immunity.name != namedImmunityXml.NA)
                    {
                        switch (immunity.name)
                        {
                        case namedImmunityXml.physical:
                            monster.Physical = 0;
                            break;

                        case namedImmunityXml.energy:
                            monster.Energy = 0;
                            break;

                        case namedImmunityXml.fire:
                            monster.Fire = 0;
                            break;

                        case namedImmunityXml.poison:     //namedImmunityXml.earth
                            monster.Earth = 0;
                            break;

                        case namedImmunityXml.drown:
                            monster.Drown = 0;
                            break;

                        case namedImmunityXml.ice:
                            monster.Ice = 0;
                            break;

                        case namedImmunityXml.holy:
                            monster.Holy = 0;
                            break;

                        case namedImmunityXml.death:
                            monster.Death = 0;
                            break;

                        case namedImmunityXml.lifedrain:
                            monster.LifeDrain = 0;
                            break;

                        case namedImmunityXml.manadrain:
                            monster.ManaDrain = 0;
                            break;

                        case namedImmunityXml.paralyze:
                            monster.IgnoreParalyze = true;
                            break;

                        case namedImmunityXml.outfit:
                            monster.IgnoreOutfit = true;
                            break;

                        case namedImmunityXml.drunk:
                            monster.IgnoreDrunk = true;
                            break;

                        case namedImmunityXml.invisible:     //namedImmunityXml.invisibility
                            monster.IgnoreInvisible = true;
                            break;

                        case namedImmunityXml.bleed:
                            monster.IgnoreBleed = true;
                            break;
                        }
                    }
                    else if (immunity.physical != 0)
                    {
                        monster.Physical = 0;
                    }
                    else if (immunity.energy != 0)
                    {
                        monster.Energy = 0;
                    }
                    else if (immunity.fire != 0)
                    {
                        monster.Fire = 0;
                    }
                    else if (immunity.poison != 0) //poison and earth are the same
                    {
                        monster.Earth = 0;
                    }
                    else if (immunity.earth != 0) //poison and earth are the same
                    {
                        monster.Earth = 0;
                    }
                    else if (immunity.drown != 0)
                    {
                        monster.Drown = 0;
                    }
                    else if (immunity.ice != 0)
                    {
                        monster.Ice = 0;
                    }
                    else if (immunity.holy != 0)
                    {
                        monster.Holy = 0;
                    }
                    else if (immunity.death != 0)
                    {
                        monster.Death = 0;
                    }
                    else if (immunity.lifedrain != 0)
                    {
                        monster.LifeDrain = 0;
                    }
                    else if (immunity.manadrain != 0)
                    {
                        monster.ManaDrain = 0;
                    }
                    else if (immunity.paralyze != 0)
                    {
                        monster.IgnoreParalyze = true;
                    }
                    else if (immunity.outfit != 0)
                    {
                        monster.IgnoreOutfit = true;
                    }
                    else if (immunity.bleed != 0)
                    {
                        monster.IgnoreBleed = true;
                    }
                    else if (immunity.drunk != 0)
                    {
                        monster.IgnoreDrunk = true;
                    }
                    else if (immunity.invisible != 0) //invisible and invisibility are the same
                    {
                        monster.IgnoreInvisible = true;
                    }
                    else if (immunity.invisibility != 0) //invisible and invisibility are the same
                    {
                        monster.IgnoreInvisible = true;
                    }
                }
            }
            #endregion

            // Loot
            if ((tfsMonster.loot != null) &&
                (tfsMonster.loot.item != null))
            {
                foreach (var item in tfsMonster.loot.item)
                {
                    string itemType = "";
                    if (!string.IsNullOrEmpty(item.name))
                    {
                        itemType = item.name;
                    }
                    else if (item.id > 0)
                    {
                        itemType = item.id.ToString();
                    }

                    decimal chance = 1;
                    if (item.chance > 0)
                    {
                        chance = item.chance;
                    }
                    else if (item.chance1 > 0)
                    {
                        chance = item.chance1;
                    }

                    chance /= MAX_LOOTCHANCE;

                    Loot commonItem = new Loot()
                    {
                        Item   = itemType,
                        Chance = chance,
                        Count  = item.countmax
                    };
                    monster.Items.Add(commonItem);
                }
            }
        }
Example #18
0
 public void ShowLootWindow(Loot loot)
 {
     lootWindow.SetActive(true);
     lootWindowC.ShowLoot(loot);
 }
Example #19
0
 private void OnLootFlipped(Loot loot)
 {
     AudioManager.instance.Play(SoundInfo.itemFlippy, loot.transform);
     AudioManager.instance.Play(loot.item.dropSound, loot.transform, delay: loot.item.dropSoundDelay);
 }
Example #20
0
        public static void Fill(LockableContainer cont, int luck, int level, bool isSos, Map map)
        {
            cont.Movable = false;
            cont.Locked  = true;
            int count;

            if (level == 0)
            {
                cont.LockLevel = 0; // Can't be unlocked

                cont.DropItem(new Gold(Utility.RandomMinMax(50, 100)));

                if (Utility.RandomDouble() < 0.75)
                {
                    cont.DropItem(new TreasureMap(0, Map.Trammel));
                }
            }
            else
            {
                cont.TrapType  = TrapType.ExplosionTrap;
                cont.TrapPower = level * 25;
                cont.TrapLevel = level;

                switch (level)
                {
                case 1:
                    cont.RequiredSkill = 5;
                    break;

                case 2:
                    cont.RequiredSkill = 45;
                    break;

                case 3:
                    cont.RequiredSkill = 65;
                    break;

                case 4:
                    cont.RequiredSkill = 75;
                    break;

                case 5:
                    cont.RequiredSkill = 75;
                    break;

                case 6:
                    cont.RequiredSkill = 80;
                    break;

                case 7:
                    cont.RequiredSkill = 80;
                    break;
                }

                cont.LockLevel    = cont.RequiredSkill - 10;
                cont.MaxLockLevel = cont.RequiredSkill + 40;

                #region Gold
                cont.DropItem(new Gold(isSos ? level * 10000 : level * 5000));
                #endregion

                #region Scrolls
                if (isSos)
                {
                    switch (level)
                    {
                    default: count = 20; break;

                    case 0:
                    case 1: count = Utility.RandomMinMax(2, 5); break;

                    case 2: count = Utility.RandomMinMax(10, 15); break;
                    }
                }
                else
                {
                    count = level * 5;
                }

                for (int i = 0; i < count; ++i)
                {
                    cont.DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular));
                }
                #endregion

                #region Magical Items
                double propsScale = 1.0;

                if (Core.SE)
                {
                    switch (level)
                    {
                    case 1:
                        count      = isSos ? Utility.RandomMinMax(2, 6) : 32;
                        propsScale = 0.5625;
                        break;

                    case 2:
                        count      = isSos ? Utility.RandomMinMax(10, 15) : 40;
                        propsScale = 0.6875;
                        break;

                    case 3:
                        count      = isSos ? Utility.RandomMinMax(15, 20) : 48;
                        propsScale = 0.875;
                        break;

                    case 4:
                        count = isSos ? Utility.RandomMinMax(15, 20) : 56;
                        break;

                    case 5:
                        count = isSos ? Utility.RandomMinMax(15, 20) : 64;
                        break;

                    case 6:
                        count = isSos ? Utility.RandomMinMax(15, 20) : 72;
                        break;

                    case 7:
                        count = isSos ? Utility.RandomMinMax(15, 20) : 80;
                        break;

                    default:
                        count = 0;
                        break;
                    }
                }
                else
                {
                    count = level * 6;
                }

                for (int i = 0; i < count; ++i)
                {
                    Item item;

                    if (Core.AOS)
                    {
                        item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
                    }
                    else
                    {
                        item = Loot.RandomArmorOrShieldOrWeapon();
                    }

                    if (item != null && Core.HS && RandomItemGenerator.Enabled)
                    {
                        int min, max;
                        GetRandomItemStat(out min, out max, propsScale);

                        RunicReforging.GenerateRandomItem(item, luck, min, max, map);

                        cont.DropItem(item);
                    }
                    else if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(weapon, attributeCount, min, max);
                        }
                        else
                        {
                            weapon.DamageLevel     = (WeaponDamageLevel)Utility.Random(6);
                            weapon.AccuracyLevel   = (WeaponAccuracyLevel)Utility.Random(6);
                            weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max);
                        }
                        else
                        {
                            armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
                            armor.Durability      = (ArmorDurabilityLevel)Utility.Random(6);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseHat)
                    {
                        BaseHat hat = (BaseHat)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(hat, attributeCount, min, max);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseJewel)
                    {
                        int attributeCount;
                        int min, max;

                        GetRandomAOSStats(out attributeCount, out min, out max);

                        BaseRunicTool.ApplyAttributesTo((BaseJewel)item, attributeCount, min, max);

                        cont.DropItem(item);
                    }
                }
            }
            #endregion

            #region Reagents
            if (isSos)
            {
                switch (level)
                {
                default: count = Utility.RandomMinMax(45, 60); break;

                case 0:
                case 1: count = Utility.RandomMinMax(15, 20); break;

                case 2: count = Utility.RandomMinMax(25, 40); break;
                }
            }
            else
            {
                count = level == 0 ? 12 : Utility.RandomMinMax(40, 60) * (level + 1);
            }

            for (int i = 0; i < count; i++)
            {
                cont.DropItemStacked(Loot.RandomPossibleReagent());
            }
            #endregion

            #region Gems
            if (level == 0)
            {
                count = 2;
            }
            else
            {
                count = (level * 3) + 1;
            }

            for (int i = 0; i < count; i++)
            {
                cont.DropItem(Loot.RandomGem());
            }
            #endregion

            #region Imbuing Ingreds
            if (level > 1)
            {
                Item item = Loot.Construct(m_ImbuingIngreds[Utility.Random(m_ImbuingIngreds.Length)]);

                item.Amount = level;
                cont.DropItem(item);
            }
            #endregion

            Item arty    = null;
            Item special = null;

            if (isSos)
            {
                if (0.004 * level > Utility.RandomDouble())
                {
                    arty = Loot.Construct(m_SOSArtifacts);
                }
                if (0.006 * level > Utility.RandomDouble())
                {
                    special = Loot.Construct(m_SOSDecor);
                }
                else if (0.009 * level > Utility.RandomDouble())
                {
                    special = new TreasureMap(Utility.RandomMinMax(level, Math.Min(7, level + 1)), cont.Map);
                }
            }
            else
            {
                if (level >= 7)
                {
                    if (0.025 > Utility.RandomDouble())
                    {
                        special = Loot.Construct(m_LevelSevenOnly);
                    }
                    else if (0.10 > Utility.RandomDouble())
                    {
                        special = Loot.Construct(m_LevelFiveToSeven);
                    }
                    else if (0.25 > Utility.RandomDouble())
                    {
                        special = GetRandomSpecial(level, cont.Map);
                    }

                    arty = Loot.Construct(m_Artifacts);
                }
                else if (level >= 6)
                {
                    if (0.025 > Utility.RandomDouble())
                    {
                        special = Loot.Construct(m_LevelFiveToSeven);
                    }
                    else if (0.20 > Utility.RandomDouble())
                    {
                        special = GetRandomSpecial(level, cont.Map);
                    }

                    arty = Loot.Construct(m_Artifacts);
                }
                else if (level >= 5)
                {
                    if (0.005 > Utility.RandomDouble())
                    {
                        special = Loot.Construct(m_LevelFiveToSeven);
                    }
                    else if (0.15 > Utility.RandomDouble())
                    {
                        special = GetRandomSpecial(level, cont.Map);
                    }
                }
                else if (.10 > Utility.RandomDouble())
                {
                    special = GetRandomSpecial(level, cont.Map);
                }
            }

            if (arty != null)
            {
                Container pack = new Backpack();
                pack.Hue = 1278;

                pack.DropItem(arty);
                cont.DropItem(pack);
            }

            if (special != null)
            {
                cont.DropItem(special);
            }

            if (Core.SA)
            {
                int rolls = 2;

                if (level >= 5)
                {
                    rolls += level - 2;
                }

                RefinementComponent.Roll(cont, rolls, 0.10);
            }
        }
Example #21
0
        public CrimsonDrake(ElementType type)
            : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
        {
            m_Type = type;

            switch (type)
            {
            case ElementType.Physical:
                Body = 0x58B;
                Hue  = 0;
                SetDamageType(ResistanceType.Physical, 100);
                break;

            case ElementType.Fire:
                Body = 0x58C;
                Hue  = 33929;
                SetDamageType(ResistanceType.Physical, 0);
                SetDamageType(ResistanceType.Fire, 100);
                break;

            case ElementType.Cold:
                Body = 0x58C;
                Hue  = 34134;
                SetDamageType(ResistanceType.Physical, 0);
                SetDamageType(ResistanceType.Cold, 100);
                break;

            case ElementType.Poison:
                Body = 0x58C;
                Hue  = 34136;
                SetDamageType(ResistanceType.Physical, 0);
                SetDamageType(ResistanceType.Poison, 100);
                break;

            case ElementType.Energy:
                Body = 0x58C;
                Hue  = 34141;
                SetDamageType(ResistanceType.Physical, 0);
                SetDamageType(ResistanceType.Energy, 100);
                break;
            }

            Name        = "Crimson Drake";
            Female      = true;
            BaseSoundID = 362;

            SetStr(400, 430);
            SetDex(133, 152);
            SetInt(101, 140);

            SetHits(241, 258);

            SetDamage(11, 17);

            SetResistance(ResistanceType.Physical, 30, 50);
            SetResistance(ResistanceType.Fire, 30, 40);
            SetResistance(ResistanceType.Cold, 30, 40);
            SetResistance(ResistanceType.Poison, 40, 50);
            SetResistance(ResistanceType.Energy, 30, 50);

            SetSkill(SkillName.MagicResist, 65.1, 80.0);
            SetSkill(SkillName.Tactics, 65.1, 90.0);
            SetSkill(SkillName.Wrestling, 65.1, 80.0);
            SetSkill(SkillName.DetectHidden, 50.0, 60.0);
            SetSkill(SkillName.Focus, 5.0, 10.0);

            Fame  = 5500;
            Karma = -5500;

            VirtualArmor = 46;

            Tamable      = true;
            ControlSlots = 2;
            MinTameSkill = 85.0;

            PackItem(Loot.PackReg(3));
            SetSpecialAbility(SpecialAbility.DragonBreath);
        }
 public void MergeFrom(FortSearchResponse other)
 {
     if (other == null)
     {
         return;
     }
     if (other.Result != 0)
     {
         Result = other.Result;
     }
     itemsAwarded_.Add(other.itemsAwarded_);
     if (other.GemsAwarded != 0)
     {
         GemsAwarded = other.GemsAwarded;
     }
     if (other.pokemonDataEgg_ != null)
     {
         if (pokemonDataEgg_ == null)
         {
             pokemonDataEgg_ = new global::POGOProtos.Data.PokemonData();
         }
         PokemonDataEgg.MergeFrom(other.PokemonDataEgg);
     }
     if (other.ExperienceAwarded != 0)
     {
         ExperienceAwarded = other.ExperienceAwarded;
     }
     if (other.CooldownCompleteTimestampMs != 0L)
     {
         CooldownCompleteTimestampMs = other.CooldownCompleteTimestampMs;
     }
     if (other.ChainHackSequenceNumber != 0)
     {
         ChainHackSequenceNumber = other.ChainHackSequenceNumber;
     }
     if (other.awardedGymBadge_ != null)
     {
         if (awardedGymBadge_ == null)
         {
             awardedGymBadge_ = new global::POGOProtos.Data.Badge.AwardedGymBadge();
         }
         AwardedGymBadge.MergeFrom(other.AwardedGymBadge);
     }
     if (other.loot_ != null)
     {
         if (loot_ == null)
         {
             loot_ = new global::POGOProtos.Inventory.Loot();
         }
         Loot.MergeFrom(other.Loot);
     }
     if (other.bonusLoot_ != null)
     {
         if (bonusLoot_ == null)
         {
             bonusLoot_ = new global::POGOProtos.Inventory.Loot();
         }
         BonusLoot.MergeFrom(other.BonusLoot);
     }
     if (other.RaidTickets != 0)
     {
         RaidTickets = other.RaidTickets;
     }
     if (other.teamBonusLoot_ != null)
     {
         if (teamBonusLoot_ == null)
         {
             teamBonusLoot_ = new global::POGOProtos.Inventory.Loot();
         }
         TeamBonusLoot.MergeFrom(other.TeamBonusLoot);
     }
     if (other.FortId.Length != 0)
     {
         FortId = other.FortId;
     }
 }
Example #23
0
        public static void Fill(LockableContainer cont, int level)
        {
            cont.Movable = false;
            cont.Locked  = true;
            int numberItems;

            if (level == 0)
            {
                cont.LockLevel = 0; // Can't be unlocked

                cont.DropItem(new Gold(Utility.RandomMinMax(50, 100)));

                if (Utility.RandomDouble() < 0.75)
                {
                    cont.DropItem(new TreasureMap(0, Map.Trammel));
                }
            }
            else
            {
                cont.TrapType  = TrapType.ExplosionTrap;
                cont.TrapPower = level * 25;
                cont.TrapLevel = level;

                switch (level)
                {
                case 1:
                    cont.RequiredSkill = 36;
                    break;

                case 2:
                    cont.RequiredSkill = 76;
                    break;

                case 3:
                    cont.RequiredSkill = 84;
                    break;

                case 4:
                    cont.RequiredSkill = 92;
                    break;

                case 5:
                    cont.RequiredSkill = 100;
                    break;

                case 6:
                    cont.RequiredSkill = 100;
                    break;
                }

                cont.LockLevel    = cont.RequiredSkill - 10;
                cont.MaxLockLevel = cont.RequiredSkill + 40;

                //Publish 67 gold change
                //if ( Core.SA )
                //	cont.DropItem( new Gold( level * 5000 ) );
                //else
                cont.DropItem(new Gold(level * 1000));

                for (int i = 0; i < level * 5; ++i)
                {
                    cont.DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular));
                }

                if (Core.SE)
                {
                    switch (level)
                    {
                    case 1:
                        numberItems = 5;
                        break;

                    case 2:
                        numberItems = 10;
                        break;

                    case 3:
                        numberItems = 15;
                        break;

                    case 4:
                        numberItems = 38;
                        break;

                    case 5:
                        numberItems = 50;
                        break;

                    case 6:
                        numberItems = 60;
                        break;

                    default:
                        numberItems = 0;
                        break;
                    }
                }
                else
                {
                    numberItems = level * 6;
                }

                for (int i = 0; i < numberItems; ++i)
                {
                    Item item;

                    if (Core.AOS)
                    {
                        item = Loot.RandomArmorOrShieldOrWeaponOrJewelry();
                    }
                    else
                    {
                        item = Loot.RandomArmorOrShieldOrWeapon();
                    }

                    if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(weapon, attributeCount, min, max);
                        }
                        else
                        {
                            weapon.DamageLevel     = (WeaponDamageLevel)Utility.Random(6);
                            weapon.AccuracyLevel   = (WeaponAccuracyLevel)Utility.Random(6);
                            weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(armor, attributeCount, min, max);
                        }
                        else
                        {
                            armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
                            armor.Durability      = (ArmorDurabilityLevel)Utility.Random(6);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseHat)
                    {
                        BaseHat hat = (BaseHat)item;

                        if (Core.AOS)
                        {
                            int attributeCount;
                            int min, max;

                            GetRandomAOSStats(out attributeCount, out min, out max);

                            BaseRunicTool.ApplyAttributesTo(hat, attributeCount, min, max);
                        }

                        cont.DropItem(item);
                    }
                    else if (item is BaseJewel)
                    {
                        int attributeCount;
                        int min, max;

                        GetRandomAOSStats(out attributeCount, out min, out max);

                        BaseRunicTool.ApplyAttributesTo((BaseJewel)item, attributeCount, min, max);

                        cont.DropItem(item);
                    }
                }
            }

            int reagents;

            if (level == 0)
            {
                reagents = 12;
            }
            else
            {
                reagents = level * 3;
            }

            for (int i = 0; i < reagents; i++)
            {
                Item item = Loot.RandomPossibleReagent();
                item.Amount = Utility.RandomMinMax(40, 60);
                cont.DropItem(item);
            }

            int gems;

            if (level == 0)
            {
                gems = 2;
            }
            else
            {
                gems = level * 3;
            }

            for (int i = 0; i < gems; i++)
            {
                Item item = Loot.RandomGem();
                cont.DropItem(item);
            }

            if (level == 6 && Core.AOS)
            {
                cont.DropItem((Item)Activator.CreateInstance(m_Artifacts[Utility.Random(m_Artifacts.Length)]));
            }
        }
Example #24
0
        public bool GiveReward(Mobile to)
        {
            Bag bag = new Bag();

            bag.DropItem(new Gold(Utility.RandomMinMax(500, 1000)));

            if (Utility.RandomBool())
            {
                BaseWeapon weapon = Loot.RandomWeapon();

                if (Core.AOS)
                {
                    BaseRunicTool.ApplyAttributesTo(weapon, 2, 20, 30);
                }
                else
                {
                    weapon.DamageLevel     = (WeaponDamageLevel)RandomMinMaxScaled(2, 3);
                    weapon.AccuracyLevel   = (WeaponAccuracyLevel)RandomMinMaxScaled(2, 3);
                    weapon.DurabilityLevel = (WeaponDurabilityLevel)RandomMinMaxScaled(2, 3);
                }

                bag.DropItem(weapon);
            }
            else
            {
                Item item;

                if (Core.AOS)
                {
                    item = Loot.RandomArmorOrShieldOrJewelry();

                    if (item is BaseArmor armor)
                    {
                        BaseRunicTool.ApplyAttributesTo(armor, 2, 20, 30);
                    }
                    else if (item is BaseJewel jewel)
                    {
                        BaseRunicTool.ApplyAttributesTo(jewel, 2, 20, 30);
                    }
                }
                else
                {
                    BaseArmor armor = Loot.RandomArmorOrShield();
                    item = armor;

                    armor.ProtectionLevel = (ArmorProtectionLevel)RandomMinMaxScaled(2, 3);
                    armor.Durability      = (ArmorDurabilityLevel)RandomMinMaxScaled(2, 3);
                }

                bag.DropItem(item);
            }

            bag.DropItem(new Obsidian());

            if (to.PlaceInBackpack(bag))
            {
                return(true);
            }

            bag.Delete();
            return(false);
        }
Example #25
0
        public virtual void Fill()
        {
            Reset();

            List <Item> contains = new List <Item>(Items);

            foreach (var i in contains)
            {
                i.Delete();
            }

            ColUtility.Free(contains);

            for (int i = 0; i < Utility.RandomMinMax(6, 12); i++)
            {
                DropItem(Loot.RandomGem());
            }

            DropItem(new Gold(Utility.RandomMinMax(800, 1100)));

            Item item = null;

            if (0.30 > Utility.RandomDouble())
            {
                switch (Utility.Random(7))
                {
                case 0:
                    item = new Bandage(Utility.Random(10, 30)); break;

                case 1:
                    item        = new SmokeBomb();
                    item.Amount = Utility.Random(3, 6);
                    break;

                case 2:
                    item        = new InvisibilityPotion();
                    item.Amount = Utility.Random(1, 3);
                    break;

                case 3:
                    item = new Lockpick(Utility.Random(1, 10)); break;

                case 4:
                    item = new DreadHornMane(Utility.Random(1, 2)); break;

                case 5:
                    item = new Corruption(Utility.Random(1, 2)); break;

                case 6:
                    item = new Taint(Utility.Random(1, 2)); break;
                }

                DropItem(item);
            }

            if (0.25 > Utility.RandomDouble())
            {
                DropItem(new CounterfeitPlatinum());
            }

            if (0.2 > Utility.RandomDouble())
            {
                switch (Utility.Random(3))
                {
                case 0:
                    item = new ZombiePainting(); break;

                case 1:
                    item = new SkeletonPortrait(); break;

                case 2:
                    item = new LichPainting(); break;
                }

                DropItem(item);
            }

            if (0.1 > Utility.RandomDouble())
            {
                item = Loot.RandomArmorOrShieldOrWeaponOrJewelry(LootPackEntry.IsInTokuno(this), LootPackEntry.IsMondain(this), LootPackEntry.IsStygian(this));

                if (item != null)
                {
                    int min, max;

                    TreasureMapChest.GetRandomItemStat(out min, out max, 1.0);

                    RunicReforging.GenerateRandomItem(item, null, Utility.RandomMinMax(min, max), 0, ReforgedPrefix.None, ReforgedSuffix.Khaldun, Map);

                    DropItem(item);
                }
            }
        }
Example #26
0
        public static void Fill(LockableContainer cont, int level)
        {
            cont.Movable = false;
            cont.Locked  = true;
            int numberItems;

            if (level == 0)
            {
                cont.LockLevel = 0;                 // Can't be unlocked

                cont.DropItem(new Gold(Utility.RandomMinMax(50, 100)));

                if (Utility.RandomDouble() < 0.75)
                {
                    cont.DropItem(new TreasureMap(0, Map.Felucca));
                }
            }
            else
            {
                cont.TrapType  = TrapType.ExplosionTrap;
                cont.TrapPower = level * 25;
                cont.TrapLevel = level;

                switch (level)
                {
                case 1: cont.RequiredSkill = 36; break;

                case 2: cont.RequiredSkill = 76; break;

                case 3: cont.RequiredSkill = 84; break;

                case 4: cont.RequiredSkill = 92; break;

                case 5: cont.RequiredSkill = 100; break;

                case 6: cont.RequiredSkill = 100; break;
                }

                cont.LockLevel    = cont.RequiredSkill - 10;
                cont.MaxLockLevel = cont.RequiredSkill + 40;

                //Publish 67 gold change
                //if ( Core.SA )
                //	cont.DropItem( new Gold( level * 5000 ) );
                //else
                cont.DropItem(new Gold(level * 1000));

                for (int i = 0; i < level * 5; ++i)
                {
                    cont.DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular));
                }

                numberItems = level * 6;

                for (int i = 0; i < numberItems; ++i)
                {
                    Item item = Loot.RandomArmorOrShieldOrWeapon();

                    if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;

                        weapon.DamageLevel     = (WeaponDamageLevel)Utility.Random(6);
                        weapon.AccuracyLevel   = (WeaponAccuracyLevel)Utility.Random(6);
                        weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6);

                        cont.DropItem(item);
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;

                        armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
                        armor.Durability      = (ArmorDurabilityLevel)Utility.Random(6);

                        cont.DropItem(item);
                    }
                    else if (item is BaseHat)
                    {
                        BaseHat hat = (BaseHat)item;

                        cont.DropItem(item);
                    }
                    else if (item is BaseJewel)
                    {
                        int attributeCount;
                        int min, max;

                        GetRandomAOSStats(out attributeCount, out min, out max);

                        cont.DropItem(item);
                    }
                }
            }

            int reagents;

            if (level == 0)
            {
                reagents = 12;
            }
            else
            {
                reagents = level * 3;
            }

            for (int i = 0; i < reagents; i++)
            {
                Item item = Loot.RandomPossibleReagent();
                item.Amount = Utility.RandomMinMax(40, 60);
                cont.DropItem(item);
            }

            int gems;

            if (level == 0)
            {
                gems = 2;
            }
            else
            {
                gems = level * 3;
            }

            for (int i = 0; i < gems; i++)
            {
                Item item = Loot.RandomGem();
                cont.DropItem(item);
            }
        }
Example #27
0
        public DupresChampion() : base(AIType.AI_Melee, FightMode.Aggressor, 10, 1, 0.2, 0.4)
        {
            Name   = NameList.RandomName("male");
            Title  = "The Champion";
            Body   = 0x190;
            Hue    = Utility.RandomSkinHue();
            Female = false;

            SetStr(190, 200);
            SetDex(50, 75);
            SetInt(150, 250);
            SetHits(3900, 4100);
            SetDamage(22, 28);

            SetDamageType(ResistanceType.Physical, 100);

            SetResistance(ResistanceType.Physical, 50, 70);
            SetResistance(ResistanceType.Fire, 50, 70);
            SetResistance(ResistanceType.Cold, 50, 70);
            SetResistance(ResistanceType.Poison, 50, 70);
            SetResistance(ResistanceType.Energy, 50, 70);

            SetSkill(SkillName.EvalInt, 195.0, 220.0);
            SetSkill(SkillName.Magery, 195.0, 220.0);
            SetSkill(SkillName.Meditation, 195.0, 200.0);
            SetSkill(SkillName.MagicResist, 100.0, 120.0);
            SetSkill(SkillName.Tactics, 195.0, 220.0);
            SetSkill(SkillName.Wrestling, 195.0, 220.0);

            VirtualArmor = 70;

            Item cutlass = new Cutlass();

            cutlass.LootType = LootType.Blessed;
            SetWearable(cutlass);

            Item ph = new PlateHelm();

            ph.LootType = LootType.Blessed;
            ph.Hue      = 0x8A5; // gold
            SetWearable(ph);

            Item pa = new PlateArms();

            pa.LootType = LootType.Blessed;
            pa.Hue      = 0x8A5; // gold
            SetWearable(pa);

            Item pg = new PlateGorget();

            pg.LootType = LootType.Blessed;
            pg.Hue      = 0x8A5; // gold
            SetWearable(pg);

            Item pgl = new PlateGloves();

            pgl.LootType = LootType.Blessed;
            pgl.Hue      = 0x8A5; // gold
            SetWearable(pgl);

            Item pl = new PlateLegs();

            pl.LootType = LootType.Blessed;
            pl.Hue      = 0x8A5; // gold
            SetWearable(pl);

            Item pc = new PlateChest();

            pc.LootType = LootType.Blessed;
            pc.Hue      = 0x8A5; // gold
            SetWearable(pc);

            Item mks = new MetalKiteShield();

            mks.LootType = LootType.Blessed;
            mks.Hue      = 0x776;
            SetWearable(mks);

            Item bs = new BodySash(0x486); // dark purple

            bs.LootType = LootType.Blessed;
            SetWearable(bs);

            Item cloak = new Cloak(0x486); // dark purple

            cloak.LootType = LootType.Blessed;
            SetWearable(cloak);

            PackItem(Loot.PackGold(250, 600));
        }
Example #28
0
 public void Populate(Loot loot, IList<LootDef> defs)
 {
     defs.Add(new LootDef(XmlDatas.ItemDescs[XmlDatas.IdToType[item]], probability));
 }
Example #29
0
        public IceSerpent() : base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
        {
            Name        = "a giant ice serpent";
            Body        = 89;
            BaseSoundID = 219;

            SetStr(216, 245);
            SetDex(26, 50);
            SetInt(66, 85);

            SetHits(130, 147);
            SetMana(0);

            SetDamage(7, 17);

            SetDamageType(ResistanceType.Physical, 10);
            SetDamageType(ResistanceType.Cold, 90);

            SetResistance(ResistanceType.Physical, 30, 35);
            SetResistance(ResistanceType.Cold, 80, 90);
            SetResistance(ResistanceType.Poison, 15, 25);
            SetResistance(ResistanceType.Energy, 10, 20);

            SetSkill(SkillName.Anatomy, 27.5, 50.0);
            SetSkill(SkillName.MagicResist, 25.1, 40.0);
            SetSkill(SkillName.Tactics, 75.1, 80.0);
            SetSkill(SkillName.Wrestling, 60.1, 80.0);

            Fame  = 3500;
            Karma = -3500;

            VirtualArmor = 32;

            PackItem(Loot.RandomArmorOrShieldOrWeapon());

            switch (Utility.Random(10))
            {
            case 0: PackItem(new LeftArm()); break;

            case 1: PackItem(new RightArm()); break;

            case 2: PackItem(new Torso()); break;

            case 3: PackItem(new Bone()); break;

            case 4: PackItem(new RibCage()); break;

            case 5: PackItem(new RibCage()); break;

            case 6: PackItem(new BonePile()); break;

            case 7: PackItem(new BonePile()); break;

            case 8: PackItem(new BonePile()); break;

            case 9: PackItem(new BonePile()); break;
            }

            if (0.025 > Utility.RandomDouble())
            {
                PackItem(new GlacialStaff());
            }
        }
Example #30
0
        public TreasureLevel4() : base(Utility.RandomList(0xe40, 0xe42, 0x9ab))
        {
            RequiredSkill = 92;
            LockLevel     = this.RequiredSkill - Utility.Random(1, 10);
            MaxLockLevel  = this.RequiredSkill;
            TrapType      = TrapType.MagicTrap;
            TrapPower     = 4 * Utility.Random(1, 25);

            DropItem(new Gold(200, 400));
            DropItem(new BlankScroll(Utility.Random(1, 4)));

            for (int i = Utility.Random(1, 4); i > 1; i--)
            {
                Item ReagentLoot = Loot.RandomReagent();
                ReagentLoot.Amount = Utility.Random(6, 12);
                DropItem(ReagentLoot);
            }

            for (int i = Utility.Random(1, 4); i > 1; i--)
            {
                DropItem(Loot.RandomPotion());
            }

            if (0.75 > Utility.RandomDouble())               //75% chance = 3/4
            {
                for (int i = Utility.RandomMinMax(8, 16); i > 0; i--)
                {
                    DropItem(Loot.RandomScroll(0, 47, SpellbookType.Regular));
                }
            }

            if (0.75 > Utility.RandomDouble())               //75% chance = 3/4
            {
                for (int i = Utility.RandomMinMax(6, 12) + 1; i > 0; i--)
                {
                    DropItem(Loot.RandomGem());
                }
            }

            for (int i = Utility.Random(1, 4); i > 1; i--)
            {
                DropItem(Loot.RandomWand());
            }

            // Magical ArmorOrWeapon
            for (int i = Utility.Random(1, 4); i > 1; i--)
            {
                Item item = Loot.RandomArmorOrShieldOrWeapon();

                if (!Core.AOS)
                {
                    if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;
                        weapon.DamageLevel     = (WeaponDamageLevel)Utility.Random(4);
                        weapon.AccuracyLevel   = (WeaponAccuracyLevel)Utility.Random(4);
                        weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(4);
                        weapon.Quality         = WeaponQuality.Regular;
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;
                        armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(4);
                        armor.Durability      = (ArmorDurabilityLevel)Utility.Random(4);
                        armor.Quality         = ArmorQuality.Regular;
                    }
                }
                else
                {
                    AddLoot(item);
                }
            }

            for (int i = Utility.Random(1, 2); i > 1; i--)
            {
                AddLoot(Loot.RandomClothing());
            }

            for (int i = Utility.Random(1, 2); i > 1; i--)
            {
                AddLoot(Loot.RandomJewelry());
            }

            DropItem(new MagicCrystalBall());

            // Magic clothing (not implemented)

            // Magic jewelry (not implemented)
        }
Example #31
0
        protected bool DistributeLoot(ICommandContext context, LootDistribution distribution)
        {
            switch (LootDistState)
            {
            case 0:
                switch (distribution)
                {
                case LootDistribution.Normal:
                    LootDistState = 1;
                    Loot.Sort((x, y) => x.ItemRarity.CompareTo(y.ItemRarity));
                    if (Loot.FindAll(x => x.ItemRarity == Rarity.Legendary).Count > 0)
                    {
                        LegendaryLoot.AddRange(Loot.FindAll(x => x.ItemRarity == Rarity.Legendary));
                        Loot.RemoveAll(x => LegendaryLoot.Contains(x));
                    }
                    else
                    {
                        SetDuplicatedLoot();
                    }

                    if (LegendaryLoot.Count > 0 || DuplicatedLoot != null)
                    {
                        SendDuplicatedLoot();
                    }

                    LootPlayers = ActivePlayers.Values.ToList();
                    LootPlayers.Sort((x, y) => Scores[x.Id].GetTotalScore().CompareTo(Scores[y.Id].GetTotalScore()));
                    //ActivePlayers.OrderBy(x => Scores[x.Key]);
                    return(DistributeLoot(context, distribution));

                case LootDistribution.Duplicate:
                    break;
                }
                break;

            case 1:     // Begin normal loot distribution
                if (Loot.Count > 0)
                {
                    if (LootPlayers.Count > 0)
                    {
                        SendLootEmbed($"{LootPlayers[0].Name}'s Pick\nCommands: `>loot <#>`");
                        LootDistState = 2;
                    }
                    else
                    {
                        LootDistState = 3;
                        return(DistributeLoot(context, distribution));
                    }
                }
                else
                {
                    LootDistState = 4;
                    return(DistributeLoot(context, distribution));
                }
                break;

            case 2:     // Player at 0 in LootPlayers (Highest score that has not picked) gets to pick loot.
                if (context.User.Id == LootPlayers[0].Id)
                {
                    if (context.Message.Content.ToLower().StartsWith(">loot"))
                    {
                        if (int.TryParse(context.Message.Content.Split(" ", StringSplitOptions.RemoveEmptyEntries)[1], out int num))
                        {
                            if (num < Loot.Count && num > 0)
                            {
                                num--;
                                LootPlayers[0].AddItemToInventory(Loot[num]);
                                SendGameMsg($"**{LootPlayers[0].Name}** looted **{Loot[num].Name}**");
                                Loot.RemoveAt(num);
                                LootPlayers.RemoveAt(0);
                                LootDistState = 1;
                                DistributeLoot(context, distribution);
                            }
                            else
                            {
                                SendGameMsg("Please select loot from the displayed loot. (number too large or below 1.)");
                            }
                        }
                        else
                        {
                            SendGameMsg("Must be a number whole after `>loot`");
                        }
                    }
                }
                break;

            case 3:     // Distribute remaning loot randomly between each player.
                Dictionary <Player, EmbedFieldBuilder> fields = new Dictionary <Player, EmbedFieldBuilder>();

                foreach (Player p in ActivePlayers.Values.ToArray())
                {
                    fields.Add(p, new EmbedFieldBuilder()
                    {
                        IsInline = false,
                        Name     = $"{p.Name}'s Loot"
                    });
                }

                while (Loot.Count > 0)
                {
                    foreach (Player p in fields.Keys)
                    {
                        int num = Program._rand.Next(Loot.Count);
                        p.AddItemToInventory(Loot[num]);
                        fields[p].Value += $"[{GetRarityString(Loot[num])}] {Loot[num].Name}\n";
                        Loot.Remove(Loot[num]);
                    }
                }

                var embed = new EmbedBuilder()
                {
                    Title  = "Random Loot Assignment",
                    Color  = Color.Gold,
                    Fields = fields.Values.ToList()
                };

                SendGameMsg(embed.Build());
                LootDistState = 4;
                return(DistributeLoot(context, distribution));

            case 4:
                SendGameMsg("All Loot Distributed.");
                return(true);
            }
            return(false);
        }
Example #32
0
        public override void OnTalk(PlayerMobile player, bool contextMenu)
        {
            Direction = GetDirectionTo(player);

            QuestSystem qs = player.Quest;

            if (qs is WitchApprenticeQuest)
            {
                if (qs.IsObjectiveInProgress(typeof(FindApprenticeObjective)))
                {
                    PlaySound(0x259);
                    PlaySound(0x206);
                    qs.AddConversation(new HagDuringCorpseSearchConversation());
                }
                else
                {
                    QuestObjective obj = qs.FindObjective(typeof(FindGrizeldaAboutMurderObjective));

                    if (obj != null && !obj.Completed)
                    {
                        PlaySound(0x420);
                        PlaySound(0x20);
                        obj.Complete();
                    }
                    else if (qs.IsObjectiveInProgress(typeof(KillImpsObjective)) ||
                             qs.IsObjectiveInProgress(typeof(FindZeefzorpulObjective)))
                    {
                        PlaySound(0x259);
                        PlaySound(0x206);
                        qs.AddConversation(new HagDuringImpSearchConversation());
                    }
                    else
                    {
                        obj = qs.FindObjective(typeof(ReturnRecipeObjective));

                        if (obj != null && !obj.Completed)
                        {
                            PlaySound(0x258);
                            PlaySound(0x41B);
                            obj.Complete();
                        }
                        else if (qs.IsObjectiveInProgress(typeof(FindIngredientObjective)))
                        {
                            PlaySound(0x259);
                            PlaySound(0x206);
                            qs.AddConversation(new HagDuringIngredientsConversation());
                        }
                        else
                        {
                            obj = qs.FindObjective(typeof(ReturnIngredientsObjective));

                            if (obj != null && !obj.Completed)
                            {
                                Container cont = GetNewContainer();

                                cont.DropItem(new BlackPearl(30));
                                cont.DropItem(new Bloodmoss(30));
                                cont.DropItem(new Garlic(30));
                                cont.DropItem(new Ginseng(30));
                                cont.DropItem(new MandrakeRoot(30));
                                cont.DropItem(new Nightshade(30));
                                cont.DropItem(new SulfurousAsh(30));
                                cont.DropItem(new SpidersSilk(30));

                                cont.DropItem(new Cauldron());
                                cont.DropItem(new MoonfireBrew());
                                cont.DropItem(new TreasureMap(Utility.RandomMinMax(1, 4), Map.Felucca));
                                cont.DropItem(new Gold(2000, 2200));

                                if (Utility.RandomBool())
                                {
                                    BaseWeapon weapon = Loot.RandomWeapon();

                                    if (Core.AOS)
                                    {
                                        BaseRunicTool.ApplyAttributesTo(weapon, 2, 20, 30);
                                    }
                                    else
                                    {
                                        weapon.DamageLevel     = (WeaponDamageLevel)BaseCreature.RandomMinMaxScaled(2, 3);
                                        weapon.AccuracyLevel   = (WeaponAccuracyLevel)BaseCreature.RandomMinMaxScaled(2, 3);
                                        weapon.DurabilityLevel = (WeaponDurabilityLevel)BaseCreature.RandomMinMaxScaled(2, 3);
                                    }

                                    cont.DropItem(weapon);
                                }
                                else
                                {
                                    Item item;

                                    if (Core.AOS)
                                    {
                                        item = Loot.RandomArmorOrShieldOrJewelry();

                                        if (item is BaseArmor)
                                        {
                                            BaseRunicTool.ApplyAttributesTo((BaseArmor)item, 2, 20, 30);
                                        }
                                        else if (item is BaseJewel)
                                        {
                                            BaseRunicTool.ApplyAttributesTo((BaseJewel)item, 2, 20, 30);
                                        }
                                    }
                                    else
                                    {
                                        BaseArmor armor = Loot.RandomArmorOrShield();
                                        item = armor;

                                        armor.ProtectionLevel = (ArmorProtectionLevel)BaseCreature.RandomMinMaxScaled(2, 3);
                                        armor.Durability      = (ArmorDurabilityLevel)BaseCreature.RandomMinMaxScaled(2, 3);
                                    }

                                    cont.DropItem(item);
                                }

                                if (player.BAC > 0)
                                {
                                    cont.DropItem(new HangoverCure());
                                }

                                if (player.PlaceInBackpack(cont))
                                {
                                    bool gainedPath = false;

                                    if (VirtueHelper.Award(player, VirtueName.Sacrifice, 250, ref gainedPath))          // TODO: Check amount on OSI.
                                    {
                                        player.SendLocalizedMessage(1054160);                                           // You have gained in sacrifice.
                                    }
                                    PlaySound(0x253);
                                    PlaySound(0x20);
                                    obj.Complete();
                                }
                                else
                                {
                                    cont.Delete();
                                    player.SendLocalizedMessage(1046260);                                       // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                QuestSystem newQuest        = new WitchApprenticeQuest(player);
                bool        inRestartPeriod = false;

                if (qs != null)
                {
                    newQuest.AddConversation(new DontOfferConversation());
                }
                else if (QuestSystem.CanOfferQuest(player, typeof(WitchApprenticeQuest), out inRestartPeriod))
                {
                    PlaySound(0x20);
                    PlaySound(0x206);
                    newQuest.SendOffer();
                }
                else if (inRestartPeriod)
                {
                    PlaySound(0x259);
                    PlaySound(0x206);
                    newQuest.AddConversation(new RecentlyFinishedConversation());
                }
            }
        }
Example #33
0
        private void SetDuplicatedLoot()
        {
            bool done      = false;
            int  dupeState = 0;

            while (!done)
            {
                switch (dupeState)
                {
                case 0:
                    if (Loot.FindAll(x => x.ItemRarity == Rarity.UltraRare).Count == 1)
                    {
                        DuplicatedLoot = Loot.Find(x => x.ItemRarity == Rarity.UltraRare);
                        done           = true;
                    }
                    else
                    {
                        dupeState = 1;
                    }
                    break;

                case 1:
                    if (Loot.FindAll(x => x.ItemRarity == Rarity.Rare).Count == 1)
                    {
                        DuplicatedLoot = Loot.Find(x => x.ItemRarity == Rarity.Rare);
                        done           = true;
                    }
                    else
                    {
                        dupeState = 2;
                    }
                    break;

                case 2:
                    if (Loot.FindAll(x => x.ItemRarity == Rarity.Uncommon).Count == 1)
                    {
                        DuplicatedLoot = Loot.Find(x => x.ItemRarity == Rarity.Uncommon);
                        done           = true;
                    }
                    else
                    {
                        dupeState = 3;
                    }
                    break;

                case 3:
                    if (Loot.FindAll(x => x.ItemRarity == Rarity.Common).Count == 1)
                    {
                        DuplicatedLoot = Loot.Find(x => x.ItemRarity == Rarity.Common);
                        done           = true;
                    }
                    else
                    {
                        dupeState = 4;
                    }
                    break;

                case 4:
                    DuplicatedLoot = null;
                    done           = true;
                    break;
                }
            }

            Loot.Remove(DuplicatedLoot);
        }
Example #34
0
        private Item RandomResource(TradeEntry entry)
        {
            int amount = 40;

            if (entry.Details.Count > 1)
            {
                amount = 40 + Utility.RandomMinMax(10, entry.Details.Count * 20);
            }

            switch (Utility.Random(4))
            {
            case 0:
                switch (Utility.Random(9))
                {
                case 0: return(new IronIngot(amount));

                case 1: return(new DullCopperIngot(amount));

                case 2: return(new ShadowIronIngot(amount));

                case 3: return(new CopperIngot(amount));

                case 4: return(new BronzeIngot(amount));

                case 5: return(new GoldIngot(amount));

                case 6: return(new AgapiteIngot(amount));

                case 7: return(new VeriteIngot(amount));

                case 8: return(new ValoriteIngot(amount));
                }
                break;

            case 1:
                switch (Utility.Random(4))
                {
                case 0: return(new Leather(amount));

                case 1: return(new SpinedLeather(amount));

                case 2: return(new HornedLeather(amount));

                case 3: return(new BarbedLeather(amount));
                }
                break;

            case 2:
                switch (Utility.Random(7))
                {
                case 0: return(new Board(amount));

                case 1: return(new OakBoard(amount));

                case 2: return(new AshBoard(amount));

                case 3: return(new YewBoard(amount));

                case 4: return(new BloodwoodBoard(amount));

                case 5: return(new HeartwoodBoard(amount));

                case 6: return(new FrostwoodBoard(amount));
                }
                break;

            case 3:
                Item item = Loot.Construct(SkillHandlers.Imbuing.IngredTypes[Utility.Random(SkillHandlers.Imbuing.IngredTypes.Length)]);

                amount /= 10;

                if (item != null && item.Stackable)
                {
                    item.Amount = amount;
                }

                return(item);
            }
            return(null);
        }
Example #35
0
 protected virtual void OnFaint(LivingGameObject lgo)
 {
     // Add all enemy items to the inventory by default.
     Loot.AddRange(lgo.GetInventoryItems());
 }
Example #36
0
        public override void GiveRewards()
        {
            bool captured = false;

            foreach (BaseObjective obj in Objectives)
            {
                if (obj is BountyQuestObjective && ((BountyQuestObjective)obj).Captured)
                {
                    BountyQuestObjective o = (BountyQuestObjective)obj;
                    captured = true;

                    if (o.CapturedCaptain != null && o.CapturedCaptain is PirateCaptain)
                    {
                        PirateCaptain p = o.CapturedCaptain as PirateCaptain;
                        p.Quest = null;
                    }

                    o.CapturedCaptain = null;
                    o.Captured        = false;
                    break;
                }
            }

            if (Owner == null)
            {
                return;
            }

            m_Helpers.Add(Owner);
            int totalAward = 7523;

            if (m_Captain != null && BountyQuestSpawner.Bounties.ContainsKey(m_Captain))
            {
                totalAward = BountyQuestSpawner.Bounties[m_Captain];
            }

            int eachAward = totalAward;

            if (m_Helpers.Count > 1)
            {
                eachAward = totalAward / m_Helpers.Count;
            }

            foreach (Mobile mob in m_Helpers)
            {
                if (mob.NetState != null || mob == Owner)
                {
                    mob.AddToBackpack(new Gold(eachAward));

                    if (captured)
                    {
                        Item reward = Loot.Construct(m_CapturedRewards[Utility.Random(m_CapturedRewards.Length)]);

                        if (reward != null)
                        {
                            if (reward is RuinedShipPlans)
                            {
                                mob.SendLocalizedMessage(1149838); //Here is something special!  It's a salvaged set of orc ship plans.  Parts of it are unreadable, but if you could get another copy you might be able to fill in some of the missing parts...
                            }
                            else
                            {
                                mob.SendLocalizedMessage(1149840); //Here is some special cannon ammunition.  It's imported!
                            }
                            if (reward is HeavyFlameCannonball || reward is LightFlameCannonball || reward is HeavyFrostCannonball || reward is LightFrostCannonball)
                            {
                                reward.Amount = Utility.RandomMinMax(5, 10);
                            }

                            mob.AddToBackpack(reward);
                        }
                    }

                    mob.SendLocalizedMessage(1149825, string.Format("{0}\t{1}", totalAward, eachAward)); //Here's your share of the ~1_val~ reward money, you get ~2_val~ gold.  You've earned it!
                }
                else
                {
                    foreach (Mobile mobile in m_Helpers)
                    {
                        if (mobile != mob && mobile.NetState != null)
                        {
                            mobile.SendLocalizedMessage(1149837, string.Format("{0}\t{1}\t{2}", eachAward, mob.Name, Owner.Name)); //~1_val~ gold is for ~2_val~, I can't find them so I'm giving this to Captain ~3_val~.
                        }
                    }

                    Owner.AddToBackpack(new Gold(eachAward));
                }
            }

            if (m_Captain != null && m_Captain.Alive)
            {
                m_Captain.Delete();
            }

            base.GiveRewards();
        }
        public TreasureChestLevel5() : base(0xE41)
        {
            this.SetChestAppearance();
            Movable      = false;
            LiftOverride = true;

            TrapType  = TrapType.ExplosionTrap;
            TrapPower = m_Level * Utility.Random(20, 35);
            Locked    = true;
            Breakable = false;

            RequiredSkill = 95;
            LockLevel     = this.RequiredSkill - Utility.Random(1, 10);
            MaxLockLevel  = this.RequiredSkill + 21;

            // According to OSI, loot in level 4 chest is:
            //  Gold 500 - 900
            //  Reagents
            //  Scrolls
            //  Blank scrolls
            //  Potions
            //  Gems
            //  Magic Wand
            //  Magic weapon
            //  Magic armour
            //  Magic clothing (not implemented)
            //  Magic jewelry (not implemented)
            //  Crystal ball (not implemented)

            // Gold
            DropItem(new Gold(Utility.Random(900, 1400)));

            // Reagents
            for (int i = Utility.Random(1, m_Level); i > 1; i--)
            {
                Item ReagentLoot = Loot.RandomReagent();
                ReagentLoot.Amount = 12;
                DropItem(ReagentLoot);
            }

            // Scrolls
            for (int i = Utility.Random(1, m_Level); i > 1; i--)
            {
                Item ScrollLoot = Loot.RandomScroll(0, 47, SpellbookType.Regular);
                ScrollLoot.Amount = Utility.Random(1, 3);
                DropItem(ScrollLoot);
            }

            // Drop blank scrolls
            DropItem(new BlankScroll(Utility.Random(1, m_Level)));

            // Potions
            for (int i = Utility.Random(1, m_Level); i > 1; i--)
            {
                Item PotionLoot = Loot.RandomPotion();
                DropItem(PotionLoot);
            }

            // Gems
            for (int i = Utility.Random(1, m_Level); i > 1; i--)
            {
                Item GemLoot = Loot.RandomGem();
                GemLoot.Amount = Utility.Random(1, 4);;
                DropItem(GemLoot);
            }

            // Equipment
            for (int i = Utility.Random(1, m_Level); i > 1; i--)
            {
                Item item = Loot.RandomArmorOrShieldOrWeapon();

                if (item is BaseWeapon)
                {
                    BaseWeapon weapon      = (BaseWeapon)item;
                    int        damageLevel = PseudoSeerStone.GetDamageLevel(m_Level);
                    if (PseudoSeerStone.HighestDamageLevelSpawn < damageLevel)
                    {
                        if (damageLevel == 5 && PseudoSeerStone.ReplaceVanqWithSkillScrolls)
                        {
                            DropItem(PuzzleChest.CreateRandomSkillScroll());
                        }
                        int platAmount = PseudoSeerStone.PlatinumPerMissedDamageLevel * (damageLevel - PseudoSeerStone.Instance._HighestDamageLevelSpawn);
                        if (platAmount > 0)
                        {
                            DropItem(new Platinum(platAmount));
                        }
                        damageLevel = PseudoSeerStone.Instance._HighestDamageLevelSpawn;
                    }
                    weapon.DamageLevel     = (WeaponDamageLevel)damageLevel;
                    weapon.DurabilityLevel = (WeaponDurabilityLevel)PseudoSeerStone.GetDurabilityLevel(m_Level);
                    weapon.AccuracyLevel   = (WeaponAccuracyLevel)PseudoSeerStone.GetAccuracyLevel(m_Level);
                    weapon.Quality         = WeaponQuality.Regular;
                }
                else if (item is BaseArmor)
                {
                    BaseArmor armor = (BaseArmor)item;
                    armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(m_Level);
                    armor.Durability      = (ArmorDurabilityLevel)Utility.Random(m_Level);
                    armor.Quality         = ArmorQuality.Regular;
                }

                DropItem(item);
            }

            // Clothing
            for (int i = Utility.Random(1, 2); i > 1; i--)
            {
                DropItem(Loot.RandomClothing());
            }

            // Jewelry
            for (int i = Utility.Random(1, 2); i > 1; i--)
            {
                DropItem(Loot.RandomJewelry());
            }

            // Crystal ball (not implemented)
        }
Example #38
0
 /// <summary>
 /// Adds a Loot object.
 /// </summary>
 /// <param name="loot"></param>
 public void AddLoot(Loot loot)
 {
     this.Loots.Add(loot);
     if (this.LootAdded != null) this.LootAdded(loot);
 }
Example #39
0
 public void Populate(Loot loot, IList<LootDef> defs)
 {
     Item[] candidates;
     switch (type)
     {
         case ItemType.Weapon:
             candidates = WeaponItems[tier];
             break;
         case ItemType.Ability:
             candidates = AbilityItems[tier];
             break;
         case ItemType.Armor:
             candidates = ArmorItems[tier];
             break;
         case ItemType.Ring:
             candidates = RingItems[tier];
             break;
         case ItemType.Potion:
             candidates = PotionItems[tier];
             break;
         default:
             throw new NotSupportedException(type.ToString());
     }
     foreach (var i in candidates)
         defs.Add(new LootDef(i, probability / candidates.Length));
 }
Example #40
0
        public override bool OnDragDrop(Mobile from, Item dropped)
        {
            PlayerMobile player = from as PlayerMobile;

            if (player != null)
            {
                QuestSystem qs = player.Quest;

                if (qs is UzeraanTurmoilQuest)
                {
                    if (dropped is UzeraanTurmoilHorn)
                    {
                        if (player.Young)
                        {
                            UzeraanTurmoilHorn horn = (UzeraanTurmoilHorn)dropped;

                            if (horn.Charges < 10)
                            {
                                SayTo(from, 1049384); // I have recharged the item for you.
                                horn.Charges = 10;
                            }
                            else
                            {
                                SayTo(from, 1049385); // That doesn't need recharging yet.
                            }
                        }
                        else
                        {
                            player.SendLocalizedMessage(1114333); //You must be young to have this item recharged.
                        }

                        return(false);
                    }

                    if (dropped is SchmendrickScrollOfPower)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(ReturnScrollOfPowerObjective));

                        if (obj != null && !obj.Completed)
                        {
                            Container cont = GetNewContainer();

                            cont.DropItem(new TreasureMap(player.Young ? 0 : 1, Map.Trammel));
                            cont.DropItem(new Shovel());
                            cont.DropItem(new UzeraanTurmoilHorn());

                            if (!player.PlaceInBackpack(cont))
                            {
                                cont.Delete();
                                player.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
                                return(false);
                            }
                            else
                            {
                                dropped.Delete();
                                obj.Complete();
                                return(true);
                            }
                        }
                    }
                    else if (dropped is QuestFertileDirt)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(ReturnFertileDirtObjective));

                        if (obj != null && !obj.Completed)
                        {
                            Container cont = GetNewContainer();

                            if (player.Profession == 2) // magician
                            {
                                cont.DropItem(new BlackPearl(20));
                                cont.DropItem(new Bloodmoss(20));
                                cont.DropItem(new Garlic(20));
                                cont.DropItem(new Ginseng(20));
                                cont.DropItem(new MandrakeRoot(20));
                                cont.DropItem(new Nightshade(20));
                                cont.DropItem(new SulfurousAsh(20));
                                cont.DropItem(new SpidersSilk(20));

                                for (int i = 0; i < 3; i++)
                                {
                                    cont.DropItem(Loot.RandomScroll(0, 23, SpellbookType.Regular));
                                }
                            }
                            else
                            {
                                cont.DropItem(new Gold(300));
                                cont.DropItem(new Bandage(25));

                                for (int i = 0; i < 5; i++)
                                {
                                    cont.DropItem(new LesserHealPotion());
                                }
                            }

                            if (!player.PlaceInBackpack(cont))
                            {
                                cont.Delete();
                                player.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
                                return(false);
                            }
                            else
                            {
                                dropped.Delete();
                                obj.Complete();
                                return(true);
                            }
                        }
                    }
                    else if (dropped is QuestDaemonBlood)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(ReturnDaemonBloodObjective));

                        if (obj != null && !obj.Completed)
                        {
                            Item reward;

                            if (player.Profession == 2) // magician
                            {
                                Container cont = GetNewContainer();

                                cont.DropItem(new ExplosionScroll(4));
                                cont.DropItem(new MagicWizardsHat());

                                reward = cont;
                            }
                            else
                            {
                                BaseWeapon weapon;
                                switch (Utility.Random(6))
                                {
                                case 0: weapon = new Broadsword(); break;

                                case 1: weapon = new Cutlass(); break;

                                case 2: weapon = new Katana(); break;

                                case 3: weapon = new Longsword(); break;

                                case 4: weapon = new Scimitar(); break;

                                default: weapon = new VikingSword(); break;
                                }

                                if (Core.AOS)
                                {
                                    BaseRunicTool.ApplyAttributesTo(weapon, 3, 20, 40);
                                }
                                else
                                {
                                    weapon.DamageLevel     = (WeaponDamageLevel)BaseCreature.RandomMinMaxScaled(2, 4);
                                    weapon.AccuracyLevel   = (WeaponAccuracyLevel)BaseCreature.RandomMinMaxScaled(2, 4);
                                    weapon.DurabilityLevel = (WeaponDurabilityLevel)BaseCreature.RandomMinMaxScaled(2, 4);
                                }

                                weapon.Slayer = SlayerName.Silver;

                                reward = weapon;
                            }

                            if (!player.PlaceInBackpack(reward))
                            {
                                reward.Delete();
                                player.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
                                return(false);
                            }
                            else
                            {
                                dropped.Delete();
                                obj.Complete();
                                return(true);
                            }
                        }
                    }
                    else if (dropped is QuestDaemonBone)
                    {
                        QuestObjective obj = qs.FindObjective(typeof(ReturnDaemonBoneObjective));

                        if (obj != null && !obj.Completed)
                        {
                            Container cont = GetNewContainer();
                            cont.DropItem(new BankCheck(2000));
                            cont.DropItem(new EnchantedSextant());

                            if (!player.PlaceInBackpack(cont))
                            {
                                cont.Delete();
                                player.SendLocalizedMessage(1046260); // You need to clear some space in your inventory to continue with the quest.  Come back here when you have more space in your inventory.
                                return(false);
                            }
                            else
                            {
                                dropped.Delete();
                                obj.Complete();
                                return(true);
                            }
                        }
                    }
                }
            }

            return(base.OnDragDrop(from, dropped));
        }
Example #41
0
        public Aughisky() : base(AIType.AI_Melee, FightMode.Closest, 6, 1, 0.175, 0.350)
        {
            Name        = "an aughisky";
            Body        = 178;
            Hue         = 1908;
            BaseSoundID = 0xA8;

            SetStr(187, 245);
            SetDex(196, 234);
            SetInt(156, 173);

            SetHits(285, 350);

            SetDamage(7, 14);

            SetDamageType(ResistanceType.Physical, 100);

            SetResistance(ResistanceType.Physical, 35);
            SetResistance(ResistanceType.Fire, 25);
            SetResistance(ResistanceType.Cold, 30);
            SetResistance(ResistanceType.Poison, 30);
            SetResistance(ResistanceType.Energy, 25);

            SetSkill(SkillName.MagicResist, 48.9, 69.7);
            SetSkill(SkillName.Tactics, 77.9, 88.8);
            SetSkill(SkillName.Wrestling, 48.6, 60.4);

            Fame  = 11600;
            Karma = -11600;

            Container pack = new Backpack();

            pack.DropItem(new Pitcher(BeverageType.Water));
            pack.DropItem(new Gold(Utility.RandomMinMax(23, 37)));

            if (0.03 > Utility.RandomDouble())
            {
                pack.DropItem(new Citrine());
            }

            if (0.10 > Utility.RandomDouble())
            {
                pack.DropItem(new NightSightScroll());
            }

            if (0.04 > Utility.RandomDouble())
            {
                pack.DropItem(new Pearl());
            }

            if (0.03 > Utility.RandomDouble())
            {
                pack.DropItem(Loot.RandomGem());
            }

            if (Utility.RandomDouble() < 0.15)
            {
                BaseClothing clothing1 = Loot.RandomClothing(true);
                BaseRunicTool.ApplyAttributesTo(clothing1, 3, 10, 25);

                pack.DropItem(clothing1);
            }

            if (Utility.RandomDouble() < 0.15)
            {
                BaseClothing clothing2 = Loot.RandomClothing(true);
                BaseRunicTool.ApplyAttributesTo(clothing2, 3, 10, 25);

                pack.DropItem(clothing2);
            }

            if (Utility.RandomDouble() < 0.15)
            {
                BaseWeapon weapon = Loot.RandomWeapon(true);
                BaseRunicTool.ApplyAttributesTo(weapon, 3, 10, 25);

                pack.DropItem(weapon);
            }

            if (Utility.RandomDouble() < 0.15)
            {
                BaseJewel necklace = new GoldNecklace();
                if (Core.AOS)
                {
                    BaseRunicTool.ApplyAttributesTo(necklace, 2, 10, 15);
                }

                pack.DropItem(necklace);
            }
            PackItem(pack);

            switch (Utility.Random(3))
            {
            case 0: AddItem(Loot.RandomArmor()); break;

            case 1: AddItem(Loot.RandomClothing()); break;

            case 2: AddItem(Loot.RandomWeapon()); break;
            }
        }
Example #42
0
 public EnemyInfo()
 {
     name = "TestName";
     hp = 100;
     lootTable[0] = new Loot();
 }
        public IceFiend() : base(AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4)
        {
            Name        = "an ice fiend";
            Body        = 43;
            BaseSoundID = 357;

            SetStr(376, 405);
            SetDex(176, 195);
            SetInt(201, 225);

            SetHits(452, 486);
            SetMana(1005, 1125);

            SetDamage(8, 19);

            SetDamageType(ResistanceType.Physical, 25);
            SetDamageType(ResistanceType.Cold, 75);

            SetResistance(ResistanceType.Physical, 60);
            SetResistance(ResistanceType.Fire, 10);
            SetResistance(ResistanceType.Cold, 60);
            SetResistance(ResistanceType.Poison, 20);
            SetResistance(ResistanceType.Energy, 30);

            SetSkill(SkillName.EvalInt, 80.1, 90.0);
            SetSkill(SkillName.Magery, 80.1, 90.0);
            SetSkill(SkillName.MagicResist, 75.1, 85.0);
            SetSkill(SkillName.Tactics, 80.1, 90.0);
            SetSkill(SkillName.Wrestling, 80.1, 100.0);

            Fame  = 28000;
            Karma = -28000;

            PackGold(81, 97);

            PackItem(new Paraiba());
            PackItem(new DiamondDust(Utility.RandomMinMax(17, 23)));

            if (Utility.RandomDouble() < 0.10)
            {
                PackItem(new SummonDaemonScroll());
            }

            if (Utility.RandomDouble() < 0.05)
            {
                PackItem(new CrackedResistColdGem());
            }

            if (Utility.RandomDouble() < 0.05)
            {
                PackItem(new CrackedHitHarmGem());
            }

            Container pack1 = new Backpack();

            pack1.DropItem(new Gold(Utility.RandomMinMax(38, 49)));

            if (Utility.RandomDouble() < 0.10)
            {
                BaseWeapon weapon = Loot.RandomWeapon(true);
                BaseRunicTool.ApplyAttributesTo(weapon, 5, 15, 30);

                pack1.DropItem(weapon);
            }

            if (Utility.RandomDouble() < 0.05)
            {
                BaseArmor armor1 = Loot.RandomArmor(true);
                BaseRunicTool.ApplyAttributesTo(armor1, 5, 15, 30);

                pack1.DropItem(armor1);
            }

            if (Utility.RandomDouble() < 0.05)
            {
                BaseArmor armor2 = Loot.RandomArmor(true);
                BaseRunicTool.ApplyAttributesTo(armor2, 5, 15, 30);

                pack1.DropItem(armor2);
            }

            if (Utility.RandomDouble() < 0.05)
            {
                BaseArmor armor3 = Loot.RandomArmor(true);
                BaseRunicTool.ApplyAttributesTo(armor3, 5, 15, 30);

                pack1.DropItem(armor3);
            }

            if (Utility.RandomDouble() < 0.05)
            {
                BaseClothing clothing1 = Loot.RandomClothing(true);
                BaseRunicTool.ApplyAttributesTo(clothing1, 3, 15, 30);

                pack1.DropItem(clothing1);
            }

            if (Utility.RandomDouble() < 0.05)
            {
                BaseClothing clothing2 = Loot.RandomClothing(true);
                BaseRunicTool.ApplyAttributesTo(clothing2, 3, 15, 30);

                pack1.DropItem(clothing2);
            }

            if (Utility.RandomDouble() < 0.05)
            {
                BaseWeapon weapon = Loot.RandomWeapon(true);
                BaseRunicTool.ApplyAttributesTo(weapon, 5, 25, 30);

                pack1.DropItem(weapon);
            }


            Container pack2 = new Backpack();

            pack2.DropItem(new BlackPearl(Utility.RandomMinMax(7, 12)));
            pack2.DropItem(new Bloodmoss(Utility.RandomMinMax(5, 9)));
            pack2.DropItem(new Garlic(Utility.RandomMinMax(9, 14)));
            pack2.DropItem(new Ginseng(Utility.RandomMinMax(3, 7)));
            pack2.DropItem(new MandrakeRoot(Utility.RandomMinMax(8, 15)));
            pack2.DropItem(new Nightshade(Utility.RandomMinMax(9, 17)));
            pack2.DropItem(new SpidersSilk(Utility.RandomMinMax(7, 12)));
            pack2.DropItem(new SulfurousAsh(Utility.RandomMinMax(5, 9)));
            PackItem(pack2);

            Container pack3 = new Backpack();

            pack3.DropItem(new CurePotion());
            pack3.DropItem(new CurePotion());
            pack3.DropItem(new ExplosionPotion());
            pack3.DropItem(new HealPotion());
            PackItem(pack3);

            switch (Utility.Random(5))
            {
            case 0: PackItem(new HarmScroll(5));  break;

            case 1: PackItem(new EnergyBoltScroll(3)); break;

            case 2: PackItem(new PoisonFieldScroll(2)); break;

            case 3: PackItem(new WallOfStoneScroll(2)); break;

            case 4: PackItem(new CurseScroll(2)); break;
            }
        }
Example #44
0
        private void Fill(int level)
        {
            TrapType  = TrapType.ExplosionTrap;
            TrapPower = level * 25;
            TrapLevel = level;
            Locked    = true;

            switch (level)
            {
            case 1: RequiredSkill = 36; break;

            case 2: RequiredSkill = 76; break;

            case 3: RequiredSkill = 84; break;

            case 4: RequiredSkill = 92; break;

            case 5: RequiredSkill = 100; break;
            }

            LockLevel    = RequiredSkill - 10;
            MaxLockLevel = RequiredSkill + 40;

            DropItem(new Gold(level * 200));

            for (int i = 0; i < level; ++i)
            {
                DropItem(Loot.RandomScroll(0, 63, SpellbookType.Regular));
            }

            for (int i = 0; i < level * 2; ++i)
            {
                Item item = Loot.RandomArmorOrShieldOrWeapon();

                if (item is BaseWeapon)
                {
                    BaseWeapon weapon = (BaseWeapon)item;

                    weapon.DamageLevel     = (WeaponDamageLevel)Utility.Random(6);
                    weapon.AccuracyLevel   = (WeaponAccuracyLevel)Utility.Random(6);
                    weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(6);

                    DropItem(item);
                }
                else if (item is BaseArmor)
                {
                    BaseArmor armor = (BaseArmor)item;

                    armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(6);
                    armor.Durability      = (ArmorDurabilityLevel)Utility.Random(6);

                    DropItem(item);
                }
                else if (item is BaseHat)
                {
                    BaseHat hat = (BaseHat)item;

                    DropItem(item);
                }
                else if (item is BaseJewel)
                {
                    int attributeCount;
                    int min, max;

                    GetRandomAOSStats(out attributeCount, out min, out max);

                    BaseRunicTool.ApplyAttributesTo(attributeCount);

                    DropItem(item);
                }
            }

            for (int i = 0; i < level; i++)
            {
                Item item = Loot.RandomPossibleReagent();
                item.Amount = Utility.RandomMinMax(40, 60);
                DropItem(item);
            }

            for (int i = 0; i < level; i++)
            {
                Item item = Loot.RandomGem();
                DropItem(item);
            }

            DropItem(new TreasureMap(level + 1, Map.Felucca));
        }
        public override void GenerateLoot()
        {
            AddLoot(LootPack.FilthyRich, 2);
            AddLoot(LootPack.Average, 3);

            if (Utility.RandomDouble() < 0.10)
            {
                BaseWeapon weapon = Loot.RandomWeapon(true);
                BaseRunicTool.ApplyAttributesTo(weapon, 3, 25, 30);

                PackItem(weapon);
            }

            if (Utility.RandomDouble() < 0.05)
            {
                BaseClothing clothing = Loot.RandomClothing(true);
                BaseRunicTool.ApplyAttributesTo(clothing, 3, 25, 30);

                PackItem(clothing);
            }

            if (Utility.RandomDouble() < 0.05)
            {
                BaseShield shield = new ScarabShield();
                if (Core.AOS)
                {
                    BaseRunicTool.ApplyAttributesTo(shield, 5, 25, 30);
                }

                PackItem(shield);
            }

            if (Utility.RandomDouble() < 0.05)
            {
                BaseJewel bracelet = new GoldBracelet();
                if (Core.AOS)
                {
                    BaseRunicTool.ApplyAttributesTo(bracelet, 5, 25, 30);
                }

                PackItem(bracelet);
            }

            if (Utility.RandomDouble() < 0.05)
            {
                BaseJewel earrings = new GoldEarrings();
                if (Core.AOS)
                {
                    BaseRunicTool.ApplyAttributesTo(earrings, 5, 25, 30);
                }

                PackItem(earrings);
            }

            if (Utility.RandomDouble() < 0.05)
            {
                BaseJewel necklace = new GoldNecklace();
                if (Core.AOS)
                {
                    BaseRunicTool.ApplyAttributesTo(necklace, 5, 25, 30);
                }

                PackItem(necklace);
            }

            if (Utility.RandomDouble() < 0.05)
            {
                BaseJewel ring = new GoldRing();
                if (Core.AOS)
                {
                    BaseRunicTool.ApplyAttributesTo(ring, 5, 25, 30);
                }

                PackItem(ring);
            }

            if (0.08 > Utility.RandomDouble())
            {
                switch (Utility.Random(4))
                {
                case 0: PackItem(new FrostAbyssalRingmailGloves()); break;

                case 1: PackItem(new FrostAbyssalRingmailLeggings()); break;

                case 2: PackItem(new FrostAbyssalRingmailSleeves()); break;

                case 3: PackItem(new FrostAbyssalRingmailTunic()); break;
                }
            }
        }
Example #46
0
 public void NextLevel()
 {
     this.CurrentLevel++;
     this.Loot = Loot.Create(this.CurrentLevel);
     this.GenerateTreasureChests();
 }
Example #47
0
        public TreasureLevel3() : base(Utility.RandomList(0x9ab, 0xe40, 0xe42))
        {
            RequiredSkill = 84;
            LockLevel     = this.RequiredSkill - Utility.Random(1, 10);
            MaxLockLevel  = this.RequiredSkill;
            TrapType      = TrapType.MagicTrap;
            TrapPower     = 3 * Utility.Random(1, 25);

            DropItem(new Gold(180, 240));
            DropItem(new Arrow(10));

            for (int i = Utility.Random(1, 3); i > 1; i--)
            {
                Item ReagentLoot = Loot.RandomReagent();
                ReagentLoot.Amount = Utility.Random(1, 9);
                DropItem(ReagentLoot);
            }

            for (int i = Utility.Random(1, 3); i > 1; i--)
            {
                DropItem(Loot.RandomPotion());
            }

            if (0.67 > Utility.RandomDouble())               //67% chance = 2/3
            {
                for (int i = Utility.Random(12) + 1; i > 0; i--)
                {
                    DropItem(Loot.RandomScroll(0, 47, SpellbookType.Regular));
                }
            }

            if (0.67 > Utility.RandomDouble())               //67% chance = 2/3
            {
                for (int i = Utility.Random(9) + 1; i > 0; i--)
                {
                    DropItem(Loot.RandomGem());
                }
            }

            for (int i = Utility.Random(1, 3); i > 1; i--)
            {
                DropItem(Loot.RandomWand());
            }

            // Magical ArmorOrWeapon
            for (int i = Utility.Random(1, 3); i > 1; i--)
            {
                Item item = Loot.RandomArmorOrShieldOrWeapon();

                if (!Core.AOS)
                {
                    if (item is BaseWeapon)
                    {
                        BaseWeapon weapon = (BaseWeapon)item;
                        weapon.DamageLevel     = (WeaponDamageLevel)Utility.Random(3);
                        weapon.AccuracyLevel   = (WeaponAccuracyLevel)Utility.Random(3);
                        weapon.DurabilityLevel = (WeaponDurabilityLevel)Utility.Random(3);
                        weapon.Quality         = WeaponQuality.Regular;
                    }
                    else if (item is BaseArmor)
                    {
                        BaseArmor armor = (BaseArmor)item;
                        armor.ProtectionLevel = (ArmorProtectionLevel)Utility.Random(3);
                        armor.Durability      = (ArmorDurabilityLevel)Utility.Random(3);
                        armor.Quality         = ArmorQuality.Regular;
                    }
                }
                else
                {
                    AddLoot(item);
                }
            }

            for (int i = Utility.Random(1, 2); i > 1; i--)
            {
                AddLoot(Loot.RandomClothing());
            }

            for (int i = Utility.Random(1, 2); i > 1; i--)
            {
                AddLoot(Loot.RandomJewelry());
            }

            // Magic clothing (not implemented)

            // Magic jewelry (not implemented)
        }
Example #48
0
        public JukaMage() : base(AIType.AI_Mage, FightMode.Closest, 10, 1, 0.2, 0.4)
        {
            Name = "a juka mage";
            Body = 765;

            SetStr(201, 300);
            SetDex(71, 90);
            SetInt(451, 500);

            SetHits(121, 180);

            SetDamage(4, 10);

            SetDamageType(ResistanceType.Physical, 100);

            SetResistance(ResistanceType.Physical, 20, 30);
            SetResistance(ResistanceType.Fire, 35, 45);
            SetResistance(ResistanceType.Cold, 30, 40);
            SetResistance(ResistanceType.Poison, 10, 20);
            SetResistance(ResistanceType.Energy, 35, 45);

            SetSkill(SkillName.Anatomy, 80.1, 90.0);
            SetSkill(SkillName.EvalInt, 80.2, 100.0);
            SetSkill(SkillName.Magery, 99.1, 100.0);
            SetSkill(SkillName.Meditation, 80.2, 100.0);
            SetSkill(SkillName.MagicResist, 140.1, 150.0);
            SetSkill(SkillName.Tactics, 80.1, 90.0);
            SetSkill(SkillName.Wrestling, 80.1, 90.0);

            Fame  = 15000;
            Karma = -15000;

            VirtualArmor = 16;

            Container bag = new Bag();

            int count = Utility.RandomMinMax(10, 20);

            for (int i = 0; i < count; ++i)
            {
                Item item = Loot.RandomReagent();

                if (item == null)
                {
                    continue;
                }

                if (!bag.TryDropItem(this, item, false))
                {
                    item.Delete();
                }
            }

            PackItem(bag);

            PackItem(new ArcaneGem());

            if (Core.ML && Utility.RandomDouble() < .33)
            {
                PackItem(Engines.Plants.Seed.RandomPeculiarSeed(4));
            }

            m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(2, 5));
        }
Example #49
0
        public MeerCaptain()
            : base(AIType.AI_Archer, FightMode.Evil, 10, 1, 0.2, 0.4)
        {
            Name = "a meer captain";
            Body = 773;

            SetStr(96, 110);
            SetDex(186, 200);
            SetInt(96, 110);

            SetHits(58, 66);

            SetDamage(5, 15);

            SetDamageType(ResistanceType.Physical, 100);

            SetResistance(ResistanceType.Physical, 45, 55);
            SetResistance(ResistanceType.Fire, 10, 20);
            SetResistance(ResistanceType.Cold, 40, 50);
            SetResistance(ResistanceType.Poison, 35, 45);
            SetResistance(ResistanceType.Energy, 35, 45);

            SetSkill(SkillName.Archery, 90.1, 100.0);
            SetSkill(SkillName.MagicResist, 91.0, 100.0);
            SetSkill(SkillName.Swords, 90.1, 100.0);
            SetSkill(SkillName.Tactics, 91.0, 100.0);
            SetSkill(SkillName.Wrestling, 80.9, 89.9);

            Fame  = 2000;
            Karma = 5000;

            VirtualArmor = 28;

            Container pack = new Backpack();

            pack.DropItem(new Bolt(Utility.RandomMinMax(10, 20)));
            pack.DropItem(new Bolt(Utility.RandomMinMax(10, 20)));

            switch (Utility.Random(6))
            {
            case 0: pack.DropItem(new Broadsword()); break;

            case 1: pack.DropItem(new Cutlass()); break;

            case 2: pack.DropItem(new Katana()); break;

            case 3: pack.DropItem(new Longsword()); break;

            case 4: pack.DropItem(new Scimitar()); break;

            case 5: pack.DropItem(new VikingSword()); break;
            }

            Container bag = new Bag();

            int count = Utility.RandomMinMax(10, 20);

            for (int i = 0; i < count; ++i)
            {
                Item item = Loot.RandomReagent();

                if (item == null)
                {
                    continue;
                }

                if (!bag.TryDropItem(this, item, false))
                {
                    item.Delete();
                }
            }

            pack.DropItem(bag);

            AddItem(new Crossbow());
            PackItem(pack);

            m_NextAbilityTime = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(2, 5));
        }