public Order_BodyPart_RogerEdmonson(float chance, float price, int delay, OrderBodypartGroup group)
 {
     Chance = chance;
     Price  = price;
     Delay  = delay;
     Group  = group;
 }
Exemplo n.º 2
0
        private void DrawBodyPartsOders(Rect rect)
        {
            CalculateBodyPartValues();

            Text.Anchor = TextAnchor.MiddleCenter;
            Rect buttonRect = new Rect(rect.x + 10, rect.y, rect.width - 20, 25);

            if (GUIUtils.DrawCustomButton(buttonRect, "RogerEdmonson_OrderWindow_SelectGroup".Translate($"{group}_group".Translate()), Color.white))
            {
                List <FloatMenuOption> options = new List <FloatMenuOption>();
                foreach (OrderBodypartGroup group in Enum.GetValues(typeof(OrderBodypartGroup)))
                {
                    options.Add(new FloatMenuOption($"{group}_group".Translate(), delegate {
                        this.group = group;
                    }));
                }

                Find.WindowStack.Add(new FloatMenu(options));
            }
            Text.Anchor = TextAnchor.UpperLeft;

            Rect intRect = new Rect(rect.x + 10, rect.y + 32, 250, 25);

            Widgets.Label(intRect, "RogerEdmonson_OrderWindow_Range".Translate());
            intRect.x    += 255;
            intRect.width = rect.width - 275;
            Widgets.TextFieldNumeric(intRect, ref delay, ref delayBuff, 1);

            Rect fullLabel = new Rect(rect.x + 10, rect.y + 60, rect.width - 10, 300);

            Widgets.Label(fullLabel, "RogerEdmonson_OrderWindow_Full".Translate($"{group}_desc".Translate(), totalValue, chance, prepayment));
            TooltipHandler.TipRegion(fullLabel, "RogerEdmonson_OrderWindow_Full2".Translate($"{group}_group".Translate(), baseValue, trader.GetPriceMultiplier(group), delay, trader.ArriveTime, totalValue, prepayment, chance, baseChance, trader.GetChanceMultiplier(group)));

            Text.Anchor = TextAnchor.MiddleCenter;
            if (GUIUtils.DrawCustomButton(new Rect(rect.x + 10, rect.height - 40, rect.width - 20, 30), "RogerEdmonson_OrderWindow_CreateOrder".Translate(), trader.Order == null ? Color.white : Color.gray))
            {
                if (trader.Order != null)
                {
                    Messages.Message("RogerEdmonson_OrderWindow_Only1Order".Translate(), MessageTypeDefOf.NeutralEvent, false);
                }
                else
                {
                    if (TakePrePayment(prepayment))
                    {
                        MakeBodyPartOrder(group, chance, totalValue, delay);
                    }
                }
            }
            if (trader.Order != null)
            {
                if (GUIUtils.DrawCustomButton(new Rect(rect.x + 10, rect.height, rect.width - 20, 30), "DarkNetButtons_CancelOrder".Translate(), Color.white))
                {
                    trader.DeclineOrder();
                }
            }
            Text.Anchor = TextAnchor.UpperLeft;
        }
Exemplo n.º 3
0
        private void MakeBodyPartOrder(OrderBodypartGroup group, float chance, float price, int delay)
        {
            price -= prepayment;

            Order_BodyPart_RogerEdmonson order = new Order_BodyPart_RogerEdmonson(chance / 100, price, delay, group);

            trader.Order = order;

            Find.LetterStack.ReceiveLetter("MakeBodyPartOrder_Title".Translate(), "MakeBodyPartOrder_Desc".Translate($"{group}_group".Translate(), delay), LetterDefOf.PositiveEvent);
        }
Exemplo n.º 4
0
        public float GetChanceMultiplier(OrderBodypartGroup group)
        {
            switch (group)
            {
            case OrderBodypartGroup.Natural:
            {
                return(1.0f);
            }

            case OrderBodypartGroup.Simple:
            {
                return(0.95f);
            }

            case OrderBodypartGroup.Bionic:
            {
                return(0.80f);
            }

            case OrderBodypartGroup.Archotech:
            {
                return(0.65f);
            }

            case OrderBodypartGroup.Improved:
            {
                return(0.85f);
            }

            case OrderBodypartGroup.Implant:
            {
                return(0.3f);
            }
            }

            return(1f);
        }
Exemplo n.º 5
0
        public float GetPriceMultiplier(OrderBodypartGroup group)
        {
            switch (group)
            {
            case OrderBodypartGroup.Natural:
            {
                return(1.4f);
            }

            case OrderBodypartGroup.Simple:
            {
                return(1.25f);
            }

            case OrderBodypartGroup.Bionic:
            {
                return(6f);
            }

            case OrderBodypartGroup.Archotech:
            {
                return(14f);
            }

            case OrderBodypartGroup.Improved:
            {
                return(5f);
            }

            case OrderBodypartGroup.Implant:
            {
                return(12f);
            }
            }

            return(1f);
        }