Merge branch 'dev' into ai

This commit is contained in:
Maruno17
2023-01-08 21:56:33 +00:00
46 changed files with 1701 additions and 848 deletions

View File

@@ -372,12 +372,14 @@ module Settings
#=============================================================================
# An array of available languages in the game, and their corresponding message
# file in the Data folder. Edit only if you have 2 or more languages to choose
# from.
# An array of available languages in the game, and their corresponding
# filename. Text files for a language are extracted to a folder called
# "Text_filename_core" or "Text_filename_game", and are recompiled into files
# in the Data folder called "messages_filename_core.dat" or
# "messages_filename_game.dat".
LANGUAGES = [
# ["English", "english.dat"],
# ["Deutsch", "deutsch.dat"]
# ["English", "english"],
# ["Deutsch", "deutsch"]
]
#=============================================================================

File diff suppressed because it is too large Load Diff

View File

@@ -30,7 +30,7 @@ module Game
# Set language (and choose language if there is no save file)
if Settings::LANGUAGES.length >= 2
$PokemonSystem.language = pbChooseLanguage if save_data.empty?
pbLoadMessages("Data/" + Settings::LANGUAGES[$PokemonSystem.language][1])
MessageTypes.load_message_files(Settings::LANGUAGES[$PokemonSystem.language][1])
end
end

View File

@@ -188,7 +188,7 @@ class Scene_Map
end
end
return if $game_temp.message_window_showing
if !pbMapInterpreterRunning?
if !pbMapInterpreterRunning? && !$PokemonGlobal.ice_sliding
if Input.trigger?(Input::USE)
$game_temp.interact_calling = true
elsif Input.trigger?(Input::ACTION)

View File

@@ -4,7 +4,6 @@
# This class handles screen maintenance data, such as change in color tone,
# flashing, etc. Refer to "$game_screen" for the instance of this class.
#===============================================================================
class Game_Screen
#-----------------------------------------------------------------------------
# * Public Instance Variables

View File

@@ -234,7 +234,7 @@ class Game_Map
# Make water tiles passable if player is surfing
return true if $PokemonGlobal.surfing && terrain.can_surf && !terrain.waterfall
# Prevent cycling in really tall grass/on ice
return false if $PokemonGlobal.bicycle && terrain.must_walk
return false if $PokemonGlobal.bicycle && (terrain.must_walk || terrain.must_walk_or_run)
# Depend on passability of bridge tile if on bridge
if terrain.bridge && $PokemonGlobal.bridge > 0
return (passage & bit == 0 && passage & 0x0f != 0x0f)

View File

@@ -135,7 +135,7 @@ class Game_Player < Game_Character
else
$stats.distance_walked += 1
end
$stats.distance_slid_on_ice += 1 if $PokemonGlobal.sliding
$stats.distance_slid_on_ice += 1 if $PokemonGlobal.ice_sliding
increase_steps
end
elsif !check_event_trigger_touch(dir)
@@ -423,12 +423,12 @@ class Game_Player < Game_Character
def update
last_real_x = @real_x
last_real_y = @real_y
@last_terrain_tag = pbTerrainTag
super
update_stop if $game_temp.in_menu && @stopped_last_frame
update_screen_position(last_real_x, last_real_y)
# Update dependent events
if (!@moved_last_frame || @stopped_last_frame ||
(@stopped_this_frame && $PokemonGlobal.sliding)) && (moving? || jumping?)
if (!@moved_last_frame || @stopped_last_frame) && (moving? || jumping?)
$game_temp.followers.move_followers
end
$game_temp.followers.update
@@ -445,8 +445,10 @@ class Game_Player < Game_Character
def update_command_new
dir = Input.dir4
unless pbMapInterpreterRunning? || $game_temp.message_window_showing ||
$game_temp.in_mini_update || $game_temp.in_menu
if $PokemonGlobal.ice_sliding
move_forward
elsif !pbMapInterpreterRunning? && !$game_temp.message_window_showing &&
!$game_temp.in_mini_update && !$game_temp.in_menu
# Move player in the direction the directional button is being pressed
if @moved_last_frame ||
(dir > 0 && dir == @lastdir && Graphics.frame_count - @lastdirframe > Graphics.frame_rate / 20)
@@ -472,7 +474,7 @@ class Game_Player < Game_Character
def update_move
if !@moved_last_frame || @stopped_last_frame # Started a new step
if pbTerrainTag.ice
if $PokemonGlobal.ice_sliding || @last_terrain_tag.ice
set_movement_type(:ice_sliding)
else
faster = can_run?
@@ -543,7 +545,7 @@ class Game_Player < Game_Character
end
def update_event_triggering
return if moving?
return if moving? || $PokemonGlobal.ice_sliding
# Try triggering events upon walking into them/in front of them
if @moved_this_frame
$game_temp.followers.turn_followers

View File

@@ -254,7 +254,7 @@ class Game_FollowerFactory
end
event.move_speed = leader.move_speed
event.transparent = !follower.visible?
if $PokemonGlobal.sliding
if $PokemonGlobal.ice_sliding
event.straighten
event.walk_anime = false
else

View File

@@ -260,9 +260,11 @@ def pbGetBasicMapNameFromId(id)
end
def pbGetMapNameFromId(id)
name = pbGetMessage(MessageTypes::MapNames, id)
name = pbGetBasicMapNameFromId(id) if nil_or_empty?(name)
name.gsub!(/\\PN/, $player.name) if $player
name = GameData::MapMetadata.get(id)&.name
if nil_or_empty?(name)
name = pbGetBasicMapNameFromId(id)
name.gsub!(/\\PN/, $player.name) if $player
end
return name
end

View File

@@ -57,6 +57,7 @@ module GameData
@bridge = hash[:bridge] || false
@shows_reflections = hash[:shows_reflections] || false
@must_walk = hash[:must_walk] || false
@must_walk_or_run = hash[:must_walk_or_run] || false
@ignore_passability = hash[:ignore_passability] || false
end
@@ -163,7 +164,7 @@ GameData::TerrainTag.register({
:id_number => 12,
:battle_environment => :Ice,
:ice => true,
:must_walk => true
:must_walk_or_run => true
})
GameData::TerrainTag.register({

View File

@@ -15,7 +15,7 @@ module GameData
"SectionName" => [:id, "u"],
"Name" => [:real_name, "s"],
"Filename" => [:filename, "s"],
"Point" => [:point, "^uussUUUU"],
"Point" => [:point, "^uusSUUUU"],
"Flags" => [:flags, "*s"]
}
@@ -33,7 +33,7 @@ module GameData
# @return [String] the translated name of this region
def name
return pbGetMessage(MessageTypes::RegionNames, @id)
return pbGetMessageFromHash(MessageTypes::Regions, @real_name)
end
def has_flag?(flag)

View File

@@ -35,7 +35,7 @@ module GameData
# @return [String] the translated description of this ability
def description
return pbGetMessageFromHash(MessageTypes::AbilityDescs, @real_description)
return pbGetMessageFromHash(MessageTypes::AbilityDescriptions, @real_description)
end
def has_flag?(flag)

View File

@@ -3,6 +3,8 @@ module GameData
attr_reader :id
attr_reader :real_name
attr_reader :real_name_plural
attr_reader :real_portion_name
attr_reader :real_portion_name_plural
attr_reader :pocket
attr_reader :price
attr_reader :sell_price
@@ -20,21 +22,23 @@ module GameData
PBS_BASE_FILENAME = "items"
SCHEMA = {
"SectionName" => [:id, "m"],
"Name" => [:real_name, "s"],
"NamePlural" => [:real_name_plural, "s"],
"Pocket" => [:pocket, "v"],
"Price" => [:price, "u"],
"SellPrice" => [:sell_price, "u"],
"BPPrice" => [:bp_price, "u"],
"FieldUse" => [:field_use, "e", { "OnPokemon" => 1, "Direct" => 2, "TM" => 3,
"HM" => 4, "TR" => 5 }],
"BattleUse" => [:battle_use, "e", { "OnPokemon" => 1, "OnMove" => 2, "OnBattler" => 3,
"OnFoe" => 4, "Direct" => 5 }],
"Flags" => [:flags, "*s"],
"Consumable" => [:consumable, "b"],
"Move" => [:move, "e", :Move],
"Description" => [:real_description, "q"]
"SectionName" => [:id, "m"],
"Name" => [:real_name, "s"],
"NamePlural" => [:real_name_plural, "s"],
"PortionName" => [:real_portion_name, "s"],
"PortionNamePlural" => [:real_portion_name_plural, "s"],
"Pocket" => [:pocket, "v"],
"Price" => [:price, "u"],
"SellPrice" => [:sell_price, "u"],
"BPPrice" => [:bp_price, "u"],
"FieldUse" => [:field_use, "e", { "OnPokemon" => 1, "Direct" => 2,
"TM" => 3, "HM" => 4, "TR" => 5 }],
"BattleUse" => [:battle_use, "e", { "OnPokemon" => 1, "OnMove" => 2,
"OnBattler" => 3, "OnFoe" => 4, "Direct" => 5 }],
"Flags" => [:flags, "*s"],
"Consumable" => [:consumable, "b"],
"Move" => [:move, "e", :Move],
"Description" => [:real_description, "q"]
}
extend ClassMethodsSymbols
@@ -108,21 +112,23 @@ module GameData
end
def initialize(hash)
@id = hash[:id]
@real_name = hash[:real_name] || "Unnamed"
@real_name_plural = hash[:real_name_plural] || "Unnamed"
@pocket = hash[:pocket] || 1
@price = hash[:price] || 0
@sell_price = hash[:sell_price] || (@price / 2)
@bp_price = hash[:bp_price] || 1
@field_use = hash[:field_use] || 0
@battle_use = hash[:battle_use] || 0
@flags = hash[:flags] || []
@consumable = hash[:consumable]
@consumable = !is_important? if @consumable.nil?
@move = hash[:move]
@real_description = hash[:real_description] || "???"
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
@id = hash[:id]
@real_name = hash[:real_name] || "Unnamed"
@real_name_plural = hash[:real_name_plural] || "Unnamed"
@real_portion_name = hash[:real_portion_name]
@real_portion_name_plural = hash[:real_portion_name_plural]
@pocket = hash[:pocket] || 1
@price = hash[:price] || 0
@sell_price = hash[:sell_price] || (@price / 2)
@bp_price = hash[:bp_price] || 1
@field_use = hash[:field_use] || 0
@battle_use = hash[:battle_use] || 0
@flags = hash[:flags] || []
@consumable = hash[:consumable]
@consumable = !is_important? if @consumable.nil?
@move = hash[:move]
@real_description = hash[:real_description] || "???"
@pbs_file_suffix = hash[:pbs_file_suffix] || ""
end
# @return [String] the translated name of this item
@@ -135,6 +141,18 @@ module GameData
return pbGetMessageFromHash(MessageTypes::ItemPlurals, @real_name_plural)
end
# @return [String] the translated portion name of this item
def portion_name
return pbGetMessageFromHash(MessageTypes::ItemPortions, @real_portion_name) if @real_portion_name
return name
end
# @return [String] the translated plural version of the portion name of this item
def portion_name_plural
return pbGetMessageFromHash(MessageTypes::ItemPortionPlurals, @real_portion_name_plural) if @real_portion_name_plural
return name_plural
end
# @return [String] the translated description of this item
def description
return pbGetMessageFromHash(MessageTypes::ItemDescriptions, @real_description)

View File

@@ -225,17 +225,17 @@ module GameData
# @return [String] the translated name of this form of this species
def form_name
return pbGetMessageFromHash(MessageTypes::FormNames, @real_form_name)
return pbGetMessageFromHash(MessageTypes::SpeciesForms, @real_form_name)
end
# @return [String] the translated Pokédex category of this species
def category
return pbGetMessageFromHash(MessageTypes::Kinds, @real_category)
return pbGetMessageFromHash(MessageTypes::SpeciesCategories, @real_category)
end
# @return [String] the translated Pokédex entry of this species
def pokedex_entry
return pbGetMessageFromHash(MessageTypes::Entries, @real_pokedex_entry)
return pbGetMessageFromHash(MessageTypes::PokedexEntries, @real_pokedex_entry)
end
def default_form

View File

@@ -107,7 +107,7 @@ module GameData
# @return [String] the translated in-battle lose message of this trainer
def lose_text
return pbGetMessageFromHash(MessageTypes::TrainerLoseText, @real_lose_text)
return pbGetMessageFromHash(MessageTypes::TrainerLoseTexts, @real_lose_text)
end
# Creates a battle-ready version of a trainer's data.

View File

@@ -115,7 +115,10 @@ module GameData
# @return [String] the translated name of this map
def name
return pbGetMapNameFromId(@id)
ret = pbGetMessageFromHash(MessageTypes::MapNames, @real_name)
ret = pbGetBasicMapNameFromId(@id) if nil_or_empty?(ret)
ret.gsub!(/\\PN/, $player.name) if $player
return ret
end
def has_flag?(flag)

View File

@@ -75,7 +75,7 @@ class Battle
end
def pbUseItemMessage(item, trainerName)
itemName = GameData::Item.get(item).name
itemName = GameData::Item.get(item).portion_name
if itemName.starts_with_vowel?
pbDisplayBrief(_INTL("{1} used an {2}.", trainerName, itemName))
else

View File

@@ -191,5 +191,5 @@ Battle::PokeBallEffects::OnCatch.add(:HEALBALL, proc { |ball, battle, pkmn|
})
Battle::PokeBallEffects::OnCatch.add(:FRIENDBALL, proc { |ball, battle, pkmn|
pkmn.happiness = 200
pkmn.happiness = (Settings::APPLY_HAPPINESS_SOFT_CAP) ? 150 : 200
})

View File

@@ -166,7 +166,7 @@ EventHandlers.add(:on_step_taken, :auto_move_player,
currentTag = $game_player.pbTerrainTag
if currentTag.waterfall_crest
pbDescendWaterfall
elsif currentTag.ice && !$PokemonGlobal.sliding
elsif currentTag.ice || $PokemonGlobal.ice_sliding
pbSlideOnIce
end
}
@@ -573,30 +573,14 @@ def pbLedge(_xOffset, _yOffset)
end
def pbSlideOnIce
return if !$game_player.pbTerrainTag.ice
$game_temp.followers.update
$PokemonGlobal.sliding = true
direction = $game_player.direction
oldwalkanime = $game_player.walk_anime
$game_player.straighten
$game_player.walk_anime = false
first_loop = true
loop do
break if !$game_player.can_move_in_direction?(direction)
break if !$game_player.pbTerrainTag.ice
$game_player.move_forward
$game_temp.followers.move_followers if first_loop
while $game_player.moving?
pbUpdateSceneMap
Graphics.update
Input.update
end
first_loop = false
if $game_player.pbTerrainTag.ice && $game_player.can_move_in_direction?($game_player.direction)
$PokemonGlobal.ice_sliding = true
$game_player.straighten
$game_player.walk_anime = false
return
end
$game_player.center($game_player.x, $game_player.y)
$game_player.straighten
$game_player.walk_anime = oldwalkanime
$PokemonGlobal.sliding = false
$PokemonGlobal.ice_sliding = false
$game_player.walk_anime = true
end
def pbTurnTowardEvent(event, otherEvent)
@@ -734,14 +718,12 @@ end
def pbItemBall(item, quantity = 1)
item = GameData::Item.get(item)
return false if !item || quantity < 1
itemname = (quantity > 1) ? item.name_plural : item.name
itemname = (quantity > 1) ? item.portion_name_plural : item.portion_name
pocket = item.pocket
move = item.move
if $bag.add(item, quantity) # If item can be picked up
meName = (item.is_key_item?) ? "Key item get" : "Item get"
if item == :LEFTOVERS
pbMessage(_INTL("\\me[{1}]You found some \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname))
elsif item == :DNASPLICERS
if item == :DNASPLICERS
pbMessage(_INTL("\\me[{1}]You found \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname))
elsif item.is_machine? # TM or HM
pbMessage(_INTL("\\me[{1}]You found \\c[1]{2} {3}\\c[0]!\\wtnp[30]", meName, itemname, GameData::Move.get(move).name))
@@ -757,9 +739,7 @@ def pbItemBall(item, quantity = 1)
return true
end
# Can't add the item
if item == :LEFTOVERS
pbMessage(_INTL("You found some \\c[1]{1}\\c[0]!\\wtnp[30]", itemname))
elsif item.is_machine? # TM or HM
if item.is_machine? # TM or HM
pbMessage(_INTL("You found \\c[1]{1} {2}\\c[0]!\\wtnp[30]", itemname, GameData::Move.get(move).name))
elsif quantity > 1
pbMessage(_INTL("You found {1} \\c[1]{2}\\c[0]!\\wtnp[30]", quantity, itemname))
@@ -780,13 +760,11 @@ end
def pbReceiveItem(item, quantity = 1)
item = GameData::Item.get(item)
return false if !item || quantity < 1
itemname = (quantity > 1) ? item.name_plural : item.name
itemname = (quantity > 1) ? item.portion_name_plural : item.portion_name
pocket = item.pocket
move = item.move
meName = (item.is_key_item?) ? "Key item get" : "Item get"
if item == :LEFTOVERS
pbMessage(_INTL("\\me[{1}]You obtained some \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname))
elsif item == :DNASPLICERS
if item == :DNASPLICERS
pbMessage(_INTL("\\me[{1}]You obtained \\c[1]{2}\\c[0]!\\wtnp[30]", meName, itemname))
elsif item.is_machine? # TM or HM
pbMessage(_INTL("\\me[{1}]You obtained \\c[1]{2} {3}\\c[0]!\\wtnp[30]", meName, itemname, GameData::Move.get(move).name))
@@ -811,7 +789,7 @@ end
def pbBuyPrize(item, quantity = 1)
item = GameData::Item.get(item)
return false if !item || quantity < 1
item_name = (quantity > 1) ? item.name_plural : item.name
item_name = (quantity > 1) ? item.portion_name_plural : item.portion_name
pocket = item.pocket
return false if !$bag.add(item, quantity)
pbMessage(_INTL("\\CNYou put the {1} in\\nyour Bag's <icon=bagPocket{2}>\\c[1]{3}\\c[0] pocket.",

View File

@@ -7,7 +7,7 @@ class PokemonGlobalMetadata
attr_accessor :bicycle
attr_accessor :surfing
attr_accessor :diving
attr_accessor :sliding
attr_accessor :ice_sliding
attr_accessor :fishing
# Player data
attr_accessor :startTime
@@ -58,7 +58,7 @@ class PokemonGlobalMetadata
@bicycle = false
@surfing = false
@diving = false
@sliding = false
@ice_sliding = false
@fishing = false
# Player data
@startTime = Time.now

View File

@@ -436,7 +436,7 @@ end
#===============================================================================
def pbPickBerry(berry, qty = 1)
berry = GameData::Item.get(berry)
berry_name = (qty > 1) ? berry.name_plural : berry.name
berry_name = (qty > 1) ? berry.portion_name_plural : berry.portion_name
if qty > 1
message = _INTL("There are {1} \\c[1]{2}\\c[0]!\nWant to pick them?", qty, berry_name)
else

View File

@@ -522,7 +522,8 @@ end
#===============================================================================
def pbBikeCheck
if $PokemonGlobal.surfing || $PokemonGlobal.diving ||
(!$PokemonGlobal.bicycle && $game_player.pbTerrainTag.must_walk)
(!$PokemonGlobal.bicycle &&
($game_player.pbTerrainTag.must_walk || $game_player.pbTerrainTag.must_walk_or_run))
pbMessage(_INTL("Can't use that here."))
return false
end
@@ -671,7 +672,7 @@ def pbUseItem(bag, item, bagscene = nil)
max_at_once = [max_at_once, $bag.quantity(item)].min
if max_at_once > 1
qty = screen.scene.pbChooseNumber(
_INTL("How many {1} do you want to use?", GameData::Item.get(item).name), max_at_once
_INTL("How many {1} do you want to use?", GameData::Item.get(item).portion_name_plural), max_at_once
)
screen.scene.pbSetHelpText("") if screen.is_a?(PokemonPartyScreen)
end
@@ -680,7 +681,7 @@ def pbUseItem(bag, item, bagscene = nil)
next unless ret && itm.consumed_after_use?
bag.remove(item, qty)
next if bag.has?(item)
pbMessage(_INTL("You used your last {1}.", itm.name)) { screen.pbUpdate }
pbMessage(_INTL("You used your last {1}.", itm.portion_name)) { screen.pbUpdate }
break
end
screen.pbEndScene
@@ -714,7 +715,7 @@ def pbUseItemOnPokemon(item, pkmn, scene)
elsif !pkmn.compatible_with_move?(machine)
pbMessage(_INTL("{1} can't learn {2}.", pkmn.name, movename)) { scene.pbUpdate }
else
pbMessage(_INTL("\\se[PC access]You booted up {1}.\1", itm.name)) { scene.pbUpdate }
pbMessage(_INTL("\\se[PC access]You booted up the {1}.\1", itm.portion_name)) { scene.pbUpdate }
if pbConfirmMessage(_INTL("Do you want to teach {1} to {2}?", movename, pkmn.name)) { scene.pbUpdate }
if pbLearnMove(pkmn, machine, false, true) { scene.pbUpdate }
$bag.remove(item) if itm.consumed_after_use?
@@ -730,7 +731,7 @@ def pbUseItemOnPokemon(item, pkmn, scene)
max_at_once = [max_at_once, $bag.quantity(item)].min
if max_at_once > 1
qty = scene.scene.pbChooseNumber(
_INTL("How many {1} do you want to use?", itm.name), max_at_once
_INTL("How many {1} do you want to use?", itm.portion_name_plural), max_at_once
)
scene.scene.pbSetHelpText("") if scene.is_a?(PokemonPartyScreen)
end
@@ -741,7 +742,7 @@ def pbUseItemOnPokemon(item, pkmn, scene)
if ret && itm.consumed_after_use?
$bag.remove(item, qty)
if !$bag.has?(item)
pbMessage(_INTL("You used your last {1}.", itm.name)) { scene.pbUpdate }
pbMessage(_INTL("You used your last {1}.", itm.portion_name)) { scene.pbUpdate }
end
end
return ret
@@ -758,7 +759,7 @@ def pbUseKeyItemInField(item)
end
def pbUseItemMessage(item)
itemname = GameData::Item.get(item).name
itemname = GameData::Item.get(item).portion_name
if itemname.starts_with_vowel?
pbMessage(_INTL("You used an {1}.", itemname))
else
@@ -774,7 +775,7 @@ end
# Give an item to a Pokémon to hold, and take a held item from a Pokémon
#===============================================================================
def pbGiveItemToPokemon(item, pkmn, scene, pkmnid = 0)
newitemname = GameData::Item.get(item).name
newitemname = GameData::Item.get(item).portion_name
if pkmn.egg?
scene.pbDisplay(_INTL("Eggs can't hold items."))
return false
@@ -783,10 +784,8 @@ def pbGiveItemToPokemon(item, pkmn, scene, pkmnid = 0)
return false if !pbTakeItemFromPokemon(pkmn, scene)
end
if pkmn.hasItem?
olditemname = pkmn.item.name
if pkmn.hasItem?(:LEFTOVERS)
scene.pbDisplay(_INTL("{1} is already holding some {2}.\1", pkmn.name, olditemname))
elsif newitemname.starts_with_vowel?
olditemname = pkmn.item.portion_name
if newitemname.starts_with_vowel?
scene.pbDisplay(_INTL("{1} is already holding an {2}.\1", pkmn.name, olditemname))
else
scene.pbDisplay(_INTL("{1} is already holding a {2}.\1", pkmn.name, olditemname))
@@ -836,14 +835,14 @@ def pbTakeItemFromPokemon(pkmn, scene)
end
elsif scene.pbConfirm(_INTL("If the mail is removed, its message will be lost. OK?"))
$bag.add(pkmn.item)
scene.pbDisplay(_INTL("Received the {1} from {2}.", pkmn.item.name, pkmn.name))
scene.pbDisplay(_INTL("Received the {1} from {2}.", pkmn.item.portion_name, pkmn.name))
pkmn.item = nil
pkmn.mail = nil
ret = true
end
else
$bag.add(pkmn.item)
scene.pbDisplay(_INTL("Received the {1} from {2}.", pkmn.item.name, pkmn.name))
scene.pbDisplay(_INTL("Received the {1} from {2}.", pkmn.item.portion_name, pkmn.name))
pkmn.item = nil
ret = true
end

View File

@@ -962,7 +962,7 @@ class Pokemon
gain += 1 if @poke_ball == :LUXURYBALL
gain = (gain * 1.5).floor if hasItem?(:SOOTHEBELL)
if Settings::APPLY_HAPPINESS_SOFT_CAP && method != "evberry"
gain = gain.clamp(0, 179 - @happiness)
gain = (@happiness >= 179) ? 0 : gain.clamp(0, 179 - @happiness)
end
end
@happiness = (@happiness + gain).clamp(0, 255)

View File

@@ -1429,6 +1429,7 @@ MenuHandlers.add(:party_menu_item, :move, {
pkmn = party[party_idx]
item = pkmn.item
itemname = item.name
portionitemname = item.portion_name
screen.scene.pbSetHelpText(_INTL("Move {1} to where?", itemname))
old_party_idx = party_idx
moved = false
@@ -1446,7 +1447,7 @@ MenuHandlers.add(:party_menu_item, :move, {
pkmn.item = nil
screen.scene.pbClearSwitching
screen.pbRefresh
screen.pbDisplay(_INTL("{1} was given the {2} to hold.", newpkmn.name, itemname))
screen.pbDisplay(_INTL("{1} was given the {2} to hold.", newpkmn.name, portionitemname))
moved = true
break
elsif newpkmn.item.is_mail?
@@ -1455,10 +1456,8 @@ MenuHandlers.add(:party_menu_item, :move, {
end
# New Pokémon is also holding an item; ask what to do with it
newitem = newpkmn.item
newitemname = newitem.name
if newitem == :LEFTOVERS
screen.pbDisplay(_INTL("{1} is already holding some {2}.\1", newpkmn.name, newitemname))
elsif newitemname.starts_with_vowel?
newitemname = newitem.portion_name
if newitemname.starts_with_vowel?
screen.pbDisplay(_INTL("{1} is already holding an {2}.\1", newpkmn.name, newitemname))
else
screen.pbDisplay(_INTL("{1} is already holding a {2}.\1", newpkmn.name, newitemname))
@@ -1468,7 +1467,7 @@ MenuHandlers.add(:party_menu_item, :move, {
pkmn.item = newitem
screen.scene.pbClearSwitching
screen.pbRefresh
screen.pbDisplay(_INTL("{1} was given the {2} to hold.", newpkmn.name, itemname))
screen.pbDisplay(_INTL("{1} was given the {2} to hold.", newpkmn.name, portionitemname))
screen.pbDisplay(_INTL("{1} was given the {2} to hold.", pkmn.name, newitemname))
moved = true
break

View File

@@ -505,7 +505,7 @@ class PokemonBagScreen
if $player.pokemon_count == 0
@scene.pbDisplay(_INTL("There is no Pokémon."))
elsif itm.is_important?
@scene.pbDisplay(_INTL("The {1} can't be held.", itemname))
@scene.pbDisplay(_INTL("The {1} can't be held.", itm.portion_name))
else
pbFadeOutIn {
sscene = PokemonParty_Scene.new
@@ -517,11 +517,11 @@ class PokemonBagScreen
elsif cmdToss >= 0 && command == cmdToss # Toss item
qty = @bag.quantity(item)
if qty > 1
helptext = _INTL("Toss out how many {1}?", itm.name_plural)
helptext = _INTL("Toss out how many {1}?", itm.portion_name_plural)
qty = @scene.pbChooseNumber(helptext, qty)
end
if qty > 0
itemname = itm.name_plural if qty > 1
itemname = (qty > 1) ? itm.portion_name_plural : itm.portion_name
if pbConfirm(_INTL("Is it OK to throw away {1} {2}?", qty, itemname))
pbDisplay(_INTL("Threw away {1} {2}.", qty, itemname))
qty.times { @bag.remove(item) }
@@ -620,7 +620,7 @@ class PokemonBagScreen
end
@scene.pbRefresh
dispqty = (itm.is_important?) ? 1 : qty
itemname = (dispqty > 1) ? itm.name_plural : itm.name
itemname = (dispqty > 1) ? itm.portion_name_plural : itm.portion_name
pbDisplay(_INTL("Withdrew {1} {2}.", dispqty, itemname))
else
pbDisplay(_INTL("There's no more room in the Bag."))
@@ -654,7 +654,7 @@ class PokemonBagScreen
end
@scene.pbRefresh
dispqty = (itm.is_important?) ? 1 : qty
itemname = (dispqty > 1) ? itm.name_plural : itm.name
itemname = (dispqty > 1) ? itm.portion_name_plural : itm.portion_name
pbDisplay(_INTL("Deposited {1} {2}.", dispqty, itemname))
else
pbDisplay(_INTL("There's no room to store items."))
@@ -680,8 +680,8 @@ class PokemonBagScreen
next
end
qty = storage.quantity(item)
itemname = itm.name
itemnameplural = itm.name_plural
itemname = itm.portion_name
itemnameplural = itm.portion_name_plural
if qty > 1
qty = @scene.pbChooseNumber(_INTL("Toss out how many {1}?", itemnameplural), qty)
end

View File

@@ -185,7 +185,7 @@ class PokemonRegionMap_Scene
@map.point.each do |point|
next if point[0] != x || point[1] != y
return "" if point[7] && (@wallmap || point[7] <= 0 || !$game_switches[point[7]])
name = pbGetMessageFromHash(MessageTypes::PlaceNames, point[2])
name = pbGetMessageFromHash(MessageTypes::RegionLocations, point[2])
return (@editor) ? point[2] : name
end
return ""
@@ -213,7 +213,8 @@ class PokemonRegionMap_Scene
@map.point.each do |point|
next if point[0] != x || point[1] != y
return "" if point[7] && (@wallmap || point[7] <= 0 || !$game_switches[point[7]])
mapdesc = pbGetMessageFromHash(MessageTypes::PlaceDescriptions, point[3])
return "" if !point[3]
mapdesc = pbGetMessageFromHash(MessageTypes::RegionDescriptions, point[3])
return (@editor) ? point[3] : mapdesc
end
return ""

View File

@@ -95,7 +95,7 @@ class PokemonPhone_Scene
end
# Set info text
infotext = _INTL("Registered<br>")
infotext += _INTL(" <r>{1}<br>", @sprites["list"].commands.length)
infotext += _INTL("<r>{1}<br>", @sprites["list"].commands.length)
infotext += _INTL("Waiting for a rematch<r>{1}", rematch_count)
@sprites["info"].text = infotext
pbRefreshScreen

View File

@@ -325,7 +325,7 @@ class PokemonLoadScreen
when cmd_language
@scene.pbEndScene
$PokemonSystem.language = pbChooseLanguage
pbLoadMessages("Data/" + Settings::LANGUAGES[$PokemonSystem.language][1])
MessageTypes.load_message_files(Settings::LANGUAGES[$PokemonSystem.language][1])
if show_continue
@save_data[:pokemon_system] = $PokemonSystem
File.open(SaveData::FILE_PATH, "wb") { |file| Marshal.dump(@save_data, file) }

View File

@@ -608,8 +608,10 @@ class PokemonStorageScene
@markingbitmap = AnimatedBitmap.new("Graphics/UI/Storage/markings")
@sprites["markingbg"] = IconSprite.new(292, 68, @boxsidesviewport)
@sprites["markingbg"].setBitmap("Graphics/UI/Storage/overlay_marking")
@sprites["markingbg"].z = 10
@sprites["markingbg"].visible = false
@sprites["markingoverlay"] = BitmapSprite.new(Graphics.width, Graphics.height, @boxsidesviewport)
@sprites["markingoverlay"].z = 11
@sprites["markingoverlay"].visible = false
pbSetSystemFont(@sprites["markingoverlay"].bitmap)
@sprites["arrow"] = PokemonBoxArrow.new(@arrowviewport)
@@ -1894,8 +1896,8 @@ class PokemonStorageScreen
return
end
if pokemon.item
itemname = pokemon.item.name
if pbConfirm(_INTL("Take this {1}?", itemname))
itemname = pokemon.item.portion_name
if pbConfirm(_INTL("Take the {1}?", itemname))
if $bag.add(pokemon.item)
pbDisplay(_INTL("Took the {1}.", itemname))
pokemon.item = nil

View File

@@ -19,15 +19,15 @@ class PokemonMartAdapter
end
def getName(item)
return GameData::Item.get(item).name
return GameData::Item.get(item).portion_name
end
def getNamePlural(item)
return GameData::Item.get(item).name_plural
return GameData::Item.get(item).portion_name_plural
end
def getDisplayName(item)
item_name = getName(item)
item_name = GameData::Item.get(item).name
if GameData::Item.get(item).is_machine?
machine = GameData::Item.get(item).move
item_name = _INTL("{1} {2}", item_name, GameData::Move.get(machine).name)
@@ -36,7 +36,7 @@ class PokemonMartAdapter
end
def getDisplayNamePlural(item)
item_name_plural = getNamePlural(item)
item_name_plural = GameData::Item.get(item).name_plural
if GameData::Item.get(item).is_machine?
machine = GameData::Item.get(item).move
item_name_plural = _INTL("{1} {2}", item_name_plural, GameData::Move.get(machine).name)
@@ -103,10 +103,22 @@ class BuyAdapter
@adapter = adapter
end
# For showing in messages
def getName(item)
@adapter.getName(item)
end
# For showing in messages
def getNamePlural(item)
@adapter.getNamePlural(item)
end
# For showing in the list of items
def getDisplayName(item)
@adapter.getDisplayName(item)
end
# For showing in the list of items
def getDisplayNamePlural(item)
@adapter.getDisplayNamePlural(item)
end
@@ -128,10 +140,22 @@ class SellAdapter
@adapter = adapter
end
# For showing in messages
def getName(item)
@adapter.getName(item)
end
# For showing in messages
def getNamePlural(item)
@adapter.getNamePlural(item)
end
# For showing in the list of items
def getDisplayName(item)
@adapter.getDisplayName(item)
end
# For showing in the list of items
def getDisplayNamePlural(item)
@adapter.getDisplayNamePlural(item)
end
@@ -583,15 +607,15 @@ class PokemonMartScreen
item = @scene.pbChooseBuyItem
break if !item
quantity = 0
itemname = @adapter.getDisplayName(item)
itemnameplural = @adapter.getDisplayNamePlural(item)
itemname = @adapter.getName(item)
itemnameplural = @adapter.getNamePlural(item)
price = @adapter.getPrice(item)
if @adapter.getMoney < price
pbDisplayPaused(_INTL("You don't have enough money."))
next
end
if GameData::Item.get(item).is_important?
next if !pbConfirm(_INTL("So you want {1}?\nIt'll be ${2}. All right?",
next if !pbConfirm(_INTL("So you want the {1}?\nIt'll be ${2}. All right?",
itemname, price.to_s_formatted))
quantity = 1
else
@@ -632,8 +656,8 @@ class PokemonMartScreen
break if !@adapter.addItem(:PREMIERBALL)
premier_balls_added += 1
end
ball_name = GameData::Item.get(:PREMIERBALL).name
ball_name = GameData::Item.get(:PREMIERBALL).name_plural if premier_balls_added > 1
ball_name = GameData::Item.get(:PREMIERBALL).portion_name
ball_name = GameData::Item.get(:PREMIERBALL).portion_name_plural if premier_balls_added > 1
$stats.premier_balls_earned += premier_balls_added
pbDisplayPaused(_INTL("And have {1} {2} on the house!", premier_balls_added, ball_name))
elsif !Settings::MORE_BONUS_PREMIER_BALLS && GameData::Item.get(item) == :POKEBALL
@@ -661,8 +685,8 @@ class PokemonMartScreen
loop do
item = @scene.pbChooseSellItem
break if !item
itemname = @adapter.getDisplayName(item)
itemnameplural = @adapter.getDisplayNamePlural(item)
itemname = @adapter.getName(item)
itemnameplural = @adapter.getNamePlural(item)
if !@adapter.canSell?(item)
pbDisplayPaused(_INTL("Oh, no. I can't buy {1}.", itemnameplural))
next

View File

@@ -19,15 +19,15 @@ class BattlePointShopAdapter
end
def getName(item)
return GameData::Item.get(item).name
return GameData::Item.get(item).portion_name
end
def getNamePlural(item)
return GameData::Item.get(item).name_plural
return GameData::Item.get(item).portion_name_plural
end
def getDisplayName(item)
item_name = getName(item)
item_name = GameData::Item.get(item).name
if GameData::Item.get(item).is_machine?
machine = GameData::Item.get(item).move
item_name = _INTL("{1} {2}", item_name, GameData::Move.get(machine).name)
@@ -36,7 +36,7 @@ class BattlePointShopAdapter
end
def getDisplayNamePlural(item)
item_name_plural = getNamePlural(item)
item_name_plural = GameData::Item.get(item).name_plural
if GameData::Item.get(item).is_machine?
machine = GameData::Item.get(item).move
item_name_plural = _INTL("{1} {2}", item_name_plural, GameData::Move.get(machine).name)
@@ -446,8 +446,8 @@ class BattlePointShopScreen
item = @scene.pbChooseItem
break if !item
quantity = 0
itemname = @adapter.getDisplayName(item)
itemnameplural = @adapter.getDisplayNamePlural(item)
itemname = @adapter.getName(item)
itemnameplural = @adapter.getNamePlural(item)
price = @adapter.getPrice(item)
if @adapter.getBP < price
pbDisplayPaused(_INTL("You don't have enough BP."))
@@ -484,8 +484,8 @@ class BattlePointShopScreen
end
if added == quantity
$stats.battle_points_spent += price
#Add bpshop_items_bought to $stats?
#$stats.bpshop_items_bought += quantity
# TODO: Add bpshop_items_bought to $stats?
# $stats.bpshop_items_bought += quantity
@adapter.setBP(@adapter.getBP - price)
@stock.delete_if { |item| GameData::Item.get(item).is_important? && $bag.has?(item) }
pbDisplayPaused(_INTL("Here you are! Thank you!")) { pbSEPlay("Mart buy item") }

View File

@@ -406,10 +406,8 @@ def pbReceiveMysteryGift(id)
if $bag.can_add?(item, qty)
$bag.add(item, qty)
itm = GameData::Item.get(item)
itemname = (qty > 1) ? itm.name_plural : itm.name
if item == :LEFTOVERS
pbMessage(_INTL("\\me[Item get]You obtained some \\c[1]{1}\\c[0]!\\wtnp[30]", itemname))
elsif itm.is_machine? # TM or HM
itemname = (qty > 1) ? itm.portion_name_plural : itm.portion_name
if itm.is_machine? # TM or HM
pbMessage(_INTL("\\me[Item get]You obtained \\c[1]{1} {2}\\c[0]!\\wtnp[30]", itemname,
GameData::Move.get(itm.move).name))
elsif qty > 1

View File

@@ -98,8 +98,8 @@ class BattleChallenge
opponent = pbGenerateBattleTrainer(self.nextTrainer, self.rules)
bttrainers = pbGetBTTrainers(@id)
trainerdata = bttrainers[self.nextTrainer]
opponent.lose_text = pbGetMessageFromHash(MessageTypes::EndSpeechLose, trainerdata[4])
opponent.win_text = pbGetMessageFromHash(MessageTypes::EndSpeechWin, trainerdata[3])
opponent.lose_text = pbGetMessageFromHash(MessageTypes::FrontierEndSpeechesLose, trainerdata[4])
opponent.win_text = pbGetMessageFromHash(MessageTypes::FrontierEndSpeechesWin, trainerdata[3])
ret = pbOrganizedBattleEx(opponent, self.rules)
return ret
end
@@ -376,8 +376,8 @@ class BattleFactoryData
pbGetMessageFromHash(MessageTypes::TrainerNames, trainerdata[1]),
trainerdata[0]
)
@opponent.lose_text = pbGetMessageFromHash(MessageTypes::EndSpeechLose, trainerdata[4])
@opponent.win_text = pbGetMessageFromHash(MessageTypes::EndSpeechWin, trainerdata[3])
@opponent.lose_text = pbGetMessageFromHash(MessageTypes::FrontierEndSpeechesLose, trainerdata[4])
@opponent.win_text = pbGetMessageFromHash(MessageTypes::FrontierEndSpeechesWin, trainerdata[3])
opponentPkmn = pbBattleFactoryPokemon(pbBattleChallenge.rules, @bcdata.wins, @bcdata.swaps, @rentals)
@opponent.party = opponentPkmn.sample(3)
end
@@ -401,8 +401,8 @@ class BattleFactoryData
pbGetMessageFromHash(MessageTypes::TrainerNames, trainerdata[1]),
trainerdata[0]
)
@opponent.lose_text = pbGetMessageFromHash(MessageTypes::EndSpeechLose, trainerdata[4])
@opponent.win_text = pbGetMessageFromHash(MessageTypes::EndSpeechWin, trainerdata[3])
@opponent.lose_text = pbGetMessageFromHash(MessageTypes::FrontierEndSpeechesLose, trainerdata[4])
@opponent.win_text = pbGetMessageFromHash(MessageTypes::FrontierEndSpeechesWin, trainerdata[3])
opponentPkmn = pbBattleFactoryPokemon(pbBattleChallenge.rules, @bcdata.wins, @bcdata.swaps,
[].concat(@rentals).concat(@oldopponent))
@opponent.party = opponentPkmn.sample(3)

View File

@@ -92,7 +92,7 @@ def pbBattleChallengeBeginSpeech
return "..." if !pbBattleChallenge.pbInProgress?
bttrainers = pbGetBTTrainers(pbBattleChallenge.currentChallenge)
tr = bttrainers[pbBattleChallenge.nextTrainer]
return (tr) ? pbGetMessageFromHash(MessageTypes::BeginSpeech, tr[2]) : "..."
return (tr) ? pbGetMessageFromHash(MessageTypes::FrontierIntroSpeeches, tr[2]) : "..."
end
#===============================================================================

View File

@@ -134,12 +134,13 @@ def getID(mod, constant)
return constant
end
def getConstantName(mod, value)
def getConstantName(mod, value, raise_if_none = true)
mod = Object.const_get(mod) if mod.is_a?(Symbol)
mod.constants.each do |c|
return c.to_s if mod.const_get(c.to_sym) == value
end
raise _INTL("Value {1} not defined by a constant in {2}", value, mod.name)
raise _INTL("Value {1} not defined by a constant in {2}", value, mod.name) if raise_if_none
return nil
end
def getConstantNameOrValue(mod, value)

View File

@@ -432,13 +432,13 @@ class Slider < UIControl
color = Color.new(120, 120, 120)
bitmap.fill_rect(x, y, width, height, Color.new(0, 0, 0, 0))
size = bitmap.text_size(self.label).width
leftarrows = bitmap.text_size(_INTL(" << "))
leftarrows = bitmap.text_size(_INTL("<<"))
numbers = bitmap.text_size(" XXXX ").width
rightarrows = bitmap.text_size(_INTL(" >> "))
rightarrows = bitmap.text_size(_INTL(">>"))
bitmap.font.color = color
shadowtext(bitmap, x, y, size, height, self.label)
x += size
shadowtext(bitmap, x, y, leftarrows.width, height, _INTL(" << "),
shadowtext(bitmap, x, y, leftarrows.width, height, _INTL("<<"),
self.disabled || self.curvalue == self.minvalue)
@leftarrow = Rect.new(x, y, leftarrows.width, height)
x += leftarrows.width
@@ -447,7 +447,7 @@ class Slider < UIControl
shadowtext(bitmap, x, y, numbers, height, " #{self.curvalue} ", false, 1)
end
x += numbers
shadowtext(bitmap, x, y, rightarrows.width, height, _INTL(" >> "),
shadowtext(bitmap, x, y, rightarrows.width, height, _INTL(">>"),
self.disabled || self.curvalue == self.maxvalue)
@rightarrow = Rect.new(x, y, rightarrows.width, height)
end
@@ -681,12 +681,12 @@ class TextSlider < UIControl
color = Color.new(120, 120, 120)
bitmap.fill_rect(x, y, width, height, Color.new(0, 0, 0, 0))
size = bitmap.text_size(self.label).width
leftarrows = bitmap.text_size(_INTL(" << "))
rightarrows = bitmap.text_size(_INTL(" >> "))
leftarrows = bitmap.text_size(_INTL("<<"))
rightarrows = bitmap.text_size(_INTL(">>"))
bitmap.font.color = color
shadowtext(bitmap, x, y, size, height, self.label)
x += size
shadowtext(bitmap, x, y, leftarrows.width, height, _INTL(" << "),
shadowtext(bitmap, x, y, leftarrows.width, height, _INTL("<<"),
self.disabled || self.curvalue == self.minvalue)
@leftarrow = Rect.new(x, y, leftarrows.width, height)
x += leftarrows.width
@@ -695,7 +695,7 @@ class TextSlider < UIControl
shadowtext(bitmap, x, y, @maxoptionwidth, height, " #{@options[self.curvalue]} ", false, 1)
end
x += @maxoptionwidth
shadowtext(bitmap, x, y, rightarrows.width, height, _INTL(" >> "),
shadowtext(bitmap, x, y, rightarrows.width, height, _INTL(">>"),
self.disabled || self.curvalue == self.maxvalue)
@rightarrow = Rect.new(x, y, rightarrows.width, height)
end

View File

@@ -1088,20 +1088,58 @@ MenuHandlers.add(:debug_menu, :mystery_gift, {
})
MenuHandlers.add(:debug_menu, :extract_text, {
"name" => _INTL("Extract Text"),
"name" => _INTL("Extract Text For Translation"),
"parent" => :other_menu,
"description" => _INTL("Extract all text in the game to a single file for translating."),
"description" => _INTL("Extract all text in the game to text files for translating."),
"effect" => proc {
pbExtractText
if Settings::LANGUAGES.length == 0
pbMessage(_INTL("No languages are defined in the LANGUAGES array in Settings."))
pbMessage(_INTL("You need to add at least one language to LANGUAGES first, to choose which one to extract text for."))
next
end
# Choose a language from Settings to name the extraction folder after
cmds = []
Settings::LANGUAGES.each { |val| cmds.push(val[0]) }
cmds.push(_INTL("Cancel"))
language_index = pbMessage(_INTL("Choose a language to extract text for."), cmds, cmds.length)
next if language_index == cmds.length - 1
language_name = Settings::LANGUAGES[language_index][1]
# Choose whether to extract core text or game text
text_type = pbMessage(_INTL("Choose a language to extract text for."),
[_INTL("Game-specific text"), _INTL("Core text"), _INTL("Cancel")], 3)
next if text_type == 2
# If game text, choose whether to extract map texts to map-specific files or
# to one big file
map_files = 0
if text_type == 0
map_files = pbMessage(_INTL("How many text files should map event texts be extracted to?"),
[_INTL("One big file"), _INTL("One file per map"), _INTL("Cancel")], 3)
next if map_files == 2
end
# Extract the chosen set of text for the chosen language
Translator.extract_text(language_name, text_type == 1, map_files == 1)
}
})
MenuHandlers.add(:debug_menu, :compile_text, {
"name" => _INTL("Compile Text"),
"name" => _INTL("Compile Translated Text"),
"parent" => :other_menu,
"description" => _INTL("Import text and converts it into a language file."),
"description" => _INTL("Import text files and convert them into a language file."),
"effect" => proc {
pbCompileTextUI
# Find all folders with a particular naming convention
cmds = Dir.glob("Text_*_*")
if cmds.length == 0
pbMessage(_INTL("No language folders found to compile."))
pbMessage(_INTL("Language folders must be named \"Text_SOMETHING_core\" or \"Text_SOMETHING_game\" and be in the root folder."))
next
end
cmds.push(_INTL("Cancel"))
# Ask which folder to compile into a .dat file
folder_index = pbMessage(_INTL("Choose a language folder to compile."), cmds, cmds.length)
next if folder_index == cmds.length - 1
# Compile the text files in the chosen folder
dat_filename = cmds[folder_index].gsub!(/^Text_/, "")
Translator.compile_text(cmds[folder_index], dat_filename)
}
})

View File

@@ -546,37 +546,6 @@ end
#===============================================================================
# Text import/export for localisation
#===============================================================================
def pbExtractText
msgwindow = pbCreateMessageWindow
if safeExists?("intl.txt") &&
!pbConfirmMessageSerious(_INTL("intl.txt already exists. Overwrite it?"))
pbDisposeMessageWindow(msgwindow)
return
end
pbMessageDisplay(msgwindow, _INTL("Please wait.\\wtnp[0]"))
MessageTypes.extract("intl.txt")
pbMessageDisplay(msgwindow, _INTL("All text in the game was extracted and saved to intl.txt.\1"))
pbMessageDisplay(msgwindow, _INTL("To localize the text for a particular language, translate every second line in the file.\1"))
pbMessageDisplay(msgwindow, _INTL("After translating, choose \"Compile Text.\""))
pbDisposeMessageWindow(msgwindow)
end
def pbCompileTextUI
msgwindow = pbCreateMessageWindow
pbMessageDisplay(msgwindow, _INTL("Please wait.\\wtnp[0]"))
begin
pbCompileText
pbMessageDisplay(msgwindow, _INTL("Successfully compiled text and saved it to intl.dat.\1"))
pbMessageDisplay(msgwindow, _INTL("To use the file in a game, place the file in the Data folder under a different name, and edit the Settings::LANGUAGES array in the scripts."))
rescue RuntimeError
pbMessageDisplay(msgwindow, _INTL("Failed to compile text: {1}", $!.message))
end
pbDisposeMessageWindow(msgwindow)
end
#===============================================================================
# Battle animations import/export
#===============================================================================

View File

@@ -151,7 +151,7 @@ module Compiler
}
end
# Unused
# Used by translated text compiler
def pbEachSection(f)
lineno = 1
havesection = false
@@ -164,21 +164,21 @@ module Compiler
line.force_encoding(Encoding::UTF_8)
if !line[/^\#/] && !line[/^\s*$/]
if line[/^\s*\[\s*(.+?)\s*\]\s*$/]
yield lastsection, sectionname if havesection
yield lastsection, sectionname if havesection
lastsection.clear
sectionname = $~[1]
lastsection = []
havesection = true
else
if sectionname.nil?
raise _INTL("Expected a section at the beginning of the file (line {1}). Sections begin with '[name of section]'", lineno)
raise _INTL("Expected a section at the beginning of the file (line {1}). Sections begin with '[name of section]'.", lineno)
end
lastsection.push(line.gsub(/^\s+/, "").gsub(/\s+$/, ""))
lastsection.push(line.strip)
end
end
lineno += 1
Graphics.update if lineno % 500 == 0
}
yield lastsection, sectionname if havesection
yield lastsection, sectionname if havesection
end
# Unused
@@ -845,9 +845,9 @@ module Compiler
compile_animations
compile_trainer_events(mustCompile)
Console.echo_li(_INTL("Saving messages..."))
pbSetTextMessages
MessageTypes.saveMessages
MessageTypes.loadMessageFile("Data/messages.dat") if safeExists?("Data/messages.dat")
Translator.gather_script_and_event_texts
MessageTypes.save_default_messages
MessageTypes.load_default_messages if safeExists?("Data/messages_core.dat")
Console.echo_done(true)
Console.echo_li(_INTL("Reloading cache..."))
System.reload_cache

View File

@@ -90,9 +90,9 @@ module Compiler
end
point_names.uniq!
interest_names.uniq!
MessageTypes.setMessages(MessageTypes::RegionNames, region_names)
MessageTypes.setMessagesAsHash(MessageTypes::PlaceNames, point_names)
MessageTypes.setMessagesAsHash(MessageTypes::PlaceDescriptions, interest_names)
MessageTypes.setMessagesAsHash(MessageTypes::Regions, region_names)
MessageTypes.setMessagesAsHash(MessageTypes::RegionLocations, point_names)
MessageTypes.setMessagesAsHash(MessageTypes::RegionDescriptions, interest_names)
end
#=============================================================================
@@ -199,7 +199,7 @@ module Compiler
ability_descriptions.push(ability.real_description)
end
MessageTypes.setMessagesAsHash(MessageTypes::Abilities, ability_names)
MessageTypes.setMessagesAsHash(MessageTypes::AbilityDescs, ability_descriptions)
MessageTypes.setMessagesAsHash(MessageTypes::AbilityDescriptions, ability_descriptions)
end
#=============================================================================
@@ -250,14 +250,20 @@ module Compiler
# Get item names/descriptions for translating
item_names = []
item_names_plural = []
item_portion_names = []
item_portion_names_plural = []
item_descriptions = []
GameData::Item.each do |item|
item_names.push(item.real_name)
item_names_plural.push(item.real_name_plural)
item_portion_names.push(item.real_portion_name)
item_portion_names_plural.push(item.real_portion_name_plural)
item_descriptions.push(item.real_description)
end
MessageTypes.setMessagesAsHash(MessageTypes::Items, item_names)
MessageTypes.setMessagesAsHash(MessageTypes::ItemPlurals, item_names_plural)
MessageTypes.setMessagesAsHash(MessageTypes::ItemPortions, item_portion_names)
MessageTypes.setMessagesAsHash(MessageTypes::ItemPortionPlurals, item_portion_names_plural)
MessageTypes.setMessagesAsHash(MessageTypes::ItemDescriptions, item_descriptions)
end
@@ -364,9 +370,9 @@ module Compiler
species_pokedex_entries.push(species.real_pokedex_entry)
end
MessageTypes.setMessagesAsHash(MessageTypes::Species, species_names)
MessageTypes.setMessagesAsHash(MessageTypes::FormNames, species_form_names)
MessageTypes.setMessagesAsHash(MessageTypes::Kinds, species_categories)
MessageTypes.setMessagesAsHash(MessageTypes::Entries, species_pokedex_entries)
MessageTypes.setMessagesAsHash(MessageTypes::SpeciesForms, species_form_names)
MessageTypes.setMessagesAsHash(MessageTypes::SpeciesCategories, species_categories)
MessageTypes.setMessagesAsHash(MessageTypes::PokedexEntries, species_pokedex_entries)
end
#=============================================================================
@@ -502,9 +508,9 @@ module Compiler
species_categories.push(species.real_category)
species_pokedex_entries.push(species.real_pokedex_entry)
end
MessageTypes.addMessagesAsHash(MessageTypes::FormNames, species_form_names)
MessageTypes.addMessagesAsHash(MessageTypes::Kinds, species_categories)
MessageTypes.addMessagesAsHash(MessageTypes::Entries, species_pokedex_entries)
MessageTypes.addMessagesAsHash(MessageTypes::SpeciesForms, species_form_names)
MessageTypes.addMessagesAsHash(MessageTypes::SpeciesCategories, species_categories)
MessageTypes.addMessagesAsHash(MessageTypes::PokedexEntries, species_pokedex_entries)
end
#=============================================================================
@@ -902,7 +908,7 @@ module Compiler
lose_texts.push(trainer.real_lose_text)
end
MessageTypes.setMessagesAsHash(MessageTypes::TrainerNames, trainer_names)
MessageTypes.setMessagesAsHash(MessageTypes::TrainerLoseText, lose_texts)
MessageTypes.setMessagesAsHash(MessageTypes::TrainerLoseTexts, lose_texts)
end
#=============================================================================
@@ -926,9 +932,9 @@ module Compiler
}
end
sections = []
MessageTypes.setMessagesAsHash(MessageTypes::BeginSpeech, [])
MessageTypes.setMessagesAsHash(MessageTypes::EndSpeechWin, [])
MessageTypes.setMessagesAsHash(MessageTypes::EndSpeechLose, [])
MessageTypes.setMessagesAsHash(MessageTypes::FrontierIntroSpeeches, [])
MessageTypes.setMessagesAsHash(MessageTypes::FrontierEndSpeechesWin, [])
MessageTypes.setMessagesAsHash(MessageTypes::FrontierEndSpeechesLose, [])
File.open(path, "rb") { |f|
FileLineData.file = path
idx = 0
@@ -1016,9 +1022,9 @@ module Compiler
}
end
MessageTypes.addMessagesAsHash(MessageTypes::TrainerNames, trainernames)
MessageTypes.addMessagesAsHash(MessageTypes::BeginSpeech, beginspeech)
MessageTypes.addMessagesAsHash(MessageTypes::EndSpeechWin, endspeechwin)
MessageTypes.addMessagesAsHash(MessageTypes::EndSpeechLose, endspeechlose)
MessageTypes.addMessagesAsHash(MessageTypes::FrontierIntroSpeeches, beginspeech)
MessageTypes.addMessagesAsHash(MessageTypes::FrontierEndSpeechesWin, endspeechwin)
MessageTypes.addMessagesAsHash(MessageTypes::FrontierEndSpeechesLose, endspeechlose)
return sections
end
@@ -1147,7 +1153,7 @@ module Compiler
# Get map names for translating
map_names = []
GameData::MapMetadata.each { |map| map_names[map.id] = map.real_name }
MessageTypes.setMessages(MessageTypes::MapNames, map_names)
MessageTypes.setMessagesAsHash(MessageTypes::MapNames, map_names)
end
#=============================================================================

View File

@@ -24,7 +24,7 @@ end
def mainFunctionDebug
begin
MessageTypes.loadMessageFile("Data/messages.dat") if safeExists?("Data/messages.dat")
MessageTypes.load_default_messages if safeExists?("Data/messages_core.dat")
PluginManager.runPlugins
Compiler.main
Game.initialize