diff options
author | Andrei Karas <akaras@inbox.ru> | 2016-08-20 01:34:13 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2016-08-20 01:34:13 +0300 |
commit | 75c8412edc9030ff86dc80dc4143d873cda9d4d1 (patch) | |
tree | 284975df74a7ae336656bd19ee3cf99a319ef0bf /src/net/eathena | |
parent | 59bc8a615eb7939474190539fe7848da0132e8f8 (diff) | |
download | manaplus-75c8412edc9030ff86dc80dc4143d873cda9d4d1.tar.gz manaplus-75c8412edc9030ff86dc80dc4143d873cda9d4d1.tar.bz2 manaplus-75c8412edc9030ff86dc80dc4143d873cda9d4d1.tar.xz manaplus-75c8412edc9030ff86dc80dc4143d873cda9d4d1.zip |
Allow get auto item share party option.
Diffstat (limited to 'src/net/eathena')
-rw-r--r-- | src/net/eathena/partyhandler.cpp | 11 | ||||
-rw-r--r-- | src/net/eathena/partyhandler.h | 4 | ||||
-rw-r--r-- | src/net/eathena/partyrecv.cpp | 39 | ||||
-rw-r--r-- | src/net/eathena/partyrecv.h | 7 |
4 files changed, 60 insertions, 1 deletions
diff --git a/src/net/eathena/partyhandler.cpp b/src/net/eathena/partyhandler.cpp index 7de6dcd9c..df9e43dee 100644 --- a/src/net/eathena/partyhandler.cpp +++ b/src/net/eathena/partyhandler.cpp @@ -32,6 +32,7 @@ #include "net/ea/partyrecv.h" #include "net/eathena/messageout.h" +#include "net/eathena/partyrecv.h" #include "net/eathena/protocolout.h" #include "debug.h" @@ -193,4 +194,14 @@ void PartyHandler::allowInvite(const bool allow) const outMsg.writeInt8(CAST_S8(allow ? 1 : 0), "allow"); } +PartyShareT PartyHandler::getShareAutoItems() const +{ + return PartyRecv::mShareAutoItems; +} + +void PartyHandler::setShareAutoItems(const PartyShareT share) const +{ + PartyRecv::mShareAutoItems = share; +} + } // namespace EAthena diff --git a/src/net/eathena/partyhandler.h b/src/net/eathena/partyhandler.h index 9cee0cc67..4782a7e2c 100644 --- a/src/net/eathena/partyhandler.h +++ b/src/net/eathena/partyhandler.h @@ -58,6 +58,10 @@ class PartyHandler final : public Ea::PartyHandler void changeLeader(const std::string &name) const override final; void allowInvite(const bool allow) const override final; + + void setShareAutoItems(const PartyShareT share) const override final; + + PartyShareT getShareAutoItems() const override final A_WARN_UNUSED; }; } // namespace EAthena diff --git a/src/net/eathena/partyrecv.cpp b/src/net/eathena/partyrecv.cpp index f0789cbf2..21edcc3b3 100644 --- a/src/net/eathena/partyrecv.cpp +++ b/src/net/eathena/partyrecv.cpp @@ -42,6 +42,11 @@ namespace EAthena { +namespace PartyRecv +{ + PartyShareT mShareAutoItems = PartyShare::UNKNOWN; +} // namespace PartyRecv + void PartyRecv::processPartyInvitationStats(Net::MessageIn &msg) { // +++ for now server allow only switch this option but not using it. @@ -94,8 +99,10 @@ void PartyRecv::processPartySettings(Net::MessageIn &msg) { const PartyShareT item = static_cast<PartyShareT>( msg.readInt8("pickup item share (&1)")); - msg.readInt8("get item share (&2)"); Ea::PartyRecv::processPartyItemSettingsContinue(msg, item); + const PartyShareT autoItem = static_cast<PartyShareT>( + msg.readInt8("get auto item share (&2)")); + processPartyAutoItemSettingsContinue(msg, autoItem); } } @@ -315,4 +322,34 @@ void PartyRecv::processPartyInvited(Net::MessageIn &msg) socialWindow->showPartyInvite(partyName, std::string(), id); } +void PartyRecv::processPartyAutoItemSettingsContinue(Net::MessageIn &msg, + const PartyShareT item) +{ + switch (item) + { + case PartyShare::YES: + if (mShareAutoItems == PartyShare::YES) + break; + mShareAutoItems = PartyShare::YES; + NotifyManager::notify(NotifyTypes::PARTY_ITEM_SHARE_ON); + break; + case PartyShare::NO: + if (mShareAutoItems == PartyShare::NO) + break; + mShareAutoItems = PartyShare::NO; + NotifyManager::notify(NotifyTypes::PARTY_ITEM_SHARE_OFF); + break; + case PartyShare::NOT_POSSIBLE: + if (mShareAutoItems == PartyShare::NOT_POSSIBLE) + break; + mShareAutoItems = PartyShare::NOT_POSSIBLE; + NotifyManager::notify(NotifyTypes::PARTY_ITEM_SHARE_ERROR); + break; + default: + case PartyShare::UNKNOWN: + UNIMPLIMENTEDPACKETFIELD(CAST_S32(item)); + break; + } +} + } // namespace EAthena diff --git a/src/net/eathena/partyrecv.h b/src/net/eathena/partyrecv.h index 9d7711ad8..4ee0e0dcc 100644 --- a/src/net/eathena/partyrecv.h +++ b/src/net/eathena/partyrecv.h @@ -22,6 +22,8 @@ #ifndef NET_EATHENA_PARTYRECV_H #define NET_EATHENA_PARTYRECV_H +#include "enums/net/partyshare.h" + namespace Net { class MessageIn; @@ -31,6 +33,8 @@ namespace EAthena { namespace PartyRecv { + extern PartyShareT mShareAutoItems; + void processPartySettings(Net::MessageIn &msg); void processPartyInvitationStats(Net::MessageIn &msg); void processPartyMemberInfo(Net::MessageIn &msg); @@ -40,6 +44,9 @@ namespace EAthena void processPartyItemPickup(Net::MessageIn &msg); void processPartyLeader(Net::MessageIn &msg); void processPartyInvited(Net::MessageIn &msg); + + void processPartyAutoItemSettingsContinue(Net::MessageIn &msg, + const PartyShareT item); } // namespace PartyRecv } // namespace EAthena |