{"action":"created","issue":{"url":"https://api.github.com/repos/otland/forgottenserver/issues/1982","repository_url":"https://api.github.com/repos/otland/forgottenserver","labels_url":"https://api.github.com/repos/otland/forgottenserver/issues/1982/labels{/name}","comments_url":"https://api.github.com/repos/otland/forgottenserver/issues/1982/comments","events_url":"https://api.github.com/repos/otland/forgottenserver/issues/1982/events","html_url":"https://github.com/otland/forgottenserver/issues/1982","id":188701484,"number":1982,"title":"ProtocolGame::sendBasicData() not sending vocation or clientid to client","user":{"login":"A-Syntax","id":20911572,"avatar_url":"https://avatars.githubusercontent.com/u/20911572?v=3","gravatar_id":"","url":"https://api.github.com/users/A-Syntax","html_url":"https://github.com/A-Syntax","followers_url":"https://api.github.com/users/A-Syntax/followers","following_url":"https://api.github.com/users/A-Syntax/following{/other_user}","gists_url":"https://api.github.com/users/A-Syntax/gists{/gist_id}","starred_url":"https://api.github.com/users/A-Syntax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/A-Syntax/subscriptions","organizations_url":"https://api.github.com/users/A-Syntax/orgs","repos_url":"https://api.github.com/users/A-Syntax/repos","events_url":"https://api.github.com/users/A-Syntax/events{/privacy}","received_events_url":"https://api.github.com/users/A-Syntax/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-11-11T07:31:48Z","updated_at":"2016-11-12T19:37:42Z","closed_at":null,"body":"`msg.addByte(player->getVocation()->getClientId()); // always returns 0`\r\nI can print the values of the client id and the vocation id in the game or server console but the actual values themselves are never sent to the client. If I try to print the value it always returns 0.\r\n\r\nEven this fragment of code seems rather pointless as it only sends 255 values, other than its purpose of allowing the flash client to use hotkeys, it doesn't serve any other purpose because the values are not associated with anything.\r\n```\r\n\tmsg.add<uint16_t>(0xFF); // number of known spells\r\n\tfor (uint8_t spellId = 0x00; spellId < 0xFF; spellId++) {\r\n\t\tmsg.addByte(spellId);\r\n\t}\r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/otland/forgottenserver/issues/comments/260143363","html_url":"https://github.com/otland/forgottenserver/issues/1982#issuecomment-260143363","issue_url":"https://api.github.com/repos/otland/forgottenserver/issues/1982","id":260143363,"user":{"login":"A-Syntax","id":20911572,"avatar_url":"https://avatars.githubusercontent.com/u/20911572?v=3","gravatar_id":"","url":"https://api.github.com/users/A-Syntax","html_url":"https://github.com/A-Syntax","followers_url":"https://api.github.com/users/A-Syntax/followers","following_url":"https://api.github.com/users/A-Syntax/following{/other_user}","gists_url":"https://api.github.com/users/A-Syntax/gists{/gist_id}","starred_url":"https://api.github.com/users/A-Syntax/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/A-Syntax/subscriptions","organizations_url":"https://api.github.com/users/A-Syntax/orgs","repos_url":"https://api.github.com/users/A-Syntax/repos","events_url":"https://api.github.com/users/A-Syntax/events{/privacy}","received_events_url":"https://api.github.com/users/A-Syntax/received_events","type":"User","site_admin":false},"created_at":"2016-11-12T19:37:42Z","updated_at":"2016-11-12T19:37:42Z","body":"Here is the code for anyone else looking to do the same thing.\r\n```\r\nvoid ProtocolGame::parsePlayerInfo(const InputMessagePtr& msg)\r\n{\r\n    bool premium = msg->getU8(); // premium\r\n    //int vocation = msg->getU8(); // vocation\r\n    if(g_game.getFeature(Otc::GamePremiumExpiration))\r\n        int premiumEx = msg->getU32(); // premium expiration used for premium advertisement\r\n\tint vocation = msg->getU8(); // vocation\r\n\r\n    int spellCount = msg->getU16();\r\n    std::vector<int> spells;\r\n\t// you can uncomment this if you want to check if vocations is being sent \r\n\t//g_logger.debug(stdext::format(\"Vocation id '%d'\", vocation));\r\n    for(int i=0;i<spellCount;++i)\r\n        spells.push_back(msg->getU8()); // spell id\r\n\r\n    m_localPlayer->setPremium(premium);\r\n    m_localPlayer->setVocation(vocation);\r\n    m_localPlayer->setSpells(spells);\r\n}\r\n```"}}
{"actor":{"display_login":"A-Syntax"}}