Ejemplo n.º 1
0
        public override void Initialize()
        {
            NWObject   door       = Object.OBJECT_SELF;
            NWPlayer   player     = GetPC();
            List <int> keyItemIDs = new List <int>();

            int count     = 1;
            int keyItemID = door.GetLocalInt("REQUIRED_KEY_ITEM_ID_" + count);

            while (keyItemID > 0)
            {
                keyItemIDs.Add(keyItemID);

                count++;
                keyItemID = door.GetLocalInt("REQUIRED_KEY_ITEM_ID_" + count);
            }

            bool   hasKeyItems  = _keyItem.PlayerHasAllKeyItems(player, keyItemIDs.ToArray());
            string doorDialogue = door.GetLocalString("DOOR_DIALOGUE");

            if (!string.IsNullOrWhiteSpace(doorDialogue))
            {
                SetPageHeader("MainPage", doorDialogue);
            }

            if (hasKeyItems)
            {
                SetResponseText("MainPage", 1, "Open Door");
            }
            else
            {
                SetResponseVisible("MainPage", 1, false);
            }
        }
Ejemplo n.º 2
0
        public bool Run(params object[] args)
        {
            int      index     = (int)args[0];
            int      type      = (int)args[1];
            NWPlayer player    = _.GetPCSpeaker();
            NWObject talkingTo = Object.OBJECT_SELF;

            int        count = 1;
            List <int> requiredKeyItemIDs = new List <int>();

            int keyItemID = talkingTo.GetLocalInt($"KEY_ITEM_{index}_REQ_{count}");

            while (keyItemID > 0)
            {
                requiredKeyItemIDs.Add(keyItemID);

                count++;
                keyItemID = talkingTo.GetLocalInt($"KEY_ITEM_{index}_REQ_{count}");
            }

            // Type 1 = ALL
            // Anything else = ANY
            return(type == 1 ?
                   _keyItem.PlayerHasAllKeyItems(player, requiredKeyItemIDs.ToArray()) :
                   _keyItem.PlayerHasAnyKeyItem(player, requiredKeyItemIDs.ToArray()));
        }