merge master
This commit is contained in:
commit
b5d015110f
16
server/bin/restart.sh
Executable file
16
server/bin/restart.sh
Executable file
@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
source /etc/profile
|
||||
source /root/.bash_profile
|
||||
|
||||
pid=$(ps -ef|grep "gameserver2004 -n $2 -i $1"|grep -v grep|awk '{print $2}')
|
||||
echo $pid
|
||||
|
||||
if [[ $pid != "" ]]
|
||||
then
|
||||
echo $pid|xargs kill -9
|
||||
else
|
||||
echo "pid 为空"
|
||||
fi
|
||||
|
||||
nohup ./gameserver2004 -n $2 -i $1 >> gameserver2004$2_$1.out &
|
@ -145,11 +145,12 @@ bool App::Init(int argc, char* argv[])
|
||||
PlayerMgr::Instance()->Init();
|
||||
GGListener::Instance()->Init();
|
||||
|
||||
a8::UdpLog::Instance()->Info("gameserver starting instance_id:%d pid:%d debug_mode:%d",
|
||||
a8::UdpLog::Instance()->Info("gameserver starting instance_id:%d pid:%d debug_mode:%d channel:%d",
|
||||
{
|
||||
instance_id,
|
||||
getpid(),
|
||||
debug_mode
|
||||
debug_mode,
|
||||
JsonDataMgr::Instance()->channel
|
||||
});
|
||||
{
|
||||
int perf_log_time = 1000 * 30;
|
||||
|
@ -324,7 +324,8 @@ enum ColliderTag_e
|
||||
|
||||
enum GameChannel_e
|
||||
{
|
||||
kWxChannelId = 6001
|
||||
kWxChannelId = 6001,
|
||||
kTouTiaoChannelId = 6006
|
||||
};
|
||||
|
||||
const char* const PROJ_NAME_FMT = "game%d_gameserver";
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "buff.h"
|
||||
#include "roomobstacle.h"
|
||||
#include "aicomponent.h"
|
||||
#include "jsondatamgr.h"
|
||||
|
||||
#include "framework/cpp/utils.h"
|
||||
#include "framework/cpp/httpclientpool.h"
|
||||
@ -2436,6 +2437,20 @@ void Human::GenZbModeBattleReportData(a8::MutableXObject* params)
|
||||
|
||||
void Human::DeadDrop()
|
||||
{
|
||||
auto SkinCanDrop =
|
||||
[this] (Skin* skin) -> bool
|
||||
{
|
||||
#ifdef DEBUG
|
||||
return false;
|
||||
#else
|
||||
if (JsonDataMgr::Instance()->channel == kTouTiaoChannelId) {
|
||||
return false;
|
||||
} else {
|
||||
return skin->skin_id != 0;
|
||||
}
|
||||
#endif
|
||||
};
|
||||
|
||||
if (GetRace() == kHumanRace && !HasBuffEffect(kBET_Terminator)) {
|
||||
for (auto& weapon : weapons) {
|
||||
if (weapon.weapon_id != 0 && weapon.weapon_id != default_weapon.weapon_id) {
|
||||
@ -2449,7 +2464,7 @@ void Human::DeadDrop()
|
||||
}
|
||||
{
|
||||
Skin* old_skin = GetSkinByIdx(kSkinSlot_HAT);
|
||||
if (old_skin && old_skin->skin_id != 0) {
|
||||
if (old_skin && old_skin->skin_id != 0 && SkinCanDrop(old_skin)) {
|
||||
a8::Vec2 dir = a8::Vec2::UP;
|
||||
dir.Rotate(a8::RandAngle());
|
||||
room->CreateLoot(old_skin->skin_id, GetPos() + dir * (40 + rand() % 50), 1, 1);
|
||||
@ -2458,7 +2473,7 @@ void Human::DeadDrop()
|
||||
}
|
||||
{
|
||||
Skin* old_skin = GetSkinByIdx(kSkinSlot_CLOTH);
|
||||
if (old_skin && old_skin->skin_id != 0) {
|
||||
if (old_skin && old_skin->skin_id != 0 && SkinCanDrop(old_skin)) {
|
||||
a8::Vec2 dir = a8::Vec2::UP;
|
||||
dir.Rotate(a8::RandAngle());
|
||||
room->CreateLoot(old_skin->skin_id, GetPos() + dir * (40 + rand() % 50), 1, 1);
|
||||
@ -2514,10 +2529,24 @@ void Human::SendBattleReport()
|
||||
if (App::Instance()->HasFlag(3)) {
|
||||
url = "http://192.168.100.41/webapp/index.php?c=Role&a=battleReport";
|
||||
} else {
|
||||
url = "https://game2004api-test.kingsome.cn/webapp/index.php?c=Role&a=battleReport";
|
||||
if (JsonDataMgr::Instance()->channel != 0) {
|
||||
url = a8::Format("http://game2004api-test.kingsome.cn/%d/webapp/index.php?c=Role&a=battleReport",
|
||||
{
|
||||
JsonDataMgr::Instance()->channel
|
||||
});
|
||||
} else {
|
||||
url = "https://game2004api-test.kingsome.cn/webapp/index.php?c=Role&a=battleReport";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
url = "http://game2004api.kingsome.cn/webapp/index.php?c=Role&a=battleReport";
|
||||
if (JsonDataMgr::Instance()->channel != 0) {
|
||||
url = a8::Format("http://game2004api.kingsome.cn/%d/webapp/index.php?c=Role&a=battleReport",
|
||||
{
|
||||
JsonDataMgr::Instance()->channel
|
||||
});
|
||||
} else {
|
||||
url = "http://game2004api.kingsome.cn/webapp/index.php?c=Role&a=battleReport";
|
||||
}
|
||||
}
|
||||
std::string data;
|
||||
params->ToUrlEncodeStr(data);
|
||||
|
@ -45,6 +45,7 @@ class Human : public MoveableEntity
|
||||
bool auto_fill = false;
|
||||
int today_enter_times = 0;
|
||||
int account_registertime = 0;
|
||||
int channel = 0;
|
||||
MetaData::Player* meta = nullptr;
|
||||
MetaData::Equip* helmet_meta = nullptr;
|
||||
MetaData::Equip* chest_meta = nullptr;
|
||||
|
@ -34,6 +34,9 @@ void JsonDataMgr::Init()
|
||||
gameserver_cluster_json_.ReadFromFile(gameserver_cluster_json_file);
|
||||
ip = GetConf()->At("ip")->AsXValue().GetString();
|
||||
listen_port = GetConf()->At("listen_port")->AsXValue();
|
||||
if (GetConf()->HasKey("channel")) {
|
||||
channel = GetConf()->At("channel")->AsXValue();
|
||||
}
|
||||
server_info = a8::Format("%s:%d", {ip, listen_port});
|
||||
Reload();
|
||||
}
|
||||
@ -44,10 +47,13 @@ void JsonDataMgr::UnInit()
|
||||
|
||||
std::shared_ptr<a8::XObject> JsonDataMgr::GetConf()
|
||||
{
|
||||
if (App::Instance()->instance_id < 1 || App::Instance()->instance_id > gameserver_cluster_json_.Size()) {
|
||||
abort();
|
||||
for (int i = 0; i < gameserver_cluster_json_.Size(); ++i) {
|
||||
std::shared_ptr<a8::XObject> conf = gameserver_cluster_json_.At(i);
|
||||
if (conf->At("instance_id")->AsXValue().GetInt() == App::Instance()->instance_id) {
|
||||
return conf;
|
||||
}
|
||||
}
|
||||
return gameserver_cluster_json_[App::Instance()->instance_id - 1];
|
||||
abort();
|
||||
}
|
||||
|
||||
std::shared_ptr<a8::XObject> JsonDataMgr::GetMasterServerClusterConf()
|
||||
|
@ -15,7 +15,7 @@ public:
|
||||
|
||||
std::string ip;
|
||||
int listen_port = 0;
|
||||
|
||||
int channel = 0;
|
||||
std::string server_info;
|
||||
|
||||
void Reload();
|
||||
|
@ -104,8 +104,8 @@ namespace MetaData
|
||||
}
|
||||
{
|
||||
std::vector<std::string> strings;
|
||||
if (!i->spera_type().empty()) {
|
||||
a8::Split(i->spera_type(), strings, '|');
|
||||
if (!i->spera_attr().empty()) {
|
||||
a8::Split(i->spera_attr(), strings, '|');
|
||||
} else {
|
||||
a8::Split(i->attr_type(), strings, '|');
|
||||
}
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "metamgr.h"
|
||||
#include "app.h"
|
||||
#include "jsondatamgr.h"
|
||||
|
||||
#define METAMGR_READ(field_name, def_val) MetaMgr::Instance()->field_name = \
|
||||
a8::XValue(MetaMgr::Instance()->GetSysParamAsString(#field_name, #def_val));
|
||||
@ -94,18 +95,20 @@ public:
|
||||
{
|
||||
if (!f8::IsOnlineEnv()) {
|
||||
if (f8::IsTestEnv()) {
|
||||
res_path = a8::Format("/root/pub/%d/%d/conf_test/game%d/gameserver.test/res/",
|
||||
res_path = a8::Format("/root/pub/%d/%d/conf_test/game%d/gameserver.test/res%d/",
|
||||
{
|
||||
GAME_ID,
|
||||
App::Instance()->instance_id,
|
||||
GAME_ID
|
||||
GAME_ID,
|
||||
App::Instance()->instance_id
|
||||
});
|
||||
} else {
|
||||
res_path = a8::Format("/root/pub/%d/%d/conf_test/game%d/gameserver.dev/res/",
|
||||
res_path = a8::Format("/root/pub/%d/%d/conf_test/game%d/gameserver.dev/res%d/",
|
||||
{
|
||||
GAME_ID,
|
||||
App::Instance()->instance_id,
|
||||
GAME_ID
|
||||
GAME_ID,
|
||||
App::Instance()->instance_id
|
||||
});
|
||||
}
|
||||
} else {
|
||||
|
@ -284,6 +284,14 @@ void Player::UpdateUseItemId()
|
||||
MetaData::Equip* item_meta = MetaMgr::Instance()->GetEquip(use_item_id);
|
||||
if (item_meta && item_meta->i->equip_type() == EQUIP_TYPE_CAMOUFLAGE) {
|
||||
int item_num = GetItemNum(use_item_id);
|
||||
if (JsonDataMgr::Instance()->channel == kTouTiaoChannelId) {
|
||||
item_num = 1;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (channel == kTouTiaoChannelId) {
|
||||
item_num = 1;
|
||||
}
|
||||
#endif
|
||||
if (item_num > 0) {
|
||||
MetaData::Buff* buff_meta = MetaMgr::Instance()->GetBuff(item_meta->i->buffid());
|
||||
if (buff_meta && !GetBuffById(item_meta->i->buffid())) {
|
||||
|
@ -63,6 +63,7 @@ Player* PlayerMgr::CreatePlayerByCMJoin(Player* hum,
|
||||
hum->today_enter_times = msg.today_enter_times();
|
||||
hum->create_tick = a8::XGetTickCount();
|
||||
hum->account_registertime = f8::ExtractRegisterTimeFromSessionId(msg.session_id());
|
||||
hum->channel = f8::ExtractChannelIdFromAccountId(msg.account_id());
|
||||
hum->atk_add = msg.atk_add();
|
||||
hum->emoji1 = msg.emoji1();
|
||||
hum->emoji2 = msg.emoji2();
|
||||
|
@ -2731,7 +2731,8 @@ void Room::AddPlayerPostProc(Player* hum)
|
||||
{
|
||||
Human* hum = (Human*)param.sender.GetUserData();
|
||||
std::string debugmsg = a8::Format("weapon_id:%d weapon_lv:%d atk:%f fire_rate:%f "
|
||||
"volume:%d maxhp:%f curr_hp:%f",
|
||||
"volume:%d maxhp:%f hp:%f curr_hp:%f curr_max_hp:%f "
|
||||
"base_reload_time:%f grow_reload_time:%f finaly_reload_time:%f",
|
||||
{
|
||||
hum->curr_weapon->weapon_id,
|
||||
hum->curr_weapon->weapon_lv,
|
||||
@ -2739,7 +2740,14 @@ void Room::AddPlayerPostProc(Player* hum)
|
||||
hum->curr_weapon->GetAttrValue(kHAT_FireRate),
|
||||
hum->curr_weapon->GetAttrValue(kHAT_Volume),
|
||||
hum->curr_weapon->GetAttrValue(kHAT_MaxHp),
|
||||
hum->GetHP()
|
||||
hum->curr_weapon->GetAttrValue(kHAT_Hp),
|
||||
hum->GetHP(),
|
||||
hum->GetMaxHP(),
|
||||
hum->curr_weapon->meta->i->reload_time(),
|
||||
hum->curr_weapon->GetUpgradeMeta() ?
|
||||
hum->curr_weapon->GetUpgradeMeta()->GetAttrValue
|
||||
(hum->curr_weapon->weapon_lv, kHAT_ReloadTime) : 0,
|
||||
hum->curr_weapon->GetAttrValue(kHAT_ReloadTime)
|
||||
});
|
||||
hum->SendDebugMsg(debugmsg);
|
||||
},
|
||||
|
@ -166,6 +166,15 @@ void RoomMgr::_CMJoin(f8::MsgHdr& hdr, const cs::CMJoin& msg)
|
||||
hum->ProcPrepareItems2(msg.prepare_items2());
|
||||
room->AddPlayer(hum);
|
||||
PlayerMgr::Instance()->IncAccountNum(msg.account_id());
|
||||
if (JsonDataMgr::Instance()->channel != 0 &&
|
||||
JsonDataMgr::Instance()->channel != channel) {
|
||||
a8::UdpLog::Instance()->Warning
|
||||
("join room channel not match channel:%d account_id:%s",
|
||||
{
|
||||
JsonDataMgr::Instance()->channel,
|
||||
msg.account_id()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void RoomMgr::_CMReconnect(f8::MsgHdr& hdr, const cs::CMReconnect& msg)
|
||||
@ -376,6 +385,7 @@ void RoomMgr::ReportServerState(int instance_id, const std::string& host, int po
|
||||
url_params->SetVal("port", JsonDataMgr::Instance()->listen_port);
|
||||
url_params->SetVal("online_num", PlayerMgr::Instance()->OnlineNum());
|
||||
url_params->SetVal("room_num", RoomNum());
|
||||
url_params->SetVal("channel", JsonDataMgr::Instance()->channel);
|
||||
url_params->SetVal("alive_count", PerfMonitor::Instance()->real_alive_count);
|
||||
url_params->SetVal("servicing", App::Instance()->servicing ? 1 : 0);
|
||||
f8::HttpClientPool::Instance()->HttpGet(a8::XParams()
|
||||
|
@ -104,7 +104,7 @@ message EquipUpgrade
|
||||
{
|
||||
optional int32 id = 1;
|
||||
optional string attr_type = 4;
|
||||
optional string spera_type = 5;
|
||||
optional string spera_attr = 5;
|
||||
}
|
||||
|
||||
message Player
|
||||
|
2
third_party/framework
vendored
2
third_party/framework
vendored
@ -1 +1 @@
|
||||
Subproject commit 203adbe1f4d7cf2f9d57e8bf8b80102c5fdd47a1
|
||||
Subproject commit ea69b96451e7004430e99b86db1cfd3ae4d76c6b
|
Loading…
x
Reference in New Issue
Block a user