Merge branch 'ty' into new_dev
This commit is contained in:
commit
6e1f0346f4
@ -73,6 +73,11 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void OnConnect() override
|
||||||
|
{
|
||||||
|
f8::UdpLog::Instance()->Info("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
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
|
|
||||||
#include "mt/Equip.h"
|
#include "mt/Equip.h"
|
||||||
#include "mt/Buff.h"
|
#include "mt/Buff.h"
|
||||||
|
#include "mt/Param.h"
|
||||||
|
|
||||||
struct AttrAddition : public std::enable_shared_from_this<AttrAddition>
|
struct AttrAddition : public std::enable_shared_from_this<AttrAddition>
|
||||||
{
|
{
|
||||||
@ -18,6 +19,8 @@ struct AttrAddition : public std::enable_shared_from_this<AttrAddition>
|
|||||||
list_head list_entry;
|
list_head list_entry;
|
||||||
int attr_id;
|
int attr_id;
|
||||||
float value;
|
float value;
|
||||||
|
float finaly_value;
|
||||||
|
int source_type = kAstNone;
|
||||||
std::shared_ptr<AttrAddition> holder;
|
std::shared_ptr<AttrAddition> holder;
|
||||||
std::shared_ptr<std::function<std::string()>> get_source;
|
std::shared_ptr<std::function<std::string()>> get_source;
|
||||||
|
|
||||||
@ -35,6 +38,62 @@ struct AttrAddition : public std::enable_shared_from_this<AttrAddition>
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static std::vector<std::shared_ptr<AttrAddition>> s_speed_ratein_list;
|
||||||
|
|
||||||
|
static float CalcSpeedRateIn(list_head* head)
|
||||||
|
{
|
||||||
|
{
|
||||||
|
list_head* pos = nullptr;
|
||||||
|
list_head* next = nullptr;
|
||||||
|
list_for_each_safe(pos, next, head) {
|
||||||
|
AttrAddition* e = list_entry(pos,
|
||||||
|
AttrAddition,
|
||||||
|
entry);
|
||||||
|
switch (e->source_type) {
|
||||||
|
case kAstChip:
|
||||||
|
{
|
||||||
|
if (mt::Param::s().spd_eff_fac_vec.size() >= 2) {
|
||||||
|
e->finaly_value = e->value * mt::Param::s().spd_eff_fac_vec.at(1);
|
||||||
|
} else {
|
||||||
|
e->finaly_value = e->value;
|
||||||
|
}
|
||||||
|
s_speed_ratein_list.push_back(e->holder);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
|
e->finaly_value = e->value;
|
||||||
|
s_speed_ratein_list.push_back(e->holder);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::sort(s_speed_ratein_list.begin(), s_speed_ratein_list.end(),
|
||||||
|
[] (std::shared_ptr<AttrAddition> a, std::shared_ptr<AttrAddition> b) -> bool
|
||||||
|
{
|
||||||
|
return std::fabs(a->finaly_value) > std::fabs(b->finaly_value);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
float result = 1.0f;
|
||||||
|
{
|
||||||
|
bool inited = false;
|
||||||
|
for (size_t i = 0; i < s_speed_ratein_list.size(); ++i) {
|
||||||
|
if (i >= mt::Param::s().spd_pun_fac_vec.size()) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!inited) {
|
||||||
|
result = 1;
|
||||||
|
inited = true;
|
||||||
|
}
|
||||||
|
result *= 1 + (s_speed_ratein_list.at(i)->finaly_value * mt::Param::s().spd_pun_fac_vec.at(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
s_speed_ratein_list.clear();
|
||||||
|
return result - 1.0f;
|
||||||
|
}
|
||||||
|
|
||||||
static bool IsMulCalc(int attr_id)
|
static bool IsMulCalc(int attr_id)
|
||||||
{
|
{
|
||||||
switch (attr_id) {
|
switch (attr_id) {
|
||||||
@ -182,13 +241,17 @@ bool Ability::CanImmune(const std::set<int>& tags)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
AttrHandle Ability::AddAttr(int attr_id, float val)
|
AttrHandle Ability::AddAttr(int attr_id, float val, int source_type)
|
||||||
{
|
{
|
||||||
float old_max_hp = owner_.Get()->GetMaxHP();
|
float old_max_hp = owner_.Get()->GetMaxHP();
|
||||||
if (IsValidHumanAttr(attr_id) ||
|
if (IsValidHumanAttr(attr_id) ||
|
||||||
IsValidHumanVirtualAttr(attr_id)) {
|
IsValidHumanVirtualAttr(attr_id)) {
|
||||||
|
if (source_type < kAstNone || source_type >= kAstEnd) {
|
||||||
|
A8_ABORT();
|
||||||
|
}
|
||||||
auto p = std::make_shared<AttrAddition>(attr_id, val);
|
auto p = std::make_shared<AttrAddition>(attr_id, val);
|
||||||
p->holder = p;
|
p->holder = p;
|
||||||
|
p->source_type = source_type;
|
||||||
if (p->IsAdd()) {
|
if (p->IsAdd()) {
|
||||||
if (IsValidHumanAttr(attr_id)) {
|
if (IsValidHumanAttr(attr_id)) {
|
||||||
list_add_tail(&p->entry, &std::get<1>(attr_add_[attr_id]));
|
list_add_tail(&p->entry, &std::get<1>(attr_add_[attr_id]));
|
||||||
@ -249,22 +312,26 @@ void Ability::RecalcAttrAddition(int attr_id)
|
|||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
list_head* pos = nullptr;
|
|
||||||
list_head* next = nullptr;
|
|
||||||
float new_val = 0.0f;
|
float new_val = 0.0f;
|
||||||
bool inited = false;
|
if (attr_id == kHAT_vSpeedRateIn) {
|
||||||
list_for_each_safe(pos, next, head) {
|
new_val = CalcSpeedRateIn(head);
|
||||||
AttrAddition* e = list_entry(pos,
|
} else {
|
||||||
AttrAddition,
|
list_head* pos = nullptr;
|
||||||
entry);
|
list_head* next = nullptr;
|
||||||
if (IsMulCalc(attr_id)) {
|
bool inited = false;
|
||||||
if (!inited) {
|
list_for_each_safe(pos, next, head) {
|
||||||
new_val = 1;
|
AttrAddition* e = list_entry(pos,
|
||||||
inited = true;
|
AttrAddition,
|
||||||
|
entry);
|
||||||
|
if (IsMulCalc(attr_id)) {
|
||||||
|
if (!inited) {
|
||||||
|
new_val = 1;
|
||||||
|
inited = true;
|
||||||
|
}
|
||||||
|
new_val *= 1 + e->value;
|
||||||
|
} else {
|
||||||
|
new_val += e->value;
|
||||||
}
|
}
|
||||||
new_val *= 1 + e->value;
|
|
||||||
} else {
|
|
||||||
new_val += e->value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (IsValidHumanAttr(attr_id)) {
|
if (IsValidHumanAttr(attr_id)) {
|
||||||
@ -289,22 +356,26 @@ void Ability::RecalcAttrRuduce(int attr_id)
|
|||||||
} else {
|
} else {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
list_head* pos = nullptr;
|
|
||||||
list_head* next = nullptr;
|
|
||||||
float new_val = 0.0f;
|
float new_val = 0.0f;
|
||||||
bool inited = false;
|
if (attr_id == kHAT_vSpeedRateIn) {
|
||||||
list_for_each_safe(pos, next, head) {
|
new_val = CalcSpeedRateIn(head);
|
||||||
AttrAddition* e = list_entry(pos,
|
} else {
|
||||||
AttrAddition,
|
list_head* pos = nullptr;
|
||||||
entry);
|
list_head* next = nullptr;
|
||||||
if (IsMulCalc(attr_id)) {
|
bool inited = false;
|
||||||
if (!inited) {
|
list_for_each_safe(pos, next, head) {
|
||||||
new_val = 1;
|
AttrAddition* e = list_entry(pos,
|
||||||
inited = true;
|
AttrAddition,
|
||||||
|
entry);
|
||||||
|
if (IsMulCalc(attr_id)) {
|
||||||
|
if (!inited) {
|
||||||
|
new_val = 1;
|
||||||
|
inited = true;
|
||||||
|
}
|
||||||
|
new_val *= 1 + e->value;
|
||||||
|
} else {
|
||||||
|
new_val += e->value;
|
||||||
}
|
}
|
||||||
new_val *= 1 + e->value;
|
|
||||||
} else {
|
|
||||||
new_val += e->value;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (IsValidHumanAttr(attr_id)) {
|
if (IsValidHumanAttr(attr_id)) {
|
||||||
@ -384,7 +455,7 @@ std::vector<std::string> Ability::GMShowAttrs()
|
|||||||
owner_.Get()->GetNetData()->GetCrit(),
|
owner_.Get()->GetNetData()->GetCrit(),
|
||||||
owner_.Get()->GetHeroLevel(),
|
owner_.Get()->GetHeroLevel(),
|
||||||
owner_.Get()->GetHeroExp(),
|
owner_.Get()->GetHeroExp(),
|
||||||
owner_.Get()->GetSpeed()
|
owner_.Get()->GetSpeed() * 20
|
||||||
}));
|
}));
|
||||||
{
|
{
|
||||||
std::vector<std::string> tmp_strings;
|
std::vector<std::string> tmp_strings;
|
||||||
|
@ -2,6 +2,14 @@
|
|||||||
#include "attrdefine.h"
|
#include "attrdefine.h"
|
||||||
#include "weakptr.h"
|
#include "weakptr.h"
|
||||||
|
|
||||||
|
enum AbilitySourceType_e
|
||||||
|
{
|
||||||
|
kAstNone,
|
||||||
|
kAstChip,
|
||||||
|
kAstOther,
|
||||||
|
kAstEnd,
|
||||||
|
};
|
||||||
|
|
||||||
class Ability
|
class Ability
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@ -16,7 +24,7 @@ class Ability
|
|||||||
void DecSwitch(int type);
|
void DecSwitch(int type);
|
||||||
int GetSwitchTimes(int type);
|
int GetSwitchTimes(int type);
|
||||||
|
|
||||||
AttrHandle AddAttr(int attr_id, float val);
|
AttrHandle AddAttr(int attr_id, float val, int source_type);
|
||||||
void RemoveAttr(AttrHandle handler);
|
void RemoveAttr(AttrHandle handler);
|
||||||
float GetAttr(int attr_id);
|
float GetAttr(int attr_id);
|
||||||
bool HasAttr(int attr_id);
|
bool HasAttr(int attr_id);
|
||||||
|
@ -1971,9 +1971,9 @@ void CallFuncBuff::BulletDmgCalcProc()
|
|||||||
bool match = target->GetHP() / target->GetMaxHP() < cond;
|
bool match = target->GetHP() / target->GetMaxHP() < cond;
|
||||||
if (match) {
|
if (match) {
|
||||||
if (target_type == 0) {
|
if (target_type == 0) {
|
||||||
context->attr_handle = owner->GetAbility()->AddAttr(attr_id, attr_val);
|
context->attr_handle = owner->GetAbility()->AddAttr(attr_id, attr_val, kAstOther);
|
||||||
} else if (target_type == 1) {
|
} else if (target_type == 1) {
|
||||||
context->attr_handle = target->GetAbility()->AddAttr(attr_id, attr_val);
|
context->attr_handle = target->GetAbility()->AddAttr(attr_id, attr_val, kAstOther);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ void ModifyAttrBuff::Activate()
|
|||||||
int attr_id = meta->_int_buff_param1;
|
int attr_id = meta->_int_buff_param1;
|
||||||
float value = meta->GetBuffParam2(this);
|
float value = meta->GetBuffParam2(this);
|
||||||
if (f8::App::Instance()->GetInstanceId() != 3) {
|
if (f8::App::Instance()->GetInstanceId() != 3) {
|
||||||
attr_handle_ = owner->GetAbility()->AddAttr(attr_id, value);
|
attr_handle_ = owner->GetAbility()->AddAttr(attr_id, value, kAstOther);
|
||||||
#ifdef MYDEBUG
|
#ifdef MYDEBUG
|
||||||
if (!attr_handle_.expired()) {
|
if (!attr_handle_.expired()) {
|
||||||
std::string source_name = a8::Format
|
std::string source_name = a8::Format
|
||||||
|
@ -337,14 +337,11 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
|
|||||||
room->GetCreatureByUniId(a8::XValue(cmds[1]).GetInt());
|
room->GetCreatureByUniId(a8::XValue(cmds[1]).GetInt());
|
||||||
int attr_id = a8::XValue(cmds[2]);
|
int attr_id = a8::XValue(cmds[2]);
|
||||||
float value = a8::XValue(cmds[3]).GetDouble();
|
float value = a8::XValue(cmds[3]).GetDouble();
|
||||||
|
int source_type = cmds.size() > 4 ? a8::XValue(cmds[4]).GetInt() : kAstOther;
|
||||||
if (target) {
|
if (target) {
|
||||||
auto handle = target->GetAbility()->AddAttr(attr_id, value);
|
auto handle = target->GetAbility()->AddAttr(attr_id, value, source_type);
|
||||||
std::vector<std::string> strings = target->GetAbility()->GMShowAttrs();
|
|
||||||
for (auto& str : strings) {
|
|
||||||
SendDebugMsg("数值: " + str);
|
|
||||||
}
|
|
||||||
if (!handle.expired()) {
|
if (!handle.expired()) {
|
||||||
std::string source_name = "<-gm.self";
|
std::string source_name = "<-gm.self." + a8::XValue(source_type).GetString();
|
||||||
auto cb = std::make_shared<std::function<std::string()>>
|
auto cb = std::make_shared<std::function<std::string()>>
|
||||||
(
|
(
|
||||||
[source_name] () -> std::string
|
[source_name] () -> std::string
|
||||||
@ -353,6 +350,10 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
|
|||||||
});
|
});
|
||||||
target->GetAbility()->SetSource(handle, cb);
|
target->GetAbility()->SetSource(handle, cb);
|
||||||
}
|
}
|
||||||
|
std::vector<std::string> strings = target->GetAbility()->GMShowAttrs();
|
||||||
|
for (auto& str : strings) {
|
||||||
|
SendDebugMsg("数值: " + str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (cmd == "del_attr") {
|
} else if (cmd == "del_attr") {
|
||||||
|
@ -4250,7 +4250,7 @@ void Creature::GenLevelAttr()
|
|||||||
}
|
}
|
||||||
grow_attr_list_.clear();
|
grow_attr_list_.clear();
|
||||||
for (auto tuple : *attrs) {
|
for (auto tuple : *attrs) {
|
||||||
auto handle = GetAbility()->AddAttr(std::get<0>(tuple), std::get<1>(tuple));
|
auto handle = GetAbility()->AddAttr(std::get<0>(tuple), std::get<1>(tuple), kAstOther);
|
||||||
if (!handle.expired()) {
|
if (!handle.expired()) {
|
||||||
grow_attr_list_.push_back(handle);
|
grow_attr_list_.push_back(handle);
|
||||||
}
|
}
|
||||||
|
@ -412,6 +412,7 @@ void Human::DecHP(float dec_hp, int killer_id, const std::string killer_name, in
|
|||||||
killer->GetUniId(),
|
killer->GetUniId(),
|
||||||
only_self);
|
only_self);
|
||||||
}
|
}
|
||||||
|
BroadcastBattleHint();
|
||||||
} else if (killer->IsHero()) {
|
} else if (killer->IsHero()) {
|
||||||
if (killer->AsHero()->master.Get() &&
|
if (killer->AsHero()->master.Get() &&
|
||||||
killer->AsHero()->master.Get()->IsPlayer()) {
|
killer->AsHero()->master.Get()->IsPlayer()) {
|
||||||
|
@ -350,6 +350,7 @@ private:
|
|||||||
virtual void DoSkillPreProc(int skill_id, int target_id) override;
|
virtual void DoSkillPreProc(int skill_id, int target_id) override;
|
||||||
virtual void DoSkillPostProc(bool used, int skill_id, int target_id) override;
|
virtual void DoSkillPostProc(bool used, int skill_id, int target_id) override;
|
||||||
void FillMFSettlement(cs::SMGameOver* msg, cs::MFSettlement* settlement);
|
void FillMFSettlement(cs::SMGameOver* msg, cs::MFSettlement* settlement);
|
||||||
|
void BroadcastBattleHint();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
long long hide_frameno_ = 0;
|
long long hide_frameno_ = 0;
|
||||||
@ -395,6 +396,8 @@ private:
|
|||||||
bool sending_battlereport_ = false;
|
bool sending_battlereport_ = false;
|
||||||
bool is_game_end_ = false;
|
bool is_game_end_ = false;
|
||||||
bool sent_personal_report_ = false;
|
bool sent_personal_report_ = false;
|
||||||
|
long long last_battle_hint_frameno_ = 0;
|
||||||
|
int last_battle_hint_uniid_ = 0;
|
||||||
|
|
||||||
long long jump_frameno_ = 0;
|
long long jump_frameno_ = 0;
|
||||||
float old_sync_speed = 0;
|
float old_sync_speed = 0;
|
||||||
|
@ -100,6 +100,22 @@ namespace mt
|
|||||||
s_.block_effect_range.push_back(a8::XValue(str).GetDouble());
|
s_.block_effect_range.push_back(a8::XValue(str).GetDouble());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
{
|
||||||
|
std::string tmp_str = GetStringParam("SpdEffFacVec", "");
|
||||||
|
std::vector<std::string> strings;
|
||||||
|
a8::Split(tmp_str, strings, '|');
|
||||||
|
for (auto& str : strings) {
|
||||||
|
s_.spd_eff_fac_vec.push_back(a8::XValue(str).GetDouble());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{
|
||||||
|
std::string tmp_str = GetStringParam("SpdPunFacVec", "");
|
||||||
|
std::vector<std::string> strings;
|
||||||
|
a8::Split(tmp_str, strings, '|');
|
||||||
|
for (auto& str : strings) {
|
||||||
|
s_.spd_pun_fac_vec.push_back(a8::XValue(str).GetDouble());
|
||||||
|
}
|
||||||
|
}
|
||||||
s_.nature_recover_hp_switch = a8::XValue(GetStringParam("nature_recover_hp_switch", "0"));
|
s_.nature_recover_hp_switch = a8::XValue(GetStringParam("nature_recover_hp_switch", "0"));
|
||||||
s_.nature_recover_hp_idletime = a8::XValue(GetStringParam("nature_recover_hp_idletime", "3"));
|
s_.nature_recover_hp_idletime = a8::XValue(GetStringParam("nature_recover_hp_idletime", "3"));
|
||||||
s_.nature_recover_hp_interval = a8::XValue(GetStringParam("nature_recover_hp_interval1", "1"));
|
s_.nature_recover_hp_interval = a8::XValue(GetStringParam("nature_recover_hp_interval1", "1"));
|
||||||
@ -107,6 +123,10 @@ namespace mt
|
|||||||
#endif
|
#endif
|
||||||
s_.battle_auto_ready_min_time = GetIntParam("battle_auto_ready_min_time", 5);
|
s_.battle_auto_ready_min_time = GetIntParam("battle_auto_ready_min_time", 5);
|
||||||
s_.battle_auto_ready_max_time = GetIntParam("battle_auto_ready_max_time", 8);
|
s_.battle_auto_ready_max_time = GetIntParam("battle_auto_ready_max_time", 8);
|
||||||
|
|
||||||
|
s_.speed_rf = GetIntParam("SpeedRF", 5.0f);
|
||||||
|
s_.speed_rate_max = GetIntParam("SpeedRateMax", 0.2f);
|
||||||
|
|
||||||
#ifdef MYDEBUG
|
#ifdef MYDEBUG
|
||||||
s_.match_team_time = 6;
|
s_.match_team_time = 6;
|
||||||
s_.match_robot_time = 5;
|
s_.match_robot_time = 5;
|
||||||
|
@ -164,6 +164,16 @@ namespace mt
|
|||||||
float battle_event_end_loss_rate_dead = 0.5f;
|
float battle_event_end_loss_rate_dead = 0.5f;
|
||||||
float battle_event_end_loss_rate_quit = 1.0f;
|
float battle_event_end_loss_rate_quit = 1.0f;
|
||||||
|
|
||||||
|
float speed_rf = 5.0f;
|
||||||
|
float speed_rate_max = 0.2f;
|
||||||
|
std::vector<float> spd_eff_fac_vec;
|
||||||
|
std::vector<float> spd_pun_fac_vec;
|
||||||
|
|
||||||
|
int battle_hint_interval = 10;
|
||||||
|
int battle_hint_duration = 10;
|
||||||
|
int battle_hint_view_range = 512;
|
||||||
|
int battle_hint_broadcast_range = 800;
|
||||||
|
|
||||||
std::vector<float> block_effect_range;
|
std::vector<float> block_effect_range;
|
||||||
std::vector<float> crit_effect_range;
|
std::vector<float> crit_effect_range;
|
||||||
|
|
||||||
|
@ -292,7 +292,7 @@ private:
|
|||||||
int attr_id = a8::XValue(attr->Get("attr_id", "0"));
|
int attr_id = a8::XValue(attr->Get("attr_id", "0"));
|
||||||
float val = a8::XValue(attr->Get("val", "0")).GetDouble();
|
float val = a8::XValue(attr->Get("val", "0")).GetDouble();
|
||||||
if (IsValidHumanAttr(attr_id)) {
|
if (IsValidHumanAttr(attr_id)) {
|
||||||
auto attr_handle = owner_.Get()->GetAbility()->AddAttr(attr_id, val);
|
auto attr_handle = owner_.Get()->GetAbility()->AddAttr(attr_id, val, kAstOther);
|
||||||
if (!attr_handle.expired()) {
|
if (!attr_handle.expired()) {
|
||||||
#ifdef MYDEBUG
|
#ifdef MYDEBUG
|
||||||
std::string source_name = a8::Format
|
std::string source_name = a8::Format
|
||||||
@ -324,7 +324,7 @@ private:
|
|||||||
int attr_id = a8::XValue(attr->Get("attr_id", "0"));
|
int attr_id = a8::XValue(attr->Get("attr_id", "0"));
|
||||||
float val = a8::XValue(attr->Get("val", "0")).GetDouble();
|
float val = a8::XValue(attr->Get("val", "0")).GetDouble();
|
||||||
if (IsValidHumanAttr(attr_id)) {
|
if (IsValidHumanAttr(attr_id)) {
|
||||||
auto attr_handle = owner_.Get()->GetAbility()->AddAttr(attr_id, val);
|
auto attr_handle = owner_.Get()->GetAbility()->AddAttr(attr_id, val, kAstChip);
|
||||||
if (!attr_handle.expired()) {
|
if (!attr_handle.expired()) {
|
||||||
#ifdef MYDEBUG
|
#ifdef MYDEBUG
|
||||||
std::string source_name = a8::Format
|
std::string source_name = a8::Format
|
||||||
|
@ -2183,6 +2183,46 @@ void Human::SendViewerUiMemberUpdate(std::vector<int> member_ids)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Human::BroadcastBattleHint()
|
||||||
|
{
|
||||||
|
if (room->GetFrameNo() - last_battle_hint_frameno_ >= mt::Param::s().battle_hint_interval) {
|
||||||
|
if (last_battle_hint_uniid_ > 0) {
|
||||||
|
if (room->GetFrameNo() - last_battle_hint_frameno_ <
|
||||||
|
mt::Param::s().battle_hint_duration * SERVER_FRAME_RATE + 8) {
|
||||||
|
cs::SMDelBattleHint notify_msg;
|
||||||
|
notify_msg.set_uniid(last_battle_hint_uniid_);
|
||||||
|
SendNotifyMsg(notify_msg);
|
||||||
|
}
|
||||||
|
last_battle_hint_uniid_ = 0;
|
||||||
|
}
|
||||||
|
last_battle_hint_frameno_ = room->GetFrameNo();
|
||||||
|
std::shared_ptr<cs::SMAddBattleHint> notify_msg;
|
||||||
|
room->TraversePlayerList
|
||||||
|
(
|
||||||
|
[this, ¬ify_msg] (Player* hum) -> bool
|
||||||
|
{
|
||||||
|
if (!hum->dead) {
|
||||||
|
float distance = hum->GetPos().Distance2D2(GetPos());
|
||||||
|
if (distance >= mt::Param::s().battle_hint_view_range &&
|
||||||
|
distance <= mt::Param::s().battle_hint_broadcast_range) {
|
||||||
|
if (!notify_msg) {
|
||||||
|
last_battle_hint_uniid_ = room->AllocUniid();
|
||||||
|
notify_msg = std::make_shared<cs::SMAddBattleHint>();
|
||||||
|
notify_msg->set_uniid(last_battle_hint_uniid_);
|
||||||
|
notify_msg->set_duration(mt::Param::s().battle_hint_duration);
|
||||||
|
TypeConvert::ToPb(GetPos(), notify_msg->mutable_pos());
|
||||||
|
}
|
||||||
|
hum->SendNotifyMsg(*notify_msg.get());
|
||||||
|
#ifdef MYDEBUG
|
||||||
|
a8::XPrintf("SMAddBattleHint:%s\n", {f8::PbToJson(notify_msg.get())});
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GGListener::SendError(int sockhandle, unsigned int seqid,
|
void GGListener::SendError(int sockhandle, unsigned int seqid,
|
||||||
int error_code, const std::string& error_msg,
|
int error_code, const std::string& error_msg,
|
||||||
const char* file, int lineno, int error_param)
|
const char* file, int lineno, int error_param)
|
||||||
|
@ -87,7 +87,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 socket_hash_.size:%d",
|
f8::UdpLog::Instance()->Warning("JoinError socket_not_exits socket_handle:%d socket_hash_.size:%d",
|
||||||
{
|
{
|
||||||
hdr->socket_handle,
|
hdr->socket_handle,
|
||||||
socket_hash_.size()
|
socket_hash_.size()
|
||||||
|
@ -75,4 +75,6 @@ enum SMMessageId_e
|
|||||||
_SMTeamFullNotify = 1032;
|
_SMTeamFullNotify = 1032;
|
||||||
_SMTeamPartNotify = 1033;
|
_SMTeamPartNotify = 1033;
|
||||||
_SMBattlePreInfoUpdate = 1034;
|
_SMBattlePreInfoUpdate = 1034;
|
||||||
|
_SMAddBattleHint = 1035;
|
||||||
|
_SMDelBattleHint = 1036;
|
||||||
}
|
}
|
||||||
|
@ -2132,4 +2132,18 @@ message SMTeamPartNotify
|
|||||||
message SMBattlePreInfoUpdate
|
message SMBattlePreInfoUpdate
|
||||||
{
|
{
|
||||||
optional MFBattlePreInfo info = 1; //战前准备信息
|
optional MFBattlePreInfo info = 1; //战前准备信息
|
||||||
|
}
|
||||||
|
|
||||||
|
//战斗提示-添加
|
||||||
|
message SMAddBattleHint
|
||||||
|
{
|
||||||
|
optional int32 uniid = 1; //唯一id
|
||||||
|
optional MFVec3 pos = 2; //坐标
|
||||||
|
optional int32 duration = 3; //持续时间秒
|
||||||
|
}
|
||||||
|
|
||||||
|
//战斗提示-删除
|
||||||
|
message SMDelBattleHint
|
||||||
|
{
|
||||||
|
optional int32 uniid = 1; //唯一id
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user