コード例 #1
0
        /// <summary>
        /// AddingClass handler.
        /// </summary>
        /// <param name="ev"><see cref="AddClassEventArgs"/>.</param>
        public void OnAddingSubclass(AddClassEventArgs ev)
        {
            if (!Instance.Config.SubclassItems.TryGetValue(ev.Subclass.Name, out List <Tuple <CustomItem, float> > customItems))
            {
                return;
            }

            foreach ((CustomItem item, float chance) in customItems)
            {
                int r = Instance.Rng.Next(100);
                if (r <= chance)
                {
                    Timing.CallDelayed(1.5f, () => item.Give(ev.Player));
                }
            }
        }
コード例 #2
0
 public static void OnAddingClass(AddClassEventArgs ev) => AddClass.InvokeSafely(ev);