Esempio n. 1
0
 public void take()
 {
     if (Item_Selection_Window != null)
     {
         var stacked_items = Supply_Window.active_stacked_items();
         actor.gain_item(stacked_items[Item_Selection_Window.index].acquire_item());
         if (Item_Selection_Window.item_count == 1 || !can_take)
         {
             Global.game_system.play_se(System_Sounds.Cancel);
             cancel_selecting_take();
             if (!can_take)
             {
                 cancel_trading();
             }
         }
         else
         {
             Global.game_system.play_se(System_Sounds.Confirm);
         }
         Traded = true;
         // Try to equip
         if (Item_Window.equipped == 0)
         {
             actor.setup_items(false);
             Item_Window.refresh_equipped_tag();
         }
         refresh();
         supply_window_index_changed();
     }
     else
     {
         if (Supply_Window.can_take_active_item(this.actor))
         {
             var item_data = Supply_Window.active_item.acquire_item();
             actor.gain_item(item_data);
             if (!can_take)
             {
                 Global.game_system.play_se(System_Sounds.Cancel);
                 cancel_trading();
             }
             else
             {
                 Global.game_system.play_se(System_Sounds.Confirm);
             }
             Traded = true;
             // Try to equip
             if (Item_Window.equipped == 0)
             {
                 actor.setup_items(false);
                 Item_Window.refresh_equipped_tag();
             }
             refresh();
             supply_window_index_changed();
         }
         else
         {
             Global.game_system.play_se(System_Sounds.Buzzer);
         }
     }
 }
Esempio n. 2
0
        public void take()
        {
            if (!can_take)
            {
                Global.game_system.play_se(System_Sounds.Buzzer);
                return;
            }

            if (Item_Selection_Window != null)
            {
                var stacked_items = Supply_Window.active_stacked_items();
                actor.gain_item(stacked_items[Item_Selection_Window.index].acquire_item());
                if (Item_Selection_Window.item_count == 1)
                {
                    Global.game_system.play_se(System_Sounds.Cancel);
                    cancel_selecting_take();
                }
                else
                {
                    Global.game_system.play_se(System_Sounds.Confirm);
                }
                Traded = true;
                refresh();
                supply_window_index_changed();
            }
            else
            {
                if (Supply_Window.can_take_active_item(this.actor))
                {
                    var item_data = Supply_Window.active_item.acquire_item();
                    actor.gain_item(item_data);
                    Global.game_system.play_se(System_Sounds.Confirm);
                    Traded = true;
                    refresh();
                    supply_window_index_changed();
                }
                else
                {
                    Global.game_system.play_se(System_Sounds.Buzzer);
                }
            }
        }