Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
mycard
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
syntax_j
mycard
Commits
fe974547
Commit
fe974547
authored
Dec 18, 2011
by
神楽坂玲奈
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
iduel观战初步
parent
aebd808b
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
488 additions
and
410 deletions
+488
-410
lib/action.rb
lib/action.rb
+3
-0
lib/cacheable.rb
lib/cacheable.rb
+6
-3
lib/game.rb
lib/game.rb
+2
-2
lib/game_event.rb
lib/game_event.rb
+5
-2
lib/iduel/action.rb
lib/iduel/action.rb
+187
-95
lib/iduel/event.rb
lib/iduel/event.rb
+176
-173
lib/iduel/iduel.rb
lib/iduel/iduel.rb
+41
-39
lib/iduel/room.rb
lib/iduel/room.rb
+0
-30
lib/iduel/user.rb
lib/iduel/user.rb
+12
-27
lib/nbx/event.rb
lib/nbx/event.rb
+4
-4
lib/nbx/nbx.rb
lib/nbx/nbx.rb
+0
-2
lib/nbx/room.rb
lib/nbx/room.rb
+0
-2
lib/nbx/user.rb
lib/nbx/user.rb
+0
-2
lib/room.rb
lib/room.rb
+16
-1
lib/scene_duel.rb
lib/scene_duel.rb
+5
-2
lib/scene_hall.rb
lib/scene_hall.rb
+1
-1
lib/scene_login.rb
lib/scene_login.rb
+20
-19
lib/scene_watch.rb
lib/scene_watch.rb
+3
-1
lib/user.rb
lib/user.rb
+6
-2
lib/window_action.rb
lib/window_action.rb
+0
-1
lib/window_field.rb
lib/window_field.rb
+0
-1
lib/window_roomlist.rb
lib/window_roomlist.rb
+1
-1
No files found.
lib/action.rb
View file @
fe974547
...
@@ -95,6 +95,9 @@ class Action
...
@@ -95,6 +95,9 @@ class Action
player_field
.
extra
player_field
.
extra
when
:removed
when
:removed
player_field
.
removed
player_field
.
removed
else
puts
'奇怪的from_field'
puts
end
end
if
@from_pos
.
is_a?
Integer
if
@from_pos
.
is_a?
Integer
...
...
lib/cacheable.rb
View file @
fe974547
...
@@ -2,8 +2,11 @@ module Cacheable
...
@@ -2,8 +2,11 @@ module Cacheable
@@all
=
{}
@@all
=
{}
def
new
(
id
,
*
args
)
def
new
(
id
,
*
args
)
@@all
[
self
]
||=
{}
@@all
[
self
]
||=
{}
@@all
[
self
][
id
]
||=
super
()
if
result
=
@@all
[
self
][
id
]
@@all
[
self
][
id
].
set
(
id
,
*
args
)
result
.
set
(
id
,
*
args
)
@@all
[
self
][
id
]
result
else
@@all
[
self
][
id
]
=
super
(
id
,
*
args
)
end
end
end
end
end
\ No newline at end of file
lib/game.rb
View file @
fe974547
...
@@ -8,10 +8,10 @@ class Game
...
@@ -8,10 +8,10 @@ class Game
@users
=
[]
@users
=
[]
@rooms
=
[]
@rooms
=
[]
end
end
def
refresh
end
def
login
(
username
,
password
=
nil
)
def
login
(
username
,
password
=
nil
)
end
end
def
refresh
end
def
host
def
host
end
end
def
join
(
room
)
def
join
(
room
)
...
...
lib/game_event.rb
View file @
fe974547
...
@@ -98,7 +98,10 @@ class Game_Event
...
@@ -98,7 +98,10 @@ class Game_Event
$game
.
room
=
@room
$game
.
room
=
@room
end
end
end
end
class
Leave
<
Game_Event
def
initialize
end
end
class
PlayerJoin
<
Game_Event
class
PlayerJoin
<
Game_Event
attr_reader
:user
attr_reader
:user
def
initialize
(
user
)
def
initialize
(
user
)
...
@@ -114,7 +117,7 @@ class Game_Event
...
@@ -114,7 +117,7 @@ class Game_Event
class
Action
<
Game_Event
class
Action
<
Game_Event
attr_reader
:action
,
:str
attr_reader
:action
,
:str
def
initialize
(
action
,
str
=
A
ction
.
escape
)
def
initialize
(
action
,
str
=
a
ction
.
escape
)
@action
=
action
@action
=
action
@str
=
str
@str
=
str
end
end
...
...
lib/iduel/action.rb
View file @
fe974547
#encoding: UTF-8
#encoding: UTF-8
require_relative
'action'
require_relative
'
../
action'
class
Action
class
Action
CardFilter
=
/(
<(?:\[.*?\]\[(?:.*?)\]){0,1}[\s\d]*>|一张怪兽卡|一张魔\/陷卡)/
.
to_s
CardFilter
=
/(
(?:<)?(?:\[.*?\])?\[(?:.*?)\][\s\d]*(?:>)?|一张怪兽卡|一张魔\/陷卡|\?\?)/
#FieldCardFilter = /(<>|<??>|<(?:(?:表攻|表守|里守)\|){0,1}\[.*?\]\[(?:.*?)\]){0,1}[\s\d]*>)/.to_s
PosFilter
=
/((?:手卡|手牌|场上|魔陷区|怪兽区|墓地|额外牌堆|除外区|卡组|卡组顶端|\(\d+\)){1,2})/
Pos
Filter
=
/((?:手卡|场上|魔陷区|怪兽区|墓地|额外牌堆|除外区|卡组顶端|\(\d+\)){1,2})/
.
to_s
Pos
itionFilter
=
/(表攻|表守|里守|攻击表示|防守表示|里侧表示|背面守备表示)/
P
ositionFilter
=
/(|攻击表示|防守表示|里侧表示|背面守备表示)/
.
to_s
P
haseFilter
=
/(抽卡`阶段|准备`阶段|主`阶段1|战斗`阶段|主`阶段2|结束`阶段)/
PhaseFilter
=
/(抽卡`阶段|准备`阶段|主`阶段1|战斗`阶段|主`阶段2|结束`阶段)/
.
to_s
FieldFilter
=
/(?:LP:(\d+)\r\n手卡(?:数)?:(\d+)\r\n卡组:(\d+)\r\n墓地:(\d+)\r\n除外:(\d+)\r\n前场:\r\n <(?:
#{
PositionFilter
}
\|
#{
CardFilter
}
)?>\r\n <(?:
#{
PositionFilter
}
\|
#{
CardFilter
}
)?>\r\n <(?:
#{
PositionFilter
}
\|
#{
CardFilter
}
)?>\r\n <(?:
#{
PositionFilter
}
\|
#{
CardFilter
}
)?>\r\n <(?:
#{
PositionFilter
}
\|
#{
CardFilter
}
)?>\r\n后场:<
#{
CardFilter
}
?><
#{
CardFilter
}
?><
#{
CardFilter
}
?><
#{
CardFilter
}
?><
#{
CardFilter
}
?>\r\n场地\|<(?:无|
#{
CardFilter
}
)>\r\n(?:◎|●)→\\)/
def
self
.
parse_pos
(
pos
)
def
self
.
parse_pos
(
pos
)
if
index
=
pos
.
index
(
"("
)
if
index
=
pos
.
index
(
"("
)
index
+=
1
index
+=
1
pos
[
index
,
pos
.
index
(
")"
)
-
index
].
to_i
pos
[
index
,
pos
.
index
(
")"
)
-
index
].
to_i
else
else
case
pos
case
pos
when
"手卡"
when
"手卡"
,
"手牌"
:hand
:hand
when
"场上"
,
"魔陷区"
,
"怪兽区"
when
"场上"
,
"魔陷区"
,
"怪兽区"
:field
:field
...
@@ -22,7 +22,7 @@ class Action
...
@@ -22,7 +22,7 @@ class Action
:extra
:extra
when
"除外区"
when
"除外区"
:removed
:removed
when
"卡组顶端"
when
"卡组顶端"
,
"卡组"
:deck
:deck
end
end
end
end
...
@@ -46,13 +46,34 @@ class Action
...
@@ -46,13 +46,34 @@ class Action
[
card
[
"表守"
]
?
:
defense
:
card
[
"里守"
]
?
:
set
:
:attack
,
parse_card
(
card
)]
[
card
[
"表守"
]
?
:
defense
:
card
[
"里守"
]
?
:
set
:
:attack
,
parse_card
(
card
)]
end
end
end
end
def
self
.
parse_field
(
arr
)
#LP, 手卡, 卡组,墓地,除外,6表示形式,6卡,7表示形式,7卡,8表示形式,8卡,9表示形式,9卡,10表示形式,10卡,1,2,3,4,5,0
{
:lp
=>
arr
[
0
].
to_i
,
:hand
=>
arr
[
1
].
to_i
,
:deck
=>
arr
[
2
].
to_i
,
:graveyard
=>
arr
[
3
].
to_i
,
:removed
=>
arr
[
4
].
to_i
,
6
=>
arr
[
5
]
&&
{
:position
=>
parse_position
(
arr
[
5
]),
:card
=>
parse_card
(
arr
[
6
])},
7
=>
arr
[
7
]
&&
{
:position
=>
parse_position
(
arr
[
7
]),
:card
=>
parse_card
(
arr
[
8
])},
8
=>
arr
[
9
]
&&
{
:position
=>
parse_position
(
arr
[
9
]),
:card
=>
parse_card
(
arr
[
10
])},
9
=>
arr
[
11
]
&&
{
:position
=>
parse_position
(
arr
[
11
]),
:card
=>
parse_card
(
arr
[
12
])},
10
=>
arr
[
13
]
&&
{
:position
=>
parse_position
(
arr
[
13
]),
:card
=>
parse_card
(
arr
[
14
])},
1
=>
arr
[
15
]
&&
{
:position
=>
arr
[
15
]
==
"??"
?
:
set
:
:attack
,
:card
=>
parse_card
(
arr
[
15
])},
2
=>
arr
[
16
]
&&
{
:position
=>
arr
[
16
]
==
"??"
?
:
set
:
:attack
,
:card
=>
parse_card
(
arr
[
16
])},
3
=>
arr
[
17
]
&&
{
:position
=>
arr
[
17
]
==
"??"
?
:
set
:
:attack
,
:card
=>
parse_card
(
arr
[
17
])},
4
=>
arr
[
18
]
&&
{
:position
=>
arr
[
18
]
==
"??"
?
:
set
:
:attack
,
:card
=>
parse_card
(
arr
[
18
])},
5
=>
arr
[
19
]
&&
{
:position
=>
arr
[
19
]
==
"??"
?
:
set
:
:attack
,
:card
=>
parse_card
(
arr
[
19
])},
0
=>
arr
[
20
]
&&
{
:position
=>
arr
[
20
]
==
"??"
?
:
set
:
:attack
,
:card
=>
parse_card
(
arr
[
20
])}
}
end
def
self
.
parse_position
(
position
)
def
self
.
parse_position
(
position
)
case
position
case
position
when
"攻击表示"
when
"攻击表示"
,
"表攻"
:attack
:attack
when
"防守表示"
when
"防守表示"
,
"表守"
:defense
:defense
when
"里侧表示"
,
"背面守备表示"
when
"里侧表示"
,
"背面守备表示"
,
"里守"
:set
:set
end
end
end
end
...
@@ -145,150 +166,197 @@ class Action
...
@@ -145,150 +166,197 @@ class Action
end
end
end
end
def
self
.
parse
(
str
)
def
self
.
parse
(
str
)
str
=~
/^\[(\d+)\] (.*)▊▊▊.*?$/m
from_player
=
false
from_player
=
false
id
=
$1
.
to_i
case
str
$chat_window
.
add
from_player
,
"[
#{
$1
}
]
#{
$2
}
"
when
/^\[(\d+)\] (.*)$/m
result
=
case
$2
id
=
$1
.
to_i
when
/^┊(.*)┊$/m
result
=
case
$2
Chat
.
new
from_player
,
$1
when
/^┊(.*)┊$/m
when
/^※\[(.*)\]\r\n(.*)\r\n注释$/m
Chat
.
new
from_player
,
$1
Note
.
new
from_player
,
$2
,
Card
.
find
(
$1
.
to_sym
)
when
/^※\[(.*)\]\r\n(.*)\r\n注释$/m
when
/^※(.*)$/
Note
.
new
from_player
,
$2
,
Card
.
find
(
$1
.
to_sym
)
Chat
.
new
from_player
,
$1
when
/^※(.*)$/
when
/^(◎|●)→=\[0:0:0\]==回合结束==<(\d+)>=\[0\]\r\nLP:(\d+)\r\n手卡:(\d+)\r\n卡组:(\d+)\r\n墓地:(\d+)\r\n除外:(\d+)\r\n前场:\r\n
#{
PositionFilter
}#{
CardFilter
}
\r\n
#{
CardFilter
}
\r\n
#{
CardFilter
}
\r\n
#{
CardFilter
}
\r\n
#{
CardFilter
}
\r\n后场:
#{
CardFilter
}#{
CardFilter
}#{
CardFilter
}#{
CardFilter
}#{
CardFilter
}
\r\n场地|
#{
CardFilter
}
\r\n◎→\\(.*)$/
Chat
.
new
from_player
,
$1
TurnEnd
.
new
(
$1
==
"◎"
,
$19
,
$3
.
to_i
,
$4
.
to_i
,
$5
.
to_i
,
$6
.
to_i
,
$7
.
to_i
,
[
parse_fieldcard
(
$18
),
parse_fieldcard
(
$13
),
parse_fieldcard
(
$14
),
parse_fieldcard
(
$15
),
parse_fieldcard
(
$16
),
parse_fieldcard
(
$17
),
parse_fieldcard
(
$8
),
parse_fieldcard
(
$9
),
parse_fieldcard
(
$10
),
parse_fieldcard
(
$11
),
parse_fieldcard
(
$12
)],
$2
.
to_i
)
when
/^(◎|●)→=\[0:0:0\]==回合结束==<(\d+)>=\[\d+\]\r\n
#{
FieldFilter
}
(.*)$/
#把这货弄外面的原因是因为这个指令里开头有一个●→,后面还有,下面判msg的正则会判错
when
/^(?:(.*)\r\n){0,1}(◎|●)→(.*)$/m
field
=
$~
.
to_a
from_player
=
$2
==
"◎"
field
.
shift
#去掉第一个完整匹配信息
msg
=
$1
from_player
=
field
.
shift
==
"◎"
case
$3
turn
=
field
.
shift
.
to_i
when
/^\[\d+年\d+月\d+日禁卡表\] Duel!!/
msg
=
field
.
pop
Reset
.
new
from_player
TurnEnd
.
new
(
from_player
,
parse_field
(
field
),
turn
,
msg
)
when
/(.*)抽牌/
when
/^(◎|●)→
#{
FieldFilter
}
$/
Draw
.
new
from_player
,
$1
field
=
$~
.
to_a
when
"开启更换卡组"
field
.
shift
Deck
.
new
from_player
from_player
=
field
.
shift
==
"◎"
when
"更换新卡组-检查卡组中..."
RefreshField
.
new
(
from_player
,
parse_field
(
field
))
Reset
.
new
from_player
when
/^(?:(.*)\r\n)?(◎|●)→(.*)$/m
when
"换SIDE……"
from_player
=
$2
==
"◎"
Side
.
new
from_player
msg
=
$1
when
/\[\d+年\d+月\d+日禁卡表\](?:<(.+)> ){0,1}先攻/
case
$3
FirstToGo
.
new
from_player
,
$1
when
/^\[\d+年\d+月\d+日禁卡表\] Duel!!/
when
/\[\d+年\d+月\d+日禁卡表\](?:<(.+)> ){0,1}后攻/
Reset
.
new
from_player
SecondToGo
.
new
from_player
,
$1
when
/(.*)抽牌/
when
/(.*)掷骰子,结果为 (\d+)/
Draw
.
new
from_player
,
$1
Dice
.
new
from_player
,
$2
.
to_i
,
$1
when
"开启更换卡组"
when
/(.*)抛硬币,结果为(.+)/
Deck
.
new
from_player
Coin
.
new
from_player
,
$2
==
"正面"
,
$1
when
"更换新卡组-检查卡组中..."
when
/从
#{
PosFilter
}
~发动
#{
CardFilter
}#{
PosFilter
}
/
Reset
.
new
from_player
Activate
.
new
from_player
,
parse_pos
(
$1
),
parse_pos
(
$3
),
parse_card
(
$2
)
when
"换SIDE……"
when
/从
#{
PosFilter
}
~召唤
#{
CardFilter
}#{
PosFilter
}
/
Side
.
new
from_player
Summon
.
new
from_player
,
parse_pos
(
$1
),
parse_pos
(
$3
),
parse_card
(
$2
),
msg
when
"卡组洗切"
,
"切洗卡组"
when
/从
#{
PosFilter
}
~特殊召唤
#{
CardFilter
}#{
PosFilter
}
呈
#{
PositionFilter
}
/
Shuffle
.
new
from_player
SpecialSummon
.
new
from_player
,
parse_pos
(
$1
),
parse_pos
(
$3
),
card
(
$2
),
msg
,
parse_position
(
$4
)
when
"查看卡组"
when
/从手卡~取
#{
CardFilter
}
盖到
#{
PosFilter
}
/
Ignored
.
new
"查看卡组"
Set
.
new
from_player
,
:hand
,
parse_pos
(
$2
),
parse_card
(
$1
)
when
"将顶牌放回卡组底部"
when
/将
#{
CardFilter
}
从~
#{
PosFilter
}
~送往墓地/
ReturnToDeckBottom
.
new
(
from_player
,
:deck
)
SendToGraveyard
.
new
(
from_player
,
parse_pos
(
$2
),
parse_card
(
$1
))
when
/抽取\((\d+)\)张卡/
when
/将
#{
PosFilter
}
的
#{
CardFilter
}
从游戏中除外/
MultiDraw
.
new
from_player
,
$1
.
to_i
Remove
.
new
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
)
when
/\[\d+年\d+月\d+日禁卡表\](?:<(.+)> )?先攻/
when
/
#{
CardFilter
}
从
#{
PosFilter
}
~放回卡组顶端/
FirstToGo
.
new
from_player
,
$1
ReturnToDeck
.
new
from_player
,
parse_pos
(
$2
),
parse_card
(
$1
)
when
/\[\d+年\d+月\d+日禁卡表\](?:<(.+)> )?后攻/
when
/
#{
CardFilter
}
从
#{
PosFilter
}
返回额外牌堆/
SecondToGo
.
new
from_player
,
$1
ReturnToExtra
.
new
from_player
,
parse_pos
(
$2
),
parse_card
(
$1
)
when
/(.*)掷骰子,结果为 (\d+)/
when
/从
#{
PosFilter
}
取
#{
CardFilter
}
加入手卡/
Dice
.
new
from_player
,
$2
.
to_i
,
$1
ReturnToHand
.
new
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
)
when
/(.*)抛硬币,结果为(.+)/
when
/
#{
PosFilter
}#{
CardFilter
}
效果发(?:\~){0,1}动/
Coin
.
new
from_player
,
$2
==
"正面"
,
$1
Effect_Activate
.
new
(
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
))
when
/从
#{
PosFilter
}
~发动
#{
CardFilter
}#{
PosFilter
}
/
when
/
#{
PhaseFilter
}
/
Activate
.
new
from_player
,
parse_pos
(
$1
),
parse_pos
(
$3
),
parse_card
(
$2
)
ChangePhase
.
new
(
from_player
,
parse_phase
(
$1
))
when
/从
#{
PosFilter
}
~召唤
#{
CardFilter
}#{
PosFilter
}
/
Summon
.
new
from_player
,
parse_pos
(
$1
),
parse_pos
(
$3
),
parse_card
(
$2
),
msg
when
/从
#{
PosFilter
}
~特殊召唤
#{
CardFilter
}#{
PosFilter
}
(?:呈
#{
PositionFilter
}
)?/
SpecialSummon
.
new
from_player
,
parse_pos
(
$1
),
parse_pos
(
$3
),
parse_card
(
$2
),
msg
,
$4
?
parse_position
(
$4
)
:
:attack
when
/从手卡~取
#{
CardFilter
}
盖到
#{
PosFilter
}
/
Set
.
new
from_player
,
:hand
,
parse_pos
(
$2
),
parse_card
(
$1
)
when
/将
#{
CardFilter
}
从~
#{
PosFilter
}
~送往墓地/
SendToGraveyard
.
new
(
from_player
,
parse_pos
(
$2
),
parse_card
(
$1
))
when
/将~
#{
PosFilter
}
~的
#{
CardFilter
}
解~放/
Tribute
.
new
(
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
))
when
/随机将一张卡从手卡\((\d+\))~放回卡组顶端/
ReturnToDeck
.
new
(
from_player
,
$1
.
to_i
+
10
,
nil
)
when
/随机舍弃~手卡~
#{
CardFilter
}
/
Discard
.
new
(
from_player
,
:hand
,
parse_card
(
$1
))
when
/随机将手卡的
#{
CardFilter
}
从游戏中除外/
Remove
.
new
from_player
,
:hand
,
parse_card
(
$1
)
when
/随机显示一张手卡为:
#{
CardFilter
}
/
Show
.
new
(
from_player
,
:hand
,
parse_card
(
$1
))
when
/第(\d+)张手牌为:
#{
CardFilter
}
/
Show
.
new
(
from_player
,
$1
.
to_i
+
10
,
parse_card
(
$2
))
when
/\|--\+>手卡:(?:\[
#{
CardFilter
}
\])*/
MultiShow
.
new
from_player
,
$&
.
scan
(
CardFilter
).
collect
{
|
matched
|
parse_card
(
matched
.
first
)}
when
/将
#{
PosFilter
}
的
#{
CardFilter
}
从游戏中除外/
Remove
.
new
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
)
when
/
#{
CardFilter
}
从
#{
PosFilter
}
~放回卡组顶端/
ReturnToDeck
.
new
from_player
,
parse_pos
(
$2
),
parse_card
(
$1
)
when
/
#{
CardFilter
}
从
#{
PosFilter
}
~放回卡组底端/
ReturnToDeckBottom
.
new
from_player
,
parse_pos
(
$2
),
parse_card
(
$1
)
when
/
#{
CardFilter
}
从
#{
PosFilter
}
返回额外牌堆/
ReturnToExtra
.
new
from_player
,
parse_pos
(
$2
),
parse_card
(
$1
)
when
/从
#{
PosFilter
}
取
#{
CardFilter
}
加入手卡/
ReturnToHand
.
new
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
)
when
/(?:己方)?
#{
PosFilter
}
.*?
#{
CardFilter
}
效果发(?:\~)?动/
Effect_Activate
.
new
(
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
))
when
/
#{
PosFilter
}#{
CardFilter
}
(?:变|改)为
#{
PositionFilter
}
/
ChangePosition
.
new
(
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
),
parse_position
(
$3
))
when
/
#{
PosFilter
}#{
CardFilter
}
打开/
Flip
.
new
(
from_player
,
parse_pos
(
$1
),
parse_card
(
$2
))
when
/
#{
PhaseFilter
}
/
ChangePhase
.
new
(
from_player
,
parse_phase
(
$1
))
else
Unknown
.
new
str
end
else
else
p
str
,
1
Unknown
.
new
str
end
end
result
.
id
=
id
result
when
/^(
#{
CardFilter
}
\r\n)*$/
MultiShow
.
new
from_player
,
$&
.
lines
.
collect
{
|
card
|
parse_card
(
card
)}
else
else
p
str
,
2
Unknown
.
new
str
end
end
result
.
id
=
id
result
end
end
def
escape
def
escape
inspect
inspect
end
end
def
run
def
run
$chat_window
.
add
@from_player
,
escape
if
@from_player
$game
.
action
self
if
@from_player
$game
.
action
self
if
@from_player
end
end
class
FirstToGo
class
FirstToGo
def
escape
def
escape
"[
#{
@id
}
]
◎
→[11年3月1日禁卡表]先攻"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→[11年3月1日禁卡表]先攻"
end
end
end
end
class
Draw
class
Draw
def
escape
def
escape
"[
#{
@id
}
] ◎→抽牌"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→抽牌"
end
end
class
MultiDraw
def
escape
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→抽取(
#{
@count
}
)张卡"
end
end
end
end
class
Dice
class
Dice
def
escape
def
escape
"[
#{
@id
}
]
◎
→掷骰子,结果为
#{
@result
}
"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→掷骰子,结果为
#{
@result
}
"
end
end
end
end
class
Reset
class
Reset
def
escape
def
escape
"[
#{
@id
}
]
◎
→[11年3月1日禁卡表] Duel!!"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→[11年3月1日禁卡表] Duel!!"
end
end
end
end
class
ChangePhase
class
ChangePhase
def
escape
def
escape
"[
#{
@id
}
]
◎
→
#{
Action
.
escape_phase
(
@phase
)
}
"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→
#{
Action
.
escape_phase
(
@phase
)
}
"
end
end
end
end
class
TurnEnd
class
TurnEnd
def
escape
def
escape
"[
#{
@id
}
]
◎
→=[0:0:0]==回合结束==<0>=[0]
\r\n
"
+
@field
.
escape
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→=[0:0:0]==回合结束==<0>=[0]
\r\n
"
+
@field
.
escape
end
end
end
end
class
Shuffle
class
Shuffle
def
escape
def
escape
"[
#{
@id
}
]
◎
→卡组洗切"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→卡组洗切"
end
end
end
end
class
Set
class
Set
def
escape
def
escape
case
@from_pos
case
@from_pos
when
:hand
when
:hand
"[
#{
@id
}
]
◎
→从手卡~取一张
#{
@card
.
monster?
?
"怪兽卡"
:
"魔/陷卡"
}
盖到场上(
#{
@to_pos
}
)"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→从手卡~取一张
#{
@card
.
monster?
?
"怪兽卡"
:
"魔/陷卡"
}
盖到场上(
#{
@to_pos
}
)"
end
end
end
end
end
end
class
Summon
class
Summon
def
escape
def
escape
"[
#{
@id
}
]
◎
→从手卡~召唤
#{
@card
.
escape
}
(
#{
@to_pos
}
)"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→从手卡~召唤
#{
@card
.
escape
}
(
#{
@to_pos
}
)"
end
end
end
end
class
SpecialSummon
class
SpecialSummon
def
escape
def
escape
"[
#{
@id
}
]
◎
→从
#{
Action
.
escape_pos2
(
@from_pos
)
}
~特殊召唤
#{
@card
.
escape
}
(
#{
@to_pos
}
)呈
#{
case
@position
;
when
:attack
;
"攻击"
;
when
:defense
;
"守备"
;
when
:set
;
"背面守备"
;
end
}
表示"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→从
#{
Action
.
escape_pos2
(
@from_pos
)
}
~特殊召唤
#{
@card
.
escape
}
(
#{
@to_pos
}
)呈
#{
case
@position
;
when
:attack
;
"攻击"
;
when
:defense
;
"守备"
;
when
:set
;
"背面守备"
;
end
}
表示"
end
end
end
end
class
Activate
class
Activate
def
escape
def
escape
"[
#{
@id
}
]
◎
→从手卡~发动
#{
@card
.
escape
}
(
#{
@to_pos
}
)"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→从手卡~发动
#{
@card
.
escape
}
(
#{
@to_pos
}
)"
end
end
end
end
class
SendToGraveyard
class
SendToGraveyard
def
escape
def
escape
"[
#{
@id
}
]
◎
→将
#{
@card
.
escape
}
从~
#{
Action
.
escape_pos2
(
@from_pos
)
}
~送往墓地"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→将
#{
@card
.
escape
}
从~
#{
Action
.
escape_pos2
(
@from_pos
)
}
~送往墓地"
end
end
end
end
class
Tribute
class
Tribute
def
escape
def
escape
"[
#{
@id
}
]
◎
→将~
#{
Action
.
escape_pos2
(
@from_pos
)
}
~的
#{
@card
.
escape
}
解~放"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→将~
#{
Action
.
escape_pos2
(
@from_pos
)
}
~的
#{
@card
.
escape
}
解~放"
end
end
end
end
class
Remove
class
Remove
def
escape
def
escape
"[
#{
@id
}
]
◎
→将
#{
Action
.
escape_pos2
(
@from_pos
)
}
的
#{
@card
.
escape
}
从游戏中除外"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→将
#{
Action
.
escape_pos2
(
@from_pos
)
}
的
#{
@card
.
escape
}
从游戏中除外"
end
end
end
end
class
ReturnToHand
class
ReturnToHand
...
@@ -303,7 +371,7 @@ class Action
...
@@ -303,7 +371,7 @@ class Action
when
0
..
10
when
0
..
10
"场上(
#{
@from_pos
}
)"
"场上(
#{
@from_pos
}
)"
end
end
"[
#{
@id
}
]
◎
→从
#{
pos
}
取
#{
@card
.
escape
}
加入手卡"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→从
#{
pos
}
取
#{
@card
.
escape
}
加入手卡"
end
end
end
end
class
ReturnToDeck
class
ReturnToDeck
...
@@ -318,7 +386,12 @@ class Action
...
@@ -318,7 +386,12 @@ class Action
when
0
..
10
when
0
..
10
"场上(
#{
@from_pos
}
)"
"场上(
#{
@from_pos
}
)"
end
end
"[
#{
@id
}
] ◎→
#{
@from_pos
==
:hand
?
"一张卡"
:
@card
.
escape
}
从
#{
pos
}
~放回卡组顶端"
#TODO:set=【一张卡】
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→
#{
@card
.
nil?
or
@from_pos
==
:hand
?
"一张卡"
:
@card
.
escape
}
从
#{
pos
}
~放回卡组顶端"
#TODO:set=【一张卡】
end
end
class
ReturnToDeckBottom
def
escape
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→将顶牌放回卡组底部"
end
end
end
end
class
ReturnToExtra
class
ReturnToExtra
...
@@ -331,32 +404,47 @@ class Action
...
@@ -331,32 +404,47 @@ class Action
when
0
..
10
when
0
..
10
"场上(
#{
pos
}
)"
"场上(
#{
pos
}
)"
end
end
"[
#{
@id
}
]
◎
→
#{
@card
.
escape
}
从
#{
pos
}
返回额外牌堆"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→
#{
@card
.
escape
}
从
#{
pos
}
返回额外牌堆"
end
end
end
end
class
Flip
class
Flip
def
escape
def
escape
"[
#{
@id
}
]
◎
→(
#{
@from_pos
}
)
#{
@card
.
escape
}
打开"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→(
#{
@from_pos
}
)
#{
@card
.
escape
}
打开"
end
end
end
end
class
FlipSummon
class
FlipSummon
def
escape
def
escape
"[
#{
@id
}
]
◎
→(
#{
@from_pos
}
)
#{
@card
.
escape
}
反转"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→(
#{
@from_pos
}
)
#{
@card
.
escape
}
反转"
end
end
end
end
class
ChangePosition
class
ChangePosition
def
escape
def
escape
if
@position
==
:set
if
@position
==
:set
if
(
6
..
10
).
include?
@from_pos
#攻击表示的怪兽,由于iduel没有变成里侧守备指令,所以采用重新放置的方式
if
(
6
..
10
).
include?
@from_pos
#攻击表示的怪兽,由于iduel没有变成里侧守备指令,所以采用重新放置的方式
"[
#{
@id
}
]
◎
→从怪兽区(
#{
@from_pos
}
)~取一张怪兽卡盖到场上(
#{
@to_pos
}
)"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→从怪兽区(
#{
@from_pos
}
)~取一张怪兽卡盖到场上(
#{
@to_pos
}
)"
else
else
"[
#{
@id
}
]
◎
→(
#{
@from_pos
}
)
#{
@card
.
escape
}
变为里侧表示"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→(
#{
@from_pos
}
)
#{
@card
.
escape
}
变为里侧表示"
end
end
else
else
"[
#{
@id
}
]
◎
→(
#{
@from_pos
}
)
#{
@card
.
escape
}
改为
#{
position
==
:attack
?
'攻击'
:
'防守'
}
表示"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→(
#{
@from_pos
}
)
#{
@card
.
escape
}
改为
#{
position
==
:attack
?
'攻击'
:
'防守'
}
表示"
end
end
end
end
end
end
class
Show
def
escape
case
from_pos
when
0
..
10
#场上
when
Integer
"第
#{
@from_pos
-
10
}
张手牌为:
#{
@card
.
escape
}
"
end
end
end
class
MultiShow
def
escape
@cards
.
collect
{
|
card
|
card
.
escape
}.
join
(
"
\r\n
"
)
end
end
class
Effect_Activate
class
Effect_Activate
def
escape
def
escape
pos
=
case
@from_pos
pos
=
case
@from_pos
...
@@ -373,7 +461,7 @@ class Action
...
@@ -373,7 +461,7 @@ class Action
when
0
..
10
when
0
..
10
"(
#{
@from_pos
}
)"
"(
#{
@from_pos
}
)"
end
end
"[
#{
@id
}
]
◎
→
#{
pos
}#{
@card
.
escape
}
效果发
#{
"~"
unless
(
0
..
10
).
include?
@from_pos
}
动"
"[
#{
@id
}
]
#{
from_player
?
'◎'
:
'●'
}
→
#{
pos
}#{
@card
.
escape
}
效果发
#{
"~"
unless
(
0
..
10
).
include?
@from_pos
}
动"
end
end
end
end
class
Chat
class
Chat
...
@@ -393,6 +481,10 @@ class Game_Field
...
@@ -393,6 +481,10 @@ class Game_Field
"
\r\n
场地|<
#{
@field
[
0
]
?
@field
[
0
].
escape
:
'无'
}
>
\r\n
"
+
"
\r\n
场地|<
#{
@field
[
0
]
?
@field
[
0
].
escape
:
'无'
}
>
\r\n
"
+
"◎→\\"
"◎→\\"
end
end
def
self
.
parse
(
str
)
end
end
end
class
Card
class
Card
def
escape
def
escape
...
...
lib/iduel/event.rb
View file @
fe974547
#encoding: UTF-8
#encoding: UTF-8
Game_Event
=
Class
.
new
#避开SDL::Event问题,所以没有用class Game_Event::Event
class
Game_Event
class
Game_Event
@queue
=
[]
def
self
.
push
(
event
)
@queue
<<
event
end
def
self
.
poll
@queue
.
shift
end
def
self
.
parse
(
info
)
def
self
.
parse
(
info
)
info
=~
/^\$([A-Z])\|(.*)$/m
info
=~
/^\$([A-Z])\|(.*)$/m
case
$1
case
$1
when
"A"
when
"A"
Game_Event
::
Error
Error
when
"B"
when
"B"
Game_Event
::
LOGINOK
Login
when
"C"
when
"C"
Game_Event
::
AllUsers
AllUsers
when
"F"
when
"F"
Game_Event
::
JOINROOMOK
Join
when
"G"
when
"G"
Game_Event
::
WATCHROOMSTART
Watch
when
"H"
Leave
when
"J"
when
"J"
Game_Event
::
Action
Action
when
"K"
when
"K"
Game_Event
::
WMSG
WatchAction
when
"M"
when
"M"
Game_Event
::
QROOMOK
#TODO
QROOMOK
#TODO
when
"O"
when
"O"
Game_Event
::
PCHAT
Chat
when
"P"
when
"P"
Game_Event
::
AllRooms
AllRooms
when
"Q"
when
"Q"
Game_Event
::
NewRoom
NewRoom
when
"R"
when
"R"
Game_Event
::
QROOMOK
#卡表
QROOMOK
#卡表
else
else
Game_Event
::
UNKNOWN
Unknown
end
.
new
(
$2
)
end
.
parse
(
$2
)
end
end
end
class
Game_Event
::
LOGINOK
<
Game_Event
class
Login
attr_reader
:user
,
:session
def
self
.
parse
(
info
)
def
initialize
(
info
)
info
=
info
.
split
(
","
)
info
=
info
.
split
(
","
)
#>> $B|201629,zh99997,5da9e5fa,Level-1 (总经验:183),,20101118
#>> $B|201629,zh99997,5da9e5fa,Level-1 (总经验:183),,20101118
info
[
3
]
=~
/Level-(\d)+ \(总经验:(\d+)\)/
info
[
3
]
=~
/Level-(\d)+ \(总经验:(\d+)\)/
result
=
self
.
new
User
.
new
(
info
[
0
].
to_i
,
info
[
1
],
$1
.
to_i
,
$2
.
to_i
)
$game
.
user
=
@user
=
Iduel
::
User
.
new
(
info
[
0
].
to_i
,
info
[
1
],
$1
.
to_i
,
$2
.
to_i
)
$game
.
session
=
info
[
2
]
$game
.
session
=
@session
=
info
[
2
]
$game
.
key
=
(
$game
.
user
.
id
-
0x186a0
)
^
0x22133
$game
.
key
=
(
$game
.
user
.
id
-
0x186a0
)
^
0x22133
result
end
end
end
end
class
Game_Event
::
AllUsers
<
Game_Event
class
AllUsers
attr_reader
:users
def
self
.
parse
(
info
)
def
initialize
(
info
)
self
.
new
info
.
split
(
','
).
collect
{
|
user
|
User
.
parse
(
user
)}
@users
=
info
.
split
(
','
).
collect
do
|
user
|
Iduel
::
User
.
new
(
user
)
end
end
end
end
end
class
AllRooms
class
Game_Event
::
AllRooms
<
Game_Event
def
self
.
parse
(
info
)
attr_reader
:rooms
info
=
info
.
split
(
"|"
)
def
initialize
(
info
)
rooms
=
[]
info
=
info
.
split
(
"|"
)
templist
=
rooms
@rooms
=
[]
empty
=
false
templist
=
@rooms
info
.
each
do
|
room
|
empty
=
false
if
room
==
'~~'
info
.
each
do
|
room
|
empty
=
true
if
room
==
'~~'
templist
=
[]
empty
=
true
templist
=
[]
else
room
=
room
.
split
(
","
)
templist
<<
if
empty
Iduel
::
Room
.
new
(
room
[
0
].
to_i
,
room
[
1
],
Iduel
::
User
.
new
(
room
[
2
]),
nil
,
room
[
3
]
==
"1"
,
Iduel
::
Color
[
room
[
4
].
to_i
],
nil
,
room
[
6
])
else
else
Iduel
::
Room
.
new
(
room
[
0
].
to_i
,
room
[
3
],
Iduel
::
User
.
new
(
room
[
1
]),
Iduel
::
User
.
new
(
room
[
2
]),
false
,
Iduel
::
Color
[
room
[
5
].
to_i
],
room
[
3
])
room
=
room
.
split
(
","
)
templist
<<
if
empty
Room
.
new
(
room
[
0
].
to_i
,
room
[
1
],
User
.
parse
(
room
[
2
]),
nil
,
room
[
3
]
==
"1"
,
Room
::
Color
[
room
[
4
].
to_i
],
nil
,
room
[
6
])
else
Room
.
new
(
room
[
0
].
to_i
,
room
[
3
],
User
.
parse
(
room
[
1
]),
User
.
parse
(
room
[
2
]),
false
,
Room
::
Color
[
room
[
5
].
to_i
],
room
[
3
])
end
end
end
end
end
rooms
=
templist
+
rooms
self
.
new
rooms
end
end
@rooms
=
templist
+
@rooms
end
$game
.
rooms
=
@rooms
class
NewUser
end
def
self
.
parse
(
info
)
end
p
info
class
Game_Event
::
NOL
<
Game_Event
#super
def
initialize
(
info
)
#@args = @args.collect do |user|
super
# User.new(user)
@args
=
@args
.
collect
do
|
user
|
#end
Iduel
::
User
.
new
(
user
)
end
end
class
MissingUser
def
self
.
parse
(
info
)
p
info
#super
#@args = @args.collect do |user|
# User.new(user)
#end
end
end
end
end
end
class
Game_Event
::
DOL
<
Game_Event
class
Join
def
initialize
(
info
)
def
self
.
parse
(
info
)
super
self
.
new
Room
.
new
(
info
.
to_i
)
@args
=
@args
.
collect
do
|
user
|
Iduel
::
User
.
new
(
user
)
end
end
end
end
end
class
Leave
class
Game_Event
::
PCHAT
<
Game_Event
def
self
.
parse
(
info
)
attr_reader
:user
,
:content
self
.
new
def
initialize
(
info
)
user
,
@content
=
info
.
split
(
","
,
2
)
@user
=
user
==
"System"
?
Iduel
::
User
.
new
(
100000
,
"iDuel管理中心"
)
:
Iduel
::
User
.
new
(
user
)
end
end
class
Game_Event
::
JOINROOMOK
<
Game_Event
attr_reader
:room
def
initialize
(
id
)
@room
=
Iduel
::
Room
.
new
(
id
)
end
end
class
Game_Event
::
QROOMOK
<
Game_Event
end
class
Game_Event
::
NewRoom
<
Game_Event
def
initialize
(
info
)
id
,
x
,
player1
,
player2
=
info
.
split
(
","
,
4
)
@room
=
Iduel
::
Room
.
new
(
id
)
@room
.
player1
=
Iduel
::
User
.
new
(
player1
)
@room
.
player2
=
Iduel
::
User
.
new
(
player2
)
$game
.
rooms
<<
@room
unless
$game
.
rooms
.
include?
@room
end
end
#"Q"
#"273,1,zh99998(201448),zh99997(201629)"
class
Game_Event
::
WATCHROOMSTART
<
Game_Event
attr_reader
:room
def
initialize
(
info
)
id
,
name
=
info
.
split
(
","
,
1
)
@room
=
Iduel
::
Room
.
new
(
id
.
to_i
,
name
,
''
,
''
,
false
,
Iduel
::
Color
[
0
])
#:name, :player1, :player2, :crypted, :color
end
end
class
Game_Event
::
Action
<
Game_Event
attr_reader
:action
def
initialize
(
info
)
info
[
"◎"
]
=
"●"
if
info
=~
/^\[\d+\] (?:.*\r\n){0,1}(◎)→.*▊▊▊.*$/
@action
=
::
Action
.
parse
info
p
@action
end
end
class
Game_Event
::
WMSG
<
Game_Event
def
initialize
(
info
)
#black_st(212671), [109] ┊墓地,苍岩┊
#p info
#p $1, $2
info
=~
/(.+)\((\d+)\), \[(\d+)\] (.*)/m
#cchenwor(211650), [27] ◎→<[效果怪兽][盟军·次世代鸟人] 1400 400>攻击8
@args
=
[
$1
,
$2
,
$3
,
$4
]
end
end
class
Game_Event
::
WATCHSTOP
<
Game_Event
end
class
Game_Event
::
Error
<
Game_Event
attr_reader
:title
,
:message
def
initialize
(
info
)
@title
,
@message
=
case
info
.
to_i
when
0x00
[
"网络错误"
,
"网络连接中断"
]
when
0x65
[
"出错啦~"
,
"服务器程序出现未知错误,请记录好出现错误的事件,并联系管理员。"
]
when
0x66
[
"错误"
,
"通信验证错误"
]
when
0x67
[
"错误"
,
"通信钥匙错误"
]
when
0xc9
[
"登录失败"
,
"错误的帐号名或密码"
]
when
0xca
[
"登录失败"
,
"你的账号还未激活"
]
when
0xcb
[
"登录失败"
,
"你的账号被系统封锁"
]
when
0x12d
[
"错误"
,
"房间已满"
]
when
0x12e
[
"错误"
,
"房间密码错误"
]
when
0x12f
[
"错误"
,
"你没有权限给房间上密码"
]
when
0x130
[
"错误"
,
"你已经加入房间,请不要重新加入"
]
when
0x131
[
"加入房间"
,
"你未达到房间要求的等级限制。"
]
when
0x132
[
"观战错误"
,
"所请求的房间无效,或未开始决斗"
]
when
0x133
[
"观战错误"
,
"你已经在该房间观战"
]
when
0x134
[
"发送信息错误"
,
"你还未加入房间"
]
when
0x135
[
"错误"
,
"请求的房间无效"
]
end
end
#Exception.new(@message).raise
end
p
caller
class
NewRoom
p
@title
def
self
.
parse
(
info
)
p
@message
id
,
x
,
player1
,
player2
=
info
.
split
(
","
,
4
)
#system("pause")
room
=
Room
.
new
(
id
)
end
room
.
player1
=
User
.
parse
(
player1
)
end
room
.
player2
=
User
.
parse
(
player2
)
class
Game_Event
::
UNKNOWN
<
Game_Event
self
.
new
room
def
initialize
(
*
args
)
end
puts
'--------UnKnown Iduel Event-------'
end
p
$1
,
$2
,
args
#"Q"
system
(
"pause"
)
#"273,1,zh99998(201448),zh99997(201629)"
class
Watch
attr_reader
:room
def
self
.
parse
(
info
)
id
,
name
=
info
.
split
(
","
,
2
)
self
.
new
Room
.
new
(
id
.
to_i
,
name
)
end
end
class
Action
attr_reader
:action
def
self
.
parse
(
info
)
info
=~
/(.*)▊▊▊.*?$/
info
=
$1
info
[
"◎"
]
=
"●"
if
info
[
"◎"
]
self
.
new
::
Action
.
parse
info
end
end
class
Leave
end
class
Chat
attr_reader
:user
,
:content
alias
old_initialize
initialize
def
self
.
parse
(
info
)
user
,
content
=
info
.
split
(
","
,
2
)
user
=
user
==
"System"
?
User
.
new
(
100000
,
"iDuel管理中心"
)
:
User
.
parse
(
user
)
self
.
new
(
user
,
content
,
:hall
)
end
end
class
Error
attr_reader
:title
,
:message
def
self
.
parse
(
info
)
title
,
message
=
case
info
.
to_i
when
0x00
[
"网络错误"
,
"网络连接中断"
]
when
0x65
[
"出错啦~"
,
"服务器程序出现未知错误,请记录好出现错误的事件,并联系管理员。"
]
when
0x66
[
"错误"
,
"通信验证错误"
]
when
0x67
[
"错误"
,
"通信钥匙错误"
]
when
0xc9
[
"登录失败"
,
"错误的帐号名或密码"
]
when
0xca
[
"登录失败"
,
"你的账号还未激活"
]
when
0xcb
[
"登录失败"
,
"你的账号被系统封锁"
]
when
0x12d
[
"错误"
,
"房间已满"
]
when
0x12e
[
"错误"
,
"房间密码错误"
]
when
0x12f
[
"错误"
,
"你没有权限给房间上密码"
]
when
0x130
[
"错误"
,
"你已经加入房间,请不要重新加入"
]
when
0x131
[
"加入房间"
,
"你未达到房间要求的等级限制。"
]
when
0x132
[
"观战错误"
,
"所请求的房间无效,或未开始决斗"
]
when
0x133
[
"观战错误"
,
"你已经在该房间观战"
]
when
0x134
[
"发送信息错误"
,
"你还未加入房间"
]
when
0x135
[
"错误"
,
"请求的房间无效"
]
end
self
.
new
title
,
message
end
end
class
Unknown
def
self
.
parse
(
*
args
)
puts
'--------Unknown Iduel Event-------'
p
$1
,
$2
,
args
end
end
#以下iduel专有
class
WatchAction
<
Action
attr_reader
:user
def
initialize
(
action
,
str
,
user
)
@user
=
user
super
(
action
,
str
)
@action
.
from_player
=
@user
==
$game
.
room
.
player1
end
def
self
.
parse
(
info
)
info
=~
/(.+)\((\d+)\), (.*)/m
self
.
new
::
Action
.
parse
(
$3
),
$3
,
User
.
new
(
$2
.
to_i
,
$1
)
end
end
class
QROOMOK
<
Game_Event
end
end
end
end
\ No newline at end of file
lib/iduel/iduel.rb
View file @
fe974547
...
@@ -5,81 +5,83 @@ class Iduel < Game
...
@@ -5,81 +5,83 @@ class Iduel < Game
Port
=
38522
Port
=
38522
RS
=
"
\xA1\xE9
"
.
force_encoding
"GBK"
RS
=
"
\xA1\xE9
"
.
force_encoding
"GBK"
Color
=
[[
0
,
0
,
0
],
[
255
,
0
,
0
],
[
0
,
255
,
0
],
[
0
,
0
,
255
],
[
255
,
165
,
0
]]
attr_accessor
:session
attr_accessor
:session
attr_accessor
:key
attr_accessor
:key
def
initialize
def
initialize
super
require
'socket'
require
'socket'
require
'digest/md5'
require
'digest/md5'
require
'open-uri'
require
'open-uri'
require_relative
'action'
require_relative
'action'
require_relative
'event'
require_relative
'event'
require_relative
'user'
require_relative
'user'
require_relative
'room'
@conn
=
TCPSocket
.
open
(
Server
,
Port
)
@conn
=
TCPSocket
.
open
(
Server
,
Port
)
@conn
.
set_encoding
"GBK"
@conn
.
set_encoding
"GBK"
Thread
.
abort_on_exception
=
true
Thread
.
abort_on_exception
=
true
@recv
=
Thread
.
new
{
recv
@conn
.
gets
(
RS
)
while
@conn
}
@recv
=
Thread
.
new
{
recv
@conn
.
gets
(
RS
)
while
@conn
}
end
end
def
login
(
username
,
password
)
md5
=
Digest
::
MD5
.
hexdigest
(
password
)
send
(
0
,
username
,
md5
,
checknum
(
"LOGINMSG"
,
username
,
md5
),
VERSION
)
end
def
refresh
send
(
1
,
@key
,
checknum
(
"UPINFOMSG"
,
@session
))
end
def
host
(
name
,
password
=
""
,
lv
=
0
,
color
=
0
)
send
(
6
,
@key
,
name
,
password
,
checknum
(
"JOINROOMMSG"
,
@session
+
name
+
password
+
"0"
),
0
,
color
,
lv
,
0
,
nil
,
nil
)
#TODO:v.ak, v.al
end
def
join
(
room
,
password
=
""
)
send
(
6
,
@key
,
room
.
id
,
password
,
checknum
(
"JOINROOMMSG"
,
@session
+
room
.
id
.
to_s
+
password
+
"1"
),
1
)
end
def
watch
(
room
,
password
=
""
)
send
(
5
,
@key
,
room
.
id
,
password
,
checknum
(
"WATCHROOMMSG"
,
"
#{
@session
}#{
room
.
id
}#{
password
}
"
))
end
def
leave
if
@room
.
include?
@user
#
else
send
(
"QUITWATCHROOM"
,
@key
,
checknum
(
"QUITWATCHROOM"
,
@session
))
end
end
def
action
(
action
)
send
(
2
,
"
#{
checknum
(
"RMSG"
,
@session
)
}
@
#{
@key
}
"
,
"
#{
action
.
escape
}
▊▊▊000000"
)
if
@room
.
include?
@user
#TODO:iduel校验字串
end
def
exit
send
(
11
,
@key
,
checknum
(
"ULO"
,
"
#{
@session
}
"
))
@recv
.
exit
@conn
.
close
@conn
=
nil
end
def
send
(
head
,
*
args
)
def
send
(
head
,
*
args
)
info
=
"#
#{
head
.
to_s
(
16
).
upcase
}
|
#{
args
.
join
(
','
)
}
"
.
encode
(
"GBK"
)
+
RS
info
=
"#
#{
head
.
to_s
(
16
).
upcase
}
|
#{
args
.
join
(
','
)
}
"
.
encode
(
"GBK"
)
+
RS
puts
"<<
#{
info
}
"
puts
"<<
#{
info
}
"
(
@conn
.
write
info
)
rescue
Event
.
push
Event
::
Error
.
new
(
0
)
(
@conn
.
write
info
)
rescue
Game_Event
.
push
Game_
Event
::
Error
.
new
(
0
)
end
end
def
recv
(
info
)
def
recv
(
info
)
if
info
.
nil?
if
info
.
nil?
@conn
.
close
@conn
.
close
@conn
=
nil
@conn
=
nil
Event
::
Error
.
new
(
0
)
Game_
Event
::
Error
.
new
(
0
)
else
else
info
.
chomp!
(
RS
)
info
.
chomp!
(
RS
)
info
.
encode!
"UTF-8"
,
:invalid
=>
:replace
,
:undef
=>
:replace
info
.
encode!
"UTF-8"
,
:invalid
=>
:replace
,
:undef
=>
:replace
puts
">>
#{
info
}
"
puts
">>
#{
info
}
"
Event
.
push
Event
.
parse
info
Game_Event
.
push
Game_
Event
.
parse
info
end
end
end
end
def
close
$game
.
quit
@recv
.
exit
@conn
.
close
@conn
=
nil
end
def
checknum
(
head
,
*
args
)
def
checknum
(
head
,
*
args
)
Digest
::
MD5
.
hexdigest
(
"[
#{
head
}
]_
#{
args
.
join
(
'_'
)
}
_SCNERO"
)
Digest
::
MD5
.
hexdigest
(
"[
#{
head
}
]_
#{
args
.
join
(
'_'
)
}
_SCNERO"
)
end
end
def
login
(
username
,
password
)
md5
=
Digest
::
MD5
.
hexdigest
(
password
)
send
(
0
,
username
,
md5
,
checknum
(
"LOGINMSG"
,
username
,
md5
),
VERSION
)
end
def
refresh
send
(
1
,
@key
,
checknum
(
"UPINFOMSG"
,
@session
))
end
def
join
(
room
,
password
=
""
)
send
(
6
,
@key
,
room
.
id
,
password
,
checknum
(
"JOINROOMMSG"
,
@session
+
room
.
id
.
to_s
+
password
+
"1"
),
1
)
end
def
qroom
(
room
)
def
qroom
(
room
)
send
(
10
,
@key
,
room
.
id
,
checknum
(
"QROOM"
,
@session
+
room
.
id
.
to_s
))
send
(
10
,
@key
,
room
.
id
,
checknum
(
"QROOM"
,
@session
+
room
.
id
.
to_s
))
end
end
def
action
(
action
)
send
(
2
,
"
#{
checknum
(
"RMSG"
,
@session
)
}
@
#{
@key
}
"
,
"
#{
action
.
escape
}
▊▊▊000000"
)
#TODO:iduel校验字串
end
def
host
(
name
,
password
=
""
,
lv
=
0
,
color
=
0
)
send
(
6
,
@key
,
name
,
password
,
checknum
(
"JOINROOMMSG"
,
@session
+
name
+
password
+
"0"
),
0
,
color
,
lv
,
0
,
nil
,
nil
)
#TODO:v.ak, v.al
end
def
watch
(
room
,
password
=
""
)
send
(
5
,
@key
,
room
.
id
,
password
,
checknum
(
"WATCHROOMMSG"
,
"
#{
@session
}#{
room
.
id
}#{
password
}
"
))
end
def
chat
(
msg
)
def
chat
(
msg
)
send
(
4
,
@key
,
msg
,
checknum
(
"CHATP"
,
@session
))
send
(
4
,
@key
,
msg
,
checknum
(
"CHATP"
,
@session
))
#4|241019,test,2368c6b89b3e2eedb92e1b624a2a157c
#4|241019,test,2368c6b89b3e2eedb92e1b624a2a157c
end
end
def
quitwatchroom
send
(
"QUITWATCHROOM"
,
@key
,
checknum
(
"QUITWATCHROOM"
,
@session
))
end
def
quit
send
(
11
,
@key
,
checknum
(
"ULO"
,
"
#{
@session
}
"
))
end
end
end
\ No newline at end of file
lib/iduel/room.rb
deleted
100644 → 0
View file @
aebd808b
class
Iduel
::
Room
@@all
=
[]
attr_accessor
:id
,
:name
,
:player1
,
:player2
,
:private
,
:color
class
<<
self
alias
old_new
new
def
new
(
id
,
*
args
)
id
=
id
.
to_i
room
=
@@all
.
find
{
|
room
|
room
.
id
==
id
}
if
room
room
else
room
=
old_new
(
id
,
*
args
)
@@all
<<
room
room
end
end
end
def
initialize
(
id
,
name
,
player1
,
player2
,
private
,
color
,
session
=
nil
,
forbid
=
nil
)
@id
=
id
@name
=
name
@player1
=
player1
@player2
=
player2
@private
=
private
@color
=
color
@forbid
=
forbid
@session
=
session
end
alias
full?
player2
alias
private
?
private
end
\ No newline at end of file
lib/iduel/user.rb
View file @
fe974547
class
Iduel
::
User
class
User
@@all
=
[]
attr_accessor
:level
,
:exp
attr_accessor
:id
,
:name
,
:level
,
:exp
def
self
.
parse
(
info
)
class
<<
self
info
=~
/(.+)\((\d+)\)/
alias
old_new
new
new
$2
.
to_i
,
$1
def
new
(
id
,
name
=
""
,
level
=
nil
,
exp
=
nil
)
if
id
.
is_a?
String
and
id
=~
/(.*)\((\d+)\)/
id
=
$2
.
to_i
name
=
$1
else
id
=
id
.
to_i
end
user
=
@@all
.
find
{
|
user
|
user
.
id
==
id
}
if
user
user
.
name
=
name
if
name
user
.
level
=
level
if
level
user
.
exp
=
exp
if
exp
user
else
user
=
old_new
(
id
,
name
,
level
,
exp
)
@@all
<<
user
user
end
end
end
end
def
initialize
(
id
,
name
=
""
,
level
=
nil
,
exp
=
nil
)
def
initialize
(
id
,
name
=
""
,
level
=
nil
,
exp
=
nil
)
@id
=
id
@id
=
id
@name
=
name
@name
=
name
@level
=
level
@level
=
level
@exp
=
exp
@exp
=
exp
#@status = :waiting
end
#@room = nil
def
set
(
id
,
name
=
:keep
,
level
=
:keep
,
exp
=
:keep
)
@id
=
id
unless
id
==
:keep
@name
=
name
unless
name
==
:keep
@level
=
level
unless
level
==
:keep
@exp
=
exp
unless
exp
==
:keep
end
end
def
avatar
(
size
=
:small
)
def
avatar
(
size
=
:small
)
cache
=
"graphics/avatars/
#{
@id
}
_
#{
size
}
.png"
cache
=
"graphics/avatars/
#{
@id
}
_
#{
size
}
.png"
...
@@ -57,6 +42,6 @@ class Iduel::User
...
@@ -57,6 +42,6 @@ class Iduel::User
result
result
end
end
def
room
def
room
$game
.
rooms
.
find
{
|
room
|
room
.
player1
==
self
or
room
.
player2
==
self
}
$game
.
rooms
.
find
{
|
room
|
room
.
include?
self
}
end
end
end
end
\ No newline at end of file
lib/nbx/event.rb
View file @
fe974547
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
class
Game_Event
class
Game_Event
def
self
.
parse
(
info
,
host
=
nil
)
def
self
.
parse
(
info
,
host
=
nil
)
result
=
(
if
host
#来自大厅的udp消息
if
host
#来自大厅的udp消息
info
=~
/^(\w*)\|(.*)$/m
info
=~
/^(\w*)\|(.*)$/m
case
$1
case
$1
when
"NewUser"
when
"NewUser"
...
@@ -31,9 +31,7 @@ class Game_Event
...
@@ -31,9 +31,7 @@ class Game_Event
else
else
Error
Error
end
.
parse
(
$1
)
end
.
parse
(
$1
)
end
)
end
p
info
,
result
result
end
end
...
@@ -79,6 +77,8 @@ class Game_Event
...
@@ -79,6 +77,8 @@ class Game_Event
self
.
new
::
Action
.
parse
(
info
),
info
self
.
new
::
Action
.
parse
(
info
),
info
end
end
end
end
#以下NBX专有
class
VerInf
class
VerInf
def
self
.
parse
(
info
)
def
self
.
parse
(
info
)
...
...
lib/nbx/nbx.rb
View file @
fe974547
...
@@ -10,8 +10,6 @@ class NBX < Game
...
@@ -10,8 +10,6 @@ class NBX < Game
require
'open-uri'
require
'open-uri'
require_relative
'action'
require_relative
'action'
require_relative
'event'
require_relative
'event'
require_relative
'user'
require_relative
'room'
@conn_hall
=
UDPSocket
.
new
@conn_hall
=
UDPSocket
.
new
@conn_hall
.
setsockopt
(
Socket
::
SOL_SOCKET
,
Socket
::
SO_BROADCAST
,
true
)
@conn_hall
.
setsockopt
(
Socket
::
SOL_SOCKET
,
Socket
::
SO_BROADCAST
,
true
)
...
...
lib/nbx/room.rb
deleted
100644 → 0
View file @
aebd808b
#class NBX::Room < Room
#end
\ No newline at end of file
lib/nbx/user.rb
deleted
100644 → 0
View file @
aebd808b
#class NBX::User < User
#end
\ No newline at end of file
lib/room.rb
View file @
fe974547
class
Room
class
Room
Color
=
[[
0
,
0
,
0
],
[
255
,
0
,
0
],
[
0
,
255
,
0
],
[
0
,
0
,
255
],
[
255
,
165
,
0
]]
extend
Cacheable
extend
Cacheable
attr_accessor
:id
,
:name
,
:player1
,
:player2
,
:private
,
:color
,
:forbid
attr_accessor
:id
,
:name
,
:player1
,
:player2
,
:private
,
:color
,
:forbid
def
set
(
id
,
name
,
player1
,
player2
=
nil
,
private
=
false
,
color
=
[
0
,
0
,
0
]
,
forbid
=
nil
)
def
initialize
(
id
,
name
=
""
,
player1
=
nil
,
player2
=
nil
,
private
=
false
,
color
=
[
0
,
0
,
0
],
session
=
nil
,
forbid
=
nil
)
@id
=
id
@id
=
id
@name
=
name
@name
=
name
@player1
=
player1
@player1
=
player1
@player2
=
player2
@player2
=
player2
@private
=
private
@private
=
private
@color
=
color
@color
=
color
@session
=
session
@forbid
=
forbid
@forbid
=
forbid
end
end
def
set
(
id
=
:keep
,
name
=
:keep
,
player1
=
:keep
,
player2
=
:keep
,
private
=
:keep
,
color
=
:keep
,
session
=
nil
,
forbid
=
:keep
)
@id
=
id
unless
id
==
:keep
@name
=
name
unless
name
==
:keep
@player1
=
player1
unless
player1
==
:keep
@player2
=
player2
unless
player2
==
:keep
@private
=
private
unless
private
==
:keep
@color
=
color
unless
color
==
:keep
@session
=
session
unless
session
==
:keep
@forbid
=
forbid
unless
forbid
==
:keep
end
def
include?
(
user
)
@player1
==
user
or
@player2
==
user
end
alias
full?
player2
alias
full?
player2
alias
private
?
private
alias
private
?
private
end
end
\ No newline at end of file
lib/scene_duel.rb
View file @
fe974547
...
@@ -21,9 +21,10 @@ class Scene_Duel < Scene
...
@@ -21,9 +21,10 @@ class Scene_Duel < Scene
attr_reader
:player_field_window
attr_reader
:player_field_window
attr_reader
:opponent_field_window
attr_reader
:opponent_field_window
attr_reader
:fieldback_window
attr_reader
:fieldback_window
def
initialize
(
room
)
def
initialize
(
room
,
deck
=
nil
)
super
()
super
()
@room
=
room
@room
=
room
@deck
=
deck
end
end
def
start
def
start
$game
.
refresh
if
$game
$game
.
refresh
if
$game
...
@@ -37,7 +38,7 @@ class Scene_Duel < Scene
...
@@ -37,7 +38,7 @@ class Scene_Duel < Scene
@phases_window
=
Window_Phases
.
new
(
124
,
357
)
@phases_window
=
Window_Phases
.
new
(
124
,
357
)
@turn_player
=
true
@turn_player
=
true
$game
.
player_field
=
Game_Field
.
new
Deck
.
load
(
"test1.TXT"
)
$game
.
player_field
=
Game_Field
.
new
@deck
$game
.
opponent_field
=
Game_Field
.
new
$game
.
opponent_field
=
Game_Field
.
new
@fieldback_window
=
Window_FieldBack
.
new
(
130
,
174
)
@fieldback_window
=
Window_FieldBack
.
new
(
130
,
174
)
...
@@ -135,6 +136,8 @@ class Scene_Duel < Scene
...
@@ -135,6 +136,8 @@ class Scene_Duel < Scene
@opponent_field_window
.
refresh
@opponent_field_window
.
refresh
when
Game_Event
::
Error
when
Game_Event
::
Error
Widget_Msgbox
.
new
(
event
.
title
,
event
.
message
){
$scene
=
Scene_Title
.
new
}
Widget_Msgbox
.
new
(
event
.
title
,
event
.
message
){
$scene
=
Scene_Title
.
new
}
when
Game_Event
::
Leave
$scene
=
Scene_Hall
.
new
end
end
end
end
def
update
def
update
...
...
lib/scene_hall.rb
View file @
fe974547
...
@@ -80,7 +80,7 @@ class Scene_Hall < Scene
...
@@ -80,7 +80,7 @@ class Scene_Hall < Scene
@roomlist
.
list
=
$game
.
rooms
@roomlist
.
list
=
$game
.
rooms
when
Game_Event
::
Join
when
Game_Event
::
Join
require_relative
'scene_duel'
require_relative
'scene_duel'
$scene
=
Scene_Duel
.
new
(
event
.
room
)
$scene
=
Scene_Duel
.
new
(
event
.
room
,
Deck
.
load
(
"test1.TXT"
)
)
when
Game_Event
::
Watch
when
Game_Event
::
Watch
require_relative
'scene_watch'
require_relative
'scene_watch'
$scene
=
Scene_Watch
.
new
(
event
.
room
)
$scene
=
Scene_Watch
.
new
(
event
.
room
)
...
...
lib/scene_login.rb
View file @
fe974547
...
@@ -16,31 +16,32 @@ class Scene_Login < Scene
...
@@ -16,31 +16,32 @@ class Scene_Login < Scene
end
end
end
end
def
login
def
login
@font
.
draw_blended_utf8
(
$screen
,
Vocab_Logging
,
0
,
0
,
255
,
0
,
255
)
@font
.
draw_blended_utf8
(
$screen
,
Vocab_Logging
,
0
,
0
,
255
,
0
,
255
)
$screen
.
update_rect
(
0
,
0
,
100
,
24
)
$game
=
Iduel
.
new
$game
=
Iduel
.
new
$game
.
login
(
@username
,
@password
)
$game
.
login
(
@username
,
@password
)
end
end
def
update
def
update
while
event
=
Event
.
poll
case
event
when
Event
::
Quit
$scene
=
nil
end
end
while
event
=
Game_Event
.
poll
while
event
=
Game_Event
.
poll
case
event
handle_game
(
event
)
when
Game_Event
::
LOGINOK
end
require_relative
'scene_hall'
super
$scene
=
Scene_Hall
.
new
end
when
Game_Event
::
Error
def
handle
(
event
)
Widget_Msgbox
.
new
(
event
.
title
,
event
.
message
){
$scene
=
Scene_Title
.
new
}
case
event
else
when
Event
::
Quit
p
event
$scene
=
nil
end
end
end
def
handle_game
(
event
)
case
event
when
Game_Event
::
Login
require_relative
'scene_hall'
$scene
=
Scene_Hall
.
new
when
Game_Event
::
Error
Widget_Msgbox
.
new
(
event
.
title
,
event
.
message
){
$scene
=
Scene_Title
.
new
}
else
p
event
end
end
end
end
end
end
lib/scene_watch.rb
View file @
fe974547
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
#==============================================================================
#==============================================================================
require_relative
'scene_duel'
require_relative
'scene_duel'
class
Scene_Watch
<
Scene_Duel
class
Scene_Watch
<
Scene_Duel
def
action
(
action
)
action
.
run
end
end
end
lib/user.rb
View file @
fe974547
class
User
class
User
attr_accessor
:id
,
:name
attr_accessor
:id
,
:name
extend
Cacheable
extend
Cacheable
def
set
(
id
,
name
=
""
)
def
initialize
(
id
,
name
=
""
)
@id
=
id
@id
=
id
@name
=
name
if
name
@name
=
name
end
def
set
(
id
,
name
=
:keep
)
@id
=
id
@name
=
name
unless
name
==
:keep
end
end
def
avatar
(
size
=
:small
)
def
avatar
(
size
=
:small
)
Surface
.
new
(
SWSURFACE
,
1
,
1
,
32
,
0
,
0
,
0
,
0
)
Surface
.
new
(
SWSURFACE
,
1
,
1
,
32
,
0
,
0
,
0
,
0
)
...
...
lib/window_action.rb
View file @
fe974547
...
@@ -25,7 +25,6 @@ class Window_Action < Window_List
...
@@ -25,7 +25,6 @@ class Window_Action < Window_List
@list_available
=
list
.
values
@list_available
=
list
.
values
@height
=
@viewport
[
3
]
=
@list
.
size
*
WLH
+
15
*
2
@height
=
@viewport
[
3
]
=
@list
.
size
*
WLH
+
15
*
2
@item_max
=
@list
.
size
@item_max
=
@list
.
size
p
list
@index
=
@list_available
.
find_index
(
true
)
||
0
@index
=
@list_available
.
find_index
(
true
)
||
0
refresh
refresh
@visible
=
true
@visible
=
true
...
...
lib/window_field.rb
View file @
fe974547
...
@@ -78,7 +78,6 @@ class Window_Field < Window
...
@@ -78,7 +78,6 @@ class Window_Field < Window
Surface
.
transform_draw
(
@cards
[
index
].
image_small
,
@contents
,
90
,
1
,
1
,
0
,
0
,
@items
[
index
][
0
]
+
Card_Size
[
1
],
@items
[
index
][
1
],
Surface
::
TRANSFORM_SAFE
)
Surface
.
transform_draw
(
@cards
[
index
].
image_small
,
@contents
,
90
,
1
,
1
,
0
,
0
,
@items
[
index
][
0
]
+
Card_Size
[
1
],
@items
[
index
][
1
],
Surface
::
TRANSFORM_SAFE
)
@contents
.
put
(
@border_horizontal
,
@items
[
index
][
0
]
-
1
,
@items
[
index
][
1
]
-
1
)
if
status
==
1
@contents
.
put
(
@border_horizontal
,
@items
[
index
][
0
]
-
1
,
@items
[
index
][
1
]
-
1
)
if
status
==
1
else
else
p
index
,
@cards
[
index
]
@contents
.
put
(
@cards
[
index
].
image_small
,
@items
[
index
][
0
],
@items
[
index
][
1
])
@contents
.
put
(
@cards
[
index
].
image_small
,
@items
[
index
][
0
],
@items
[
index
][
1
])
@contents
.
put
(
@border
,
@items
[
index
][
0
]
-
1
,
@items
[
index
][
1
]
-
1
)
if
status
==
1
@contents
.
put
(
@border
,
@items
[
index
][
0
]
-
1
,
@items
[
index
][
1
]
-
1
)
if
status
==
1
end
end
...
...
lib/window_roomlist.rb
View file @
fe974547
...
@@ -27,7 +27,7 @@ class Window_RoomList < Window_List
...
@@ -27,7 +27,7 @@ class Window_RoomList < Window_List
@font
.
draw_blended_utf8
(
@contents
,
"R-
#{
room
.
id
}
"
,
24
,
WLH
*
index
+
8
,
*
@color
)
@font
.
draw_blended_utf8
(
@contents
,
"R-
#{
room
.
id
}
"
,
24
,
WLH
*
index
+
8
,
*
@color
)
@font
.
draw_blended_utf8
(
@contents
,
room
.
full?
?
"【决斗中】"
:
room
.
private?
?
"【私密房】"
:
"【等待中】"
,
8
,
WLH
*
index
+
24
,
*
@color
)
@font
.
draw_blended_utf8
(
@contents
,
room
.
full?
?
"【决斗中】"
:
room
.
private?
?
"【私密房】"
:
"【等待中】"
,
8
,
WLH
*
index
+
24
,
*
@color
)
@font
.
draw_blended_utf8
(
@contents
,
room
.
name
,
128
,
WLH
*
index
+
8
,
*
room
.
color
)
@font
.
draw_blended_utf8
(
@contents
,
room
.
name
,
128
,
WLH
*
index
+
8
,
*
room
.
color
)
@font
.
draw_blended_utf8
(
@contents
,
room
.
player1
.
name
,
128
,
WLH
*
index
+
24
,
*
@color
)
@font
.
draw_blended_utf8
(
@contents
,
room
.
player1
.
name
,
128
,
WLH
*
index
+
24
,
*
@color
)
@font
.
draw_blended_utf8
(
@contents
,
room
.
player2
.
name
,
256
,
WLH
*
index
+
24
,
*
@color
)
if
room
.
full?
@font
.
draw_blended_utf8
(
@contents
,
room
.
player2
.
name
,
256
,
WLH
*
index
+
24
,
*
@color
)
if
room
.
full?
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment