68 #include "pol_global_config.h" 78 #include "../../bscript/berror.h" 79 #include "../../bscript/bobject.h" 80 #include "../../bscript/bstruct.h" 81 #include "../../bscript/dict.h" 82 #include "../../bscript/impstr.h" 83 #include "../../clib/cfgelem.h" 84 #include "../../clib/clib.h" 85 #include "../../clib/clib_endian.h" 86 #include "../../clib/compilerspecifics.h" 87 #include "../../clib/esignal.h" 88 #include "../../clib/logfacility.h" 89 #include "../../clib/passert.h" 90 #include "../../clib/refptr.h" 91 #include "../../plib/mapcell.h" 92 #include "../../plib/mapshape.h" 93 #include "../../plib/maptile.h" 94 #include "../../plib/staticblock.h" 95 #include "../../plib/stlastar.h" 96 #include "../../plib/systemstate.h" 97 #include "../action.h" 98 #include "../cfgrepos.h" 99 #include "../clidata.h" 100 #include "../containr.h" 102 #include "../eventid.h" 103 #include "../fnsearch.h" 104 #include "../gameclck.h" 105 #include "../globals/object_storage.h" 106 #include "../globals/uvars.h" 107 #include "../guardrgn.h" 108 #include "../item/item.h" 109 #include "../item/itemdesc.h" 110 #include "../layers.h" 111 #include "../lightlvl.h" 112 #include "../listenpt.h" 114 #include "../mdelta.h" 116 #include "../miscrgn.h" 117 #include "../mobile/charactr.h" 118 #include "../mobile/npc.h" 119 #include "../mobile/ufacing.h" 120 #include "../multi/boat.h" 121 #include "../multi/house.h" 122 #include "../multi/multi.h" 123 #include "../multi/multidef.h" 124 #include "../network/cgdata.h" 125 #include "../network/client.h" 126 #include "../network/packethelper.h" 127 #include "../network/packets.h" 128 #include "../npctmpl.h" 129 #include "../objtype.h" 130 #include "../pktboth.h" 131 #include "../pktdef.h" 132 #include "../polcfg.h" 133 #include "../polclass.h" 134 #include "../polclock.h" 135 #include "../polsig.h" 136 #include "../profile.h" 137 #include "../realms.h" 138 #include "../realms/realm.h" 139 #include "../resource.h" 140 #include "../savedata.h" 141 #include "../scrdef.h" 142 #include "../scrsched.h" 143 #include "../scrstore.h" 144 #include "../spells.h" 145 #include "../target.h" 146 #include "../uconst.h" 147 #include "../udatfile.h" 148 #include "../ufunc.h" 149 #include "../uimport.h" 150 #include "../umanip.h" 151 #include "../unicode.h" 152 #include "../uobject.h" 153 #include "../uoexec.h" 154 #include "../uopathnode.h" 155 #include "../uoscrobj.h" 156 #include "../uworld.h" 157 #include "../wthrtype.h" 169 Bscript::BObjectImp*
open_trade_window( Network::Client* client, Mobile::Character* dropon );
170 void send_tip( Network::Client* client,
const std::string& tiptext );
172 void send_paperdoll( Network::Client* client, Mobile::Character* chr );
173 void send_skillmsg( Network::Client* client,
const Mobile::Character* chr );
174 Bscript::BObjectImp*
equip_from_template( Mobile::Character* chr,
const char* template_name );
178 using namespace Bscript;
179 using namespace Items;
181 using namespace Core;
183 #define CONST_DEFAULT_ZRANGE 19 198 target_cursor_chr( nullptr ),
199 menu_selection_chr( nullptr ),
200 popup_menu_selection_chr( nullptr ),
201 popup_menu_selection_above( nullptr ),
202 prompt_chr( nullptr ),
204 textentry_chr( nullptr ),
205 resurrect_chr( nullptr ),
206 selcolor_chr( nullptr ),
208 attached_chr_( nullptr ),
209 attached_npc_( nullptr ),
210 attached_item_( nullptr ),
211 controller_( nullptr ),
213 registered_for_speech_events( false )
222 item->
inuse(
false );
306 return new BLong( 1 );
309 return new BError(
"Another script still attached." );
312 return new BError(
"Another character still attached." );
315 return new BError(
"Invalid parameter" );
325 return new BLong( 1 );
329 return new BLong( 0 );
336 amount > 0 && amount <= 60000L;
340 unsigned short amount,
bool force_stacking,
363 if ( chr_owner ==
nullptr )
364 if ( uoemod !=
nullptr )
377 return new BError(
"Item was destroyed in CanInsert Script" );
380 item->ct_merge_stacks_pergon(
386 item->
setamount( static_cast<unsigned short>( newamount ) );
395 return new BError(
"Item was destroyed in OnInsert Script" );
403 else if ( amount != 1 && !force_stacking )
405 return new BError(
"That item is not stackable. Create one at a time." );
409 if ( item !=
nullptr )
433 return new BError(
"Couldn't add item to container after create script ran" );
442 return new BError(
"No slots available in this container" );
447 return new BError(
"Couldn't set slot index on item" );
452 if ( chr_owner ==
nullptr )
453 if ( uoemod !=
nullptr )
460 return new BError(
"Could not insert item into container." );
464 return new BError(
"Item was destroyed in CanInsert Script" );
475 return new BError(
"Item was destroyed in OnInsert Script" );
483 return new BError(
"That container is full" );
488 return new BError(
"Failed to create that item type" );
501 if ( item->
isa( UOBJ_CLASS::CLASS_CONTAINER ) )
504 static_cast<unsigned short>( amount ),
false,
this );
508 return new BError(
"That is not a container" );
513 return new BError(
"A parameter was invalid" );
526 if ( item->
isa( UOBJ_CLASS::CLASS_CONTAINER ) )
529 static_cast<unsigned short>( amount ),
true,
this );
533 return new BError(
"That is not a container" );
538 return new BError(
"A parameter was invalid" );
547 unsigned short color;
548 unsigned short requiredCmdLevel;
555 return new BLong( 1 );
578 return new BError(
"Invalid parameter type" );
583 return new BError(
"No client attached" );
585 if ( !item->
isa( UOBJ_CLASS::CLASS_CONTAINER ) )
587 return new BError(
"That isn't a container" );
593 item->
layer = save_layer;
600 return new BLong( 1 );
610 return new BError(
"Invalid parameter type." );
615 return new BError(
"You can't trade with yourself." );
620 return new BError(
"No client attached." );
624 return new BError(
"No client attached." );
635 return new BError(
"Invalid parameter type." );
638 return new BError(
"Mobile is not currently trading with anyone." );
641 return new BLong( 1 );
650 return new BError(
"Invalid parameter type" );
655 return new BError(
"No client attached" );
657 if ( !item->
isa( UOBJ_CLASS::CLASS_CONTAINER ) )
659 return new BError(
"That isn't a container" );
666 return new BLong( 1 );
672 unsigned int objtype;
676 return new BError(
"Invalid parameter type" );
678 if ( !item->
isa( UOBJ_CLASS::CLASS_CONTAINER ) )
680 return new BError(
"That is not a container" );
687 if ( found ==
nullptr )
688 return new BError(
"No items were found" );
699 unsigned short color;
707 return new BLong( 1 );
711 return new BError(
"Mobile has no active client" );
716 return new BError(
"Invalid parameter type" );
725 unsigned short color;
735 return new BError(
"A parameter was invalid" );
744 unsigned short color;
755 return new BError(
"A parameter was invalid" );
769 if ( obj !=
nullptr )
800 return new BError(
"Invalid parameter type" );
804 return new BError(
"No client connected" );
808 return new BError(
"Client busy with another target cursor" );
826 <<
"\tCall to function UO::Target():\n" 827 <<
"\tThe execution of this script can't be blocked!\n";
834 if ( is_los_checked )
848 return new BLong( 0 );
863 msg->Write<
u8>( 0x3u );
866 return new BLong( 0 );
870 return new BError(
"Client does not have an active target cursor" );
875 return new BError(
"No client connected" );
880 return new BError(
"Invalid parameter type" );
888 if ( msg !=
nullptr )
902 if ( selected_serial )
917 if ( multi !=
nullptr )
934 return new BError(
"Invalid parameter type" );
938 return new BError(
"Mobile has no active client" );
942 return new BError(
"Client has an active target cursor" );
948 <<
"\tCall to function UO::TargetCoordinates():\n" 949 <<
"\tThe execution of this script can't be blocked!\n";
956 return new BLong( 0 );
962 unsigned int objtype, hue;
964 int xoffset, yoffset;
969 return new BError(
"Invalid parameter type" );
975 return new BError(
"No client attached" );
980 return new BError(
"Client busy with another target cursor" );
986 return new BError(
"Object Type is out of range for Multis" );
992 <<
"\tCall to function UO::TargetMultiPlacement():\n" 993 <<
"\tThe execution of this script can't be blocked!\n";
1001 chr->
client, objtype, flags, (
s16)xoffset, (
s16)yoffset, hue );
1003 return new BLong( 0 );
1021 return new BLong( 0 );
1040 return new BLong( 1 );
1042 return new BLong( 0 );
1044 return new BLong( 0 );
1057 return new BLong( 0 );
1067 unsigned short amount;
1073 if ( backpack !=
nullptr )
1079 return new BError(
"Character has no backpack." );
1084 return new BError(
"A parameter was invalid." );
1094 item->
z =
static_cast<signed char>( z );
1095 item->
realm = realm;
1099 if ( !
id.create_script.empty() )
1121 unsigned short x, y;
1124 unsigned short amount;
1132 return new BError(
"That item is not stackable. Create one at a time." );
1137 return new BError(
"Realm not found" );
1139 if ( !realm->
valid( x, y, z ) )
1140 return new BError(
"Invalid Coordinates for Realm" );
1142 if ( item !=
nullptr )
1152 return new BError(
"Invalid parameter type" );
1157 unsigned short x, y;
1165 return new BError(
"This function does not work with Multi objects." );
1169 return new BError(
"Realm not found" );
1171 if ( !realm->
valid( x, y, z ) )
1172 return new BError(
"Invalid Coordinates for Realm" );
1174 if ( item !=
nullptr )
1180 return new BError(
"Unable to clone item" );
1185 return new BError(
"Invalid parameter type" );
1191 unsigned short x, y;
1199 return new BError(
"Invalid parameter type" );
1204 return new BError(
"Invalid parameter type" );
1210 return new BError(
"Invalid parameter type" );
1215 return new BError(
"Realm not found" );
1216 if ( !realm->
valid( x, y, z ) )
1217 return new BError(
"Invalid Coordinates for Realm" );
1220 return new BError(
"That objtype is not a Multi" );
1229 for ( BStruct::Contents::const_iterator citr = custom->
contents().begin(),
1231 citr != end; ++citr )
1233 const std::string&
name = ( *citr ).first;
1234 BObjectImp* ref = ( *citr ).second->impptr();
1236 if ( name ==
"CProps" )
1242 BDictionary::Contents::const_iterator itr;
1243 for ( itr = cprop_cont.begin(); itr != cprop_cont.end(); ++itr )
1245 elem.
add_prop(
"cprop", ( ( *itr ).first->getStringRep() +
"\t" +
1246 ( *itr ).second->impptr()->pack() ) );
1251 throw std::runtime_error(
"NPC override_properties: CProps must be a dictionary, but is: " +
1252 std::string( ref->
typeOf() ) );
1266 unsigned short x, y;
1274 return new BError(
"Invalid parameter type" );
1277 BStruct* custom_struct =
nullptr;
1280 custom_struct =
nullptr;
1284 custom_struct =
static_cast<BStruct*
>( imp );
1288 return new BError( std::string(
"Parameter 4 must be a Struct or Integer(0), got " ) +
1294 return new BError(
"Realm not found" );
1299 return new BError(
"Realm not found" );
1300 if ( !realm->
valid( x, y, z ) )
1301 return new BError(
"Invalid Coordinates for Realm" );
1311 return new BError(
"NPC template '" + tmplname->
value() +
"' not found" );
1318 if ( !realm->
walkheight( x, y, z, &newz, &dummy_multi, &dummy_walkon,
true, movemode ) )
1320 return new BError(
"Not a valid location for an NPC!" );
1342 if ( custom_struct !=
nullptr )
1344 npc->readPropertiesForNewNPC( elem );
1362 if ( npc->registered_house == 0 )
1364 npc->registered_house = dummy_multi->
serial;
1366 if ( this_house !=
nullptr )
1372 if ( npc->registered_house > 0 )
1375 if ( multi !=
nullptr )
1379 npc->registered_house = 0;
1385 catch ( std::exception& ex )
1387 if ( npc.
get() != nullptr )
1389 return new BError(
"Exception detected trying to create npc from template '" +
1390 tmplname->
value() +
"': " + ex.what() );
1398 unsigned short amount;
1402 if ( item->has_gotten_by() )
1403 item->gotten_by()->clear_gotten_item();
1405 return new BError(
"That item is being used." );
1407 return new BLong( 1 );
1411 return new BError(
"Invalid parameter type" );
1418 unsigned short amount;
1424 return new BError(
"That item is being used." );
1428 return new BError(
"That item type is not stackable." );
1432 return new BError(
"Can't add that much to that stack" );
1435 unsigned short newamount = item->
getamount();
1436 newamount += amount;
1443 return new BLong( 1 );
1447 return new BError(
"Invalid parameter type" );
1454 unsigned short actionval;
1455 unsigned short framecount, repeatcount;
1456 unsigned short backward, repeatflag, delay;
1463 chr, action, framecount, repeatcount, static_cast<DIRECTION_FLAG_OLD>( backward ),
1464 static_cast<REPEAT_FLAG_OLD>( repeatflag ), static_cast<unsigned char>( delay ) );
1465 return new BLong( 1 );
1469 return new BError(
"Invalid parameter" );
1480 return new BLong( 1 );
1484 return new BError(
"Invalid parameter" );
1497 return new BLong( 1 );
1501 return new BError(
"Invalid parameter" );
1507 unsigned short cx, cy;
1516 return new BError(
"Realm not found" );
1517 if ( !realm->
valid( cx, cy, cz ) )
1518 return new BError(
"Invalid Coordinates for realm" );
1521 return new BLong( 1 );
1525 return new BError(
"Invalid parameter" );
1536 return new BLong( 1 );
1540 return new BError(
"Invalid parameter" );
1546 if ( client !=
nullptr )
1551 if ( mi !=
nullptr && msg !=
nullptr )
1574 if ( aob !=
nullptr )
1577 menu = &menu_imp->
value();
1593 return ( menu !=
nullptr );
1601 menu = &menu_imp->
value();
1605 DEBUGLOG <<
"SelectMenuItem: expected a menu name (static menu) or a CreateMenu() dynamic menu\n";
1617 return new BError(
"Invalid parameter" );
1622 return new BError(
"Client is busy, or menu is empty" );
1627 return new BError(
"Menu too large" );
1633 <<
"\tCall to function UO::SelectMenuItem():\n" 1634 <<
"\tThe execution of this script can't be blocked!\n";
1643 return new BLong( 0 );
1648 for (
unsigned i = 0; i < menu->
menuitems_.size(); ++i )
1658 if ( tmp_menu !=
nullptr )
1673 std::unique_ptr<ObjArray> objarr(
new ObjArray );
1677 return objarr.release();
1679 return new BLong( 0 );
1686 const String* propname_str;
1692 std::unique_ptr<ObjArray> newarr(
new ObjArray );
1694 for (
unsigned i = 0; i < arr->
ref_arr.size(); i++ )
1699 if ( bo ==
nullptr )
1703 BLong* blong =
static_cast<BLong*
>( bo->impptr() );
1704 unsigned int objtype =
static_cast<u32>( blong->
value() );
1707 if ( celem.
get() == nullptr )
1711 if ( propval ==
nullptr )
1715 BLong* amtreq =
static_cast<BLong*
>( propval );
1716 if ( amtreq->
value() > amthave )
1718 newarr->addElement(
new BLong( objtype ) );
1721 return newarr.release();
1737 return new BLong( 0 );
1743 unsigned int objtype;
1745 unsigned short color;
1756 return new BLong( 1 );
1760 return new BLong( 0 );
1767 const String* propname_str;
1777 return new BError(
"Property not found" );
1782 return new BError(
"Invalid parameter type" );
1789 const String* propname_str;
1794 return new BLong( 1 );
1798 return new BError(
"Invalid parameter type" );
1805 const String* propname_str;
1809 return new BLong( 1 );
1813 return new BError(
"Invalid parameter type" );
1821 std::vector<std::string> propnames;
1823 std::unique_ptr<ObjArray> arr(
new ObjArray );
1824 for (
unsigned i = 0; i < propnames.size(); ++i )
1826 arr->addElement(
new String( propnames[i] ) );
1828 return arr.release();
1832 return new BError(
"Invalid parameter type" );
1839 const String* propname_str;
1849 return new BError(
"Property not found" );
1854 return new BError(
"Invalid parameter type" );
1860 const String* propname_str;
1865 return new BLong( 1 );
1869 return new BError(
"Invalid parameter type" );
1875 const String* propname_str;
1879 return new BLong( 1 );
1883 return new BError(
"Invalid parameter type" );
1889 std::vector<std::string> propnames;
1891 std::unique_ptr<ObjArray> arr(
new ObjArray );
1892 for (
unsigned i = 0; i < propnames.size(); ++i )
1894 arr->addElement(
new String( propnames[i] ) );
1896 return arr.release();
1903 unsigned short effect;
1909 getParam( 5, explode, UCHAR_MAX ) )
1912 return new BError(
"Realms must match" );
1914 static_cast<unsigned char>( loop ), static_cast<unsigned char>( explode ) );
1915 return new BLong( 1 );
1919 return new BLong( 0 );
1925 unsigned short sx, sy;
1926 unsigned short dx, dy;
1929 unsigned short effect;
1942 return new BError(
"Realm not found" );
1943 if ( !realm->
valid( sx, sy, sz ) || !realm->
valid( dx, dy, dz ) )
1944 return new BError(
"Invalid Coordinates for realm" );
1946 static_cast<signed char>( dz ), effect, static_cast<signed char>( speed ),
1947 static_cast<signed char>( loop ), static_cast<signed char>( explode ),
1949 return new BLong( 1 );
1962 unsigned short effect;
1969 static_cast<unsigned char>( loop ) );
1970 return new BLong( 1 );
1980 unsigned short x, y;
1982 unsigned short effect;
1983 int speed, loop, explode;
1991 return new BError(
"Realm not found" );
1992 if ( !realm->
valid( x, y, z ) )
1993 return new BError(
"Invalid Coordinates for realm" );
1996 static_cast<unsigned char>( speed ), static_cast<unsigned char>( loop ),
1997 static_cast<unsigned char>( explode ), realm );
1998 return new BLong( 1 );
2002 return new BError(
"Invalid parameter" );
2011 unsigned short effect;
2018 unsigned short effect3d;
2019 unsigned short effect3dexplode;
2020 unsigned short effect3dsound;
2030 return new BError(
"Realms must match" );
2032 src, dst, effect, static_cast<unsigned char>( speed ),
2033 static_cast<unsigned char>( duration ), static_cast<unsigned int>( hue ),
2034 static_cast<unsigned int>( render ), static_cast<unsigned char>( direction ),
2035 static_cast<unsigned char>( explode ), effect3d, effect3dexplode, effect3dsound );
2036 return new BLong( 1 );
2040 return new BLong( 0 );
2046 unsigned short sx, sy;
2047 unsigned short dx, dy;
2051 unsigned short effect;
2058 unsigned short effect3d;
2059 unsigned short effect3dexplode;
2060 unsigned short effect3dsound;
2072 return new BError(
"Realm not found" );
2073 if ( !realm->
valid( sx, sy, sz ) || !realm->
valid( dx, dy, dz ) )
2074 return new BError(
"Invalid Coordinates for realm" );
2076 sx, sy, static_cast<signed char>( sz ), dx, dy, static_cast<signed char>( dz ), realm,
2077 effect, static_cast<unsigned char>( speed ), static_cast<unsigned char>( duration ),
2078 static_cast<unsigned int>( hue ), static_cast<unsigned int>( render ),
2079 static_cast<unsigned char>( direction ), static_cast<unsigned char>( explode ), effect3d,
2080 effect3dexplode, effect3dsound );
2081 return new BLong( 1 );
2092 unsigned short effect;
2098 unsigned short effect3d;
2106 src, effect, static_cast<unsigned char>( speed ), static_cast<unsigned char>( duration ),
2107 static_cast<unsigned int>( hue ), static_cast<unsigned int>( render ),
2108 static_cast<unsigned char>( layer ), effect3d );
2109 return new BLong( 1 );
2119 unsigned short x, y;
2122 unsigned short effect;
2127 unsigned short effect3d;
2136 return new BError(
"Realm not found" );
2137 if ( !realm->
valid( x, y, z ) )
2138 return new BError(
"Invalid Coordinates for realm" );
2141 x, y, static_cast<signed char>( z ), realm, effect, static_cast<unsigned char>( speed ),
2142 static_cast<unsigned char>( duration ), static_cast<unsigned int>( hue ),
2143 static_cast<unsigned int>( render ), effect3d );
2144 return new BLong( 1 );
2148 return new BError(
"Invalid parameter" );
2158 return new BLong( 1 );
2162 return new BLong( 0 );
2168 unsigned short x, y;
2179 return new BError(
"Realm not found" );
2183 if ( !realm->
valid( x, y, 0 ) )
2184 return new BError(
"Invalid Coordinates for realm" );
2188 if ( !realm->
valid( x, y, static_cast<short>( z ) ) )
2189 return new BError(
"Invalid Coordinates for realm" );
2192 std::unique_ptr<ObjArray> newarr(
new ObjArray );
2194 if ( ( abs( item->
x - x ) <= range ) && ( abs( item->
y - y ) <= range ) )
2196 if ( ( z == LIST_IGNORE_Z ) || ( abs( item->z - z ) < CONST_DEFAULT_ZRANGE ) )
2197 newarr->addElement( item->make_ref() );
2201 return newarr.release();
2208 int& z1,
unsigned short& x2,
unsigned short& y2,
2214 if ( x2 >= realm->
width() )
2215 x2 = ( realm->
width() - 1 );
2216 if ( y2 >= realm->
height() )
2217 y2 = ( realm->
height() - 1 );
2224 unsigned short x1, y1;
2226 unsigned short x2, y2;
2234 return new BError(
"Invalid parameter" );
2239 return new BError(
"Realm not found" );
2242 std::swap( x1, x2 );
2244 std::swap( y1, y2 );
2246 std::swap( z1, z2 );
2252 std::unique_ptr<ObjArray> newarr(
new ObjArray );
2254 if ( chr->
z >= z1 && chr->
z <= z2 )
2256 newarr->addElement( chr->make_ref() );
2260 if ( item->
z >= z1 && item->
z <= z2 )
2262 newarr->addElement( item->make_ref() );
2266 return newarr.release();
2271 unsigned short x1, y1;
2273 unsigned short x2, y2;
2281 return new BError(
"Invalid parameter" );
2286 return new BError(
"Realm not found" );
2289 std::swap( x1, x2 );
2291 std::swap( y1, y2 );
2293 std::swap( z1, z2 );
2299 std::unique_ptr<ObjArray> newarr(
new ObjArray );
2301 if ( chr->
z >= z1 && chr->
z <= z2 )
2303 newarr->addElement( chr->make_ref() );
2307 return newarr.release();
2312 unsigned short x1, y1;
2314 unsigned short x2, y2;
2322 return new BError(
"Invalid parameter" );
2327 return new BError(
"Realm not found" );
2330 std::swap( x1, x2 );
2332 std::swap( y1, y2 );
2334 std::swap( z1, z2 );
2340 std::unique_ptr<ObjArray> newarr(
new ObjArray );
2344 unsigned short x1range = x1;
2346 unsigned short y1range = y1;
2349 if ( x1range >= RANGE_VISUAL_LARGE_BUILDINGS )
2353 if ( y1range >= RANGE_VISUAL_LARGE_BUILDINGS )
2361 x1range, y1range, x2range, y2range, realm, [&](
Multi::UMulti* multi ) {
2363 if ( multi->
x + md.
minrx > x2 ||
2364 multi->
x + md.
maxrx < x1 ||
2365 multi->
y + md.
minry > y2 ||
2366 multi->
y + md.
maxry < y1 ||
2367 multi->
z + md.
minrz > z2 ||
2368 multi->
z + md.
maxrz < z1 )
2377 int absx = multi->
x + elem->
x;
2378 int absy = multi->
y + elem->
y;
2379 int absz = multi->
z + elem->
z;
2380 if ( x1 <= absx && absx <= x2 && y1 <= absy && absy <= y2 )
2384 int top = absz + height;
2386 if ( ( z1 <= absz && absz <= z2 ) ||
2387 ( z1 <= top && top <= z2 ) ||
2388 ( top >= z2 && absz <= z1 ) )
2390 newarr->addElement( multi->
make_ref() );
2397 return newarr.release();
2402 unsigned short x1, y1;
2403 unsigned short x2, y2;
2414 return new BError(
"Realm not found" );
2417 std::swap( x1, x2 );
2419 std::swap( y1, y2 );
2421 std::swap( z1, z2 );
2427 std::unique_ptr<ObjArray> newarr(
new ObjArray );
2429 for (
unsigned short wx = x1; wx <= x2; ++wx )
2431 for (
unsigned short wy = y1; wy <= y2; ++wy )
2438 for (
unsigned i = 0; i < slist.size(); ++i )
2440 if ( ( z1 <= slist[i].z ) && ( slist[i].z <= z2 ) )
2442 std::unique_ptr<BStruct> arr(
new BStruct );
2443 arr->addMember(
"x",
new BLong( wx ) );
2444 arr->addMember(
"y",
new BLong( wy ) );
2445 arr->addMember(
"z",
new BLong( slist[i].z ) );
2446 arr->addMember(
"objtype",
new BLong( slist[i].objtype ) );
2447 arr->addMember(
"hue",
new BLong( slist[i].hue ) );
2448 newarr->addElement( arr.release() );
2458 for (
unsigned i = 0; i < mlist.size(); ++i )
2460 if ( ( z1 <= mlist[i].z ) && ( mlist[i].z <= z2 ) )
2462 std::unique_ptr<BStruct> arr(
new BStruct );
2463 arr->addMember(
"x",
new BLong( wx ) );
2464 arr->addMember(
"y",
new BLong( wy ) );
2465 arr->addMember(
"z",
new BLong( mlist[i].z ) );
2466 arr->addMember(
"objtype",
new BLong( mlist[i].graphic ) );
2467 newarr->addElement( arr.release() );
2474 return newarr.release();
2477 return new BError(
"Invalid parameter" );
2482 unsigned short x, y;
2484 unsigned int objtype;
2492 return new BError(
"Realm not found" );
2494 std::unique_ptr<ObjArray> newarr(
new ObjArray );
2498 if ( !realm->
valid( x, y, 0 ) )
2499 return new BError(
"Invalid Coordinates for realm" );
2503 if ( !realm->
valid( x, y, static_cast<short>( z ) ) )
2504 return new BError(
"Invalid Coordinates for realm" );
2508 if ( ( item->
objtype_ == objtype ) && ( abs( item->
x - x ) <= range ) &&
2509 ( abs( item->
y - y ) <= range ) )
2511 if ( ( z == LIST_IGNORE_Z ) || ( abs( item->z - z ) < CONST_DEFAULT_ZRANGE ) )
2512 newarr->addElement( item->make_ref() );
2516 return newarr.release();
2525 unsigned short x, y;
2534 return new BError(
"Realm not found" );
2538 if ( !realm->
valid( x, y, 0 ) )
2539 return new BError(
"Invalid Coordinates for realm" );
2543 if ( !realm->
valid( x, y, static_cast<short>( z ) ) )
2544 return new BError(
"Invalid Coordinates for realm" );
2547 std::unique_ptr<ObjArray> newarr(
new ObjArray );
2549 if ( ( item->
x == x ) && ( item->
y == y ) )
2551 if ( ( z == LIST_IGNORE_Z ) || ( item->z == z ) )
2552 newarr->addElement( item->make_ref() );
2556 return newarr.release();
2575 return new BError(
"Realm not found" );
2577 std::unique_ptr<ObjArray> newarr(
new ObjArray );
2581 newarr->addElement( chr->
make_ref() );
2585 return newarr.release();
2589 return new BError(
"Invalid parameter" );
2602 unsigned short x, y;
2612 return new BError(
"Realm not found" );
2616 if ( !realm->
valid( x, y, 0 ) )
2617 return new BError(
"Invalid Coordinates for realm" );
2621 if ( !realm->
valid( x, y, static_cast<short>( z ) ) )
2622 return new BError(
"Invalid Coordinates for realm" );
2632 std::unique_ptr<ObjArray> newarr(
new ObjArray );
2635 if ( ( inc_hidden && _chr->hidden() ) || ( inc_dead && _chr->dead() ) ||
2636 ( inc_concealed && _chr->concealed() ) ||
2637 ( inc_normal && !( _chr->hidden() || _chr->dead() || _chr->concealed() ) ) )
2641 if ( !inc_players_only && !inc_npc_only )
2642 newarr->addElement( _chr->make_ref() );
2643 else if ( inc_players_only && _chr->client )
2644 newarr->addElement( _chr->make_ref() );
2645 else if ( inc_npc_only && _chr->isa( UOBJ_CLASS::CLASS_NPC ) )
2646 newarr->addElement( _chr->make_ref() );
2650 if ( inc_players_only )
2652 else if ( inc_npc_only )
2657 return newarr.release();
2661 return new BError(
"Invalid parameter" );
2667 unsigned short x, y;
2678 return new BError(
"Realm not found" );
2682 if ( !realm->
valid( x, y, 0 ) )
2683 return new BError(
"Invalid Coordinates for realm" );
2687 if ( !realm->
valid( x, y, static_cast<short>( z ) ) )
2688 return new BError(
"Invalid Coordinates for realm" );
2691 std::unique_ptr<ObjArray> newarr(
new ObjArray );
2695 newarr->addElement( chr->
make_ref() );
2697 return newarr.release();
2701 return new BError(
"Invalid parameter" );
2712 std::unique_ptr<ObjArray> newarr(
new ObjArray );
2715 if ( chr->dead() || chr->hidden() || chr->concealed() )
2719 if ( ( abs( chr->z - obj->z ) < CONST_DEFAULT_ZRANGE ) )
2721 if ( obj->realm->has_los( *obj, *chr ) )
2723 newarr->addElement( chr->make_ref() );
2728 return newarr.release();
2732 return new BError(
"Invalid parameter" );
2738 const String* strrealm =
nullptr;
2745 return new BError(
"Realm not found" );
2747 std::unique_ptr<ObjArray> newarr(
new ObjArray() );
2751 UObject* obj = objitr.second.get();
2752 if ( !obj->
ismobile() || obj->
isa( UOBJ_CLASS::CLASS_NPC ) )
2761 return newarr.release();
2765 return new BError(
"Invalid parameter" );
2779 std::unique_ptr<ObjArray> arr(
new ObjArray );
2782 Character::CharacterSet::const_iterator itr = cont.begin(), end = cont.end();
2783 for ( ; itr != end; ++itr )
2788 if ( ( flags & LH_FLAG_LOS ) && !chr->
realm->
has_los( *chr, *hostile ) )
2790 if ( ( ~flags & LH_FLAG_INCLUDE_HIDDEN ) && hostile->
hidden() )
2792 if ( !
inrangex( chr, hostile, range ) )
2794 arr->addElement( hostile->
make_ref() );
2797 return arr.release();
2801 return new BError(
"Invalid parameter" );
2815 return new BLong( 0 );
2822 unsigned short x, y;
2827 return new BError(
"Invalid Coordinates for realm" );
2828 LosObj tgt( x, y, static_cast<s8>( z ), src->
realm );
2839 unsigned short x1, x2;
2840 unsigned short y1, y2;
2848 return new BError(
"Realm not found" );
2850 if ( ( !realm->
valid( x1, y1, z1 ) ) || ( !realm->
valid( x2, y2, z2 ) ) )
2851 return new BError(
"Invalid Coordinates for Realm" );
2853 LosObj att( x1, y1, static_cast<s8>( z1 ), realm );
2854 LosObj tgt( x2, y2, static_cast<s8>( z2 ), realm );
2868 if ( item->has_gotten_by() )
2869 item->gotten_by()->clear_gotten_item();
2871 return new BError(
"That item is being used." );
2874 if ( !
id.destroy_script.empty() )
2890 return new BLong( 1 );
2894 return new BError(
"Invalid parameter type" );
2906 return new BLong( 1 );
2910 return new BLong( 0 );
2919 std::unique_ptr<BStruct> arr(
new BStruct );
2920 arr->addMember(
"x",
new BLong( obj->
x ) );
2921 arr->addMember(
"y",
new BLong( obj->
y ) );
2922 arr->addMember(
"z",
new BLong( obj->
z ) );
2923 return arr.release();
2927 return new BLong( 0 );
2940 return new BError(
"Invalid parameter type" );
2943 if ( item->
isa( UOBJ_CLASS::CLASS_CONTAINER ) )
2945 std::unique_ptr<ObjArray> newarr(
new ObjArray );
2947 static_cast<UContainer*
>( item )->enumerate_contents( newarr.get(), flags );
2949 return newarr.release();
2955 return new BError(
"Invalid parameter type" );
2960 std::unique_ptr<ObjArray> newarr(
new ObjArray );
2966 if ( ( *itr )->chr !=
nullptr )
2972 return newarr.release();
2985 return new BError(
"Invalid parameter type" );
2991 return new BLong( 1 );
2995 return new BError(
"Already registered for speech events" );
3000 return new BError(
"Invalid parameter type" );
3011 unsigned short range;
3029 return new BError(
"Invalid parameter" );
3044 return new BError(
"Invalid parameter" );
3054 return new BError(
"That is not dead" );
3059 return new BError(
"Invalid parameter type" );
3070 if ( !chr->
realm->
walkheight( chr->
x, chr->
y, chr->
z, &newz, &supporting_multi, &walkon_item,
3073 return new BError(
"That location is blocked" );
3078 return new BLong( 1 );
3082 return new BError(
"Invalid parameter type" );
3091 int sysfind_flags = 0;
3094 if ( !
getParam( 1, sysfind_flags ) )
3095 return new BError(
"Invalid parameter type" );
3100 if ( chr !=
nullptr )
3109 return new BError(
"Character not found" );
3118 if ( item !=
nullptr )
3123 return new BError(
"Item not found." );
3128 return new BError(
"Invalid parameter type" );
3139 return new BError(
"Invalid parameter type" );
3147 unsigned int dirty, clean;
3148 long long elapsed_ms;
3156 res =
write_data( dirty, clean, elapsed_ms );
3165 ret->
addMember(
"ElapsedMilliseconds",
new BLong( static_cast<int>( elapsed_ms ) ) );
3170 return new BError(
"pol.cfg has InhibitSaves=1" );
3173 catch ( std::exception& ex )
3175 POLLOG <<
"Exception during world save! (" << ex.what() <<
")\n";
3176 return new BError(
"Exception during world save" );
3183 const String* region_name_str;
3187 return new BError(
"Invalid Parameter type" );
3192 return new BError(
"Light Level is out of range" );
3196 if ( lightregion ==
nullptr )
3198 return new BError(
"Light region not found" );
3202 return new BLong( 1 );
3207 const String* region_name_str;
3215 return new BError(
"Invalid Parameter type" );
3219 if ( weatherregion ==
nullptr )
3221 return new BError(
"Weather region not found" );
3226 return new BLong( 1 );
3230 const String* region_name_str;
3231 unsigned short xwest, ynorth, xeast, ysouth;
3237 return new BError(
"Invalid Parameter type" );
3241 return new BError(
"Realm not found" );
3242 if ( !realm->
valid( xwest, ynorth, 0 ) )
3243 return new BError(
"Invalid Coordinates for realm" );
3244 if ( !realm->
valid( xeast, ysouth, 0 ) )
3245 return new BError(
"Invalid Coordinates for realm" );
3248 xeast, ysouth, realm );
3250 return new BLong( 1 );
3252 return new BError(
"Weather region not found" );
3263 int xd = tobj1->
x - tobj2->
x;
3264 int yd = tobj1->
y - tobj2->
y;
3270 return new BLong( xd );
3272 return new BLong( yd );
3276 return new BError(
"Invalid parameter type" );
3288 return new Double( sqrt( pow( (
double)( tobj1->
x - tobj2->
x ), 2 ) +
3289 pow( (
double)( tobj1->
y - tobj2->
y ), 2 ) ) );
3293 return new BError(
"Invalid parameter type" );
3299 unsigned short x1, y1, x2, y2;
3302 return new BError(
"Invalid parameter type" );
3309 unsigned short x1, y1, x2, y2;
3312 return new BError(
"Invalid parameter type" );
3314 return new Double( sqrt( pow( (
double)( x1 - x2 ), 2 ) + pow( (
double)( y1 - y2 ), 2 ) ) );
3322 return new BError(
"Invalid parameter type" );
3324 else if ( x1 == x2 && y1 == y2 )
3334 double dx = abs( x2 - x1 ) + 0.5;
3335 double dy = abs( y2 - y1 ) + 0.5;
3347 std::unique_ptr<ObjArray> coords(
new ObjArray );
3352 for (
int c = 0; c <= dx; c++ )
3354 int point_x = x1 + ( c * vx );
3356 double float_y = double( c ) * double( vy ) * dy;
3357 if ( float_y - floor( float_y ) >= 0.5 )
3358 float_y = ceil( float_y );
3359 int point_y = int( float_y ) + y1;
3361 std::unique_ptr<BStruct> point(
new BStruct );
3362 point->addMember(
"x",
new BLong( point_x ) );
3363 point->addMember(
"y",
new BLong( point_y ) );
3364 coords->addElement( point.release() );
3370 for (
int c = 0; c <= dy; c++ )
3372 int point_y = y1 + ( c * vy );
3374 double float_x = double( c ) * double( vx ) * dx;
3375 if ( float_x - floor( float_x ) >= 0.5 )
3376 float_x = ceil( float_x );
3377 int point_x = int( float_x ) + x1;
3379 std::unique_ptr<BStruct> point(
new BStruct );
3380 point->addMember(
"x",
new BLong( point_x ) );
3381 point->addMember(
"y",
new BLong( point_y ) );
3382 coords->addElement( point.release() );
3385 return coords.release();
3390 unsigned short from_x, from_y, to_x, to_y;
3394 return new BError(
"Invalid parameter type" );
3397 double x = to_x - from_x;
3398 double y = to_y - from_y;
3399 double pi = acos(
double( -1 ) );
3400 double r = sqrt( x * x + y * y );
3402 double angle = ( ( acos( x / r ) * 180.0 ) / pi );
3404 double y_check = ( ( asin( y / r ) * 180.0 ) / pi );
3407 angle = 360 - angle;
3410 unsigned short facing = ( ( short( angle / 40 ) + 10 ) % 8 );
3412 return new BLong( facing );
3435 int add_to_existing_stack;
3438 getParam( 4, add_to_existing_stack, 0, 2 ) ) )
3440 return new BError(
"Invalid parameter type" );
3447 if ( chr ==
nullptr || !chr->
can_move( item ) )
3448 return new BError(
"That is immobile" );
3452 return new BError(
"That item is being used." );
3456 if ( !cont_item->
isa( UOBJ_CLASS::CLASS_CONTAINER ) )
3458 return new BError(
"Non-container selected as target" );
3464 return new BError(
"Can't put a container into itself" );
3468 return new BError(
"Can't put a container into an item in itself" );
3470 if ( !cont->
can_add( *item ) )
3472 return new BError(
"Container is too full to add that" );
3476 if ( chr_owner ==
nullptr )
3482 Item* existing_stack =
nullptr;
3484 if ( ( oldcont !=
nullptr ) &&
3486 return new BError(
"Could not remove item from its container." );
3489 return new BError(
"Item was destroyed in CanRemove script" );
3492 if ( add_to_existing_stack )
3495 if ( existing_stack !=
nullptr )
3499 return new BError(
"Could not add to existing stack" );
3501 else if ( add_to_existing_stack == 2 )
3502 add_to_existing_stack = 0;
3504 return new BError(
"There is no existing stack" );
3507 if ( !add_to_existing_stack )
3509 return new BError(
"Could not insert item into container." );
3513 return new BError(
"Item was destroyed in CanInsert Script" );
3517 return new BError(
"Item cannot be unequipped" );
3520 return new BError(
"Item was destroyed in Equip Script" );
3523 if ( oldcont !=
nullptr )
3528 return new BError(
"Item was destroyed in OnRemove script" );
3532 if ( !add_to_existing_stack )
3538 return new BError(
"No slots available in new container" );
3543 return new BError(
"Couldn't set slot index on item" );
3546 short x =
static_cast<short>( px );
3547 short y =
static_cast<short>( py );
3572 return new BError(
"Item was destroyed in OnInsert script" );
3586 return new BLong( 1 );
3596 return new BError(
"Invalid parameter type" );
3603 if ( _chr ==
nullptr || !_chr->
can_move( item ) )
3604 return new BError(
"That is immobile" );
3608 return new BError(
"That item is being used." );
3616 if ( oldcont !=
nullptr )
3618 if ( chr_owner ==
nullptr )
3622 if ( ( oldcont !=
nullptr ) &&
3624 return new BError(
"Could not remove item from its container." );
3627 return new BError(
"Item was destroyed in CanRemove script" );
3631 return new BError(
"Item cannot be unequipped" );
3634 return new BError(
"Item was destroyed in Equip Script" );
3637 if ( oldcont !=
nullptr )
3642 return new BError(
"Item was destroyed in OnRemove script" );
3661 if ( _chr ==
nullptr || !_chr->
can_move( item ) )
3662 return new BError(
"That is immobile" );
3667 return new BError(
"That item is being used." );
3672 return new BError(
"That item is not equippable by that character" );
3676 return new BError(
"Item was destroyed in EquipTest script" );
3697 return new BLong( 1 );
3701 return new BError(
"Invalid parameter type" );
3710 if ( chr->
isa( UOBJ_CLASS::CLASS_NPC ) )
3712 NPC* npc =
static_cast<NPC*
>( chr );
3714 return new BLong( 1 );
3718 return new BError(
"RestartScript only operates on NPCs" );
3723 return new BError(
"Invalid parameter" );
3733 unsigned short tiletype;
3741 return new BError(
"Realm not found" );
3742 if ( !realm->
valid( x, y, 0 ) )
3743 return new BError(
"Invalid Coordinates for realm" );
3749 return new BError(
"Invalid parameter" );
3767 return new BError(
"Realm not found" );
3768 if ( !realm->
valid( x, y, 0 ) )
3769 return new BError(
"Invalid Coordinates for realm" );
3772 return new BError(
"b must be >= 0" );
3777 return new BError(
"Invalid parameter" );
3788 if ( obj->
isa( UOBJ_CLASS::CLASS_ITEM ) )
3791 if ( obj->
isa( UOBJ_CLASS::CLASS_CHARACTER ) )
3803 if ( justice_region ==
nullptr )
3804 return new BError(
"No Region defined at this Location" );
3809 return new BError(
"Invalid parameter" );
3814 unsigned short x, y;
3821 return new BError(
"Realm not found" );
3822 if ( !realm->
valid( x, y, 0 ) )
3823 return new BError(
"Invalid Coordinates for realm" );
3826 if ( justice_region ==
nullptr )
3827 return new BError(
"No Region defined at this Location" );
3832 return new BError(
"Invalid parameter" );
3838 unsigned short x, y;
3847 return new BError(
"Realm not found" );
3848 if ( !realm->
valid( x, y, 0 ) )
3849 return new BError(
"Invalid Coordinates for realm" );
3855 return new BError(
"Invalid parameter" );
3861 unsigned short x, y;
3868 return new BError(
"Realm not found" );
3869 if ( !realm->
valid( x, y, 0 ) )
3870 return new BError(
"Invalid Coordinates for realm" );
3873 if ( light_region !=
nullptr )
3877 return new BLong( lightlevel );
3881 return new BError(
"Invalid parameter" );
3889 const String* template_name;
3896 return new BError(
"Invalid parameter" );
3908 return new BLong( 1 );
3912 return new BError(
"Invalid parameter" );
3924 return new BLong( 1 );
3928 return new BError(
"Invalid parameter" );
3939 if ( ch >=
'0' && ch <=
'9' )
3941 else if ( ch >=
'A' && ch <=
'F' )
3942 ch = ch -
'A' + 0xa;
3943 else if ( ch >=
'a' && ch <=
'f' )
3944 ch = ch -
'a' + 0xa;
3956 if ( str->
length() % 2 > 0 )
3958 return new BError(
"Invalid packet string length." );
3962 unsigned char* buf =
reinterpret_cast<unsigned char*
>( buffer->getBuffer() );
3963 const char* s = str->
data();
3964 while ( buffer->offset < 2000 && isxdigit( s[0] ) && isxdigit( s[1] ) )
3972 if ( chr !=
nullptr )
3977 return new BLong( 1 );
3981 return new BError(
"No client attached" );
3984 else if ( client !=
nullptr )
3988 buffer.
Send( client );
3989 return new BLong( 1 );
3993 return new BError(
"Client is disconnected" );
3998 return new BError(
"Invalid parameter type" );
4003 return new BError(
"Invalid parameter type" );
4017 return new BError(
"No client attached" );
4022 if ( x == -1 && y == -1 )
4026 if ( usesNewPktSize )
4031 if ( !chr->
realm->
valid( static_cast<unsigned short>( x ), static_cast<unsigned short>( y ),
4033 return new BError(
"Invalid Coordinates for Realm" );
4035 msg->WriteFlipped<
u16>(
static_cast<u16>( x & 0xFFFF ) );
4036 msg->WriteFlipped<
u16>(
static_cast<u16>( y & 0xFFFF ) );
4037 if ( usesNewPktSize )
4042 return new BError(
"No valid target for HSA client" );
4048 return new BLong( 1 );
4052 return new BError(
"Invalid parameter" );
4064 return new BError(
"Spell ID out of range" );
4067 if ( spell ==
nullptr )
4069 return new BError(
"No such spell" );
4076 return new BError(
"Invalid parameter" );
4088 return new BError(
"Spell ID out of range" );
4091 if ( spell ==
nullptr )
4093 return new BError(
"No such spell" );
4097 return new BLong( 1 );
4101 return new BError(
"Invalid parameter" );
4111 return new BError(
"Spell ID out of range" );
4114 if ( spell ==
nullptr )
4116 return new BError(
"No such spell" );
4123 return new BError(
"Invalid parameter" );
4130 unsigned short font;
4131 unsigned short color;
4138 return new BError(
"Spell ID out of range" );
4141 if ( spell ==
nullptr )
4143 return new BError(
"No such spell" );
4148 return new BLong( 1 );
4152 return new BError(
"Invalid parameter" );
4161 std::unique_ptr<ObjArray> arr(
new ObjArray );
4165 if ( item !=
nullptr )
4170 return arr.release();
4174 return new BError(
"Invalid parameter" );
4186 return new BError(
"Invalid layer" );
4190 if ( item ==
nullptr )
4192 return new BError(
"Nothing equipped on that layer." );
4201 return new BError(
"Invalid parameter" );
4212 if ( chr !=
nullptr )
4215 return new BError(
"No client attached" );
4220 if ( client !=
nullptr )
4225 return new BLong( 1 );
4228 return new BError(
"Client is disconnected" );
4231 return new BError(
"Invalid parameter type" );
4235 return new BError(
"Invalid parameter type" );
4252 return new BError(
"Realm not found" );
4253 if ( !realm->
valid( x, y, 0 ) )
4254 return new BError(
"Invalid Coordinates for realm" );
4257 realm->
getmaptile( static_cast<unsigned short>( x ), static_cast<unsigned short>( y ) );
4259 std::unique_ptr<BStruct> result(
new BStruct );
4260 result->addMember(
"z",
new BLong( cell.
z ) );
4261 result->addMember(
"landtile",
new BLong( cell.
landtile ) );
4263 return result.release();
4267 return new BError(
"Invalid parameter" );
4272 unsigned short x, y;
4278 return new BError(
"Realm not found" );
4279 if ( !realm->
valid( x, y, 0 ) )
4280 return new BError(
"Invalid Coordinates for Realm" );
4284 return new BLong( z );
4286 return new BError(
"Nowhere" );
4290 return new BError(
"Invalid parameter" );
4301 return new BLong( objtype );
4303 return new BError(
"No objtype by that name" );
4307 return new BError(
"Invalid parameter" );
4317 if ( event !=
nullptr )
4319 if ( chr->
isa( UOBJ_CLASS::CLASS_NPC ) )
4321 NPC* npc =
static_cast<NPC*
>( chr );
4327 return new BError(
"That mobile is not an NPC" );
4332 return new BError(
"Huh? Not enough parameters" );
4337 return new BError(
"Invalid parameter" );
4347 if ( !
id.destroy_script.empty() )
4357 if ( boat !=
nullptr )
4362 if ( house !=
nullptr )
4366 return new BError(
"WTF!? Don't know what kind of multi that is!" );
4370 return new BError(
"Invalid parameter type" );
4381 return new BError(
"MultiID not found" );
4384 std::unique_ptr<BStruct> ret(
new BStruct );
4385 ret->addMember(
"xmin",
new BLong( md.
minrx ) );
4386 ret->addMember(
"xmax",
new BLong( md.
maxrx ) );
4387 ret->addMember(
"ymin",
new BLong( md.
minry ) );
4388 ret->addMember(
"ymax",
new BLong( md.
maxry ) );
4389 return ret.release();
4392 return new BError(
"Invalid parameter" );
4399 bool handled =
false;
4404 if ( lng->
value() == 0 )
4420 if ( old_controller )
4423 return new BLong( 0 );
4455 unsigned short x, y;
4462 return new BError(
"Realm not found" );
4463 if ( !realm->
valid( x, y, z ) )
4464 return new BError(
"Coordinates Invalid for Realm" );
4470 std::unique_ptr<BStruct> arr(
new BStruct );
4471 arr->addMember(
"z",
new BLong( newz ) );
4472 if ( multi !=
nullptr )
4474 return arr.release();
4478 return new BError(
"Can't stand there" );
4483 return new BError(
"Invalid parameter type" );
4489 unsigned short x, y;
4498 return new BError(
"Realm not found" );
4500 if ( !realm->
valid( x, y, 0 ) )
4501 return new BError(
"Coordinates Invalid for Realm" );
4503 std::unique_ptr<ObjArray> newarr(
new ObjArray );
4509 for (
unsigned i = 0; i < mlist.size(); ++i )
4511 std::unique_ptr<BStruct> arr(
new BStruct );
4514 arr->addMember(
"z",
new BLong( mlist[i].z + 1 ) );
4516 arr->addMember(
"z",
new BLong( mlist[i].z ) );
4518 arr->addMember(
"height",
new BLong( mlist[i].height ) );
4519 arr->addMember(
"flags",
new BLong( mlist[i].flags ) );
4520 newarr->addElement( arr.release() );
4523 return newarr.release();
4526 return new BError(
"Invalid parameter type" );
4534 if ( item->
inuse() )
4537 return new BLong( 2 );
4539 return new BError(
"That item is already being used." );
4541 item->
inuse(
true );
4543 return new BLong( 1 );
4547 return new BError(
"Invalid parameter" );
4556 if ( item->
inuse() )
4562 item->
inuse(
false );
4565 return new BLong( 1 );
4568 return new BError(
"That item is not reserved by this script." );
4572 return new BError(
"That item is not reserved." );
4577 return new BError(
"Invalid parameter" );
4590 return new BLong( 1 );
4594 return new BError(
"No client attached" );
4599 return new BError(
"Invalid parameter type" );
4612 return new BLong( 1 );
4616 return new BError(
"No client attached" );
4621 return new BError(
"Invalid parameter type" );
4632 unsigned int objtype;
4637 if ( !cont_item->
isa( UOBJ_CLASS::CLASS_CONTAINER ) )
4638 return new BError(
"That is not a container" );
4640 return new BError(
"Amount cannot be negative" );
4644 if ( amthave < amount )
4645 return new BError(
"Not enough of that substance in container" );
4649 return new BLong( 1 );
4653 return new BError(
"Invalid parameter type" );
4675 return new BLong( 1 );
4686 if ( !help.empty() )
4688 return new String( help );
4692 return new BError(
"No help for that command found" );
4697 return new BError(
"Invalid parameter type" );
4711 return new BLong( 1 );
4715 return new BError(
"No client attached" );
4720 return new BError(
"Invalid parameter type" );
4727 unsigned short x, y;
4738 return new BError(
"Realm not found" );
4742 if ( !realm->
valid( x, y, 0 ) )
4743 return new BError(
"Invalid Coordinates for realm" );
4747 if ( !realm->
valid( x, y, static_cast<short>( z ) ) )
4748 return new BError(
"Invalid Coordinates for realm" );
4751 std::unique_ptr<ObjArray> newarr(
new ObjArray );
4755 if ( ( abs( item->x - x ) <= range ) && ( abs( item->y - y ) <= range ) )
4757 if ( ( z == LIST_IGNORE_Z ) || ( abs( item->z - z ) < CONST_DEFAULT_ZRANGE ) )
4758 newarr->addElement( new EItemRefObjImp( item ) );
4763 return newarr.release();
4766 return new BError(
"Invalid parameter" );
4771 unsigned short x, y;
4780 return new BError(
"Realm not found" );
4784 if ( !realm->
valid( x, y, 0 ) )
4785 return new BError(
"Invalid Coordinates for realm" );
4789 if ( !realm->
valid( x, y, static_cast<short>( z ) ) )
4790 return new BError(
"Invalid Coordinates for realm" );
4793 std::unique_ptr<ObjArray> newarr(
new ObjArray );
4800 for (
unsigned i = 0; i < slist.size(); ++i )
4804 std::unique_ptr<BStruct> arr(
new BStruct );
4805 arr->addMember(
"x",
new BLong( x ) );
4806 arr->addMember(
"y",
new BLong( y ) );
4807 arr->addMember(
"z",
new BLong( slist[i].z ) );
4808 arr->addMember(
"objtype",
new BLong( slist[i].objtype ) );
4809 arr->addMember(
"hue",
new BLong( slist[i].hue ) );
4810 newarr->addElement( arr.release() );
4820 for (
unsigned i = 0; i < mlist.size(); ++i )
4824 std::unique_ptr<BStruct> arr(
new BStruct );
4825 arr->addMember(
"x",
new BLong( x ) );
4826 arr->addMember(
"y",
new BLong( y ) );
4827 arr->addMember(
"z",
new BLong( mlist[i].z ) );
4828 arr->addMember(
"objtype",
new BLong( mlist[i].graphic ) );
4829 newarr->addElement( arr.release() );
4834 return newarr.release();
4837 return new BError(
"Invalid parameter" );
4842 unsigned short x, y;
4853 return new BError(
"Realm not found" );
4857 if ( !realm->
valid( x, y, 0 ) )
4858 return new BError(
"Invalid Coordinates for realm" );
4862 if ( !realm->
valid( x, y, static_cast<short>( z ) ) )
4863 return new BError(
"Invalid Coordinates for realm" );
4866 std::unique_ptr<ObjArray> newarr(
new ObjArray );
4876 if ( wxH > realm->
width() - 1 )
4877 wxH = realm->
width() - 1;
4879 if ( wyH > realm->
height() - 1 )
4880 wyH = realm->
height() - 1;
4882 for (
unsigned short wx = wxL; wx <=
wxH; ++wx )
4884 for (
unsigned short wy = wyL; wy <=
wyH; ++wy )
4891 for (
unsigned i = 0; i < slist.size(); ++i )
4895 std::unique_ptr<BStruct> arr(
new BStruct );
4896 arr->addMember(
"x",
new BLong( wx ) );
4897 arr->addMember(
"y",
new BLong( wy ) );
4898 arr->addMember(
"z",
new BLong( slist[i].z ) );
4899 arr->addMember(
"objtype",
new BLong( slist[i].objtype ) );
4900 arr->addMember(
"hue",
new BLong( slist[i].hue ) );
4901 newarr->addElement( arr.release() );
4911 for (
unsigned i = 0; i < mlist.size(); ++i )
4915 std::unique_ptr<BStruct> arr(
new BStruct );
4916 arr->addMember(
"x",
new BLong( wx ) );
4917 arr->addMember(
"y",
new BLong( wy ) );
4918 arr->addMember(
"z",
new BLong( mlist[i].z ) );
4919 arr->addMember(
"objtype",
new BLong( mlist[i].graphic ) );
4920 newarr->addElement( arr.release() );
4927 return newarr.release();
4930 return new BError(
"Invalid parameter" );
5027 unsigned short x1, x2;
5028 unsigned short y1, y2;
5037 return new BError(
"Beyond Max Range." );
5053 return new BError(
"Realm not found" );
5054 if ( !realm->
valid( x1, y1, z1 ) )
5055 return new BError(
"Start Coordinates Invalid for Realm" );
5056 if ( !realm->
valid( x2, y2, z2 ) )
5057 return new BError(
"End Coordinates Invalid for Realm" );
5059 unsigned int SearchState;
5061 short xL, xH, yL, yH;
5089 if ( xH >= realm->
width() )
5090 xH = realm->
width() - 1;
5091 if ( yH >= realm->
height() )
5092 yH = realm->
height() - 1;
5096 POLLOG.Format(
"[FindPath] Calling FindPath({}, {}, {}, {}, {}, {}, {}, 0x{:X}, {})\n" )
5097 << x1 << y1 << z1 << x2 << y2 << z2 << strrealm->
data() << flags << theSkirt;
5098 POLLOG.Format(
"[FindPath] search for Blockers inside {} {} {} {}\n" )
5099 << xL << yL << xH << yH;
5110 POLLOG.Format(
"[FindPath] add Blocker {} at {} {} {}\n" )
5111 << chr->
name() << chr->
x << chr->
y << chr->
z;
5120 POLLOG.Format(
"[FindPath] use StartNode {} {} {}\n" ) << x1 << y1 << z1;
5121 POLLOG.Format(
"[FindPath] use EndNode {} {} {}\n" ) << x2 << y2 << z2;
5125 UOPathState nodeStart( x1, y1, z1, realm, &theBlockers );
5127 UOPathState nodeEnd( x2, y2, z2, realm, &theBlockers );
5132 SearchState = astarsearch->
SearchStep( doors_block );
5156 return new BError(
"Failed to find a path." );
5161 return new BError(
"Out of memory." );
5166 return new BError(
"Solution Corrupted!" );
5170 return new BError(
"Pathfind Error." );
5174 return new BError(
"Invalid parameter" );
5190 if ( chr->
client !=
nullptr )
5193 return new BError(
"Character busy." );
5205 if ( !on_use_script.empty() )
5207 ScriptDef sd( on_use_script,
nullptr,
"" );
5218 if ( prog.
get() != nullptr )
5221 return new BLong( 1 );
5223 return new BError(
"Failed to start script!" );
5228 if ( chr->
client !=
nullptr )
5230 return new BLong( 0 );
5235 return new BError(
"Invalid parameter" );
5244 unsigned int objtype;
5253 if ( !
getParam( 3, makeInUseLong ) )
5256 makeInUse = ( makeInUseLong ?
true : false );
5260 if ( !cont_item->
isa( UOBJ_CLASS::CLASS_CONTAINER ) )
5261 return new BError(
"That is not a container" );
5263 return new BError(
"Amount cannot be negative" );
5268 return new BError(
"Not enough of that substance in container" );
5271 std::unique_ptr<ObjArray> theArray(
new ObjArray() );
5274 for ( UContainer::Contents::const_iterator itr = substanceVector.begin();
5275 itr != substanceVector.end(); ++itr )
5278 if ( item !=
nullptr )
5280 if ( ( makeInUse ) && ( !item->
inuse() ) )
5282 item->
inuse(
true );
5288 return theArray.release();
5293 return new BError(
"Invalid parameter type" );
5304 return new BError(
"Invalid parameter type" );
5308 return new BError(
"Objtypes differs" );
5310 return new BError(
"That item type is not stackable." );
5313 return new BLong( 1 );
5315 return new BError(
"Failed to stack" );
5327 if ( ( !chr->
isa( UOBJ_CLASS::CLASS_NPC ) ) && ( chr->
client ) )
5329 if ( ( chr->
isa( UOBJ_CLASS::CLASS_NPC ) ) || ( chr->
client ) )
5332 return new BError(
"Mobile is offline" );
5336 if ( ( !chr->
isa( UOBJ_CLASS::CLASS_NPC ) ) && ( chr->
client ) )
5338 if ( ( chr->
isa( UOBJ_CLASS::CLASS_NPC ) ) || ( chr->
client ) )
5341 return new BError(
"Mobile is offline" );
5343 return new BLong( 1 );
5345 return new BError(
"Invalid parameter type" );
5355 return new BLong( 1 );
5359 return new BError(
"Invalid parameter type" );
5371 const String* realm_name;
5372 const String* movemode_name;
5382 return new BError(
"Realm not found." );
5383 else if ( !realm->valid( x, y, z ) )
5384 return new BError(
"Invalid coordinates for realm." );
5387 dir =
static_cast<UFACING>( x2_or_dir & 0x7 );
5390 if ( !realm->valid( static_cast<xcoord>( x2_or_dir ), static_cast<ycoord>( y2_ ), 0 ) )
5391 return new BError(
"Invalid coordinates for realm." );
5392 dir =
direction_toward( x, y, static_cast<xcoord>( x2_or_dir ), static_cast<ycoord>( y2_ ) );
5398 u8 tmp_facing = ( dir + 1 ) & 0x7;
5403 bool walk1 = realm->walkheight( tmp_newx, tmp_newy, z, &new_z,
nullptr,
nullptr,
true,
5404 movemode,
nullptr );
5406 tmp_facing = ( dir - 1 ) & 0x7;
5410 if ( !walk1 && !realm->walkheight( tmp_newx, tmp_newy, z, &new_z,
nullptr,
nullptr,
true,
5411 movemode,
nullptr ) )
5412 return new BError(
"Cannot walk there" );
5419 if ( !realm->walkheight( newx, newy, z, &newz,
nullptr,
nullptr,
true, movemode,
nullptr ) )
5420 return new BError(
"Cannot walk there" );
5422 return new BLong( newz );
5425 return new BError(
"Invalid parameter" );
5446 size_t ulen = uText->
ref_arr.size();
5448 return new BError(
"Unicode array exceeds maximum size." );
5451 return new BError(
"Invalid parameter type" );
5453 size_t elen = eText->
ref_arr.size();
5455 return new BError(
"Unicode array exceeds maximum size." );
5458 return new BError(
"Invalid parameter type" );
5461 return new BLong( 1 );
5464 return new BError(
"Mobile must be online." );
5467 return new BError(
"Invalid parameter type" );
5472 int season_id, playsound;
5476 if ( season_id < 0 || season_id > 4 )
5477 return new BError(
"Invalid season id" );
5480 msg->Write<
u8>(
static_cast<u16>( season_id ) );
5481 msg->Write<
u8>(
static_cast<u16>( playsound ) );
5492 return new BLong( 1 );
5495 return new BError(
"Invalid parameter" );
5501 int xcenter, ycenter, radius;
5504 return new BError(
"Invalid parameter type" );
5506 std::unique_ptr<ObjArray> coords(
new ObjArray );
5508 std::vector<std::tuple<int, int>> points;
5509 auto add_point = [&coords](
int x,
int y ) {
5510 std::unique_ptr<BStruct> point(
new BStruct );
5511 point->addMember(
"x",
new BLong( x ) );
5512 point->addMember(
"y",
new BLong( y ) );
5513 coords->addElement( point.release() );
5518 add_point( xcenter, ycenter );
5519 return coords.release();
5525 std::vector<std::tuple<int, int>> q1, q2, q3, q4;
5526 int x = -radius, y = 0, err = 2 - 2 * radius;
5529 q1.emplace_back( xcenter - x, ycenter + y );
5530 q2.emplace_back( xcenter - y, ycenter - x );
5531 q3.emplace_back( xcenter + x, ycenter - y );
5532 q4.emplace_back( xcenter + y, ycenter + x );
5536 if ( radius > x || err > y )
5540 for (
const auto p : q1 )
5541 add_point( std::get<0>( p ), std::get<1>( p ) );
5542 for (
const auto p : q2 )
5543 add_point( std::get<0>( p ), std::get<1>( p ) );
5544 for (
const auto p : q3 )
5545 add_point( std::get<0>( p ), std::get<1>( p ) );
5546 for (
const auto p : q4 )
5547 add_point( std::get<0>( p ), std::get<1>( p ) );
5549 return coords.release();
5555 using namespace Module;
Bscript::BObjectImp * mf_DestroyItem()
void setFunctionResult(BObjectImp *imp)
Bscript::BObjectImp * mf_EraseObjProperty()
virtual void on_insert_add_item(Mobile::Character *mob, MoveType move, Items::Item *new_item)
Contents::const_iterator const_iterator
void on_remove(Mobile::Character *chr, Items::Item *item, MoveType move=MT_PLAYER)
void handle_script_cursor(Character *chr, UObject *obj)
void play_moving_effect2(u16 xs, u16 ys, s8 zs, u16 xd, u16 yd, s8 zd, u16 effect, u8 speed, u8 loop, u8 explode, Realms::Realm *realm)
Bscript::BObjectImp * mf_GetMidpointCircleCoords()
Bscript::BObjectImp * mf_CloseTradeWindow()
VersionDetailStruct getversiondetail() const
Bscript::BObjectImp * mf_EnableEvents()
Module::UOExecutorModule * popup_menu_selection_uoemod
void register_with_supporting_multi(Item *item)
std::vector< Items::Item * > Contents
Bscript::BObjectImp * mf_AddMenuItem()
static Item * create(u32 objtype, u32 serial=0)
virtual void walk_on(Mobile::Character *chr) POL_OVERRIDE
unsigned int tile_flags(unsigned short tilenum)
void broadcast(const char *text, unsigned short font, unsigned short color, unsigned short requiredCmdLevel)
unsigned short stack_limit
Bscript::BObjectImp * mf_FindAccount()
Bscript::BObjectImp * mf_FindObjtypeInContainer()
Bscript::BObjectImp * mf_GetStandingHeight()
bool can_add_to_slot(u8 &slotIndex)
void register_for_speech_events(UObject *obj, UOExecutor *uoexec, int range, int flags)
Bscript::BObjectImp * mf_DisconnectClient()
virtual std::string getStringRep() const =0
const int ITEMS_IGNORE_STATICS
bool is_legal_posn(const Items::Item *item, u16 x, u16 y) const
Bscript::BObjectImp * mf_MoveObjectToLocation()
ref_ptr< Bscript::EScriptProgram > find_script2(const ScriptDef &script, bool complain_if_not_found, bool cache_script)
Bscript::BObjectImp * mf_EnumerateItemsInContainer()
const std::string & value() const
bool can_add_to_self(unsigned short amount, bool force_stacking) const
unsigned int find_sumof_objtype_noninuse(u32 objtype) const
virtual Bscript::BObjectImp * make_ref() POL_OVERRIDE
unsigned int get_objtype_byname(const char *str)
Bscript::BObjectImp * mf_RegisterForSpeechEvents()
Bscript::BObjectImp * mf_UpdateMobile()
Bscript::BObjectImp * mf_PlayStationaryEffect_Ex()
UObject * system_find_object(u32 serial)
bool assign_zones_to_region(const char *regionname, unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2, Realms::Realm *realm)
Bscript::BObjectImp * mf_SendViewContainer()
void clear_prop(const char *propname)
virtual bool can_add(const Items::Item &item) const
Bscript::BObjectImp * mf_ConsumeSubstance()
void add_item_to_world(Items::Item *item)
Bscript::BObjectImp * mf_Detach()
std::vector< StaticRec > StaticList
ValueStackCont ValueStack
unsigned short default_light_level
bool skill_ex_active() const
void SetStartAndGoalStates(UserState &Start, UserState &Goal)
Bscript::BObjectImp * mf_MoveItemToSecureTradeWin()
Bscript::BObjectImp * mf_CreateAccount()
bool check_unequip_script()
unsigned char concealed() const
Bscript::BObjectImp * mf_CreateItemInInventory()
Bscript::BObjectImp * mf_UseItem()
Bscript::BObjectImp * harvest_resource(const char *resource, xcoord x, ycoord y, Realms::Realm *realm, int b, int n)
bool registered_for_speech_events
bool isa(BObjectType type) const
void setprop(const std::string &propname, const std::string &propvalue)
Mobile::Character * gump_chr
void revoke_privilege(const char *priv)
const unsigned LMBLEX_FLAG_DEAD
unsigned int tile_uoflags(unsigned short tilenum)
Mobile::Character * prompt_chr
#define RANGE_VISUAL_LARGE_BUILDINGS
bool VALID_LIGHTLEVEL(int lightlevel)
void getmapshapes(Plib::MapShapeList &shapes, unsigned short x, unsigned short y, unsigned int anyflags) const
bool FindNpcTemplate(const char *template_name, Clib::ConfigElem &elem)
bool walkheight(unsigned short x, unsigned short y, short oldz, short *newz, Multi::UMulti **pmulti, Items::Item **pwalkon, bool doors_block, Core::MOVEMODE movemode, short *gradual_boost=nullptr)
void SetCharacterWorldPosition(Mobile::Character *chr, Realms::WorldChangeReason reason)
unsigned char tilelayer(unsigned short tilenum)
Bscript::BObjectImp * mf_ListObjectsInBox()
Module::UOExecutorModule * textentry_uoemod
Core::UOExecutor * script_ex
Bscript::BObjectImp * mf_PlaySoundEffect()
bool check_unequiptest_scripts(Mobile::Character *chr)
u32 GetNextSerialNumber(void)
void speak_power_words(Mobile::Character *chr, unsigned short font, unsigned short color)
Bscript::BObjectImp * mf_EraseGlobalProperty()
void add_remote_container(Items::Item *)
Bscript::BObjectImp * mf_SetRegionLightLevel()
void grant_privilege(const char *priv)
bool getParam(unsigned param, int &value)
Core::UOExecutor & uoexec
void send_paperdoll(Network::Client *client, Mobile::Character *chr)
bool target_cursor_busy() const
virtual class UBoat * as_boat()
Bscript::BObjectImp * mf_SendOpenBook()
void deregister_from_speech_events(UOExecutor *uoexec)
Bscript::BObjectImp * mf_SubtractAmount()
UserState * GetSolutionNext()
const unsigned POLCLASS_MULTI
const unsigned SYSFIND_SEARCH_OFFLINE_MOBILES
virtual void repsys_on_help(Character *recipient)
[15] Mobile (MA) Helps Mobile (MB)
unsigned short speech_size
bool has_active_client() const
BObjectImp * _complete_create_item_at_location(Item *item, unsigned short x, unsigned short y, short z, Realms::Realm *realm)
bool get(ENUM flag) const
void SetRegionWeatherLevel(WeatherRegion *weatherregion, unsigned type, unsigned severity, unsigned aux, int lightoverride)
Bscript::BObjectImp * mf_CreateItemCopyAtLocation()
static bool item_create_params_ok(u32 objtype, int amount)
Bscript::BObjectImp * mf_CoordinateDistanceEuclidean()
LosCheckedCoordCursor script_cursor2
const Contents & contents() const
void append_objtypes(ObjArray *objarr, Menu *menu)
Character * UpdateCharacterWeight(Item *item)
bool has_equip_script() const
Bscript::BObjectImp * mf_SendGumpMenu()
Bscript::BObjectImp * mf_SystemFindObjectBySerial()
const unsigned LMBLEX_FLAG_CONCEALED
bool casting_spell() const
Mobile::Character * resurrect_chr
void getpropnames(std::vector< std::string > &propnames) const
void send_open_gump(Network::Client *client, const UContainer &cont)
Bscript::BObjectImp * mf_RevokePrivilege()
Bscript::BObjectImp * mf_SingleClick()
Bscript::BObjectImp * broadcast()
LosCheckedTargetCursor los_checked_script_cursor
Bscript::BObjectImp * mf_Resurrect()
Bscript::BObjectImp * mf_GetRegionName()
void play_moving_effect2_ex(u16 xs, u16 ys, s8 zs, u16 xd, u16 yd, s8 zd, Realms::Realm *realm, u16 effect, u8 speed, u8 duration, u32 hue, u32 render, u8 direction, u8 explode, u16 effect3d, u16 effect3dexplode, u16 effect3dsound)
Bscript::BObjectImp * mf_GetCoordsInLine()
BObjectImp * getParamImp(unsigned param)
Bscript::BObjectImp * mf_GetPosition()
#define STOP_PROFILECLOCK(timer)
std::unique_ptr< Core::PropertyList > global_properties
Bscript::BObjectImp * mf_CoordinateDistance()
virtual void register_object(UObject *obj)
void addMember(const char *name, BObjectRef val)
Core::CharacterRef controller_
int lightlevel(unsigned short x, unsigned short y)
Core::UFACING direction_toward(const Character *src, const Core::UObject *idst)
static void InRange(u16 x, u16 y, const Realms::Realm *realm, unsigned range, F &&f)
Bscript::BObjectImp * mf_SendCharacterRaceChanger()
Bscript::BObjectImp * mf_GetAmount()
virtual Item * clone() const
virtual T * getregion(xcoord x, ycoord y, Realms::Realm *realm)
const ItemDesc & find_itemdesc(unsigned int objtype)
Bscript::BObjectImp * mf_PerformAction()
Bscript::BObjectImp * mf_PolCore()
Bscript::BObjectImp * mf_SelectColor()
void add_to_self(Item *&item)
void menu_selection_made(Network::Client *client, MenuItem *mi, PKTIN_7D *msg)
virtual void builtin_on_use(Network::Client *client)
Bscript::BObjectImp * mf_GetSpellDifficulty()
const char * paramAsString(unsigned param)
Bscript::BObjectImp * mf_ListOfflineMobilesInRealm()
const int FP_IGNORE_DOORS
const std::string & region_name() const
const std::string name() const
void play_moving_effect(const UObject *src, const UObject *dst, u16 effect, u8 speed, u8 loop, u8 explode)
virtual void add(Items::Item *item)
static Core::MOVEMODE decode_movemode(const std::string &str)
void remove_item_from_world(Items::Item *item)
void send_item_to_inrange(const Item *item)
Bscript::BObjectImp * mf_PromptInput()
virtual std::string pack() const
Bscript::BObjectImp * mf_ListGhostsNearLocation()
Bscript::BObjectImp * mf_CreateItemAtLocation()
Bscript::BObjectImp * mf_SendSkillWindow()
#define UOBJ_ITEM__LOWEST
Bscript::BObjectImp * mf_Shutdown()
Bscript::BObjectImp * mf_GetGlobalProperty()
Bscript::BObjectImp * mf_ListMobilesNearLocationEx()
unsigned int SearchStep(bool doors_block)
virtual bool script_isa(unsigned isatype) const POL_OVERRIDE
Bscript::BObjectImp * mf_SendPacket()
Bscript::BObjectImp * mf_SelectMenuItem()
Core::ScriptDef on_use_script
bool private_say_above(Character *chr, const UObject *obj, const char *text, unsigned short font, unsigned short color, unsigned int journal_print)
Bscript::BObjectImp * mf_GetStandingLayers()
const unsigned LMBLEX_FLAG_HIDDEN
std::string hexint(unsigned short v)
const BApplicObjType * object_type() const
Items::Item * find_addable_stack(const Items::Item *adding_item) const
unsigned short getgraphic(u32 objtype)
void get_random_location(u16 *px, u16 *py) const
virtual const char * target_tag() const
bool getCharacterParam(Bscript::Executor &exec, unsigned param, Mobile::Character *&chrptr)
void play_stationary_effect_ex(u16 x, u16 y, s8 z, Realms::Realm *realm, u16 effect, u8 speed, u8 duration, u32 hue, u32 render, u16 effect3d)
Bscript::BObjectImp * mf_PlayMusic()
bool getprop(const std::string &propname, std::string &propvalue) const
Bscript::BObjectImp * mf_DestroyMulti()
Bscript::BObjectImp * mf_PlaySoundEffectPrivate()
Bscript::BObjectImp * equip_from_template(Mobile::Character *chr, const char *template_name)
void setamount(u16 amount)
bool lowest_standheight(unsigned short x, unsigned short y, short *z) const
void send_move_mobile_to_nearby_cansee(const Character *chr)
Multi::UMulti * system_find_multi(u32 serial)
Bscript::BObjectImp * mf_GetObjType()
Bscript::BObjectImp * mf_ListItemsNearLocationWithFlag()
virtual void repsys_on_attack(Character *defender)
[13] Mobile (MA) Attacks Mobile (MA)
Bscript::BObjectImp * mf_CreateItemInContainer()
Bscript::BObjectImp * mf_GetMapInfo()
Bscript::BObjectImp * mf_ListItemsNearLocationOfType()
bool start_itemuse_script(Bscript::EScriptProgram *prog, Items::Item *item, bool start_attached)
void send_move(Client *client, const Character *chr)
Bscript::BObjectImp * mf_SaveWorldState()
void send_midi(Client *client, u16 midi)
const unsigned LMBLEX_FLAG_NORMAL
bool send_coord_cursor(Network::Client *client)
Bscript::BObjectImp * mf_ListEquippedItems()
Bscript::BObjectImp * mf_SendBuyWindow()
Bscript::BObjectImp * mf_ListStaticsInBox()
void true_extricate(Item *item)
Bscript::BObjectImp * mf_GetWorldHeight()
virtual class UHouse * as_house()
void destroy_item(Item *item)
virtual bool isTrue() const
bool is_reserved_to_me(Items::Item *item)
Bscript::BObjectImp * mf_SetObjProperty()
Bscript::BObjectImp * destroy_house(UHouse *house)
Mobile::Character * target_cursor_chr
Bscript::BObjectImp * mf_ListStaticsNearLocationWithFlag()
void play_object_centered_effect_ex(const UObject *center, u16 effect, u8 speed, u8 duration, u32 hue, u32 render, u8 layer, u16 effect3d)
static void internal_InBoxAreaChecks(unsigned short &x1, unsigned short &y1, int &z1, unsigned short &x2, unsigned short &y2, int &z2, Realms::Realm *realm)
Bscript::BObjectImp * mf_SetRegionWeatherLevel()
Bscript::BObjectImp * mf_ConsumeReagents()
unsigned short difficulty() const
Bscript::BObjectImp * mf_PlayLightningBoltEffect()
bool getCharacterOrClientParam(Executor &exec, unsigned param, Mobile::Character *&chrptr, Network::Client *&clientptr)
Module::UOExecutorModule * prompt_uoemod
Bscript::BObjectImp * mf_GetGlobalPropertyNames()
void eraseprop(const std::string &propname)
weak_ptr< Core::Menu > menu
Bscript::BObjectImp * mf_SendCharProfile()
Mobile::Character * attached_chr_
Bscript::BObjectImp * mf_CanWalk()
NetworkManager networkManager
void add_prop(std::string propname, std::string propval)
Bscript::BObjectImp * mf_DisableEvents()
bool is_a_parent(const Item *item, u32 serial)
std::vector< BObjectRef > fparams
Module::UOExecutorModule * selcolor_uoemod
bool convertArrayToUC(Bscript::ObjArray *&in_text, u16 *out_wtext, size_t textlen, bool ConvToBE, bool nullterm)
unsigned short height() const
void Send(Client *client, int len=-1) const
BApplicObjBase * getApplicObjParam(unsigned param, const BApplicObjType *object_type)
Bscript::BObjectImp * mf_ListMobilesNearLocation()
Bscript::BObjectImp * mf_AddAmount()
Bscript::BObjectImp * mf_GetObjPropertyNames()
Bscript::BObjectImp * mf_GetCommandHelp()
bool consume_reagents(Mobile::Character *chr)
void play_sound_effect(const UObject *center, u16 effect)
Core::CharacterRef trading_with
Bscript::BObjectImp * mf_SendSellWindow()
void notify_entered(Mobile::Character &whoentered)
Module::UOExecutorModule * resurrect_uoemod
Bscript::BObjectImp * mf_PlayStationaryEffect()
void getstatics(Plib::StaticEntryList &statics, unsigned short x, unsigned short y) const
bool send_menu(Network::Client *client, Menu *menu)
unsigned int max_pathfind_range
UOExecutorModule(Core::UOExecutor &exec)
Bscript::BObjectImp * mf_ListHostiles()
void play_sound_effect_xyz(u16 cx, u16 cy, s8 cz, u16 effect, Realms::Realm *realm)
std::map< BObject, BObjectRef > Contents
Bscript::BObjectImp * mf_SetGlobalProperty()
virtual void double_click(Network::Client *client)
bool has_los(const Core::ULWObject &att, const Core::ULWObject &tgt) const
bool getDynamicMenuParam(unsigned param, Core::Menu *&menu)
char tileheight(unsigned short tilenum)
Bscript::BObjectImp * mf_ListItemsAtLocation()
static Bscript::BObjectImp * scripted_create(const Items::ItemDesc &descriptor, u16 x, u16 y, s8 z, Realms::Realm *realm, int flags)
Bscript::BObjectImp * mf_CloseWindow()
virtual void inform_engaged(Character *engaged)
const int SAVE_INCREMENTAL
void AddBlocker(short x, short y, short z)
Bscript::BObjectImp * mf_CreateNpcFromTemplate()
std::string read_string(const char *propname) const
Bscript::BObjectImp * mf_SendHousingTool()
Bscript::BObjectImp * mf_ListStaticsNearLocation()
Bscript::BObjectImp * mf_ListStaticsNearLocationOfType()
Bscript::BObjectImp * mf_Accessible()
Plib::AStarSearch< UOPathState > UOSearch
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)
Items::Item * attached_item_
bool has_only_default_cprops(const ItemDesc *compare=nullptr) const
Bscript::BObjectImp * mf_AssignRectToWeatherRegion()
Bscript::BObjectImp * mf_ListMobilesInLineOfSight()
Bscript::BObjectImp * mf_ListAccounts()
Bscript::BObjectImp * mf_FindPath()
virtual Bscript::BObjectImp * make_ref() POL_OVERRIDE
void replace_properties(Clib::ConfigElem &elem, BStruct *custom)
const int FINDSUBSTANCE_FIND_ALL
bool getItemParam(Executor &exec, unsigned param, Items::Item *&itemptr)
static BObjectImp * unpack(const char *pstr)
const int RESURRECT_FORCELOCATION
void add_at_random_location(Items::Item *item)
virtual UObject * toplevel_owner()
const std::string & scriptname() const
Bscript::BObjectImp * mf_PrivateTextAbove()
Bscript::BObjectImp * mf_RestartScript()
Bscript::BObjectImp * mf_CheckLineOfSight()
Core::AttributeFlags< PRIV_FLAGS > cached_settings
Core::UContainer * container
Bscript::BObjectImp * mf_GetRegionString()
gameclock_t read_gameclock()
Reads the current value of the game clock.
Bscript::BObjectImp * mf_Attach()
#define GET_ITEM_PTR(itr)
void signal_catch_thread()
Bscript::BObjectImp * mf_EnumerateOnlineCharacters()
unsigned char decode_xdigit(unsigned char ch)
void setname(const std::string &)
void send_remove_object_to_inrange(const UObject *centerObject)
Bscript::BObjectImp * mf_SetScriptController()
Bscript::BObjectImp * mf_SendStringAsTipWindow()
Core::UObject * popup_menu_selection_above
const int FP_IGNORE_MOBILES
const String * getStringParam(unsigned param)
void equip(Items::Item *item)
bool getStoredConfigFileParam(Bscript::ExecutorModule &exmod, unsigned param, Core::StoredConfigFile *&cfile)
Bscript::BObjectImp * mf_GetRegionNameAtLocation()
void cast(Mobile::Character *caster)
Bscript::BObjectImp * send_event_script(Bscript::BObjectImp *event)
Bscript::BObjectImp * mf_ListMultisInBox()
Bscript::BObjectImp * mf_UpdateItem()
void consume_sumof_objtype_noninuse(u32 objtype, unsigned int amount)
Bscript::BObjectImp * mf_CreateItemInBackpack()
bool cache_interactive_scripts
NoLosCheckedTargetCursor nolos_checked_script_cursor
void send_placemulti(Network::Client *client, unsigned int objtype, int flags, s16 xoffset, s16 yoffset, u32 hue)
void send_wornitem(Client *client, const Character *chr, const Item *item)
std::vector< USpell * > spells
SettingsManager settingsManager
Bscript::BObjectImp * mf_PlayObjectCenteredEffect_Ex()
static void InVisualRange(const UObject *obj, F &&f)
void SetRegionLightLevel(LightRegion *lightregion, int lightlevel)
Mobile::Character * popup_menu_selection_chr
Bscript::BObjectImp * mf_GetEquipmentByLayer()
Mobile::Character * system_find_mobile(u32 serial)
ElemRef findelem(int key)
Bscript::BObjectImp * mf_GetObjtypeByName()
void play_object_centered_effect(const UObject *center, u16 effect, u8 speed, u8 loop)
bool Insert(UObject *obj)
bool getObjtypeParam(Executor &exec, unsigned param, unsigned int &objtype)
Bscript::BObjectImp * mf_CreateMenu()
Bscript::BObjectImp * mf_GetObjProperty()
const unsigned LMBLEX_FLAG_NPC_ONLY
ref_ptr< Items::Item > ItemRef
bool MultiDefByMultiIDExists(u16 multiid)
virtual Bscript::BObjectImp * make_ref()=0
Mobile::Character * menu_selection_chr
Bscript::BObjectImp * mf_PlaySoundEffectXYZ()
Bscript::BObjectImp * mf_FindSubstance()
bool IsCharacter(u32 serial)
Core::JusticeRegion * justice_region
void readmultis(Plib::MapShapeList &vec, unsigned short x, unsigned short y, unsigned int flags) const
Bscript::BObjectImp * mf_GetFacing()
Bscript::BObjectImp * mf_PlayMovingEffect_Ex()
void addElement(BObjectImp *imp)
Items::Item * system_find_item(u32 serial)
Bscript::BObjectImp * mf_DistanceEuclidean()
Bscript::BObjectImp * mf_SpeakPowerWords()
void subtract_amount_from_item(Item *item, unsigned short amount)
const int ITEMS_IGNORE_MULTIS
Core::UContainer * backpack() const
std::set< Character * > CharacterSet
Bscript::BObjectImp * mf_SetName()
Bscript::BObjectImp * mf_ApplyConstraint()
Bscript::BObjectImp * mf_ListItemsNearLocation()
void play_sound_effect_private(const UObject *center, u16 effect, Character *forchr)
Bscript::BObjectImp * mf_CheckLosBetween()
bool getUObjectParam(Executor &exec, unsigned param, UObject *&objptr)
Module::UOExecutorModule * target_cursor_uoemod
void(* on_menu_selection)(Network::Client *client, Core::MenuItem *mi, Core::PKTIN_7D *msg)
#define PKTOUT_BA_ARROW_ON
const Contents & contents() const
Bscript::BObjectImp * mf_SendPopUpMenu()
Sends a PopUp/Context menu.
unsigned short pol_distance(unsigned short x1, unsigned short y1, unsigned short x2, unsigned short y2)
void send_container_contents(Network::Client *client, const UContainer &cont)
const String * getStringParam(unsigned param)
Mobile::Character * selcolor_chr
int save_incremental(unsigned int &dirty, unsigned int &clean, long long &elapsed_ms)
Bscript::BObjectImp * get_region_string(const char *resource, xcoord x, ycoord y, Realms::Realm *realm, const std::string &propname)
bool send_object_cursor(Network::Client *client, PKTBI_6C::CURSOR_TYPE crstype=PKTBI_6C::CURSOR_TYPE_NEUTRAL)
std::string get_use_script_name() const
bool getMultiParam(Executor &exec, unsigned param, Multi::UMulti *&multiptr)
Bscript::BObjectImp * mf_EquipFromTemplate()
Bscript::BObjectImp * mf_ReserveItem()
Bscript::BObjectImp * mf_ListMobilesInBox()
Bscript::BObjectImp * mf_HarvestResource()
bool place_item_in_secure_trade_container(Network::Client *client, Items::Item *item, u16 x, u16 y)
bool check_can_remove_script(Mobile::Character *chr, Items::Item *item, MoveType move=MT_PLAYER)
ObjectStorageManager objStorageManager
unsigned short width() const
Bscript::BObjectImp * mf_PrintTextAbove()
unsigned short remove_ushort(const char *propname)
Bscript::BObjectImp * mf_GrantPrivilege()
Realms::Realm * find_realm(const std::string &name)
Bscript::BObjectImp * mf_SendOpenSpecialContainer()
#define CONST_DEFAULT_ZRANGE
bool run_script_to_completion(const char *filename, Bscript::BObjectImp *parameter)
bool open_trade_window(Network::Client *client, Items::Item *item, Mobile::Character *dropon)
bool can_insert_increase_stack(Mobile::Character *mob, MoveType move, Items::Item *existing_item, unsigned short amt_to_add, Items::Item *adding_item)
bool hasParams(unsigned howmany) const
const CharacterSet & hostiles() const
MultiPlacementCursor multi_placement_cursor
bool isa(UOBJ_CLASS uobj_class) const
bool ignores_line_of_sight() const
void send_wornitem_to_inrange(const Character *chr, const Item *item)
Bscript::BObjectImp * mf_SendStatus()
bool check_equiptest_scripts(Mobile::Character *chr, bool startup=false)
bool getStaticOrDynamicMenuParam(unsigned param, Core::Menu *&menu)
bool getObjArrayParam(unsigned param, ObjArray *&pobjarr)
Items::Item * wornitem(int layer) const
bool lowest_walkheight(unsigned short x, unsigned short y, short oldz, short *newz, Multi::UMulti **pmulti, Items::Item **pwalkon, bool doors_block, Core::MOVEMODE movemode, short *gradual_boost=nullptr)
Bscript::BObjectImp * mf_MoveItemToContainer()
void sendCharProfile(Character *chr, Character *of_who, const char *title, const u16 *utext, const u16 *etext)
Bscript::BObjectImp * mf_ReleaseItem()
virtual Bscript::BObjectImp * make_ref() POL_OVERRIDE
Bscript::BObjectImp * mf_TargetCancel()
void UpdateCharacterOnDestroyItem(Item *item)
Items::Item * find_objtype(u32 objtype, int flags) const
Bscript::BObjectImp * mf_TargetMultiPlacement()
bool can_move(const Items::Item *item) const
Bscript::BObjectImp * mf_IsStackable()
Bscript::BObjectImp * mf_SecureTradeWin()
Bscript::BObjectImp * mf_ListStaticsAtLocation()
void send_char_data(Client *client, Character *chr)
const MultiDef & multidef() const
bool valid(unsigned short x, unsigned short y, short z) const
Bscript::BObjectImp * run_equip_script(Mobile::Character *chr, bool startup)
const ItemDesc & itemdesc() const
Bscript::BObjectImp * mf_SendSysMessage()
int write_data(unsigned int &dirty_writes, unsigned int &clean_writes, long long &elapsed_ms)
Bscript::BObjectImp * get_harvest_difficulty(const char *resource, xcoord x, ycoord y, Realms::Realm *realm, unsigned short marker)
void update_gameclock()
Saves the current value into the global cprop "gameclock".
Bscript::BObjectImp * mf_PlayMovingEffectXyz()
Bscript::BObjectImp * mf_PlayObjectCenteredEffect()
unsigned short item_color_mask
Bscript::BObjectImp * mf_StartSpellEffect()
Bscript::BObjectImp * mf_SendTextEntryGump()
std::string get_textcmd_help(Mobile::Character *chr, const char *cmd)
bool equippable(const Items::Item *item) const
bool inrangex(const Character *c1, const Character *c2, int maxdist)
const int TGTOPT_CHECK_LOS
Bscript::BObjectImp * mf_GetMultiDimensions()
std::vector< Core::ItemRef > reserved_items_
Multi::UMulti * find_supporting_multi(unsigned short x, unsigned short y, short z) const
virtual std::string name() const
void play_stationary_effect(u16 x, u16 y, s8 z, u16 effect, u8 speed, u8 loop, u8 explode, Realms::Realm *realm)
Plib::MAPTILE_CELL getmaptile(unsigned short x, unsigned short y) const
Module::UOExecutorModule * menu_selection_uoemod
void send_owncreate(Client *client, const Character *chr)
virtual void unregister_object(UObject *obj)
Mobile::Character * GetCharacterOwner()
#define START_PROFILECLOCK(timer)
void send_create_mobile_to_nearby_cansee(const Character *chr)
const int LH_FLAG_INCLUDE_HIDDEN
UserState * GetSolutionStart()
void play_moving_effect_ex(const UObject *src, const UObject *dst, u16 effect, u8 speed, u8 duration, u32 hue, u32 render, u8 direction, u8 explode, u16 effect3d, u16 effect3dexplode, u16 effect3dsound)
void remove_gumpmods(Module::UOExecutorModule *)
Removes all the registered gumpids for a given module.
Bscript::BObjectImp * mf_SendOverallSeason()
void cancel_trade(Mobile::Character *chr1)
bool say_above(const UObject *obj, const char *text, unsigned short font, unsigned short color, unsigned int journal_print)
void play_lightning_bolt_effect(const UObject *center)
const char * data() const
Bscript::BObjectImp * mf_CreateMultiAtLocation()
Bscript::BObjectImp * mf_GetRegionLightLevelAtLocation()
#define PKTOUT_BA_ARROW_OFF
Bscript::BObjectImp * mf_GetHarvestDifficulty()
void handle_coord_cursor(Character *chr, PKTBI_6C *msg)
virtual const char * typeOf() const
Bscript::BObjectImp * mf_PlayMovingEffect()
Bscript::BObjectImp * mf_TargetCoordinates()
Bscript::BObjectImp * mf_OpenPaperdoll()
Core::ScriptDef create_script
Bscript::BObjectImp * destroy_boat(UBoat *boat)
std::atomic< bool > exit_signalled
Bscript::BObjectImp * mf_SendInstaResDialog()
Bscript::BObjectImp * mf_Distance()
Bscript::BObjectImp * mf_PlayMovingEffectXyz_Ex()
bool can_access(const Items::Item *item, int range=-1) const
const MultiDef * MultiDefByMultiID(u16 multiid)
static const char * typestr(BObjectType typ)
Bscript::BObjectImp * mf_Target()
void send_sysmessage(Network::Client *client, const char *text, unsigned short font, unsigned short color)
Bscript::BObjectImp * mf_SendQuestArrow()
Bscript::BObjectImp * mf_CloseGump()
void send_skillmsg(Network::Client *client, const Mobile::Character *chr)
Bscript::BObjectImp * mf_EquipItem()
BObjectImp * getParamImp(unsigned param)
void update_item_to_inrange(const Item *item)
Module::OSExecutorModule * os_module
const unsigned LMBLEX_FLAG_PLAYERS_ONLY
Bscript::BObjectImp * mf_SendEvent()
Mobile::Character * textentry_chr
Bscript::BObjectImp * mf_GetMenuObjTypes()
void send_action_to_inrange(const Mobile::Character *obj, UACTION action, unsigned short framecount=0x05, unsigned short repeatcount=0x01, DIRECTION_FLAG_OLD backward=FORWARD, REPEAT_FLAG_OLD repeatflag=NOREPEAT, unsigned char delay=0x01)
bool can_insert_add_item(Mobile::Character *mob, MoveType move, Items::Item *new_item)
Bscript::BObjectImp * mf_CheckLosAt()
Bscript::BObjectImp * mf_ReadGameClock()
void send_tip(Network::Client *client, const std::string &tiptext)
bool VALID_SPELL_ID(int spellid)
static void InBox(u16 x1, u16 y1, u16 x2, u16 y2, const Realms::Realm *realm, F &&f)
#define INC_PROFILEVAR(counter)