mirror of
https://github.com/infinitefusion/infinitefusion-e18.git
synced 2026-07-22 07:37:00 +00:00
Update 6.8
This commit is contained in:
@@ -1,32 +1,39 @@
|
||||
def setDialogIconOff(eventId=nil)
|
||||
eventId = @event_id if !eventId
|
||||
event = $game_map.events[eventId]
|
||||
return unless event
|
||||
event.setDialogIconManualOffValue(true)
|
||||
event.setTradeIconManualOffValue(true)
|
||||
event.setTutorIconManualOffValue(true)
|
||||
end
|
||||
|
||||
def setDialogIconOn(eventId=nil)
|
||||
eventId = @event_id if !eventId
|
||||
event = $game_map.events[eventId]
|
||||
return unless event
|
||||
event.setDialogIconManualOffValue(false)
|
||||
event.setTradeIconManualOffValue(false)
|
||||
|
||||
event.setTutorIconManualOffValue(false)
|
||||
end
|
||||
class Game_Event < Game_Character
|
||||
#set from analyzing the event's content at load
|
||||
attr_accessor :show_quest_icon
|
||||
attr_accessor :show_dialog_icon
|
||||
attr_accessor :show_trade_icon
|
||||
attr_accessor :show_tutor_icon
|
||||
|
||||
#set manually from inside the event when triggered
|
||||
attr_accessor :quest_icon_manual_off
|
||||
attr_accessor :dialog_icon_manual_off
|
||||
attr_accessor :trade_icon_manual_off
|
||||
attr_accessor :tutor_icon_manual_off
|
||||
|
||||
QUEST_NPC_TRIGGER = "questNPC"
|
||||
MAPS_WITH_NO_ICONS = [] #Maps in which the game shouldn't try to look for quest icons(e.g. maps with a lot of events - mostly for possible performance issues)
|
||||
DIALOG_ICON_COMMENT_TRIGGER=["dialogIcon"]
|
||||
QUEST_ICON_COMMENT_TRIGGER=["questIcon"] #Only when it can't be defined in the event's name (multiple page - only one is quest giver)
|
||||
TRADE_ICON_COMMENT_TRIGGER=["tradeIcon"]
|
||||
MOVE_TUTOR_ICON_COMMENT_TRIGGER=["tutorIcon"]
|
||||
|
||||
alias eventQuestIcon_init initialize
|
||||
def initialize(map_id, event, map=nil)
|
||||
@@ -34,6 +41,19 @@ class Game_Event < Game_Character
|
||||
addQuestMarkersToSprite unless MAPS_WITH_NO_ICONS.include?($game_map.map_id)
|
||||
end
|
||||
|
||||
alias _orig_start start
|
||||
def start
|
||||
setDialogIconManualOffValue(true)
|
||||
setQuestIconManualOffValue(true)
|
||||
_orig_start
|
||||
end
|
||||
|
||||
alias eventQuestIcon_refresh refresh
|
||||
def refresh
|
||||
eventQuestIcon_refresh
|
||||
addQuestMarkersToSprite
|
||||
end
|
||||
|
||||
def setDialogIconManualOffValue(value)
|
||||
@dialog_icon_manual_off=value
|
||||
@show_dialog_icon = !@dialog_icon_manual_off
|
||||
@@ -47,28 +67,37 @@ class Game_Event < Game_Character
|
||||
@show_trade_icon = !@trade_icon_manual_off
|
||||
end
|
||||
|
||||
def setTutorIconManualOffValue(value)
|
||||
@tutor_icon_manual_off=value
|
||||
@show_tutor_icon = !@tutor_icon_manual_off
|
||||
end
|
||||
|
||||
|
||||
def addQuestMarkersToSprite()
|
||||
@show_quest_icon = detectQuestSwitch(self) && !@quest_icon_manual_off
|
||||
@show_quest_icon = (detectQuestSwitch(self) || detectQuestIcon(self)) && !@quest_icon_manual_off
|
||||
@show_dialog_icon = detectDialogueIcon(self) && !@dialog_icon_manual_off
|
||||
@show_trade_icon = detectTradeIcon(self) && !@trade_icon_manual_off
|
||||
@show_tutor_icon = detectTutorIcon(self) && !@tutor_icon_manual_off
|
||||
end
|
||||
|
||||
def detectDialogueIcon(event)
|
||||
return nil if !validateEventIsCompatibleWithIcons(event)
|
||||
page = pbGetActiveEventPage(event)
|
||||
first_command = page.list[0]
|
||||
return nil if !(first_command.code == 108 || first_command.code == 408)
|
||||
comments = first_command.parameters
|
||||
return comments.any? { |str| DIALOG_ICON_COMMENT_TRIGGER.include?(str) }
|
||||
return detectCommentCommand(DIALOG_ICON_COMMENT_TRIGGER,event)
|
||||
end
|
||||
|
||||
def detectTradeIcon(event)
|
||||
return nil if !validateEventIsCompatibleWithIcons(event)
|
||||
page = pbGetActiveEventPage(event)
|
||||
first_command = page.list[0]
|
||||
return nil if !(first_command.code == 108 || first_command.code == 408)
|
||||
comments = first_command.parameters
|
||||
return comments.any? { |str| TRADE_ICON_COMMENT_TRIGGER.include?(str) }
|
||||
return detectCommentCommand(TRADE_ICON_COMMENT_TRIGGER,event)
|
||||
end
|
||||
|
||||
def detectQuestIcon(event)
|
||||
return nil if !validateEventIsCompatibleWithIcons(event)
|
||||
return detectCommentCommand(QUEST_ICON_COMMENT_TRIGGER,event)
|
||||
end
|
||||
|
||||
def detectTutorIcon(event)
|
||||
return nil if !validateEventIsCompatibleWithIcons(event)
|
||||
return detectCommentCommand(MOVE_TUTOR_ICON_COMMENT_TRIGGER,event)
|
||||
end
|
||||
|
||||
def detectQuestSwitch(event)
|
||||
@@ -86,6 +115,7 @@ class Game_Event < Game_Character
|
||||
def validateEventIsCompatibleWithIcons(event)
|
||||
return false if event.is_a?(Game_Player)
|
||||
return false if event.erased
|
||||
return false unless event.visible?
|
||||
page = pbGetActiveEventPage(event)
|
||||
return false unless page
|
||||
return false if page.graphic.character_name.empty?
|
||||
@@ -98,9 +128,10 @@ end
|
||||
|
||||
class Sprite_Character
|
||||
|
||||
DIALOGUE_ICON_NAME = "Graphics/Pictures/Quests/dialogIcon"
|
||||
QUEST_ICON_NAME = "Graphics/Pictures/Quests/questIcon"
|
||||
TRADE_ICON_NAME = "Graphics/Pictures/Quests/tradeIcon"
|
||||
DIALOGUE_ICON_NAME = "Graphics/Pictures/NPCIcons/dialogIcon"
|
||||
QUEST_ICON_NAME = "Graphics/Pictures/NPCIcons/questIcon"
|
||||
TRADE_ICON_NAME = "Graphics/Pictures/NPCIcons/tradeIcon"
|
||||
TUTOR_ICON_NAME = "Graphics/Pictures/NPCIcons/tutorIcon"
|
||||
|
||||
attr_accessor :questIcon
|
||||
alias questIcon_init initialize
|
||||
@@ -115,6 +146,9 @@ class Sprite_Character
|
||||
if character.is_a?(Game_Event) && character.show_trade_icon
|
||||
addQuestMarkerToSprite(:TRADE_ICON)
|
||||
end
|
||||
if character.is_a?(Game_Event) && character.show_tutor_icon
|
||||
addQuestMarkerToSprite(:TUTOR_ICON)
|
||||
end
|
||||
#addQuestMarkersToSprite(character) unless MAPS_WITH_NO_ICONS.include?($game_map.map_id)
|
||||
end
|
||||
|
||||
@@ -137,7 +171,22 @@ class Sprite_Character
|
||||
end
|
||||
|
||||
def updateGameEvent
|
||||
removeQuestIcon if !@character.show_dialog_icon && !@character.show_quest_icon && !@character.show_trade_icon
|
||||
if !@character.show_dialog_icon &&
|
||||
!@character.show_quest_icon &&
|
||||
!@character.show_trade_icon &&
|
||||
!@character.show_tutor_icon
|
||||
removeQuestIcon
|
||||
elsif !@questIcon
|
||||
if @character.show_dialog_icon
|
||||
addQuestMarkerToSprite(:DIALOG_ICON)
|
||||
elsif @character.show_quest_icon
|
||||
addQuestMarkerToSprite(:QUEST_ICON)
|
||||
elsif @character.show_trade_icon
|
||||
addQuestMarkerToSprite(:TRADE_ICON)
|
||||
elsif @character.show_tutor_icon
|
||||
addQuestMarkerToSprite(:TUTOR_ICON)
|
||||
end
|
||||
end
|
||||
positionQuestIndicator if @questIcon
|
||||
end
|
||||
|
||||
@@ -153,10 +202,6 @@ class Sprite_Character
|
||||
# Event name must contain questNPC(x) for a quest icon to be displayed
|
||||
# Where x is the quest ID
|
||||
# if the quest has not already been accepted, the quest marker will be shown
|
||||
|
||||
|
||||
|
||||
|
||||
#type: :QUEST_ICON, :DIALOG_ICON
|
||||
def addQuestMarkerToSprite(iconType)
|
||||
removeQuestIcon if @questIcon
|
||||
@@ -168,6 +213,8 @@ class Sprite_Character
|
||||
iconPath = DIALOGUE_ICON_NAME
|
||||
when :TRADE_ICON
|
||||
iconPath = TRADE_ICON_NAME
|
||||
when :TUTOR_ICON
|
||||
iconPath = TUTOR_ICON_NAME
|
||||
end
|
||||
return if !iconPath
|
||||
@questIcon.bmp(iconPath)
|
||||
@@ -193,6 +240,7 @@ class Sprite_Character
|
||||
def removeQuestIcon()
|
||||
@questIcon.dispose if @questIcon
|
||||
@questIcon = nil
|
||||
@character.show_quest_icon = false if @character.is_a?(Game_Event)
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user