Elin Decompiled Documentation EA 23.102 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.category.id == "vegi") && !(t.category.id == "fruit"))
44 {
45 return t.category.id == "mushroom";
46 }
47 return true;
48 default:
49 return false;
50 }
51 }
52
53 public static void PayBill(Thing t, bool fromBank = false)
54 {
55 bool flag = t.id == "bill_tax";
56 bool flag2 = t.id == "bill_debt";
57 QuestDebt questDebt = EClass.game.quests.Get<QuestDebt>();
58 bool flag3 = flag2 && questDebt != null && !questDebt.paid && questDebt.IsValidBill(t);
59 if ((flag && EClass.player.taxBills <= 0) || (flag2 && !flag3))
60 {
61 SE.Beep();
62 Msg.Say("badidea");
63 EClass.pc.Pick(t, msg: false);
64 return;
65 }
66 if (fromBank)
67 {
69 }
70 else if (!EClass.pc.TryPay(t.c_bill))
71 {
72 return;
73 }
74 if (flag2)
75 {
76 EClass.player.debt -= t.c_bill;
77 if (EClass.player.debt < 0)
78 {
79 EClass.player.debt = 0;
80 }
81 questDebt.paid = true;
82 questDebt.UpdateJournal();
83 }
84 else if (flag)
85 {
86 EClass.player.stats.taxBillsPaid += t.c_bill;
88 if (EClass.player.taxBills < 0)
89 {
90 EClass.player.taxBills = 0;
91 }
92 int num = t.GetInt(35) / 1000;
93 if (num > 0)
94 {
95 Thing thing = ThingGen.Create("money2", "copper").SetNum(num);
96 Thing p = ThingGen.CreateParcel("parcel_mysiliaGift", thing);
97 Msg.Say("getSalary", thing);
99 }
100 }
101 else
102 {
103 EClass.player.unpaidBill -= t.c_bill;
104 }
105 Msg.Say("payBill", t);
106 t.Destroy();
107 }
108
109 public override void _OnProcess(Thing t)
110 {
111 switch (mode)
112 {
113 case Mode.Tax:
114 PayBill(t);
115 break;
116 case Mode.Bank:
117 SE.Pay();
118 Msg.Say("depositMoney", t, owner);
119 owner.AddThing(t);
120 break;
121 case Mode.Crop:
122 {
123 Msg.Say("farm_chest", t, Lang._weight(t.SelfWeight * t.Num));
124 QuestHarvest questHarvest = EClass.game.quests.Get<QuestHarvest>();
125 if (questHarvest != null)
126 {
127 questHarvest.weightDelivered += t.SelfWeight * t.Num;
128 }
129 SE.Pick();
130 t.Destroy();
131 break;
132 }
133 }
134 }
135}
CurrencyType
Definition: CurrencyType.cs:2
int GetInt(int id, int? defaultInt=null)
Definition: BaseCard.cs:25
Thing container_deposit
Definition: CardManager.cs:58
Definition: Card.cs:11
Thing AddThing(string id, int lv=-1)
Definition: Card.cs:2901
Thing SetNum(int a)
Definition: Card.cs:3242
void ModCurrency(int a, string id="money")
Definition: Card.cs:3638
bool TryPay(int a, string id="money")
Definition: Card.cs:3602
void Destroy()
Definition: Card.cs:4538
int c_bill
Definition: Card.cs:1217
int Num
Definition: Card.cs:154
SourceCategory.Row category
Definition: Card.cs:1925
Thing Pick(Thing t, bool msg=true, bool tryStack=true)
Definition: Chara.cs:3920
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:754
int taxBills
Definition: Player.cs:715
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