Skip to content

Commit

Permalink
Fix equipping decorations.
Browse files Browse the repository at this point in the history
  • Loading branch information
jchv committed Jun 29, 2023
1 parent 6258b73 commit 8efc797
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 38 deletions.
9 changes: 7 additions & 2 deletions database/accounts/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ import (
"database/sql"
"errors"
"fmt"
"log"
"time"

"github.com/google/uuid"
"github.com/pangbox/server/common/hash"
"github.com/pangbox/server/gen/dbmodels"
"github.com/pangbox/server/pangya"
log "github.com/sirupsen/logrus"
)

// Enumeration of possible errors that can be returned from authenticate.
Expand Down Expand Up @@ -619,6 +619,7 @@ func (s *Service) getDecorationIDWith(ctx context.Context, tx *dbmodels.Queries,
return sql.NullInt64{}, err
}
if len(items) == 0 {
log.Warningf("missing decoration 0x%08x", typeID)
return sql.NullInt64{}, nil
}
return sql.NullInt64{Valid: true, Int64: items[0].ItemID}, nil
Expand Down Expand Up @@ -663,14 +664,18 @@ func (s *Service) SetDecoration(ctx context.Context, playerId int64, decoration
return err
}

queries.SetPlayerDecoration(ctx, dbmodels.SetPlayerDecorationParams{
_, err = queries.SetPlayerDecoration(ctx, dbmodels.SetPlayerDecorationParams{
BackgroundID: backgroundID,
FrameID: frameID,
StickerID: stickerID,
SlotID: slotID,
CutInID: cutInID,
TitleID: titleID,
PlayerID: playerId,
})
if err != nil {
return err
}

err = tx.Commit()
if err != nil {
Expand Down
72 changes: 36 additions & 36 deletions game/model/room.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,42 +38,42 @@ const (
)

type RoomPlayerEntry struct {
ConnID uint32
Nickname string `struct:"[22]byte"`
GuildName string `struct:"[17]byte"`
Slot uint8
PlayerFlags uint32 // (I think GM flag goes here!)
TitleID uint32
CharTypeID uint32
PortraitBGID uint32
PortraitFrameID uint32
PortraitStickerID uint32
PortraitSlotID uint32
SlotCutInID uint32
SlotRankBannerID uint32
StatusFlags RoomStatusFlag
Rank uint8
Unknown uint16
GuildID uint32
GuildEmblemImage string `struct:"[12]byte"`
PlayerID uint32
Unknown2 uint32
Unknown3 uint8 // <-- suspect, this may not be in the right place
LoungeState uint32
Unknown4 uint16
X float32
Y float32
Z float32
Angle float32
Unknown5 uint32
ShopUnknown uint32
ShopName string `struct:"[64]byte"`
MascotTypeID uint32
GlobalID string `struct:"[22]byte"`
Unknown6 [106]byte
Guest bool `struct:"byte"`
AverageScore float32
CharacterData pangya.PlayerCharacterData
ConnID uint32
Nickname string `struct:"[22]byte"`
GuildName string `struct:"[17]byte"`
Slot uint8
PlayerFlags uint32 // (I think GM flag goes here!)
TitleID uint32
CharTypeID uint32
BackgroundTypeID uint32
FrameTypeID uint32
StickerTypeID uint32
SlotTypeID uint32
CutInTypeID uint32
TitleTypeID uint32
StatusFlags RoomStatusFlag
Rank uint8
Unknown uint16
GuildID uint32
GuildEmblemImage string `struct:"[12]byte"`
PlayerID uint32
Unknown2 uint32
Unknown3 uint8 // <-- suspect, this may not be in the right place
LoungeState uint32
Unknown4 uint16
X float32
Y float32
Z float32
Angle float32
Unknown5 uint32
ShopUnknown uint32
ShopName string `struct:"[64]byte"`
MascotTypeID uint32
GlobalID string `struct:"[22]byte"`
Unknown6 [106]byte
Guest bool `struct:"byte"`
AverageScore float32
CharacterData pangya.PlayerCharacterData
}

type RoomActionRotation struct {
Expand Down
6 changes: 6 additions & 0 deletions game/server/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,12 @@ func (c *Conn) getRoomPlayer() *gamemodel.RoomPlayerEntry {
StatusFlags: 0,
GuildEmblemImage: "guildmark", // TODO
PlayerID: uint32(c.player.PlayerID),
BackgroundTypeID: uint32(c.player.BackgroundTypeID.Int64),
FrameTypeID: uint32(c.player.FrameTypeID.Int64),
StickerTypeID: uint32(c.player.StickerTypeID.Int64),
SlotTypeID: uint32(c.player.SlotTypeID.Int64),
CutInTypeID: uint32(c.player.CutInTypeID.Int64),
TitleTypeID: uint32(c.player.TitleTypeID.Int64),
CharacterData: c.getPlayerEquippedCharacter(),
}
}
Expand Down

0 comments on commit 8efc797

Please sign in to comment.