Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
S
srvpro
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
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
MyCard
srvpro
Commits
39af0bcd
Commit
39af0bcd
authored
Aug 20, 2016
by
mercury233
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix long ai name
parent
5bf73b28
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
ygopro-server.coffee
ygopro-server.coffee
+6
-2
ygopro-server.js
ygopro-server.js
+10
-2
No files found.
ygopro-server.coffee
View file @
39af0bcd
...
...
@@ -225,12 +225,14 @@ ROOM_find_or_create_ai = (name)->
name
=
'AI'
if
name
[
0
...
3
]
==
'AI_'
name
=
'AI#'
+
name
.
slice
(
3
)
namea
=
name
.
split
(
'#'
)
if
room
=
ROOM_find_by_name
(
name
)
return
room
else
if
name
==
'AI'
windbot
=
_
.
sample
settings
.
modules
.
windbots
name
=
'AI#'
+
Math
.
floor
(
Math
.
random
()
*
100000
)
else
if
ainame
=
name
.
split
(
'#'
)[
1
]
else
if
namea
.
length
>
1
ainame
=
namea
[
namea
.
length
-
1
]
windbot
=
_
.
sample
_
.
filter
settings
.
modules
.
windbots
,
(
w
)
->
w
.
name
==
ainame
or
w
.
deck
==
ainame
if
!
windbot
...
...
@@ -239,7 +241,9 @@ ROOM_find_or_create_ai = (name)->
else
windbot
=
_
.
sample
settings
.
modules
.
windbots
name
=
name
+
'#'
+
Math
.
floor
(
Math
.
random
()
*
100000
)
if
name
.
replace
(
/[^\x00-\xff]/g
,
"00"
).
length
>
20
log
.
info
"long ai name"
,
name
return
{
"error"
:
"AI房间名过长"
}
result
=
new
Room
(
name
)
result
.
windbot
=
windbot
return
result
...
...
ygopro-server.js
View file @
39af0bcd
...
...
@@ -308,19 +308,21 @@
};
ROOM_find_or_create_ai
=
function
(
name
)
{
var
ainame
,
result
,
room
,
windbot
;
var
ainame
,
namea
,
result
,
room
,
windbot
;
if
(
name
===
''
)
{
name
=
'
AI
'
;
}
if
(
name
.
slice
(
0
,
3
)
===
'
AI_
'
)
{
name
=
'
AI#
'
+
name
.
slice
(
3
);
}
namea
=
name
.
split
(
'
#
'
);
if
(
room
=
ROOM_find_by_name
(
name
))
{
return
room
;
}
else
if
(
name
===
'
AI
'
)
{
windbot
=
_
.
sample
(
settings
.
modules
.
windbots
);
name
=
'
AI#
'
+
Math
.
floor
(
Math
.
random
()
*
100000
);
}
else
if
(
ainame
=
name
.
split
(
'
#
'
)[
1
])
{
}
else
if
(
namea
.
length
>
1
)
{
ainame
=
namea
[
namea
.
length
-
1
];
windbot
=
_
.
sample
(
_
.
filter
(
settings
.
modules
.
windbots
,
function
(
w
)
{
return
w
.
name
===
ainame
||
w
.
deck
===
ainame
;
}));
...
...
@@ -334,6 +336,12 @@
windbot
=
_
.
sample
(
settings
.
modules
.
windbots
);
name
=
name
+
'
#
'
+
Math
.
floor
(
Math
.
random
()
*
100000
);
}
if
(
name
.
replace
(
/
[^\x
00-
\x
ff
]
/g
,
"
00
"
).
length
>
20
)
{
log
.
info
(
"
long ai name
"
,
name
);
return
{
"
error
"
:
"
AI房间名过长
"
};
}
result
=
new
Room
(
name
);
result
.
windbot
=
windbot
;
return
result
;
...
...
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