| 1 | /* |
| 2 | * Copyright (C) 2000,2001 Onlyer ([email protected]) |
| 3 | * |
| 4 | * This program is free software; you can redistribute it and/or |
| 5 | * modify it under the terms of the GNU General Public License |
| 6 | * as published by the Free Software Foundation; either version 2 |
| 7 | * of the License, or (at your option) any later version. |
| 8 | * |
| 9 | * This program is distributed in the hope that it will be useful, |
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | * GNU General Public License for more details. |
| 13 | * |
| 14 | * You should have received a copy of the GNU General Public License |
| 15 | * along with this program; if not, write to the Free Software |
| 16 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 17 | */ |
| 18 | #include "common/setup_before.h"cxx . . $ `<file>/src/common/setup_before.h`/ |
| 19 | #include "handle_d2cs.h"cxx . . $ `<file>/src/bnetd/handle_d2cs.h`/ |
| 20 | |
| 21 | #include <cstring> |
| 22 | #include <cstdio> |
| 23 | |
| 24 | #include "compat/strcasecmp.h"cxx . . $ `<file>/src/compat/strcasecmp.h`/ |
| 25 | #include "common/eventlog.h"cxx . . $ `<file>/src/common/eventlog.h`/ |
| 26 | #include "common/bn_type.h"cxx . . $ `<file>/src/common/bn_type.h`/ |
| 27 | #include "common/addr.h"cxx . . $ `<file>/src/common/addr.h`/ |
| 28 | #include "common/bnethash.h"cxx . . $ `<file>/src/common/bnethash.h`/ |
| 29 | #include "common/bnethashconv.h"cxx . . $ `<file>/src/common/bnethashconv.h`/ |
| 30 | #include "common/tag.h"cxx . . $ `<file>/src/common/tag.h`/ |
| 31 | #include "common/util.h"cxx . . $ `<file>/src/common/util.h`/ |
| 32 | |
| 33 | #include "realm.h"cxx . . $ `<file>/src/bnetd/realm.h`/ |
| 34 | #include "prefs.h"cxx . . $ `<file>/src/bnetd/prefs.h`/ |
| 35 | #include "account_wrap.h"cxx . . $ `<file>/src/bnetd/account_wrap.h`/ |
| 36 | #include "game.h"cxx . . $ `<file>/src/bnetd/game.h`/ |
| 37 | #include "common/setup_after.h"cxx . . $ `<file>/src/common/setup_after.h`/ |
| 38 | |
| 39 | namespace pvpgncxx . . $ pvpgn/ |
| 40 | { |
| 41 | |
| 42 | namespace bnetdcxx . . $ pvpgn/bnetd/ |
| 43 | { |
| 44 | |
| 45 | static int on_d2cs_accountloginreqcxx . . $ pvpgn/bnetd/on_d2cs_accountloginreq(8d07eb83d60bed1d).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * c, t_packetcxx . . $ pvpgn/t_packet# const * packet); |
| 46 | static int on_d2cs_charloginreqcxx . . $ pvpgn/bnetd/on_d2cs_charloginreq(8d07eb83d60bed1d).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * c, t_packetcxx . . $ pvpgn/t_packet# const * packet); |
| 47 | static int on_d2cs_authreplycxx . . $ pvpgn/bnetd/on_d2cs_authreply(8d07eb83d60bed1d).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * c, t_packetcxx . . $ pvpgn/t_packet# const * packet); |
| 48 | static int on_d2cs_gameinforeplycxx . . $ pvpgn/bnetd/on_d2cs_gameinforeply(8d07eb83d60bed1d).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * c, t_packetcxx . . $ pvpgn/t_packet# const * packet); |
| 49 | |
| 50 | extern int handle_d2cs_packetcxx . . $ pvpgn/bnetd/handle_d2cs_packet(8d07eb83d60bed1d).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * c, t_packetcxx . . $ pvpgn/t_packet# const * packet) |
| 51 | { |
| 52 | if (!c) { |
| 53 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL connection"); |
| 54 | return -1; |
| 55 | } |
| 56 | if (!packet) { |
| 57 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL packet"); |
| 58 | return -1; |
| 59 | } |
| 60 | if (packet_get_classcxx . . $ pvpgn/packet_get_class(6361653567fd72e5).(packet) != packet_class_d2cs_bnetdcxx . . $ pvpgn/packet_class_d2cs_bnetd.) { |
| 61 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad packet class {}", |
| 62 | packet_get_classcxx . . $ pvpgn/packet_get_class(6361653567fd72e5).(packet)); |
| 63 | return -1; |
| 64 | } |
| 65 | switch (conn_get_statecxx . . $ pvpgn/bnetd/conn_get_state(14586157a79399d4).(c)) { |
| 66 | case conn_state_connectedcxx . . $ pvpgn/bnetd/conn_state_connected.: |
| 67 | switch (packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(packet)) { |
| 68 | case D2CS_BNETD_AUTHREPLYcxx . . $ `src/common/d2cs_bnetd_protocol.h:45:9`!: |
| 69 | on_d2cs_authreplycxx . . $ pvpgn/bnetd/on_d2cs_authreply(8d07eb83d60bed1d).(c, packet); |
| 70 | break; |
| 71 | default: |
| 72 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, |
| 73 | "got unknown packet type {}", packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(packet)); |
| 74 | break; |
| 75 | } |
| 76 | break; |
| 77 | case conn_state_loggedincxx . . $ pvpgn/bnetd/conn_state_loggedin.: |
| 78 | switch (packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(packet)) { |
| 79 | case D2CS_BNETD_ACCOUNTLOGINREQcxx . . $ `src/common/d2cs_bnetd_protocol.h:62:9`!: |
| 80 | on_d2cs_accountloginreqcxx . . $ pvpgn/bnetd/on_d2cs_accountloginreq(8d07eb83d60bed1d).(c, packet); |
| 81 | break; |
| 82 | case D2CS_BNETD_CHARLOGINREQcxx . . $ `src/common/d2cs_bnetd_protocol.h:82:9`!: |
| 83 | on_d2cs_charloginreqcxx . . $ pvpgn/bnetd/on_d2cs_charloginreq(8d07eb83d60bed1d).(c, packet); |
| 84 | break; |
| 85 | case D2CS_BNETD_GAMEINFOREPLYcxx . . $ `src/common/d2cs_bnetd_protocol.h:107:9`!: |
| 86 | on_d2cs_gameinforeplycxx . . $ pvpgn/bnetd/on_d2cs_gameinforeply(8d07eb83d60bed1d).(c, packet); |
| 87 | break; |
| 88 | default: |
| 89 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, |
| 90 | "got unknown packet type {}", packet_get_typecxx . . $ pvpgn/packet_get_type(e4ac9e2b4744cb4b).(packet)); |
| 91 | break; |
| 92 | } |
| 93 | break; |
| 94 | default: |
| 95 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, |
| 96 | "got unknown connection state {}", conn_get_statecxx . . $ pvpgn/bnetd/conn_get_state(14586157a79399d4).(c)); |
| 97 | break; |
| 98 | } |
| 99 | return 0; |
| 100 | } |
| 101 | |
| 102 | static int on_d2cs_authreplycxx . . $ pvpgn/bnetd/on_d2cs_authreply(8d07eb83d60bed1d).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * c, t_packetcxx . . $ pvpgn/t_packet# const * packet) |
| 103 | { |
| 104 | t_packetcxx . . $ pvpgn/t_packet# * rpacket; |
| 105 | unsigned int version; |
| 106 | unsigned int try_version; |
| 107 | unsigned int reply; |
| 108 | char const * realmname; |
| 109 | t_realmcxx . . $ pvpgn/bnetd/t_realm# * realm; |
| 110 | |
| 111 | if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_d2cs_bnetd_authreplycxx . . $ pvpgn/t_d2cs_bnetd_authreply#)) { |
| 112 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad packet size"); |
| 113 | return -1; |
| 114 | } |
| 115 | if (!(realmname = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_d2cs_bnetd_authreplycxx . . $ pvpgn/t_d2cs_bnetd_authreply#), MAX_REALMNAME_LENcxx . . $ MAX_REALMNAME_LEN.))) { |
| 116 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad realmname"); |
| 117 | return -1; |
| 118 | } |
| 119 | if (!(realm = realmlist_find_realmcxx . . $ pvpgn/bnetd/realmlist_find_realm(8fe5f3fa56e7fb14).(realmname))) { |
| 120 | realm = realmlist_find_realm_by_ipcxx . . $ pvpgn/bnetd/realmlist_find_realm_by_ip(a00e58d003047626).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(c)); /* should not fail - checked in handle_init_packet() handle_init.c */ |
| 121 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_warncxx . . $ pvpgn/eventlog_level_warn., __FUNCTION__, "warn: realm name mismatch {} {}", realm_get_namecxx . . $ pvpgn/bnetd/realm_get_name(83f045398bcf2fc5).(realm), realmname); |
| 122 | if (!(prefs_allow_d2cs_setnamecxx . . $ pvpgn/bnetd/prefs_allow_d2cs_setname(db52760e79bf9054).())) { /* fail if allow_d2cs_setname = false */ |
| 123 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "d2cs not allowed to set realm name"); |
| 124 | return -1; |
| 125 | } |
| 126 | if (realm_get_activecxx . . $ pvpgn/bnetd/realm_get_active(d125a4483a7f736b).(realm)) { /* fail if realm already active */ |
| 127 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "cannot set realm name to {} (realm already active)", realmname); |
| 128 | return -1; |
| 129 | } |
| 130 | realm_set_namecxx . . $ pvpgn/bnetd/realm_set_name(21a7e9771b814a54).(realm, realmname); |
| 131 | } |
| 132 | version = prefs_get_d2cs_versioncxx . . $ pvpgn/bnetd/prefs_get_d2cs_version(db52760e79bf9054).(); |
| 133 | try_version = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..d2cs_bnetd_authreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#d2cs_bnetd_authreply..versioncxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_3#version.); |
| 134 | if (version && version != try_version) { |
| 135 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "d2cs version mismatch 0x{:X} - 0x{:X}", |
| 136 | try_version, version); |
| 137 | reply = BNETD_D2CS_AUTHREPLY_BAD_VERSIONcxx . . $ `src/common/d2cs_bnetd_protocol.h:60:9`!; |
| 138 | } |
| 139 | else { |
| 140 | reply = BNETD_D2CS_AUTHREPLY_SUCCEEDcxx . . $ `src/common/d2cs_bnetd_protocol.h:59:9`!; |
| 141 | } |
| 142 | |
| 143 | if (reply == BNETD_D2CS_AUTHREPLY_SUCCEEDcxx . . $ `src/common/d2cs_bnetd_protocol.h:59:9`!) { |
| 144 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "d2cs {} authed", |
| 145 | addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(c))); |
| 146 | conn_set_statecxx . . $ pvpgn/bnetd/conn_set_state(7b556497952c81aa).(c, conn_state_loggedincxx . . $ pvpgn/bnetd/conn_state_loggedin.); |
| 147 | realm_activecxx . . $ pvpgn/bnetd/realm_active(785603629566d68e).(realm, c); |
| 148 | } |
| 149 | else { |
| 150 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "failed to auth d2cs {}", |
| 151 | addr_num_to_ip_strcxx . . $ pvpgn/addr_num_to_ip_str(81a3ae90da26a711).(conn_get_addrcxx . . $ pvpgn/bnetd/conn_get_addr(8bd2285a65940781).(c))); |
| 152 | } |
| 153 | if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_d2cs_bnetdcxx . . $ pvpgn/packet_class_d2cs_bnetd.))) { |
| 154 | packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_bnetd_d2cs_authreplycxx . . $ pvpgn/t_bnetd_d2cs_authreply#)); |
| 155 | packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, BNETD_D2CS_AUTHREPLYcxx . . $ `src/common/d2cs_bnetd_protocol.h:53:9`!); |
| 156 | bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..bnetd_d2cs_authreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#bnetd_d2cs_authreply..hcxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_4#h..seqnocxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_0#seqno., 1); |
| 157 | bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..bnetd_d2cs_authreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#bnetd_d2cs_authreply..replycxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_4#reply., reply); |
| 158 | conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket); |
| 159 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket); |
| 160 | } |
| 161 | return 0; |
| 162 | } |
| 163 | |
| 164 | static int on_d2cs_accountloginreqcxx . . $ pvpgn/bnetd/on_d2cs_accountloginreq(8d07eb83d60bed1d).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * c, t_packetcxx . . $ pvpgn/t_packet# const * packet) |
| 165 | { |
| 166 | unsigned int sessionkey; |
| 167 | unsigned int sessionnum; |
| 168 | unsigned int salt; |
| 169 | char const * account; |
| 170 | char const * tname; |
| 171 | t_connectioncxx . . $ pvpgn/bnetd/t_connection# * client; |
| 172 | int reply; |
| 173 | t_packetcxx . . $ pvpgn/t_packet# * rpacket; |
| 174 | structcxx . . $ pvpgn/bnetd/on_d2cs_accountloginreq(8d07eb83d60bed1d).$anonymous_type_0# |
| 175 | { |
| 176 | bn_intcxx . . $ pvpgn/bn_int# saltcxx . . $ pvpgn/bnetd/on_d2cs_accountloginreq(8d07eb83d60bed1d).$anonymous_type_0#salt.; |
| 177 | bn_intcxx . . $ pvpgn/bn_int# sessionkeycxx . . $ pvpgn/bnetd/on_d2cs_accountloginreq(8d07eb83d60bed1d).$anonymous_type_0#sessionkey.; |
| 178 | bn_intcxx . . $ pvpgn/bn_int# sessionnumcxx . . $ pvpgn/bnetd/on_d2cs_accountloginreq(8d07eb83d60bed1d).$anonymous_type_0#sessionnum.; |
| 179 | bn_intcxx . . $ pvpgn/bn_int# secretcxx . . $ pvpgn/bnetd/on_d2cs_accountloginreq(8d07eb83d60bed1d).$anonymous_type_0#secret.; |
| 180 | bn_intcxx . . $ pvpgn/bn_int# passhashcxx . . $ pvpgn/bnetd/on_d2cs_accountloginreq(8d07eb83d60bed1d).$anonymous_type_0#passhash.[5]; |
| 181 | } temp; |
| 182 | t_hashcxx . . $ pvpgn/t_hash# secret_hash; |
| 183 | char const * pass_str; |
| 184 | t_hashcxx . . $ pvpgn/t_hash# passhash; |
| 185 | t_hashcxx . . $ pvpgn/t_hash# try_hash; |
| 186 | |
| 187 | if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_d2cs_bnetd_accountloginreqcxx . . $ pvpgn/t_d2cs_bnetd_accountloginreq#)) { |
| 188 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad packet size"); |
| 189 | return -1; |
| 190 | } |
| 191 | if (!(account = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_d2cs_bnetd_accountloginreqcxx . . $ pvpgn/t_d2cs_bnetd_accountloginreq#), MAX_USERNAME_LENcxx . . $ MAX_USERNAME_LEN.))) { |
| 192 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "missing or too long account name"); |
| 193 | return -1; |
| 194 | } |
| 195 | sessionkey = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..d2cs_bnetd_accountloginreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#d2cs_bnetd_accountloginreq..sessionkeycxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_5#sessionkey.); |
| 196 | sessionnum = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..d2cs_bnetd_accountloginreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#d2cs_bnetd_accountloginreq..sessionnumcxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_5#sessionnum.); |
| 197 | salt = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..d2cs_bnetd_accountloginreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#d2cs_bnetd_accountloginreq..seqnocxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_5#seqno.); |
| 198 | if (!(client = connlist_find_connection_by_sessionnumcxx . . $ pvpgn/bnetd/connlist_find_connection_by_sessionnum(d9e2ca1f510d44cc).(sessionnum))) { |
| 199 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "sessionnum {} not found", sessionnum); |
| 200 | reply = BNETD_D2CS_ACCOUNTLOGINREPLY_FAILEDcxx . . $ `src/common/d2cs_bnetd_protocol.h:80:9`!; |
| 201 | } |
| 202 | else if (sessionkey != conn_get_sessionkeycxx . . $ pvpgn/bnetd/conn_get_sessionkey(8bd2285a65940781).(client)) { |
| 203 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "sessionkey {} not match", sessionkey); |
| 204 | reply = BNETD_D2CS_ACCOUNTLOGINREPLY_FAILEDcxx . . $ `src/common/d2cs_bnetd_protocol.h:80:9`!; |
| 205 | } |
| 206 | else if (!(tname = conn_get_usernamecxx . . $ `src/bnetd/connection.h:361:9`!(client))) { |
| 207 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL username"); |
| 208 | reply = BNETD_D2CS_ACCOUNTLOGINREPLY_FAILEDcxx . . $ `src/common/d2cs_bnetd_protocol.h:80:9`!; |
| 209 | } |
| 210 | else if (strcasecmp(account, tname)) { |
| 211 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "username {} not match", account); |
| 212 | reply = BNETD_D2CS_ACCOUNTLOGINREPLY_FAILEDcxx . . $ `src/common/d2cs_bnetd_protocol.h:80:9`!; |
| 213 | } |
| 214 | else { |
| 215 | bn_int_set(&temp.saltcxx . . $ pvpgn/bnetd/on_d2cs_accountloginreq(8d07eb83d60bed1d).$anonymous_type_0#salt., salt); |
| 216 | bn_int_set(&temp.sessionkeycxx . . $ pvpgn/bnetd/on_d2cs_accountloginreq(8d07eb83d60bed1d).$anonymous_type_0#sessionkey., sessionkey); |
| 217 | bn_int_set(&temp.sessionnumcxx . . $ pvpgn/bnetd/on_d2cs_accountloginreq(8d07eb83d60bed1d).$anonymous_type_0#sessionnum., sessionnum); |
| 218 | bn_int_set(&temp.secretcxx . . $ pvpgn/bnetd/on_d2cs_accountloginreq(8d07eb83d60bed1d).$anonymous_type_0#secret., conn_get_secretcxx . . $ pvpgn/bnetd/conn_get_secret(8bd2285a65940781).(client)); |
| 219 | pass_str = account_get_passcxx . . $ pvpgn/bnetd/account_get_pass(4b37305d4a4563d0).(conn_get_accountcxx . . $ pvpgn/bnetd/conn_get_account(8df8b24b7c17a7f3).(client)); |
| 220 | if (hash_set_strcxx . . $ pvpgn/hash_set_str(bc9a1c18029b2ef4).(&passhash, pass_str) < 0) { |
| 221 | reply = BNETD_D2CS_ACCOUNTLOGINREPLY_FAILEDcxx . . $ `src/common/d2cs_bnetd_protocol.h:80:9`!; |
| 222 | } |
| 223 | else { |
| 224 | hash_to_bnhashcxx . . $ pvpgn/hash_to_bnhash(50eab12f45c1086c).((t_hashcxx . . $ pvpgn/t_hash# const *)&passhash, temp.passhashcxx . . $ pvpgn/bnetd/on_d2cs_accountloginreq(8d07eb83d60bed1d).$anonymous_type_0#passhash.); |
| 225 | bnet_hashcxx . . $ pvpgn/bnet_hash(2a8392f275be648).(&secret_hash, sizeof(temp), &temp); |
| 226 | bnhash_to_hashcxx . . $ pvpgn/bnhash_to_hash(8ced6dd31669b167).(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..d2cs_bnetd_accountloginreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#d2cs_bnetd_accountloginreq..secret_hashcxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_5#secret_hash., &try_hash); |
| 227 | if (hash_eqcxx . . $ pvpgn/hash_eq(4301982f75a4a5fa).(try_hash, secret_hash) == 1) { |
| 228 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, "user {} loggedin on d2cs", |
| 229 | account); |
| 230 | reply = BNETD_D2CS_ACCOUNTLOGINREPLY_SUCCEEDcxx . . $ `src/common/d2cs_bnetd_protocol.h:79:9`!; |
| 231 | } |
| 232 | else { |
| 233 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "user {} hash not match", |
| 234 | account); |
| 235 | reply = BNETD_D2CS_ACCOUNTLOGINREPLY_FAILEDcxx . . $ `src/common/d2cs_bnetd_protocol.h:80:9`!; |
| 236 | } |
| 237 | } |
| 238 | } |
| 239 | if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_d2cs_bnetdcxx . . $ pvpgn/packet_class_d2cs_bnetd.))) { |
| 240 | packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_bnetd_d2cs_accountloginreplycxx . . $ pvpgn/t_bnetd_d2cs_accountloginreply#)); |
| 241 | packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, BNETD_D2CS_ACCOUNTLOGINREPLYcxx . . $ `src/common/d2cs_bnetd_protocol.h:73:9`!); |
| 242 | bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..bnetd_d2cs_accountloginreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#bnetd_d2cs_accountloginreply..hcxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_6#h..seqnocxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_0#seqno., |
| 243 | bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..d2cs_bnetd_accountloginreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#d2cs_bnetd_accountloginreq..hcxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_5#h..seqnocxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_0#seqno.)); |
| 244 | bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..bnetd_d2cs_accountloginreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#bnetd_d2cs_accountloginreply..replycxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_6#reply., reply); |
| 245 | conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket); |
| 246 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket); |
| 247 | } |
| 248 | return 0; |
| 249 | } |
| 250 | |
| 251 | #define CHAR_PORTRAIT_LENcxx . . $ `src/bnetd/handle_d2cs.cpp:251:9`! 0x30 |
| 252 | static int on_d2cs_charloginreqcxx . . $ pvpgn/bnetd/on_d2cs_charloginreq(8d07eb83d60bed1d).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * c, t_packetcxx . . $ pvpgn/t_packet# const * packet) |
| 253 | { |
| 254 | t_connectioncxx . . $ pvpgn/bnetd/t_connection# * client; |
| 255 | char const * charname; |
| 256 | char const * portrait; |
| 257 | char const * clienttag; |
| 258 | char * temp; |
| 259 | unsigned int sessionnum; |
| 260 | t_realmcxx . . $ pvpgn/bnetd/t_realm# * realm; |
| 261 | char const * realmname; |
| 262 | unsigned int pos, reply; |
| 263 | t_packetcxx . . $ pvpgn/t_packet# * rpacket; |
| 264 | |
| 265 | if (packet_get_sizecxx . . $ pvpgn/packet_get_size(e4ac9e2b4744cb4b).(packet) < sizeof(t_d2cs_bnetd_charloginreqcxx . . $ pvpgn/t_d2cs_bnetd_charloginreq#)) { |
| 266 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad packet size"); |
| 267 | return -1; |
| 268 | } |
| 269 | sessionnum = bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..d2cs_bnetd_charloginreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#d2cs_bnetd_charloginreq..sessionnumcxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_7#sessionnum.); |
| 270 | pos = sizeof(t_d2cs_bnetd_charloginreqcxx . . $ pvpgn/t_d2cs_bnetd_charloginreq#); |
| 271 | if (!(charname = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, pos, MAX_CHARNAME_LENcxx . . $ MAX_CHARNAME_LEN.))) { |
| 272 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad character name"); |
| 273 | return -1; |
| 274 | } |
| 275 | pos += stdcxx . . $ std/::strlen(charname) + 1; |
| 276 | if (!(portrait = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, pos, CHAR_PORTRAIT_LENcxx . . $ `src/bnetd/handle_d2cs.cpp:251:9`!))) { |
| 277 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got bad character portrait"); |
| 278 | return -1; |
| 279 | } |
| 280 | if (!(client = connlist_find_connection_by_sessionnumcxx . . $ pvpgn/bnetd/connlist_find_connection_by_sessionnum(d9e2ca1f510d44cc).(sessionnum))) { |
| 281 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "user {} not found", sessionnum); |
| 282 | reply = BNETD_D2CS_CHARLOGINREPLY_FAILEDcxx . . $ `src/common/d2cs_bnetd_protocol.h:98:9`!; |
| 283 | } |
| 284 | else if (!(clienttag = clienttag_uint_to_str(conn_get_clienttagcxx . . $ pvpgn/bnetd/conn_get_clienttag(8bd2285a65940781).(client)))) { |
| 285 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL clienttag"); |
| 286 | reply = BNETD_D2CS_CHARLOGINREPLY_FAILEDcxx . . $ `src/common/d2cs_bnetd_protocol.h:98:9`!; |
| 287 | } |
| 288 | else if (!(realm = conn_get_realmcxx . . $ pvpgn/bnetd/conn_get_realm(c743a4e7d4d1463d).(client))) { |
| 289 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL realm"); |
| 290 | reply = BNETD_D2CS_CHARLOGINREPLY_FAILEDcxx . . $ `src/common/d2cs_bnetd_protocol.h:98:9`!; |
| 291 | } |
| 292 | else { |
| 293 | char revtag[8]; |
| 294 | |
| 295 | realmname = realm_get_namecxx . . $ pvpgn/bnetd/realm_get_name(83f045398bcf2fc5).(realm); |
| 296 | temp = (char*)xmalloccxx . . $ `src/common/xalloc.h:43:9`!(std::strlen(clienttag) + std::strlen(realmname) + 1 + std::strlen(charname) + 1 + |
| 297 | std::strlen(portrait) + 1); |
| 298 | reply = BNETD_D2CS_CHARLOGINREPLY_SUCCEEDcxx . . $ `src/common/d2cs_bnetd_protocol.h:97:9`!; |
| 299 | stdcxx . . $ std/::strcpy(revtag, clienttag); |
| 300 | strreversecxx . . $ pvpgn/strreverse(7a9722d75b371431).(revtag); |
| 301 | stdcxx . . $ std/::sprintfcxx . . $ std/sprintf(bb743b22d71e45d5).(temp, "%4s%s,%s,%s", revtag, realmname, charname, portrait); |
| 302 | conn_set_charnamecxx . . $ pvpgn/bnetd/conn_set_charname(2e9022cda97b266d).(client, charname); |
| 303 | conn_set_realminfocxx . . $ pvpgn/bnetd/conn_set_realminfo(2e9022cda97b266d).(client, temp); |
| 304 | xfreecxx . . $ `src/common/xalloc.h:51:9`!(temp); |
| 305 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_debugcxx . . $ pvpgn/eventlog_level_debug., __FUNCTION__, |
| 306 | "loaded portrait for character {}", charname); |
| 307 | } |
| 308 | if ((rpacket = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_d2cs_bnetdcxx . . $ pvpgn/packet_class_d2cs_bnetd.))) { |
| 309 | packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(rpacket, sizeof(t_bnetd_d2cs_charloginreplycxx . . $ pvpgn/t_bnetd_d2cs_charloginreply#)); |
| 310 | packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(rpacket, BNETD_D2CS_CHARLOGINREPLYcxx . . $ `src/common/d2cs_bnetd_protocol.h:91:9`!); |
| 311 | bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..bnetd_d2cs_charloginreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#bnetd_d2cs_charloginreply..hcxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_8#h..seqnocxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_0#seqno., |
| 312 | bn_int_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..d2cs_bnetd_charloginreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#d2cs_bnetd_charloginreq..hcxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_7#h..seqnocxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_0#seqno.)); |
| 313 | bn_int_set(&rpacket->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..bnetd_d2cs_charloginreplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#bnetd_d2cs_charloginreply..replycxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_8#reply., reply); |
| 314 | conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, rpacket); |
| 315 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(rpacket); |
| 316 | } |
| 317 | return 0; |
| 318 | } |
| 319 | |
| 320 | extern int handle_d2cs_initcxx . . $ pvpgn/bnetd/handle_d2cs_init(c4dfbc2386fe4fc3).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * c) |
| 321 | { |
| 322 | t_packetcxx . . $ pvpgn/t_packet# * packet; |
| 323 | |
| 324 | if ((packet = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_d2cs_bnetdcxx . . $ pvpgn/packet_class_d2cs_bnetd.))) { |
| 325 | packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(packet, sizeof(t_bnetd_d2cs_authreqcxx . . $ pvpgn/t_bnetd_d2cs_authreq#)); |
| 326 | packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(packet, BNETD_D2CS_AUTHREQcxx . . $ `src/common/d2cs_bnetd_protocol.h:38:9`!); |
| 327 | bn_int_set(&packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..bnetd_d2cs_authreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#bnetd_d2cs_authreq..hcxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_2#h..seqnocxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_0#seqno., 1); |
| 328 | bn_int_set(&packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..bnetd_d2cs_authreqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#bnetd_d2cs_authreq..sessionnumcxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_2#sessionnum., conn_get_sessionnumcxx . . $ pvpgn/bnetd/conn_get_sessionnum(8bd2285a65940781).(c)); |
| 329 | conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(c, packet); |
| 330 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(packet); |
| 331 | } |
| 332 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_infocxx . . $ pvpgn/eventlog_level_info., __FUNCTION__, "sent init packet to d2cs (sessionnum={})", |
| 333 | conn_get_sessionnumcxx . . $ pvpgn/bnetd/conn_get_sessionnum(8bd2285a65940781).(c)); |
| 334 | return 0; |
| 335 | } |
| 336 | |
| 337 | extern int send_d2cs_gameinforeqcxx . . $ pvpgn/bnetd/send_d2cs_gameinforeq(c4dfbc2386fe4fc3).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * c) |
| 338 | { |
| 339 | t_packetcxx . . $ pvpgn/t_packet# * packet; |
| 340 | t_game * game; |
| 341 | t_realmcxx . . $ pvpgn/bnetd/t_realm# * realm; |
| 342 | |
| 343 | if (!(c)) |
| 344 | { |
| 345 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL conn"); |
| 346 | return -1; |
| 347 | } |
| 348 | |
| 349 | if (!(game = conn_get_gamecxx . . $ pvpgn/bnetd/conn_get_game(692151a8f99bc3ef).(c))) |
| 350 | { |
| 351 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "conn had NULL game"); |
| 352 | return -1; |
| 353 | } |
| 354 | |
| 355 | if (!(realm = conn_get_realmcxx . . $ pvpgn/bnetd/conn_get_realm(c743a4e7d4d1463d).(c))) |
| 356 | { |
| 357 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "conn had NULL realm"); |
| 358 | return -1; |
| 359 | } |
| 360 | |
| 361 | |
| 362 | if ((packet = packet_createcxx . . $ pvpgn/packet_create(f721c565085e24c0).(packet_class_d2cs_bnetdcxx . . $ pvpgn/packet_class_d2cs_bnetd.))) { |
| 363 | packet_set_sizecxx . . $ pvpgn/packet_set_size(a12d8724e4c46208).(packet, sizeof(t_bnetd_d2cs_gameinforeqcxx . . $ pvpgn/t_bnetd_d2cs_gameinforeq#)); |
| 364 | packet_set_typecxx . . $ pvpgn/packet_set_type(a12d8724e4c46208).(packet, BNETD_D2CS_GAMEINFOREQcxx . . $ `src/common/d2cs_bnetd_protocol.h:100:9`!); |
| 365 | bn_int_set(&packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..bnetd_d2cs_gameinforeqcxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#bnetd_d2cs_gameinforeq..hcxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_9#h..seqnocxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_0#seqno., 0); |
| 366 | packet_append_stringcxx . . $ pvpgn/packet_append_string(41801851180b7cbb).(packet, game_get_namecxx . . $ pvpgn/bnetd/game_get_name(743fb6d1aa411c4e).(game)); |
| 367 | conn_push_outqueuecxx . . $ pvpgn/bnetd/conn_push_outqueue(212cf84cd7032d49).(realm_get_conncxx . . $ pvpgn/bnetd/realm_get_conn(f873919d1146ff54).(realm), packet); |
| 368 | packet_del_refcxx . . $ pvpgn/packet_del_ref(d23439d9c1f63082).(packet); |
| 369 | } |
| 370 | return 0; |
| 371 | } |
| 372 | |
| 373 | static int on_d2cs_gameinforeplycxx . . $ pvpgn/bnetd/on_d2cs_gameinforeply(8d07eb83d60bed1d).(t_connectioncxx . . $ pvpgn/bnetd/t_connection# * c, t_packetcxx . . $ pvpgn/t_packet# const * packet) |
| 374 | { |
| 375 | t_game * game; |
| 376 | char const * gamename; |
| 377 | unsigned int difficulty; |
| 378 | t_game_difficulty diff; |
| 379 | |
| 380 | if (!(c)) { |
| 381 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "got NULL connection"); |
| 382 | return -1; |
| 383 | } |
| 384 | |
| 385 | if (!(gamename = packet_get_str_constcxx . . $ pvpgn/packet_get_str_const(2621638e840efcc6).(packet, sizeof(t_d2cs_bnetd_gameinforeplycxx . . $ pvpgn/t_d2cs_bnetd_gameinforeply#), MAX_GAMENAME_LENcxx . . $ MAX_GAMENAME_LEN.))) |
| 386 | { |
| 387 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "missing or too long gamename"); |
| 388 | return -1; |
| 389 | } |
| 390 | |
| 391 | if (!(game = gamelist_find_gamecxx . . $ pvpgn/bnetd/gamelist_find_game(e383c2f40f0b546f).(gamename, CLIENTTAG_DIABLO2DV_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:99:9`!, game_type_diablo2closed)) |
| 392 | && !(game = gamelist_find_gamecxx . . $ pvpgn/bnetd/gamelist_find_game(e383c2f40f0b546f).(gamename, CLIENTTAG_DIABLO2XP_UINTcxx . . $ `/build/tmp.prHwK0hYwT/package/src/common/tag.h:105:9`!, game_type_diablo2closed))) |
| 393 | { |
| 394 | eventlogcxx . . $ pvpgn/eventlog(f1d8dd72586f1e25).(eventlog_level_errorcxx . . $ pvpgn/eventlog_level_error., __FUNCTION__, "reply for unknown game \"{}\"", gamename); |
| 395 | return -1; |
| 396 | } |
| 397 | |
| 398 | difficulty = bn_byte_get(packet->ucxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#u..d2cs_bnetd_gameinforeplycxx . . $ pvpgn/$anonymous_type_a1640d8ff791e3e5_2#$anonymous_type_3#d2cs_bnetd_gameinforeply..difficultycxx . . $ pvpgn/$anonymous_type_b0a976df95fb5a1_10#difficulty.); |
| 399 | |
| 400 | switch (difficulty) |
| 401 | { |
| 402 | case 0: |
| 403 | diff = game_difficulty_normal; |
| 404 | break; |
| 405 | case 1: |
| 406 | diff = game_difficulty_nightmare; |
| 407 | break; |
| 408 | case 2: |
| 409 | diff = game_difficulty_hell; |
| 410 | break; |
| 411 | default: |
| 412 | diff = game_difficulty_none; |
| 413 | } |
| 414 | |
| 415 | game_set_difficultycxx . . $ pvpgn/bnetd/game_set_difficulty(9a59f4516a0d09ce).(game, diff); |
| 416 | |
| 417 | return 0; |
| 418 | } |
| 419 | |
| 420 | } |
| 421 | |
| 422 | } |