Elin Decompiled Documentation EA 23.130 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 SingleTarget => mode == Mode.Tax;
14
15 public override string langTransfer
16 {
17 get
18 {
19 if (mode != Mode.Bank)
20 {
21 return "invDeliver";
22 }
23 return "invBank";
24 }
25 }
26
27 public override ProcessType processType => ProcessType.Consume;
28
29 public InvOwnerDeliver(Card owner = null, Card container = null, CurrencyType _currency = CurrencyType.Money)
30 : base(owner, container, _currency)
31 {
32 }
33
34 public override bool ShouldShowGuide(Thing t)
35 {
36 switch (mode)
37 {
38 case Mode.Tax:
39 return t.c_bill != 0;
40 case Mode.Bank:
41 return t.id == "money";
42 case Mode.Crop:
43 if (!t.GetBool(115))
44 {
45 return false;
46 }
47 if (!(t.category.id == "vegi") && !(t.category.id == "fruit"))
48 {
49 return t.category.id == "mushroom";
50 }
51 return true;
52 default:
53 return false;
54 }
55 }
56
57 public static void PayBill(Thing t, bool fromBank = false)
58 {
59 bool flag = t.id == "bill_tax";
60 bool flag2 = t.id == "bill_debt";
61 QuestDebt questDebt = EClass.game.quests.Get<QuestDebt>();
62 bool flag3 = flag2 && questDebt != null && !questDebt.paid && questDebt.IsValidBill(t);
63 if ((flag && EClass.player.taxBills <= 0) || (flag2 && !flag3))
64 {
65 SE.Beep();
66 Msg.Say("badidea");
67 EClass.pc.Pick(t, msg: false);
68 return;
69 }
70 if (fromBank)
71 {
73 }
74 else if (!EClass.pc.TryPay(t.c_bill))
75 {
76 return;
77 }
78 if (flag2)
79 {
80 EClass.player.debt -= t.c_bill;
81 if (EClass.player.debt < 0)
82 {
83 EClass.player.debt = 0;
84 }
85 questDebt.paid = true;
86 questDebt.UpdateJournal();
87 }
88 else if (flag)
89 {
90 EClass.player.stats.taxBillsPaid += t.c_bill;
92 if (EClass.player.taxBills < 0)
93 {
94 EClass.player.taxBills = 0;
95 }
96 int num = t.GetInt(35) / 1000;
97 if (num > 0)
98 {
99 Thing thing = ThingGen.Create("money2", "copper").SetNum(num);
100 Thing p = ThingGen.CreateParcel("parcel_mysiliaGift", thing);
101 Msg.Say("getSalary", thing);
103 }
104 }
105 else
106 {
107 EClass.player.unpaidBill -= t.c_bill;
108 }
109 Msg.Say("payBill", t);
110 t.Destroy();
111 }
112
113 public override void _OnProcess(Thing t)
114 {
115 switch (mode)
116 {
117 case Mode.Tax:
118 PayBill(t);
119 break;
120 case Mode.Bank:
121 SE.Pay();
122 Msg.Say("depositMoney", t, owner);
123 owner.AddThing(t);
124 break;
125 case Mode.Crop:
126 {
127 Msg.Say("farm_chest", t, Lang._weight(t.SelfWeight * t.Num));
128 QuestHarvest questHarvest = EClass.game.quests.Get<QuestHarvest>();
129 if (questHarvest != null)
130 {
131 questHarvest.weightDelivered += t.SelfWeight * t.Num;
132 }
133 SE.Pick();
134 t.Destroy();
135 break;
136 }
137 }
138 }
139}
CurrencyType
Definition: CurrencyType.cs:2
int GetInt(int id, int? defaultInt=null)
Definition: BaseCard.cs:25
bool GetBool(int id)
Definition: BaseCard.cs:15
Thing container_deposit
Definition: CardManager.cs:58
Definition: Card.cs:11
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:2950
Thing SetNum(int a)
Definition: Card.cs:3286
void ModCurrency(int a, string id="money")
Definition: Card.cs:3708
bool TryPay(int a, string id="money")
Definition: Card.cs:3672
void Destroy()
Definition: Card.cs:4680
int c_bill
Definition: Card.cs:1241
int Num
Definition: Card.cs:154
SourceCategory.Row category
Definition: Card.cs:1949
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:3940
Definition: EClass.cs:5
static Game game
Definition: EClass.cs:8
static World world
Definition: EClass.cs:40
static Player player
Definition: EClass.cs:12
static Chara pc
Definition: EClass.cs:14
CardManager cards
Definition: Game.cs:155
QuestManager quests
Definition: Game.cs:179
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 SingleTarget
static void PayBill(Thing t, bool fromBank=false)
override ProcessType processType
Card owner
Definition: InvOwner.cs:538
Definition: Lang.cs:6
static string _weight(int a, int b, bool showUnit=true, int unitSize=0)
Definition: Lang.cs:172
Definition: Msg.cs:5
static string Say(string idLang, string ref1, string ref2=null, string ref3=null, string ref4=null)
Definition: Msg.cs:58
int debt
Definition: Player.cs:766
int taxBills
Definition: Player.cs:727
bool IsValidBill(Thing t)
Definition: QuestDebt.cs:52
Quest Get(string id)
void UpdateJournal()
Definition: Quest.cs:685
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:62
void SendPackage(Thing p)
Definition: World.cs:68