Compare commits

..

16 Commits

Author SHA1 Message Date
aozhiwei
f37aed628b 1 2024-08-24 07:43:18 +08:00
aozhiwei
35e54cc45b 修复龙炮台问题 2024-08-24 07:30:50 +08:00
aozhiwei
d7f09c299f 1 2024-08-23 21:43:17 +08:00
aozhiwei
c3aff41128 1 2024-08-23 17:16:13 +08:00
aozhiwei
0be164988a 1 2024-08-23 17:07:53 +08:00
aozhiwei
c02c4542c4 1 2024-08-23 16:40:40 +08:00
aozhiwei
17166c21d3 1 2024-08-23 15:28:34 +08:00
aozhiwei
bfde769e98 1 2024-08-23 14:52:03 +08:00
aozhiwei
c7840d9071 1 2024-08-23 14:42:42 +08:00
aozhiwei
b366492f0e 1 2024-08-23 14:42:02 +08:00
aozhiwei
e301be3dc1 1 2024-07-27 15:29:36 +08:00
aozhiwei
0e2ac2bb59 1 2024-06-01 18:26:10 +08:00
aozhiwei
7c3edc1074 1 2024-06-01 17:56:50 +08:00
aozhiwei
3e424d81aa 1 2024-06-01 17:45:01 +08:00
aozhiwei
72abfd9f94 1 2024-06-01 17:35:47 +08:00
aozhiwei
aa5e6661fc 1 2024-06-01 17:23:29 +08:00
18 changed files with 85 additions and 65 deletions

3
.gitmodules vendored
View File

@ -13,6 +13,3 @@
[submodule "third_party/f8"] [submodule "third_party/f8"]
path = third_party/f8 path = third_party/f8
url = git@git.kingsome.cn:server_common/f8.git url = git@git.kingsome.cn:server_common/f8.git
[submodule "third_party/recastnavigation_v1.6.0"]
path = third_party/recastnavigation_v1.6.0
url = git@git.kingsome.cn:server_common/recastnavigation_v1.6.0.git

View File

@ -15,14 +15,3 @@ SMUiUpdate
https://www.cnblogs.com/fellow1988/p/17263427.html https://www.cnblogs.com/fellow1988/p/17263427.html
export ASAN_OPTIONS=halt_on_error=false:print_scariness=true:fast_unwind_on_malloc=true:detect_leak=1 export ASAN_OPTIONS=halt_on_error=false:print_scariness=true:fast_unwind_on_malloc=true:detect_leak=1
if (owner_->IsPlayer()) {
start.x = 302.209595;
start.y = 6.18993711;
start.z = 49.6232567;
end.x = 308.426758;
end.y = 6.18993711;
end.z = 44.5886955;
}

View File

@ -31,9 +31,9 @@ include_directories(
/usr/include/glm /usr/include/glm
../../third_party ../../third_party
../../third_party/behaviac/inc ../../third_party/behaviac/inc
../../third_party/recastnavigation_v1.6.0/Recast/Include ../../third_party/recastnavigation/Recast/Include
../../third_party/recastnavigation_v1.6.0/Detour/Include ../../third_party/recastnavigation/Detour/Include
../../third_party/recastnavigation_v1.6.0/DetourTileCache/Include ../../third_party/recastnavigation/DetourTileCache/Include
behaviac_generated/types behaviac_generated/types
behaviac_generated/types/internal behaviac_generated/types/internal
. .
@ -53,15 +53,15 @@ aux_source_directory(../../third_party/f8/f8
SRC_LIST SRC_LIST
) )
aux_source_directory(../../third_party/recastnavigation_v1.6.0/Recast/Source aux_source_directory(../../third_party/recastnavigation/Recast/Source
SRC_LIST SRC_LIST
) )
aux_source_directory(../../third_party/recastnavigation_v1.6.0/Detour/Source aux_source_directory(../../third_party/recastnavigation/Detour/Source
SRC_LIST SRC_LIST
) )
aux_source_directory(../../third_party/recastnavigation_v1.6.0/DetourTileCache/Source aux_source_directory(../../third_party/recastnavigation/DetourTileCache/Source
SRC_LIST SRC_LIST
) )

View File

@ -73,6 +73,11 @@ public:
} }
} }
virtual void OnConnect() override
{
f8::UdpLog::Instance()->Warning("OnConnect socket_handle:%d", {socket_handle});
}
virtual void OnRawHttpGet(const std::string& url, const std::string& querystr, virtual void OnRawHttpGet(const std::string& url, const std::string& querystr,
std::string& response) override std::string& response) override
{ {
@ -91,6 +96,7 @@ public:
virtual void OnDisConnect() override virtual void OnDisConnect() override
{ {
f8::UdpLog::Instance()->Warning("OnDisConnect socket_handle:%d", {socket_handle});
f8::MsgQueue::Instance()->PostMsg f8::MsgQueue::Instance()->PostMsg
(IM_ClientSocketDisconnect, (IM_ClientSocketDisconnect,
a8::Args a8::Args
@ -241,7 +247,7 @@ void GGListener::RemoveSocketDisconnectHandler(std::weak_ptr<SocketDisconnectHan
p->cb = nullptr; p->cb = nullptr;
p->holder = nullptr; p->holder = nullptr;
#if 1 #if 1
f8::UdpLog::Instance()->Warning("RemoveSocketDisconnectHandler socket_handle%d time:%d", f8::UdpLog::Instance()->Warning("RemoveSocketDisconnectHandler socket_handle:%d time:%d",
{ {
p->socket_handle, p->socket_handle,
a8::XGetTickCount() - p->add_tick a8::XGetTickCount() - p->add_tick
@ -253,5 +259,17 @@ void GGListener::RemoveSocketDisconnectHandler(std::weak_ptr<SocketDisconnectHan
void GGListener::OnClientDisconnect(int socket_handle) void GGListener::OnClientDisconnect(int socket_handle)
{ {
auto itr = disconnect_listener_hash_.find(socket_handle);
if (itr != disconnect_listener_hash_.end()) {
std::vector<std::weak_ptr<SocketDisconnectHandler>> del_handlers;
SocketDisconnectHandler *handle = nullptr, *tmp = nullptr;
list_for_each_entry_safe(handle, tmp, &itr->second, entry) {
del_handlers.push_back(handle->holder);
handle->cb(a8::Args({itr->first}));
}
for (auto handler : del_handlers) {
RemoveSocketDisconnectHandler(handler);
}
}
PlayerMgr::Instance()->OnClientDisconnect(socket_handle); PlayerMgr::Instance()->OnClientDisconnect(socket_handle);
} }

View File

@ -16,10 +16,13 @@
#include "jsondatamgr.h" #include "jsondatamgr.h"
#include "player.h" #include "player.h"
#include "mapinstance.h" #include "mapinstance.h"
#include "human.h"
#include "stats.h"
#include "mt/MapMode.h" #include "mt/MapMode.h"
#include "mt/Hero.h" #include "mt/Hero.h"
#include "mt/MapThing.h" #include "mt/MapThing.h"
#include "mt/Param.h"
const int BOX_ID = 150001; const int BOX_ID = 150001;
@ -53,6 +56,39 @@ void BoxDrop::OnObstacleDeadDrop(Obstacle* ob)
} }
} }
void BoxDrop::OnHumanDeadDrop(Human* hum)
{
if (hum->box_num <= 0) {
return;
}
if (room_->IsGameOver()) {
return;
}
if (room_->GetVictoryTeam()) {
return;
}
int drop_num = 0;
for (int i = 0; i < hum->box_num; ++i) {
int rnd = a8::RandEx(0, 100);
if (hum->stats->abandon_battle) {
if (rnd <= (mt::Param::s().battle_event_end_loss_rate_quit * 100)) {
++drop_num;
}
} else {
if (rnd <= (mt::Param::s().battle_event_end_loss_rate_dead * 100)) {
++drop_num;
}
}
}
drop_num = std::min(drop_num, hum->box_num);
if (drop_num > 0) {
Drop(drop_num, hum->GetPos().ToGlmVec3());
hum->box_num -= drop_num;
room_->frame_event.AddPropChgEx(hum->GetWeakPtrRef(), kPropBoxNum, 0, hum->box_num,
0, 0, false);
}
}
void BoxDrop::Drop(int num, const glm::vec3& center) void BoxDrop::Drop(int num, const glm::vec3& center)
{ {
for (int i = 0; i < num; ++i) { for (int i = 0; i < num; ++i) {

View File

@ -3,6 +3,7 @@
class Room; class Room;
class Hero; class Hero;
class Obstacle; class Obstacle;
class Human;
class BoxDrop : public std::enable_shared_from_this<BoxDrop> class BoxDrop : public std::enable_shared_from_this<BoxDrop>
{ {
@ -14,6 +15,7 @@ class BoxDrop : public std::enable_shared_from_this<BoxDrop>
void OnBattleStart(); void OnBattleStart();
void OnHeroDeadDrop(Hero* hero); void OnHeroDeadDrop(Hero* hero);
void OnObstacleDeadDrop(Obstacle* ob); void OnObstacleDeadDrop(Obstacle* ob);
void OnHumanDeadDrop(Human* hum);
void RequestReturnBoxNum(); void RequestReturnBoxNum();
bool GetNextBoxPos(glm::vec3& pos); bool GetNextBoxPos(glm::vec3& pos);
void DropByUuid(int obj_uniid, const glm::vec3& center); void DropByUuid(int obj_uniid, const glm::vec3& center);

View File

@ -998,9 +998,6 @@ void CallFuncBuff::ClearSummonHero()
{ {
int hero_id = meta->_int_buff_param2; int hero_id = meta->_int_buff_param2;
float hero_num = meta->GetBuffParam3(this); float hero_num = meta->GetBuffParam3(this);
if (hero_id == 9011) {
a8::XPrintf("ClearSummonHero 9011\n", {});
}
owner->RemoveSurplusHero(hero_id, hero_num); owner->RemoveSurplusHero(hero_id, hero_num);
} }

View File

@ -32,10 +32,6 @@
#include "mt/Map.h" #include "mt/Map.h"
#include "mt/MobaRoom.h" #include "mt/MobaRoom.h"
#define BOOST_STACKTRACE_USE_ADDR2LINE
#include <boost/stacktrace.hpp>
#include <iostream>
Hero::Hero():Creature() Hero::Hero():Creature()
{ {
++PerfMonitor::Instance()->entity_num[ET_Hero]; ++PerfMonitor::Instance()->entity_num[ET_Hero];
@ -48,11 +44,6 @@ Hero::Hero():Creature()
Hero::~Hero() Hero::~Hero()
{ {
if (GetHeroMeta()->id() == 9011) {
a8::XPrintf("DestoryHero 9011\n", {});
std::cout << boost::stacktrace::stacktrace();
int i = 0;
}
SetDestorying(); SetDestorying();
DetachFromMaster(); DetachFromMaster();
if (agent_) { if (agent_) {

View File

@ -44,6 +44,7 @@
#include "hero.h" #include "hero.h"
#include "bornpoint.h" #include "bornpoint.h"
#include "ingamevoice.h" #include "ingamevoice.h"
#include "boxdrop.h"
#include "buff/sprint.h" #include "buff/sprint.h"
@ -3100,6 +3101,7 @@ void Human::InternalBeKill(int killer_id, const std::string& killer_name, int we
} }
#endif #endif
if (!dead && !room->IsGameOver() && !real_dead) { if (!dead && !room->IsGameOver() && !real_dead) {
room->GetBoxDrop()->OnHumanDeadDrop(this);
KillInfo info; KillInfo info;
{ {
info.killer_id = killer_id; info.killer_id = killer_id;

View File

@ -481,11 +481,7 @@ bool MapInstance::Raycast(const glm::vec3& start, const glm::vec3& end,
float t = 0; float t = 0;
int npolys; int npolys;
memset(hit_normal_, 0, sizeof(hit_normal_)); memset(hit_normal_, 0, sizeof(hit_normal_));
#if 1
status = navmesh_query_->newRaycast(666, startRef, spos, epos, &filter, &t, hit_normal_, polys_, &npolys, MAX_POLYS);
#else
status = navmesh_query_->raycast(startRef, spos, epos, &filter, &t, hit_normal_, polys_, &npolys, MAX_POLYS); status = navmesh_query_->raycast(startRef, spos, epos, &filter, &t, hit_normal_, polys_, &npolys, MAX_POLYS);
#endif
if (!dtStatusSucceed(status)) { if (!dtStatusSucceed(status)) {
#ifdef MYDEBUG #ifdef MYDEBUG
abort(); abort();
@ -777,11 +773,7 @@ bool MapInstance::RaycastEx(const glm::vec3& start, const glm::vec3& end,
float t = 0; float t = 0;
int npolys; int npolys;
memset(hit_normal_, 0, sizeof(hit_normal_)); memset(hit_normal_, 0, sizeof(hit_normal_));
#if 1
status = navmesh_query_->newRaycast(666, startRef, spos, epos, &filter, &t, hit_normal_, polys_, &npolys, MAX_POLYS);
#else
status = navmesh_query_->raycast(startRef, spos, epos, &filter, &t, hit_normal_, polys_, &npolys, MAX_POLYS); status = navmesh_query_->raycast(startRef, spos, epos, &filter, &t, hit_normal_, polys_, &npolys, MAX_POLYS);
#endif
if (!dtStatusSucceed(status)) { if (!dtStatusSucceed(status)) {
#ifdef MYDEBUG #ifdef MYDEBUG
abort(); abort();

View File

@ -124,17 +124,6 @@ void Movement::CalcTargetPos(float distance)
glm::vec3 hit_point; glm::vec3 hit_point;
owner_->room->map_instance->Scale(start); owner_->room->map_instance->Scale(start);
owner_->room->map_instance->Scale(end); owner_->room->map_instance->Scale(end);
#if 0
if (owner_->IsPlayer()) {
start.x = 302.209595;
start.y = 6.18993711;
start.z = 49.6232567;
end.x = 308.426758;
end.y = 6.18993711;
end.z = 44.5886955;
}
#endif
bool ret = owner_->room->map_instance->RaycastEx(start, end, hit_point, hit_result, bool ret = owner_->room->map_instance->RaycastEx(start, end, hit_point, hit_result,
point.same_polys_flags, point.spec_polys, exclude_flags); point.same_polys_flags, point.spec_polys, exclude_flags);
if (ret) { if (ret) {

View File

@ -110,9 +110,9 @@ namespace mt
} }
auto itr = _trigger_type_buffs.find(buff_meta->trigger_type()); auto itr = _trigger_type_buffs.find(buff_meta->trigger_type());
if (itr != _trigger_type_buffs.end()) { if (itr != _trigger_type_buffs.end()) {
itr->second.insert(buff_meta); itr->second.push_back(buff_meta);
} else { } else {
_trigger_type_buffs[buff_meta->trigger_type()] = std::set<const mt::Buff*>({buff_meta}); _trigger_type_buffs[buff_meta->trigger_type()] = std::vector<const mt::Buff*>({buff_meta});
} }
} }
} }

View File

@ -37,7 +37,7 @@ namespace mt
const mt::Skill* _base_skill_meta = nullptr; const mt::Skill* _base_skill_meta = nullptr;
float _value_up = 0.0f; float _value_up = 0.0f;
std::set<int> _buff_list; std::set<int> _buff_list;
std::map<int, std::set<const mt::Buff*>> _trigger_type_buffs; std::map<int, std::vector<const mt::Buff*>> _trigger_type_buffs;
std::vector<mt::SkillPhase> _phases; std::vector<mt::SkillPhase> _phases;
std::vector<mt::SkillPhase> _raw_phases; std::vector<mt::SkillPhase> _raw_phases;
bool IsTurnOverSkill() const; bool IsTurnOverSkill() const;

View File

@ -897,10 +897,6 @@ Hero* Room::CreateHero(Creature* master,
int team_id, int team_id,
int obj_uniid) int obj_uniid)
{ {
if (meta->id() == 9011) {
a8::XPrintf("CreateHero 9011\n", {});
int i = 0;
}
if (obj_uniid > 0) { if (obj_uniid > 0) {
if (GetEntityByUniId(obj_uniid)) { if (GetEntityByUniId(obj_uniid)) {
abort(); abort();

View File

@ -78,6 +78,13 @@ void RoomMgr::_CMJoin(f8::MsgHdr* hdr, const cs::CMJoin& msg)
{ {
#ifdef MYDEBUG #ifdef MYDEBUG
a8::XPrintf("CMJoin socket_handle:%d\n", {hdr->socket_handle}); a8::XPrintf("CMJoin socket_handle:%d\n", {hdr->socket_handle});
#endif
#if 1
f8::UdpLog::Instance()->Warning("CMJoin account_id:%s socket_handle:%d",
{
msg.account_id(),
hdr->socket_handle,
});
#endif #endif
if (IsLimitJoin()) { if (IsLimitJoin()) {
JoinErrorHandle(msg, 2, hdr->socket_handle); JoinErrorHandle(msg, 2, hdr->socket_handle);
@ -87,7 +94,7 @@ void RoomMgr::_CMJoin(f8::MsgHdr* hdr, const cs::CMJoin& msg)
auto member = GetCustomMemberBySocket(hdr->socket_handle); auto member = GetCustomMemberBySocket(hdr->socket_handle);
if (member) { if (member) {
#if 1 #if 1
f8::UdpLog::Instance()->Warning("JoinError socket_not_exits socket_handle%d", f8::UdpLog::Instance()->Warning("JoinError socket already exits socket_handle:%d",
{ {
hdr->socket_handle, hdr->socket_handle,
}); });

View File

@ -22,7 +22,7 @@
class EventHandler : public std::enable_shared_from_this<EventHandler> class EventHandler : public std::enable_shared_from_this<EventHandler>
{ {
public: public:
a8::CommonCbProc cb; std::shared_ptr<a8::CommonCbProc> cb;
list_head entry; list_head entry;
std::shared_ptr<EventHandler> holder; std::shared_ptr<EventHandler> holder;
@ -497,7 +497,8 @@ std::weak_ptr<EventHandler> Trigger::AddListener(int event_id, a8::CommonCbProc
INIT_LIST_HEAD(&itr->second); INIT_LIST_HEAD(&itr->second);
} }
auto p = std::make_shared<EventHandler>(); auto p = std::make_shared<EventHandler>();
p->cb = cb; p->cb = std::make_shared<a8::CommonCbProc>();
*p->cb = cb;
list_add_tail(&p->entry, &itr->second); list_add_tail(&p->entry, &itr->second);
p->holder = p; p->holder = p;
return p; return p;
@ -520,13 +521,17 @@ void Trigger::RemoveEventHandlers(std::vector<std::weak_ptr<EventHandler>> handl
} }
} }
/*
!!!
*/
void Trigger::DispatchEvent(int event_id, const std::vector<std::any>& param) void Trigger::DispatchEvent(int event_id, const std::vector<std::any>& param)
{ {
auto itr = listeners_hash_.find(event_id); auto itr = listeners_hash_.find(event_id);
if (itr != listeners_hash_.end()) { if (itr != listeners_hash_.end()) {
struct EventHandler *handle = nullptr, *tmp = nullptr; struct EventHandler *handle = nullptr, *tmp = nullptr;
list_for_each_entry_safe(handle, tmp, &itr->second, entry) { list_for_each_entry_safe(handle, tmp, &itr->second, entry) {
handle->cb(param); auto cb = handle->cb;
(*cb)(param);
} }
} }
} }

View File

@ -32,7 +32,7 @@ void PlayerMgr::Init()
account_id_hash_[hum->GetAccountId()] = hum; account_id_hash_[hum->GetAccountId()] = hum;
socket_id_hash_[hum->GetSocketId()] = hum; socket_id_hash_[hum->GetSocketId()] = hum;
++count; ++count;
if (count >= 300) { if (count >= 3) {
f8::Timer::Instance()->DeleteCurrentTimer(); f8::Timer::Instance()->DeleteCurrentTimer();
} }
} }

@ -1 +0,0 @@
Subproject commit 6dc1667f580357e8a2154c28b7867bea7e8ad3a7