[Autor: Cayoda ]
Rpg Maker Online System
Introdução
Permite o uso de Blizz-ABS com o RMX-OS e ainda contem ADD-Ons Como PVP e salva todas as informações em SQL, alem de ver com um sistema de party adaptado.
Script
Crie um script acima do Main e coloque o código.
Em Seguida, va no arquivo cfg.ini na pasta RMX-OS Server e procure pela linha EXTENSIONS = [ ] e entre os colchetes digite "blizzabs" com as aspas e pronto!, ja esta funcionando:ok:
LEMBRANDO, este script só funciona com o RMX-OS E alem disto é necessário o BlizzABS Versão 2.7 ou superior,
Blizzard-ABS Para RMX-OS
Rpg Maker Online System
Introdução
Permite o uso de Blizz-ABS com o RMX-OS e ainda contem ADD-Ons Como PVP e salva todas as informações em SQL, alem de ver com um sistema de party adaptado.
Script
Crie um script acima do Main e coloque o código.
- Código:
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
# Blizz-ABS Controller for RMX-OS by Blizzard
# Version: 1.02
# Type: RMX-OS Add-on
# Date: 15.2.2010
# Date v1.01: 16.2.2010
# Date v1.02: 23.4.2010
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# This script is to be distributed under the same terms and conditions like
# the scripts it was created for: RMX-OS and Blizz-ABS.
#
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
#
# Information:
#
# This script must be placed below RMX-OS and Blizz-ABS. It requires RMX-OS
# v1.1 or higher and Blizz-ABS 2.7 or higher to work properly. This script
# will allow the RMX-OS Server to assign a client the role of the processor
# (Global Master) and allow global processing Blizz-ABS AI behavior.
#
#
# What is different:
#
# - Map actor data will not be stored completely. Special states and effects
# that are related to Blizz-ABS (i.e. the data regarding the charging
# state) are not being saved.
# - RMX-OS was not intended to have Blizz-ABS allies! Players will not see
# other players' allies on the map if you add them and you are risking data
# corruption during saving! The same goes for summons!
# - Alignment groups are available, but dynamic change of alignment groups
# is mostly disabled for convenience.
# - Target selection is disabled. Every skill that has target selection will
# be executed immediately. If a selection skill targets only one target, a
# random target from all available targets will be chosen. Generally you
# should avoid single-target selection skills and items.
# - ABSEAL is disabled.
# - Processing takes place only on the Global Master client that is assigned
# dynamically by the server.
# - Killed enemy events that are set on Death trigger are run only on the
# Global Master client. It is recommended that killed enemies trigger
# global switches that run common events. For that you need a plugin for
# RMX-OS that allows you to have global switches.
# - Item / Gold Drops are disabled. The actor who killed the enemy will get
# the item reward. EXP and gold rewards are shared among party members
# where each party member adds a specific amount to the gained EXP.
# Remember that items can be traded so a shared item reward is unnecessary.
#
#
# Notes:
#
# - Keep in mind that adding and/or removing this script will corrupt the
# save data in the RMX-OS SQL database.
# - You shouldn't have any non-map scenes during the battle. This can disrupt
# the normal game flow. You should get a custom menu system on the map for
# the menu system specifically.
#
#
# If you find any bugs, please report them here:
# [url=http://forum.chaos-project.com]http://forum.chaos-project.com[/url]
#:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=:=
if !$BlizzABS || BlizzABS::VERSION < 2.7
raise 'ERROR: The "Blizz-ABS Controller" requires Blizz-ABS 2.7 or higher.'
elsif !defined?(RMXOS) || RMXOS::VERSION < 1.1
raise 'ERROR: The "Blizz-ABS Controller" requires RMX-OS 1.1 or higher.'
end
$blizzabs_rmxos = 1.02
#==============================================================================
# module RMXOS
#==============================================================================
module RMXOS
#============================================================================
# module RMXOS::Options
#============================================================================
module Options
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# START Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# PvP active or not
PVP = false
# how much percent to the total EXP gain does each party member add
PARTY_EXP_BONUS = 20
# how much percent to the total gold gain does each party member add
PARTY_GOLD_BONUS = 20
# this should be only changed if necessary!
BATTLER_VARIABLES = ['@battler|@hp', [email='@battler|@sp']'@battler|@sp'[/email],
[email='@battler|@states']'@battler|@states'[/email], [email='@battler|@states_turn']'@battler|@states_turn'[/email], [email='@battler|@state_time']'@battler|@state_time'[/email],
[email='@battler|@states_turn']'@battler|@states_turn'[/email], [email='@battler|@state_time']'@battler|@state_time'[/email], [email='@battler|@states']'@battler|@states'[/email],
[email='@ai|@positive']'@ai|@positive'[/email], [email='@ai|@negative']'@ai|@negative'[/email], [email='@ai|@neutral']'@ai|@neutral'[/email]]
ACTOR_VARIABLES = ['@battler|@actor_id', [email='@battler|@class_id']'@battler|@class_id'[/email],
[email='@battler|@level']'@battler|@level'[/email], [email='@battler|@maxhp_plus']'@battler|@maxhp_plus'[/email], [email='@battler|@maxsp_plus']'@battler|@maxsp_plus'[/email],
[email='@battler|@str_plus']'@battler|@str_plus'[/email], [email='@battler|@dex_plus']'@battler|@dex_plus'[/email], [email='@battler|@agi_plus']'@battler|@agi_plus'[/email],
[email='@battler|@int_plus']'@battler|@int_plus'[/email], [email='@battler|@skills']'@battler|@skills'[/email], [email='@battler|@weapon_id']'@battler|@weapon_id'[/email],
[email='@battler|@armor1_id']'@battler|@armor1_id'[/email], [email='@battler|@armor2_id']'@battler|@armor2_id'[/email], [email='@battler|@armor4_id']'@battler|@armor4_id'[/email],
[email='@battler|@armor3_id']'@battler|@armor3_id'[/email], [email='@battler|@character_name']'@battler|@character_name'[/email],
[email='@battler|@character_hue']'@battler|@character_hue'[/email]]
ENEMY_VARIABLES = ['@battler|@enemy_id', [email='@battler|@immortal']'@battler|@immortal'[/email],
[email='@ai|@altered_alignment']'@ai|@altered_alignment'[/email], [email='@ai|@aggressive']'@ai|@aggressive'[/email], [email='@ai|@view_range']'@ai|@view_range'[/email],
[email='@ai|@hearing_range_ratio']'@ai|@hearing_range_ratio'[/email]]
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# END Configuration
#::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
# because Game_Player was redefined
old_Game_Player = SAVE_DATA.keys.find_all {|key|
key.is_a?(Class) && key.name == 'Game_Player'}[0]
SAVE_DATA[Game_Player] = SAVE_DATA[old_Game_Player]
SAVE_DATA.delete(old_Game_Player)
# other additional save data
SAVE_DATA[Map_Actor] = SAVE_DATA[Game_Player].clone
SAVE_DATA[Game_System].concat(['@hud', [email='@hotkeys']'@hotkeys'[/email], [email='@minimap']'@minimap'[/email],
[email='@attack_button']'@attack_button'[/email], [email='@defend_button']'@defend_button'[/email], [email='@skill_button']'@skill_button'[/email], [email='@item_button']'@item_button'[/email],
[email='@select_button']'@select_button'[/email], [email='@hud_button']'@hud_button'[/email], [email='@hotkey_button']'@hotkey_button'[/email], [email='@minimap_button']'@minimap_button'[/email],
[email='@turn_button']'@turn_button'[/email], [email='@running_button']'@running_button'[/email], [email='@sneaking_button']'@sneaking_button'[/email], [email='@jumping_button']'@jumping_button'[/email],
[email='@caterpillar']'@caterpillar'[/email], [email='@caterpillar_active']'@caterpillar_active'[/email]])
SAVE_DATA[Game_Actor].concat(['@skill', [email='@item']'@item'[/email], [email='@skill_hotkeys']'@skill_hotkeys'[/email],
[email='@item_hotkeys']'@item_hotkeys'[/email], [email='@old_level']'@old_level'[/email], [email='@offensive']'@offensive'[/email], [email='@aggressive']'@aggressive'[/email],
[email='@force_offensive']'@force_offensive'[/email], [email='@force_aggressive']'@force_aggressive'[/email], [email='@state_time']'@state_time'[/email], [email='@triggers']'@triggers'[/email]])
SAVE_DATA[BlizzABS::Trigger] = ['@activator', [email='@condition']'@condition'[/email], [email='@comparator']'@comparator'[/email],
[email='@value']'@value'[/email], [email='@action_type']'@action_type'[/email], [email='@action_data']'@action_data'[/email], [email='@target']'@target'[/email]]
# new creation data
CREATION_DATA[Map_Actor] = '0'
end
#============================================================================
# module RMXOS::Data
#============================================================================
module Data
PartyAlreadyMember = 'Player is already a member of your party.'
PartyNone = 'You are not in a party.'
PartyNotLeader = 'You are not the leader of the party.'
PartyNotMember = 'Player is not a member of your party.'
PartyInfo = 'Party Leader: LEADER; Members: MEMBERS'
ColorParty = Color.new(0xFF, 0x7F, 0x1F)
end
#============================================================================
# module RMXOS::Documentation
#============================================================================
module Documentation
# Party commands
PARAMETERS['party'] = 'USERNAME'
PARAMETERS['premove'] = 'USERNAME'
PARAMETERS['pleave'] = 'none'
PARAMETERS['pmsg'] = 'MESSAGE'
PARAMETERS['pinfo'] = 'none'
DESCRIPTIONS['party'] = 'Invites a player into your party.'
DESCRIPTIONS['premove'] = 'Removes a player from your party.'
DESCRIPTIONS['pleave'] = 'Leaves the current party. Disbands the party if you are the party leader.'
DESCRIPTIONS['pmsg'] = 'Sends a message to all party members.'
DESCRIPTIONS['pinfo'] = 'Displays information about your party.'
end
end
#==============================================================================
# module BlizzABS
#==============================================================================
module BlizzABS
#============================================================================
# module BlizzABS::Config
#============================================================================
module Config
ABSEAL_FACTOR = 485
GOLD_DROP = ''
ITEM_DROP = false
CORPSES = false
end
#============================================================================
# module BlizzABS::Alignments
#============================================================================
module Alignments
ONLINE_GROUP = 0
GROUPS.push(ONLINE_GROUP)
GROUPS.sort!
class << Alignments
alias neutral_blizzabsrmxos_later neutral
alias negative_blizzabsrmxos_later neutral
end
def self.negative(id)
result = negative_blizzabsrmxos_later(id)
case id
when ONLINE_GROUP
result = GROUPS.clone
result.delete(id)
result.delete(ACTOR_GROUP) if !RMXOS::Options::PVP
when ENEMY_GROUP
result.push(ONLINE_GROUP)
end
return result
end
def self.neutral(id)
result = neutral_blizzabsrmxos_later(id)
result |= [ONLINE_GROUP]
return result
end
end
#============================================================================
# BlizzABS::AI::Data_Enemy
#============================================================================
class AI::Data_Enemy
alias lifeless_blizzabsrmxos_later? lifeless?
def lifeless?
return (!$network.gmaster || lifeless_blizzabsrmxos_later?)
end
end
#============================================================================
# BlizzABS::Processor
#============================================================================
class Processor
alias update_killed_blizzabsrmxos_later update_killed
def update_killed
update_killed_blizzabsrmxos_later if $network.gmaster
end
alias exp_result_blizzabsrmxos_later exp_result
def exp_result(enemy)
if enemy.last_targeter == $network.user_id ||
$network.party.include?(enemy.last_targeter)
return exp_result_blizzabsrmxos_later(enemy)
end
return 0
end
alias gold_result_blizzabsrmxos_later gold_result
def gold_result(enemy)
if enemy.last_targeter == $network.user_id ||
$network.party.include?(enemy.last_targeter)
return gold_result_blizzabsrmxos_later(enemy)
end
return 0
end
alias additional_result_blizzabsrmxos_later additional_result
def additional_result(enemy)
if enemy.last_targeter == $network.user_id
return additional_result_blizzabsrmxos_later(enemy)
end
end
alias drop_items_blizzabsrmxos_later drop_items
def drop_items(enemy)
if enemy.last_targeter == $network.user_id
return drop_items_blizzabsrmxos_later(enemy)
end
return []
end
alias remove_enemy_blizzabsrmxos_later remove_enemy
def remove_enemy(enemy, override = false)
if $network.gmaster && !override
$network.send_enemy_death(enemy)
elsif override
remove_enemy_blizzabsrmxos_later(enemy)
end
end
end
#============================================================================
# BlizzABS::Controller
#============================================================================
class Controller
alias update_control_blizzabsrmxos_later update_control
def update_control
update_control_blizzabsrmxos_later if !$game_temp.chat_active
end
end
#============================================================================
# BlizzABS::Controls
#============================================================================
class Controls
alias update_blizzabsrmxos_later update
def update
update_blizzabsrmxos_later if !$game_temp.chat_active
end
end
#============================================================================
# BlizzABS::Utility
#============================================================================
class Utility
alias request_damage_sprite_blizzabsrmxos_later request_damage_sprite
def request_damage_sprite(char, damage = nil)
if $network.gmaster
char.check_battler_changes(['@battler|@damage', [email='@battler|@hpdamage']'@battler|@hpdamage'[/email],
[email='@battler|@spdamage']'@battler|@spdamage'[/email], [email='@battler|@hp']'@battler|@hp'[/email], [email='@battler|@sp']'@battler|@sp'[/email]])
end
request_damage_sprite_blizzabsrmxos_later(char, damage)
end
end
end
$BlizzABS = BlizzABS::Processor.new
#==============================================================================
# RMXOS::Network
#==============================================================================
class RMXOS::Network
attr_reader :gmaster
attr_reader :party
attr_reader :partyleader
alias init_blizzabsrmxos_later initialize
def initialize
init_blizzabsrmxos_later
@gmaster = false
self.party_reset
end
alias reset_blizzabsrmxos_later reset
def reset
self.party_reset
reset_blizzabsrmxos_later
end
def party_reset
@partyleader = ''
@party = []
end
alias check_game_blizzabsrmxos_later check_game
def check_game(message)
case message
when /\AGMA\Z/
@gmaster = true
return true
when /\AGMD\Z/
@gmaster = false
return true
when /\AMAA(.+)\t(.+)/
id = $1.to_i
if id == @user_id
$game_player.apply_data(eval($2))
elsif @players.has_key?(id)
@players[id].apply_data(eval($2))
end
return true
when /\AMAB(.+)\t(.+)/
id = $1.to_i
$game_map.events[id].apply_data(eval($2)) if $game_map.events.has_key?(id)
return true
when /\AMDC(.+)/
data = eval("[#{$1}]")
id = data[0]
self.update_online_battler(id, data)
return true
when /\AMDR\Z/
$game_map.battlers.each {|battler|
send_character_data(battler)
battler.send_battler_data}
return true
when /\ABED(.+)\t(.+)/
id = $1.to_i
if $game_map.events.has_key?(id)
$game_map.events[id].last_targeter = $2.to_i
$BlizzABS.remove_enemy($game_map.events[id], true)
end
return true
when /\APIN(.+)\t(.+)/
@partyleader = $1
@party = eval($2).compact.sort
@party.delete(@username)
return true
when /\APRM\Z/
self.party_reset
return true
when /\APRE(.+)/
@party.delete($1)
return true
when /\AIRM(.+)/
$game_party.lose_item($1.to_i)
return true
end
return check_game_blizzabsrmxos_later(message)
end
alias check_normal_commands_blizzabsrmxos_later check_normal_commands
def check_normal_commands(message)
case message
when /\A\/party (\S+)\Z/
command_party_invite($1)
return true
when /\A\/premove (\S+)\Z/
command_party_remove($1)
return true
when /\A\/pleave\Z/
command_party_leave
return true
when /\A\/pmsg (\S{1}.*)/
command_party_chat($1)
return true
when /\A\/pinfo\Z/
command_party_info
return true
end
return check_normal_commands_blizzabsrmxos_later(message)
end
def partyleader?
return (self.in_party? && @partyleader == @username)
end
def in_party?
return (@partyleader != '')
end
def check_partyleader_action
if !self.partyleader?
self.add_error(RMXOS::Data::PartyNotLeader)
return false
end
return true
end
def check_party_action
if !self.in_party?
self.add_error(RMXOS::Data::PartyNone)
return false
end
return true
end
def command_party_invite(username)
if !self.in_party? || self.check_partyleader_action
if @party.include?(username)
self.add_error(RMXOS::Data::PartyAlreadyMember)
else
self.send("PIN#{username}")
end
end
end
def command_party_remove(username)
if self.check_partyleader_action
if [email=!@party.include?(username]!@party.include?(username[/email])
self.add_error(RMXOS::Data::PartyNotMember)
else
self.send("PRE#{username}")
end
end
end
def command_party_leave
if self.check_party_action
self.send('PLE')
end
end
def command_party_info
if self.check_party_action
text = RMXOS::Data::PartyInfo.sub('LEADER') [email={@partyleader]{@partyleader[/email]}
text = text.sub('MEMBERS') {(@party - [@partyleader]).join(', ')}
self.add_info(text)
end
end
def command_party_chat(message)
if self.check_party_action
send_chat_message(message, RMXOS::Data::ColorParty, 'PME')
end
end
def update_online_battler(id, data, move_instantly = false)
if !$game_map.events.has_key?(id) || !$game_map.events[id].is_a?(Map_Battler)
$game_map.recreate_event(id)
end
$game_map.events[id].evaluate(data, move_instantly)
end
alias enter_map_blizzabsrmxos_later enter_map
def enter_map
$game_player.check_battler_changes
enter_map_blizzabsrmxos_later
end
alias leave_map_blizzabsrmxos_later leave_map
def leave_map
leave_map_blizzabsrmxos_later
self.try_deactivate_gmaster
end
def try_deactivate_gmaster
self.send('GMD')
@gmaster = false
end
def send_item_remove(user_id, item_id)
self.send("IRM#{user_id}\t#{item_id}")
end
def send_character_data(character)
data = create_character_data(character)
self.send("MDC#{character.id},#{data}")
end
def send_player(data)
send_actor(data, @user_id)
end
def send_actor(data, user_id)
self.send("MAA#{user_id}\t#{data.inspect}")
end
def send_battler(data, event_id)
self.send("MAB#{event_id}\t#{data.inspect}")
end
def send_enemy_death(enemy)
return if enemy.last_targeter == nil
if enemy.last_targeter == $game_player
id = $network.user_id
elsif enemy.last_targeter.is_a?(Map_OnlineBattler)
id = enemy.last_targeter.user_id
else
return
end
self.send("BED#{enemy.id}\t#{id}")
end
end
#==============================================================================
# Game_Enemy
#==============================================================================
class Game_Enemy
alias exp_blizzabs_rmxos_later exp
def exp
result = exp_blizzabs_rmxos_later
bonus = $network.party.size * RMXOS::Options::PARTY_EXP_BONUS
return (result * (100 + bonus) / 100 / ($network.party.size + 1))
end
alias gold_blizzabs_rmxos_later gold
def gold
result = gold_blizzabs_rmxos_later
bonus = $network.party.size * RMXOS::Options::PARTY_GOLD_BONUS
return (result * (100 + bonus) / 100 / ($network.party.size + 1))
end
end
#==============================================================================
# Game_Character
#==============================================================================
class Game_Character
def evaluate(data, move_instantly)
return if data == nil
@character_name = data[1]
@x = data[2]
@y = data[3]
@real_x = data[4]
@real_y = data[5]
@pattern = data[8]
@anime_count = data[9]
@direction = data[6]
@move_speed = data[7]
end
def apply_data(data)
data.each_key {|variables|
current = self
keys = variables.split('|')
variable = keys.pop
while keys.size > 0 && current != nil
current = current.instance_variable_get(keys.shift)
end
if current != nil
current.instance_variable_set(variable, data[variables])
end}
end
end
#==============================================================================
# Spriteset_Map
#==============================================================================
class Spriteset_Map
alias init_blizzabsrmxos_later initialize
def initialize
init_blizzabsrmxos_later
$network.map_players.each_value {|character|
sprite = Sprite_Character.new(@viewport1, character)
sprite.update
@character_sprites.push(sprite)}
end
end
#==============================================================================
# Map_Battler
#==============================================================================
class Map_Battler
attr_accessor :last_targeter
def check_action
return if !self.valid? || [email=!@ai.act.valid]!@ai.act.valid[/email]?
if @ai.target == nil
battlers = ($game_map.battlers + $BlizzABS.battlers).find_all {|b|
b.valid?}
end
battlers.compact!
$BlizzABS.AI.normal_action(self, battlers, battlers, @ai.act.basic?,
@ai.act.kind - 1, 0xFFFF, 0xFFFF, @ai.act.id, @ai.act.skill?)
@ai.act.delay = 0 if [email=!@ai.act.defend]!@ai.act.defend[/email]?
$BlizzABS.AI.try_execute(self)
self.reset_action
end
def send_battler_data
check_battler_changes(@battler_data) if @battler_data != nil
end
def check_battler_changes(data = nil)
return data if data.is_a?(Hash)
return get_battler_changes(data)
end
def clear_battler_data
@battler_data = nil
end
def get_battler_changes(variables = nil, forced = false)
@battler_data = {} if @battler_data == nil
original = @battler_data.clone
variables = get_battler_variables if variables == nil
variables.each {|variable|
keys = variable.split('|')
current = self
while keys.size > 0 && current != nil
current = current.instance_variable_get(keys.shift)
end
@battler_data[variable] = current if keys.size == 0}
changed = {}
(original.keys - @battler_data.keys).each {|key| changed[key] = nil}
@battler_data.each_key {|key|
if forced || @battler_data[key] != original[key] || original[key] == nil
changed[key] = @battler_data[key]
end}
return changed
end
def get_battler_variables
return RMXOS::Options::BATTLER_VARIABLES.clone
end
alias use_attack_blizzabsrmxos_later use_attack
def use_attack
result = use_attack_blizzabsrmxos_later
if result && (self == $game_player || $network.gmaster)
data = {}
data['@ai|@act|@kind'] = BlizzABS::ACTAttack
check_battler_changes(data)
end
return result
end
alias use_skill_blizzabsrmxos_later use_skill
def use_skill(skill)
result = use_skill_blizzabsrmxos_later(skill)
if result && (self == $game_player || $network.gmaster)
data = {}
data['@ai|@act|@kind'] = BlizzABS::ACTSkill
data['@ai|@act|@id'] = skill.id
check_battler_changes(data)
end
return result
end
alias use_item_blizzabsrmxos_later use_item
def use_item(item)
result = use_item_blizzabsrmxos_later(item)
if result && (self == $game_player || $network.gmaster)
data = {}
data['@ai|@act|@kind'] = BlizzABS::ACTItem
data['@ai|@act|@id'] = item.id
check_battler_changes(data)
end
return result
end
def setup_damage_display
$BlizzABS.util.request_damage_sprite(self)
@battler.damage, @battler.hpdamage, @battler.spdamage = nil, 0, 0
end
def in_screen?
return true
end
end
#==============================================================================
# Map_Actor
#==============================================================================
class Map_Actor
alias update_blizzabsrmxos_later update
def update
if self != $game_player
update_blizzabsrmxos_later
return
end
setup_damage_display if !$network.gmaster && @battler.damage != nil
last_character_name = @character_name
last_x = @x
last_y = @y
last_direction = @direction
last_move_speed = @move_speed
update_blizzabsrmxos_later
if last_character_name != @character_name || last_x != @x || last_y != @y ||
last_direction != @direction || last_move_speed != @move_speed
$network.send_player_data
end
check_battler_changes
end
def check_battler_changes(data = nil)
changed = super
if self == $game_player
$network.send_player(changed) if changed.size > 0
else
return changed
end
end
def get_battler_variables
return (super | RMXOS::Options::ACTOR_VARIABLES)
end
alias attack_effect_blizzabsrmxos_later attack_effect
def attack_effect(character, _battler)
return false if !$network.gmaster
return attack_effect_blizzabsrmxos_later(character, _battler)
end
alias skill_effect_blizzabsrmxos_later skill_effect
def skill_effect(character, _battler, skill)
return false if !$network.gmaster
return skill_effect_blizzabsrmxos_later(character, _battler, skill)
end
alias item_effect_blizzabsrmxos_later item_effect
def item_effect(character, item)
return false if !$network.gmaster
return item_effect_blizzabsrmxos_later(character, item)
end
end
#==============================================================================
# Map_Enemy
#==============================================================================
class Map_Enemy
alias update_blizzabsrmxos_later update
def update
if !$network.gmaster
setup_damage_display if @battler.damage != nil
update_blizzabsrmxos_later
get_battler_changes
return
end
last_character_name = @character_name
last_x = @x
last_y = @y
last_direction = @direction
last_move_speed = @move_speed
update_blizzabsrmxos_later
if last_character_name != @character_name || last_x != @x || last_y != @y ||
last_direction != @direction || last_move_speed != @move_speed
$network.send_character_data(self)
end
check_battler_changes
end
def check_battler_changes(data = nil)
changed = super
$network.send_battler(changed, @id) if changed.size > 0
end
def get_battler_variables
return (super | RMXOS::Options::ENEMY_VARIABLES)
end
alias attack_effect_blizzabsrmxos_later attack_effect
def attack_effect(character, _battler)
return false if !$network.gmaster
@last_targeter = character
return attack_effect_blizzabsrmxos_later(character, _battler)
end
alias skill_effect_blizzabsrmxos_later skill_effect
def skill_effect(character, _battler, skill)
return false if !$network.gmaster
@last_targeter = character
return skill_effect_blizzabsrmxos_later(character, _battler, skill)
end
alias item_effect_blizzabsrmxos_later item_effect
def item_effect(character, item)
return false if !$network.gmaster
@last_targeter = character
return item_effect_blizzabsrmxos_later(character, item)
end
end
#==============================================================================
# Map_OnlineBattler
#==============================================================================
class Map_OnlineBattler < Map_Actor
attr_reader :user_id
attr_reader :username
attr_reader :usergroup
attr_accessor :map_id
def initialize
super(0)
@battler = Game_Actor.new(1)
@cindex = nil
@ai.setup_group(BlizzABS::Alignments::ONLINE_GROUP)
@normal_speed = BlizzABS::Config::NORMAL_SPEED
refresh
end
def update
setup_damage_display if !$network.gmaster && @battler.damage != nil
refresh
super
@character_name = @character_name_org
sprite_animation_setup
check_action
end
def update?
return false
end
def check_battler_changes(data = nil)
changed = super
if changed.size > 0
$network.send_actor(changed, @user_id)
refresh
end
end
def evaluate(data, move_instantly)
return if data == nil
@user_id = data[0]
@username = data[1]
@usergroup = data[2]
2.times {data.delete_at(1)}
super
end
def battler(override = false)
return @battler
end
def item_can_use?(id)
return true
end
def item_consumption(item)
$network.send_item_remove(@user_id, item.id) if item.consumable
end
def update_ci(ind = nil)
end
def update_buffer(move)
end
def turn_toward(character)
end
end
Game_OnlineCharacter = Map_OnlineBattler
#==============================================================================
# Game_Map
#==============================================================================
class Game_Map
alias battlers_blizzabsrmxos_later battlers
def battlers
return (battlers_blizzabsrmxos_later | $network.map_players.values)
end
def recreate_event(id)
if [email=!@events.has_key?(id]!@events.has_key?(id[/email])
@events[id] = Game_Event.new(@map_id, @map.events[id])
end
rename_event(id, @map.events[id].name)
end
end
#==============================================================================
# Scene_Map
#==============================================================================
class Scene_Map
alias main_blizzabsrmxos_later main
def main
main_blizzabsrmxos_later
$network.try_deactivate_gmaster
end
def initialize_selection
end
def process_selection
object, r, type, sprites = $game_temp.select_data
if $tons_version != nil && object.is_a?(RPG::Skill) &&
($tons_version >= 6.02 && $game_system.TARGET_EM_ALL &&
FULL_TARGET_IDS.include?(object.id))
targets = []
sprites.each {|sprite| targets.push(sprite.character)}
else
targets = [sprites[rand(sprites.size)].character]
end
return targets
end
def execute_selection(targets)
if targets.size > 0
$game_player.ai.target = targets[0]
case $game_temp.select_data[0]
when RPG::Skill then $game_player.use_skill($game_temp.select_data[0])
when RPG::Item then $game_player.use_item($game_temp.select_data[0])
end
end
$game_temp.select_data = nil
end
end
- Código:
module RMXOS
def self.load_current_extension
return BlizzABS
end
module Data
GlobalMasterActivate = 'Client 'CLIENT' activate G-Master for map 'MAPID'.'
GlobalMasterDeactivate = 'Client 'CLIENT' deactivate G-Master for map 'MAPID'.'
GlobalMasterRelease = 'Map 'MAPID' has been released.'
PartyDisbanded = 'The party has been disbanded.'
PartyFull = 'Your party is already full.'
PartyFullPlayer = 'The party of 'PLAYER' is already full.'
PartyInvitation = ''PLAYER' has invited you to join a party.'
PartyInvited = 'You have invited 'PLAYER' to join your party.'
PartyJoined = 'You have joined the party of 'PLAYER'.'
PartyJoinedPlayer = ''PLAYER' has joined the party.'
PartyNoJoinPlayer = ''PLAYER' has not accepted the party invitation.'
PartyNotOnline = ''PLAYER' is not online anymore.'
PartyRemoved = 'You have left the party.'
PartyRemovedPlayer = ''PLAYER' has left the party.'
end
end
#======================================================================
# module BlizzABS
#======================================================================
module BlizzABS
VERSION = 1.02
RMXOS_VERSION = 1.1
SERVER_THREAD = true
# START Configuration
MAX_ONLINE_PARTY = 5
GMASTER_TIMEOUT = 10 # after how much an inactive time global master client should be released
SERVER_DISPLAY = false # show log in command prompt screen
LOG_FILENAME = './logs/blizzabs.log' # leave empty if no log file should be created
DELETE_LOG_ON_START = true
IGNORE_DATA = ['@battler|@damage', [email='@battler|@hpdamage']'@battler|@hpdamage'[/email], [email='@battler|@spdamage']'@battler|@spdamage'[/email], [email='@ai.act.kind']'@ai.act.kind'[/email], [email='@ai.act.id']'@ai.act.id'[/email]]
# END Configuration
def self.initialize
@client_times = {}
@gmasters = {}
@capable_clients = {}
@battlers = {}
File.delete(LOG_FILENAME) if LOG_FILENAME != '' && DELETE_LOG_ON_START && FileTest.exist?(LOG_FILENAME)
end
def self.main
while RMXOS.server.running
self.server_update
sleep(0.1)
end
end
def self.server_update
time = Time.now
logged_in_clients = $clients.find_all {|client| client.player.user_id > 0}
old_clients = @client_times.keys - logged_in_clients
old_clients.each {|client|
@client_times.delete(client)
@capable_clients.delete(@capable_clients.key(client))
Thread.exclusive {
self.try_deactivate_gmaster(client)
}
if client.player.partyleader != ''
client.action.execute_party_remove(client.player.username, client.player.partyleader)
end
}
new_clients = logged_in_clients - @client_times.keys
new_clients.each {|client| @client_times[client] = time}
@capable_clients.keys.each {|key|
if time - @client_times[@capable_clients[key]] > GMASTER_TIMEOUT
Thread.exclusive {
client = @capable_clients[key]
@capable_clients.delete(key)
self.try_deactivate_gmaster(client)
}
end
}
(@capable_clients.values - logged_in_clients).each {|client| @capable_clients.delete(@capable_clients.key(client))}
map_ids = []
logged_in_clients.each {|client| map_ids.push(client.player.map_id)}
map_ids |= map_ids
Thread.exclusive {
(@battlers.keys - map_ids).each {|map_id| @battlers.delete(map_id) if @battlers.has_key?(map_id)}
(@gmasters.keys - map_ids).each {|map_id| self.release_map(map_id)}
(map_ids - @gmasters.keys).each {|map_id| self.try_activate_gmaster(map_id)}
}
end
def self.client_update(client)
case client.message
when /\AGMD\Z/ # deactivate capable global master client
Thread.exclusive {
@capable_clients.delete(client.player.user_id) if @capable_clients.has_key?(client.player.user_id)
self.try_deactivate_gmaster(client, client.player.map_id) if client == @gmasters[client.player.map_id]
}
return true
when /\APNG\Z/ # client ping
if client.player.user_id != 0
@client_times[client] = Time.now
@capable_clients[client.player.user_id] = client if [email=!@capable_clients.has_key?(client.player.user_id]!@capable_clients.has_key?(client.player.user_id[/email])
end
when /\AMAA(.+)\t(.+)/ # battler data for players
id = $1.to_i
current = nil
if client.player.user_id == id
current = client
elsif @gmasters[client.player.map_id] == client
current = client.sender.get_client_by_id(id)
end
if current != nil
data = eval($2)
(data.keys - IGNORE_DATA).each {|key| current.player.battler[key] = data[key]}
client.sender.send_to_map(client.message) if client.player.map_id != 0
end
return true
when /\AMAB(.+)\t(.+)/ # battler data for battlers
if @gmasters[client.player.map_id] == client
current = @battlers[client.player.map_id][$1.to_i]
if current != nil
data = eval($2)
(data.keys - IGNORE_DATA).each {|key| current.battler[key] = data[key]}
client.sender.send_to_map(client.message) if client.player.map_id != 0
end
end
return true
when /\AMDC(.+)/ # map data for characters
data = eval("[#{$1}]")
id = data.shift
@battlers[client.player.map_id][id] = Player.new(nil) if [email=!@battlers[client.player.map_id].has_key?(id]!@battlers[client.player.map_id].has_key?(id[/email])
@battlers[client.player.map_id][id].evaluate(data)
client.sender.send_to_map("MDC#{id},#{@battlers[client.player.map_id][id].get_map_data}")
return true
when /\AMEN(.+)/ # enter map
client.player.map_id, old_map_id = $1.to_i, client.player.map_id
client.sender.get_map_clients.each {|c| client.send("MAA#{c.player.user_id}\t#{c.player.battler.inspect}")}
client.sender.send_to_map("MAA#{client.player.user_id}\t#{client.player.battler.inspect}")
if @battlers.has_key?(client.player.map_id)
@battlers[client.player.map_id].each_key {|id|
client.send("MDC#{id},#{@battlers[client.player.map_id][id].get_map_data}")
client.send("MAB#{id}\t#{@battlers[client.player.map_id][id].battler.inspect}")
}
end
client.player.map_id = old_map_id
when /\ABED(.+)\t(.+)/ # broadcast enemy death
if @gmasters[client.player.map_id] == client
client.sender.send_to_map(client.message, true)
else
id = $1.to_i
client.send("MAB#{id}\t#{@battlers[client.player.map_id][id].battler.inspect}")
end
return true
when /\AIRM(.+)\t(.+)/ # item remove
if @gmasters[client.player.map_id] == client
user_id, item_id = $1.to_i, $2.to_i
client.sender.send_to_id(user_id, "IRM#{item_id}")
end
return true
when /\APIN(.+)/ # party invitation
username = $1
result = client.action.try_party_invite(username)
case result
when RMXOS::RESULT_SUCCESS
message = RMXOS::Data::PartyInvited.sub('PLAYER') {username}
color = RMXOS::Data::ColorInfo
when RMXOS::RESULT_FAIL
message = RMXOS::Data::PlayerNotOnlineMap.sub('PLAYER') {username}
color = RMXOS::Data::ColorError
when RMXOS::RESULT_ALTFAIL
message = RMXOS::Data::PartyFull
color = RMXOS::Data::ColorError
end
client.send("CHT#{color}\t0\t#{message}")
return true
when /\APLE\Z/ # party leave
client.action.execute_party_remove(client.player.username, client.player.partyleader)
return true
when /\APRE(.+)/ # party remove
username = $1
client.action.execute_party_remove(username, client.player.partyleader)
return true
when /\APME(.+)/ # party message
client.sender.send_to_party("CHT#{$1}", true)
return true
end
return false
end
def self.try_activate_gmaster(map_id)
return if @gmasters.has_key?(map_id)
clients = @capable_clients.values.find_all {|client| client.player.map_id == map_id}
return if clients.size == 0
clients[0].send('GMA')
@gmasters[map_id] = clients[0]
if [email=!@battlers.has_key?(map_id]!@battlers.has_key?(map_id[/email])
@battlers[map_id] = {}
clients[0].send('MDR')
end
message = RMXOS::Data::GlobalMasterActivate.sub('CLIENT', clients[0].player.username).sub('MAPID', map_id.to_s)
self.log(message)
end
def self.try_deactivate_gmaster(client, map_id = nil)
if map_id == nil
@gmasters.each_key {|key|
if client == @gmasters[key]
map_id = key
break
end
}
end
return if map_id == nil
@gmasters.delete(map_id)
client.send('GMD')
message = RMXOS::Data::GlobalMasterDeactivate.sub('CLIENT', client.player.username).sub('MAPID', map_id.to_s)
self.log(message)
self.try_activate_gmaster(map_id)
self.release_map(map_id) if [email=!@gmasters.has_key?(map_id]!@gmasters.has_key?(map_id[/email])
end
def self.release_map(map_id)
@gmasters.delete(map_id) if @gmasters.has_key?(map_id)
message = RMXOS::Data::GlobalMasterRelease.sub('MAPID', map_id.to_s)
self.log(message)
end
def self.log(message)
puts message if SERVER_DISPLAY
if LOG_FILENAME != ''
file = File.open(LOG_FILENAME, 'a')
file.write(message + "\n")
file.close
end
end
end
#======================================================================
# Player
#======================================================================
class Player
attr_accessor :battler
attr_accessor :party
attr_accessor :partyleader
alias initialize_blizzabsrmxos_later initialize
def initialize(client)
initialize_blizzabsrmxos_later(client)
@battler = {}
self.reset_party
end
def reset_party
@partyleader = ''
@party = []
end
end
#======================================================================
# Action
#======================================================================
class Action
TYPE_PARTY_JOIN = 111
end
#======================================================================
# Action_Handler
#======================================================================
class Action_Handler
def try_party_invite(username)
return RMXOS::RESULT_ALTFAIL if @client.player.party.size >= BlizzABS::MAX_ONLINE_PARTY - 1
client = @client.sender.get_client_by_name(username)
return RMXOS::RESULT_FAIL if client == nil
return RMXOS::RESULT_FAIL if client.player.map_id != @client.player.map_id
client.action.current.type = Action::TYPE_PARTY_JOIN
client.action.current.data = [@client.player.user_id, @client.player.username]
message = "#{RMXOS::Data::PartyInvitation.sub('PLAYER') [email={@client.player.username]{@client.player.username[/email]}} #{RMXOS::Data::DoYouAccept}"
client.send("CHT#{RMXOS::Data::ColorInfo}\t0\t#{message}")
return RMXOS::RESULT_SUCCESS
end
def execute_party_join
user_id, leadername = @current.data
leader = @client.sender.get_client_by_id(user_id)
if leader == nil
message = RMXOS::Data::PlayerNotOnlineMap.sub('PLAYER') {leadername}
@client.send("CHT#{RMXOS::Data::ColorInfo}\t0\t#{RMXOS::Data::PartyNotOnline}")
return
end
if leader.player.party.size >= BlizzABS::MAX_ONLINE_PARTY - 1
message = RMXOS::Data::PartyFullPlayer.sub('PLAYER') {leadername}
@client.send("CHT#{RMXOS::Data::ColorInfo}\t0\t#{message}")
return
end
leader.player.party |= [@client.player.username]
@client.player.party = leader.player.party.clone
@client.player.partyleader = leader.player.partyleader = leadername
message = RMXOS::Data::PartyJoined.sub('PLAYER') {leadername}
@client.send("CHT#{RMXOS::Data::ColorOK}\t0\t#{message}")
@client.send("PIN#{leadername}\t#{leader.player.party.inspect}")
message = RMXOS::Data::PartyJoinedPlayer.sub('PLAYER') [email={@client.player.username]{@client.player.username[/email]}
@client.sender.get_party_clients.each {|client|
client.send("PIN#{leadername}\t#{leader.player.party.inspect}")
client.send("CHT#{RMXOS::Data::ColorOK}\t0\t#{message}")
client.player.party = leader.player.party.clone
}
end
def execute_party_remove(username, leadername)
client = @client.sender.get_client_by_name(username)
clients = $clients.find_all {|client| client.player.partyleader == leadername}
leader = @client.sender.get_client_by_name(leadername)
party = clients - [client, leader]
if username == leadername || leader == nil || party.size == 0
clients.each {|client|
if !client.socket.closed?
client.send('PRM')
client.send("CHT#{RMXOS::Data::ColorInfo}\t0\t#{RMXOS::Data::PartyDisbanded}")
client.player.reset_party
end
}
return
end
if client != nil
client.send('PRM')
message = RMXOS::Data::PartyRemoved
client.send("CHT#{RMXOS::Data::ColorInfo}\t0\t#{message}")
client.player.reset_party
end
leader.sender.send_to_party("PRE#{username}", true)
message = RMXOS::Data::PartyRemovedPlayer.sub('PLAYER') {username}
leader.sender.send_to_party("CHT#{RMXOS::Data::ColorInfo}\t0\t#{message}", true)
end
alias execute_yes_blizzabsrmxos_later execute_yes
def execute_yes
if @current.type == Action::TYPE_PARTY_JOIN
self.execute_party_join
@current.clear
else
execute_yes_blizzabsrmxos_later
end
end
alias execute_no_blizzabsrmxos_later execute_no
def execute_no
if @current.type == Action::TYPE_PARTY_JOIN
@client.send("CHT#{RMXOS::Data::ColorInfo}\t0\t#{RMXOS::Data::PartyNoJoin}")
name = @current.data[1]
if name != nil
message = RMXOS::Data::PartyNoJoinPlayer.sub('PLAYER') [email={@client.player.username]{@client.player.username[/email]}
@client.sender.send_to_name(name, "CHT#{RMXOS::Data::ColorInfo}\t0\t#{message}")
end
@current.clear
else
execute_no_blizzabsrmxos_later
end
end
end
#======================================================================
# Sender
#======================================================================
class Sender
def get_party_clients(including = false)
clients = $clients.find_all {|client| client.player.partyleader == @client.player.partyleader}
clients.delete(@client) if !including
return clients
end
def send_to_party(message, including = false)
self.send_to_clients(self.get_party_clients(including), message)
end
end
Em Seguida, va no arquivo cfg.ini na pasta RMX-OS Server e procure pela linha EXTENSIONS = [ ] e entre os colchetes digite "blizzabs" com as aspas e pronto!, ja esta funcionando:ok:
LEMBRANDO, este script só funciona com o RMX-OS E alem disto é necessário o BlizzABS Versão 2.7 ou superior,