public static void RemoveContext(Mobile m, AnimalFormContext context, bool resetGraphics) { m_Table.Remove(m); if (context.SpeedBoost) { m.Send(SpeedBoost.Instantiate(false)); } SkillMod mod = context.Mod; if (mod != null) { m.RemoveSkillMod(mod); } if (resetGraphics) { m.HueMod = -1; m.BodyMod = 0; } context.Timer.Stop(); }
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); } 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); BaseMount.Dismount(m); m.BodyMod = entry.BodyMod; if (entry.HueMod > 0) { m.HueMod = entry.HueMod; } if (entry.SpeedBoost) { m.Send(SpeedBoost.Instantiate(true)); } SkillMod mod = null; if (entry.StealthBonus) { mod = new DefaultSkillMod(SkillName.Stealth, true, 20.0); mod.ObeyCap = true; m.AddSkillMod(mod); } Timer timer = new AnimalFormTimer(m, entry.BodyMod, entry.HueMod); timer.Start(); AddContext(m, new AnimalFormContext(timer, mod, entry.SpeedBoost, entry.Type)); return(MorphResult.Success); }