ManaPlus
familyrecv.cpp
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2011-2019 The ManaPlus Developers
4  * Copyright (C) 2019-2021 Andrei Karas
5  *
6  * This file is part of The ManaPlus Client.
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 2 of the License, or
11  * any later version.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program. If not, see <http://www.gnu.org/licenses/>.
20  */
21 
22 #include "net/eathena/familyrecv.h"
23 
24 #include "notifymanager.h"
25 #include "party.h"
26 
27 #include "being/localplayer.h"
28 
29 #include "const/sound.h"
30 
32 
34 
35 #include "utils/gettext.h"
36 #include "utils/stringutils.h"
37 
39 
40 #include "net/messagein.h"
41 
42 #include "debug.h"
43 
44 namespace EAthena
45 {
46 
47 namespace FamilyRecv
48 {
53 } // namespace FamilyRecv
54 
56 {
57  if (localPlayer == nullptr)
58  {
59  mParent1 = msg.readBeingId("account id who ask");
60  mParent2 = msg.readBeingId("acoount id for other parent");
61  msg.readString(24, "name who ask");
62  return;
63  }
64  mParent1 = msg.readBeingId("account id who ask");
65  mParent2 = msg.readBeingId("acoount id for other parent");
66  const std::string name1 = msg.readString(24, "name who ask");
67  const Party *const party = localPlayer->getParty();
68  if (party != nullptr)
69  {
70  const PartyMember *const member = party->getMember(mParent2);
71  if (member != nullptr)
72  {
73  const std::string name2 = member->getName();
75  // TRANSLATORS: adopt child message
76  _("Request parents"),
77  // TRANSLATORS: adopt child message
78  strprintf(_("Do you accept %s and %s as parents?"),
79  name1.c_str(), name2.c_str()),
81  false,
83  nullptr);
85  }
86  }
87 }
88 
90 {
91  const std::string name = msg.readString(24, "name");
92  if ((localPlayer != nullptr) && name == localPlayer->getName())
93  {
95  }
96  else
97  {
99  }
100 }
101 
103 {
104  const std::string name = msg.readString(24, "name");
106 }
107 
109 {
110  const int type = msg.readInt32("type");
111  switch (type)
112  {
113  case 0:
115  break;
116  case 1:
118  break;
119  case 2:
121  break;
122  default:
124  break;
125  }
126 }
127 
128 } // namespace EAthena
int BeingId
Definition: beingid.h:30
const BeingId BeingId_zero
Definition: beingid.h:30
std::string getName() const
Definition: avatar.h:53
Party * getParty() const
Definition: being.h:330
const std::string & getName() const
Definition: being.h:232
Definition: party.h:63
void addActionListener(ActionListener *const actionListener)
Definition: widget.cpp:252
#define CREATEWIDGETV(var, type,...)
Definition: createwidget.h:25
#define _(s)
Definition: gettext.h:35
LocalPlayer * localPlayer
#define UNIMPLEMENTEDPACKETFIELD(field)
Definition: logger.h:59
uint32_t party
const bool Modal_false
Definition: modal.h:30
bool msg(InputEvent &event)
Definition: chat.cpp:39
void processAskForChildReply(Net::MessageIn &msg)
Definition: familyrecv.cpp:108
ConfirmDialog * confirmDlg
Definition: familyrecv.cpp:49
void processAskForChild(Net::MessageIn &msg)
Definition: familyrecv.cpp:55
void processDivorced(Net::MessageIn &msg)
Definition: familyrecv.cpp:102
RequestAdoptChildListener listener
Definition: familyrecv.cpp:50
void processCallPartner(Net::MessageIn &msg)
Definition: familyrecv.cpp:89
void notify(const unsigned int message)
@ ADOPT_CHILD_ERROR_LEVEL
Definition: notifytypes.h:228
@ ADOPT_CHILD_ERROR_HAVE_BABY
Definition: notifytypes.h:227
@ ADOPT_CHILD_ERROR_BABY_MARRIED
Definition: notifytypes.h:229
static const std::string SOUND_REQUEST
Definition: sound.h:29
std::string strprintf(const char *const format,...)