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