示例#1
0
文件: character.go 项目: beoran/woe
// Save a character as a sitef file.
func (me *Character) Save(dirname string) (err error) {
	path := SavePathFor(dirname, "character", me.ID)

	rec := sitef.NewRecord()
	me.SaveSirec(rec)
	monolog.Debug("Saving Character record: %s %v", path, rec)
	return sitef.SaveRecord(path, *rec)
}
示例#2
0
文件: world.go 项目: beoran/woe
// Save an account as a sitef file.
func (me *World) Save(dirname string) (err error) {
	path := SavePathFor(dirname, "world", me.Name)

	rec := sitef.NewRecord()
	rec.Put("name", me.Name)
	rec.Put("motd", me.MOTD)
	monolog.Debug("Saving World record: %s %v", path, rec)
	return sitef.SaveRecord(path, *rec)
}
示例#3
0
文件: account.go 项目: beoran/woe
// Save an account as a sitef file.
func (me *Account) Save(dirname string) (err error) {
	path := SavePathFor(dirname, "account", me.Name)

	rec := sitef.NewRecord()
	rec.Put("name", me.Name)
	rec.Put("hash", me.Hash)
	rec.Put("algo", me.Algo)
	rec.Put("email", me.Email)
	rec.PutInt("points", me.Points)
	rec.PutInt("privilege", int(me.Privilege))
	rec.PutInt("characters", len(me.characters))
	for i, chara := range me.characters {
		key := fmt.Sprintf("characters[%d]", i)
		rec.Put(key, chara.ID)

	}
	monolog.Debug("Saving Acccount record: %s %v", path, rec)
	return sitef.SaveRecord(path, *rec)
}