| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- package mapLogic
- import (
- "f1-game/internal/pb"
- "f1-game/internal/types"
- "time"
- "github.com/goburrow/cache"
- )
- var (
- aoiUpdateBattleMap = cache.New(
- cache.WithMaximumSize(-1),
- cache.WithExpireAfterWrite(time.Minute),
- )
- pbMapLeagues = types.NewMap[int64, *pb.MapLeague]()
- )
- func getAOIUpdateBattle(updateID uint32) (*pb.MapBattlePush, bool) {
- value, ok := aoiUpdateBattleMap.GetIfPresent(updateID)
- if !ok {
- return nil, false
- }
- push, ok := value.(*pb.MapBattlePush)
- return push, ok
- }
- func (p *actor) getPlayerName(playerID int64) string {
- if watcherTable, ok := p.WatcherTables.Get(playerID); ok {
- return watcherTable.PlayerName
- }
- return ""
- }
- func (p *actor) getLeagueName(leagueID int64) string {
- if leauge, found := pbMapLeagues.Get(leagueID); found {
- return leauge.LeagueName
- }
- return ""
- }
|