Example #1
0
        private static void SellItem()
        {
            Main.instance.player.miscInventory.Remove(examinedStack);
            GameObject go;

            relicsList.TryGetValue(examinedStack, out go);
            Main.Destroy(go);
            BigRational val = ItemStack.GetRelicValue(examinedStack);

            Main.instance.player.AddMoney(BigRational.ToBigInt(val));
            examinedStack.onSoldByPlayer();
            examinedStack = null;
            relicInfo.parent.gameObject.SetActive(false);
            setupUI();
        }
Example #2
0
        public void onSuccessfulQuest(Quest theQuest)
        {
            ObstacleType goal = theQuest.getGoal();

            if (goal == ChallengeTypes.Goals.DeepGoalSpecial.CAPITALISM)
            {
                ItemStack newRelic = theQuest.determineRelic().clone();
                if (newRelic != null)
                {
                    newRelic.antiquity = Math.Max(newRelic.antiquity, StatisticsTracker.guildmastersElected.value / 5);
                    newRelic           = QuestManager.makeRelic(newRelic, goal, "Capitalism!");
                    UpgradeValueWrapper wrap;
                    Main.instance.player.upgrades.TryGetValue(UpgradeType.QUEST_GOODS_VALUE, out wrap);
                    float      v   = Mathf.Max(((UpgradeFloatValue)wrap).value, 0.1f);
                    BigInteger val = BigRational.ToBigInt(ItemStack.GetRelicValue(newRelic) / 2 * v);
                    Main.instance.player.AddMoney(val);
                }
            }
        }
Example #3
0
        public static void OneTimeSetup()
        {
            Transform trans = GuiManager.instance.researchArea.transform;

            relicList = trans.Find("RelicsList").GetChild(0).GetChild(0);
            relicList.transform.hierarchyCapacity = 200 * 20;
            progressBarMat = trans.Find("Research").Find("RelicProgress").GetComponent <Image>().material;
            trans.Find("Research").Find("Barbg").GetComponent <Button>().onClick.AddListener(delegate { IncrementResearch(); });
            timeLeftTxt   = trans.Find("Research").Find("TimeLeft").GetComponent <Text>();
            relicsLeftTxt = trans.Find("Research").Find("NumUnidentified").GetComponent <Text>();

            relicInfo = trans.Find("RelicInfoOpen").GetChild(0);
            relicInfo.Find("CloseBtn").GetComponent <Button>().onClick.AddListener(delegate { CloseInfo(); });
            Button btn = relicInfo.Find("SellBtn").GetComponent <Button>();

            btn.onClick.AddListener(delegate { SellItem(); });
            btn.AddHover(delegate(Vector3 p) {
                if (examinedStack != null)
                {
                    BigInteger val = BigRational.ToBigInt(ItemStack.GetRelicValue(examinedStack));
                    GuiManager.ShowTooltip(btn.transform.position + Vector3.up * 30, "Sell for $" + Main.AsCurrency(val));
                }
            }, false);
            Button btn2 = relicInfo.Find("DiscardBtn").GetComponent <Button>();

            btn2.onClick.AddListener(delegate { DiscardItem(); });
            btn2.AddHover(delegate(Vector3 p) {
                if (examinedStack != null)
                {
                    GuiManager.ShowTooltip(btn2.transform.position + Vector3.up * 30, "Discard this artifact back to the unidentified pile.", 3);
                }
            }, false);
            moneyDisp     = GuiManager.instance.researchHeader.transform.Find("MoneyArea").GetChild(0).GetComponent <Text>();
            relicInfoText = relicInfo.Find("Info Scroll View").GetChild(0).GetChild(0).GetChild(0).GetComponent <Text>();
            for (int r = 1; r <= 20; r++)
            {
                int   rr  = r;
                Image igm = relicInfo.transform.Find("Req" + r).GetComponent <Image>();
                igm.AddHover(delegate(Vector3 p) {
                    GuiManager.ShowTooltip(igm.transform.position + Vector3.up * 20, displayReqDetails(rr));
                }, false);
            }
        }