events
This commit is contained in:
parent
0f30dccbae
commit
d2064ae059
File diff suppressed because it is too large
Load Diff
|
@ -120,8 +120,11 @@ func (x *{{ $obj.Name }}) Name() string { return x.Name_ }
|
||||||
{{- if $obj.SubType }}
|
{{- if $obj.SubType }}
|
||||||
func (x *{{ $obj.Name }}) Type() string { return "{{ $obj.SubType }}" }
|
func (x *{{ $obj.Name }}) Type() string { return "{{ $obj.SubType }}" }
|
||||||
{{- end }}
|
{{- end }}
|
||||||
func (x *{{ $obj.Name }}) RelatedToEntity(id int) bool { return {{ $obj.Related "civId,civ_id,entity_id,entity" }} }
|
func (x *{{ $obj.Name }}) RelatedToEntity(id int) bool { return {{ $obj.Related "civId,civ_id,entity_id,entity,enid" }} }
|
||||||
func (x *{{ $obj.Name }}) RelatedToHf(id int) bool { return {{ $obj.Related "hfid,hf_id,_hf,hist_figure_id,Hfid,histfig_id,histfig,bodies" }} }
|
func (x *{{ $obj.Name }}) RelatedToHf(id int) bool { return {{ $obj.Related "hfid,hf_id,_hf,hist_figure_id,Hfid,histfig_id,histfig,bodies" }} }
|
||||||
|
func (x *{{ $obj.Name }}) RelatedToArtifact(id int) bool { return {{ $obj.Related "artifact_id" }} }
|
||||||
|
func (x *{{ $obj.Name }}) RelatedToSite(id int) bool { return {{ $obj.Related "site_id" }} }
|
||||||
|
func (x *{{ $obj.Name }}) RelatedToRegion(id int) bool { return {{ $obj.Related "region_id" }} }
|
||||||
|
|
||||||
func (x *{{ $obj.Name }}) CheckFields() {
|
func (x *{{ $obj.Name }}) CheckFields() {
|
||||||
{{- range $field := ($obj.LegendFields "plus") }}
|
{{- range $field := ($obj.LegendFields "plus") }}
|
||||||
|
@ -129,7 +132,7 @@ func (x *{{ $obj.Name }}) CheckFields() {
|
||||||
{{- range $field2 := ($obj.LegendFields "base") }}
|
{{- range $field2 := ($obj.LegendFields "base") }}
|
||||||
{{- if eq $field.Type $field2.Type }}
|
{{- if eq $field.Type $field2.Type }}
|
||||||
{{- if eq $field.Type "int" }}
|
{{- if eq $field.Type "int" }}
|
||||||
if x.{{ $field.Name}} != x.{{ $field2.Name}} && x.{{ $field.Name}} != 0 && x.{{ $field2.Name}} != 0 {
|
if x.{{ $field.Name}} != x.{{ $field2.Name}} {
|
||||||
sameFields["{{$obj.Name}}"]["{{ $field.Name}}"]["{{ $field2.Name}}"] = false
|
sameFields["{{$obj.Name}}"]["{{ $field.Name}}"]["{{ $field2.Name}}"] = false
|
||||||
}
|
}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
|
|
|
@ -39,11 +39,15 @@
|
||||||
"BuilderHf": "BuilderHfid",
|
"BuilderHf": "BuilderHfid",
|
||||||
"Civ": "CivId",
|
"Civ": "CivId",
|
||||||
"Site": "SiteId",
|
"Site": "SiteId",
|
||||||
"SiteCiv": "SiteCivId"
|
"SiteCiv": "SiteCivId",
|
||||||
|
"Structure": "StructureId"
|
||||||
},
|
},
|
||||||
"HistoricalEventCreatureDevoured": {
|
"HistoricalEventCreatureDevoured": {
|
||||||
"Site": "SiteId"
|
"Site": "SiteId"
|
||||||
},
|
},
|
||||||
|
"HistoricalEventDiplomatLost": {
|
||||||
|
"Site": "SiteId"
|
||||||
|
},
|
||||||
"HistoricalEventEntityPrimaryCriminals": {
|
"HistoricalEventEntityPrimaryCriminals": {
|
||||||
"Entity": "EntityId",
|
"Entity": "EntityId",
|
||||||
"Site": "SiteId",
|
"Site": "SiteId",
|
||||||
|
@ -94,6 +98,21 @@
|
||||||
"Woundee": "WoundeeHfid",
|
"Woundee": "WoundeeHfid",
|
||||||
"Wounder": "WounderHfid"
|
"Wounder": "WounderHfid"
|
||||||
},
|
},
|
||||||
|
"HistoricalEventMasterpieceEngraving": {
|
||||||
|
"Maker": "Hfid",
|
||||||
|
"MakerEntity": "EntityId",
|
||||||
|
"Site": "SiteId"
|
||||||
|
},
|
||||||
|
"HistoricalEventMasterpieceItem": {
|
||||||
|
"Maker": "Hfid",
|
||||||
|
"MakerEntity": "EntityId",
|
||||||
|
"Site": "SiteId"
|
||||||
|
},
|
||||||
|
"HistoricalEventMerchant": {
|
||||||
|
"Destination": "DepotEntityId",
|
||||||
|
"Site": "SiteId",
|
||||||
|
"Source": "TraderEntityId"
|
||||||
|
},
|
||||||
"HistoricalEventPeaceAccepted": {
|
"HistoricalEventPeaceAccepted": {
|
||||||
"Site": "SiteId"
|
"Site": "SiteId"
|
||||||
},
|
},
|
||||||
|
@ -108,6 +127,13 @@
|
||||||
"HistoricalEventRemoveHfSiteLink": {
|
"HistoricalEventRemoveHfSiteLink": {
|
||||||
"Site": "SiteId"
|
"Site": "SiteId"
|
||||||
},
|
},
|
||||||
|
"HistoricalEventReplacedStructure": {
|
||||||
|
"Civ": "CivId",
|
||||||
|
"NewStructure": "NewAbId",
|
||||||
|
"OldStructure": "OldAbId",
|
||||||
|
"Site": "SiteId",
|
||||||
|
"SiteCiv": "SiteCivId"
|
||||||
|
},
|
||||||
"Structure": {},
|
"Structure": {},
|
||||||
"WrittenContent": {
|
"WrittenContent": {
|
||||||
"Author": "AuthorHfid"
|
"Author": "AuthorHfid"
|
||||||
|
|
|
@ -41,8 +41,14 @@ func main() {
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
"title": util.Title,
|
"title": util.Title,
|
||||||
|
"hf": model.LinkHf,
|
||||||
"getHf": func(id int) *model.HistoricalFigure { return world.HistoricalFigures[id] },
|
"getHf": func(id int) *model.HistoricalFigure { return world.HistoricalFigures[id] },
|
||||||
|
"entity": model.LinkEntity,
|
||||||
"getEntity": func(id int) *model.Entity { return world.Entities[id] },
|
"getEntity": func(id int) *model.Entity { return world.Entities[id] },
|
||||||
|
"site": model.LinkSite,
|
||||||
|
"getSite": func(id int) *model.Site { return world.Sites[id] },
|
||||||
|
"region": model.LinkRegion,
|
||||||
|
"getRegion": func(id int) *model.Region { return world.Regions[id] },
|
||||||
"events": func(obj model.Identifiable) []*model.HistoricalEvent {
|
"events": func(obj model.Identifiable) []*model.HistoricalEvent {
|
||||||
id := obj.Id()
|
id := obj.Id()
|
||||||
var list []*model.HistoricalEvent
|
var list []*model.HistoricalEvent
|
||||||
|
@ -59,6 +65,24 @@ func main() {
|
||||||
list = append(list, e)
|
list = append(list, e)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
case *model.Artifact:
|
||||||
|
for _, e := range world.HistoricalEvents {
|
||||||
|
if e.Details.RelatedToArtifact(id) {
|
||||||
|
list = append(list, e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case *model.Site:
|
||||||
|
for _, e := range world.HistoricalEvents {
|
||||||
|
if e.Details.RelatedToSite(id) {
|
||||||
|
list = append(list, e)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case *model.Region:
|
||||||
|
for _, e := range world.HistoricalEvents {
|
||||||
|
if e.Details.RelatedToRegion(id) {
|
||||||
|
list = append(list, e)
|
||||||
|
}
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
fmt.Printf("unknown type %T\n", obj)
|
fmt.Printf("unknown type %T\n", obj)
|
||||||
}
|
}
|
||||||
|
@ -150,6 +174,9 @@ func main() {
|
||||||
|
|
||||||
RegisterResourcePage(router, "/entity/{id}", t, "entity.html", func(id int) any { return world.Entities[id] })
|
RegisterResourcePage(router, "/entity/{id}", t, "entity.html", func(id int) any { return world.Entities[id] })
|
||||||
RegisterResourcePage(router, "/hf/{id}", t, "hf.html", func(id int) any { return world.HistoricalFigures[id] })
|
RegisterResourcePage(router, "/hf/{id}", t, "hf.html", func(id int) any { return world.HistoricalFigures[id] })
|
||||||
|
RegisterResourcePage(router, "/region/{id}", t, "region.html", func(id int) any { return world.Regions[id] })
|
||||||
|
RegisterResourcePage(router, "/site/{id}", t, "site.html", func(id int) any { return world.Sites[id] })
|
||||||
|
RegisterResourcePage(router, "/artifact/{id}", t, "artifact.html", func(id int) any { return world.Artifacts[id] })
|
||||||
RegisterPage(router, "/events", t, "eventTypes.html", func(p Parms) any { return allEventTypes() })
|
RegisterPage(router, "/events", t, "eventTypes.html", func(p Parms) any { return allEventTypes() })
|
||||||
RegisterPage(router, "/events/{type}", t, "eventType.html", func(p Parms) any { return eventsOfType(p["type"]) })
|
RegisterPage(router, "/events/{type}", t, "eventType.html", func(p Parms) any { return eventsOfType(p["type"]) })
|
||||||
}
|
}
|
||||||
|
|
|
@ -101,6 +101,10 @@ func (x *HistoricalEventAddHfSiteLink) Html() string {
|
||||||
return h + " took up residence in " + b + c + " " + s
|
return h + " took up residence in " + b + c + " " + s
|
||||||
case HistoricalEventAddHfSiteLinkLinkType_Occupation:
|
case HistoricalEventAddHfSiteLinkLinkType_Occupation:
|
||||||
return h + " started working at " + b + c + " " + s
|
return h + " started working at " + b + c + " " + s
|
||||||
|
case HistoricalEventAddHfSiteLinkLinkType_PrisonAbstractBuilding:
|
||||||
|
return h + " was imprisoned in " + b + c + " " + s
|
||||||
|
case HistoricalEventAddHfSiteLinkLinkType_PrisonSiteBuildingProfile:
|
||||||
|
return h + " was imprisoned in " + b + c + " " + s
|
||||||
case HistoricalEventAddHfSiteLinkLinkType_SeatOfPower:
|
case HistoricalEventAddHfSiteLinkLinkType_SeatOfPower:
|
||||||
return h + " ruled from " + b + c + " " + s
|
return h + " ruled from " + b + c + " " + s
|
||||||
default:
|
default:
|
||||||
|
@ -112,7 +116,9 @@ func (x *HistoricalEventAgreementFormed) Html() string { // TODO
|
||||||
return "UNKNWON HistoricalEventAgreementFormed"
|
return "UNKNWON HistoricalEventAgreementFormed"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *HistoricalEventAgreementMade) Html() string { return "UNKNWON HistoricalEventAgreementMade" } // TODO
|
func (x *HistoricalEventAgreementMade) Html() string { // TODO
|
||||||
|
return "UNKNWON HistoricalEventAgreementMade"
|
||||||
|
}
|
||||||
|
|
||||||
func (x *HistoricalEventAgreementRejected) Html() string { // TODO
|
func (x *HistoricalEventAgreementRejected) Html() string { // TODO
|
||||||
return "UNKNWON HistoricalEventAgreementRejected"
|
return "UNKNWON HistoricalEventAgreementRejected"
|
||||||
|
@ -143,9 +149,9 @@ func (x *HistoricalEventArtifactClaimFormed) Html() string {
|
||||||
|
|
||||||
func (x *HistoricalEventArtifactCopied) Html() string {
|
func (x *HistoricalEventArtifactCopied) Html() string {
|
||||||
s := util.If(x.FromOriginal, "made a copy of the original", "aquired a copy of")
|
s := util.If(x.FromOriginal, "made a copy of the original", "aquired a copy of")
|
||||||
return fmt.Sprintf("%s %s %s from %s%s of %s, keeping it within %s%s",
|
return fmt.Sprintf("%s %s %s %s of %s, keeping it%s",
|
||||||
entity(x.DestEntityId), s, artifact(x.ArtifactId), structure(x.SourceSiteId, x.SourceStructureId), site(x.SourceSiteId, " in "),
|
entity(x.DestEntityId), s, artifact(x.ArtifactId), siteStructure(x.SourceSiteId, x.SourceStructureId, "from"),
|
||||||
entity(x.SourceEntityId), structure(x.DestSiteId, x.DestStructureId), site(x.DestSiteId, " in "))
|
entity(x.SourceEntityId), siteStructure(x.DestSiteId, x.DestStructureId, "within"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *HistoricalEventArtifactCreated) Html() string {
|
func (x *HistoricalEventArtifactCreated) Html() string {
|
||||||
|
@ -176,13 +182,22 @@ func (x *HistoricalEventArtifactCreated) Html() string {
|
||||||
return fmt.Sprintf("%s received its name%s from %s %s", a, s, h, c)
|
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 fmt.Sprintf("%s was destroyed by %s in %s", artifact(x.ArtifactId), entity(x.DestroyerEnid), site(x.SiteId, ""))
|
return fmt.Sprintf("%s was destroyed by %s in %s", artifact(x.ArtifactId), entity(x.DestroyerEnid), site(x.SiteId, ""))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *HistoricalEventArtifactFound) Html() string {
|
func (x *HistoricalEventArtifactFound) Html() string {
|
||||||
return fmt.Sprintf("%s was found in %s by %s", artifact(x.ArtifactId), site(x.SiteId, ""), hf(x.HistFigureId))
|
w := ""
|
||||||
|
if x.SiteId != -1 {
|
||||||
|
w = site(x.SiteId, "")
|
||||||
|
if x.SitePropertyId != -1 {
|
||||||
|
w = property(x.SiteId, x.SitePropertyId) + " in " + w
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("%s was found in %s by %s", artifact(x.ArtifactId), w, util.If(x.HistFigureId != -1, hf(x.HistFigureId), "an unknown creature"))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *HistoricalEventArtifactGiven) Html() string {
|
func (x *HistoricalEventArtifactGiven) Html() string {
|
||||||
r := ""
|
r := ""
|
||||||
if x.ReceiverHistFigureId != -1 {
|
if x.ReceiverHistFigureId != -1 {
|
||||||
|
@ -216,6 +231,9 @@ func (x *HistoricalEventArtifactLost) Html() string {
|
||||||
}
|
}
|
||||||
if x.SiteId != -1 {
|
if x.SiteId != -1 {
|
||||||
w = site(x.SiteId, "")
|
w = site(x.SiteId, "")
|
||||||
|
if x.SitePropertyId != -1 {
|
||||||
|
w = property(x.SiteId, x.SitePropertyId) + " in " + w
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("%s was lost in %s", artifact(x.ArtifactId), w)
|
return fmt.Sprintf("%s was lost in %s", artifact(x.ArtifactId), w)
|
||||||
}
|
}
|
||||||
|
@ -255,14 +273,18 @@ func (x *HistoricalEventArtifactRecovered) Html() string {
|
||||||
if x.SiteId != -1 {
|
if x.SiteId != -1 {
|
||||||
w = site(x.SiteId, "in ")
|
w = site(x.SiteId, "in ")
|
||||||
if x.StructureId != -1 {
|
if x.StructureId != -1 {
|
||||||
w = "from " + structure(x.SiteId, x.StructureId) + " " + w
|
w = siteStructure(x.SiteId, x.StructureId, "from")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("%s was recovered %s by %s", a, w, h)
|
return fmt.Sprintf("%s was recovered %s by %s", a, w, h)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *HistoricalEventArtifactStored) Html() string {
|
func (x *HistoricalEventArtifactStored) Html() string { // TODO export siteProperty
|
||||||
return fmt.Sprintf("%s stored %s in %s", hf(x.HistFigureId), artifact(x.ArtifactId), site(x.SiteId, ""))
|
if x.HistFigureId != -1 {
|
||||||
|
return fmt.Sprintf("%s stored %s in %s", hf(x.HistFigureId), artifact(x.ArtifactId), site(x.SiteId, ""))
|
||||||
|
} else {
|
||||||
|
return fmt.Sprintf("%s was stored in %s", artifact(x.ArtifactId), site(x.SiteId, ""))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *HistoricalEventArtifactTransformed) Html() string {
|
func (x *HistoricalEventArtifactTransformed) Html() string {
|
||||||
|
@ -386,6 +408,7 @@ func (x *HistoricalEventChangeHfJob) Html() string {
|
||||||
return hf(x.Hfid) + " gave up being " + old + " to become a " + new + w
|
return hf(x.Hfid) + " gave up being " + old + " to become a " + new + w
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *HistoricalEventChangeHfState) Html() string {
|
func (x *HistoricalEventChangeHfState) Html() string {
|
||||||
r := ""
|
r := ""
|
||||||
switch x.Reason {
|
switch x.Reason {
|
||||||
|
@ -434,9 +457,11 @@ func (x *HistoricalEventChangeHfState) Html() string {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch x.Mood { // TODO catatonic
|
switch x.Mood {
|
||||||
case HistoricalEventChangeHfStateMood_Berserk:
|
case HistoricalEventChangeHfStateMood_Berserk:
|
||||||
return hf(x.Hfid) + " went berserk " + site(x.SiteId, "in") + r
|
return hf(x.Hfid) + " went berserk " + site(x.SiteId, "in") + r
|
||||||
|
case HistoricalEventChangeHfStateMood_Catatonic:
|
||||||
|
return hf(x.Hfid) + " stopped responding to the outside world " + site(x.SiteId, "in") + r
|
||||||
case HistoricalEventChangeHfStateMood_Fell:
|
case HistoricalEventChangeHfStateMood_Fell:
|
||||||
return hf(x.Hfid) + " was taken by a fell mood " + site(x.SiteId, "in") + r
|
return hf(x.Hfid) + " was taken by a fell mood " + site(x.SiteId, "in") + r
|
||||||
case HistoricalEventChangeHfStateMood_Fey:
|
case HistoricalEventChangeHfStateMood_Fey:
|
||||||
|
@ -502,12 +527,12 @@ func (x *HistoricalEventCreatedSite) Html() string {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *HistoricalEventCreatedStructure) Html() string { // TODO rebuild/rebuilt; Structure/StructureId
|
func (x *HistoricalEventCreatedStructure) Html() string { // TODO rebuild/rebuilt
|
||||||
if x.BuilderHfid != -1 {
|
if x.BuilderHfid != -1 {
|
||||||
return hf(x.BuilderHfid) + " thrust a spire of slade up from the underworld, naming it " + structure(x.SiteId, x.StructureId) +
|
return hf(x.BuilderHfid) + " thrust a spire of slade up from the underworld, naming it " + structure(x.SiteId, x.StructureId) +
|
||||||
", and established a gateway between worlds in " + site(x.SiteId, "")
|
", and established a gateway between worlds in " + site(x.SiteId, "")
|
||||||
}
|
}
|
||||||
return siteCiv(x.SiteCivId, x.CivId) + util.If(x.Rebuilt, " rebuild ", " constructed ") + structure(x.SiteId, x.StructureId) + site(x.SiteId, " in")
|
return siteCiv(x.SiteCivId, x.CivId) + util.If(x.Rebuilt, " rebuild ", " constructed ") + siteStructure(x.SiteId, x.StructureId, "")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *HistoricalEventCreatedWorldConstruction) Html() string {
|
func (x *HistoricalEventCreatedWorldConstruction) Html() string {
|
||||||
|
@ -539,22 +564,51 @@ func (x *HistoricalEventDanceFormCreated) Html() string {
|
||||||
case HistoricalEventDanceFormCreatedCircumstance_PrayToHf:
|
case HistoricalEventDanceFormCreatedCircumstance_PrayToHf:
|
||||||
circumstance = " after praying to " + hf(x.CircumstanceId)
|
circumstance = " after praying to " + hf(x.CircumstanceId)
|
||||||
}
|
}
|
||||||
return danceForm(x.FormId) + " was created by " + hf(x.HistFigureId) + site(x.SiteId, " in") + reason + circumstance
|
return danceForm(x.FormId) + " was created by " + hf(x.HistFigureId) + location(x.SiteId, " in", x.SubregionId, " in") + reason + circumstance
|
||||||
}
|
}
|
||||||
func (x *HistoricalEventDestroyedSite) Html() string { return "UNKNWON HistoricalEventDestroyedSite" }
|
|
||||||
func (x *HistoricalEventDiplomatLost) Html() string { return "UNKNWON HistoricalEventDiplomatLost" }
|
func (x *HistoricalEventDestroyedSite) Html() string { // TODO NoDefeatMention
|
||||||
|
return entity(x.AttackerCivId) + " defeated " + siteCiv(x.SiteCivId, x.DefenderCivId) + " and destroyed " + site(x.SiteId, "")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (x *HistoricalEventDiplomatLost) Html() string { // TODO
|
||||||
|
return "UNKNWON HistoricalEventDiplomatLost"
|
||||||
|
}
|
||||||
|
|
||||||
func (x *HistoricalEventEntityAllianceFormed) Html() string {
|
func (x *HistoricalEventEntityAllianceFormed) Html() string {
|
||||||
return "UNKNWON HistoricalEventEntityAllianceFormed"
|
return entityList(x.JoiningEnid) + " swore to support " + entity(x.InitiatingEnid) + " in war if the latter did likewise"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *HistoricalEventEntityBreachFeatureLayer) Html() string {
|
func (x *HistoricalEventEntityBreachFeatureLayer) Html() string {
|
||||||
return "UNKNWON HistoricalEventEntityBreachFeatureLayer"
|
return siteCiv(x.SiteEntityId, x.CivEntityId) + " breached the Underworld at " + site(x.SiteId, "")
|
||||||
}
|
}
|
||||||
func (x *HistoricalEventEntityCreated) Html() string { return "UNKNWON HistoricalEventEntityCreated" }
|
|
||||||
|
func (x *HistoricalEventEntityCreated) Html() string {
|
||||||
|
if x.CreatorHfid != -1 {
|
||||||
|
return hf(x.CreatorHfid) + " formed " + entity(x.EntityId) + siteStructure(x.SiteId, x.StructureId, "in")
|
||||||
|
} else {
|
||||||
|
return entity(x.EntityId) + " formed" + siteStructure(x.SiteId, x.StructureId, "in")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func (x *HistoricalEventEntityDissolved) Html() string {
|
func (x *HistoricalEventEntityDissolved) Html() string {
|
||||||
return "UNKNWON HistoricalEventEntityDissolved"
|
return entity(x.EntityId) + " dissolved after " + x.Reason.String()
|
||||||
}
|
}
|
||||||
func (x *HistoricalEventEntityEquipmentPurchase) Html() string {
|
func (x *HistoricalEventEntityEquipmentPurchase) Html() string { // todo check hfid
|
||||||
return "UNKNWON HistoricalEventEntityEquipmentPurchase"
|
l := ""
|
||||||
|
switch x.NewEquipmentLevel {
|
||||||
|
case 1:
|
||||||
|
l = "well-crafted"
|
||||||
|
case 2:
|
||||||
|
l = "finely-crafted"
|
||||||
|
case 3:
|
||||||
|
l = "superior quality"
|
||||||
|
case 4:
|
||||||
|
l = "exceptional"
|
||||||
|
case 5:
|
||||||
|
l = "masterwork"
|
||||||
|
}
|
||||||
|
return entity(x.EntityId) + " purchased " + l + " equipment"
|
||||||
}
|
}
|
||||||
func (x *HistoricalEventEntityExpelsHf) Html() string { return "UNKNWON HistoricalEventEntityExpelsHf" }
|
func (x *HistoricalEventEntityExpelsHf) Html() string { return "UNKNWON HistoricalEventEntityExpelsHf" }
|
||||||
func (x *HistoricalEventEntityFledSite) Html() string { return "UNKNWON HistoricalEventEntityFledSite" }
|
func (x *HistoricalEventEntityFledSite) Html() string { return "UNKNWON HistoricalEventEntityFledSite" }
|
||||||
|
@ -727,3 +781,10 @@ func (x *HistoricalEventTrade) Html() string { return "UNKNWON HistoricalEventTr
|
||||||
func (x *HistoricalEventWrittenContentComposed) Html() string {
|
func (x *HistoricalEventWrittenContentComposed) Html() string {
|
||||||
return "UNKNWON HistoricalEventWrittenContentComposed"
|
return "UNKNWON HistoricalEventWrittenContentComposed"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *HistoricalEventAgreementConcluded) Html() string {
|
||||||
|
return "UNKNWON HistoricalEventAgreementConcluded"
|
||||||
|
}
|
||||||
|
func (x *HistoricalEventMasterpieceDye) Html() string {
|
||||||
|
return "UNKNWON HistoricalEventMasterpieceDye"
|
||||||
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"html/template"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
@ -39,6 +40,9 @@ func (hf *HistoricalFigure) Male() bool {
|
||||||
type HistoricalEventDetails interface {
|
type HistoricalEventDetails interface {
|
||||||
RelatedToEntity(int) bool
|
RelatedToEntity(int) bool
|
||||||
RelatedToHf(int) bool
|
RelatedToHf(int) bool
|
||||||
|
RelatedToArtifact(int) bool
|
||||||
|
RelatedToSite(int) bool
|
||||||
|
RelatedToRegion(int) bool
|
||||||
Html() string
|
Html() string
|
||||||
Type() string
|
Type() string
|
||||||
}
|
}
|
||||||
|
@ -85,6 +89,10 @@ func entity(id int) string {
|
||||||
return "UNKNOWN ENTITY"
|
return "UNKNOWN ENTITY"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func entityList(ids []int) string {
|
||||||
|
return andList(util.Map(ids, entity))
|
||||||
|
}
|
||||||
|
|
||||||
func siteCiv(siteCivId, civId int) string {
|
func siteCiv(siteCivId, civId int) string {
|
||||||
if siteCivId == civId {
|
if siteCivId == civId {
|
||||||
return entity(civId)
|
return entity(civId)
|
||||||
|
@ -92,9 +100,16 @@ func siteCiv(siteCivId, civId int) string {
|
||||||
return util.If(siteCivId != -1, entity(siteCivId), "") + util.If(civId != -1 && siteCivId != -1, " of ", "") + util.If(civId != -1, entity(civId), "")
|
return util.If(siteCivId != -1, entity(siteCivId), "") + util.If(civId != -1 && siteCivId != -1, " of ", "") + util.If(civId != -1, entity(civId), "")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func siteStructure(siteId, structureId int, prefix string) string {
|
||||||
|
if siteId == -1 {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return " " + prefix + " " + util.If(structureId != -1, structure(siteId, structureId)+" in ", "") + site(siteId, "")
|
||||||
|
}
|
||||||
|
|
||||||
func hf(id int) string {
|
func hf(id int) string {
|
||||||
if x, ok := world.HistoricalFigures[id]; ok {
|
if x, ok := world.HistoricalFigures[id]; ok {
|
||||||
return fmt.Sprintf(`the %s <a class="hf" href="/hf/%d">%s</a>`, x.Race, x.Id(), util.Title(x.Name()))
|
return fmt.Sprintf(`the %s <a class="hf" href="/hf/%d">%s</a>`, x.Race+util.If(x.Deity, " deity", "")+util.If(x.Force, " force", ""), x.Id(), util.Title(x.Name()))
|
||||||
}
|
}
|
||||||
return "UNKNOWN HISTORICAL FIGURE"
|
return "UNKNOWN HISTORICAL FIGURE"
|
||||||
}
|
}
|
||||||
|
@ -214,3 +229,8 @@ func worldConstruction(id int) string {
|
||||||
}
|
}
|
||||||
return "UNKNOWN WORLD CONSTRUCTION"
|
return "UNKNOWN WORLD CONSTRUCTION"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var LinkHf = func(id int) template.HTML { return template.HTML(hf(id)) }
|
||||||
|
var LinkEntity = func(id int) template.HTML { return template.HTML(entity(id)) }
|
||||||
|
var LinkSite = func(id int) template.HTML { return template.HTML(site(id, "")) }
|
||||||
|
var LinkRegion = func(id int) template.HTML { return template.HTML(region(id)) }
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -5,11 +5,24 @@
|
||||||
"HistoricalEventAddHfSiteLink": {
|
"HistoricalEventAddHfSiteLink": {
|
||||||
"Site": "SiteId"
|
"Site": "SiteId"
|
||||||
},
|
},
|
||||||
|
"HistoricalEventAgreementMade": {
|
||||||
|
"Destination": "SiteId",
|
||||||
|
"Site": "SiteId",
|
||||||
|
"Source": "SiteId"
|
||||||
|
},
|
||||||
|
"HistoricalEventAgreementRejected": {
|
||||||
|
"Destination": "SiteId",
|
||||||
|
"Site": "SiteId",
|
||||||
|
"Source": "SiteId"
|
||||||
|
},
|
||||||
"HistoricalEventDiplomatLost": {
|
"HistoricalEventDiplomatLost": {
|
||||||
"Entity": "SiteId",
|
"Entity": "SiteId",
|
||||||
"Involved": "SiteId",
|
"Involved": "SiteId",
|
||||||
"Site": "SiteId"
|
"Site": "SiteId"
|
||||||
},
|
},
|
||||||
|
"HistoricalEventHfDied": {
|
||||||
|
"ShooterArtifactId": "FeatureLayerId"
|
||||||
|
},
|
||||||
"HistoricalEventPeaceAccepted": {
|
"HistoricalEventPeaceAccepted": {
|
||||||
"Site": "SiteId"
|
"Site": "SiteId"
|
||||||
},
|
},
|
||||||
|
@ -21,12 +34,5 @@
|
||||||
},
|
},
|
||||||
"HistoricalEventRemoveHfSiteLink": {
|
"HistoricalEventRemoveHfSiteLink": {
|
||||||
"Site": "SiteId"
|
"Site": "SiteId"
|
||||||
},
|
|
||||||
"HistoricalEventReplacedStructure": {
|
|
||||||
"Civ": "OldAbId",
|
|
||||||
"NewStructure": "OldAbId",
|
|
||||||
"OldStructure": "OldAbId",
|
|
||||||
"Site": "OldAbId",
|
|
||||||
"SiteCiv": "OldAbId"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,13 @@
|
||||||
|
{{template "layout.html" .}}
|
||||||
|
|
||||||
|
{{define "title"}}{{ title .Name }}{{end}}
|
||||||
|
|
||||||
|
{{define "content"}}
|
||||||
|
<h1>{{ title .Name }}</h1>
|
||||||
|
|
||||||
|
<h3>Events</h3>
|
||||||
|
|
||||||
|
{{ template "events.html" events . }}
|
||||||
|
|
||||||
|
<p>{{ json . }}</p>
|
||||||
|
{{- end }}
|
|
@ -1 +0,0 @@
|
||||||
<a href="/entity/{{ .Id }}">{{ title .Name }}</a>
|
|
|
@ -12,13 +12,13 @@
|
||||||
<ul>
|
<ul>
|
||||||
{{- range $i := .EntityFormerPositionLink }}
|
{{- range $i := .EntityFormerPositionLink }}
|
||||||
<li>
|
<li>
|
||||||
{{ ((getEntity $i.EntityId).Position $i.PositionProfileId).Name }} of {{ template "entityLink.html" (getEntity $i.EntityId) }} ({{
|
{{ ((getEntity $i.EntityId).Position $i.PositionProfileId).Name }} of {{ entity $i.EntityId }} ({{
|
||||||
$i.StartYear }} - {{ $i.EndYear }})
|
$i.StartYear }} - {{ $i.EndYear }})
|
||||||
</li>
|
</li>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
{{- range $i := .EntityPositionLink }}
|
{{- range $i := .EntityPositionLink }}
|
||||||
<li>
|
<li>
|
||||||
of {{ template "entityLink.html" (getEntity $i.EntityId) }}
|
of {{ entity $i.EntityId }}
|
||||||
</li>
|
</li>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -29,7 +29,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
{{- range $i := .HfLink }}
|
{{- range $i := .HfLink }}
|
||||||
<li>
|
<li>
|
||||||
{{ template "hfLink.html" (getHf $i.Hfid) }} ({{ $i.LinkType }})
|
{{ hf $i.Hfid }} ({{ $i.LinkType }})
|
||||||
</li>
|
</li>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</ul>
|
</ul>
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
{{- range $i := .EntityLink }}
|
{{- range $i := .EntityLink }}
|
||||||
<li>
|
<li>
|
||||||
{{ template "entityLink.html" (getEntity $i.EntityId) }} ({{ $i.LinkType }})
|
{{ entity $i.EntityId }} ({{ $i.LinkType }})
|
||||||
</li>
|
</li>
|
||||||
{{- end }}
|
{{- end }}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
the
|
|
||||||
{{ .Race }}
|
|
||||||
{{ check .Deity "deity"}}
|
|
||||||
{{ check .Force "force"}}
|
|
||||||
<a href="/hf/{{ .Id }}">{{ title .Name }}</a>
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
{{template "layout.html" .}}
|
||||||
|
|
||||||
|
{{define "title"}}{{ title .Name }}{{end}}
|
||||||
|
|
||||||
|
{{define "content"}}
|
||||||
|
<h1>{{ title .Name }}</h1>
|
||||||
|
|
||||||
|
<h3>Events</h3>
|
||||||
|
|
||||||
|
{{ template "events.html" events . }}
|
||||||
|
|
||||||
|
<p>{{ json . }}</p>
|
||||||
|
{{- end }}
|
|
@ -0,0 +1,13 @@
|
||||||
|
{{template "layout.html" .}}
|
||||||
|
|
||||||
|
{{define "title"}}{{ title .Name }}{{end}}
|
||||||
|
|
||||||
|
{{define "content"}}
|
||||||
|
<h1>{{ title .Name }}</h1>
|
||||||
|
|
||||||
|
<h3>Events</h3>
|
||||||
|
|
||||||
|
{{ template "events.html" events . }}
|
||||||
|
|
||||||
|
<p>{{ json . }}</p>
|
||||||
|
{{- end }}
|
Loading…
Reference in New Issue