Celebration

The st_celebration function is at 0x004E23A4.

00000000 struct scheduled_task_celebration // sizeof=0x10
00000000 {
00000000     signed __int32 field_0_merchant_index;
00000004     signed __int32 field_4_town_index;
00000008     signed __int32 field_8_maybe_type;
0000000C     signed __int32 field_C;
00000010 };

Consumption

The celebration_base_consumption table at 0x006734E8 defines the base consumption per guest:

WareBase Consumption
Grain3
Meat2
Fish2
Beer2
Salt0
Honey1
Spices0
Wine2

The consumption per guest is calculated as follows:

celebration_wares = [
    WareId.Grain,
    WareId.Meat,
    WareId.Fish,
    WareId.Beer,
    WareId.Salt,
    WareId.Honey,
    WareId.Spices,
    WareId.Wine,
]

for ware in celebration_wares:
    base_consumption = guests * celebration_base_consumption[ware]
    scaled_consumption = base_consumption * (4 if has_famine else 2)

    # Ceil to the next barrel/bundle
    if is_barrel_ware[ware]:
        consumption = 200 * ((scaled_consumption + 199) / 200)
    else
        consumption = 2000 * ((scaled_consumption + 1999) / 2000)

Not having enough wares to cover the consumption does not impact celebration level, merchant popularity, or citizen satisfaction.

Attendance

The amount of guests is calculated as follows:

attendance_ratio = min(99, max(0, 39 + local_reputation))
eligible_citizens = attendance_ratio * total_citizens / 100
satisfied_wares = 0

for ware in celebration_wares:
    if celebration_base_consumption[ware] == 0:
        continue
    if celebration_base_consumption[ware] * eligible_citizens <= office.wares[ware]:
        satisfied_wares += 1

satisfaction_ratio = attendance_ratio * satisfied_wares // 6
capped_satisfaction_ratio = max(2, min(99, satisfaction_ratio))
guests = max(5, total_citizens * capped_satisfaction_ratio // 100)

Since exactly 6 wares have a non-zero consumption, satisfaction_ratio is equal to attendance_ratio if all wares are satisfied.

Levels

Depending on how many wares were available in sufficient amounts, the celebration is classified as one of the following levels:

LevelLetter
0This was not really a great celebration [...]
1The celebration was only moderately successful [...]
2The celebration was relatively successful [...]
3It was a fantastic celebration [...]

A celebration's level is calculated as follows:

level = satisfied_wares // 2

Consequently, a partially satisfied ware does not contribute to the celebration's success.

Satisfaction

Reputation

Under be assumption that the base_rep_factor is always 1, the impact of each celebration level is:

LevelSocial Reputation Impact
0-1
10.5
21
31.5