Documentation
¶
Index ¶
- Variables
- func CreateTables(db *pg.DB) error
- func Delete(db *pg.DB, userID uint64, req structs.NcAvatarEraseReq) error
- func DeleteTables(db *pg.DB) error
- func New(db *pg.DB, userID uint64, req structs.NcAvatarCreateReq) (structs.AvatarInformation, error)
- func Validate(db *pg.DB, userID uint64, req structs.NcAvatarCreateReq) error
- type Appearance
- type Attributes
- type Character
- func (c *Character) AllEquippedItems(db *pg.DB) *structs.NcCharClientItemCmd
- func (c *Character) InventoryItems(db *pg.DB) *structs.NcCharClientItemCmd
- func (c *Character) MiniHouseItems(db *pg.DB) *structs.NcCharClientItemCmd
- func (c *Character) NcRepresentation() structs.AvatarInformation
- func (c *Character) PremiumActionItems(db *pg.DB) *structs.NcCharClientItemCmd
- type ClientOptions
- type EquippedItems
- type ErrCharacter
- type Items
- type Location
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidClassGender = &ErrCharacter{
Code: 4,
Message: "invalid class gender data",
}
ErrInvalidClassGender happens if the client tries to bypass client side verification
var ErrInvalidName = &ErrCharacter{
Code: 3,
Message: "invalid name",
}
ErrInvalidName happens if the client tries to bypass client side verification
var ErrInvalidSlot = &ErrCharacter{
Code: 0,
Message: "invalid slot",
}
ErrInvalidSlot happens if the client tries to bypass client side verification
var ErrNameTaken = &ErrCharacter{
Code: 1,
Message: "name taken",
}
ErrNameTaken name is reserved or in use
var ErrNoSlot = &ErrCharacter{
Code: 2,
Message: "no slot available",
}
ErrNoSlot happens if the client tries to bypass client side verification
Functions ¶
func Delete ¶
func Delete(db *pg.DB, userID uint64, req structs.NcAvatarEraseReq) error
Delete character for User with userID soft deletion is performed
func New ¶
func New(db *pg.DB, userID uint64, req structs.NcAvatarCreateReq) (structs.AvatarInformation, error)
New creates character for the User with userID and returns data the client can understand
Types ¶
type Appearance ¶
type Appearance struct { ID uint64 CharacterID uint64 // Character *Character Class uint8 `pg:",notnull"` Gender uint8 `pg:",notnull,use_zero"` HairType uint8 `pg:",notnull,use_zero"` HairColor uint8 `pg:",notnull,use_zero"` FaceType uint8 `pg:",notnull,use_zero"` CreatedAt time.Time UpdatedAt time.Time DeletedAt time.Time `pg:",soft_delete"` // contains filtered or unexported fields }
Appearance model for the database layer
func (*Appearance) NcRepresentation ¶ added in v0.0.2
func (ca *Appearance) NcRepresentation() structs.ProtoAvatarShapeInfo
NcRepresentation returns a struct that can be serialized into bytes and can be sent to the client
type Attributes ¶
type Attributes struct { ID uint64 CharacterID uint64 Character *Character Level uint8 `pg:",notnull"` Experience uint64 `pg:",notnull,use_zero"` Fame uint32 `pg:",notnull,use_zero"` Hp uint32 `pg:",notnull"` Sp uint32 `pg:",notnull"` Intelligence uint8 `pg:",notnull,use_zero"` Strength uint8 `pg:",notnull,use_zero"` Dexterity uint8 `pg:",notnull,use_zero"` Endurance uint8 `pg:",notnull,use_zero"` Spirit uint8 `pg:",notnull,use_zero"` Money uint64 `pg:",notnull,use_zero"` KillPoints uint32 `pg:",notnull,use_zero"` HpStones uint16 `pg:",notnull"` SpStones uint16 `pg:",notnull"` CreatedAt time.Time UpdatedAt time.Time DeletedAt time.Time `pg:",soft_delete"` // contains filtered or unexported fields }
Attributes model for the database layer
type Character ¶
type Character struct { ID uint64 UserID uint64 `pg:",notnull"` Name string `pg:",notnull,unique"` Appearance *Appearance Attributes *Attributes Location *Location Options *ClientOptions Items []Items EquippedItems *EquippedItems AdminLevel uint8 `pg:",notnull,use_zero"` Slot uint8 `pg:",notnull,use_zero"` IsDeleted bool `pg:",use_zero"` CreatedAt time.Time UpdatedAt time.Time DeletedAt time.Time `pg:",soft_delete"` // contains filtered or unexported fields }
Character model for the database layer
func (*Character) AllEquippedItems ¶ added in v0.0.3
func (c *Character) AllEquippedItems(db *pg.DB) *structs.NcCharClientItemCmd
enum ItemEquipEnum
{ ITEMEQUIP_NONE = 0x0, ITEMEQUIP_HAT = 0x1, ITEMEQUIP_NOUSE03 = 0x2, ITEMEQUIP_NOUSE01 = 0x3, ITEMEQUIP_NOUSE02 = 0x4, ITEMEQUIP_FACETATTOO = 0x5, ITEMEQUIP_NECKLACE = 0x6, ITEMEQUIP_BODY = 0x7, ITEMEQUIP_BODYACC = 0x8, ITEMEQUIP_BACK = 0x9, ITEMEQUIP_LEFTHAND = 0xA, ITEMEQUIP_LEFTHANDACC = 0xB, ITEMEQUIP_RIGHTHAND = 0xC, ITEMEQUIP_RIGHTHANDACC = 0xD, ITEMEQUIP_BRACELET = 0xE, ITEMEQUIP_LEFTRING = 0xF, ITEMEQUIP_RIGHTRING = 0x10, ITEMEQUIP_COSEFF = 0x11, ITEMEQUIP_TAIL = 0x12, ITEMEQUIP_LEG = 0x13, ITEMEQUIP_LEGACC = 0x14, ITEMEQUIP_SHOES = 0x15, ITEMEQUIP_SHOESACC = 0x16, ITEMEQUIP_EARRING = 0x17, ITEMEQUIP_MOUTH = 0x18, ITEMEQUIP_MINIMON = 0x19, ITEMEQUIP_EYE = 0x1A, ITEMEQUIP_HATACC = 0x1B, ITEMEQUIP_MINIMON_R = 0x1C, ITEMEQUIP_SHIELDACC = 0x1D, MAX_ITEMEQUIPENUM = 0x1E, };
func (*Character) InventoryItems ¶ added in v0.0.3
func (c *Character) InventoryItems(db *pg.DB) *structs.NcCharClientItemCmd
func (*Character) MiniHouseItems ¶ added in v0.0.3
func (c *Character) MiniHouseItems(db *pg.DB) *structs.NcCharClientItemCmd
func (*Character) NcRepresentation ¶ added in v0.0.2
func (c *Character) NcRepresentation() structs.AvatarInformation
NcRepresentation returns a struct that can be serialized into bytes and can be sent to the client
func (*Character) PremiumActionItems ¶ added in v0.0.3
func (c *Character) PremiumActionItems(db *pg.DB) *structs.NcCharClientItemCmd
type ClientOptions ¶ added in v0.0.3
type EquippedItems ¶
type EquippedItems struct { ID uint64 CharacterID uint64 // Character *Character Head uint16 Face uint16 Body uint16 Pants uint16 Boots uint16 LeftHand uint16 RightHand uint16 LeftMiniPet uint16 RightMiniPet uint16 ApparelHead uint16 ApparelFace uint16 ApparelEye uint16 ApparelBody uint16 ApparelPants uint16 ApparelBoots uint16 ApparelLeftHand uint16 ApparelRightHand uint16 ApparelBack uint16 ApparelTail uint16 ApparelAura uint16 ApparelShield uint16 DeletedAt time.Time `pg:",soft_delete"` // contains filtered or unexported fields }
EquippedItems model for the database layer
func (*EquippedItems) NcRepresentation ¶ added in v0.0.2
func (cei *EquippedItems) NcRepresentation() structs.ProtoEquipment
NcRepresentation returns a struct that can be serialized into bytes and can be sent to the client
type ErrCharacter ¶
ErrCharacter is used to handle known errors
func (*ErrCharacter) Error ¶
func (ec *ErrCharacter) Error() string
type Items ¶ added in v0.0.3
type Items struct { //ID uint64 CharacterID uint64 `pg:",pk,use_zero"` Character *Character // box 2 = reward inventory // box 3 = mini house furniture // box 8 = equipped items // box 9 = inventory, storage // box 12 = mini houses // box 13 = mini house accessories // box 14 = mini house tile all inventory // box 15 = premium actions inventory(dances) // box 16 = mini house mini game inventory InventoryType int `pg:",pk,use_zero"` Slot uint16 `pg:",pk,use_zero"` ShnID uint16 `pg:",notnull"` Stackable bool `pg:",notnull,use_zero"` Amount uint32 CreatedAt time.Time UpdatedAt time.Time DeletedAt time.Time `pg:",soft_delete"` // contains filtered or unexported fields }
type Location ¶
type Location struct { ID uint64 CharacterID uint64 // Character *Character MapName string `pg:",notnull"` X uint32 `pg:",notnull"` Y uint32 `pg:",notnull"` D uint8 `pg:",notnull,use_zero"` IsKQ bool `pg:",notnull,use_zero"` CreatedAt time.Time UpdatedAt time.Time DeletedAt time.Time `pg:",soft_delete"` // contains filtered or unexported fields }
Location model for the database layer