protected override void OnTargetUntargetable(Mobile from, object targeted) { if (from is PlayerMobile) ((PlayerMobile)from).EndPlayerAction(); else from.EndAction(typeof(IAction)); base.OnTargetUntargetable(from, targeted); }
public static void RemoveEntry( Mobile m ) { if ( _Table.ContainsKey( m ) ) { int v = _Table[m]; _Table.Remove( m ); m.EndAction( typeof( ArchProtectionSpell ) ); m.VirtualArmorMod -= v; if ( m.VirtualArmorMod < 0 ) m.VirtualArmorMod = 0; } }
public override bool OnBeforeSwing(Mobile attacker, Mobile defender) { bool valid = this.Validate(attacker) && this.CheckMana(attacker, true); if (valid) { attacker.BeginAction(typeof(Stealth)); Timer.DelayCall(TimeSpan.FromSeconds(5.0), delegate { attacker.EndAction(typeof(Stealth)); }); } return valid; }
public override void RemoveEffect( Mobile m ) { m.SendLocalizedMessage( 1074771 ); // You are no longer under the effects of Ethereal Voyage. TransformationSpellHelper.RemoveContext( m, true ); Timer.DelayCall( TimeSpan.FromMinutes( 5 ), delegate { m.EndAction( typeof( EtherealVoyageSpell ) ); } ); BuffInfo.RemoveBuff( m, BuffIcon.EtherealVoyage ); }
public static void RemoveEffect(Mobile m) { if (!m_Table.ContainsKey(m)) return; List<ResistanceMod> mods = m_Table[m]; for (int i = 0; i < m_Table[m].Count; i++) { m.RemoveResistanceMod(mods[i]); } m_Table.Remove(m); m.EndAction(typeof(StoneFormSpell)); m.PlaySound(0x201); m.FixedParticles(0x3728, 1, 13, 9918, 92, 3, EffectLayer.Head); m.BodyMod = 0; }
public override void RemoveEffect(Mobile m) { ResistanceMod[] mods = (ResistanceMod[])m_Table[m]; if (mods != null) { m_Table.Remove(m); m_Table[m] = mods; for (int i = 0; i < mods.Length; ++i) m.RemoveResistanceMod(mods[i]); m.PlaySound(0x65B); m.FixedParticles(0x3728, 1, 13, 9918, 92, 3, EffectLayer.Head); m.Delta(MobileDelta.WeaponDamage); m.EndAction(typeof(StoneFormSpell)); } }
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.RemoveStatMod( ((StatMod)mods[2]).Name ); m.RemoveSkillMod( (SkillMod)mods[3] ); m.RemoveSkillMod( (SkillMod)mods[4] ); m.RemoveSkillMod( (SkillMod)mods[5] ); } m_Table.Remove( m ); m.EndAction( typeof( ClericAngelicFaithSpell ) ); m.BodyMod = 0; }
public static void RemoveEffect(Mobile m) { if (!m_Table.ContainsKey(m)) return; var mods = m_Table[m]; for (var i = 0; i < m_Table[m].Count; i++) { m.RemoveResistanceMod(mods[i]); } Enhancement.SetValue(m, AosAttribute.CastSpeed, 2, "Stone Form"); Enhancement.SetValue(m, AosAttribute.WeaponSpeed, 10, "Stone Form"); m_Table.Remove(m); m.EndAction(typeof (StoneFormSpell)); m.PlaySound(0x201); m.FixedParticles(0x3728, 1, 13, 9918, 92, 3, EffectLayer.Head); m.BodyMod = 0; }
private static void ReleaseExplosionLock(Mobile from) { from.EndAction(typeof(BaseExplosionPotion)); }
protected override void OnTargetCancel( Mobile from, TargetCancelType cancelType ) { from.EndAction( typeof( RockPile ) ); }
protected override void OnTick() { m_iCount++; m_From.DisruptiveAction(); if (m_iCount < m_iCountMax) { m_CraftSystem.PlayCraftEffect(m_From); } else { m_From.EndAction(typeof(CraftSystem)); int badCraft = m_CraftSystem.CanCraft(m_From, m_Tool, m_CraftItem.m_Type); if (badCraft > 0) { if (m_Tool != null && !m_Tool.Deleted && m_Tool.UsesRemaining > 0) { m_From.SendGump(new CraftGump(m_From, m_CraftSystem, m_Tool, badCraft)); } else { m_From.SendLocalizedMessage(badCraft); } return; } int quality = 1; bool allRequiredSkills = true; m_CraftItem.CheckSkills(m_From, m_TypeRes, m_CraftSystem, ref quality, ref allRequiredSkills, false); CraftContext context = m_CraftSystem.GetContext(m_From); if (context == null) { return; } bool makersMark = false; if (quality == 2 && m_From.Skills[m_CraftSystem.MainSkill].Base >= 100.0) { makersMark = m_CraftItem.IsMarkable(m_CraftItem.ItemType); } if (makersMark && context.MarkOption == CraftMarkOption.PromptForMark) { m_From.SendGump(new QueryMakersMarkGump(quality, m_From, m_CraftItem, m_CraftSystem, m_TypeRes, m_Tool)); } else { if (context.MarkOption == CraftMarkOption.DoNotMark) { makersMark = false; } m_CraftItem.CompleteCraft(quality, makersMark, m_From, m_CraftSystem, m_TypeRes, m_Tool); } } }
protected override void OnTick() { m_Target.EndAction(typeof(NaturesTouchSpell)); }
protected override void OnTargetCancel(Mobile from, TargetCancelType cancelType) { if (from is PlayerMobile) ((PlayerMobile)from).EndPlayerAction(); else from.EndAction(typeof(IAction)); base.OnTargetCancel(from, cancelType); }
public override void OnDoubleClick( Mobile from ) { if( this.RootParent == from ) { if (this.m_updown == 3) { this.m_updown = 1; new InternalTimer( this ).Start(); } else { this.m_updown = 3; from.EndAction( typeof(FireGlasses) ); } } }
private static void ReleaseManaLock(Mobile from) { from.EndAction(typeof(BaseManaRefreshPotion)); }
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 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 OnTick() { m_From.EndAction(typeof(BaseInstrument)); }
public virtual void FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked) { from.EndAction(locked); if (!CheckHarvest(from, tool)) { return; } if (!GetHarvestDetails(from, tool, toHarvest, out int tileID, out Map map, out Point3D loc)) { OnBadHarvestTarget(from, tool, toHarvest); return; } if (!def.Validate(tileID) && !def.ValidateSpecial(tileID)) { OnBadHarvestTarget(from, tool, toHarvest); return; } if (!CheckRange(from, tool, def, map, loc, true)) { return; } if (!CheckResources(from, tool, def, map, loc, true)) { return; } 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; Type type = null; if (CheckHarvestSkill(map, loc, from, resource, def)) { 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, tool); if (item == null) { type = null; } else { int amount = def.ConsumedPerHarvest; int feluccaAmount = def.ConsumedPerFeluccaHarvest; if (item is BaseGranite) { feluccaAmount = 3; } Caddellite.OnHarvest(from, tool, this, item); //The whole harvest system is kludgy and I'm sure this is just adding to it. if (item.Stackable) { 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 && !Siege.SiegeShard; if (eligableForRacialBonus && inFelucca && bank.Current >= feluccaRacialAmount && 0.1 > Utility.RandomDouble()) { item.Amount = feluccaRacialAmount; } else if (inFelucca && bank.Current >= feluccaAmount) { item.Amount = feluccaAmount; } else if (eligableForRacialBonus && bank.Current >= racialAmount && 0.1 > Utility.RandomDouble()) { item.Amount = racialAmount; } else { item.Amount = amount; } // Void Pool Rewards item.Amount += WoodsmansTalisman.CheckHarvest(from, type, this); } if (from.AccessLevel == AccessLevel.Player) { bank.Consume(amount, from); } if (Give(from, item, def.PlaceAtFeetIfFull)) { SendSuccessTo(from, item, resource); } else { SendPackFullTo(from, item, def, resource); item.Delete(); } BonusHarvestResource bonus = def.GetBonusResource(); Item bonusItem = null; if (bonus != null && bonus.Type != null && skillBase >= bonus.ReqSkill) { if (bonus.RequiredMap == null || bonus.RequiredMap == from.Map) { bonusItem = Construct(bonus.Type, from, tool); Caddellite.OnHarvest(from, tool, this, bonusItem); if (Give(from, bonusItem, true)) //Bonuses always allow placing at feet, even if pack is full irregrdless of def { bonus.SendSuccessTo(from); } else { bonusItem.Delete(); } } } EventSink.InvokeResourceHarvestSuccess(new ResourceHarvestSuccessEventArgs(from, tool, item, bonusItem, this)); } #region High Seas OnToolUsed(from, tool, item != null); #endregion } // Siege rules will take into account axes and polearms used for lumberjacking if (tool is IUsesRemaining && (tool is BaseHarvestTool || tool is Pickaxe || tool is SturdyPickaxe || tool is GargoylesPickaxe || Siege.SiegeShard)) { 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 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 { if (item.Stackable) { Region reg = Region.Find(from.Location, from.Map); int amount = def.ConsumedPerHarvest; int feluccaAmount = def.ConsumedPerLodorHarvest; 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 inLodor = (map == Map.IslesDread); if (item is BlankScroll) { amount = Utility.RandomMinMax(amount, (int)(amount + (from.Skills[SkillName.Inscribe].Value / 10))); from.SendMessage("You find some blank scrolls."); } if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Isles of Dread" && bank.Current >= feluccaAmount) { item.Amount = feluccaAmount; } else if (reg.IsPartOf("the Mines of Morinia") && item is BaseOre && Utility.RandomMinMax(1, 3) > 1) { item.Amount = 2 * amount; } else { item.Amount = amount; } bool FindSpecialOre = false; if ((item is AgapiteOre || item is VeriteOre || item is ValoriteOre) && Utility.RandomMinMax(1, 2) == 1) { FindSpecialOre = true; } bool FindSpecialGranite = false; if ((item is AgapiteGranite || item is VeriteGranite || item is ValoriteGranite) && Utility.RandomMinMax(1, 2) == 1) { FindSpecialGranite = true; } bool FindGhostLog = false; if ((item is WalnutLog) || (item is RosewoodLog) || (item is PineLog) || (item is OakLog)) { FindGhostLog = true; } bool FindBlackLog = false; if ((item is AshLog) || (item is CherryLog) || (item is GoldenOakLog) || (item is HickoryLog) || (item is MahoganyLog)) { FindBlackLog = true; } bool FindToughLog = false; if (!(item is Log)) { FindToughLog = true; } if (Worlds.IsExploringSeaAreas(from) && item is BaseLog) { int driftWood = item.Amount; item.Delete(); item = new DriftwoodLog(driftWood); from.SendMessage("You chop some driftwood logs."); } else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Underworld" && FindSpecialOre && item is BaseOre && from.Map == Map.SavagedEmpire) { int xormiteOre = item.Amount; item.Delete(); item = new XormiteOre(xormiteOre); from.SendMessage("You dig up some xormite ore."); } else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Underworld" && FindSpecialOre && item is BaseOre) { int mithrilOre = item.Amount; item.Delete(); item = new MithrilOre(mithrilOre); from.SendMessage("You dig up some mithril ore."); } else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Serpent Island" && FindSpecialOre && item is BaseOre) { int obsidianOre = item.Amount; item.Delete(); item = new ObsidianOre(obsidianOre); from.SendMessage("You dig up some obsidian ore."); } else if (Worlds.IsExploringSeaAreas(from) && FindSpecialOre && item is BaseOre) { int nepturiteOre = item.Amount; item.Delete(); item = new NepturiteOre(nepturiteOre); from.SendMessage("You dig up some nepturite ore."); } else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Underworld" && FindSpecialGranite && item is BaseGranite && from.Map == Map.SavagedEmpire) { int xormiteGranite = item.Amount; item.Delete(); item = new XormiteGranite(xormiteGranite); from.SendMessage("You dig up xormite granite."); } else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Underworld" && FindSpecialGranite && item is BaseGranite) { int mithrilGranite = item.Amount; item.Delete(); item = new MithrilGranite(mithrilGranite); from.SendMessage("You dig up mithril granite."); } else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Serpent Island" && FindSpecialGranite && item is BaseGranite) { int obsidianGranite = item.Amount; item.Delete(); item = new ObsidianGranite(obsidianGranite); from.SendMessage("You dig up obsidian granite."); } else if (Worlds.IsExploringSeaAreas(from) && FindSpecialGranite && item is BaseGranite) { int nepturiteGranite = item.Amount; item.Delete(); item = new NepturiteGranite(nepturiteGranite); from.SendMessage("You dig up nepturite granite."); } else if (reg.IsPartOf(typeof(NecromancerRegion)) && FindBlackLog && item is BaseLog) { int blackLog = item.Amount; item.Delete(); item = new EbonyLog(blackLog); from.SendMessage("You chop some ebony logs."); } else if (reg.IsPartOf(typeof(NecromancerRegion)) && FindGhostLog && item is BaseLog) { int ghostLog = item.Amount; item.Delete(); item = new GhostLog(ghostLog); from.SendMessage("You chop some ghost logs."); } else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Underworld" && FindToughLog && item is BaseLog) { int toughLog = item.Amount; item.Delete(); item = new PetrifiedLog(toughLog); from.SendMessage("You chop some petrified logs."); } else if ((reg.IsPartOf("Shipwreck Grotto") || reg.IsPartOf("Barnacled Cavern")) && FindToughLog && item is BaseLog) { int driftWood = item.Amount; item.Delete(); item = new DriftwoodLog(driftWood); from.SendMessage("You chop some driftwood logs."); } else if ((reg.IsPartOf("Shipwreck Grotto") || reg.IsPartOf("Barnacled Cavern") || reg.IsPartOf("Savage Sea Docks") || reg.IsPartOf("Serpent Sail Docks") || reg.IsPartOf("Anchor Rock Docks") || reg.IsPartOf("Kraken Reef Docks") || reg.IsPartOf("the Forgotten Lighthouse")) && FindSpecialGranite && item is BaseGranite) { int nepturiteGranite = item.Amount; item.Delete(); item = new NepturiteGranite(nepturiteGranite); from.SendMessage("You dig up nepturite granite."); } else if ((reg.IsPartOf("Shipwreck Grotto") || reg.IsPartOf("Barnacled Cavern") || reg.IsPartOf("Savage Sea Docks") || reg.IsPartOf("Serpent Sail Docks") || reg.IsPartOf("Anchor Rock Docks") || reg.IsPartOf("Kraken Reef Docks") || reg.IsPartOf("the Forgotten Lighthouse")) && FindSpecialOre && item is BaseOre) { int nepturiteOre = item.Amount; item.Delete(); item = new NepturiteOre(nepturiteOre); from.SendMessage("You dig up some nepturite ore."); } else if (item is IronOre) { from.SendMessage("You dig up some ore."); } else if (item is DullCopperOre) { from.SendMessage("You dig up some dull copper ore."); } else if (item is ShadowIronOre) { from.SendMessage("You dig up some shadow iron ore."); } else if (item is CopperOre) { from.SendMessage("You dig up some copper ore."); } else if (item is BronzeOre) { from.SendMessage("You dig up some bronze ore."); } else if (item is GoldOre) { from.SendMessage("You dig up some golden ore."); } else if (item is AgapiteOre) { from.SendMessage("You dig up some agapite ore."); } else if (item is VeriteOre) { from.SendMessage("You dig up some verite ore."); } else if (item is ValoriteOre) { from.SendMessage("You dig up some valorite ore."); } else if (item is Granite) { from.SendMessage("You dig up granite."); } else if (item is DullCopperGranite) { from.SendMessage("You dig up dull copper granite."); } else if (item is ShadowIronGranite) { from.SendMessage("You dig up shadow iron granite."); } else if (item is CopperGranite) { from.SendMessage("You dig up copper granite."); } else if (item is BronzeGranite) { from.SendMessage("You dig up bronze granite."); } else if (item is GoldGranite) { from.SendMessage("You dig up golden granite."); } else if (item is AgapiteGranite) { from.SendMessage("You dig up agapite granite."); } else if (item is VeriteGranite) { from.SendMessage("You dig up verite granite."); } else if (item is ValoriteGranite) { from.SendMessage("You dig up valorite granite."); } else if (item is Log) { from.SendMessage("You chop some logs."); } else if (item is AshLog) { from.SendMessage("You chop some ash logs."); } else if (item is CherryLog) { from.SendMessage("You chop some cherry logs."); } else if (item is EbonyLog) { from.SendMessage("You chop some ebony logs."); } else if (item is GoldenOakLog) { from.SendMessage("You chop some golden oak logs."); } else if (item is HickoryLog) { from.SendMessage("You chop some hickory logs."); } else if (item is MahoganyLog) { from.SendMessage("You chop some mahogany logs."); } else if (item is OakLog) { from.SendMessage("You chop some oak logs."); } else if (item is PineLog) { from.SendMessage("You chop some pine logs."); } else if (item is RosewoodLog) { from.SendMessage("You chop some rosewood logs."); } else if (item is WalnutLog) { from.SendMessage("You chop some walnut logs."); } else if (item is ElvenLog) { from.SendMessage("You chop some elven logs."); } if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Savaged Empire" && from.Skills[SkillName.Mining].Value > Utility.RandomMinMax(1, 500)) { Container pack = from.Backpack; DugUpCoal coal = new DugUpCoal(Utility.RandomMinMax(1, 2)); from.AddToBackpack(coal); from.SendMessage("You dig up some coal."); } else if (Worlds.GetMyWorld(from.Map, from.Location, from.X, from.Y) == "the Island of Umber Veil" && from.Skills[SkillName.Mining].Value > Utility.RandomMinMax(1, 500)) { Container pack = from.Backpack; DugUpZinc zinc = new DugUpZinc(Utility.RandomMinMax(1, 2)); from.AddToBackpack(zinc); from.SendMessage("You dig up some zinc."); } if (tool is FishingPole && Server.Engines.Harvest.Fishing.IsNearHugeShipWreck(from) && from.Skills[SkillName.Fishing].Value >= Utility.RandomMinMax(1, 250)) { Server.Engines.Harvest.Fishing.FishUpFromMajorWreck(from); } else if (tool is FishingPole && Server.Engines.Harvest.Fishing.IsNearSpaceCrash(from) && from.Skills[SkillName.Fishing].Value >= Utility.RandomMinMax(1, 250)) { Server.Engines.Harvest.Fishing.FishUpFromSpaceship(from); } else if (tool is FishingPole && Server.Engines.Harvest.Fishing.IsNearUnderwaterRuins(from) && from.Skills[SkillName.Fishing].Value >= Utility.RandomMinMax(1, 250)) { Server.Engines.Harvest.Fishing.FishUpFromRuins(from); } } else if (item is BlueBook || item is LoreBook || item is DDRelicBook || item is MyNecromancerSpellbook || item is MySpellbook || item is MyNinjabook || item is MySamuraibook || item is MyPaladinbook || item is MySongbook || item is ArtifactManual) { from.SendMessage("You find a book."); if (item is DDRelicBook) { ((DDRelicBook)item).RelicGoldValue = ((DDRelicBook)item).RelicGoldValue + Utility.RandomMinMax(1, (int)(from.Skills[SkillName.Inscribe].Value * 2)); } else if (item is BlueBook) { item.Name = "Book"; item.Hue = Utility.RandomColor(0); item.ItemID = RandomThings.GetRandomBookItemID(); } } else if (item is SomeRandomNote || item is ScrollClue || item is LibraryScroll1 || item is LibraryScroll2 || item is LibraryScroll3 || item is LibraryScroll4 || item is LibraryScroll5 || item is LibraryScroll6 || item is DDRelicScrolls) { from.SendMessage("You find a scroll."); if (item is DDRelicScrolls) { ((DDRelicScrolls)item).RelicGoldValue = ((DDRelicScrolls)item).RelicGoldValue + Utility.RandomMinMax(1, (int)(from.Skills[SkillName.Inscribe].Value * 2)); } } 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 { item.Delete(); } } 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); }
protected override void OnTick() { m_Target.EndAction(typeof(EarthPortalSpell)); }
protected override void OnTarget(Mobile from, object targeted) { CraftContext context = m_CraftSystem.GetContext(from); if (context != null && targeted is IPlantHue) context.RequiredPlantHue = ((IPlantHue)targeted).PlantHue; else if (context != null && targeted is IPigmentHue) context.RequiredPigmentHue = ((IPigmentHue)targeted).PigmentHue; from.EndAction(typeof(CraftSystem)); m_CraftItem.Craft(from, m_CraftSystem, m_TypeRes, m_Tool); }
public static void ReleasePartyInviteLock(Mobile from) { if (from != null) { from.EndAction(typeof(XmlGroup)); } }
protected virtual void OnThrownAt(Mobile m, TEntity target) { if (m == null || m.Deleted || target == null) { return; } if (ImpactSound >= 0) { Effects.PlaySound(target.Location, target.Map, ImpactSound); } ThrownLast = DateTime.UtcNow; if (Consumable) { Consume(); } if (ThrowRecovery > TimeSpan.Zero) { if (UpdateTimer == null) { UpdateTimer = PollTimer.FromSeconds( 1.0, () => { ClearProperties(); Delta(ItemDelta.Properties); DateTime readyWhen = ThrownLast + ThrowRecovery; if (DateTime.UtcNow < readyWhen) { return; } m.EndAction(GetType()); if (UpdateTimer == null) { return; } UpdateTimer.Running = false; UpdateTimer = null; }); } else { UpdateTimer.Running = true; } } else { if (UpdateTimer != null) { UpdateTimer.Running = false; UpdateTimer = null; } ClearProperties(); Delta(ItemDelta.Properties); m.EndAction(GetType()); } }
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 { if (item.Stackable) { if (map == Map.Felucca && bank.Current >= def.ConsumedPerFeluccaHarvest) { item.Amount = def.ConsumedPerFeluccaHarvest; } else { item.Amount = def.ConsumedPerHarvest; } } bank.Consume(def, item.Amount); if (Give(from, item, def.PlaceAtFeetIfFull)) { SendSuccessTo(from, item, resource); } else { SendPackFullTo(from, item, def, resource); item.Delete(); } 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 virtual void Negate(Mobile m) { if (m == null || m.Deleted) { return; } if (m.Frozen) { m.Frozen = false; } if (m.Paralyzed) { m.Paralyzed = false; } if (m.Poisoned) { m.CurePoison(m); } if (BleedAttack.IsBleeding(m)) { BleedAttack.EndBleed(m, true); } if (MortalStrike.IsWounded(m)) { MortalStrike.EndWound(m); } PolymorphSpell.StopTimer(m); IncognitoSpell.StopTimer(m); DisguiseTimers.RemoveTimer(m); m.EndAction(typeof(PolymorphSpell)); m.EndAction(typeof(IncognitoSpell)); MeerMage.StopEffect(m, false); if (DebugMode || m.AccessLevel <= AccessLevel.Counselor) { m.RevealingAction(); m.DisruptiveAction(); } if (m.Target != null) { m.Target.Cancel(m, TargetCancelType.Overriden); } m.Spell = null; if (m.Combatant != null) { #if ServUO var c = m.Combatant as Mobile; #else var c = m.Combatant; #endif if (c != null && c.Combatant == m) { c.Combatant = null; c.Warmode = false; } m.Combatant = null; } if (m.Aggressed != null) { m.Aggressed.Clear(); } if (m.Aggressors != null) { m.Aggressors.Clear(); } m.Warmode = false; m.Criminal = false; m.Delta(MobileDelta.Noto); }
protected override void OnTarget(Mobile from, object target) { if (m_ParagonWand.Deleted || m_ParagonWand.RootParent != from) { return; } PlayerMobile player = from as PlayerMobile; if (player == null) { return; } BaseCreature bc_Target = target as BaseCreature; if (bc_Target == null) { from.SendMessage("That is not a valid creature."); return; } if (!bc_Target.AllowParagon) { from.SendMessage("That creature is not capable of becoming a paragon."); return; } if (bc_Target.IsParagon) { from.SendMessage("That creature is already a paragon."); return; } if (bc_Target.Controlled) { from.SendMessage("That creature is currently controlled."); return; } if (player.AccessLevel == AccessLevel.Player) { if (!bc_Target.Map.InLOS(from.Location, bc_Target.Location)) { from.SendMessage("You must have a valid line-of-sight to the creature you wish to target."); return; } if (bc_Target.Combatant != null) { from.SendMessage("You may not target creatures currently engaged in combat."); return; } if (bc_Target.Hits < bc_Target.HitsMax) { from.SendMessage("You may not target creatures that are currently injured."); return; } /* * if (bc_Target.CreationTime + SpawnCooldown >= DateTime.UtcNow) * { * string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, bc_Target.CreationTime + SpawnCooldown, false, false, true, true, true); * * from.SendMessage("That has spawned too recently to be converted. You must wait another + " + timeRemaining + "."); * return; * } */ if (bc_Target.LastCombatTime + CombatCooldown >= DateTime.UtcNow) { string timeRemaining = Utility.CreateTimeRemainingString(DateTime.UtcNow, bc_Target.LastCombatTime + CombatCooldown, false, false, true, true, true); from.SendMessage("That has been in combat too recently. You must wait another " + timeRemaining + "."); return; } if (!from.CanBeginAction(typeof(ParagonWand))) { from.SendMessage("You may only use a single paragon wand per hour."); return; } } bool targetValid = true; IPooledEnumerable mobilesNearby = bc_Target.Map.GetMobilesInRange(bc_Target.Location, 12); if (player.AccessLevel == AccessLevel.Player) { foreach (Mobile mobile in mobilesNearby) { if (mobile.Combatant == bc_Target) { targetValid = false; from.SendMessage("That creature is currently being engaged in combat by someone."); break; } BaseCreature nearbyCreature = mobile as BaseCreature; PlayerMobile nearbyPlayer = mobile as PlayerMobile; if (mobile != from) { if (nearbyCreature != null) { if (nearbyCreature.Controlled && nearbyCreature.ControlMaster is PlayerMobile && nearbyCreature.ControlMaster != from) { targetValid = false; from.SendMessage("That target is too near another player's follower."); break; } } if (nearbyPlayer != null) { targetValid = false; from.SendMessage("That target is too near another player."); break; } } } } mobilesNearby.Free(); if (targetValid) { bc_Target.PlaySound(0x652); Effects.SendLocationEffect(bc_Target.Location, bc_Target.Map, 0x3967, 30, 15, 2586, 0); bc_Target.IsParagon = true; bc_Target.ConvertedParagon = true; from.SendMessage("You transform the creature into a mighty paragon."); m_ParagonWand.m_Charges--; if (from.AccessLevel == AccessLevel.Player) { from.BeginAction(typeof(ParagonDevolveWand)); Timer.DelayCall(ParagonDevolveWand.UsageCooldown, delegate { if (from != null) { from.EndAction(typeof(ParagonDevolveWand)); } }); } if (m_ParagonWand.m_Charges == 0) { m_ParagonWand.Delete(); } } }
protected override void OnTick() { m_From.EndAction(typeof(SnowPile)); }
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 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 ReleaseLock_Callback(Mobile m) { m.EndAction(this); }
public override void OnResponse(GameClient sender, RelayInfo info) { Mobile from = sender.Mobile; switch (info.ButtonID) { default: case 0: // Cancel { from.EndAction(typeof(Imbuing)); break; } case 1: // Imbue Item { from.SendLocalizedMessage(1079589); // Target an item you wish to imbue. from.Target = new ImbueTarget(); from.Target.BeginTimeout(from, TimeSpan.FromSeconds(10.0)); break; } case 2: // Unravel Item { from.SendLocalizedMessage(1080422); // Target an item you wish to magically unravel. from.Target = new UnravelTarget(); from.Target.BeginTimeout(from, TimeSpan.FromSeconds(10.0)); break; } case 3: // Imbue Last Item { Item item = ImbuingContext.GetLastItem(from); if (item == null) { from.SendLocalizedMessage(1113572); // You haven't imbued anything yet! from.EndAction(typeof(Imbuing)); } else if (Imbuing.Check(from, item)) { from.SendGump(new SelectPropGump(item)); } break; } case 4: // Reimbue Last { ImbuingContext context = ImbuingContext.GetContext(from); if (context == null) { from.SendLocalizedMessage(1113572); // You haven't imbued anything yet! from.EndAction(typeof(Imbuing)); } else { ConfirmationGump confirm = SelectPropGump.SelectProp(from, context.Item, context.Property); if (confirm != null) { confirm.ChangeIntensity(from, context.Intensity); confirm.OnResponse(sender, new RelayInfo(302, new int[0], new TextRelay[0])); } } break; } case 5: // Imbue Last Property { BaseAttrInfo attribute = ImbuingContext.GetLastProperty(from); if (attribute == null) { from.SendLocalizedMessage(1113572); // You haven't imbued anything yet! from.EndAction(typeof(Imbuing)); } else { from.SendLocalizedMessage(1079589); // Target an item you wish to imbue. from.Target = new ImbueLastPropTarget(attribute); from.Target.BeginTimeout(from, TimeSpan.FromSeconds(10.0)); } break; } case 6: // Unravel Container { from.SendLocalizedMessage(1080422); // Target an item you wish to magically unravel. from.Target = new UnravelContainerTarget(); from.Target.BeginTimeout(from, TimeSpan.FromSeconds(10.0)); break; } } }
private static void EndGolemRepair(Mobile from) { from.EndAction(typeof(Golem)); }
public override void FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked) { //Lava fishing needs to have its own set of rules. if (IsLavaHarvest(tool, toHarvest)) { 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) && !def.ValidateSpecial(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; } HarvestBank bank = def.GetBank(map, loc.X, loc.Y); if (bank == null) { return; } HarvestVein vein = bank.Vein; if (vein == null) { return; } Type type = null; HarvestResource resource = MutateResource(from, tool, def, map, loc, vein, vein.PrimaryResource, vein.FallbackResource); if (from.CheckSkill(def.Skill, resource.MinSkill, resource.MaxSkill)) { //Special eye candy item type = GetSpecialLavaItem(from, tool, map, loc, toHarvest); //Special fish if (type == null) { type = FishInfo.GetSpecialItem(from, tool, loc, IsLavaHarvest(tool, tileID)); } if (type != null) { Item item = Construct(type, from, tool); if (item == null) { type = null; } else { if (from.AccessLevel == AccessLevel.Player) { bank.Consume(Convert.ToInt32(map != null && map.Rules == MapRules.FeluccaRules ? Math.Ceiling(item.Amount / 2.0) : item.Amount), from); } if (Give(from, item, true)) { SendSuccessTo(from, item, null); } else { SendPackFullTo(from, item, def, null); item.Delete(); } } } } if (type == null) { def.SendMessageTo(from, def.FailMessage); double skill = (double)from.Skills[SkillName.Fishing].Value / 50; if (0.5 / skill > Utility.RandomDouble()) { OnToolUsed(from, tool, false); } } else { OnToolUsed(from, tool, true); } OnHarvestFinished(from, tool, def, vein, bank, null, null); } else { base.FinishHarvesting(from, tool, def, toHarvest, locked); } }
public virtual void ReleaseWandLock_Callback( Mobile from ) { from.EndAction( typeof( BaseWand ) ); }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; ImbuingContext context = Imbuing.GetContext(from); m_Item = context.LastImbued; switch (info.ButtonID) { case 0: // Close/Cancel case 1: { from.EndAction(typeof(Imbuing)); break; } case 10001: { context.ImbMenu_Cat = 1; from.SendGump(new ImbuingGumpB(from, context.LastImbued)); break; } case 10002: { context.ImbMenu_Cat = 2; from.SendGump(new ImbuingGumpB(from, context.LastImbued)); break; } case 10003: { context.ImbMenu_Cat = 3; from.SendGump(new ImbuingGumpB(from, context.LastImbued)); break; } case 10004: { context.ImbMenu_Cat = 4; from.SendGump(new ImbuingGumpB(from, context.LastImbued)); break; } case 10005: { context.ImbMenu_Cat = 5; from.SendGump(new ImbuingGumpB(from, context.LastImbued)); break; } case 10006: { context.ImbMenu_Cat = 6; from.SendGump(new ImbuingGumpB(from, context.LastImbued)); break; } case 10007: { context.ImbMenu_Cat = 7; from.SendGump(new ImbuingGumpB(from, context.LastImbued)); break; } case 10008: { context.ImbMenu_Cat = 8; from.SendGump(new ImbuingGumpB(from, context.LastImbued)); break; } case 10009: { context.ImbMenu_Cat = 9; from.SendGump(new ImbuingGumpB(from, context.LastImbued)); break; } case 10010: { context.ImbMenu_Cat = 10; from.SendGump(new ImbuingGumpB(from, context.LastImbued)); break; } case 10011: { context.ImbMenu_Cat = 11; from.SendGump(new ImbuingGumpB(from, context.LastImbued)); break; } case 10012: { context.ImbMenu_Cat = 12; from.SendGump(new ImbuingGumpB(from, context.LastImbued)); break; } case 10013: { context.ImbMenu_Cat = 13; from.SendGump(new ImbuingGumpB(from, context.LastImbued)); break; } case 10014: { context.ImbMenu_Cat = 14; from.SendGump(new ImbuingGumpB(from, context.LastImbued)); break; } case 10015: { context.ImbMenu_Cat = 15; from.SendGump(new ImbuingGumpB(from, context.LastImbued)); break; } default: // = Proceed to Attribute Intensity Menu [ImbuingC.cs] { int buttonNum = info.ButtonID - 10100; context.Imbue_Mod = buttonNum; if (Imbuing.OnBeforeImbue(from, context.LastImbued, buttonNum, -1)) { from.SendGump(new ImbuingGumpC(from, context.LastImbued, buttonNum, -1)); } break; } } }
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 (Recipe == null || !(from is PlayerMobile) || ((PlayerMobile)from).HasRecipe(Recipe)) { if (!RequiresBasketWeaving || (from is PlayerMobile && ((PlayerMobile)from).BasketWeaving)) { if (!RequiresMechanicalLife || (from is PlayerMobile && ((PlayerMobile)from).MechanicalLife)) { int badCraft = craftSystem.CanCraft(from, tool, m_Type); if (badCraft <= 0) { if (RequiresResTarget && NeedsResTarget(from, craftSystem)) { from.Target = new ChooseResTarget(from, this, craftSystem, typeRes, tool); from.SendMessage("Choose the resource you would like to use."); return; } 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(); return; } 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, 1113034)); // You haven't read the Mechanical Life Manual. Talking to Sutek might help! } } else { from.EndAction(typeof(CraftSystem)); from.SendGump(new CraftGump(from, craftSystem, tool, 1112253)); // You haven't learned basket weaving. Perhaps studying a book would help! } } 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 } AutoCraftTimer.EndTimer(from); }
protected override void OnTargetCancel(Mobile m, TargetCancelType cancelType) { m.EndAction(typeof(Imbuing)); }
protected override void OnTargetCancel(Mobile from, Server.Targeting.TargetCancelType cancelType) { from.EndAction(typeof(CraftSystem)); from.SendGump(new CraftGump(from, m_CraftSystem, m_Tool, null)); }
public virtual bool OnHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked, bool last) { if (!this.CheckHarvest(from, tool)) { from.EndAction(locked); return false; } int tileID; Map map; Point3D loc; if (!this.GetHarvestDetails(from, tool, toHarvest, out tileID, out map, out loc)) { from.EndAction(locked); this.OnBadHarvestTarget(from, tool, toHarvest); return false; } else if (!def.Validate(tileID)) { from.EndAction(locked); this.OnBadHarvestTarget(from, tool, toHarvest); return false; } else if (!this.CheckRange(from, tool, def, map, loc, true)) { from.EndAction(locked); return false; } else if (!this.CheckResources(from, tool, def, map, loc, true)) { from.EndAction(locked); return false; } else if (!this.CheckHarvest(from, tool, def, toHarvest)) { from.EndAction(locked); return false; } this.DoHarvestingEffect(from, tool, def, map, loc); new HarvestSoundTimer(from, tool, this, def, toHarvest, locked, last).Start(); return !last; }
// THIS CALLBACK IS USED FOR ADDPARTYMEMBERSTOGROUP calls public static void JoinGroupCallback(Mobile from, bool okay, object state) { if (from == null || from.Deleted || state == null || !(state is object[])) { return; } try { var states = (object[])state; Mobile captain = (Mobile)states[0]; XmlGroup group = (XmlGroup)states[1]; string eventName = (string)states[2]; if (okay) { if (ADDTOGROUP(null, from, eventName, group)) { captain.SendMessage(0x38, "{0} has joined your group for {1}.", from.RawName, eventName); from.SendMessage(0x38, "You have joined " + captain.RawName + "'s group for " + eventName + "."); } else { if (group.Members.Count == group.MaxMembers) { captain.SendMessage( 0x38, "{0} cannot join your group because you already have the maximum {1} members in your group for {2}.", from.RawName, group.MaxMembers, eventName); from.SendMessage( 38, "You cannot join " + captain.RawName + "'s group because it already has the maximum number of team members allowed for this event."); } else { captain.SendMessage( 0x38, "{0} cannot join your group because they are already in a group for {1}.", from.RawName, eventName); from.SendMessage( 38, "You cannot join " + captain.RawName + "'s group because you are already in another group for this event (possibly on another character)."); } } } else { captain.SendMessage(38, "{0} has rejected your offer to join your group for {1}.", from.RawName, eventName); from.SendMessage(0x38, "You have rejected " + captain.RawName + "'s invitation."); } } catch { } from.EndAction(typeof(XmlGroup)); }
protected override void OnTargetFinish(Mobile from) { if (from is PlayerMobile) ((PlayerMobile)from).EndPlayerAction(); else from.EndAction(typeof(IAction)); if (m_SetSkillTime) from.NextSkillTime = DateTime.Now; }
public virtual void FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked) { from.EndAction(locked); if (!this.CheckHarvest(from, tool)) return; int tileID; Map map; Point3D loc; if (!this.GetHarvestDetails(from, tool, toHarvest, out tileID, out map, out loc)) { this.OnBadHarvestTarget(from, tool, toHarvest); return; } else if (!def.Validate(tileID)) { this.OnBadHarvestTarget(from, tool, toHarvest); return; } if (!this.CheckRange(from, tool, def, map, loc, true)) return; else if (!this.CheckResources(from, tool, def, map, loc, true)) return; else if (!this.CheckHarvest(from, tool, def, toHarvest)) return; if (this.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 = this.MutateVein(from, tool, def, bank, toHarvest, vein); if (vein == null) return; HarvestResource primary = vein.PrimaryResource; HarvestResource fallback = vein.FallbackResource; HarvestResource resource = this.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 = this.GetResourceType(from, tool, def, map, loc, resource); if (type != null) type = this.MutateType(type, from, tool, def, map, loc, resource); if (type != null) { Item item = this.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 && 0.1 > Utility.RandomDouble()) item.Amount = feluccaRacialAmount; else if (inFelucca && bank.Current >= feluccaAmount) item.Amount = feluccaAmount; else if (eligableForRacialBonus && bank.Current >= racialAmount && 0.1 > Utility.RandomDouble()) item.Amount = racialAmount; else item.Amount = amount; } bank.Consume(item.Amount, from); if (this.Give(from, item, def.PlaceAtFeetIfFull)) { this.SendSuccessTo(from, item, resource); } else { this.SendPackFullTo(from, item, def, resource); item.Delete(); } BonusHarvestResource bonus = def.GetBonusResource(); if (bonus != null && bonus.Type != null && skillBase >= bonus.ReqSkill) { Item bonusItem = this.Construct(bonus.Type, from); if (this.Give(from, bonusItem, true)) //Bonuses always allow placing at feet, even if pack is full irregrdless of def { bonus.SendSuccessTo(from); } else { item.Delete(); } } 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); this.OnHarvestFinished(from, tool, def, vein, bank, resource, toHarvest); }
public void Interact(Mobile from, InteractionType interactionType) { if (from == null) { return; } if (!from.CanBeginAction(typeof(BreakableStatic))) { from.SendMessage("You must wait a few moments before attempting to use that again."); return; } from.RevealingAction(); BeforeInteract(from, interactionType); double usageDelay = 0; BaseWeapon weapon = from.Weapon as BaseWeapon; switch (interactionType) { case InteractionType.None: from.SendMessage("You cannot interact with that in that manner."); return; break; case InteractionType.Normal: usageDelay = InteractionDelay; break; case InteractionType.Weapon: weapon = from.Weapon as BaseWeapon; if (weapon != null) { usageDelay = weapon.GetDelay(from, false).TotalSeconds; } break; case InteractionType.Lockpick: usageDelay = InteractionDelay; break; case InteractionType.Mining: usageDelay = InteractionDelay; break; case InteractionType.Lumberjacking: usageDelay = InteractionDelay; break; } from.BeginAction(typeof(BreakableStatic)); Timer.DelayCall(TimeSpan.FromSeconds(usageDelay), delegate { if (from != null) { from.EndAction(typeof(BreakableStatic)); } }); int damage = 0; double randomScalar = (double)(Utility.RandomMinMax(75, 125)) / 100; Direction direction; switch (interactionType) { case InteractionType.None: return; break; case InteractionType.Normal: damage = (int)(Math.Round((double)(Utility.RandomMinMax(m_MinInteractDamage, m_MaxInteractDamage)) * InteractDamageScalar)); direction = from.GetDirectionTo(Location); if (direction != from.Direction) { from.Direction = direction; } Timer.DelayCall(TimeSpan.FromSeconds(.25), delegate { if (from == null) { return; } if (!from.Alive) { return; } from.Animate(12, 5, 1, true, false, 0); from.RevealingAction(); Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (from == null) { return; } if (!from.Alive) { return; } Effects.PlaySound(from.Location, from.Map, m_HitSound); }); }); break; case InteractionType.Weapon: weapon = from.Weapon as BaseWeapon; if (weapon != null && !(weapon is Fists)) { int minDamage = weapon.MinDamage; int maxDamage = weapon.MaxDamage; if (weapon is Pickaxe || weapon is Hatchet) { minDamage = 10; maxDamage = 20; } if (minDamage < m_MinInteractDamage) { minDamage = m_MinInteractDamage; } if (maxDamage < m_MaxInteractDamage) { maxDamage = m_MaxInteractDamage; } damage = (int)(Math.Round((double)(Utility.RandomMinMax(weapon.MinDamage, weapon.MaxDamage)) * WeaponDamageScalar)); } direction = from.GetDirectionTo(Location); if (direction != from.Direction) { from.Direction = direction; } Timer.DelayCall(TimeSpan.FromSeconds(.25), delegate { if (from == null) { return; } if (!from.Alive) { return; } from.Animate(12, 5, 1, true, false, 0); from.RevealingAction(); Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (from == null) { return; } if (!from.Alive) { return; } Effects.PlaySound(from.Location, from.Map, m_HitSound); }); }); break; case InteractionType.Lockpick: damage = (int)(Math.Round(from.Skills.Lockpicking.Value * LockpickDamageScalar * randomScalar)); if (damage < 20) { damage = 20; } direction = from.GetDirectionTo(Location); if (direction != from.Direction) { from.Direction = direction; } Timer.DelayCall(TimeSpan.FromSeconds(.25), delegate { if (from == null) { return; } if (!from.Alive) { return; } from.Animate(32, 5, 1, true, false, 0); from.RevealingAction(); Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (from == null) { return; } if (!from.Alive) { return; } Effects.PlaySound(from.Location, from.Map, 0x241); }); }); break; case InteractionType.Mining: weapon = from.Weapon as BaseWeapon; if (weapon != null && weapon is Pickaxe) { damage = (int)(Math.Round(from.Skills.Mining.Value * MiningDamageScalar * randomScalar)); if (damage < 20) { damage = 20; } } direction = from.GetDirectionTo(Location); if (direction != from.Direction) { from.Direction = direction; } Timer.DelayCall(TimeSpan.FromSeconds(.25), delegate { if (from == null) { return; } if (!from.Alive) { return; } from.Animate(Utility.RandomList(11, 12), 5, 1, true, false, 0); from.RevealingAction(); Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (from == null) { return; } if (!from.Alive) { return; } Effects.PlaySound(from.Location, from.Map, m_HitSound); }); }); break; case InteractionType.Lumberjacking: weapon = from.Weapon as BaseWeapon; if (weapon != null && (weapon is BaseAxe)) { damage = (int)(Math.Round(from.Skills.Lumberjacking.Value * LumberjackingDamageScalar * randomScalar)); if (damage < 20) { damage = 20; } } direction = from.GetDirectionTo(Location); if (direction != from.Direction) { from.Direction = direction; } Timer.DelayCall(TimeSpan.FromSeconds(.25), delegate { if (from == null) { return; } if (!from.Alive) { return; } from.Animate(12, 5, 1, true, false, 0); from.RevealingAction(); Timer.DelayCall(TimeSpan.FromSeconds(.5), delegate { if (from == null) { return; } if (!from.Alive) { return; } Effects.PlaySound(from.Location, from.Map, m_HitSound); }); }); break; } if (damage < 1) { damage = 1; } ReceiveDamage(from, damage, interactionType); AfterInteract(from, interactionType); }
protected override void OnThrownAt(Mobile m, IEntity target) { if (m == null || m.Deleted || target == null) { return; } if (ImpactSound >= 0) { Effects.PlaySound(target.Location, target.Map, ImpactSound); } ThrownLast = DateTime.UtcNow; LastUsed = DateTime.UtcNow + ThrowRecovery; if (target is BaseCreature) { var creature = target as BaseCreature; if (creature.Alive) { m.DoHarmful(creature); creature.Damage(Utility.RandomMinMax(5, 20), m); } int range = 1; int zOffset = 10; Point3D src = target.Location.Clone3D(0, 0, zOffset); var points = src.GetAllPointsInRange(target.Map, range, range); Effects.PlaySound(target.Location, target.Map, 0x19C); Timer.DelayCall( TimeSpan.FromMilliseconds(100), () => { foreach (Point3D trg in points) { int bloodID = Utility.RandomMinMax(4650, 4655); new MovingEffectInfo(src, trg.Clone3D(0, 0, 2), target.Map, bloodID).MovingImpact( info => { var blood = new Blood { ItemID = bloodID }; blood.MoveToWorld(info.Target.Location, info.Map); Effects.PlaySound(info.Target, info.Map, 0x028); }); } }); } if (ThrowRecovery > TimeSpan.Zero) { if (UpdateTimer == null) { UpdateTimer = PollTimer.FromSeconds( 1.0, () => { ClearProperties(); Delta(ItemDelta.Properties); DateTime readyWhen = ThrownLast + ThrowRecovery; if (DateTime.UtcNow < readyWhen) { return; } m.EndAction(GetType()); if (UpdateTimer == null) { return; } UpdateTimer.Running = false; UpdateTimer = null; }); } else { UpdateTimer.Running = true; } } else { if (UpdateTimer != null) { UpdateTimer.Running = false; UpdateTimer = null; } ClearProperties(); Delta(ItemDelta.Properties); m.EndAction(GetType()); } }
private static void EndAction(Mobile m) { m?.EndAction <FireHorn>(); m?.SendLocalizedMessage(1049621); // You catch your breath. }
public override void Drink( Mobile from ) { if (Core.AOS && (from.Paralyzed || from.Frozen || (from.Spell != null && from.Spell.IsCasting))) { from.SendLocalizedMessage(1062725); // You can not use a purple potion while paralyzed. return; } if (from.BeginAction(typeof(BaseExplosionPotion))) { from.EndAction(typeof(BaseExplosionPotion)); //Timer should start when targeting ThrowTarget targ = from.Target as ThrowTarget; Stackable = false; // Scavenged explosion potions won't stack with those ones in backpack, and still will explode. if (targ != null && targ.Potion == this) return; from.RevealingAction(); if (m_Users == null) m_Users = new ArrayList(); if (!m_Users.Contains(from)) m_Users.Add(from); from.Target = new ThrowTarget(this); if (m_Timer == null) { from.SendLocalizedMessage(500236); // You should throw it now! //if (Core.ML) // m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(1.0), TimeSpan.FromSeconds(1.25), 5, new TimerStateCallback(Detonate_OnTick), new object[] {from, 3}); // 3.6 seconds explosion delay //else m_Timer = Timer.DelayCall(TimeSpan.FromSeconds(0.75), TimeSpan.FromSeconds(1.0), 4, new TimerStateCallback(Detonate_OnTick), new object[] {from, 3}); // 2.6 seconds explosion delay } } else from.SendAsciiMessage("You can't use another explosion potion yet!"); }
public static TimeSpan OnUse(Mobile mobile) { PlayerMobile pm = mobile as PlayerMobile; if (pm != null) { if (pm.TrueHidden == false) { pm.SendMessage("You must hide first using the Hiding skill."); pm.RevealingAction(); return(TimeSpan.FromSeconds(SkillCooldown.StealthCooldown)); } } if (!mobile.Hidden) { mobile.SendLocalizedMessage(502725); // You must hide first } else if (mobile.Skills[SkillName.Hiding].Base < HidingRequirement) { mobile.SendLocalizedMessage(502726); // You are not hidden well enough. Become better at hiding. mobile.RevealingAction(); } else if (!mobile.CanBeginAction(typeof(Stealth))) { mobile.RevealingAction(); } else { if (mobile.CheckSkill(SkillName.Stealth, 0, 100, 1.0)) { int steps = (int)(mobile.Skills[SkillName.Stealth].Value / 10); BaseArmor gorget = mobile.NeckArmor as BaseArmor; BaseArmor gloves = mobile.HandArmor as BaseArmor; BaseArmor arms = mobile.ArmsArmor as BaseArmor; BaseArmor head = mobile.HeadArmor as BaseArmor; BaseArmor legs = mobile.LegsArmor as BaseArmor; BaseArmor chest = mobile.ChestArmor as BaseArmor; List <BaseArmor> equipment = new List <BaseArmor>(); equipment.Add(gorget); equipment.Add(gloves); equipment.Add(arms); equipment.Add(head); equipment.Add(legs); equipment.Add(chest); //Each Piece of Armor that Has a Meditation Penalty Reduces Total Stealth Steps By 1 foreach (BaseArmor armor in equipment) { if (armor != null) { if (armor.OldMedAllowance == ArmorMeditationAllowance.None) { steps--; } } } DungeonArmor.PlayerDungeonArmorProfile stealtherDungeonArmor = new DungeonArmor.PlayerDungeonArmorProfile(mobile, null); if (stealtherDungeonArmor.MatchingSet && !stealtherDungeonArmor.InPlayerCombat) { steps += 6 + stealtherDungeonArmor.DungeonArmorDetail.BonusStealthSteps; } if (steps < 1) { steps = 1; } mobile.AllowedStealthSteps = steps; if (pm != null) { pm.IsStealthing = true; if (pm.Skills[SkillName.Hiding].Value >= 80 && pm.Skills[SkillName.Stealth].Value >= 80) { mobile.StealthAttackReady = true; } } mobile.SendMessage("You begin to move quietly."); mobile.BeginAction((typeof(Hiding))); Timer.DelayCall(TimeSpan.FromSeconds(SkillCooldown.StealthCooldown - .1), delegate { mobile.EndAction(typeof(Hiding)); }); mobile.BeginAction((typeof(Stealth))); Timer.DelayCall(TimeSpan.FromSeconds(SkillCooldown.StealthCooldown - .1), delegate { mobile.EndAction(typeof(Stealth)); }); mobile.m_StealthMovementTimer = null; mobile.m_StealthMovementTimer = new Mobile.StealthMovementTimer(mobile); mobile.m_StealthMovementTimer.Start(); mobile.m_HidingTimer = null; mobile.m_HidingTimer = new Mobile.HidingTimer(mobile, DateTime.UtcNow, true); mobile.m_HidingTimer.Start(); return(TimeSpan.FromSeconds(SkillCooldown.StealthCooldown)); } else { mobile.SendLocalizedMessage(502731); // You fail in your attempt to move unnoticed. mobile.RevealingAction(); } } return(TimeSpan.FromSeconds(SkillCooldown.StealthCooldown)); }
public override void FinishHarvesting(Mobile from, Item tool, HarvestDefinition def, object toHarvest, object locked) { //Lava fishing needs to have its own set of rules. if (IsLavaHarvest(tool, toHarvest)) { 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) && !def.ValidateSpecial(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; HarvestBank bank = def.GetBank(map, loc.X, loc.Y); if (bank == null) return; HarvestVein vein = bank.Vein; if (vein == null) return; Type type = null; HarvestResource resource = MutateResource(from, tool, def, map, loc, vein, vein.PrimaryResource, vein.FallbackResource); if (from.CheckSkill(def.Skill, resource.MinSkill, resource.MaxSkill)) { //Special eye candy item type = GetSpecialLavaItem(from, tool, map, loc, toHarvest); //Special fish if (type == null) type = FishInfo.GetSpecialItem(from, tool, loc, IsLavaHarvest(tool, tileID)); if (type != null) { Item item = Construct(type, from, tool); if (item == null) { type = null; } else { if (from.AccessLevel == AccessLevel.Player) bank.Consume(Convert.ToInt32(map != null && map.Rules == MapRules.FeluccaRules ? Math.Ceiling(item.Amount / 2.0) : item.Amount), from); if (Give(from, item, true)) { SendSuccessTo(from, item, null); } else { SendPackFullTo(from, item, def, null); item.Delete(); } } } } if (type == null) { def.SendMessageTo(from, def.FailMessage); double skill = (double)from.Skills[SkillName.Fishing].Value / 50; if (0.5 / skill > Utility.RandomDouble()) OnToolUsed(from, tool, false); } else OnToolUsed(from, tool, true); OnHarvestFinished(from, tool, def, vein, bank, null, null); } else base.FinishHarvesting(from, tool, def, toHarvest, locked); }
protected override void OnTick() { m_From.EndAction(typeof(PumpkinheadSummoner)); }
protected override void OnTarget( Mobile from, object o ) { int itemID = 0; if (o is LandTarget) { if (from.Map == Map.Malas || from.Map == Map.Ilshenar) { from.PrivateOverheadMessage( MessageType.Regular, 0x2B2, true, "No solen lairs exist on this facet. Try again in Trammel or Felucca.", from.NetState); return; } Point3D p = new Point3D( o as IPoint3D ); itemID = from.Map.Tiles.GetLandTile( ((LandTarget)o).X, ((LandTarget)o).Y ).ID & 0x3FFF; bool goodspot = false; int effect = 0; for ( int i = 0; i < m_DirtIDs.Length; i += 2 ) { if ( itemID >= m_DirtIDs[i] && itemID <= m_DirtIDs[i + 1] ) { goodspot = true; effect = 1; } } for ( int i = 0; i < m_SwampIDs.Length; i += 2 ) { if ( itemID >= m_SwampIDs[i] && itemID <= m_SwampIDs[i + 1] ) { goodspot = true; effect = 2; } } for ( int i = 0; i < m_SandIDs.Length; i += 2 ) { if ( itemID >= m_SandIDs[i] && itemID <= m_SandIDs[i + 1] ) { goodspot = true; effect = 3; } } for ( int i = 0; i < m_SnowIDs.Length; i += 2 ) { if ( itemID >= m_SnowIDs[i] && itemID <= m_SnowIDs[i + 1] ) { goodspot = true; effect = 4; } } for ( int i = 0; i < m_FurrowsIDs.Length; i += 2 ) { if ( itemID >= m_FurrowsIDs[i] && itemID <= m_FurrowsIDs[i + 1] ) { goodspot = true; effect = 5; } } if ( goodspot ) { m_GreenThorn.Consume(); from.LocalOverheadMessage( MessageType.Emote, 0x2B2, 1061914 ); // * You push the strange green thorn into the ground * from.NonlocalOverheadMessage( MessageType.Emote, 0x2B2, 1061915, from.Name ); // * ~1_PLAYER_NAME~ pushes a strange green thorn into the ground. * from.PlaySound(0x106); Effects.SendLocationParticles( EffectItem.Create( p, from.Map, EffectItem.DefaultDuration ), 0x3735, 1, 182, 0xBE3 ); new ThornEffectTimer( from, p, effect ).Start(); new DelayTimer(from).Start(); } else { from.SendLocalizedMessage( 1061913 ); // * You sense it would be useless to plant a green thorn there. * from.EndAction( typeof( GreenThorn ) ); } } else { from.SendLocalizedMessage( 1061912 ); // * You cannot plant a green thorn there! * from.EndAction( typeof( GreenThorn ) ); } }
private void EndLock(Mobile m) { m.EndAction(this); }
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 && 0.1 > Utility.RandomDouble()) { item.Amount = feluccaRacialAmount; } else if (inFelucca && bank.Current >= feluccaAmount) { item.Amount = feluccaAmount; } else if (eligableForRacialBonus && bank.Current >= racialAmount && 0.1 > Utility.RandomDouble()) { 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 { item.Delete(); } } if (tool is IUsesRemaining) { IUsesRemaining toolWithUses = (IUsesRemaining)tool; toolWithUses.ShowUsesRemaining = true; if (toolWithUses.UsesRemaining > 0) { --toolWithUses.UsesRemaining; } if (toolWithUses.UsesRemaining < 1) { #region Mondain's Legacy if (!(tool is JacobsPickaxe)) { tool.Delete(); def.SendMessageTo(from, def.ToolBrokeMessage); } #endregion } } } } } if (type == null) { def.SendMessageTo(from, def.FailMessage); } OnHarvestFinished(from, tool, def, vein, bank, resource, toHarvest); }
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 (Recipe == null || !(from is PlayerMobile) || ((PlayerMobile)from).HasRecipe(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(); return; } 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 } AutoCraftTimer.EndTimer(from); }
protected override void OnTick() { m_From.EndAction(typeof(GreenThorns)); }
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 static bool OnHarvest(Mobile m, Item tool) { if (!(m is PlayerMobile) || m.Map != Map.TerMur) { return(false); } PlayerMobile pm = m as PlayerMobile; if ((pm.ToggleMiningStone || pm.ToggleStoneOnly) && VolcanoMineBounds.Contains(m.Location)) { object locked = tool; if (!m.BeginAction(locked)) { return(false); } m.Animate(AnimationType.Attack, 3); Timer.DelayCall(Mining.System.OreAndStone.EffectSoundDelay, () => { m.PlaySound(Utility.RandomList(Mining.System.OreAndStone.EffectSounds)); }); Timer.DelayCall(Mining.System.OreAndStone.EffectDelay, () => { TheGreatVolcanoQuest quest = QuestHelper.GetQuest(pm, typeof(TheGreatVolcanoQuest)) as TheGreatVolcanoQuest; if (quest != null && !quest.Completed && 0.05 > Utility.RandomDouble()) { if (m.CheckSkill(SkillName.Mining, 90, 100)) { double chance = Utility.RandomDouble(); if (0.08 > chance) { BaseCreature spawn = new VolcanoElemental(); Point3D p = m.Location; for (int i = 0; i < 10; i++) { int x = Utility.RandomMinMax(p.X - 1, p.X + 1); int y = Utility.RandomMinMax(p.Y - 1, p.Y + 1); int z = Map.TerMur.GetAverageZ(x, y); if (Map.TerMur.CanSpawnMobile(x, y, z)) { p = new Point3D(x, y, z); break; } } spawn.OnBeforeSpawn(p, Map.TerMur); spawn.MoveToWorld(p, Map.TerMur); spawn.OnAfterSpawn(); spawn.Combatant = m; m.SendLocalizedMessage(1156508); // Uh oh...that doesn't look like a lava rock! } else if (0.55 > chance) { m.PrivateOverheadMessage(MessageType.Regular, 1154, 1156507, m.NetState); // *You uncover a lava rock and carefully store it for later!* quest.Update(m); } else { m.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1156509); // You loosen some dirt but fail to find anything. } } else { m.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1156509); // You loosen some dirt but fail to find anything. } } else { m.LocalOverheadMessage(MessageType.Regular, 0x3B2, 1156509); // You loosen some dirt but fail to find anything. } if (tool is IUsesRemaining) { ((IUsesRemaining)tool).UsesRemaining--; if (((IUsesRemaining)tool).UsesRemaining <= 0) { m.SendLocalizedMessage(1044038); // You have worn out your tool! tool.Delete(); } } m.EndAction(locked); }); return(true); } return(false); }
public virtual void ReleaseWandLock_Callback(Mobile state) { state.EndAction(typeof(BaseWand)); }
protected override void OnTick() { m_Mobile.EndAction(typeof(Fists)); }