Пример #1
0
// 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
// 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
// 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)
}