merge master
This commit is contained in:
commit
3776467e61
@ -24,7 +24,7 @@ def monitor_gs():
|
||||
pids = getRuningProgramPids('gameserver2001')
|
||||
if len(pids) <= 0:
|
||||
print('zzzz')
|
||||
os.popen('nohup ./gameserver2001 -i1 >> gameserver2001.out 2>&1 &')
|
||||
os.popen('nohup ./gameserver2001 -n1 -i1 >> gameserver2001.out 2>&1 &')
|
||||
time.sleep(2)
|
||||
|
||||
monitor_gs()
|
||||
|
@ -40,6 +40,18 @@ aux_source_directory(../../third_party/framework/cpp
|
||||
SRC_LIST
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND touch -a cs_proto.pb.h
|
||||
COMMAND touch -a cs_proto.pb.cc
|
||||
COMMAND touch -a cs_msgid.pb.h
|
||||
COMMAND touch -a cs_msgid.pb.cc
|
||||
COMMAND touch -a ss_proto.pb.h
|
||||
COMMAND touch -a ss_proto.pb.cc
|
||||
COMMAND touch -a ss_msgid.pb.h
|
||||
COMMAND touch -a ss_msgid.pb.cc
|
||||
COMMAND touch -a metatable.pb.h
|
||||
COMMAND touch -a metatable.pb.cc
|
||||
)
|
||||
aux_source_directory(.
|
||||
SRC_LIST
|
||||
)
|
||||
|
@ -40,10 +40,10 @@ void Bullet::Update(int delta_time)
|
||||
std::set<Entity*> objects;
|
||||
for (auto& grid : grid_list) {
|
||||
for (Human* hum: grid->human_list) {
|
||||
#if 1
|
||||
#if 0
|
||||
if (hum != player && !hum->dead) {
|
||||
#else
|
||||
if (hum != player &&
|
||||
if (hum != player && !hum->dead &&
|
||||
(hum->team_id == 0 || player->team_id != hum->team_id)) {
|
||||
#endif
|
||||
if (TestCollision(hum)) {
|
||||
@ -112,7 +112,8 @@ void Bullet::OnHit(std::set<Entity*>& objects)
|
||||
#if 1
|
||||
if (!hum->dead) {
|
||||
#else
|
||||
if (!hum->dead && (hum->team_id == 0 || hum->team_id != player->team_id)) {
|
||||
if (hum != player && !hum->dead &&
|
||||
(hum->team_id == 0 || player->team_id != hum->team_id)) {
|
||||
#endif
|
||||
float dmg = gun_meta->i->atk() * (1 + player->buff.damage_add);
|
||||
float def = hum->def + hum->buff.def_add;
|
||||
|
@ -1671,7 +1671,9 @@ void Human::SendUIUpdate()
|
||||
void Human::SendWxVoip()
|
||||
{
|
||||
cs::SMWxVoip notifymsg;
|
||||
notifymsg.set_group_id(a8::XValue(room->room_uuid).GetString());
|
||||
if (!team_uuid.empty()) {
|
||||
notifymsg.set_group_id(a8::XValue(room->room_uuid).GetString() + team_uuid);
|
||||
}
|
||||
SendNotifyMsg(notifymsg);
|
||||
}
|
||||
|
||||
|
@ -785,6 +785,7 @@ void Room::UpdateGas()
|
||||
gas_data.gas_mode = GasJump;
|
||||
gas_data.gas_start_frameno = frame_no;
|
||||
ShuaPlane();
|
||||
NotifyWxVoip();
|
||||
RoomMgr::Instance()->ActiveRoom(room_uuid);
|
||||
int auto_jump_interval = MetaMgr::Instance()->GetSysParamAsInt("auto_jump_interval");
|
||||
auto_jump_timer_ = xtimer.AddRepeatTimerAndAttach(SERVER_FRAME_RATE * auto_jump_interval,
|
||||
@ -849,7 +850,6 @@ void Room::UpdateGas()
|
||||
battle_start_frameno_ = frame_no;
|
||||
xtimer.DeleteTimer(auto_jump_timer_);
|
||||
auto_jump_timer_ = nullptr;
|
||||
NotifyWxVoip();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
14
server/tools/scripts/ci/gameserver/boundle.sh
Normal file
14
server/tools/scripts/ci/gameserver/boundle.sh
Normal file
@ -0,0 +1,14 @@
|
||||
cd third_party/game2001/server/gameserver
|
||||
#python ../tools/scripts/construct/build_pb.py --nohooks 1
|
||||
cmake $1 .
|
||||
make clean
|
||||
make
|
||||
cp ../bin/gameserver ../../../../bin/
|
||||
|
||||
cd ../../../../
|
||||
|
||||
tag_name=`git status |grep '# On branch '|sed 's/# On branch //g'`
|
||||
dir_name=`basename $PWD`
|
||||
package_name=${dir_name}.tar.gz
|
||||
|
||||
tar --exclude=*.git -chzf target/${package_name} bin reload.sh restart.sh start_instance.sh manage.py config res
|
75
server/tools/scripts/ci/gameserver/manage.py
Executable file
75
server/tools/scripts/ci/gameserver/manage.py
Executable file
@ -0,0 +1,75 @@
|
||||
#!/usr/bin/python
|
||||
#coding utf8
|
||||
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
def getRuningProgramPids(progname):
|
||||
pids = []
|
||||
lines = os.popen('ps -ef | grep %s' % progname).readlines()
|
||||
for l in lines:
|
||||
line = ''
|
||||
oldc = ''
|
||||
for c in l.strip():
|
||||
if c in [' ', '\t'] and c == oldc:
|
||||
continue
|
||||
oldc = c
|
||||
line += c
|
||||
line = line.split(' ')
|
||||
|
||||
if line[7] == './%s' % progname:
|
||||
pids.append(line[1])
|
||||
return pids
|
||||
|
||||
def getExePath(pid):
|
||||
return os.popen('ls -l /proc/%d | grep "exe ->" | cut -d " " -f 7-' % int(pid)).read()
|
||||
|
||||
def getExeCmdLine(pid):
|
||||
return os.popen('cat /proc/%d/cmdline' % int(pid)).read()
|
||||
|
||||
def stop(instance_id, node_id):
|
||||
gameserver_ids = getRuningProgramPids('gameserver')
|
||||
pids = gameserver_ids
|
||||
for pid in pids:
|
||||
exepath = getExePath(pid)
|
||||
cmdline = getExeCmdLine(pid)
|
||||
if cmdline == ("./gameserver\0-i\0%d\0-i\0%d\0" % (instance_id, node_id)):
|
||||
os.popen('kill -9 %d' % int(pid))
|
||||
|
||||
def listServer():
|
||||
gameserver_ids = getRuningProgramPids('gameserver')
|
||||
pids = gameserver_ids
|
||||
for pid in pids:
|
||||
exepath = getExePath(pid)
|
||||
cmdline = getExeCmdLine(pid)
|
||||
print(pid, exepath, cmdline)
|
||||
|
||||
def restartServer(str_instance_ids, str_node_id):
|
||||
instance_ids = str_instance_ids.split(',')
|
||||
node_id = int(str_node_id)
|
||||
for instance_id in instance_ids:
|
||||
instance_id = int(instance_id)
|
||||
stop(instance_id, node_id)
|
||||
time.sleep(0.5)
|
||||
print('gameserver %d starting......' % instance_id)
|
||||
cmd = 'sh start_instance.sh %d %d' % (instance_id, node_id)
|
||||
os.popen(cmd)
|
||||
time.sleep(0.5)
|
||||
|
||||
def printHelp():
|
||||
print('usuage: [restart]')
|
||||
|
||||
def main(argv):
|
||||
if len(argv) == 1:
|
||||
printHelp()
|
||||
else:
|
||||
if argv[1] == 'restart':
|
||||
restartServer(argv[2], argv[3])
|
||||
elif argv[1] == 'stop':
|
||||
stop(argv[2], argv[3])
|
||||
elif argv[1] == 'list':
|
||||
listServer()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv)
|
0
server/tools/scripts/ci/gameserver/reload.sh
Normal file
0
server/tools/scripts/ci/gameserver/reload.sh
Normal file
5
server/tools/scripts/ci/gameserver/restart.sh
Executable file
5
server/tools/scripts/ci/gameserver/restart.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
python manage.py restart $1 $2
|
||||
|
||||
echo 'success'
|
4
server/tools/scripts/ci/gameserver/start_instance.sh
Executable file
4
server/tools/scripts/ci/gameserver/start_instance.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd bin
|
||||
nohup ./gameserver -i $1 -n $2>> gameserver$2_$1.out 2>&1 &
|
14
server/tools/scripts/ci/masterserer/boundle.sh
Normal file
14
server/tools/scripts/ci/masterserer/boundle.sh
Normal file
@ -0,0 +1,14 @@
|
||||
cd third_party/game2001/server/masterserver
|
||||
#python ../tools/scripts/construct/build_pb.py --nohooks 1
|
||||
cmake -DGAME_ID=2001 .
|
||||
make clean
|
||||
make
|
||||
cp ../bin/masterserver ../../../../bin/
|
||||
|
||||
cd ../../../../
|
||||
|
||||
tag_name=`git status |grep '# On branch '|sed 's/# On branch //g'`
|
||||
dir_name=`basename $PWD`
|
||||
package_name=${dir_name}.tar.gz
|
||||
|
||||
tar --exclude=*.git -chzf target/${package_name} bin reload.sh restart.sh start_instance.sh manage.py config
|
75
server/tools/scripts/ci/masterserer/manage.py
Executable file
75
server/tools/scripts/ci/masterserer/manage.py
Executable file
@ -0,0 +1,75 @@
|
||||
#!/usr/bin/python
|
||||
#coding utf8
|
||||
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
def getRuningProgramPids(progname):
|
||||
pids = []
|
||||
lines = os.popen('ps -ef | grep %s' % progname).readlines()
|
||||
for l in lines:
|
||||
line = ''
|
||||
oldc = ''
|
||||
for c in l.strip():
|
||||
if c in [' ', '\t'] and c == oldc:
|
||||
continue
|
||||
oldc = c
|
||||
line += c
|
||||
line = line.split(' ')
|
||||
|
||||
if line[7] == './%s' % progname:
|
||||
pids.append(line[1])
|
||||
return pids
|
||||
|
||||
def getExePath(pid):
|
||||
return os.popen('ls -l /proc/%d | grep "exe ->" | cut -d " " -f 7-' % int(pid)).read()
|
||||
|
||||
def getExeCmdLine(pid):
|
||||
return os.popen('cat /proc/%d/cmdline' % int(pid)).read()
|
||||
|
||||
def stop(instance_id, node_id):
|
||||
masterserver_ids = getRuningProgramPids('masterserver')
|
||||
pids = masterserver_ids
|
||||
for pid in pids:
|
||||
exepath = getExePath(pid)
|
||||
cmdline = getExeCmdLine(pid)
|
||||
if cmdline == ("./masterserver\0-i\0%d\0-i\0%d\0" % (instance_id, node_id)):
|
||||
os.popen('kill -9 %d' % int(pid))
|
||||
|
||||
def listServer():
|
||||
masterserver_ids = getRuningProgramPids('masterserver')
|
||||
pids = masterserver_ids
|
||||
for pid in pids:
|
||||
exepath = getExePath(pid)
|
||||
cmdline = getExeCmdLine(pid)
|
||||
print(pid, exepath, cmdline)
|
||||
|
||||
def restartServer(str_instance_ids, str_node_id):
|
||||
instance_ids = str_instance_ids.split(',')
|
||||
node_id = int(str_node_id)
|
||||
for instance_id in instance_ids:
|
||||
instance_id = int(instance_id)
|
||||
stop(instance_id, node_id)
|
||||
time.sleep(0.5)
|
||||
print('masterserver %d starting......' % instance_id)
|
||||
cmd = 'sh start_instance.sh %d %d' % (instance_id, node_id)
|
||||
os.popen(cmd)
|
||||
time.sleep(0.5)
|
||||
|
||||
def printHelp():
|
||||
print('usuage: [restart]')
|
||||
|
||||
def main(argv):
|
||||
if len(argv) == 1:
|
||||
printHelp()
|
||||
else:
|
||||
if argv[1] == 'restart':
|
||||
restartServer(argv[2], argv[3])
|
||||
elif argv[1] == 'stop':
|
||||
stop(argv[2], argv[3])
|
||||
elif argv[1] == 'list':
|
||||
listServer()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main(sys.argv)
|
0
server/tools/scripts/ci/masterserer/reload.sh
Normal file
0
server/tools/scripts/ci/masterserer/reload.sh
Normal file
5
server/tools/scripts/ci/masterserer/restart.sh
Executable file
5
server/tools/scripts/ci/masterserer/restart.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/bin/bash
|
||||
|
||||
python manage.py restart $1 $2
|
||||
|
||||
echo 'success'
|
4
server/tools/scripts/ci/masterserer/start_instance.sh
Executable file
4
server/tools/scripts/ci/masterserer/start_instance.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
cd bin
|
||||
nohup ./masterserver -i $1 -n $2>> masterserver$2_$1.out 2>&1 &
|
Loading…
x
Reference in New Issue
Block a user