예제 #1
0
        public static void LogBuildingAndWorker(BuildingWorkInfo info, int selectedWorkerId,
                                                int partId, int placeId, TaiwuDate currDate, Dictionary <int, Dictionary <int, int> > workerAttrs,
                                                bool suppressNoWorkerWarnning)
        {
            var building       = DateFile.instance.homeBuildingsDate[partId][placeId][info.buildingIndex];
            int baseBuildingId = building[0];
            int buildingLevel  = building[1];

            var    baseBuilding = DateFile.instance.basehomePlaceDate[baseBuildingId];
            string buildingName = baseBuilding[0];

            string attrName = Output.GetRequiredAttrName(info.requiredAttrId);

            string logText = string.Format("{0}:{1} ({2}) {3} [{4}, {5}] - ",
                                           TaiwuCommon.SetColor(TaiwuCommon.COLOR_LIGHT_GRAY, Common.ToFullWidth(info.priority.ToString("F0").PadLeft(4))),
                                           TaiwuCommon.SetColor(TaiwuCommon.COLOR_YELLOW, Common.ToFullWidth(buildingName.PadRight(5))),
                                           TaiwuCommon.SetColor(TaiwuCommon.COLOR_LIGHT_GRAY, Common.ToFullWidth(buildingLevel.ToString().PadLeft(2))),
                                           TaiwuCommon.SetColor(TaiwuCommon.COLOR_RICE_WHITE, Common.ToFullWidth(attrName.PadRight(2))),
                                           TaiwuCommon.SetColor(TaiwuCommon.COLOR_LIGHT_GRAY, Common.ToFullWidth(info.halfWorkingAttrValue.ToString().PadLeft(3))),
                                           TaiwuCommon.SetColor(TaiwuCommon.COLOR_LIGHT_GRAY, Common.ToFullWidth(info.fullWorkingAttrValue.ToString().PadLeft(3))));

            if (selectedWorkerId >= 0)
            {
                string workerName = DateFile.instance.GetActorName(selectedWorkerId);
                int    attrValue  = info.requiredAttrId != 0 ? workerAttrs[selectedWorkerId][info.requiredAttrId] : -1;
                int    mood       = int.Parse(DateFile.instance.GetActorDate(selectedWorkerId, 4, false));
                int    favor      = DateFile.instance.GetActorFavor(false, DateFile.instance.MianActorID(), selectedWorkerId, getLevel: true);

                // 这里的工作效率并不一定等于最终工作效率,因为可能还有厢房未分配
                int workEffectiveness = info.requiredAttrId != 0 ?
                                        Original.GetWorkEffectiveness(partId, placeId, info.buildingIndex, selectedWorkerId) : -1;
                string workEffectivenessStr = workEffectiveness >= 0 ? workEffectiveness / 2 + "%" : "N/A";

                MajordomoWindow.instance.AppendMessage(currDate, Message.IMPORTANCE_LOW, logText + string.Format(
                                                           "{0} 资质: {1} 心情: {2} 好感: {3} 工作效率: {4}",
                                                           TaiwuCommon.SetColor(TaiwuCommon.COLOR_YELLOW, Common.ToFullWidth(workerName.PadRight(5))),
                                                           TaiwuCommon.SetColor(TaiwuCommon.COLOR_LIGHT_GRAY, Common.ToFullWidth(attrValue.ToString().PadLeft(3))),
                                                           TaiwuCommon.SetColor(TaiwuCommon.COLOR_LIGHT_GRAY, Common.ToFullWidth(mood.ToString().PadLeft(4))),
                                                           TaiwuCommon.SetColor(TaiwuCommon.COLOR_LIGHT_GRAY, Common.ToFullWidth(favor.ToString().PadLeft(2))),
                                                           TaiwuCommon.SetColor(TaiwuCommon.COLOR_WHITE, Common.ToFullWidth(workEffectivenessStr.PadLeft(4)))));
            }
            else
            {
                if (suppressNoWorkerWarnning)
                {
                    MajordomoWindow.instance.AppendMessage(currDate, Message.IMPORTANCE_LOW,
                                                           logText + TaiwuCommon.SetColor(TaiwuCommon.COLOR_LIGHT_GRAY, "无合适人选"));
                }
                else
                {
                    MajordomoWindow.instance.AppendMessage(currDate, Message.IMPORTANCE_HIGH,
                                                           logText + TaiwuCommon.SetColor(TaiwuCommon.COLOR_RED, "无合适人选"));
                }
            }
        }
예제 #2
0
        /// <summary>
        /// 获取当前据点需要工作人员的建筑,以及该建筑的工作相关信息
        /// </summary>
        /// <returns></returns>
        private Dictionary <int, List <BuildingWorkInfo> > GetBuildingsNeedWorker()
        {
            // requiredAttrId -> [BuildingWorkInfo, ]
            var attrBuildings = new Dictionary <int, List <BuildingWorkInfo> >();

            var buildings      = DateFile.instance.homeBuildingsDate[this.partId][this.placeId];
            var validBuildings = buildings.Where(entry => !this.excludedBuildings.Contains(entry.Key));

            foreach (var entry in validBuildings)
            {
                int   buildingIndex  = entry.Key;
                int[] building       = entry.Value;
                int   baseBuildingId = building[0];

                var  baseBuilding = DateFile.instance.basehomePlaceDate[baseBuildingId];
                bool needWorker   = int.Parse(baseBuilding[3]) == 1;
                if (!needWorker)
                {
                    continue;
                }

                int requiredAttrId = int.Parse(baseBuilding[33]);

                BuildingWorkInfo info = new BuildingWorkInfo
                {
                    buildingIndex        = buildingIndex,
                    requiredAttrId       = requiredAttrId,
                    priority             = HumanResource.GetBuildingWorkingPriority(this.partId, this.placeId, buildingIndex),
                    halfWorkingAttrValue = 0,
                    fullWorkingAttrValue = 0,
                };

                if (requiredAttrId != 0)
                {
                    int[] requiredAttrValues = Original.GetRequiredAttributeValues(this.partId, this.placeId, buildingIndex);
                    info.halfWorkingAttrValue = requiredAttrValues[0];
                    info.fullWorkingAttrValue = requiredAttrValues[1];
                }

                if (!attrBuildings.ContainsKey(requiredAttrId))
                {
                    attrBuildings[requiredAttrId] = new List <BuildingWorkInfo>();
                }
                attrBuildings[requiredAttrId].Add(info);
            }

            return(attrBuildings);
        }
예제 #3
0
        // 获取需要工作人员的建筑,以及该建筑的工作相关信息
        private Dictionary <int, List <BuildingWorkInfo> > GetBuildingsNeedWorker(int partId, int placeId)
        {
            // requiredAttrId -> [BuildingWorkInfo, ]
            Dictionary <int, List <BuildingWorkInfo> > attrBuildings = new Dictionary <int, List <BuildingWorkInfo> >();

            var buildingsHarvestTypes = GetBuildingsHarvestTypes();

            var buildings = DateFile.instance.homeBuildingsDate[partId][placeId];

            foreach (var entry in buildings)
            {
                int   buildingIndex  = entry.Key;
                int[] building       = entry.Value;
                int   baseBuildingId = building[0];

                var  baseBuilding = DateFile.instance.basehomePlaceDate[baseBuildingId];
                bool needWorker   = int.Parse(baseBuilding[3]) == 1;
                if (needWorker)
                {
                    int requiredAttrId = int.Parse(baseBuilding[33]);

                    BuildingWorkInfo info = new BuildingWorkInfo
                    {
                        buildingIndex        = buildingIndex,
                        requiredAttrId       = requiredAttrId,
                        priority             = GetBuildingWorkingPriority(partId, placeId, buildingIndex, buildingsHarvestTypes),
                        halfWorkingAttrValue = 0,
                        fullWorkingAttrValue = 0,
                    };

                    if (requiredAttrId != 0)
                    {
                        int[] requiredAttrValues = GetRequiredAttributeValues(partId, placeId, buildingIndex);
                        info.halfWorkingAttrValue = requiredAttrValues[0];
                        info.fullWorkingAttrValue = requiredAttrValues[1];
                    }

                    if (!attrBuildings.ContainsKey(requiredAttrId))
                    {
                        attrBuildings[requiredAttrId] = new List <BuildingWorkInfo>();
                    }
                    attrBuildings[requiredAttrId].Add(info);
                }
            }

            return(attrBuildings);
        }
예제 #4
0
파일: Output.cs 프로젝트: yq0727/Taiwu_mods
        public static void LogBuildingAndWorker(BuildingWorkInfo info, int selectedWorkerId,
                                                int partId, int placeId, Dictionary <int, Dictionary <int, int> > workerAttrs)
        {
            var building       = DateFile.instance.homeBuildingsDate[partId][placeId][info.buildingIndex];
            int baseBuildingId = building[0];
            int buildingLevel  = building[1];

            var    baseBuilding = DateFile.instance.basehomePlaceDate[baseBuildingId];
            string buildingName = baseBuilding[0];

            string attrName = Output.GetRequiredAttrName(info.requiredAttrId);

            string logText = $"{info.priority}\t" +
                             $"{buildingName} ({buildingLevel}): " +
                             $"{attrName} [{info.halfWorkingAttrValue}, {info.fullWorkingAttrValue}] - ";

            if (selectedWorkerId >= 0)
            {
                string workerName = DateFile.instance.GetActorName(selectedWorkerId);
                int    attrValue  = info.requiredAttrId != 0 ? workerAttrs[selectedWorkerId][info.requiredAttrId] : -1;
                int    mood       = int.Parse(DateFile.instance.GetActorDate(selectedWorkerId, 4, addValue: false));
                int    favor      = DateFile.instance.GetActorFavor(false, DateFile.instance.MianActorID(), selectedWorkerId, getLevel: true);

                // 这里的工作效率并不一定等于最终工作效率,因为可能还有厢房未分配
                int workEffectiveness = info.requiredAttrId != 0 ?
                                        Original.GetWorkEffectiveness(partId, placeId, info.buildingIndex, selectedWorkerId) : -1;
                string workEffectivenessStr = workEffectiveness >= 0 ? workEffectiveness / 2 + "%" : "N/A";

                Main.Logger.Log(logText +
                                $"{workerName}, 资质: {attrValue}, 心情: {mood}, 好感: {favor}, 工作效率: {workEffectivenessStr}");
            }
            else
            {
                Main.Logger.Log(logText + "<无合适人选>");
            }
        }