summaryrefslogtreecommitdiff
path: root/src/net/eathena/familyrecv.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-20 17:15:36 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-20 17:39:01 +0300
commit3005870980cf3fe86d42a75b8303c208354b6573 (patch)
tree584a95d24382237bbf9bbe77da2e058f6e4c4119 /src/net/eathena/familyrecv.cpp
parentcefe3bc037ccbf3f82b387d0484e9c81bed670f3 (diff)
downloadmanaplus-3005870980cf3fe86d42a75b8303c208354b6573.tar.gz
manaplus-3005870980cf3fe86d42a75b8303c208354b6573.tar.bz2
manaplus-3005870980cf3fe86d42a75b8303c208354b6573.tar.xz
manaplus-3005870980cf3fe86d42a75b8303c208354b6573.zip
Impliment packets SMSG_FAMILY_ASK_FOR_CHILD.
Diffstat (limited to 'src/net/eathena/familyrecv.cpp')
-rw-r--r--src/net/eathena/familyrecv.cpp48
1 files changed, 42 insertions, 6 deletions
diff --git a/src/net/eathena/familyrecv.cpp b/src/net/eathena/familyrecv.cpp
index 995c00a8b..7b0e9fa01 100644
--- a/src/net/eathena/familyrecv.cpp
+++ b/src/net/eathena/familyrecv.cpp
@@ -22,11 +22,21 @@
#include "logger.h"
#include "notifymanager.h"
+#include "party.h"
#include "being/localplayer.h"
#include "enums/resources/notifytypes.h"
+#include "gui/widgets/createwidget.h"
+
+#include "gui/windows/confirmdialog.h"
+
+#include "utils/gettext.h"
+#include "utils/stringutils.h"
+
+#include "listeners/requestadoptchildlistener.h"
+
#include "net/messagein.h"
#include "debug.h"
@@ -36,16 +46,42 @@ namespace EAthena
namespace FamilyRecv
{
- int mParent1 = 0;
- int mParent2 = 0;
+ ConfirmDialog *confirmDlg = nullptr;
+ RequestAdoptChildListener listener;
+ BeingId mParent1 = BeingId_zero;
+ BeingId mParent2 = BeingId_zero;
} // namespace FamilyRecv
void FamilyRecv::processAskForChild(Net::MessageIn &msg)
{
- UNIMPLIMENTEDPACKET;
- msg.readInt32("account id who ask");
- msg.readInt32("acoount id for other parent");
- msg.readString(24, "name who ask");
+ if (!localPlayer)
+ {
+ mParent1 = msg.readBeingId("account id who ask");
+ mParent2 = msg.readBeingId("acoount id for other parent");
+ msg.readString(24, "name who ask");
+ return;
+ }
+ mParent1 = msg.readBeingId("account id who ask");
+ mParent2 = msg.readBeingId("acoount id for other parent");
+ const std::string name1 = msg.readString(24, "name who ask");
+ const Party *const party = localPlayer->getParty();
+ if (party)
+ {
+ const PartyMember *const member = party->getMember(mParent2);
+ if (member)
+ {
+ const std::string name2 = member->getName();
+ CREATEWIDGETV(confirmDlg, ConfirmDialog,
+ // TRANSLATORS: adopt child message
+ _("Request parents"),
+ // TRANSLATORS: adopt child message
+ strprintf(_("Do you accept %s and %s as parents?"),
+ name1.c_str(), name2.c_str()),
+ SOUND_REQUEST,
+ false);
+ confirmDlg->addActionListener(&listener);
+ }
+ }
}
void FamilyRecv::processCallPartner(Net::MessageIn &msg)