Example #1
0
        internal static void InitItemLogic()
        {
            trigger itemPick = CreateTrigger();
            trigger itemDrop = CreateTrigger();
            trigger itemUse  = CreateTrigger();

            TriggerRegisterAnyUnitEventBJ(itemPick, EVENT_PLAYER_UNIT_PICKUP_ITEM);
            TriggerRegisterAnyUnitEventBJ(itemDrop, EVENT_PLAYER_UNIT_PAWN_ITEM);
            TriggerRegisterAnyUnitEventBJ(itemDrop, EVENT_PLAYER_UNIT_DROP_ITEM);
            TriggerRegisterAnyUnitEventBJ(itemUse, EVENT_PLAYER_UNIT_USE_ITEM);

            TriggerAddAction(itemPick, () =>
            {
                int type      = GetItemTypeId(GetManipulatedItem());
                NoxItem check = Indexer[type];
                if (check != null)
                {
                    check.PickUp.Invoke(GetManipulatingUnit());
                }
            });
            TriggerAddAction(itemDrop, () =>
            {
                int type      = GetItemTypeId(GetManipulatedItem());
                NoxItem check = Indexer[type];
                if (check != null)
                {
                    check.Drop.Invoke(GetManipulatingUnit());
                }
            });
            TriggerAddAction(itemUse, () =>
            {
                int type      = GetItemTypeId(GetManipulatedItem());
                NoxItem check = Indexer[type];
                if (check != null)
                {
                    check.Use.Invoke(GetManipulatingUnit());
                }
            });
        }
Example #2
0
        /// <summary>
        /// Run when all static data is initialized.<br />
        /// Types taht need to be initialized before running: UnitEntity Custom Classes, Players, Items
        /// </summary>
        public static void RunAfterExtensionsReady()
        {
            int abilid = FourCC("AD00");

            for (int i = 0; i < NoxUnit.Abilities_BonusDamage.Length; i++)
            {
                NoxUnit.Abilities_BonusDamage[i] = abilid;
                if ((i + 1) % 10 == 0)
                {
                    abilid += 246;
                }
                abilid++;
            }
            abilid = FourCC("AR00");
            for (int i = 0; i < NoxUnit.Abilities_BonusArmor.Length; i++)
            {
                NoxUnit.Abilities_BonusArmor[i] = abilid;
                if ((i + 1) % 10 == 0)
                {
                    abilid += 246;
                }
                abilid++;
            }
            abilid = FourCC("CR00");
            for (int i = 0; i < NoxUnit.Abilities_Corruption.Length; i++)
            {
                NoxUnit.Abilities_Corruption[i] = abilid;
                if ((i + 1) % 10 == 0)
                {
                    abilid += 246;
                }
                abilid++;
            }
            abilid = FourCC("ST00");
            for (int i = 0; i < NoxHero.Abilities_Strength.Length; i++)
            {
                NoxHero.Abilities_Strength[i] = abilid;
                if ((i + 1) % 10 == 0)
                {
                    abilid += 246;
                }
                abilid++;
            }
            abilid = FourCC("AG00");
            for (int i = 0; i < NoxHero.Abilities_Agility.Length; i++)
            {
                NoxHero.Abilities_Agility[i] = abilid;
                if ((i + 1) % 10 == 0)
                {
                    abilid += 246;
                }
                abilid++;
            }
            abilid = FourCC("IN00");
            for (int i = 0; i < NoxHero.Abilities_Intelligence.Length; i++)
            {
                NoxHero.Abilities_Intelligence[i] = abilid;
                if ((i + 1) % 10 == 0)
                {
                    abilid += 246;
                }
                abilid++;
            }
            NoxUnit.InitUnitLogic();
            NoxItem.InitItemLogic();
            NoxAbility.InitAbilityLogic();
            TimerStart(CreateTimer(), 1800, true, GCRoutine);
        }