Exemple #1
0
        public bool resolve()
        {
            FactionFC factionfc = Find.World.GetComponent <FactionFC>();

            if (PaymentUtil.getSilver() >= -1 * taxes.silverAmount || taxes.silverAmount >= 0)
            { //if have enough silver on the current map to pay  & map belongs to player
                FCEventMaker.createTaxEvent(this);
                if (taxes.researchCompleted != 0)
                {
                    factionfc.researchPointPool += taxes.researchCompleted;
                    Messages.Message("PointsAddedToResearchPool".Translate(taxes.researchCompleted), MessageTypeDefOf.PositiveEvent);
                }

                if (taxes.electricityAllotted != 0)
                {
                    factionfc.powerPool += taxes.electricityAllotted;
                }

                return(true);
            }

            string messageString = "NotEnoughSilverForBill".Translate() + " " + settlement.name + ". " + "ConfiscatedTithes".Translate() + "." + " " + "UnpaidTitheEffect".Translate();

            settlement.GainUnrestWithReason(new Message(messageString, MessageTypeDefOf.NegativeEvent), 10d);
            settlement.GainHappiness(-10d);
            factionfc.Bills.Remove(this);
            return(false);
        }
Exemple #2
0
        public bool attemptResolve()
        {
            FactionFC factionfc = Find.World.GetComponent <FactionFC>();

            if (PaymentUtil.getSilver() >= -1 * this.taxes.silverAmount || this.taxes.silverAmount >= 0)
            { //if have enough silver on the current map to pay  & map belongs to player
                FCEventMaker.createTaxEvent(this);
                if (this.taxes.researchCompleted != 0)
                {
                    factionfc.researchPointPool += this.taxes.researchCompleted;
                    Messages.Message(TranslatorFormattedStringExtensions.Translate("PointsAddedToResearchPool", this.taxes.researchCompleted), MessageTypeDefOf.PositiveEvent);
                }

                if (this.taxes.electricityAllotted != 0)
                {
                    factionfc.powerPool += this.taxes.electricityAllotted;
                }

                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #3
0
        public bool resolve()
        {
            FactionFC factionfc = Find.World.GetComponent <FactionFC>();

            if (PaymentUtil.getSilver() >= -1 * taxes.silverAmount || taxes.silverAmount >= 0)
            { //if have enough silver on the current map to pay  & map belongs to player
                FCEventMaker.createTaxEvent(this);
                if (taxes.researchCompleted != 0)
                {
                    factionfc.researchPointPool += taxes.researchCompleted;
                    Messages.Message("PointsAddedToResearchPool".Translate(taxes.researchCompleted), MessageTypeDefOf.PositiveEvent);
                }

                if (taxes.electricityAllotted != 0)
                {
                    factionfc.powerPool += taxes.electricityAllotted;
                }

                return(true);
            }

            Messages.Message("NotEnoughSilverForBill".Translate() + " " + settlement.name + ". " + "ConfiscatedTithes".Translate() + "." + " " + "UnpaidTitheEffect".Translate(), MessageTypeDefOf.NegativeEvent);
            settlement.unrest    += 10 * TraitUtilsFC.cycleTraits(new double(), "unrestGainedMultiplier", settlement.traits, "multiply") * TraitUtilsFC.cycleTraits(new double(), "unrestGainedMultiplier", factionfc.traits, "multiply");
            settlement.happiness -= 10 * TraitUtilsFC.cycleTraits(new double(), "happinessLostMultiplier", settlement.traits, "multiply") * TraitUtilsFC.cycleTraits(new double(), "happinessLostMultiplier", factionfc.traits, "multiply");
            factionfc.Bills.Remove(this);
            return(false);
        }
Exemple #4
0
        public override void DoWindowContents(Rect inRect)
        {
            //grab before anchor/font
            GameFont   fontBefore   = Text.Font;
            TextAnchor anchorBefore = Text.Anchor;

            //top label
            Text.Font   = GameFont.Small;
            Text.Anchor = TextAnchor.MiddleCenter;

            //build outline
            Widgets.DrawMenuSection(billsBox);


            //loop through each bill
            //GoTo Here if change
Reset:

            int i = 0;

            Text.Anchor = TextAnchor.MiddleCenter;
            foreach (BillFC bill in bills)
            {
                i++;
                Rect settlement = new Rect();
                Rect date       = new Rect();
                Rect amount     = new Rect();
                Rect tithe      = new Rect();
                Rect resolve    = new Rect();
                Rect highlight  = new Rect();


                settlement = billNameBase;
                date       = billDescBase;
                amount     = billLocationBase;
                tithe      = billTimeRemaining;
                resolve    = billResolveBase;

                settlement.y = scroll + billHeight * i;
                date.y       = scroll + billHeight * i;
                amount.y     = scroll + billHeight * i;
                tithe.y      = scroll + billHeight * i;
                resolve.y    = scroll + billHeight * i;

                highlight = new Rect(settlement.x, settlement.y, resolve.x + resolve.width, billHeight);



                if (i % 2 == 0)
                {
                    Widgets.DrawHighlight(highlight);
                }
                String settlementName;
                if (bill.settlement != null)
                {
                    settlementName = bill.settlement.name;
                }
                else
                {
                    settlementName = "Null";
                }
                if (Widgets.ButtonText(settlement, settlementName))
                {
                    if (bill.settlement != null)
                    {
                        Find.WindowStack.Add(new settlementWindowFC(bill.settlement));
                    }
                }
                //
                Text.Anchor = TextAnchor.MiddleCenter;
                Widgets.Label(date, GenDate.ToStringTicksToDays(bill.dueTick - Find.TickManager.TicksGame));

                //
                Widgets.Label(amount, bill.taxes.silverAmount.ToString());
                //
                bool bul;
                bul = (bill.taxes.itemTithes.Count > 0);
                Widgets.Checkbox(new Vector2(tithe.x + tithe.width / 2 - 12, tithe.y), ref bul);

                if (Widgets.ButtonText(resolve, "ResolveBill".Translate()))
                {
                    if (PaymentUtil.getSilver() >= -1 * (bill.taxes.silverAmount) || bill.taxes.silverAmount >= 0)
                    { //if have enough silver on the current map to pay  & map belongs to player
                        FCEventMaker.createTaxEvent(bill);
                        if (bill.taxes.researchCompleted != 0)
                        {
                            faction.researchPointPool += bill.taxes.researchCompleted;
                            Messages.Message(TranslatorFormattedStringExtensions.Translate("PointsAddedToResearchPool", bill.taxes.researchCompleted), MessageTypeDefOf.PositiveEvent);
                        }
                        if (bill.taxes.electricityAllotted != 0)
                        {
                            faction.powerPool += bill.taxes.electricityAllotted;
                        }
                        goto Reset;
                    }
                    else
                    {
                        Messages.Message("NotEnoughSilverOnMapToPayBill".Translate() + "!", MessageTypeDefOf.RejectInput);
                    }
                }
            }



            //Top label
            Widgets.ButtonTextSubtle(billNameBase, "Settlement".Translate());
            Widgets.ButtonTextSubtle(billDescBase, "DueFC".Translate());
            Widgets.ButtonTextSubtle(billLocationBase, "Amount".Translate());
            Widgets.ButtonTextSubtle(billTimeRemaining, "HasTithe".Translate());
            if (Widgets.ButtonTextSubtle(billResolveBase, "Auto-Resolve"))
            {
                List <FloatMenuOption> list = new List <FloatMenuOption>();

                FloatMenuOption option = new FloatMenuOption("Auto-Resolving : " + faction.autoResolveBills, delegate
                {
                    faction.autoResolveBills = !faction.autoResolveBills;
                    switch (faction.autoResolveBills)
                    {
                    case true:
                        Messages.Message("Bills are now autoresolving!", MessageTypeDefOf.NeutralEvent);
                        PaymentUtil.autoresolveBills(bills);
                        break;

                    case false:
                        Messages.Message("Bills are now not autoresolving.", MessageTypeDefOf.NeutralEvent);
                        break;
                    }
                });
                list.Add(option);


                FloatMenu menu = new FloatMenu(list);
                Find.WindowStack.Add(menu);
            }
            Widgets.Checkbox(new Vector2(billResolveBase.x + billResolveBase.width - 30, billResolveBase.y + 3), ref faction.autoResolveBills, 24, true);

            //Menu Outline
            Widgets.DrawBox(billsBox);


            //reset anchor/font
            Text.Font   = fontBefore;
            Text.Anchor = anchorBefore;


            if (Event.current.type == EventType.ScrollWheel)
            {
                scrollWindow(Event.current.delta.y);
            }
        }