Update 6.8

This commit is contained in:
chardub
2026-07-10 15:42:06 -04:00
parent 5b85e72cb2
commit 6a6f126a18
7871 changed files with 493194 additions and 224826 deletions
@@ -67,6 +67,9 @@ class Interpreter
return unless Settings::REMOTE_NPC_DIALOG
if event_id > 0 && map_id
return unless $game_map.events[@event_id]
return unless $game_map.events[@event_id].trigger
return unless $game_map.events[@event_id].trigger < 3
$game_temp.talking_npc_id = event_id
return unless $game_temp.talking_npc_id
# Prepare finalizer for end-of-event
@@ -81,6 +84,8 @@ class Interpreter
def command_end
_remoteNPCDialog_command_end
# Run finalizer once when the events interpreter finishes
return unless @event_id == $game_temp.talking_npc_id
if $game_temp.active_event_finalizer
$game_temp.active_event_finalizer.call
$game_temp.active_event_finalizer = nil
@@ -1,25 +1,42 @@
#Npc context an array of dialogues in order
# Npc context an array of dialogues in order
# ex: ["NPC: hello, I'm an NPC"], ["Player: Hello!"]
def getRemoteNPCResponse(event_id)
npc_event = $game_map.events[event_id]
npc_context = get_npc_context(event_id) # ["NPC: Hello...", "Player: ..."]
npc_sprite_name = npc_event.character_name
current_location = Kernel.getMapName($game_map.map_id)
npc_event = $game_map.events[event_id]
npc_context = get_npc_context(event_id) # ["NPC: Hello...", "Player: ..."]
npc_sprite_name = npc_event.character_name
current_location = getMapName($game_map.map_id)
rematchable_trainer = getRebattledTrainer(event_id, $game_map.map_id)
trainer_dialogs = {}
if rematchable_trainer
trainer_data = GameData::Trainer.try_get(rematchable_trainer.trainerType, rematchable_trainer.trainerName, 0)
trainer_dialogs = {
TRAINER_CLASS: rematchable_trainer.trainerType,
TRAINER_NAME: rematchable_trainer.trainerName,
CATCH: trainer_data.preRematchText_caught,
EVOLVE: trainer_data.preRematchText_evolved,
FUSE: trainer_data.preRematchText_fused,
UNFUSE: trainer_data.preRematchText_unfused,
REVERSE: trainer_data.preRematchText_reversed,
GIFT: trainer_data.preRematchText_gift }
end
# Build state params
state_params = {
context: npc_context,
sprite: npc_sprite_name,
location: current_location
location: current_location,
trainer_dialogs: trainer_dialogs
}
# Convert into JSON-safe form (like battle code does)
safe_params = convert_to_json_safe(state_params)
json_data = JSON.generate(safe_params)
json_data = JSON.generate(safe_params)
# Send to your remote dialogue server
response = pbPostToString(Settings::REMOTE_NPC_DIALOG_SERVER_URL, { "npc_state" => json_data },10)
response = pbPostToString(Settings::REMOTE_NPC_DIALOG_SERVER_URL, { "npc_state" => json_data }, 10)
response = clean_json_string(response)
echoln "npc sprite name: #{npc_sprite_name}"
@@ -27,7 +44,7 @@ def getRemoteNPCResponse(event_id)
echoln "[Remote NPC] Sent state: #{json_data}"
echoln "[Remote NPC] Got response: #{response}"
pbCallBub(2,event_id)
pbCallBub(2, event_id)
pbMessage(response)
return response
end