summaryrefslogtreecommitdiff
path: root/src/net
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-20 01:34:13 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-20 01:34:13 +0300
commit75c8412edc9030ff86dc80dc4143d873cda9d4d1 (patch)
tree284975df74a7ae336656bd19ee3cf99a319ef0bf /src/net
parent59bc8a615eb7939474190539fe7848da0132e8f8 (diff)
downloadmv-75c8412edc9030ff86dc80dc4143d873cda9d4d1.tar.gz
mv-75c8412edc9030ff86dc80dc4143d873cda9d4d1.tar.bz2
mv-75c8412edc9030ff86dc80dc4143d873cda9d4d1.tar.xz
mv-75c8412edc9030ff86dc80dc4143d873cda9d4d1.zip
Allow get auto item share party option.
Diffstat (limited to 'src/net')
-rw-r--r--src/net/eathena/partyhandler.cpp11
-rw-r--r--src/net/eathena/partyhandler.h4
-rw-r--r--src/net/eathena/partyrecv.cpp39
-rw-r--r--src/net/eathena/partyrecv.h7
-rw-r--r--src/net/partyhandler.h4
-rw-r--r--src/net/tmwa/partyhandler.cpp9
-rw-r--r--src/net/tmwa/partyhandler.h4
7 files changed, 77 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
diff --git a/src/net/partyhandler.h b/src/net/partyhandler.h
index bd2a0f097..fc257b868 100644
--- a/src/net/partyhandler.h
+++ b/src/net/partyhandler.h
@@ -62,6 +62,10 @@ class PartyHandler notfinal
virtual void setShareItems(const PartyShareT share) const = 0;
+ virtual PartyShareT getShareAutoItems() const A_WARN_UNUSED = 0;
+
+ virtual void setShareAutoItems(const PartyShareT share) const = 0;
+
virtual void changeLeader(const std::string &name) const = 0;
virtual void allowInvite(const bool allow) const = 0;
diff --git a/src/net/tmwa/partyhandler.cpp b/src/net/tmwa/partyhandler.cpp
index 94471e4c3..490561a7a 100644
--- a/src/net/tmwa/partyhandler.cpp
+++ b/src/net/tmwa/partyhandler.cpp
@@ -151,4 +151,13 @@ void PartyHandler::allowInvite(const bool allow A_UNUSED) const
{
}
+PartyShareT PartyHandler::getShareAutoItems() const
+{
+ return PartyShare::NOT_POSSIBLE;
+}
+
+void PartyHandler::setShareAutoItems(const PartyShareT share A_UNUSED) const
+{
+}
+
} // namespace TmwAthena
diff --git a/src/net/tmwa/partyhandler.h b/src/net/tmwa/partyhandler.h
index d57944736..046039730 100644
--- a/src/net/tmwa/partyhandler.h
+++ b/src/net/tmwa/partyhandler.h
@@ -59,6 +59,10 @@ class PartyHandler final : public Ea::PartyHandler
A_CONST;
void allowInvite(const bool allow) const override final A_CONST;
+
+ void setShareAutoItems(const PartyShareT share) const override final;
+
+ PartyShareT getShareAutoItems() const override final A_WARN_UNUSED;
};
} // namespace TmwAthena