Documentation ¶
Index ¶
- Constants
- func DeleteObject(obj datastore.Identifiable) error
- func DirectionToString(dir Direction) string
- func Find(t datastore.ObjectType, key string, value interface{}) []bson.ObjectId
- func FindAll(t datastore.ObjectType) []bson.ObjectId
- func Init(session Session, dbName string)
- func ItemNames(items []*Item) []string
- func RetrieveObjects(t datastore.ObjectType, objects interface{}) error
- func UserNames(users []*User) []string
- type Area
- type Areas
- type Character
- func (self *Character) AddCash(amount int)
- func (self *Character) AddItem(item *Item)
- func (self *Character) GetCash() int
- func (self *Character) GetHealth() int
- func (self *Character) GetHitPoints() int
- func (self *Character) GetItemIds() []bson.ObjectId
- func (self *Character) GetName() string
- func (self *Character) GetRoomId() bson.ObjectId
- func (self *Character) GetType() datastore.ObjectType
- func (self *Character) HasItem(item *Item) bool
- func (self *Character) Heal(hitpoints int)
- func (self *Character) Hit(hitpoints int)
- func (self *Character) RemoveItem(item *Item)
- func (self *Character) SetCash(cash int)
- func (self *Character) SetHealth(health int)
- func (self *Character) SetHitPoints(hitpoints int)
- func (self *Character) SetName(name string)
- func (self *Character) SetObjectType(t datastore.ObjectType)
- func (self *Character) SetRoomId(id bson.ObjectId)
- type CharacterList
- type Collection
- type Coordinate
- type Database
- type DbObject
- type Direction
- type Item
- type Iterator
- type MongoCollection
- func (mc MongoCollection) DropCollection() error
- func (mc MongoCollection) Find(selector interface{}) Query
- func (mc MongoCollection) Remove(selector interface{}) error
- func (mc MongoCollection) RemoveId(id interface{}) error
- func (mc MongoCollection) UpdateId(id interface{}, change interface{}) error
- func (mc MongoCollection) UpsertId(id interface{}, change interface{}) error
- type MongoDatabase
- type MongoIterator
- type MongoQuery
- type MongoSession
- type NonPlayerChar
- type NonPlayerCharList
- type PlayerChar
- type PlayerCharList
- type Query
- type Room
- func (self *Room) AddItem(item *Item)
- func (self *Room) GetAreaId() bson.ObjectId
- func (self *Room) GetDescription() string
- func (self *Room) GetExits() []Direction
- func (self *Room) GetItemIds() []bson.ObjectId
- func (self *Room) GetLocation() Coordinate
- func (self *Room) GetProperties() map[string]string
- func (self *Room) GetProperty(name string) string
- func (self *Room) GetTitle() string
- func (self *Room) GetType() datastore.ObjectType
- func (self *Room) GetZoneId() bson.ObjectId
- func (self *Room) HasExit(dir Direction) bool
- func (self *Room) HasItem(item *Item) bool
- func (self *Room) NextLocation(direction Direction) Coordinate
- func (self *Room) RemoveItem(item *Item)
- func (self *Room) RemoveProperty(key string)
- func (self *Room) SetAreaId(areaId bson.ObjectId)
- func (self *Room) SetDescription(description string)
- func (self *Room) SetExitEnabled(dir Direction, enabled bool)
- func (self *Room) SetLocation(location Coordinate)
- func (self *Room) SetProperty(name, value string)
- func (self *Room) SetTitle(title string)
- func (self *Room) SetZoneId(zoneId bson.ObjectId)
- func (self *Room) ToString(players []*PlayerChar, npcs []*NonPlayerChar, items []*Item, area *Area) string
- type Rooms
- type Session
- type Time
- type User
- func (self *User) GetColorMode() utils.ColorMode
- func (self *User) GetConnection() net.Conn
- func (self *User) GetInput(text string) string
- func (self *User) GetName() string
- func (self *User) GetPassword() []byte
- func (self *User) GetType() datastore.ObjectType
- func (self *User) Online() bool
- func (self *User) SetColorMode(cm utils.ColorMode)
- func (self *User) SetConnection(conn net.Conn)
- func (self *User) SetOnline(online bool)
- func (self *User) SetPassword(password string)
- func (self *User) SetTerminalType(tt string)
- func (self *User) SetWindowSize(width int, height int)
- func (self *User) TerminalType() string
- func (self *User) VerifyPassword(password string) bool
- func (self *User) WindowSize() (width int, height int)
- func (self *User) Write(text string) (int, error)
- func (self *User) WriteLine(line string) (int, error)
- type Users
- type World
- type Zone
- type Zones
Constants ¶
View Source
const ( SET = "$set" PUSH = "$push" PULL = "$pull" )
MongDB operations
View Source
const ( NpcType datastore.ObjectType = iota PcType datastore.ObjectType = iota UserType datastore.ObjectType = iota ZoneType datastore.ObjectType = iota AreaType datastore.ObjectType = iota RoomType datastore.ObjectType = iota ItemType datastore.ObjectType = iota )
Variables ¶
This section is empty.
Functions ¶
func DeleteObject ¶
func DeleteObject(obj datastore.Identifiable) error
func DirectionToString ¶
func RetrieveObjects ¶
func RetrieveObjects(t datastore.ObjectType, objects interface{}) error
Types ¶
type Character ¶
type Character struct { DbObject `bson:",inline"` RoomId bson.ObjectId `bson:",omitempty"` Name string Cash int Inventory []bson.ObjectId Health int HitPoints int // contains filtered or unexported fields }
func (*Character) GetHitPoints ¶
func (*Character) GetItemIds ¶
func (*Character) GetType ¶
func (self *Character) GetType() datastore.ObjectType
func (*Character) RemoveItem ¶
func (*Character) SetHitPoints ¶
func (*Character) SetObjectType ¶
func (self *Character) SetObjectType(t datastore.ObjectType)
Used when loading existing characters from the DB
type CharacterList ¶
type CharacterList []*Character
func (CharacterList) Names ¶
func (self CharacterList) Names() []string
type Collection ¶
type Coordinate ¶
func (*Coordinate) Next ¶
func (self *Coordinate) Next(direction Direction) Coordinate
type Database ¶
type Database interface {
C(string) Collection
}
type DbObject ¶
func (*DbObject) IsDestroyed ¶
func (*DbObject) ReadUnlock ¶
func (self *DbObject) ReadUnlock()
func (*DbObject) WriteUnlock ¶
func (self *DbObject) WriteUnlock()
type Direction ¶
type Direction int
const ( DirectionNorth Direction = iota DirectionNorthEast Direction = iota DirectionEast Direction = iota DirectionSouthEast Direction = iota DirectionSouth Direction = iota DirectionSouthWest Direction = iota DirectionWest Direction = iota DirectionNorthWest Direction = iota DirectionUp Direction = iota DirectionDown Direction = iota DirectionNone Direction = iota )
func StringToDirection ¶
type MongoCollection ¶
type MongoCollection struct {
// contains filtered or unexported fields
}
func (MongoCollection) DropCollection ¶
func (mc MongoCollection) DropCollection() error
func (MongoCollection) Find ¶
func (mc MongoCollection) Find(selector interface{}) Query
func (MongoCollection) Remove ¶
func (mc MongoCollection) Remove(selector interface{}) error
func (MongoCollection) RemoveId ¶
func (mc MongoCollection) RemoveId(id interface{}) error
func (MongoCollection) UpdateId ¶
func (mc MongoCollection) UpdateId(id interface{}, change interface{}) error
func (MongoCollection) UpsertId ¶
func (mc MongoCollection) UpsertId(id interface{}, change interface{}) error
type MongoDatabase ¶
type MongoDatabase struct {
// contains filtered or unexported fields
}
func (MongoDatabase) C ¶
func (md MongoDatabase) C(collectionName string) Collection
type MongoIterator ¶
type MongoIterator struct {
// contains filtered or unexported fields
}
func (MongoIterator) All ¶
func (mi MongoIterator) All(result interface{}) error
type MongoQuery ¶
type MongoQuery struct {
// contains filtered or unexported fields
}
func (MongoQuery) Count ¶
func (mq MongoQuery) Count() (int, error)
func (MongoQuery) Iter ¶
func (mq MongoQuery) Iter() Iterator
func (MongoQuery) One ¶
func (mq MongoQuery) One(result interface{}) error
type MongoSession ¶
type MongoSession struct {
// contains filtered or unexported fields
}
func NewMongoSession ¶
func NewMongoSession(session *mgo.Session) *MongoSession
func (MongoSession) DB ¶
func (ms MongoSession) DB(dbName string) Database
type NonPlayerChar ¶
func NewNonPlayerChar ¶
func NewNonPlayerChar(name string, roomId bson.ObjectId) *NonPlayerChar
func (*NonPlayerChar) GetConversation ¶
func (self *NonPlayerChar) GetConversation() string
func (*NonPlayerChar) GetRoaming ¶
func (self *NonPlayerChar) GetRoaming() bool
func (*NonPlayerChar) PrettyConversation ¶
func (self *NonPlayerChar) PrettyConversation() string
func (*NonPlayerChar) SetConversation ¶
func (self *NonPlayerChar) SetConversation(conversation string)
func (*NonPlayerChar) SetRoaming ¶
func (self *NonPlayerChar) SetRoaming(roaming bool)
type NonPlayerCharList ¶
type NonPlayerCharList []*NonPlayerChar
func (NonPlayerCharList) Characters ¶
func (self NonPlayerCharList) Characters() CharacterList
type PlayerChar ¶
type PlayerChar struct { Character `bson:",inline"` UserId bson.ObjectId // contains filtered or unexported fields }
func NewPlayerChar ¶
func (*PlayerChar) GetUserId ¶
func (self *PlayerChar) GetUserId() bson.ObjectId
func (*PlayerChar) IsOnline ¶
func (self *PlayerChar) IsOnline() bool
func (*PlayerChar) SetOnline ¶
func (self *PlayerChar) SetOnline(online bool)
func (*PlayerChar) SetUserId ¶
func (self *PlayerChar) SetUserId(id bson.ObjectId)
type PlayerCharList ¶
type PlayerCharList []*PlayerChar
func (PlayerCharList) Characters ¶
func (self PlayerCharList) Characters() CharacterList
type Room ¶
type Room struct { DbObject `bson:",inline"` ZoneId bson.ObjectId AreaId bson.ObjectId `bson:",omitempty"` Title string Description string Items []bson.ObjectId Location Coordinate ExitNorth bool ExitNorthEast bool ExitEast bool ExitSouthEast bool ExitSouth bool ExitSouthWest bool ExitWest bool ExitNorthWest bool ExitUp bool ExitDown bool Properties map[string]string }
func (*Room) GetDescription ¶
func (*Room) GetItemIds ¶
func (*Room) GetLocation ¶
func (self *Room) GetLocation() Coordinate
func (*Room) GetProperties ¶
func (*Room) GetProperty ¶
func (*Room) GetType ¶
func (self *Room) GetType() datastore.ObjectType
func (*Room) NextLocation ¶
func (self *Room) NextLocation(direction Direction) Coordinate
func (*Room) RemoveItem ¶
func (*Room) RemoveProperty ¶
func (*Room) SetDescription ¶
func (*Room) SetExitEnabled ¶
func (*Room) SetLocation ¶
func (self *Room) SetLocation(location Coordinate)
func (*Room) SetProperty ¶
func (*Room) ToString ¶
func (self *Room) ToString(players []*PlayerChar, npcs []*NonPlayerChar, items []*Item, area *Area) string
type User ¶
type User struct { DbObject `bson:",inline"` Name string ColorMode utils.ColorMode Password []byte // contains filtered or unexported fields }
func (*User) GetColorMode ¶
func (*User) GetConnection ¶
func (*User) GetPassword ¶
GetPassword returns the SHA1 of the user's password
func (*User) GetType ¶
func (self *User) GetType() datastore.ObjectType
func (*User) SetColorMode ¶
func (*User) SetConnection ¶
func (*User) SetPassword ¶
SetPassword SHA1 hashes the password before saving it to the database
func (*User) SetTerminalType ¶
func (*User) SetWindowSize ¶
func (*User) TerminalType ¶
func (*User) VerifyPassword ¶
func (*User) WindowSize ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.