Exemple #1
0
 public static async Task SaveUnidentifiedArtifactAsync(UnidentifiedArtifact unidentifiedArtifact)
 {
     using (var db = new CypherContext())
     {
         db.UnidentifiedArtifacts.Add(unidentifiedArtifact);
         await db.SaveChangesAsync();
     }
 }
Exemple #2
0
 public static async Task RemoveUnidentifiedArtifactAsync(int unidentifiedArtifactID)
 {
     using (var db = new CypherContext())
     {
         var uArtifactToRemove = new UnidentifiedArtifact()
         {
             UnidentifiedArtifactId = unidentifiedArtifactID
         };
         db.UnidentifiedArtifacts.Remove(uArtifactToRemove);
         await db.SaveChangesAsync();
     }
 }
Exemple #3
0
        public static void GiveArtifactTo(Mobile m)
        {
            Item item = new UnidentifiedArtifact();

            if (DifficultyLevel.GetUnidentifiedChance() >= Utility.RandomMinMax(1, 100))
            {
                item = Loot.RandomArty();
            }                                                                                                                         // WIZARD WANTS A UNIFIED ARTY LISTING

            if (item == null)
            {
                return;
            }

            // TODO: Confirm messages
            if (m.AddToBackpack(item))
            {
                m.SendMessage("As a reward for slaying the mighty leviathan, an artifact has been placed in your backpack.");
            }
            else
            {
                m.SendMessage("As your backpack is full, your reward for destroying the legendary leviathan has been placed at your feet.");
            }
        }
Exemple #4
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                Container pack = from.Backpack;

                int nCost  = 500;
                int nCost2 = 5000;

                if (BeggingPose(from) > 0)                   // LET US SEE IF THEY ARE BEGGING - WIZARD
                {
                    nCost  = nCost - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost);
                    nCost2 = nCost2 - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost2);
                }

                if (targeted is UnknownWand && from.Backpack != null)
                {
                    int toConsume = nCost;

                    if (pack.ConsumeTotal(typeof(Gold), toConsume))
                    {
                        from.SendMessage(String.Format("You pay {0} gold.", toConsume));

                        if (Utility.RandomMinMax(1, 100) > 10)
                        {
                            Server.Items.UnknownWand.WandType((Item)targeted, from, m_Sage);
                        }
                        else
                        {
                            int    nJunk     = Utility.RandomMinMax(1, 5);
                            string stickName = "";
                            switch (nJunk)
                            {
                            case 1: stickName = "a useless stick"; break;

                            case 2: stickName = "a wand that was never enchanted"; break;

                            case 3: stickName = "a fake wand"; break;

                            case 4: stickName = "nothing magical at all"; break;

                            case 5: stickName = "a simple metal rod"; break;
                            }
                            m_Sage.SayTo(from, "This seems to be " + stickName + ".");
                        }
                        ((Item)targeted).Delete();
                    }
                    else
                    {
                        m_Sage.SayTo(from, "It would cost you {0} gold to have that identified.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                else if (targeted is UnidentifiedArtifact)
                {
                    Container packs = from.Backpack;
                    nCost2 = 5000;
                    UnidentifiedArtifact WhatIsIt = (UnidentifiedArtifact)targeted;

                    if (BeggingPose(from) > 0)                       // LET US SEE IF THEY ARE BEGGING - WIZARD
                    {
                        nCost2 = nCost2 - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost2); if (nCost2 < 1)
                        {
                            nCost2 = 1;
                        }
                    }
                    int toConsume = nCost2;

                    if (packs.ConsumeTotal(typeof(Gold), toConsume))
                    {
                        Container   bpack = (Container)targeted;
                        List <Item> items = new List <Item>();
                        foreach (Item item in bpack.Items)
                        {
                            items.Add(item);
                        }
                        foreach (Item item in items)
                        {
                            from.AddToBackpack(item);
                        }
                        from.SendMessage(String.Format("You pay {0} gold.", toConsume));
                        m_Sage.SayTo(from, "Let me tell you about this artifact...");
                        WhatIsIt.Delete();
                    }
                    else
                    {
                        m_Sage.SayTo(from, "It would cost you {0} gold to have that identified.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                else if (targeted is UnidentifiedItem)
                {
                    Container packs = from.Backpack;
                    nCost = 200;
                    UnidentifiedItem WhatIsIt = (UnidentifiedItem)targeted;

                    if (BeggingPose(from) > 0)                       // LET US SEE IF THEY ARE BEGGING - WIZARD
                    {
                        nCost = nCost - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost); if (nCost < 1)
                        {
                            nCost = 1;
                        }
                    }
                    int toConsume = nCost;

                    if (WhatIsIt.VendorCanID != "Sage")
                    {
                        m_Sage.SayTo(from, "Sorry, I cannot tell what that is.");
                    }
                    else if (packs.ConsumeTotal(typeof(Gold), toConsume))
                    {
                        Container   bpack = (Container)targeted;
                        List <Item> items = new List <Item>();
                        foreach (Item item in bpack.Items)
                        {
                            items.Add(item);
                        }
                        foreach (Item item in items)
                        {
                            from.AddToBackpack(item);
                        }
                        from.SendMessage(String.Format("You pay {0} gold.", toConsume));
                        m_Sage.SayTo(from, "Let me tell you about this item...");
                        WhatIsIt.Delete();
                    }
                    else
                    {
                        m_Sage.SayTo(from, "It would cost you {0} gold to have that identified.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                else if (targeted is ScrollClue)
                {
                    Container packs = from.Backpack;
                    nCost = 100;
                    ScrollClue WhatIsIt = (ScrollClue)targeted;

                    if (BeggingPose(from) > 0)                       // LET US SEE IF THEY ARE BEGGING - WIZARD
                    {
                        nCost = nCost - (int)((from.Skills[SkillName.Begging].Value * 0.005) * nCost); if (nCost < 1)
                        {
                            nCost = 1;
                        }
                    }
                    int toConsume = nCost;

                    if (WhatIsIt.ScrollIntelligence == 0)
                    {
                        m_Sage.SayTo(from, "That was already deciphered by someone.");
                    }
                    else if (packs.ConsumeTotal(typeof(Gold), toConsume))
                    {
                        if (WhatIsIt.ScrollIntelligence >= 80)
                        {
                            WhatIsIt.Name = "diabolically coded parchment";
                        }
                        else if (WhatIsIt.ScrollIntelligence >= 70)
                        {
                            WhatIsIt.Name = "ingeniously coded parchment";
                        }
                        else if (WhatIsIt.ScrollIntelligence >= 60)
                        {
                            WhatIsIt.Name = "deviously coded parchment";
                        }
                        else if (WhatIsIt.ScrollIntelligence >= 50)
                        {
                            WhatIsIt.Name = "cleverly coded parchment";
                        }
                        else if (WhatIsIt.ScrollIntelligence >= 40)
                        {
                            WhatIsIt.Name = "adeptly coded parchment";
                        }
                        else if (WhatIsIt.ScrollIntelligence >= 30)
                        {
                            WhatIsIt.Name = "expertly coded parchment";
                        }
                        else
                        {
                            WhatIsIt.Name = "plainly coded parchment";
                        }

                        WhatIsIt.ScrollIntelligence = 0;
                        WhatIsIt.InvalidateProperties();
                        from.SendMessage(String.Format("You pay {0} gold.", toConsume));
                        m_Sage.SayTo(from, "Let me show you what this reads...");
                        WhatIsIt.ScrollSolved = "Deciphered by " + m_Sage.Name + " the Librarian";
                        from.PlaySound(0x249);
                        WhatIsIt.InvalidateProperties();
                    }
                    else
                    {
                        m_Sage.SayTo(from, "It would cost you {0} gold to have that deciphered.", toConsume);
                        from.SendMessage("You do not have enough gold.");
                    }
                }
                /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
                else
                {
                    m_Sage.SayTo(from, "That does not need my services.");
                }
            }
        public static Item CreateArtifact(string arty)
        {
            Item artifact   = null;
            int  AddBonuses = 1;

            if (arty == "random")
            {
                arty = "any";
                int HighSearch = 300 + 3;                 // THERE ARE 300 ARTIFACTS SO CHANGE THE SECOND NUMBER TO THE NUMBER OF CATEGORIES LISTED BELOW...
                switch (Utility.RandomMinMax(1, HighSearch))
                {
                case 3:         arty = "invulnerable";  break;
                }
            }

            if (arty == "driftwood")               // ONLY FOR SEA TRAVELERS
            {
                artifact = CreateWoodItem();
                if (artifact != null)
                {
                    artifact.Hue = 0x5B2; artifact.Name = "runed driftwood " + artifact.Name;
                }
            }
            else if (arty == "kelp")               // ONLY FOR SEA TRAVELERS
            {
                artifact = CreateLeatherArmor("any");
                if (artifact != null)
                {
                    artifact.Hue = 0x483; artifact.Name = artifact.Name.Replace("leather", "kelp woven");
                }
            }
            else if (arty == "barnacle")               // ONLY FOR SEA TRAVELERS
            {
                artifact = CreatePlateArmor("any");
                if (Utility.RandomMinMax(1, 3) == 1)
                {
                    artifact = CreateMetalShield();
                }
                if (artifact != null)
                {
                    artifact.Name = "barnacled " + artifact.Name; artifact.Hue = 0xB91;
                }
            }
            else if (arty == "bronzed")               // ONLY FOR SEA TRAVELERS
            {
                artifact = CreateMetalItem("female");
                if (artifact != null)
                {
                    artifact.Name = "bronzed " + artifact.Name + " of the valkyrie"; artifact.Hue = 2418;
                }
            }
            else if (arty == "neptune")               // ONLY FOR SEA TRAVELERS
            {
                switch (Utility.RandomMinMax(0, 4))
                {
                case 1: artifact = CreateArmorItem("any"); break;

                case 2: artifact = CreateBowItem(); break;

                case 3: artifact = CreateMetalShield(); break;

                case 4: artifact = CreateMetalWeapon(); break;
                }
                if (artifact is PlateLegs)
                {
                    artifact.ItemID = 0x2B6B;
                }
                else if (artifact is PlateArms)
                {
                    artifact.ItemID = 0x2B6C;
                }
                else if (artifact is PlateChest)
                {
                    artifact.ItemID = 0x2B67;
                }
                else if (artifact is PlateHelm)
                {
                    artifact.ItemID = 0x140E; artifact.Name = "helm";
                }

                if (artifact != null)
                {
                    artifact.Name = artifact.Name + " of Neptune"; artifact.Hue = 0x84C;
                }
            }
            else if (arty == "invulnerable")
            {
                artifact = CreateMetalProtection("any");
                if (artifact != null)
                {
                    artifact.Hue = 0x4F2; artifact.Name = artifact.Name + " of invulnerability";
                }
            }
            else
            {
                artifact   = Loot.RandomArty();
                AddBonuses = 0;
            }

            while (artifact == null)
            {
                artifact = Loot.RandomArty();
            }

            if (AddBonuses == 1)
            {
                if (artifact is BaseWeapon)
                {
                    PowerArtifactWeapon(artifact, arty);
                }
                else if (artifact is BaseShield)
                {
                    PowerArtifactShield(artifact, arty);
                }
                else if (artifact is BaseArmor)
                {
                    PowerArtifactArmor(artifact, arty);
                }
                else if (artifact is BaseJewel)
                {
                    PowerArtifactJewel(artifact, arty);
                }
            }

            if (MyServerSettings.GetUnidentifiedChance() >= Utility.RandomMinMax(1, 100))
            {
                LockableContainer box = new UnidentifiedArtifact();
                box.DropItem(artifact);
                box.ItemID = artifact.ItemID;
                box.Hue    = artifact.Hue;
                box.Name   = RandomThings.GetOddityAdjective() + " artifact";
                return(box);
            }
            return(artifact);
        }