# --------------------------------- #
# PX Mod
# By Prexus
# Adds features to RMXP including:
# Party Selector
# Inn
# Beastiary
# --------------------------------- #
module PXMod
ENABLED = true;
INN_SE = "137-Light03";
STEXT_COLOR = Color.new(0, 0, 0, 192);
class Window_Help < Window_Base
def initialize
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
end
def set_text(text, align = 0)
if text != @text or align != @align
self.contents.clear
self.contents.font.color = normal_color
self.contents.draw_text_shadow(4, 0, self.width - 40, 32, text, align)
@text = text
@align = align
@actor = nil
end
self.visible = true
end
def set_actor(actor)
if actor != @actor
self.contents.clear
draw_actor_name(actor, 4, 0)
draw_actor_state(actor, 140, 0)
draw_actor_hp(actor, 284, 0)
draw_actor_sp(actor, 460, 0)
@actor = actor
@text = nil
self.visible = true
end
end
def set_enemy(enemy)
text = enemy.name
state_text = make_battler_state_text(enemy, 112, false)
if state_text != ""
text += " " + state_text
end
set_text(text, 1)
end
end
end
class Bitmap
def draw_text_shadow(x, y, wid, hei, text, align = 0)
color = self.font.color.clone;
self.font.color = PXMod::STEXT_COLOR;
draw_text(x+1, y+1, wid, hei, text, align)
self.font.color = color
draw_text(x, y, wid, hei, text, align)
end
end
# ------------------------------------------------------------------- #
# PXMod::Inn #
# By Prexus #
# Description: Mimics the Inn function of old RPG Makers and most #
# commercial RPGs. #
# ------------------------------------------------------------------- #
class Scene_Map
alias pxmod_s_map_update update
def update
if PXMod::ENABLED
if $inn
if $inn.active
$inn.update
else
$inn = nil
return
end
$game_map.update
$game_system.update
$game_screen.update
@spriteset.update
@message_window.update
return
end
end
pxmod_s_map_update
end
end
# ------------------------------------------------------------------- #
# Appends to Module::PXMod #
# By Prexus #
# These are parts of the script that act independantly of the default #
# RGSS coding. Its very important to PXMod to do the work this way. #
# ------------------------------------------------------------------- #
module PXMod
class Inn
attr_accessor :active
def initialize(price=0, message='Would you like to stay the night?')
@price = price
@message = message
@active = true
@wait_count = 0
@started = false
@message_window = PXMod::Window_InnMessage.new(@message.to_s)
@price_window = PXMod::Window_Price.new(@price)
@yesno_window = Window_Command.new(128, ['Yes', 'No'])
@yesno_window.x = 512
@yesno_window.y = 64
end
def update
@message_window.update
@price_window.update
@yesno_window.update
if @wait_count != 0
@wait_count -= 1
if @started
if @wait_count == 0
Audio.se_play("Audio/SE/" + PXMod::INN_SE)
for actor in $game_party.actors
actor.recover_all
end
$game_screen.start_tone_change(Tone.new(0, 0, 0, 0), 40)
@started = false
@wait_count = 80
end
else
dispose
return
end
return
end
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
dispose
return
end
if Input.trigger?(Input::C)
case @yesno_window.index
when 0 # Yes
if $game_party.gold < @price
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.decision_se)
$game_party.lose_gold(@price)
$game_screen.start_tone_change(Tone.new(-255, -255, -255, 0), 40)
@message_window.visible = false
@price_window.visible = false
@yesno_window.visible = false
@started = true
@wait_count = 60
when 1 # No
$game_system.se_play($data_system.decision_se)
dispose
end
return
end
end
def dispose
@active = false
@message_window.dispose
@price_window.dispose
@yesno_window.dispose
end
end
class Window_InnMessage < Window_Base
def initialize(message)
super(0, 0, 640, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.draw_text_shadow(4, 0, self.contents.width - 4, 32, message.to_s, 1)
end
end
class Window_Price < Window_Base
def initialize(price)
super(416, 64, 96, 64)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.draw_text_shadow(4, 0, self.contents.width - 4, 32, price.to_s + ' ' + $data_system.words.gold, 1)
end
end
end
# ------------------------------------------------------------------- #
# PXMod::PartyManager #
# By Prexus #
# Description: Allows you to change your party based on availability. #
# ------------------------------------------------------------------- #
# Add a player's Party status to Game_Actor
class Game_Actor < Game_Battler
attr_accessor :party;
alias pxmod_g_actor_setup setup;
def setup(actor_id)
pxmod_g_actor_setup(actor_id);
@party = Game_Actor::Party.new;
end
# Subclass Party to Game_Actor holds any party information.
class Party
def initialize
# This determines if they are available in the PartySelector
@available = false;
@first_time = true;
@mandatory = false;
end
attr_accessor :available;
attr_accessor :first_time;
attr_accessor :mandatory;
end
end
# Adds functions to Game_Party to add and remove party members with ease.
class Game_Party
# Add the Manager subclass to Game_Party to handle methods to add/remove members
# with the new system.
attr_accessor :manager;
alias pxmod_g_party_initialize initialize
def initialize
pxmod_g_party_initialize;
@manager = Game_Party::Manager.new;
end
# Editting the default method to setup starting members to adjust for
# Game_Actor::Party
# Only if PXMOD_ENABLED == True
def setup_starting_members
@actors = [];
for i in $data_system.party_members
if PXMod::ENABLED
add_actor($game_actors
.id);
else
@actors.push($game_actors);
end
end
end
# Adds a condition to add_actor to update Game_Actor::Party if PXMOD is on.
alias pxmod_g_party_add add_actor;
def add_actor(actor_id)
pxmod_g_party_add(actor_id);
return if not PXMod::ENABLED;
actor = $game_actors[actor_id];
@manager.add_actor(actor);
end
# Handles methods and classes beyond the default Game_Party
class Manager
# Updates the Actor's information if PXMOD is Enabled.
def add_actor(actor)
actor.party.available = true;
actor.party.first_time = false;
$game_player.refresh;
end
end
end
# Automagically creates the entire actor database instead of only if you have
# referenced $game_actors[id]. Makes it easier to locate unused actors.
class Game_Actors
# Makes Data readable.
attr_reader :data;
alias pxmod_g_actors_initialize initialize;
def initialize
pxmod_g_actors_initialize;
# Checks all of $data_actors and adds all the available actors.
for i in $data_actors
if @data[i.id] == nil
@data[i.id] = Game_Actor.new(i.id);
end
end
end
end
# ------------------------------------------------------------------- #
# Appends to Module::PXMod #
# By Prexus #
# These are parts of the script that act independantly of the default #
# RGSS coding. Its very important to PXMod to do the work this way. #
# ------------------------------------------------------------------- #
module PXMod
class Scene_PartyManager
def main
if not PXMod::ENABLED
$scene = Scene_Map.new;
return;
end
@current_party = Window_CurrentParty.new;
@available_actors = Window_Available.new;
@actor_status = Window_ActorStatus.new;
Graphics.transition;
loop do
Graphics.update;
Input.update;
update;
if $scene != self
break;
end
end
Graphics.freeze;
@current_party.dispose;
@available_actors.dispose;
@actor_status.dispose;
end
def update
@current_party.update;
@available_actors.update;
@actor_status.update;
if @current_party.active
@actor_status.actor(@current_party.actor);
if Input.trigger?(Input::B)
if $game_party.actors.size == 0
$game_system.se_play($data_system.buzzer_se);
return;
end
$game_system.se_play($data_system.cancel_se);
$scene = Scene_Menu.new(3);
return;
end
if Input.trigger?(Input::C)
@actor = @current_party.actor;
if @actor != nil
if @actor.party.mandatory
$game_system.se_play($data_system.buzzer_se);
return;
end
end
$game_system.se_play($data_system.decision_se);
@available_actors.active = true;
@available_actors.index = 0;
@current_party.active = false;
return;
end
return;
end
if @available_actors.active
@actor_status.actor(@available_actors.actor);
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se);
@actor = nil;
@available_actors.active = false;
@available_actors.index = -1;
@current_party.active = true;
@current_party.index = 0;
return;
end
if Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se);
$game_party.add_actor(@available_actors.actor.id) unless @available_actors.actor == nil;
$game_party.remove_actor(@actor.id) unless @actor == nil;
@current_party.refresh;
@available_actors.refresh;
@actor = nil;
@available_actors.active = false;
@available_actors.index = -1;
@current_party.active = true;
@current_party.index = 0;
return;
end
return;
end
end
end
class Window_ActorStatus < Window_Base
def initialize
super(232, 96, 288, 144);
self.contents = Bitmap.new(width - 32, height - 32);
@actor = nil;
refresh;
end
def actor(actor)
@actor = actor;
refresh;
end
def refresh
self.contents.clear;
return if @actor == nil;
draw_actor_graphic(@actor, 16, 48);
self.contents.draw_text_shadow(40, 0, 144, 24, @actor.name.to_s);
self.contents.draw_text_shadow(184, 0, 72, 32, "Lv. " + @actor.level.to_s, 2);
self.contents.draw_text_shadow(40, 24, 216, 24, @actor.class_name.to_s);
self.contents.draw_text_shadow(0, 48, 256, 32, "HP: " + @actor.hp.to_s + ":" + @actor.maxhp.to_s, 1);
self.contents.draw_text_shadow(0, 80, 256, 32, "SP: " + @actor.sp.to_s + ":" + @actor.maxsp.to_s, 1);
end
end
class Window_Available < Window_Selectable
def initialize
super(120, 240, 400, 144);
self.contents = Bitmap.new(width - 32, height - 32);
@data = [];
for i in $game_actors.data
next if $game_party.actors.include?(i);
next if i == nil;
next if i.party.available == false;
@data.push(i);
end
for i in 0...16-@data.size
@data.push(nil);
end
@item_max = @data.size;
@column_max = @data.size >= 8 ? 8 : @data.size;
@index = -1; @active = false;
refresh;
end
def actor
return @data[self.index];
end
def refresh
self.contents.clear;
@data = [];
for i in $game_actors.data
next if $game_party.actors.include?(i);
next if i == nil;
next if i.party.available == false;
@data.push(i);
end
for i in 0...16-@data.size
@data.push(nil);
end
for index in 0..@data.size
actor = @data[index];
return if actor == nil;
x = (index) % 8 * 48;
y = (index) / 8 * 64;
draw_actor_graphic(actor, x+16, y+48);
end
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty;
else
self.cursor_rect.set(@index % 8 * 48, @index / 8 * 64, 32, 48);
end
end
end
class Window_CurrentParty < Window_Selectable
def initialize
super(120, 96, 112, 144);
self.contents = Bitmap.new(width - 32, height - 32);
@item_max = 4;
@column_max = 2;
@index = 0;
refresh;
end
def actor
return $game_party.actors[self.index];
end
def refresh
self.contents.clear;
for index in 0..$game_party.actors.size
actor = $game_party.actors[index];
return if actor == nil;
x = (index) % 2 * 48;
y = (index) / 2 * 64;
draw_actor_graphic(actor, x+16, y+48);
end
end
def update_cursor_rect
if @index < 0
self.cursor_rect.empty;
else
self.cursor_rect.set(@index % 2 * 48, @index / 2 * 64, 32, 48);
end
end
end
end
# ------------------------------------------------------------------- #
# PXMod::Beastiary #
# By Prexus #
# Description: Allows you to view enemies in the game and their stats #
# ------------------------------------------------------------------- #
module RPG
class Enemy
alias pxmod_r_enemy_initialize initialize
def initialize
pxmod_r_enemy_initialize
@seen = false
end
attr_accessor :seen
def set_seen(yes = false)
@seen = yes
end
end
end
class Game_Enemy < Game_Battler
alias pxmod_g_enemy_initialize initialize
def initialize(troop_id, member_index)
pxmod_g_enemy_initialize(troop_id, member_index)
enemy = $data_enemies[@enemy_id]
enemy.set_seen(true)
end
end
module PXMod
class Window_BeastList < Window_Selectable
def initialize
super(480, 64, 160, 416);
self.index = 0;
refresh;
end
def enemy
return @data[self.index];
end
def refresh
if self.contents != nil
self.contents.dispose;
self.contents = nil;
end
@data = [];
for i in 1...$data_enemies.size
if $data_enemies.seen
@data.push($data_enemies);
else
@data.push('?');
end
end
@item_max = @data.size;
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32);
for i in 0...@item_max
draw_item(i);
end
end
end
def draw_item(index)
item = @data[index];
x = 4;
y = index * 32;
case item
when RPG::Enemy
self.contents.draw_text_shadow(x, y, self.contents.width - 8, 32,
"#{item.id}: #{item.name}", 0);
else
self.contents.draw_text_shadow(x, y, self.contents.width - 8, 32, item, 1);
end
end
end
class Window_BeastInfo < Window_Base
def initialize
super(0, 64, 480, 416);
self.contents = Bitmap.new(width - 32, height - 32);
end
def refresh(enemy)
return if enemy == @enemy;
@enemy = enemy;
self.contents.clear;
third_width = (self.contents.width - / 3;
y_offset = 192;
if @enemy.is_a?(String);
rect = Rect.new(0, 0, third_width+8, 32);
rect2 = Rect.new(1, 1, third_width+6, 30);
self.contents.fill_rect(rect, Color.new(0, 0, 32, 160));
self.contents.fill_rect(rect2, Color.new(32, 32, 64, 114));
rect = Rect.new(0, y_offset, self.contents.width, self.contents.height - 192);
rect2 = Rect.new(1, y_offset + 1, self.contents.width - 2, self.contents.height - 194);
self.contents.fill_rect(rect, Color.new(0, 0, 32, 160));
self.contents.fill_rect(rect2, Color.new(32, 32, 64, 114));
return
else
bitmap = RPG::Cache.battler(@enemy.battler_name, @enemy.battler_hue);
src_rect = Rect.new(0, 0, bitmap.width, bitmap.height);
x = (self.contents.width - bitmap.width) / 2;
self.contents.blt(x, 0, bitmap, src_rect);
rect = Rect.new(0, 0, third_width+8, 32);
rect2 = Rect.new(1, 1, third_width+6, 30);
self.contents.fill_rect(rect, Color.new(0, 0, 32, 160));
self.contents.fill_rect(rect2, Color.new(32, 32, 64, 114));
rect = Rect.new(0, y_offset, self.contents.width, self.contents.height - 192);
rect2 = Rect.new(1, y_offset + 1, self.contents.width - 2, self.contents.height - 194);
self.contents.fill_rect(rect, Color.new(0, 0, 32, 160));
self.contents.fill_rect(rect2, Color.new(32, 32, 64, 114));
end
self.contents.draw_text_shadow(4, 0, third_width, 32, @enemy.name, 1);
self.contents.draw_text_shadow(4, y_offset, third_width, 32,
"#{$data_system.words.hp}: #{@enemy.maxhp}", 0);
self.contents.draw_text_shadow(third_width, y_offset, third_width, 32,
"#{$data_system.words.sp}: #{@enemy.maxsp}", 0);
self.contents.draw_text_shadow(4, y_offset + 32, third_width, 32,
"#{$data_system.words.str}: #{@enemy.str}", 0);
self.contents.draw_text_shadow(4, y_offset + 64, third_width, 32,
"#{$data_system.words.dex}: #{@enemy.dex}", 0);
self.contents.draw_text_shadow(third_width, y_offset + 32, third_width, 32,
"#{$data_system.words.agi}: #{@enemy.agi}", 0);
self.contents.draw_text_shadow(third_width, y_offset + 64, third_width, 32,
"#{$data_system.words.int}: #{@enemy.int}", 0);
self.contents.draw_text_shadow(third_width*2, y_offset + 32, third_width, 32,
"EXP: #{@enemy.exp}", 0);
self.contents.draw_text_shadow(third_width*2, y_offset + 64, third_width, 32,
"#{$data_system.words.gold}: #{@enemy.gold}", 0);
self.contents.draw_text_shadow(4, y_offset + 128, third_width, 32,
"#{$data_system.words.atk}: #{@enemy.atk}", 0);
self.contents.draw_text_shadow(4, y_offset + 160, third_width, 32,
"Evasion: #{@enemy.eva}", 0);
self.contents.draw_text_shadow(third_width, y_offset + 128, third_width, 32,
"#{$data_system.words.pdef}: #{@enemy.pdef}", 0);
self.contents.draw_text_shadow(third_width, y_offset + 160, third_width, 32,
"#{$data_system.words.mdef}: #{@enemy.mdef}", 0);
self.contents.draw_text_shadow(third_width*2, y_offset + 128, third_width, 32,
"Prob%: #{@enemy.treasure_prob}", 0);
if @enemy.item_id > 0
item_name = $data_items[@enemy.item_id];
elsif @enemy.weapon_id > 0
item_name = $data_weapons[@enemy.weapon_id];
elsif @enemy.armor_id > 0
item_name = $data_armors[@enemy.armor_id];
else
item_name = 'No Treasure';
end
self.contents.draw_text_shadow(third_width*2, y_offset + 160, third_width, 32,
"#{item_name}", 0);
end
end
class Scene_Beastiary
def main
@help_window = PXMod::Window_Help.new;
@help_window.set_text("Press Cancel to return to the Menu.", 1)
@beast_list = PXMod::Window_BeastList.new;
@beast_info = PXMod::Window_BeastInfo.new;
@beast_info.refresh(@beast_list.enemy);
Graphics.transition;
loop do
Graphics.update;
Input.update;
update;
if $scene != self
break;
end
end
Graphics.freeze;
@help_window.dispose;
@beast_list.dispose;
@beast_info.dispose;
end
def update
@help_window.update;
@beast_list.update;
@beast_info.refresh(@beast_list.enemy);
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
$scene = Scene_Menu.new(5)
return
end
end
end
end