33 #include "pol_global_config.h" 39 #include "../../bscript/berror.h" 40 #include "../../bscript/bobject.h" 41 #include "../../bscript/bstruct.h" 42 #include "../../bscript/eprog.h" 43 #include "../../bscript/executor.h" 44 #include "../../bscript/impstr.h" 45 #include "../../clib/Program/ProgramConfig.h" 46 #include "../../clib/clib.h" 47 #include "../../clib/clib_endian.h" 48 #include "../../clib/compilerspecifics.h" 49 #include "../../clib/logfacility.h" 50 #include "../../clib/make_unique.hpp" 51 #include "../../clib/passert.h" 52 #include "../../clib/rawtypes.h" 53 #include "../../clib/refptr.h" 54 #include "../../plib/pkg.h" 55 #include "../../plib/staticblock.h" 56 #include "../../plib/systemstate.h" 57 #include "../accounts/account.h" 58 #include "../accounts/accounts.h" 59 #include "../accounts/acscrobj.h" 60 #include "../containr.h" 62 #include "../exscrobj.h" 63 #include "../globals/memoryusage.h" 64 #include "../globals/script_internals.h" 65 #include "../globals/state.h" 66 #include "../globals/uvars.h" 67 #include "../item/item.h" 68 #include "../item/itemdesc.h" 69 #include "../layers.h" 70 #include "../mobile/charactr.h" 71 #include "../mobile/npc.h" 72 #include "../multi/customhouses.h" 73 #include "../multi/house.h" 74 #include "../multi/multi.h" 75 #include "../multi/multidef.h" 76 #include "../network/cgdata.h" 77 #include "../network/client.h" 78 #include "../network/packethelper.h" 79 #include "../network/packetinterface.h" 80 #include "../network/packets.h" 81 #include "../objtype.h" 82 #include "../pktboth.h" 83 #include "../pktdef.h" 85 #include "../polclass.h" 86 #include "../profile.h" 87 #include "../realms/realm.h" 88 #include "../reftypes.h" 89 #include "../scrstore.h" 90 #include "../sngclick.h" 91 #include "../statmsg.h" 92 #include "../tooltips.h" 93 #include "../uconst.h" 95 #include "../uobject.h" 96 #include "../uoexec.h" 97 #include "../uoscrobj.h" 98 #include "../uworld.h" 103 #include "../../clib/opnew.h" 107 #ifdef USE_SYSTEM_ZLIB 110 #include "../../../lib/zlib/zlib.h" 122 using namespace Bscript;
123 using namespace Network;
125 using namespace Items;
126 using namespace Core;
128 #define CONST_DEFAULT_ZRANGE 19 181 for (
int i = for_sale->
count() - 1; i >= 0; --i )
183 Item* item = ( *for_sale )[i];
186 size_t addlen = 5 + desc.size();
187 if ( msg->offset + addlen >
sizeof msg->buffer )
192 msg->Write<
u8>( desc.size() + 1 );
193 msg->Write( desc.c_str(),
static_cast<u16>( desc.size() + 1 ) );
196 if ( send_aos_tooltip )
199 u16 len = msg->offset;
201 msg->WriteFlipped<
u16>( len );
203 msg->Write<
u8>( num_items );
204 msg.
Send( client, len );
215 unsigned char save_layer_one, save_layer_two;
219 getParam( 4, flags ) )
223 return new BError(
"No client connected to character" );
232 return new BError(
"Parameter 1 invalid" );
237 merchant =
static_cast<NPC*
>( mrchnt );
241 return new BError(
"Parameter 2 invalid" );
250 return new BError(
"Parameter 3 invalid" );
257 return new BError(
"A parameter was invalid" );
262 save_layer_one = for_sale->
layer;
265 for_sale->
layer = save_layer_one;
266 for_sale->
x = merchant->
x;
267 for_sale->
y = merchant->
y;
268 for_sale->
z = merchant->
z;
271 save_layer_two = bought->
layer;
274 bought->
layer = save_layer_two;
275 bought->
x = merchant->
x;
276 bought->
y = merchant->
y;
277 bought->
z = merchant->
z;
294 return new BError(
"Too much crap in vendor's inventory!" );
303 return new BError(
"Too much crap in vendor's inventory!" );
309 open_window->WriteFlipped<
u16>( 0x0030u );
311 open_window->WriteFlipped<
u16>( 0x00u );
319 return new BLong( 1 );
326 msg->WriteFlipped<
u16>(
sizeof msg->buffer );
334 unsigned int amt = 0;
338 for (
int i = 0; i < nitems; ++i )
341 Item* item = for_sale->
find( serial );
342 if ( item ==
nullptr )
344 item = bought->
find( serial );
345 if ( item ==
nullptr )
362 if ( backpack ==
nullptr )
374 if ( for_sale ==
nullptr || for_sale->
orphan() )
381 if ( vendor_bought ==
nullptr || vendor_bought->
orphan() )
387 unsigned int total_cost =
calculate_cost( vendor, for_sale, vendor_bought, msg );
394 unsigned int amount_spent = 0;
402 for (
int i = 0; i < nitems; ++i )
406 Item* fs_item = for_sale->
find( serial );
407 if ( fs_item ==
nullptr )
409 fs_item = vendor_bought->
find( serial );
410 if ( fs_item ==
nullptr )
422 if ( fs_item ==
nullptr )
432 Item* tobuy =
nullptr;
440 vendor_bought->
remove( fs_item );
442 for_sale->
remove( fs_item );
450 Item* existing_stack;
456 existing_stack, tobuy->
getamount(), tobuy ) )
472 vendor_bought->
add( tobuy );
474 for_sale->
add( tobuy );
478 amount_spent += tobuy->
sellprice() * num;
486 else if ( backpack->
can_add( *tobuy ) )
507 vendor_bought->
add( tobuy );
509 for_sale->
add( tobuy );
517 amount_spent += tobuy->
sellprice() * num;
531 vendor_bought->
add( tobuy );
533 for_sale->
add( tobuy );
542 sale_event->addMember(
"amount",
new BLong( amount_spent ) );
561 if ( backpack ==
nullptr )
574 if ( for_sale ==
nullptr || for_sale->
orphan() )
580 if ( vendor_bought ==
nullptr || vendor_bought->
orphan() )
591 std::unique_ptr<ObjArray> items_bought(
new ObjArray );
592 for (
int i = 0; i < nitems; ++i )
595 if ( fs_item ==
nullptr )
598 if ( fs_item ==
nullptr )
606 std::unique_ptr<BStruct> entry(
new BStruct );
607 entry->addMember(
"item", fs_item->
make_ref() );
608 entry->addMember(
"amount",
new BLong( numleft ) );
610 items_bought->addElement( entry.release() );
614 sale_event->addMember(
"shoppinglist", items_bought.release() );
621 bool send_aos_tooltip )
623 unsigned short num_items = 0;
630 if ( buyable !=
nullptr )
631 buyable_end = buyable->
end();
634 while ( cont !=
nullptr )
642 if ( cont2->
count() )
647 unsigned int buyprice;
651 if ( msg->offset + desc.size() + 14 >
sizeof msg->buffer )
655 if ( buyable !=
nullptr )
657 for ( buyable_itr = buyable->
begin(); buyable_itr != buyable_end; ++buyable_itr )
663 if ( buyable_itr == buyable_end )
669 msg->WriteFlipped<
u16>( item->
color );
671 msg->WriteFlipped<
u16>( buyprice );
672 msg->WriteFlipped<
u16>( desc.size() );
673 msg->Write( desc.c_str(),
static_cast<u16>( desc.size() ),
false );
676 if ( send_aos_tooltip )
682 u16 len = msg->offset;
684 msg->WriteFlipped<
u16>( len );
686 msg->WriteFlipped<
u16>( num_items );
687 msg.
Send( client, len );
704 getItemParam( exec, 4, wi1c ) && getParam( 5, flags ) ) )
706 return new BError(
"A parameter was invalid" );
711 return new BError(
"No client connected to character" );
716 merchant =
static_cast<NPC*
>( mrchnt );
720 return new BError(
"Parameter 1 invalid" );
724 merchant_bought =
static_cast<UContainer*
>( wi1b );
728 return new BError(
"Parameter 2 must be a container" );
735 merchant_buyable =
static_cast<UContainer*
>( wi1c );
739 return new BError(
"Parameter 3 must be a container" );
745 return new BError(
"Character has no backpack" );
748 unsigned char save_layer = wi1a->
layer;
751 wi1a->
layer = save_layer;
753 save_layer = wi1b->
layer;
756 wi1b->
layer = save_layer;
758 save_layer = wi1c->
layer;
761 wi1c->
layer = save_layer;
770 return new BLong( 1 );
774 unsigned short amount,
bool force_stacking,
780 if ( backpack ==
nullptr )
793 if ( vendor_bought ==
nullptr || vendor_bought->
orphan() )
800 unsigned int cost = 0;
804 for (
int i = 0; i < num_items; ++i )
809 unsigned int buyprice;
812 if ( item ==
nullptr )
822 Item* remainder_not_sold =
nullptr;
826 if ( vendor_bought->
can_add( *item ) )
831 if ( remainder_not_sold !=
nullptr )
835 backpack->
add( remainder_not_sold );
837 remainder_not_sold =
nullptr;
844 vendor_bought->
add( item );
846 cost += buyprice * amount;
849 if ( remainder_not_sold !=
nullptr )
860 unsigned int temp_cost = cost;
861 while ( temp_cost > 60000 )
864 static_cast<unsigned short>( 60000 ),
false,
871 static_cast<unsigned short>( temp_cost ),
false,
876 sale_event->addMember(
"amount",
new BLong( cost ) );
898 if ( backpack ==
nullptr )
910 if ( vendor_bought ==
nullptr || vendor_bought->
orphan() )
918 std::unique_ptr<ObjArray> items_sold(
new ObjArray );
920 for (
int i = 0; i < num_items; ++i )
927 if ( item ==
nullptr )
936 std::unique_ptr<BStruct> entry(
new BStruct );
937 entry->addMember(
"item", item->
make_ref() );
938 entry->addMember(
"amount",
new BLong( amount ) );
940 items_sold->addElement( entry.release() );
943 sale_event->addMember(
"shoppinglist", items_sold.release() );
961 int x, y, flags, gump_id;
965 if ( !(
getCharacterParam( exec, 0, chr ) && exec.getObjArrayParam( 1, layout_arr ) &&
966 exec.getObjArrayParam( 2, data_arr ) && exec.getParam( 3, x ) && exec.getParam( 4, y ) &&
967 exec.getParam( 5, flags ) && exec.getParam( 6, gump_id ) ) )
969 return new BError(
"Invalid parameter" );
973 return new BError(
"No client attached" );
982 return new BError(
"GumpID out of range" );
983 gumpid = (
u32)gump_id;
985 return new BError(
"GumpID out of range" );
991 gumpid = this->uoexec.os_module->pid();
1003 return internal_SendCompressedGumpMenu( chr, layout_arr, data_arr, x, y, gumpid );
1005 return internal_SendUnCompressedGumpMenu( chr, layout_arr, data_arr, x, y, gumpid );
1017 msg->WriteFlipped<
u32>( gumpid );
1018 msg->WriteFlipped<
u32>(
static_cast<u32>( x ) );
1019 msg->WriteFlipped<
u32>(
static_cast<u32>( y ) );
1020 u16 pos = msg->offset;
1022 size_t layoutlen = 0;
1023 for (
unsigned i = 0; i < layout_arr->
ref_arr.size(); ++i )
1026 if ( bo ==
nullptr )
1031 size_t addlen = 4 + s.length();
1032 layoutlen += addlen;
1033 if ( msg->offset + addlen >
sizeof msg->buffer )
1035 return new BError(
"Buffer length exceeded" );
1037 msg->Write(
"{ ", 2,
false );
1038 msg->Write( s.c_str(),
static_cast<u16>( s.length() ),
false );
1039 msg->Write(
" }", 2,
false );
1042 if ( msg->offset + 1 > static_cast<int>(
sizeof msg->buffer ) )
1044 return new BError(
"Buffer length exceeded" );
1049 u16 len = msg->offset;
1051 msg->WriteFlipped<
u16>( layoutlen );
1056 if ( msg->offset + 2 > static_cast<int>(
sizeof msg->buffer ) )
1058 return new BError(
"Buffer length exceeded" );
1063 for (
unsigned i = 0; i < data_arr->
ref_arr.size(); ++i )
1066 if ( bo ==
nullptr )
1071 const char*
string = s.c_str();
1073 size_t textlen = s.length();
1075 if ( msg->offset + 2 + textlen * 2 >
sizeof msg->buffer )
1077 return new BError(
"Buffer length exceeded" );
1080 msg->WriteFlipped<
u16>( textlen );
1083 msg->Write<
u16>(
static_cast<u16>( ( *
string++ ) << 8 ) );
1086 if ( msg->offset + 1 > static_cast<int>(
sizeof msg->buffer ) )
1088 return new BError(
"Buffer length exceeded" );
1094 msg->WriteFlipped<
u16>( numlines );
1096 msg->WriteFlipped<
u16>( len );
1098 if ( !uoexec.suspend() )
1100 DEBUGLOG <<
"Script Error in '" << scriptname() <<
"' PC=" << exec.PC <<
": \n" 1101 <<
"\tCall to function UO::SendDialogGump():\n" 1102 <<
"\tThe execution of this script can't be blocked!\n";
1111 return new BLong( 0 );
1123 msg->WriteFlipped<
u32>( gumpid );
1124 msg->WriteFlipped<
u32>(
static_cast<u16>( x ) );
1125 msg->WriteFlipped<
u32>(
static_cast<u16>( y ) );
1130 for (
unsigned i = 0; i < layout_arr->
ref_arr.size(); ++i )
1133 if ( bo ==
nullptr )
1138 size_t addlen = 4 + s.length();
1139 if ( layoutdlen + addlen >
sizeof bfr->buffer )
1141 return new BError(
"Buffer length exceeded" );
1143 layoutdlen +=
static_cast<u32>( addlen );
1144 bfr->Write(
"{ ", 2,
false );
1145 bfr->Write( s.c_str(),
static_cast<u16>( s.length() ),
false );
1146 bfr->Write(
" }", 2,
false );
1148 if ( layoutdlen + 1 > static_cast<u32>(
sizeof bfr->buffer ) )
1150 return new BError(
"Buffer length exceeded" );
1155 unsigned long cbuflen =
1156 ( ( (
unsigned long)( ( (
float)( layoutdlen ) ) * 1.001f ) ) + 12 );
1157 if ( cbuflen > ( (
unsigned long)( 0xFFFF - msg->offset ) ) )
1159 return new BError(
"Compression error" );
1162 if ( compress2( reinterpret_cast<unsigned char*>( msg->getBuffer() ), &cbuflen,
1163 reinterpret_cast<unsigned char*>( &bfr->buffer ), layoutdlen,
1164 Z_DEFAULT_COMPRESSION ) != Z_OK )
1166 return new BError(
"Compression error" );
1169 msg->WriteFlipped<
u32>( cbuflen + 4 );
1170 msg->WriteFlipped<
u32>( layoutdlen );
1171 msg->offset +=
static_cast<u16>( cbuflen );
1178 for (
unsigned i = 0; i < data_arr->
ref_arr.size(); ++i )
1181 if ( bo ==
nullptr )
1186 const char*
string = s.c_str();
1188 size_t addlen = ( s.length() + 1 ) * 2;
1189 if ( datadlen + addlen >
sizeof bfr->buffer )
1191 return new BError(
"Buffer length exceeded" );
1193 datadlen +=
static_cast<u32>( addlen );
1194 bfr->WriteFlipped<
u16>( s.length() );
1196 bfr->Write<
u16>(
static_cast<u16>( ( *
string++ ) << 8 ) );
1198 msg->WriteFlipped<
u32>( numlines );
1199 if ( numlines != 0 )
1203 cbuflen = ( ( (
unsigned long)( ( (
float)( datadlen ) ) * 1.001f ) ) + 12 );
1204 if ( cbuflen > ( (
unsigned long)( 0xFFFF - msg->offset ) ) )
1206 return new BError(
"Compression error" );
1208 if ( compress2( reinterpret_cast<unsigned char*>( msg->getBuffer() ), &cbuflen,
1209 reinterpret_cast<unsigned char*>( &bfr->buffer ), datadlen,
1210 Z_DEFAULT_COMPRESSION ) != Z_OK )
1212 return new BError(
"Compression error" );
1216 msg->WriteFlipped<
u32>( cbuflen + 4 );
1217 msg->WriteFlipped<
u32>( datadlen );
1218 msg->offset +=
static_cast<u16>( cbuflen );
1221 msg->Write<
u32>( 0u );
1222 u16 len = msg->offset;
1224 msg->WriteFlipped<
u16>( len );
1226 if ( !uoexec.suspend() )
1228 DEBUGLOG <<
"Script Error in '" << scriptname() <<
"' PC=" << exec.PC <<
": \n" 1229 <<
"\tCall to function UO::SendDialogGump():\n" 1230 <<
"\tThe execution of this script can't be blocked!\n";
1239 return new BLong( 0 );
1275 (
sizeof(
int ) +
sizeof(
BObjectRef ) + (
sizeof(
void* ) * 3 + 1 ) / 2 ) *
contents_.size();
1278 size += p.second.sizeEstimate();
1296 if ( stricmp( membername,
"keys" ) == 0 )
1301 Contents::const_iterator itr, end;
1304 int key = ( *itr ).first;
1321 const BLong& lng =
static_cast<const BLong&
>( objimp );
1335 return BObjectRef(
new BError(
"Incorrect type used as subscript to inthash" ) );
1353 ( getParamImp( 2, resp ) ) ) )
1355 return new BError(
"Invalid parameter" );
1359 return new BError(
"No client attached" );
1364 if ( uoemod ==
nullptr )
1366 return new BError(
"Couldnt find script" );
1370 msg->WriteFlipped<
u16>( 13u );
1372 msg->WriteFlipped<
u32>(
pid );
1380 return new BLong( 1 );
1391 return new BError(
"Invalid parameter" );
1394 return new BError(
"No client attached" );
1399 return new BError(
"Invalid object, has to be a containerRef" );
1405 return new BError(
"Invalid object, has to be a mobRef" );
1408 return new BError(
"Invalid type" );
1411 msg->WriteFlipped<
u16>( 13u );
1413 msg->WriteFlipped<
u32>(
type );
1418 return new BLong( 1 );
1423 const u32 VIRTUE_GUMP_ID = 0x1CD;
1425 char* msgbuf =
reinterpret_cast<char*
>( msg );
1434 if ( gumpid == VIRTUE_GUMP_ID )
1438 if ( buttonid == 1 )
1447 "misc/virtuebutton",
true,
Plib::systemstate.config.cache_interactive_scripts );
1448 if ( prog.
get() != nullptr )
1459 if ( uoemod ==
nullptr )
1462 "\nWarning: Character 0x{:X} sent an unexpected gump menu selection. Gump ID 0x{:X}, " 1463 "button ID 0x{:X}\n" )
1464 << client->
chr->
serial << gumpid << buttonid;
1475 if ( buttonid == 0 )
1481 std::unique_ptr<BIntHash> hash(
new BIntHash );
1482 hash->add( 0,
new BLong( buttonid ) );
1483 hash->add( buttonid,
new BLong( 1 ) );
1495 if ( stridx > msglen )
1497 ERROR_PRINT <<
"Blech! B1 message specified too many ints!\n";
1510 <<
") Blech! B1 message specified too many ints and/or strings!\n";
1512 new BObject(
new BError(
"B1 message specified too many ints and/or strings." ) ) );
1517 if ( ints_count == 0 && strings_count == 0 && buttonid == 0 )
1523 std::unique_ptr<BIntHash> hash(
new BIntHash );
1524 hash->add( 0,
new BLong( buttonid ) );
1525 hash->add( buttonid,
new BLong( 1 ) );
1526 for (
unsigned i = 0; i < ints_count; ++i )
1528 hash->add(
cfBEu32( intentries[i].value ),
new BLong( 1 ) );
1530 for (
unsigned i = 0; i < strings_count; ++i )
1536 if ( stridx > msglen )
1540 <<
") Blech! B1 message strings overflow message buffer!\n";
1545 str.reserve( length + str.size() );
1547 for (
int si = 0; si < length; ++si )
1551 c = strentry->
data[si * 2 + 1];
1575 exec.getParam( 2, cancel ) && exec.getParam( 3, style ) && exec.getParam( 4, maximum ) &&
1576 exec.getStringParam( 5, line2 ) ) )
1578 return new BError(
"Invalid parameter" );
1582 return new BError(
"No client attached" );
1590 size_t numbytes = line1->
length() + 1;
1591 if ( numbytes > 256 )
1593 msg->WriteFlipped<
u16>( numbytes );
1594 msg->Write( line1->
data(),
static_cast<u16>( numbytes ) );
1596 msg->Write<
u8>(
static_cast<u8>( cancel ) );
1597 msg->Write<
u8>(
static_cast<u8>( style ) );
1598 msg->WriteFlipped<
s32>( maximum );
1599 numbytes = line2->
length() + 1;
1600 if ( numbytes > 256 )
1602 msg->WriteFlipped<
u16>( numbytes );
1603 msg->Write( line2->
data(),
static_cast<u16>( numbytes ) );
1604 u16 len = msg->offset;
1606 msg->WriteFlipped<
u16>( len );
1608 if ( !uoexec.suspend() )
1610 DEBUGLOG <<
"Script Error in '" << scriptname() <<
"' PC=" << exec.PC <<
": \n" 1611 <<
"\tCall to function UO::SendTextEntryGump():\n" 1612 <<
"\tThe execution of this script can't be blocked!\n";
1618 textentry_chr = chr;
1620 return new BLong( 0 );
1628 << client->
chr->
name() <<
")used out-of-sequence textentry command?\n";
1635 if ( datalen >= 1 && datalen <= 256 && msg->
data[datalen - 1] ==
'\0' )
1640 for (
int i = 0; i < datalen; ++i )
1642 if ( !isprint( msg->
data[i] ) )
1692 return "PolCoreRef";
1701 std::unique_ptr<ObjArray> arr(
new ObjArray );
1706 arr->addElement(
new String( pkg->
name() ) );
1708 return arr.release();
1723 for (
const auto& script : ranlist )
1727 for (
const auto& script : runlist )
1743 for (
const auto& script : ranlist )
1747 for (
const auto& script : runlist )
1751 for (
const auto& script : holdlist )
1753 add_script( arr, ( script ).second,
"Sleeping" );
1755 for (
const auto& script : notimeoutholdlist )
1764 std::unique_ptr<ObjArray> arr = Clib::make_unique<ObjArray>();
1766 u64 total_instr = 0;
1778 std::unique_ptr<BStruct> elem = Clib::make_unique<BStruct>();
1779 elem->addMember(
"name",
new String( eprog->
name ) );
1780 elem->addMember(
"instr",
new Double( static_cast<double>( eprog->
instr_cycles ) ) );
1783 elem->addMember(
"instr_per_invoc",
new Double( static_cast<double>( cycles_per_invoc ) ) );
1784 double cycle_percent =
1785 total_instr != 0 ? (
static_cast<double>( eprog->
instr_cycles ) / total_instr * 100.0 ) : 0;
1786 elem->addMember(
"instr_percent",
new Double( cycle_percent ) );
1788 arr->addElement( elem.release() );
1790 return arr.release();
1795 std::unique_ptr<BStruct> arr(
new BStruct );
1798 arr->addMember(
"sent", sent );
1801 arr->addMember(
"received", received );
1803 for (
unsigned i = 0; i < 256; ++i )
1805 std::unique_ptr<BStruct> elem = Clib::make_unique<BStruct>();
1811 for (
unsigned i = 0; i < 256; ++i )
1813 std::unique_ptr<BStruct> elem(
new BStruct );
1819 return arr.release();
1834 using namespace PacketWriterDefs;
1835 std::unique_ptr<ObjArray> pkts = Clib::make_unique<ObjArray>();
1837 for ( PacketQueueMap::iterator it = map->begin(); it != map->end(); ++it )
1839 std::unique_ptr<BStruct> elem(
new BStruct );
1840 elem->addMember(
"pkt",
new BLong( it->first ) );
1841 elem->addMember(
"count",
new BLong( static_cast<int>( it->second->Count() ) ) );
1842 pkts->addElement( elem.release() );
1843 if ( it->second->HasSubs() )
1846 for ( PacketInterfaceQueueMap::iterator s_it = submap->begin(); s_it != submap->end();
1849 std::unique_ptr<BStruct> elemsub(
new BStruct );
1850 elemsub->addMember(
"pkt",
new BLong( it->first ) );
1851 elemsub->addMember(
"sub",
new BLong( s_it->first ) );
1852 elemsub->addMember(
"count",
new BLong( static_cast<int>( s_it->second.size() ) ) );
1853 pkts->addElement( elemsub.release() );
1857 return pkts.release();
1862 #define LONG_COREVAR( name, expr ) \ 1863 if ( stricmp( corevar, #name ) == 0 ) \ 1864 return new BLong( static_cast<int>( expr ) ); 1866 if ( stricmp( corevar,
"itemcount" ) == 0 )
1868 if ( stricmp( corevar,
"mobilecount" ) == 0 )
1871 if ( stricmp( corevar,
"bytes_sent" ) == 0 )
1873 if ( stricmp( corevar,
"bytes_received" ) == 0 )
1897 if ( stricmp( corevar,
"verstr" ) == 0 )
1898 return new String( POL_VERSION_ID );
1899 if ( stricmp( corevar,
"compiledatetime" ) == 0 )
1901 if ( stricmp( corevar,
"packages" ) == 0 )
1903 if ( stricmp( corevar,
"running_scripts" ) == 0 )
1905 if ( stricmp( corevar,
"all_scripts" ) == 0 )
1907 if ( stricmp( corevar,
"script_profiles" ) == 0 )
1909 if ( stricmp( corevar,
"iostats" ) == 0 )
1911 if ( stricmp( corevar,
"queued_iostats" ) == 0 )
1913 if ( stricmp( corevar,
"pkt_status" ) == 0 )
1915 if ( stricmp( corevar,
"memory_usage" ) == 0 )
1918 return new BError( std::string(
"Unknown core variable " ) + corevar );
1928 if ( stricmp( methodname,
"log_profile" ) == 0 )
1931 return new BError(
"polcore.log_profile(clear) requires 1 parameter." );
1936 return new BLong( 1 );
1939 else if ( stricmp( methodname,
"set_priority_divide" ) == 0 )
1942 return new BError(
"polcore.set_priority_divide(value) requires 1 parameter." );
1944 if ( ex.
getParam( 0, div, 1, 1000 ) )
1947 return new BLong( 1 );
1954 else if ( stricmp( methodname,
"clear_script_profile_counters" ) == 0 )
1957 return new BError(
"polcore.clear_script_profile_counters() doesn't take parameters." );
1959 return new BLong( 1 );
1961 else if ( stricmp( methodname,
"internal" ) == 0 )
1972 strftime( buffer,
sizeof buffer,
"%m/%d %H:%M:%S", &time_tm );
1973 DEBUGLOG <<
"[" << buffer <<
"] polcore().internal\n";
1980 ConfigFiles_log_stuff();
1984 #ifdef ESCRIPT_PROFILE 1985 DEBUGLOG <<
"FuncName,Count,Min,Max,Sum,Avarage\n";
1986 for ( escript_profile_map::iterator itr = EscriptProfileMap.begin();
1987 itr != EscriptProfileMap.end(); ++itr )
1989 DEBUGLOG << itr->first <<
"," << itr->second.count <<
"," << itr->second.min <<
"," 1990 << itr->second.max <<
"," << itr->second.sum <<
"," 1991 << ( itr->second.sum / ( 1.0 * itr->second.count ) ) <<
"\n";
1998 else if ( type == 3 )
2004 else if ( type == 4 )
2009 return new BLong( 1 );
2012 return new BError(
"polcore.internal(value) requires 1 parameter." );
2034 if ( getStringParam( 0, acctname ) && getStringParam( 1, password ) && getParam( 2, enabled ) )
2039 "Attempted to use username in account creation with non-allowed characters." );
2044 "Attempted to use password in account creation with non-allowed characters." );
2049 return new BError(
"Account already exists" );
2054 enabled ?
true : false );
2060 return new BError(
"Invalid parameter type" );
2067 if ( getStringParam( 0, acctname ) )
2070 if ( acct !=
nullptr )
2076 return new BError(
"Account not found." );
2081 return new BError(
"Invalid parameter type" );
2087 std::unique_ptr<ObjArray> arr(
new ObjArray );
2092 return arr.release();
2117 return new BError(
"Invalid parameter type" );
2119 return new BError(
"No client attached" );
2121 return new BError(
"Client busy with another instares dialog" );
2123 if ( !uoexec.suspend() )
2125 DEBUGLOG <<
"Script Error in '" << scriptname() <<
"' PC=" << exec.PC <<
": \n" 2126 <<
"\tCall to function UO::SendInstaResDialog():\n" 2127 <<
"\tThe execution of this script can't be blocked!\n";
2135 resurrect_chr = chr;
2137 return new BLong( 0 );
2146 if ( color >= 2 && color <= 1001 )
2152 valstack =
new BObject(
new BError(
"Client selected an out-of-range color" ) );
2155 POLLOG_ERROR.Format(
"Client #{:d} (account {}) selected an out-of-range color 0x{:X}\n" )
2156 <<
static_cast<unsigned long>( client->
instance_ )
2157 << ( ( client->
acct !=
nullptr ) ? client->
acct->
name() :
"unknown" ) << color;
2176 return new BError(
"Invalid parameter type" );
2179 return new BError(
"No client attached" );
2181 return new BError(
"Client is already selecting a color" );
2188 if ( !uoexec.suspend() )
2190 DEBUGLOG <<
"Script Error in '" << scriptname() <<
"' PC=" << exec.PC <<
": \n" 2191 <<
"\tCall to function UO::SelectColor():\n" 2192 <<
"\tThe execution of this script can't be blocked!\n";
2200 return new BLong( 0 );
2210 return new BError(
"Invalid parameter type" );
2214 return new BError(
"No active client" );
2222 BLong* blong =
static_cast<BLong*
>( nlines_ob.impptr() );
2223 nlines = blong->
value();
2227 return new BError(
"book.GetNumLines() did not return an Integer" );
2232 int npages = ( nlines + 7 ) / 8;
2241 return contents_ob->
copy();
2243 return new BError(
"book.GetContents() must return an array" );
2249 msg93->Write<
u8>( writable ? 1u : 0u );
2250 msg93->Write<
u8>( 1u );
2251 msg93->WriteFlipped<
u16>(
static_cast<u16>( npages ) );
2252 msg93->Write( title.c_str(), 60, false );
2253 msg93->Write( author.c_str(), 30, false );
2261 msg->WriteFlipped<
u16>(
static_cast<u16>( npages ) );
2266 for (
int page = 1; page <= npages; ++page )
2268 if ( msg->offset + 4 > static_cast<int>(
sizeof msg->buffer ) )
2270 return new BError(
"Buffer overflow" );
2272 msg->WriteFlipped<
u16>(
static_cast<u16>( page ) );
2273 u16 offset = msg->offset;
2277 for ( pagelines = 0; pagelines < 8 && linenum <= nlines; ++pagelines, ++linenum )
2280 std::string linetext;
2283 if ( msg->offset + linetext.size() + 1 >
sizeof msg->buffer )
2285 return new BError(
"Buffer overflow" );
2287 msg->Write( linetext.c_str(),
static_cast<u16>( linetext.size() + 1 ) );
2289 u16 len = msg->offset;
2290 msg->offset = offset;
2291 msg->WriteFlipped<
u16>(
static_cast<u16>( pagelines ) );
2324 u16 len = msg->offset;
2326 msg->WriteFlipped<
u16>( len );
2330 return new BLong( 1 );
2338 if ( book ==
nullptr )
2340 POLLOG.Format(
"Unable to find book 0x{:X} for character 0x{:X}\n" )
2345 if ( msg->
lines == 0xFFFF )
2351 BLong* blong =
static_cast<BLong*
>( nlines_ob.impptr() );
2352 nlines = blong->
value();
2360 msgOut->offset += 2;
2362 msgOut->WriteFlipped<
u16>( 1u );
2364 int linenum = ( page - 1 ) * 8 + 1;
2366 msgOut->WriteFlipped<
u16>( page );
2367 u16 offset = msgOut->offset;
2368 msgOut->offset += 2;
2371 for ( pagelines = 0; pagelines < 8 && linenum <= nlines; ++pagelines, ++linenum )
2373 std::string linetext;
2380 if ( msgOut->offset + linetext.size() + 1 >
sizeof msgOut->buffer )
2384 msgOut->Write( linetext.c_str(),
static_cast<u16>( linetext.size() + 1 ) );
2387 u16 len = msgOut->offset;
2388 msgOut->offset = offset;
2389 msgOut->WriteFlipped<
u16>(
static_cast<u16>( pagelines ) );
2391 msgOut->WriteFlipped<
u16>( len );
2392 msgOut.
Send( client, len );
2397 const char* ptext = msg->
text;
2398 size_t bytesleft = msglen - offsetof(
PKTBI_66, text );
2399 for (
int i = 1; i <= 8; ++i )
2407 line.append( 1, *ptext );
2445 std::string title( msg->
title, strlen( msg->
title ) );
2446 std::string author( msg->
author, strlen( msg->
author ) );
2449 std::transform( title.begin(), title.end(), title.begin(),
strip_ctrl_chars );
2450 std::transform( author.begin(), author.end(), author.begin(),
strip_ctrl_chars );
2455 if ( book ==
nullptr )
2457 POLLOG.Format(
"Unable to find book 0x{:X} for character 0x{:X}\n" )
2465 params[0].set(
new String( author ) );
2476 return new BError(
"Invalid parameter type" );
2479 return new BError(
"Charater does not have AOS enabled." );
2481 if ( multi ==
nullptr )
2482 return new BError(
"House not found." );
2485 if ( house ==
nullptr )
2486 return new BError(
"Not a House multi." );
2489 return new BError(
"Not a Custom House." );
2492 return new BError(
"House currently being customized." );
2495 return new BError(
"House currently being waiting for a commit" );
2498 return new BError(
"You must be inside the house to customize it." );
2504 msg->WriteFlipped<
u16>( 17u );
2507 msg->Write<
u8>( 0x4u );
2509 msg->Write<
u32>( 0xFFFFFFFFu );
2510 msg->Write<
u8>( 0xFFu );
2524 while ( !itemlist.empty() )
2526 Item* item = itemlist.front();
2528 itemlist.pop_front();
2531 while ( !moblist.empty() )
2534 if ( multichr != chr )
2544 return new BLong( 1 );
2553 msg->WriteFlipped<
u16>( 7u );
2556 msg->Write<
u8>( chr->
race + 1u );
2558 return new BLong( 1 );
2561 return new BError(
"Invalid parameter" );
2616 if ( client ==
nullptr )
2626 "Bug in handling PopUp menu selection. Please report this on the forums." );
2635 POLLOG_INFO.Format(
"{}/{} send an unexpected popup reply for {}.\n" )
2652 exec.getObjArrayParam( 2, menu_arr ) ) )
2654 return new BError(
"Invalid parameter" );
2657 return new BError(
"No client attached" );
2658 if ( !menu_arr->
ref_arr.size() )
2659 return new BError(
"Can't send empty menu" );
2660 if ( menu_arr->
ref_arr.size() > 0xfffe )
2661 return new BError(
"Too many entries in menu" );
2667 msg->Write<
u8>( 0u );
2668 msg->Write<
u8>( 1u );
2670 u16 offset_num_entries = msg->offset;
2674 for (
u16 i = 0; i < menu_arr->
ref_arr.size(); ++i )
2677 if ( bo ==
nullptr )
2681 if ( !++num_entries )
2682 return new BError(
"Too many entries in menu" );
2685 bool disabled =
false;
2688 bool use_color =
false;
2692 const BLong* lng =
static_cast<BLong*
>( imp );
2693 cliloc = lng->
value();
2701 if ( cl ==
nullptr )
2702 return new BError(
"Missing cliloc for menu element" );
2704 return new BError(
"Invalid cliloc for menu element" );
2705 const BLong* lng =
static_cast<BLong*
>( cl );
2706 cliloc = lng->
value();
2709 if ( ds !=
nullptr )
2713 if ( ar !=
nullptr )
2719 const BLong* colng =
static_cast<BLong*
>( co );
2720 color =
static_cast<u16>( colng->
value() );
2725 return new BError(
"Menu elements must be int or struct" );
2727 if ( cliloc < 3000000 || cliloc > 3065535 )
2728 return new BError(
"Cliloc out of range in menu" );
2737 msg->WriteFlipped<
u16>(
static_cast<u16>( i + 1 ) );
2738 msg->WriteFlipped<
u16>(
static_cast<u16>( cliloc - 3000000 ) );
2739 msg->WriteFlipped<
u16>( flags );
2741 msg->WriteFlipped<
u16>(
static_cast<u16>( color ) );
2745 u16 len = msg->offset;
2746 msg->offset = offset_num_entries;
2747 msg->Write<
u8>( num_entries );
2749 msg->WriteFlipped<
u16>( len );
2762 if ( !uoexec.suspend() )
2764 DEBUGLOG <<
"Script Error in '" << scriptname() <<
"' PC=" << exec.PC <<
": \n" 2765 <<
"\tCall to function UO::SendPopupMenu():\n" 2766 <<
"\tThe execution of this script can't be blocked!\n";
2773 popup_menu_selection_chr = chr;
2774 popup_menu_selection_above = above;
2776 return new BLong( 0 );
2785 return new BError(
"Invalid parameter" );
2788 return new BError(
"Mobile has no active client" );
2791 exec.setFunctionResult(
nullptr );
2794 return new BLong( 1 );
2800 unsigned short x, y;
2803 unsigned int objtype;
2807 if ( getParam( 0, x ) && getParam( 1, y ) && getParam( 2, z ) && getParam( 3, range ) &&
2809 getStringParam( 6, strrealm ) )
2813 return new BError(
"Realm not found" );
2817 if ( !realm->
valid( x, y, 0 ) )
2818 return new BError(
"Invalid Coordinates for realm" );
2822 if ( !realm->
valid( x, y, static_cast<short>( z ) ) )
2823 return new BError(
"Invalid Coordinates for realm" );
2826 std::unique_ptr<ObjArray> newarr(
new ObjArray );
2836 if ( wxH > realm->
width() - 1 )
2837 wxH = realm->
width() - 1;
2839 if ( wyH > realm->
height() - 1 )
2840 wyH = realm->
height() - 1;
2842 for (
unsigned short wx = wxL; wx <=
wxH; ++wx )
2844 for (
unsigned short wy = wyL; wy <=
wyH; ++wy )
2851 for (
unsigned i = 0; i < slist.size(); ++i )
2853 if ( slist[i].objtype != objtype )
2857 std::unique_ptr<BStruct> arr(
new BStruct );
2858 arr->addMember(
"x",
new BLong( wx ) );
2859 arr->addMember(
"y",
new BLong( wy ) );
2860 arr->addMember(
"z",
new BLong( slist[i].z ) );
2861 arr->addMember(
"objtype",
new BLong( slist[i].objtype ) );
2862 arr->addMember(
"hue",
new BLong( slist[i].hue ) );
2863 newarr->addElement( arr.release() );
2872 for (
unsigned i = 0; i < mlist.size(); ++i )
2874 if ( mlist[i].graphic != objtype )
2878 std::unique_ptr<BStruct> arr(
new BStruct );
2879 arr->addMember(
"x",
new BLong( wx ) );
2880 arr->addMember(
"y",
new BLong( wy ) );
2881 arr->addMember(
"z",
new BLong( mlist[i].z ) );
2882 arr->addMember(
"objtype",
new BLong( mlist[i].graphic ) );
2883 newarr->addElement( arr.release() );
2890 return newarr.release();
2893 return new BError(
"Invalid parameter" );
2900 unsigned short x, y;
2906 if ( getParam( 0, x ) && getParam( 1, y ) && getParam( 2, z ) && getParam( 3, range ) &&
2907 getParam( 4, flags ) && getStringParam( 5, strrealm ) )
2911 return new BError(
"Realm not found" );
2915 if ( !realm->
valid( x, y, 0 ) )
2916 return new BError(
"Invalid Coordinates for realm" );
2920 if ( !realm->
valid( x, y, static_cast<short>( z ) ) )
2921 return new BError(
"Invalid Coordinates for realm" );
2924 std::unique_ptr<ObjArray> newarr(
new ObjArray );
2934 if ( wxH > realm->
width() - 1 )
2935 wxH = realm->
width() - 1;
2937 if ( wyH > realm->
height() - 1 )
2938 wyH = realm->
height() - 1;
2940 for (
unsigned short wx = wxL; wx <=
wxH; ++wx )
2942 for (
unsigned short wy = wyL; wy <=
wyH; ++wy )
2949 for (
unsigned i = 0; i < slist.size(); ++i )
2955 std::unique_ptr<BStruct> arr(
new BStruct );
2956 arr->addMember(
"x",
new BLong( wx ) );
2957 arr->addMember(
"y",
new BLong( wy ) );
2958 arr->addMember(
"z",
new BLong( slist[i].z ) );
2959 arr->addMember(
"objtype",
new BLong( slist[i].objtype ) );
2960 arr->addMember(
"hue",
new BLong( slist[i].hue ) );
2961 newarr->addElement( arr.release() );
2971 for (
unsigned i = 0; i < mlist.size(); ++i )
2977 std::unique_ptr<BStruct> arr(
new BStruct );
2978 arr->addMember(
"x",
new BLong( wx ) );
2979 arr->addMember(
"y",
new BLong( wy ) );
2980 arr->addMember(
"z",
new BLong( mlist[i].z ) );
2981 arr->addMember(
"objtype",
new BLong( mlist[i].graphic ) );
2982 newarr->addElement( arr.release() );
2990 return newarr.release();
2993 return new BError(
"Invalid parameter" );
virtual void on_insert_add_item(Mobile::Character *mob, MoveType move, Items::Item *new_item)
#define LAYER_VENDOR_PLAYER_ITEMS
std::unique_ptr< Network::PacketsSingleton > packetsSingleton
Module::UOExecutorModule * popup_menu_selection_uoemod
const int VENDOR_SEND_AOS_TOOLTIP
static Item * create(u32 objtype, u32 serial=0)
CustomHouseDesign WorkingDesign
void send_clear_vendorwindow(Client *client, Character *vendor)
#define CONST_DEFAULT_ZRANGE
Bscript::BObjectImp * mf_FindAccount()
Clib::fixed_allocator< sizeof(Double), 256 > double_alloc
int get_toplevel_item_count()
std::map< u8, PacketQueue * > PacketQueueMap
std::atomic< u64 > bytes_sent
std::set< UOExecutor * > NoTimeoutHoldList
size_t getCurrentMemoryUsage()
returns the current process size in bytes
const ExecList & getRanlist()
virtual std::string getStringRep() const =0
const int ITEMS_IGNORE_STATICS
ref_ptr< Core::UContainer > vendor_for_sale
const std::string & value() const
virtual Bscript::BObjectImp * make_ref() POL_OVERRIDE
std::list< Items::Item * > ItemList
bool send_vendorwindow_contents(Network::Client *client, Core::UContainer *for_sale, bool send_aos_tooltip)
virtual bool can_add(const Items::Item &item) const
void singleclick(Network::Client *client, u32 serial)
virtual BObjectRef get_member(const char *membername) POL_OVERRIDE
Account * create_new_account(const std::string &acctname, const std::string &password, bool enabled)
std::vector< StaticRec > StaticList
ValueStackCont ValueStack
const int VENDOR_BUYABLE_CONTAINER_FILTER
char strip_ctrl_chars(char c)
bool send_event(Bscript::BObjectImp *event)
void open_book_handler(Client *client, PKTBI_93 *msg)
Bscript::BObjectImp * mf_CreateAccount()
static void list_contents(const UHouse *house, ItemList &items_in, MobileList &chrs_in)
bool isa(BObjectType type) const
Mobile::Character * gump_chr
unsigned int tile_uoflags(unsigned short tilenum)
void log_all_script_cycle_counts(bool clear_counters)
void add_script(ObjArray *arr, UOExecutor *uoexec, const char *)
const HoldList & getHoldlist()
Module::UOExecutorModule * textentry_uoemod
bool getbuyprice(u32 &buyprice) const
const int SENDDIALOGMENU_FORCE_OLD
std::tm localtime(const std::time_t &t)
threadsafe version of localtime
Core::UOExecutor & uoexec
std::string decint(unsigned short v)
Bscript::BObjectImp * mf_SendOpenBook()
virtual void on_color_changed() POL_OVERRIDE
bool move_character_to(Mobile::Character *chr, unsigned short x, unsigned short y, short z, int flags, Realms::Realm *oldrealm)
const unsigned VALID_ITEM_COLOR_MASK
Items::Item * find(u32 serial) const
unsigned int calculate_cost(Character *, UContainer *for_sale, UContainer *bought, PKTBI_3B *msg)
void clear_script_profile_counters()
std::string merchant_description() const
bool has_active_client() const
void gumpbutton_handler(Client *client, PKTIN_B1 *msg)
std::list< Mobile::Character * > MobileList
Bscript::BObjectImp * mf_SendGumpMenu()
boost_utils::script_name_flystring name
Item * find_legal_item(const Character *chr, u32 serial, bool *additlegal, bool *isRemoteContainer)
virtual BObjectImp * copy() const =0
Mobile::Character * resurrect_chr
Bscript::BObjectImp * mf_SingleClick()
std::map< u16, PacketInterfaceQueue > PacketInterfaceQueueMap
CustomHouseDesign CurrentDesign
virtual u8 typeOfInt() const
BObjectImp * GetScriptProfiles()
Contents::iterator iterator
virtual std::string getStringRep() const POL_OVERRIDE
const std::string & name() const
bool isa(BObjectImp::BObjectType type) const
Bscript::BObjectImp * mf_SendCharacterRaceChanger()
void send_remove_object_if_inrange(Client *client, const Item *item)
const ExecList & getRunlist()
void(* on_popup_menu_selection)(Network::Client *client, u32 serial, u16 id)
Bscript::BObject call_custom_method(const char *methodname, Bscript::BObjectImpRefVec &pmore)
const ItemDesc & find_itemdesc(unsigned int objtype)
PKTBI_BF_RACE_CHANGER_RESULT characterracechanger
PKTBI_BF_2A_RESULT result
void clear_gumphandler(Client *client, UOExecutorModule *uoemod)
Bscript::BObjectImp * mf_PolCore()
Clib::fixed_allocator< sizeof(BLong), 256 > blong_alloc
Bscript::BObjectImp * mf_SelectColor()
void add_to_self(Item *&item)
void AddComponents(UHouse *house)
virtual void add(Items::Item *item)
virtual bool script_isa(unsigned isatype) const
BIntHash & operator=(const BIntHash &)
virtual Items::Item * remove(u32 serial, UContainer **found_in=nullptr)
Module::UOExecutorModule * find_gumpmod(u32 gumpid)
Given a gumpid, finds the module that registered it, returns nullptr if not found.
Items::Item * find_addable_stack(const Items::Item *adding_item) const
void oldSellHandler(Client *client, PKTIN_9F *msg)
void get_random_location(u16 *px, u16 *py) const
bool getCharacterParam(Bscript::Executor &exec, unsigned param, Mobile::Character *&chrptr)
virtual size_t sizeEstimate() const POL_OVERRIDE
void spend_gold(unsigned int amount)
virtual std::string getStringRep() const POL_OVERRIDE
#define RESURRECT_CHOICE_SELECT
#define LAYER_VENDOR_FOR_SALE
virtual size_t sizeEstimate() const POL_OVERRIDE
void setimp(BObjectImp *imp)
Bscript::BObjectImp * mf_SendBuyWindow()
BObjectImp * GetAllScriptList()
virtual class UHouse * as_house()
void destroy_item(Item *item)
virtual bool isTrue() const
const BObjectImp * imp_at(unsigned index) const
std::atomic< u64 > bytes_received
Bscript::BObjectImp * mf_ListStaticsNearLocationWithFlag()
void add(int key, BObjectImp *value)
Clib::fixed_allocator< sizeof(UninitObject), 256 > uninit_alloc
void sanitize_upperlimit(T *value, const T max)
Items::Item * find_toplevel(u32 serial) const
NetworkManager networkManager
std::multimap< Core::polclock_t, Core::UOExecutor * > HoldList
Module::UOExecutorModule * selcolor_uoemod
unsigned short height() const
void Send(Client *client, int len=-1) const
bool scripted_merchant_handlers
BObjectImp * GetIoStats()
const char * name() const
Bscript::BObjectImp * mf_SendSellWindow()
#define GET_PROFILEVAR_PER_MIN(counter)
std::deque< UOExecutor * > ExecList
Module::UOExecutorModule * resurrect_uoemod
void SendAOSTooltip(Network::Client *client, UObject *obj, bool vendor_content)
void getstatics(Plib::StaticEntryList &statics, unsigned short x, unsigned short y) const
const unsigned POLCLASS_CONTAINER
Bscript::BObjectImp * mf_CloseWindow()
static UninitObject * create()
Bscript::BObjectImp * mf_SendHousingTool()
Bscript::BObjectImp * internal_SendCompressedGumpMenu(Mobile::Character *chr, Bscript::ObjArray *layout_arr, Bscript::ObjArray *data_arr, int x, int y, u32 gumpid)
virtual BObjectImp * copy() const POL_OVERRIDE
struct Pol::Core::PKTBI_3B::@19 items[1]
Bscript::BObjectImp * mf_ListStaticsNearLocationOfType()
void on_insert_increase_stack(Mobile::Character *mob, MoveType move, Items::Item *existing_item, unsigned short amt_added)
BObjectImp * _create_item_in_container(UContainer *cont, const ItemDesc *descriptor, unsigned short amount, bool force_stacking, UOExecutorModule *uoemod)
Bscript::BObjectImp * mf_ListAccounts()
bool getItemParam(Executor &exec, unsigned param, Items::Item *&itemptr)
struct Pol::Core::PKTIN_9F::@52 items[1]
BObjectImp * GetIoStatsObj(const IOStats &stats)
bool validhair(u16 HairStyle)
void add_at_random_location(Items::Item *item)
virtual BObjectImp * call_method(const char *methodname, Executor &ex)
const unsigned POLCLASS_MOBILE
unsigned int SafeCharAmt() const
void handle_textentry(Client *client, PKTIN_AC *msg)
#define GET_ITEM_PTR(itr)
void send_full_statmsg(Network::Client *client, Mobile::Character *chr)
Item * remove_part_of_stack(u16 amount_to_remove)
Core::UObject * popup_menu_selection_above
void equip(Items::Item *item)
BObjectImp * GetPktStatusObj()
bool compareVersion(const std::string &ver)
#define passert_always_r(exp, reason)
std::unordered_map< u64, ScriptDiffData > data
void send_wornitem(Client *client, const Character *chr, const Item *item)
SettingsManager settingsManager
void buyhandler(Client *client, PKTBI_3B *msg)
size_t last_sysload_nprocs
Mobile::Character * popup_menu_selection_chr
StateManager stateManager
ScriptScheduler scriptScheduler
bool getObjtypeParam(Executor &exec, unsigned param, unsigned int &objtype)
const int MOVEITEM_FORCELOCATION
virtual BObjectRef OperSubscript(const BObject &obj) POL_OVERRIDE
bool send_vendorsell(Client *client, NPC *merchant, UContainer *sellfrom, UContainer *buyable, bool send_aos_tooltip)
ref_ptr< Items::Item > ItemRef
void popup_menu_selection_made(Network::Client *client, u32 serial, u16 id)
void add_gumpmod(Module::UOExecutorModule *, u32 gumpid)
Registers a gumpid for the given module.
ref_ptr< Core::UContainer > vendor_bought
const struct VersionDetailStruct CLIENT_VER_5000
void readmultis(Plib::MapShapeList &vec, unsigned short x, unsigned short y, unsigned int flags) const
ref_ptr< Accounts::Account > AccountRef
#define LONG_COREVAR(name, expr)
void addElement(BObjectImp *imp)
const int ITEMS_IGNORE_MULTIS
Core::UContainer * backpack() const
virtual const char * typeOf() const POL_OVERRIDE
Bscript::BObjectImp * internal_SendUnCompressedGumpMenu(Mobile::Character *chr, Bscript::ObjArray *layout_arr, Bscript::ObjArray *data_arr, int x, int y, u32 gumpid)
bool getUObjectParam(Executor &exec, unsigned param, UObject *&objptr)
Bscript::BObjectImp * mf_SendPopUpMenu()
Sends a PopUp/Context menu.
void send_container_contents(Network::Client *client, const UContainer &cont)
virtual BObjectImp * call_method(const char *methodname, Executor &ex) POL_OVERRIDE
Mobile::Character * selcolor_chr
void oldBuyHandler(Client *client, PKTBI_3B *msg)
bool getMultiParam(Executor &exec, unsigned param, Multi::UMulti *&multiptr)
virtual u8 typeOfInt() const POL_OVERRIDE
BObjectImp * GetQueuedIoStats()
std::atomic< unsigned int > count
std::atomic< unsigned int > bytes
unsigned short width() const
virtual BObjectImp * copy() const POL_OVERRIDE
Realms::Realm * find_realm(const std::string &name)
std::map< int, BObjectRef > Contents
unsigned int gold_carried() const
bool can_insert_increase_stack(Mobile::Character *mob, MoveType move, Items::Item *existing_item, unsigned short amt_to_add, Items::Item *adding_item)
bool isa(UOBJ_CLASS uobj_class) const
void send_wornitem_to_inrange(const Character *chr, const Item *item)
bool amount_to_remove_is_partial(u16 amount_to_remove) const
bool start_script(Bscript::EScriptProgram *prog, bool start_attached, Bscript::BObjectImp *param2=nullptr, Bscript::BObjectImp *param3=nullptr, Bscript::BObjectImp *param4=nullptr)
Items::Item * wornitem(int layer) const
const NoTimeoutHoldList & getNoTimeoutHoldlist()
Item * slice_stacked_item(u16 this_item_new_amount)
virtual BObjectRef get_member(const char *membername) POL_OVERRIDE
const MultiDef & multidef() const
void CustomHousesSendFull(UHouse *house, Network::Client *client, int design)
bool valid(unsigned short x, unsigned short y, short z) const
std::vector< ref_ptr< BObjectImp > > BObjectImpRefVec
ref_ptr< Bscript::EScriptProgram > find_script(const std::string &name, bool complain_if_not_found, bool cache_script)
void sellhandler(Client *client, PKTIN_9F *msg)
virtual bool setcolor(u16 newcolor)
Bscript::BObjectImp * mf_SendTextEntryGump()
#define passert_always(exp)
void handle_selcolor(Client *client, PKTBI_95 *msg)
Multi::UMulti * find_supporting_multi(unsigned short x, unsigned short y, short z) const
virtual std::string name() const
bool IsWaitingForAccept() const
BObjectImp * GetPackageList()
BObjectImp * GetRunningScriptList()
#define LAYER_VENDOR_BUYABLE_ITEMS
Clib::fixed_allocator< sizeof(BObject), 256 > bobject_alloc
BObjectImp * MakeMapCacheImp()
void remove_gumpmods(Module::UOExecutorModule *)
Removes all the registered gumpids for a given module.
const char * data() const
void read_book_page_handler(Client *client, PKTBI_66 *msg)
bool layer_is_equipped(int layer) const
const polclock_t POLCLOCKS_PER_SEC
virtual const char * typeOf() const
const BObjectImp * FindMember(const char *name)
Bscript::BObjectImp * mf_SendInstaResDialog()
void handle_resurrect_menu(Client *client, PKTBI_2C *msg)
Bscript::BObjectImp * mf_CloseGump()
Account * find_account(const char *acctname)
static void ClearComponents(UHouse *house)
void character_race_changer_handler(Network::Client *client, Core::PKTBI_BF *msg)
void update_item_to_inrange(const Item *item)
Module::OSExecutorModule * os_module
static std::string build_datetime()
bool validbeard(u16 BeardStyle)
Mobile::Character * textentry_chr
static const unsigned int PID_MIN
BObjectImp * GetCoreVariable(const char *corevar)
bool getParam(unsigned param, int &value)
bool can_insert_add_item(Mobile::Character *mob, MoveType move, Items::Item *new_item)