This commit is contained in:
aozhiwei 2024-04-10 14:24:15 +08:00
parent 649cd01f31
commit bbfe9c0376
6 changed files with 64 additions and 1 deletions

View File

@ -13,6 +13,7 @@
#include "incubator.h"
#include "mapinstance.h"
#include "team.h"
#include "loot.h"
#include "cs_proto.pb.h"
@ -410,6 +411,40 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
&xtimer_attacher);
} else if (cmd == "fast_forward") {
room->GMFastForward();
} else if (cmd == "last_pickup") {
SendDebugMsg(a8::Format("拾取道具: 距离当前时间(毫秒):%d 数量:%d",
{
(room->GetFrameNo() - last_interaction_frameno_) * FRAME_RATE_MS,
last_interaction_objids_.size()
}));
SendDebugMsg("道具拾取: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
for (int obj_uniid : last_interaction_objids_) {
std::string obj_type = "?";
std::string obj_name = "?";
int item_id = 0;
int entity_type = 0;
Entity* entity = room->GetEntityByUniId(obj_uniid);
if (entity) {
entity_type = entity->GetEntityType();
switch (entity->GetEntityType()) {
case ET_Loot:
{
item_id = ((Loot*)entity)->item_id;
}
break;
default:
{
}
break;
}
}
SendDebugMsg(a8::Format("拾取道具: obj_uniid:%d item_id:%s",
{
obj_uniid,
item_id,
}));
}
SendDebugMsg("道具拾取: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
} else if (cmd == "winexp" && cmds.size() >= 1) {
float exp = a8::XValue(cmds[1]).GetDouble();
if (exp > 0) {

View File

@ -1716,8 +1716,23 @@ void Creature::CheckSpecObject(int new_poly_flags)
RemoveBuffById(8058);
RemoveBuffById(kInGrassBuffId);
} else {
TryAddBuffAndSetTime(this, 8058, 9999999);
TryAddBuffAndSetTime(this, kInGrassBuffId, 9999999);
if ((room->GetFrameNo() - last_battling_frameno) * FRAME_RATE_MS <
mt::Param::s().battling_grass_hide_delay_time) {
#if 0
battling_grass_hide_delay_timer = room->xtimer.SetTimeoutWpEx
(
dur_time * SERVER_FRAME_RATE,
[] (int event, const a8::Args* args)
{
if (a8::TIMER_EXEC_EVENT == event) {
}
},
&xtimer_attacher);
#endif
} else {
TryAddBuffAndSetTime(this, 8058, 9999999);
}
}
}
}

View File

@ -134,6 +134,9 @@ class Creature : public MoveableEntity
int point_idx = 0;
int path_dir = 0;
long long last_battling_frameno = 0;
a8::XTimerWp battling_grass_hide_delay_timer;
Creature();
virtual ~Creature() override;
virtual void Initialize() override;

View File

@ -142,6 +142,9 @@ namespace mt
int battle_auto_ready_min_time = 0;
int battle_auto_ready_max_time = 0;
int battling_detection_range = 0;
int battling_grass_hide_delay_time = 0;
std::vector<float> block_effect_range;
std::vector<float> crit_effect_range;

View File

@ -832,6 +832,8 @@ void Player::ProcInteraction()
#endif
}
}
last_interaction_objids_ = std::move(interaction_objids);
last_interaction_frameno_ = room->GetFrameNo();
interaction_objids.clear();
if (notify_msg.items().size() > 0) {
SendNotifyMsg(notify_msg);

View File

@ -166,6 +166,11 @@ private:
long long last_cmmove_frameno_ = 0;
a8::XTimerWp watch_war_req_timer_;
#ifdef MYDEBUG
std::vector<int> last_interaction_objids_;
long long last_interaction_frameno_ = 0;
#endif
friend class EntityFactory;
friend class PBUtils;
};