This commit is contained in:
Robert Janetzko 2022-04-19 21:54:29 +00:00
parent 767216b2cc
commit 5f461c4f0f
2 changed files with 104 additions and 6 deletions

View File

@ -64,8 +64,53 @@ func (x *HistoricalEventAddHfEntityLink) Html() string {
return h + " became SOMETHING of " + c
}
func (x *HistoricalEventAddHfHfLink) Html() string { return "UNKNWON HistoricalEventAddHfHfLink" }
func (x *HistoricalEventAddHfSiteLink) Html() string { return "UNKNWON HistoricalEventAddHfSiteLink" }
func (x *HistoricalEventAddHfHfLink) Html() string {
h := hf(x.Hfid)
t := hf(x.HfidTarget)
switch x.LinkType {
case HistoricalEventAddHfHfLinkLinkType_Apprentice:
return h + " became the master of " + t
case HistoricalEventAddHfHfLinkLinkType_Deity:
return h + " began worshipping " + t
case HistoricalEventAddHfHfLinkLinkType_FormerMaster: // TODO
return h + " began an apprenticeship under " + t
case HistoricalEventAddHfHfLinkLinkType_Lover:
return h + " became romantically involved with " + t
case HistoricalEventAddHfHfLinkLinkType_Master:
return h + " began an apprenticeship under " + t
case HistoricalEventAddHfHfLinkLinkType_PetOwner:
return h + " became the owner of " + t
case HistoricalEventAddHfHfLinkLinkType_Prisoner:
return h + " imprisoned " + t
case HistoricalEventAddHfHfLinkLinkType_Spouse:
return h + " married " + t
default:
return h + " LINKED TO " + t
}
}
func (x *HistoricalEventAddHfSiteLink) Html() string {
h := hf(x.Histfig)
c := ""
if x.Civ != -1 {
c = " of " + entity(x.Civ)
}
b := ""
if x.Structure != -1 {
b = " " + structure(x.SiteId, x.Structure)
}
s := site(x.SiteId, "in")
switch x.LinkType {
case HistoricalEventAddHfSiteLinkLinkType_HomeSiteAbstractBuilding:
return h + " took up residence in " + b + c + " " + s
case HistoricalEventAddHfSiteLinkLinkType_Occupation:
return h + " started working at " + b + c + " " + s
case HistoricalEventAddHfSiteLinkLinkType_SeatOfPower:
return h + " ruled from " + b + c + " " + s
default:
return h + " LINKED TO " + s
}
}
func (x *HistoricalEventAgreementFormed) Html() string {
return "UNKNWON HistoricalEventAgreementFormed"
}
@ -74,11 +119,48 @@ func (x *HistoricalEventAgreementRejected) Html() string {
return "UNKNWON HistoricalEventAgreementRejected"
}
func (x *HistoricalEventArtifactClaimFormed) Html() string {
return "UNKNWON HistoricalEventArtifactClaimFormed"
a := artifact(x.ArtifactId)
switch x.Claim {
case HistoricalEventArtifactClaimFormedClaim_Heirloom:
return a + " was made a family heirloom by " + hf(x.HistFigureId)
case HistoricalEventArtifactClaimFormedClaim_Symbol:
p := world.Entities[x.EntityId].Position(x.PositionProfileId).Name_
e := entity(x.EntityId)
return a + " was made a symbol of the " + p + " by " + e
case HistoricalEventArtifactClaimFormedClaim_Treasure:
c := ""
if x.Circumstance != HistoricalEventArtifactClaimFormedCircumstance_Unknown {
c = x.Circumstance.String()
}
if x.HistFigureId != -1 {
return a + " was claimed by " + hf(x.HistFigureId) + c
} else if x.EntityId != -1 {
return a + " was claimed by " + entity(x.EntityId) + c
}
}
return a + " was claimed"
}
func (x *HistoricalEventArtifactCopied) Html() string { // TODO original
return fmt.Sprintf("%s made a copy of the original %s from %s%s of %s, keeping it within %s%s",
entity(x.DestEntityId), artifact(x.ArtifactId), structure(x.SourceSiteId, x.SourceStructureId), site(x.SourceSiteId, " in "),
entity(x.SourceEntityId), structure(x.DestSiteId, x.DestStructureId), site(x.DestSiteId, " in "))
}
func (x *HistoricalEventArtifactCopied) Html() string { return "UNKNWON HistoricalEventArtifactCopied" }
func (x *HistoricalEventArtifactCreated) Html() string {
return "UNKNWON HistoricalEventArtifactCreated"
a := artifact(x.ArtifactId)
h := hf(x.HistFigureId)
s := ""
if x.SiteId != -1 {
s = site(x.SiteId, " in ")
}
if !x.NameOnly {
return h + " created " + a + s
}
switch x.Reason {
case HistoricalEventArtifactCreatedReason_SanctifyHf:
return fmt.Sprintf("%s received its name%s from %s in order to sanctify %s as the item was a favorite possession", a, s, h, hf(x.SanctifyHf))
default:
return fmt.Sprintf("%s received its name%s from %s after defeating %s", a, s, h, hf(x.Circumstance.Defeated)) // TODO
}
}
func (x *HistoricalEventArtifactDestroyed) Html() string {
return "UNKNWON HistoricalEventArtifactDestroyed"

View File

@ -8,7 +8,7 @@ func (e *Entity) Position(id int) *EntityPosition {
return p
}
}
return nil
return &EntityPosition{Name_: "UNKNOWN POSITION"}
}
func (p *EntityPosition) GenderName(hf *HistoricalFigure) string {
@ -50,6 +50,13 @@ func containsInt(list []int, id int) bool {
var world *DfWorld
func artifact(id int) string {
if x, ok := world.Artifacts[id]; ok {
return fmt.Sprintf(`<a href="/artifact/%d">%s</a>`, x.Id(), x.Name())
}
return "UNKNOWN ARTIFACT"
}
func entity(id int) string {
if x, ok := world.Entities[id]; ok {
return fmt.Sprintf(`<a href="/entity/%d">%s</a>`, x.Id(), x.Name())
@ -70,3 +77,12 @@ func site(id int, prefix string) string {
}
return "UNKNOWN SITE"
}
func structure(siteId, structureId int) string {
if x, ok := world.Sites[siteId]; ok {
if y, ok := x.Structures[structureId]; ok {
return fmt.Sprintf(`<a href="/site/%d/structure/%d">%s</a>`, siteId, structureId, y.Name())
}
}
return "UNKNOWN STRUCTURE"
}