This commit is contained in:
Robert Janetzko 2022-04-20 19:38:31 +00:00
parent f038523b46
commit b534159a8d
2 changed files with 88 additions and 21 deletions

View File

@ -14,12 +14,12 @@ func andList(list []string) string {
func (x *Honor) Requirement() string { func (x *Honor) Requirement() string {
var list []string var list []string
if x.GrantedToEverybody { if x.RequiresAnyMeleeOrRangedSkill {
list = append(list, "attaining sufficent skill with a weapon or technique") list = append(list, "attaining sufficent skill with a weapon or technique")
} }
// if x.RequiredSkill { // TODO if x.RequiredSkill != HonorRequiredSkill_Unknown {
list = append(list, "attaining enough skill with the "+x.RequiredSkill.String())
// } }
if x.RequiredBattles == 1 { if x.RequiredBattles == 1 {
list = append(list, "serving in combat") list = append(list, "serving in combat")
} }
@ -30,7 +30,7 @@ func (x *Honor) Requirement() string {
list = append(list, fmt.Sprintf("%d years of membership", x.RequiredYears)) list = append(list, fmt.Sprintf("%d years of membership", x.RequiredYears))
} }
if x.RequiredKills >= 1 { if x.RequiredKills >= 1 {
list = append(list, fmt.Sprintf("%d KILLS", x.RequiredKills)) // TODO list = append(list, fmt.Sprintf("slaying %d enemies", x.RequiredKills))
} }
return " after " + andList(list) return " after " + andList(list)
@ -41,6 +41,7 @@ func (x *HistoricalEventAddHfEntityHonor) Html() string {
h := e.Honor[x.HonorId] 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()) 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 { func (x *HistoricalEventAddHfEntityLink) Html() string {
h := hf(x.Hfid) h := hf(x.Hfid)
c := entity(x.CivId) c := entity(x.CivId)
@ -59,7 +60,7 @@ func (x *HistoricalEventAddHfEntityLink) Html() string {
case HistoricalEventAddHfEntityLinkLink_Slave: case HistoricalEventAddHfEntityLinkLink_Slave:
return h + " was enslaved by " + c return h + " was enslaved by " + c
case HistoricalEventAddHfEntityLinkLink_Squad: case HistoricalEventAddHfEntityLinkLink_Squad:
return h + " SQUAD " + c // TODO return h + " became a hearthperson/solder of " + c // TODO
} }
return h + " became SOMETHING of " + c return h + " became SOMETHING of " + c
} }
@ -72,8 +73,8 @@ func (x *HistoricalEventAddHfHfLink) Html() string {
return h + " became the master of " + t return h + " became the master of " + t
case HistoricalEventAddHfHfLinkLinkType_Deity: case HistoricalEventAddHfHfLinkLinkType_Deity:
return h + " began worshipping " + t return h + " began worshipping " + t
case HistoricalEventAddHfHfLinkLinkType_FormerMaster: // TODO case HistoricalEventAddHfHfLinkLinkType_FormerMaster:
return h + " began an apprenticeship under " + t return h + " ceased being the apprentice of " + t
case HistoricalEventAddHfHfLinkLinkType_Lover: case HistoricalEventAddHfHfLinkLinkType_Lover:
return h + " became romantically involved with " + t return h + " became romantically involved with " + t
case HistoricalEventAddHfHfLinkLinkType_Master: case HistoricalEventAddHfHfLinkLinkType_Master:
@ -87,8 +88,8 @@ func (x *HistoricalEventAddHfHfLink) Html() string {
default: default:
return h + " LINKED TO " + t return h + " LINKED TO " + t
} }
} }
func (x *HistoricalEventAddHfSiteLink) Html() string { func (x *HistoricalEventAddHfSiteLink) Html() string {
h := hf(x.Histfig) h := hf(x.Histfig)
c := "" c := ""
@ -111,13 +112,17 @@ func (x *HistoricalEventAddHfSiteLink) Html() string {
return h + " LINKED TO " + s return h + " LINKED TO " + s
} }
} }
func (x *HistoricalEventAgreementFormed) Html() string {
func (x *HistoricalEventAgreementFormed) Html() string { // TODO
return "UNKNWON HistoricalEventAgreementFormed" return "UNKNWON HistoricalEventAgreementFormed"
} }
func (x *HistoricalEventAgreementMade) Html() string { return "UNKNWON HistoricalEventAgreementMade" }
func (x *HistoricalEventAgreementRejected) Html() string { func (x *HistoricalEventAgreementMade) Html() string { return "UNKNWON HistoricalEventAgreementMade" } // TODO
func (x *HistoricalEventAgreementRejected) Html() string { // TODO
return "UNKNWON HistoricalEventAgreementRejected" return "UNKNWON HistoricalEventAgreementRejected"
} }
func (x *HistoricalEventArtifactClaimFormed) Html() string { func (x *HistoricalEventArtifactClaimFormed) Html() string {
a := artifact(x.ArtifactId) a := artifact(x.ArtifactId)
switch x.Claim { switch x.Claim {
@ -140,11 +145,17 @@ func (x *HistoricalEventArtifactClaimFormed) Html() string {
} }
return a + " was claimed" 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", func (x *HistoricalEventArtifactCopied) Html() string {
entity(x.DestEntityId), artifact(x.ArtifactId), structure(x.SourceSiteId, x.SourceStructureId), site(x.SourceSiteId, " in "), s := "aquired a copy of"
if x.FromOriginal {
s = "made a copy of the original"
}
return fmt.Sprintf("%s %s %s from %s%s of %s, keeping it within %s%s",
entity(x.DestEntityId), s, artifact(x.ArtifactId), structure(x.SourceSiteId, x.SourceStructureId), site(x.SourceSiteId, " in "),
entity(x.SourceEntityId), structure(x.DestSiteId, x.DestStructureId), site(x.DestSiteId, " in ")) entity(x.SourceEntityId), structure(x.DestSiteId, x.DestStructureId), site(x.DestSiteId, " in "))
} }
func (x *HistoricalEventArtifactCreated) Html() string { func (x *HistoricalEventArtifactCreated) Html() string {
a := artifact(x.ArtifactId) a := artifact(x.ArtifactId)
h := hf(x.HistFigureId) h := hf(x.HistFigureId)
@ -155,19 +166,68 @@ func (x *HistoricalEventArtifactCreated) Html() string {
if !x.NameOnly { if !x.NameOnly {
return h + " created " + a + s return h + " created " + a + s
} }
c := ""
if x.Circumstance != nil {
switch x.Circumstance.Type {
case HistoricalEventArtifactCreatedCircumstanceType_Defeated:
c = " after defeating " + hf(x.Circumstance.Defeated)
case HistoricalEventArtifactCreatedCircumstanceType_Favoritepossession:
c = " as the item was a favorite possession"
case HistoricalEventArtifactCreatedCircumstanceType_Preservebody:
c = " by preserving part of the body"
}
}
switch x.Reason { switch x.Reason {
case HistoricalEventArtifactCreatedReason_SanctifyHf: 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)) return fmt.Sprintf("%s received its name%s from %s in order to sanctify %s%s", a, s, h, hf(x.SanctifyHf), c)
default: default:
return fmt.Sprintf("%s received its name%s from %s after defeating %s", a, s, h, hf(x.Circumstance.Defeated)) // TODO return fmt.Sprintf("%s received its name%s from %s %s", a, s, h, c)
} }
} }
func (x *HistoricalEventArtifactDestroyed) Html() string { func (x *HistoricalEventArtifactDestroyed) Html() string {
return "UNKNWON HistoricalEventArtifactDestroyed" return fmt.Sprintf("%s was destroyed by %s in %s", artifact(x.ArtifactId), entity(x.DestroyerEnid), site(x.SiteId, ""))
}
func (x *HistoricalEventArtifactFound) Html() string {
return fmt.Sprintf("%s was found in %s by %s", artifact(x.ArtifactId), site(x.SiteId, ""), hf(x.HistFigureId))
}
func (x *HistoricalEventArtifactGiven) Html() string {
r := ""
if x.ReceiverHistFigureId != -1 {
r = hf(x.ReceiverHistFigureId)
if x.ReceiverEntityId != -1 {
r += " of " + entity(x.ReceiverEntityId)
}
} else if x.ReceiverEntityId != -1 {
r += entity(x.ReceiverEntityId)
}
g := ""
if x.GiverHistFigureId != -1 {
g = hf(x.GiverHistFigureId)
if x.GiverEntityId != -1 {
g += " of " + entity(x.GiverEntityId)
}
} else if x.GiverEntityId != -1 {
g += entity(x.GiverEntityId)
}
reason := ""
switch x.Reason {
case HistoricalEventArtifactGivenReason_PartOfTradeNegotiation:
reason = " as part of a trade negotiation"
}
return fmt.Sprintf("%s was offered to %s by %s%s", artifact(x.ArtifactId), r, g, reason)
}
func (x *HistoricalEventArtifactLost) Html() string {
w := ""
if x.SiteId != -1 {
w = site(x.SiteId, "")
}
if x.SubregionId != -1 {
w = region(x.SubregionId) // TODO optional
}
return fmt.Sprintf("%s was lost in %s", artifact(x.ArtifactId), w)
} }
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 { func (x *HistoricalEventArtifactPossessed) Html() string {
return "UNKNWON HistoricalEventArtifactPossessed" return "UNKNWON HistoricalEventArtifactPossessed"
} }

View File

@ -86,3 +86,10 @@ func structure(siteId, structureId int) string {
} }
return "UNKNOWN STRUCTURE" return "UNKNOWN STRUCTURE"
} }
func region(id int) string {
if x, ok := world.Regions[id]; ok {
return fmt.Sprintf(`<a href="/region/%d">%s</a>`, x.Id(), x.Name())
}
return "UNKNOWN REGION"
}