public static bool SetCurrentMove(Mobile m, SpecialMove move) { if (!Core.SE) { ClearCurrentMove(m); return(false); } if (move?.Validate(m) == false) { ClearCurrentMove(m); return(false); } var sameMove = move == GetCurrentMove(m); ClearCurrentMove(m); if (sameMove) { return(true); } if (move != null) { WeaponAbility.ClearCurrentAbility(m); Table[m] = move; move.OnUse(m); var moveID = SpellRegistry.GetRegistryNumber(move); if (moveID > 0) { m.Send(new ToggleSpecialAbility(moveID + 1, true)); } TextDefinition.SendMessageTo(m, move.AbilityMessage); } return(true); }
public static bool SetCurrentMove(Mobile m, SpecialMove move) { if (!Core.SE) { ClearCurrentMove(m); return(false); } if (move != null && !move.Validate(m)) { ClearCurrentMove(m); return(false); } bool sameMove = (move == GetCurrentMove(m)); ClearCurrentMove(m); if (sameMove) { return(true); } if (move != null) { WeaponAbility.ClearCurrentAbility(m); m_Table[m] = move; move.OnUse(m); int moveID = SpellRegistry.GetRegistryNumber(move); if (moveID > 0) { m.Send(new ToggleSpecialAbility(moveID + 1, true)); } move.SendAbilityMessage(m); } return(true); }
public static void ClearCurrentMove(Mobile m) { SpecialMove move = null; m_Table.TryGetValue(m, out move); if (move != null) { move.OnClearMove(m); int moveID = SpellRegistry.GetRegistryNumber(move); if (moveID > 0) { m.Send(new ToggleSpecialAbility(moveID + 1, false)); } } m_Table.Remove(m); }
public static void ClearCurrentMove(Mobile m) { SpecialMove move = null; if (m_Table.Contains(m)) { move = (SpecialMove)m_Table[m]; } m_Table.Remove(m); if (move != null) { move.OnClearMove(m); int moveID = SpellRegistry.GetRegistryNumber(move); if (moveID > 0) { m.Send(new ToggleSpecialAbility(moveID + 1, false)); } } }
public static void Register(int spellID, Type type) { SpellRegistry.Register(spellID, type); }