Beispiel #1
0
        public bool TryCollect(out ItemStage givenStage)
        {
            if (!TryGetNextStage(out givenStage))
            {
                return(false);
            }

            // Execute stage actions
            foreach (PlayerField <bool> pf in givenStage.BoolActions)
            {
                pf.ApplyValue();
            }

            foreach (PlayerField <int> pf in givenStage.IntActions)
            {
                pf.ApplyValue();
            }

            // Increment obtained counter
            if (!RandomizerMod.Instance.ItemObtainedCounts.TryGetValue(Id, out int itemCount))
            {
                itemCount = 0;
            }

            RandomizerMod.Instance.ItemObtainedCounts[Id] = itemCount + 1;
        public static void CheckNotches(ItemStage stage)
        {
            PlayerData pd = PlayerData.instance;

            pd.CountCharms();
            int charms  = pd.charmsOwned;
            int notches = pd.charmSlots;

            if (!pd.salubraNotch1 && charms >= 5)
            {
                pd.salubraNotch1 = true;
                notches++;
            }

            if (!pd.salubraNotch2 && charms >= 10)
            {
                pd.salubraNotch2 = true;
                notches++;
            }

            if (!pd.salubraNotch3 && charms >= 18)
            {
                pd.salubraNotch3 = true;
                notches++;
            }

            if (!pd.salubraNotch4 && charms >= 25)
            {
                pd.salubraNotch4 = true;
                notches++;
            }

            pd.SetInt(nameof(PlayerData.charmSlots), notches);
        }
Beispiel #3
0
        public bool TryGetNextStage(out ItemStage stage)
        {
            if (!RandomizerMod.Instance.ItemObtainedCounts.TryGetValue(Id, out int itemCount))
            {
                itemCount = 0;
            }

            int stageIdx = 0;
            int count    = 0;

            for (int i = 0; i < itemCount; i++)
            {
                count++;
                if (count >= Stages[stageIdx].Repeat)
                {
                    stageIdx++;
                    if (stageIdx >= Stages.Length)
                    {
                        stage = null;
                        return(false);
                    }
                }
            }

            stage = Stages[stageIdx];
            return(true);
        }
Beispiel #4
0
 private void OnItemEffect(ItemType itemType, ItemStage itemStage)
 {
     switch (itemType)
     {
     case ItemType.BubbleTrap:
         OnBubbleTrap(itemStage);
         break;
     }
 }
        protected string GcxxValidation(string itemCode, ItemStage stage, int xh)
        {
            Xm_Gcxx       gcInfo = new BusiItemManage().GetItemGcxx(itemCode, stage, xh.ToString());
            StringBuilder sb     = new StringBuilder();

            if (gcInfo == null)
            {
                sb.AppendLine(string.Format(NotNullFormat, "项目规模"));
                sb.AppendLine(string.Format(NotNullFormat, "成效信息"));
                sb.AppendLine(string.Format(NotNullFormat, "工程量信息"));
            }
            else
            {
                bool gmFlag  = true;
                bool cxFlag  = true;
                bool gclFlag = true;
                foreach (PropertyInfo pi in gcInfo.GetType().GetProperties())
                {
                    if (pi.Name.ToLower().StartsWith("gm"))
                    {
                        if (!string.IsNullOrEmpty(pi.GetValue(gcInfo, null).ToString()))
                        {
                            gmFlag = false;
                        }
                    }
                    if (pi.Name.ToLower().StartsWith("cx"))
                    {
                        if (!string.IsNullOrEmpty(pi.GetValue(gcInfo, null).ToString()))
                        {
                            cxFlag = false;
                        }
                    }
                    if (pi.Name.ToLower().StartsWith("gc"))
                    {
                        if (!string.IsNullOrEmpty(pi.GetValue(gcInfo, null).ToString()))
                        {
                            gclFlag = false;
                        }
                    }
                }
                if (gmFlag)
                {
                    sb.AppendLine(string.Format(NotNullFormat, "项目规模"));
                }
                if (cxFlag)
                {
                    sb.AppendLine(string.Format(NotNullFormat, "成效信息"));
                }
                if (gclFlag)
                {
                    sb.AppendLine(string.Format(NotNullFormat, "工程量信息"));
                }
            }
            return(sb.ToString());
        }
Beispiel #6
0
        private void OnBubbleTrap(ItemStage itemStage)
        {
            switch (itemStage)
            {
            case ItemStage.Start:
                gravity = 0f;
                playerStateMachine.ChangeState(PlayerStateType.Floating);
                break;

            case ItemStage.End:
                gravity = 1f;
                playerStateMachine.ChangeState(PlayerStateType.Fall);
                break;
            }
        }
        public static void CheckVesselFragments(ItemStage stage)
        {
            if (PlayerData.instance.vesselFragments < 3 || PlayerData.instance.MPReserveMax >= PlayerData.instance.MPReserveCap)
            {
                return;
            }

            HeroController.instance.AddToMaxMPReserve(33);
            PlayMakerFSM.BroadcastEvent("NEW SOUL ORB");
            if (PlayerData.instance.MPReserveMax < PlayerData.instance.MPReserveCap)
            {
                PlayerData.instance.vesselFragments -= 3;
                CheckVesselFragments(stage);
            }
        }
        public static void CheckMaskShards(ItemStage stage)
        {
            if (PlayerData.instance.heartPieces < 4 || PlayerData.instance.maxHealthBase >= PlayerData.instance.maxHealthCap)
            {
                return;
            }

            HeroController.instance.AddToMaxHealth(1);
            PlayMakerFSM.BroadcastEvent("MAX HP UP");
            PlayMakerFSM.BroadcastEvent("HERO HEALED FULL");
            if (PlayerData.instance.maxHealthBase < PlayerData.instance.maxHealthCap)
            {
                PlayerData.instance.heartPieces -= 4;
                CheckMaskShards(stage);
            }
        }
 public static void UpdateGeoCounter(ItemStage stage)
 => HeroController.instance.geoCounter.AddGeo(stage.IntActions[0].Value);
 protected string GcxxValidation(string itemCode, ItemStage stage, int xh)
 {
     Xm_Gcxx gcInfo = new BusiItemManage().GetItemGcxx(itemCode, stage, xh.ToString());
     StringBuilder sb = new StringBuilder();
     if (gcInfo == null)
     {
         sb.AppendLine(string.Format(NotNullFormat, "项目规模"));
         sb.AppendLine(string.Format(NotNullFormat, "成效信息"));
         sb.AppendLine(string.Format(NotNullFormat, "工程量信息"));
     }
     else
     {
         bool gmFlag = true;
         bool cxFlag = true;
         bool gclFlag = true;
         foreach (PropertyInfo pi in gcInfo.GetType().GetProperties())
         {
             if (pi.Name.ToLower().StartsWith("gm"))
             {
                 if (!string.IsNullOrEmpty(pi.GetValue(gcInfo, null).ToString()))
                 {
                     gmFlag = false;
                 }
             }
             if (pi.Name.ToLower().StartsWith("cx"))
             {
                 if (!string.IsNullOrEmpty(pi.GetValue(gcInfo, null).ToString()))
                 {
                     cxFlag = false;
                 }
             }
             if (pi.Name.ToLower().StartsWith("gc"))
             {
                 if (!string.IsNullOrEmpty(pi.GetValue(gcInfo, null).ToString()))
                 {
                     gclFlag = false;
                 }
             }
         }
         if (gmFlag) sb.AppendLine(string.Format(NotNullFormat, "项目规模"));
         if (cxFlag) sb.AppendLine(string.Format(NotNullFormat, "成效信息"));
         if (gclFlag) sb.AppendLine(string.Format(NotNullFormat, "工程量信息"));
     }
     return sb.ToString();
 }
 public static void CheckNailArts(ItemStage stage)
 => PlayerData.instance.hasAllNailArts = PlayerData.instance.hasCyclone &&
                                         PlayerData.instance.hasUpwardSlash && PlayerData.instance.hasDashSlash;
 public static void MakeGrubNoise(ItemStage stage)
 {
 }
Beispiel #13
0
        private static string GetDialogueString(Location loc, Item item)
        {
            string itemName = Lang.Get(item.Stages[0].Popup.Name, "UI");

            if (item.Stages.Length > 1)
            {
                itemName = "Additive " + itemName;
            }

            List <string> reqText = new List <string>();

            foreach (PlayerField <bool> pf in loc.RequiredBools)
            {
                string t = pf.Value
                    ? "Have "
                    : "Don't have ";

                ItemStage reqItem = RandoResources.Items
                                    .SelectMany(i => i.Stages)
                                    .FirstOrDefault(s => s.BoolActions.Any(b => b.FieldName == pf.FieldName && b.Value == pf.Value));

                t += reqItem == null
                    ? pf.FieldName
                    : Lang.Get(reqItem.Popup.Name, "UI");

                reqText.Add(t);
            }

            foreach (PlayerField <int> pf in loc.RequiredInts)
            {
                string t = pf.Value.ToString();
                switch (pf.FieldName)
                {
                case nameof(PlayerData.geo):
                    t += " Geo";
                    break;

                case nameof(PlayerData.dreamOrbs):
                    t += " Essence";
                    break;

                case nameof(PlayerData.grubsCollected):
                    t += " Grubs";
                    break;

                case nameof(PlayerData.simpleKeys):
                    if (pf.Value == 1)
                    {
                        t = "Simple Key";
                    }
                    else
                    {
                        t += " Simple Keys";
                    }

                    break;

                default:
                    ItemStage reqItem = RandoResources.Items
                                        .SelectMany(i => i.Stages)
                                        .FirstOrDefault(s => s.IntActions.Any(i => i.FieldName == pf.FieldName && i.Value == pf.Value));

                    t = "Have " + (reqItem == null
                            ? pf.Value + " " + pf.FieldName
                            : Lang.Get(reqItem.Popup.Name, "UI"));

                    break;
                }

                reqText.Add(t);
            }

            MethodInfo[] reqCalls = loc.RequiredCallbacks
                                    .Select(s => Type.GetType("Randomizer." + s.Substring(0, s.IndexOf('.'))).GetMethod(s.Substring(s.IndexOf('.') + 1)))
                                    .ToArray();

            foreach (MethodInfo call in reqCalls)
            {
                reqText.Add(call
                            .GetCustomAttributes(typeof(NameAttribute), false)
                            .Cast <NameAttribute>()
                            .FirstOrDefault()?.Name
                            ?? call.Name);
            }

            return(string.Join(", ", reqText.ToArray()) + ": " + itemName);
        }
Beispiel #14
0
 private string changeName(ItemStage stage)
 {
     switch (stage)
     {
         case ItemStage.KeYan:
             return "lxdkjh";
         case ItemStage.ShiShi:
             return "ssdkjh";
         case ItemStage.YanShou:
             return "ysdkjh";
         default:
             return string.Empty;
     }
 }
Beispiel #15
0
        /// <summary>
        /// 插入阶段数据的XML结点
        /// </summary>
        /// <param name="fileUrl"></param>
        /// <param name="rootNode"></param>
        /// <param name="stage"></param>
        /// <param name="dataList"></param>
        private void InsertStageNode(string fileUrl, string rootNode, ItemStage stage, List<Xm_Dkxx> dataList)
        {
            var stageList = from item in dataList where item.Stage == stage select item;
            if (stageList.Count<Xm_Dkxx>() == 0) return;

            string stageName = this.changeName(stage);

            Dictionary<string, string> paraNode = new Dictionary<string, string>();
            paraNode.Add("zbx", dataList[0].Zbx);
            paraNode.Add("jdfd", dataList[0].Jdfd);
            paraNode.Add("tylx", dataList[0].Tylx);
            paraNode.Add("jldw", dataList[0].Jldw);
            paraNode.Add("dh", dataList[0].Dh);
            paraNode.Add("jd", dataList[0].Jd);
            paraNode.Add("zhzbcs", dataList[0].Zhcs);

            XmlHelper.InsertNode(fileUrl, rootNode, stageName, null, paraNode);
            int i = 1;
            foreach (Xm_Dkxx DK in stageList)
            {
                Dictionary<string, string> dkAttr = new Dictionary<string, string>();
                dkAttr.Add("id", i.ToString());
                Dictionary<string, string> dkSubNode = new Dictionary<string, string>();
                dkSubNode.Add("dkbh", DK.Dkbh);
                dkSubNode.Add("dkmc", DK.Dkmc);
                dkSubNode.Add("dkmj", DK.Jsdkmj);
                dkSubNode.Add("dkds", DK.Jzds);
                dkSubNode.Add("dktf", DK.Tfh);

                XmlHelper.InsertNode(fileUrl, string.Format("/{0}/{1}", rootNode, stageName), "dk", dkAttr, dkSubNode);

                ////查询地块中的包含区域的个数
                var QhList = (from item in DK.JzdList select item.Dkqh).Distinct();
                foreach (string qh in QhList)
                {
                    var JzdList = from item in DK.JzdList where item.Dkqh == qh select item;
                    Dictionary<string, string> JzqyNode = new Dictionary<string, string>();
                    JzqyNode.Add("qybh", qh);
                    Dictionary<string, string> JzqyAttributes = new Dictionary<string, string>();
                    JzqyAttributes.Add("id", qh);
                    XmlHelper.InsertNode(fileUrl, string.Format("/{0}/{1}/dk[@id='{2}']", rootNode, stageName, i.ToString()), "jzqy", JzqyAttributes, JzqyNode);
                    foreach (Xm_Jzd jzd in JzdList)
                    {
                        Dictionary<string, string> JzdNode = new Dictionary<string, string>();
                        JzdNode.Add("jzdbh", jzd.JzdBh);
                        JzdNode.Add("jzdjd", jzd.X);
                        JzdNode.Add("jzdwd", jzd.Y);
                        XmlHelper.InsertNode(fileUrl, string.Format("/{0}/{1}/dk[@id='{2}']/jzqy[@id='{3}']", rootNode, stageName, i.ToString(), qh), "jzd", null, JzdNode);
                    }
                }
                i++;
            }
        }
Beispiel #16
0
        /// <summary>
        /// 保存项目地块信息
        /// </summary>
        /// <param name="dataList"></param>
        /// <returns></returns>
        public bool SaveDkInfo(string gisFold, List<Xm_Dkxx> dataList, ItemStage itemStage, string Xh)
        {
            if (!CommonManage.GisEnable)
            {
                return true;
            }
            string tmpSql = string.Empty;
            tmpSql = "delete from xm_dkxx where itemCode = '{0}' and stage = '{1}' and xh = '{2}'";
            tmpSql = string.Format(tmpSql, dataList[0].ItemCode, ((int)itemStage).ToString(), Xh);
            if (!OracleHelper.ExecuteCommand(tmpSql)) return false;

            string dkId = string.Empty;
            foreach (Xm_Dkxx dkInfo in dataList)
            {
                ArrayList strSql = new ArrayList();

                tmpSql = "select '{0}' || lpad(nvl(max(replace(dkid, '{0}', '')), 0) + 1, 4, '0') from xm_dkxx where itemcode = '{0}'";
                tmpSql = string.Format(tmpSql, dkInfo.ItemCode);
                dkId = OracleHelper.ExecuteDataTable(tmpSql).Rows[0][0].ToString();

                tmpSql = "insert into xm_dkxx (dkid, itemcode, stage, xh, dkbh, dkmc, tfh, scdkmj, jsdkmj, txlx, qsxz, jzds, thjb, dlbm, dlmc, ysid,zbx,jdfd,tylx,jldw,dh,jd,zhcs)"
                + "Values ('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','{9}','{10}','{11}','{12}','{13}','{14}','{15}','{16}','{17}','{18}','{19}','{20}','{21}','{22}')";
                tmpSql = string.Format(tmpSql, dkId, dkInfo.ItemCode, ((int)itemStage).ToString(), Xh,
                    dkInfo.Dkbh, dkInfo.Dkmc, dkInfo.Tfh, dkInfo.Scdkmj, dkInfo.Jsdkmj, dkInfo.Txlx,
                    dkInfo.Qsxz, dkInfo.Jzds, dkInfo.Thjb, dkInfo.Dlbm, dkInfo.Dlmc, dkInfo.Ysid, dkInfo.Zbx, dkInfo.Jdfd, dkInfo.Tylx,
                    dkInfo.Jldw, dkInfo.Dh, dkInfo.Jd, dkInfo.Zhcs);
                strSql.Add(tmpSql);
                int i = 1;
                foreach (Xm_Jzd jzdInfo in dkInfo.JzdList)
                {
                    tmpSql = "insert into xm_dkjzd (dkid, xh, jzdbh, dkqh, x, y) values ('{0}','{1}','{2}','{3}','{4}','{5}')";
                    tmpSql = string.Format(tmpSql, dkId, i.ToString(), jzdInfo.JzdBh, jzdInfo.Dkqh, jzdInfo.X, jzdInfo.Y);
                    strSql.Add(tmpSql);
                    i++;
                }
                if (!OracleHelper.ExecuteCommand(strSql)) return false;
            }
            try
            {
                List<Xm_Dkxx> dkAllList = this.getDkInfoByItemCode(dataList[0].ItemCode);
                this.CreatXmlData(gisFold, dataList[0].ItemCode, dkAllList);
                return true;
            }
            catch
            {
                return false;
            }
        }
Beispiel #17
0
 /// <summary>
 /// 获取某个阶段的工程信息
 /// </summary>
 /// <param name="itemCode"></param>
 /// <param name="stage"></param>
 /// <param name="xh"></param>
 /// <returns></returns>
 public Xm_Gcxx GetItemGcxx(string itemCode, ItemStage stage, string xh)
 {
     Xm_Gcxx gcInfo = null;
     string strSql = "select * from xm_gcxx where itemCode = '{0}' and stage = '{1}' and xh = '{2}'";
     strSql = string.Format(strSql, itemCode, (int)stage, xh);
     DataTable dt = OracleHelper.ExecuteDataTable(strSql);
     if (dt.Rows.Count == 1)
     {
         gcInfo = (Xm_Gcxx)new DataTableOperation().ConvertFromDataRowToEntity(dt.Rows[0], typeof(Xm_Gcxx));
     }
     return gcInfo;
 }