Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
3422342d28 | ||
![]() |
0bbfd36c3d | ||
![]() |
d66d386270 | ||
![]() |
3723810667 |
@ -7,11 +7,3 @@
|
||||
| AbandonPickup | 放弃拾取当前物件一段时间 | | | | |
|
||||
| Pickup | 开始拾取 | BT_FAILURE:失败 BT_SUCCESS:成功 | | | |
|
||||
|
||||
# 观战
|
||||
|
||||
SMJoinedNotify
|
||||
SMMapInfo
|
||||
SMUiUpdate
|
||||
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
|
||||
|
@ -164,12 +164,6 @@ template<> inline void HeroAgent::_Execute_Method_<METHOD_TYPE_HeroAgent_ResetUs
|
||||
this->HeroAgent::ResetUseSkillTimes();
|
||||
}
|
||||
|
||||
struct METHOD_TYPE_HeroAgent_SearchHumanEnemy { };
|
||||
template<> inline behaviac::EBTStatus HeroAgent::_Execute_Method_<METHOD_TYPE_HeroAgent_SearchHumanEnemy>(int p0)
|
||||
{
|
||||
return this->HeroAgent::SearchHumanEnemy(p0);
|
||||
}
|
||||
|
||||
struct METHOD_TYPE_HeroAgent_SearchPickupObj { };
|
||||
template<> inline int HeroAgent::_Execute_Method_<METHOD_TYPE_HeroAgent_SearchPickupObj>()
|
||||
{
|
||||
|
@ -633,7 +633,7 @@ namespace behaviac
|
||||
|
||||
virtual bool load()
|
||||
{
|
||||
AgentMeta::SetTotalSignature(2686576916u);
|
||||
AgentMeta::SetTotalSignature(2900147864u);
|
||||
|
||||
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(1955586164u);
|
||||
meta = BEHAVIAC_NEW AgentMeta(3488849203u);
|
||||
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));
|
||||
@ -784,7 +784,6 @@ namespace behaviac
|
||||
meta->RegisterMethod(1352812660u, BEHAVIAC_NEW CAgentMethodVoid_1<CoId_e>(FunctionPointer_HeroAgent_AbortCoroutine));
|
||||
meta->RegisterMethod(3724946699u, BEHAVIAC_NEW CAgentMethodVoid_1<glm::vec3&>(FunctionPointer_HeroAgent_BattleMove) /* BattleMove */);
|
||||
meta->RegisterMethod(113953652u, BEHAVIAC_NEW CMethod_HeroAgent_CalcDistance());
|
||||
meta->RegisterMethod(2948764806u, BEHAVIAC_NEW CAgentMethod< bool >(FunctionPointer_HeroAgent_CanAttack));
|
||||
meta->RegisterMethod(896336728u, BEHAVIAC_NEW CAgentMethod< bool >(FunctionPointer_HeroAgent_CanShot));
|
||||
meta->RegisterMethod(3040220846u, BEHAVIAC_NEW CAgentMethod_1< bool, InventorySlot_e >(FunctionPointer_HeroAgent_CanThrowItem));
|
||||
meta->RegisterMethod(1672911688u, BEHAVIAC_NEW CAgentMethod_1< bool, int >(FunctionPointer_HeroAgent_CanUseSkill));
|
||||
@ -812,7 +811,6 @@ 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));
|
||||
@ -884,7 +882,6 @@ namespace behaviac
|
||||
meta->RegisterMethod(3146209884u, BEHAVIAC_NEW CAgentMethodVoid_1<glm::vec3&>(FunctionPointer_HeroAgent_RunAway) /* RunAway */);
|
||||
meta->RegisterMethod(160678866u, BEHAVIAC_NEW CAgentMethodVoid_3<int, int, int>(FunctionPointer_HeroAgent_RunGas) /* RunGas */);
|
||||
meta->RegisterMethod(3025058903u, BEHAVIAC_NEW CAgentMethod_1< behaviac::EBTStatus, float >(FunctionPointer_HeroAgent_SearchEnemy));
|
||||
meta->RegisterMethod(3238208553u, BEHAVIAC_NEW CAgentMethod_1< behaviac::EBTStatus, int >(FunctionPointer_HeroAgent_SearchHumanEnemy));
|
||||
meta->RegisterMethod(1182328469u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_HeroAgent_SearchPickupObj));
|
||||
meta->RegisterMethod(3477639065u, BEHAVIAC_NEW CAgentMethod_1< bool, int >(FunctionPointer_HeroAgent_SearchTeammate));
|
||||
meta->RegisterMethod(2380700906u, BEHAVIAC_NEW CAgentMethodVoid_1<int>(FunctionPointer_HeroAgent_SendEmote));
|
||||
@ -923,7 +920,7 @@ namespace behaviac
|
||||
meta->RegisterMethod(502968959u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorRemove());
|
||||
|
||||
// AndroidAgent
|
||||
meta = BEHAVIAC_NEW AgentMeta(3669426665u);
|
||||
meta = BEHAVIAC_NEW AgentMeta(1894141024u);
|
||||
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));
|
||||
@ -957,7 +954,6 @@ namespace behaviac
|
||||
meta->RegisterMethod(1352812660u, BEHAVIAC_NEW CAgentMethodVoid_1<CoId_e>(FunctionPointer_AndroidAgent_AbortCoroutine));
|
||||
meta->RegisterMethod(3724946699u, BEHAVIAC_NEW CAgentMethodVoid_1<glm::vec3&>(FunctionPointer_AndroidAgent_BattleMove) /* BattleMove */);
|
||||
meta->RegisterMethod(113953652u, BEHAVIAC_NEW CMethod_HeroAgent_CalcDistance());
|
||||
meta->RegisterMethod(2948764806u, BEHAVIAC_NEW CAgentMethod< bool >(FunctionPointer_AndroidAgent_CanAttack));
|
||||
meta->RegisterMethod(896336728u, BEHAVIAC_NEW CAgentMethod< bool >(FunctionPointer_AndroidAgent_CanShot));
|
||||
meta->RegisterMethod(3040220846u, BEHAVIAC_NEW CAgentMethod_1< bool, InventorySlot_e >(FunctionPointer_AndroidAgent_CanThrowItem));
|
||||
meta->RegisterMethod(1672911688u, BEHAVIAC_NEW CAgentMethod_1< bool, int >(FunctionPointer_AndroidAgent_CanUseSkill));
|
||||
@ -985,7 +981,6 @@ 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));
|
||||
@ -1058,7 +1053,6 @@ namespace behaviac
|
||||
meta->RegisterMethod(3146209884u, BEHAVIAC_NEW CAgentMethodVoid_1<glm::vec3&>(FunctionPointer_AndroidAgent_RunAway) /* RunAway */);
|
||||
meta->RegisterMethod(160678866u, BEHAVIAC_NEW CAgentMethodVoid_3<int, int, int>(FunctionPointer_AndroidAgent_RunGas) /* RunGas */);
|
||||
meta->RegisterMethod(3025058903u, BEHAVIAC_NEW CAgentMethod_1< behaviac::EBTStatus, float >(FunctionPointer_AndroidAgent_SearchEnemy));
|
||||
meta->RegisterMethod(3238208553u, BEHAVIAC_NEW CAgentMethod_1< behaviac::EBTStatus, int >(FunctionPointer_AndroidAgent_SearchHumanEnemy));
|
||||
meta->RegisterMethod(1182328469u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_AndroidAgent_SearchPickupObj));
|
||||
meta->RegisterMethod(3477639065u, BEHAVIAC_NEW CAgentMethod_1< bool, int >(FunctionPointer_AndroidAgent_SearchTeammate));
|
||||
meta->RegisterMethod(2380700906u, BEHAVIAC_NEW CAgentMethodVoid_1<int>(FunctionPointer_AndroidAgent_SendEmote));
|
||||
|
@ -160,7 +160,6 @@ namespace behaviac
|
||||
inline void FunctionPointer_HeroAgent_Abort(Agent* self, behaviac::string msg, behaviac::vector<int> args) { ((HeroAgent*)self)->_Execute_Method_<METHOD_TYPE_HeroAgent_Abort, void, behaviac::string, behaviac::vector<int> >(msg, args); }
|
||||
inline void FunctionPointer_HeroAgent_AbortCoroutine(Agent* self, CoId_e co_id) { ((BaseAgent*)self)->_Execute_Method_<METHOD_TYPE_BaseAgent_AbortCoroutine, void, CoId_e >(co_id); }
|
||||
inline void FunctionPointer_HeroAgent_BattleMove(Agent* self, glm::vec3& loc_point0) { } /* BattleMove */
|
||||
inline bool FunctionPointer_HeroAgent_CanAttack(Agent* self) { return ((HeroAgent*)self)->CanAttack(); }
|
||||
inline bool FunctionPointer_HeroAgent_CanShot(Agent* self) { return ((HeroAgent*)self)->CanShot(); }
|
||||
inline bool FunctionPointer_HeroAgent_CanThrowItem(Agent* self, InventorySlot_e slot) { return (bool)((HeroAgent*)self)->_Execute_Method_<METHOD_TYPE_HeroAgent_CanThrowItem, bool, InventorySlot_e >(slot); }
|
||||
inline bool FunctionPointer_HeroAgent_CanUseSkill(Agent* self, int skill_id) { return ((HeroAgent*)self)->CanUseSkill(skill_id); }
|
||||
@ -186,7 +185,6 @@ 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(); }
|
||||
@ -257,7 +255,6 @@ namespace behaviac
|
||||
inline void FunctionPointer_HeroAgent_RunAway(Agent* self, glm::vec3& loc_point0) { } /* RunAway */
|
||||
inline void FunctionPointer_HeroAgent_RunGas(Agent* self, int loc_val0, int loc_val1, int loc_val2) { } /* RunGas */
|
||||
inline behaviac::EBTStatus FunctionPointer_HeroAgent_SearchEnemy(Agent* self, float range) { return ((HeroAgent*)self)->SearchEnemy(range); }
|
||||
inline behaviac::EBTStatus FunctionPointer_HeroAgent_SearchHumanEnemy(Agent* self, int range) { return (behaviac::EBTStatus)((HeroAgent*)self)->_Execute_Method_<METHOD_TYPE_HeroAgent_SearchHumanEnemy, behaviac::EBTStatus, int >(range); }
|
||||
inline int FunctionPointer_HeroAgent_SearchPickupObj(Agent* self) { return (int)((HeroAgent*)self)->_Execute_Method_<METHOD_TYPE_HeroAgent_SearchPickupObj, int >(); }
|
||||
inline bool FunctionPointer_HeroAgent_SearchTeammate(Agent* self, int range) { return (bool)((HeroAgent*)self)->_Execute_Method_<METHOD_TYPE_HeroAgent_SearchTeammate, bool, int >(range); }
|
||||
inline void FunctionPointer_HeroAgent_SendEmote(Agent* self, int emote) { ((HeroAgent*)self)->_Execute_Method_<METHOD_TYPE_HeroAgent_SendEmote, void, int >(emote); }
|
||||
@ -290,7 +287,6 @@ namespace behaviac
|
||||
inline void FunctionPointer_AndroidAgent_Abort(Agent* self, behaviac::string msg, behaviac::vector<int> args) { ((HeroAgent*)self)->_Execute_Method_<METHOD_TYPE_HeroAgent_Abort, void, behaviac::string, behaviac::vector<int> >(msg, args); }
|
||||
inline void FunctionPointer_AndroidAgent_AbortCoroutine(Agent* self, CoId_e co_id) { ((BaseAgent*)self)->_Execute_Method_<METHOD_TYPE_BaseAgent_AbortCoroutine, void, CoId_e >(co_id); }
|
||||
inline void FunctionPointer_AndroidAgent_BattleMove(Agent* self, glm::vec3& loc_point0) { } /* BattleMove */
|
||||
inline bool FunctionPointer_AndroidAgent_CanAttack(Agent* self) { return ((AndroidAgent*)self)->CanAttack(); }
|
||||
inline bool FunctionPointer_AndroidAgent_CanShot(Agent* self) { return ((AndroidAgent*)self)->CanShot(); }
|
||||
inline bool FunctionPointer_AndroidAgent_CanThrowItem(Agent* self, InventorySlot_e slot) { return (bool)((HeroAgent*)self)->_Execute_Method_<METHOD_TYPE_HeroAgent_CanThrowItem, bool, InventorySlot_e >(slot); }
|
||||
inline bool FunctionPointer_AndroidAgent_CanUseSkill(Agent* self, int skill_id) { return ((AndroidAgent*)self)->CanUseSkill(skill_id); }
|
||||
@ -316,7 +312,6 @@ 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(); }
|
||||
@ -388,7 +383,6 @@ namespace behaviac
|
||||
inline void FunctionPointer_AndroidAgent_RunAway(Agent* self, glm::vec3& loc_point0) { } /* RunAway */
|
||||
inline void FunctionPointer_AndroidAgent_RunGas(Agent* self, int loc_val0, int loc_val1, int loc_val2) { } /* RunGas */
|
||||
inline behaviac::EBTStatus FunctionPointer_AndroidAgent_SearchEnemy(Agent* self, float range) { return ((AndroidAgent*)self)->SearchEnemy(range); }
|
||||
inline behaviac::EBTStatus FunctionPointer_AndroidAgent_SearchHumanEnemy(Agent* self, int range) { return (behaviac::EBTStatus)((HeroAgent*)self)->_Execute_Method_<METHOD_TYPE_HeroAgent_SearchHumanEnemy, behaviac::EBTStatus, int >(range); }
|
||||
inline int FunctionPointer_AndroidAgent_SearchPickupObj(Agent* self) { return (int)((HeroAgent*)self)->_Execute_Method_<METHOD_TYPE_HeroAgent_SearchPickupObj, int >(); }
|
||||
inline bool FunctionPointer_AndroidAgent_SearchTeammate(Agent* self, int range) { return (bool)((HeroAgent*)self)->_Execute_Method_<METHOD_TYPE_HeroAgent_SearchTeammate, bool, int >(range); }
|
||||
inline void FunctionPointer_AndroidAgent_SendEmote(Agent* self, int emote) { ((HeroAgent*)self)->_Execute_Method_<METHOD_TYPE_HeroAgent_SendEmote, void, int >(emote); }
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--EXPORTED BY TOOL, DON'T MODIFY IT!-->
|
||||
<agents version="1" signature="2686576916">
|
||||
<agent type="HeroAgent" base="BaseAgent" signature="1955586164">
|
||||
<agents version="1" signature="2900147864">
|
||||
<agent type="HeroAgent" base="BaseAgent" signature="3488849203">
|
||||
<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="3669426665">
|
||||
<agent type="AndroidAgent" base="HeroAgent" signature="1894141024">
|
||||
<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" />
|
||||
|
@ -2,75 +2,67 @@
|
||||
<!--EXPORTED BY TOOL, DON'T MODIFY IT!-->
|
||||
<!--Source File: monster\8002_thief.xml-->
|
||||
<behavior name="monster/8002_thief" agenttype="HeroAgent" version="5">
|
||||
<node class="IfElse" id="19">
|
||||
<node class="Condition" id="20">
|
||||
<property Operator="Equal" />
|
||||
<property Opl="Self.HeroAgent::IsMobaMode()" />
|
||||
<property Opr="const bool true" />
|
||||
<node class="IfElse" id="6">
|
||||
<node class="Action" id="7">
|
||||
<property Method="Self.HeroAgent::SearchEnemy(300)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="Noop" id="21" />
|
||||
<node class="IfElse" id="6">
|
||||
<node class="Action" id="7">
|
||||
<property Method="Self.HeroAgent::SearchEnemy(300)" />
|
||||
<node class="SelectorProbability" id="8">
|
||||
<node class="DecoratorWeight" id="9">
|
||||
<property DecorateWhenChildEnds="false" />
|
||||
<property Weight="const int 80" />
|
||||
<node class="ReferencedBehavior" id="2">
|
||||
<property ReferenceBehavior="const string "task/RandomWalk"" />
|
||||
<property Task="Self.HeroAgent::RandomWalk(0,0,{x=0;y=0;z=0;})" />
|
||||
</node>
|
||||
</node>
|
||||
<node class="DecoratorWeight" id="1">
|
||||
<property DecorateWhenChildEnds="false" />
|
||||
<property Weight="const int 20" />
|
||||
<node class="Action" id="4">
|
||||
<property Method="Self.HeroAgent::CoIdle(2000,4000)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node class="IfElse" id="0">
|
||||
<node class="Action" id="3">
|
||||
<property Method="Self.HeroAgent::SearchEnemy(600)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="SelectorProbability" id="8">
|
||||
<node class="DecoratorWeight" id="9">
|
||||
<node class="SelectorProbability" id="5">
|
||||
<node class="DecoratorWeight" id="10">
|
||||
<property DecorateWhenChildEnds="false" />
|
||||
<property Weight="const int 80" />
|
||||
<node class="ReferencedBehavior" id="2">
|
||||
<property Weight="const int 30" />
|
||||
<node class="ReferencedBehavior" id="11">
|
||||
<property ReferenceBehavior="const string "task/RandomWalk"" />
|
||||
<property Task="Self.HeroAgent::RandomWalk(0,0,{x=0;y=0;z=0;})" />
|
||||
</node>
|
||||
</node>
|
||||
<node class="DecoratorWeight" id="1">
|
||||
<node class="DecoratorWeight" id="12">
|
||||
<property DecorateWhenChildEnds="false" />
|
||||
<property Weight="const int 20" />
|
||||
<node class="Action" id="4">
|
||||
<property Weight="const int 70" />
|
||||
<node class="Action" id="13">
|
||||
<property Method="Self.HeroAgent::CoIdle(2000,4000)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node class="IfElse" id="0">
|
||||
<node class="Action" id="3">
|
||||
<property Method="Self.HeroAgent::SearchEnemy(600)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="SelectorProbability" id="5">
|
||||
<node class="DecoratorWeight" id="10">
|
||||
<property DecorateWhenChildEnds="false" />
|
||||
<property Weight="const int 30" />
|
||||
<node class="ReferencedBehavior" id="11">
|
||||
<property ReferenceBehavior="const string "task/RandomWalk"" />
|
||||
<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 70" />
|
||||
<node class="Action" id="13">
|
||||
<property Method="Self.HeroAgent::CoIdle(2000,4000)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="SelectorProbability" id="14">
|
||||
<node class="DecoratorWeight" id="15">
|
||||
<property DecorateWhenChildEnds="false" />
|
||||
<property Weight="const int 10" />
|
||||
<node class="ReferencedBehavior" id="16">
|
||||
<property ReferenceBehavior="const string "task/RandomWalk"" />
|
||||
<property Task="Self.HeroAgent::RandomWalk(0,0,{x=0;y=0;z=0;})" />
|
||||
</node>
|
||||
</node>
|
||||
<node class="SelectorProbability" id="14">
|
||||
<node class="DecoratorWeight" id="15">
|
||||
<property DecorateWhenChildEnds="false" />
|
||||
<property Weight="const int 10" />
|
||||
<node class="ReferencedBehavior" id="16">
|
||||
<property ReferenceBehavior="const string "task/RandomWalk"" />
|
||||
<property Task="Self.HeroAgent::RandomWalk(0,0,{x=0;y=0;z=0;})" />
|
||||
</node>
|
||||
</node>
|
||||
<node class="DecoratorWeight" id="17">
|
||||
<property DecorateWhenChildEnds="false" />
|
||||
<property Weight="const int 90" />
|
||||
<node class="Action" id="18">
|
||||
<property Method="Self.HeroAgent::CoIdle(2000,4000)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="DecoratorWeight" id="17">
|
||||
<property DecorateWhenChildEnds="false" />
|
||||
<property Weight="const int 90" />
|
||||
<node class="Action" id="18">
|
||||
<property Method="Self.HeroAgent::CoIdle(2000,4000)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
@ -2,75 +2,67 @@
|
||||
<!--EXPORTED BY TOOL, DON'T MODIFY IT!-->
|
||||
<!--Source File: monster\8003_mystery_troop.xml-->
|
||||
<behavior name="monster/8003_mystery_troop" agenttype="HeroAgent" version="5">
|
||||
<node class="IfElse" id="19">
|
||||
<node class="Condition" id="20">
|
||||
<property Operator="Equal" />
|
||||
<property Opl="Self.HeroAgent::IsMobaMode()" />
|
||||
<property Opr="const bool true" />
|
||||
<node class="IfElse" id="6">
|
||||
<node class="Action" id="7">
|
||||
<property Method="Self.HeroAgent::SearchEnemy(300)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="Noop" id="21" />
|
||||
<node class="IfElse" id="6">
|
||||
<node class="Action" id="7">
|
||||
<property Method="Self.HeroAgent::SearchEnemy(300)" />
|
||||
<node class="SelectorProbability" id="8">
|
||||
<node class="DecoratorWeight" id="9">
|
||||
<property DecorateWhenChildEnds="false" />
|
||||
<property Weight="const int 70" />
|
||||
<node class="ReferencedBehavior" id="2">
|
||||
<property ReferenceBehavior="const string "task/RandomWalk"" />
|
||||
<property Task="Self.HeroAgent::RandomWalk(0,0,{x=0;y=0;z=0;})" />
|
||||
</node>
|
||||
</node>
|
||||
<node class="DecoratorWeight" id="1">
|
||||
<property DecorateWhenChildEnds="false" />
|
||||
<property Weight="const int 30" />
|
||||
<node class="Action" id="4">
|
||||
<property Method="Self.HeroAgent::CoIdle(2000,4000)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node class="IfElse" id="0">
|
||||
<node class="Action" id="3">
|
||||
<property Method="Self.HeroAgent::SearchEnemy(600)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="SelectorProbability" id="8">
|
||||
<node class="DecoratorWeight" id="9">
|
||||
<node class="SelectorProbability" id="5">
|
||||
<node class="DecoratorWeight" id="10">
|
||||
<property DecorateWhenChildEnds="false" />
|
||||
<property Weight="const int 70" />
|
||||
<node class="ReferencedBehavior" id="2">
|
||||
<property Weight="const int 30" />
|
||||
<node class="ReferencedBehavior" id="11">
|
||||
<property ReferenceBehavior="const string "task/RandomWalk"" />
|
||||
<property Task="Self.HeroAgent::RandomWalk(0,0,{x=0;y=0;z=0;})" />
|
||||
</node>
|
||||
</node>
|
||||
<node class="DecoratorWeight" id="1">
|
||||
<node class="DecoratorWeight" id="12">
|
||||
<property DecorateWhenChildEnds="false" />
|
||||
<property Weight="const int 30" />
|
||||
<node class="Action" id="4">
|
||||
<property Weight="const int 70" />
|
||||
<node class="Action" id="13">
|
||||
<property Method="Self.HeroAgent::CoIdle(2000,4000)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node class="IfElse" id="0">
|
||||
<node class="Action" id="3">
|
||||
<property Method="Self.HeroAgent::SearchEnemy(600)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="SelectorProbability" id="5">
|
||||
<node class="DecoratorWeight" id="10">
|
||||
<property DecorateWhenChildEnds="false" />
|
||||
<property Weight="const int 30" />
|
||||
<node class="ReferencedBehavior" id="11">
|
||||
<property ReferenceBehavior="const string "task/RandomWalk"" />
|
||||
<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 70" />
|
||||
<node class="Action" id="13">
|
||||
<property Method="Self.HeroAgent::CoIdle(2000,4000)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="SelectorProbability" id="14">
|
||||
<node class="DecoratorWeight" id="15">
|
||||
<property DecorateWhenChildEnds="false" />
|
||||
<property Weight="const int 10" />
|
||||
<node class="ReferencedBehavior" id="16">
|
||||
<property ReferenceBehavior="const string "task/RandomWalk"" />
|
||||
<property Task="Self.HeroAgent::RandomWalk(0,0,{x=0;y=0;z=0;})" />
|
||||
</node>
|
||||
</node>
|
||||
<node class="SelectorProbability" id="14">
|
||||
<node class="DecoratorWeight" id="15">
|
||||
<property DecorateWhenChildEnds="false" />
|
||||
<property Weight="const int 10" />
|
||||
<node class="ReferencedBehavior" id="16">
|
||||
<property ReferenceBehavior="const string "task/RandomWalk"" />
|
||||
<property Task="Self.HeroAgent::RandomWalk(0,0,{x=0;y=0;z=0;})" />
|
||||
</node>
|
||||
</node>
|
||||
<node class="DecoratorWeight" id="17">
|
||||
<property DecorateWhenChildEnds="false" />
|
||||
<property Weight="const int 90" />
|
||||
<node class="Action" id="18">
|
||||
<property Method="Self.HeroAgent::CoIdle(2000,4000)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="DecoratorWeight" id="17">
|
||||
<property DecorateWhenChildEnds="false" />
|
||||
<property Weight="const int 90" />
|
||||
<node class="Action" id="18">
|
||||
<property Method="Self.HeroAgent::CoIdle(2000,4000)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
@ -11,13 +11,8 @@
|
||||
<property Prototype="Self.HeroAgent::UseSkill30100(0,0,0)" />
|
||||
<property IsHTN="false" />
|
||||
<node class="Sequence" id="1">
|
||||
<node class="SelectorStochastic" id="2">
|
||||
<node class="Selector" id="2">
|
||||
<node class="Sequence" id="3">
|
||||
<node class="Condition" id="12">
|
||||
<property Operator="Equal" />
|
||||
<property Opl="Self.HeroAgent::SearchEnemy(180)" />
|
||||
<property Opr="const behaviac::EBTStatus BT_SUCCESS" />
|
||||
</node>
|
||||
<node class="Condition" id="4">
|
||||
<property Operator="Equal" />
|
||||
<property Opl="Self.HeroAgent::CanUseSkill(60101)" />
|
||||
@ -29,11 +24,6 @@
|
||||
</node>
|
||||
</node>
|
||||
<node class="Sequence" id="6">
|
||||
<node class="Condition" id="13">
|
||||
<property Operator="Equal" />
|
||||
<property Opl="Self.HeroAgent::SearchEnemy(220)" />
|
||||
<property Opr="const behaviac::EBTStatus BT_SUCCESS" />
|
||||
</node>
|
||||
<node class="Condition" id="7">
|
||||
<property Operator="Equal" />
|
||||
<property Opl="Self.HeroAgent::CanUseSkill(60121)" />
|
||||
@ -45,25 +35,11 @@
|
||||
</node>
|
||||
</node>
|
||||
<node class="Sequence" id="9">
|
||||
<node class="Condition" id="14">
|
||||
<property Operator="Equal" />
|
||||
<property Opl="Self.HeroAgent::SearchEnemy(500)" />
|
||||
<property Opr="const behaviac::EBTStatus BT_SUCCESS" />
|
||||
</node>
|
||||
<node class="Condition" id="10">
|
||||
<property Operator="Equal" />
|
||||
<property Opl="Self.HeroAgent::CanUseSkill(60111)" />
|
||||
<property Opr="const bool true" />
|
||||
</node>
|
||||
<node class="Assignment" id="15">
|
||||
<property CastRight="false" />
|
||||
<property Opl="glm::vec3 Self.HeroAgent::tmp_point1" />
|
||||
<property Opr="Self.HeroAgent::GetTargetDir()" />
|
||||
</node>
|
||||
<node class="Action" id="16">
|
||||
<property Method="Self.HeroAgent::SetAttackDir(glm::vec3 Self.HeroAgent::tmp_point0)" />
|
||||
<property ResultOption="BT_SUCCESS" />
|
||||
</node>
|
||||
<node class="Action" id="11">
|
||||
<property Method="Self.HeroAgent::CoUseSkill(60111)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
|
@ -50,21 +50,6 @@
|
||||
</node>
|
||||
<node class="True" id="107" />
|
||||
</node>
|
||||
<node class="IfElse" id="118">
|
||||
<node class="Condition" id="120">
|
||||
<property Operator="Equal" />
|
||||
<property Opl="Self.HeroAgent::CanAttack()" />
|
||||
<property Opr="const bool true" />
|
||||
</node>
|
||||
<node class="True" id="121" />
|
||||
<node class="Sequence" id="122">
|
||||
<node class="Action" id="123">
|
||||
<property Method="current_target_agent.TargetAgent::Abandon(0,0)" />
|
||||
<property ResultOption="BT_SUCCESS" />
|
||||
</node>
|
||||
<node class="False" id="124" />
|
||||
</node>
|
||||
</node>
|
||||
<node class="Selector" id="100">
|
||||
<node class="IfElse" id="9">
|
||||
<node class="Condition" id="10">
|
||||
|
@ -32,73 +32,40 @@
|
||||
<property ReferenceBehavior="const string "task/RunGas"" />
|
||||
<property Task="Self.HeroAgent::RunGas(0,0,0)" />
|
||||
</node>
|
||||
<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="26">
|
||||
<node class="Condition" id="27">
|
||||
<property Operator="Equal" />
|
||||
<property Opl="Self.HeroAgent::CanAttack()" />
|
||||
<property Opr="const bool false" />
|
||||
<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 "task/ChaseToKill"" />
|
||||
<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 "task/RandomWalk"" />
|
||||
<property Task="Self.HeroAgent::RandomWalk(0,0,{x=0;y=0;z=0;})" />
|
||||
</node>
|
||||
<node class="IfElse" id="34">
|
||||
<node class="Condition" id="35">
|
||||
<property Operator="Equal" />
|
||||
<property Opl="Self.HeroAgent::IsMoving()" />
|
||||
<property Opr="const bool false" />
|
||||
</node>
|
||||
<node class="SelectorProbability" id="28">
|
||||
<node class="DecoratorWeight" id="29">
|
||||
<property DecorateWhenChildEnds="false" />
|
||||
<property Weight="const int 50" />
|
||||
<node class="ReferencedBehavior" id="30">
|
||||
<property ReferenceBehavior="const string "task/RandomWalk"" />
|
||||
<property Task="Self.HeroAgent::RandomWalk(0,0,{x=0;y=0;z=0;})" />
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node class="True" id="36" />
|
||||
</node>
|
||||
<node class="DecoratorWeight" id="12">
|
||||
<property DecorateWhenChildEnds="false" />
|
||||
<property Weight="const int 100" />
|
||||
<node class="ReferencedBehavior" id="13">
|
||||
<property ReferenceBehavior="const string "task/RandomShot"" />
|
||||
<property Task="Self.HeroAgent::RandomShot(0,0,{x=0;y=0;z=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 "task/ChaseToKill"" />
|
||||
<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 "task/RandomWalk"" />
|
||||
<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 0" />
|
||||
<node class="ReferencedBehavior" id="13">
|
||||
<property ReferenceBehavior="const string "task/RandomShot"" />
|
||||
<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(1000,4000)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</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>
|
||||
|
@ -1,76 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--EXPORTED BY TOOL, DON'T MODIFY IT!-->
|
||||
<!--Source File: task\ChiJiMode_0.xml-->
|
||||
<behavior name="task/ChiJiMode_0" agenttype="HeroAgent" version="5">
|
||||
<pars>
|
||||
<par name="_$local_task_param_$_0" type="int" value="0" />
|
||||
<par name="loc_val0" type="int" value="0" />
|
||||
<par name="loc_val1" type="int" value="0" />
|
||||
</pars>
|
||||
<node class="Task" id="0">
|
||||
<property Prototype="Self.HeroAgent::ChiMode()" />
|
||||
<property IsHTN="false" />
|
||||
<node class="IfElse" id="1">
|
||||
<node class="Sequence" id="2">
|
||||
<node class="Assignment" id="16">
|
||||
<property CastRight="true" />
|
||||
<property Opl="float Self.HeroAgent::tmp_val0" />
|
||||
<property Opr="Self.BaseAgent::RandRange(25,150)" />
|
||||
</node>
|
||||
<node class="Condition" id="4">
|
||||
<property Operator="Equal" />
|
||||
<property Opl="Self.HeroAgent::IsNearGas(float Self.HeroAgent::tmp_val0)" />
|
||||
<property Opr="const bool true" />
|
||||
</node>
|
||||
<node class="Condition" id="5">
|
||||
<property Operator="GreaterEqual" />
|
||||
<property Opl="Self.HeroAgent::GetSafeAreaRadius()" />
|
||||
<property Opr="const float 500" />
|
||||
</node>
|
||||
</node>
|
||||
<node class="ReferencedBehavior" id="3">
|
||||
<property ReferenceBehavior="const string "task/RunGas"" />
|
||||
<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 "task/ChaseToKill"" />
|
||||
<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 "task/RandomWalk"" />
|
||||
<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 "task/RandomShot"" />
|
||||
<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>
|
||||
</node>
|
||||
</behavior>
|
@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--EXPORTED BY TOOL, DON'T MODIFY IT!-->
|
||||
<!--Source File: task\Follow.xml-->
|
||||
<behavior name="task/Follow" agenttype="HeroAgent" version="5">
|
||||
<node class="Sequence" id="0">
|
||||
<node class="Assignment" id="1">
|
||||
<property CastRight="false" />
|
||||
<property Opl="glm::vec3 current_teammate_agent.TeammateAgent::tmp_point0" />
|
||||
<property Opr="current_teammate_agent.TeammateAgent::GetPos()" />
|
||||
</node>
|
||||
<node class="Action" id="2">
|
||||
<property Method="Self.HeroAgent::CoFindPathEx(glm::vec3 current_teammate_agent.TeammateAgent::tmp_point0,60)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="Action" id="3">
|
||||
<property Method="Self.HeroAgent::DebugOut("ddddd跟随队友",0,0,0)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
</node>
|
||||
</behavior>
|
@ -1,54 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--EXPORTED BY TOOL, DON'T MODIFY IT!-->
|
||||
<!--Source File: task\FollowTeammate.xml-->
|
||||
<behavior name="task/FollowTeammate" agenttype="HeroAgent" version="5">
|
||||
<pars>
|
||||
<par name="_$local_task_param_$_0" type="glm::vec3" value="{x=0;y=0;z=0;}" />
|
||||
<par name="_$local_task_param_$_1" type="float" value="0" />
|
||||
</pars>
|
||||
<node class="Task" id="4">
|
||||
<property Prototype="Self.HeroAgent::FollowTeammate({x=0;y=0;z=0;},0)" />
|
||||
<property IsHTN="false" />
|
||||
<node class="Sequence" id="0">
|
||||
<node class="Action" id="7">
|
||||
<property Method="Self.HeroAgent::DebugOut("ddddd开始跟随",0,0,0)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="Condition" id="6">
|
||||
<property Operator="Equal" />
|
||||
<property Opl="current_teammate_agent.TeammateAgent::IsValid()" />
|
||||
<property Opr="const bool true" />
|
||||
</node>
|
||||
<node class="Action" id="8">
|
||||
<property Method="Self.HeroAgent::DebugOut("跟随2",0,0,0)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="Assignment" id="1">
|
||||
<property CastRight="false" />
|
||||
<property Opl="glm::vec3 Self.HeroAgent::_$local_task_param_$_0" />
|
||||
<property Opr="current_teammate_agent.TeammateAgent::GetPos()" />
|
||||
</node>
|
||||
<node class="Action" id="9">
|
||||
<property Method="Self.HeroAgent::DebugOut("跟随3",0,0,0)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="Assignment" id="5">
|
||||
<property CastRight="false" />
|
||||
<property Opl="float Self.HeroAgent::_$local_task_param_$_1" />
|
||||
<property Opr="Self.BaseAgent::RandRangeAsFloat(120,150)" />
|
||||
</node>
|
||||
<node class="Action" id="10">
|
||||
<property Method="Self.HeroAgent::DebugOut("跟随4",0,0,0)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="Action" id="2">
|
||||
<property Method="Self.HeroAgent::CoFindPathEx(glm::vec3 Self.HeroAgent::_$local_task_param_$_0,float Self.HeroAgent::_$local_task_param_$_1)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="Action" id="3">
|
||||
<property Method="Self.HeroAgent::DebugOut("ddddd跟随队友",0,0,0)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</behavior>
|
@ -27,92 +27,62 @@
|
||||
<property Method="Self.HeroAgent::RegisterEvents(1:kMobaModeReviveEvent)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="IfElse" id="33">
|
||||
<node class="Condition" id="34">
|
||||
<node class="IfElse" id="6">
|
||||
<node class="Condition" id="7">
|
||||
<property Operator="Equal" />
|
||||
<property Opl="Self.HeroAgent::CanAttack()" />
|
||||
<property Opr="const bool false" />
|
||||
<property Opl="Self.HeroAgent::SearchEnemy(500)" />
|
||||
<property Opr="const behaviac::EBTStatus BT_SUCCESS" />
|
||||
</node>
|
||||
<node class="IfElse" id="15">
|
||||
<node class="Condition" id="35">
|
||||
<property Operator="Equal" />
|
||||
<property Opl="Self.HeroAgent::IsMoving()" />
|
||||
<property Opr="const bool true" />
|
||||
</node>
|
||||
<node class="True" id="36" />
|
||||
<node class="SelectorProbability" id="37">
|
||||
<node class="DecoratorWeight" id="38">
|
||||
<property DecorateWhenChildEnds="false" />
|
||||
<property Weight="const int 50" />
|
||||
<node class="ReferencedBehavior" id="39">
|
||||
<property ReferenceBehavior="const string "task/RandomWalk"" />
|
||||
<property Task="Self.HeroAgent::RandomWalk(0,0,{x=0;y=0;z=0;})" />
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
<node class="ReferencedBehavior" id="8">
|
||||
<property ReferenceBehavior="const string "task/ChaseToKill"" />
|
||||
<property Task="Self.HeroAgent::ChaseToKill(0,0,0)" />
|
||||
</node>
|
||||
<node class="IfElse" id="6">
|
||||
<node class="Or" id="7">
|
||||
<node class="Condition" id="40">
|
||||
<property Operator="Equal" />
|
||||
<property Opl="Self.HeroAgent::SearchHumanEnemy(500)" />
|
||||
<property Opr="const behaviac::EBTStatus BT_SUCCESS" />
|
||||
</node>
|
||||
<node class="Condition" id="41">
|
||||
<property Operator="Equal" />
|
||||
<property Opl="Self.HeroAgent::SearchEnemy(500)" />
|
||||
<property Opr="const behaviac::EBTStatus BT_SUCCESS" />
|
||||
</node>
|
||||
<node class="Sequence" id="4">
|
||||
<node class="Action" id="5">
|
||||
<property Method="Self.HeroAgent::CoGetNextMobaModeRoadPoint()" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="ReferencedBehavior" id="8">
|
||||
<property ReferenceBehavior="const string "task/ChaseToKill"" />
|
||||
<property Task="Self.HeroAgent::ChaseToKill(0,0,0)" />
|
||||
</node>
|
||||
<node class="Sequence" id="4">
|
||||
<node class="Action" id="5">
|
||||
<property Method="Self.HeroAgent::CoGetNextMobaModeRoadPoint()" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
<node class="Sequence" id="21">
|
||||
<node class="Assignment" id="22">
|
||||
<property CastRight="false" />
|
||||
<property Opl="int Self.HeroAgent::_$local_task_param_$_1" />
|
||||
<property Opr="Self.BaseAgent::GetTickCount()" />
|
||||
</node>
|
||||
<node class="Sequence" id="21">
|
||||
<node class="Assignment" id="22">
|
||||
<property CastRight="false" />
|
||||
<property Opl="int Self.HeroAgent::_$local_task_param_$_1" />
|
||||
<property Opr="Self.BaseAgent::GetTickCount()" />
|
||||
<node class="Parallel" id="9">
|
||||
<property ChildFinishPolicy="CHILDFINISH_ONCE" />
|
||||
<property ExitPolicy="EXIT_NONE" />
|
||||
<property FailurePolicy="FAIL_ON_ONE" />
|
||||
<property SuccessPolicy="SUCCEED_ON_ONE" />
|
||||
<node class="Action" id="10">
|
||||
<property Method="Self.HeroAgent::CoFindPath(glm::vec3 Self.HeroAgent::out_point0)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
<attachment class="Precondition" id="11" flag="precondition">
|
||||
<property BinaryOperator="And" />
|
||||
<property Operator="Assign" />
|
||||
<property Opl="int Self.HeroAgent::_$local_task_param_$_0" />
|
||||
<property Opr2="const int 0" />
|
||||
<property Phase="Enter" />
|
||||
</attachment>
|
||||
<attachment class="Effector" id="12" flag="effector">
|
||||
<property Operator="Assign" />
|
||||
<property Opl="int Self.HeroAgent::_$local_task_param_$_0" />
|
||||
<property Opr2="const int 1" />
|
||||
<property Phase="Both" />
|
||||
</attachment>
|
||||
</node>
|
||||
<node class="Parallel" id="9">
|
||||
<property ChildFinishPolicy="CHILDFINISH_LOOP" />
|
||||
<property ExitPolicy="EXIT_NONE" />
|
||||
<property FailurePolicy="FAIL_ON_ONE" />
|
||||
<property SuccessPolicy="SUCCEED_ON_ONE" />
|
||||
<node class="Action" id="10">
|
||||
<property Method="Self.HeroAgent::CoFindPath(glm::vec3 Self.HeroAgent::out_point0)" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
<attachment class="Precondition" id="11" flag="precondition">
|
||||
<property BinaryOperator="And" />
|
||||
<property Operator="Assign" />
|
||||
<property Opl="int Self.HeroAgent::_$local_task_param_$_0" />
|
||||
<property Opr2="const int 0" />
|
||||
<property Phase="Enter" />
|
||||
</attachment>
|
||||
<attachment class="Effector" id="12" flag="effector">
|
||||
<property Operator="Assign" />
|
||||
<property Opl="int Self.HeroAgent::_$local_task_param_$_0" />
|
||||
<property Opr2="const int 1" />
|
||||
<property Phase="Both" />
|
||||
</attachment>
|
||||
</node>
|
||||
<node class="DecoratorLoop" id="13">
|
||||
<property Count="const int -1" />
|
||||
<property DecorateWhenChildEnds="true" />
|
||||
<property DoneWithinFrame="false" />
|
||||
<attachment class="Precondition" id="14" flag="precondition">
|
||||
<property BinaryOperator="And" />
|
||||
<property Operator="Equal" />
|
||||
<property Opl="int Self.HeroAgent::_$local_task_param_$_0" />
|
||||
<property Opr2="const int 0" />
|
||||
<property Phase="Both" />
|
||||
</attachment>
|
||||
<node class="Sequence" id="16">
|
||||
<node class="DecoratorLoop" id="13">
|
||||
<property Count="const int -1" />
|
||||
<property DecorateWhenChildEnds="true" />
|
||||
<property DoneWithinFrame="false" />
|
||||
<attachment class="Precondition" id="14" flag="precondition">
|
||||
<property BinaryOperator="And" />
|
||||
<property Operator="Equal" />
|
||||
<property Opl="int Self.HeroAgent::_$local_task_param_$_0" />
|
||||
<property Opr2="const int 0" />
|
||||
<property Phase="Both" />
|
||||
</attachment>
|
||||
<node class="Sequence" id="16">
|
||||
<node class="IfElse" id="15">
|
||||
<node class="Condition" id="17">
|
||||
<property Operator="Greater" />
|
||||
<property Opl="Self.BaseAgent::DeltaTime(int Self.HeroAgent::_$local_task_param_$_1)" />
|
||||
@ -135,15 +105,15 @@
|
||||
</node>
|
||||
</node>
|
||||
<node class="False" id="23" />
|
||||
<node class="Assignment" id="19">
|
||||
<property CastRight="false" />
|
||||
<property Opl="int Self.HeroAgent::_$local_task_param_$_0" />
|
||||
<property Opr="const int 1" />
|
||||
</node>
|
||||
<node class="Action" id="20">
|
||||
<property Method="Self.BaseAgent::AbortCoroutine(kCoFindPath)" />
|
||||
<property ResultOption="BT_SUCCESS" />
|
||||
</node>
|
||||
</node>
|
||||
<node class="Assignment" id="19">
|
||||
<property CastRight="false" />
|
||||
<property Opl="int Self.HeroAgent::_$local_task_param_$_0" />
|
||||
<property Opr="const int 1" />
|
||||
</node>
|
||||
<node class="Action" id="20">
|
||||
<property Method="Self.BaseAgent::AbortCoroutine(kCoFindPath)" />
|
||||
<property ResultOption="BT_SUCCESS" />
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
|
@ -3,7 +3,7 @@
|
||||
#source /etc/profile
|
||||
#source /root/.bash_profile
|
||||
|
||||
pid=$(ps -ef|grep "gameserver2006 -z 1 -n $2 -i $1"|grep -v grep|awk '{print $2}')
|
||||
pid=$(ps -ef|grep "gameserver2006 -n $2 -i $1"|grep -v grep|awk '{print $2}')
|
||||
echo $pid
|
||||
|
||||
if [[ $pid != "" ]]
|
||||
@ -13,4 +13,4 @@ else
|
||||
echo "pid 为空"
|
||||
fi
|
||||
|
||||
nohup ./gameserver2006 -z 1 -n $2 -i $1 >> gameserver2006$2_$1.out 2>$1 &
|
||||
nohup ./gameserver2006 -n $2 -i $1 >> gameserver2006$2_$1.out 2>$1 &
|
||||
|
@ -1,4 +1,3 @@
|
||||
{
|
||||
"api_url": "https://game2006api-test.kingsome.cn/webapp/index.php",
|
||||
"api_secret_key": "BIgDh5J%uUktooKxT!IM7#m$NtB51%la"
|
||||
"api_url": "https://game2006api-test.kingsome.cn/webapp/index.php"
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
[
|
||||
{
|
||||
"url": "http://192.168.100.21:8321/webapp/index.php"
|
||||
}
|
||||
{
|
||||
"url": "http://127.0.0.1:8321/webapp/index.php?c=Proxy&a=get"
|
||||
}
|
||||
]
|
||||
|
@ -1,12 +1,7 @@
|
||||
[
|
||||
{
|
||||
"instance_id": 1,
|
||||
"ip": "192.168.100.45",
|
||||
"listen_port": 7621
|
||||
},
|
||||
{
|
||||
"instance_id": 2,
|
||||
"ip": "192.168.100.21",
|
||||
"ip": "127.0.0.1",
|
||||
"listen_port": 7621
|
||||
}
|
||||
]
|
||||
|
@ -1,4 +1,3 @@
|
||||
{
|
||||
"api_url": "https://game2006api-test.kingsome.cn/webapp/index.php",
|
||||
"api_secret_key": "BIgDh5J%uUktooKxT!IM7#m$NtB51%la"
|
||||
"api_url": "https://game2006api-test.kingsome.cn/webapp/index.php"
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
[
|
||||
{
|
||||
"url": "http://127.0.0.1:8321/webapp/index.php"
|
||||
"url": "http://127.0.0.1:8321/webapp/index.php?c=Proxy&a=get"
|
||||
}
|
||||
]
|
||||
|
@ -1 +0,0 @@
|
||||
../bt/exported
|
@ -1,28 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Behavior Version="5" NoError="true">
|
||||
<Node Class="Behaviac.Design.Nodes.Behavior" AgentType="AndroidAgent" Domains="" Enable="true" HasOwnPrefabData="false" Id="-1" PrefabName="" PrefabNodeId="-1">
|
||||
<Comment Background="NoColor" Text="" />
|
||||
<DescriptorRefs value="0:" />
|
||||
<Connector Identifier="GenericChildren">
|
||||
<Node Class="PluginBehaviac.Nodes.Sequence" Enable="true" HasOwnPrefabData="false" Id="0" PrefabName="" PrefabNodeId="-1">
|
||||
<Comment Background="NoColor" Text="" />
|
||||
<Connector Identifier="GenericChildren">
|
||||
<Node Class="PluginBehaviac.Nodes.Action" Enable="true" HasOwnPrefabData="false" Id="1" Method="Self.AndroidAgent::CoConnectBattleServer()" PrefabName="" PrefabNodeId="-1" ResultFunctor="""" ResultOption="BT_INVALID">
|
||||
<Comment Background="NoColor" Text="" />
|
||||
</Node>
|
||||
<Node Class="PluginBehaviac.Nodes.Action" Enable="true" HasOwnPrefabData="false" Id="2" Method="Self.AndroidAgent::CoJoin()" PrefabName="" PrefabNodeId="-1" ResultFunctor="""" ResultOption="BT_INVALID">
|
||||
<Comment Background="NoColor" Text="" />
|
||||
</Node>
|
||||
<Node Class="PluginBehaviac.Nodes.DecoratorLoop" Count="const int -1" DecorateWhenChildEnds="true" DoneWithinFrame="false" Enable="true" HasOwnPrefabData="false" Id="3" PrefabName="" PrefabNodeId="-1">
|
||||
<Comment Background="NoColor" Text="" />
|
||||
<Connector Identifier="GenericChildren">
|
||||
<Node Class="PluginBehaviac.Nodes.Action" Enable="true" HasOwnPrefabData="false" Id="6" Method="Self.AndroidAgent::CoUpdateGame()" PrefabName="" PrefabNodeId="-1" ResultFunctor="""" ResultOption="BT_INVALID">
|
||||
<Comment Background="NoColor" Text="" />
|
||||
</Node>
|
||||
</Connector>
|
||||
</Node>
|
||||
</Connector>
|
||||
</Node>
|
||||
</Connector>
|
||||
</Node>
|
||||
</Behavior>
|
@ -1,27 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Behavior Version="5">
|
||||
<Node Class="Behaviac.Design.Nodes.Behavior" AgentType="AndroidAgent" Domains="" Enable="true" HasOwnPrefabData="false" Id="-1" PrefabName="" PrefabNodeId="-1">
|
||||
<Comment Background="NoColor" Text="" />
|
||||
<DescriptorRefs value="0:" />
|
||||
<Connector Identifier="GenericChildren">
|
||||
<Node Class="PluginBehaviac.Nodes.IfElse" Enable="true" HasOwnPrefabData="false" Id="0" PrefabName="" PrefabNodeId="-1">
|
||||
<Comment Background="NoColor" Text="" />
|
||||
<Connector Identifier="_condition">
|
||||
<Node Class="PluginBehaviac.Nodes.Condition" Enable="true" HasOwnPrefabData="false" Id="1" Operator="Equal" Opl="Self.AndroidAgent::IsLoginSuccess()" Opr="const bool true" PrefabName="" PrefabNodeId="-1">
|
||||
<Comment Background="NoColor" Text="" />
|
||||
</Node>
|
||||
</Connector>
|
||||
<Connector Identifier="_if">
|
||||
<Node Class="Behaviac.Design.Nodes.ReferencedBehavior" Enable="true" HasOwnPrefabData="false" Id="3" PrefabName="" PrefabNodeId="-1" ReferenceBehavior="const string "android/battle"" Task="""">
|
||||
<Comment Background="Gray" Text="" />
|
||||
</Node>
|
||||
</Connector>
|
||||
<Connector Identifier="_else">
|
||||
<Node Class="PluginBehaviac.Nodes.Action" Enable="true" HasOwnPrefabData="false" Id="2" Method="Self.AndroidAgent::CoLogin()" PrefabName="" PrefabNodeId="-1" ResultFunctor="""" ResultOption="BT_INVALID">
|
||||
<Comment Background="NoColor" Text="" />
|
||||
</Node>
|
||||
</Connector>
|
||||
</Node>
|
||||
</Connector>
|
||||
</Node>
|
||||
</Behavior>
|
@ -1,64 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<meta>
|
||||
<types />
|
||||
<agents>
|
||||
<agent classfullname="behaviac::Agent" DisplayName="behaviac::Agent" Desc="behaviac::Agent" IsRefType="true" IsImplemented="true">
|
||||
<Method Name="VectorLength" DisplayName="VectorLength" Desc="VectorLength" Class="behaviac::Agent" ReturnType="int" ReturnTypeFullName="System.Int32" Static="true" Public="true" istask="false">
|
||||
<Param Name="param0" Type="const IList&" TypeFullName="System.Collections.IList" DisplayName="param0" Desc="param0" />
|
||||
</Method>
|
||||
<Method Name="VectorAdd" DisplayName="VectorAdd" Desc="VectorAdd" Class="behaviac::Agent" ReturnType="void" ReturnTypeFullName="System.Void" Static="true" Public="true" istask="false">
|
||||
<Param Name="param0" Type="IList&" TypeFullName="System.Collections.IList" DisplayName="param0" Desc="param0" />
|
||||
<Param Name="param1" Type="const System::Object&" TypeFullName="System.Object" DisplayName="param1" Desc="param1" />
|
||||
</Method>
|
||||
<Method Name="VectorRemove" DisplayName="VectorRemove" Desc="VectorRemove" Class="behaviac::Agent" ReturnType="void" ReturnTypeFullName="System.Void" Static="true" Public="true" istask="false">
|
||||
<Param Name="param0" Type="IList&" TypeFullName="System.Collections.IList" DisplayName="param0" Desc="param0" />
|
||||
<Param Name="param1" Type="const System::Object&" TypeFullName="System.Object" DisplayName="param1" Desc="param1" />
|
||||
</Method>
|
||||
<Method Name="VectorContains" DisplayName="VectorContains" Desc="VectorContains" Class="behaviac::Agent" ReturnType="bool" ReturnTypeFullName="System.Boolean" Static="true" Public="true" istask="false">
|
||||
<Param Name="param0" Type="IList&" TypeFullName="System.Collections.IList" DisplayName="param0" Desc="param0" />
|
||||
<Param Name="param1" Type="const System::Object&" TypeFullName="System.Object" DisplayName="param1" Desc="param1" />
|
||||
</Method>
|
||||
<Method Name="VectorClear" DisplayName="VectorClear" Desc="VectorClear" Class="behaviac::Agent" ReturnType="void" ReturnTypeFullName="System.Void" Static="true" Public="true" istask="false">
|
||||
<Param Name="param0" Type="IList&" TypeFullName="System.Collections.IList" DisplayName="param0" Desc="param0" />
|
||||
</Method>
|
||||
<Method Name="LogMessage" DisplayName="LogMessage" Desc="LogMessage" Class="behaviac::Agent" ReturnType="void" ReturnTypeFullName="System.Void" Static="true" Public="true" istask="false">
|
||||
<Param Name="param0" Type="const char*" TypeFullName="System.String" DisplayName="param0" Desc="param0" />
|
||||
</Method>
|
||||
</agent>
|
||||
<agent classfullname="BaseAgent" base="behaviac::Agent" DisplayName="BaseAgent" Desc="BaseAgent" IsRefType="true" IsCustomized="true" IsImplemented="true">
|
||||
<Method Name="GetTickCount" DisplayName="GetTickCount" Desc="GetTickCount" Class="BaseAgent" ReturnType="int" ReturnTypeFullName="System.Int32" Static="false" Public="false" istask="false" />
|
||||
<Method Name="RandRange" DisplayName="RandRange" Desc="RandRange" Class="BaseAgent" ReturnType="int" ReturnTypeFullName="System.Int32" Static="false" Public="false" istask="false">
|
||||
<Param Name="min_val" Type="int" TypeFullName="System.Int32" DisplayName="min_val" Desc="min_val" />
|
||||
<Param Name="max_val" Type="int" TypeFullName="System.Int32" DisplayName="max_val" Desc="max_val" />
|
||||
</Method>
|
||||
<Method Name="RandRangeAsFloat" DisplayName="RandRangeAsFloat" Desc="RandRangeAsFloat" Class="BaseAgent" ReturnType="float" ReturnTypeFullName="System.Single" Static="false" Public="false" istask="false">
|
||||
<Param Name="min_val" Type="float" TypeFullName="System.Single" DisplayName="min_val" Desc="min_val" />
|
||||
<Param Name="max_val" Type="float" TypeFullName="System.Single" DisplayName="max_val" Desc="max_val" />
|
||||
</Method>
|
||||
<Method Name="Rand" DisplayName="Rand" Desc="Rand" Class="BaseAgent" ReturnType="int" ReturnTypeFullName="System.Int32" Static="false" Public="false" istask="false" />
|
||||
<Method Name="DeltaTime" DisplayName="DeltaTime" Desc="DeltaTime" Class="BaseAgent" ReturnType="int" ReturnTypeFullName="System.Int32" Static="false" Public="false" istask="false">
|
||||
<Param Name="time" Type="int" TypeFullName="System.Int32" DisplayName="time" Desc="time" />
|
||||
</Method>
|
||||
<Method Name="AbortCoroutine" DisplayName="AbortCoroutine" Desc="AbortCoroutine" Class="BaseAgent" ReturnType="void" ReturnTypeFullName="System.Void" Static="false" Public="false" istask="false">
|
||||
<Param Name="co_id" Type="int" TypeFullName="System.Int32" DisplayName="co_id" Desc="co_id" />
|
||||
</Method>
|
||||
</agent>
|
||||
<agent classfullname="AndroidAgent" base="BaseAgent" DisplayName="AndroidAgent" Desc="AndroidAgent" IsRefType="true" IsCustomized="true" IsImplemented="true">
|
||||
<Method Name="IsLoginSuccess" DisplayName="IsLoginSuccess" Desc="IsLoginSuccess" Class="AndroidAgent" ReturnType="bool" ReturnTypeFullName="System.Boolean" Static="false" Public="false" istask="false" />
|
||||
<Method Name="SearchEnemy" DisplayName="SearchEnemy" Desc="SearchEnemy" Class="AndroidAgent" ReturnType="behaviac::EBTStatus" ReturnTypeFullName="XMLPluginBehaviac.behaviac_EBTStatus" Static="false" Public="false" istask="false">
|
||||
<Param Name="range" Type="int" TypeFullName="System.Int32" DisplayName="range" Desc="range" />
|
||||
</Method>
|
||||
<Method Name="NetIsConnected" DisplayName="NetIsConnected" Desc="NetIsConnected" Class="AndroidAgent" ReturnType="bool" ReturnTypeFullName="System.Boolean" Static="false" Public="false" istask="false" />
|
||||
<Method Name="CoIdle" DisplayName="CoIdle" Desc="CoIdle" Class="AndroidAgent" ReturnType="behaviac::EBTStatus" ReturnTypeFullName="XMLPluginBehaviac.behaviac_EBTStatus" Static="false" Public="false" istask="false">
|
||||
<Param Name="min_val" Type="int" TypeFullName="System.Int32" DisplayName="min_val" Desc="min_val" />
|
||||
<Param Name="max_val" Type="int" TypeFullName="System.Int32" DisplayName="max_val" Desc="max_val" />
|
||||
</Method>
|
||||
<Method Name="CoLogin" DisplayName="CoLogin" Desc="CoLogin" Class="AndroidAgent" ReturnType="behaviac::EBTStatus" ReturnTypeFullName="XMLPluginBehaviac.behaviac_EBTStatus" Static="false" Public="false" istask="false" />
|
||||
<Method Name="CoConnectBattleServer" DisplayName="CoConnectBattleServer" Desc="CoConnectBattleServer" Class="AndroidAgent" ReturnType="behaviac::EBTStatus" ReturnTypeFullName="XMLPluginBehaviac.behaviac_EBTStatus" Static="false" Public="false" istask="false" />
|
||||
<Method Name="CoJoin" DisplayName="CoJoin" Desc="CoJoin" Class="AndroidAgent" ReturnType="behaviac::EBTStatus" ReturnTypeFullName="XMLPluginBehaviac.behaviac_EBTStatus" Static="false" Public="false" istask="false" />
|
||||
<Method Name="IsGameOver" DisplayName="IsGameOver" Desc="IsGameOver" Class="AndroidAgent" ReturnType="bool" ReturnTypeFullName="System.Boolean" Static="false" Public="false" istask="false" />
|
||||
<Method Name="CoUpdateGame" DisplayName="CoUpdateGame" Desc="CoUpdateGame" Class="AndroidAgent" ReturnType="behaviac::EBTStatus" ReturnTypeFullName="XMLPluginBehaviac.behaviac_EBTStatus" Static="false" Public="false" istask="false" />
|
||||
</agent>
|
||||
</agents>
|
||||
<instances />
|
||||
</meta>
|
@ -1,24 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--EXPORTED BY TOOL, DON'T MODIFY IT!-->
|
||||
<!--Source File: android\battle.xml-->
|
||||
<behavior name="android/battle" agenttype="AndroidAgent" version="5">
|
||||
<node class="Sequence" id="0">
|
||||
<node class="Action" id="1">
|
||||
<property Method="Self.AndroidAgent::CoConnectBattleServer()" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="Action" id="2">
|
||||
<property Method="Self.AndroidAgent::CoJoin()" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
<node class="DecoratorLoop" id="3">
|
||||
<property Count="const int -1" />
|
||||
<property DecorateWhenChildEnds="true" />
|
||||
<property DoneWithinFrame="false" />
|
||||
<node class="Action" id="6">
|
||||
<property Method="Self.AndroidAgent::CoUpdateGame()" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
</node>
|
||||
</node>
|
||||
</behavior>
|
@ -1,19 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--EXPORTED BY TOOL, DON'T MODIFY IT!-->
|
||||
<!--Source File: android\test.xml-->
|
||||
<behavior name="android/test" agenttype="AndroidAgent" version="5">
|
||||
<node class="IfElse" id="0">
|
||||
<node class="Condition" id="1">
|
||||
<property Operator="Equal" />
|
||||
<property Opl="Self.AndroidAgent::IsLoginSuccess()" />
|
||||
<property Opr="const bool true" />
|
||||
</node>
|
||||
<node class="ReferencedBehavior" id="3">
|
||||
<property ReferenceBehavior="const string "android/battle"" />
|
||||
</node>
|
||||
<node class="Action" id="2">
|
||||
<property Method="Self.AndroidAgent::CoLogin()" />
|
||||
<property ResultOption="BT_INVALID" />
|
||||
</node>
|
||||
</node>
|
||||
</behavior>
|
@ -1,71 +0,0 @@
|
||||
// ---------------------------------------------------------------------
|
||||
// THIS FILE IS AUTO-GENERATED BY BEHAVIAC DESIGNER, SO PLEASE DON'T MODIFY IT BY YOURSELF!
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
#ifndef _BEHAVIAC_TYPES_H_
|
||||
#define _BEHAVIAC_TYPES_H_
|
||||
|
||||
#include "behaviac/behaviac.h"
|
||||
#include "behaviac/behaviortree/behaviortree.h"
|
||||
#include "behaviac/agent/agent.h"
|
||||
#include "behaviac/common/meta.h"
|
||||
|
||||
#include "behaviac/behaviortree/nodes/actions/action.h"
|
||||
#include "behaviac/behaviortree/nodes/actions/assignment.h"
|
||||
#include "behaviac/behaviortree/nodes/actions/compute.h"
|
||||
#include "behaviac/behaviortree/nodes/actions/end.h"
|
||||
#include "behaviac/behaviortree/nodes/actions/noop.h"
|
||||
#include "behaviac/behaviortree/nodes/actions/wait.h"
|
||||
#include "behaviac/behaviortree/nodes/actions/waitforsignal.h"
|
||||
#include "behaviac/behaviortree/nodes/actions/waitframes.h"
|
||||
#include "behaviac/behaviortree/nodes/composites/compositestochastic.h"
|
||||
#include "behaviac/behaviortree/nodes/composites/ifelse.h"
|
||||
#include "behaviac/behaviortree/nodes/composites/parallel.h"
|
||||
#include "behaviac/behaviortree/nodes/composites/referencebehavior.h"
|
||||
#include "behaviac/behaviortree/nodes/composites/selector.h"
|
||||
#include "behaviac/behaviortree/nodes/composites/selectorloop.h"
|
||||
#include "behaviac/behaviortree/nodes/composites/selectorprobability.h"
|
||||
#include "behaviac/behaviortree/nodes/composites/selectorstochastic.h"
|
||||
#include "behaviac/behaviortree/nodes/composites/sequence.h"
|
||||
#include "behaviac/behaviortree/nodes/composites/sequencestochastic.h"
|
||||
#include "behaviac/behaviortree/nodes/composites/withprecondition.h"
|
||||
#include "behaviac/behaviortree/nodes/conditions/and.h"
|
||||
#include "behaviac/behaviortree/nodes/conditions/conditionbase.h"
|
||||
#include "behaviac/behaviortree/nodes/conditions/condition.h"
|
||||
#include "behaviac/behaviortree/nodes/conditions/false.h"
|
||||
#include "behaviac/behaviortree/nodes/conditions/or.h"
|
||||
#include "behaviac/behaviortree/nodes/conditions/true.h"
|
||||
#include "behaviac/behaviortree/nodes/decorators/decoratoralwaysfailure.h"
|
||||
#include "behaviac/behaviortree/nodes/decorators/decoratoralwaysrunning.h"
|
||||
#include "behaviac/behaviortree/nodes/decorators/decoratoralwayssuccess.h"
|
||||
#include "behaviac/behaviortree/nodes/decorators/decoratorcount.h"
|
||||
#include "behaviac/behaviortree/nodes/decorators/decoratorcountlimit.h"
|
||||
#include "behaviac/behaviortree/nodes/decorators/decoratorfailureuntil.h"
|
||||
#include "behaviac/behaviortree/nodes/decorators/decoratorframes.h"
|
||||
#include "behaviac/behaviortree/nodes/decorators/decoratoriterator.h"
|
||||
#include "behaviac/behaviortree/nodes/decorators/decoratorlog.h"
|
||||
#include "behaviac/behaviortree/nodes/decorators/decoratorloop.h"
|
||||
#include "behaviac/behaviortree/nodes/decorators/decoratorloopuntil.h"
|
||||
#include "behaviac/behaviortree/nodes/decorators/decoratornot.h"
|
||||
#include "behaviac/behaviortree/nodes/decorators/decoratorrepeat.h"
|
||||
#include "behaviac/behaviortree/nodes/decorators/decoratorsuccessuntil.h"
|
||||
#include "behaviac/behaviortree/nodes/decorators/decoratortime.h"
|
||||
#include "behaviac/behaviortree/nodes/decorators/decoratorweight.h"
|
||||
#include "behaviac/behaviortree/attachments/event.h"
|
||||
#include "behaviac/behaviortree/attachments/attachaction.h"
|
||||
#include "behaviac/behaviortree/attachments/precondition.h"
|
||||
#include "behaviac/behaviortree/attachments/effector.h"
|
||||
#include "behaviac/htn/task.h"
|
||||
#include "behaviac/fsm/fsm.h"
|
||||
#include "behaviac/fsm/state.h"
|
||||
#include "behaviac/fsm/startcondition.h"
|
||||
#include "behaviac/fsm/transitioncondition.h"
|
||||
#include "behaviac/fsm/waitstate.h"
|
||||
#include "behaviac/fsm/waitframesstate.h"
|
||||
#include "behaviac/fsm/alwaystransition.h"
|
||||
#include "behaviac/fsm/waittransition.h"
|
||||
|
||||
#include "internal/behaviac_agent_headers.h"
|
||||
#include "internal/behaviac_agent_member_visitor.h"
|
||||
|
||||
#endif // _BEHAVIAC_TYPES_H_
|
@ -1,12 +0,0 @@
|
||||
// ---------------------------------------------------------------------
|
||||
// THIS FILE IS AUTO-GENERATED BY BEHAVIAC DESIGNER, SO PLEASE DON'T MODIFY IT BY YOURSELF!
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
#ifndef _BEHAVIAC_AGENT_HEADERS_H_
|
||||
#define _BEHAVIAC_AGENT_HEADERS_H_
|
||||
|
||||
#include "behaviac_headers.h"
|
||||
|
||||
// THE FOLLOWING AGENT HEADER FILES IS GENERATED AUTOMATICALLY:
|
||||
|
||||
#endif // _BEHAVIAC_AGENT_HEADERS_H_
|
@ -1,105 +0,0 @@
|
||||
// ---------------------------------------------------------------------
|
||||
// THIS FILE IS AUTO-GENERATED BY BEHAVIAC DESIGNER, SO PLEASE DON'T MODIFY IT BY YOURSELF!
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
#ifndef _BEHAVIAC_MEMBER_VISITOR_H_
|
||||
#define _BEHAVIAC_MEMBER_VISITOR_H_
|
||||
|
||||
#include "behaviac_agent_headers.h"
|
||||
|
||||
// Agent property and method handlers
|
||||
|
||||
|
||||
struct METHOD_TYPE_BaseAgent_AbortCoroutine { };
|
||||
template<> inline void BaseAgent::_Execute_Method_<METHOD_TYPE_BaseAgent_AbortCoroutine>(int p0)
|
||||
{
|
||||
this->BaseAgent::AbortCoroutine(p0);
|
||||
}
|
||||
|
||||
struct METHOD_TYPE_BaseAgent_DeltaTime { };
|
||||
template<> inline int BaseAgent::_Execute_Method_<METHOD_TYPE_BaseAgent_DeltaTime>(int p0)
|
||||
{
|
||||
return this->BaseAgent::DeltaTime(p0);
|
||||
}
|
||||
|
||||
struct METHOD_TYPE_BaseAgent_GetTickCount { };
|
||||
template<> inline int BaseAgent::_Execute_Method_<METHOD_TYPE_BaseAgent_GetTickCount>()
|
||||
{
|
||||
return this->BaseAgent::GetTickCount();
|
||||
}
|
||||
|
||||
struct METHOD_TYPE_BaseAgent_Rand { };
|
||||
template<> inline int BaseAgent::_Execute_Method_<METHOD_TYPE_BaseAgent_Rand>()
|
||||
{
|
||||
return this->BaseAgent::Rand();
|
||||
}
|
||||
|
||||
struct METHOD_TYPE_BaseAgent_RandRange { };
|
||||
template<> inline int BaseAgent::_Execute_Method_<METHOD_TYPE_BaseAgent_RandRange>(int p0, int p1)
|
||||
{
|
||||
return this->BaseAgent::RandRange(p0, p1);
|
||||
}
|
||||
|
||||
struct METHOD_TYPE_BaseAgent_RandRangeAsFloat { };
|
||||
template<> inline float BaseAgent::_Execute_Method_<METHOD_TYPE_BaseAgent_RandRangeAsFloat>(float p0, float p1)
|
||||
{
|
||||
return this->BaseAgent::RandRangeAsFloat(p0, p1);
|
||||
}
|
||||
|
||||
|
||||
struct METHOD_TYPE_AndroidAgent_CoConnectBattleServer { };
|
||||
template<> inline behaviac::EBTStatus AndroidAgent::_Execute_Method_<METHOD_TYPE_AndroidAgent_CoConnectBattleServer>()
|
||||
{
|
||||
return this->AndroidAgent::CoConnectBattleServer();
|
||||
}
|
||||
|
||||
struct METHOD_TYPE_AndroidAgent_CoIdle { };
|
||||
template<> inline behaviac::EBTStatus AndroidAgent::_Execute_Method_<METHOD_TYPE_AndroidAgent_CoIdle>(int p0, int p1)
|
||||
{
|
||||
return this->AndroidAgent::CoIdle(p0, p1);
|
||||
}
|
||||
|
||||
struct METHOD_TYPE_AndroidAgent_CoJoin { };
|
||||
template<> inline behaviac::EBTStatus AndroidAgent::_Execute_Method_<METHOD_TYPE_AndroidAgent_CoJoin>()
|
||||
{
|
||||
return this->AndroidAgent::CoJoin();
|
||||
}
|
||||
|
||||
struct METHOD_TYPE_AndroidAgent_CoLogin { };
|
||||
template<> inline behaviac::EBTStatus AndroidAgent::_Execute_Method_<METHOD_TYPE_AndroidAgent_CoLogin>()
|
||||
{
|
||||
return this->AndroidAgent::CoLogin();
|
||||
}
|
||||
|
||||
struct METHOD_TYPE_AndroidAgent_CoUpdateGame { };
|
||||
template<> inline behaviac::EBTStatus AndroidAgent::_Execute_Method_<METHOD_TYPE_AndroidAgent_CoUpdateGame>()
|
||||
{
|
||||
return this->AndroidAgent::CoUpdateGame();
|
||||
}
|
||||
|
||||
struct METHOD_TYPE_AndroidAgent_IsGameOver { };
|
||||
template<> inline bool AndroidAgent::_Execute_Method_<METHOD_TYPE_AndroidAgent_IsGameOver>()
|
||||
{
|
||||
return this->AndroidAgent::IsGameOver();
|
||||
}
|
||||
|
||||
struct METHOD_TYPE_AndroidAgent_IsLoginSuccess { };
|
||||
template<> inline bool AndroidAgent::_Execute_Method_<METHOD_TYPE_AndroidAgent_IsLoginSuccess>()
|
||||
{
|
||||
return this->AndroidAgent::IsLoginSuccess();
|
||||
}
|
||||
|
||||
struct METHOD_TYPE_AndroidAgent_NetIsConnected { };
|
||||
template<> inline bool AndroidAgent::_Execute_Method_<METHOD_TYPE_AndroidAgent_NetIsConnected>()
|
||||
{
|
||||
return this->AndroidAgent::NetIsConnected();
|
||||
}
|
||||
|
||||
struct METHOD_TYPE_AndroidAgent_SearchEnemy { };
|
||||
template<> inline behaviac::EBTStatus AndroidAgent::_Execute_Method_<METHOD_TYPE_AndroidAgent_SearchEnemy>(int p0)
|
||||
{
|
||||
return this->AndroidAgent::SearchEnemy(p0);
|
||||
}
|
||||
|
||||
|
||||
#endif // _BEHAVIAC_MEMBER_VISITOR_H_
|
@ -1,330 +0,0 @@
|
||||
// ---------------------------------------------------------------------
|
||||
// THIS FILE IS AUTO-GENERATED BY BEHAVIAC DESIGNER, SO PLEASE DON'T MODIFY IT BY YOURSELF!
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
#include "behaviac/common/meta.h"
|
||||
#include "behaviac/common/member.h"
|
||||
#include "behaviac_agent_meta.h"
|
||||
|
||||
namespace behaviac
|
||||
{
|
||||
class CMethod_behaviac_Agent_VectorAdd : public CAgentMethodVoidBase
|
||||
{
|
||||
IInstanceMember* _param0;
|
||||
IInstanceMember* _param1;
|
||||
|
||||
public:
|
||||
CMethod_behaviac_Agent_VectorAdd() : _param0(0) , _param1(0)
|
||||
{
|
||||
}
|
||||
|
||||
CMethod_behaviac_Agent_VectorAdd(CMethod_behaviac_Agent_VectorAdd &rhs) : CAgentMethodVoidBase(rhs) , _param0(0) , _param1(0)
|
||||
{
|
||||
}
|
||||
|
||||
~CMethod_behaviac_Agent_VectorAdd()
|
||||
{
|
||||
BEHAVIAC_DELETE _param0;
|
||||
BEHAVIAC_DELETE _param1;
|
||||
}
|
||||
|
||||
virtual IInstanceMember* clone()
|
||||
{
|
||||
return BEHAVIAC_NEW CMethod_behaviac_Agent_VectorAdd(*this);
|
||||
}
|
||||
|
||||
virtual void load(const char* instance, behaviac::vector<behaviac::string>& paramStrs)
|
||||
{
|
||||
BEHAVIAC_ASSERT(paramStrs.size() == 2);
|
||||
|
||||
behaviac::StringUtils::StringCopySafe(kInstanceNameMax, _instance, instance);
|
||||
_param0 = AgentMeta::TParseProperty<IList >(paramStrs[0].c_str());
|
||||
_param1 = AgentMeta::TParseProperty<System::Object >(paramStrs[1].c_str());
|
||||
}
|
||||
|
||||
virtual void run(Agent* self)
|
||||
{
|
||||
BEHAVIAC_ASSERT(_param0 != NULL);
|
||||
BEHAVIAC_ASSERT(_param1 != NULL);
|
||||
|
||||
IList& pValue_param0 = *(IList*)_param0->GetValue(self, behaviac::Meta::IsVector<IList >::Result, behaviac::GetClassTypeNumberId<IList >());
|
||||
System::Object& pValue_param1 = *(System::Object*)_param1->GetValue(self, behaviac::Meta::IsVector<System::Object >::Result, behaviac::GetClassTypeNumberId<System::Object >());
|
||||
behaviac::Agent::VectorAdd(pValue_param0, pValue_param1);
|
||||
}
|
||||
};
|
||||
|
||||
class CMethod_behaviac_Agent_VectorClear : public CAgentMethodVoidBase
|
||||
{
|
||||
IInstanceMember* _param0;
|
||||
|
||||
public:
|
||||
CMethod_behaviac_Agent_VectorClear() : _param0(0)
|
||||
{
|
||||
}
|
||||
|
||||
CMethod_behaviac_Agent_VectorClear(CMethod_behaviac_Agent_VectorClear &rhs) : CAgentMethodVoidBase(rhs) , _param0(0)
|
||||
{
|
||||
}
|
||||
|
||||
~CMethod_behaviac_Agent_VectorClear()
|
||||
{
|
||||
BEHAVIAC_DELETE _param0;
|
||||
}
|
||||
|
||||
virtual IInstanceMember* clone()
|
||||
{
|
||||
return BEHAVIAC_NEW CMethod_behaviac_Agent_VectorClear(*this);
|
||||
}
|
||||
|
||||
virtual void load(const char* instance, behaviac::vector<behaviac::string>& paramStrs)
|
||||
{
|
||||
BEHAVIAC_ASSERT(paramStrs.size() == 1);
|
||||
|
||||
behaviac::StringUtils::StringCopySafe(kInstanceNameMax, _instance, instance);
|
||||
_param0 = AgentMeta::TParseProperty<IList >(paramStrs[0].c_str());
|
||||
}
|
||||
|
||||
virtual void run(Agent* self)
|
||||
{
|
||||
BEHAVIAC_ASSERT(_param0 != NULL);
|
||||
|
||||
IList& pValue_param0 = *(IList*)_param0->GetValue(self, behaviac::Meta::IsVector<IList >::Result, behaviac::GetClassTypeNumberId<IList >());
|
||||
behaviac::Agent::VectorClear(pValue_param0);
|
||||
}
|
||||
};
|
||||
|
||||
class CMethod_behaviac_Agent_VectorContains : public CAgentMethodBase<bool>
|
||||
{
|
||||
IInstanceMember* _param0;
|
||||
IInstanceMember* _param1;
|
||||
|
||||
public:
|
||||
CMethod_behaviac_Agent_VectorContains() : _param0(0) , _param1(0)
|
||||
{
|
||||
}
|
||||
|
||||
CMethod_behaviac_Agent_VectorContains(CMethod_behaviac_Agent_VectorContains &rhs) : CAgentMethodBase<bool>(rhs) , _param0(0) , _param1(0)
|
||||
{
|
||||
}
|
||||
|
||||
~CMethod_behaviac_Agent_VectorContains()
|
||||
{
|
||||
BEHAVIAC_DELETE _param0;
|
||||
BEHAVIAC_DELETE _param1;
|
||||
}
|
||||
|
||||
virtual IInstanceMember* clone()
|
||||
{
|
||||
return BEHAVIAC_NEW CMethod_behaviac_Agent_VectorContains(*this);
|
||||
}
|
||||
|
||||
virtual void load(const char* instance, behaviac::vector<behaviac::string>& paramStrs)
|
||||
{
|
||||
BEHAVIAC_ASSERT(paramStrs.size() == 2);
|
||||
|
||||
behaviac::StringUtils::StringCopySafe(kInstanceNameMax, _instance, instance);
|
||||
_param0 = AgentMeta::TParseProperty<IList >(paramStrs[0].c_str());
|
||||
_param1 = AgentMeta::TParseProperty<System::Object >(paramStrs[1].c_str());
|
||||
}
|
||||
|
||||
virtual void run(Agent* self)
|
||||
{
|
||||
BEHAVIAC_ASSERT(_param0 != NULL);
|
||||
BEHAVIAC_ASSERT(_param1 != NULL);
|
||||
|
||||
IList& pValue_param0 = *(IList*)_param0->GetValue(self, behaviac::Meta::IsVector<IList >::Result, behaviac::GetClassTypeNumberId<IList >());
|
||||
System::Object& pValue_param1 = *(System::Object*)_param1->GetValue(self, behaviac::Meta::IsVector<System::Object >::Result, behaviac::GetClassTypeNumberId<System::Object >());
|
||||
_returnValue->value = behaviac::Agent::VectorContains(pValue_param0, pValue_param1);
|
||||
}
|
||||
};
|
||||
|
||||
class CMethod_behaviac_Agent_VectorLength : public CAgentMethodBase<int>
|
||||
{
|
||||
IInstanceMember* _param0;
|
||||
|
||||
public:
|
||||
CMethod_behaviac_Agent_VectorLength() : _param0(0)
|
||||
{
|
||||
}
|
||||
|
||||
CMethod_behaviac_Agent_VectorLength(CMethod_behaviac_Agent_VectorLength &rhs) : CAgentMethodBase<int>(rhs) , _param0(0)
|
||||
{
|
||||
}
|
||||
|
||||
~CMethod_behaviac_Agent_VectorLength()
|
||||
{
|
||||
BEHAVIAC_DELETE _param0;
|
||||
}
|
||||
|
||||
virtual IInstanceMember* clone()
|
||||
{
|
||||
return BEHAVIAC_NEW CMethod_behaviac_Agent_VectorLength(*this);
|
||||
}
|
||||
|
||||
virtual void load(const char* instance, behaviac::vector<behaviac::string>& paramStrs)
|
||||
{
|
||||
BEHAVIAC_ASSERT(paramStrs.size() == 1);
|
||||
|
||||
behaviac::StringUtils::StringCopySafe(kInstanceNameMax, _instance, instance);
|
||||
_param0 = AgentMeta::TParseProperty<IList >(paramStrs[0].c_str());
|
||||
}
|
||||
|
||||
virtual void run(Agent* self)
|
||||
{
|
||||
BEHAVIAC_ASSERT(_param0 != NULL);
|
||||
|
||||
IList& pValue_param0 = *(IList*)_param0->GetValue(self, behaviac::Meta::IsVector<IList >::Result, behaviac::GetClassTypeNumberId<IList >());
|
||||
_returnValue->value = behaviac::Agent::VectorLength(pValue_param0);
|
||||
}
|
||||
};
|
||||
|
||||
class CMethod_behaviac_Agent_VectorRemove : public CAgentMethodVoidBase
|
||||
{
|
||||
IInstanceMember* _param0;
|
||||
IInstanceMember* _param1;
|
||||
|
||||
public:
|
||||
CMethod_behaviac_Agent_VectorRemove() : _param0(0) , _param1(0)
|
||||
{
|
||||
}
|
||||
|
||||
CMethod_behaviac_Agent_VectorRemove(CMethod_behaviac_Agent_VectorRemove &rhs) : CAgentMethodVoidBase(rhs) , _param0(0) , _param1(0)
|
||||
{
|
||||
}
|
||||
|
||||
~CMethod_behaviac_Agent_VectorRemove()
|
||||
{
|
||||
BEHAVIAC_DELETE _param0;
|
||||
BEHAVIAC_DELETE _param1;
|
||||
}
|
||||
|
||||
virtual IInstanceMember* clone()
|
||||
{
|
||||
return BEHAVIAC_NEW CMethod_behaviac_Agent_VectorRemove(*this);
|
||||
}
|
||||
|
||||
virtual void load(const char* instance, behaviac::vector<behaviac::string>& paramStrs)
|
||||
{
|
||||
BEHAVIAC_ASSERT(paramStrs.size() == 2);
|
||||
|
||||
behaviac::StringUtils::StringCopySafe(kInstanceNameMax, _instance, instance);
|
||||
_param0 = AgentMeta::TParseProperty<IList >(paramStrs[0].c_str());
|
||||
_param1 = AgentMeta::TParseProperty<System::Object >(paramStrs[1].c_str());
|
||||
}
|
||||
|
||||
virtual void run(Agent* self)
|
||||
{
|
||||
BEHAVIAC_ASSERT(_param0 != NULL);
|
||||
BEHAVIAC_ASSERT(_param1 != NULL);
|
||||
|
||||
IList& pValue_param0 = *(IList*)_param0->GetValue(self, behaviac::Meta::IsVector<IList >::Result, behaviac::GetClassTypeNumberId<IList >());
|
||||
System::Object& pValue_param1 = *(System::Object*)_param1->GetValue(self, behaviac::Meta::IsVector<System::Object >::Result, behaviac::GetClassTypeNumberId<System::Object >());
|
||||
behaviac::Agent::VectorRemove(pValue_param0, pValue_param1);
|
||||
}
|
||||
};
|
||||
|
||||
class BehaviorLoaderImplement : BehaviorLoader
|
||||
{
|
||||
public:
|
||||
BehaviorLoaderImplement()
|
||||
{
|
||||
AgentMeta::SetBehaviorLoader(this);
|
||||
}
|
||||
|
||||
virtual ~BehaviorLoaderImplement()
|
||||
{
|
||||
}
|
||||
|
||||
virtual bool load()
|
||||
{
|
||||
AgentMeta::SetTotalSignature(3338390249u);
|
||||
|
||||
AgentMeta* meta = NULL;
|
||||
BEHAVIAC_UNUSED_VAR(meta);
|
||||
|
||||
// behaviac::Agent
|
||||
meta = BEHAVIAC_NEW AgentMeta(24743406u);
|
||||
AgentMeta::GetAgentMetas()[1770892321u] = meta;
|
||||
meta->RegisterMethod(1045109914u, BEHAVIAC_NEW CAgentStaticMethodVoid_1<char*>(FunctionPointer_behaviac_Agent_LogMessage));
|
||||
meta->RegisterMethod(2521019022u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorAdd());
|
||||
meta->RegisterMethod(2306090221u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorClear());
|
||||
meta->RegisterMethod(3483755530u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorContains());
|
||||
meta->RegisterMethod(505785840u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorLength());
|
||||
meta->RegisterMethod(502968959u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorRemove());
|
||||
|
||||
// BaseAgent
|
||||
meta = BEHAVIAC_NEW AgentMeta(378357712u);
|
||||
AgentMeta::GetAgentMetas()[2774251291u] = meta;
|
||||
meta->RegisterMethod(1352812660u, BEHAVIAC_NEW CAgentMethodVoid_1<int>(FunctionPointer_BaseAgent_AbortCoroutine));
|
||||
meta->RegisterMethod(1811924796u, BEHAVIAC_NEW CAgentMethod_1< int, int >(FunctionPointer_BaseAgent_DeltaTime));
|
||||
meta->RegisterMethod(2541118574u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_BaseAgent_GetTickCount));
|
||||
meta->RegisterMethod(1045109914u, BEHAVIAC_NEW CAgentStaticMethodVoid_1<char*>(FunctionPointer_BaseAgent_LogMessage));
|
||||
meta->RegisterMethod(3156314303u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_BaseAgent_Rand));
|
||||
meta->RegisterMethod(1110901686u, BEHAVIAC_NEW CAgentMethod_2< int, int, int >(FunctionPointer_BaseAgent_RandRange));
|
||||
meta->RegisterMethod(966948371u, BEHAVIAC_NEW CAgentMethod_2< float, float, float >(FunctionPointer_BaseAgent_RandRangeAsFloat));
|
||||
meta->RegisterMethod(2521019022u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorAdd());
|
||||
meta->RegisterMethod(2306090221u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorClear());
|
||||
meta->RegisterMethod(3483755530u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorContains());
|
||||
meta->RegisterMethod(505785840u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorLength());
|
||||
meta->RegisterMethod(502968959u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorRemove());
|
||||
|
||||
// AndroidAgent
|
||||
meta = BEHAVIAC_NEW AgentMeta(3724796529u);
|
||||
AgentMeta::GetAgentMetas()[2475098143u] = meta;
|
||||
meta->RegisterMethod(1352812660u, BEHAVIAC_NEW CAgentMethodVoid_1<int>(FunctionPointer_AndroidAgent_AbortCoroutine));
|
||||
meta->RegisterMethod(1384709030u, BEHAVIAC_NEW CAgentMethod< behaviac::EBTStatus >(FunctionPointer_AndroidAgent_CoConnectBattleServer));
|
||||
meta->RegisterMethod(3209797653u, BEHAVIAC_NEW CAgentMethod_2< behaviac::EBTStatus, int, int >(FunctionPointer_AndroidAgent_CoIdle));
|
||||
meta->RegisterMethod(3402581732u, BEHAVIAC_NEW CAgentMethod< behaviac::EBTStatus >(FunctionPointer_AndroidAgent_CoJoin));
|
||||
meta->RegisterMethod(2804162432u, BEHAVIAC_NEW CAgentMethod< behaviac::EBTStatus >(FunctionPointer_AndroidAgent_CoLogin));
|
||||
meta->RegisterMethod(805357126u, BEHAVIAC_NEW CAgentMethod< behaviac::EBTStatus >(FunctionPointer_AndroidAgent_CoUpdateGame));
|
||||
meta->RegisterMethod(1811924796u, BEHAVIAC_NEW CAgentMethod_1< int, int >(FunctionPointer_AndroidAgent_DeltaTime));
|
||||
meta->RegisterMethod(2541118574u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_AndroidAgent_GetTickCount));
|
||||
meta->RegisterMethod(400482748u, BEHAVIAC_NEW CAgentMethod< bool >(FunctionPointer_AndroidAgent_IsGameOver));
|
||||
meta->RegisterMethod(856196672u, BEHAVIAC_NEW CAgentMethod< bool >(FunctionPointer_AndroidAgent_IsLoginSuccess));
|
||||
meta->RegisterMethod(1045109914u, BEHAVIAC_NEW CAgentStaticMethodVoid_1<char*>(FunctionPointer_AndroidAgent_LogMessage));
|
||||
meta->RegisterMethod(2514585826u, BEHAVIAC_NEW CAgentMethod< bool >(FunctionPointer_AndroidAgent_NetIsConnected));
|
||||
meta->RegisterMethod(3156314303u, BEHAVIAC_NEW CAgentMethod< int >(FunctionPointer_AndroidAgent_Rand));
|
||||
meta->RegisterMethod(1110901686u, BEHAVIAC_NEW CAgentMethod_2< int, int, int >(FunctionPointer_AndroidAgent_RandRange));
|
||||
meta->RegisterMethod(966948371u, BEHAVIAC_NEW CAgentMethod_2< float, float, float >(FunctionPointer_AndroidAgent_RandRangeAsFloat));
|
||||
meta->RegisterMethod(3025058903u, BEHAVIAC_NEW CAgentMethod_1< behaviac::EBTStatus, int >(FunctionPointer_AndroidAgent_SearchEnemy));
|
||||
meta->RegisterMethod(2521019022u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorAdd());
|
||||
meta->RegisterMethod(2306090221u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorClear());
|
||||
meta->RegisterMethod(3483755530u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorContains());
|
||||
meta->RegisterMethod(505785840u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorLength());
|
||||
meta->RegisterMethod(502968959u, BEHAVIAC_NEW CMethod_behaviac_Agent_VectorRemove());
|
||||
|
||||
AgentMeta::Register<behaviac::Agent>("behaviac::Agent");
|
||||
AgentMeta::Register<BaseAgent>("BaseAgent");
|
||||
AgentMeta::Register<AndroidAgent>("AndroidAgent");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual bool unLoad()
|
||||
{
|
||||
AgentMeta::UnRegister<behaviac::Agent>("behaviac::Agent");
|
||||
AgentMeta::UnRegister<BaseAgent>("BaseAgent");
|
||||
AgentMeta::UnRegister<AndroidAgent>("AndroidAgent");
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
static BehaviorLoaderImplement _behaviorLoaderImplement_;
|
||||
|
||||
static BehaviorLoaderImplement* _pBehaviorLoader_ = NULL;
|
||||
|
||||
void InitBehaviorLoader()
|
||||
{
|
||||
_pBehaviorLoader_ = BEHAVIAC_NEW BehaviorLoaderImplement();
|
||||
}
|
||||
|
||||
void DestroyBehaviorLoader()
|
||||
{
|
||||
if (_pBehaviorLoader_)
|
||||
{
|
||||
BEHAVIAC_DELETE _pBehaviorLoader_;
|
||||
_pBehaviorLoader_ = NULL;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
// ---------------------------------------------------------------------
|
||||
// THIS FILE IS AUTO-GENERATED BY BEHAVIAC DESIGNER, SO PLEASE DON'T MODIFY IT BY YOURSELF!
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
#ifndef _BEHAVIAC_AGENT_PROPERTIES_H_
|
||||
#define _BEHAVIAC_AGENT_PROPERTIES_H_
|
||||
|
||||
#include "behaviac_agent_headers.h"
|
||||
#include "behaviac_agent_member_visitor.h"
|
||||
|
||||
namespace behaviac
|
||||
{
|
||||
// ---------------------------------------------------------------------
|
||||
// Delegate methods
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
inline void FunctionPointer_behaviac_Agent_LogMessage(char* param0) { behaviac::Agent::LogMessage(param0); }
|
||||
inline void FunctionPointer_BaseAgent_AbortCoroutine(Agent* self, int co_id) { ((BaseAgent*)self)->_Execute_Method_<METHOD_TYPE_BaseAgent_AbortCoroutine, void, int >(co_id); }
|
||||
inline int FunctionPointer_BaseAgent_DeltaTime(Agent* self, int time) { return (int)((BaseAgent*)self)->_Execute_Method_<METHOD_TYPE_BaseAgent_DeltaTime, int, int >(time); }
|
||||
inline int FunctionPointer_BaseAgent_GetTickCount(Agent* self) { return (int)((BaseAgent*)self)->_Execute_Method_<METHOD_TYPE_BaseAgent_GetTickCount, int >(); }
|
||||
inline void FunctionPointer_BaseAgent_LogMessage(char* param0) { BaseAgent::LogMessage(param0); }
|
||||
inline int FunctionPointer_BaseAgent_Rand(Agent* self) { return (int)((BaseAgent*)self)->_Execute_Method_<METHOD_TYPE_BaseAgent_Rand, int >(); }
|
||||
inline int FunctionPointer_BaseAgent_RandRange(Agent* self, int min_val, int max_val) { return (int)((BaseAgent*)self)->_Execute_Method_<METHOD_TYPE_BaseAgent_RandRange, int, int, int >(min_val, max_val); }
|
||||
inline float FunctionPointer_BaseAgent_RandRangeAsFloat(Agent* self, float min_val, float max_val) { return (float)((BaseAgent*)self)->_Execute_Method_<METHOD_TYPE_BaseAgent_RandRangeAsFloat, float, float, float >(min_val, max_val); }
|
||||
inline void FunctionPointer_AndroidAgent_AbortCoroutine(Agent* self, int co_id) { ((BaseAgent*)self)->_Execute_Method_<METHOD_TYPE_BaseAgent_AbortCoroutine, void, int >(co_id); }
|
||||
inline behaviac::EBTStatus FunctionPointer_AndroidAgent_CoConnectBattleServer(Agent* self) { return (behaviac::EBTStatus)((AndroidAgent*)self)->_Execute_Method_<METHOD_TYPE_AndroidAgent_CoConnectBattleServer, behaviac::EBTStatus >(); }
|
||||
inline behaviac::EBTStatus FunctionPointer_AndroidAgent_CoIdle(Agent* self, int min_val, int max_val) { return (behaviac::EBTStatus)((AndroidAgent*)self)->_Execute_Method_<METHOD_TYPE_AndroidAgent_CoIdle, behaviac::EBTStatus, int, int >(min_val, max_val); }
|
||||
inline behaviac::EBTStatus FunctionPointer_AndroidAgent_CoJoin(Agent* self) { return (behaviac::EBTStatus)((AndroidAgent*)self)->_Execute_Method_<METHOD_TYPE_AndroidAgent_CoJoin, behaviac::EBTStatus >(); }
|
||||
inline behaviac::EBTStatus FunctionPointer_AndroidAgent_CoLogin(Agent* self) { return (behaviac::EBTStatus)((AndroidAgent*)self)->_Execute_Method_<METHOD_TYPE_AndroidAgent_CoLogin, behaviac::EBTStatus >(); }
|
||||
inline behaviac::EBTStatus FunctionPointer_AndroidAgent_CoUpdateGame(Agent* self) { return (behaviac::EBTStatus)((AndroidAgent*)self)->_Execute_Method_<METHOD_TYPE_AndroidAgent_CoUpdateGame, behaviac::EBTStatus >(); }
|
||||
inline int FunctionPointer_AndroidAgent_DeltaTime(Agent* self, int time) { return (int)((BaseAgent*)self)->_Execute_Method_<METHOD_TYPE_BaseAgent_DeltaTime, int, int >(time); }
|
||||
inline int FunctionPointer_AndroidAgent_GetTickCount(Agent* self) { return (int)((BaseAgent*)self)->_Execute_Method_<METHOD_TYPE_BaseAgent_GetTickCount, int >(); }
|
||||
inline bool FunctionPointer_AndroidAgent_IsGameOver(Agent* self) { return (bool)((AndroidAgent*)self)->_Execute_Method_<METHOD_TYPE_AndroidAgent_IsGameOver, bool >(); }
|
||||
inline bool FunctionPointer_AndroidAgent_IsLoginSuccess(Agent* self) { return (bool)((AndroidAgent*)self)->_Execute_Method_<METHOD_TYPE_AndroidAgent_IsLoginSuccess, bool >(); }
|
||||
inline void FunctionPointer_AndroidAgent_LogMessage(char* param0) { AndroidAgent::LogMessage(param0); }
|
||||
inline bool FunctionPointer_AndroidAgent_NetIsConnected(Agent* self) { return (bool)((AndroidAgent*)self)->_Execute_Method_<METHOD_TYPE_AndroidAgent_NetIsConnected, bool >(); }
|
||||
inline int FunctionPointer_AndroidAgent_Rand(Agent* self) { return (int)((BaseAgent*)self)->_Execute_Method_<METHOD_TYPE_BaseAgent_Rand, int >(); }
|
||||
inline int FunctionPointer_AndroidAgent_RandRange(Agent* self, int min_val, int max_val) { return (int)((BaseAgent*)self)->_Execute_Method_<METHOD_TYPE_BaseAgent_RandRange, int, int, int >(min_val, max_val); }
|
||||
inline float FunctionPointer_AndroidAgent_RandRangeAsFloat(Agent* self, float min_val, float max_val) { return (float)((BaseAgent*)self)->_Execute_Method_<METHOD_TYPE_BaseAgent_RandRangeAsFloat, float, float, float >(min_val, max_val); }
|
||||
inline behaviac::EBTStatus FunctionPointer_AndroidAgent_SearchEnemy(Agent* self, int range) { return (behaviac::EBTStatus)((AndroidAgent*)self)->_Execute_Method_<METHOD_TYPE_AndroidAgent_SearchEnemy, behaviac::EBTStatus, int >(range); }
|
||||
}
|
||||
#endif // _BEHAVIAC_AGENT_PROPERTIES_H_
|
@ -1,15 +0,0 @@
|
||||
// ---------------------------------------------------------------------
|
||||
// THIS FILE IS AUTO-GENERATED BY BEHAVIAC DESIGNER, SO PLEASE DON'T MODIFY IT BY YOURSELF!
|
||||
// ---------------------------------------------------------------------
|
||||
|
||||
#ifndef _BEHAVIAC_HEADERS_H_
|
||||
#define _BEHAVIAC_HEADERS_H_
|
||||
|
||||
#include "behaviac/behaviac.h"
|
||||
|
||||
// YOU SHOULD SET THE HEADER FILES OF YOUR GAME WHEN EXPORTING CPP FILES ON THE BEHAVIAC EDITOR:
|
||||
#include "base_agent.h"
|
||||
#include "android_agent.h"
|
||||
|
||||
|
||||
#endif // _BEHAVIAC_HEADERS_H_
|
@ -1,3 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--EXPORTED BY TOOL, DON'T MODIFY IT!-->
|
||||
<agents version="1" signature="3338390249" />
|
@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<workspace name="robot2006" folder="behaviors" export="exported" language="cpp" userelativepath="false" version="3">
|
||||
<export>
|
||||
<cpp>
|
||||
<isexported>False</isexported>
|
||||
<exportfilecount>1</exportfilecount>
|
||||
<folder>../exported</folder>
|
||||
<includedfilenames>
|
||||
<includedfilename>base_agent.h</includedfilename>
|
||||
<includedfilename>android_agent.h</includedfilename>
|
||||
</includedfilenames>
|
||||
</cpp>
|
||||
</export>
|
||||
</workspace>
|
@ -1 +0,0 @@
|
||||
../gameserver/test_config
|
@ -14,11 +14,11 @@ endif()
|
||||
set(LIB_DIR "ubuntu20.04_g++-9")
|
||||
message(LIB_DIR: ${LIB_DIR} )
|
||||
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -g -std=gnu++1z -DGAME_ID=${GAME_ID} -DNDEBUG -DDT_VIRTUAL_QUERYFILTER -DNEW_WEAPON_SYS=1 -DNEW_NUM=1 -DA8_PERFT=1")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -g -std=gnu++1z -DGAME_ID=${GAME_ID} -DNDEBUG -DDT_VIRTUAL_QUERYFILTER -DNEW_WEAPON_SYS=1")
|
||||
if (${ASAN})
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++1z -DGAME_ID=${GAME_ID} -DMYDEBUG -DDT_VIRTUAL_QUERYFILTER -DNEW_WEAPON_SYS=1 -fsanitize=address -DNEW_NUM=1 -fno-omit-frame-pointer -DA8_PERFT=1 -fsanitize-recover=address")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++1z -DGAME_ID=${GAME_ID} -DDEBUG -DDT_VIRTUAL_QUERYFILTER -DNEW_WEAPON_SYS=1 -fsanitize=address -fno-omit-frame-pointer")
|
||||
else()
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++1z -DGAME_ID=${GAME_ID} -DMYDEBUG -DDT_VIRTUAL_QUERYFILTER -DNEW_WEAPON_SYS=1 -DNEW_NUM=1 -DA8_PERFT=1 -fsanitize-recover=address")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -g -std=gnu++1z -DGAME_ID=${GAME_ID} -DDEBUG -DDT_VIRTUAL_QUERYFILTER -DNEW_WEAPON_SYS=1")
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
@ -144,8 +144,7 @@ target_link_libraries(
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
target_link_libraries(
|
||||
gameserver${GAME_ID}
|
||||
behaviac_gcc_release
|
||||
#behaviac_gcc_debug
|
||||
behaviac_gcc_debug
|
||||
boost_stacktrace_backtrace
|
||||
boost_stacktrace_addr2line
|
||||
)
|
||||
|
@ -13,26 +13,6 @@
|
||||
#include "app.h"
|
||||
#include "jsondatamgr.h"
|
||||
#include "handlermgr.h"
|
||||
#include "playermgr.h"
|
||||
|
||||
class SocketDisconnectHandler : public std::enable_shared_from_this<SocketDisconnectHandler>
|
||||
{
|
||||
public:
|
||||
a8::CommonCbProc cb;
|
||||
int socket_handle = 0;
|
||||
list_head entry;
|
||||
long long add_tick = 0;
|
||||
std::shared_ptr<SocketDisconnectHandler> holder;
|
||||
|
||||
SocketDisconnectHandler()
|
||||
{
|
||||
}
|
||||
|
||||
~SocketDisconnectHandler()
|
||||
{
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
class GCClientSession: public a8::MixedSession
|
||||
{
|
||||
@ -44,22 +24,19 @@ public:
|
||||
is_activite = true;
|
||||
#endif
|
||||
bool warning = false;
|
||||
|
||||
while (buflen - offset >= sizeof(f8::WSProxyPackHead_C)) {
|
||||
f8::WSProxyPackHead_C* p = (f8::WSProxyPackHead_C*)&buf[offset];
|
||||
if (p->magic_code == f8::MAGIC_CODE) {
|
||||
if (buflen - offset < sizeof(f8::WSProxyPackHead_C) + p->packlen) {
|
||||
break;
|
||||
}
|
||||
f8::App::Instance()->AddSocketMsg
|
||||
(SF_GameGate,
|
||||
(socket_handle << 16) + p->socket_handle,
|
||||
p->ip_saddr,
|
||||
p->msgid,
|
||||
p->seqid,
|
||||
&buf[offset + sizeof(f8::WSProxyPackHead_C)],
|
||||
p->packlen,
|
||||
0);
|
||||
App::Instance()->AddSocketMsg(SF_GameGate,
|
||||
(socket_handle << 16) + p->socket_handle,
|
||||
p->ip_saddr,
|
||||
p->msgid,
|
||||
p->seqid,
|
||||
&buf[offset + sizeof(f8::WSProxyPackHead_C)],
|
||||
p->packlen);
|
||||
offset += sizeof(f8::WSProxyPackHead_C) + p->packlen;
|
||||
} else {
|
||||
warning = true;
|
||||
@ -69,15 +46,10 @@ public:
|
||||
}
|
||||
|
||||
if (warning) {
|
||||
f8::UdpLog::Instance()->Warning("收到client非法数据包 buflen:%d", {buflen});
|
||||
f8::UdpLog::Instance()->Warning("收到client非法数据包", {});
|
||||
}
|
||||
}
|
||||
|
||||
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,
|
||||
std::string& response) override
|
||||
{
|
||||
@ -96,7 +68,6 @@ public:
|
||||
|
||||
virtual void OnDisConnect() override
|
||||
{
|
||||
f8::UdpLog::Instance()->Warning("OnDisConnect socket_handle:%d", {socket_handle});
|
||||
f8::MsgQueue::Instance()->PostMsg
|
||||
(IM_ClientSocketDisconnect,
|
||||
a8::Args
|
||||
@ -140,44 +111,10 @@ void GGListener::Init()
|
||||
int error_id = args.Get<int>(0);
|
||||
GGListener::Instance()->OnListenError(error_id);
|
||||
});
|
||||
f8::MsgQueue::Instance()->RegisterCallBack
|
||||
(
|
||||
IM_ClientSocketDisconnect,
|
||||
[this] (const a8::Args& args)
|
||||
{
|
||||
int gg_socket = args.Get<int>(0);
|
||||
PlayerMgr::Instance()->OnGateDisconnect(gg_socket);
|
||||
{
|
||||
std::vector<std::weak_ptr<SocketDisconnectHandler>> del_handlers;
|
||||
for (auto& pair : disconnect_listener_hash_) {
|
||||
unsigned short parent_socket_handle = (pair.first >> 16) & 0xFFFF;
|
||||
if (parent_socket_handle == gg_socket) {
|
||||
SocketDisconnectHandler *handle = nullptr, *tmp = nullptr;
|
||||
list_for_each_entry_safe(handle, tmp, &pair.second, entry) {
|
||||
del_handlers.push_back(handle->holder);
|
||||
handle->cb(a8::Args({pair.first}));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (auto handler : del_handlers) {
|
||||
RemoveSocketDisconnectHandler(handler);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void GGListener::UnInit()
|
||||
{
|
||||
std::vector<std::weak_ptr<SocketDisconnectHandler>> del_handlers;
|
||||
for (auto& pair : disconnect_listener_hash_) {
|
||||
SocketDisconnectHandler *handle = nullptr, *tmp = nullptr;
|
||||
list_for_each_entry_safe(handle, tmp, &pair.second, entry) {
|
||||
del_handlers.push_back(handle->holder);
|
||||
}
|
||||
}
|
||||
for (auto& handler : del_handlers) {
|
||||
RemoveSocketDisconnectHandler(handler);
|
||||
}
|
||||
tcp_listener_ = nullptr;
|
||||
}
|
||||
|
||||
@ -217,59 +154,3 @@ void GGListener::OnListenError(int errorid)
|
||||
f8::App::Instance()->Terminate();
|
||||
exit(1);
|
||||
}
|
||||
|
||||
bool GGListener::DebugNetMsg(int msg_id)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
std::weak_ptr<SocketDisconnectHandler> GGListener::AddSocketDisconnectListener(int socket_handle, a8::CommonCbProc cb)
|
||||
{
|
||||
auto itr = disconnect_listener_hash_.find(socket_handle);
|
||||
if (itr == disconnect_listener_hash_.end()) {
|
||||
disconnect_listener_hash_[socket_handle] = list_head();
|
||||
itr = disconnect_listener_hash_.find(socket_handle);
|
||||
INIT_LIST_HEAD(&itr->second);
|
||||
}
|
||||
auto p = std::make_shared<SocketDisconnectHandler>();
|
||||
p->socket_handle = socket_handle;
|
||||
p->cb = cb;
|
||||
p->add_tick = a8::XGetTickCount();
|
||||
list_add_tail(&p->entry, &itr->second);
|
||||
p->holder = p;
|
||||
return p;
|
||||
}
|
||||
|
||||
void GGListener::RemoveSocketDisconnectHandler(std::weak_ptr<SocketDisconnectHandler> handler)
|
||||
{
|
||||
if (!handler.expired()) {
|
||||
auto p = handler.lock();
|
||||
p->cb = nullptr;
|
||||
p->holder = nullptr;
|
||||
#if 1
|
||||
f8::UdpLog::Instance()->Warning("RemoveSocketDisconnectHandler socket_handle:%d time:%d",
|
||||
{
|
||||
p->socket_handle,
|
||||
a8::XGetTickCount() - p->add_tick
|
||||
});
|
||||
#endif
|
||||
list_del_init(&p->entry);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
@ -4,12 +4,6 @@
|
||||
|
||||
#include <f8/types.h>
|
||||
#include <f8/protoutils.h>
|
||||
#include <f8/utils.h>
|
||||
|
||||
namespace ss
|
||||
{
|
||||
class SS_WSP_SocketDisconnect;
|
||||
}
|
||||
|
||||
//game client listener
|
||||
namespace a8
|
||||
@ -17,7 +11,6 @@ namespace a8
|
||||
class TcpListener;
|
||||
}
|
||||
|
||||
class SocketDisconnectHandler;
|
||||
class GGListener : public a8::Singleton<GGListener>
|
||||
{
|
||||
private:
|
||||
@ -45,15 +38,6 @@ public:
|
||||
void SendToClient(int sockhandle, unsigned int seqid, T& msg)
|
||||
{
|
||||
static int msgid = f8::Net_GetMessageId(msg);
|
||||
#ifdef MYDEBUG
|
||||
if (GGListener::Instance()->DebugNetMsg(msgid)) {
|
||||
a8::XPrintf("SendToClient msgid:%d %s\n",
|
||||
{
|
||||
msgid,
|
||||
f8::PbToJson(&msg)
|
||||
});
|
||||
}
|
||||
#endif
|
||||
int packet_size = f8::Net_SendProxyMsg(tcp_listener_.get(), sockhandle, seqid, 0, msgid, msg);
|
||||
if (packet_size > max_packet_size) {
|
||||
max_packet_size = packet_size;
|
||||
@ -71,16 +55,10 @@ public:
|
||||
long long GetSendNodeNum();
|
||||
long long GetSentNodeNum();
|
||||
long long GetSentBytesNum();
|
||||
std::weak_ptr<SocketDisconnectHandler> AddSocketDisconnectListener(int socket_handle, a8::CommonCbProc cb);
|
||||
void RemoveSocketDisconnectHandler(std::weak_ptr<SocketDisconnectHandler> handler);
|
||||
bool DebugNetMsg(int msg_id);
|
||||
void _SS_WSP_SocketDisconnect(f8::MsgHdr* hdr, const ss::SS_WSP_SocketDisconnect& msg);
|
||||
|
||||
private:
|
||||
void OnListenError(int errorid);
|
||||
void OnClientDisconnect(int socket_handle);
|
||||
|
||||
private:
|
||||
std::shared_ptr<a8::TcpListener> tcp_listener_;
|
||||
std::map<int, list_head> disconnect_listener_hash_;
|
||||
};
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -16,34 +16,45 @@ class Ability
|
||||
void DecSwitch(int type);
|
||||
int GetSwitchTimes(int type);
|
||||
|
||||
AttrHandle AddAttr(int attr_id, float val);
|
||||
void RemoveAttr(AttrHandle handler);
|
||||
float GetAttr(int attr_id);
|
||||
bool HasAttr(int attr_id);
|
||||
AttrAbsHandle AddAttrAbs(int attr_id, float value);
|
||||
void RemoveAttrAbs(AttrAbsHandle handle);
|
||||
AttrRateHandle AddAttrRate(int attr_id, float value);
|
||||
void RemoveAttrRate(AttrRateHandle handle);
|
||||
float GetAttrAbs(int attr_id);
|
||||
float GetAttrRate(int attr_id);
|
||||
|
||||
AttrAdditionHandle AddAttrAddition(int attr_id, float rate);
|
||||
void RemoveAttrAddition(AttrAdditionHandle handler);
|
||||
AttrRuduceHandle AddAttrRuduce(int attr_id, float rate);
|
||||
void RemoveAttrRuduce(AttrRuduceHandle handler);
|
||||
float GetAttrAddition(int attr_id);
|
||||
float GetAttrRuduce(int attr_id);
|
||||
bool HasAddAttr(int attr_id);
|
||||
bool HasDecAttr(int attr_id);
|
||||
|
||||
void GMDelAttr(int attr_id, int idx);
|
||||
void GMClearAttr();
|
||||
AttrDirectHandle AddAttrDirect(int attr_id, float value);
|
||||
void RemoveAttrDirect(AttrDirectHandle handle);
|
||||
float GetAttrDirect(int attr_id);
|
||||
|
||||
void GMDelBaseAttr(int type, int attr_id, int idx);
|
||||
void GMClearBaseAttr(int type);
|
||||
void GMDelGrowAttr(int type, int attr_id, int idx);
|
||||
void GMClearGrowAttr(int type);
|
||||
std::vector<std::string> GMShowAttrs();
|
||||
void SetSource(AttrHandle handle, std::shared_ptr<std::function<std::string()>> cb);
|
||||
|
||||
private:
|
||||
void Clear();
|
||||
void RecalcAttrAbs(int attr_id);
|
||||
void RecalcAttrRate(int attr_id);
|
||||
void RecalcAttrAddition(int attr_id);
|
||||
void RecalcAttrRuduce(int attr_id);
|
||||
|
||||
void RecalcAttrDirect(int attr_id);
|
||||
private:
|
||||
CreatureWeakPtr owner_;
|
||||
std::array<std::tuple<float, list_head>, kHAT_End> attr_abs_ = {};
|
||||
std::array<std::tuple<float, list_head>, kHAT_End> attr_rate_ = {};
|
||||
std::array<std::tuple<float, list_head>, kHAT_End> attr_add_ = {};
|
||||
std::array<std::tuple<float, list_head>, kHAT_End> attr_dec_ = {};
|
||||
std::array<list_head, kHAT_End> attr_list_ = {};
|
||||
std::array<std::tuple<float, list_head>, kHVAT_End - kHVAT_Begin> vattr_add_ = {};
|
||||
std::array<std::tuple<float, list_head>, kHVAT_End - kHVAT_Begin> vattr_dec_ = {};
|
||||
std::array<list_head, kHVAT_End - kHVAT_Begin> vattr_list_ = {};
|
||||
std::array<std::tuple<float, list_head>, kHAT_End> attr_direct_ = {};
|
||||
std::array<int, kSwitchTimeEnd> switch_times_ = {};
|
||||
std::map<int, int> immune_tags_;
|
||||
|
||||
|
@ -49,7 +49,7 @@ void AirDrop::Init()
|
||||
|
||||
void AirDrop::Exec(int appear_time, int box_id, int airdrop_id)
|
||||
{
|
||||
#ifdef MYDEBUG
|
||||
#ifdef DEBUG
|
||||
if (!f8::IsTestEnv()) {
|
||||
a8::XPrintf("AirDrop appear_time:%d box_id:%d airdrop_id:%d\n",
|
||||
{
|
||||
@ -130,7 +130,7 @@ void AirDrop::ShuaMon(const glm::vec3& center, const std::vector<int>& airdrop_m
|
||||
dir,
|
||||
team_id);
|
||||
if (hero) {
|
||||
#ifdef MYDEBUG
|
||||
#ifdef DEBUG
|
||||
room_->BroadcastDebugMsg
|
||||
(a8::Format("ShuaMon pos:%f,%f,%f hero_id:%d",
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ void AirRaid::Init()
|
||||
}
|
||||
},
|
||||
&room_->xtimer_attacher_);
|
||||
#ifdef MYDEBUG
|
||||
#ifdef DEBUG
|
||||
timers_.push_back(timer_wp);
|
||||
#endif
|
||||
});
|
||||
@ -87,7 +87,7 @@ bool AirRaid::GenAirRaidPos(const mt::AirRaid* raid_meta, glm::vec3& center)
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef MYDEBUG
|
||||
#ifdef DEBUG
|
||||
if (humans.size() > 0 && room_->debug_params.find(121) != room_->debug_params.end()) {
|
||||
center = humans[0]->GetPos().ToGlmVec3();
|
||||
}
|
||||
@ -211,7 +211,7 @@ void AirRaid::ExecOneRoundAirRaid(const mt::AirRaid* raid_meta, const glm::vec3&
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef MYDEBUG
|
||||
#ifdef DEBUG
|
||||
|
||||
void AirRaid::NextRaid()
|
||||
{
|
||||
|
@ -8,7 +8,7 @@ class AirRaid
|
||||
AirRaid(Room* room);
|
||||
|
||||
void Init();
|
||||
#ifdef MYDEBUG
|
||||
#ifdef DEBUG
|
||||
void NextRaid();
|
||||
#endif
|
||||
|
||||
@ -20,7 +20,7 @@ class AirRaid
|
||||
|
||||
private:
|
||||
Room* room_ = nullptr;
|
||||
#ifdef MYDEBUG
|
||||
#ifdef DEBUG
|
||||
std::vector<a8::XTimerWp> timers_;
|
||||
#endif
|
||||
};
|
||||
|
@ -15,8 +15,6 @@
|
||||
#include "mt/Text.h"
|
||||
#include "mt/Hero.h"
|
||||
#include "mt/Item.h"
|
||||
#include "mt/Map.h"
|
||||
#include "mt/BattleBasicAttribute.h"
|
||||
|
||||
Android::Android():Human()
|
||||
{
|
||||
@ -31,7 +29,6 @@ Android::Android():Human()
|
||||
|
||||
Android::~Android()
|
||||
{
|
||||
SetDestorying();
|
||||
if (agent_) {
|
||||
f8::BtMgr::Instance()->BtDestory(agent_);
|
||||
agent_ = nullptr;
|
||||
@ -44,14 +41,13 @@ Android::~Android()
|
||||
void Android::Initialize()
|
||||
{
|
||||
Human::Initialize();
|
||||
account_id = a8::Format("0000_2006_%d", {robot_meta->id()});
|
||||
//RandSkin();
|
||||
RandSkin();
|
||||
GiveEquip();
|
||||
RecalcBaseAttr();
|
||||
SetInfiniteBulletMode();
|
||||
{
|
||||
auto context = std::make_shared<BattleDataContext>();
|
||||
SetNetData(context);
|
||||
SetBattleContext(context);
|
||||
context->ForceInit
|
||||
(
|
||||
App::Instance()->AllocTempHeroUniId(),
|
||||
@ -61,10 +57,9 @@ void Android::Initialize()
|
||||
0,
|
||||
nullptr
|
||||
);
|
||||
GetNetData()->Init(this);
|
||||
GetBattleContext()->Init(this);
|
||||
}
|
||||
RandSkin();
|
||||
SetHP(GetNetData()->GetMaxHP());
|
||||
SetHP(GetBattleContext()->GetMaxHP());
|
||||
SetMaxHP(GetHP());
|
||||
{
|
||||
avatar_url = a8::XValue(50001 + rand() % 10).GetString();
|
||||
@ -72,16 +67,11 @@ void Android::Initialize()
|
||||
}
|
||||
{
|
||||
std::vector<int> skill_list;
|
||||
GetNetData()->GetSkillList(skill_list);
|
||||
GetBattleContext()->GetSkillList(skill_list);
|
||||
for (auto& skill_id : skill_list) {
|
||||
AddSkill(skill_id);
|
||||
}
|
||||
}
|
||||
if (GetHeroMeta()->GetBasicMeta()) {
|
||||
SetHeroLevel(1, 0, GetHeroMeta()->GetBasicMeta()->GetGrowMeta(room->GetMapMeta()->map_id()));
|
||||
} else {
|
||||
SetHeroLevel(1, 0, nullptr);
|
||||
}
|
||||
agent_->SetOwner(this);
|
||||
f8::BtMgr::Instance()->BtLoad(agent_, "hero/standard");
|
||||
f8::BtMgr::Instance()->BtSetCurrent(agent_, "hero/standard");
|
||||
@ -94,15 +84,27 @@ void Android::Update(int delta_time)
|
||||
return;
|
||||
}
|
||||
}
|
||||
#ifdef MYDEBUG
|
||||
if (!dead &&
|
||||
room->debug_params.find(119) != room->debug_params.end()) {
|
||||
BeKill(VP_Gas,
|
||||
TEXT("battle_server_killer_gas", "毒圈"),
|
||||
VW_Gas,
|
||||
VP_Gas,
|
||||
TEXT("battle_server_killer_gas", "毒圈"));
|
||||
a8::UnSetBitFlag(status, CS_Disable);
|
||||
#ifdef DEBUG
|
||||
if (room->BattleStarted()) {
|
||||
if (!dead &&
|
||||
room->debug_params.find(119) != room->debug_params.end()) {
|
||||
BeKill(VP_Gas,
|
||||
TEXT("battle_server_killer_gas", "毒圈"),
|
||||
VW_Gas,
|
||||
VP_Gas,
|
||||
TEXT("battle_server_killer_gas", "毒圈"));
|
||||
a8::UnSetBitFlag(status, CS_Disable);
|
||||
}
|
||||
if (!dead &&
|
||||
a8::HasBitFlag(status, CS_ForceTeam) &&
|
||||
App::Instance()->debug_params.find(120) != App::Instance()->debug_params.end()) {
|
||||
BeKill(VP_Gas,
|
||||
TEXT("battle_server_killer_gas", "毒圈"),
|
||||
VW_Gas,
|
||||
VP_Gas,
|
||||
TEXT("battle_server_killer_gas", "毒圈"));
|
||||
a8::UnSetBitFlag(status, CS_Disable);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
InternalUpdate(delta_time);
|
||||
@ -124,9 +126,9 @@ void Android::InternalUpdate(int delta_time)
|
||||
UpdateAction();
|
||||
}
|
||||
if (HasBuffEffect(kBET_Fly)) {
|
||||
App::Instance()->verify_set_pos = 1;
|
||||
Global::Instance()->verify_set_pos = 1;
|
||||
GetMutablePos().FromGlmVec3(room->plane.curr_pos);
|
||||
App::Instance()->verify_set_pos = 0;
|
||||
Global::Instance()->verify_set_pos = 0;
|
||||
room->grid_service->MoveCreature(this);
|
||||
return;
|
||||
}
|
||||
@ -145,7 +147,7 @@ void Android::InternalUpdate(int delta_time)
|
||||
if (playing_skill) {
|
||||
UpdateSkill();
|
||||
}
|
||||
#ifdef MYDEBUG
|
||||
#ifdef DEBUG
|
||||
if (!room->stop_world) {
|
||||
agent_->Exec();
|
||||
}
|
||||
@ -177,13 +179,6 @@ void Android::GiveEquip()
|
||||
|
||||
void Android::RandSkin()
|
||||
{
|
||||
#ifdef MYDEBUG
|
||||
{
|
||||
Skin& skin = skins[0];
|
||||
skin.skin_id = 1 + meta->skinlist();
|
||||
skin.skin_lv = 1;
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
if (!robot_meta->_skin_id.empty()) {
|
||||
Skin& skin = skins[0];
|
||||
@ -208,9 +203,9 @@ void Android::UpdateMoving()
|
||||
return;
|
||||
}
|
||||
Position old_pos = GetPos();
|
||||
App::Instance()->verify_set_pos = 1;
|
||||
Global::Instance()->verify_set_pos = 1;
|
||||
UpdateMove();
|
||||
#ifdef MYDEBUG1
|
||||
#ifdef DEBUG1
|
||||
a8::XPrintf("updatemove old_pos:%f,%f new_pos:%f,%f\n",
|
||||
{
|
||||
old_pos.x,
|
||||
@ -219,7 +214,7 @@ void Android::UpdateMoving()
|
||||
GetPos().y,
|
||||
});
|
||||
#endif
|
||||
App::Instance()->verify_set_pos = 0;
|
||||
Global::Instance()->verify_set_pos = 0;
|
||||
if (GetCar() && GetCar()->IsDriver(this)) {
|
||||
if (!GetCar()->HasBuffEffect(kBET_Sprint)) {
|
||||
GetCar()->SyncPos();
|
||||
|
@ -1,10 +1,19 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <mutex>
|
||||
#include <condition_variable>
|
||||
#include <regex>
|
||||
|
||||
#include <a8/uuid.h>
|
||||
#include <a8/collision.h>
|
||||
#include <a8/magicenum.h>
|
||||
#include <a8/lisp.h>
|
||||
|
||||
#include <f8/udplog.h>
|
||||
#include <f8/btmgr.h>
|
||||
#include <f8/timer.h>
|
||||
#include <f8/netmsghandler.h>
|
||||
|
||||
#include "app.h"
|
||||
#include "jsondatamgr.h"
|
||||
@ -20,7 +29,17 @@
|
||||
#include "lispenv.h"
|
||||
#include "perf.h"
|
||||
|
||||
#include "ss_msgid.pb.h"
|
||||
#include "ss_proto.pb.h"
|
||||
|
||||
#include "f8/msgqueue.h"
|
||||
#include "f8/tglog.h"
|
||||
#include "f8/httpclientpool.h"
|
||||
#include "f8/btmgr.h"
|
||||
#include <f8/timer.h>
|
||||
|
||||
#include "tracemgr.h"
|
||||
#include "matchmgr.h"
|
||||
#include "selfchecker.h"
|
||||
#include "hero_agent.h"
|
||||
#include "android_agent.h"
|
||||
@ -29,6 +48,21 @@
|
||||
#include "mt/MetaMgr.h"
|
||||
#include "mt/Skill.h"
|
||||
|
||||
struct MsgNode
|
||||
{
|
||||
SocketFrom_e sockfrom;
|
||||
int sockhandle;
|
||||
unsigned short msgid;
|
||||
unsigned int seqid;
|
||||
long ip_saddr;
|
||||
char* buf;
|
||||
int buflen;
|
||||
MsgNode* next;
|
||||
};
|
||||
|
||||
const char* const PROJ_LOG_ROOT_FMT = "/data/logs/%s/logs";
|
||||
const char* const PROJ_LOG_FILENAME_FMT = "log_$pid_%Y%m%d.log";
|
||||
|
||||
static void SavePerfLog()
|
||||
{
|
||||
f8::UdpLog::Instance()->Info
|
||||
@ -38,7 +72,7 @@ static void SavePerfLog()
|
||||
"max_full_obj:%d max_part_obj:%d max_bullet:%d max_packet:%d "
|
||||
"his_max_full_obj:%d his_max_part_obj:%d his_max_bullet:%d his_max_packet:%d",
|
||||
{
|
||||
f8::App::Instance()->GetMaxRunDelayTime(),
|
||||
PerfMonitor::Instance()->max_run_delay_time,
|
||||
RoomMgr::Instance()->RoomNum(),
|
||||
PerfMonitor::Instance()->entity_num[ET_Player],
|
||||
PlayerMgr::Instance()->OnlineNum(),
|
||||
@ -69,9 +103,18 @@ static void SavePerfLog()
|
||||
GGListener::Instance()->his_max_packet_size = std::max
|
||||
(GGListener::Instance()->his_max_packet_size, GGListener::Instance()->max_packet_size);
|
||||
}
|
||||
f8::App::Instance()->ResetMaxRunDelayTime();
|
||||
PerfMonitor::Instance()->max_run_delay_time = 0;
|
||||
PerfMonitor::Instance()->max_dispatchmsg_time = 0;
|
||||
PerfMonitor::Instance()->max_timer_idle = 0;
|
||||
PerfMonitor::Instance()->grid_chg_times = 0;
|
||||
PerfMonitor::Instance()->test_times = 0;
|
||||
PerfMonitor::Instance()->params[0] = 0;
|
||||
PerfMonitor::Instance()->params[1] = 0;
|
||||
PerfMonitor::Instance()->params[2] = 0;
|
||||
PerfMonitor::Instance()->params[3] = 0;
|
||||
PerfMonitor::Instance()->params[4] = 0;
|
||||
PerfMonitor::Instance()->params[5] = 0;
|
||||
PerfMonitor::Instance()->params[6] = 0;
|
||||
PerfMonitor::Instance()->max_full_objects_num = 0;
|
||||
PerfMonitor::Instance()->max_part_objects_num = 0;
|
||||
PerfMonitor::Instance()->max_bullet_num = 0;
|
||||
@ -82,14 +125,59 @@ static void SavePerfLog()
|
||||
|
||||
void App::Init()
|
||||
{
|
||||
#ifdef MYDEBUG
|
||||
#if 0
|
||||
signal(SIGPIPE, SIG_IGN);
|
||||
this->argc_ = argc;
|
||||
this->argv_ = argv;
|
||||
|
||||
if (!ParseOpt()) {
|
||||
if (zone_id_ <= 0) {
|
||||
a8::XPrintf("gameserver启动失败,缺少-z参数\n", {});
|
||||
} else if (zone_id_ > MAX_ZONE_ID) {
|
||||
a8::XPrintf("gameserver启动失败,-z参数不能大于%d\n", {MAX_ZONE_ID});
|
||||
} else if (node_id_ <= 0) {
|
||||
a8::XPrintf("gameserver启动失败,缺少-n参数\n", {});
|
||||
} else if (node_id_ > MAX_NODE_ID) {
|
||||
a8::XPrintf("gameserver启动失败,-n参数不能大于%d\n", {MAX_NODE_ID});
|
||||
} else if (instance_id_ <= 0) {
|
||||
a8::XPrintf("gameserver启动失败,缺少-i参数\n", {});
|
||||
} else if (instance_id_ > MAX_INSTANCE_ID) {
|
||||
a8::XPrintf("gameserver启动失败,-i参数不能大于%d\n", {MAX_INSTANCE_ID});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
int debug_mode = 0;
|
||||
#ifdef DEBUG
|
||||
debug_mode = 1;
|
||||
#endif
|
||||
a8::XPrintf("gameserver starting zone_id:%d node_id:%d instance_id:%d pid:%d game_id:%d debug_mode:%d\n",
|
||||
{
|
||||
zone_id_,
|
||||
node_id_,
|
||||
instance_id_,
|
||||
getpid(),
|
||||
GAME_ID,
|
||||
debug_mode
|
||||
});
|
||||
|
||||
loop_mutex_ = std::make_shared<std::mutex>();
|
||||
loop_cond_ = std::make_shared<std::condition_variable>();
|
||||
msg_mutex_ = std::make_shared<std::mutex>();
|
||||
|
||||
srand(time(nullptr));
|
||||
InitLog();
|
||||
#ifdef DEBUG
|
||||
TraceMgr::Instance()->Init("gameserver2006");
|
||||
#endif
|
||||
PerfMonitor::Instance()->Init();
|
||||
f8::MsgQueue::Instance()->Init();
|
||||
HandlerMgr::Instance()->Init();
|
||||
f8::Timer::Instance()->Init();
|
||||
Perf::Instance()->Init();
|
||||
f8::TGLog::Instance()->Init(a8::Format(PROJ_NAME_FMT, {GAME_ID}), false, 0);
|
||||
f8::HttpClientPool::Instance()->Init(MAX_ALL_HTTP_NUM, MAX_SYS_HTTP_NUM, MAX_USER_HTTP_NUM);
|
||||
f8::BtMgr::Instance()->Init("exported");
|
||||
#ifdef MYDEBUG1
|
||||
#ifdef DEBUG1
|
||||
f8::BtMgr::Instance()->SetLogging(true);
|
||||
#endif
|
||||
SkillHelper::Init();
|
||||
@ -98,12 +186,24 @@ void App::Init()
|
||||
mt::MetaMgr::Instance()->Init();
|
||||
SelfChecker::Init();
|
||||
EntityFactory::Instance()->Init();
|
||||
uuid_.SetMachineId((node_id_ - 1) * MAX_NODE_ID + instance_id_);
|
||||
KillMgr::Instance()->Init();
|
||||
RoomMgr::Instance()->Init();
|
||||
MatchMgr::Instance()->Init();
|
||||
MapMgr::Instance()->Init();
|
||||
PlayerMgr::Instance()->Init();
|
||||
GGListener::Instance()->Init();
|
||||
HttpProxy::Instance()->Init();
|
||||
|
||||
f8::UdpLog::Instance()->Info("gameserver starting zone_id:%d node_id:%d instance_id:%d pid:%d debug_mode:%d channel:%d",
|
||||
{
|
||||
zone_id_,
|
||||
node_id_,
|
||||
instance_id_,
|
||||
getpid(),
|
||||
debug_mode,
|
||||
JsonDataMgr::Instance()->channel
|
||||
});
|
||||
{
|
||||
int perf_log_time = 1000 * 30;
|
||||
f8::Timer::Instance()->SetInterval
|
||||
@ -115,15 +215,32 @@ void App::Init()
|
||||
}
|
||||
});
|
||||
}
|
||||
if (HasFlag(7)) {
|
||||
f8::Timer::Instance()->SetTimeout
|
||||
(
|
||||
1000 * 60 * 1,
|
||||
[] (int event, const a8::Args* args)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
App::Instance()->Terminate();
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
void App::UnInit()
|
||||
{
|
||||
PlayerMgr::Instance()->UnInit();
|
||||
RoomMgr::Instance()->UnInit();
|
||||
//const char* s2 = GetEnumString<int>();
|
||||
//int i = static_cast<int>(Test_e::kFlyBuffId);
|
||||
HttpProxy::Instance()->UnInit();
|
||||
GGListener::Instance()->UnInit();
|
||||
PlayerMgr::Instance()->UnInit();
|
||||
RoomMgr::Instance()->UnInit();
|
||||
MapMgr::Instance()->UnInit();
|
||||
MatchMgr::Instance()->UnInit();
|
||||
KillMgr::Instance()->UnInit();
|
||||
EntityFactory::Instance()->UnInit();
|
||||
SelfChecker::UnInit();
|
||||
@ -131,63 +248,259 @@ void App::UnInit()
|
||||
LispEnv::Instance()->UnInit();
|
||||
JsonDataMgr::Instance()->UnInit();
|
||||
f8::BtMgr::Instance()->UnInit();
|
||||
f8::HttpClientPool::Instance()->UnInit();
|
||||
HandlerMgr::Instance()->UnInit();
|
||||
f8::MsgQueue::Instance()->UnInit();
|
||||
f8::Timer::Instance()->UnInit();
|
||||
PerfMonitor::Instance()->UnInit();
|
||||
Perf::Instance()->UnInit();
|
||||
#ifdef MYDEBUG
|
||||
f8::TGLog::Instance()->UnInit();
|
||||
#ifdef DEBUG
|
||||
TraceMgr::Instance()->UnInit();
|
||||
#endif
|
||||
UnInitLog();
|
||||
|
||||
FreeSocketMsgQueue();
|
||||
msg_mutex_ = nullptr;
|
||||
loop_cond_ = nullptr;
|
||||
loop_mutex_ = nullptr;
|
||||
}
|
||||
|
||||
int App::Run()
|
||||
{
|
||||
int ret = 0;
|
||||
#if 0
|
||||
f8::UdpLog::Instance()->Info("gameserver running", {});
|
||||
last_run_tick_ = a8::XGetTickCount();
|
||||
int delta_time = 0;
|
||||
while (!terminated_) {
|
||||
a8::tick_t begin_tick = a8::XGetTickCount();
|
||||
Global::g_nowtime = time(nullptr);
|
||||
QuickExecute(delta_time);
|
||||
SlowerExecute(delta_time);
|
||||
Schedule();
|
||||
a8::tick_t end_tick = a8::XGetTickCount();
|
||||
if (end_tick - begin_tick > PerfMonitor::Instance()->max_run_delay_time) {
|
||||
PerfMonitor::Instance()->max_run_delay_time = end_tick - begin_tick;
|
||||
}
|
||||
delta_time = end_tick - begin_tick;
|
||||
}
|
||||
#endif
|
||||
return ret;
|
||||
}
|
||||
|
||||
void App::AddSocketMsg(SocketFrom_e sockfrom,
|
||||
int sockhandle,
|
||||
long ip_saddr,
|
||||
unsigned short msgid,
|
||||
unsigned int seqid,
|
||||
const char *msgbody,
|
||||
int bodylen)
|
||||
{
|
||||
MsgNode *p = (MsgNode*) malloc(sizeof(MsgNode));
|
||||
memset(p, 0, sizeof(MsgNode));
|
||||
p->sockfrom = sockfrom;
|
||||
p->ip_saddr = ip_saddr;
|
||||
p->sockhandle = sockhandle;
|
||||
p->msgid = msgid;
|
||||
p->seqid = seqid;
|
||||
p->buf = nullptr;
|
||||
p->buflen = bodylen;
|
||||
if (bodylen > 0) {
|
||||
p->buf = (char*)malloc(bodylen);
|
||||
memmove(p->buf, msgbody, bodylen);
|
||||
}
|
||||
msg_mutex_->lock();
|
||||
if (bot_node_) {
|
||||
bot_node_->next = p;
|
||||
bot_node_ = p;
|
||||
} else {
|
||||
top_node_ = p;
|
||||
bot_node_ = p;
|
||||
}
|
||||
++msgnode_size_;
|
||||
msg_mutex_->unlock();
|
||||
NotifyLoopCond();
|
||||
}
|
||||
|
||||
void App::QuickExecute(int delta_time)
|
||||
{
|
||||
f8::MsgQueue::Instance()->Update();
|
||||
DispatchMsg();
|
||||
RoomMgr::Instance()->Update(delta_time);
|
||||
f8::Timer::Instance()->Update();
|
||||
}
|
||||
|
||||
void App::SlowerExecute(int delta_time)
|
||||
{
|
||||
}
|
||||
|
||||
void App::NotifyLoopCond()
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(*loop_mutex_);
|
||||
loop_cond_->notify_all();
|
||||
}
|
||||
|
||||
void App::Schedule()
|
||||
{
|
||||
std::unique_lock<std::mutex> lk(*loop_mutex_);
|
||||
loop_cond_->wait_for(lk, std::chrono::milliseconds(1));
|
||||
}
|
||||
|
||||
bool App::HasTask()
|
||||
{
|
||||
return RoomMgr::Instance()->HasTask();
|
||||
{
|
||||
if (!work_node_) {
|
||||
msg_mutex_->lock();
|
||||
if (!work_node_ && top_node_) {
|
||||
work_node_ = top_node_;
|
||||
top_node_ = nullptr;
|
||||
bot_node_ = nullptr;
|
||||
}
|
||||
msg_mutex_->unlock();
|
||||
}
|
||||
if (work_node_) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void App::ProcessGameGateMsg(f8::MsgHdr* hdr)
|
||||
void App::DispatchMsg()
|
||||
{
|
||||
f8::NetMsgHandler* handler = f8::GetNetMsgHandler
|
||||
(&HandlerMgr::Instance()->ggmsghandler,
|
||||
hdr->msgid);
|
||||
long long begin_tick = a8::XGetTickCount();
|
||||
if (!work_node_ && top_node_) {
|
||||
msg_mutex_->lock();
|
||||
work_node_ = top_node_;
|
||||
top_node_ = nullptr;
|
||||
bot_node_ = nullptr;
|
||||
working_msgnode_size_ = msgnode_size_;
|
||||
msg_mutex_->unlock();
|
||||
}
|
||||
|
||||
f8::MsgHdr hdr;
|
||||
while (work_node_) {
|
||||
MsgNode *pdelnode = work_node_;
|
||||
work_node_ = pdelnode->next;
|
||||
hdr.msgid = pdelnode->msgid;
|
||||
hdr.seqid = pdelnode->seqid;
|
||||
hdr.socket_handle = pdelnode->sockhandle;
|
||||
hdr.buf = pdelnode->buf;
|
||||
hdr.buflen = pdelnode->buflen;
|
||||
hdr.offset = 0;
|
||||
hdr.ip_saddr = pdelnode->ip_saddr;
|
||||
switch (pdelnode->sockfrom) {
|
||||
case SF_GameGate:
|
||||
{
|
||||
ProcessGameGateMsg(hdr);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (pdelnode->buf) {
|
||||
free(pdelnode->buf);
|
||||
}
|
||||
free(pdelnode);
|
||||
working_msgnode_size_--;
|
||||
if (a8::XGetTickCount() - begin_tick > 200) {
|
||||
break;
|
||||
}
|
||||
}//end while
|
||||
|
||||
if (!work_node_) {
|
||||
working_msgnode_size_ = 0;
|
||||
}
|
||||
a8::tick_t end_tick = a8::XGetTickCount();
|
||||
if (end_tick - begin_tick > PerfMonitor::Instance()->max_dispatchmsg_time) {
|
||||
PerfMonitor::Instance()->max_dispatchmsg_time = end_tick - begin_tick;
|
||||
}
|
||||
}
|
||||
|
||||
void App::ProcessGameGateMsg(f8::MsgHdr& hdr)
|
||||
{
|
||||
if (hdr.msgid == ss::_SS_Ping) {
|
||||
ss::SS_Pong pongmsg;
|
||||
GGListener::Instance()->SendProxyMsg(hdr.socket_handle, pongmsg);
|
||||
return;
|
||||
}
|
||||
f8::NetMsgHandler* handler = f8::GetNetMsgHandler(&HandlerMgr::Instance()->ggmsghandler,
|
||||
hdr.msgid);
|
||||
if (handler) {
|
||||
switch (handler->handlerid) {
|
||||
case HID_RoomMgr:
|
||||
ProcessNetMsg(handler, RoomMgr::Instance(), hdr);
|
||||
ProcessNetMsg(handler, RoomMgr::Instance(), &hdr);
|
||||
break;
|
||||
case HID_GGListener:
|
||||
ProcessNetMsg(handler, GGListener::Instance(), hdr);
|
||||
case HID_MatchTeam:
|
||||
{
|
||||
auto match_info = MatchMgr::Instance()->GetMatchInfo(hdr.socket_handle);
|
||||
if (match_info) {
|
||||
ProcessNetMsg(handler, std::get<1>(*match_info).get(), &hdr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HID_PlayerMgr:
|
||||
ProcessNetMsg(handler, PlayerMgr::Instance(), hdr);
|
||||
ProcessNetMsg(handler, PlayerMgr::Instance(), &hdr);
|
||||
break;
|
||||
case HID_Player:
|
||||
{
|
||||
Player* hum = PlayerMgr::Instance()->GetPlayerBySocket(hdr->socket_handle);
|
||||
Player* hum = PlayerMgr::Instance()->GetPlayerBySocket(hdr.socket_handle);
|
||||
if (hum) {
|
||||
hdr->hum = hum;
|
||||
#ifdef MYDEBUG
|
||||
if (hum->GetSocketHandle() != hdr->socket_handle) {
|
||||
A8_ABORT();
|
||||
}
|
||||
#endif
|
||||
ProcessNetMsg(handler, hum, hdr);
|
||||
hdr.hum = hum;
|
||||
ProcessNetMsg(handler, hum, &hdr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case HID_CustomMember:
|
||||
{
|
||||
auto member = RoomMgr::Instance()->GetCustomMemberBySocket(hdr->socket_handle);
|
||||
if (member) {
|
||||
ProcessNetMsg(handler, member.get(), hdr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void App::InitLog()
|
||||
{
|
||||
std::string filename_fmt = PROJ_LOG_FILENAME_FMT;
|
||||
a8::ReplaceString(filename_fmt, "$pid", a8::XValue(getpid()));
|
||||
|
||||
std::string proj_root_dir = a8::Format(PROJ_ROOT_FMT, {a8::Format(PROJ_NAME_FMT,{GAME_ID})});
|
||||
std::string proj_log_root_dir = a8::Format(PROJ_LOG_ROOT_FMT, {a8::Format(PROJ_NAME_FMT, {GAME_ID})});
|
||||
std::string log_file_name = a8::Format(PROJ_LOG_ROOT_FMT,
|
||||
{a8::Format(PROJ_NAME_FMT, {GAME_ID})}) + "/" + filename_fmt;
|
||||
|
||||
a8::MkDir(proj_root_dir);
|
||||
a8::MkDir(proj_log_root_dir);
|
||||
f8::UdpLog::Instance()->SetLogFileName(log_file_name);
|
||||
f8::UdpLog::Instance()->Init();
|
||||
f8::UdpLog::Instance()->Info("proj_root_dir:%s", {proj_root_dir});
|
||||
f8::UdpLog::Instance()->Info("proj_log_root_dir:%s", {proj_log_root_dir});
|
||||
f8::UdpLog::Instance()->Info("log_file_name:%s", {log_file_name});
|
||||
}
|
||||
|
||||
void App::UnInitLog()
|
||||
{
|
||||
f8::UdpLog::Instance()->UnInit();
|
||||
}
|
||||
|
||||
void App::FreeSocketMsgQueue()
|
||||
{
|
||||
msg_mutex_->lock();
|
||||
if (!work_node_) {
|
||||
work_node_ = top_node_;
|
||||
top_node_ = nullptr;
|
||||
bot_node_ = nullptr;
|
||||
}
|
||||
while (work_node_) {
|
||||
MsgNode* pdelnode = work_node_;
|
||||
work_node_ = work_node_->next;
|
||||
if (pdelnode->buf) {
|
||||
free(pdelnode->buf);
|
||||
}
|
||||
free(pdelnode);
|
||||
if (!work_node_) {
|
||||
work_node_ = top_node_;
|
||||
top_node_ = nullptr;
|
||||
bot_node_ = nullptr;
|
||||
}
|
||||
}
|
||||
msg_mutex_->unlock();
|
||||
}
|
||||
|
||||
long long App::AllocTempHeroUniId()
|
||||
{
|
||||
if (curr_uniid_ < 1000) {
|
||||
@ -212,57 +525,17 @@ 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()
|
||||
{
|
||||
if (!version_) {
|
||||
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});
|
||||
}
|
||||
return *version_;
|
||||
}
|
||||
|
||||
const std::string App::GetPkgName()
|
||||
{
|
||||
return a8::Format("gameserver2006", {});
|
||||
}
|
||||
|
||||
void App::Update(int delta_time)
|
||||
void App::Update()
|
||||
{
|
||||
RoomMgr::Instance()->Update(delta_time);
|
||||
|
||||
}
|
||||
|
||||
void App::DispatchSocketMsg(f8::MsgHdr* hdr)
|
||||
{
|
||||
switch (hdr->sockfrom) {
|
||||
case SF_GameGate:
|
||||
{
|
||||
ProcessGameGateMsg(hdr);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,12 @@
|
||||
#pragma once
|
||||
|
||||
#include <a8/uuid.h>
|
||||
#include <a8/singleton.h>
|
||||
|
||||
#include <f8/protoutils.h>
|
||||
#include <f8/app.h>
|
||||
|
||||
struct MsgNode;
|
||||
class App : public f8::UserApp, public a8::Singleton<App>
|
||||
{
|
||||
private:
|
||||
@ -10,30 +14,66 @@ private:
|
||||
friend class a8::Singleton<App>;
|
||||
|
||||
public:
|
||||
#ifdef DEBUG
|
||||
std::map<int, int> debug_params;
|
||||
#endif
|
||||
|
||||
virtual const std::string GetPkgName() override;
|
||||
virtual void Init() override;
|
||||
virtual void UnInit() override;
|
||||
virtual void Update(int delta_time) override;
|
||||
virtual void Update() override;
|
||||
virtual bool HasTask() override;
|
||||
virtual void DispatchSocketMsg(f8::MsgHdr* hdr) override;
|
||||
|
||||
int Run();
|
||||
|
||||
void AddSocketMsg(SocketFrom_e sockfrom,
|
||||
int sockhandle,
|
||||
long ip_saddr,
|
||||
unsigned short msgid,
|
||||
unsigned int seqid,
|
||||
const char *msgbody,
|
||||
int bodylen);
|
||||
|
||||
void NotifyLoopCond();
|
||||
|
||||
long long AllocTempHeroUniId();
|
||||
long long AllocTempWeaponUniId();
|
||||
bool IsServicing() const { return servicing_; }
|
||||
void SetServicing(bool open) { servicing_ = open; }
|
||||
int GetVersion();
|
||||
|
||||
public:
|
||||
int verify_set_pos = 0;
|
||||
|
||||
private:
|
||||
void ProcessGameGateMsg(f8::MsgHdr* hdr);
|
||||
void QuickExecute(int delta_time);
|
||||
void SlowerExecute(int delta_time);
|
||||
void Schedule();
|
||||
|
||||
void DispatchMsg();
|
||||
|
||||
void ProcessGameGateMsg(f8::MsgHdr& hdr);
|
||||
|
||||
void InitLog();
|
||||
void UnInitLog();
|
||||
|
||||
void FreeSocketMsgQueue();
|
||||
|
||||
private:
|
||||
bool servicing_ = true;
|
||||
|
||||
a8::uuid::SnowFlake uuid_;
|
||||
|
||||
long long last_run_tick_ = 0;
|
||||
std::shared_ptr<std::mutex> loop_mutex_;
|
||||
std::shared_ptr<std::condition_variable> loop_cond_;
|
||||
|
||||
std::shared_ptr<std::mutex> msg_mutex_;
|
||||
MsgNode* top_node_ = nullptr;
|
||||
MsgNode* bot_node_ = nullptr;
|
||||
MsgNode* work_node_ = nullptr;
|
||||
|
||||
long long curr_uniid_ = 0;
|
||||
|
||||
std::shared_ptr<int> version_;
|
||||
public:
|
||||
int msgnode_size_ = 0 ;
|
||||
int working_msgnode_size_ = 0;
|
||||
|
||||
};
|
||||
|
@ -1,79 +1,61 @@
|
||||
#pragma once
|
||||
|
||||
A8_DECLARE_ENUM(HumanAttrType_e,
|
||||
enum HumanAttrType_e
|
||||
{
|
||||
kHAT_Begin = 0,
|
||||
kHAT_vCurrnetHealth = 1,
|
||||
kHAT_vHealth = 2,
|
||||
kHAT_pHealth = 3,
|
||||
kHAT_pHealthAm = 4,
|
||||
kHAT_pHealthRateSe = 5,
|
||||
kHAT_pHealthRateIn = 6,
|
||||
kHAT_vHealthAm = 7,
|
||||
kHAT_vHealthRateSe = 8,
|
||||
kHAT_vHealthRateIn = 9,
|
||||
kHAT_vAttack = 10,
|
||||
kHAT_pAttack = 11,
|
||||
kHAT_pAttackAm = 12,
|
||||
kHAT_pAttackRateSe = 13,
|
||||
kHAT_pAttackRateIn = 14,
|
||||
kHAT_vAttackAm = 15,
|
||||
kHAT_vAttackRateSe = 16,
|
||||
kHAT_vAttackRateIn = 17,
|
||||
kHAT_vDefend = 18,
|
||||
kHAT_pDefend = 19,
|
||||
kHAT_pDefendAm = 20,
|
||||
kHAT_pDefendRateSe = 21,
|
||||
kHAT_pDefendRateIn = 22,
|
||||
kHAT_vBlock = 23,
|
||||
kHAT_pBlock = 24,
|
||||
kHAT_pBlockAm = 25,
|
||||
kHAT_pBlockRateSe = 26,
|
||||
kHAT_pBlockRateIn = 27,
|
||||
kHAT_vBloPro = 28,
|
||||
kHAT_vBloDef = 29,
|
||||
kHAT_vCrit = 30,
|
||||
kHAT_pCrit = 31,
|
||||
kHAT_pCritAm = 32,
|
||||
kHAT_pCritRateSe = 33,
|
||||
kHAT_pCritRateIn = 34,
|
||||
kHAT_vCriPro = 35,
|
||||
kHAT_vCriBon = 36,
|
||||
kHAT_vSpeedRateIn = 37,
|
||||
kHAT_vHaste = 38,
|
||||
kHAT_vDrain = 39,
|
||||
kHAT_vTenacity = 40,
|
||||
kHAT_vDamageTakenRateIn = 41,
|
||||
kHAT_vDamageDealtRateIn = 42,
|
||||
kHAT_vNormalDamageTakenRateIn = 43,
|
||||
kHAT_vNormalDamageDealtRateIn = 44,
|
||||
kHAT_vSkillDamageTakenRateIn = 45,
|
||||
kHAT_vSkillDamageDealtRateIn = 46,
|
||||
kHAT_vHealthGainRateIn = 47,
|
||||
kHAT_vHealDealtRateIn = 48,
|
||||
kHAT_Hp = 1,
|
||||
kHAT_HPRecover = 2,
|
||||
kHAT_Atk = 3,
|
||||
kHAT_Def = 4,
|
||||
kHAT_Speed = 5,
|
||||
kHAT_ShotRange = 6,
|
||||
kHAT_ShotSpeed = 7,
|
||||
kHAT_ReloadSpeed = 8,
|
||||
kHAT_FireRate = 9,
|
||||
kHAT_Volume = 10,
|
||||
kHAT_MaxHp = 11,
|
||||
kHAT_ShotView = 12,
|
||||
kHAT_ReloadTime = 14,
|
||||
|
||||
kHAT_Hold = 55,
|
||||
kHAT_WeaponDmg = 20,
|
||||
kHAT_WeaponShotSpeed = 21,
|
||||
kHAT_WeaponReloadTime = 22,
|
||||
kHAT_WeaponExplosionRange = 23,
|
||||
kHAT_WeaponExplosionContinueTime = 24,
|
||||
kHAT_PoisoningReduction = 25,
|
||||
kHAT_RescueTime = 26,
|
||||
kHAT_DrugTime = 27,
|
||||
kHAT_DrugEfficacy = 28,
|
||||
kHAT_CarOil = 29,
|
||||
kHAT_WeaponExplosionDealyTime = 30,
|
||||
kHAT_RecoverHpAdd = 31,
|
||||
kHAT_SkillTime = 32,
|
||||
kHAT_WeaponThrowRange = 33,
|
||||
kHAT_LUCKY = 34,
|
||||
kHAT_HP_RATE = 39,
|
||||
kHAT_ATK_RATE = 40,
|
||||
kHAT_DEF_RATE = 41,
|
||||
kHAT_CRIT = 42,
|
||||
kHAT_CRIT_DAMAGE_RATE = 43,
|
||||
kHAT_DODGE = 44,
|
||||
kHAT_DODGE_DAMAGE_RATE = 45,
|
||||
kHAT_HpRecoverPct = 46,
|
||||
kHAT_BrainLifePct = 47,
|
||||
kHAT_ReloadTimePct = 48,
|
||||
kHAT_BulletSpeed = 49,
|
||||
kHAT_BulletSpeedPct = 50,
|
||||
kHAT_CoolDownPct = 51,
|
||||
kHAT_PickUpPct = 52,
|
||||
kHAT_Shield = 53,
|
||||
kHAT_Tenacity = 54,
|
||||
kHAT_End
|
||||
);
|
||||
};
|
||||
|
||||
A8_DECLARE_ENUM(HumanVirtualAttrType_e,
|
||||
enum HumanVirtualAttrType_e
|
||||
{
|
||||
kHVAT_Begin = 1000,
|
||||
kHVAT_Dmg = 1001,
|
||||
kHVAT_BulletAngle = 1002,
|
||||
kHVAT_WeaponAtk = 1003,
|
||||
|
||||
kHVAT_ShotRange = 1004,
|
||||
kHVAT_WeaponExplosionContinueTime = 1005,
|
||||
kHVAT_RescueTime = 1006,
|
||||
kHVAT_PoisoningReduction = 1007,
|
||||
kHVAT_WeaponReloadTime = 1008,
|
||||
kHVAT_CarOil = 1009,
|
||||
kHVAT_WeaponExplosionDealyTime = 1010,
|
||||
kHVAT_WeaponDmg = 1011,
|
||||
kHVAT_WeaponExplosionRange = 1012,
|
||||
kHVAT_SkillTime = 1013,
|
||||
kHVAT_DirectAtk = 1014,
|
||||
kHVAT_Volume = 1015,
|
||||
kHVAT_FireRate = 1016,
|
||||
kHVAT_BulletScale = 1017,
|
||||
kHVAT_End
|
||||
);
|
||||
};
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include <a8/magicenum.h>
|
||||
|
||||
#include "attrhelper.h"
|
||||
|
||||
float* AttrHelper::GetAttrAbsPtr(std::array<float, kHAT_End>& attr, int attr_id)
|
||||
@ -48,18 +46,3 @@ bool AttrHelper::ParseAttr(std::shared_ptr<a8::XObject> xobj,
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string AttrHelper::GetAttrName(int attr_id)
|
||||
{
|
||||
if (IsValidHumanAttr(attr_id)) {
|
||||
std::string name = a8::GetEnumName<HumanAttrType_e>(attr_id);
|
||||
a8::ReplaceString(name, "kHAT_", "");
|
||||
return name;
|
||||
} else if (IsValidHumanVirtualAttr(attr_id)) {
|
||||
std::string name = a8::GetEnumName<HumanVirtualAttrType_e>(attr_id);
|
||||
a8::ReplaceString(name, "kHVAT_", "Virtual_");
|
||||
return name;
|
||||
} else {
|
||||
return "None";
|
||||
}
|
||||
}
|
||||
|
@ -13,5 +13,4 @@ class AttrHelper
|
||||
std::array<float, kHAT_End>& attr_abs,
|
||||
std::array<float, kHAT_End>& attr_rate);
|
||||
|
||||
static std::string GetAttrName(int attr_id);
|
||||
};
|
||||
|
@ -125,7 +125,7 @@ void BaseAgent::CheckCoroutineEvent()
|
||||
|
||||
int BaseAgent::Test(int p1)
|
||||
{
|
||||
#ifdef MYDEBUG1
|
||||
#ifdef DEBUG1
|
||||
a8::XPrintf("Test output:%d\n", {p1});
|
||||
#endif
|
||||
return p1;
|
||||
|
@ -23,9 +23,6 @@ BatchSync::~BatchSync()
|
||||
|
||||
void BatchSync::AddGlobalObject(Creature* c)
|
||||
{
|
||||
if (c->IsOb()) {
|
||||
return;
|
||||
}
|
||||
if (global_object_hash_.find(c->GetUniId()) != global_object_hash_.end()) {
|
||||
abort();
|
||||
}
|
||||
@ -47,10 +44,9 @@ void BatchSync::AddGlobalObject(Creature* c)
|
||||
std::get<1>(*tuple).FillSMSyncPosition(sync_msg);
|
||||
room_->TraversePlayerList
|
||||
(
|
||||
[&sync_msg] (Player* hum) mutable -> bool
|
||||
[&sync_msg] (Player* hum) mutable
|
||||
{
|
||||
hum->SendNotifyMsg(sync_msg);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
},
|
||||
@ -68,9 +64,6 @@ void BatchSync::RemoveGlobalObject(int obj_uniid)
|
||||
|
||||
void BatchSync::AddTeam(Team* team)
|
||||
{
|
||||
if (team->IsViewTeam()) {
|
||||
return;
|
||||
}
|
||||
if (team_hash_.find(team) != team_hash_.end()) {
|
||||
abort();
|
||||
}
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "bornpoint.h"
|
||||
#include "room.h"
|
||||
#include "glmhelper.h"
|
||||
#include "tracemgr.h"
|
||||
|
||||
#include "mt/Map.h"
|
||||
|
||||
@ -20,15 +19,6 @@ Position BornPoint::RandPoint(Room* room) const
|
||||
glm::vec3 dir = GlmHelper::UP;
|
||||
GlmHelper::RotateY(dir, glm::radians((float)(rand() % 360)));
|
||||
pos.AddGlmVec3(dir * (float)a8::RandEx(10, 100));
|
||||
#ifdef MYDEBUG
|
||||
a8::XPrintf("RandPoint wo_meta:%d pos:%d %d %d\n",
|
||||
{
|
||||
(long long)((char*)wo_meta.get()),
|
||||
pos.GetX(),
|
||||
pos.GetY(),
|
||||
pos.GetZ()
|
||||
});
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
pos.SetX(5120.000000000000);
|
||||
@ -60,17 +50,3 @@ Position BornPoint::GetSrcPoint(Room* room) const
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
Position BornPoint::NewRandPoint(Room* room, int min_radius, int max_radius) const
|
||||
{
|
||||
Position pos;
|
||||
if (wo_meta) {
|
||||
pos.FromGlmVec3(wo_meta->pos);
|
||||
glm::vec3 dir = GlmHelper::UP;
|
||||
GlmHelper::RotateY(dir, glm::radians((float)(rand() % 360)));
|
||||
pos.AddGlmVec3(dir * (float)a8::RandEx(min_radius, max_radius));
|
||||
} else {
|
||||
A8_ABORT();
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
@ -1,5 +1,10 @@
|
||||
#pragma once
|
||||
|
||||
namespace MetaData
|
||||
{
|
||||
struct MapTplThing;
|
||||
}
|
||||
|
||||
namespace mt
|
||||
{
|
||||
struct WorldObject;
|
||||
@ -16,5 +21,4 @@ struct BornPoint
|
||||
int GetNum();
|
||||
Position RandPoint(Room* room) const;
|
||||
Position GetSrcPoint(Room* room) const;
|
||||
Position NewRandPoint(Room* room, int min_radius, int max_radius) const;
|
||||
};
|
||||
|
@ -1,391 +0,0 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include <random>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <a8/mutable_xobject.h>
|
||||
|
||||
#include <f8/app.h>
|
||||
#include <f8/udplog.h>
|
||||
|
||||
#include "boxdrop.h"
|
||||
#include "room.h"
|
||||
#include "hero.h"
|
||||
#include "roomobstacle.h"
|
||||
#include "httpproxy.h"
|
||||
#include "jsondatamgr.h"
|
||||
#include "player.h"
|
||||
#include "mapinstance.h"
|
||||
#include "human.h"
|
||||
#include "stats.h"
|
||||
|
||||
#include "mt/MapMode.h"
|
||||
#include "mt/Hero.h"
|
||||
#include "mt/MapThing.h"
|
||||
#include "mt/Param.h"
|
||||
|
||||
const int BOX_ID = 150001;
|
||||
|
||||
BoxDrop::BoxDrop(Room* room):room_(room)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BoxDrop::Init()
|
||||
{
|
||||
}
|
||||
|
||||
void BoxDrop::UnInit()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void BoxDrop::OnHeroDeadDrop(Hero* hero)
|
||||
{
|
||||
int box_num = GetAndDecObjBoxNum(hero->GetUniId());
|
||||
if (box_num > 0) {
|
||||
Drop(box_num, hero->GetPos().ToGlmVec3());
|
||||
}
|
||||
}
|
||||
|
||||
void BoxDrop::OnObstacleDeadDrop(Obstacle* ob)
|
||||
{
|
||||
int box_num = GetAndDecObjBoxNum(ob->GetUniId());
|
||||
if (box_num > 0) {
|
||||
Drop(box_num, ob->GetPos().ToGlmVec3());
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
for (int i = 0; i < num; ++i) {
|
||||
glm::vec3 dir = GlmHelper::UP;
|
||||
GlmHelper::RotateY(dir, a8::RandAngle());
|
||||
|
||||
glm::vec3 born_pos = center;
|
||||
GlmHelper::Normalize(dir);
|
||||
glm::vec3 start = born_pos;
|
||||
room_->map_instance->Scale(start);
|
||||
|
||||
glm::vec3 real_pos = born_pos;
|
||||
float distance = 25.0f + rand() % 50;
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
glm::vec3 end = born_pos + dir * distance;
|
||||
glm::vec3 hit_point;
|
||||
bool hit_result = false;
|
||||
room_->map_instance->Scale(end);
|
||||
if (room_->map_instance->Raycast(start,
|
||||
end,
|
||||
hit_point,
|
||||
hit_result,
|
||||
room_->map_instance->GetMoveIncludeFlags(),
|
||||
room_->map_instance->GetMoveExcludeFlags())) {
|
||||
room_->map_instance->UnScale(hit_point);
|
||||
if (GlmHelper::Norm2D(hit_point - born_pos) > 5) {
|
||||
real_pos = hit_point;
|
||||
break;
|
||||
}
|
||||
}
|
||||
GlmHelper::RotateY(dir, glm::radians(90.0f));
|
||||
}
|
||||
|
||||
room_->CreateObstacle(BOX_ID, real_pos.x, real_pos.y, real_pos.z);
|
||||
}
|
||||
}
|
||||
|
||||
void BoxDrop::OnBattleStart()
|
||||
{
|
||||
if (room_->GetMapModeMeta() && room_->GetMapModeMeta()->mapMode() == mt::kTreasureBoxMode) {
|
||||
get_box_num_timer_ = room_->xtimer.SetIntervalWpEx
|
||||
(SERVER_FRAME_RATE * 20,
|
||||
[this] (int event, const a8::Args* args)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
if (!room_->IsGameOver() && !room_->GetVictoryTeam()) {
|
||||
if (!alloced_) {
|
||||
RequestAllocBoxNum();
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
&room_->xtimer_attacher_);
|
||||
RequestAllocBoxNum();
|
||||
}
|
||||
}
|
||||
|
||||
void BoxDrop::RequestAllocBoxNum()
|
||||
{
|
||||
std::string account_id;
|
||||
std::string session_id;
|
||||
if (!FillAccountIdSessionId(account_id, session_id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string url;
|
||||
JsonDataMgr::Instance()->GetApiUrl(url);
|
||||
auto url_params = a8::MutableXObject::CreateObject();
|
||||
url_params->SetVal("c", "Battle");
|
||||
url_params->SetVal("a", "requestAllocBoxNum");
|
||||
url_params->SetVal("room_uuid", room_->GetRoomUuid());
|
||||
url_params->SetVal("account_id", account_id);
|
||||
url_params->SetVal("session_id", session_id);
|
||||
HttpProxy::Instance()->HttpGet
|
||||
(
|
||||
[room_wp = room_->weak_from_this(), room_uuid = room_->GetRoomUuid()]
|
||||
(bool ok, a8::XObject* rsp_obj, f8::HttpContext* ctx)
|
||||
{
|
||||
if (ok) {
|
||||
f8::UdpLog::Instance()->Info
|
||||
("RequestAllocBoxNum ok room_uuid:%s %s",
|
||||
{
|
||||
room_uuid,
|
||||
rsp_obj->ToJsonStr()
|
||||
});
|
||||
if (rsp_obj->GetType() != a8::XOT_OBJECT ||
|
||||
!rsp_obj->HasKey("errcode")) {
|
||||
return;
|
||||
}
|
||||
if (!room_wp.expired()) {
|
||||
auto room = room_wp.lock();
|
||||
if (rsp_obj->Get("errcode").GetInt() == 0) {
|
||||
int box_num = rsp_obj->Get("box_num").GetInt();
|
||||
room->GetBoxDrop()->OnAllocOk(box_num);
|
||||
} else {
|
||||
room->GetBoxDrop()->OnAllocFail();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
f8::UdpLog::Instance()->Warning
|
||||
("RequestAllocBoxNum error room_uuid:%s",
|
||||
{
|
||||
room_uuid
|
||||
});
|
||||
}
|
||||
},
|
||||
url,
|
||||
url_params
|
||||
);
|
||||
}
|
||||
|
||||
void BoxDrop::RequestReturnBoxNum()
|
||||
{
|
||||
if (alloc_box_num_ <= 0) {
|
||||
return;
|
||||
}
|
||||
if (room_->GetMapModeMeta() && room_->GetMapModeMeta()->mapMode() == mt::kTreasureBoxMode) {
|
||||
if (returned_) {
|
||||
return;
|
||||
}
|
||||
returned_ = true;
|
||||
|
||||
std::string account_id;
|
||||
std::string session_id;
|
||||
if (!FillAccountIdSessionId(account_id, session_id)) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string url;
|
||||
JsonDataMgr::Instance()->GetApiUrl(url);
|
||||
auto url_params = a8::MutableXObject::CreateObject();
|
||||
url_params->SetVal("c", "Battle");
|
||||
url_params->SetVal("a", "requestReturnBoxNum");
|
||||
url_params->SetVal("account_id", account_id);
|
||||
url_params->SetVal("session_id", session_id);
|
||||
url_params->SetVal("room_uuid", room_->GetRoomUuid());
|
||||
url_params->SetVal("used_num", GetUsedBoxNum());
|
||||
url_params->SetVal("alloc_box_num", alloc_box_num_);
|
||||
HttpProxy::Instance()->HttpGet
|
||||
(
|
||||
[room_uuid = room_->GetRoomUuid()]
|
||||
(bool ok, a8::XObject* rsp_obj, f8::HttpContext* ctx)
|
||||
{
|
||||
if (ok) {
|
||||
f8::UdpLog::Instance()->Info
|
||||
("RequestReturnBoxNum ok room_uuid:%s %s",
|
||||
{
|
||||
room_uuid,
|
||||
rsp_obj->ToJsonStr()
|
||||
});
|
||||
if (rsp_obj->GetType() != a8::XOT_OBJECT ||
|
||||
!rsp_obj->HasKey("errcode")) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
f8::UdpLog::Instance()->Warning
|
||||
("RequestReturnBoxNum error room_uuid:%s",
|
||||
{
|
||||
room_uuid
|
||||
});
|
||||
}
|
||||
},
|
||||
url,
|
||||
url_params
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
bool BoxDrop::FillAccountIdSessionId(std::string& account_id, std::string& session_id)
|
||||
{
|
||||
bool ok = false;
|
||||
room_->TraversePlayerList
|
||||
([&ok, &account_id, &session_id] (Player* hum) -> bool
|
||||
{
|
||||
ok = true;
|
||||
account_id = hum->account_id;
|
||||
session_id = hum->session_id;
|
||||
return true;
|
||||
});
|
||||
return ok;
|
||||
}
|
||||
|
||||
void BoxDrop::OnAllocOk(int box_num)
|
||||
{
|
||||
if (!get_box_num_timer_.expired()) {
|
||||
room_->xtimer.Delete(get_box_num_timer_);
|
||||
}
|
||||
if (alloced_) {
|
||||
return;
|
||||
}
|
||||
alloced_ = true;
|
||||
alloc_box_num_ = box_num;
|
||||
AllocBoxToRoom();
|
||||
}
|
||||
|
||||
void BoxDrop::OnAllocFail()
|
||||
{
|
||||
if (!get_box_num_timer_.expired()) {
|
||||
room_->xtimer.Delete(get_box_num_timer_);
|
||||
}
|
||||
}
|
||||
|
||||
void BoxDrop::AllocBoxToRoom()
|
||||
{
|
||||
if (alloc_box_num_ <= 0) {
|
||||
return;
|
||||
}
|
||||
std::vector<Entity*> all_list;
|
||||
std::vector<Creature*> hero_list;
|
||||
std::vector<Obstacle*> box_list;
|
||||
room_->TraverseEntityList
|
||||
(
|
||||
[this, &all_list, &hero_list, &box_list] (Entity* e) -> bool
|
||||
{
|
||||
if (e->IsCreature(room_) && ((Creature*)e)->IsHero()) {
|
||||
Hero* hero = (Hero*)e;
|
||||
if (hero->meta->HasDrop()) {
|
||||
hero_list.push_back(hero);
|
||||
all_list.push_back(e);
|
||||
}
|
||||
} else if (e->IsRoomObstacle()) {
|
||||
RoomObstacle* ob = (RoomObstacle*)e;
|
||||
if (ob->meta->HasDrop()) {
|
||||
box_list.push_back(ob);
|
||||
all_list.push_back(e);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
std::shuffle(all_list.begin(),
|
||||
all_list.end(),
|
||||
std::default_random_engine(a8::XGetTickCount()));
|
||||
std::shuffle(hero_list.begin(),
|
||||
hero_list.end(),
|
||||
std::default_random_engine(a8::XGetTickCount()));
|
||||
std::shuffle(box_list.begin(),
|
||||
box_list.end(),
|
||||
std::default_random_engine(a8::XGetTickCount()));
|
||||
#ifdef MYDEBUG
|
||||
f8::UdpLog::Instance()->Info
|
||||
("AllocBoxToRoom room_uuid:%s all:%d hero:%d box:%d",
|
||||
{
|
||||
room_->GetRoomUuid(),
|
||||
all_list.size(),
|
||||
hero_list.size(),
|
||||
box_list.size()
|
||||
});
|
||||
#endif
|
||||
for (int i = 0; i < alloc_box_num_; ++i) {
|
||||
if (drop_hash_.size() < all_list.size()) {
|
||||
drop_hash_[all_list.at(i)->GetUniId()] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int BoxDrop::GetAndDecObjBoxNum(int uniid)
|
||||
{
|
||||
auto itr = drop_hash_.find(uniid);
|
||||
if (itr != drop_hash_.end()) {
|
||||
int num = itr->second;
|
||||
itr->second = 0;
|
||||
return num;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int BoxDrop::GetUsedBoxNum()
|
||||
{
|
||||
int num = 0;
|
||||
room_->TraverseHumanList
|
||||
(
|
||||
[&num] (Human* hum) -> bool
|
||||
{
|
||||
num += hum->box_num;
|
||||
return true;
|
||||
});
|
||||
return num;
|
||||
}
|
||||
|
||||
bool BoxDrop::GetNextBoxPos(glm::vec3& pos)
|
||||
{
|
||||
for (auto& pair : drop_hash_) {
|
||||
if (pair.second > 0) {
|
||||
Entity* e = room_->GetEntityByUniId(pair.first);
|
||||
if (e) {
|
||||
pos = e->GetPos().ToGlmVec3();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void BoxDrop::DropByUuid(int obj_uniid, const glm::vec3& center)
|
||||
{
|
||||
int box_num = GetAndDecObjBoxNum(obj_uniid);
|
||||
if (box_num > 0) {
|
||||
Drop(box_num, center);
|
||||
}
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
class Room;
|
||||
class Hero;
|
||||
class Obstacle;
|
||||
class Human;
|
||||
|
||||
class BoxDrop : public std::enable_shared_from_this<BoxDrop>
|
||||
{
|
||||
public:
|
||||
|
||||
BoxDrop(Room* room);
|
||||
void Init();
|
||||
void UnInit();
|
||||
void OnBattleStart();
|
||||
void OnHeroDeadDrop(Hero* hero);
|
||||
void OnObstacleDeadDrop(Obstacle* ob);
|
||||
void OnHumanDeadDrop(Human* hum);
|
||||
void RequestReturnBoxNum();
|
||||
bool GetNextBoxPos(glm::vec3& pos);
|
||||
void DropByUuid(int obj_uniid, const glm::vec3& center);
|
||||
|
||||
private:
|
||||
|
||||
void Drop(int num, const glm::vec3& center);
|
||||
void RequestAllocBoxNum();
|
||||
bool FillAccountIdSessionId(std::string& account_id, std::string& session_id);
|
||||
void OnAllocOk(int box_num);
|
||||
void OnAllocFail();
|
||||
void AllocBoxToRoom();
|
||||
int GetAndDecObjBoxNum(int uniid);
|
||||
int GetUsedBoxNum();
|
||||
|
||||
private:
|
||||
Room* room_ = nullptr;
|
||||
a8::XTimerWp get_box_num_timer_;
|
||||
int alloc_box_num_ = 0;
|
||||
bool alloced_ = false;
|
||||
bool returned_ = false;
|
||||
std::map<int, int> drop_hash_;
|
||||
};
|
@ -3,8 +3,6 @@
|
||||
#include <math.h>
|
||||
#include <float.h>
|
||||
|
||||
#include <a8/magicenum.h>
|
||||
|
||||
#include "buff.h"
|
||||
#include "human.h"
|
||||
#include "room.h"
|
||||
@ -51,50 +49,10 @@ void Buff::Init()
|
||||
res_scale = meta->GetResScale(this);
|
||||
res_scale_frameno = owner->room->GetFrameNo();
|
||||
}
|
||||
#ifdef MYDEBUG
|
||||
switch (meta->buff_effect()) {
|
||||
case kBET_InRescue:
|
||||
case kBET_Rescuer:
|
||||
{
|
||||
a8::XPrintf("add jiuyuan role_name:%s type:%s buff_id:%d buff_effect:%\n",
|
||||
{
|
||||
owner->GetName(),
|
||||
owner->IsPlayer() ? "player" : "android",
|
||||
meta->buff_id(),
|
||||
a8::GetEnumName<BuffEffectType_e>(meta->buff_effect())
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Buff::UnInit()
|
||||
{
|
||||
#ifdef MYDEBUG
|
||||
switch (meta->buff_effect()) {
|
||||
case kBET_InRescue:
|
||||
case kBET_Rescuer:
|
||||
{
|
||||
a8::XPrintf("remove jiuyuan role_name:%s type:%s buff_id:%d buff_effect:%\n",
|
||||
{
|
||||
owner->GetName(),
|
||||
owner->IsPlayer() ? "player" : "android",
|
||||
meta->buff_id(),
|
||||
a8::GetEnumName<BuffEffectType_e>(meta->buff_effect())
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
list_del_init(&effect_entry);
|
||||
if (!list_empty(&depend_entry)) {
|
||||
list_del_init(&depend_entry);
|
||||
@ -135,14 +93,16 @@ void Buff::InternalTimerAddBuff()
|
||||
|
||||
auto caster_state = std::make_shared<SkillCasterState>();
|
||||
caster_.Get()->FillSkillCasterState(caster_state.get());
|
||||
auto add_buff_id = std::make_shared<int>(0);
|
||||
|
||||
#if 1
|
||||
const mt::Skill* skill = skill_meta;
|
||||
#else
|
||||
const mt::Skill* skill = caster_.Get()->CurrentSkillMeta();
|
||||
#endif
|
||||
auto timer_func =
|
||||
[this, caster_state, skill, add_buff_id] (int event, const a8::Args* args)
|
||||
[this, caster_state, skill] (int event, const a8::Args* args)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
int buff_id = meta->buff_id();
|
||||
if (!caster_state->caster.Get()) {
|
||||
return;
|
||||
}
|
||||
@ -156,8 +116,8 @@ void Buff::InternalTimerAddBuff()
|
||||
receiver->context_pos = receiver->GetPos();
|
||||
#endif
|
||||
|
||||
//int buff_id = meta->_int_buff_param2;
|
||||
const mt::Buff* buff_meta = mt::Buff::GetById(*add_buff_id);
|
||||
int buff_id = meta->_int_buff_param2;
|
||||
const mt::Buff* buff_meta = mt::Buff::GetById(buff_id);
|
||||
if (buff_meta) {
|
||||
SkillCasterState old_caster_state;
|
||||
caster.Get()->FillSkillCasterState(&old_caster_state);
|
||||
@ -179,7 +139,6 @@ void Buff::InternalTimerAddBuff()
|
||||
switch (meta->buff_effect() ) {
|
||||
case kBET_DelayAddBuff:
|
||||
{
|
||||
*add_buff_id = meta->_int_buff_param2;
|
||||
owner->room->xtimer.SetTimeoutEx
|
||||
(
|
||||
param1 * SERVER_FRAME_RATE,
|
||||
@ -190,7 +149,6 @@ void Buff::InternalTimerAddBuff()
|
||||
break;
|
||||
case kBET_IntervalAddBuff:
|
||||
{
|
||||
*add_buff_id = meta->_int_buff_param2;
|
||||
owner->room->xtimer.SetIntervalEx
|
||||
(
|
||||
param1 * SERVER_FRAME_RATE,
|
||||
@ -199,25 +157,6 @@ void Buff::InternalTimerAddBuff()
|
||||
);
|
||||
}
|
||||
break;
|
||||
case kBET_PhaseAddBuff:
|
||||
{
|
||||
*add_buff_id = meta->_int_buff_param1;
|
||||
meta->TraverseParams
|
||||
(
|
||||
[this, timer_func] (int idx, const std::string& val) -> bool {
|
||||
if (!val.empty() && idx > 0) {
|
||||
float param = meta->GetBuffParam(this, idx);
|
||||
owner->room->xtimer.SetTimeoutEx
|
||||
(
|
||||
param * SERVER_FRAME_RATE,
|
||||
timer_func,
|
||||
&xtimer_attacher
|
||||
);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
@ -237,7 +176,7 @@ bool Buff::FreezeOperate()
|
||||
|
||||
void Buff::RecoverHoldWeapons()
|
||||
{
|
||||
#ifdef MYDEBUG1
|
||||
#ifdef DEBUG1
|
||||
caster_.Get()->SendDebugMsg(a8::Format("RecoverHoldWeapons buff:%d hold_curr_weapon_idx:%d",
|
||||
{
|
||||
meta->buff_id(),
|
||||
@ -263,7 +202,7 @@ void Buff::RecoverHoldWeapons()
|
||||
}
|
||||
}
|
||||
}
|
||||
#ifdef MYDEBUG1
|
||||
#ifdef DEBUG1
|
||||
for (auto& w : caster_.Get()->weapons) {
|
||||
caster_.Get()->SendDebugMsg(a8::Format("weapon_idx:%d weapon_id:%d",
|
||||
{
|
||||
@ -355,7 +294,7 @@ void Buff::PreProcess()
|
||||
}
|
||||
break;
|
||||
}
|
||||
#ifdef MYDEBUG
|
||||
#ifdef DEBUG
|
||||
if (owner->IsPlayer()) {
|
||||
if (meta->buff_effect() == kBET_Vertigo) {
|
||||
int i = 0;
|
||||
@ -387,8 +326,7 @@ void Buff::ProcSputteringFunc(Bullet* bullet)
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
nullptr,
|
||||
bullet->shot_uniid);
|
||||
nullptr);
|
||||
auto p = std::make_shared<VirtualBullet>();
|
||||
p->bullet_uniid = bullet_uniid;
|
||||
p->weapon_uniid = bullet->weapon_uniid;
|
||||
@ -402,7 +340,6 @@ void Buff::ProcSputteringFunc(Bullet* bullet)
|
||||
p->dir = bullet_dir;
|
||||
p->born_pos = bullet_born_pos;
|
||||
p->born_dir = bullet_dir;
|
||||
p->shot_uniid = bullet->shot_uniid;
|
||||
p->Init();
|
||||
owner->room->AddTask(bullet_uniid, std::make_shared<a8::CommonCbProcEx>
|
||||
(
|
||||
@ -423,44 +360,3 @@ void Buff::Activate()
|
||||
void Buff::Deactivate()
|
||||
{
|
||||
}
|
||||
|
||||
int Buff::IncV(int key, int val)
|
||||
{
|
||||
SetV(key, GetV(key) + val);
|
||||
return GetV(key);
|
||||
}
|
||||
|
||||
int Buff::DecV(int key, int val)
|
||||
{
|
||||
return IncV(key, -val);
|
||||
}
|
||||
|
||||
int Buff::GetV(int key)
|
||||
{
|
||||
if (!dyn_data_) {
|
||||
return 0;
|
||||
}
|
||||
auto itr = dyn_data_->find(key);
|
||||
if (itr != dyn_data_->end()) {
|
||||
return itr->second;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Buff::SetV(int key, int val)
|
||||
{
|
||||
if (!dyn_data_) {
|
||||
dyn_data_ = std::make_shared<std::map<int, int>>();
|
||||
}
|
||||
(*dyn_data_)[key] = val;
|
||||
}
|
||||
|
||||
void Buff::PreExec(const a8::Args* args)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void Buff::PostExec(const a8::Args* args)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -37,7 +37,6 @@ class Buff
|
||||
float res_scale = 1;
|
||||
long long res_scale_frameno = 0;
|
||||
std::shared_ptr<std::vector<float>> buff_vars;
|
||||
std::shared_ptr<std::list<int>> child_buff_uniids;
|
||||
|
||||
Buff();
|
||||
virtual ~Buff();
|
||||
@ -51,10 +50,6 @@ class Buff
|
||||
CreatureWeakPtr& GetCaster();
|
||||
void SetCaster(Creature* caster);
|
||||
virtual bool IsValid() { return is_valid_; };
|
||||
int IncV(int key, int val);
|
||||
int DecV(int key, int val);
|
||||
int GetV(int key);
|
||||
void SetV(int key, int val);
|
||||
|
||||
void CalcPassengerShotOffset();
|
||||
|
||||
@ -62,8 +57,6 @@ class Buff
|
||||
|
||||
virtual void Activate();
|
||||
virtual void Deactivate();
|
||||
virtual void PreExec(const a8::Args* args);
|
||||
virtual void PostExec(const a8::Args* args);
|
||||
|
||||
protected:
|
||||
void ClearEventHandlers();
|
||||
@ -79,7 +72,6 @@ protected:
|
||||
std::list<std::weak_ptr<EventHandler>> event_handlers_;
|
||||
CreatureWeakPtr caster_;
|
||||
std::list<std::weak_ptr<Effect>> effect_list_;
|
||||
std::shared_ptr<std::map<int, int>> dyn_data_;
|
||||
|
||||
friend class PBUtils;
|
||||
};
|
||||
|
@ -17,6 +17,11 @@ void AutoShotBuff::Activate()
|
||||
owner->AsHuman()->shot_hold = true;
|
||||
owner->AsHuman()->series_shot_frames = 0;
|
||||
}
|
||||
} else if (a8::TIMER_DELETE_EVENT == event) {
|
||||
if (owner->IsHuman()) {
|
||||
owner->AsHuman()->shot_hold = false;
|
||||
owner->AsHuman()->series_shot_frames = 0;
|
||||
}
|
||||
}
|
||||
},
|
||||
&xtimer_attacher);
|
||||
@ -24,8 +29,5 @@ void AutoShotBuff::Activate()
|
||||
|
||||
void AutoShotBuff::Deactivate()
|
||||
{
|
||||
if (owner->IsHuman()) {
|
||||
owner->AsHuman()->shot_hold = false;
|
||||
owner->AsHuman()->series_shot_frames = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -11,18 +11,6 @@
|
||||
void BeatBackBuff::Activate()
|
||||
{
|
||||
if (caster_.Get()) {
|
||||
#if 1
|
||||
if (std::abs(caster_.Get()->GetAttackDir().x) > FLT_EPSILON ||
|
||||
std::abs(caster_.Get()->GetAttackDir().y) > FLT_EPSILON) {
|
||||
float distance = meta->GetBuffParam1(this);
|
||||
if (std::abs(distance) > 0) {
|
||||
glm::vec3 old_move_dir = owner->GetMoveDir();
|
||||
owner->SetMoveDir(caster_.Get()->GetAttackDir());
|
||||
owner->ForwardMove(distance);
|
||||
owner->SetMoveDir(old_move_dir);
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (std::abs(caster_.Get()->context_dir.x) > FLT_EPSILON ||
|
||||
std::abs(caster_.Get()->context_dir.x) > FLT_EPSILON) {
|
||||
if (std::abs(meta->_int_buff_param1) > 0) {
|
||||
@ -32,7 +20,6 @@ void BeatBackBuff::Activate()
|
||||
owner->SetMoveDir(old_move_dir);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "buff/internal_add.h"
|
||||
#include "buff/jump.h"
|
||||
#include "buff/machine_gun.h"
|
||||
#include "buff/once_chg_attr.h"
|
||||
#include "buff/passenger.h"
|
||||
#include "buff/pull.h"
|
||||
#include "buff/pull_to_walkable.h"
|
||||
@ -41,19 +42,24 @@
|
||||
#include "buff/use_skill.h"
|
||||
#include "buff/invincible.h"
|
||||
#include "buff/modify_attr.h"
|
||||
#include "buff/modify_base_attr.h"
|
||||
#include "buff/modify_grow_attr.h"
|
||||
#include "buff/direct_set_attr.h"
|
||||
#include "buff/vertigo.h"
|
||||
#include "buff/cond_add.h"
|
||||
#include "buff/distance_dmg_addition.h"
|
||||
#include "buff/downed.h"
|
||||
#include "buff/phase_add.h"
|
||||
|
||||
#include "mt/Buff.h"
|
||||
|
||||
std::shared_ptr<Buff> BuffFactory::MakeBuff(const mt::Buff* buff_meta)
|
||||
{
|
||||
switch (buff_meta->buff_effect()) {
|
||||
case kBET_ModifyAttr:
|
||||
return std::make_shared<ModifyAttrBuff>();
|
||||
case kBET_ModifyBaseAttr:
|
||||
return std::make_shared<ModifyBaseAttrBuff>();
|
||||
case kBET_ModifyGrowAttr:
|
||||
return std::make_shared<ModifyGrowAttrBuff>();
|
||||
case kBET_DirectSetAttr:
|
||||
return std::make_shared<DirectSetAttrBuff>();
|
||||
case kBET_SummonLoot:
|
||||
return std::make_shared<SummonLootBuff>();
|
||||
case kBET_DistanceDmgAddition:
|
||||
@ -98,12 +104,12 @@ std::shared_ptr<Buff> BuffFactory::MakeBuff(const mt::Buff* buff_meta)
|
||||
return std::make_shared<InWaterBuff>();
|
||||
case kBET_IntervalAddBuff:
|
||||
return std::make_shared<InternalAddBuff>();
|
||||
case kBET_PhaseAddBuff:
|
||||
return std::make_shared<PhaseAddBuff>();
|
||||
case kBET_Jump:
|
||||
return std::make_shared<JumpBuff>();
|
||||
case kBET_MachineGun:
|
||||
return std::make_shared<MachineGunBuff>();
|
||||
case kBET_OnceChgAttr:
|
||||
return std::make_shared<OnceChgAttrBuff>();
|
||||
case kBET_Passenger:
|
||||
return std::make_shared<PassengerBuff>();
|
||||
case kBET_PullToWalkable:
|
||||
@ -128,12 +134,12 @@ std::shared_ptr<Buff> BuffFactory::MakeBuff(const mt::Buff* buff_meta)
|
||||
return std::make_shared<UseSkillBuff>();
|
||||
case kBET_Invincible:
|
||||
return std::make_shared<InvincibleBuff>();
|
||||
case kBET_ModifyAttr:
|
||||
return std::make_shared<ModifyBuff>();
|
||||
case kBET_Vertigo:
|
||||
return std::make_shared<VertigoBuff>();
|
||||
case kBET_CondAdd:
|
||||
return std::make_shared<CondAddBuff>();
|
||||
case kBET_Down:
|
||||
return std::make_shared<DownedBuff>();
|
||||
default:
|
||||
return std::make_shared<Buff>();
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -35,28 +35,15 @@ A8_DECLARE_CLASS_ENUM(BuffCallFunc_e, int,
|
||||
kPlayFlyEffect = 35,
|
||||
kLispEval = 36,
|
||||
kSpecCenterRangeHoldBuff = 37,
|
||||
kThrowKnife = 38,
|
||||
kDirectAbsDecHP = 39,
|
||||
kAccumulatePower = 40,
|
||||
kCallShot = 41,
|
||||
kBatchRandomPosSummonObstacle = 42,
|
||||
kOnBreakSkill = 43,
|
||||
kBreakSkill = 44,
|
||||
kBuffEffectCondAdd = 45,
|
||||
kRandAdd = 46,
|
||||
kShowExplosion = 47,
|
||||
kAddArmorShield = 48,
|
||||
kBulletDmgCalcProc = 49,
|
||||
);
|
||||
|
||||
|
||||
class CallFuncBuff : public Buff
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void Activate() override;
|
||||
virtual void Deactivate() override;
|
||||
virtual void PreExec(const a8::Args* args) override;
|
||||
virtual void PostExec(const a8::Args* args) override;
|
||||
|
||||
private:
|
||||
void ProcIntervalRangeAddBuffFunc();
|
||||
@ -82,23 +69,9 @@ class CallFuncBuff : public Buff
|
||||
void PlayFlyEffect();
|
||||
void LispEval();
|
||||
void SpecCenterRangeHoldBuff();
|
||||
void ThrowKnife();
|
||||
void AccumulatePower();
|
||||
void Shot();
|
||||
void BatchRandomPosSummonObstacle();
|
||||
void OnBreakSkill();
|
||||
void BreakSkill();
|
||||
void BuffEffectCondAdd();
|
||||
void RandAdd();
|
||||
void ShowExplosion();
|
||||
void AddArmorShield();
|
||||
void BulletDmgCalcProc();
|
||||
|
||||
void InternalRangeHoldBuff(std::function<bool(glm::vec3&)> get_center_func);
|
||||
|
||||
void OnBreakSkillPreExec();
|
||||
void OnBreakSkillPostExec();
|
||||
|
||||
float hold_param2_ = 0.0;
|
||||
Weapon* hold_weapon_ = nullptr;
|
||||
std::function<void()> deactivate_cb_ = nullptr;
|
||||
|
26
server/gameserver/buff/direct_set_attr.cc
Normal file
26
server/gameserver/buff/direct_set_attr.cc
Normal file
@ -0,0 +1,26 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include "buff/direct_set_attr.h"
|
||||
|
||||
#include "creature.h"
|
||||
#include "human.h"
|
||||
#include "car.h"
|
||||
#include "ability.h"
|
||||
|
||||
#include "mt/Buff.h"
|
||||
|
||||
void DirectSetAttrBuff::Activate()
|
||||
{
|
||||
int attr_id = meta->_int_buff_param1;
|
||||
float value = meta->GetBuffParam2(this);
|
||||
if (IsValidHumanAttr(attr_id)) {
|
||||
handle_ = owner->GetAbility()->AddAttrDirect(attr_id, value);
|
||||
}
|
||||
}
|
||||
|
||||
void DirectSetAttrBuff::Deactivate()
|
||||
{
|
||||
if (!handle_.expired()) {
|
||||
owner->GetAbility()->RemoveAttrDirect(handle_);
|
||||
}
|
||||
}
|
@ -2,11 +2,13 @@
|
||||
|
||||
#include "buff.h"
|
||||
|
||||
class DownedBuff : public Buff
|
||||
class DirectSetAttrBuff : public Buff
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void Activate() override;
|
||||
virtual void Deactivate() override;
|
||||
|
||||
private:
|
||||
AttrDirectHandle handle_;
|
||||
};
|
@ -38,9 +38,7 @@ void DiveBuff::Activate()
|
||||
0,
|
||||
0,
|
||||
"water",
|
||||
dmg_out,
|
||||
0,
|
||||
0);
|
||||
dmg_out);
|
||||
}
|
||||
},
|
||||
&xtimer_attacher
|
||||
|
@ -1,27 +0,0 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include "buff/downed.h"
|
||||
|
||||
#include "creature.h"
|
||||
#include "human.h"
|
||||
#include "room.h"
|
||||
|
||||
#include "mt/Buff.h"
|
||||
|
||||
void DownedBuff::Activate()
|
||||
{
|
||||
if (!owner->room->IsDestorying() && !owner->room->IsGameOver()) {
|
||||
if (owner->IsHuman()) {
|
||||
owner->AsHuman()->SendViewerUiMemberUpdate({owner->GetUniId()});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DownedBuff::Deactivate()
|
||||
{
|
||||
if (!owner->room->IsDestorying() && !owner->room->IsGameOver()) {
|
||||
if (owner->IsHuman()) {
|
||||
owner->AsHuman()->SendViewerUiMemberUpdate({owner->GetUniId()});
|
||||
}
|
||||
}
|
||||
}
|
@ -7,7 +7,6 @@
|
||||
#include "trigger.h"
|
||||
#include "collision.h"
|
||||
#include "human.h"
|
||||
#include "ability.h"
|
||||
|
||||
#include "mt/Buff.h"
|
||||
#include "mt/Skill.h"
|
||||
@ -45,12 +44,6 @@ void HideBuff::Activate()
|
||||
&xtimer_attacher
|
||||
);
|
||||
}
|
||||
if (meta->_int_buff_param1 > 0) {
|
||||
owner->GetAbility()->IncSwitch(kHideBuffMoveShow);
|
||||
}
|
||||
if (meta->_int_buff_param6 > 0) {
|
||||
owner->GetAbility()->IncSwitch(kHideBuffAimingShow);
|
||||
}
|
||||
}
|
||||
|
||||
void HideBuff::Deactivate()
|
||||
@ -62,12 +55,6 @@ void HideBuff::Deactivate()
|
||||
}
|
||||
}
|
||||
alert_buff_hash_.clear();
|
||||
if (meta->_int_buff_param1 > 0) {
|
||||
owner->GetAbility()->DecSwitch(kHideBuffMoveShow);
|
||||
}
|
||||
if (meta->_int_buff_param6 > 0) {
|
||||
owner->GetAbility()->DecSwitch(kHideBuffAimingShow);
|
||||
}
|
||||
}
|
||||
|
||||
void HideBuff::AddInRangeObject(Creature* target)
|
||||
|
@ -57,4 +57,24 @@ void MachineGunBuff::SwitchWeapons()
|
||||
|
||||
void MachineGunBuff::ProcSkill()
|
||||
{
|
||||
if (skill_meta && skill_meta->_number_meta) {
|
||||
switch (skill_meta->GetMagicId()) {
|
||||
case MAGIC_20201_HX:
|
||||
{
|
||||
owner->room->xtimer.ModifyTime
|
||||
(remover_timer,
|
||||
skill_meta->_number_meta->_float_time * 1000 / FRAME_RATE_MS);
|
||||
owner->GetTrigger()->DispatchEvent(kStartSwitchWeaponBuffEvent, {this});
|
||||
}
|
||||
break;
|
||||
case MAGIC_20401_MAO:
|
||||
{
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include <f8/app.h>
|
||||
|
||||
#include "buff/modify_attr.h"
|
||||
|
||||
#include "creature.h"
|
||||
@ -9,39 +7,12 @@
|
||||
#include "car.h"
|
||||
|
||||
#include "mt/Buff.h"
|
||||
#include "mt/Skill.h"
|
||||
|
||||
void ModifyAttrBuff::Activate()
|
||||
void ModifyBuff::Activate()
|
||||
{
|
||||
int attr_id = meta->_int_buff_param1;
|
||||
float value = meta->GetBuffParam2(this);
|
||||
if (f8::App::Instance()->GetInstanceId() != 3) {
|
||||
attr_handle_ = owner->GetAbility()->AddAttr(attr_id, value);
|
||||
#ifdef MYDEBUG
|
||||
if (!attr_handle_.expired()) {
|
||||
std::string source_name = a8::Format
|
||||
("<-buff.%d.%d.%s",
|
||||
{
|
||||
meta->buff_id(),
|
||||
skill_meta ? skill_meta->skill_id() : 0,
|
||||
GetCaster().Get() ? (GetCaster().Get() == owner ? "self" : GetCaster().Get()->GetName() )
|
||||
: "none"
|
||||
});
|
||||
auto cb = std::make_shared<std::function<std::string()>>
|
||||
(
|
||||
[source_name] () -> std::string
|
||||
{
|
||||
return source_name;
|
||||
});
|
||||
owner->GetAbility()->SetSource(attr_handle_, cb);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void ModifyAttrBuff::Deactivate()
|
||||
void ModifyBuff::Deactivate()
|
||||
{
|
||||
if (!attr_handle_.expired()) {
|
||||
owner->GetAbility()->RemoveAttr(attr_handle_);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,14 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "buff.h"
|
||||
#include "ability.h"
|
||||
|
||||
class ModifyAttrBuff : public Buff
|
||||
class ModifyBuff : public Buff
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void Activate() override;
|
||||
virtual void Deactivate() override;
|
||||
private:
|
||||
AttrHandle attr_handle_;
|
||||
};
|
||||
|
43
server/gameserver/buff/modify_base_attr.cc
Normal file
43
server/gameserver/buff/modify_base_attr.cc
Normal file
@ -0,0 +1,43 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include "buff/modify_base_attr.h"
|
||||
|
||||
#include "creature.h"
|
||||
#include "human.h"
|
||||
#include "car.h"
|
||||
|
||||
#include "mt/Buff.h"
|
||||
|
||||
void ModifyBaseAttrBuff::Activate()
|
||||
{
|
||||
int attr_id = meta->_int_buff_param1;
|
||||
if (IsValidHumanAttr(attr_id)) {
|
||||
float value = meta->GetBuffParam2(this);
|
||||
switch (meta->_int_buff_param4) {
|
||||
case 1:
|
||||
{
|
||||
rate_handle_ = owner->GetAbility()->AddAttrRate(attr_id, value);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
abs_handle_ = owner->GetAbility()->AddAttrAbs(attr_id, value);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ModifyBaseAttrBuff::Deactivate()
|
||||
{
|
||||
if (!abs_handle_.expired()) {
|
||||
owner->GetAbility()->RemoveAttrAbs(abs_handle_);
|
||||
}
|
||||
if (!rate_handle_.expired()) {
|
||||
owner->GetAbility()->RemoveAttrRate(rate_handle_);
|
||||
}
|
||||
}
|
16
server/gameserver/buff/modify_base_attr.h
Normal file
16
server/gameserver/buff/modify_base_attr.h
Normal file
@ -0,0 +1,16 @@
|
||||
#pragma once
|
||||
|
||||
#include "buff.h"
|
||||
#include "ability.h"
|
||||
|
||||
class ModifyBaseAttrBuff : public Buff
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void Activate() override;
|
||||
virtual void Deactivate() override;
|
||||
|
||||
private:
|
||||
AttrAbsHandle abs_handle_;
|
||||
AttrRateHandle rate_handle_;
|
||||
};
|
41
server/gameserver/buff/modify_grow_attr.cc
Normal file
41
server/gameserver/buff/modify_grow_attr.cc
Normal file
@ -0,0 +1,41 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include "buff/modify_grow_attr.h"
|
||||
|
||||
#include "creature.h"
|
||||
#include "human.h"
|
||||
#include "car.h"
|
||||
|
||||
#include "mt/Buff.h"
|
||||
|
||||
void ModifyGrowAttrBuff::Activate()
|
||||
{
|
||||
int attr_id = meta->_int_buff_param1;
|
||||
float value = meta->GetBuffParam2(this);
|
||||
switch (meta->_int_buff_param3) {
|
||||
case 1:
|
||||
{
|
||||
add_handle_ = owner->GetAbility()->AddAttrAddition(attr_id, value);
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
{
|
||||
ruduce_handle_ = owner->GetAbility()->AddAttrRuduce(attr_id, value);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ModifyGrowAttrBuff::Deactivate()
|
||||
{
|
||||
if (!add_handle_.expired()) {
|
||||
owner->GetAbility()->RemoveAttrAddition(add_handle_);
|
||||
}
|
||||
if (!ruduce_handle_.expired()) {
|
||||
owner->GetAbility()->RemoveAttrRuduce(ruduce_handle_);
|
||||
}
|
||||
}
|
15
server/gameserver/buff/modify_grow_attr.h
Normal file
15
server/gameserver/buff/modify_grow_attr.h
Normal file
@ -0,0 +1,15 @@
|
||||
#pragma once
|
||||
|
||||
#include "buff.h"
|
||||
#include "ability.h"
|
||||
|
||||
class ModifyGrowAttrBuff : public Buff
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void Activate() override;
|
||||
virtual void Deactivate() override;
|
||||
private:
|
||||
AttrAdditionHandle add_handle_;
|
||||
AttrRuduceHandle ruduce_handle_;
|
||||
};
|
93
server/gameserver/buff/once_chg_attr.cc
Normal file
93
server/gameserver/buff/once_chg_attr.cc
Normal file
@ -0,0 +1,93 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include "buff/once_chg_attr.h"
|
||||
|
||||
#include "attrdefine.h"
|
||||
#include "creature.h"
|
||||
#include "room.h"
|
||||
|
||||
#include "mt/Buff.h"
|
||||
|
||||
void OnceChgAttrBuff::Activate()
|
||||
{
|
||||
InternalProcOnceChgAttr();
|
||||
}
|
||||
|
||||
void OnceChgAttrBuff::Deactivate()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void OnceChgAttrBuff::InternalProcOnceChgAttr()
|
||||
{
|
||||
if (owner->dead) {
|
||||
return;
|
||||
}
|
||||
switch (meta->_int_buff_param1) {
|
||||
case kHAT_Hp:
|
||||
{
|
||||
int real_killer_id = 0;
|
||||
std::string real_killer_name;
|
||||
if (caster_.Get()) {
|
||||
real_killer_id = caster_.Get()->GetUniId();
|
||||
real_killer_name = caster_.Get()->GetName();
|
||||
}
|
||||
#ifdef DEBUG
|
||||
if (caster_.Get()->IsPlayer()) {
|
||||
a8::XPrintf("once chgattr %d %d\n", {real_killer_id, real_killer_name});
|
||||
}
|
||||
#endif
|
||||
if (meta->_int_buff_param2 == 1) {
|
||||
//绝对值
|
||||
if (meta->_buff_param3 > 0) {
|
||||
owner->AddHp(meta->_buff_param3);
|
||||
} else if (meta->_buff_param3 < 0) {
|
||||
float dmg_out = 0.0f;
|
||||
owner->over_delay_time = 100;
|
||||
owner->DecHP(std::abs(meta->_buff_param3),
|
||||
VP_Buff,
|
||||
"",
|
||||
meta->buff_id(),
|
||||
real_killer_id,
|
||||
real_killer_name,
|
||||
dmg_out);
|
||||
owner->over_delay_time = 0;
|
||||
}
|
||||
} else if (meta->_int_buff_param2 == 2) {
|
||||
//百分比
|
||||
float chg_hp = owner->GetHP() * meta->_buff_param3;
|
||||
if (chg_hp > 0.0001f) {
|
||||
owner->AddHp(chg_hp);
|
||||
} else if (chg_hp < 0.0001f) {
|
||||
float dmg_out = 0.0f;
|
||||
owner->over_delay_time = 100;
|
||||
owner->DecHP(std::abs(chg_hp),
|
||||
VP_Buff,
|
||||
"",
|
||||
meta->buff_id(),
|
||||
real_killer_id,
|
||||
real_killer_name,
|
||||
dmg_out);
|
||||
owner->over_delay_time = 0;
|
||||
}
|
||||
}
|
||||
#ifdef DEBUG
|
||||
{
|
||||
std::string dbg_msg = a8::Format
|
||||
("buff扣血 type:%s val:%f",
|
||||
{
|
||||
meta->_int_buff_param2,
|
||||
meta->_int_buff_param3,
|
||||
});
|
||||
owner->room->BroadcastDebugMsg(dbg_msg);
|
||||
}
|
||||
#endif
|
||||
owner->room->frame_event.AddHpChg(owner->GetWeakPtrRef());
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
@ -2,11 +2,13 @@
|
||||
|
||||
#include "buff.h"
|
||||
|
||||
class PhaseAddBuff : public Buff
|
||||
class OnceChgAttrBuff : public Buff
|
||||
{
|
||||
public:
|
||||
|
||||
virtual void Activate() override;
|
||||
virtual void Deactivate() override;
|
||||
|
||||
private:
|
||||
void InternalProcOnceChgAttr();
|
||||
};
|
@ -1,13 +0,0 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include "buff/phase_add.h"
|
||||
|
||||
void PhaseAddBuff::Activate()
|
||||
{
|
||||
InternalTimerAddBuff();
|
||||
}
|
||||
|
||||
void PhaseAddBuff::Deactivate()
|
||||
{
|
||||
|
||||
}
|
@ -8,7 +8,6 @@
|
||||
#include "creature.h"
|
||||
#include "room.h"
|
||||
#include "mapinstance.h"
|
||||
#include "app.h"
|
||||
|
||||
void PullToWalkableBuff::Activate()
|
||||
{
|
||||
@ -20,9 +19,9 @@ void PullToWalkableBuff::Activate()
|
||||
abort();
|
||||
}
|
||||
owner->room->map_instance->UnScale(point);
|
||||
App::Instance()->verify_set_pos = 1;
|
||||
Global::Instance()->verify_set_pos = 1;
|
||||
owner->GetMutablePos().FromGlmVec3(point);
|
||||
App::Instance()->verify_set_pos = 0;
|
||||
Global::Instance()->verify_set_pos = 0;
|
||||
}
|
||||
|
||||
void PullToWalkableBuff::Deactivate()
|
||||
|
@ -15,29 +15,14 @@ void SelectTargetWithSelfPosBuff::Activate()
|
||||
hold_param3_ = meta->GetBuffParam3(this);
|
||||
hold_param4_ = meta->GetBuffParam4(this);
|
||||
std::vector<Creature*> targets;
|
||||
bool include_car = false;
|
||||
bool exclude_passenger = false;
|
||||
if (!meta->_buff_param8_int_set.empty()) {
|
||||
include_car = meta->_buff_param8_int_set.find(1) != meta->_buff_param8_int_set.end();
|
||||
exclude_passenger = meta->_buff_param8_int_set.find(2) != meta->_buff_param8_int_set.end();
|
||||
}
|
||||
owner->TraverseCreatures
|
||||
(
|
||||
[this, &targets, include_car, exclude_passenger] (Creature* c, bool& stop)
|
||||
[this, &targets] (Creature* c, bool& stop)
|
||||
{
|
||||
if (c->dead ||
|
||||
(c->IsCar() && !include_car) ||
|
||||
a8::HasBitFlag(c->status, CS_Disable) ||
|
||||
c->HasBuffEffect(kBET_Dive)
|
||||
) {
|
||||
c->IsCar()) {
|
||||
return;
|
||||
}
|
||||
if (exclude_passenger) {
|
||||
if (c->HasBuffEffect(kBET_Driver) &&
|
||||
c->HasBuffEffect(kBET_Passenger)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
float distance = owner->GetPos().Distance2D2(c->GetPos());
|
||||
float angle = 0.0f;
|
||||
if (distance > 0.0001f) {
|
||||
|
@ -20,31 +20,16 @@ void SelectTargetWithSpecPosBuff::Activate()
|
||||
meta->GetBuffParam7(this)
|
||||
);
|
||||
std::vector<Creature*> targets;
|
||||
bool include_car = false;
|
||||
bool exclude_passenger = false;
|
||||
if (!meta->_buff_param8_int_set.empty()) {
|
||||
include_car = meta->_buff_param8_int_set.find(1) != meta->_buff_param8_int_set.end();
|
||||
exclude_passenger = meta->_buff_param8_int_set.find(2) != meta->_buff_param8_int_set.end();
|
||||
}
|
||||
owner->TraverseCreatures
|
||||
(
|
||||
[this, &targets, ¢er, include_car, exclude_passenger] (Creature* c, bool& stop)
|
||||
[this, &targets, ¢er] (Creature* c, bool& stop)
|
||||
{
|
||||
if (c->dead ||
|
||||
(c->IsCar() && !include_car) ||
|
||||
a8::HasBitFlag(c->status, CS_Disable) ||
|
||||
c->HasBuffEffect(kBET_Dive)
|
||||
) {
|
||||
c->IsCar()) {
|
||||
return;
|
||||
}
|
||||
if (exclude_passenger) {
|
||||
if (c->HasBuffEffect(kBET_Driver) &&
|
||||
c->HasBuffEffect(kBET_Passenger)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
float distance = c->GetPos().Distance2D2(center);
|
||||
#ifdef MYDEBUG
|
||||
#ifdef DEBUG
|
||||
if (c->IsPlayer()) {
|
||||
a8::XPrintf("select spec pos distance:%f center:%f %f %f pos:%f %f %f range:%f\n",
|
||||
{
|
||||
@ -76,7 +61,7 @@ void SelectTargetWithSpecPosBuff::Activate()
|
||||
case kBST_FriendlyIncludeSelf:
|
||||
{
|
||||
if (c->team_id == owner->team_id) {
|
||||
#ifdef MYDEBUG
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("select spec pos distance:%f center:%f %f %f pos:%f %f %f range:%f\n",
|
||||
{
|
||||
distance,
|
||||
@ -124,7 +109,7 @@ void SelectTargetWithSpecPosBuff::Activate()
|
||||
);
|
||||
for (auto& target : targets) {
|
||||
for (int buff_id : meta->_buff_param2_int_list) {
|
||||
target->TryAddBuff(caster_.Get(), buff_id, skill_meta, init_args, buff_vars);
|
||||
target->TryAddBuff(caster_.Get(), buff_id, skill_meta);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "movement.h"
|
||||
#include "car.h"
|
||||
#include "human.h"
|
||||
#include "app.h"
|
||||
|
||||
#include "mt/Buff.h"
|
||||
#include "mt/Skill.h"
|
||||
@ -44,7 +43,7 @@ void SprintBuff::SprintMove()
|
||||
owner->SetAttackDir(owner->context_dir);
|
||||
owner->SetDisableMoveDirTimes(old_times);
|
||||
owner->IncDisableMoveDirTimes();
|
||||
#ifdef MYDEBUG
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("%s\n",
|
||||
{
|
||||
a8::Format("xxxxxxxx move_dir:%f,%f,%f attack_dir:%f,%f,%f speed:%d disable_move_dir:%d",
|
||||
@ -125,7 +124,7 @@ void SprintBuff::Check(Position& pre_pos, Position& src_pos, std::map<int, long
|
||||
[this] (int event, const a8::Args* args)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
#ifdef MYDEBUG1
|
||||
#ifdef DEBUG1
|
||||
a8::XPrintf("11111111111111111111111111\n", {});
|
||||
#endif
|
||||
owner->TryAddBuff(owner, meta->_int_buff_param1, skill_meta);
|
||||
@ -179,9 +178,9 @@ void SprintBuff::OnEnemyHit(Creature* enemy)
|
||||
void SprintBuff::SprintEnd()
|
||||
{
|
||||
if (owner->IsCar() && owner->AsCar()->GetDriver()) {
|
||||
App::Instance()->verify_set_pos = 1;
|
||||
Global::Instance()->verify_set_pos = 1;
|
||||
owner->AsCar()->GetDriver()->GetMovement()->ClearPath();
|
||||
App::Instance()->verify_set_pos = 0;
|
||||
Global::Instance()->verify_set_pos = 0;
|
||||
}
|
||||
owner->room->xtimer.SetTimeoutEx
|
||||
(
|
||||
@ -192,9 +191,9 @@ void SprintBuff::SprintEnd()
|
||||
owner->TryAddBuff(owner, meta->_int_buff_param1, skill_meta);
|
||||
owner->GetMovement()->ClearPath();
|
||||
if (owner->IsCar() && owner->AsCar()->GetDriver()) {
|
||||
App::Instance()->verify_set_pos = 1;
|
||||
Global::Instance()->verify_set_pos = 1;
|
||||
owner->AsCar()->GetDriver()->GetMovement()->ClearPath();
|
||||
App::Instance()->verify_set_pos = 0;
|
||||
Global::Instance()->verify_set_pos = 0;
|
||||
}
|
||||
owner->RemoveBuffByUniId(buff_uniid);
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
#include "room.h"
|
||||
#include "skill.h"
|
||||
#include "collision.h"
|
||||
#include "app.h"
|
||||
|
||||
#include "mt/Buff.h"
|
||||
#include "mt/Skill.h"
|
||||
@ -29,7 +28,7 @@ void TurnOverBuff::Activate()
|
||||
glm::vec3 old_dir = owner->GetMoveDir();
|
||||
Position old_pos = owner->GetPos();
|
||||
float distance = phase->phase_param1.GetDouble();
|
||||
#ifdef MYDEBUG
|
||||
#ifdef DEBUG
|
||||
caster_.Get()->SendDebugMsg(a8::Format("ProTurnOver currTimes:%d last_pos:%d,%d curr_pos:%d,%d",
|
||||
{
|
||||
skill->GetCurrTimes(),
|
||||
@ -39,9 +38,9 @@ void TurnOverBuff::Activate()
|
||||
owner->GetPos().GetY()
|
||||
}));
|
||||
#endif
|
||||
App::Instance()->verify_set_pos = 1;
|
||||
Global::Instance()->verify_set_pos = 1;
|
||||
owner->ForwardMove(distance);
|
||||
App::Instance()->verify_set_pos = 0;
|
||||
Global::Instance()->verify_set_pos = 0;
|
||||
owner->SetMoveDir(old_dir);
|
||||
if (phase->phase_param2.GetInt() == 1) {
|
||||
++owner->turn_over_times;
|
||||
@ -90,9 +89,9 @@ void TurnOverBuff::Activate()
|
||||
&target->xtimer_attacher);
|
||||
}
|
||||
}
|
||||
App::Instance()->verify_set_pos = 1;
|
||||
Global::Instance()->verify_set_pos = 1;
|
||||
owner->SetPos(curr_pos);
|
||||
App::Instance()->verify_set_pos = 0;
|
||||
Global::Instance()->verify_set_pos = 0;
|
||||
owner->room->grid_service->MoveCreature(owner);
|
||||
}
|
||||
if (!meta->_buff_param2_int_list.empty()) {
|
||||
|
@ -15,7 +15,7 @@ void UseSkillBuff::Activate()
|
||||
++skill->force_use_times;
|
||||
Position target_pos = owner->GetPos();
|
||||
owner->DoSkill(
|
||||
skill->GetBaseSkillMeta()->skill_id(),
|
||||
skill->meta->skill_id(),
|
||||
owner->GetUniId(),
|
||||
owner->GetAttackDir(),
|
||||
0
|
||||
|
@ -30,9 +30,6 @@
|
||||
#include "movement.h"
|
||||
#include "hero.h"
|
||||
#include "skill.h"
|
||||
#include "netdata.h"
|
||||
#include "cs_proto.pb.h"
|
||||
#include "team.h"
|
||||
|
||||
#include "mt/Param.h"
|
||||
#include "mt/Equip.h"
|
||||
@ -49,13 +46,7 @@ Bullet::Bullet():MoveableEntity()
|
||||
|
||||
Bullet::~Bullet()
|
||||
{
|
||||
SetDestorying();
|
||||
--PerfMonitor::Instance()->entity_num[ET_Bullet];
|
||||
if (IsFlyHook()) {
|
||||
if (sender.Get()) {
|
||||
sender.Get()->hook_hash.erase(GetUniId());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Bullet::Initialize()
|
||||
@ -78,11 +69,10 @@ void Bullet::Initialize()
|
||||
}
|
||||
if (sender.Get()) {
|
||||
sender.Get()->GetTrigger()->FlyHookCreate(this);
|
||||
sender.Get()->hook_hash[GetUniId()] = GetUniId();
|
||||
}
|
||||
Raycast();
|
||||
}
|
||||
#ifdef MYDEBUG
|
||||
#ifdef DEBUG
|
||||
if (DebugCmd::Enable() && sender.Get() && sender.Get() && sender.Get()->IsPlayer()) {
|
||||
glm::vec3 hit_pos;
|
||||
float ray_length;
|
||||
@ -100,46 +90,12 @@ void Bullet::Initialize()
|
||||
}
|
||||
}
|
||||
#endif
|
||||
switch (gun_meta->equip_subtype()) {
|
||||
case GUN_SUB_EQUIP_TYPE_FLY_LASER:
|
||||
{
|
||||
room->xtimer.SetTimeoutEx
|
||||
(SERVER_FRAME_RATE * 2,
|
||||
[this] (int event, const a8::Args* args)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
ForceRemove();
|
||||
}
|
||||
},
|
||||
&xtimer_attacher
|
||||
);
|
||||
|
||||
room->xtimer.SetIntervalEx
|
||||
(SERVER_FRAME_RATE,
|
||||
[this] (int event, const a8::Args* args)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
if (!later_removed_) {
|
||||
ProcLaster();
|
||||
}
|
||||
}
|
||||
},
|
||||
&xtimer_attacher
|
||||
);
|
||||
ProcLaster();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
{
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void Bullet::Update(int delta_time)
|
||||
{
|
||||
if (shot_animi_time <= (room->GetFrameNo() - create_frameno_) * FRAME_RATE_MS) {
|
||||
if (!trace_target_id && !reporter_list && !IsClientHook() && !IsSpecBullet()) {
|
||||
if (!trace_target_id && !reporter_list) {
|
||||
MapServiceUpdate();
|
||||
++updated_times_;
|
||||
}
|
||||
@ -161,9 +117,7 @@ void Bullet::OnHit(std::set<Entity*>& objects)
|
||||
ProcFlyHook(target);
|
||||
if (!c || (c->team_id != sender.Get()->team_id)) {
|
||||
if (!c || !c->IsCar()) {
|
||||
if (!ignore_original_dmg) {
|
||||
target->OnBulletHit(this);
|
||||
}
|
||||
target->OnBulletHit(this);
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -174,20 +128,11 @@ void Bullet::OnHit(std::set<Entity*>& objects)
|
||||
bool eat = false;
|
||||
if (!trace_target_id && !reporter_list) {
|
||||
if (mt::Param::s().bullet_through_wall_check) {
|
||||
if (!gun_meta->is_penetrate_thing() &&
|
||||
!room->BulletCanReach(born_pos.ToGlmVec3(), target->GetPos().ToGlmVec3())) {
|
||||
if (!room->BulletCanReach(born_pos.ToGlmVec3(), target->GetPos().ToGlmVec3())) {
|
||||
eat = true;
|
||||
}
|
||||
if (gun_meta->id() == 30905 && eat && sender.Get()) {
|
||||
glm::vec3 new_born_pos = born_pos.ToGlmVec3();
|
||||
new_born_pos.y = target->GetPos().GetY();
|
||||
if (gun_meta->is_penetrate_thing() ||
|
||||
room->BulletCanReach(new_born_pos, target->GetPos().ToGlmVec3())) {
|
||||
eat = false;
|
||||
}
|
||||
}
|
||||
if (sender.Get() && sender.Get()->IsPlayer()) {
|
||||
#ifdef MYDEBUG
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("eat %d xxxxxxxxxxxxxxxxxxxxxxxx\n", {eat});
|
||||
#endif
|
||||
}
|
||||
@ -196,9 +141,7 @@ void Bullet::OnHit(std::set<Entity*>& objects)
|
||||
if (!eat) {
|
||||
bool old_is_dead = target->IsDead(room);
|
||||
TriggerHitBuff(target);
|
||||
if (!ignore_original_dmg) {
|
||||
target->OnBulletHit(this);
|
||||
}
|
||||
target->OnBulletHit(this);
|
||||
if (target->IsDead(room) && !old_is_dead) {
|
||||
OnKillTarget(target);
|
||||
}
|
||||
@ -292,8 +235,9 @@ void Bullet::ProcBomb()
|
||||
}
|
||||
if (IsCurrWeapon() &&
|
||||
sender.Get() &&
|
||||
sender.Get()->GetAbility()->HasAttr(kHVAT_WeaponExplosionDealyTime) > 0) {
|
||||
delay_time = delay_time + sender.Get()->GetAbility()->GetAttr(kHVAT_WeaponExplosionDealyTime);
|
||||
sender.Get()->GetAbility()->GetAttrAbs(kHAT_WeaponExplosionDealyTime) > 0) {
|
||||
delay_time = delay_time -
|
||||
sender.Get()->GetAbility()->GetAttrAbs(kHAT_WeaponExplosionDealyTime);
|
||||
delay_time = std::max(0, delay_time);
|
||||
}
|
||||
{
|
||||
@ -437,7 +381,7 @@ void Bullet::ProcSmokeBomb()
|
||||
(SERVER_FRAME_RATE * mt::Param::GetIntParam("smoke_duration", 10),
|
||||
[task] (int event, const a8::Args* args)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
if (a8::TIMER_DELETE_EVENT == event) {
|
||||
task->Done();
|
||||
}
|
||||
},
|
||||
@ -482,7 +426,7 @@ void Bullet::MapServiceUpdate()
|
||||
auto old_pos = GetPos();
|
||||
GetMutablePos().AddGlmVec3(dir * step_len);
|
||||
float distance = GetPos().DistanceGlmVec3(born_pos.ToGlmVec3());
|
||||
#ifdef MYDEBUG
|
||||
#ifdef DEBUG
|
||||
if (IsFlyHook()) {
|
||||
a8::XPrintf("step_len:%f born_pos:%f,%f,%f curr_pos:%f,%f,%f old_pos:%f,%f,%f distance:%f %f\n",
|
||||
{
|
||||
@ -518,7 +462,7 @@ void Bullet::MapServiceUpdate()
|
||||
Check(distance);
|
||||
}
|
||||
} while(!later_removed_ && move_length >= 0.0001f);
|
||||
#ifdef MYDEBUG1
|
||||
#ifdef DEBUG1
|
||||
{
|
||||
if (sender.Get()->IsPlayer()) {
|
||||
if ((room->GetFrameNo() - create_frameno_) % 2 == 0) {
|
||||
@ -554,14 +498,18 @@ float Bullet::GetAtk()
|
||||
atk *= android->ai->GetAttackRate();
|
||||
#endif
|
||||
}
|
||||
return atk;
|
||||
float attr_rate = 1 + ability_->GetAttrRate(kHAT_Atk);
|
||||
if (IsCurrWeapon()) {
|
||||
attr_rate += ability_->GetAttrRate(kHAT_WeaponDmg);
|
||||
}
|
||||
return atk * attr_rate;
|
||||
}
|
||||
|
||||
float Bullet::GetExplosionRange()
|
||||
{
|
||||
float e_range = gun_meta->explosion_range();
|
||||
if (IsCurrWeapon()) {
|
||||
e_range *= (1 + ability_->GetAttr(kHVAT_WeaponExplosionRange));
|
||||
e_range *= (1 + ability_->GetAttrRate(kHAT_WeaponExplosionRange));
|
||||
}
|
||||
return e_range;
|
||||
}
|
||||
@ -576,8 +524,6 @@ void Bullet::Check(float distance)
|
||||
GetHitThings(result);
|
||||
if (result.o_hit_num <= 0) {
|
||||
GetHitCreatures(result);
|
||||
} else {
|
||||
|
||||
}
|
||||
if (!result.objects.empty() ||
|
||||
#if 1
|
||||
@ -735,6 +681,9 @@ bool Bullet::IsPreBattleBullet()
|
||||
if (room->IsPveRoom()) {
|
||||
return false;
|
||||
}
|
||||
if (room->IsNewBieRoom()) {
|
||||
return false;
|
||||
}
|
||||
return create_frameno_ <= room->GetBattleStartFrameNo() || room->GetBattleStartFrameNo() == 0;
|
||||
}
|
||||
|
||||
@ -749,9 +698,7 @@ void Bullet::OnKillTarget(Entity* target)
|
||||
if (sender.Get()->IsHero() &&
|
||||
sender.Get()->AsHero()->master.Get() &&
|
||||
sender.Get()->AsHero()->master.Get()->IsHuman()) {
|
||||
#if 0
|
||||
sender.Get()->AsHero()->master.Get()->AsHuman()->stats->kills++;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -858,9 +805,6 @@ void Bullet::ForceRemove()
|
||||
if (!keep_shot_animi_timer_ptr.expired()) {
|
||||
room->xtimer.Delete(keep_shot_animi_timer_ptr);
|
||||
}
|
||||
if (on_bullet_exit) {
|
||||
on_bullet_exit(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -892,13 +836,12 @@ void Bullet::GetHitThings(BulletCheckResult& result)
|
||||
room->grid_service->TraverseObstacles
|
||||
(room->GetRoomIdx(),
|
||||
GetGridList(),
|
||||
[this, &result] (Obstacle* ob, bool& stop) mutable
|
||||
[this, result] (Obstacle* ob, bool& stop) mutable
|
||||
{
|
||||
#if 1
|
||||
if (!ob->CanThroughable(this) && !ob->IsDead(room)) {
|
||||
if (Collision::CheckBullet(this, ob)) {
|
||||
result.objects.insert(ob);
|
||||
++result.o_hit_num;
|
||||
}
|
||||
}
|
||||
#else
|
||||
@ -918,7 +861,7 @@ void Bullet::GetHitThings(BulletCheckResult& result)
|
||||
if (ret) {
|
||||
strengthened_ = true;
|
||||
OnStrengthen(ob);
|
||||
#ifdef MYDEBUG
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("命中能量墙\n", {});
|
||||
#endif
|
||||
}
|
||||
@ -947,9 +890,6 @@ void Bullet::GetHitCreatures(BulletCheckResult& result)
|
||||
if (c->HasBuffEffect(kBET_BulletThrough)) {
|
||||
return;
|
||||
}
|
||||
if (c->HasBuffEffect(kBET_Dive)) {
|
||||
return;
|
||||
}
|
||||
if (c->HasBuffEffect(kBET_HoldShield)) {
|
||||
c->CheckBulletHitHoldShield(this, result.eat);
|
||||
if (result.eat) {
|
||||
@ -959,7 +899,7 @@ void Bullet::GetHitCreatures(BulletCheckResult& result)
|
||||
}
|
||||
if (c != sender.Get() && !c->dead &&
|
||||
Collision::CheckBullet(this, c)) {
|
||||
#ifdef MYDEBUG
|
||||
#ifdef DEBUG
|
||||
if (IsFlyHook()) {
|
||||
a8::XPrintf("bullet hit\n", {});
|
||||
}
|
||||
@ -974,11 +914,8 @@ void Bullet::GetHitCreatures(BulletCheckResult& result)
|
||||
}
|
||||
} else {
|
||||
result.objects.insert(c);
|
||||
#ifdef MYDEBUG1
|
||||
a8::XPrintf("GetHitCreatures gun_id:%d\n", {gun_meta->id()});
|
||||
#endif
|
||||
++result.c_hit_num;
|
||||
if (gun_meta->ispenetrate()) {
|
||||
++result.c_hit_num;
|
||||
hit_objects_.insert(c->GetUniId());
|
||||
}
|
||||
}
|
||||
@ -1008,7 +945,7 @@ void Bullet::ProcNormalBullet(BulletCheckResult& result)
|
||||
}
|
||||
if (need_remove) {
|
||||
if (IsFlyHook()) {
|
||||
#ifdef MYDEBUG
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("ProcHookHit\n",
|
||||
{
|
||||
});
|
||||
@ -1071,9 +1008,6 @@ float Bullet::GetHitRadius()
|
||||
hit_radius = GetExplosionRange();
|
||||
}
|
||||
}
|
||||
if (gun_meta->id() == 30905) {
|
||||
hit_radius = 20;
|
||||
}
|
||||
return hit_radius;
|
||||
}
|
||||
|
||||
@ -1092,14 +1026,7 @@ void Bullet::Raycast()
|
||||
glm::vec3 hit_point;
|
||||
sender.Get()->room->map_instance->Scale(start);
|
||||
sender.Get()->room->map_instance->Scale(end);
|
||||
bool ret = sender.Get()->room->map_instance->Raycast
|
||||
(start,
|
||||
end,
|
||||
hit_point,
|
||||
hit_result,
|
||||
room->map_instance->GetBulletIncludeFlags(),
|
||||
room->map_instance->GetBulletExcludeFlags()
|
||||
);
|
||||
bool ret = sender.Get()->room->map_instance->Raycast(start, end, hit_point, hit_result);
|
||||
if (ret && hit_result) {
|
||||
raycast_hited = true;
|
||||
sender.Get()->room->map_instance->UnScale(hit_point);
|
||||
@ -1108,7 +1035,7 @@ void Bullet::Raycast()
|
||||
} else {
|
||||
raycast_len_ = gun_meta->range();
|
||||
}
|
||||
#ifdef MYDEBUG
|
||||
#ifdef DEBUG
|
||||
float distance = 0.0f;
|
||||
if (hit_result) {
|
||||
glm::vec3 v1 = raycast_hit_point_;
|
||||
@ -1142,6 +1069,7 @@ void Bullet::ProcRequestBulletDmg(int shield_hit, int strength_wall_uniid, int t
|
||||
if (!sender.Get()) {
|
||||
return;
|
||||
}
|
||||
|
||||
GetMutablePos().FromGlmVec3(pos);
|
||||
room->grid_service->MoveBullet(this);
|
||||
float distance = GlmHelper::Norm(GetPos().ToGlmVec3() - born_pos.ToGlmVec3());
|
||||
@ -1187,6 +1115,9 @@ void Bullet::ProcRequestBulletDmg(int shield_hit, int strength_wall_uniid, int t
|
||||
|
||||
const mt::Skill* Bullet::GetSkillMeta()
|
||||
{
|
||||
if (sender.Get() && skill_meta) {
|
||||
return sender.Get()->GetAdjustSkillMeta(skill_meta);
|
||||
}
|
||||
return skill_meta;
|
||||
}
|
||||
|
||||
@ -1207,83 +1138,3 @@ bool Bullet::NoAdjustPos()
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void Bullet::ReportHookHitPos(int hit_obj_uniid, const glm::vec3& hit_pos)
|
||||
{
|
||||
if (later_removed_) {
|
||||
return;
|
||||
}
|
||||
if (sender.Get()) {
|
||||
Creature* hit_obj = room->GetCreatureByUniId(hit_obj_uniid);
|
||||
BulletCheckResult result;
|
||||
if (hit_obj && hit_obj->GetPos().Distance2D2(GetPos()) < raycast_len_ + 50) {
|
||||
++result.c_hit_num;
|
||||
result.objects.insert(hit_obj);
|
||||
GetMutablePos().FromGlmVec3(hit_obj->GetPos().ToGlmVec3());
|
||||
room->grid_service->MoveBullet(this);
|
||||
result.flyed_distance = hit_obj->GetPos().Distance2D2(sender.Get()->GetPos());
|
||||
} else {
|
||||
GetMutablePos().FromGlmVec3(dir * raycast_len_);
|
||||
result.flyed_distance = raycast_len_;
|
||||
}
|
||||
ProcNormalBullet(result);
|
||||
}
|
||||
}
|
||||
|
||||
bool Bullet::IsClientHook()
|
||||
{
|
||||
if (!IsFlyHook() ||
|
||||
!sender.Get()) {
|
||||
return false;
|
||||
}
|
||||
if (!sender.Get()->IsPlayer()) {
|
||||
return false;
|
||||
}
|
||||
if (sender.Get()->GetNetData()->join_msg &&
|
||||
sender.Get()->GetNetData()->join_msg->proto_version() > 0 &&
|
||||
sender.Get()->GetNetData()->join_msg->proto_version() < 2023121501) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
bool Bullet::IsSpecBullet()
|
||||
{
|
||||
return (gun_meta->equip_subtype() == GUN_SUB_EQUIP_TYPE_FLY_LASER);
|
||||
}
|
||||
|
||||
void Bullet::ProcLaster()
|
||||
{
|
||||
std::set<Entity*> objects;
|
||||
room->TraverseCreatureList
|
||||
(
|
||||
[this, &objects] (Creature* c) -> bool
|
||||
{
|
||||
if (c->team_id == sender.Get()->GetTeam()->GetTeamId()) {
|
||||
return true;
|
||||
}
|
||||
if (c->dead) {
|
||||
return true;
|
||||
}
|
||||
if (c->IsInvincible()) {
|
||||
return true;
|
||||
}
|
||||
glm::vec3 ray_orig = born_pos.ToGlmVec3();
|
||||
ray_orig.y = 0.0f;
|
||||
glm::vec3 ray_dir = dir;
|
||||
ray_dir.y = 0.0f;
|
||||
glm::vec3 sphere_center = c->GetPos().ToGlmVec3();
|
||||
sphere_center.y = 0.0f;
|
||||
|
||||
float intersection_distance = 0.0;
|
||||
bool ret = Collision::IntersectRaySphere(GetHitRadius(),
|
||||
ray_orig, ray_dir, sphere_center, c->GetHitRadius(),
|
||||
intersection_distance);
|
||||
if (ret) {
|
||||
objects.insert(c);
|
||||
}
|
||||
return true;
|
||||
});
|
||||
OnHit(objects);
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ class Ability;
|
||||
class Bullet : public MoveableEntity, public IBullet
|
||||
{
|
||||
public:
|
||||
int shot_uniid = 0;
|
||||
long long weapon_uniid = 0;
|
||||
int gun_lv = 0;
|
||||
int spec_gun_buff_id = 0;
|
||||
@ -33,10 +32,7 @@ class Bullet : public MoveableEntity, public IBullet
|
||||
a8::XTimerWp keep_shot_animi_timer_ptr;
|
||||
float shot_animi_time = 0.0f;
|
||||
std::shared_ptr<std::set<int>> reporter_list;
|
||||
bool ignore_original_dmg = false;
|
||||
std::function<void(Bullet*)> on_bullet_exit = nullptr;
|
||||
int duration = 0;
|
||||
std::shared_ptr<float> scale;
|
||||
|
||||
|
||||
virtual ~Bullet() override;
|
||||
virtual void Initialize() override;
|
||||
@ -65,8 +61,6 @@ class Bullet : public MoveableEntity, public IBullet
|
||||
virtual const Position& GetPos() override;
|
||||
virtual void ProcRequestBulletDmg(int shield_hit, int strength_wall_uniid, int target_uniid, const glm::vec3& pos) override;
|
||||
|
||||
void ReportHookHitPos(int hit_obj_uniid, const glm::vec3& hit_pos);
|
||||
|
||||
protected:
|
||||
Bullet();
|
||||
|
||||
@ -83,7 +77,6 @@ protected:
|
||||
void ProcShieldWallBomb(int delay_time);
|
||||
void ProcOilBucketBomb(int delay_time);
|
||||
void ProcFlyHook(Entity* target);
|
||||
void ProcLaster();
|
||||
inline void MapServiceUpdate();
|
||||
void Check(float distance);
|
||||
void AddGunBuff();
|
||||
@ -93,8 +86,6 @@ protected:
|
||||
void GetHitThings(BulletCheckResult& result);
|
||||
void GetHitCreatures(BulletCheckResult& result);
|
||||
void Raycast();
|
||||
bool IsClientHook();
|
||||
bool IsSpecBullet();
|
||||
|
||||
private:
|
||||
bool later_removed_ = false;
|
||||
|
@ -29,8 +29,6 @@
|
||||
#include "mt/Equip.h"
|
||||
#include "mt/Buff.h"
|
||||
#include "mt/MapThing.h"
|
||||
#include "mt/Map.h"
|
||||
#include "mt/BattleBasicAttribute.h"
|
||||
|
||||
Car::Car():Creature()
|
||||
{
|
||||
@ -39,7 +37,6 @@ Car::Car():Creature()
|
||||
|
||||
Car::~Car()
|
||||
{
|
||||
SetDestorying();
|
||||
--PerfMonitor::Instance()->entity_num[ET_Car];
|
||||
}
|
||||
|
||||
@ -67,7 +64,7 @@ void Car::Initialize()
|
||||
cur_oil_ = meta->max_oil();
|
||||
{
|
||||
auto context = std::make_shared<BattleDataContext>();
|
||||
SetNetData(context);
|
||||
SetBattleContext(context);
|
||||
context->ForceInit
|
||||
(
|
||||
App::Instance()->AllocTempHeroUniId(),
|
||||
@ -77,25 +74,20 @@ void Car::Initialize()
|
||||
0,
|
||||
nullptr
|
||||
);
|
||||
GetNetData()->Init(this);
|
||||
GetBattleContext()->Init(this);
|
||||
if (weapon_meta) {
|
||||
GetCurrWeapon()->ammo = GetCurrWeapon()->GetClipVolume(this);
|
||||
}
|
||||
}
|
||||
SetHP(GetNetData()->GetMaxHP());
|
||||
SetHP(GetBattleContext()->GetMaxHP());
|
||||
SetMaxHP(std::max(GetHP(), GetMaxHP()));
|
||||
{
|
||||
std::vector<int> skill_list;
|
||||
GetNetData()->GetSkillList(skill_list);
|
||||
GetBattleContext()->GetSkillList(skill_list);
|
||||
for (auto& skill_id : skill_list) {
|
||||
AddSkill(skill_id);
|
||||
}
|
||||
}
|
||||
if (GetHeroMeta()->GetBasicMeta()) {
|
||||
SetHeroLevel(1, 0, GetHeroMeta()->GetBasicMeta()->GetGrowMeta(room->GetMapMeta()->map_id()));
|
||||
} else {
|
||||
SetHeroLevel(1, 0, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
Human* Car::GetPassengerBySeat(int seat)
|
||||
@ -126,9 +118,9 @@ void Car::GetDown(Human* passenger)
|
||||
passenger->CancelAction();
|
||||
passenger->RemoveBuffByEffectId(kBET_Driver);
|
||||
passenger->RemoveBuffByEffectId(kBET_Passenger);
|
||||
App::Instance()->verify_set_pos = 1;
|
||||
Global::Instance()->verify_set_pos = 1;
|
||||
passenger->SetPos(passenger->GetPos());
|
||||
App::Instance()->verify_set_pos = 0;
|
||||
Global::Instance()->verify_set_pos = 0;
|
||||
room->frame_event.AddCarChg(passenger->GetWeakPtrRef());
|
||||
if (passengers_.empty()) {
|
||||
team_id = 0;
|
||||
@ -184,9 +176,9 @@ void Car::GetOn(Human* passenger)
|
||||
}
|
||||
passenger->SetCar(this);
|
||||
passenger->SetSeat(seat);
|
||||
App::Instance()->verify_set_pos = 1;
|
||||
Global::Instance()->verify_set_pos = 1;
|
||||
passenger->SetPos(GetPos());
|
||||
App::Instance()->verify_set_pos = 0;
|
||||
Global::Instance()->verify_set_pos = 0;
|
||||
{
|
||||
const mt::Buff* buff_meta = mt::Buff::GetById
|
||||
(driver_ == passenger ? DRIVER_BUFFID : PASSENGER_BUFFID);
|
||||
@ -276,7 +268,7 @@ int Car::AllocSeat()
|
||||
void Car::SyncPos()
|
||||
{
|
||||
if (driver_) {
|
||||
App::Instance()->verify_set_pos = 1;
|
||||
Global::Instance()->verify_set_pos = 1;
|
||||
SetPos(driver_->GetPos());
|
||||
SetMoveDir(driver_->GetMoveDir());
|
||||
for (auto hum : passengers_) {
|
||||
@ -286,7 +278,7 @@ void Car::SyncPos()
|
||||
room->grid_service->MoveCreature(hum);
|
||||
}
|
||||
}
|
||||
App::Instance()->verify_set_pos = 0;
|
||||
Global::Instance()->verify_set_pos = 0;
|
||||
room->grid_service->MoveCreature(this);
|
||||
}
|
||||
}
|
||||
@ -296,11 +288,16 @@ float Car::GetRadius()
|
||||
return hero_meta_->radius();
|
||||
}
|
||||
|
||||
float Car::GetSpeed()
|
||||
{
|
||||
return Creature::GetSpeed();
|
||||
}
|
||||
|
||||
void Car::OnBulletHit(IBullet* bullet)
|
||||
{
|
||||
if (!IsDead(room)) {
|
||||
//超能电磁枪已删除
|
||||
float finaly_dmg = bullet->GetSender().Get()->GetNetData()->CalcDmg(this, bullet);
|
||||
float finaly_dmg = bullet->GetSender().Get()->GetBattleContext()->CalcDmg(this, bullet);
|
||||
if (bullet->GetBulletMeta()->_buff_meta) {
|
||||
MustBeAddBuff(bullet->GetSender().Get(), bullet->GetBulletMeta()->buffid());
|
||||
}
|
||||
@ -312,18 +309,16 @@ void Car::OnBulletHit(IBullet* bullet)
|
||||
bullet->GetGunMeta()->id(),
|
||||
bullet->GetSender().Get()->GetUniId(),
|
||||
bullet->GetSender().Get()->GetName(),
|
||||
dmg_out,
|
||||
0,
|
||||
0);
|
||||
dmg_out);
|
||||
if (bullet->GetSender().Get() &&
|
||||
!bullet->GetSender().Get()->dead &&
|
||||
dmg_out > 0.0f &&
|
||||
!bullet->GetSkillMeta()
|
||||
) {
|
||||
{
|
||||
if (bullet->GetSender().Get()->GetNetData()->GetBrainLifePct() > 0.0f) {
|
||||
if (bullet->GetSender().Get()->GetBattleContext()->GetBrainLifePct() > 0.0f) {
|
||||
float recover_hp = dmg_out *
|
||||
bullet->GetSender().Get()->GetNetData()->GetBrainLifePct();
|
||||
bullet->GetSender().Get()->GetBattleContext()->GetBrainLifePct();
|
||||
if (recover_hp > 0.0f) {
|
||||
bullet->GetSender().Get()->AddHp(recover_hp);
|
||||
}
|
||||
@ -335,9 +330,9 @@ void Car::OnBulletHit(IBullet* bullet)
|
||||
if (hero->GetAbility()->GetSwitchTimes(kEnableDmgForwardTimes) > 0 &&
|
||||
hero->master.Get() &&
|
||||
!hero->master.Get()->dead &&
|
||||
hero->master.Get()->GetNetData()->GetBrainLifePct() > 0.0f){
|
||||
hero->master.Get()->GetBattleContext()->GetBrainLifePct() > 0.0f){
|
||||
float recover_hp = dmg_out *
|
||||
hero->master.Get()->GetNetData()->GetBrainLifePct();
|
||||
hero->master.Get()->GetBattleContext()->GetBrainLifePct();
|
||||
if (recover_hp > 0.0f) {
|
||||
hero->master.Get()->AddHp(recover_hp);
|
||||
}
|
||||
@ -375,21 +370,19 @@ void Car::OnExplosionHit(Explosion* e)
|
||||
}
|
||||
|
||||
float dmg_out = 0.0f;
|
||||
float finaly_dmg = GetNetData()->CalcDmg(e);
|
||||
float finaly_dmg = GetBattleContext()->CalcDmg(e);
|
||||
DecHP(finaly_dmg,
|
||||
VP_Explosion,
|
||||
"",
|
||||
e->GetExplosionEffect(),
|
||||
real_killer_id,
|
||||
real_killer_name,
|
||||
dmg_out,
|
||||
0,
|
||||
0);
|
||||
dmg_out);
|
||||
}
|
||||
|
||||
void Car::DecHP(float dec_hp, int killer_id, const std::string killer_name, int weapon_id,
|
||||
int real_killer_id, const std::string real_killer_name,
|
||||
float& real_dmg_out, int dmg_type, int dmg_bp)
|
||||
float& real_dmg_out)
|
||||
{
|
||||
real_dmg_out = 0.0f;
|
||||
if (dec_hp < 0.001f) {
|
||||
@ -399,9 +392,6 @@ void Car::DecHP(float dec_hp, int killer_id, const std::string killer_name, int
|
||||
float old_health = GetHP();
|
||||
float new_health = std::max(0.0f, GetHP() - dec_hp);
|
||||
SetHP(std::max(0.0f, new_health));
|
||||
if (old_health - GetHP() > 0.001f) {
|
||||
real_dmg_out = old_health - GetHP();
|
||||
}
|
||||
if (GetHP() <= 0.0001f && !IsDead(room)) {
|
||||
BeKill(killer_id, killer_name, weapon_id);
|
||||
}
|
||||
@ -422,13 +412,12 @@ void Car::DecHP(float dec_hp, int killer_id, const std::string killer_name, int
|
||||
cur_buff_id_ = std::get<1>(meta->_car_buff_list[cur_buff_idx_]);
|
||||
if (cur_buff_id_ != 0) {
|
||||
MustBeAddBuff(this, cur_buff_id_);
|
||||
#ifdef MYDEBUG
|
||||
#ifdef DEBUG
|
||||
#endif
|
||||
}
|
||||
}
|
||||
Creature* killer = room->GetCreatureByUniId(real_killer_id);
|
||||
if (killer && real_dmg_out > 0.999) {
|
||||
bool only_self = !room->IsMobaModeRoom();
|
||||
if (killer->IsPlayer()) {
|
||||
room->frame_event.AddPropChgEx
|
||||
(
|
||||
@ -438,7 +427,7 @@ void Car::DecHP(float dec_hp, int killer_id, const std::string killer_name, int
|
||||
real_dmg_out,
|
||||
0,
|
||||
killer->GetUniId(),
|
||||
only_self);
|
||||
true);
|
||||
} else if (killer->IsHero() &&
|
||||
killer->AsHero()->master.Get() &&
|
||||
killer->AsHero()->master.Get()->IsPlayer()) {
|
||||
@ -450,7 +439,7 @@ void Car::DecHP(float dec_hp, int killer_id, const std::string killer_name, int
|
||||
real_dmg_out,
|
||||
0,
|
||||
killer->AsHero()->master.Get()->GetUniId(),
|
||||
only_self);
|
||||
true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -499,7 +488,6 @@ void Car::BeKill(int killer_id, const std::string& killer_name, int weapon_id)
|
||||
);
|
||||
room->NotifyUiUpdate();
|
||||
room->frame_event.AddDead(GetWeakPtrRef(), 0);
|
||||
AllocDeadExp(killer_id);
|
||||
GetTrigger()->Die(killer_id, weapon_id);
|
||||
}
|
||||
|
||||
@ -531,7 +519,7 @@ void Car::SetAttackDir(const glm::vec3& attack_dir)
|
||||
|
||||
void Car::DecOil(float dec_oil)
|
||||
{
|
||||
dec_oil *= 1 + GetAbility()->GetAttr(kHVAT_CarOil);
|
||||
dec_oil *= 1 - GetAbility()->GetAttrRate(kHAT_CarOil);
|
||||
cur_oil_ -= dec_oil;
|
||||
cur_oil_ = std::max(0.0f, cur_oil_);
|
||||
if (!HasOil()) {
|
||||
@ -582,15 +570,9 @@ void Car::OnKillTarget(Creature* target)
|
||||
if (target->IsHuman()) {
|
||||
for (auto passenger : passengers_) {
|
||||
++passenger->stats->ride_car_kills;
|
||||
#if 0
|
||||
++passenger->stats->kills;
|
||||
#endif
|
||||
}
|
||||
if (driver_) {
|
||||
++driver_->stats->ride_car_kills;
|
||||
#if 0
|
||||
++driver_->stats->kills;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -627,16 +609,16 @@ void Car::Update(int delta_time)
|
||||
}
|
||||
if (GetMovement()->GetPathSize() > 0 ||
|
||||
HasBuffEffect(kBET_Sprint)) {
|
||||
App::Instance()->verify_set_pos = 1;
|
||||
Global::Instance()->verify_set_pos = 1;
|
||||
UpdateMove();
|
||||
App::Instance()->verify_set_pos = 0;
|
||||
Global::Instance()->verify_set_pos = 0;
|
||||
if (GetDriver()) {
|
||||
App::Instance()->verify_set_pos = 1;
|
||||
Global::Instance()->verify_set_pos = 1;
|
||||
GetDriver()->SetPos(GetPos());
|
||||
App::Instance()->verify_set_pos = 0;
|
||||
Global::Instance()->verify_set_pos = 0;
|
||||
}
|
||||
SyncPos();
|
||||
#ifdef MYDEBUG1
|
||||
#ifdef DEBUG1
|
||||
a8::XPrintf("updatemove old_pos:%f,%f new_pos:%f,%f\n",
|
||||
{
|
||||
old_pos.x,
|
||||
|
@ -39,12 +39,11 @@ class Car : public Creature
|
||||
void DecOil(float dec_oil);
|
||||
bool HasPassenter() { return !passengers_.empty();};
|
||||
virtual float GetRadius() override;
|
||||
virtual float GetSpeed() override;
|
||||
virtual void DecHP(float dec_hp,
|
||||
int killer_id, const std::string killer_name, int weapon_id,
|
||||
int real_killer_id, const std::string real_killer_name,
|
||||
float& real_dmg_out,
|
||||
int dmg_type,
|
||||
int dmg_bp) override;
|
||||
float& real_dmg_out) override;
|
||||
virtual void SendDebugMsg(const std::string& debug_msg) override;
|
||||
virtual void SetAttackDir(const glm::vec3& attack_dir) override;
|
||||
virtual void DropItems(Obstacle* obstacle) override;
|
||||
|
@ -3,9 +3,6 @@
|
||||
#include <math.h>
|
||||
|
||||
#include <a8/collision.h>
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/matrix_transform.hpp>
|
||||
#include <glm/gtx/intersect.hpp>
|
||||
|
||||
#include "collision.h"
|
||||
#include "creature.h"
|
||||
@ -17,7 +14,7 @@
|
||||
#include "mt/MapThing.h"
|
||||
#include "mt/Hero.h"
|
||||
|
||||
static const float GUN_HEIGHT = 20.0f;
|
||||
static const float GUN_HEIGHT = 10.0f;
|
||||
|
||||
bool Collision::CheckBullet(IBullet* bullet, Creature* c)
|
||||
{
|
||||
@ -26,6 +23,9 @@ bool Collision::CheckBullet(IBullet* bullet, Creature* c)
|
||||
bullet_real_pos = bullet->GetPos().ToGlmVec3();
|
||||
}
|
||||
float bullet_hit_radius = bullet->GetHitRadius();
|
||||
if (c->room->IsNewBieRoom()) {
|
||||
bullet_hit_radius += 3;
|
||||
}
|
||||
bool ret = a8::IntersectCylinderCylinder
|
||||
(
|
||||
bullet_real_pos, bullet_hit_radius * 1.0, GUN_HEIGHT,
|
||||
@ -127,7 +127,7 @@ bool Collision::Check2dRotationRectangle(float rx, float ry, float r, float dx,
|
||||
float tmp_dy = std::min(new_ry, dh * 0.5f);
|
||||
float tmp_dy1 = std::max(tmp_dy, -dh * 0.5f);
|
||||
|
||||
#ifdef MYDEBUG1
|
||||
#ifdef DEBUG1
|
||||
a8::XPrintf("new_rx:%f new_ry:%f dx1:%f dy1:%f dro:%f v1:%f v2:%f r:%f,%f d:%f,%f\n",
|
||||
{
|
||||
new_rx,
|
||||
@ -144,25 +144,6 @@ bool Collision::Check2dRotationRectangle(float rx, float ry, float r, float dx,
|
||||
return (tmp_dx1 - new_rx) * (tmp_dx1 - new_rx) + (tmp_dy1 - new_ry) * (tmp_dy1 - new_ry) <= r * r;
|
||||
}
|
||||
|
||||
bool Collision::IntersectRaySphere(float ray_width,
|
||||
glm::vec3 ray_starting, glm::vec3 ray_normalized_direction,
|
||||
glm::vec3 sphere_center, float sphere_radius,
|
||||
float &intersection_distance
|
||||
)
|
||||
{
|
||||
ray_starting.y = 0.0f;
|
||||
ray_normalized_direction.y = 0.0f;
|
||||
sphere_center.y = 0.0f;
|
||||
sphere_radius += ray_width * 0.5f;
|
||||
|
||||
glm::vec3 intersection_position;
|
||||
glm::vec3 intersection_normal;
|
||||
|
||||
bool ret = glm::intersectRaySphere(ray_starting, ray_normalized_direction, sphere_center, sphere_radius,
|
||||
intersection_position, intersection_normal);
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool Collision::InSquare(const glm::vec3& center, const glm::vec3& pos, float side_len)
|
||||
{
|
||||
float x_distance = std::fabs(pos.x - center.x);
|
||||
|
@ -22,14 +22,7 @@ class Collision
|
||||
--dw dh 矩形长宽
|
||||
--dro 矩形旋转角度
|
||||
*/
|
||||
static bool Check2dRotationRectangle(float rx, float ry, float r,
|
||||
float dx, float dy, float dw, float dh, float dro);
|
||||
|
||||
static bool IntersectRaySphere(float ray_width,
|
||||
glm::vec3 ray_starting, glm::vec3 ray_normalized_direction,
|
||||
glm::vec3 sphere_center, float sphere_radius,
|
||||
float &intersection_distance
|
||||
);
|
||||
static bool Check2dRotationRectangle(float rx, float ry, float r, float dx, float dy, float dw, float dh, float dro);
|
||||
|
||||
static bool InSquare(const glm::vec3& center, const glm::vec3& pos, float side_len);
|
||||
|
||||
|
@ -13,11 +13,6 @@
|
||||
#include "incubator.h"
|
||||
#include "mapinstance.h"
|
||||
#include "team.h"
|
||||
#include "loot.h"
|
||||
#include "ability.h"
|
||||
#include "trigger.h"
|
||||
#include "boxdrop.h"
|
||||
#include "netdata.h"
|
||||
|
||||
#include "cs_proto.pb.h"
|
||||
|
||||
@ -27,12 +22,10 @@
|
||||
#include "mt/Buff.h"
|
||||
#include "mt/Robot.h"
|
||||
#include "mt/Hero.h"
|
||||
#include "mt/MapThing.h"
|
||||
|
||||
void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
|
||||
void Player::_CMExecCommand(f8::MsgHdr& hdr, const cs::CMExecCommand& msg)
|
||||
{
|
||||
#ifdef MYDEBUG
|
||||
#ifndef MYDEBUG
|
||||
#ifndef DEBUG
|
||||
return;
|
||||
#endif
|
||||
std::vector<std::string> cmds;
|
||||
@ -71,13 +64,6 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
|
||||
room->grid_service->MoveCreature(this);
|
||||
}
|
||||
}
|
||||
} else if (cmd == "goto_box") {
|
||||
glm::vec3 pos;
|
||||
if (room->GetBoxDrop()->GetNextBoxPos(pos)) {
|
||||
GetMutablePos().FromGlmVec3(pos);
|
||||
GetMovement()->ClearPath();
|
||||
room->grid_service->MoveCreature(this);
|
||||
}
|
||||
} else if (cmd == "additem" && cmds.size() >= 3) {
|
||||
int item_id = a8::XValue(cmds[1]);
|
||||
int item_num = a8::XValue(cmds[2]);
|
||||
@ -92,73 +78,11 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
|
||||
DecHP(dmg, VP_Gas, TEXT("battle_server_killer_gas", "毒圈"), VW_Gas,
|
||||
VP_Gas,
|
||||
TEXT("battle_server_killer_gas", "毒圈"),
|
||||
dmg_out,
|
||||
0,
|
||||
0);
|
||||
dmg_out);
|
||||
} else if (cmd == "stop_world") {
|
||||
room->stop_world = true;
|
||||
} else if (cmd == "start_world") {
|
||||
room->stop_world = false;
|
||||
} else if (cmd == "chiji") {
|
||||
if (room->IsMobaModeRoom()) {
|
||||
while (GetTeam()->GetKillCount() <100) {
|
||||
GetTeam()->IncKillCount();
|
||||
}
|
||||
if (!room->moba_over_timer.expired()) {
|
||||
room->xtimer.ModifyTime(room->moba_over_timer, 0);
|
||||
}
|
||||
} else {
|
||||
room->debug_params[119] = 1;
|
||||
room->xtimer.SetTimeoutEx
|
||||
(1,
|
||||
[this] (int event, const a8::Args* args)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
room->GetIncubator()->ShowHand();
|
||||
}
|
||||
},
|
||||
&xtimer_attacher);
|
||||
}
|
||||
} else if (cmd == "!chiji") {
|
||||
if (room->IsMobaModeRoom()) {
|
||||
Team* team = room->GetMobaTeamA();
|
||||
if (team == GetTeam()) {
|
||||
team = room->GetMobaTeamB();
|
||||
}
|
||||
while (team->GetKillCount() < 100) {
|
||||
team->IncKillCount();
|
||||
}
|
||||
if (!room->moba_over_timer.expired()) {
|
||||
room->xtimer.ModifyTime(room->moba_over_timer, 0);
|
||||
}
|
||||
} else {
|
||||
BeKill(VP_Gas,
|
||||
TEXT("battle_server_killer_gas", "毒圈"),
|
||||
VW_Gas,
|
||||
VP_Gas,
|
||||
TEXT("battle_server_killer_gas", "毒圈"));
|
||||
room->debug_params[119] = 1;
|
||||
room->xtimer.SetTimeoutEx
|
||||
(1,
|
||||
[this] (int event, const a8::Args* args)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
room->GetIncubator()->ShowHand();
|
||||
}
|
||||
},
|
||||
&xtimer_attacher);
|
||||
}
|
||||
} else if (cmd == "disable_gas_damage") {
|
||||
room->debug_params[120] = 1;
|
||||
room->xtimer.SetTimeoutEx
|
||||
(SERVER_FRAME_RATE * 60 * 10,
|
||||
[this] (int event, const a8::Args* args)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
room->debug_params[120] = 0;
|
||||
}
|
||||
},
|
||||
&xtimer_attacher);
|
||||
} else if (cmd == "add_hp") {
|
||||
if (cmds.size() > 1) {
|
||||
float hp = a8::XValue(cmds[1]).GetDouble();
|
||||
@ -171,10 +95,7 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
|
||||
DecHP(dmg, VP_Gas, TEXT("battle_server_killer_gas", "毒圈"), VW_Gas,
|
||||
VP_Gas,
|
||||
TEXT("battle_server_killer_gas", "毒圈"),
|
||||
dmg_out,
|
||||
0,
|
||||
0);
|
||||
GetTrigger()->BeAttack(GetUniId());
|
||||
dmg_out);
|
||||
}
|
||||
} else if (cmd == "add_shield") {
|
||||
if (cmds.size() > 1) {
|
||||
@ -193,7 +114,7 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
|
||||
} else if (cmd == "jiuyuan") {
|
||||
TryAddBuff(this, kRescuerBuffId);
|
||||
int downed_relive_time = mt::Param::GetIntParam("downed_relive_time") * 1000;
|
||||
downed_relive_time += GetAbility()->GetAttr(kHVAT_RescueTime);
|
||||
downed_relive_time -= GetAbility()->GetAttrAbs(kHAT_RescueTime);
|
||||
downed_relive_time = std::max(0, downed_relive_time);
|
||||
downed_relive_time = 1000 * 30;
|
||||
StartAction(
|
||||
@ -210,9 +131,6 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
|
||||
if (buff_meta) {
|
||||
MustBeAddBuff(this, buff_id);
|
||||
}
|
||||
} else if (cmd == "delbuff" && cmds.size() >= 2) {
|
||||
int buff_id = a8::XValue(cmds[1]);
|
||||
RemoveBuffById(buff_id);
|
||||
} else if (cmd == "findobj" && cmds.size() >= 2) {
|
||||
int obj_uniid = a8::XValue(cmds[1]);
|
||||
Entity* e = room->GetEntityByUniId(obj_uniid);
|
||||
@ -222,53 +140,17 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
|
||||
hum->GetMutablePos().FromGlmVec3(GetPos().ToGlmVec3());
|
||||
room->grid_service->MoveCreature(hum);
|
||||
}
|
||||
} else if (cmd == "findhero" && cmds.size() >= 2) {
|
||||
int hero_id = a8::XValue(cmds[1]);
|
||||
bool found = false;
|
||||
room->TraverseHumanList
|
||||
(
|
||||
[this, hero_id, &found] (Human* hum) -> bool
|
||||
{
|
||||
if (!hum->dead && hum->GetHeroMeta()->id() == hero_id && GetTeam() != hum->GetTeam()) {
|
||||
hum->GetMovement()->ClearPath();
|
||||
hum->GetMutablePos().FromGlmVec3(GetPos().ToGlmVec3());
|
||||
room->grid_service->MoveCreature(hum);
|
||||
found = true;
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
if (!found) {
|
||||
SendDebugMsg(a8::Format("not found", {}));
|
||||
}
|
||||
} else if (cmd == "find_teammate") {
|
||||
GetTeam()->TraverseMembers
|
||||
(
|
||||
[this] (Human* hum) -> bool
|
||||
{
|
||||
//a8::SetBitFlag(hum->status, CS_NoDie);
|
||||
a8::SetBitFlag(hum->status, CS_NoDie);
|
||||
hum->GetMovement()->ClearPath();
|
||||
hum->GetMutablePos().FromGlmVec3(GetPos().ToGlmVec3());
|
||||
room->grid_service->MoveCreature(hum);
|
||||
return true;
|
||||
});
|
||||
} else if (cmd == "dead_teammate") {
|
||||
GetTeam()->TraverseMembers
|
||||
(
|
||||
[this] (Human* hum) -> bool
|
||||
{
|
||||
if (hum != this && !hum->dead) {
|
||||
hum->BeKill(VP_Gas,
|
||||
TEXT("battle_server_killer_gas", "毒圈"),
|
||||
VW_Gas,
|
||||
VP_Gas,
|
||||
TEXT("battle_server_killer_gas", "毒圈"));
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
} else if (cmd == "total_lucky") {
|
||||
SendDebugMsg(a8::Format("total_lucky:%f", {GetNetData()->GetTotalLucky()}));
|
||||
} else if (cmd == "randomobj" && cmds.size() >= 2) {
|
||||
int weapon_id = a8::XValue(cmds[1]);
|
||||
Human* target = nullptr;
|
||||
@ -291,8 +173,9 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
|
||||
}
|
||||
} else if (cmd == "getattr" && cmds.size() >= 2) {
|
||||
int attr_id = a8::XValue(cmds[1]);
|
||||
float attr_val = GetAbility()->GetAttr(attr_id);
|
||||
SendDebugMsg(a8::Format("attr_id:%d attr_val:%f", {attr_id, attr_val}));
|
||||
float abs_val = GetAbility()->GetAttrAbs(attr_id);
|
||||
float rate_val = GetAbility()->GetAttrRate(attr_id);
|
||||
SendDebugMsg(a8::Format("attr_id:%d abs_val:%f rate_val:%f", {attr_id, abs_val, rate_val}));
|
||||
} else if (cmd == "bufflist") {
|
||||
SendDebugMsg(DebugOutBuffList());
|
||||
} else if (cmd == "throwitem_test") {
|
||||
@ -309,10 +192,39 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
|
||||
}
|
||||
return true;
|
||||
});
|
||||
} else if (cmd == "set_inactive_time" && cmds.size() >= 2) {
|
||||
#if DEBUG
|
||||
App::Instance()->debug_params[1] = a8::XValue(cmds[1]);
|
||||
#endif
|
||||
} else if (cmd == "set_born_frameno_offset" && cmds.size() >= 2) {
|
||||
#if DEBUG
|
||||
App::Instance()->debug_params[118] = a8::XValue(cmds[1]);
|
||||
#endif
|
||||
} else if (cmd == "chiji") {
|
||||
#if DEBUG
|
||||
room->debug_params[119] = 1;
|
||||
#endif
|
||||
} else if (cmd == "airraid") {
|
||||
#if DEBUG
|
||||
room->debug_params[121] = 1;
|
||||
#endif
|
||||
} else if (cmd == "next_raid") {
|
||||
#if MYDEBUG
|
||||
#if DEBUG
|
||||
room->debug_params[121] = 1;
|
||||
room->GetAirRaid()->NextRaid();
|
||||
#endif
|
||||
} else if (cmd == "autodie") {
|
||||
#if DEBUG
|
||||
if (cmds.size() >= 2) {
|
||||
if (cmds[1] == "open") {
|
||||
App::Instance()->debug_params[120] = 1;
|
||||
} else if (cmds[1] == "close") {
|
||||
App::Instance()->debug_params.erase(120);
|
||||
}
|
||||
} else {
|
||||
App::Instance()->debug_params[120] = 1;
|
||||
}
|
||||
#endif
|
||||
} else if (cmd == "wudi") {
|
||||
int buff_uniid = TryAddBuff(this, 1005);
|
||||
if (buff_uniid != 0) {
|
||||
@ -331,56 +243,76 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
|
||||
room->DropItem(drop_pos.ToGlmVec3(), equip_meta->id(), 1, 1);
|
||||
}
|
||||
}
|
||||
} else if (cmd == "add_attr") {
|
||||
if (cmds.size() > 3) {
|
||||
} else if (cmd == "add_base_attr") {
|
||||
if (cmds.size() > 4) {
|
||||
Creature* target = a8::XValue(cmds[1]).GetInt() <= 0 ? this :
|
||||
room->GetCreatureByUniId(a8::XValue(cmds[1]).GetInt());
|
||||
int attr_id = a8::XValue(cmds[2]);
|
||||
float value = a8::XValue(cmds[3]).GetDouble();
|
||||
int type = a8::XValue(cmds[2]);
|
||||
int attr_id = a8::XValue(cmds[3]);
|
||||
float value = a8::XValue(cmds[4]).GetDouble();
|
||||
if (target) {
|
||||
auto handle = target->GetAbility()->AddAttr(attr_id, value);
|
||||
std::vector<std::string> strings = target->GetAbility()->GMShowAttrs();
|
||||
for (auto& str : strings) {
|
||||
SendDebugMsg("数值: " + str);
|
||||
}
|
||||
if (!handle.expired()) {
|
||||
std::string source_name = "<-gm.self";
|
||||
auto cb = std::make_shared<std::function<std::string()>>
|
||||
(
|
||||
[source_name] () -> std::string
|
||||
{
|
||||
return source_name;
|
||||
});
|
||||
target->GetAbility()->SetSource(handle, cb);
|
||||
if (type == 1) {
|
||||
target->GetAbility()->AddAttrAbs(attr_id, value);
|
||||
} else {
|
||||
target->GetAbility()->AddAttrRate(attr_id, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (cmd == "del_attr") {
|
||||
if (cmds.size() > 3) {
|
||||
} else if (cmd == "del_base_attr") {
|
||||
if (cmds.size() > 4) {
|
||||
Creature* target = a8::XValue(cmds[1]).GetInt() <= 0 ? this :
|
||||
room->GetCreatureByUniId(a8::XValue(cmds[1]).GetInt());
|
||||
int attr_id = a8::XValue(cmds[2]);
|
||||
int idx = a8::XValue(cmds[3]);
|
||||
int type = a8::XValue(cmds[2]);
|
||||
int attr_id = a8::XValue(cmds[3]);
|
||||
int idx = a8::XValue(cmds[4]);
|
||||
if (target) {
|
||||
target->GetAbility()->GMDelAttr(attr_id, idx);
|
||||
std::vector<std::string> strings = target->GetAbility()->GMShowAttrs();
|
||||
for (auto& str : strings) {
|
||||
SendDebugMsg("数值: " + str);
|
||||
}
|
||||
target->GetAbility()->GMDelBaseAttr(type, attr_id, idx);
|
||||
}
|
||||
}
|
||||
} else if (cmd == "clear_attr") {
|
||||
} else if (cmd == "clear_base_attr") {
|
||||
if (cmds.size() > 1) {
|
||||
Creature* target = a8::XValue(cmds[1]).GetInt() <= 0 ? this :
|
||||
room->GetCreatureByUniId(a8::XValue(cmds[1]).GetInt());
|
||||
int type = 0;
|
||||
if (target) {
|
||||
target->GetAbility()->GMClearAttr();
|
||||
std::vector<std::string> strings = target->GetAbility()->GMShowAttrs();
|
||||
for (auto& str : strings) {
|
||||
SendDebugMsg("数值: " + str);
|
||||
target->GetAbility()->GMClearBaseAttr(type);
|
||||
}
|
||||
}
|
||||
} else if (cmd == "add_grow_attr") {
|
||||
if (cmds.size() > 4) {
|
||||
Creature* target = a8::XValue(cmds[1]).GetInt() <= 0 ? this :
|
||||
room->GetCreatureByUniId(a8::XValue(cmds[1]).GetInt());
|
||||
int type = a8::XValue(cmds[2]);
|
||||
int attr_id = a8::XValue(cmds[3]);
|
||||
float value = a8::XValue(cmds[4]).GetDouble();
|
||||
if (target) {
|
||||
if (type == 1) {
|
||||
target->GetAbility()->AddAttrAddition(attr_id, value);
|
||||
} else {
|
||||
target->GetAbility()->AddAttrRuduce(attr_id, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (cmd == "del_grow_attr") {
|
||||
if (cmds.size() > 4) {
|
||||
Creature* target = a8::XValue(cmds[1]).GetInt() <= 0 ? this :
|
||||
room->GetCreatureByUniId(a8::XValue(cmds[1]).GetInt());
|
||||
int type = a8::XValue(cmds[2]);
|
||||
int attr_id = a8::XValue(cmds[3]);
|
||||
int idx = a8::XValue(cmds[4]);
|
||||
if (target) {
|
||||
target->GetAbility()->GMDelGrowAttr(type, attr_id, idx);
|
||||
}
|
||||
}
|
||||
} else if (cmd == "clear_grow_attr") {
|
||||
if (cmds.size() > 1) {
|
||||
Creature* target = a8::XValue(cmds[1]).GetInt() <= 0 ? this :
|
||||
room->GetCreatureByUniId(a8::XValue(cmds[1]).GetInt());
|
||||
int type = 0;
|
||||
if (target) {
|
||||
target->GetAbility()->GMClearGrowAttr(type);
|
||||
}
|
||||
}
|
||||
} else if (cmd == "show_attrs") {
|
||||
if (cmds.size() > 1) {
|
||||
Creature* target = a8::XValue(cmds[1]).GetInt() <= 0 ? this :
|
||||
@ -437,12 +369,6 @@ void Player::_CMExecCommand(f8::MsgHdr* hdr, const cs::CMExecCommand& msg)
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} else if (cmd == "create_mapthing") {
|
||||
int thing_id = a8::XValue(cmds[1]).GetDouble();
|
||||
const mt::MapThing* thing_meta = mt::MapThing::GetById(thing_id);
|
||||
if (thing_meta) {
|
||||
room->CreateObstacle(thing_id, GetPos().GetX(), GetPos().GetY(), GetPos().GetZ());
|
||||
}
|
||||
} else if (cmd == "use_skill") {
|
||||
if (cmds.size() >= 2 && GetCar() && GetCar()->IsDriver(this)) {
|
||||
int skill_id = a8::XValue(cmds[1]);
|
||||
@ -473,118 +399,13 @@ 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 == "human_list") {
|
||||
SendDebugMsg(a8::Format("human_list: hum:%d",
|
||||
{
|
||||
room->GetHumanNum()
|
||||
}));
|
||||
room->TraverseHumanList
|
||||
(
|
||||
[this] (Human* hum) -> bool
|
||||
{
|
||||
SendDebugMsg(a8::Format("human_list: obj_uniid:%d hero_id:%s hero_name:%s",
|
||||
{
|
||||
hum->GetUniId(),
|
||||
hum->GetHeroMeta()->id(),
|
||||
hum->GetHeroMeta()->name()
|
||||
}));
|
||||
return true;
|
||||
}
|
||||
);
|
||||
SendDebugMsg("human_list: >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
|
||||
SendDebugMsg("human_list: <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<");
|
||||
|
||||
} else if (cmd == "winexp" && cmds.size() >= 1) {
|
||||
float exp = a8::XValue(cmds[1]).GetDouble();
|
||||
if (exp > 0) {
|
||||
WinExp(exp);
|
||||
}
|
||||
std::vector<std::string> strings = GetAbility()->GMShowAttrs();
|
||||
for (auto& str : strings) {
|
||||
SendDebugMsg("数值: " + str);
|
||||
}
|
||||
} else if (cmd == "down_teammate") {
|
||||
Human* target = nullptr;
|
||||
GetTeam()->TraverseMembers
|
||||
(
|
||||
[this, &target] (Human *hum) -> bool
|
||||
{
|
||||
if (!hum->dead && hum != this) {
|
||||
if (!target) {
|
||||
target = hum;
|
||||
} else if (GetPos().Distance2D2(hum->GetPos()) <
|
||||
GetPos().Distance2D2(target->GetPos())) {
|
||||
target = hum;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
if (target) {
|
||||
float dmg_out = 0.0f;
|
||||
target->DecHP(100000.0f, VP_Gas, TEXT("battle_server_killer_gas", "毒圈"), VW_Gas,
|
||||
VP_Gas,
|
||||
TEXT("battle_server_killer_gas", "毒圈"),
|
||||
dmg_out,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
} else if (cmd == "moba_pingju" && cmds.size() >= 0) {
|
||||
if (room->IsMobaModeRoom() && !room->IsGameOver() && room->GetMobaOvertimeRaceFrameNo() <= 0) {
|
||||
room->TraverseTeams
|
||||
(
|
||||
[] (Team* team) -> bool
|
||||
{
|
||||
team->SetKillCount(5);
|
||||
return true;
|
||||
});
|
||||
room->xtimer.ModifyTime(room->moba_over_timer, 0);
|
||||
}
|
||||
} else if (cmd == "peace_mode" && cmds.size() >= 0) {
|
||||
if (cmds[1] == "1") {
|
||||
room->OpenRoomSwitch(kRoomSwitchPeaceMode);
|
||||
} else {
|
||||
room->CloseRoomSwitch(kRoomSwitchPeaceMode);
|
||||
}
|
||||
} else if (cmd == "findpath" && cmds.size() >= 3) {
|
||||
float x = a8::XValue(cmds[1]).GetDouble();
|
||||
float y = a8::XValue(cmds[2]).GetDouble();
|
||||
float z = a8::XValue(cmds[3]).GetDouble();
|
||||
GetMovement()->FindPath(glm::vec3(x, y, z), 10);
|
||||
}
|
||||
#ifdef DEBUG
|
||||
a8::XPrintf("exec_cmd:%s\n", {cmd});
|
||||
#endif
|
||||
}
|
||||
|
89
server/gameserver/compose.cc
Normal file
89
server/gameserver/compose.cc
Normal file
@ -0,0 +1,89 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include "compose.h"
|
||||
#include "creature.h"
|
||||
#include "netdata.h"
|
||||
#include "trigger.h"
|
||||
#include "room.h"
|
||||
#include "effect.h"
|
||||
#include "weapon.h"
|
||||
#include "human.h"
|
||||
|
||||
#include "mt/MergeItem.h"
|
||||
#include "mt/Hero.h"
|
||||
#include "mt/Equip.h"
|
||||
|
||||
Compose::Compose(Creature* owner)
|
||||
{
|
||||
owner_ = owner;
|
||||
}
|
||||
|
||||
Compose::~Compose()
|
||||
{
|
||||
}
|
||||
|
||||
void Compose::Init()
|
||||
{
|
||||
if (owner_->IsPlayer()) {
|
||||
TakeOnWeapon(owner_->GetCurrWeapon());
|
||||
owner_->GetTrigger()->AddListener
|
||||
(
|
||||
kTakeonWeaponEvent,
|
||||
[this] (const a8::Args& args) mutable
|
||||
{
|
||||
Weapon* old_weapon = args.Get<Weapon*>(0);
|
||||
Weapon* new_weapon = args.Get<Weapon*>(1);
|
||||
TakeOnWeapon(new_weapon);
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void Compose::Clear()
|
||||
{
|
||||
for (int buff_uniid : hold_buffs_) {
|
||||
owner_->RemoveBuffByUniId(buff_uniid);
|
||||
}
|
||||
hold_buffs_.clear();
|
||||
}
|
||||
|
||||
bool Compose::CanAdd()
|
||||
{
|
||||
return GetNum() < 8;
|
||||
}
|
||||
|
||||
void Compose::IncNum()
|
||||
{
|
||||
++num_;
|
||||
if ((num_ + 1) % 3 == 0 && num_ < 9) {
|
||||
TakeOnWeapon(owner_->GetCurrWeapon());
|
||||
}
|
||||
if (num_ >= 8) {
|
||||
owner_->room->NotifyNewsTicker
|
||||
(1,
|
||||
{
|
||||
owner_->GetName(),
|
||||
a8::XValue(owner_->GetCurrWeapon()->meta->id()).GetString()
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void Compose::TakeOnWeapon(Weapon* weapon)
|
||||
{
|
||||
Clear();
|
||||
auto merge_item_meta = mt::MergeItem::GetById(weapon->meta->id());
|
||||
if (merge_item_meta) {
|
||||
std::set<int>* buffs = merge_item_meta->GetBuffs((num_ + 1) / 3);
|
||||
if (buffs) {
|
||||
for (int buff_id : *buffs) {
|
||||
hold_buffs_.push_back(owner_->TryAddBuff(owner_, buff_id, nullptr));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Compose::Reset()
|
||||
{
|
||||
Clear();
|
||||
num_ = 0;
|
||||
}
|
28
server/gameserver/compose.h
Normal file
28
server/gameserver/compose.h
Normal file
@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include "trigger.h"
|
||||
|
||||
class Creature;
|
||||
class Weapon;
|
||||
class Compose
|
||||
{
|
||||
public:
|
||||
Compose(Creature* owner);
|
||||
~Compose();
|
||||
|
||||
void Init();
|
||||
void IncNum();
|
||||
bool CanAdd();
|
||||
int GetNum() { return num_; }
|
||||
void Reset();
|
||||
|
||||
private:
|
||||
|
||||
void Clear();
|
||||
void TakeOnWeapon(Weapon* weapon);
|
||||
|
||||
private:
|
||||
Creature* owner_ = nullptr;
|
||||
int num_ = 0;
|
||||
std::vector<int> hold_buffs_;
|
||||
};
|
@ -17,8 +17,10 @@ enum NetHandler_e
|
||||
{
|
||||
HID_Player,
|
||||
HID_PlayerMgr,
|
||||
HID_Room,
|
||||
HID_RoomMgr,
|
||||
HID_CustomMember,
|
||||
HID_MatchMgr,
|
||||
HID_MatchTeam,
|
||||
HID_GGListener,
|
||||
};
|
||||
|
||||
@ -161,8 +163,6 @@ enum VirtualWeapon_e
|
||||
VW_Gas = 9000000,
|
||||
VW_Explosion = 9000001,
|
||||
VW_Weapon = 9000002,
|
||||
VW_Tower = 9000005,
|
||||
VW_Magma = 9000006,
|
||||
};
|
||||
|
||||
enum VirtualPlayer_e
|
||||
@ -171,8 +171,6 @@ enum VirtualPlayer_e
|
||||
VP_Buff = 9000001,
|
||||
VP_Explosion = 9000002,
|
||||
VP_Water = 9000003,
|
||||
VP_Tower = 9000005,
|
||||
VP_Magma = 9000006,
|
||||
};
|
||||
|
||||
enum EquipType_e
|
||||
@ -196,10 +194,7 @@ enum EquipType_e
|
||||
|
||||
enum GunSubEquipType_e
|
||||
{
|
||||
GUN_SUB_EQUIP_TYPE_THREE_GUN = 9,
|
||||
GUN_SUB_EQUIP_TYPE_LASER_CANNON = 10,
|
||||
GUN_SUB_EQUIP_TYPE_FLY_HOOk = 14,
|
||||
GUN_SUB_EQUIP_TYPE_FLY_LASER = 15,
|
||||
GUN_SUB_EQUIP_TYPE_End
|
||||
};
|
||||
|
||||
@ -275,15 +270,6 @@ enum PropertyType_e
|
||||
|
||||
kPropDmgShow = 51,
|
||||
kPropShowHonor = 52,
|
||||
kPropSpecShot = 53,
|
||||
|
||||
kPropFlyTo = 54,
|
||||
|
||||
kPropLevelExp = 55,
|
||||
kPropLevelUp = 56,
|
||||
|
||||
kPropBoxNum = 57,
|
||||
kPropShowOrHideBigEventBox = 58,
|
||||
};
|
||||
|
||||
enum SkinSlot_e
|
||||
@ -330,7 +316,6 @@ enum ObstacleType_e
|
||||
kObstacleStrengthenWall = 12,
|
||||
kObstacleMedicalStation = 13,
|
||||
kObstacleFlameSurface = 16,
|
||||
kObstacleTreasureBox = 18,
|
||||
};
|
||||
|
||||
enum BulletHit_e
|
||||
@ -378,9 +363,6 @@ enum EventAddBuff_e
|
||||
kEventBuffLimitTimeKillTarget = 17,
|
||||
kEventBuffRevive = 18,
|
||||
kEventBuffDmgOut = 19,
|
||||
kEventEnterBattleMode = 20,
|
||||
kEventLeaveBattleMode = 21,
|
||||
kEventBeAttack = 22,
|
||||
kEventBuffEnd
|
||||
};
|
||||
|
||||
@ -439,10 +421,8 @@ enum SamplePolyFlags
|
||||
SAMPLE_POLYFLAGS_SWIM = 0x02, // Ability to swim (water).
|
||||
SAMPLE_POLYFLAGS_DOOR = 0x04, // Ability to move through doors.
|
||||
SAMPLE_POLYFLAGS_JUMP = 0x08, // Ability to jump.
|
||||
SAMPLE_POLYFLAGS_DISABLED = 0x10, // Disabled polygon
|
||||
SAMPLE_POLYFLAGS_HOP = 0x20, // 子弹可以穿
|
||||
SAMPLE_POLYFLAGS_GLASS = 0x40, // Disabled polygon
|
||||
SAMPLE_POLYFLAGS_MAGMA = 0x80, //岩浆
|
||||
SAMPLE_POLYFLAGS_DISABLED = 0x10, // Disabled polygon
|
||||
SAMPLE_POLYFLAGS_GLASS = 0x40, // Disabled polygon
|
||||
SAMPLE_POLYFLAGS_ALL = 0xffff // All abilities.
|
||||
};
|
||||
|
||||
@ -510,8 +490,7 @@ A8_DECLARE_ENUM(WorldObjectType_e,
|
||||
kLootType = 1,
|
||||
kBoxType = 2,
|
||||
kCarType = 3,
|
||||
kBornPointType = 4,
|
||||
kMonsterType = 5,
|
||||
kBornPointType = 4
|
||||
);
|
||||
|
||||
enum SwitchTimesType_e
|
||||
@ -523,11 +502,6 @@ enum SwitchTimesType_e
|
||||
kEnableDmgForwardTimes,
|
||||
kImmuneGasTimes,
|
||||
kAniHideTimes,
|
||||
kAccumulatePowerTimes,
|
||||
kForceClientReportBullet,
|
||||
kIgnoreOriginalDmg,
|
||||
kHideBuffMoveShow,
|
||||
kHideBuffAimingShow,
|
||||
kSwitchTimeEnd,
|
||||
};
|
||||
|
||||
@ -538,7 +512,6 @@ enum RemoveHideReason_e
|
||||
kMoveReason,
|
||||
kOnBulletHitReason,
|
||||
kOnExplosionHitReason,
|
||||
kAimingReason
|
||||
};
|
||||
|
||||
enum SkillIdx_e
|
||||
|
@ -26,7 +26,6 @@ A8_DECLARE_ENUM(SpecBuffId_e,
|
||||
kInWater2BuffId = 7027,
|
||||
kInWater3BuffId = 7028,
|
||||
kRecoverHpEffectBuffId = 7040,
|
||||
kInMagmaBuffId = 7041,
|
||||
kPullToWalkableBuffId = 8003,
|
||||
kDiveBuffId = 8054,
|
||||
kHoldGunBuffId = 8059,
|
||||
@ -45,23 +44,23 @@ A8_DECLARE_ENUM(BuffEffectType_e,
|
||||
kBET_NewProtect = 8, //新手保护血量低于50%
|
||||
kBET_BePull = 9, //拉人(被拉方)
|
||||
kBET_DistanceDmgAddition = 10,
|
||||
kBET_UnUse11 = 11, //
|
||||
kBET_OnceChgAttr = 11, //一次性buff
|
||||
kBET_Scale = 12, //缩放角色模型,这时res_scale表示缩放比,客户端需要特殊处理
|
||||
kBET_UnUse13 = 13,
|
||||
kBET_ModifyAttr = 13,
|
||||
kBET_PlayShotAni = 14, //播放射击动画
|
||||
kBET_Vertigo = 15, //眩晕
|
||||
kBET_Floating = 16, //浮空
|
||||
kBET_PullDone = 17, //拖拽到目的地
|
||||
kBET_DelayAddBuff = 18, //延迟加buff
|
||||
kBET_ModifyAttr = 19, //修改属性
|
||||
kBET_UnUse20 = 20,
|
||||
kBET_UnUse21 = 21,
|
||||
kBET_ModifyBaseAttr = 19,
|
||||
kBET_ModifyGrowAttr = 20,
|
||||
kBET_DirectSetAttr = 21,
|
||||
kBET_UnUse22 = 22,
|
||||
kBET_HunLuan = 23, //混乱,在烟雾弹中不自动瞄准
|
||||
kBET_Fly = 24, //飞行中
|
||||
kBET_Jump = 25, //跳伞中
|
||||
kBET_IntervalAddBuff = 26, //循环定时器
|
||||
kBET_PhaseAddBuff = 27, //分阶段定时器添加
|
||||
kBET_IntervalAddBuff = 26, //持续掉血
|
||||
//kBET_LastAddHp = 27, //持续加血
|
||||
kBET_UnUse28 = 28,
|
||||
kBET_SummonHero = 29, //召唤英雄
|
||||
//kBET_SummonHero = 30, //向前跳跃
|
||||
@ -105,7 +104,7 @@ A8_DECLARE_ENUM(BuffEffectType_e,
|
||||
kBET_BeatBack = 67, //击退
|
||||
kBET_Disperse = 68, //驱散
|
||||
kBET_PeaceMode = 69, //和平模式
|
||||
kBET_InMagma = 70, //在岩浆里
|
||||
kBET_UnUse70 = 70, //
|
||||
kBET_CondAdd = 71, //
|
||||
kBET_Dive = 72, //下潜模式
|
||||
kBET_Reverse = 73, //人物反向
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -12,13 +12,13 @@ enum CreatureStatus
|
||||
{
|
||||
CS_Disable,
|
||||
CS_DisableAttack,
|
||||
CS_ForceTeam,
|
||||
CS_PreDieSuspended,
|
||||
CS_DeadNoDrop,
|
||||
CS_Reviving,
|
||||
CS_CrazeMode,
|
||||
CS_DisableAttackAndroid,
|
||||
CS_NoDie,
|
||||
CS_NoHpChgNotify,
|
||||
CS_IsOb,
|
||||
CS_End
|
||||
};
|
||||
|
||||
@ -66,6 +66,8 @@ class Trigger;
|
||||
class DelayAddBuffHandle;
|
||||
class Movement;
|
||||
class Player;
|
||||
class GunGrasp;
|
||||
class Compose;
|
||||
class Android;
|
||||
class Creature : public MoveableEntity
|
||||
{
|
||||
@ -97,9 +99,10 @@ class Creature : public MoveableEntity
|
||||
int max_energy_shield = 0;
|
||||
int armor_shield = 0;
|
||||
int max_armor_shield = 0;
|
||||
int level = 1;
|
||||
int hero_level = 1;
|
||||
int revive_count = 0;
|
||||
CreatureWeakPtr master;
|
||||
int box_num = 0;
|
||||
|
||||
Weapon second_weapon;
|
||||
glm::vec3 skill_pos;
|
||||
@ -110,6 +113,8 @@ class Creature : public MoveableEntity
|
||||
glm::vec3 context_dir = GlmHelper::ZERO;
|
||||
std::shared_ptr<Ability> context_ability;
|
||||
|
||||
std::vector<std::tuple<int, int>> talent_list;
|
||||
|
||||
std::function<void ()> on_loading_bullet;
|
||||
CreatureWeakPtr follow_target;
|
||||
|
||||
@ -123,21 +128,16 @@ class Creature : public MoveableEntity
|
||||
std::vector<int> gemstone_hold_buffs;
|
||||
bool shot_start = false;
|
||||
bool shot_hold = false;
|
||||
int skill_hold_skill_id = 0;
|
||||
long long skill_hold_start_frameno = 0;
|
||||
a8::XTimerWp remove_shot_hold_timer;
|
||||
|
||||
a8::XTimerWp craze_mode_timer;
|
||||
a8::XTimerWp nature_recover_hp_idle_timer;
|
||||
std::map<int, int> hook_hash;
|
||||
|
||||
int side = 0;
|
||||
int road_idx = 0;
|
||||
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;
|
||||
@ -157,11 +157,9 @@ class Creature : public MoveableEntity
|
||||
virtual bool IsCreature(Room* room) override { return true;};
|
||||
virtual void OnBattleStart(Room* room) override;
|
||||
virtual const mt::Hero* GetHeroMeta() { return nullptr; };
|
||||
virtual const mt::BattleHeroGrow* GetHeroGrowMeta() { return hero_grow_meta_; };
|
||||
virtual void FillMFObjectImage(Room* room, Human* hum, cs::MFCharacterImage* image_data) {};
|
||||
virtual void SetPos(Position pos) override;
|
||||
float GetSpeed();
|
||||
virtual void LateUpdate(int delta_time) override;
|
||||
virtual float GetSpeed();
|
||||
std::shared_ptr<Movement> GetMovement() { return movement_; };
|
||||
bool HasBuffEffect(int buff_effect_id);
|
||||
Buff* GetBuffByEffectId(int effect_id);
|
||||
@ -212,6 +210,7 @@ class Creature : public MoveableEntity
|
||||
void TriggerBuff(Skill* skill, std::set<Creature*>& target_list, BuffTriggerType_e trigger_type);
|
||||
Skill* GetSkill(int skill_id);
|
||||
Skill* GetMainSkill();
|
||||
const mt::Skill* GetAdjustSkillMeta(const mt::Skill* skill_meta);
|
||||
int GetSkillTargetId() { return skill_target_id_; };
|
||||
void AddSkill(int skill_id);
|
||||
void ClearSkill();
|
||||
@ -241,6 +240,7 @@ class Creature : public MoveableEntity
|
||||
);
|
||||
void ResetSkill();
|
||||
Skill* CurrentSkill();
|
||||
const mt::Skill* CurrentSkillMeta();
|
||||
void ActiveAllSkill();
|
||||
const mt::SkillPhase* GetCurrSkillPhase();
|
||||
bool CanSee(const Creature* c) const;
|
||||
@ -259,9 +259,7 @@ class Creature : public MoveableEntity
|
||||
virtual void DecHP(float dec_hp, int killer_id,
|
||||
const std::string killer_name, int weapon_id,
|
||||
int real_killer_id, const std::string real_killer_name,
|
||||
float& real_dmg_out,
|
||||
int dmg_type,
|
||||
int dmg_bp) {};
|
||||
float& real_dmg_out) {};
|
||||
void AddHp(float hp);
|
||||
void SetHP(float hp);
|
||||
void SetMaxHP(float max_hp);
|
||||
@ -269,9 +267,6 @@ class Creature : public MoveableEntity
|
||||
void AddEnergyShield(int value);
|
||||
void ClearEnergyShield();
|
||||
|
||||
void AddArmorShield(int value);
|
||||
void ClearArmorShield();
|
||||
|
||||
void StartAction(ActionType_e action_type,
|
||||
int action_duration,
|
||||
int item_id,
|
||||
@ -302,9 +297,8 @@ class Creature : public MoveableEntity
|
||||
void SummonObstacle(Buff* buff, int id, const Position& target_pos);
|
||||
Hero* SummonHero(Buff* buff, const glm::vec3& pos, const glm::vec3& dir);
|
||||
void RemoveSurplusHero(int hero_id, int num);
|
||||
Obstacle* SummonObstacle(Buff* buff, int id, const glm::vec3& pos, const glm::vec3& dir);
|
||||
Obstacle* SummonObstacle(Buff* buff, const glm::vec3& pos, const glm::vec3& dir);
|
||||
void RemoveSurplusObstacle(int thing_id, int num);
|
||||
void RemoveSurplusObstacleByUniid(int obj_uniid);
|
||||
void FillSkillCasterState(SkillCasterState* caster_state);
|
||||
void RecoverSkillCasterState(SkillCasterState* caster_state);
|
||||
CreatureWeakPtr AllocWeakPtr();
|
||||
@ -329,8 +323,8 @@ class Creature : public MoveableEntity
|
||||
void FindLocation();
|
||||
std::shared_ptr<Trigger> GetTrigger() { return trigger_; };
|
||||
std::shared_ptr<Ability>& GetAbility() { return ability_; };
|
||||
std::shared_ptr<BattleDataContext>& GetNetData() { return battle_context_; };
|
||||
void SetNetData(std::shared_ptr<BattleDataContext> c);
|
||||
std::shared_ptr<BattleDataContext>& GetBattleContext() { return battle_context_; };
|
||||
void SetBattleContext(std::shared_ptr<BattleDataContext> c);
|
||||
void RefreshHP();
|
||||
void TraverseBuff(std::function<void (Buff*, bool&)> func);
|
||||
void TraverseEffect(std::function<void (Effect*, bool&)> func);
|
||||
@ -358,12 +352,7 @@ class Creature : public MoveableEntity
|
||||
void SetDisableMoveTimes(int times) { disable_move_times_ = times; };
|
||||
|
||||
void DoRecoilForce(int distance);
|
||||
void SetHeroLevel(int level, int exp, const mt::BattleHeroGrow* grow_meta);
|
||||
int GetHeroLevel();
|
||||
int GetHeroExp();
|
||||
int GetHeroMaxExp();
|
||||
void WinExp(int win_exp);
|
||||
void AllocDeadExp(int real_killer_id);
|
||||
void WinSkillExp(int win_exp);
|
||||
void RecalcDtoAttr();
|
||||
void AutoNavigation(const glm::vec3& target_pos, float speed,
|
||||
std::function<void (Creature*)> cb);
|
||||
@ -379,7 +368,6 @@ class Creature : public MoveableEntity
|
||||
void ShortFindPath();
|
||||
float GetSkillRaycastDistance();
|
||||
virtual void NetInitOk();
|
||||
bool NetIsInited() { return net_init_ok_; };
|
||||
bool IsNearGas(float distance);
|
||||
float GetSafeAreaRaidus();
|
||||
std::shared_ptr<std::set<int>> CalcReporterList
|
||||
@ -389,6 +377,7 @@ class Creature : public MoveableEntity
|
||||
bool CanShot(bool try_reload);
|
||||
void AdjustPos();
|
||||
void OnLand();
|
||||
std::shared_ptr<Compose> GetCompose() { return compose_; }
|
||||
void ClearGemStoneBuffs();
|
||||
virtual Car* GetCar() { return nullptr; }
|
||||
void AddIgnoreTarget(int target_uniid, int time);
|
||||
@ -406,18 +395,8 @@ class Creature : public MoveableEntity
|
||||
float GetSkillLocalVar(int skill_id, int idx);
|
||||
void SetSkillLocalVar(int skill_id, int idx, float val);
|
||||
void CheckShotHold();
|
||||
int Throw(const mt::Equip* src_equip_meta,
|
||||
int slot, const glm::vec3& bomb_pos, const glm::vec3& bomb_dir,
|
||||
int Throw(int slot, const glm::vec3& bomb_pos, const glm::vec3& bomb_dir,
|
||||
float fly_distance, int estimated_time);
|
||||
void AddSkillHoldState(int skill_id);
|
||||
void ClearSkillHoldState();
|
||||
bool HasHeightOffset();
|
||||
float GetHeightOffset();
|
||||
void SpecShot(const glm::vec3& pos, int max_bullet);
|
||||
void AdjustMobaBornDir();
|
||||
int GetBattleStartTime();
|
||||
bool IsOb();
|
||||
bool HaveBallingEnemy();
|
||||
|
||||
protected:
|
||||
virtual void OnBuffRemove(Buff& buff);
|
||||
@ -440,9 +419,6 @@ private:
|
||||
void AutoSwitchWeapon();
|
||||
void CheckLoadingBullet();
|
||||
bool InternalCanUseSkill(Skill* skill);
|
||||
void InternalUseSkill();
|
||||
void GenLevelAttr();
|
||||
float InternalGetSpeed();
|
||||
|
||||
protected:
|
||||
bool need_sync_active_player_ = false;
|
||||
@ -482,17 +458,11 @@ private:
|
||||
std::map<int, std::shared_ptr<Effect>> effect_hash_;
|
||||
std::map<int, list_head> slave_heros_;
|
||||
std::map<int, list_head> slave_things2_;
|
||||
std::list<std::tuple<int, EntityWeakPtr>> slave_things_;
|
||||
std::list<std::tuple<int, RoomObstacleWeakPtr>> slave_things_;
|
||||
a8::XTimerWp auto_switch_weapon_timer_;
|
||||
a8::XTimerWp reload_delay_timer_;
|
||||
int follow_times_ = 0;
|
||||
std::map<int, int> buff_tags_;
|
||||
const mt::BattleHeroGrow* hero_grow_meta_ = nullptr;
|
||||
|
||||
int hero_level_ = 1;
|
||||
int hero_exp_ = 0;
|
||||
std::vector<int> grow_buff_list_;
|
||||
std::vector<AttrHandle> grow_attr_list_;
|
||||
|
||||
int disable_move_dir_times_ = 0;
|
||||
int disable_attack_dir_times_ = 0;
|
||||
@ -509,6 +479,9 @@ private:
|
||||
std::map<int, long long> buff_interval_hash_;
|
||||
std::array<Inventory, IS_END> inventory_ = {};
|
||||
|
||||
std::shared_ptr<GunGrasp> gun_grasp_;
|
||||
std::shared_ptr<Compose> compose_;
|
||||
|
||||
std::map<int, a8::XTimerWp> ignore_target_hash_;
|
||||
std::map<int, std::map<int, float>> skill_local_vars_;
|
||||
|
||||
@ -516,10 +489,6 @@ private:
|
||||
int last_attacker_revive_times_ = 0;
|
||||
long long last_beattack_frameno_;
|
||||
|
||||
bool net_init_ok_ = false;
|
||||
|
||||
int battle_start_time_ = 0;
|
||||
|
||||
friend class Buff;
|
||||
friend class AddInventoryBuff;
|
||||
friend class BePullBuff;
|
||||
@ -532,4 +501,5 @@ private:
|
||||
friend class Skill;
|
||||
friend class Trigger;
|
||||
friend class PBUtils;
|
||||
friend class GunGrasp;
|
||||
};
|
||||
|
@ -4,32 +4,10 @@
|
||||
#include "custom_team.h"
|
||||
#include "custom_member.h"
|
||||
#include "netdata.h"
|
||||
#include "roommgr.h"
|
||||
#include "room.h"
|
||||
#include "player.h"
|
||||
|
||||
#include "cs_proto.pb.h"
|
||||
#include "ss_proto.pb.h"
|
||||
|
||||
#include "mt/Map.h"
|
||||
#include "mt/MapMode.h"
|
||||
#include "mt/Param.h"
|
||||
|
||||
void CustomBattle::Init()
|
||||
{
|
||||
ob_team_ = std::make_shared<CustomTeam>();
|
||||
ob_team_->team_uuid_ = "";
|
||||
ob_team_->is_view_ = true;
|
||||
f8::Timer::Instance()->SetIntervalEx
|
||||
(
|
||||
2000,
|
||||
[this] (int event, const a8::Args* args)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
NotifyState();
|
||||
}
|
||||
},
|
||||
&timer_attacher);
|
||||
|
||||
}
|
||||
|
||||
void CustomBattle::UnInit()
|
||||
@ -47,141 +25,74 @@ void CustomBattle::ParseResult(a8::XObject& obj)
|
||||
room_uuid_ = obj.Get("room_uuid").GetString();
|
||||
zone_id_ = obj.Get("zone_id");
|
||||
node_id_ = obj.Get("node_id");
|
||||
map_mode_ = obj.Get("mode_id");
|
||||
map_id_ = obj.Get("map_id");
|
||||
match_mode_ = obj.Get("match_mode");
|
||||
start_time_ = obj.Get("start_time");
|
||||
sign_ = obj.Get("sign").GetString();
|
||||
const mt::Map* map_meta = mt::Map::GetById(map_id_);
|
||||
if (!map_meta || !map_meta->IsOpen()) {
|
||||
|
||||
auto team_list = obj.At("team_list");
|
||||
if (!team_list || !team_list->IsArray()) {
|
||||
parse_ok_ = false;
|
||||
return;
|
||||
}
|
||||
map_mode_meta_ = mt::MapMode::GetById(map_mode_);
|
||||
if (!map_mode_meta_) {
|
||||
parse_ok_ = false;
|
||||
return;
|
||||
}
|
||||
{
|
||||
is_moba_ = map_meta->is_moba() ? true : false;
|
||||
}
|
||||
{
|
||||
auto team_list = obj.At("team_list");
|
||||
if (!team_list || !team_list->IsArray()) {
|
||||
for (int i = 0;i < team_list->Size(); ++i) {
|
||||
auto team_obj = team_list->At(i);
|
||||
if (!team_obj || !team_obj->IsObject()) {
|
||||
parse_ok_ = false;
|
||||
return;
|
||||
}
|
||||
for (int i = 0;i < team_list->Size(); ++i) {
|
||||
auto team_obj = team_list->At(i);
|
||||
if (!team_obj || !team_obj->IsObject()) {
|
||||
std::string team_uuid = team_obj->Get("team_uuid").GetString();
|
||||
int is_view = team_obj->Get("is_view").GetInt();
|
||||
auto member_list = team_obj->At("members");
|
||||
if (!member_list ||
|
||||
!member_list->IsArray()) {
|
||||
parse_ok_ = false;
|
||||
return;
|
||||
}
|
||||
auto team = GetTeamByTeamUuid(team_uuid);
|
||||
if (!team) {
|
||||
team = std::make_shared<CustomTeam>();
|
||||
team->team_uuid_ = team_uuid;
|
||||
team->is_view_ = is_view ? true : false;
|
||||
uuid_hash_[team->team_uuid_] = team;
|
||||
}
|
||||
for (int ii = 0; ii < member_list->Size(); ++ii) {
|
||||
auto member_obj = member_list->At(ii);
|
||||
if (!member_obj || !member_obj->IsObject()) {
|
||||
parse_ok_ = false;
|
||||
return;
|
||||
}
|
||||
std::string team_uuid = team_obj->Get("team_uuid").GetString();
|
||||
int is_view = team_obj->Get("is_view").GetInt();
|
||||
auto member_list = team_obj->At("members");
|
||||
if (!member_list ||
|
||||
!member_list->IsArray()) {
|
||||
auto member = std::make_shared<CustomMember>();
|
||||
member->team_ = team.get();
|
||||
member->account_id_ = member_obj->Get("account_id").GetString();
|
||||
member->session_id_ = member_obj->Get("session_id").GetString();
|
||||
member->battle_context_ = std::make_shared<BattleDataContext>();
|
||||
member->battle_context_->ParseResult(*member_obj);
|
||||
if (!member->battle_context_->parse_ok) {
|
||||
parse_ok_ = false;
|
||||
return;
|
||||
}
|
||||
auto team = GetTeamByTeamUuid(team_uuid);
|
||||
if (!team) {
|
||||
team = std::make_shared<CustomTeam>();
|
||||
team->custom_battle_ = this;
|
||||
team->team_uuid_ = team_uuid;
|
||||
team->is_view_ = false;
|
||||
uuid_hash_[team->team_uuid_] = team;
|
||||
team_list_.push_back(team);
|
||||
}
|
||||
for (int ii = 0; ii < member_list->Size(); ++ii) {
|
||||
auto member_obj = member_list->At(ii);
|
||||
if (!member_obj || !member_obj->IsObject()) {
|
||||
parse_ok_ = false;
|
||||
return;
|
||||
}
|
||||
auto member = std::make_shared<CustomMember>();
|
||||
member->team_ = team.get();
|
||||
member->account_id_ = member_obj->Get("account_id").GetString();
|
||||
member->session_id_ = member_obj->Get("session_id").GetString();
|
||||
member->name_ = member_obj->Get("name").GetString();
|
||||
member->sex_ = member_obj->Get("sex");
|
||||
member->robot_id_ = member_obj->Get("robot_id");
|
||||
member->is_android_ = member_obj->Get("is_android");
|
||||
member->avatar_url_ = member_obj->Get("head_id").GetString();
|
||||
member->battle_context_ = std::make_shared<BattleDataContext>();
|
||||
member->battle_context_->ParseResult(*member_obj);
|
||||
if (!member->battle_context_->parse_ok) {
|
||||
parse_ok_ = false;
|
||||
return;
|
||||
}
|
||||
member_id_hash_[member->account_id_] = member;
|
||||
team->member_hash_[member->account_id_] = member;
|
||||
account_hash_[member->account_id_] = team;
|
||||
}
|
||||
member_id_hash_[member->account_id_] = member;
|
||||
team->member_hash_[member->account_id_] = member;
|
||||
account_hash_[member->account_id_] = team;
|
||||
}
|
||||
}
|
||||
{
|
||||
auto ob_list = obj.At("ob_list");
|
||||
if (ob_list && ob_list->IsArray()) {
|
||||
for (int i = 0; i < ob_list->Size(); ++i) {
|
||||
auto member_obj = ob_list->At(i);
|
||||
if (!member_obj || !member_obj->IsObject()) {
|
||||
parse_ok_ = false;
|
||||
return;
|
||||
}
|
||||
auto member = std::make_shared<CustomMember>();
|
||||
member->team_ = ob_team_.get();
|
||||
member->account_id_ = member_obj->Get("account_id").GetString();
|
||||
member->session_id_ = member_obj->Get("session_id").GetString();
|
||||
member->name_ = member_obj->Get("name").GetString();
|
||||
member->sex_ = member_obj->Get("sex");
|
||||
member->battle_context_ = std::make_shared<BattleDataContext>();
|
||||
member->battle_context_->ParseResult(*member_obj);
|
||||
if (!member->battle_context_->parse_ok) {
|
||||
parse_ok_ = false;
|
||||
return;
|
||||
}
|
||||
account_hash_[member->account_id_] = ob_team_;
|
||||
ob_id_hash_[member->account_id_] = member;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TraverseTeamList
|
||||
(
|
||||
[this] (std::shared_ptr<CustomTeam> team) -> bool
|
||||
{
|
||||
team->TraverseMember
|
||||
(
|
||||
[this] (std::shared_ptr<CustomMember> m) -> bool
|
||||
{
|
||||
auto member = m;
|
||||
f8::Timer::Instance()->SetTimeoutEx
|
||||
(
|
||||
a8::RandEx(mt::Param::s().battle_auto_ready_min_time,
|
||||
mt::Param::s().battle_auto_ready_max_time) * 1000,
|
||||
[member] (int event, const a8::Args* args)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
if (!member->is_ready_) {
|
||||
member->is_ready_ = 1;
|
||||
member->GetTeam()->GetCustomBattle()->OnMemberReady(member.get());
|
||||
}
|
||||
}
|
||||
},
|
||||
&timer_attacher);
|
||||
return true;
|
||||
});
|
||||
return true;
|
||||
});
|
||||
|
||||
raw_data_ = std::make_shared<a8::XObject>();
|
||||
obj.DeepCopy(*raw_data_);
|
||||
CalcTeam1AverageHeroLv();
|
||||
parse_ok_ = true;
|
||||
}
|
||||
|
||||
bool CustomBattle::CanAdd(const std::string& account_id, const std::string& session_id)
|
||||
{
|
||||
auto member = GetMemberByAccountId(account_id);
|
||||
if (!member) {
|
||||
return false;
|
||||
}
|
||||
if (member->IsJoined()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
std::shared_ptr<CustomMember> CustomBattle::GetMemberByAccountId(const std::string& account_id)
|
||||
{
|
||||
auto itr = member_id_hash_.find(account_id);
|
||||
@ -212,28 +123,11 @@ bool CustomBattle::AllIsJoined()
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool CustomBattle::AllIsReady()
|
||||
{
|
||||
bool ok = true;
|
||||
for (auto& pair : member_id_hash_) {
|
||||
if (!pair.second->IsReady()) {
|
||||
ok = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
int CustomBattle::GetMemberNum()
|
||||
{
|
||||
return member_id_hash_.size();
|
||||
}
|
||||
|
||||
int CustomBattle::GetTeamNum()
|
||||
{
|
||||
return uuid_hash_.size();
|
||||
}
|
||||
|
||||
void CustomBattle::TraverseMemberList(std::function<bool (CustomMember*)> func)
|
||||
{
|
||||
for (auto& pair : member_id_hash_) {
|
||||
@ -242,169 +136,3 @@ void CustomBattle::TraverseMemberList(std::function<bool (CustomMember*)> func)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CustomBattle::TraverseTeamList(std::function<bool (std::shared_ptr<CustomTeam>)> cb)
|
||||
{
|
||||
for (auto& pair : uuid_hash_) {
|
||||
if (!cb(pair.second)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<CustomMember> CustomBattle::GetObByAccountId(const std::string& account_id)
|
||||
{
|
||||
auto itr = ob_id_hash_.find(account_id);
|
||||
return itr != ob_id_hash_.end() ? itr->second : nullptr;
|
||||
}
|
||||
|
||||
void CustomBattle::TraverseObList(std::function<bool (std::shared_ptr<CustomMember>)> cb)
|
||||
{
|
||||
for (auto& pair : ob_id_hash_) {
|
||||
if (!cb(pair.second)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RoomMode_e CustomBattle::GetRoomMode()
|
||||
{
|
||||
if (IsMoba()) {
|
||||
return kMobaMode;
|
||||
} else {
|
||||
if (match_mode_) {
|
||||
if (GetMapModeMeta()->mapMode() == mt::kPvpRankMode) {
|
||||
return kPvpRankMode;
|
||||
} else {
|
||||
return kPvpMode;
|
||||
}
|
||||
} else {
|
||||
return kPvpMode;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CustomBattle::CalcTeam1AverageHeroLv()
|
||||
{
|
||||
if (!team_list_.empty()) {
|
||||
team1_average_hero_lv_ = team_list_.at(0)->GetAverageHeroLv();
|
||||
}
|
||||
}
|
||||
|
||||
RoomType_e CustomBattle::GetRoomType()
|
||||
{
|
||||
if (IsMoba()) {
|
||||
return RoomType_MidBrid;
|
||||
}
|
||||
if (IsCustomMode()) {
|
||||
return RoomType_MidBrid;
|
||||
}
|
||||
if (GetRoomMode() == kPvpRankMode) {
|
||||
auto rank_mode_conf = mt::Param::GetRankModeConfByHeroLv(team1_average_hero_lv_);
|
||||
if (!rank_mode_conf) {
|
||||
abort();
|
||||
}
|
||||
return rank_mode_conf->room_type;
|
||||
} else {
|
||||
if (team1_average_hero_lv_ < mt::Param::s().new_room_max_level) {
|
||||
return RoomType_OldBrid1;
|
||||
}
|
||||
if (team1_average_hero_lv_ < mt::Param::s().mid_room_max_level) {
|
||||
return RoomType_OldBrid2;
|
||||
}
|
||||
return RoomType_OldBrid3;
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<CustomTeam> CustomBattle::GetTeamByIdx(int idx)
|
||||
{
|
||||
if (GetTeamNum() <= 0) {
|
||||
return nullptr;
|
||||
}
|
||||
if (idx < 0 || idx >= GetTeamNum()) {
|
||||
return nullptr;
|
||||
}
|
||||
return team_list_.at(idx);
|
||||
}
|
||||
|
||||
void CustomBattle::OnEnter(std::shared_ptr<cs::CMJoin> join_msg, long ip_saddr, int socket_handle,
|
||||
std::weak_ptr<SocketDisconnectHandler> sd_handler)
|
||||
{
|
||||
if (sd_handler.expired()) {
|
||||
socket_handle = 0;
|
||||
}
|
||||
auto member = GetMemberByAccountId(join_msg->account_id());
|
||||
if (!member) {
|
||||
member = GetObByAccountId(join_msg->account_id());
|
||||
if (!member) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
{
|
||||
ss::SS_BindUpStreamSocket notifymsg;
|
||||
GGListener::Instance()->SendToClient(socket_handle, 0, notifymsg);
|
||||
}
|
||||
NotifyState();
|
||||
RoomMgr::Instance()->UnBindCustomMemberSocket(socket_handle);
|
||||
member->join_msg_ = join_msg;
|
||||
member->ip_saddr_ = ip_saddr;
|
||||
member->socket_handle_ = socket_handle;
|
||||
if (socket_handle) {
|
||||
socket_hash_[socket_handle] = member;
|
||||
RoomMgr::Instance()->ReBindCustomMemberSocket(member);
|
||||
}
|
||||
NotifyState();
|
||||
if (IsPvp()) {
|
||||
for (auto& pair : member_id_hash_) {
|
||||
pair.second->is_ready_ = 1;
|
||||
OnMemberReady(pair.second.get());
|
||||
}
|
||||
}
|
||||
#ifdef MYDEBUG
|
||||
a8::XPrintf("OnEnter socket_handle:%d\n", {socket_handle});
|
||||
#endif
|
||||
if (state_ == 1) {
|
||||
auto hum = GetRoom()->GetPlayerByAccountId(join_msg->account_id());
|
||||
if (hum) {
|
||||
hum->ReJoin(ip_saddr, socket_handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CustomBattle::OnMemberReady(CustomMember* member)
|
||||
{
|
||||
if (state_ == 0 && AllIsReady()) {
|
||||
state_ = 1;
|
||||
GameStart();
|
||||
}
|
||||
NotifyState();
|
||||
}
|
||||
|
||||
void CustomBattle::GameStart()
|
||||
{
|
||||
if (IsNormalMode()) {
|
||||
auto room = RoomMgr::Instance()->GetJoinableRoom(shared_from_this());
|
||||
if (!room) {
|
||||
RoomType_e self_room_type = GetRoomType();
|
||||
if (IsPvp()) {
|
||||
room = RoomMgr::Instance()->CreateRoom
|
||||
(self_room_type,
|
||||
GetMapModeMeta()->id(),
|
||||
GetMapId(),
|
||||
GetRoomMode(),
|
||||
nullptr);
|
||||
} else {
|
||||
room = RoomMgr::Instance()->CreateRoom
|
||||
(self_room_type,
|
||||
GetMapModeMeta()->id(),
|
||||
GetMapId(),
|
||||
GetRoomMode(),
|
||||
nullptr);
|
||||
}
|
||||
}
|
||||
SetRoom(room.get());
|
||||
room->JoinWithCustomBattle(shared_from_this());
|
||||
} else {
|
||||
abort();
|
||||
}
|
||||
}
|
||||
|
@ -1,15 +1,9 @@
|
||||
#pragma once
|
||||
|
||||
#include <f8/timer.h>
|
||||
|
||||
const int CUSTOM_ROOM_CUSTOM = 0;
|
||||
const int CUSTOM_ROOM_NORMAL = 1;
|
||||
|
||||
class SocketDisconnectHandler;
|
||||
class Room;
|
||||
class CustomTeam;
|
||||
class CustomMember;
|
||||
class CustomBattle : public std::enable_shared_from_this<CustomBattle>
|
||||
class CustomBattle
|
||||
{
|
||||
public:
|
||||
|
||||
@ -20,69 +14,32 @@ class CustomBattle : public std::enable_shared_from_this<CustomBattle>
|
||||
Room* GetRoom() { return room_; }
|
||||
void SetRoom(Room* room) { room_ = room; }
|
||||
const std::string& GetRoomId() { return room_id_; }
|
||||
const std::string& GetMatchRoomUuid() { return room_uuid_; }
|
||||
const std::string& GetRoomUuid() { return room_uuid_; }
|
||||
const std::string& GetSign() { return sign_; }
|
||||
const std::shared_ptr<a8::XObject>& GetRawData() { return raw_data_; }
|
||||
int GetZoneId() { return zone_id_; }
|
||||
int GetNodeId() { return zone_id_; }
|
||||
int GetMatchMode() { return match_mode_; }
|
||||
const mt::MapMode* GetMapModeMeta() { return map_mode_meta_; }
|
||||
int GetMapId() { return map_id_; }
|
||||
RoomType_e GetRoomType();
|
||||
RoomMode_e GetRoomMode();
|
||||
int GetStartTime() { return start_time_; }
|
||||
void ParseResult(a8::XObject& obj);
|
||||
bool CanAdd(const std::string& account_id, const std::string& session_id);
|
||||
std::shared_ptr<CustomTeam> GetTeamByAccountId(const std::string& account_id);
|
||||
std::shared_ptr<CustomTeam> GetTeamByIdx(int idx);
|
||||
std::shared_ptr<CustomMember> GetMemberByAccountId(const std::string& account_id);
|
||||
std::shared_ptr<CustomTeam> GetTeamByTeamUuid(const std::string& team_uuid);
|
||||
std::shared_ptr<CustomMember> GetObByAccountId(const std::string& account_id);
|
||||
bool AllIsJoined();
|
||||
bool AllIsReady();
|
||||
int GetMemberNum();
|
||||
int GetTeamNum();
|
||||
void TraverseMemberList(std::function<bool (CustomMember*)> func);
|
||||
void TraverseTeamList(std::function<bool (std::shared_ptr<CustomTeam>)> cb);
|
||||
void TraverseObList(std::function<bool (std::shared_ptr<CustomMember>)> cb);
|
||||
void SetCustomRoomType(int custom_room_type) { custom_room_type_ = custom_room_type; }
|
||||
bool IsNormalMode() { return custom_room_type_ == CUSTOM_ROOM_NORMAL; }
|
||||
bool IsCustomMode() { return custom_room_type_ == CUSTOM_ROOM_CUSTOM; }
|
||||
bool IsPvp() { return !is_moba_; }
|
||||
bool IsMoba() { return is_moba_; }
|
||||
void OnEnter(std::shared_ptr<cs::CMJoin> join_msg, long ip_saddr, int socket_handle,
|
||||
std::weak_ptr<SocketDisconnectHandler> sd_handler);
|
||||
void OnMemberReady(CustomMember* member);
|
||||
|
||||
private:
|
||||
|
||||
void CalcTeam1AverageHeroLv();
|
||||
void NotifyState();
|
||||
void GameStart();
|
||||
|
||||
private:
|
||||
f8::Attacher timer_attacher;
|
||||
bool parse_ok_ = false;
|
||||
int state_ = 0;
|
||||
Room *room_ = nullptr;
|
||||
int custom_room_type_ = CUSTOM_ROOM_CUSTOM;
|
||||
bool is_moba_ = false;
|
||||
std::string room_id_;
|
||||
std::string room_uuid_;
|
||||
int zone_id_ = 0;
|
||||
int node_id_ = 0;
|
||||
int map_mode_ = 0;
|
||||
int match_mode_ = 0;
|
||||
int map_id_ = 0;
|
||||
int start_time_ = 0;
|
||||
int team1_average_hero_lv_ = 0;
|
||||
const mt::MapMode* map_mode_meta_ = nullptr;
|
||||
std::string sign_;
|
||||
std::shared_ptr<a8::XObject> raw_data_;
|
||||
std::vector<std::shared_ptr<CustomTeam>> team_list_;
|
||||
std::map<std::string, std::shared_ptr<CustomTeam>> uuid_hash_;
|
||||
std::shared_ptr<CustomTeam> ob_team_;
|
||||
std::map<std::string, std::shared_ptr<CustomTeam>> account_hash_;
|
||||
std::map<std::string, std::shared_ptr<CustomMember>> member_id_hash_;
|
||||
std::map<std::string, std::shared_ptr<CustomMember>> ob_id_hash_;
|
||||
std::map<int, std::shared_ptr<CustomMember>> socket_hash_;
|
||||
};
|
||||
|
@ -1,7 +1,5 @@
|
||||
#include "precompile.h"
|
||||
|
||||
#include <f8/app.h>
|
||||
|
||||
#include "custom_battle.h"
|
||||
#include "custom_team.h"
|
||||
#include "custom_member.h"
|
||||
@ -12,21 +10,10 @@
|
||||
void CustomMember::Join(Player* hum)
|
||||
{
|
||||
joined_ = true;
|
||||
join_time_ = f8::App::Instance()->GetNowTime();
|
||||
join_time_ = Global::g_nowtime;
|
||||
}
|
||||
|
||||
bool CustomMember::IsView()
|
||||
{
|
||||
return team_->IsView();
|
||||
}
|
||||
|
||||
void CustomMember::_CMBattlePreSetReady(f8::MsgHdr* hdr, const cs::CMBattlePreSetReady& msg)
|
||||
{
|
||||
is_ready_ = true;
|
||||
GetTeam()->GetCustomBattle()->OnMemberReady(this);
|
||||
}
|
||||
|
||||
bool CustomMember::IsAndroid()
|
||||
{
|
||||
return is_android_ != 0;
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user