public static void Craft( Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem ) { if ( from.Backpack == null ) { from.EndAction( typeof( CraftSystem ) ); return; } Timer.DelayCall( TimeSpan.FromSeconds( craftSystem.Delay ), new TimerCallback( delegate { if ( from.Backpack.GetAmount( typeof( Bottle ) ) < 1 || from.Backpack.GetAmount( typeof( PlantClippings ) ) < 1 ) { from.EndAction( typeof( CraftSystem ) ); // You don't have the components needed to make that. from.SendGump( new CraftGump( from, craftSystem, tool, 1044253 ) ); } else if ( ShouldChooseHue( from ) ) { from.SendLocalizedMessage( 1074794 ); // Target the material to use: from.Target = new ClippingsTarget( craftSystem, typeRes, tool, craftItem ); } else { from.EndAction( typeof( CraftSystem ) ); DoCraft( from, craftSystem, typeRes, tool, craftItem, from.Backpack.FindItemByType<PlantClippings>() ); } } ) ); }
public override bool Use( Mobile from ) { if ( from.BeginAction( typeof( ClarityPotion ) ) ) { int amount = Utility.Dice( 3, 3, 3 ); int time = Utility.RandomMinMax( 5, 30 ); from.PlaySound( 0x2D6 ); if ( from.Body.IsHuman ) { from.Animate( 34, 5, 1, true, false, 0 ); } from.FixedParticles( 0x375A, 10, 15, 5011, EffectLayer.Head ); from.PlaySound( 0x1EB ); StatMod mod = from.GetStatMod( "Concussion" ); if ( mod != null ) { from.RemoveStatMod( "Concussion" ); from.Mana -= mod.Offset; } from.PlaySound( 0x1EE ); from.AddStatMod( new StatMod( StatType.Int, "clarity-potion", amount, TimeSpan.FromMinutes( time ) ) ); Timer.DelayCall( TimeSpan.FromMinutes( time ), delegate() { from.EndAction( typeof( ClarityPotion ) ); } ); return true; } return false; }
protected override void OnTarget( Mobile from, object targeted ) { Item toImbue = targeted as Item; if ( Imbuing.Check( from, toImbue ) ) from.SendGump( new SelectPropGump( toImbue ) ); else from.EndAction( typeof( Imbuing ) ); }
public static void Remove(Mobile m) { if (m_Table.ContainsKey(m)) { m.RemoveSkillMod(m_Table[m]); m_Table.Remove(m); } m.EndAction(typeof(RogueShadowSpell)); }
protected override void OnTarget( Mobile from, object targeted ) { Item item = targeted as Item; IImbuable toUnravel = targeted as IImbuable; from.EndAction( typeof( Imbuing ) ); if ( !Soulforge.CheckProximity( from, 2 ) ) from.SendLocalizedMessage( 1080433 ); // You must be near a soulforge to magically unravel an item. else if ( !Soulforge.CheckQueen( from ) ) from.SendLocalizedMessage( 1113736 ); // You must rise to the rank of noble in the eyes of the Gargoyle Queen before her majesty will allow you to use this soulforge. else if ( item == null || !item.IsChildOf( from.Backpack ) ) from.SendLocalizedMessage( 1080424 ); // The item must be in your backpack to magically unravel it. else Unraveling.TryUnravel( from, item, true ); }
public override void Drink( Mobile from ) { if ( from.BeginAction( typeof( LightCycle ) ) ) { // ** EDIT ** Time System //new LightCycle.NightSightTimer( from ).Start(); //from.LightLevel = LightCycle.DungeonLevel / 2; from.FixedParticles( 0x376A, 9, 32, 5007, EffectLayer.Waist ); from.PlaySound( 0x1E3 ); BasePotion.PlayDrinkEffect( from ); this.Consume(); int oldLevel = LightCycle.DungeonLevel / 2; int level = TimeSystem.EffectsEngine.GetNightSightLevel(from, oldLevel); if (level > -1) { from.LightLevel = level; TimeSystem.EffectsEngine.SetNightSightOn(from, oldLevel); } else { from.EndAction(typeof(LightCycle)); from.SendMessage("The potion seems to have no effect."); } // ** END *** Time System } else { from.SendMessage( "You already have nightsight." ); } }
public static void Craft( Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool, CraftItem craftItem ) { if ( !( from is PlayerMobile ) || !( (PlayerMobile) from ).BasketWeaving ) { from.EndAction( typeof( CraftSystem ) ); // You haven't learned basket weaving. Perhaps studying a book would help! from.SendGump( new CraftGump( from, craftSystem, tool, 1112253 ) ); } else { Timer.DelayCall( TimeSpan.FromSeconds( craftSystem.Delay ), new TimerCallback( delegate { from.SendLocalizedMessage( 1074794 ); // Target the material to use: from.Target = new ReedsTarget( craftSystem, typeRes, tool, craftItem ); } ) ); } }
public static void RemoveEffect(Mobile m) { if (m_Table.ContainsKey(m)) { object[] mods = m_Table[m]; if (mods != null) { m.RemoveStatMod(((StatMod)mods[0]).Name); m.RemoveSkillMod((SkillMod)mods[1]); m.RemoveSkillMod((SkillMod)mods[2]); } m_Table.Remove(m); m.BodyMod = 0; m.EndAction(typeof(RogueSlyFoxSpell)); } }
public static void DismountAttack( Mobile from, Mobile target ) { target.Damage( 1, from ); IMount mt = target.Mount; if ( mt != null ) { mt.Rider = null; } if ( target.IsPlayer ) { target.BeginAction( typeof( BaseMount ) ); target.SendLocalizedMessage( 1040023 ); // You have been knocked off of your mount! target.EndAction( typeof( BaseMount ) ); } from.DoHarmful( target ); }
public override void ApplyEffect(Mobile to, Mobile source, int intensity, Item itemSource) { if (to.BeginAction(typeof(LightCycle))) { int oldLevel = to.LightLevel; int level = TimeSystem.EffectsEngine.GetNightSightLevel(to, oldLevel); if (level > -1) { to.LightLevel = level; TimeSystem.EffectsEngine.SetNightSightOn(to, oldLevel); } else { to.EndAction(typeof(LightCycle)); to.SendMessage("The potion seems to have no effect."); } } }
public static void RemoveEffect(Mobile m) { if (m_Table.ContainsKey(m)) { object[] mods = (object[])m_Table[m]; if (mods != null) { m.RemoveStatMod(((StatMod)mods[0]).Name); m.RemoveStatMod(((StatMod)mods[1]).Name); m.RemoveSkillMod((SkillMod)mods[2]); m.RemoveSkillMod((SkillMod)mods[3]); m.RemoveSkillMod((SkillMod)mods[4]); m.RemoveSkillMod((SkillMod)mods[5]); m.RemoveSkillMod((SkillMod)mods[6]); } m_Table.Remove(m); m.EndAction(typeof(RogueIntimidationSpell)); } }
protected override void OnTarget( Mobile from, object targeted ) { Container cont = targeted as Container; from.EndAction( typeof( Imbuing ) ); if ( !Soulforge.CheckProximity( from, 2 ) ) from.SendLocalizedMessage( 1080433 ); // You must be near a soulforge to magically unravel an item. else if ( !Soulforge.CheckQueen( from ) ) from.SendLocalizedMessage( 1113736 ); // You must rise to the rank of noble in the eyes of the Gargoyle Queen before her majesty will allow you to use this soulforge. else if ( cont == null ) from.SendLocalizedMessage( 1111814, "0\t0" ); // Unraveled: ~1_COUNT~/~2_NUM~ items else if ( !cont.IsChildOf( from.Backpack ) ) from.SendLocalizedMessage( 1062334 ); // This item must be in your backpack to be used. else if ( HasSpecialMaterialItem( cont ) ) { from.BeginAction( typeof( Imbuing ) ); from.SendGump( new ConfirmUnravelContainerGump( cont ) ); } else { Unraveling.UnravelContainer( from, cont ); } }
public static void Debuff( Mobile mob ) { mob.RemoveStatMod( "[Magic] Str Offset" ); mob.RemoveStatMod( "[Magic] Dex Offset" ); mob.RemoveStatMod( "[Magic] Int Offset" ); mob.RemoveStatMod( "Concussion" ); mob.RemoveStatMod( "blood-rose" ); mob.RemoveStatMod( "clarity-potion" ); OrangePetals.RemoveContext( mob ); mob.Paralyzed = false; mob.Hidden = false; if ( !Core.AOS ) { mob.MagicDamageAbsorb = 0; mob.MeleeDamageAbsorb = 0; Spells.Second.ProtectionSpell.Registry.Remove( mob ); Spells.Fourth.ArchProtectionSpell.RemoveEntry( mob ); mob.EndAction( typeof( DefensiveSpell ) ); } TransformationSpellHelper.RemoveContext( mob, true ); AnimalForm.RemoveContext( mob, true ); if( DisguiseTimers.IsDisguised( mob ) ) DisguiseTimers.StopTimer( mob ); if( !mob.CanBeginAction( typeof( PolymorphSpell ) ) ) { mob.BodyMod = 0; mob.HueMod = -1; mob.EndAction( typeof( PolymorphSpell ) ); } BaseArmor.ValidateMobile( mob ); BaseClothing.ValidateMobile( mob ); mob.Hits = mob.HitsMax; mob.Stam = mob.StamMax; mob.Mana = mob.ManaMax; mob.Poison = null; }
public void CheckCancelMorph ( Mobile m ) { if ( m == null ) return; double minSkill, maxSkill; AnimalFormContext acontext = AnimalForm.GetContext( m ); TransformContext context = TransformationSpellHelper.GetContext( m ); if ( context != null ) { Spell spell = context.Spell as Spell; spell.GetCastSkills ( out minSkill, out maxSkill ); if ( m.Skills[spell.CastSkill].Value < minSkill ) TransformationSpellHelper.RemoveContext( m, context, true ); } if ( acontext != null ) { int i; for ( i = 0; i < AnimalForm.Entries.Length; ++i ) if ( AnimalForm.Entries[i].Type == acontext.Type ) break; if ( m.Skills[SkillName.Ninjitsu].Value < AnimalForm.Entries[i].ReqSkill ) AnimalForm.RemoveContext( m, true ); } if ( !m.CanBeginAction ( typeof ( PolymorphSpell ) ) && m.Skills[SkillName.Magery].Value < 66.1 ) { m.BodyMod = 0; m.HueMod = -1; m.NameMod = null; m.EndAction( typeof( PolymorphSpell ) ); BaseArmor.ValidateMobile( m ); BaseClothing.ValidateMobile( m ); } if ( !m.CanBeginAction ( typeof ( IncognitoSpell ) ) && m.Skills[SkillName.Magery].Value < 38.1 ) { if ( m is PlayerMobile ) ((PlayerMobile)m).SetHairMods( -1, -1 ); m.BodyMod = 0; m.HueMod = -1; m.NameMod = null; m.EndAction( typeof( IncognitoSpell ) ); BaseArmor.ValidateMobile( m ); BaseClothing.ValidateMobile( m ); BuffInfo.RemoveBuff( m, BuffIcon.Incognito ); } return; }
public void DoStopStartHueCycle( Mobile from, CyclingDyetub cd ) { if ( !CheckRange( from, cd ) ) return; if ( !cd.m_IsCycling ) { cd.m_IsCycling = true; cd.DoHueTimer(); } else { cd.m_IsCycling = false; from.EndAction( typeof( CyclingDyetub ) ); } from.CloseGump( typeof( CyclingDyetubGump ) ); from.SendGump( new CyclingDyetubGump( from, m_CD ) ); }
public void DoCurHueMinus( Mobile from, CyclingDyetub cd ) { if ( !CheckRange( from, m_CD ) ) return; if ( !cd.m_IsCycling ) { if ( cd.Hue >= 1 ) cd.Hue--; } else { cd.m_IsCycling = false; from.EndAction( typeof( CyclingDyetub ) ); if ( cd.Hue >= 1 ) cd.Hue--; } cd.Name = "Dyetub Hue # " + cd.Hue; from.CloseGump( typeof( CyclingDyetubGump ) ); from.SendGump( new CyclingDyetubGump( from, cd ) ); }
protected override void OnTick() { m_Owner.EndAction(typeof(LightCycle)); m_Owner.LightLevel = 0; BuffInfo.RemoveBuff(m_Owner, BuffIcon.NightSight); }
private void EndLock( Mobile m ) { m.EndAction( this ); }
protected override void OnTick() { m_Owner.EndAction(typeof(LightCycle)); m_Owner.LightLevel = 0; }
public virtual bool OnHarvesting( Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked, bool last ) { if ( !CheckHarvest( from, tool ) ) { from.EndAction( locked ); return false; } int tileID; Map map; Point3D loc; if ( !GetHarvestDetails( from, tool, toHarvest, out tileID, out map, out loc ) ) { from.EndAction( locked ); OnBadHarvestTarget( from, tool, toHarvest ); return false; } else if ( !def.Validate( tileID ) ) { from.EndAction( locked ); OnBadHarvestTarget( from, tool, toHarvest ); return false; } else if ( !CheckRange( from, tool, def, map, loc, true ) ) { from.EndAction( locked ); return false; } else if ( !CheckResources( from, tool, def, map, loc, true ) ) { from.EndAction( locked ); return false; } else if ( !CheckHarvest( from, tool, def, toHarvest ) ) { from.EndAction( locked ); return false; } DoHarvestingEffect( from, tool, def, map, loc ); new HarvestSoundTimer( from, tool, this, def, toHarvest, locked, last ).Start(); return !last; }
public void Craft( Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool ) { if ( from.BeginAction( typeof( CraftSystem ) ) ) { if( RequiredExpansion == Expansion.None || ( from.NetState != null && from.NetState.SupportsExpansion( RequiredExpansion ) ) ) { bool allRequiredSkills = true; double chance = GetSuccessChance( from, typeRes, craftSystem, false, ref allRequiredSkills ); if ( allRequiredSkills && chance >= 0.0 ) { if( this.Recipe == null || !(from is PlayerMobile) || ((PlayerMobile)from).HasRecipe( this.Recipe ) ) { int badCraft = craftSystem.CanCraft( from, tool, m_Type ); if( badCraft <= 0 ) { int resHue = 0; int maxAmount = 0; object message = null; if( ConsumeRes( from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.None, ref message ) ) { message = null; if( ConsumeAttributes( from, ref message, false ) ) { CraftContext context = craftSystem.GetContext( from ); if( context != null ) context.OnMade( this ); int iMin = craftSystem.MinCraftEffect; int iMax = (craftSystem.MaxCraftEffect - iMin) + 1; int iRandom = Utility.Random( iMax ); iRandom += iMin + 1; new InternalTimer( from, craftSystem, this, typeRes, tool, iRandom ).Start(); } else { from.EndAction( typeof( CraftSystem ) ); from.SendGump( new CraftGump( from, craftSystem, tool, message ) ); } } else { from.EndAction( typeof( CraftSystem ) ); from.SendGump( new CraftGump( from, craftSystem, tool, message ) ); } } else { from.EndAction( typeof( CraftSystem ) ); from.SendGump( new CraftGump( from, craftSystem, tool, badCraft ) ); } } else { from.EndAction( typeof( CraftSystem ) ); from.SendGump( new CraftGump( from, craftSystem, tool, 1072847 ) ); // You must learn that recipe from a scroll. } } else { from.EndAction( typeof( CraftSystem ) ); from.SendGump( new CraftGump( from, craftSystem, tool, 1044153 ) ); // You don't have the required skills to attempt this item. } } else { from.EndAction( typeof( CraftSystem ) ); from.SendGump( new CraftGump( from, craftSystem, tool, RequiredExpansionMessage( RequiredExpansion ) ) ); //The {0} expansion is required to attempt this item. } } else { from.SendLocalizedMessage( 500119 ); // You must wait to perform another action } }
protected override void OnTarget( Mobile from, object targeted ) { if ( !( targeted is DryReeds ) || !( (DryReeds) targeted ).IsChildOf( from.Backpack ) ) { from.SendLocalizedMessage( 1046439 ); // That is not a valid target. from.SendLocalizedMessage( 1074794 ); // Target the material to use: from.Target = new ReedsTarget( m_CraftSystem, m_TypeRes, m_Tool, m_CraftItem ); } else { from.EndAction( typeof( CraftSystem ) ); DryReeds reeds = targeted as DryReeds; if ( !reeds.IsChildOf( from.Backpack ) ) { // You do not have enough scouring toxins to make that! from.SendGump( new CraftGump( from, m_CraftSystem, m_Tool, 1112326 ) ); } if ( from.Backpack == null || from.Backpack.GetAmount( typeof( ScouringToxin ) ) < 1 ) { // You do not have enough scouring toxins to make that! from.SendGump( new CraftGump( from, m_CraftSystem, m_Tool, 1112326 ) ); } else if ( DryReeds.GetTotalReeds( from.Backpack, reeds.PlantHue ) < 2 ) { // You don't have enough of this type of dry reeds to make that. from.SendGump( new CraftGump( from, m_CraftSystem, m_Tool, 1112250 ) ); } else { bool allRequiredSkills = true; double chance = m_CraftItem.GetSuccessChance( from, m_TypeRes, m_CraftSystem, true, ref allRequiredSkills ); if ( chance > 0.0 ) chance += m_CraftItem.GetTalismanBonus( from, m_CraftSystem ); if ( allRequiredSkills ) { if ( chance < Utility.RandomDouble() ) { DryReeds.ConsumeReeds( from.Backpack, reeds.PlantHue, 1 ); from.SendGump( new CraftGump( from, m_CraftSystem, m_Tool, 1044043 ) ); // You failed to create the item, and some of your materials are lost. } else { from.Backpack.ConsumeTotal( typeof( ScouringToxin ), 1 ); DryReeds.ConsumeReeds( from.Backpack, reeds.PlantHue, 2 ); from.AddToBackpack( new SoftenedReeds( reeds.PlantHue ) ); bool toolBroken = false; m_Tool.UsesRemaining--; if ( m_Tool.UsesRemaining < 1 ) toolBroken = true; if ( toolBroken ) { m_Tool.Delete(); from.SendLocalizedMessage( 1044038 ); // You have worn out your tool! from.SendLocalizedMessage( 1044154 ); // You create the item. } if ( !toolBroken ) { // You create the item. from.SendGump( new CraftGump( from, m_CraftSystem, m_Tool, 1044154 ) ); } } } else { // You don't have the required skills to attempt this item. from.SendGump( new CraftGump( from, m_CraftSystem, m_Tool, 1044153 ) ); } } } }
protected override void OnTick() { m_Mobile.EndAction <DefensiveSpell>(); }
public void CheckCancelMorph(Mobile m) { if (m == null) { return; } double minSkill, maxSkill; AnimalFormContext acontext = AnimalForm.GetContext(m); TransformContext context = TransformationSpellHelper.GetContext(m); if (context != null) { Spell spell = context.Spell as Spell; spell.GetCastSkills(out minSkill, out maxSkill); if (m.Skills[spell.CastSkill].Value < minSkill) { TransformationSpellHelper.RemoveContext(m, context, true); } } if (acontext != null) { int i; for (i = 0; i < AnimalForm.Entries.Length; ++i) { if (AnimalForm.Entries[i].Type == acontext.Type) { break; } } if (m.Skills[SkillName.Ninjitsu].Value < AnimalForm.Entries[i].ReqSkill) { AnimalForm.RemoveContext(m, true); } } if (!m.CanBeginAction(typeof(PolymorphSpell)) && m.Skills[SkillName.Magery].Value < 66.1) { m.BodyMod = 0; m.HueMod = -1; m.NameMod = null; m.EndAction(typeof(PolymorphSpell)); BaseArmor.ValidateMobile(m); BaseClothing.ValidateMobile(m); } if (!m.CanBeginAction(typeof(IncognitoSpell)) && m.Skills[SkillName.Magery].Value < 38.1) { if (m is PlayerMobile) { ((PlayerMobile)m).SetHairMods(-1, -1); } m.BodyMod = 0; m.HueMod = -1; m.NameMod = null; m.EndAction(typeof(IncognitoSpell)); BaseArmor.ValidateMobile(m); BaseClothing.ValidateMobile(m); BuffInfo.RemoveBuff(m, BuffIcon.Incognito); } return; }
private static void ReleaseManaLock( Mobile from ) { from.EndAction( typeof( BaseManaRefreshPotion ) ); }
private static void EndPolymorph( Mobile m ) { if( !m.CanBeginAction( typeof( PolymorphSpell ) ) ) { m.BodyMod = 0; m.HueMod = -1; m.EndAction( typeof( PolymorphSpell ) ); BaseArmor.ValidateMobile( m ); BaseClothing.ValidateMobile( m ); } }
public static void DoExit( Mobile from, CyclingDyetub cd ) { if ( cd.m_IsCycling ) { cd.m_IsCycling = false; from.EndAction( typeof( CyclingDyetub ) ); } if ( cd.Hue != 0 ) { cd.Hue = 0; cd.Name = "Dyetub Hue # " + cd.Hue; } if ( cd.ItemID != 0xFAB ) cd.ItemID = 0xFAB; from.CloseGump( typeof( CyclingDyetubGump ) ); }
public void DoCurHuePlus( Mobile from, CyclingDyetub cd ) { if ( !CheckRange( from, cd ) ) return; if ( cd.Hue > 2998 ) { from.SendMessage( "There are no hues above 2999." ); } else if ( !cd.m_IsCycling ) { cd.Hue++; } else { cd.m_IsCycling = false; from.EndAction( typeof( CyclingDyetub ) ); cd.Hue++; } cd.Name = "Dyetub Hue # " + cd.Hue; from.CloseGump( typeof( CyclingDyetubGump ) ); from.SendGump( new CyclingDyetubGump( from, cd ) ); }
protected override void OnTick() { m_Mobile.EndAction(typeof(DefensiveSpell)); }
protected override void OnTargetCancel( Mobile from, TargetCancelType cancelType ) { from.EndAction( typeof( CraftSystem ) ); from.SendGump( new CraftGump( from, m_CraftSystem, m_Tool, null ) ); }
public static void RemoveEffect( Mobile m ) { object[] mods = (object[])m_Table[m]; if ( mods != null ) { m.RemoveStatMod( ((StatMod)mods[0]).Name ); m.RemoveStatMod( ((StatMod)mods[1]).Name ); m.RemoveSkillMod( (SkillMod)mods[2] ); m.RemoveSkillMod( (SkillMod)mods[3] ); } m_Table.Remove( m ); m.EndAction( typeof( RangerHuntersAimSpell ) ); m.BodyMod = 0; }
protected void EndGamble(Mobile from) { if (from == null || from.Deleted) { return; } from.EndAction(GetType()); var a = Utility.RandomDouble() * 0.5; var b = (Math.Min(LuckCap, from.Luck) / (double)LuckCap) * 0.5; var c = a + b; Normalize(ref c); //Console.WriteLine("LDT: A = {0} B = {1} C = {2}", a, b, c); var prizeEntry = GetPrize(c); if (prizeEntry == null || prizeEntry.Disabled) { from.SendMessage(34, "Sorry {0}, you didn't win anything, better luck next time!", from.RawName); Delete(); return; } var prize = prizeEntry.CreateInstance<Item>(); if (prize == null) { Prizes.Remove(prizeEntry); VitaNexCore.ToConsole( "WARNING: An instance of {0} could not be constructed in {1} at {2}", prizeEntry.Type.FullName, GetType().FullName, prizeEntry.GetType().FullName); from.SendMessage(34, "We couldn't process your ticket, please try again."); return; } from.SendMessage(85, "Congratulations, you won a prize! ({0})", prize.ResolveName(from)); ReplaceWith(prize); }
public void Craft( Mobile from, CraftSystem craftSystem, Type typeRes, BaseTool tool ) { if ( from.BeginAction( typeof( CraftSystem ) ) ) { int flags = from.NetState == null ? 0 : from.NetState.Flags; if( !RequiresSE || (flags & 0x10) != 0 )// SE 2D = 0x1F SE 3D = 0x11F { bool allRequiredSkills = true; double chance = GetSuccessChance( from, typeRes, craftSystem, false, ref allRequiredSkills ); if ( allRequiredSkills && chance >= 0.0 ) { string badCraft = craftSystem.CanCraft( from, tool, m_Type ); if ( badCraft == "" ) { int resHue = 0; int maxAmount = 0; object message = null; if ( ConsumeRes( from, typeRes, craftSystem, ref resHue, ref maxAmount, ConsumeType.None, ref message ) ) { message = null; if ( ConsumeAttributes( from, ref message, false ) ) { CraftContext context = craftSystem.GetContext( from ); if ( context != null ) context.OnMade( this ); int iMin = craftSystem.MinCraftEffect; int iMax = ( craftSystem.MaxCraftEffect - iMin ) + 1; int iRandom = Utility.Random( iMax ); iRandom += iMin + 1; new InternalTimer( from, craftSystem, this, typeRes, tool, iRandom ).Start(); } else { from.EndAction( typeof( CraftSystem ) ); from.SendGump( new CraftGump( from, craftSystem, tool, message ) ); } } else { from.EndAction( typeof( CraftSystem ) ); from.SendGump( new CraftGump( from, craftSystem, tool, message ) ); } } else { from.EndAction( typeof( CraftSystem ) ); from.SendGump( new CraftGump( from, craftSystem, tool, badCraft ) ); } } else { from.EndAction( typeof( CraftSystem ) ); from.SendGump( new CraftGump( from, craftSystem, tool, 1044153 ) ); // You don't have the required skills to attempt this item. } } else { from.EndAction( typeof( CraftSystem ) ); from.SendGump( new CraftGump( from, craftSystem, tool, 1063307 ) ); //The "Samurai Empire" expansion is required to attempt this item. } } else { from.SendAsciiMessage( "You must wait to perform another action." ); } }
public virtual void FinishHarvesting( Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked ) { from.EndAction( locked ); if ( !CheckHarvest( from, tool ) ) return; int tileID; Map map; Point3D loc; if ( !GetHarvestDetails( from, tool, toHarvest, out tileID, out map, out loc ) ) { OnBadHarvestTarget( from, tool, toHarvest ); return; } else if ( !def.Validate( tileID ) ) { OnBadHarvestTarget( from, tool, toHarvest ); return; } if ( !CheckRange( from, tool, def, map, loc, true ) ) return; else if ( !CheckResources( from, tool, def, map, loc, true ) ) return; else if ( !CheckHarvest( from, tool, def, toHarvest ) ) return; if ( SpecialHarvest( from, tool, def, map, loc ) ) return; HarvestBank bank = def.GetBank( map, loc.X, loc.Y ); if ( bank == null ) return; HarvestVein vein = bank.Vein; if ( vein != null ) vein = MutateVein( from, tool, def, bank, toHarvest, vein ); if ( vein == null ) return; HarvestResource primary = vein.PrimaryResource; HarvestResource fallback = vein.FallbackResource; HarvestResource resource = MutateResource( from, tool, def, map, loc, vein, primary, fallback ); double skillBase = from.Skills[def.Skill].Base; double skillValue = from.Skills[def.Skill].Value; Type type = null; if ( skillBase >= resource.ReqSkill && from.CheckSkill( def.Skill, resource.MinSkill, resource.MaxSkill ) ) { type = GetResourceType( from, tool, def, map, loc, resource ); if ( type != null ) type = MutateType( type, from, tool, def, map, loc, resource ); if ( type != null ) { Item item = Construct( type, from ); if ( item == null ) { type = null; } else { //The whole harvest system is kludgy and I'm sure this is just adding to it. if ( item.Stackable ) { int amount = def.ConsumedPerHarvest; int feluccaAmount = def.ConsumedPerFeluccaHarvest; int racialAmount = (int)Math.Ceiling( amount * 1.1 ); int feluccaRacialAmount = (int)Math.Ceiling( feluccaAmount * 1.1 ); bool eligableForRacialBonus = ( def.RaceBonus && from.Race == Race.Human ); bool inFelucca = (map == Map.Felucca); if( eligableForRacialBonus && inFelucca && bank.Current >= feluccaRacialAmount ) item.Amount = feluccaRacialAmount; else if( inFelucca && bank.Current >= feluccaAmount ) item.Amount = feluccaAmount; else if( eligableForRacialBonus && bank.Current >= racialAmount ) item.Amount = racialAmount; else item.Amount = amount; } bank.Consume( item.Amount, from ); if ( Give( from, item, def.PlaceAtFeetIfFull ) ) { SendSuccessTo( from, item, resource ); } else { SendPackFullTo( from, item, def, resource ); item.Delete(); } BonusHarvestResource bonus = def.GetBonusResource(); if ( bonus != null && bonus.Type != null && skillBase >= bonus.ReqSkill ) { Item bonusItem = Construct( bonus.Type, from ); if ( Give( from, bonusItem, true ) ) //Bonuses always allow placing at feet, even if pack is full irregrdless of def { bonus.SendSuccessTo( from ); } else { //28JUL2008 Typo in RC2 - SVN 295: in HarvestSystem.cs *** START *** //item.Delete(); bonusItem.Delete(); //28JUL2008 Typo in RC2 - SVN 295: in HarvestSystem.cs *** END *** } } if ( tool is IUsesRemaining ) { IUsesRemaining toolWithUses = (IUsesRemaining)tool; toolWithUses.ShowUsesRemaining = true; if ( toolWithUses.UsesRemaining > 0 ) --toolWithUses.UsesRemaining; if ( toolWithUses.UsesRemaining < 1 ) { tool.Delete(); def.SendMessageTo( from, def.ToolBrokeMessage ); } } } } } if ( type == null ) def.SendMessageTo( from, def.FailMessage ); OnHarvestFinished( from, tool, def, vein, bank, resource, toHarvest ); }
public override void OnDoubleClick(Mobile m) { if (m == null || m.Deleted) { return; } if (FuseLit) { m.SendMessage("The fuse is already burning."); return; } if (!this.CheckDoubleClick(m, true, false, 10)) { return; } if (!m.BeginAction(UseLock)) { m.SendMessage("You must wait before you can light another {0}.", this.ResolveName(m)); return; } MoveToWorld(m.Location, m.Map); Timer.DelayCall(UseDelay, () => m.EndAction(UseLock)); IgniteFuse(m); InvalidateProperties(); }