Changing the player's character or outfit immediately updates the player's graphic again

This commit is contained in:
Maruno17
2021-10-26 22:54:31 +01:00
parent 6c38f769c7
commit 6066797517
3 changed files with 33 additions and 9 deletions

View File

@@ -3,9 +3,9 @@
#===============================================================================
class Player < Trainer
# @return [Integer] the character ID of the player
attr_accessor :character_ID
attr_reader :character_ID
# @return [Integer] the player's outfit
attr_accessor :outfit
attr_reader :outfit
# @return [Array<Boolean>] the player's Gym Badges (true if owned)
attr_accessor :badges
# @return [Integer] the player's money
@@ -31,11 +31,20 @@ class Player < Trainer
# @return [Array<Array>] downloaded Mystery Gift data
attr_accessor :mystery_gifts
def character_ID=(value)
return if @character_ID == value
@character_ID = value
$game_player.refresh_charset if $game_player
end
def outfit=(value)
return if @outfit == value
@outfit = value
$game_player.refresh_charset if $game_player
end
def trainer_type
if @trainer_type.is_a?(Integer)
@trainer_type = GameData::PlayerMetadata.get(@character_ID || 1).trainer_type
end
return @trainer_type
return GameData::PlayerMetadata.get(@character_ID || 1).trainer_type
end
# Sets the player's money. It can not exceed {Settings::MAX_MONEY}.