Esempio n. 1
0
        private static void TrySelectingTransformation(TransformationDefinition def, UIMouseEvent evt, UIElement listeningElement)
        {
            DBTPlayer dbtPlayer = Main.LocalPlayer.GetModPlayer <DBTPlayer>();

            if (dbtPlayer.HasAcquiredTransformation(def) && def.DoesDisplayInCharacterMenu(dbtPlayer))
            {
                // TODO Add sounds.
                //SoundHelper.PlayVanillaSound(SoundID.MenuTick);

                if (!dbtPlayer.SelectedTransformations.Contains(def))
                {
                    dbtPlayer.SelectTransformation(def);
                    Main.NewText($"Selected {def.DisplayName}, Mastery: {Math.Round(def.GetMaxMastery(dbtPlayer) * def.GetCurrentMastery(dbtPlayer), 2)}%");
                }
                else
                {
                    Main.NewText($"{def.DisplayName} Mastery: {Math.Round(100f * def.GetCurrentMastery(dbtPlayer), 2)}%");
                }
            }

            /*else if (def.SelectionRequirementsFailed.Invoke(player, def))
             * {
             *  SoundHelper.PlayVanillaSound(SoundID.MenuClose);
             *
             *  if (def.FailureText == null) return;
             *  Main.NewText(def.FailureText);
             * }*/
        }
        private static void TrySelectingTransformation(TransformationDefinition def, UIMouseEvent evt, UIElement listeningElement)
        {
            DBTPlayer dbtPlayer = Main.LocalPlayer.GetModPlayer <DBTPlayer>();

            if (def.CheckPrePlayerConditions() && dbtPlayer.HasAcquiredTransformation(def) && def.BaseConditions(dbtPlayer))
            {
                // TODO Add sounds.
                //SoundHelper.PlayVanillaSound(SoundID.MenuTick);

                if (!dbtPlayer.SelectedTransformations.Contains(def))
                {
                    dbtPlayer.SelectTransformation(def);
                    Main.NewText($"Selected {def.DisplayName}, Mastery: {Math.Round(def.GetMaxMastery(dbtPlayer) * def.GetCurrentMastery(dbtPlayer), 2)}%");
                }
                else
                {
                    Main.NewText($"{def.DisplayName} Mastery: {Math.Round(100f * def.GetCurrentMastery(dbtPlayer), 2)}%");
                }
            }
        }