Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
phpdts
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
Nemo Ma
phpdts
Commits
34d4029e
Commit
34d4029e
authored
Mar 21, 2023
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update botservice
parent
d155915a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
43 additions
and
39 deletions
+43
-39
bot/bot_enable.bat
bot/bot_enable.bat
+2
-4
bot/bot_enable.sh
bot/bot_enable.sh
+2
-5
bot/revbot.func.php
bot/revbot.func.php
+4
-1
bot/revbotservice.php
bot/revbotservice.php
+35
-29
No files found.
bot/bot_enable.bat
View file @
34d4029e
@echo
off
set
BOT_CD
=
1
cd
..
:loop
php
bot
/revbotservice
.php
timeout
/t
%BOT_CD%
goto
loop
bot/bot_enable.sh
View file @
34d4029e
#!/bin/bash
BOT_CD
=
2
cd
..
while
true
;
do
php bot/revbotservice.php
sleep
$BOT_CD
done
php bot/revbotservice.php
bot/revbot.func.php
View file @
34d4029e
...
...
@@ -82,7 +82,10 @@ function bot_acts($id)
{
$flag
=
search
(
$bdata
);
}
unset
(
$bdata
[
'clbpara'
][
'botact'
][
'moveto'
]);
if
(
isset
(
$bdata
[
'clbpara'
][
'botact'
][
'moveto'
]))
{
unset
(
$bdata
[
'clbpara'
][
'botact'
][
'moveto'
]);
}
echo
$log
;
echo
"bot
{
$bdata
[
'name'
]
}
行动完成。"
;
player_save
(
$bdata
);
...
...
bot/revbotservice.php
View file @
34d4029e
<?php
define
(
'CURSCRIPT'
,
'revbotservice'
);
include
'./include/common.inc.php'
;
include
GAME_ROOT
.
'./include/game.func.php'
;
include
GAME_ROOT
.
'./bot/revbot.func.php'
;
if
(
$gamestate
>
10
)
{
if
(
!
empty
(
$gamevars
[
'botplayer'
]))
{
# bot初始化
$ids
=
bot_player_valid
(
$gamevars
[
'botplayer'
]);
unset
(
$gamevars
[
'botplayer'
]);
$gamevars
[
'botid'
]
=
$ids
;
save_gameinfo
();
echo
"所有BOT初始化完成,共计:"
.
(
count
(
$ids
))
.
"个"
;
}
elseif
(
!
empty
(
$gamevars
[
'botid'
]))
{
foreach
(
$gamevars
[
'botid'
]
as
$botid
)
{
$flag
=
bot_acts
(
$botid
);
if
(
$flag
==
0
)
{
unset
(
$gamevars
[
'botid'
][
array_search
(
$botid
,
$gamevars
[
'botid'
])]);
save_gameinfo
();
if
(
empty
(
$gamevars
[
'botid'
]))
break
;
include
GAME_ROOT
.
'./include/game.func.php'
;
include
GAME_ROOT
.
'./bot/revbot.func.php'
;
$id
=
0
;
if
(
$gamestate
>
10
)
{
$ids
=
bot_player_valid
(
1
);
$id
=
$ids
[
0
];
unset
(
$gamevars
[
'botplayer'
]);
$gamevars
[
'botid'
]
=
$ids
;
save_gameinfo
();
echo
"BOT初始化完成,id:"
.
(
$id
)
.
"
\n
"
;
ob_end_flush
();
}
while
(
true
)
{
if
(
$gamestate
>
10
)
{
var_dump
(
$gamevars
[
'botplayer'
]);
if
(
!
empty
(
$gamevars
[
'botplayer'
]))
{
# bot初始化
$ids
=
bot_player_valid
(
1
);
$id
=
$ids
[
0
];
unset
(
$gamevars
[
'botplayer'
]);
$gamevars
[
'botid'
]
=
$ids
;
save_gameinfo
();
echo
"BOT初始化完成,id:"
.
(
$id
)
.
"
\n
"
;
ob_end_flush
();
}
elseif
(
!
empty
(
$gamevars
[
'botid'
]))
{
{
$flag
=
bot_acts
(
$id
);
if
(
$flag
==
0
)
{
unset
(
$gamevars
[
'botid'
][
array_search
(
$botid
,
$gamevars
[
'botid'
])]);
save_gameinfo
();
if
(
empty
(
$gamevars
[
'botid'
]))
break
;
}
echo
"所有BOT行动完成
\n
"
;
ob_end_flush
();
}
sleep
(
1
);
}
echo
"所有BOT行动完成"
;
sleep
(
2
)
;
}
}
?>
}
\ No newline at end of file
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