本文整理汇总了Golang中github.com/beoran/woe/sitef.Record类的典型用法代码示例。如果您正苦于以下问题:Golang Record类的具体用法?Golang Record怎么用?Golang Record使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Record类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: SaveSitef
// Save a being to a sitef record.
func (me *Being) SaveSitef(rec *sitef.Record) (err error) {
me.Entity.SaveSitef(rec)
rec.PutInt("level", me.Level)
if me.Gender != nil {
rec.Put("gender", me.Gender.ID)
}
if me.Job != nil {
rec.Put("job", me.Job.ID)
}
if me.Kin != nil {
rec.Put("kin", me.Kin.ID)
}
me.Talents.SaveSitef(rec)
me.Vitals.SaveSitef(rec)
me.EquipmentValues.SaveSitef(rec)
me.Aptitudes.SaveSitef(rec)
me.Inventory.SaveSitef(rec)
if me.Room != nil {
rec.Put("room", me.Room.ID)
}
return nil
}
示例2: LoadSitef
// Load a being from a sitef record.
func (me *Being) LoadSitef(rec sitef.Record) (err error) {
me.Entity.LoadSitef(rec)
me.Level = rec.GetIntDefault("level", 1)
me.Gender = EntitylikeToGender(GenderEntityList.FindID(rec.Get("gender")))
me.Job = EntitylikeToJob(JobEntityList.FindID(rec.Get("job")))
me.Kin = EntitylikeToKin(KinEntityList.FindID(rec.Get("kin")))
me.Talents.LoadSitef(rec)
me.Vitals.LoadSitef(rec)
me.EquipmentValues.LoadSitef(rec)
me.Aptitudes.LoadSitef(rec)
me.Inventory.LoadSitef(rec)
if rec.Get("room") != "" {
var err error
me.Room, err = DefaultWorld.LoadRoom(rec.Get("room"))
if err != nil {
monolog.WriteError(err)
return err
}
}
return nil
}
示例3: SaveSitef
func (me *Equipment) SaveSitef(rec sitef.Record) (err error) {
for k, v := range me.Equipped {
if v != nil {
key := fmt.Sprintf("equipment[%s]", k)
rec.Put(key, v.ID)
}
}
return nil
}
示例4: LoadSirec
// Load a character from a sitef record.
func (me *Character) LoadSirec(rec sitef.Record) (err error) {
aname := rec.Get("accountname")
account, err := DefaultWorld.LoadAccount(aname)
if err != nil {
return err
}
me.Account = account
me.Being.LoadSitef(rec)
return nil
}
示例5: LoadSitef
func (me *Equipment) LoadSitef(rec sitef.Record, world *World, dirname string) (err error) {
for k := range EquipWhereList {
key := fmt.Sprintf("equipment[%s]", k)
val, ok := rec.MayGet(key)
if ok {
item, err := world.LoadItem(val)
if item != nil && err == nil {
me.Equipped[EquipWhere(k)] = item
}
}
}
return nil
}
示例6: LoadSitef
// Load an entity from a sitef record.
func (me *Entity) LoadSitef(rec sitef.Record) (err error) {
me.ID = rec.Get("id")
me.Name = rec.Get("name")
me.Short = rec.Get("short")
me.Long = rec.Get("long")
return nil
}
示例7: SaveSitef
// Save an entity to a sitef record.
func (me *Entity) SaveSitef(rec *sitef.Record) (err error) {
rec.Put("id", me.ID)
rec.Put("name", me.Name)
rec.Put("short", me.Short)
rec.Put("long", me.Long)
return nil
}
示例8: SaveSirec
// Save a character into a a sitef record.
func (me *Character) SaveSirec(rec *sitef.Record) (err error) {
rec.Put("accountname", me.Account.Name)
me.Being.SaveSitef(rec)
return nil
}