Skip to content

feat: highscores module#809

Merged
luanluciano93 merged 6 commits intoopentibiabr:mainfrom
kokekanon:high
Jul 9, 2024
Merged

feat: highscores module#809
luanluciano93 merged 6 commits intoopentibiabr:mainfrom
kokekanon:high

Conversation

@kokekanon
Copy link
Contributor

@kokekanon kokekanon commented Jul 7, 2024

Test in

OTC Release 3.5
TFS main repo 13.10
tested in release 3.5 because in the main repo the compatibility with 13.10 is broken (packet).
and tfs 13.32 canary on the public test server has a packet error in market that makes it not work controller:onGameEnd.

hjhj

Experience

experience

magic level

magic level

show own rank

show own  rank

someone to review .c++ part because i

show own  rank

Error

1.- [DONE] Controller event

1.- Controller event

    --[[  why no work?    
    highscoreController:registerEvents(g_game, {
        onProcessHighscores = onProcessHighscores
    }):execute()  ]]
    
   -- i used
  connect(g_game, {
        onProcessHighscores = onProcessHighscores
    })
    

2.- in canary (public server)
I think there is an error in the interpretation of "show own rank", which does not appear in 13.10

Missing content

im player 860. i don't know what it is :
battlEye or worldType

image
server does not send battleye or wordtype labels
that functionality is not built in because I don't know how to test it.

vs tibia client

image

Client send to 13.10

image

server 13.10 send to client
--[[ { 
    ["vocation"] = 4294967295,
    ["title_column"] = 0,
    ["isEmpty"] = 0,
    ["entriesTs"] = 1720198326,
    ["page"] = 1,
    ["pages"] = 1,
    ["size"] = 5,
    ["categoryId"] = 1,
    ["categories"] = { 
        [1] = { 
            ["categoryName"] = "Experience Points",
            ["id"] = 1
        },
        [2] = { 
            ["categoryName"] = "Magic Level",
            ["id"] = 2
        },
        [3] = { 
            ["categoryName"] = "Fist Fighting",
            ["id"] = 3
        },
        [4] = { 
            ["categoryName"] = "Axe Fighting",
            ["id"] = 4
        },
        [5] = { 
            ["categoryName"] = "Club Fighting",
            ["id"] = 5
        },
        [6] = { 
            ["categoryName"] = "Sword Fighting",
            ["id"] = 6
        },
        [7] = { 
            ["categoryName"] = "Distance Fighting",
            ["id"] = 7
        },
        [8] = { 
            ["categoryName"] = "Shielding",
            ["id"] = 8
        },
        [9] = { 
            ["categoryName"] = "Fishing",
            ["id"] = 9
        },
        [10] = { 
            ["categoryName"] = "Achievement Points",
            ["id"] = 10
        }
    },
    ["idk2"] = 1,
    ["idk"] = 1,
    ["SERVER_NAME"] = "Forgotten",
    ["world"] = "",
    ["worldType"] = 0,
    ["battlEye"] = 255,
    ["size_vocation"] = 6,
    ["ffffff"] = 4294967295,
    ["All_vocations"] = "All vocations",
    ["list_vocation"] = { 
        [1] = { 
            ["vocationID"] = 0,
            ["vocationName"] = "None"--
        },
        [2] = { 
            ["vocationID"] = 1,
            ["vocationName"] = "Sorcerer"--
        },
        [3] = { 
            ["vocationID"] = 2,
            ["vocationName"] = "Druid"--
        },
        [4] = { 
            ["vocationID"] = 3,
            ["vocationName"] = "Paladin"
        },
        [5] = { 
            ["vocationID"] = 4,
            ["vocationName"] = "Knight"
        }
    },
    ["unknown"] = 255,
    ["list"] = { 
        [1] = { 
            ["vocation"] = 4,
            ["name"] = "Druid Sample",
            ["title"] = "",
            ["isPlayer"] = 0,
            ["rank"] = 1,
            ["points"] = 4200,
            ["world"] = "Forgotten",
            ["level"] = 8
        },
        [2] = { 
            ["vocation"] = 1,
            ["name"] = "Knight Sample",
            ["title"] = "",
            ["isPlayer"] = 0,
            ["rank"] = 2,
            ["points"] = 4200,
            ["world"] = "Forgotten",
            ["level"] = 8
        },
        [3] = { 
            ["vocation"] = 2,
            ["name"] = "Paladin Sample",
            ["title"] = "",
            ["isPlayer"] = 0,
            ["rank"] = 3,
            ["points"] = 4200,
            ["world"] = "Forgotten",
            ["level"] = 8
        },
        [4] = { 
            ["vocation"] = 3,
            ["name"] = "Sorcerer Sample",
            ["title"] = "",
            ["isPlayer"] = 0,
            ["rank"] = 4,
            ["points"] = 4200,
            ["world"] = "Forgotten",
            ["level"] = 8
        },
        [5] = { 
            ["vocation"] = 0,
            ["name"] = "Rook Sample",
            ["title"] = "",
            ["isPlayer"] = 0,
            ["rank"] = 5,
            ["points"] = 0,
            ["world"] = "Forgotten",
            ["level"] = 1
        }
    },
    ["Size_categories"] = 10
} ]]

@mehah
Copy link
Collaborator

mehah commented Jul 7, 2024

About registerevent, are your controller and event modules updated?

I saw that you are using version 3.5, if the modules are also from 3.5, it really won't work.

@kokekanon
Copy link
Contributor Author

kokekanon commented Jul 7, 2024

i made the changes in 3.5(gamelib/controller and all controller modules) and the same bug appears as in the main repo

if I put this

highscoreController:registerEvents(g_game, {
        onProcessHighscores = onProcessHighscores
    }):execute()

in
:onInit() (error open)

:onGameStart() (error login player)

ERROR: Lua exception: /corelib/table.lua:25: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
    [C]: at 0x7ff79ca4da80
    [C]: in function 'pairs'
    /corelib/table.lua:25: in function 'copy'
    /game_highscore/game_highscore.lua:123: in function 'act'
    /gamelib/eventcontroller.lua:47: in function 'execute'
    /game_highscore/game_highscore.lua:91: in function 'onInit'
    /gamelib/controller.lua:77: in function 'init'
    /game_highscore/game_highscore.otmod:8:[@onLoad]:1: in main chunk
    [C]: in function 'ensureModuleLoaded'
    /init.lua:88: in function 'loadModules'
    /init.lua:111: in main chunk
ERROR: Unable to load module 'game_highscore': LUA ERROR:
/corelib/table.lua:25: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
    [C]: at 0x7ff79ca4da80
    [C]: in function 'pairs'
    /corelib/table.lua:25: in function 'copy'
    /game_highscore/game_highscore.lua:123: in function 'act'
    /gamelib/eventcontroller.lua:47: in function 'execute'
    /game_highscore/game_highscore.lua:91: in function 'onInit'
    /gamelib/controller.lua:77: in function 'init'
    /game_highscore/game_highscore.otmod:8:[@onLoad]:1: in main chunk
    [C]: in function 'ensureModuleLoaded'
    /init.lua:88: in function 'loadModules'
    /init.lua:111: in main chunk

but if I put

  connect(g_game, {
        onProcessHighscores = onProcessHighscores
    })

in

:onInit()
or
:onGameStart()

work

@kokekanon
Copy link
Contributor Author

kokekanon commented Jul 7, 2024

@mehah me bad , I only have to remove :execute() and work

canary 13.32 public server

image

@kokekanon kokekanon marked this pull request as ready for review July 9, 2024 21:29
@majestyotbr
Copy link
Contributor

Tested, it's working with Canary. The options that are missing can be developed later.
Thanks for your contribution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants