Elin Decompiled Documentation EA 23.335 Nightly
Loading...
Searching...
No Matches
InvOwnerDeliver.cs
Go to the documentation of this file.
2{
3 public enum Mode
4 {
6 Tax,
7 Bank,
8 Crop
9 }
10
11 public Mode mode;
12
13 public override bool ShowButtonDeliver => mode == Mode.Crop;
14
15 public override bool SingleTarget => mode == Mode.Tax;
16
17 public override string langTransfer
18 {
19 get
20 {
21 if (mode != Mode.Bank)
22 {
23 return "invDeliver";
24 }
25 return "invBank";
26 }
27 }
28
29 public override ProcessType processType => ProcessType.Consume;
30
31 public InvOwnerDeliver(Card owner = null, Card container = null, CurrencyType _currency = CurrencyType.Money)
32 : base(owner, container, _currency)
33 {
34 }
35
36 public override bool ShouldShowGuide(Thing t)
37 {
38 switch (mode)
39 {
40 case Mode.Tax:
41 return t.c_bill != 0;
42 case Mode.Bank:
43 return t.id == "money";
44 case Mode.Crop:
45 if (!t.GetBool(115))
46 {
47 return false;
48 }
49 if (!(t.category.id == "vegi") && !(t.category.id == "fruit"))
50 {
51 return t.category.id == "mushroom";
52 }
53 return true;
54 default:
55 return false;
56 }
57 }
58
59 public static void PayBill(Thing t, bool fromBank = false)
60 {
61 bool flag = t.id == "bill_tax";
62 bool flag2 = t.id == "bill_debt";
63 QuestDebt questDebt = EClass.game.quests.Get<QuestDebt>();
64 bool flag3 = flag2 && questDebt != null && !questDebt.paid && questDebt.IsValidBill(t);
65 if ((flag && EClass.player.taxBills <= 0) || (flag2 && !flag3))
66 {
67 SE.Beep();
68 Msg.Say("badidea");
69 EClass.pc.Pick(t, msg: false);
70 return;
71 }
72 if (fromBank)
73 {
75 }
76 else if (!EClass.pc.TryPay(t.c_bill))
77 {
78 return;
79 }
80 if (flag2)
81 {
82 EClass.player.debt -= t.c_bill;
83 if (EClass.player.debt < 0)
84 {
85 EClass.player.debt = 0;
86 }
87 questDebt.paid = true;
88 questDebt.UpdateJournal();
89 }
90 else if (flag)
91 {
93 {
94 EClass.player.stats.taxBillsPaid = 2147483647L;
95 }
96 EClass.player.stats.taxBillsPaid += t.c_bill;
98 if (EClass.player.taxBills < 0)
99 {
100 EClass.player.taxBills = 0;
101 }
102 int num = t.GetInt(35) / 1000;
103 if (num > 0)
104 {
105 Thing thing = ThingGen.Create("money2", "copper").SetNum(num);
106 Thing p = ThingGen.CreateParcel("parcel_mysiliaGift", thing);
107 Msg.Say("getSalary", thing);
109 }
110 }
111 else
112 {
113 EClass.player.unpaidBill -= t.c_bill;
114 }
115 Msg.Say("payBill", t);
116 t.Destroy();
117 }
118
119 public override void _OnProcess(Thing t)
120 {
121 switch (mode)
122 {
123 case Mode.Tax:
124 PayBill(t);
125 break;
126 case Mode.Bank:
127 SE.Pay();
128 Msg.Say("depositMoney", t, owner);
129 owner.AddThing(t);
130 break;
131 case Mode.Crop:
132 {
133 Msg.Say("farm_chest", t, Lang._weight(t.SelfWeight * t.Num));
134 QuestHarvest questHarvest = EClass.game.quests.Get<QuestHarvest>();
135 if (questHarvest != null)
136 {
137 questHarvest.weightDelivered += t.SelfWeight * t.Num;
138 }
139 SE.Pick();
140 t.Destroy();
141 break;
142 }
143 }
144 }
145}
CurrencyType
Definition: CurrencyType.cs:2
Thing container_deposit
Definition: CardManager.cs:58
Definition: Card.cs:11
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:3277
Thing SetNum(int a)
Definition: Card.cs:3673
void ModCurrency(int a, string id="money")
Definition: Card.cs:4139
bool TryPay(int a, string id="money")
Definition: Card.cs:4103
void Destroy()
Definition: Card.cs:5305
bool GetBool(string id)
Definition: Card.cs:2557
int c_bill
Definition: Card.cs:1321
int Num
Definition: Card.cs:161
SourceCategory.Row category
Definition: Card.cs:2101
int GetInt(string id, int? defaultInt=null)
Definition: Card.cs:2567
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:4565
Definition: EClass.cs:6
static Game game
Definition: EClass.cs:9
static World world
Definition: EClass.cs:41
static Player player
Definition: EClass.cs:13
static Chara pc
Definition: EClass.cs:15
CardManager cards
Definition: Game.cs:156
QuestManager quests
Definition: Game.cs:183
override void _OnProcess(Thing t)
override bool ShouldShowGuide(Thing t)
override string langTransfer
InvOwnerDeliver(Card owner=null, Card container=null, CurrencyType _currency=CurrencyType.Money)
override bool ShowButtonDeliver
override bool SingleTarget
static void PayBill(Thing t, bool fromBank=false)
override ProcessType processType
Card owner
Definition: InvOwner.cs:533
Definition: Lang.cs:7
static string _weight(int a, int b, bool showUnit=true, int unitSize=0)
Definition: Lang.cs:171
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
long taxBillsPaid
Definition: Player.cs:144
int debt
Definition: Player.cs:1014
Stats stats
Definition: Player.cs:1083
int taxBills
Definition: Player.cs:975
bool IsValidBill(Thing t)
Definition: QuestDebt.cs:52
Quest Get(string id)
void UpdateJournal()
Definition: Quest.cs:690
static Thing CreateParcel(string idLang=null, params Thing[] things)
Definition: ThingGen.cs:42
static Thing Create(string id, int idMat=-1, int lv=-1)
Definition: ThingGen.cs:53
Definition: Thing.cs:8
override int SelfWeight
Definition: Thing.cs:64
void SendPackage(Thing p)
Definition: World.cs:68