=begin
#==============================================================================
# ■ Buddy List for RMX-OS
#------------------------------------------------------------------------------
# By Stan ;) (AKA Sylphe)
# 1.0
# 02/08/2014
#------------------------------------------------------------------------------
Show a window that displays buddies and let you add your buddies graphically
Includes:
~ Check if your buddies are onlines or offlines
~ Icons displayed whether your buddy is online or offline
~ Possibility to :
ADD A BUDDY (checking players on same map)
REMOVE A BUDDY
INVITE BUDDY TO YOUR GROUP
INVITE BUDDY TO YOUR GUILD
~ If you can't invite a player in guild/group/buddy list,
alert you with a window explaining WHY you can't invite the player.
********************************************************************************
* I N S T R U C T I O N S *
********************************************************************************
You will have to change RMXOS Script line 1300
Just add the extra lines of this code :
(it's within "add_message" method)
________________________________________________________________________________
# add username to message
if action
message = "* #{username} #{message}"
else
message = "#{username}: #{message}"
end
end
HERE ==> #stanley's add !! Storing id
HERE ==> else
HERE ==> register_request_id(message)
end
end
HERE ==>if $delete_buddy != true
# slice the text if necessary
slices = bitmap.slice_text(message, RMXOS::Options::CHATBOX_WIDTH - 40)
bitmap.dispose
# add each text slice to chat display
slices.each {|slice| $game_temp.chat_messages.push(
RMXOS::ChatMessage.new(slice, color))
}
# if exceeding log size
if $game_temp.chat_messages.size > RMXOS::Data::ChatLineEntries
# remove a few messages from before
i = $game_temp.chat_messages.size
lines = RMXOS::Data::ChatLineEntries
$game_temp.chat_messages = $game_temp.chat_messages[i - lines, lines]
end
# chat box needs refreshing
$game_temp.chat_refresh = 0 if !$game_temp.chat_refresh
$game_temp.chat_refresh += slices.size
HERE ==> end
end
________________________________________________________________________________
====== ! If you don't already have my onmap_players window ! ===================
You will also have to change RMXOS OnlineAwareness line 126
Just add the extra lines of this code :
when /\A\/onmap\Z/
names = self.map_players.values.map {|player| player = player.username}
HERE ==> $onmap_players = names
HERE ==> $onmap_player_need_refresh = true
================================================================================
Then You can call the scene with :
$scene = Scene_BuddyList.new
anywhere you want. (in a script call event or in your menu)
----------
-Controls-
----------
Enter, down, up.
Nothing more.
----------
-Graphics-
----------
WINDOWSKIN
In configuration, explained below.
ICONS
Idem
WINDOW'S SIZE
In methods initialize, at the beginning of all windows, you can change the "super(x,y,width,height)" method
BITMAP COLOR
Red for offline
Green for online
You can change those colors near line 253 in draw_buddy method.
------------
-Compatibility-
------------
Work with RMXOS modified and RMXOS OnlineAwareness modified.
You will also need RMX-OS controller for BlizzABS if you want the group feature.
---------------
-Configuration-
---------------
Below
================================================================================
Credits:
Sylphe -> Making this script
Blizzard -> Doing RMX-OS and RMX-OS OnlineAwareness and RMX-OS controller for BlizzABS
================================================================================
# ExitScene : Where you will go when pressing B
# PageTurnSound : The sound played when you turn page (not featured yet)
Commands
# FirstCommands : Buddy list and Add a buddy
# BuddyCommands : What you can do with your buddy
# OfflineBuddyCommands :What you can do when your buddy isn't connected
Confirmation when removing a buddy
# Yes_No : Well all is in the name (confirmation when you want to remove buddy)
# AreYouSure : Idem
# Windowskin : The windowskin of all this script windows
Note that if you set icons parameters to '', no icon will be displayed
# OnlineIcon : Icon to be displayed near name when buddy is online
# OfflineIcon : Icon to be displayed near name when buddy is offline
# OnMapIcon : Icon to be displayed near name when adding a buddy
# BitmapColor : Whether the background of your buddy name if colored or not
Messages for the informations windows
(Note that errors messages are defined in RMX-OS Script and RMX-OS controller for BlizzABS)
# PartyInvite : What will be displayed when you invite your buddy in party
# GuildInvite : What will be displayed when you invite your buddy in guild
# BuddyInvite : What will be displayed when you invite a player to be your buddy
# NoPlayerSelected : What will be displayed when you selected nil in onmap_player window
#==============================================================================
=end
#==============================================================================
##################### BEGIN CONFIGURATION ###############################
# =============================================================================
module BuddyData
# Where you should go once exiting the scene
ExitScene = Scene_Menu.new(0)
# First commands, in order : Buddy list, Add a buddy, Quit
FirstCommands = ["Liste d'amis","Ajouter ami", "Retour"]
# When entering SHIFT you can switch pages and it will produce the sound below (NOT FEATURED YET)
# change "005-System05"with the name of your SE music File
PageTurnSound = RPG::AudioFile.new("005-System05", 80)
# in the order : Add group, add guild, remove, quit
BuddyCommands = ['Inviter Groupe', 'Inviter Guilde', 'Supprimer', 'Retour']
# "remove" , "quit" this will be displayed when selecting an offline buddy
OfflineBuddyCommands = ['Supprimer', 'Retour']
# "add a buddy"
NoBuddyCommands = ['Ajouter un ami']
# "yes" , "no"
Yes_No = ['Oui', 'Non']
#windowskin of all windows in the scene
Windowskin = "Thunder Rain.png"
# For the confirmation window "Are you sure ?"
AreYouSure = "Vous êtes sûr ?"
# Icons displayed in buddy list, near name if the player is online or offline
# IF YOU DON'T WANT ICON JUST PUT '' (ex: OnlineIcon = '')
OnlineIcon = RPG::Cache.icon("elm_light")
OfflineIcon = RPG::Cache.icon("elm_darkness")
OnMapIcon = ''
# Change if you want your buddy list names to have colored background
# (Though, used with Online/Offine icons may give the player too much informations )
BitmapColor = false
# What will be displayed when inviting in party / guild / buddylist
PartyInvite = "Vous avez invité PLAYER dans votre groupe"
GuildInvite = "Vous avez invité PLAYER dans votre guilde"
BuddyInvite = "Vous avez invité PLAYER à devenir votre ami"
#What will be displayed if you selected the void ('No player selected by default')
NoPlayerSelected = "Aucun joueur sélectionné"
end
#==============================================================================
##################### END CONFIGURATION ###############################
# =============================================================================
class Window_BuddyList < Window_Selectable
#--------------------------------------------------------------------------
# * Public Instance Variables
#--------------------------------------------------------------------------
#well it's unnecessary
#--------------------------------------------------------------------------
# ● Initialisation
#--------------------------------------------------------------------------
def initialize(buddyList)
#online players
@players = $network.players.values.map {|player| player = player.username}
@buddyList = buddyList
@item_max = buddyList.size
# Change here if you don't like the window size
# x, y , width, height
super(100, 100, 200, 250)
#(x , y , largeur, hauteur)
bitmap = Bitmap.new(width - 32, height - 32)
bitmap.hue_change((3 - 1.5).sgn * (1.25 - 40 / 0.8) * 120 /(3 ** 2))
bitmap.fill_rect(0, 0, bitmap.width, bitmap.height,
Color.new(0, 0, 0, 20))
self.contents = bitmap
self.opacity=125
self.windowskin = RPG::Cache.windowskin(BuddyData::Windowskin)
refresh
self.index = 0
end
#--------------------------------------------------------------------------
# ● refresh
#--------------------------------------------------------------------------
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for buddy in @buddyList
if buddy != nil
@data.push(buddy)
end
end
# If item count is not 0, make a bit map and draw all items
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_buddy(i)
end
end
end
#--------------------------------------------------------------------------
# * Draw Buddy
# index : buddy number
#--------------------------------------------------------------------------
def draw_buddy(index)
item = @data[index]
x = 4
y = index * 32
rect = Rect.new(x, y, self.width - 32, 32)
if BuddyData::BitmapColor
@players.include?(item) ? self.contents.fill_rect(rect, Color.new(0, 200, 0, 100)) : self.contents.fill_rect(rect, Color.new(200, 0, 0, 100))
else
self.contents.fill_rect(rect, Color.new(255, 0, 0, 0))
end
if BuddyData::OfflineIcon != '' and BuddyData::OnlineIcon != ''
bitmap = @players.include?(item) ? BuddyData::OnlineIcon : BuddyData::OfflineIcon
opacity = @players.include?(item) ? 255 : 128
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
end
self.contents.draw_text(x + 28, y, 212, 32, item, 0)
end
# -- pour cacher la fenêtre
def hide_fen
self.contents.clear
end
def show_fen
refresh
end
end
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\#
#
# Window displaying 'Are you sure ?"
#
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\#
class Confirm_Window < Window_Base
def initialize
super(400, 280, 200, 70)
bitmap = Bitmap.new(width - 32, height - 32)
bitmap.hue_change((3 - 1.5).sgn * (1.25 - 40 / 0.8) * 120 /
(3 ** 2))
bitmap.fill_rect(0, 0, bitmap.width, bitmap.height,
Color.new(0, 0, 0, 20))
self.contents = bitmap
self.opacity=200
self.windowskin = RPG::Cache.windowskin(BuddyData::Windowskin)
refresh
end
def refresh
self.contents.clear
self.contents.font.color= Color.new(255, 255, 255, 255)
w = contents.text_size("Sylph is the Wind Goddess :").width
self.contents.draw_text(0, 0, w, 32, BuddyData::AreYouSure, 1)
end
end
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\#
#
# Window displaying Error Infos
#
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\#
class Info_Window < Window_Base
attr_accessor :info # the info that we will display
attr_accessor :badnews # will change the color of the text
def initialize
@info = ''
super(260, 200, 320, 70)
bitmap = Bitmap.new(width - 32, height - 32)
bitmap.hue_change((3 - 1.5).sgn * (1.25 - 40 / 0.8) * 120 /
(3 ** 2))
bitmap.fill_rect(0, 0, bitmap.width, bitmap.height,
Color.new(0, 0, 0, 20))
self.contents = bitmap
self.opacity=200
self.windowskin = RPG::Cache.windowskin(BuddyData::Windowskin)
refresh
end
def refresh
self.contents.clear
badnews ? self.contents.font.color= Color.new(255, 0, 0, 255) : self.contents.font.color= Color.new(0, 255, 0, 255)
w = contents.text_size("Sylph is the uniq Wind Goddess, but she died...").width
self.contents.draw_text(0, 0, w, 32,@info, 1)
end
end
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\#
#
# Window displaying all onmap players
#
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\#
class Onmap_Selectable < Window_Selectable
def initialize
#we check which players are on same map
$network.check_normal_commands('/onmap')
# Change here if you don't like the window size
# x, y , width, height
super(400, 100, 200, 250)
#(x , y , largeur, hauteur)
bitmap = Bitmap.new(width - 32, height - 32)
bitmap.hue_change((3 - 1.5).sgn * (1.25 - 40 / 0.8) * 120 /(3 ** 2))
bitmap.fill_rect(0, 0, bitmap.width, bitmap.height,
Color.new(0, 0, 0, 20))
self.contents = bitmap
self.opacity=125
self.windowskin = RPG::Cache.windowskin(BuddyData::Windowskin)
refresh
self.index = 0
end
def refresh
if self.contents != nil
self.contents.dispose
self.contents = nil
end
@data = []
for player in $onmap_players
if player != nil
@data.push(player)
end
end
# If item count is not 0, make a bit map and draw all items
@item_max = @data.size
if @item_max > 0
self.contents = Bitmap.new(width - 32, row_max * 32)
for i in 0...@item_max
draw_player(i)
end
end
end
#--------------------------------------------------------------------------
# * Draw Onmap players
# index : player index
#--------------------------------------------------------------------------
def draw_player(index)
item = @data[index]
x = 4
y = index * 32
rect = Rect.new(x, y, self.width - 32, 32)
self.contents.fill_rect(rect, Color.new(255, 0, 0, 0))
if BuddyData::OnMapIcon != ''
bitmap = BuddyData::OnMapIcon
opacity = 255
self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24), opacity)
end
self.contents.draw_text(x + 28, y, 212, 32, item, 0)
end
end
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\#
# #
# The actual buddy scene ! ! ! #
# #
#\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\#
class Scene_BuddyList
def main
# get the players online
@players = $network.players.values.map {|player| player = player.username}
#Creates the windows
# selectable of the players onmap
@onmap_selectable = Onmap_Selectable.new
@onmap_selectable.visible = false
@onmap_selectable.active = false
# The buddy list
@Buddys_list = Window_BuddyList.new($network.buddies)
@Buddys_list.visible = false
@Buddys_list.active = false
# Window to display infos
@info_window = Info_Window.new
@info_window.z = 99999
@info_window.visible = false
#=============== FIRST WINDOW -> ADD A BUDDY AND CHECK BUDDY LIST =================
@first_window = Window_Command.new(192,BuddyData::FirstCommands)
@first_window.x, @first_window.y = 300 - @first_window.width/2, 240 - @first_window.height/2
@first_window.z = 21000
@first_window.windowskin = RPG::Cache.windowskin(BuddyData::Windowskin)
#---------------- Transparent -------
@first_window.opacity = 255
#=============== WINDOWS FOR REMOVING BUDDY CONFIRMATION =================
# Window that display "Are you sure ?"
@confirm_title_window = Confirm_Window.new
@confirm_title_window.visible = false
@yes_no_window = Window_Command.new(192, BuddyData::Yes_No)
@yes_no_window.x, @yes_no_window.y = 400, 360
@yes_no_window.z = 21000
@yes_no_window.visible = false
@yes_no_window.active = false
@yes_no_window.windowskin = RPG::Cache.windowskin(BuddyData::Windowskin)
#@buddys_info = Window_BuddysInfo.new(@buddys_list.buddy)
#=============== WINDOW FOR BUDDY ONLINE COMMANDS =================
@window = Window_Command.new(192, BuddyData::BuddyCommands)
@window.x, @window.y = 400 - @window.width/2, 240 - @window.height/2
@window.z = 21000
@window.windowskin = RPG::Cache.windowskin(BuddyData::Windowskin)
#---------------- Transparent -------
@window.opacity = 100
@window.active = false
@window.visible = false
#=============== WINDOW FOR BUDDY OFFLINE COMMANDS =================
@window2 = Window_Command.new(192, BuddyData::OfflineBuddyCommands)
@window2.x, @window2.y = 400 - @window2.width/2, 240 - @Buddys_list.height/2
@window2.z = 21000
@window2.windowskin = RPG::Cache.windowskin(BuddyData::Windowskin)
#---------------- Transparent -------
@window2.opacity = 100
@window2.active = false
@window2.visible = false
#=============== WINDOW FOR ADD BUDDY COMMANDS =================
@window3 = Window_Command.new(192, BuddyData::NoBuddyCommands)
@window3.x, @window3.y = 400 - @window3.width/2, 240 - @window3.height/2
@window3.z = 21000
@window3.windowskin = RPG::Cache.windowskin(BuddyData::Windowskin)
#---------------- Transparent -------
@window3.opacity = 100
@window3.active = false
@window3.visible = false
$game_temp.in_battle = true
@hud = Hud.new if BlizzABS::Config::HUD_ENABLED && $game_system.hud
@hotkeys = Hotkey_Assignment.new if
BlizzABS::Config::HOTKEYS && $game_system.hotkeys
# Show sprite in background
@map = Spriteset_Map.new
Graphics.transition
loop do
Graphics.update
Input.update
update
if $scene != self
break
end
end
Graphics.freeze
@map.dispose unless @map.nil?
@Buddys_list.dispose
@confirm_title_window.dispose
@yes_no_window.dispose
@onmap_selectable.dispose
@info_window.dispose
@first_window.dispose
@window.dispose
@window2.dispose
@window3.dispose
end
###############################################
# On update le tout...
##############################################
def update
$network.listen
if $delete_buddy
$network.command_yes($network.last_request_id)
$network.buddies.delete_at(@Buddys_list.index)
$delete_buddy = false
@Buddys_list.refresh
$network.save
end
@window3.update
@window2.update
@window.update
@first_window.update
@info_window.update
@onmap_selectable.update
@confirm_title_window.update
@yes_no_window.update
@Buddys_list.update
@map.update unless @map.nil?
update_controls
end
####################################################
# On vérifie sur quelle touche on appuie
###################################################
def update_controls
# ================= SI ON APPUIE SUR B ===================
if Input.trigger?(Input::B)
$game_system.se_play($data_system.cancel_se)
# If first window visible, exit scene
if @first_window.active
$game_temp.in_battle = false
$scene = BuddyData::ExitScene
# If buddy list displayed, return to first window
elsif @Buddys_list.active
@Buddys_list.active = false
@Buddys_list.visible = false
@first_window.visible = @first_window.active = true
#If Buddy commands are displayed, return to Buddy list
elsif @window.active || @window2.active || @window3.active
@window.visible = @window2.visible = @window3.visible = false
@window.active = @window2.active = @window3.active = false
@Buddys_list.active = true
# If confirm/onmap players windows are displayed, we return to command
# Or to First window
elsif @yes_no_window.active || @onmap_selectable.active
@yes_no_window.visible = @onmap_selectable.visible = false
@yes_no_window.active = @onmap_selectable.active = false
@confirm_title_window.visible = @info_window.visible = false
if @window.visible
@window.active = true
elsif @window2.visible
@window2.active = true
elsif @window3.visible
@window3.active = true
elsif @first_window.visible
@first_window.active = true
end
# If infos are displayed we return to the last displayed window
elsif @info_window.visible
@info_window.visible = false
if @window.visible
@window.active = true
elsif @window2.visible
@window2.active = true
elsif @onmap_selectable.visible
@onmap_selectable.active = true
elsif @first_window.visible
@first_window.active = true
end
end
#================ SI ON APPUIE SUR C ====================
elsif Input.trigger?(Input::C)
if @first_window.active
case @first_window.index
when 0 # Buddy List
@first_window.active = false
@first_window.visible = false
@Buddys_list.refresh
@Buddys_list.active = @Buddys_list.visible = true
when 1 # Add a Buddy
@first_window.active = false
@onmap_selectable.refresh
@onmap_selectable.visible = true
@onmap_selectable.active = true
when 2 # Quit
# Play cancel SE
$game_system.se_play($data_system.cancel_se)
$game_temp.in_battle = false
$scene = BuddyData::ExitScene
end
#Works only if Buddy commands aren't displayed
elsif @Buddys_list.active and $network.buddies[@Buddys_list.index] != nil
# if player is online
if @players.include?($network.buddies[@Buddys_list.index])
$game_system.se_play($data_system.decision_se)
@window.visible = true
@window.active = true
@window.refresh
@window.contents.font.color = Color.new(100,0,200,150)
@Buddys_list.active = false
# if player is offline
else
$game_system.se_play($data_system.decision_se)
@window2.visible = true
@window2.active = true
@window2.refresh
@window2.contents.font.color = Color.new(100,0,200,150)
@Buddys_list.active = false
end
# If we choosed a connected Buddy !
elsif @window.active
case @window.index
when 0 # Invite Party
# IF IN PARTY AND NOT LEADER
if $network.in_party? and $network.party.include?($network.buddies[@Buddys_list.index])
@window.active = false
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
@info_window.info = RMXOS::Data::PartyAlreadyMember
@info_window.badnews = true
@info_window.refresh
@info_window.visible = true
# IF IN BUDDY ALREADY IN PARTY
elsif $network.in_party? and !$network.partyleader?
@window.active = false
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
@info_window.info = RMXOS::Data::PartyNotLeader
@info_window.badnews = true
@info_window.refresh
@info_window.visible = true
else
@window.active = false
# Play decision SE
$game_system.se_play($data_system.decision_se)
@info_window.info = text = BuddyData::PartyInvite.sub('PLAYER') {$network.buddies[@Buddys_list.index]}
@info_window.badnews = false
@info_window.refresh
@info_window.visible = true
$network.command_party_invite($network.buddies[@Buddys_list.index])
end
when 1 # Invite Guild
# CHECK LEADER ACTION
if !$network.check_guildleader_action
# IF NOT IN GUILD
if !$network.in_guild?
@window.active = false
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
@info_window.info = RMXOS::Data::GuildNone
@info_window.badnews = true
@info_window.refresh
@info_window.visible = true
# IF NOT LEADER OF THE GUILD
else
@window.active = false
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
@info_window.info = RMXOS::Data::GuildNotLeader
@info_window.badnews = true
@info_window.refresh
@info_window.visible = true
end
# WE INVITE
else
@window.active = false
# Play decision SE
$game_system.se_play($data_system.decision_se)
@info_window.info = text = BuddyData::GuildInvite.sub('PLAYER') {$network.buddies[@Buddys_list.index]}
@info_window.badnews = false
@info_window.refresh
@info_window.visible = true
$network.command_guild_invite($network.buddies[@Buddys_list.index])
end
when 2 # Remove
# Play decision SE
$game_system.se_play($data_system.decision_se)
@confirm_title_window.refresh
@confirm_title_window.visible = true
@yes_no_window.visible = true
@yes_no_window.active = true
@window.active = false
when 3 # Return
$game_system.se_play($data_system.cancel_se)
@window.visible = false
@window.active = false
@Buddys_list.active = true
end
# If we choosed a disconnected Buddy !
elsif @window2.active
case @window2.index
when 0 # Supprimer
# Play decision SE
$game_system.se_play($data_system.decision_se)
@confirm_title_window.refresh
@confirm_title_window.visible = true
@yes_no_window.visible = true
@yes_no_window.active = true
@window2.active = false
when 1 # Retour
$game_system.se_play($data_system.cancel_se)
@window2.visible = false
@window2.active = false
@Buddys_list.active = true
end
# if we requested a confirmation-needed thing
elsif @yes_no_window.active
case @yes_no_window.index
when 0 # OUI
$game_system.se_play($data_system.decision_se)
# on fais la requete de suppression
$network.command_buddy_remove($network.buddies[@Buddys_list.index])
$delete_buddy = true
@yes_no_window.active = false
@yes_no_window.visible = false
@confirm_title_window.visible = false
@Buddys_list.refresh
if @window2.visible
@window2.visible = false
else
@window.visible = false
end
@Buddys_list.refresh
when 1 # NON
$game_system.se_play($data_system.cancel_se)
@yes_no_window.visible = false
@yes_no_window.active = false
@confirm_title_window.visible = false
if @window2.visible
@window2.active = true
else
@window.active = true
end
end
#If we selected no player
elsif @window3.active
$network.check_normal_commands('/onmap')
@onmap_selectable.refresh
@onmap_selectable.visible = true
@onmap_selectable.active = true
@window3.active = false
# If we requested to add a player, we display all onmap players
elsif @onmap_selectable.active
# Si le joueur est déjà dans la liste d'amis
if $network.buddies.include?($onmap_players[@onmap_selectable.index])
@onmap_selectable.active = false
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
@info_window.info = RMXOS::Data::BuddyAlreadyInList
@info_window.badnews = true
@info_window.refresh
@info_window.visible = true
# Sinon, si aucun joueur n'a été sélectionné
elsif $onmap_players[@onmap_selectable.index] == nil
@onmap_selectable.active = false
# Play buzzer SE
$game_system.se_play($data_system.buzzer_se)
@info_window.info = BuddyData::NoPlayerSelected
@info_window.badnews = true
@info_window.refresh
@info_window.visible = true
# Sinon on l'ajoute à la liste
else
$network.command_buddy_add($onmap_players[@onmap_selectable.index])
@onmap_selectable.active = false
# Play decision SE
$game_system.se_play($data_system.decision_se)
@info_window.info = BuddyData::BuddyInvite.sub('PLAYER') {$onmap_players[@onmap_selectable.index]}
@info_window.badnews = false
@info_window.refresh
@info_window.visible = true
end
# If other infos are displayed
elsif @info_window.visible
@info_window.visible = false
if @window.visible
@window.active = true
@window.refresh
elsif @onmap_selectable.visible
@onmap_selectable.refresh
@onmap_selectable.active = true
end
else
@Buddys_list.active = false
@window3.visible = true
@window3.active = true
@window3.refresh
end
elsif Input.trigger?(Input::SHIFT) # and !@Buddy_info.visible
$game_system.se_play(BuddyData::PageTurnSound)
#@Buddys_title.next_page
#@Buddys_list.next_page
end
end
end
module RMXOS
class Network
#--------------------------------------------------------------------------
# * Register Last Request ID
# message : the message of the request (sent by server)
#--------------------------------------------------------------------------
def register_request_id(message='')
id = ''
# stanley's add ! Je récupère l'id de la dernière requête (1er chiffre du message)
# je récupère le premier caractère après le premier chiffre (pour 1A, 1B etc)
if message.include?('ID: ')
after_id = message.split('ID: ', 2)[1].split(//).first
while after_id != ')' do
id += after_id
after_id = message.split(after_id, 2)[1].split(//).first
end
@last_request_id = id
end
end
end
end