Плохо! Плохо!:  0
Показано с 1 по 3 из 3

Тема: Аддоны к Время/Дата (Game Time)

  1. #1

    По умолчанию Аддоны к Время/Дата (Game Time)

    Календарь
    Автор: Я (Денис Кузнецов)
    Версия: 1.11 от 02.02.15
    Тип: Добавляющий возможности

    Описание:

    Аддон к Время/Дата Есть возможность отображать календарь, записи.

    Особенности:

    Вы можете заносить свои записи в кадендарь(что-то вроде ежедневника)

    Использование:
    Вся инструкция и настройки в шапке скрипта!

    Скрипт:

    Спойлер Код:
    Код:
    =begin
    ###############################################################################
    #                                                                             #
    #          								 	 Calendar (Календарь)                             #
    #                                                                             #
    ###############################################################################	
    	
    Автор: Денис Кузнецов (http://vk.com/id8137201)
    Версия: 1.11
    Релиз от: 02.02.15
    Зависимость: Game_Time by Denis Kyznetsov (версия 5.0)
    Установка: разместить ниже Game_Time (Время/Дата)
    
    	Календарь:
      Чтобы добавить запись в календарь, воспользуйтесь вызовом скрипта:
      add_quest(text, day, month, year, hour, info, location, notify)
      text - текст, что будет отображаться в календаре
      day - день если == -1, то текущий день
      month - месяц если == -1, то текущий месяц
      year - год если == -1, то текущий год
    	hour - час если hour == -1, то на следующий час
    	info - дополнительная информация о квесте
    	location - локация (ид карты) если 0, то текущая локация
    	notify - уведомлять о получении, завершении квеста (по-умолчанию true)
    
    	Внимание! Чтобы добавить дополнительную информацию перед вызовом скрипта прописывайте:
    	text = "здесь ваш текст" таким образом, чтобы последняя ковычка была в конце окна
    	редактора скрипта !
    
    	Потом вы можете написать text1 = "еще текст" опять же до конца окна редактора скрипта!
    	Это особенность rpg maker. После чего вызвать скрипт:
    	add_quest(text, day, month, year, text+text1) и таких text - может быть много.
      Например: add_quest("Сходить за посылкой", 2, 1, 2014, 17) - вызов этого скрипта добавит
      запись в календарь на 2 января 2014 года на 17 часов.
      
      Прошедшие события будут автоматически удаляться и помечаться, как проваленные, 
    	чтобы записи были, как завершенные, воспользуйтесь вызовом скрипта !
      complete_quest(text, day, month, year, hour)
      где text - текст записи
      day - день, если == -1, то текущий день
      month - месяц, если == -1, то текущий месяц
      year - год, если == -1, то текущий год
    	hour - час, если == -1, то следующий час
    	location - локация (ид карты) если 0, то текущая локация
      
    	Чтобы, например, удалить запись из первого примера выше, нужно вызвать скрипт:
      complete_quest("Сходить за посылкой", 2, 1, 2014, 17). Внимание! Чтобы запись 
    	была удалена, должны быть правильны введены все поля, особенно время!
    	Внимание! Если вы не используете локации для календарей, то в вызове скрипта можете
    	не указывать последний параметр (location)
    
    =end
    
    ### НАЧАЛО НАСТРОЙКИ ###########################################################
    
    module Calendar_Settings
    	# Сокращенное название дней недели для календаря
    	SHORT_DAYS_WEEK = ["Пн", "Вт", "Ср", "Чт", "Пт", "Сб", "Вс"]
    	# Название месяцев
    	MONTHS = [ "Январь", "Февраль", "Март", "Апрель", "Май", "Июнь", "Июль", "Август", 
    		"Сентябрь", "Октябрь", "Ноябрь", "Декабрь"]
    end
    
    module Time_Settings
    	#------ Настройка календаря ----------------------------------------------------
    	
    	# Использовать календарь ? true - да, false - нет
    	USE_CALENDAR = true
    	
    	# Использовать окно с календарем в игре ? true - да, false - нет
    	USE_CALENDAR_WINDOW = true
    	
    	# Использовать окно уведомлений о квестах ? true - да, false - нет
    	USE_CALENDAR_WINDOW_NOTIFICATION = true
    	
    	# Использовать локации для записей ? true - да, false - нет
    	USE_CALENDAR_LOCATION = true
    	
    	# Использовать отображение конца квеста ? true - да, false - нет
    	USE_CALENDAR_QUEST_END = true
    	
    	# Использовать статус квеста ? true - да, false - нет
    	USE_CALENDAR_QUEST_STATUS = true
    	
    	# Использовать прокрутку большого текста в календаре ? true - да, false - нет
    	USE_CALENDAR_SCROLL_TEXT = true
    	
    	# Через сколько секунд текст будет прокручиваться ?
    	CALENDAR_SCROLL_TIME = 6
    	
    	# За сколько минут оповещать о завершении квеста ? не больше MINUTES_IN_HOUR
    	$CALENDAR_NOTIFY = 5
    	
    	# Использовать прошедшие события ? true - да, false - нет
    	USE_LAST_QUESTS = true
    	
    	# Координата X окна календаря
    	CALENDAR_X = 0
    	# Координата Y окна календаря
    	CALENDAR_Y = 0
    	
    	# Кнопка отображения/скрытия окна календаря
    	# -1, чтобы не использовать
    	CALENDAR_TIME_BUTTON = :Z
    	
    	# Показывать окно календаря в начале игры ? true - да, false - нет
    	$SHOW_START_GAME_CALENDAR_WINDOW = false
    	
    	#----- Конец настройки календаря -----------------------------------------------
    	
    	# не трогать
    	MONTHS_DAY = []
    	SORT = []
    	# не трогать
    	
    end
    
    module CalVocab
    	# Информация на месяцы, на которых нет записей
    	NO_INFO = "В этот день ничего нет"
    	# Информация в окне, если сегодня нет событий
    	GAME_NO_INFO = "На сегодня ничего нет"
    	# Текст, когда нет дополнительной информации у записи
    	QUESTS_NO_INFO = "Нет описания квеста"
    	# Текст в календаре, если квест выполнен
    	STATUS_COMPLETE_QUEST = "Завершено"
    	# Текст в календаре, если квест не выполнен
    	STATUS_NO_COMPLETE_QUEST = "Провалено"
    	# Текст в календаре, если квест еще не выполнен
    	STATUS_NOW_QUEST = "Активно"
    	# Текст названия квеста
    	WINDOW_NAME_QUEST = "Квест"
    	# Текст в окне уведомелний при получении квеста
    	WINDOW_STATUS_GET = "Получен!"
    	# Текст в окне уведомелний при успешном завершении квеста
    	WINDOW_STATUS_COMPLETE = "Завершен!"
    	# Текст в окне уведомелний при провале квеста
    	WINDOW_STATUS_NO_COMPLETE = "Провален!"
    end
    
    ### КОНЕЦ НАСТРОЙКИ ############################################################
    
    $imported = {} if $imported.nil?
    $imported["DenKyz_Game_Time_Calendar"] = true	
    
    class Functions
    	
    	def self.transfer_quest(index, complete = false) # перенос записей в архив
    		add_notification($QUESTS[index][:text], complete) if USE_CALENDAR_WINDOW_NOTIFICATION && $QUESTS[index][:notify]
    		flag = false
    		for i in 0..$LAST_QUESTS.size
    			if $LAST_QUESTS[i] == nil
    				$LAST_QUESTS[i] = $QUESTS[index]
    				$LAST_QUESTS[i][:complete] = complete
    				flag = true
    				break
    			end
    		end
    		size = $LAST_QUESTS.size
    		$LAST_QUESTS[size] = $QUESTS[index] if !flag
    		$LAST_QUESTS[size][:complete] = complete if !flag
    		$QUESTS[index] = nil
    	end
    	
    	def self.add_notification(text, complete = false, add = false)
    		flag = false
    		for i in 0..$NOTIFICATION_WINDOW.size
    			if $NOTIFICATION_WINDOW[i] == nil
    				$NOTIFICATION_WINDOW[i] = { :text => text, :status => (!add ? (complete ? CalVocab::WINDOW_STATUS_COMPLETE : CalVocab::WINDOW_STATUS_NO_COMPLETE) : CalVocab::WINDOW_STATUS_GET) }
    				flag = true
    				break
    			end
    		end
    		size = $NOTIFICATION_WINDOW.size
    		$NOTIFICATION_WINDOW[size] = { :text => text, :status => (!add ? (complete ? CalVocab::WINDOW_STATUS_COMPLETE : CalVocab::WINDOW_STATUS_NO_COMPLETE) : CalVocab::WINDOW_STATUS_GET) } if !flag
    		$Game_Time_Notification = Calendar_Notification_Window.new
    	end
    	
    	def self.transfer?
    		return if $QUESTS.nil?
    		k = 0
    		for i in 0..$QUESTS.size - 1
    			if $QUESTS[i] != nil
    				if $Game_Time.year > $QUESTS[i][:year] || (($Game_Time.year >= $QUESTS[i][:year] && $QUESTS[i][:month] < $Game_Time.month)) || ($Game_Time.year >= $QUESTS[i][:year] && $QUESTS[i][:month] <= $Game_Time.month && $QUESTS[i][:date] < $Game_Time.day) # && $Game_Time.hour >= $QUESTS[i][:hour])
    					transfer_quest(i)
    					k += 1
    				end
    			end
    		end
    		return k
    	end
    	
    	def self.complete?
    		return if $QUESTS.nil?
    		for i in 0..$QUESTS.size-1
    			if $QUESTS[i] != nil
    				if $QUESTS[i][:date] <= $Game_Time.day && $QUESTS[i][:month] <= $Game_Time.month && $QUESTS[i][:year] <= $Game_Time.year && $QUESTS[i][:hour] <= $Game_Time.hour
    					transfer_quest(i)
    				end
    			end
    		end
    	end
    	
    	def self.cursor_pagedown
    		$CURRENT_FIRST_DAY = $FIRST_DAY if $List_Year == $Year
    		$List_Year += 1
    		all_days = 0
    		for i in 0..MONTHS.size-1
    			all_days += DAYS[i]
    		end
    		$FIRST_DAY += all_days % DAYS_WEEK.size
    		$FIRST_DAY = 1 if $FIRST_DAY > DAYS_WEEK.size
    	end
    	
    	def self.cursor_pageup
    		$CURRENT_FIRST_DAY = $FIRST_DAY if $List_Year == $Year
    		$List_Year -= 1
    		all_days = 0
    		for i in 0..MONTHS.size-1
    			all_days += DAYS[i]
    		end
    		$FIRST_DAY -= all_days % DAYS_WEEK.size
    		$FIRST_DAY = DAYS_WEEK.size if $FIRST_DAY < 1
    		$List_Year = $Year if $List_Year < $Year && !USE_LAST_QUESTS
    	end
    	
    	def self.cursor_left(wrap = true)
    		$List_Day -= 1
    		if $month_cursor > 0 && $List_Day < 1
    			$month_cursor -= 1
    			$List_Day = DAYS[$month_cursor]
    		elsif $month_cursor == 0 && $List_Day < 1
    			$month_cursor = MONTHS.size-1
    			$List_Day = DAYS[$month_cursor]
    			cursor_pageup
    		end
    	end
    	
    	def self.cursor_right(wrap = true)
    		$List_Day += 1
    		if $month_cursor < MONTHS.size-1 && $List_Day > DAYS[$month_cursor]
    			$month_cursor += 1
    			$List_Day = 1
    		elsif $month_cursor == MONTHS.size-1 && $List_Day > DAYS[$month_cursor]
    			$month_cursor = 0
    			$List_Day = 1
    			cursor_pagedown
    		end
    	end
    	
    	def self.min_text(*args)
    		return args[0][args[1]][:text][0..(args[2]-1)] + "..."
    	end
    	
    end
    
    class Window_MenuCommand < Window_Command
    	alias denis_kyznetsov_calendar_wnd_menu_cmmd_add_original_commands add_original_commands
    	def add_original_commands
    		denis_kyznetsov_calendar_wnd_menu_cmmd_add_original_commands
    		add_command("Календарь", :calendar) if Time_Settings::USE_CALENDAR && $imported["DenKyz_Game_Time_Calendar"]
    	end
    	
    end # class Window_MenuCommand < Window_Command
    
    class Scene_Menu < Scene_MenuBase
    	def calendar
    		SceneManager.call(CalendarScene)
    	end
    end # class Scene_Menu < Scene_MenuBase
    
    class Calendar_Time_Window_Base < Window_Base
    	include Calendar_Settings
    	
    	def initialize(x = 0, y = 0, w = Graphics.width, h = Graphics.height)
    		super(x, y, w, h)
    		@year = $List_Year
    		static_text
    		draw_text(0, 40, 190, 32, "Календарь на: " + $List_Year.to_s + " г")
    		update
    	end
    	
    	def static_text
    		draw_text(10, 0, 180, 32, "Текущая дата:")
    		draw_text(10, 20, 160, 32, $Day.to_s + ", " + MONTHS[$Month].to_s + " " + $Year.to_s + " г")
    	end
    	
    	def update
    		if @year != $List_Year
    			@year = $List_Year
    			contents.clear
    			static_text
    			draw_text(0, 40, 190, 32, "Календарь на: " + $List_Year.to_s + " г")
    		end
    	end
    	
    end # class Calendar_Time_Window_Base < Window_Base
    
    class Calendar_Month_Window_Base < Window_Base
    	include Calendar_Settings
    	
    	def initialize(x = 0, y = 0, w = Graphics.width, h = Graphics.height)
    		super(x, y, w, h)
    		@now_day = $List_Day
    		@now_year = $List_Year
    		@mow_month = $month_cursor
    		month_math
    		update
    	end
    	
    	def month_math
    		Time_Settings::MONTHS_DAY[0] = $FIRST_DAY
    		for i in 1..MONTHS.size
    			Time_Settings::MONTHS_DAY[i] = (Time_Settings::DAYS[i-1] + Time_Settings::MONTHS_DAY[i-1]) % DAYS_WEEK.size
    			Time_Settings::MONTHS_DAY[i] = DAYS_WEEK.size if Time_Settings::MONTHS_DAY[i] == 0
    		end
    	end
    	
    	def show_days_info
    		dy, i, k, week = 22, 1, Time_Settings::MONTHS_DAY[$month_cursor], 5
    		if Time_Settings::DAYS[$month_cursor] > 30 || (Time_Settings::MONTHS_DAY[$month_cursor] > 5 && Time_Settings::DAYS[$month_cursor] >= 30)
    			week = 6
    		end
    		change_color(normal_color)
    		text = ""
    		SHORT_DAYS_WEEK.each do |key|
    			text += key + "  "
    		end
    		draw_text(0, 0, 360, 25, text, 1)
    		i = draw_week(dy, Time_Settings::MONTHS_DAY[$month_cursor], 1, i)
    		for j in 2..week
    			i = draw_week(dy, 1, j, i)
    		end
    	end
    	
    	def draw_week(dy, k, j, i) # отображение календаря в цифрах
    		for s in k..DAYS_WEEK.size
    			if i > Time_Settings::DAYS[$month_cursor]
    				break
    			end
    			if i == $Day && $Month == $month_cursor && $Year == $List_Year && $List_Day != $Day
    				change_color(text_color(24))
    			elsif i == $List_Day && $List_Day != $Day || (($Year != $List_Year || $Month != $month_cursor) && i == $List_Day)
    				change_color(text_color(20))
    			elsif i == $List_Day && $List_Day == $Day && $Year == $List_Year && $Month == $month_cursor
    				change_color(text_color(21))
    			else
    				change_color(normal_color)
    			end
    			draw_text(40 + (s-1)*24*1.64, dy + (j-1)*20, 360, 25, i < 10 ? " " + i.to_s : i.to_s)
    			i += 1
    		end
    		return i
    	end
    	
    	def update
    		if @now_year != $List_Year || @now_day != $List_Day || @now_month != $month_cursor || Functions.transfer? > 0
    			@now_year = $List_Year
    			month_math
    			@now_month = $month_cursor
    			@now_day = $List_Day
    			contents.clear
    			show_days_info 
    		end
    	end
    	
    end # Calendar_Month_Window_Base < Window_Base
    
    class CalendarScene < Scene_Base
    	include Calendar_Settings
    	
    	def start
    		super
    		$Year = $Game_Time.year
    		$Month = $Game_Time.month
    		$Day = $Game_Time.day
    		$List_Year = $Year
    		create_main_window
    		create_month_window
    		create_time_window
    		create_strings_window
    		@activate = true
    		@help_window = false
    		if $QUESTS.size > 0
    			Functions.transfer? 
    			Functions.complete?
    		end
    	end
    	
    	def create_main_window
    		@create_main_calendar_window = Calendar_Window_Command.new(0, 100)
    		MONTHS.each do |key|
    			@create_main_calendar_window.set_handler(key.to_sym, method(:month))
    		end
    	end
    	
    	def month
    		if !@create_calendar_strings_window.activator
    			@create_calendar_strings_window.deactivate
    			@create_main_calendar_window.activate
    			@activate = true
    		else
    			@create_main_calendar_window.deactivate
    			@create_calendar_strings_window.activate
    			@activate = false
    		end
    	end
    	
    	def create_strings_window
    		Functions.transfer?
    		dw = Graphics.width/3
    		@create_calendar_strings_window = Strings_Window_Commad.new(dw, 176)
    		if Time_Settings::USE_LAST_QUESTS
    			for i in 0..$LAST_QUESTS.size - 1
    				if $LAST_QUESTS[i] != nil
    					@create_calendar_strings_window.set_handler(($LAST_QUESTS[i][:text] + $LAST_QUESTS[i][:date].to_s + $LAST_QUESTS[i][:month].to_s + $LAST_QUESTS[i][:year].to_s + "LAST").to_sym, method(:show_info))
    				end
    			end
    		end
    		for i in 0..$QUESTS.size - 1
    			if $QUESTS[i] != nil
    				@create_calendar_strings_window.set_handler(($QUESTS[i][:text] + $QUESTS[i][:date].to_s + $QUESTS[i][:month].to_s + $QUESTS[i][:year].to_s).to_sym, method(:show_info))
    			end
    		end
    		@create_calendar_strings_window.deactivate
    	end
    	
    	def show_info
    		@create_window_info = Strings_Window_Info.new(25, Graphics.height/2-185, Graphics.width-50, 370)
    		@help_window = true
    	end
    	
    	def create_month_window
    		dw = Graphics.width/3
    		@create_month_window = Calendar_Month_Window_Base.new(dw, 0, Graphics.width - dw, 176)
    	end
    	
    	def create_time_window
    		@create_time_window = Calendar_Time_Window_Base.new(0, 0, Graphics.width/3, 100)
    	end
    	
    	def update
    		super
    		if Input.trigger?(:A) && @create_calendar_strings_window
    			@create_calendar_strings_window.show_last_quests = !@create_calendar_strings_window.show_last_quests
    		end
    		
    		if Input.trigger?(:B) && @activate
    			Sound.play_cancel
    			return_scene
    		elsif Input.trigger?(:B) && !@activate || !@create_calendar_strings_window.activator
    			Sound.play_cancel if Input.trigger?(:B) || !@activate
    			@create_calendar_strings_window.deactivate
    			@create_main_calendar_window.activate
    			@activate = true
    		elsif !@create_window_info.nil? && @help_window
    			if @create_window_info.disposing
    				Sound.play_cancel
    				@help_window = false
    				@create_window_info.dispose
    				@create_main_calendar_window.deactivate
    				@activate = false
    				@create_calendar_strings_window.activate
    			end
    		end
    	end
    	
    end # class CalendarScene < Scene_MenuBase
    
    class Strings_Window_Info < Window_Base
    	include Calendar_Settings, CalVocab
    	
    	attr_reader :disposing
    	
    	def initialize(x, y, w, h)
    		super(x, y, w, h)
    		self.back_opacity = 255
    		@index = -1
    		@location_index = -1
    		@scroll = 0
    		@y = 0
    		@str_len_cat = 48
    		@hello_time = 0
    		if $Quest_Symbol.include?("LAST")
    			@last = true
    			strings($LAST_QUESTS)
    		else
    			@last = false
    			strings($QUESTS)
    		end
    		@disposing = false
    	end
    	
    	def strings(*args)
    		@location_index = -1
    		@main_text = format_text
    		@mas = []
    		for i in 0..args[0].size - 1
    			if args[0][i] != nil
    				if args[0][i][:text] == @main_text && args[0][i][:date] == $List_Day && args[0][i][:month] == $month_cursor && args[0][i][:year] == $List_Year
    					@location_index = i
    					if args[0][i][:info] != nil
    						@index = i
    						if args[0][i][:info].size >= @str_len_cat
    							position, str, len, x = 0, 0, args[0][i][:info].size-1, @str_len_cat-1
    							for k in 0..args[0][i][:info].size-1
    								if args[0][i][:info][x] == ' '
    									position += 1 if args[0][i][:info][position] == ' '
    									@mas[str] = args[0][i][:info][position..x]
    									len -= (x - position)
    									position = x + 1
    									x += @str_len_cat
    									str += 1
    								end
    								x -= 1
    								if (x-position) < @str_len_cat && len < @str_len_cat
    									@mas[str] = args[0][i][:info][position..x]
    									break
    								end
    							end
    							break
    						end
    					end
    				end
    			end
    		end
    		show_info(args[0])
    	end
    	
    	def format_text
    		index = $Quest_Symbol.index($List_Day.to_s)
    		text = $Quest_Symbol[0..index-1]
    		return text
    	end
    	
    	def show_info(*args)
    		@y = 0
    		change_color(text_color(24))
    		draw_text(-5, 0, 480, 32, @main_text, 1)
    		change_color(normal_color)
    		self.contents.fill_rect(0, 28, 470, 1, normal_color)
    		draw_text(0, 32, 480, 32, "Дополнительная информация", 1)
    		if Time_Settings::USE_CALENDAR_LOCATION
    			@y += 28
    			change_color(text_color(24))
    			draw_text(0, 60, 450, 32, "Локация: ")
    			change_color(normal_color)
    			if !args[0][@location_index][:location].to_i.zero?
    				@location = load_data(sprintf("Data/Map%03d.rvdata2", args[0][@location_index][:location]))
    				draw_text(90, 60, 450, 32, (@location.display_name == "" ? "Неизвестно" : @location.display_name + (args[0][@location_index][:location] == $game_map.map_id ? " (Текущая)" : "")))
    			else
    				draw_text(90, 60, 450, 32, args[0][@location_index][:location])
    			end
    		end
    		if Time_Settings::USE_CALENDAR_QUEST_END
    			@y += 28
    			change_color(text_color(24))
    			draw_text(0, 60 + @y/2, 450, 32, "Завершить до: ")
    			change_color(normal_color)
    			draw_text(140, 60 + @y/2, 450, 32, args[0][@location_index][:date].to_s + " " + CALENDAR_MONTHS[args[0][@location_index][:month]] + " " + args[0][@location_index][:year].to_s + "г. " + args[0][@location_index][:hour].to_s + ":00")
    		end
    		if Time_Settings::USE_CALENDAR_QUEST_STATUS
    			change_color(text_color(24))
    			draw_text(0, 60 + @y, 450, 32, "Статус: ")
    			if @last
    				text = ""
    				if !args[0][@location_index][:complete]
    					change_color(text_color(20))
    					text = STATUS_NO_COMPLETE_QUEST
    				else
    					text = STATUS_COMPLETE_QUEST
    				end
    				draw_text(75, 60 + @y, 450, 32, text)
    			else
    				change_color(text_color(17))
    				draw_text(75, 60 + @y, 450, 32, STATUS_NOW_QUEST)
    			end
    			change_color(normal_color)
    			@y += 28
    		end
    		if args[0][@index][:info] != nil && @index != -1
    			if args[0][@index][:info].size < 38
    				draw_text(0, @y + 60, 480, 32, args[0][@index][:info], 0) # 28+ из-за локации
    			else
    				for str in 0..@mas.size-1
    					draw_text(0, @y + 60 + str*25, 485, 32, @mas[str+@scroll], 1)
    				end
    			end
    		else
    			draw_text(90, 60, 480, 32, "Неизвестно") if @location_index == -1 && Time_Settings::USE_CALENDAR_LOCATION
    			draw_text(0, 60 + @y*1.8, 480, 32, QUESTS_NO_INFO, 1)
    		end
    	end
    	
    	def update
    		if Time_Settings::USE_CALENDAR_SCROLL_TEXT
    			if Graphics.frame_count % 60 == 0 
    				@hello_time += 1
    			end
    			happy_scroll = true if @hello_time == Time_Settings::CALENDAR_SCROLL_TIME
    		end
    		if (Input.trigger?(:DOWN) || (happy_scroll && Time_Settings::USE_CALENDAR_SCROLL_TEXT)) && !@disposing
    			if @index != -1
    				if !$Quest_Symbol.include?("LAST")
    					if ($QUESTS[@index][:info].size/@str_len_cat-@scroll + (@y/28)) > 9 # +1 из-за локации
    						@scroll += 1
    						contents.clear
    						show_info($QUESTS)
    					end
    				else
    					if ($LAST_QUESTS[@index][:info].size/@str_len_cat-@scroll + (@y/28)) > 9
    						@scroll += 1
    						contents.clear
    						show_info($LAST_QUESTS)
    					end
    				end
    			end
    		elsif Input.trigger?(:UP) && @scroll != 0 && !@disposing
    			@scroll -= 1
    			contents.clear
    			if $Quest_Symbol.include?("LAST")
    				@last = true
    				show_info($LAST_QUESTS)
    			else
    				@last = false
    				show_info($QUESTS)
    			end
    			happy_scroll = false
    		end
    		return @disposing = true if Input.trigger?(:B) && !@disposing
    		if happy_scroll && Time_Settings::USE_CALENDAR_SCROLL_TEXT
    			happy_scroll = false
    			@hello_time = 0
    		end
    	end
    	
    end # class Strings_Window_Info < Window_Base
    
    class Strings_Window_Commad < Window_Command
    	include CalVocab
    	
    	attr_reader :activator
    	attr_accessor :show_last_quests
    	
    	def initialize(x, y)
    		@now_day = $List_Day
    		@now_month = $month_cursor
    		@now_year = $List_Year
    		@activator = false
    		@no_doubt = 0
    		@doubt = 0
    		@show_last_quests = true if Time_Settings::USE_LAST_QUESTS
    		@update_show = true
    		super
    	end
    	
    	def window_width
    		return Graphics.width - Graphics.width/3
    	end
    	
    	def window_height
    		Graphics.height - 176
    	end
    	
    	def draw_item(index)
    		if index < @no_doubt
    			color = $LAST_QUESTS[@quests[index]][:complete] ? text_color(24) : text_color(20)
    		else
    			color = text_color(17)
    		end
    		change_color(color, command_enabled?(index))
    		draw_text(item_rect_for_text(index), command_name(index), alignment)
    	end
    	
    	def make_command_list
    		@quests = []
    		@no_doubt = 0
    		@doubt = 0
    		if Time_Settings::USE_LAST_QUESTS && @show_last_quests
    			for h in 0..Time_Settings::HOURS_IN_DAY
    				for i in 0..$LAST_QUESTS.size - 1
    					if $LAST_QUESTS[i] != nil
    						if $LAST_QUESTS[i][:month] == $month_cursor && $List_Day == $LAST_QUESTS[i][:date] && $LAST_QUESTS[i][:year] == $List_Year
    							if $LAST_QUESTS[i][:hour] == h
    								if $LAST_QUESTS[i][:text].size < 28
    									add_command($LAST_QUESTS[i][:text], ($LAST_QUESTS[i][:text] + $LAST_QUESTS[i][:date].to_s + $LAST_QUESTS[i][:month].to_s + $LAST_QUESTS[i][:year].to_s + "LAST").to_sym)
    								else
    									add_command(Functions.min_text($LAST_QUESTS, i, 28), ($LAST_QUESTS[i][:text] + $LAST_QUESTS[i][:date].to_s + $LAST_QUESTS[i][:month].to_s + $LAST_QUESTS[i][:year].to_s + "LAST").to_sym)
    								end
    								@quests[@no_doubt] = i
    								@no_doubt += 1
    								@activator = true
    							end
    						end
    					end
    				end
    			end
    		end
    		for h in 0..Time_Settings::HOURS_IN_DAY
    			for i in 0..$QUESTS.size - 1
    				if $QUESTS[i] != nil
    					if $QUESTS[i][:month] == $month_cursor && $List_Day == $QUESTS[i][:date] && $QUESTS[i][:year] == $List_Year
    						if $QUESTS[i][:hour] == h
    							if $QUESTS[i][:text].size < 28
    								add_command($QUESTS[i][:text], ($QUESTS[i][:text] + $QUESTS[i][:date].to_s + $QUESTS[i][:month].to_s + $QUESTS[i][:year].to_s).to_sym)
    							else 
    								add_command(Functions.min_text($QUESTS, i, 28), ($QUESTS[i][:text] + $QUESTS[i][:date].to_s + $QUESTS[i][:month].to_s + $QUESTS[i][:year].to_s).to_sym)
    							end
    							@doubt += 1
    							@activator = true if !@activator
    						end
    					end
    				end
    			end
    		end
    	end
    	
    	def call_ok_handler
    		$Quest_Symbol = current_symbol.to_s
    		super
    	end
    	
    	def update_cursor
    		if @cursor_all
    			cursor_rect.set(0, 0, contents.width, row_max * item_height)
    			self.top_row = 0
    		elsif @index < 0 || !@activator
    			cursor_rect.empty
    		elsif @index >= 0 && @activator
    			ensure_cursor_visible
    			cursor_rect.set(item_rect(@index))
    		end
    	end
    	
    	def cursor_pageup
    		Functions.cursor_pageup
    	end
    	
    	def cursor_pagedown
    		Functions.cursor_pagedown
    	end
    	
    	def cursor_left(wrap = true)
    		Functions.cursor_left
    	end
    	
    	def cursor_right(wrap = true)
    		Functions.cursor_right
    	end
    	
    	def update
    		if $List_Day != @now_day || $month_cursor != @now_month || @now_year != $List_Year || @update_show != @show_last_quests
    			@update_show = @show_last_quests
    			@now_day = $List_Day
    			@now_month = $month_cursor
    			@now_year = $List_Year
    			@activator = false
    			refresh
    			update_cursor
    			select(0)
    		end
    		if !@activator
    			self.contents.clear
    			self.contents.draw_text(50, 80, 350, 50, NO_INFO, 0)
    		end
    		super
    	end
    	
    end # class Strings_Window_Commad < Window_Command
    
    class Game_Interpreter
    	
    	def add_quest(text, date = -1, month = -1, year = -1, hour = -1, info = nil, location = 0, notify = true)
    		date = $Game_Time.day if date == -1
    		month = $Game_Time.month + 1 if month == -1
    		year = $Game_Time.year if year == -1
    		location = $game_map.map_id if location == 0 && Time_Settings::USE_CALENDAR_LOCATION
    		hour = ($Game_Time.hour + 1) % Time_Settings::HOURS_IN_DAY if hour == -1
    		flag = false
    		for i in 0..$QUESTS.size
    			if $QUESTS[i] == nil
    				$QUESTS[i] = { :text => text, :date => date, :month => month - 1, :year => year, :hour => hour, :info => info, :notify => notify }
    				$QUESTS[i][:location] = location if Time_Settings::USE_CALENDAR_LOCATION
    				flag = true
    				break
    			end
    		end
    		$QUESTS[$QUESTS.size] = { :text => text, :date => date, :month => month - 1, :year => year, :hour => hour, :info => info, :notify => notify } if !flag
    		$QUESTS[$QUESTS.size][:location] = location if Time_Settings::USE_CALENDAR_LOCATION && !flag
    		Functions.add_notification(text, false, true) if Time_Settings::USE_CALENDAR_WINDOW_NOTIFICATION && notify
    	end
    	
    	def complete_quest(text, day = -1, month = -1, year = -1, hour = -1, location = 0)
    		day = $Game_Time.day if day == -1
    		month = $Game_Time.month if month == -1
    		month -= 1 if month != $Game_Time.month
    		year = $Game_Time.year if year == -1
    		hour = ($Game_Time.hour+1) % HOURS_IN_DAY if hour == -1
    		location = $game_map.map_id if location == 0 && Time_Settings::USE_CALENDAR_LOCATION
    		for i in 0..$QUESTS.size - 1
    			if $QUESTS[i] != nil
    				if $QUESTS[i][:text] == text && $QUESTS[i][:date] == day && $QUESTS[i][:month] == month && $QUESTS[i][:year] == year && $QUESTS[i][:hour] == hour
    					if USE_CALENDAR_LOCATION
    						if $QUESTS[i][:location] == location
    							Functions.transfer_quest(i, true)
    							break
    						end
    					else
    						Functions.transfer_quest(i, true)
    						break
    					end
    				end
    			end
    		end
    	end
    	
    end # class Game_Interpreter
    
    class Scene_Menu < Scene_MenuBase
    	
    	alias denis_kyznetsov_calendar_scn_menu_start start
    	def start
    		if $Game_Time_Notification
    			$Game_Time_Notification.hide
    			$Game_Time_Notification.menu = true
    		end
    		denis_kyznetsov_calendar_scn_menu_start
    	end
    	
    end # class Scene_Menu < Scene_MenuBase
    
    class Scene_Map < Scene_Base
    	
    	alias denis_kyznetsov_calendar_scn_map_start start
    	def start
    		denis_kyznetsov_calendar_scn_map_start
    		if $Game_Time_Notification
    			$Game_Time_Notification.show
    			$Game_Time_Notification.menu = false
    		end
    	end
    	
    end # class Scene_Map < Scene_Base
    
    class Calendar_Notification_Window < Window_Base
    	include CalVocab
    	attr_accessor :menu
    	attr_accessor :disposing
    	def initialize
    		super(0, Graphics.height/12, Graphics.width/2, Graphics.height/4)
    		@menu = false
    		@update_funny_cat = false
    		@frame = 0
    		@text = ""
    		@status = ""
    		@down = false
    		@frame_count = 0
    		@disposing = false
    		@index = 0
    		self.z = 150
    		self.opacity = 0
    		self.back_opacity = 0
    		self.contents_opacity = 0
    	end
    	
    	def update
    		return if @menu
    		if !@update_funny_cat
    			for i in @index..$NOTIFICATION_WINDOW.size-1
    				if $NOTIFICATION_WINDOW[i] != nil
    					@update_funny_cat = true
    					@text = $NOTIFICATION_WINDOW[i][:text]
    					@status = $NOTIFICATION_WINDOW[i][:status]
    					@index = i
    					break
    				end
    			end
    		end
    		if (@update_funny_cat) && !@disposing
    			if !@down
    				@dw = @text.size
    				self.width = (@dw*10 + 32 > Graphics.width ? Graphics.width : (@dw < 10 ? ((@dw = 10); @dw*10 + 32) : @dw*10 + 32))
    				self.x = Graphics.width/2 - self.width/2
    				create_contents
    				@frame += 1 if Graphics.frame_count % 30 == 0
    				@frame_count += 1.4
    				contents.clear
    				dw = self.width - 20
    				draw_text(0, 0, dw, 32, WINDOW_NAME_QUEST, 1)
    				draw_text(0, 25, dw, 32, @text, 1)
    				if @status == WINDOW_STATUS_COMPLETE
    					change_color(text_color(24))
    				elsif @status == WINDOW_STATUS_NO_COMPLETE
    					change_color(text_color(20))
    				elsif
    					change_color(text_color(17))
    				end
    				draw_text(0, 50, dw, 32, @status, 1)
    				change_color(normal_color)
    				set_window_opacity
    				@down = true if @frame == 3
    			elsif @down
    				set_window_opacity
    				@frame -= 1 if Graphics.frame_count % 30 == 0
    				@frame_count -= 0.7
    				$NOTIFICATION_WINDOW[@index] = nil
    				reset_all if @frame == -1
    			end
    		end
    	end
    	
    	def set_window_opacity
    		self.opacity = @frame_count*3
    		self.back_opacity = @frame_count*3
    		self.contents_opacity = @frame_count*3
    	end
    	
    	def reset_all
    		@update_funny_cat = false
    		@frame = 0
    		@text = ""
    		@complete = false
    		@down = false
    		@frame_count = 0
    		@main_text = ""
    		@text = ""
    		@status = ""
    		self.opacity = 0
    		self.back_opacity = 0
    		self.contents_opacity = 0
    		for i in 0..$NOTIFICATION_WINDOW.size-1
    			if $NOTIFICATION_WINDOW[i] != nil
    				return
    			end
    		end
    		return @disposing = true
    	end
    	
    end # class Notification_Window < Window_Base
    
    class Calendar_Window_Command < Window_Command
    	include Calendar_Settings
    	
    	def initialize(x, y)
    		super
    		select($Month)
    	end
    	
    	def make_command_list
    		$month_cursor = $Month
    		$List_Year = $Year
    		$List_Day = $Day
    		MONTHS.each do |index|
    			add_command(index, index.to_sym)
    		end
    	end
    	
    	def window_width
    		return Graphics.width/3
    	end
    	
    	def window_height
    		return 2*Graphics.height/3 + 40
    	end
    	
    	def cursor_up(wrap = true)
    		$month_cursor -= 1
    		if $month_cursor < 0
    			$month_cursor = MONTHS.size-1
    		end
    		select($month_cursor)
    		$List_Day = Time_Settings::DAYS[$month_cursor] if $List_Day > Time_Settings::DAYS[$month_cursor]
    	end
    	
    	def cursor_down(wrap = true)
    		$month_cursor += 1
    		if $month_cursor > MONTHS.size-1
    			$month_cursor = 0
    		end
    		select($month_cursor)
    		$List_Day = Time_Settings::DAYS[$month_cursor] if $List_Day > Time_Settings::DAYS[$month_cursor]
    	end
    	
    	def cursor_pagedown
    		Functions.cursor_pagedown
    	end
    	
    	def cursor_pageup
    		Functions.cursor_pageup
    	end
    	
    	def cursor_left(wrap = true)
    		Functions.cursor_left
    		select($month_cursor)
    	end
    	
    	def cursor_right(wrap = true)
    		Functions.cursor_right
    		select($month_cursor) 
    	end
    	
    	def update
    		if Input.trigger?(:Z)
    			$month_cursor = $Game_Time.month
    			$List_Day = $Game_Time.day
    			$FIRST_DAY = $CURRENT_FIRST_DAY if $List_Year != $Year
    			$List_Year = $Game_Time.year
    			select($month_cursor)
    		end
    		super
    	end
    	
    end # Calendar_Window_Command < Window_Command
    
    class Calendar_Scene_Map_Window < Window_Base
    	include Calendar_Settings, CalVocab
    	
    	def initialize(x = 0, y = 0, w = Graphics.width, h = Graphics.height)
    		super(x, y, w, h)
    		@now_sec = $Game_Time.sec
    		@now_min = $Game_Time.min
    		@now_hour = $Game_Time.hour
    		@draw, @fade = false, false
    		Functions.transfer?
    		draw_info
    	end
    	
    	def blink(k, i)
    		return draw_text(0, k*25, 216, 32, "") if Graphics.frame_count % TIME_UPDATE*2 > TIME_UPDATE 
    		return draw_text(0, k*25, 216, 32, $QUESTS[i][:text])
    	end
    	
    	def draw_now_quests
    		k = 0
    		for i in 0..$QUESTS.size - 1
    			if $QUESTS[i] != nil
    				if $QUESTS[i][:date] == $Game_Time.day && $QUESTS[i][:month] == $Game_Time.month && $QUESTS[i][:year] == $Game_Time.year
    					if $QUESTS[i][:hour] == ($Game_Time.hour + 1) % HOURS_IN_DAY && $Game_Time.min >= MINUTES_IN_HOUR - $CALENDAR_NOTIFY
    						change_color(text_color(20))
    						@fade = true
    					end
    					!@fade ? draw_text(0, k*25, 216, 32, $QUESTS[i][:text]) : blink(k, i)
    					k += 1
    					change_color(normal_color)
    					@fade = false
    				end
    			end
    		end
    		return false if k == 0
    		return true
    	end
    	
    	def draw_info
    		change_color(normal_color)
    		if @now_day != $Game_Time.day
    			@now_day = $Game_Time.day
    			Functions.transfer?
    		end
    		@draw = draw_now_quests
    		draw_text(10, 20, 210, 32, GAME_NO_INFO) if @draw == false
    	end
    	
    	def update
    		return if @now_sec == $Game_Time.sec && $TIME_SPEED > 1 && !$STOP_TIME_UPDATE
    		return if (@now_min == $Game_Time.min || $Game_Time.sec % 5 == 1) && $TIME_SPEED == 1 && !$STOP_TIME_UPDATE
    		@now_sec = $Game_Time.sec
    		@now_min = $Game_Time.min
    		Functions.complete? if @now_hour != $Game_Time.hour
    		@now_hour = $Game_Time.hour
    		contents.clear
    		change_color(normal_color)
    		@fade = false
    		draw_info
    	end
    	
    end # Calendar_Scene_Map_Window


    Банковская система
    Автор: Я (Денис Кузнецов)
    Версия: 1.0alpha от 27.10.14
    Тип: Добавляющий возможности

    Описание:

    Аддон к Время/Дата В игре появляется банк, где можно брать кредиты и оформлять вклады.

    Особенности:

    Есть множество настроек, анимация окон, а также присутствует система репутации

    Использование:
    Вся инструкция и настройки в шапке скрипта!

    Скрипт:

    Спойлер Код:
    Код:
    if $imported["DenKyz_CalTime"]
     
    =begin
    ###############################################################################
    #                                                                             #
    #          								   Банковская система                               #
    #                                                                             #
    ###############################################################################	
     
    Автор: Денис Кузнецов (http://vk.com/id8137201)
    Версия: 1.0 alpha
    Релиз от: 27.10.14
    Зависимость: Game_Time by Denis Kyznetsov (минимум 5.0 версия)
    Установка: разместить ниже Game_Time (Время/Дата)
     
    	Инструкция: 
    	call_bank(value1, value2) - чтобы вызвать банк
    	value1 - проценты по вкладам, value2 - проценты по кредитам
     
    	add_bank_reputation(value) - чтобы изменить репутацию
    =end
     
    	module Bank_Settings
    		# Название Банка
    		BANK_NAME = "Государственный Банк"
    		# Минимальная сумма вклада
    		MINIMUM_HOLDING = 100
    		# Минимальная сумма кредита
    		MINIMUM_CREDIT = 100
    		# Максимальная сумма вклада
    		HOLDING_MAXIMUM = 100000
    		# Максимальная сумма кредита
    		CREDIT_MAXIMUM = 100000
    		# Минимальный порог репутации, когда вы можете получить кредит
    		REPUTATION_MINIMUM = -50
    		# Скорость текста (верхнего). Чем меньше, тем быстрее
    		TEXT_SPEED1 = 2
    		# Прокрутка текста сверху влево ? true/false. false - вправо
    		SCROLL_TEXT1 = true
    		# Настройка верхнего текста. "Приветствие" - зарезервированное слово и окно
    		# отображает "Добро пожаловать в /название банка/"
    		# "Информация по вкладам" - "Проценты по вкладам начисляются в конце каждого месяца"
    		# "Информация по кредитам" - "Сумма по кредиту списывается ежемесячно"
    		# "Предупреждение" - "За просроченный кредит каждый день идут проценты"
    		CUSTOM_TEXT1 = ["Приветствие", "Информация по вкладам", "Информация по кредитам", "Предупреждение"]
    		# Скорость текста (нижнего). Чем меньше, тем быстрее
    		TEXT_SPEED2 = 1
    		# Прокрутка текста снизу влево ? true/false. false - вправо
    		SCROLL_TEXT2 = true
    		# Настройка нижнего текста. "Дата" - отображает "Сегодня: /текущая дата/"
    		# "Вклады_%" отображает "Проценты по вкладам: до /проценты/"
    		# "Кредиты_% - "Проценты по кредитам: до /проценты/"
    		CUSTOM_TEXT2 = ["Дата", "Вклады_%", "Кредиты_%"]
    		#### КОНЕЦ НАСТРОЙКИ #### Ниже не трогать ! Аррррр ###########################
    	end
     
    	class Bank_System_Scene < Scene_Base
    		include Bank_Settings
    		def start
    			super
    			@exit = false
    			@last_confirm_window = false
    			@add_window = false
    			create_all_windows
    		end
     
    		def create_all_windows
    			create_help_window
    			create_remote_window
    			create_all_info_window
    			create_before_operation_info_window
    			create_additional_window
    			create_add_holding_or_add_credit
    			create_add_to_holding_or_close_credit_bank_window
    			create_confirm_window
    		end
     
    		def create_help_window
    			@create_help_window = Help_Bank_Window.new(0, 0, Graphics.width, 50, 1)
    			@create_help_window.ox = Graphics.width * (SCROLL_TEXT1 ? -1 : 1)
    			@create_help_window.arrows_visible = false
    		end
     
    		def create_remote_window
    			@create_remote_window = Remote_Bank_Window.new(0, 50)
    			@create_remote_window.set_handler(:holdings, method(:holdings))
    			@create_remote_window.set_handler(:credits, method(:credits))
    			@create_remote_window.set_handler(:exit, method(:exit))
    			@create_remote_window.set_handler(:add_holding, method(:add_holding))
    			@create_remote_window.set_handler(:add_credit, method(:add_credit))
    			@create_remote_window.set_handler(:add_to_holding, method(:add_to_holding))
    			@create_remote_window.set_handler(:close_holding, method(:close_holding))
    			@create_remote_window.set_handler(:close_credit, method(:close_credit))
    		end
     
    		def create_all_info_window
    			@create_money_info_window = Money_Info_Bank_Window.new(Graphics.width/2, 100, Graphics.width/2, 100)
    			@create_money_info_window.x = Graphics.width
    			@create_info_window = Info_Bank_Window.new(0, 100, Graphics.width/2, 100)
    			@create_info_window.x = -Graphics.width
    			@create_first_before_operation_info_bank_window = First_Before_Operation_Info_Bank_Window.new(0, 200, Graphics.width, Graphics.height - 250)
    			@create_first_before_operation_info_bank_window.opacity = 0
    			@create_first_before_operation_info_bank_window.contents_opacity = 0
    			@start_scene_animation_update = true
    		end
     
    		def create_before_operation_info_window
    			@create_before_operation_info_window = Before_Operation_Info_Bank_Window.new(0, 200, Graphics.width, Graphics.height - 250)
    			@create_before_operation_info_window.x = -Graphics.width
    			@create_before_operation_info_window.hide
    		end
     
    		### самое нижнее окно с бегущей строкой
    		def create_additional_window
    			@create_additional_window = Help_Bank_Window.new(0, Graphics.height - 50, Graphics.width, 50, 2)
    			@create_additional_window.ox = Graphics.width * (SCROLL_TEXT2 ? -1 : 1) ###
    			@create_additional_window.arrows_visible = false
    		end
     
    		### окно добавления к вкладу/погашения кредита
    		def create_add_to_holding_or_close_credit_bank_window
    			@create_add_to_holding_or_close_credit_bank_window = Add_to_Holding_Or_Close_Credit_Bank_Window.new(0, 200)
    			@create_add_to_holding_or_close_credit_bank_window.set_handler(:money, method(:add_to_holding_or_close_credit))
    			@create_add_to_holding_or_close_credit_bank_window.set_handler(:confirm_yes, method(:confirm_add_to_holding_or_close_credit))
    			@create_add_to_holding_or_close_credit_bank_window.set_handler(:confirm_no, method(:add_window_down_animation))
    			@create_add_to_holding_or_close_credit_bank_window.x = Graphics.width
    			@create_add_to_holding_or_close_credit_bank_window.deactivate
    			@create_add_to_holding_or_close_credit_bank_window.hide
    		end
     
    		### окно получения вклада/кредита
    		def create_add_holding_or_add_credit
    			@create_add_holding_or_add_credit = Add_Holding_Or_Add_Credit_Bank_Window.new(0, 200)
    			@create_add_holding_or_add_credit.set_handler(:month1, method(:month))
    			@create_add_holding_or_add_credit.set_handler(:month3, method(:month))
    			@create_add_holding_or_add_credit.set_handler(:month6, method(:month))
    			@create_add_holding_or_add_credit.set_handler(:month12, method(:month))
    			@create_add_holding_or_add_credit.set_handler(:money, method(:money))
    			@create_add_holding_or_add_credit.set_handler(:holding_credit_no, method(:layer_2_down))
    			@create_add_holding_or_add_credit.set_handler(:holding_credit_yes, method(:confirm_holding_credit))
    			@create_add_holding_or_add_credit.y = 50
    			@create_add_holding_or_add_credit.deactivate
    			@create_add_holding_or_add_credit.hide
    		end
     
    		### создание последнего окна
    		def create_confirm_window
    			@create_notification_bank_window = Notification_Bank_Window.new
    			@create_notification_bank_window.y = 200 + @create_add_holding_or_add_credit.height
    			@create_notification_bank_window.opacity = 0
    			@create_notification_bank_window.contents_opacity = 0
    			@create_notification_bank_window.hide
    			@create_notification_bank_window.deactivate
    			@create_notification_bank_window.set_handler(:last_confirm, method(:last_confirm))
    			@create_notification_bank_window.set_handler(:last_confirm_no, method(:last_window_confirm_no))
    		end
     
    		### обработка последнего окна, получение вклада/кредита
    		def last_confirm
    			case @create_notification_bank_window.mode
    			when 1
    				$Player_Holding[0] = @create_notification_bank_window.money
    				$Player_Holding[1] = @create_notification_bank_window.percent
    				$Player_Holding[2] = @create_notification_bank_window.final_sum
    				$Player_Holding[3] = @create_notification_bank_window.month
    				$game_party.gain_gold(-$Player_Holding[0])
    			when 2
    				$Player_Credit[0] = @create_notification_bank_window.credit_final * @create_notification_bank_window.month 
    				$Player_Credit[1] = @create_notification_bank_window.percent
    				$Player_Credit[2] = @create_notification_bank_window.credit_final
    				$Player_Credit[3] = @create_notification_bank_window.month
    				$game_party.gain_gold(@create_notification_bank_window.money)
    			end
    			last_window_confirm_animation
    		end
     
    		def confirm_add_to_holding_or_close_credit
    			case @create_add_to_holding_or_close_credit_bank_window.mode
    			when 1
    				$Player_Holding[0] += @create_add_to_holding_or_close_credit_bank_window.money
    				$game_party.gain_gold(-@create_add_to_holding_or_close_credit_bank_window.money)
    			when 2
    				$Player_Credit[0] -= @create_add_to_holding_or_close_credit_bank_window.money
    				$game_party.gain_gold(-@create_add_to_holding_or_close_credit_bank_window.money)
    				$Bank_Reputation += 3 * $Player_Credit[3] if $Player_Credit[3] > 0
    				$Player_Credit = [] if $Player_Credit[0] == 0
    				@create_before_operation_info_window.mode = 1
    				@create_before_operation_info_window.text = "кредита"
    			end
    			$bank_remote_cursor = 0
    			@create_info_window.update(true)
    			@create_before_operation_info_window.update(true)
    			@create_add_to_holding_or_close_credit_bank_window.layer = 1
    			@create_add_to_holding_or_close_credit_bank_window.money = 0
    			@create_add_to_holding_or_close_credit_bank_window.deactivate
    			@create_before_operation_info_window.show
    			@add_window = false
    			@window_animation = 5
    			$bank_animation_update = true
    			update_remote_window
    		end
     
    		### обработка продолжения вклада/кредита
    		def confirm_holding_credit
    			@last_confirm_window = true
    			@create_add_holding_or_add_credit.deactivate
    			@create_notification_bank_window.activate
    			@create_notification_bank_window.show
    			@window_animation = 7
    			$bank_animation_update = true
    			@create_notification_bank_window.mode = @create_add_holding_or_add_credit.text == "вклада" ? 1 : 2
    			@create_notification_bank_window.no_money = false
    			@create_notification_bank_window.no_money = true if @create_add_holding_or_add_credit.money < MINIMUM_HOLDING && @create_notification_bank_window.mode == 1
    			@create_notification_bank_window.no_money = true if @create_add_holding_or_add_credit.money < MINIMUM_CREDIT && @create_notification_bank_window.mode == 2
    			if @create_notification_bank_window.no_money
    				@create_notification_bank_window.deactivate
    				@create_notification_bank_window.refresh
    				return
    			end
    			@create_notification_bank_window.money = @create_add_holding_or_add_credit.money
    			case @create_add_holding_or_add_credit.month
    			when :month1
    				@create_notification_bank_window.month = 1
    			when :month3
    				@create_notification_bank_window.month = 3
    			when :month6
    				@create_notification_bank_window.month = 6
    			when :month12
    				@create_notification_bank_window.month = 12
    			end
    			@create_notification_bank_window.refresh
    			@create_notification_bank_window.select(0)
    		end
     
    		### обработка выбора месяца
    		def month
    			@create_add_holding_or_add_credit.layer = 2
    			@create_add_holding_or_add_credit.activate
    		end
     
    		### обработка ввода денег
    		def money
    			@create_add_holding_or_add_credit.layer = 3
    			@create_add_holding_or_add_credit.select(5)
    			@create_add_holding_or_add_credit.activate
    		end
     
    		# отключаем 3 команды, включаем оформление вклада
    		def add_holding
    			@create_remote_window.deactivate
    			@create_add_holding_or_add_credit.text = "вклада"
    			@create_add_holding_or_add_credit.activate
    			@create_add_holding_or_add_credit.show
    			@create_add_holding_or_add_credit.opacity = 0
    			@create_add_holding_or_add_credit.contents_opacity = 0
    			@window_animation = 3
    			$bank_animation_update = true
    			@operation = true
    		end
     
    		# отключаем 3 команды, включаем добавление денег к вкладу
    		def add_to_holding
    			@create_remote_window.deactivate
    			@create_add_to_holding_or_close_credit_bank_window.mode = 1
    			@create_add_to_holding_or_close_credit_bank_window.refresh
    			@create_add_to_holding_or_close_credit_bank_window.select(0)
    			@create_add_to_holding_or_close_credit_bank_window.activate
    			@create_add_to_holding_or_close_credit_bank_window.show
    			@window_animation = 2
    			$bank_animation_update = true
    			@add_window = true
    		end
     
    		def add_to_holding_or_close_credit
    			@create_add_to_holding_or_close_credit_bank_window.layer = 2
    			@create_add_to_holding_or_close_credit_bank_window.refresh
    			@create_add_to_holding_or_close_credit_bank_window.select(1)
    			@create_add_to_holding_or_close_credit_bank_window.activate
    		end
     
    		def close_holding
    			$game_party.gain_gold($Player_Holding[0])
    			$bank_remote_cursor = 0
    			$Player_Holding = []
    			@create_info_window.update(true)
    			@create_before_operation_info_window.mode = 1
    			@create_before_operation_info_window.text = "открыть вклад"
    			@create_before_operation_info_window.update(true)
    			update_remote_window
    		end
     
    		# отключаем 3 команды, включаем оформление кредита
    		def add_credit
    			add_holding
    			@create_add_holding_or_add_credit.text = "кредита"
    		end
     
    		# отключаем 3 команды, включаем закрытие кредита
    		def close_credit
    			@create_remote_window.deactivate
    			@create_add_to_holding_or_close_credit_bank_window.mode = 2
    			@create_add_to_holding_or_close_credit_bank_window.refresh
    			@create_add_to_holding_or_close_credit_bank_window.select(0)
    			@create_add_to_holding_or_close_credit_bank_window.activate
    			@create_add_to_holding_or_close_credit_bank_window.show
    			@window_animation = 2
    			$bank_animation_update = true
    			@add_window = true
    		end
     
    		# активируем команды для вкладов, обновляем окно и переключаем окно
    		def holdings
    			@create_remote_window.remote_list = 2
    			update_remote_window
    			@create_before_operation_info_window.mode = 1
    			@create_before_operation_info_window.text = "открыть вклад"
    			@create_before_operation_info_window.mode = 2 if $Player_Holding != []
    			@window_animation = 1
    			holding_and_credits
    			$bank_animation_update = true
    		end
     
    		# активируем команды для кредитов, обновляем окно и переключаем окно
    		def credits
    			@create_remote_window.remote_list = 3
    			update_remote_window
    			@create_before_operation_info_window.mode = 1
    			@create_before_operation_info_window.text = "взять кредит"
    			@create_before_operation_info_window.mode = 2 if $Player_Credit != []
    			@window_animation = 1
    			holding_and_credits
    			$bank_animation_update = true
    		end
     
    		def holding_and_credits
    			@create_before_operation_info_window.x = -Graphics.width
    			@create_before_operation_info_window.update(true)
    			@create_before_operation_info_window.show
    		end
     
    		def layer_2_down
    			@create_add_holding_or_add_credit.money = 0 if @create_add_holding_or_add_credit.layer == 3
    			@create_add_holding_or_add_credit.layer = 1
    			@create_add_holding_or_add_credit.refresh
    			@create_add_holding_or_add_credit.select(0)
    			@create_add_holding_or_add_credit.activate
    		end
     
    		### обработка esc для окна подтверждения - последнего окна
    		def last_window_confirm_no
    			last_window_down
    			layer_2_down
    		end
     
    		### запуск анимации для последнего окна
    		def last_window_down
    			@window_animation = 8
    			$bank_animation_update = true
    			@last_confirm_window = false
    			@create_notification_bank_window.deactivate
    			@create_add_holding_or_add_credit.activate
    			@create_add_holding_or_add_credit.show
    		end
     
    		# обновляем окно с 3 командами
    		def update_remote_window
    			@create_remote_window.refresh
    			@create_remote_window.select(0)
    			@create_remote_window.activate
    		end
     
    		# обработка нажатия выход
    		def exit
    			return @exit = true
    		end
     
    		# обработка нажатия кнопки esc на всех этапах
    		def update_list_down
    			return exit if @create_remote_window.remote_list == 1
    			if !@operation && !@last_confirm_window && !@add_window
    				@create_remote_window.remote_list = 1 
    				update_remote_window
    				@window_animation += 3
    				$bank_animation_update = true
    				@create_first_before_operation_info_bank_window.show
    			elsif @operation && @create_add_holding_or_add_credit.layer == 1 && !@last_confirm_window
    				operation_window_down
    			elsif @operation && @create_add_holding_or_add_credit.layer == 2 && !@last_confirm_window
    				layer_2_down
    			elsif @operation && @create_add_holding_or_add_credit.layer == 3 && !@last_confirm_window
    				month
    			elsif @last_confirm_window
    				last_window_down
    			elsif @add_window && @create_add_to_holding_or_close_credit_bank_window.layer == 1
    				update_remote_window
    				@window_animation = 5
    				$bank_animation_update = true
    				@create_before_operation_info_window.show
    				@add_window = false
    			elsif @add_window && @create_add_to_holding_or_close_credit_bank_window.layer == 2
    				add_window_down_animation
    			end
    		end
     
    		def add_window_down_animation
    			@create_add_to_holding_or_close_credit_bank_window.layer = 1
    			@create_add_to_holding_or_close_credit_bank_window.refresh
    			@create_add_to_holding_or_close_credit_bank_window.select(0)
    		end
     
    		def operation_window_down
    			@create_before_operation_info_window.show
    			@create_add_holding_or_add_credit.deactivate
    			@create_remote_window.activate
    			@window_animation = 6
    			$bank_animation_update = true
    			@operation = false
    		end
     
    		def last_window_confirm_animation
    			@create_notification_bank_window.deactivate
    			@create_add_holding_or_add_credit.select(0)
    			@create_add_holding_or_add_credit.deactivate
    			@create_add_holding_or_add_credit.layer = 1
    			@create_add_holding_or_add_credit.money = 0
    			@operation = false
    			@last_confirm_window = false
    			@create_remote_window.remote_list = 1
    			@create_first_before_operation_info_bank_window.show
    			update_remote_window
    			@create_before_operation_info_window.x = -Graphics.width
    			@create_before_operation_info_window.opacity = 255
    			@create_before_operation_info_window.contents_opacity = 255
    			@create_before_operation_info_window.y = 200
    			@create_notification_bank_window.y = 200 + @create_notification_bank_window.height
    			@window_animation = 9
    			$bank_animation_update = true
    			@create_info_window.update(true)
    		end
     
    		def update
    			super
    			if @start_scene_animation_update
    				@create_info_window.x += 15
    				@create_money_info_window.x -= 8
    				@create_first_before_operation_info_bank_window.opacity += 8
    				@create_first_before_operation_info_bank_window.contents_opacity += 8
    				@create_help_window.opacity += 10
    				@create_additional_window.opacity += 10
    				if @create_money_info_window.x <= Graphics.width/2
    					@create_info_window.x = 0
    					@create_money_info_window.x = Graphics.width/2
    					@create_first_before_operation_info_bank_window.opacity = 255
    					@create_first_before_operation_info_bank_window.contents_opacity = 255
    					@start_scene_animation_update = false
    				end
    			end
    			### обновление прокрутки текста
    			if Graphics.frame_count % Bank_Settings::TEXT_SPEED1 == 0
    				@create_help_window.ox -= 1 * (SCROLL_TEXT1 ? -1 : 1)
    				if @create_help_window.ox == -Graphics.width * (SCROLL_TEXT1 ? -1 : 1)
    					@create_help_window.ox = Graphics.width * (SCROLL_TEXT1 ? -1 : 1)
    					@create_help_window.number_text += 1
    					@create_help_window.number_text = 0 if @create_help_window.number_text >= CUSTOM_TEXT1.size
    				end
    			end
    			### обновление прокрутки текста
    			if Graphics.frame_count % Bank_Settings::TEXT_SPEED2 == 0
    				@create_additional_window.ox -= 1 * (SCROLL_TEXT2 ? -1 : 1)
    				if @create_additional_window.ox == -Graphics.width * (SCROLL_TEXT2 ? -1 : 1)
    					@create_additional_window.ox = Graphics.width * (SCROLL_TEXT2 ? -1 : 1)
    					@create_additional_window.number_text += 1
    					@create_additional_window.number_text = 0 if @create_additional_window.number_text >= CUSTOM_TEXT2.size
    				end
    			end
     
    			if $bank_animation_update
    				case @window_animation
    				when 1 ### включение 2-ого окна
    					@create_first_before_operation_info_bank_window.x += 15
    					@create_before_operation_info_window.x += 15
    					if @create_before_operation_info_window.x >= 0
    						@create_before_operation_info_window.x = 0
    						@create_first_before_operation_info_bank_window.x = Graphics.width
    						@create_first_before_operation_info_bank_window.hide
    						$bank_animation_update = false
    					end
    				when 2 ### включение 3-ого окна
    					@create_add_to_holding_or_close_credit_bank_window.x -= 15
    					@create_before_operation_info_window.x -= 15
    					if @create_add_to_holding_or_close_credit_bank_window.x < 0
    						@create_add_to_holding_or_close_credit_bank_window.x = 0
    						@create_before_operation_info_window.x = -Graphics.width
    						@create_before_operation_info_window.hide
    						$bank_animation_update = false
    					end
    				when 3 ### включение 4-ого окна
    					@create_add_holding_or_add_credit.y += 4
    					@create_before_operation_info_window.y += 4
    					@create_add_holding_or_add_credit.opacity += 17
    					@create_add_holding_or_add_credit.contents_opacity += 17
    					@create_before_operation_info_window.opacity -= 17
    					@create_before_operation_info_window.contents_opacity -= 17
    					if @create_add_holding_or_add_credit.y >= 200
    						@create_add_holding_or_add_credit.y = 200
    						@create_before_operation_info_window.y = 200 + @create_add_holding_or_add_credit.height
    						@create_before_operation_info_window.opacity = 0
    						@create_before_operation_info_window.contents_opacity = 0
    						@create_before_operation_info_window.hide
    						$bank_animation_update = false
    					end
    				when 4 ### выключение 2-ого окна
    					@create_before_operation_info_window.x -= 15
    					@create_first_before_operation_info_bank_window.x -= 15
    					if @create_first_before_operation_info_bank_window.x <= 0
    						@create_first_before_operation_info_bank_window.x = 0
    						@create_before_operation_info_window.x = -Graphics.width
    						@create_before_operation_info_window.hide
    						$bank_animation_update = false
    					end
    				when 5 ### выключение 3-ого окна
    					@create_add_to_holding_or_close_credit_bank_window.x += 15
    					@create_before_operation_info_window.x += 15
    					if @create_add_to_holding_or_close_credit_bank_window.x >= Graphics.width
    						@create_add_to_holding_or_close_credit_bank_window.x = Graphics.width
    						@create_before_operation_info_window.x = 0
    						@create_add_to_holding_or_close_credit_bank_window.deactivate
    						@create_add_to_holding_or_close_credit_bank_window.hide
    						@window_animation = 1
    						$bank_animation_update = false
    					end
    				when 6 ### выключение 4-ого окна
    					@create_add_holding_or_add_credit.y -= 4
    					@create_before_operation_info_window.y -= 4
    					@create_before_operation_info_window.opacity += 17
    					@create_before_operation_info_window.contents_opacity += 17
    					@create_add_holding_or_add_credit.opacity -= 17
    					@create_add_holding_or_add_credit.contents_opacity -= 17
    					if @create_before_operation_info_window.y <= 200
    						@create_before_operation_info_window.y = 200
    						@create_add_holding_or_add_credit.y = 50
    						@create_add_holding_or_add_credit.opacity = 0
    						@create_add_holding_or_add_credit.contents_opacity = 0
    						@create_add_holding_or_add_credit.hide
    						$bank_animation_update = false
    						@window_animation = 1
    					end
    				when 7 ### открытие 5-ого окна
    					@create_add_holding_or_add_credit.y -= 4
    					@create_notification_bank_window.y -= 4
    					@create_notification_bank_window.opacity += 17
    					@create_notification_bank_window.contents_opacity += 17
    					@create_add_holding_or_add_credit.opacity -= 17
    					@create_add_holding_or_add_credit.contents_opacity -= 17
    					if @create_notification_bank_window.y <= 200
    						@create_notification_bank_window.y = 200
    						@create_add_holding_or_add_credit.y = 50
    						@create_add_holding_or_add_credit.hide
    						$bank_animation_update = false
    					end
    				when 8 ### закрытие 5-ого окна
    					@create_add_holding_or_add_credit.y += 4
    					@create_notification_bank_window.y += 4
    					@create_add_holding_or_add_credit.opacity += 17
    					@create_add_holding_or_add_credit.contents_opacity += 17
    					@create_notification_bank_window.opacity -= 17
    					@create_notification_bank_window.contents_opacity -= 17
    					if @create_add_holding_or_add_credit.y >= 200
    						@create_add_holding_or_add_credit.y = 200
    						@create_notification_bank_window.y = 200 + @create_add_holding_or_add_credit.height
    						@create_notification_bank_window.opacity = 0
    						@create_notification_bank_window.contents_opacity = 0
    						@create_notification_bank_window.hide
    						$bank_animation_update = false
    					end
    				when 9 ### получен вклад/кредит
    					@create_notification_bank_window.opacity -= 7
    					@create_notification_bank_window.contents_opacity -= 7
    					@create_first_before_operation_info_bank_window.x -= 15
    					if @create_first_before_operation_info_bank_window.x <= 0
    						@create_first_before_operation_info_bank_window.x = 0
    						@create_notification_bank_window.opacity = 0
    						@create_notification_bank_window.contents_opacity = 0
    						@create_notification_bank_window.hide
    						$bank_animation_update = false
    					end
    				end
    			end
     
    			if @bank_cursor != $bank_remote_cursor && 
    				((@create_remote_window.remote_list == 2 && $Player_Holding == []) || 
    					(@create_remote_window.remote_list == 3 && $Player_Credit == []))
    				@bank_cursor = $bank_remote_cursor
    				@create_before_operation_info_window.update(true)
    			end
     
    			if Input.trigger?(:B) || @exit
    				return if $bank_animation_update
    				if !@exit
    					update_list_down
    					Sound.play_cancel
    					return
    				end
    				@exit = false
    				return_scene
    			end
    		end
    	end
     
    	#### ОКНА ######################################################################
    	class First_Before_Operation_Info_Bank_Window < Window_Base
    		def initialize(x, y, w, h)
    			super(x, y, w, h)
    			update(true)
    		end
     
    		def update(upd = false)
    			return if !upd
    			contents.clear
    			draw_text(0, 0, Graphics.width - 16, 30, "Приветсвуем Вас в нашем банке", 1)
    			draw_text(0, (Graphics.height - 250)/3 - 5, Graphics.width - 16, 30, "Вы можете открыть у нас свой вклад или", 1)
    			draw_text(0, (Graphics.height - 250)/3 + 15, Graphics.width - 16, 30, "оформить кредит на выгодных условиях", 1)
    		end
    	end
     
    	class Help_Bank_Window < Window_Base
    		include Bank_Settings
    		attr_accessor :number_text
    		def initialize(x, y, w, h, mode)
    			@number_text, @hello_world_text = 0, 0
    			@mode = mode
    			super(x, y, w, h)
    			update(true)
    		end
     
    		def text
    			case @mode
    			when 1
    				case CUSTOM_TEXT1[@number_text]
    				when "Приветствие"
    					return "Добро пожаловать в " + BANK_NAME
    				when "Информация по вкладам"
    					return "Проценты по вкладам начисляются в конце каждого месяца"
    				when "Информация по кредитам"
    					return "Сумма по кредиту списывается ежемесячно"
    				when "Предупреждение"
    					return "За просроченный кредит каждый день идут проценты"
    				else
    					return CUSTOM_TEXT1[@number_text]
    				end
    			when 2
    				case CUSTOM_TEXT2[@number_text]
    				when "Дата"
    					return "Сегодня: " + $Game_Time.day.to_s + " " + Calendar_Settings::CALENDAR_MONTHS[$Game_Time.month] +
    					" " + $Game_Time.year.to_s + " г."
    				when "Вклады_%"
    					return "Проценты по вкладам: до " + $Bank_Settings[0].to_s + " %"
    				when "Кредиты_%"
    					return "Проценты по кредитам: до " + $Bank_Settings[1].to_s + " %"
    				else
    					return CUSTOM_TEXT2[@number_text]
    				end
    			end
    		end
     
    		def create_contents
    			self.contents = Bitmap.new(Graphics.width*1.4, Graphics.height)
    		end
     
    		def update(upd = false)
    			if @hello_world_text != @number_text
    				@hello_world_text = @number_text
    				upd = true
    			end
    			return if !upd
    			contents.clear
    			contents.font.size = 26
    			draw_text(0, -2, Graphics.width*1.25, 30, text)
    		end
    	end
     
    	class Remote_Bank_Window < Window_HorzCommand
    		attr_accessor :remote_list
    		def initialize(x, y)
    			@remote_list = 1
    			super(x, y)
    		end
     
    		def process_handling
    			super if !$bank_animation_update
    		end
     
    		def col_max
    			return 3
    		end
     
    		def window_width
    			Graphics.width
    		end
     
    		def window_height
    			50
    		end
     
    		def make_command_list
    			$bank_remote_cursor = 0
    			case @remote_list
    			when 1
    				add_command("Вклады", :holdings)
    				add_command("Кредиты", :credits)
    			when 2
    				text = "Открыть вклад"
    				symbol = :add_holding
    				if $Player_Holding != []
    					text = "Добавить к вкладу" 
    					symbol = :add_to_holding
    				end
    				add_command(text, symbol)
    				enable = true
    				enable = false if $Player_Holding == []
    				add_command("Закрыть вклад", :close_holding, enable)
    			when 3
    				enable = true
    				enable = false if $Player_Credit == []
    				add_command("Взять кредит", :add_credit, ($Bank_Reputation > Bank_Settings::REPUTATION_MINIMUM && !enable) ? true : false)
    				add_command("Погасить кредит", :close_credit, enable)
    			end
    			add_command("Выход", :exit)
    		end
     
    		def cursor_left(wrap = false)
    			$bank_remote_cursor -= 1
    			$bank_remote_cursor = 2 if $bank_remote_cursor == -1
    			select($bank_remote_cursor)
    		end
     
    		def cursor_right(wrap = false)
    			$bank_remote_cursor += 1
    			$bank_remote_cursor = 0 if $bank_remote_cursor == 3
    			select($bank_remote_cursor)
    		end
    	end # class Remote_Bank_Window < Window_HorzCommand
     
    	class Info_Bank_Window < Window_Base
    		def initialize(x, y, w, h)
    			super(x, y, w, h)
    			@provetka_holding = $Player_Holding.nil?
    			@proverka_credit = $Player_Credit.nil?
    			update(true)
    		end
     
    		def update(upd = false)
    			return if !upd
    			contents.clear
    			casing = 1 if $Player_Holding != [] && $Player_Credit == []
    			casing = 2 if $Player_Holding == [] && $Player_Credit != []
    			casing = 3 if $Player_Holding == [] && $Player_Credit == []
    			casing = 4 if $Player_Holding != [] && $Player_Credit != []
    			case casing
    			when 1
    				draw_text(0, 10, 240, 30, "Ваш вклад: ")
    				draw_text(0, 10, 240, 30, $Player_Holding[0].to_s + " " + Vocab::currency_unit, 2)
    				draw_text(0, 35, 240, 30, "У вас нет кредита", 1)
    			when 2
    				draw_text(0, 10, 240, 30, "Ваш кредит: ")
    				draw_text(0, 10, 240, 30, $Player_Credit[0].to_s + " " + Vocab::currency_unit, 2)
    				draw_text(0, 35, 240, 30, "У вас нет вклада", 1)
    			when 3
    				draw_text(-10, 20, 260, 30, "У вас нет вкладов/кредитов", 1)
    			when 4
    				draw_text(0, 10, 240, 30, "Ваш вклад: ")
    				draw_text(0, 10, 240, 30, $Player_Holding[0].to_s + " " + Vocab::currency_unit, 2)
    				draw_text(0, 35, 240, 30, "Ваш кредит: ")
    				draw_text(0, 35, 240, 30, $Player_Credit[0].to_s + " " + Vocab::currency_unit, 2)
    			end
    			@provetka_holding = false
    			@proverka_credit = false
    		end
    	end # class Info_Bank_Window < Window_Base
     
    	class Money_Info_Bank_Window < Window_Base
    		def initialize(x, y, w, h)
    			super(x, y, w, h)
    			@money = -1
    			@reputation = 0
    		end
     
    		def update
    			if @reputation != $Bank_Reputation || @money != $game_party.gold
    				@reputation = $Bank_Reputation
    				@money = $game_party.gold
    				contents.clear
    				draw_text(0, 5, Graphics.width/3, 30, "Ваша репутация: ")
    				$Bank_Reputation > 0 ? change_color(text_color(24)) : change_color(text_color(20))
    				change_color(normal_color) if $Bank_Reputation == 0
    				draw_text(-30, 5, Graphics.width/2, 30, $Bank_Reputation.to_s, 2)
    				change_color(normal_color)
    				draw_text(0, 35, Graphics.width/3, 30, "У Вас: ")
    				draw_text(-30, 35, Graphics.width/2, 30, $game_party.gold.to_s + " " + Vocab::currency_unit, 2)
    			end
    		end
     
    	end # class Money_Info_Bank_Window < Window_Base
     
    	class Before_Operation_Info_Bank_Window < Window_Base
    		include Bank_Settings
    		attr_accessor :text
    		attr_accessor :mode
    		def initialize(x, y, w, h)
    			super(x, y, w, h)
    			@text = "открыть вклад"
    			@mode = 1
    			update(true)
    		end
     
    		def width
    			return Graphics.width - standard_padding*1.5
    		end
     
    		def what?
    			return @text.include?("вклад") ? "вклады: до " + $Bank_Settings[0].to_s + " %" : "кредиты: до " + $Bank_Settings[1].to_s + " %"
    		end
     
    		def no_what?
    			return @text.include?("вклад") ? "вклада" : "кредита"
    		end
     
    		def month(month)
    			case month
    			when 1
    				" месяц "
    			when 2..4
    				" месяца "
    			when 5..12
    				" месяцев "
    			end
    		end
     
    		def update(upd = false)
    			return if !upd
    			contents.clear
    			case @mode
    			when 1
    				if $bank_remote_cursor == 0
    					draw_text(0, 8, width, 30, "На какой период Вы хотите #{text} ?", 1)
    					draw_text(0, 38, width, 30, "У нас выгодные условия на " + what?, 1)
    					draw_text(0, 68, width, 30, "Вы можете #{text} на следующее время:", 1)
    					draw_text(0, 98, width, 30, "1 месяц,  3 месяца,  6 месяцев,  12 месяцев", 1)
    				elsif $bank_remote_cursor == 1
    					draw_text(0, 38, width, 30, "У Вас еще нет " + no_what?, 1)		
    					draw_text(0, 68, width, 30, "Мы предлагаем Вам #{text} у нас", 1)
    				elsif $bank_remote_cursor == 2
    					draw_text(0, 52, width, 30, "До свидания! Приходите к нам еще!", 1)
    				end
    			when 2
    				p $Player_Holding
    				p $Player_Credit
    				case @text
    				when "открыть вклад"
    					draw_text(0, 8, width, 30, "Текущая сумма вклада составляет: " + $Player_Holding[0].to_s + " " + Vocab::currency_unit, 1)
    					draw_text(0, 38, width, 30, "Ваша процентная ставка: " + $Player_Holding[1].to_s + " %", 1)
    					draw_text(0, 68, width, 30, "Сумма максимально возможного вклада: " + HOLDING_MAXIMUM.to_s + " " + Vocab::currency_unit, 1)
    					if $Player_Holding[3] != 0
    						draw_text(0, 98, width, 30, "Еще " + $Player_Holding[3].to_s + month($Player_Holding[3]) + "Вам будут поступать проценты", 1)
    					else
    						draw_text(0, 98, width, 30, "Срок начисления процентов по этому вкладу истек", 1)
    					end
    				else
    					draw_text(0, 8, width, 30, "Текущая сумма кредита составляет: " + $Player_Credit[0].to_s + " " + Vocab::currency_unit, 1)
    					draw_text(0, 38, width, 30, "Ваша процентная ставка: " + $Player_Credit[1].to_s + " %", 1)
    					draw_text(0, 68, width, 30, "Сумма максимально возможного кредита: " + CREDIT_MAXIMUM.to_s + " " + Vocab::currency_unit, 1)
    					draw_text(0, 98, width, 30, "Еще " + $Player_Credit[3].to_s + month($Player_Credit[3]) + "Вы должны выплачивать кредит", 1)
    				end
    			end
    		end
    	end # class Before_Operation_Info_Bank_Window < Window_Base
     
    	class Add_to_Holding_Or_Close_Credit_Bank_Window < Window_Command
    		include Bank_Settings
    		attr_accessor :layer
    		attr_accessor :money
    		attr_accessor :mode
    		def initialize(x, y)
    			@layer = 1
    			@money = 0
    			@mode = 1
    			super
    		end
     
    		def col_max
    			2
    		end
     
    		def alignment
    			2
    		end
     
    		def process_handling
    			super if @money != 0
    		end
     
    		def item_rect(index)
    			rect = Rect.new
    			rect.width = item_width
    			rect.height = item_height
    			if index == 0
    				rect.width /= 2
    				rect.x = Graphics.width - standard_padding*13
    				rect.y = 28
    			else
    				rect.width /= 5
    				if index == 1
    					rect.x = Graphics.width/2 - item_width/2 + spacing*8
    				else
    					rect.x = Graphics.width/2 + item_width/4 + spacing*4
    				end	
    				rect.y = 78
    			end
    			rect
    		end
     
    		def cursor_pagedown(wrap = false)
    			return if @layer != 1
    			@money += 1000
    			case @mode
    			when 1
    				@money = HOLDING_MAXIMUM - $Player_Holding[0] if @money > HOLDING_MAXIMUM - $Player_Holding[0]
    			when 2
    				@money = $Player_Credit[0] if @money > $Player_Credit[0]
    			end
    			@money = $game_party.gold if @money > $game_party.gold
    			refresh
    		end
     
    		def cursor_pageup(wrap = false)
    			return if @layer != 1
    			@money -= 1000
    			@money = 0 if @money < 0
    			refresh
    		end
     
    		def cursor_up(wrap = false)
    			return if @layer != 1
    			@money += 100
    			case @mode
    			when 1
    				@money = HOLDING_MAXIMUM - $Player_Holding[0] if @money > HOLDING_MAXIMUM - $Player_Holding[0]
    			when 2
    				@money = $Player_Credit[0] if @money > $Player_Credit[0]
    			end
    			@money = $game_party.gold if @money > $game_party.gold
    			refresh
    		end
     
    		def cursor_down(wrap = false)
    			return if @layer != 1
    			@money -= 100
    			@money = 0 if @money < 0
    			refresh
    		end
     
    		def cursor_left(wrap = false)
    			if @layer == 1
    				@money -= 1
    				@money = 0 if @money < 0
    			else
    				select(1)
    			end
    			refresh
    		end
     
    		def cursor_right(wrap = false)
    			if @layer == 1
    				@money += 1
    				case @mode
    				when 1
    					@money = HOLDING_MAXIMUM - $Player_Holding[0] if @money > HOLDING_MAXIMUM - $Player_Holding[0]
    				when 2
    					@money = $Player_Credit[0] if @money > $Player_Credit[0]
    				end
    				@money = $game_party.gold if @money > $game_party.gold
    			else
    				select(2)
    			end
    			refresh
    		end
     
    		def window_width
    			Graphics.width
    		end
     
    		def window_height
    			Graphics.height - 250
    		end
     
    		def width
    			Graphics.width - standard_padding*1.5
    		end
     
    		def refresh
    			super
    			draw_text(10, 25, width, 30, "Введите нужную сумму:")
    			draw_text(10, 75, width, 30, "Внести " + @money.to_s + " " + Vocab::currency_unit + " ?") if @layer == 2
    		end
     
    		def make_command_list
    			add_command(@money.to_s, :money) if @layer >= 1
    			if @layer ==2
    				add_command("Да", :confirm_yes)
    				add_command("Нет", :confirm_no)
    			end
    		end
     
    	end
     
    	class Add_Holding_Or_Add_Credit_Bank_Window < Window_Command
    		include Bank_Settings
    		attr_accessor :text
    		attr_accessor :layer
    		attr_accessor :money
    		attr_reader :month
    		def initialize(x, y)
    			@layer = 1
    			@text = "вклада"
    			@money = 0
    			@month = :month1
    			super
    		end
     
    		def alignment
    			2
    		end
     
    		def col_max
    			4
    		end
     
    		def window_width
    			Graphics.width
    		end
     
    		def window_height
    			Graphics.height - 250
    		end
     
    		def item_rect(index)
    			rect = Rect.new
    			rect.width = item_width
    			rect.height = item_height
    			rect.x = index % col_max * (item_width + spacing)
    			rect.y = 30
    			if index == 4
    				rect.x = Graphics.width - (item_width + spacing) - standard_padding
    				rect.y = 60
    			elsif index > 4
    				rect.width /= 2
    				if index == 5
    					rect.x = Graphics.width - standard_padding*12
    				else
    					rect.x = Graphics.width - standard_padding*8
    				end
    				rect.y = 90
    			end
    			rect
    		end
     
    		def width
    			Graphics.width - standard_padding*1.5
    		end
     
    		def call_handler(symbol)
    			super
    			@month = symbol if @layer == 2
    		end
     
    		def refresh
    			super
    			draw_text(0, 0, width, 30, "Выберите период для #{text}", 1)
    			draw_text(0, 60, width, 30, "Введите нужную сумму:") if @layer >= 2
    			draw_text(0, 90, width, 30, "Продолжить оформление " + @text + " ?") if @layer == 3
    		end
     
    		def update
    			super
    			refresh
    			if @layer == 2
    				select(4)
    			end
    		end
     
    		def cursor_pagedown(wrap = false)
    			return if @layer != 2
    			@money += 1000
    			@money = HOLDING_MAXIMUM if @money > HOLDING_MAXIMUM && @text == "вклада"
    			@money = CREDIT_MAXIMUM if @money > CREDIT_MAXIMUM && @text == "кредита"
    			@money = $game_party.gold if @money > $game_party.gold && @text == "вклада"
    			refresh
    		end
     
    		def cursor_pageup(wrap = false)
    			return if @layer != 2
    			@money -= 1000
    			@money = 0 if @money < 0
    			refresh
    		end
     
    		def cursor_up(wrap = false)
    			if @layer == 1
    				super
    			elsif @layer == 2
    				@money += 100
    				@money = HOLDING_MAXIMUM if @money > HOLDING_MAXIMUM && @text == "вклада"
    				@money = CREDIT_MAXIMUM if @money > CREDIT_MAXIMUM && @text == "кредита"
    				@money = $game_party.gold if @money > $game_party.gold && @text == "вклада"
    			end
    			refresh
    		end
     
    		def cursor_down(wrap = false)
    			if @layer == 1
    				super
    			elsif @layer == 2
    				@money -= 100
    				@money = 0 if @money < 0
    			end
    			refresh
    		end
     
    		def cursor_left(wrap = false)
    			if @layer == 1
    				super
    			elsif @layer == 2
    				@money -= 1
    				@money = 0 if @money < 0
    			elsif @layer == 3
    				select(5)
    			end
    			refresh
    		end
     
    		def cursor_right(wrap = false)
    			if @layer == 1
    				super
    			elsif @layer == 2
    				@money += 1
    				@money = HOLDING_MAXIMUM if @money > HOLDING_MAXIMUM && @text == "вклада"
    				@money = CREDIT_MAXIMUM if @money > CREDIT_MAXIMUM && @text == "кредита"
    				@money = $game_party.gold if @money > $game_party.gold
    			elsif @layer == 3
    				select(6)
    			end
    			refresh
    		end
     
    		def make_command_list 
    			add_command("1 мес.", :month1)
    			add_command("3 мес.", :month3)
    			add_command("6 мес.", :month6)
    			add_command("12 мес.", :month12)
    			add_command(@money.to_s, :money) if @layer >= 2
    			if @layer == 3
    				add_command("Да", :holding_credit_yes)
    				add_command("Нет", :holding_credit_no)
    			end
    		end
     
    	end
     
    	class Notification_Bank_Window < Window_Command
    		include Bank_Settings
    		attr_accessor :money
    		attr_accessor :mode
    		attr_accessor :no_money
    		attr_accessor :month
    		attr_reader :percent
    		def initialize(x = 0, y = 200)
    			@money = 0
    			@mode = 0
    			@no_money = true
    			@month = 1
    			super
    		end
     
    		def alignment
    			1
    		end
     
    		def process_handling
    			super if !$bank_animation_update
    		end
     
    		def col_max
    			2
    		end
     
    		def item_rect(index)
    			rect = Rect.new
    			rect.width = item_width/4
    			rect.height = item_height
    			rect.x = Graphics.width - standard_padding*16 + index * spacing/2 * standard_padding/2
    			rect.y = 90
    			rect
    		end
     
    		def window_width
    			Graphics.width
    		end
     
    		def window_height
    			Graphics.height - 250
    		end
     
    		def width
    			Graphics.width - standard_padding
    		end
     
    		def update_cursor
    			super
    			return cursor_rect.empty if @no_money
    		end
     
    		def month_sum
    			case @month
    			when 1
    				" месяц "
    			when 3
    				" месяца "
    			else
    				" месяцев "
    			end
    		end
     
    		def sum
    			case @mode
    			when 1
    				@percent = [[$Bank_Settings[0], $Bank_Settings[0] - (@money/200).to_f/100 + ($Bank_Reputation/@month).to_f/100].min, 0.01].max
    			when 2
    				@percent = [[$Bank_Settings[1], $Bank_Settings[1] - (@money/250).to_f/100 - ($Bank_Reputation/(2*@month)).to_f/100].min, 0.01].max
    			end
    			@percent = @percent.round 2
    		end
     
    		def final_sum
    			all = @money
    			for i in 1..@month
    				all += (((all*@percent*i*30)/100)/365) 
    			end
    			@mode == 1 ? (all.to_i - @money)/@month : all.to_i - @money
    		end
     
    		def credit_final
    			(((@money + final_sum)/@month.to_f).round 0).to_i
    		end
     
    		def refresh
    			super
    			if @no_money
    				draw_text(0, 45, width, 30, "Вы ввели слишком маленькую сумму", 1) 
    				draw_text(0, 65, width, 30, "Минимальная сумма " + (@mode == 1 ? "вклада: " + MINIMUM_HOLDING.to_s : "кредита: " + MINIMUM_CREDIT.to_s) + " " + Vocab::currency_unit, 1)
    			else
    				y = @mode == 1 ? 7 : 0
    				draw_text(0, y, width, 30, "Вы собираетесь оформить " + (@mode == 1 ? "вклад ": "кредит ") + "на " + @money.to_s + " " + Vocab::currency_unit, 1)
    				y += 23
    				draw_text(0, y, width, 30, "Мы предлагаем Вам " + sum.to_s + " % годовых", 1)
    				case @mode
    				when 1
    					draw_text(0, 52, width, 30, "За " + @month.to_s + month_sum + "Вы заработаете: " + (final_sum * @month).to_s + " " + Vocab::currency_unit, 1)
    				when 2
    					y += 22
    					draw_text(0, y, width, 30, "За " + @month.to_s + month_sum + "Вы должны заплатить: " + (credit_final * @month).to_s + " " + Vocab::currency_unit, 1)
    					y += 22
    					draw_text(0, y, width, 30, "Ежемесечная плата составит: " + credit_final.to_s + " " + Vocab::currency_unit, 1)
    				end
    				draw_text(5, 90, width, 30, "Вы согласны с нашими условиями ?")
    			end
    		end
     
    		def make_command_list
    			if !@no_money
    				add_command("Да", :last_confirm)
    				add_command("Нет", :last_confirm_no)
    			end
    		end
    	end
     
    	### ФУНКЦИИ ####################################################################
     
    	class Game_Interpreter
    		def call_bank(value1, value2)
    			$Bank_Settings[0] = value1
    			$Bank_Settings[1] = value2
    			SceneManager.call(Bank_System_Scene)
    		end
     
    		def add_bank_reputation(value)
    			$Bank_Reputation += value
    		end
    	end # class Game_Interpreter
     
    	class Game_Time
    		alias denis_kyznetsov_bank_system_game_time_add_day add_day
    		def add_day(n = 1)
    			if $Player_Credit != []
    				if $Player_Credit[3] < 0
    					$Player_Credit[0] += ((($Player_Credit[0]*$Player_Credit[1]*30)/100)/365).to_i
    				end
    			end
    			denis_kyznetsov_bank_system_game_time_add_day(1)
    		end
     
    		alias denis_kyznetsov_bank_system_game_time_add_month add_month
    		def add_month(n = 1)
    			if $Player_Holding != []
    				if $Player_Holding[3] != 0
    					$Player_Holding[0] += $Player_Holding[2]
    					$Player_Holding[3] -= 1
    				end
    			end
     
    			if $Player_Credit != []
    				if $Player_Credit[0] > 0
    					gold = $game_party.gold
    					if $Player_Credit[3] > 0
    						if gold >= $Player_Credit[2] && $Player_Credit[0] >= $Player_Credit[2]
    							$Player_Credit[0] -= $Player_Credit[2]
    							$game_party.gain_gold(-$Player_Credit[2])
    						elsif gold >= $Player_Credit[0] && $Player_Credit[0] < $Player_Credit[2]
    							$game_party.gain_gold(-$Player_Credit[0])
    							$Player_Credit[0] = 0
    						elsif gold < $Player_Credit[2] && gold > 0 && $Player_Credit[0] > $Player_Credit[2]
    							$Bank_Reputation -= 1
    							$Player_Credit[0] -= gold
    							$game_party.gain_gold(-gold)
    						end
    						if $Player_Credit[0] == 0
    							$Bank_Reputation += 10
    							$Player_Credit = []
    						end
    					else
    						$Bank_Reputation -= 1
    						if gold >= $Player_Credit[0]
    							$game_party.gain_gold(-$Player_Credit[0])
    							$Player_Credit[0] = 0
    						elsif gold < $Player_Credit[0] && gold > 0
    							$Player_Credit[0] -= gold
    							$game_party.gain_gold(-gold)
    						else
    							$Bank_Reputation -= 1
    						end
    						$Player_Credit = [] if $Player_Credit[0] == 0
    					end
    					$Player_Credit[3] -= 1 if $Player_Credit != []
    				end
    			end
    			denis_kyznetsov_bank_system_game_time_add_month(1)
    		end
    	end # class Game_Time
     
    	module DataManager
    		class << self
     
    			alias denis_kyznetsov_bank_system_dt_mngr_setup_new_game setup_new_game
    			def setup_new_game
    				denis_kyznetsov_bank_system_dt_mngr_setup_new_game
    				$Bank_Settings = []
    				$Player_Holding = []
    				$Player_Credit = []
    				$Bank_Reputation = 0
    			end
     
    			alias denis_kyznetsov_bank_system_dt_mngr_make_save_contents make_save_contents
    			def make_save_contents
    				contents = denis_kyznetsov_bank_system_dt_mngr_make_save_contents
    				contents[:Player_Holding] = $Player_Holding
    				contents[:Player_Credit] = $Player_Credit
    				contents[:Bank_Reputation] = $Bank_Reputation
    				contents
    			end
     
    			alias denis_kyznetsov_bank_system_dt_mngr_extract_save_contents extract_save_contents
    			def extract_save_contents(contents)
    				denis_kyznetsov_bank_system_dt_mngr_extract_save_contents(contents)
    				$Player_Holding = contents[:Player_Holding]
    				$Player_Credit = contents[:Player_Credit]
    				$Bank_Reputation = contents[:Bank_Reputation]
    			end
    		end
    	end # module DataManager
     
    end


    Спойлер Скриншоты::
    Последний раз редактировалось DK; 02.02.2015 в 14:14. Причина: Обновление

  2. #2
    Хранитель Форума Аватар для Валера
    Информация о пользователе
    Регистрация
    15.04.2008
    Адрес
    Москва
    Сообщений
    14,006
    Записей в дневнике
    3
    Репутация: 166 Добавить или отнять репутацию

    По умолчанию

    Неужто у нас завелся новый скриптер? Ну-ка, расскажи о себе. Два года молчал и вдруг выдал.

    Спойлер И как тебе не стыдно-то, а, Валера?:


    Оборона форта: http://rghost.ru/8kLGxFtD2
    Сделать, чтоб все происходило, как я хочу, - вот, собственно, и весь мейкер!
    Адский Рейд: http://rpgmaker.su/vbdownloads.php?d...downloadid=106

  3. #3

    По умолчанию

    Цитата Сообщение от Валера Посмотреть сообщение
    Неужто у нас завелся новый скриптер? Ну-ка, расскажи о себе. Два года молчал и вдруг выдал.
    Скриптер старый) КПД, правда, низкий, потому что времени особо нет, да и знаний rgss маловато) Вот пытаюсь что-то сделать, выкладываю. Если кто найдет баги, то пишите о них сразу)

Информация о теме

Пользователи, просматривающие эту тему

Эту тему просматривают: 1 (пользователей: 0 , гостей: 1)

Метки этой темы

Социальные закладки

Социальные закладки

Ваши права

  • Вы не можете создавать новые темы
  • Вы не можете отвечать в темах
  • Вы не можете прикреплять вложения
  • Вы не можете редактировать свои сообщения
  •  
Аддоны к Время/Дата (Game Time)