29 #include <format/format.h> 30 #include "../bscript/eprog.h" 31 #include "../clib/clib_endian.h" 32 #include "../clib/fdump.h" 33 #include "../clib/logfacility.h" 34 #include "../clib/rawtypes.h" 35 #include "../clib/refptr.h" 36 #include "../clib/stlutil.h" 37 #include "../plib/systemstate.h" 72 using namespace Network;
99 bool msg_warmode = msg->
warmode ?
true :
false;
102 transmit( client, msg,
sizeof *msg );
110 if ( chr !=
nullptr )
114 msg->
name[
sizeof msg->
name - 1] =
'\0';
116 for (
char* p = msg->
name; *p; p++ )
119 if ( *p !=
' ' && !isalpha( *p ) )
122 tmp.Format(
"Client#{} (account {}) attempted an invalid rename (packet 0x{:X}):\n{}\n" )
124 << ( ( client->
acct != nullptr ) ? client->
acct->
name() :
"unknown" )
155 if ( prog.
get() != nullptr )
162 if ( mobile ==
nullptr )
170 if ( mobile ==
nullptr )
187 for ( i = 0; i < intextlen; i++ )
194 wtextbuf[wtextbuflen++] =
ctBEu16( wc );
219 std::string ver2 =
"";
271 POLLOG_INFO <<
"Suspect string length in PKTBI_BD packet: " << len <<
"\n";
295 if ( attrib ==
nullptr )
320 if ( multi !=
nullptr )
323 if ( house !=
nullptr )
338 if ( obj !=
nullptr )
380 if ( prog.
get() == nullptr )
386 if ( chr ==
nullptr )
393 if ( item ==
nullptr )
403 POLLOG_INFO.Format(
"{}/{} tried to use a popup menu, but none was active.\n" )
432 if ( the_mob !=
nullptr )
444 msgOut->WriteFlipped<
u16>( 37u );
446 msgOut->Write( the_mob->
name().c_str(), 30, false );
447 msgOut.
Send( client );
459 if ( length < 0 || ( length % 4 ) != 0 )
461 int count = length / 4;
463 for (
int i = 0; i < count; ++i )
466 if ( obj !=
nullptr )
504 os << detail.
major <<
"." << detail.
minor <<
"." << detail.
rev <<
"." << detail.
patch;
519 INFO_PRINT <<
"Unknown client type send with packet 0xE1 : 0x" 520 << fmt::hexu( static_cast<unsigned long>(
cfBEu32( msg->
clienttype ) ) ) <<
"\n";
532 if ( client ==
nullptr || client->
chr ==
nullptr )
537 if ( client && client->
chr && client->
chr->
serial != serial )
539 INFO_PRINT <<
"Ignoring spoofed packet 0xD7 from character 0x" 540 << fmt::hexu( client->
chr->
serial ) <<
" trying to spoof 0x" << fmt::hexu( serial )
612 if ( prog.
get() != nullptr )
622 if ( prog.
get() != nullptr )
632 if ( prog.
get() != nullptr )
virtual Bscript::BObjectImp * make_ref() POL_OVERRIDE
const struct VersionDetailStruct CLIENT_VER_60142
void handle_msg_BB(Client *client, PKTBI_BB *)
UObject * system_find_object(u32 serial)
const struct VersionDetailStruct CLIENT_VER_70130
const struct VersionDetailStruct CLIENT_VER_5020
void party_cmd_handler(Client *client, PKTBI_BF *msg)
void handle_mode_set(Client *client, PKTBI_72 *msg)
unsigned char lock() const
const struct VersionDetailStruct CLIENT_VER_7090
void CustomHousesErase(Core::PKTBI_D7 *msg)
void handle_char_profile_request(Client *client, PKTBI_B8_IN *msg)
void handle_msg_BF(Client *client, PKTBI_BF *msg)
void CustomHousesSynch(Core::PKTBI_D7 *msg)
void handle_unknown_packet(Client *client)
void OnChatButton(Client *client)
struct Pol::Core::PKTBI_D6_IN::@40 serials[1]
bool is_visible_to_me(const Character *chr) const
const struct VersionDetailStruct CLIENT_VER_4070
#define OSTRINGSTREAM_STR(x)
void transmit(Client *client, const void *data, int len)
void fdump(fmt::Writer &writer, const void *data, int len)
PKTBI_B8_IN_UPDATE profile_update
void(* on_popup_menu_selection)(Network::Client *client, u32 serial, u16 id)
void CustomHousesCommit(Core::PKTBI_D7 *msg)
u32 serial_request_popup_menu
void OnGuildButton(Client *client)
bool can_rename(const Character *chr) const
PKTBI_BF_1E reqfullcustomhouse
void do_cast(Network::Client *client, u16 spellid)
void handle_ef_seed(Client *client, PKTIN_EF *msg)
void ext_stats_in(Client *client, PKTBI_BF *msg)
void handle_client_version(Client *client, PKTBI_BD *msg)
void handle_e1_clienttype(Client *client, PKTIN_E1 *msg)
void send_move_mobile_to_nearby_cansee(const Character *chr)
Multi::UMulti * system_find_multi(u32 serial)
void send_move(Client *client, const Character *chr)
virtual class UHouse * as_house()
void handle_allnames(Client *client, PKTBI_98_IN *msg)
void send_goxyz(Client *client, const Character *chr)
const Mobile::Attribute * pAttrStrength
void CustomHousesQuit(Core::PKTBI_D7 *msg)
void Send(Client *client, int len=-1) const
const AttributeValue & attribute(unsigned attrid) const
const char * name() const
void CustomHousesRoofRemove(Core::PKTBI_D7 *msg)
void handle_bulletin_boards(Client *client, PKTBI_71 *)
void SendAOSTooltip(Network::Client *client, UObject *obj, bool vendor_content)
const struct VersionDetailStruct CLIENT_VER_6017
void OnQuestButton(Client *client)
const struct VersionDetailStruct CLIENT_VER_4000
const struct VersionDetailStruct CLIENT_VER_70331
const struct VersionDetailStruct CLIENT_VER_70300
void handle_rename_char(Client *client, PKTIN_75 *msg)
bool convertUCtoArray(const u16 *in_wtext, Bscript::ObjArray *&out_text, size_t textlen, bool ConvFromBE)
gameclock_t read_gameclock()
Reads the current value of the game clock.
void setname(const std::string &)
Mobile::Character * find_character(u32 serial)
bool compareVersion(const std::string &ver)
SettingsManager settingsManager
void setversiondetail(VersionDetailStruct &detail)
Mobile::Character * system_find_mobile(u32 serial)
void setversion(const std::string &ver)
CombatConfig combat_config
void handle_msg_B5(Client *client, PKTIN_B5 *)
const struct VersionDetailStruct CLIENT_VER_5000
bool IsCharacter(u32 serial)
Items::Item * system_find_item(u32 serial)
void setClientType(ClientTypeFlag type)
const Mobile::Attribute * pAttrIntelligence
void CustomHousesBackup(Core::PKTBI_D7 *msg)
unsigned short pol_distance(unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2)
std::string strlower(const std::string &str)
void set_warmode(bool warmode)
u32 UOExpansionFlagClient
bool start_script(Bscript::EScriptProgram *prog, bool start_attached, Bscript::BObjectImp *param2=nullptr, Bscript::BObjectImp *param3=nullptr, Bscript::BObjectImp *param4=nullptr)
void CustomHousesClear(Core::PKTBI_D7 *msg)
void CustomHousesSelectFloor(Core::PKTBI_D7 *msg)
const Mobile::Attribute * pAttrDexterity
void CustomHousesSendFull(UHouse *house, Network::Client *client, int design)
ref_ptr< Bscript::EScriptProgram > find_script(const std::string &name, bool complain_if_not_found, bool cache_script)
void CustomHousesRestore(Core::PKTBI_D7 *msg)
void handle_update_range_change(Client *client, PKTBI_C8 *)
void send_season_info(Client *client)
void send_object_cache(Network::Client *client, const UObject *obj)
const struct VersionDetailStruct CLIENT_VER_7000
virtual std::string name() const
void CustomHousesAdd(Core::PKTBI_D7 *msg)
void handle_unknown_C4(Client *client, PKTOUT_C4 *)
void CustomHousesRoofSelect(Core::PKTBI_D7 *msg)
unsigned int warmode_delay
void CustomHousesRevert(Core::PKTBI_D7 *msg)
void handle_se_object_list(Client *client, PKTBI_D6_IN *msgin)
void handle_aos_commands(Client *client, PKTBI_D7 *msg)
void CustomHousesAddMulti(Core::PKTBI_D7 *msg)
void send_sysmessage(Network::Client *client, const char *text, unsigned short font, unsigned short color)
void character_race_changer_handler(Network::Client *client, Core::PKTBI_BF *msg)
static void itemizeclientversion(const std::string &ver, VersionDetailStruct &detail)
PKTBI_B8_IN_REQUEST profile_request