From c591cb6e215ea5e762560afdae059f1d4fd7f4ec Mon Sep 17 00:00:00 2001
From: client_linchunjie <461730578@qq.com>
Date: 星期五, 28 九月 2018 16:32:37 +0800
Subject: [PATCH] Merge branch 'master' into 3687天赋功能
---
Fight/MapTransferUtility.cs | 229 ++++++++++++++++++++++++++++++++------------------------
1 files changed, 130 insertions(+), 99 deletions(-)
diff --git a/Fight/MapTransferUtility.cs b/Fight/MapTransferUtility.cs
index d9d2a4f..b7f4b80 100644
--- a/Fight/MapTransferUtility.cs
+++ b/Fight/MapTransferUtility.cs
@@ -180,8 +180,22 @@
}
}
- public void MoveToNPC(int npcID)
+ public void MoveToNPC(int npcID, int sid = 0)
{
+ if (sid != 0)
+ {
+ GActor _actor = GAMgr.Instance.GetBySID((uint)sid);
+ if (_actor != null)
+ {
+ NpcID = npcID;
+ MapTransferDoType = E_MapTransferDoType.Npc;
+
+ MoveToExistNpc(npcID, _actor);
+
+ return;
+ }
+ }
+
NPCConfig _config = Config.Instance.Get<NPCConfig>(npcID);
if (_config == null)
@@ -350,22 +364,21 @@
}
else
{
- //Debug.LogFormat(" |-- 鍦ㄦ湰鍦板浘");
- if (PlayerDatas.Instance.baseData.FBID != 0)
- {
- if (BossFakeLineUtility.Instance.IsShuntBoss(npcID))
- {
- //Debug.LogFormat(" |-- BossFakeLineUtility.Instance.makeFakeLineTimes = 1");
- BossFakeLineUtility.Instance.makeFakeLineTimes = 1;
- }
- }
+ //Debug.LogFormat(" |-- 鍦ㄦ湰鍦板浘");
+ // Debug.LogFormat("lastMoveToWorldBossNpcID: {0}, Time: {1}, FBID: {2}, showFakeLine: {3}, FairyBoss: {4}",
+ // lastMoveToWorldBossNpcID,
+ // Time.realtimeSinceStartup - lastMoveToWorldBossTime,
+ // PlayerDatas.Instance.baseData.FBID,
+ // BossFakeLineUtility.Instance.showFakeLine,
+ // _fairyBossModel.bosses != null
+ // && _fairyBossModel.bosses.Contains(npcID));
if (((lastMoveToWorldBossNpcID == npcID
- && Time.realtimeSinceStartup - lastMoveToWorldBossTime < 60)
- && PlayerDatas.Instance.baseData.FBID == 0)
- || BossFakeLineUtility.Instance.showFakeLine
- || (_fairyBossModel.bosses != null
- && _fairyBossModel.bosses.Contains(npcID)))
+ && Time.realtimeSinceStartup - lastMoveToWorldBossTime < 60)
+ && PlayerDatas.Instance.baseData.FBID == 0)
+ || BossFakeLineUtility.Instance.showFakeLine
+ || (_fairyBossModel.bosses != null
+ && _fairyBossModel.bosses.Contains(npcID)))
{
//Debug.LogFormat(" |-- 闈炴兂鍘荤殑boss涓�60绉掑唴琛屼负浜х敓涓斾负鍚屼竴鍙猙oss, {0}, {1}", BossFakeLineUtility.Instance.showFakeLine,
//PlayerDatas.Instance.baseData.FBID);
@@ -375,9 +388,14 @@
else
{
// 澶勪簬鐩稿悓鍦板浘
- if (BossFakeLineUtility.Instance.lastBossNpcID != npcID
- || Time.realtimeSinceStartup - BossFakeLineUtility.Instance.inMistakeForBossAliveOverTime > 60)
+ if (!BossFakeLineUtility.Instance.HasSawBossRecently(npcID))
{
+ if (BossFakeLineUtility.Instance.IsShuntBoss(npcID))
+ {
+ //Debug.LogFormat(" |-- BossFakeLineUtility.Instance.makeFakeLineTimes = 1");
+ BossFakeLineUtility.Instance.makeFakeLineTimes = 1;
+ }
+
//Debug.LogFormat(" |-- 闈炴兂鍘荤殑boss璁板綍,鎴栧垯瑙佸埌boss鏃跺樊瓒呰繃60绉�");
Send_WorldTransfer(_npcLocation.mapId, new Vector3(_hero.Pos.x * 2, 0, _hero.Pos.z * 2), MapTransferType.WorldTransport, 0, npcID);
}
@@ -459,111 +477,115 @@
{
_npc = GAMgr.Instance.GetCloserNPC(_hero.Pos, npcID);
- // 鐩爣鐐�, 榛樿涓轰富瑙掑潗鏍�, 鎵句笉鍒颁换鍔$粓鐐圭殑鏃跺�欎笉绉诲姩
- Vector3 _destPos = _hero.Pos;
+ MoveToExistNpc(npcID, _npc);
+ }
+ }
- // 璁$畻褰撳墠鍧愭爣涓庣洰鏍囪鑹茬殑鍧愭爣宸�
- //GActor _npc = GAMgr.Instance.GetCloserNPC(_hero.Pos, npcID);
- //// 濡傛灉鍦ㄥ綋鍓嶅湴鍥炬壘寰楀埌宸插垱寤哄嚭鏉ユ渶杩戠殑鐩爣
- //if (_npc != null)
- //{
- // _destPos = _npc.Pos;
- //}
- //else
- //{
- Vector2 _calculPos = _destPos;
- if (_findLocation)
+ private void MoveToExistNpc(int npcID, GActor npc)
+ {
+ GA_Hero _hero = PlayerDatas.Instance.hero;
+
+ NPCConfig _config = Config.Instance.Get<NPCConfig>(npcID);
+
+ // 鐩爣鐐�, 榛樿涓轰富瑙掑潗鏍�, 鎵句笉鍒颁换鍔$粓鐐圭殑鏃跺�欎笉绉诲姩
+ Vector3 _destPos = _hero.Pos;
+
+ // 鑾峰彇NPC浣嶇疆鏁版嵁
+ GAStaticDefine.NPCLocation _npcLocation;
+ var _findLocation = GAStaticDefine.TryGetMapNPCLocation(npcID, out _npcLocation);
+
+ Vector2 _calculPos = _destPos;
+ if (_findLocation)
+ {
+ _calculPos = _npcLocation.position;
+ }
+ _destPos = new Vector3(_calculPos.x, _hero.Pos.y, _calculPos.y);
+ //}
+
+ // 鍒ゆ柇璺濈
+ float _distSqrt = MathUtility.DistanceSqrtXZ(_hero.Pos, _destPos);
+
+ // 鍒ゆ柇鏄惁闇�瑕侀獞椹Щ鍔�
+ if (_distSqrt > Mathf.Pow(7, 2))
+ {
+ DTC0428_tagPlayerRideHorse.Send_tagPlayerRideHorse(true);
+ }
+
+ float _chkDist = Mathf.Max(GeneralConfig.Instance.CloseNpcDist + _config.ModelRadius - 0.3f, 0);
+
+ if (_config.NPCType == (int)E_NpcType.OpenWorldMap)
+ {
+ _chkDist = 1;
+ }
+
+ // 閽堝鎸栨礊瀵硅薄淇濇寔璺濈涓�0
+ if (npc != null && _config.Dig == 1)
+ {
+ _chkDist = 0;
+ }
+
+ // 澶т簬閰嶇疆鐨勮窛绂�, 绉诲姩鑷�
+ if (_distSqrt > Mathf.Pow(_chkDist, 2))
+ {
+ if (_config.NPCType == (int)E_NpcType.Fight)
{
- _calculPos = _npcLocation.position;
+ _hero.MoveToPosition(_destPos, _npcLocation.scope);
}
- _destPos = new Vector3(_calculPos.x, _hero.Pos.y, _calculPos.y);
- //}
-
- // 鍒ゆ柇璺濈
- float _distSqrt = MathUtility.DistanceSqrtXZ(_hero.Pos, _destPos);
-
- // 鍒ゆ柇鏄惁闇�瑕侀獞椹Щ鍔�
- if (_distSqrt > Mathf.Pow(7, 2))
+ else
{
- DTC0428_tagPlayerRideHorse.Send_tagPlayerRideHorse(true);
+ if (npc != null)
+ {
+ _destPos = npc.Pos;
+ }
+
+ _hero.MoveToPosition(_destPos, _chkDist);
}
- float _chkDist = Mathf.Max(GeneralConfig.Instance.CloseNpcDist + _config.ModelRadius - 0.3f, 0);
-
- if (_config.NPCType == (int)E_NpcType.OpenWorldMap)
+ if (s_OnHeroStartMoveToNPC != null)
{
- _chkDist = 1;
+ s_OnHeroStartMoveToNPC();
}
-
- // 閽堝鎸栨礊瀵硅薄淇濇寔璺濈涓�0
- if (_npc != null && _config.Dig == 1)
- {
- _chkDist = 0;
- }
-
- // 澶т簬閰嶇疆鐨勮窛绂�, 绉诲姩鑷�
- if (_distSqrt > Mathf.Pow(_chkDist, 2))
+ }
+ // 灏忎簬璺濈鍒欏垽鏂洰鏍囩殑绫诲瀷,鎵ц鐩稿簲鐨勯�昏緫
+ else
+ {
+ if (_config != null)
{
if (_config.NPCType == (int)E_NpcType.Fight)
{
- _hero.MoveToPosition(_destPos, _npcLocation.scope);
+ _hero.Behaviour.StartHandupAI();
+ }
+ else if (_config.NPCType == (int)E_NpcType.Collect)
+ {
+ GA_NpcCollect _collect = npc as GA_NpcCollect;
+ if (_collect != null)
+ {
+ _collect.Arrive();
+ }
}
else
{
- if (_npc != null)
+ // 濡傛灉鐩爣宸茬粡鍦ㄤ箣鍓嶆悳绱腑纭畾浜�
+ // 娌$‘瀹氬叾瀹炲湪杩欓噷搴旇鏄紓甯告儏鍐�
+ if (npc != null)
{
- _destPos = _npc.Pos;
- }
+ _hero.LockTarget = npc;
+ _hero.SelectTarget = npc;
- _hero.MoveToPosition(_destPos, _chkDist);
- }
+ NPCInteractProcessor.InvokeEvent((E_NpcType)_config.NPCType, npcID, npc.ServerInstID);
- if (s_OnHeroStartMoveToNPC != null)
- {
- s_OnHeroStartMoveToNPC();
- }
- }
- // 灏忎簬璺濈鍒欏垽鏂洰鏍囩殑绫诲瀷,鎵ц鐩稿簲鐨勯�昏緫
- else
- {
- if (_config != null)
- {
- if (_config.NPCType == (int)E_NpcType.Fight)
- {
- _hero.Behaviour.StartHandupAI();
- }
- else if (_config.NPCType == (int)E_NpcType.Collect)
- {
- GA_NpcCollect _collect = _npc as GA_NpcCollect;
- if (_collect != null)
+ Vector3 _npc2heroDir = MathUtility.ForwardXZ(npc.Pos, _hero.Pos);
+
+ if (_config.AutomaticFace == 1)
{
- _collect.Arrive();
+ npc.Forward = -_npc2heroDir;
}
+ _hero.Forward = _npc2heroDir;
}
+ // 浼氭湁涓虹┖鐨勬椂鍊�, 渚嬪鏄皬椋為瀷椋炵殑鎯呭喌, 杩欓噷鐩存帴鍒ゆ柇涓庨厤缃殑鍧愭爣鐨勮窛绂�
else
{
- // 濡傛灉鐩爣宸茬粡鍦ㄤ箣鍓嶆悳绱腑纭畾浜�
- // 娌$‘瀹氬叾瀹炲湪杩欓噷搴旇鏄紓甯告儏鍐�
- if (_npc != null)
- {
- _hero.LockTarget = _npc;
- _hero.SelectTarget = _npc;
- NPCInteractProcessor.InvokeEvent((E_NpcType)_config.NPCType, npcID, _npc.ServerInstID);
-
- Vector3 _npc2heroDir = MathUtility.ForwardXZ(_npc.Pos, _hero.Pos);
-
- if (_config.AutomaticFace == 1)
- {
- _npc.Forward = -_npc2heroDir;
- }
- _hero.Forward = _npc2heroDir;
- }
- // 浼氭湁涓虹┖鐨勬椂鍊�, 渚嬪鏄皬椋為瀷椋炵殑鎯呭喌, 杩欓噷鐩存帴鍒ゆ柇涓庨厤缃殑鍧愭爣鐨勮窛绂�
- else
- {
-
- }
}
}
}
@@ -885,6 +907,15 @@
}
else if (_npcConfig.NPCType == (int)E_NpcType.Collect)
{
+ float _chkDist = GeneralConfig.Instance.CloseNpcDist + _npcConfig.ModelRadius + 0.3f;
+ if (_chkDistSqrt <= Mathf.Pow(_chkDist, 2))
+ {
+ if (!UserInputHandler.isTouched
+ && (_hero.SkillMgr.CurCastSkill == null || _hero.SkillMgr.CurCastSkill.SkillCompelete))
+ {
+ NPCInteractProcessor.InvokeEvent(E_NpcType.Func, NpcID, _npc.ServerInstID);
+ }
+ }
}
else
{
--
Gitblit v1.8.0