This commit is contained in:
aozhiwei 2023-11-24 16:52:11 +08:00
commit 0bb084433b
5 changed files with 94 additions and 38 deletions

View File

@ -633,7 +633,7 @@ namespace behaviac
virtual bool load()
{
AgentMeta::SetTotalSignature(2900147864u);
AgentMeta::SetTotalSignature(4002927094u);
AgentMeta* meta = NULL;
BEHAVIAC_UNUSED_VAR(meta);
@ -750,7 +750,7 @@ namespace behaviac
meta->RegisterMethod(502968959u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorRemove());
// HeroAgent
meta = BEHAVIAC_NEW AgentMeta(3488849203u);
meta = BEHAVIAC_NEW AgentMeta(926738999u);
AgentMeta::GetAgentMetas()[2270112014u] = meta;
meta->RegisterMemberProperty(2706111800u, BEHAVIAC_NEW CMemberProperty< TargetAgent* >("current_target_agent", Set_HeroAgent_current_target_agent, Get_HeroAgent_current_target_agent));
meta->RegisterMemberProperty(3525744799u, BEHAVIAC_NEW CMemberProperty< TeammateAgent* >("current_teammate_agent", Set_HeroAgent_current_teammate_agent, Get_HeroAgent_current_teammate_agent));
@ -811,6 +811,7 @@ namespace behaviac
meta->RegisterMethod(961264360u, BEHAVIAC_NEW CAgentMethodVoid_2<int, int>(FunctionPointer_HeroAgent_DecV));
meta->RegisterMethod(1811924796u, BEHAVIAC_NEW CAgentMethod_1< int, int >(FunctionPointer_HeroAgent_DeltaTime));
meta->RegisterMethod(3850832265u, BEHAVIAC_NEW CAgentMethodVoid_2<glm::vec3&, float>(FunctionPointer_HeroAgent_FollowMaster) /* FollowMaster */);
meta->RegisterMethod(337666808u, BEHAVIAC_NEW CAgentMethodVoid_2<glm::vec3&, float>(FunctionPointer_HeroAgent_FollowTeammate) /* FollowTeammate */);
meta->RegisterMethod(3395125024u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_HeroAgent_GetAgentType));
meta->RegisterMethod(1962280222u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_HeroAgent_GetAliveEnemyNum));
meta->RegisterMethod(755433673u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_HeroAgent_GetBattleTimes));
@ -920,7 +921,7 @@ namespace behaviac
meta->RegisterMethod(502968959u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorRemove());
// AndroidAgent
meta = BEHAVIAC_NEW AgentMeta(1894141024u);
meta = BEHAVIAC_NEW AgentMeta(1303304095u);
AgentMeta::GetAgentMetas()[2475098143u] = meta;
meta->RegisterMemberProperty(2706111800u, BEHAVIAC_NEW CMemberProperty< TargetAgent* >("current_target_agent", Set_HeroAgent_current_target_agent, Get_HeroAgent_current_target_agent));
meta->RegisterMemberProperty(3525744799u, BEHAVIAC_NEW CMemberProperty< TeammateAgent* >("current_teammate_agent", Set_HeroAgent_current_teammate_agent, Get_HeroAgent_current_teammate_agent));
@ -981,6 +982,7 @@ namespace behaviac
meta->RegisterMethod(961264360u, BEHAVIAC_NEW CAgentMethodVoid_2<int, int>(FunctionPointer_AndroidAgent_DecV));
meta->RegisterMethod(1811924796u, BEHAVIAC_NEW CAgentMethod_1< int, int >(FunctionPointer_AndroidAgent_DeltaTime));
meta->RegisterMethod(3850832265u, BEHAVIAC_NEW CAgentMethodVoid_2<glm::vec3&, float>(FunctionPointer_AndroidAgent_FollowMaster) /* FollowMaster */);
meta->RegisterMethod(337666808u, BEHAVIAC_NEW CAgentMethodVoid_2<glm::vec3&, float>(FunctionPointer_AndroidAgent_FollowTeammate) /* FollowTeammate */);
meta->RegisterMethod(397371422u, BEHAVIAC_NEW CAgentMethod< behaviac::string >(FunctionPointer_AndroidAgent_GetAccountId));
meta->RegisterMethod(3395125024u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_AndroidAgent_GetAgentType));
meta->RegisterMethod(1962280222u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_AndroidAgent_GetAliveEnemyNum));

View File

@ -185,6 +185,7 @@ namespace behaviac
inline void FunctionPointer_HeroAgent_DecV(Agent* self, int id, int val) { ((HeroAgent*)self)->_Execute_Method_<METHOD_TYPE_HeroAgent_DecV, void, int, int >(id, val); }
inline int FunctionPointer_HeroAgent_DeltaTime(Agent* self, int time) { return ((HeroAgent*)self)->DeltaTime(time); }
inline void FunctionPointer_HeroAgent_FollowMaster(Agent* self, glm::vec3& loc_point0, float loc_val0) { } /* FollowMaster */
inline void FunctionPointer_HeroAgent_FollowTeammate(Agent* self, glm::vec3& loc_point0, float loc_val0) { } /* FollowTeammate */
inline int FunctionPointer_HeroAgent_GetAgentType(Agent* self) { return ((HeroAgent*)self)->GetAgentType(); }
inline int FunctionPointer_HeroAgent_GetAliveEnemyNum(Agent* self) { return ((HeroAgent*)self)->GetAliveEnemyNum(); }
inline int FunctionPointer_HeroAgent_GetBattleTimes(Agent* self) { return ((HeroAgent*)self)->GetBattleTimes(); }
@ -312,6 +313,7 @@ namespace behaviac
inline void FunctionPointer_AndroidAgent_DecV(Agent* self, int id, int val) { ((HeroAgent*)self)->_Execute_Method_<METHOD_TYPE_HeroAgent_DecV, void, int, int >(id, val); }
inline int FunctionPointer_AndroidAgent_DeltaTime(Agent* self, int time) { return ((AndroidAgent*)self)->DeltaTime(time); }
inline void FunctionPointer_AndroidAgent_FollowMaster(Agent* self, glm::vec3& loc_point0, float loc_val0) { } /* FollowMaster */
inline void FunctionPointer_AndroidAgent_FollowTeammate(Agent* self, glm::vec3& loc_point0, float loc_val0) { } /* FollowTeammate */
inline behaviac::string FunctionPointer_AndroidAgent_GetAccountId(Agent* self) { return ((AndroidAgent*)self)->GetAccountId(); }
inline int FunctionPointer_AndroidAgent_GetAgentType(Agent* self) { return ((AndroidAgent*)self)->GetAgentType(); }
inline int FunctionPointer_AndroidAgent_GetAliveEnemyNum(Agent* self) { return ((AndroidAgent*)self)->GetAliveEnemyNum(); }

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<!--EXPORTED BY TOOL, DON'T MODIFY IT!-->
<agents version="1" signature="2900147864">
<agent type="HeroAgent" base="BaseAgent" signature="3488849203">
<agents version="1" signature="4002927094">
<agent type="HeroAgent" base="BaseAgent" signature="926738999">
<properties>
<property name="current_target_agent" type="TargetAgent*" member="false" static="false" defaultvalue="null" />
<property name="current_teammate_agent" type="TeammateAgent*" member="false" static="false" defaultvalue="null" />
@ -32,7 +32,7 @@
<property name="tmp_val4" type="float" member="false" static="false" defaultvalue="0" />
</properties>
</agent>
<agent type="AndroidAgent" base="HeroAgent" signature="1894141024">
<agent type="AndroidAgent" base="HeroAgent" signature="1303304095">
<properties>
<property name="current_target_agent" type="TargetAgent*" member="false" static="false" defaultvalue="null" />
<property name="current_teammate_agent" type="TeammateAgent*" member="false" static="false" defaultvalue="null" />

View File

@ -32,41 +32,65 @@
<property ReferenceBehavior="const string &quot;task/RunGas&quot;" />
<property Task="Self.HeroAgent::RunGas(0,0,0)" />
</node>
<node class="IfElse" id="6">
<node class="Condition" id="7">
<property Operator="Equal" />
<property Opl="Self.HeroAgent::SearchEnemy(500)" />
<property Opr="const behaviac::EBTStatus BT_SUCCESS" />
</node>
<node class="ReferencedBehavior" id="8">
<property ReferenceBehavior="const string &quot;task/ChaseToKill&quot;" />
<property Task="Self.HeroAgent::ChaseToKill(0,0,0)" />
</node>
<node class="Sequence" id="17">
<node class="SelectorProbability" id="9">
<node class="DecoratorWeight" id="10">
<property DecorateWhenChildEnds="false" />
<property Weight="const int 50" />
<node class="ReferencedBehavior" id="11">
<property ReferenceBehavior="const string &quot;task/RandomWalk&quot;" />
<property Task="Self.HeroAgent::RandomWalk(0,0,{x=0;y=0;z=0;})" />
<node class="Sequence" id="18">
<node class="SelectorProbability" id="23">
<node class="DecoratorWeight" id="24">
<property DecorateWhenChildEnds="false" />
<property Weight="const int 50" />
<node class="IfElse" id="6">
<node class="Condition" id="7">
<property Operator="Equal" />
<property Opl="Self.HeroAgent::SearchEnemy(500)" />
<property Opr="const behaviac::EBTStatus BT_SUCCESS" />
</node>
<node class="ReferencedBehavior" id="8">
<property ReferenceBehavior="const string &quot;task/ChaseToKill&quot;" />
<property Task="Self.HeroAgent::ChaseToKill(0,0,0)" />
</node>
<node class="Sequence" id="17">
<node class="SelectorProbability" id="9">
<node class="DecoratorWeight" id="10">
<property DecorateWhenChildEnds="false" />
<property Weight="const int 50" />
<node class="ReferencedBehavior" id="11">
<property ReferenceBehavior="const string &quot;task/RandomWalk&quot;" />
<property Task="Self.HeroAgent::RandomWalk(0,0,{x=0;y=0;z=0;})" />
</node>
</node>
<node class="DecoratorWeight" id="12">
<property DecorateWhenChildEnds="false" />
<property Weight="const int 100" />
<node class="ReferencedBehavior" id="13">
<property ReferenceBehavior="const string &quot;task/RandomShot&quot;" />
<property Task="Self.HeroAgent::RandomShot(0,0,{x=0;y=0;z=0;})" />
</node>
</node>
<node class="DecoratorWeight" id="14">
<property DecorateWhenChildEnds="false" />
<property Weight="const int 60" />
<node class="Action" id="15">
<property Method="Self.HeroAgent::CoIdle(2000,4000)" />
<property ResultOption="BT_INVALID" />
</node>
</node>
</node>
</node>
</node>
<node class="DecoratorWeight" id="12">
<property DecorateWhenChildEnds="false" />
<property Weight="const int 100" />
<node class="ReferencedBehavior" id="13">
<property ReferenceBehavior="const string &quot;task/RandomShot&quot;" />
<property Task="Self.HeroAgent::RandomShot(0,0,{x=0;y=0;z=0;})" />
</node>
<node class="DecoratorWeight" id="25">
<property DecorateWhenChildEnds="false" />
<property Weight="const int 50" />
<node class="IfElse" id="19">
<node class="Condition" id="20">
<property Operator="Equal" />
<property Opl="Self.HeroAgent::SearchTeammate(800)" />
<property Opr="const bool true" />
</node>
</node>
<node class="DecoratorWeight" id="14">
<property DecorateWhenChildEnds="false" />
<property Weight="const int 60" />
<node class="Action" id="15">
<property Method="Self.HeroAgent::CoIdle(2000,4000)" />
<property ResultOption="BT_INVALID" />
<node class="ReferencedBehavior" id="21">
<property ReferenceBehavior="const string &quot;task/FollowTeammate&quot;" />
<property Task="Self.HeroAgent::FollowTeammate({x=0;y=0;z=0;},0)" />
</node>
<node class="True" id="22" />
</node>
</node>
</node>

View File

@ -1,5 +1,7 @@
#include "precompile.h"
#include <unistd.h>
#include <f8/udplog.h>
#include <f8/btmgr.h>
#include <f8/timer.h>
@ -203,10 +205,35 @@ long long App::AllocTempWeaponUniId()
return -curr_uniid_;
}
static std::string GetSelfPath()
{
char self[PATH_MAX] = { 0 };
int nchar = readlink("/proc/self/exe", self, sizeof self);
if (nchar < 0) {
A8_ABORT();
}
std::string path((char*)self);
a8::XPrintf("exe:%s path:%s\n", {self, path});
return path;
}
int App::GetVersion()
{
const char* current_file_name = __FILE__;
if (!version_) {
#if 1
std::string self_path = GetSelfPath();
//self_path = "/data/backups_app/b_game2006_gameserver_ty_z9.1.0.0.1.20231124R2/bin/gameserver2006";
std::vector<std::string> strings;
a8::Split(self_path, strings, '/');
std::string tag = strings.at(strings.size() - 3);
std::vector<std::string> strings2;
a8::Split(tag, strings2, '.');
std::string version_str = strings2.at(strings2.size() - 1);
a8::ReplaceString(version_str, "R", "0");
version_ = std::make_shared<int>(a8::XValue(version_str).GetInt());
a8::XPrintf("%s %s %s\n", {self_path, *version_, version_str});
#else
std::vector<std::string> strings;
a8::Split(current_file_name, strings, '/');
std::string tag = strings.at(strings.size() - 6);
@ -215,7 +242,8 @@ int App::GetVersion()
std::string version_str = strings2.at(strings2.size() - 1);
a8::ReplaceString(version_str, "R", "0");
version_ = std::make_shared<int>(a8::XValue(version_str).GetInt());
//a8::XPrintf("%s %s %s\n", {current_file_name, *version_, version_str});
a8::XPrintf("%s %s %s\n", {current_file_name, *version_, version_str});
#endif
}
return *version_;
}