void MulAdRandMisOperation(TargetType curType, int targetid) { switch (curType) { case TargetType.TargetType_KillMonster: { //if (!m_Player.m_bHadInitMission) // m_Player.RPCServer(EPacketType.PT_InGame_InitMission, targetid); } break; case TargetType.TargetType_Follow: { TypeFollowData data = MissionManager.GetTypeFollowData(targetid); if (data == null) { return; } data.m_DistRadius = data.m_AdDistPos.radius2; if (PeCreature.Instance.mainPlayer.ExtGetName() != m_FollowPlayerName && m_FollowPlayerName != null) { break; } for (int i = 0; i < data.m_iNpcList.Count; i++) { PeEntity npc = EntityMgr.Instance.Get(data.m_iNpcList[i]); if (npc == null) { continue; } } } break; case TargetType.TargetType_UseItem: { TypeUseItemData data = MissionManager.GetTypeUseItemData(targetid); if (data == null) { return; } // int iMin = data.m_AdDistPos.dist - data.m_AdDistPos.radius; // int iMax = data.m_AdDistPos.dist + data.m_AdDistPos.radius; data.m_Radius = data.m_AdDistPos.radius2; } break; } }
void RPC_S2C_CreateFollowPos(uLink.BitStream stream, uLink.NetworkMessageInfo info) { float x, y; int targetid, missionId; stream.TryRead <float> (out x); stream.TryRead <float> (out y); stream.TryRead <int> (out targetid); stream.TryRead <int>(out missionId); Vector3 pos = new Vector3(x, VFDataRTGen.GetPosTop(new IntVector2((int)x, (int)y)), y); if (null != PlayerNetwork.mainPlayer) { PlayerNetwork.mainPlayer.RPCServer(EPacketType.PT_InGame_MissionFollowPos, pos, targetid); } TypeFollowData data = MissionManager.GetTypeFollowData(targetid); if (data == null) { return; } data.m_DistPos = pos; data.m_DistRadius = data.m_AdDistPos.radius2; if (data.m_AdNpcRadius.num > 0) { data.m_LookNameID = StroyManager.Instance.CreateMissionRandomNpc(data.m_DistPos, data.m_AdNpcRadius.num); } if (IsOwner) { if (data.m_AdDistPos.refertoType == ReferToType.Transcript) { RandomDungenMgr.Instance.GenTaskEntrance(new IntVector2((int)data.m_DistPos.x, (int)data.m_DistPos.z), data.m_AdDistPos.referToID); } for (int i = 0; i < data.m_CreateNpcList.Count; i++) { Vector3 createpos = StroyManager.Instance.GetPatrolPoint(data.m_DistPos, 3, 8, false); EntityCreateMgr.Instance.CreateRandomNpc(data.m_CreateNpcList[i], createpos); } MissionManager.Instance.m_PlayerMission.ProcessFollowMission(missionId, targetid); } UpdateMissionMapLabelPos(missionId, targetid, pos); }
public static void CreateRandomMission(int id) { int type = 1; if (MissionRepository.m_MissionCommonMap.ContainsKey(id)) { MissionCommonData data1 = MissionManager.GetMissionCommonData(id); if (data1 != null) { return; } } MutiPlayMissionRand rand = GetMissRand(id); if (rand == null) { return; } // 0小怪、1BOSS、2收集、3护送、4探索、5塔防 if (GameConfig.IsMultiServer) { type = UnityEngine.Random.Range(1, 3); //随机1 //PlayerFactory.RandIds[0] = type; } else { //type = PlayerFactory.RandIds[0]; } MissionType misstype = MissionType.MissionType_Main; TypeMonsterData monData = null; TypeCollectData colData = null; TypeMessengerData mesData = null; TypeFollowData folData = null; TypeSearchData seaData = null; TypeTowerDefendsData towData = null; //switch (type) //{ // case 0: // monData = new TypeMonsterData(); // break; // case 1: // monData = new TypeMonsterData(); // break; // case 2: // colData = new TypeCollectData(); // break; // case 3: // folData = new TypeFollowData(); // break; // case 4: // seaData = new TypeSearchData(); // break; // case 5: // towData = new TypeTowerDefendsData(); // break; //} int idx = 0; MissionCommonData data = new MissionCommonData(); data.m_ID = id; // string[] listName = { "Monster Hunter", "Boss Hunter", "Gather", "Escort", "Exploration", "Defend" }; //data.m_MissionName = listName[type]; data.m_iNpc = 0; data.m_iReplyNpc = 0; data.m_Type = misstype; data.m_MaxNum = 1; TalkData talkdata = TalkRespository.GetTalkData(911); if (talkdata != null) { data.m_Description = talkdata.m_Content; } if (type == 0 || type == 1) { if (GameConfig.IsMultiServer) { idx = 0; //随机2 //PlayerFactory.RandIds[1] = idx; } else { //idx = PlayerFactory.RandIds[1]; } monData.m_TargetID = 1100; monData.m_MonsterID = rand.m_MulKillID[idx]; monData.m_MonsterNum = rand.m_MulKillNum[idx]; monData.m_Desc = "KillMonster : " + AiDataBlock.GetAIDataName(monData.m_MonsterID); data.m_TargetIDList.Add(monData.m_TargetID); } else if (type == 2) { if (GameConfig.IsMultiServer) { idx = UnityEngine.Random.Range(0, rand.m_MulCollectID.Count); //随机3 //PlayerFactory.RandIds[2] = idx; } else { //idx = PlayerFactory.RandIds[2]; } colData.m_TargetID = 2100; colData.ItemID = rand.m_MulCollectID[idx]; idx = UnityEngine.Random.Range(0, rand.m_MulCollectNum.Count); colData.ItemNum = rand.m_MulCollectNum[idx]; colData.m_Desc = "Gather : " + ItemAsset.ItemProto.GetName(colData.ItemID); data.m_TargetIDList.Add(colData.m_TargetID); } if (type == 5) { towData.m_TargetID = 7100; towData.m_Time = 5; towData.m_Desc = data.m_MissionName; //towData.m_Pos = npcobj.transform.position; //towData.m_NpcList.Add(npcname); if (idx == 1) { towData.m_Count = UnityEngine.Random.Range(3, 6); } else if (idx == 2) { towData.m_Count = UnityEngine.Random.Range(5, 9); } else { towData.m_Count = UnityEngine.Random.Range(8, 13); } //for (int i = 0; i < towData.m_Count; i++) //{ // if (idx == 1) // { // towData.m_TDInfoList.Add(UnityEngine.Random.Range(17, 22)); // } // else if (idx == 2) // { // towData.m_TDInfoList.Add(UnityEngine.Random.Range(22, 26)); // } // else // { // towData.m_TDInfoList.Add(UnityEngine.Random.Range(26, 30)); // } //} data.m_TargetIDList.Add(towData.m_TargetID); } //// 0.小怪、1.BOSS、2.收集、3.护送、4.探索、5.塔防 MissionIDNum idnum = new MissionIDNum(); switch (type) { case 0: case 1: case 2: { if (GameConfig.IsMultiServer) { idx = UnityEngine.Random.Range(0, rand.m_MulRD.Count); //随机4 //PlayerFactory.RandIds[3] = idx; } else { //idx = PlayerFactory.RandIds[3]; } idnum.id = 30000000; //统一奖励货币 idnum.num = rand.m_MulRD[idx]; data.m_Com_RewardItem.Add(idnum); } break; case 3: { if (GameConfig.IsMultiServer) { idx = UnityEngine.Random.Range(0, rand.m_MulEscort.Count); //随机4 //PlayerFactory.RandIds[3] = idx; } else { //idx = PlayerFactory.RandIds[3]; } idnum.id = 30000000; // idnum.num = rand.m_MulEscort[idx]; data.m_Com_RewardItem.Add(idnum); } break; case 4: { if (GameConfig.IsMultiServer) { idx = UnityEngine.Random.Range(0, rand.m_MulExplore.Count); //随机4 //PlayerFactory.RandIds[3] = idx; } else { //idx = PlayerFactory.RandIds[3]; } idnum.id = 30000000; // idnum.num = rand.m_MulExplore[idx]; data.m_Com_RewardItem.Add(idnum); } break; case 5: { if (GameConfig.IsMultiServer) { idx = UnityEngine.Random.Range(0, rand.m_MulTD.Count); //随机4 //PlayerFactory.RandIds[3] = idx; } else { //idx = PlayerFactory.RandIds[3]; } idnum.id = 30000000; // idnum.num = rand.m_MulTD[idx]; data.m_Com_RewardItem.Add(idnum); } break; } if (monData != null) { MissionRepository.AddTypeMonsterData(monData.m_TargetID, monData); } else if (colData != null) { MissionRepository.AddTypeCollectData(colData.m_TargetID, colData); } else if (folData != null) { MissionRepository.AddTypeFollowData(folData.m_TargetID, folData); } else if (seaData != null) { MissionRepository.AddTypeSearchData(seaData.m_TargetID, seaData); } else if (mesData != null) { MissionRepository.AddTypeMessengerData(mesData.m_TargetID, mesData); } else if (towData != null) { MissionRepository.AddTypeTowerDefendsData(towData.m_TargetID, towData); } if (!MissionRepository.m_MissionCommonMap.ContainsKey(data.m_ID)) { MissionRepository.m_MissionCommonMap.Add(data.m_ID, data); } }