public static CSMedicalCheck FindMedicalCheck(out bool isReady, PeEntity npc) { isReady = false; if (PeGameMgr.IsMulti) { NetworkInterface npcnet = AiAdNpcNetwork.Get(npc.Id); if (npcnet == null) { return(null); } CSMgCreator creator = MultiColonyManager.GetCreator(npcnet.TeamId); if (creator.Assembly == null) { return(null); } if (creator.Assembly.MedicalCheck == null) { return(null); } CSMedicalCheck check = creator.Assembly.MedicalCheck; if (!check.IsRunning) { return(null); } isReady = check.IsReady(npc); if (npc.GetCmpt <NpcCmpt>().illAbnormals != null && npc.GetCmpt <NpcCmpt>().illAbnormals.Count > 0) { check._ColonyObj._Network.RPCServer(EPacketType.PT_CL_CHK_FindMachine, npc.Id); } return(check); } else { if (s_MgCreator.Assembly == null) { return(null); } if (s_MgCreator.Assembly.MedicalCheck == null) { return(null); } CSMedicalCheck detector = s_MgCreator.Assembly.MedicalCheck; if (!detector.IsRunning) { return(null); } isReady = detector.IsReady(npc); detector.AppointCheck(npc); return(detector); } }
public static bool TryGetCheck(PeEntity npc) { if (PeGameMgr.IsMulti) { NetworkInterface npcnet = AiAdNpcNetwork.Get(npc.Id); if (npcnet == null) { return(false); } CSMgCreator creator = MultiColonyManager.GetCreator(npcnet.TeamId); if (creator.Assembly == null) { return(false); } if (creator.Assembly.MedicalCheck == null) { return(false); } CSMedicalCheck detector = creator.Assembly.MedicalCheck; if (!detector.IsRunning) { return(false); } detector._ColonyObj._Network.RPCServer(EPacketType.PT_CL_CHK_TryStart, npc.Id); } else { if (s_MgCreator.Assembly == null) { return(false); } if (s_MgCreator.Assembly.MedicalCheck == null) { return(false); } CSMedicalCheck detector = s_MgCreator.Assembly.MedicalCheck; if (!detector.IsRunning) { return(false); } //--to do : check npc detector return(detector.StartCheck(npc)); } return(false); }
CSCommon _CreateCommon(int type) { CSCommon csc = null; switch (type) { case CSConst.etStorage: csc = new CSStorage(); CSStorage css = csc as CSStorage; css.m_Info = CSInfoMgr.m_StorageInfo; css.m_Creator = this; css.m_Package.ExtendPackage(CSInfoMgr.m_StorageInfo.m_MaxItem, CSInfoMgr.m_StorageInfo.m_MaxEquip, CSInfoMgr.m_StorageInfo.m_MaxRecource, CSInfoMgr.m_StorageInfo.m_MaxArmor); break; case CSConst.etEnhance: csc = new CSEnhance(); CSEnhance csen = csc as CSEnhance; csen.m_Creator = this; csen.m_Info = CSInfoMgr.m_EnhanceInfo; break; case CSConst.etRepair: csc = new CSRepair(); CSRepair csr = csc as CSRepair; csr.m_Creator = this; csr.m_Info = CSInfoMgr.m_RepairInfo; break; case CSConst.etRecyle: csc = new CSRecycle(); CSRecycle csrc = csc as CSRecycle; csrc.m_Creator = this; csrc.m_Info = CSInfoMgr.m_RecycleInfo; break; case CSConst.etDwelling: csc = new CSDwellings(); CSDwellings csd = csc as CSDwellings; csd.m_Creator = this; csd.m_Info = CSInfoMgr.m_DwellingsInfo; // Find the npc to live if (!PeGameMgr.IsMulti) { int index = 0; foreach (KeyValuePair <int, CSCommon> kvp in m_CommonEntities) { if (index >= csd.m_NPCS.Length) { break; } if (kvp.Value.m_Type == CSConst.etDwelling) { CSDwellings dwellings = kvp.Value as CSDwellings; if (dwellings.IsRunning) { continue; } for (int i = 0; i < dwellings.m_NPCS.Length; i++) { if (dwellings.m_NPCS[i] != null) { csd.AddNpcs(dwellings.m_NPCS[i]); dwellings.RemoveNpc(dwellings.m_NPCS[i]); index++; } } } } } break; case CSConst.etppCoal: csc = new CSPPCoal(); CSPPCoal cscppc = csc as CSPPCoal; cscppc.m_Creator = this; cscppc.m_Power = 10000; cscppc.m_RestPower = 10000; cscppc.m_Info = CSInfoMgr.m_ppCoal; break; case CSConst.etppSolar: csc = new CSPPSolar(); CSPPSolar cspps = csc as CSPPSolar; cspps.m_Creator = this; cspps.m_Power = 10000; cspps.m_RestPower = 10000; cspps.m_Info = CSInfoMgr.m_ppCoal; break; case CSConst.etFarm: csc = new CSFarm(); csc.m_Creator = this; csc.m_Info = CSInfoMgr.m_FarmInfo; break; case CSConst.etFactory: csc = new CSFactory(); csc.m_Creator = this; csc.m_Info = CSInfoMgr.m_FactoryInfo; break; case CSConst.etProcessing: csc = new CSProcessing(this); CSProcessing csp = csc as CSProcessing; csp.m_Info = CSInfoMgr.m_ProcessingInfo; break; case CSConst.etTrade: csc = new CSTrade(this); CSTrade cst = csc as CSTrade; cst.m_Info = CSInfoMgr.m_Trade; break; case CSConst.etTrain: csc = new CSTraining(this); CSTraining cstrain = csc as CSTraining; cstrain.m_Info = CSInfoMgr.m_Train; break; case CSConst.dtCheck: csc = new CSMedicalCheck(this); CSMedicalCheck csCheck = csc as CSMedicalCheck; csCheck.m_Info = CSInfoMgr.m_Check; break; case CSConst.dtTreat: csc = new CSMedicalTreat(this); CSMedicalTreat csTreat = csc as CSMedicalTreat; csTreat.m_Info = CSInfoMgr.m_Treat; break; case CSConst.dtTent: csc = new CSMedicalTent(this); CSMedicalTent csTent = csc as CSMedicalTent; csTent.m_Info = CSInfoMgr.m_Tent; break; case CSConst.dtppFusion: csc = new CSPPFusion(); CSPPFusion csFusion = csc as CSPPFusion; csFusion.m_Creator = this; csFusion.m_Power = 10000; csFusion.m_RestPower = 100000; csFusion.m_Info = CSInfoMgr.m_ppFusion; break; default: break; } return(csc); }