Voilà j'ai programmer un nouveau système d'échange en temps réel (oui en temps réel
c'est le seul petit problème a régler et mon système est fonctionnel aidé moi please ^^
#==============================================================================
# ■ Win32
#------------------------------------------------------------------------------
# Handles numerical based data.
#==============================================================================
module Win32
#--------------------------------------------------------------------------
# ● Retrieves data from a pointer.
#--------------------------------------------------------------------------
def copymem(len)
buf = "\0" * len
Win32API.new("kernel32", "RtlMoveMemory", "ppl", "").call(buf, self, len)
buf
end
end
# Extends the numeric class.
class Numeric
include Win32
end
# Extends the string class.
class String
include Win32
end
#==============================================================================
# ■ Winsock
#------------------------------------------------------------------------------
# Maps out the functions held in the Winsock DLL.
#==============================================================================
module Winsock
DLL = "ws2_32"
def self.accept(*args)
Win32API.new(DLL, "accept", "ppl", "l").call(*args)
end
def self.bind(*args)
Win32API.new(DLL, "bind", "ppl", "l").call(*args)
end
def self.closesocket(*args)
Win32API.new(DLL, "closesocket", "p", "l").call(*args)
end
def self.connect(*args)
Win32API.new(DLL, "connect", "ppl", "l").call(*args)
end
def self.gethostbyaddr(*args)
Win32API.new(DLL, "gethostbyaddr", "pll", "l").call(*args)
end
def self.gethostbyname(*args)
Win32API.new(DLL, "gethostbyname", "p", "l").call(*args)
end
def self.gethostname(*args)
Win32API.new(DLL, "gethostname", "pl", "").call(*args)
end
def self.getservbyname(*args)
Win32API.new(DLL, "getservbyname", "pp", "p").call(*args)
end
def self.htonl(*args)
Win32API.new(DLL, "htonl", "l", "l").call(*args)
end
def self.htons(*args)
Win32API.new(DLL, "htons", "l", "l").call(*args)
end
def self.inet_addr(*args)
Win32API.new(DLL, "inet_addr", "p", "l").call(*args)
end
def self.inet_ntoa(*args)
Win32API.new(DLL, "inet_ntoa", "l", "p").call(*args)
end
def self.gethostname(*args)
Win32API.new(DLL, "gethostname", "pl", "").call(*args)
end
def self.listen(*args)
Win32API.new(DLL, "listen", "pl", "l").call(*args)
end
def self.recv(*args)
Win32API.new(DLL, "recv", "ppll", "l").call(*args)
end
def self.select(*args)
Win32API.new(DLL, "select", "lpppp", "l").call(*args)
end
def self.send(*args)
Win32API.new(DLL, "send", "ppll", "l").call(*args)
end
def self.setsockopt(*args)
Win32API.new(DLL, "setsockopt", "pllpl", "l").call(*args)
end
def self.shutdown(*args)
Win32API.new(DLL, "shutdown", "pl", "l").call(*args)
end
def self.socket(*args)
Win32API.new(DLL, "socket", "lll", "l").call(*args)
end
def self.WSAGetLastError(*args)
Win32API.new(DLL, "WSAGetLastError", "", "l").call(*args)
end
end
#==============================================================================
# ■ Window_PasswordInput
# Pokemon Script Project - Krosk
# 19/08/07
#-----------------------------------------------------------------------------
# Scène à ne pas modifier
#-----------------------------------------------------------------------------
class Window_Ip < Window_Base
CHARACTER_TABLE =
[
"0","1","2","3","4",
"5","6","7","8","9",
".","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","",""
]
CHARACTER_TABLE_EX =
[
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","","",
"","","","",""
]
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def initialize(ex_table = false)
super(30, 150, 555, 300)
self.contents = Bitmap.new(width - 32, height - 32)
self.contents.font.name = $fontface
self.contents.font.size = $fontsize
self.contents.font.color = normal_color
self.opacity = 0
@index = 0
@ex_table = ex_table
refresh
update_cursor_rect
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def refresh
self.contents.clear
for i in 0..134
x = 24 + i / 5 / 9 * 152 + i % 5 * 28
y = 9 + i / 5 % 9 * 29
if @ex_table
self.contents.draw_text(x, y, 28, 32, CHARACTER_TABLE_EX, 1)
else
self.contents.draw_text(x, y, 28, 32, CHARACTER_TABLE, 1)
end
end
self.contents.draw_text(0, 9 + 8 * 29, 511, 32, "OK", 2)
end
#--------------------------------------------------------------------------
# ? ?????
#--------------------------------------------------------------------------
def character
if @ex_table
return CHARACTER_TABLE_EX[@index]
end
return CHARACTER_TABLE[@index]
end
#--------------------------------------------------------------------------
# ? ?????????
#--------------------------------------------------------------------------
def update_cursor_rect
# ??????? [??] ???
if @index >= 135
self.cursor_rect.set(483, 9 + 8 * 29, 32, 32)
# ??????? [??] ?????
else
x = 24 + @index / 5 / 9 * 152 + @index % 5 * 28
y = 9 + @index / 5 % 9 * 29
self.cursor_rect.set(x, y, 32, 32)
end
end
#--------------------------------------------------------------------------
# ? ??????
#--------------------------------------------------------------------------
def update
super
# ??????? [??] ???
if @index >= 135
@index = 135
# ?????
if Input.trigger?(Input::LEFT)
$game_system.se_play($data_system.cursor_se)
@index = 134
end
# ?????
if Input.trigger?(Input::RIGHT)
$game_system.se_play($data_system.cursor_se)
@index = 40
end
# ??????? [??] ?????
else
# ??????????????
if Input.repeat?(Input::RIGHT)
# ????????????????
# ???????????????
if Input.trigger?(Input::RIGHT) or
@index / 45 < 2 or @index % 5 < 4
# ?????????
$game_system.se_play($data_system.cursor_se)
if @index % 5 < 4
@index += 1
else
@index += 45 - 4
end
if @index >= 135
@index -= 135
end
if @index == 40
@index = 135
end
end
end
# ??????????????
if Input.repeat?(Input::LEFT)
# ????????????????
# ???????????????
if Input.trigger?(Input::LEFT) or
@index / 45 > 0 or @index % 5 > 0
# ?????????
$game_system.se_play($data_system.cursor_se)
if @index % 5 > 0
@index -= 1
else
@index -= 45 - 4
end
if @index < 0
@index += 135
end
if @index == 134
@index = 135
end
end
end
# ??????????????
if Input.repeat?(Input::DOWN)
# ?????????
if Input.trigger?(Input::DOWN) or @index % 45 < 40
$game_system.se_play($data_system.cursor_se)
if @index % 45 < 40
@index += 5
else
@index -= 40
end
end
end
# ??????????????
if Input.repeat?(Input::UP)
# ????????????????
# ???????????????
if Input.trigger?(Input::UP) or @index % 45 >= 5
# ?????????
$game_system.se_play($data_system.cursor_se)
if @index % 45 >= 5
@index -= 5
else
@index += 40
end
end
end
# L ???? R ??????????
if Input.repeat?(Input::L) or Input.repeat?(Input::R)
# ???? / ???? ??
$game_system.se_play($data_system.cursor_se)
if @index / 45 < 2
@index += 90
else
@index -= 90
end
end
end
update_cursor_rect
end
end
Le serveur est en ruby il faut donc avoir ruby sur son ordinateur (google is your friend)