diff options
author | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-09-10 19:38:20 +0200 |
---|---|---|
committer | Erik Schilling <ablu.erikschilling@googlemail.com> | 2013-09-13 21:30:22 +0200 |
commit | 66a98a3a0df795761328d62ef2ad07f81e383f9e (patch) | |
tree | 6f8f924bb020be5688e644bda4ae183875005f7c /src/common/manaserv_protocol.h | |
parent | 53a566674c6912647f636617c020835abeb04a98 (diff) | |
download | manaserv-66a98a3a0df795761328d62ef2ad07f81e383f9e.tar.gz manaserv-66a98a3a0df795761328d62ef2ad07f81e383f9e.tar.bz2 manaserv-66a98a3a0df795761328d62ef2ad07f81e383f9e.tar.xz manaserv-66a98a3a0df795761328d62ef2ad07f81e383f9e.zip |
Added basic questlog support
I did this patch quite a while ago. Big thx to Stefan Beller for
"rebasing" it.
Diffstat (limited to 'src/common/manaserv_protocol.h')
-rw-r--r-- | src/common/manaserv_protocol.h | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/common/manaserv_protocol.h b/src/common/manaserv_protocol.h index 86f6196c..2bfd8c70 100644 --- a/src/common/manaserv_protocol.h +++ b/src/common/manaserv_protocol.h @@ -254,6 +254,9 @@ enum { PCMSG_USER_MODE = 0x0465, // W channel id, S name, B mode PCMSG_KICK_USER = 0x0466, // W channel id, S name + // -- Questlog + GPMSG_QUESTLOG_STATUS = 0x0470, // W quest id, B flags, [B status], [S questname], [S questdescription] + // Inter-server GAMSG_REGISTER = 0x0500, // S address, W port, S password, D items db revision AGMSG_REGISTER_RESPONSE = 0x0501, // W item version, W password response, { S globalvar_key, S globalvar_value } @@ -415,6 +418,13 @@ enum { GUILD_EVENT_OFFLINE_PLAYER }; +enum { + QUESTLOG_UPDATE_STATE = 1, + QUESTLOG_UPDATE_TITLE = 2, + QUESTLOG_UPDATE_DESCRIPTION = 4, + QUESTLOG_SHOW_NOTIFICATION = 8, +}; + /** * Moves enum for beings and actors for others players vision. * WARNING: Has to be in sync with the same enum in the Being class @@ -483,6 +493,55 @@ inline ManaServ::BeingGender getGender(std::string gender) return ManaServ::GENDER_UNSPECIFIED; } +/** + * Quest states + */ +enum QuestStatus +{ + STATUS_OPEN = 0, + STATUS_STARTED, + STATUS_FINISHED, + STATUS_INVALID +}; + +/** + * Helper function for getting quest status by id + * @param status id of the status + * @return the status as enum value + */ +inline ManaServ::QuestStatus getQuestStatus(int status) +{ + switch (status) + { + case 0: + return ManaServ::STATUS_OPEN; + case 1: + return ManaServ::STATUS_STARTED; + case 2: + return ManaServ::STATUS_FINISHED; + default: + return ManaServ::STATUS_INVALID; + } +} + +/** + * Helper function for getting quest status by string + * @param status name of quest status (open, started or finished) + * @return the status as enum value + */ +inline ManaServ::QuestStatus getQuestStatus(std::string status) +{ + std::string lowercase = utils::toLower(status); + if (lowercase == "open") + return ManaServ::STATUS_OPEN; + else if (lowercase == "started") + return ManaServ::STATUS_STARTED; + else if (lowercase == "finished") + return ManaServ::STATUS_FINISHED; + else + return ManaServ::STATUS_INVALID; +} + } // namespace ManaServ #endif // MANASERV_PROTOCOL_H |