public void ClearUpdateNPC() { for (int i = 0; i < this.m_ClientNpcList.Count; i++) { BountyHuntNPCInfo bountyHuntNPCInfo = this.m_ClientNpcList[i]; if (bountyHuntNPCInfo != null) { NrTSingleton <NkCharManager> .Instance.DeleteChar(bountyHuntNPCInfo.CharID); } } this.m_ClientNpcList.Clear(); }
public BountyHuntNPCInfo GetNPCInfo(int iBountyHuntUnique) { for (int i = 0; i < this.m_ClientNpcList.Count; i++) { BountyHuntNPCInfo bountyHuntNPCInfo = this.m_ClientNpcList[i]; if (bountyHuntNPCInfo != null) { if ((int)bountyHuntNPCInfo.BountyHuntUnique == iBountyHuntUnique) { if (NrTSingleton <NkCharManager> .Instance.GetChar(bountyHuntNPCInfo.CharID) != null) { return(bountyHuntNPCInfo); } } } } return(null); }
public Vector3 FindFirstPath(short iBountyHuntUnique) { Vector3 result = Vector3.zero; NrMyCharInfo myCharInfo = NrTSingleton <NkCharManager> .Instance.GetMyCharInfo(); if (myCharInfo == null) { return(result); } int mapIndex = myCharInfo.m_kCharMapInfo.MapIndex; BountyInfoData bountyInfoDataFromUnique = this.GetBountyInfoDataFromUnique(iBountyHuntUnique); if (bountyInfoDataFromUnique == null) { return(result); } if (bountyInfoDataFromUnique.i32MapIndex != mapIndex) { this.IsWarp(iBountyHuntUnique, bountyInfoDataFromUnique.i32MapIndex); } else { BountyHuntNPCInfo bountyHuntNPCInfo = this.GetNPCInfo((int)bountyInfoDataFromUnique.i16Unique); if (bountyHuntNPCInfo == null) { bountyHuntNPCInfo = this.UpdateClientNpc(bountyInfoDataFromUnique.i32MapIndex); } if (bountyHuntNPCInfo != null) { int i32MapIndex = bountyInfoDataFromUnique.i32MapIndex; short destX = (short)bountyHuntNPCInfo.Pos.x; short destY = (short)bountyHuntNPCInfo.Pos.z; NrCharBase @char = NrTSingleton <NkCharManager> .Instance.GetChar(1); if (@char != null && @char.m_kCharMove != null) { result = @char.m_kCharMove.FindFirstPath(i32MapIndex, destX, destY, false); } } } NrTSingleton <FormsManager> .Instance.CloseForm(G_ID.BOUNTYHUNTING_DLG); return(result); }
public BountyHuntNPCInfo UpdateClientNpc(int iMapIndex) { if (Scene.CurScene != Scene.Type.WORLD) { return(null); } if (iMapIndex == 0) { iMapIndex = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.m_kCharMapInfo.m_nMapIndex; } for (int i = 0; i < this.m_ClientNpcList.Count; i++) { BountyHuntNPCInfo bountyHuntNPCInfo = this.m_ClientNpcList[i]; if (bountyHuntNPCInfo != null) { NrTSingleton <NkCharManager> .Instance.DeleteChar(bountyHuntNPCInfo.CharID); } } this.m_ClientNpcList.Clear(); BountyInfoData bountyInfoDataFromUnique = this.GetBountyInfoDataFromUnique(NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.BountyHuntUnique); if (bountyInfoDataFromUnique != null) { if (iMapIndex != bountyInfoDataFromUnique.i32MapIndex) { return(null); } if (!NrTSingleton <BountyHuntManager> .Instance.GetBountyInfoDataTime(bountyInfoDataFromUnique.i16Unique)) { NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.BountyHuntUnique = 0; NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo.ClearBountyHuntClearInfo(); } else { NrCharKindInfo charKindInfo = NrTSingleton <NrCharKindInfoManager> .Instance.GetCharKindInfo(bountyInfoDataFromUnique.i32NPCCharKind); if (charKindInfo != null) { int num = UnityEngine.Random.Range(0, 5); NEW_MAKECHAR_INFO nEW_MAKECHAR_INFO = new NEW_MAKECHAR_INFO(); nEW_MAKECHAR_INFO.CharName = TKString.StringChar(charKindInfo.GetName()); nEW_MAKECHAR_INFO.CharPos.x = bountyInfoDataFromUnique.fFixPosX[num]; nEW_MAKECHAR_INFO.CharPos.y = 0f; nEW_MAKECHAR_INFO.CharPos.z = bountyInfoDataFromUnique.fFixPosZ[num]; int num2 = bountyInfoDataFromUnique.iDirection[num]; float f = (float)num2 * 0.0174532924f; nEW_MAKECHAR_INFO.Direction.x = 1f * Mathf.Sin(f); nEW_MAKECHAR_INFO.Direction.y = 0f; nEW_MAKECHAR_INFO.Direction.z = 1f * Mathf.Cos(f); nEW_MAKECHAR_INFO.CharKind = charKindInfo.GetCharKind(); nEW_MAKECHAR_INFO.CharKindType = 3; nEW_MAKECHAR_INFO.CharUnique = NrTSingleton <NkCharManager> .Instance.GetClientNpcUnique(); if (nEW_MAKECHAR_INFO.CharUnique == 0) { GS_BOUNTYHUNT_LOG_REQ gS_BOUNTYHUNT_LOG_REQ = new GS_BOUNTYHUNT_LOG_REQ(); gS_BOUNTYHUNT_LOG_REQ.i16BountyHuntUnique = bountyInfoDataFromUnique.i16Unique; gS_BOUNTYHUNT_LOG_REQ.i32CharID = (int)nEW_MAKECHAR_INFO.CharUnique; gS_BOUNTYHUNT_LOG_REQ.i32MapIndex = iMapIndex; SendPacket.GetInstance().SendObject(1930, gS_BOUNTYHUNT_LOG_REQ); } int num3 = NrTSingleton <NkCharManager> .Instance.SetChar(nEW_MAKECHAR_INFO, false, false); TsLog.LogOnlyEditor(string.Concat(new object[] { "BountyHunt UpdateClientNpc MapIndex : ", iMapIndex, " : ", num3 })); BountyHuntNPCInfo bountyHuntNPCInfo2 = new BountyHuntNPCInfo(); bountyHuntNPCInfo2.MapIndex = iMapIndex; bountyHuntNPCInfo2.CharID = num3; bountyHuntNPCInfo2.BountyHuntUnique = bountyInfoDataFromUnique.i16Unique; bountyHuntNPCInfo2.Pos = nEW_MAKECHAR_INFO.CharPos; bountyHuntNPCInfo2.RandIndex = num; this.m_ClientNpcList.Add(bountyHuntNPCInfo2); return(bountyHuntNPCInfo2); } } } return(null); }