public override void OnResponse(NetState sender, RelayInfo info) { int entryID = info.ButtonID - 1; if (entryID < 0 || entryID >= m_Entries.Length) { return; } int mana = m_Spell.ScaleMana(m_Spell.RequiredMana); AnimalFormEntry entry = AnimalForm.Entries[entryID]; if (mana > m_Caster.Mana) { m_Caster.SendLocalizedMessage(1060174, mana.ToString()); // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability. } else if (BaseFormTalisman.EntryEnabled(sender.Mobile, entry.Type)) { if (AnimalForm.Morph(m_Caster, entryID) == MorphResult.Fail) { m_Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 502632); // The spell fizzles. m_Caster.FixedParticles(0x3735, 1, 30, 9503, EffectLayer.Waist); m_Caster.PlaySound(0x5C); } else { m_Caster.Mana -= mana; } } }
public override void OnResponse(NetState sender, RelayInfo info) { int entryID = info.ButtonID - 1; if (entryID < 0 || entryID >= m_Entries.Length) { return; } int mana = m_Spell.ScaleMana(m_Spell.RequiredMana); AnimalFormEntry entry = AnimalForm.Entries[entryID]; if (mana > m_Caster.Mana) { m_Caster.SendLocalizedMessage(1060174, mana.ToString()); // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability. } else if (BaseFormTalisman.EntryEnabled(sender.Mobile, entry.Type)) { #region Dueling if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).DuelContext != null && !((PlayerMobile)m_Caster).DuelContext.AllowSpellCast(m_Caster, m_Spell)) { } #endregion else if (Morph(m_Caster, entryID) == MorphResult.Fail) { m_Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 502632); // The spell fizzles. m_Caster.FixedParticles(0x3735, 1, 30, 9503, EffectLayer.Waist); m_Caster.PlaySound(0x5C); } else { m_Caster.FixedParticles(0x3728, 10, 13, 2023, EffectLayer.Waist); m_Caster.Mana -= mana; string typename = entry.Name; BuffInfo.AddBuff(m_Caster, new BuffInfo(BuffIcon.AnimalForm, 1060612, 1075823, String.Format("{0}\t{1}", "aeiouy".IndexOf(typename.ToLower()[0]) >= 0 ? "an" : "a", typename))); } } }
public override void OnResponse(NetState sender, RelayInfo info) { int entryID = info.ButtonID - 1; if (entryID < 0 || entryID >= AnimalForm.Entries.Length) { return; } int mana = m_Spell.ScaleMana(m_Spell.RequiredMana); AnimalFormEntry entry = AnimalForm.Entries[entryID]; if (mana > m_Caster.Mana) { m_Caster.SendLocalizedMessage(1060174, mana.ToString()); // You must have at least ~1_MANA_REQUIREMENT~ Mana to use this ability. } else if ((m_Caster is PlayerMobile) && (m_Caster as PlayerMobile).MountBlockReason != BlockMountType.None) { m_Caster.SendLocalizedMessage(1063108); // You cannot use this ability right now. } else if (BaseFormTalisman.EntryEnabled(sender.Mobile, entry.Type)) { #region Dueling if (m_Caster is PlayerMobile && ((PlayerMobile)m_Caster).DuelContext != null && !((PlayerMobile)m_Caster).DuelContext.AllowSpellCast(m_Caster, m_Spell)) { } #endregion else if (AnimalForm.Morph(m_Caster, entryID) == MorphResult.Fail) { m_Caster.LocalOverheadMessage(MessageType.Regular, 0x3B2, 502632); // The spell fizzles. m_Caster.FixedParticles(0x3735, 1, 30, 9503, EffectLayer.Waist); m_Caster.PlaySound(0x5C); } else { m_Caster.FixedParticles(0x3728, 10, 13, 2023, EffectLayer.Waist); m_Caster.Mana -= mana; } } }
public AnimalFormGump(Mobile caster, AnimalFormEntry[] entries, AnimalForm spell) : base(50, 50) { m_Caster = caster; m_Spell = spell; m_Talisman = caster.Talisman; AddPage(0); AddBackground(0, 0, 520, 404, 0x13BE); AddImageTiled(10, 10, 500, 20, 0xA40); AddImageTiled(10, 40, 500, 324, 0xA40); AddImageTiled(10, 374, 500, 20, 0xA40); AddAlphaRegion(10, 10, 500, 384); AddHtmlLocalized(14, 12, 500, 20, 1063394, 0x7FFF, false, false); // <center>Polymorph Selection Menu</center> AddButton(10, 374, 0xFB1, 0xFB2, 0, GumpButtonType.Reply, 0); AddHtmlLocalized(45, 376, 450, 20, 1011012, 0x7FFF, false, false); // CANCEL double ninjitsu = caster.Skills.Ninjitsu.Value; int current = 0; for (int i = 0; i < entries.Length; ++i) { bool enabled = (ninjitsu >= entries[i].ReqSkill && BaseFormTalisman.EntryEnabled(caster, entries[i].Type)); int page = current / 10 + 1; int pos = current % 10; if (pos == 0) { if (page > 1) { AddButton(400, 374, 0xFA5, 0xFA7, 0, GumpButtonType.Page, page); AddHtmlLocalized(440, 376, 60, 20, 1043353, 0x7FFF, false, false); // Next } AddPage(page); if (page > 1) { AddButton(300, 374, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 1); AddHtmlLocalized(340, 376, 60, 20, 1011393, 0x7FFF, false, false); // Back } } if (enabled) { int x = (pos % 2 == 0) ? 14 : 264; int y = (pos / 2) * 64 + 44; Rectangle2D b = ItemBounds.Table[entries[i].ItemID]; AddImageTiledButton( x, y, 0x918, 0x919, i + 1, GumpButtonType.Reply, 0, entries[i].ItemID, entries[i].Hue, 40 - b.Width / 2 - b.X, 30 - b.Height / 2 - b.Y, entries[i].Tooltip); AddHtml(x + 84, y, 250, 60, Color(String.Format(entries[i].Name), 0xFFFFFF), false, false); current++; } } }
public static MorphResult Morph(Mobile m, int entryID) { if (entryID < 0 || entryID >= m_Entries.Length) { return(MorphResult.Fail); } AnimalFormEntry entry = m_Entries[entryID]; m_LastAnimalForms[m] = entryID; //On OSI, it's the last /attempted/ one not the last succeeded one if (m.Skills.Ninjitsu.Value < entry.ReqSkill) { string args = String.Format("{0}\t{1}\t ", entry.ReqSkill.ToString("F1"), SkillName.Ninjitsu); m.SendLocalizedMessage(1063013, args); // You need at least ~1_SKILL_REQUIREMENT~ ~2_SKILL_NAME~ skill to use that ability. return(MorphResult.NoSkill); } /* * if( !m.CheckSkill( SkillName.Ninjitsu, entry.ReqSkill, entry.ReqSkill + 37.5 ) ) * return MorphResult.Fail; * * On OSI,it seems you can only gain starting at '0' using Animal form. */ double ninjitsu = m.Skills.Ninjitsu.Value; if (ninjitsu < entry.ReqSkill + 37.5) { double chance = (ninjitsu - entry.ReqSkill) / 37.5; if (chance < Utility.RandomDouble()) { return(MorphResult.Fail); } } m.CheckSkill(SkillName.Ninjitsu, 0.0, 37.5); if (!BaseFormTalisman.EntryEnabled(m, entry.Type)) { return(MorphResult.Success); // Still consumes mana, just no effect } BaseMount.Dismount(m); int bodyMod = entry.BodyMod; int hueMod = entry.HueMod; m.BodyMod = bodyMod; m.HueMod = hueMod; if (entry.SpeedBoost) { m.Send(SpeedControl.MountSpeed); } SkillMod mod = null; if (entry.StealthBonus) { mod = new DefaultSkillMod(SkillName.Stealth, true, 20.0); mod.ObeyCap = true; m.AddSkillMod(mod); } SkillMod stealingMod = null; if (entry.StealingBonus) { stealingMod = new DefaultSkillMod(SkillName.Stealing, true, 10.0); stealingMod.ObeyCap = true; m.AddSkillMod(stealingMod); } Timer timer = new AnimalFormTimer(m, bodyMod, hueMod); timer.Start(); AddContext(m, new AnimalFormContext(timer, mod, entry.SpeedBoost, entry.Type, stealingMod)); return(MorphResult.Success); }
public AnimalFormGump(Mobile caster, AnimalFormEntry[] entries, AnimalForm spell) : base(50, 50) { m_Caster = caster; m_Spell = spell; AddPage(0); AddBackground(0, 0, 520, 404, 0x13BE); AddImageTiled(10, 10, 500, 20, 0xA40); AddImageTiled(10, 40, 500, 324, 0xA40); AddImageTiled(10, 374, 500, 20, 0xA40); AddAlphaRegion(10, 10, 500, 384); AddHtmlLocalized(14, 12, 500, 20, 1063394, 0x7FFF); // <center>Polymorph Selection Menu</center> AddButton(10, 374, 0xFB1, 0xFB2, 0); AddHtmlLocalized(45, 376, 450, 20, 1011012, 0x7FFF); // CANCEL var ninjitsu = caster.Skills.Ninjitsu.Value; var current = 0; for (var i = 0; i < entries.Length; ++i) { var enabled = ninjitsu >= entries[i].ReqSkill && BaseFormTalisman.EntryEnabled(caster, entries[i].Type); var page = current / 10 + 1; var pos = current % 10; if (pos == 0) { if (page > 1) { AddButton(400, 374, 0xFA5, 0xFA7, 0, GumpButtonType.Page, page); AddHtmlLocalized(440, 376, 60, 20, 1043353, 0x7FFF); // Next } AddPage(page); if (page > 1) { AddButton(300, 374, 0xFAE, 0xFB0, 0, GumpButtonType.Page, 1); AddHtmlLocalized(340, 376, 60, 20, 1011393, 0x7FFF); // Back } } if (!enabled) { continue; } var x = pos % 2 == 0 ? 14 : 264; var y = pos / 2 * 64 + 44; var b = ItemBounds.Table[entries[i].ItemID]; AddImageTiledButton( x, y, 0x918, 0x919, i + 1, GumpButtonType.Reply, 0, entries[i].ItemID, entries[i].Hue, 40 - b.Width / 2 - b.X, 30 - b.Height / 2 - b.Y, entries[i].Tooltip ); AddHtmlLocalized(x + 84, y, 250, 60, entries[i].Name, 0x7FFF); current++; } }