Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cyclopedia Character: Send Basic Info #4456

Merged
merged 3 commits into from
May 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
75 changes: 75 additions & 0 deletions data/scripts/network/cyclopedia_character.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
local function sendBasicInfo(self, msg)
msg:addString(self:getName())
msg:addString(self:getVocation():getName())
msg:addU16(self:getLevel())

local outfit = self:getOutfit()
if outfit.lookType ~= 0 then
msg:addU16(outfit.lookType)
msg:addByte(outfit.lookHead)
msg:addByte(outfit.lookBody)
msg:addByte(outfit.lookLegs)
msg:addByte(outfit.lookFeet)
msg:addByte(outfit.lookAddons)
else
msg:addU16(outfit.lookTypeEx)
end

msg:addByte(0) -- hide stamina
msg:addByte(1) -- enable store summary & character titles
msg:addString("") -- character title

msg:sendToPlayer(self)
msg:delete()
return true
end

local BASIC_INFO = 0x00

--[[
local GENERAL_STATS = 0x01
local COMBAT_STATS = 0x02
local RECENT_DEATHS = 0x03
local RECENT_PVP_KILLS = 0x04
local ACHIEVEMENTS = 0x05
local ITEM_SUMMARY = 0x06
local APPEARANCES = 0x07
local STORE = 0x08
local INSPECTION = 0x09
local BADGES = 0x0A
local TITLES = 0x0B
]]--

local handlers = {
[BASIC_INFO] = sendBasicInfo,
--[[
[GENERAL_STATS] = "sendGeneralStats",
[COMBAT_STATS] = "sendCombatStats",
[RECENT_DEATHS] = "sendRecentDeaths",
[RECENT_PVP_KILLS] = "sendRecentPvpKills",
[ACHIEVEMENTS] = "sendAchievements",
[ITEM_SUMMARY] = "sendItemSummary",
[APPEARANCES] = "sendAppearances",
[STORE] = "sendStore",
[INSPECTION] = "sendInspection",
[BADGES] = "sendBadges",
[TITLES] = "sendTitles"
]]--
}

local handler = PacketHandler(0xE5)

function handler.onReceive(player, msg)
msg:skipBytes(4)
local type = msg:getByte()
local method = handlers[type]
if method then
local msg = NetworkMessage()
msg:addByte(0xDA)
msg:addByte(type)
msg:addByte(0x00)
method(player, msg)
end
end

handler:register()