dorfylegends/backend/model/events.go
Robert Janetzko d29ab0dce1 events
2022-04-19 15:46:11 +00:00

329 lines
15 KiB
Go

package model
import (
"fmt"
"strings"
)
func andList(list []string) string {
if len(list) > 1 {
return strings.Join(list[:len(list)-1], ", ") + " and " + list[len(list)-1]
}
return strings.Join(list, ", ")
}
func (x *Honor) Requirement() string {
var list []string
if x.GrantedToEverybody {
list = append(list, "attaining sufficent skill with a weapon or technique")
}
// if x.RequiredSkill { // TODO
// }
if x.RequiredBattles == 1 {
list = append(list, "serving in combat")
}
if x.RequiredBattles > 1 {
list = append(list, fmt.Sprintf("participating in %d battles", x.RequiredBattles))
}
if x.RequiredYears >= 1 {
list = append(list, fmt.Sprintf("%d years of membership", x.RequiredYears))
}
if x.RequiredKills >= 1 {
list = append(list, fmt.Sprintf("%d KILLS", x.RequiredKills)) // TODO
}
return " after " + andList(list)
}
func (x *HistoricalEventAddHfEntityHonor) Html() string {
e := world.Entities[x.EntityId]
h := e.Honor[x.HonorId]
return fmt.Sprintf("%s received the title %s of %s%s", hf(x.Hfid), h.Name(), entity(x.EntityId), h.Requirement())
}
func (x *HistoricalEventAddHfEntityLink) Html() string {
h := hf(x.Hfid)
c := entity(x.CivId)
if x.AppointerHfid != -1 {
c += fmt.Sprintf(", appointed by %s", hf(x.AppointerHfid))
}
switch x.Link {
case HistoricalEventAddHfEntityLinkLink_Enemy:
return h + " became an enemy of " + c
case HistoricalEventAddHfEntityLinkLink_Member:
return h + " became a member of " + c
case HistoricalEventAddHfEntityLinkLink_Position:
return h + " became " + world.Entities[x.CivId].Position(x.PositionId).GenderName(world.HistoricalFigures[x.Hfid]) + " of " + c
case HistoricalEventAddHfEntityLinkLink_Prisoner:
return h + " was imprisoned by " + c
case HistoricalEventAddHfEntityLinkLink_Slave:
return h + " was enslaved by " + c
case HistoricalEventAddHfEntityLinkLink_Squad:
return h + " SQUAD " + c // TODO
}
return h + " became SOMETHING of " + c
}
func (x *HistoricalEventAddHfHfLink) Html() string { return "UNKNWON HistoricalEventAddHfHfLink" }
func (x *HistoricalEventAddHfSiteLink) Html() string { return "UNKNWON HistoricalEventAddHfSiteLink" }
func (x *HistoricalEventAgreementFormed) Html() string {
return "UNKNWON HistoricalEventAgreementFormed"
}
func (x *HistoricalEventAgreementMade) Html() string { return "UNKNWON HistoricalEventAgreementMade" }
func (x *HistoricalEventAgreementRejected) Html() string {
return "UNKNWON HistoricalEventAgreementRejected"
}
func (x *HistoricalEventArtifactClaimFormed) Html() string {
return "UNKNWON HistoricalEventArtifactClaimFormed"
}
func (x *HistoricalEventArtifactCopied) Html() string { return "UNKNWON HistoricalEventArtifactCopied" }
func (x *HistoricalEventArtifactCreated) Html() string {
return "UNKNWON HistoricalEventArtifactCreated"
}
func (x *HistoricalEventArtifactDestroyed) Html() string {
return "UNKNWON HistoricalEventArtifactDestroyed"
}
func (x *HistoricalEventArtifactFound) Html() string { return "UNKNWON HistoricalEventArtifactFound" }
func (x *HistoricalEventArtifactGiven) Html() string { return "UNKNWON HistoricalEventArtifactGiven" }
func (x *HistoricalEventArtifactLost) Html() string { return "UNKNWON HistoricalEventArtifactLost" }
func (x *HistoricalEventArtifactPossessed) Html() string {
return "UNKNWON HistoricalEventArtifactPossessed"
}
func (x *HistoricalEventArtifactRecovered) Html() string {
return "UNKNWON HistoricalEventArtifactRecovered"
}
func (x *HistoricalEventArtifactStored) Html() string { return "UNKNWON HistoricalEventArtifactStored" }
func (x *HistoricalEventArtifactTransformed) Html() string {
return "UNKNWON HistoricalEventArtifactTransformed"
}
func (x *HistoricalEventAssumeIdentity) Html() string { return "UNKNWON HistoricalEventAssumeIdentity" }
func (x *HistoricalEventAttackedSite) Html() string { return "UNKNWON HistoricalEventAttackedSite" }
func (x *HistoricalEventBodyAbused) Html() string { return "UNKNWON HistoricalEventBodyAbused" }
func (x *HistoricalEventBuildingProfileAcquired) Html() string {
return "UNKNWON HistoricalEventBuildingProfileAcquired"
}
func (x *HistoricalEventCeremony) Html() string { return "UNKNWON HistoricalEventCeremony" }
func (x *HistoricalEventChangeHfBodyState) Html() string {
return "UNKNWON HistoricalEventChangeHfBodyState"
}
func (x *HistoricalEventChangeHfJob) Html() string { return "UNKNWON HistoricalEventChangeHfJob" }
func (x *HistoricalEventChangeHfState) Html() string {
switch x.State {
case HistoricalEventChangeHfStateState_Settled:
switch x.Reason {
case HistoricalEventChangeHfStateReason_BeWithMaster:
return hf(x.Hfid) + " moved to study " + site(x.SiteId, "in") + " in order to be with the master"
default:
return hf(x.Hfid) + " settled " + site(x.SiteId, "in")
}
}
return "UNKNWON HistoricalEventChangeHfState"
}
func (x *HistoricalEventChangedCreatureType) Html() string {
return "UNKNWON HistoricalEventChangedCreatureType"
}
func (x *HistoricalEventCompetition) Html() string { return "UNKNWON HistoricalEventCompetition" }
func (x *HistoricalEventCreateEntityPosition) Html() string {
return "UNKNWON HistoricalEventCreateEntityPosition"
}
func (x *HistoricalEventCreatedSite) Html() string { return "UNKNWON HistoricalEventCreatedSite" }
func (x *HistoricalEventCreatedStructure) Html() string {
return "UNKNWON HistoricalEventCreatedStructure"
}
func (x *HistoricalEventCreatedWorldConstruction) Html() string {
return "UNKNWON HistoricalEventCreatedWorldConstruction"
}
func (x *HistoricalEventCreatureDevoured) Html() string {
return "UNKNWON HistoricalEventCreatureDevoured"
}
func (x *HistoricalEventDanceFormCreated) Html() string {
return "UNKNWON HistoricalEventDanceFormCreated"
}
func (x *HistoricalEventDestroyedSite) Html() string { return "UNKNWON HistoricalEventDestroyedSite" }
func (x *HistoricalEventDiplomatLost) Html() string { return "UNKNWON HistoricalEventDiplomatLost" }
func (x *HistoricalEventEntityAllianceFormed) Html() string {
return "UNKNWON HistoricalEventEntityAllianceFormed"
}
func (x *HistoricalEventEntityBreachFeatureLayer) Html() string {
return "UNKNWON HistoricalEventEntityBreachFeatureLayer"
}
func (x *HistoricalEventEntityCreated) Html() string { return "UNKNWON HistoricalEventEntityCreated" }
func (x *HistoricalEventEntityDissolved) Html() string {
return "UNKNWON HistoricalEventEntityDissolved"
}
func (x *HistoricalEventEntityEquipmentPurchase) Html() string {
return "UNKNWON HistoricalEventEntityEquipmentPurchase"
}
func (x *HistoricalEventEntityExpelsHf) Html() string { return "UNKNWON HistoricalEventEntityExpelsHf" }
func (x *HistoricalEventEntityFledSite) Html() string { return "UNKNWON HistoricalEventEntityFledSite" }
func (x *HistoricalEventEntityIncorporated) Html() string {
return "UNKNWON HistoricalEventEntityIncorporated"
}
func (x *HistoricalEventEntityLaw) Html() string { return "UNKNWON HistoricalEventEntityLaw" }
func (x *HistoricalEventEntityOverthrown) Html() string {
return "UNKNWON HistoricalEventEntityOverthrown"
}
func (x *HistoricalEventEntityPersecuted) Html() string {
return "UNKNWON HistoricalEventEntityPersecuted"
}
func (x *HistoricalEventEntityPrimaryCriminals) Html() string {
return "UNKNWON HistoricalEventEntityPrimaryCriminals"
}
func (x *HistoricalEventEntityRampagedInSite) Html() string {
return "UNKNWON HistoricalEventEntityRampagedInSite"
}
func (x *HistoricalEventEntityRelocate) Html() string { return "UNKNWON HistoricalEventEntityRelocate" }
func (x *HistoricalEventEntitySearchedSite) Html() string {
return "UNKNWON HistoricalEventEntitySearchedSite"
}
func (x *HistoricalEventFailedFrameAttempt) Html() string {
return "UNKNWON HistoricalEventFailedFrameAttempt"
}
func (x *HistoricalEventFailedIntrigueCorruption) Html() string {
return "UNKNWON HistoricalEventFailedIntrigueCorruption"
}
func (x *HistoricalEventFieldBattle) Html() string { return "UNKNWON HistoricalEventFieldBattle" }
func (x *HistoricalEventFirstContact) Html() string { return "UNKNWON HistoricalEventFirstContact" }
func (x *HistoricalEventGamble) Html() string { return "UNKNWON HistoricalEventGamble" }
func (x *HistoricalEventHfAbducted) Html() string { return "UNKNWON HistoricalEventHfAbducted" }
func (x *HistoricalEventHfAttackedSite) Html() string { return "UNKNWON HistoricalEventHfAttackedSite" }
func (x *HistoricalEventHfConfronted) Html() string { return "UNKNWON HistoricalEventHfConfronted" }
func (x *HistoricalEventHfConvicted) Html() string { return "UNKNWON HistoricalEventHfConvicted" }
func (x *HistoricalEventHfDestroyedSite) Html() string {
return "UNKNWON HistoricalEventHfDestroyedSite"
}
func (x *HistoricalEventHfDied) Html() string { return "UNKNWON HistoricalEventHfDied" }
func (x *HistoricalEventHfDisturbedStructure) Html() string {
return "UNKNWON HistoricalEventHfDisturbedStructure"
}
func (x *HistoricalEventHfDoesInteraction) Html() string {
return "UNKNWON HistoricalEventHfDoesInteraction"
}
func (x *HistoricalEventHfEnslaved) Html() string { return "UNKNWON HistoricalEventHfEnslaved" }
func (x *HistoricalEventHfEquipmentPurchase) Html() string {
return "UNKNWON HistoricalEventHfEquipmentPurchase"
}
func (x *HistoricalEventHfFreed) Html() string { return "UNKNWON HistoricalEventHfFreed" }
func (x *HistoricalEventHfGainsSecretGoal) Html() string {
return "UNKNWON HistoricalEventHfGainsSecretGoal"
}
func (x *HistoricalEventHfInterrogated) Html() string { return "UNKNWON HistoricalEventHfInterrogated" }
func (x *HistoricalEventHfLearnsSecret) Html() string { return "UNKNWON HistoricalEventHfLearnsSecret" }
func (x *HistoricalEventHfNewPet) Html() string { return "UNKNWON HistoricalEventHfNewPet" }
func (x *HistoricalEventHfPerformedHorribleExperiments) Html() string {
return "UNKNWON HistoricalEventHfPerformedHorribleExperiments"
}
func (x *HistoricalEventHfPrayedInsideStructure) Html() string {
return "UNKNWON HistoricalEventHfPrayedInsideStructure"
}
func (x *HistoricalEventHfPreach) Html() string { return "UNKNWON HistoricalEventHfPreach" }
func (x *HistoricalEventHfProfanedStructure) Html() string {
return "UNKNWON HistoricalEventHfProfanedStructure"
}
func (x *HistoricalEventHfRansomed) Html() string { return "UNKNWON HistoricalEventHfRansomed" }
func (x *HistoricalEventHfReachSummit) Html() string { return "UNKNWON HistoricalEventHfReachSummit" }
func (x *HistoricalEventHfRecruitedUnitTypeForEntity) Html() string {
return "UNKNWON HistoricalEventHfRecruitedUnitTypeForEntity"
}
func (x *HistoricalEventHfRelationshipDenied) Html() string {
return "UNKNWON HistoricalEventHfRelationshipDenied"
}
func (x *HistoricalEventHfReunion) Html() string { return "UNKNWON HistoricalEventHfReunion" }
func (x *HistoricalEventHfRevived) Html() string { return "UNKNWON HistoricalEventHfRevived" }
func (x *HistoricalEventHfSimpleBattleEvent) Html() string {
return "UNKNWON HistoricalEventHfSimpleBattleEvent"
}
func (x *HistoricalEventHfTravel) Html() string { return "UNKNWON HistoricalEventHfTravel" }
func (x *HistoricalEventHfViewedArtifact) Html() string {
return "UNKNWON HistoricalEventHfViewedArtifact"
}
func (x *HistoricalEventHfWounded) Html() string { return "UNKNWON HistoricalEventHfWounded" }
func (x *HistoricalEventHfsFormedIntrigueRelationship) Html() string {
return "UNKNWON HistoricalEventHfsFormedIntrigueRelationship"
}
func (x *HistoricalEventHfsFormedReputationRelationship) Html() string {
return "UNKNWON HistoricalEventHfsFormedReputationRelationship"
}
func (x *HistoricalEventHolyCityDeclaration) Html() string {
return "UNKNWON HistoricalEventHolyCityDeclaration"
}
func (x *HistoricalEventInsurrectionStarted) Html() string {
return "UNKNWON HistoricalEventInsurrectionStarted"
}
func (x *HistoricalEventItemStolen) Html() string { return "UNKNWON HistoricalEventItemStolen" }
func (x *HistoricalEventKnowledgeDiscovered) Html() string {
return "UNKNWON HistoricalEventKnowledgeDiscovered"
}
func (x *HistoricalEventMasterpieceArchConstructed) Html() string {
return "UNKNWON HistoricalEventMasterpieceArchConstructed"
}
func (x *HistoricalEventMasterpieceEngraving) Html() string {
return "UNKNWON HistoricalEventMasterpieceEngraving"
}
func (x *HistoricalEventMasterpieceFood) Html() string {
return "UNKNWON HistoricalEventMasterpieceFood"
}
func (x *HistoricalEventMasterpieceItem) Html() string {
return "UNKNWON HistoricalEventMasterpieceItem"
}
func (x *HistoricalEventMasterpieceItemImprovement) Html() string {
return "UNKNWON HistoricalEventMasterpieceItemImprovement"
}
func (x *HistoricalEventMasterpieceLost) Html() string {
return "UNKNWON HistoricalEventMasterpieceLost"
}
func (x *HistoricalEventMerchant) Html() string { return "UNKNWON HistoricalEventMerchant" }
func (x *HistoricalEventModifiedBuilding) Html() string {
return "UNKNWON HistoricalEventModifiedBuilding"
}
func (x *HistoricalEventMusicalFormCreated) Html() string {
return "UNKNWON HistoricalEventMusicalFormCreated"
}
func (x *HistoricalEventNewSiteLeader) Html() string { return "UNKNWON HistoricalEventNewSiteLeader" }
func (x *HistoricalEventPeaceAccepted) Html() string { return "UNKNWON HistoricalEventPeaceAccepted" }
func (x *HistoricalEventPeaceRejected) Html() string { return "UNKNWON HistoricalEventPeaceRejected" }
func (x *HistoricalEventPerformance) Html() string { return "UNKNWON HistoricalEventPerformance" }
func (x *HistoricalEventPlunderedSite) Html() string { return "UNKNWON HistoricalEventPlunderedSite" }
func (x *HistoricalEventPoeticFormCreated) Html() string {
return "UNKNWON HistoricalEventPoeticFormCreated"
}
func (x *HistoricalEventProcession) Html() string { return "UNKNWON HistoricalEventProcession" }
func (x *HistoricalEventRazedStructure) Html() string { return "UNKNWON HistoricalEventRazedStructure" }
func (x *HistoricalEventReclaimSite) Html() string { return "UNKNWON HistoricalEventReclaimSite" }
func (x *HistoricalEventRegionpopIncorporatedIntoEntity) Html() string {
return "UNKNWON HistoricalEventRegionpopIncorporatedIntoEntity"
}
func (x *HistoricalEventRemoveHfEntityLink) Html() string {
return "UNKNWON HistoricalEventRemoveHfEntityLink"
}
func (x *HistoricalEventRemoveHfHfLink) Html() string { return "UNKNWON HistoricalEventRemoveHfHfLink" }
func (x *HistoricalEventRemoveHfSiteLink) Html() string {
return "UNKNWON HistoricalEventRemoveHfSiteLink"
}
func (x *HistoricalEventReplacedStructure) Html() string {
return "UNKNWON HistoricalEventReplacedStructure"
}
func (x *HistoricalEventSiteDied) Html() string { return "UNKNWON HistoricalEventSiteDied" }
func (x *HistoricalEventSiteDispute) Html() string { return "UNKNWON HistoricalEventSiteDispute" }
func (x *HistoricalEventSiteRetired) Html() string { return "UNKNWON HistoricalEventSiteRetired" }
func (x *HistoricalEventSiteSurrendered) Html() string {
return "UNKNWON HistoricalEventSiteSurrendered"
}
func (x *HistoricalEventSiteTakenOver) Html() string { return "UNKNWON HistoricalEventSiteTakenOver" }
func (x *HistoricalEventSiteTributeForced) Html() string {
return "UNKNWON HistoricalEventSiteTributeForced"
}
func (x *HistoricalEventSneakIntoSite) Html() string { return "UNKNWON HistoricalEventSneakIntoSite" }
func (x *HistoricalEventSpottedLeavingSite) Html() string {
return "UNKNWON HistoricalEventSpottedLeavingSite"
}
func (x *HistoricalEventSquadVsSquad) Html() string { return "UNKNWON HistoricalEventSquadVsSquad" }
func (x *HistoricalEventTacticalSituation) Html() string {
return "UNKNWON HistoricalEventTacticalSituation"
}
func (x *HistoricalEventTrade) Html() string { return "UNKNWON HistoricalEventTrade" }
func (x *HistoricalEventWrittenContentComposed) Html() string {
return "UNKNWON HistoricalEventWrittenContentComposed"
}