Elin:Code Analysis/Housing
Housing: Visitors / Publicity / Attractiveness
This is (TENATIVELY) the code block that determines the amount of visitors that visit a settlement and the type of visitors that visit.
Eclass Names | Eclass Values |
---|---|
Attraction | 2206 |
Tourist Safety | 2811 |
Ancient Ruin | 3702 |
Celebrity's Heaven | 2822 |
Open for Buisness | 2810 |
Motherless Zone | 2710 |
Publicity | 2202 |
if (EClass.rnd(5) == 0 && this.policies.IsActive(2810, -1))
{
int num8 = 3 + this.lv + this.Evalue(2206) / 5 + this.Evalue(3702) * 2 + this.Evalue(2202) / 2;
num8 = num8 * (100 + this.Evalue(3702) * 20 + this.Evalue(2206)) / 100;
num8 = num8 * (100 + (int)Mathf.Sqrt((float)this.Evalue(2811)) * 3) / 100;
if (EClass._map.CountGuest() < num8)
{
Chara chara;
if (this.policies.IsActive(2822, -1) && Mathf.Sqrt((float)(this.Evalue(2822) / 2)) + 5f >= (float)EClass.rnd(100))
{
chara = CharaGen.CreateWealthy(this.ContentLV);
EClass._zone.AddCard(chara, EClass._zone.GetSpawnPos(SpawnPosition.Random, 100) ?? EClass._map.GetRandomSurface(false, true, false));
}
else
{
chara = EClass._zone.SpawnMob(null, SpawnSetting.HomeGuest(this.ContentLV));
}
if (chara != null && (chara.id == "nun_mother" || chara.id == "prostitute") && this.policies.IsActive(2710, -1))
{
chara.Destroy();
chara = null;
}
if (chara != null)
{
this.statistics.visitor++;
chara.memberType = FactionMemberType.Guest;
chara.SetInt(34, EClass.world.date.GetRaw(0));
chara.c_allowance = chara.LV * 100;
if (chara.IsWealthy)
{
chara.c_allowance *= 10;
}
if (date.IsRealTime)
{
Msg.Say("guestArrive", chara.Name, null, null, null);
}
else
{
chara.TryAssignBed();
}
}
}
}
So there's a 80% chance if open for business is active, then
num8 = 3 + (I'm guessing land lvl) + (attractiveness / 5) + (If ancient ruin value is active then, it * 2) + publicity / 2
num8 = num8 (from above) * (100 + ancient ruin * 20 + attractiveness) / 100
num8 = num8 (from above) * (100 + integer of the sqrt((of a float of tourist safety) * 3) / 100)
Then if Celeb heaven is on AND the sqrt(Celeb heaven / 2) + 5 is greater than or equal to a random number from 1-100
THEN
wealthy visitors are generated (based on something called content lvl (which may be danger lvl))
add the random visitors somewhere random
Then the next lines check to say if its a mother and if you have the anti mother policy
Then they get an allowance of their character level * 100,
and if they're wealthy its * 1000
TLDR; if you want to build a settlement that generates orens through visitors you should use a snowy / ancient ruin tile
Housing: Taxes
Eclass Names | Eclass Values |
---|---|
Wealth Tax | 2500 |
Faith Tax | 2501 |
Resident Tax | 2512 |
public int GetResidentTax()
{
if (!this.policies.IsActive(2512, 30))
{
return 0;
}
int num = 0;
int num2 = this.policies.IsActive(2500, 30) ? this.Evalue(2500) : 0;
int num3 = this.policies.IsActive(2501, 30) ? this.Evalue(2501) : 0;
int num4 = 50 + (int)Mathf.Sqrt((float)this.Evalue(2512)) * 5;
foreach (Chara chara in this.members)
{
if (!chara.IsPC && chara.memberType == FactionMemberType.Default)
{
bool isWealthy = chara.IsWealthy;
int num5 = 0;
foreach (Hobby hobby in chara.ListWorks(true).Concat(chara.ListHobbies(true)))
{
int num6 = hobby.source.tax * 100 / 100;
if (num6 > num5)
{
num5 = num6;
}
}
int num7 = ((isWealthy ? 50 : 10) + chara.LV * 2) * num5 / 100 * num4 / 100;
if (isWealthy && num2 > 0)
{
num7 = num7 * (150 + (int)Mathf.Sqrt((float)num2) * 5) / 100;
}
if (num3 > 0)
{
num7 += (80 + (int)Mathf.Sqrt((float)num3) * 5) * chara.faith.source.tax / 100;
}
num7 = num7 * this.efficiency / (this.IsTaxFree ? 100 : 1000);
num += num7;
if (num7 > 0)
{
this.Log("bTax", num7.ToString() ?? "", chara.Name, null, null);
}
}
}
this.statistics.tax += num;
return num;
}