Exemple #1
0
		public override void OnDeath( Container c )
		{ 
			if( this.m_GoldOnDeath > 0 ) 
				c.DropItem( new Gold( this.m_GoldOnDeath ) );

			base.OnDeath( c );
		}
		public override void OnDeath( Container c )
		{
			base.OnDeath( c );

			if ( !Summoned && !NoKillAwards && DemonKnight.CheckArtifactChance( this ) )
				DemonKnight.DistributeArtifact( this );
		}
		public override void OnDeath( Container c )
		{
			base.OnDeath( c );		
			
			c.DropItem( new GrizzledBones() );
			
			switch ( Utility.Random( 4 ) )
			{
				case 0: c.DropItem( new TombstoneOfTheDamned() ); break;
				case 1: c.DropItem( new GlobOfMonstreousInterredGrizzle() ); break;
				case 2: c.DropItem( new MonsterousInterredGrizzleMaggots() ); break;
				case 3: c.DropItem( new GrizzledSkullCollection() ); break;
			}			
			
			if ( Utility.RandomDouble() < 0.6 )				
				c.DropItem( new ParrotItem() );
				
			if ( Utility.RandomDouble() < 0.05 )				
				c.DropItem( new GrizzledMareStatuette() );
							
			if ( Utility.RandomDouble() < 0.025 )
				c.DropItem( new CrimsonCincture() );
				
			if ( Utility.RandomDouble() < 0.05 )
			{
				switch ( Utility.Random( 5 ) )
				{
					case 0: c.DropItem( new GrizzleGauntlets() ); break;
					case 1: c.DropItem( new GrizzleGreaves() ); break;
					case 2: c.DropItem( new GrizzleHelm() ); break;
					case 3: c.DropItem( new GrizzleTunic() ); break;
					case 4: c.DropItem( new GrizzleVambraces() ); break;
				}
			}	
		}
		public override void OnDeath( Container c )
		{
			if ( Utility.Random( 120 ) < 1 )
				c.DropItem( new RaindeerStatue() );

			base.OnDeath( c );
		}
Exemple #5
0
        public override void OnDeath(Container c)
        {
            base.OnDeath(c);

            if (Utility.RandomDouble() < 0.5)
                c.DropItem(new VoidOrb());
        }
Exemple #6
0
        public static bool ConsumeReeds( Container cont, PlantHue hue, int amount )
        {
            List<SoftenedReeds> reeds = GetReeds( cont, hue );

            if ( GetTotalReeds( reeds, hue ) >= amount )
            {
                for ( int i = 0; i < reeds.Count; i++ )
                {
                    SoftenedReeds reed = reeds[i];

                    if ( amount >= reed.Amount )
                    {
                        amount -= reed.Amount;
                        reed.Delete();
                    }
                    else
                    {
                        reed.Amount -= amount;
                        break;
                    }
                }

                return true;
            }
            else
            {
                return false;
            }
        }
Exemple #7
0
        public void Target( Container item )
        {
            if ( CheckSequence() )
            {
                SpellHelper.Turn( Caster, item );

                object root = item.RootParent;

                if ( !item.IsAccessibleTo( Caster ) )
                {
                    item.OnDoubleClickNotAccessible( Caster );
                }
                else if ( !item.CheckItemUse( Caster, item ) )
                {
                }
                else if ( root != null && root is Mobile && root != Caster )
                {
                    item.OnSnoop( Caster );
                }
                else if ( item is Corpse && !((Corpse)item).CheckLoot( Caster, null ) )
                {
                }
                else if ( Caster.Region.OnDoubleClick( Caster, item ) )
                {
                    Effects.SendLocationParticles( EffectItem.Create( item.Location, item.Map, EffectItem.DefaultDuration ), 0x376A, 9, 32, 5022 );
                    Effects.PlaySound( item.Location, item.Map, 0x1F5 );

                    item.DisplayTo( Caster );
                    item.OnItemUsed( Caster, item );
                }
            }

            FinishSequence();
        }
        public override void OnDeath( Container c )
        {
            base.OnDeath( c );

            if ( Utility.RandomDouble() < 0.4 )
            c.DropItem( new ScatteredCrystals() );
        }
		public override void OnKill( BaseCreature creature, Container corpse )
		{
			if ( creature is CursedSoul )
			{
				if ( m_CursedSoulsKilled == 0 )
					System.AddConversation( new GainKarmaConversation( true ) );

				m_CursedSoulsKilled++;

				// Cursed Souls killed:  ~1_COUNT~
				System.From.SendLocalizedMessage( 1063038, m_CursedSoulsKilled.ToString() );
			}
			else if ( creature is YoungRonin )
			{
				if ( m_YoungRoninKilled == 0 )
					System.AddConversation( new GainKarmaConversation( false ) );

				m_YoungRoninKilled++;

				// Young Ronin killed:  ~1_COUNT~
				System.From.SendLocalizedMessage( 1063039, m_YoungRoninKilled.ToString() );
			}

			CurProgress = Math.Max( m_CursedSoulsKilled, m_YoungRoninKilled );
		}
        public override void OnDeath(Container c)
        {
            base.OnDeath(c);	
			
            if (Utility.RandomDouble() < 0.2)
                c.DropItem(new SerpentFangKey());
        }
		public override void OnDeath( Container c )
	  	{
			if ( Utility.Random( 75 ) <  1 )
				c.DropItem( new BasicBlueCarpet( PieceType.NWCorner ) );

			base.OnDeath( c );
	  	}
		public override void OnDeath( Container c )
		{
			base.OnDeath( c );		
/*
			c.DropItem( new LardOfParoxysmus() );
			
			switch ( Utility.Random( 3 ) )
			{
				case 0: c.DropItem( new ParoxysmusDinner() ); break;
				case 1: c.DropItem( new ParoxysmusCorrodedStein() ); break;
				case 2: c.DropItem( new StringOfPartsOfParoxysmusVictims() ); break;
			}
			
			if ( Utility.RandomDouble() < 0.6 )				
				c.DropItem( new ParrotItem() );
			
			if ( Utility.RandomBool() )
				c.DropItem( new SweatOfParoxysmus() );
				
			if ( Utility.RandomDouble() < 0.05 )
				c.DropItem( new ParoxysmusSwampDragonStatuette() );
				
			if ( Utility.RandomDouble() < 0.05 )
				c.DropItem( new ScepterOfTheChief() );
				
			if ( Utility.RandomDouble() < 0.025 )
				c.DropItem( new CrimsonCincture() );
*/
		}
		public override void OnDeath( Container c )
		{
			base.OnDeath( c );		
							
			if ( Utility.RandomDouble() < 0.3 )
				c.DropItem( new TaintedSeeds() );
		}
		public void Generate( Mobile from, Container cont, bool spawning, int luckChance )
		{
			if ( cont == null )
				return;

			bool checkLuck = Core.AOS;

			for ( int i = 0; i < m_Entries.Length; ++i )
			{
				LootPackEntry entry = m_Entries[i];

				bool shouldAdd = ( entry.Chance > Utility.Random( 10000 ) );

				if ( !shouldAdd && checkLuck )
				{
					checkLuck = false;

					if ( LootPack.CheckLuck( luckChance ) )
						shouldAdd = ( entry.Chance > Utility.Random( 10000 ) );
				}

				if ( !shouldAdd )
					continue;

				Item item = entry.Construct( from, luckChance, spawning );

				if ( item != null )
				{
					if ( !item.Stackable || !cont.TryDropItem( from, item, false ) )
						cont.DropItem( item );
				}
			}
		}
Exemple #15
0
		public static void Fill( Container c, int itemCount, double talismanChance )
		{
			c.Hue = Utility.RandomNondyedHue();

			int done = 0;

			if ( Utility.RandomDouble() < talismanChance )
			{
				c.DropItem( new RandomTalisman() );
				++done;
			}

			for ( ; done < itemCount; ++done )
			{
				Item loot = null;

				switch ( Utility.Random( 5 ) )
				{
					case 0: loot = Loot.RandomWeapon( false, true ); break;
					case 1: loot = Loot.RandomArmor( false, true ); break;
					case 2: loot = Loot.RandomRangedWeapon( false, true ); break;
					case 3: loot = Loot.RandomJewelry(); break;
					case 4: loot = Loot.RandomHat( false ); break;
				}

				if ( loot == null )
					continue;

				Enhance( loot );
				c.DropItem( loot );
			}
		}
		public override void OnDeath(Container c)
		{
			base.OnDeath(c);

			if (Core.ML && Utility.RandomDouble() <= 0.25)
				c.AddItem(Loot.Construct(typeof(MapFragment)));
		}
Exemple #17
0
        public override void OnDeath(Container c)
        {
            base.OnDeath(c);	
			
            if (Utility.RandomDouble() < 0.3)
                c.DropItem(new DragonFlameKey());
        }
        public override void OnDeath(Container c)
        {
            base.OnDeath(c);

            if (Utility.RandomDouble() < 0.10)
            {
                switch (Utility.Random(2))
                {
                    case 0: c.DropItem(new EssenceDiligence()); break;

                    case 1: c.DropItem(new FairyDragonWing()); break;
                }

                if (Utility.RandomDouble() < 0.10)
                {
                    switch (Utility.Random(2))
                    {
                        case 0: c.DropItem(new DraconicOrbKey()); break;

                        case 1: c.DropItem(new UntransTome()); break;
                    }
                }

                if (Utility.RandomDouble() < 0.05)
                {
                   
                        c.DropItem(new AnimatedLegsoftheInsaneTinker()); 
                }
            }
        }
Exemple #19
0
		public override void OnDeath( Container c )
		{
			base.OnDeath( c );

			if ( Utility.RandomDouble() < 0.1 )
				c.DropItem( new PrimitiveFetish() );
		}
		public override void OnDeath( Container c )
	  	{
			if ( Utility.Random( 95 ) <  1 )
				c.DropItem( new RexxarRare() );

			base.OnDeath( c );
	  	}
		public override void OnDeath( Container c )
		{
			if ( Utility.Random( 18 ) < 1 )
			c.AddItem( new PurpleBall() );

			base.OnDeath( c );
		}
        public override void OnDeath(Container c)
        {
            if (Utility.RandomDouble() <= 0.1)
            {
                c.DropItem(new BlindingAnkh());
            }

            if (Utility.RandomDouble() <= 0.01)
            {
                c.DropItem(new DaemonBlood{Hue = 33, Name = "Daemon Ichor"});
            }

            if (Utility.RandomDouble() <= 0.001)
            {
                if (Utility.RandomBool())
                {
                    c.DropItem(new BloodSpear {Hue = 33});
                }
                else
                {
                    c.DropItem(new BloodFork { Hue = 33 });
                }
            }
            base.OnDeath(c);
        }
		public override void OnDeath( Container c )
		{
			if ( Utility.Random( 10 ) < 1 )
				c.DropItem( new SnowDrop( Utility.RandomMinMax( 1, 3 ) ) );

			base.OnDeath( c );
		}
		public override void OnDeath( Container c )
		{
			base.OnDeath( c );		
			
			if ( Paragon.ChestChance > Utility.RandomDouble() )
				c.DropItem( new ParagonChest( Name, TreasureMapLevel ) );
		}
		public override void OnDeath( Container c )
		{
			base.OnDeath( c );	
			
			if ( Utility.RandomDouble() < 0.3 )
				c.DropItem( new TigerClawKey() );
		}
Exemple #26
0
        public override void OnDeath( Container c )
        {
            base.OnDeath( c );

            if ( Utility.RandomDouble() < 0.025 )
            {
                switch ( Utility.Random( 18 ) )
                {
                    case 0: c.DropItem( new AssassinChest() ); break;
                    case 1: c.DropItem( new AssassinArms() ); break;
                    case 2: c.DropItem( new DeathChest() ); break;
                    case 3: c.DropItem( new MyrmidonArms() ); break;
                    case 4: c.DropItem( new MyrmidonLegs() ); break;
                    case 5: c.DropItem( new MyrmidonGorget() ); break;
                    case 6: c.DropItem( new LeafweaveGloves() ); break;
                    case 7: c.DropItem( new LeafweaveLegs() ); break;
                    case 8: c.DropItem( new LeafweavePauldrons() ); break;
                    case 9: c.DropItem( new PaladinGloves() ); break;
                    case 10: c.DropItem( new PaladinGorget() ); break;
                    case 11: c.DropItem( new PaladinArms() ); break;
                    case 12: c.DropItem( new HunterArms() ); break;
                    case 13: c.DropItem( new HunterGloves() ); break;
                    case 14: c.DropItem( new HunterLegs() ); break;
                    case 15: c.DropItem( new HunterChest() ); break;
                    case 16: c.DropItem( new GreymistArms() ); break;
                    case 17: c.DropItem( new GreymistGloves() ); break;
                }
            }

            if ( Utility.RandomDouble() < 0.1 )
            c.DropItem( new ParrotItem() );
        }
		public override void OnDeath( Container c )
		{
			if ( Utility.Random( 250 ) <  1 )
				c.DropItem( new BloodWispStatue() );

            		base.OnDeath( c );
		}
		public override void OnDeath( Container c )
		{
			base.OnDeath( c );	
			
			if ( Utility.RandomDouble() < 0.4 )
				c.DropItem( new SpeckledPoisonSac() );
		}
        public override void OnDeath(Container c)
        {

            base.OnDeath(c);
            Region reg = Region.Find(c.GetWorldLocation(), c.Map);
            if (0.25 > Utility.RandomDouble() && reg.Name == "Fairy Dragon Lair")
            {
                switch (Utility.Random(2))
                {
                    case 0: c.DropItem(new EssenceDiligence()); break;
                    case 1: c.DropItem(new FaeryDust()); break;
                }
            }
            if (Utility.RandomDouble() <= 0.25)
            {
                switch (Utility.Random(2))
                {
                    case 0:
                        c.DropItem(new FeyWings());
                        break;
                    case 1:
                        c.DropItem(new FairyDragonWing());
                        break;

                }
            }

            if (Utility.RandomDouble() < 0.10)
            {
                c.DropItem(new DraconicOrb());

            }
        }
		public override void OnDeath( Container c )
		{
			if ( Utility.Random( 250 ) <  1 )
				c.DropItem( new SpiderWeb() );

            		base.OnDeath( c );
		}
Exemple #31
0
        protected override void OnAfterDeath(Server.Items.Container c)
        {
            if (Utility.RandomBool())
            {
                c.DropItem(new Engines.MLQuests.CoilsFang());
            }

            if (2000 > Utility.Random(100000))
            {
                c.DropItem(SetItemsHelper.GetRandomSetItem());
            }

            base.OnAfterDeath(c);
        }
Exemple #32
0
        public override void OnDeath(Server.Items.Container c)
        {
            base.OnDeath(c);

            Corpse corpse = c as Corpse;

            corpse.BeginDecay(TimeSpan.FromHours(24.0));
            corpse.StaticCorpse = true;
            for (int i = 0; i < 3; i++)
            {
                Point3D p = new Point3D(Location);
                p.X += Utility.RandomMinMax(-1, 1);
                p.Y += Utility.RandomMinMax(-1, 1);
                new Blood(Utility.Random(0x122A, 5), 86400.0).MoveToWorld(p, c.Map);
            }
        }
Exemple #33
0
        public static void CheckDrop(BaseCreature bc, Container c)
        {
            if (m_IngredientTable != null)
            {
                foreach (IngredientDropEntry entry in m_IngredientTable)
                {
                    if (entry == null)
                    {
                        continue;
                    }

                    if (entry.Region != null)
                    {
                        string reg = entry.Region;

                        if (reg == "TerMur" && c.Map != Map.TerMur)
                        {
                            continue;
                        }
                        else if (reg == "Abyss" && (c.Map != Map.TerMur || c.X < 235 || c.X > 1155 || c.Y < 40 || c.Y > 1040))
                        {
                            continue;
                        }
                        else if (reg != "TerMur" && reg != "Abyss")
                        {
                            Server.Region r = Server.Region.Find(c.Location, c.Map);

                            if (r == null || !r.IsPartOf(entry.Region))
                            {
                                continue;
                            }
                        }
                    }

                    if (bc.GetType() != entry.CreatureType && !bc.GetType().IsSubclassOf(entry.CreatureType))
                    {
                        continue;
                    }

                    double      toBeat = entry.Chance;
                    List <Item> drops  = new List <Item>();

                    if (bc is BaseVoidCreature)
                    {
                        toBeat *= ((BaseVoidCreature)bc).Stage + 1;
                    }

                    if (entry.DropMultiples)
                    {
                        foreach (Type type in entry.Ingredients)
                        {
                            if (toBeat >= Utility.RandomDouble())
                            {
                                Item drop = Loot.Construct(type);

                                if (drop != null)
                                {
                                    drops.Add(drop);
                                }
                            }
                        }
                    }
                    else if (toBeat >= Utility.RandomDouble())
                    {
                        Item drop = Loot.Construct(entry.Ingredients);

                        if (drop != null)
                        {
                            drops.Add(drop);
                        }
                    }

                    foreach (Item item in drops)
                    {
                        c.DropItem(item);
                    }
                }
            }
        }
Exemple #34
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (from == null || this.m_tool == null || from.Map == null)
                {
                    return;
                }

                // find any xmlsiege attachment on the target
                XmlSiege a = (XmlSiege)XmlAttach.FindAttachment(targeted, typeof(XmlSiege));

                // if it isnt on the target, but the target is an addon, then check the addon
                if (a == null && targeted is AddonComponent)
                {
                    a = (XmlSiege)XmlAttach.FindAttachment(((AddonComponent)targeted).Addon, typeof(XmlSiege));
                }

                // if it still isnt found, the look for nearby targets
                if (a == null)
                {
                    Point3D loc = Point3D.Zero;
                    if (targeted is IEntity)
                    {
                        loc = ((IEntity)targeted).Location;
                    }
                    else if (targeted is StaticTarget)
                    {
                        loc = ((StaticTarget)targeted).Location;
                    }
                    else if (targeted is LandTarget)
                    {
                        loc = ((LandTarget)targeted).Location;
                    }

                    if (loc != Point3D.Zero)
                    {
                        foreach (Item p in from.Map.GetItemsInRange(loc, RepairRange))
                        {
                            a = (XmlSiege)XmlAttach.FindAttachment(p, typeof(XmlSiege));
                            if (a != null)
                            {
                                break;
                            }
                        }
                    }
                }

                // repair the target
                if (a != null)
                {
                    if (a.Hits >= a.HitsMax)
                    {
                        from.SendMessage("This does not require repair.");
                        return;
                    }

                    if (a.BeingRepaired)
                    {
                        from.SendMessage("You must wait to repair again.");
                        return;
                    }
                    Container pack = from.Backpack;

                    // does the player have it?
                    if (pack != null)
                    {
                        int nhits = 0;

                        double resourcepenalty = 1;

                        // require more resources for repairing destroyed structures
                        if (a.Hits == 0)
                        {
                            resourcepenalty = RepairDestroyedResourcePenalty;
                        }

                        // dont consume resources for staff
                        if (from.AccessLevel > AccessLevel.Player)
                        {
                            resourcepenalty = 0;
                        }

                        int requirediron  = (int)(a.Iron * resourcepenalty);
                        int requiredstone = (int)(a.Stone * resourcepenalty);
                        int requiredwood  = (int)(a.Wood * resourcepenalty);

                        int niron  = pack.ConsumeUpTo(typeof(IronIngot), requirediron);
                        int nstone = pack.ConsumeUpTo(typeof(BaseGranite), requiredstone);
                        int nwood  = pack.ConsumeUpTo(typeof(Board), requiredwood);

                        if (niron == requirediron && nstone == requiredstone && nwood == requiredwood)
                        {
                            nhits += this.m_tool.HitsPerRepair;
                        }

                        if (nhits == 0)
                        {
                            from.SendMessage("Insufficient resources to complete the repair. Resources lost.");
                            return;
                        }
                        from.PlaySound(0x2A); // play anvil sound
                        from.SendMessage("You begin your repair");

                        this.m_tool.UsesRemaining--;
                        if (this.m_tool.UsesRemaining == 0)
                        {
                            from.SendLocalizedMessage(1044038); // You have worn out your tool!
                            this.m_tool.Delete();
                        }

                        a.BeingRepaired = true;

                        double smithskill     = from.Skills[SkillName.Blacksmith].Value;
                        double carpentryskill = from.Skills[SkillName.Carpentry].Value;

                        double timepenalty = 1;
                        if (a.Hits == 0)
                        {
                            // repairing destroyed structures requires more time
                            timepenalty = RepairDestroyedTimePenalty;
                        }

                        // compute repair speed with modifiers
                        TimeSpan repairtime = TimeSpan.FromSeconds(this.m_tool.BaseRepairTime * timepenalty - from.Dex / 40.0 - smithskill / 50.0 - carpentryskill / 50.0);

                        // allow staff instant repair
                        if (from.AccessLevel > AccessLevel.Player)
                        {
                            repairtime = TimeSpan.Zero;
                        }

                        // setup for the delayed repair
                        Timer.DelayCall(repairtime, new TimerStateCallback(SiegeRepair_Callback), new object[] { from, a, nhits });
                    }
                }
                else
                {
                    from.SendMessage("Invalid target");
                    return;
                }
            }
Exemple #35
0
        public virtual void Open(Mobile from, bool checkSelfLoot)
        {
            if (from.IsStaff() || from.InRange(GetWorldLocation(), 2))
            {
                #region Self Looting
                bool selfLoot = (checkSelfLoot && (from == m_Owner));

                if (selfLoot)
                {
                    SetFlag(CorpseFlag.SelfLooted, true);

                    var items = new List <Item>(Items);

                    bool gathered = false;

                    for (int k = 0; k < EquipItems.Count; ++k)
                    {
                        Item item2 = EquipItems[k];

                        if (!items.Contains(item2) && item2.IsChildOf(from.Backpack))
                        {
                            items.Add(item2);
                            gathered = true;
                        }
                    }

                    bool didntFit = false;

                    Container pack = from.Backpack;

                    bool checkRobe = true;

                    for (int i = 0; !didntFit && i < items.Count; ++i)
                    {
                        Item    item = items[i];
                        Point3D loc  = item.Location;

                        if ((item.Layer == Layer.Hair || item.Layer == Layer.FacialHair) || !item.Movable)
                        {
                            continue;
                        }

                        if (checkRobe)
                        {
                            DeathRobe robe = from.FindItemOnLayer(Layer.OuterTorso) as DeathRobe;

                            if (robe != null)
                            {
                                if (Core.SA)
                                {
                                    robe.Delete();
                                }
                                else
                                {
                                    Map map = from.Map;

                                    if (map != null && map != Map.Internal)
                                    {
                                        robe.MoveToWorld(from.Location, map);
                                    }
                                }
                            }
                        }

                        if (m_EquipItems.Contains(item) && from.EquipItem(item))
                        {
                            gathered = true;
                        }
                        else if (pack != null && pack.CheckHold(from, item, false, true))
                        {
                            item.Location = loc;
                            pack.AddItem(item);
                            gathered = true;
                        }
                        else
                        {
                            didntFit = true;
                        }
                    }

                    if (gathered && !didntFit)
                    {
                        SetFlag(CorpseFlag.Carved, true);

                        if (ItemID == 0x2006)
                        {
                            ProcessDelta();
                            SendRemovePacket();
                            ItemID = Utility.Random(0xECA, 9);                             // bone graphic
                            Hue    = 0;
                            ProcessDelta();
                        }

                        from.PlaySound(0x3E3);
                        from.SendLocalizedMessage(1062471);                         // You quickly gather all of your belongings.
                        items.Clear();
                        m_EquipItems.Clear();
                        return;
                    }

                    if (gathered && didntFit)
                    {
                        from.SendLocalizedMessage(1062472);                         // You gather some of your belongings. The rest remain on the corpse.
                    }
                }
                #endregion

                if (!CheckLoot(from, null))
                {
                    return;
                }

                #region Quests
                PlayerMobile player = from as PlayerMobile;

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

                    if (qs is UzeraanTurmoilQuest)
                    {
                        GetDaemonBoneObjective obj = qs.FindObjective(typeof(GetDaemonBoneObjective)) as GetDaemonBoneObjective;

                        if (obj != null && obj.CorpseWithBone == this && (!obj.Completed || UzeraanTurmoilQuest.HasLostDaemonBone(player)))
                        {
                            Item bone = new QuestDaemonBone();

                            if (player.PlaceInBackpack(bone))
                            {
                                obj.CorpseWithBone = null;
                                player.SendLocalizedMessage(1049341, "", 0x22);
                                // You rummage through the bones and find a Daemon Bone!  You quickly place the item in your pack.

                                if (!obj.Completed)
                                {
                                    obj.Complete();
                                }
                            }
                            else
                            {
                                bone.Delete();
                                player.SendLocalizedMessage(1049342, "", 0x22);
                                // Rummaging through the bones you find a Daemon Bone, but can't pick it up because your pack is too full.  Come back when you have more room in your pack.
                            }

                            return;
                        }
                    }
                    else if (qs is TheSummoningQuest)
                    {
                        VanquishDaemonObjective obj = qs.FindObjective(typeof(VanquishDaemonObjective)) as VanquishDaemonObjective;

                        if (obj != null && obj.Completed && obj.CorpseWithSkull == this)
                        {
                            GoldenSkull sk = new GoldenSkull();

                            if (player.PlaceInBackpack(sk))
                            {
                                obj.CorpseWithSkull = null;
                                player.SendLocalizedMessage(1050022);
                                // For your valor in combating the devourer, you have been awarded a golden skull.
                                qs.Complete();
                            }
                            else
                            {
                                sk.Delete();
                                player.SendLocalizedMessage(1050023);                                 // You find a golden skull, but your backpack is too full to carry it.
                            }
                        }
                    }
                }
                #endregion

                base.OnDoubleClick(from);
            }
            else
            {
                from.SendLocalizedMessage(500446);                 // That is too far away.
                return;
            }
        }
Exemple #36
0
 public static bool ConsumeTotal(Container pack, BeverageType content, int quantity)
 {
     return(ConsumeTotal(pack, typeof(BaseBeverage), content, quantity));
 }
Exemple #37
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Kit.Deleted)
                {
                    return;
                }

                if (!(targeted is Corpse) && !(targeted is BigFish))
                {
                    from.SendLocalizedMessage(1042600);                       // That is not a corpse!
                }
                else if (targeted is Corpse && ((Corpse)targeted).VisitedByTaxidermist)
                {
                    from.SendLocalizedMessage(1042596);                       // That corpse seems to have been visited by a taxidermist already.
                }
                else if (!m_Kit.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1042001);                       // That must be in your pack for you to use it.
                }
                else if (from.Skills[SkillName.Carpentry].Base < 90.0)
                {
                    from.SendLocalizedMessage(1042603);                       // You would not understand how to use the kit.
                }
                else
                {
                    object obj = targeted;

                    if (obj is Corpse)
                    {
                        obj = ((Corpse)obj).Owner;
                    }

                    for (int i = 0; obj != null && i < m_Table.GetLength(0); ++i)
                    {
                        if (m_Table[i, 0] == obj.GetType())
                        {
                            Container pack = from.Backpack;

                            if (pack != null && pack.ConsumeTotal(typeof(Board), 10))
                            {
                                from.SendLocalizedMessage(1042278);                                   // You review the corpse and find it worthy of a trophy.
                                from.SendLocalizedMessage(1042602);                                   // You use your kit up making the trophy.

                                Mobile hunter = null;
                                int    weight = 0;

                                if (targeted is BigFish)
                                {
                                    hunter = ((BigFish)targeted).Fisher;
                                    weight = (int)((BigFish)targeted).Weight;
                                }

                                from.AddToBackpack(new TrophyDeed((int)m_Table[i, 1] + 7, (int)m_Table[i, 1], (int)m_Table[i, 2], (int)m_Table[i, 3], hunter, weight));

                                if (targeted is Corpse)
                                {
                                    ((Corpse)targeted).VisitedByTaxidermist = true;
                                }
                                else if (targeted is BigFish)
                                {
                                    ((BigFish)targeted).Consume();
                                }

                                m_Kit.Delete();
                                return;
                            }
                            else
                            {
                                from.SendLocalizedMessage(1042598);                                   // You do not have enough boards.
                                return;
                            }
                        }
                    }

                    from.SendLocalizedMessage(1042599);                       // That does not look like something you want hanging on a wall.
                }
            }
Exemple #38
0
            protected override void OnTarget(Mobile from, object targeted)
            {
                if (m_Addon == null || m_Addon.Deleted)
                {
                    return;
                }

                if (!m_Addon.CheckAccessible(from, m_Addon))
                {
                    m_Addon.Using = false;
                    m_Addon.AccessibleFailMessage(from);
                    return;
                }

                if (targeted is RepairDeed)
                {
                    RepairDeed deed = (RepairDeed)targeted;

                    if (m_Addon.Tools.Any(x => x.Skill == deed.RepairSkill && x.Charges >= 500))
                    {
                        from.SendLocalizedMessage(1158778); // This would exceed the maximum charges allowed on this magic item.
                        from.Target = new InternalTarget(from, m_Gump, m_Addon);
                    }
                    else if (m_Addon.Tools.Any(x => x.Skill == deed.RepairSkill && x.Charges != 0 && x.SkillValue != deed.SkillLevel))
                    {
                        from.SendLocalizedMessage(1158866); // The repair bench contains deeds that do not match the skill of the deed you are trying to add.
                        from.Target = new InternalTarget(from, m_Gump, m_Addon);
                    }
                    else
                    {
                        RepairBenchDefinition tool = m_Addon.Tools.Find(x => x.Skill == deed.RepairSkill);

                        tool.SkillValue = deed.SkillLevel;
                        tool.Charges++;

                        deed.Delete();

                        from.Target = new InternalTarget(from, m_Gump, m_Addon);
                    }
                }
                else if (targeted is Container)
                {
                    Container c = targeted as Container;

                    for (int i = c.Items.Count - 1; i >= 0; --i)
                    {
                        if (i < c.Items.Count && c.Items[i] is RepairDeed)
                        {
                            RepairDeed deed = (RepairDeed)c.Items[i];

                            if (m_Addon.Tools.Any(x => x.Skill == deed.RepairSkill && x.Charges >= 500))
                            {
                                from.SendLocalizedMessage(1158778); // This would exceed the maximum charges allowed on this magic item.
                            }
                            else if (m_Addon.Tools.Any(x => x.Skill == deed.RepairSkill && x.SkillValue == deed.SkillLevel))
                            {
                                RepairBenchDefinition tool = m_Addon.Tools.Find(x => x.Skill == deed.RepairSkill);

                                tool.SkillValue = deed.SkillLevel;
                                tool.Charges++;

                                deed.Delete();
                            }
                        }
                    }
                }
                else
                {
                    from.SendLocalizedMessage(1158865); // That is not a valid repair contract or container.
                }

                m_Gump.StopTimer(from);
                from.CloseGump(typeof(RepairBenchGump));
                from.SendGump(new RepairBenchGump(from, m_Addon));
            }
Exemple #39
0
        public bool PourBottle(Mobile from, Item item)
        {
            if (item is Bottle)
            {
                Container pack = from.Backpack;

                if (pack != null)
                {
                    Container parentpack = item.Parent as Container;

                    item.Consume();                     //Consume a bottle

                    from.SendLocalizedMessage(502242);  // You pour some of the keg's contents into an empty bottle...

                    BasePotion pot = FillBottle();

                    if (parentpack != null && parentpack.TryDropItem(from, pot, false))
                    {
                        from.SendLocalizedMessage(502243);                           // ...and place it into your backpack.
                        from.PlaySound(0x240);

                        if (--Held == 0)
                        {
                            from.SendLocalizedMessage(502245);                               // The keg is now empty.
                        }
                    }
                    else
                    {
                        from.SendLocalizedMessage(502244);                           // ...but there is no room for the bottle in your backpack.
                        //pot.Delete();
                        pot.MoveToWorld(pack.GetWorldLocation(), pack.Map);
                    }
                    return(true);
                }
            }
            else if (item is PotionKeg)
            {
                PotionKeg keg = item as PotionKeg;

                if (keg.Held >= 100)
                {
                    from.SendLocalizedMessage(502233);                       // The keg will not hold any more!
                }
                else if (m_Type != keg.Type)
                {
                    from.SendLocalizedMessage(502236);                       // You decide that it would be a bad idea to mix different types of potions.
                }
                else
                {
                    int toHold = Math.Min(100 - keg.Held, m_Held);

                    keg.Held += toHold;

                    if ((Held -= toHold) == 0)
                    {
                        from.SendLocalizedMessage(502245);                           // The keg is now empty.
                    }
                    from.PlaySound(0x240);

                    return(true);
                }
            }

            return(false);
        }
Exemple #40
0
        public virtual void Open(Mobile from, bool checkSelfLoot)
        {
            if (from.AccessLevel > AccessLevel.Player || from.InRange(this.GetWorldLocation(), 2))
            {
                #region Self Looting
                bool selfLoot = (checkSelfLoot && (from == m_Owner));

                if (selfLoot)
                {
                    List <Item> items = new List <Item>(this.Items);

                    bool gathered = false;
                    bool didntFit = false;

                    Container pack = from.Backpack;

                    bool checkRobe = true;

                    for (int i = 0; !didntFit && i < items.Count; ++i)
                    {
                        Item    item = items[i];
                        Point3D loc  = item.Location;

                        if ((item.Layer == Layer.Hair || item.Layer == Layer.FacialHair) || !item.Movable || !GetRestoreInfo(item, ref loc))
                        {
                            continue;
                        }

                        if (checkRobe)
                        {
                            DeathRobe robe = from.FindItemOnLayer(Layer.OuterTorso) as DeathRobe;

                            if (robe != null)
                            {
                                if (Core.SE)
                                {
                                    robe.Delete();
                                }
                                else
                                {
                                    Map map = from.Map;

                                    if (map != null && map != Map.Internal)
                                    {
                                        robe.MoveToWorld(from.Location, map);
                                    }
                                }
                            }
                        }

                        if (m_EquipItems.Contains(item) && from.EquipItem(item))
                        {
                            gathered = true;
                        }
                        else if (pack != null && pack.CheckHold(from, item, false, true))
                        {
                            item.Location = loc;
                            pack.AddItem(item);
                            gathered = true;
                        }
                        else
                        {
                            didntFit = true;
                        }
                    }

                    if (gathered && !didntFit)
                    {
                        SetFlag(CorpseFlag.Carved, true);

                        if (ItemID == 0x2006)
                        {
                            ProcessDelta();
                            SendRemovePacket();
                            ItemID = Utility.Random(0xECA, 9);                               // bone graphic
                            Hue    = 0;
                            ProcessDelta();
                        }

                        from.PlaySound(0x3E3);
                        from.SendLocalizedMessage(1062471);                           // You quickly gather all of your belongings.
                        return;
                    }

                    if (gathered && didntFit)
                    {
                        from.SendLocalizedMessage(1062472);                           // You gather some of your belongings. The rest remain on the corpse.
                    }
                }

                #endregion

                if (!CheckLoot(from, null))
                {
                    return;
                }

                base.OnDoubleClick(from);
            }
            else
            {
                from.SendLocalizedMessage(500446);                   // That is too far away.
                return;
            }
        }
Exemple #41
0
        public void OnTarget(Mobile from, object targeted)
        {
            if (!(from is PlayerMobile) || !((PlayerMobile)from).BasketWeaving)
            {
                from.SendLocalizedMessage(1112253); //You haven't learned basket weaving. Perhaps studying a book would help!
            }
            else if (targeted is DryReeds)
            {
                DryReeds  reed1 = (DryReeds)targeted;
                Container cont  = from.Backpack;

                Server.Engines.Plants.PlantHue hue = reed1.PlantHue;

                if (!reed1.IsChildOf(from.Backpack))
                {
                    from.SendLocalizedMessage(1116249); //That must be in your backpack for you to use it.
                }
                else if (cont != null)
                {
                    Item[]      items = cont.FindItemsByType(typeof(DryReeds));
                    List <Item> list  = new List <Item>();
                    int         total = 0;

                    foreach (Item item in items)
                    {
                        if (item is DryReeds)
                        {
                            DryReeds check = (DryReeds)item;

                            if (reed1.PlantHue == check.PlantHue)
                            {
                                total += item.Amount;
                                list.Add(item);
                            }
                        }
                    }

                    int toConsume = 2;

                    if (list.Count > 0 && total > 1)
                    {
                        foreach (Item item in list)
                        {
                            if (item.Amount >= toConsume)
                            {
                                item.Consume(toConsume);
                                toConsume = 0;
                            }
                            else if (item.Amount < toConsume)
                            {
                                item.Delete();
                                toConsume -= item.Amount;
                            }

                            if (toConsume <= 0)
                            {
                                break;
                            }
                        }

                        SoftenedReeds sReed = new SoftenedReeds(hue);

                        if (!from.Backpack.TryDropItem(from, sReed, false))
                        {
                            sReed.MoveToWorld(from.Location, from.Map);
                        }

                        m_UsesRemaining--;

                        if (m_UsesRemaining <= 0)
                        {
                            Delete();
                        }
                        else
                        {
                            InvalidateProperties();
                        }

                        from.PlaySound(0x23E);
                    }
                    else
                    {
                        from.SendLocalizedMessage(1112250); //You don't have enough of this type of dry reeds to make that.
                    }
                }

                return;
            }

            if (targeted is Item && BasePigmentsOfTokuno.IsValidItem((Item)targeted))
            {
                from.PlaySound(0x23E);
                from.SendMessage("You scour any color from the item.");

                ((Item)targeted).Hue = 0;
                this.Consume();
            }
            else
            {
                from.SendMessage("You cannot scour that!");
            }
        }
Exemple #42
0
        public static void TransferGold(Mobile m, Container c, GoldLedger ledger, string nametitle)
        {
            Item[] items = c.FindItemsByType(typeof(Gold));

            foreach (Gold ngold in items)
            {
                Gold gold = ngold as Gold;

                if (gold != null)
                {
                    if (ledger.Gold < 999999999)
                    {
                        double maxWeight = (WeightOverloading.GetMaxWeight(m));
                        if ((Mobile.BodyWeight + m.TotalWeight) < (maxWeight))
                        {
                            int golda = gold.Amount;
                            if ((gold.Amount + ledger.Gold) > 999999999)
                            {
                                golda = (999999999 - ledger.Gold);
                            }
                            double maxgold = golda;
                            if (ledger.d_WeightScale > 0)
                            {
                                maxgold = ((maxWeight - ((double)Mobile.BodyWeight + (double)m.TotalWeight)) / ledger.d_WeightScale);
                            }
                            if (golda > maxgold)
                            {
                                golda = (int)maxgold;
                            }
                            int GoldID = 0;
                            if (golda == 1)
                            {
                                GoldID = gold.ItemID;
                            }
                            else if (golda > 1 && golda < 6)
                            {
                                GoldID = gold.ItemID + 1;
                            }
                            else if (golda >= 6)
                            {
                                GoldID = gold.ItemID + 2;
                            }
                            if (golda < gold.Amount)
                            {
                                gold.Amount -= golda;
                            }
                            else
                            {
                                gold.Delete();
                            }
                            ledger.Gold += golda;
                            if (ledger.b_open && golda > 0)
                            {
                                m.CloseGump(typeof(GoldLedgerGump));
                                m.SendGump(new GoldLedgerGump(ledger));
                            }

                            if (golda > 4999)
                            {
                                m.SendMessage(2125, "You loot {0} gold from {1} and deposit it into your gold ledger.", golda.ToString("#,0"), nametitle);
                                Effects.SendMovingEffect(c, m, GoldID, 5, 50, true, false);
                                m.PlaySound(0x2E6);
                            }
                        }
                    }
                }
            }
        }
Exemple #43
0
        public override bool CanTeleport(Mobile m)
        {
            if (!base.CanTeleport(m))
            {
                return false;
            }

            if (GetFlag(ConditionFlag.StaffOnly) && m.IsPlayer())
            {
                return false;
            }

            if (GetFlag(ConditionFlag.DenyMounted) && m.Mounted)
            {
                m.SendLocalizedMessage(1077252); // You must dismount before proceeding.
                return false;
            }

            if (GetFlag(ConditionFlag.DenyFollowers) &&
                (m.Followers != 0 || (m is PlayerMobile && ((PlayerMobile)m).AutoStabled.Count != 0)))
            {
                m.SendLocalizedMessage(1077250); // No pets permitted beyond this point.
                return false;
            }

            Container pack = m.Backpack;

            if (pack != null)
            {
                if (GetFlag(ConditionFlag.DenyPackContents) && pack.TotalItems != 0)
                {
                    if (!DisableMessage)
                        m.SendMessage("You must empty your backpack before proceeding.");
                    return false;
                }

                if (GetFlag(ConditionFlag.DenyPackEthereals) &&
                    (pack.FindItemByType(typeof(EtherealMount)) != null || pack.FindItemByType(typeof(BaseImprisonedMobile)) != null))
                {
                    if (!DisableMessage)
                        m.SendMessage("You must empty your backpack of ethereal mounts before proceeding.");
                    return false;
                }
            }

            if (GetFlag(ConditionFlag.DenyHolding) && m.Holding != null)
            {
                if (!DisableMessage)
                    m.SendMessage("You must let go of what you are holding before proceeding.");
                return false;
            }

            if (GetFlag(ConditionFlag.DenyEquipment))
            {
                foreach (Item item in m.Items)
                {
                    switch (item.Layer)
                    {
                        case Layer.Hair:
                        case Layer.FacialHair:
                        case Layer.Backpack:
                        case Layer.Mount:
                        case Layer.Bank:
                            {
                                continue; // ignore
                            }
                        default:
                            {
                                if (!DisableMessage)
                                    m.SendMessage("You must remove all of your equipment before proceeding.");
                                return false;
                            }
                    }
                }
            }

            if (GetFlag(ConditionFlag.DenyTransformed) && m.IsBodyMod)
            {
                if (!DisableMessage)
                    m.SendMessage("You cannot go there in this form.");
                return false;
            }

            if (GetFlag(ConditionFlag.DeadOnly) && m.Alive)
            {
                if (!DisableMessage)
                    m.SendLocalizedMessage(1060014); // Only the dead may pass.
                return false;
            }

            if (!DisableMessage && ClilocNumber != 0)
            {
                m.SendLocalizedMessage(ClilocNumber);
            }

            return true;
        }
Exemple #44
0
        public static void GetMyCorpse(Mobile from)
        {
            if (!from.Alive)
            {
                from.SendMessage("But you are dead sire, I cannot help thee");
                return;
            }

            Map map = from.Map;

            if (map == null)
            {
                return;
            }

            int distchk = 0;
            int distpck = 0;

            ArrayList bodies = new ArrayList();
            ArrayList empty  = new ArrayList();

            //ArrayList mice = new ArrayList();
            foreach (Item body in World.Items.Values) // change so it check sall facets... remove Inrange?
            {
                if (body is Corpse)
                {
                    Corpse cadaver = (Corpse)body;

                    int carrying = body.GetTotal(TotalType.Items);

                    if (cadaver.Owner == from && carrying > 0)
                    {
                        distchk++;
                        bodies.Add(body);
                        //if ( GhostHelper.HowFar( from.X, from.Y, mSp.X, mSp.Y ) < TheClosest ){ TheClosest = GhostHelper.HowFar( from.X, from.Y, mSp.X, mSp.Y ); IsClosest = distchk; }
                    }
                    else if (cadaver.Owner == from && carrying < 1)
                    {
                        empty.Add(body);
                        //mice.Add( mSp );
                    }
                }
            }


            for (int u = 0; u < empty.Count; ++u)
            {
                Item theEmpty = (Item)empty[u]; theEmpty.Delete();
            }
            //for ( int m = 0; m < mice.Count; ++m ){ Mobile theMouse = ( Mobile )mice[ m ]; theMouse.Delete(); }
            if (distchk == 0)
            {
                from.SendMessage("You have no nearby corpse in this area!");
            }
            else
            {
                int i_Bank;
                i_Bank = Banker.GetBalance(from);
                Container bank = from.FindBankNoCreate();
                if ((from.Backpack != null && from.Backpack.ConsumeTotal(typeof(Gold), 30000)) || (bank != null && bank.ConsumeTotal(typeof(Gold), 30000)))
                {
                    for (int h = 0; h < bodies.Count; ++h)
                    {
                        distpck++;
                        //if ( distpck == IsClosest )
                        //{
                        Corpse theBody = (Corpse)bodies[h];
                        theBody.MoveToWorld(new Point3D(from.X, from.Y, from.Z), from.Map);
                        //}
                    }
                }
                else
                {
                    from.SendMessage("I only work for gold, Sire.");
                    from.SendMessage("Make sure you have 30,000 gold (coins) in your pack or bank.");
                }
            }
        }
Exemple #45
0
        public override void OnAdded(object parent)
#endif
        {
            base.OnAdded(parent);

            if (!AccountGold.Enabled)
            {
                return;
            }

            Mobile          owner     = null;
            SecureTradeInfo tradeInfo = null;

            Container root = parent as Container;

            while (root != null && root.Parent is Container)
            {
                root = (Container)root.Parent;
            }

            parent = root ?? parent;

            if (parent is SecureTradeContainer && AccountGold.ConvertOnTrade)
            {
                var trade = (SecureTradeContainer)parent;

                if (trade.Trade.From.Container == trade)
                {
                    tradeInfo = trade.Trade.From;
                    owner     = tradeInfo.Mobile;
                }
                else if (trade.Trade.To.Container == trade)
                {
                    tradeInfo = trade.Trade.To;
                    owner     = tradeInfo.Mobile;
                }
            }
            else if (parent is BankBox && AccountGold.ConvertOnBank)
            {
                owner = ((BankBox)parent).Owner;
            }

            if (owner == null || owner.Account == null || !owner.Account.DepositGold(Amount))
            {
                return;
            }

            if (tradeInfo != null)
            {
                if (owner.NetState != null && !owner.NetState.NewSecureTrading)
                {
                    var total = Amount / Math.Max(1.0, Account.CurrencyThreshold);
                    var plat  = (int)Math.Truncate(total);
                    var gold  = (int)((total - plat) * Account.CurrencyThreshold);

                    tradeInfo.Plat += plat;
                    tradeInfo.Gold += gold;
                }

                if (tradeInfo.VirtualCheck != null)
                {
                    tradeInfo.VirtualCheck.UpdateTrade(tradeInfo.Mobile);
                }
            }

            owner.SendLocalizedMessage(1042763, Amount.ToString("#,0"));

            Delete();

            ((Container)parent).UpdateTotals();
        }