コード例 #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)
}