Pol  Revision:cb584c9
textcmd.cpp
Go to the documentation of this file.
1 
13 #include "textcmd.h"
14 
15 #include <cstddef>
16 #include <ctype.h>
17 #include <iosfwd>
18 #include <stdio.h>
19 #include <stdlib.h>
20 #include <string.h>
21 #include <string>
22 #include <time.h>
23 
24 #include "../bscript/berror.h"
25 #include "../bscript/impstr.h"
26 #include "../clib/cfgelem.h"
27 #include "../clib/cfgfile.h"
28 #include "../clib/clib.h"
29 #include "../clib/clib_endian.h"
30 #include "../clib/esignal.h"
31 #include "../clib/fileutil.h"
32 #include "../clib/logfacility.h"
33 #include "../clib/opnew.h"
34 #include "../clib/rawtypes.h"
35 #include "../clib/refptr.h"
36 #include "../clib/spinlock.h"
37 #include "../clib/stlutil.h"
38 #include "../clib/strutil.h"
39 #include "../clib/threadhelp.h"
40 #include "../plib/pkg.h"
41 #include "../plib/systemstate.h"
42 #include "accounts/account.h"
43 #include "allocd.h"
44 #include "clidata.h"
45 #include "globals/network.h"
46 #include "globals/state.h"
47 #include "globals/uvars.h"
48 #include "item/item.h"
49 #include "item/itemdesc.h"
50 #include "mobile/charactr.h"
51 #include "module/osmod.h"
52 #include "module/uomod.h"
53 #include "network/client.h"
54 #include "pktboth.h"
55 #include "polclock.h"
56 #include "repsys.h"
57 #include "scrdef.h"
58 #include "scrsched.h"
59 #include "scrstore.h"
60 #include "tmpvars.h"
61 #include "uconst.h"
62 #include "ufunc.h"
63 #include "ufuncstd.h"
64 #include "unicode.h"
65 #include "uoexec.h"
66 #include "uoscrobj.h"
67 #include "utype.h"
68 #include "uworld.h"
69 
70 namespace Pol
71 {
72 namespace Core
73 {
74 bool wordicmp::operator()( const std::string& lhs, const std::string& rhs ) const
75 {
76  size_t len = std::min( lhs.size(), rhs.size() );
77 
78  return ( strnicmp( lhs.c_str(), rhs.c_str(), len ) < 0 );
79 }
80 
81 
82 void register_command( const char* cmd, TextCmdFunc f )
83 {
84  gamestate.textcmds.insert( TextCmds::value_type( cmd, f ) );
85 }
86 void register_command( const char* cmd, ParamTextCmdFunc f )
87 {
88  gamestate.paramtextcmds.insert( ParamTextCmds::value_type( cmd, f ) );
89 }
90 
91 bool FindEquipTemplate( const char* template_name, Clib::ConfigElem& elem )
92 {
93  try
94  {
95  Clib::ConfigFile cf( "config/equip.cfg" );
96  while ( cf.read( elem ) )
97  {
98  if ( !elem.type_is( "Equipment" ) )
99  continue;
100  const char* rest = elem.rest();
101  if ( rest == nullptr || *rest == '\0' )
102  continue;
103  if ( stricmp( rest, template_name ) == 0 )
104  return true;
105  }
106  return false;
107  }
108  catch ( ... )
109  {
110  return false;
111  }
112 }
113 
114 Bscript::BObjectImp* equip_from_template( Mobile::Character* chr, const char* template_name )
115 {
116  Clib::ConfigElem elem;
117  if ( !FindEquipTemplate( template_name, elem ) )
118  {
119  return new Bscript::BError( "Equipment template not found" );
120  }
121 
122  std::string tmp;
123  while ( elem.remove_prop( "Equip", &tmp ) || elem.remove_prop( "Weapon", &tmp ) ||
124  elem.remove_prop( "Armor", &tmp ) )
125  {
126  ISTRINGSTREAM is( tmp );
127  std::string objtype_str;
128  if ( is >> objtype_str )
129  {
130  unsigned int objtype;
131  const char* ot_str = objtype_str.c_str();
132  if ( isdigit( *ot_str ) )
133  {
134  objtype = static_cast<u32>( strtoul( ot_str, nullptr, 0 ) );
135  }
136  else
137  {
138  objtype = Items::get_objtype_byname( ot_str );
139  if ( !objtype )
140  {
141  ERROR_PRINT << "Blech! Can't find '" << ot_str << "' named in equip.cfg\n";
142  continue;
143  }
144  }
145  std::string color_str;
146  unsigned short color = 0;
147  if ( is >> color_str )
148  {
149  color = static_cast<unsigned short>( strtoul( color_str.c_str(), nullptr, 0 ) );
150  }
151  Items::Item* it = Items::Item::create( objtype );
152  if ( it != nullptr )
153  {
154  color &= VALID_ITEM_COLOR_MASK;
155  it->color = color;
156  it->layer = tilelayer( it->graphic );
157  it->realm = chr->realm;
158  // FIXME equip scripts, equiptest scripts
159  if ( chr->equippable( it ) )
160  {
161  chr->equip( it );
163  }
164  else
165  {
166  it->destroy();
167  }
168  }
169  }
170  }
171  return new Bscript::BLong( 1 );
172 }
173 
174 // FIXME should do a command handler table like for messages received.
176 
178 {
179  if ( client->ready && client->chr && client->chr != chr && inrange( client->chr, chr ) )
180  {
181  send_move( client, chr );
182  }
183 }
184 
185 void textcmd_flag1( Network::Client* client, const char* text )
186 {
187  tmp_flag1 = (u8)strtoul( text, nullptr, 16 );
189  client->chr,
190  [&]( Mobile::Character* zonechr ) { send_move_if_inrange2( zonechr, client ); } );
191 }
192 
193 void textcmd_flag2( Network::Client* client, const char* text )
194 {
195  tmp_flag2 = (u8)strtoul( text, nullptr, 16 );
197  client->chr,
198  [&]( Mobile::Character* zonechr ) { send_move_if_inrange2( zonechr, client ); } );
199 }
200 
202 {
204  client->chr,
205  [&]( Mobile::Character* zonechr ) { send_client_char_data( zonechr, client ); } );
206 }
207 
209 {
211 }
212 
214 {
215  if ( chr->client != nullptr )
216  {
217  char s[80];
218  sprintf( s, "Serial: 0x%8.08lX, %ld, ObjType 0x%4.04X",
219  static_cast<unsigned long>( cfBEu32( msgin->selected_serial ) ),
220  static_cast<signed long>( cfBEu32( msgin->selected_serial ) ),
221  cfBEu16( msgin->graphic ) );
222  send_sysmessage( chr->client, s );
223  }
224 }
225 
227 {
228  send_sysmessage( client, "Select something to identify." );
230 }
231 
233 {
234  client->chr->showarmor();
235 }
236 
237 
238 std::string timeoutstr( polclock_t at )
239 {
240  polclock_t ticks = at - polclock();
241  int seconds = ticks / POLCLOCKS_PER_SEC;
242  return Clib::decint( seconds ) + " seconds";
243 }
244 
258 {
259  if ( mob->is_murderer() )
260  {
261  send_sysmessage( client, "Mobile is a murderer." );
262  }
263  else if ( mob->is_criminal() )
264  {
265  send_sysmessage( client, "Mobile is criminal for " + timeoutstr( mob->criminal_until_ ) + " [" +
266  Clib::decint( mob->criminal_until_ ) + "]" );
267  }
268 
269  for ( Mobile::Character::MobileCont::const_iterator itr = mob->aggressor_to_.begin();
270  itr != mob->aggressor_to_.end(); ++itr )
271  {
272  send_sysmessage( client, "Aggressor to " + ( *itr ).first->name() + " for " +
273  timeoutstr( ( *itr ).second ) + " [" +
274  Clib::decint( ( *itr ).second ) + "]" );
275  }
276 
277  for ( Mobile::Character::MobileCont::const_iterator itr = mob->lawfully_damaged_.begin();
278  itr != mob->lawfully_damaged_.end(); ++itr )
279  {
280  send_sysmessage( client, "Lawfully Damaged " + ( *itr ).first->name() + " for " +
281  timeoutstr( ( *itr ).second ) + " [" +
282  Clib::decint( ( *itr ).second ) + "]" );
283  }
284 
285  for ( Mobile::Character::ToBeReportableList::const_iterator itr = mob->to_be_reportable_.begin();
286  itr != mob->to_be_reportable_.end(); ++itr )
287  {
288  USERIAL serial = ( *itr );
289  send_sysmessage( client, "ToBeReportable: " + Clib::hexint( serial ) );
290  }
291 
292  for ( Mobile::Character::ReportableList::const_iterator itr = mob->reportable_.begin();
293  itr != mob->reportable_.end(); ++itr )
294  {
295  const Mobile::reportable_t& rt = ( *itr );
297  client, "Reportable: " + Clib::hexint( rt.serial ) + " at " + Clib::decint( rt.polclock ) );
298  }
299 
300  if ( mob->repsys_task_ != nullptr )
301  send_sysmessage( client, "Repsys task is active, runs in " +
302  timeoutstr( mob->repsys_task_->next_run_clock() ) + " [" +
303  Clib::decint( mob->repsys_task_->next_run_clock() ) + "]" );
304 }
305 
307 {
308  RepSystem::show_repdata( looker->client, mob );
309 }
310 
311 
313 {
314  send_sysmessage( client, "Please target a mobile to display repdata for." );
316 }
317 
319 {
320  if ( mob->connected() ) // gotta be connected to get packets right?
321  {
322  Clib::SpinLockGuard guard( mob->client->_fpLog_lock );
323  if ( mob->client->fpLog.empty() )
324  {
325  std::string filename = "log/";
326  filename += mob->client->acct->name();
327  filename += ".log";
328  mob->client->fpLog = OPEN_FLEXLOG( filename, true );
329  if ( !mob->client->fpLog.empty() )
330  {
331  send_sysmessage( looker->client, "I/O log file opened for " + mob->name() );
332  }
333  else
334  {
335  send_sysmessage( looker->client, "Unable to open I/O log file for " + mob->name() );
336  }
337  }
338  }
339 }
340 
342 {
343  if ( client->chr->can_plogany() )
344  {
345  send_sysmessage( client, "Please target a player to start packet logging for." );
347  }
348  else
349  {
350  Clib::SpinLockGuard guard( client->_fpLog_lock );
351  if ( client->fpLog.empty() )
352  {
353  std::string filename = "log/";
354  filename += client->acct->name();
355  filename += ".log";
356  client->fpLog = OPEN_FLEXLOG( filename, true );
357  if ( !client->fpLog.empty() )
358  {
359  send_sysmessage( client, "I/O log file opened." );
360  }
361  else
362  {
363  send_sysmessage( client, "Unable to open I/O log file." );
364  }
365  }
366  }
367 }
368 
370 {
371  if ( mob->connected() ) // gotta be connected to already have packets right?
372  {
373  Clib::SpinLockGuard guard( mob->client->_fpLog_lock );
374  if ( !mob->client->fpLog.empty() )
375  {
376  auto time_tm = Clib::localtime( time( nullptr ) );
377  FLEXLOG( mob->client->fpLog ) << "Log closed at %s" << asctime( &time_tm ) << "\n";
378  CLOSE_FLEXLOG( mob->client->fpLog );
379  mob->client->fpLog.clear();
380  send_sysmessage( looker->client, "I/O log file closed for " + mob->name() );
381  }
382  else
383  {
384  send_sysmessage( looker->client, "Packet Logging not enabled for " + mob->name() );
385  }
386  }
387 }
388 
390 {
391  if ( client->chr->can_plogany() )
392  {
393  send_sysmessage( client, "Please target a player to stop packet logging for." );
395  }
396  else
397  {
398  Clib::SpinLockGuard guard( client->_fpLog_lock );
399  if ( !client->fpLog.empty() )
400  {
401  auto time_tm = Clib::localtime( time( nullptr ) );
402  FLEXLOG( client->fpLog ) << "Log closed at %s" << asctime( &time_tm ) << "\n";
403  CLOSE_FLEXLOG( client->fpLog );
404  client->fpLog.clear();
405  send_sysmessage( client, "I/O log file closed." );
406  }
407  else
408  {
409  send_sysmessage( client, "Packet Logging not enabled." );
410  }
411  }
412 }
413 
415 {
416  OSTRINGSTREAM os;
417  os << "Unreaped orphans: " << stateManager.uobjcount.unreaped_orphans;
418 
419  send_sysmessage( client, OSTRINGSTREAM_STR( os ) );
420 
421  OSTRINGSTREAM os2;
422  os2 << "EChrRef count: " << stateManager.uobjcount.uobj_count_echrref;
423  send_sysmessage( client, OSTRINGSTREAM_STR( os2 ) );
424 }
425 
426 void list_scripts();
428 {
429  list_scripts();
430 }
431 void list_crit_scripts();
433 {
435 }
437 {
438  send_sysmessage( client, "Process Information:" );
439 
441  client, "Running: " + Clib::decint( (unsigned int)( scriptScheduler.getRunlist().size() ) ) );
443  client,
444  "Blocked: " + Clib::decint( (unsigned int)( scriptScheduler.getHoldlist().size() ) ) );
445 }
446 
448 {
450  send_sysmessage( client, "Script profile written to logfile" );
451 }
452 
454 {
456  send_sysmessage( client, "Script profile written to logfile and cleared" );
457 }
458 
460 {
463 }
464 
466 {
467  std::string s = "Child threads: " + Clib::decint( threadhelp::child_threads );
468  send_sysmessage( client, s );
469 }
470 
472 {
473  int i = 0;
474  send_sysmessage( client, "Connection statuses:" );
475  for ( Clients::const_iterator itr = networkManager.clients.begin(),
476  end = networkManager.clients.end();
477  itr != end; ++itr )
478  {
479  OSTRINGSTREAM os;
480  os << i << ": " << ( *itr )->status() << " ";
481  send_sysmessage( client, OSTRINGSTREAM_STR( os ) );
482  ++i;
483  }
484 }
485 
486 
489 {
490  unsigned short wx, wy;
491  zone_convert( client->chr->x, client->chr->y, &wx, &wy, client->chr->realm );
492  bool ok = check_single_zone_item_integrity( wx, wy, client->chr->realm );
493  if ( ok )
494  send_sysmessage( client, "Item integrity checks out OK!" );
495  else
496  send_sysmessage( client, "Item integrity problems detected. " );
497 }
498 
499 bool check_item_integrity();
501 {
502  bool ok = check_item_integrity();
503  if ( ok )
504  send_sysmessage( client, "Item integrity checks out OK!" );
505  else
506  send_sysmessage( client, "Item integrity problems detected. Check logfile" );
507 }
510 {
512 }
513 
514 std::string get_textcmd_help( Mobile::Character* chr, const char* cmd )
515 {
516  const char* t = cmd;
517  while ( *t )
518  {
519  if ( !isalpha( *t ) && ( *t != '_' ) )
520  {
521  // cout << "illegal command char: as int = " << int(*t) << ", as char = " << *t << endl;
522  return "";
523  }
524  ++t;
525  }
526 
527  std::string upp( cmd );
528  Clib::mkupper( upp );
529  if ( upp == "AUX" || upp == "CON" || upp == "PRN" || upp == "NUL" )
530  return "";
531 
532  for ( int i = chr->cmdlevel(); i >= 0; --i )
533  {
534  CmdLevel& cmdlevel = gamestate.cmdlevels[i];
535  for ( unsigned diridx = 0; diridx < cmdlevel.searchlist.size(); ++diridx )
536  {
537  std::string filename;
538 
539  Plib::Package* pkg = cmdlevel.searchlist[diridx].pkg;
540  filename = cmdlevel.searchlist[diridx].dir + cmd + std::string( ".txt" );
541  if ( pkg )
542  filename = pkg->dir() + filename;
543 
544  // cout << "Searching for " << filename << endl;
545  if ( Clib::FileExists( filename.c_str() ) )
546  {
547  // cout << "Found " << filename << endl;
548  std::string result;
549  std::ifstream ifs( filename.c_str(), std::ios::binary );
550  char temp[64];
551  do
552  {
553  ifs.read( temp, sizeof temp );
554  if ( ifs.gcount() )
555  result.append( temp, static_cast<size_t>( ifs.gcount() ) );
556  } while ( !ifs.eof() );
557  return result;
558  }
559  }
560  }
561  return "";
562 }
563 
564 bool start_textcmd_script( Network::Client* client, const char* text, const u16* wtext = nullptr,
565  const char* lang = nullptr )
566 {
567  std::string scriptname;
568  std::string params;
569  const char* t = strchr( text, ' ' );
570  if ( t != nullptr )
571  {
572  scriptname = std::string( text, t );
573  params = t + 1;
574  }
575  else
576  {
577  scriptname = text;
578  params = "";
579  }
580 
581  // cout << "scriptname='" << scriptname << "', params='" << params << "'" << endl;
582 
583  t = scriptname.c_str();
584  while ( *t )
585  {
586  if ( !isalnum( *t ) && ( *t != '_' ) )
587  {
588  // cout << "illegal command char: as int = " << int(*t) << ", as char = " << *t << endl;
589  return false;
590  }
591  ++t;
592  }
593 
594  std::string upp( scriptname );
595  Clib::mkupper( upp );
596  if ( upp == "AUX" || upp == "CON" || upp == "PRN" || upp == "NUL" )
597  return false;
598 
599  for ( int i = client->chr->cmdlevel(); i >= 0; --i )
600  {
601  // cout << "checking cmdlevel " << i << endl;
602  CmdLevel& cmdlevel = gamestate.cmdlevels[i];
603  for ( unsigned diridx = 0; diridx < cmdlevel.searchlist.size(); ++diridx )
604  {
605  ScriptDef sd;
606  Plib::Package* pkg = cmdlevel.searchlist[diridx].pkg;
607  if ( pkg )
608  sd.quickconfig( pkg, cmdlevel.searchlist[diridx].dir + scriptname + ".ecl" );
609  else
610  sd.quickconfig( cmdlevel.searchlist[diridx].dir + scriptname + ".ecl" );
611  if ( !sd.exists() )
612  continue;
613 
614  // cout << "Searching for " << sd.name() << endl;
616  find_script2( sd,
617  false, // don't complain if not found
618  Plib::systemstate.config.cache_interactive_scripts );
619  if ( prog.get() != nullptr )
620  {
621  // Unicode stuff
622 
623  std::unique_ptr<UOExecutor> ex( create_script_executor() );
624  if ( prog->haveProgram )
625  {
626  if ( wtext && lang )
627  {
628  Bscript::ObjArray* arr;
629  size_t woffset;
630  bool UCconv = false;
631  // calc offset to either the null after the
632  // scriptname (+1) or the start of the param (+2)
633  woffset = static_cast<size_t>( scriptname.length() + ( params == "" ? 1 : 2 ) );
634  unsigned wtlen = 0; // wcslen(static_cast<const wchar_t*>(wtext+woffset))
635 
636  // Need to calc length with a loop (coz linux is a PITA with 4-byte unicode!)
637  while ( *( wtext + woffset + wtlen ) )
638  ++wtlen;
639  UCconv = Core::convertUCtoArray( wtext + woffset, arr, wtlen,
640  true ); // convert back with ctBEu16()
641  if ( UCconv )
642  {
643  ex->pushArg( new Bscript::String( lang ) );
644  ex->pushArg( arr );
645  }
646  else
647  ex->pushArg( new Bscript::BError( "Invalid Unicode speech received." ) );
648  }
649  ex->pushArg( new Bscript::String( params ) );
650  ex->pushArg( new Module::ECharacterRefObjImp( client->chr ) );
651  }
652 
654  ex->addModule( uoemod );
655  ex->os_module->priority = 100;
656 
657  if ( ex->setProgram( prog.get() ) )
658  {
659  uoemod->controller_.set( client->chr ); // DAVE added 12/04, let character issuing
660  // textcmd be the script controller
661  schedule_executor( ex.release() );
662  return true;
663  }
664  else
665  {
666  ERROR_PRINT << "script " << scriptname << ": setProgram failed\n";
667  // TODO: it seems to keep looking until it finds one it can use..guess this is okay?
668  }
669  }
670  }
671  }
672  return false;
673 }
674 
675 bool process_command( Network::Client* client, const char* text, const u16* wtext /*nullptr*/,
676  const char* lang /*nullptr*/ )
677 {
678  static int init;
679  if ( !init )
680  {
681  init = 1;
683  register_command( "constat", textcmd_constat );
684  register_command( "heapcheck", &textcmd_heapcheck );
685  register_command( "i_repdata", textcmd_repdata );
686  register_command( "t_ident", textcmd_ident );
687  register_command( "integ_item", textcmd_integ_item );
688  register_command( "integ_chr", textcmd_integ_chr );
689  register_command( "i_s_item_integ", textcmd_singlezone_integ_item ); // davedebug
691  register_command( "list_scripts", &textcmd_list_scripts );
692  register_command( "log_profile", &textcmd_log_profile );
693  register_command( "log_profile_clear", &textcmd_log_profile_clear );
694  register_command( "orphans", &textcmd_orphans );
695  register_command( "procs", &textcmd_procs );
696  register_command( "resendchars", &textcmd_resendchars );
697  register_command( "shutdown", &textcmd_shutdown );
698  register_command( "startlog", &textcmd_startlog );
699  register_command( "stoplog", &textcmd_stoplog );
700  register_command( "threads", &textcmd_threads );
701  register_command( "flag1 ", &textcmd_flag1 );
702  register_command( "flag2 ", &textcmd_flag2 );
703  }
704 
705  ++text; // skip the "/" or "."
706 
707  if ( start_textcmd_script( client, text, wtext, lang ) )
708  return true;
709 
710  // cout << "checking for builtin commands" << endl;
711  if ( client->chr->cmdlevel() >= gamestate.cmdlevels.size() - 2 )
712  {
713  TextCmds::iterator itr2 = gamestate.textcmds.find( text );
714  if ( itr2 != gamestate.textcmds.end() )
715  {
716  TextCmdFunc f = ( *itr2 ).second;
717  ( *f )( client );
718  return true;
719  }
720 
721  ParamTextCmds::iterator itr1 = gamestate.paramtextcmds.find( text );
722  if ( itr1 != gamestate.paramtextcmds.end() )
723  {
724  ParamTextCmdFunc f = ( *itr1 ).second;
725  ( *f )( client, text + ( *itr1 ).first.size() );
726  return true;
727  }
728  }
729 
730  return false;
731 }
732 }
733 }
unsigned char u8
Definition: rawtypes.h:25
ToBeReportableList to_be_reportable_
Definition: charactr.h:847
static Item * create(u32 objtype, u32 serial=0)
Definition: itemcr.cpp:53
bool check_single_zone_item_integrity(int, int, Realms::Realm *)
Definition: uworld.cpp:301
void textcmd_list_scripts(Network::Client *)
Definition: textcmd.cpp:427
ref_ptr< Bscript::EScriptProgram > find_script2(const ScriptDef &script, bool complain_if_not_found, bool cache_script)
Definition: scrstore.cpp:83
void quickconfig(const Plib::Package *pkg, const std::string &name_ecl)
Definition: scrdef.cpp:112
unsigned int get_objtype_byname(const char *str)
Definition: itemdesc.cpp:58
bool is_criminal() const
A Mobile is Criminal if: he has an active Criminal Timer, which has not timed out. OR he is a murderer.
Definition: repsys.cpp:749
static void show_repdata(Network::Client *client, Mobile::Character *mob)
Internal Command: .i_repdata Show Reputation System Data for a Targetted Mobile Displays: Murderer st...
Definition: textcmd.cpp:257
bool process_command(Network::Client *client, const char *text, const u16 *wtext, const char *lang)
Definition: textcmd.cpp:675
void textcmd_stoplog(Network::Client *client)
Definition: textcmd.cpp:389
void start_packetlog(Mobile::Character *looker, Mobile::Character *mob)
Definition: textcmd.cpp:318
FullMsgTargetCursor ident_cursor
Definition: target.h:231
bool is_murderer() const
Definition: repsys.cpp:776
void send_move_if_inrange2(Mobile::Character *chr, Network::Client *client)
Definition: textcmd.cpp:177
void check_character_integrity()
Definition: uworld.cpp:348
void stop_packetlog(Mobile::Character *looker, Mobile::Character *mob)
Definition: textcmd.cpp:369
void textcmd_shutdown(Network::Client *)
Definition: textcmd.cpp:208
SystemState systemstate
Definition: systemstate.cpp:12
void PrintAllocationData()
Definition: allocd.cpp:26
void textcmd_singlezone_integ_item(Network::Client *client)
Definition: textcmd.cpp:488
Network::Client * client
Definition: charactr.h:871
polclock_t polclock()
Definition: polclock.cpp:72
void textcmd_log_profile(Network::Client *client)
Definition: textcmd.cpp:447
std::string fpLog
Definition: client.h:222
Cursors target_cursors
Definition: uvars.h:234
Accounts::Account * acct
Definition: client.h:181
void log_all_script_cycle_counts(bool clear_counters)
Definition: scrstore.cpp:157
MobileCont lawfully_damaged_
Definition: charactr.h:844
unsigned char tilelayer(unsigned short tilenum)
Definition: polfile2.cpp:22
void textcmd_listarmor(Network::Client *client)
Definition: textcmd.cpp:232
const HoldList & getHoldlist()
void mkupper(std::string &str)
Definition: strutil.cpp:271
char * binary(unsigned int val, int nbits)
Core::polclock_t polclock
Definition: charactr.h:276
#define cfBEu32(x)
Definition: clib_endian.h:43
T * get() const
Definition: refptr.h:176
std::tm localtime(const std::time_t &t)
threadsafe version of localtime
Definition: clib.h:143
std::string decint(unsigned short v)
Definition: strutil.cpp:64
void show_repdata(Mobile::Character *looker, Mobile::Character *mob)
Definition: textcmd.cpp:306
bool FindEquipTemplate(const char *template_name, Clib::ConfigElem &elem)
Definition: textcmd.cpp:91
const unsigned VALID_ITEM_COLOR_MASK
Definition: uconst.h:76
u8 tmp_flag2
Definition: tmpvars.cpp:16
bool inrange(const UObject *c1, unsigned short x, unsigned short y)
Definition: ufunc.cpp:454
void(* TextCmdFunc)(Network::Client *)
Definition: uvars.h:120
void list_scripts(const char *desc, const ExecList &ls)
Definition: scrsched.cpp:735
unsigned char cmdlevel() const
Definition: charactr.h:993
void textcmd_procs(Network::Client *client)
Definition: textcmd.cpp:436
TextCmds textcmds
Definition: uvars.h:236
#define OSTRINGSTREAM_STR(x)
Definition: stlutil.h:76
bool connected() const
Definition: charactr.cpp:438
u32 USERIAL
Definition: utype.h:21
void handle_ident_cursor(Mobile::Character *chr, PKTBI_6C *msgin)
Definition: textcmd.cpp:213
Core::CharacterRef controller_
Definition: uomod.h:314
CmdLevels cmdlevels
Definition: uvars.h:137
const ExecList & getRunlist()
bool operator()(const std::string &lhs, const std::string &rhs) const
Definition: textcmd.cpp:74
void textcmd_integ_item(Network::Client *client)
Definition: textcmd.cpp:500
Mobile::Character * chr
Definition: client.h:182
void PrintHeapData()
Definition: opnew.cpp:440
#define FLEXLOG(id)
Definition: logfacility.h:245
std::string timeoutstr(polclock_t at)
Definition: textcmd.cpp:238
std::string hexint(unsigned short v)
Definition: strutil.cpp:23
MobileCont aggressor_to_
Definition: charactr.h:843
unsigned short u16
Definition: rawtypes.h:26
const char * rest() const
Definition: cfgfile.cpp:71
unsigned int u32
Definition: rawtypes.h:27
void textcmd_flag2(Network::Client *client, const char *text)
Definition: textcmd.cpp:193
Bscript::BObjectImp * equip_from_template(Mobile::Character *chr, const char *template_name)
Definition: textcmd.cpp:114
bool exists() const
Definition: scrdef.cpp:126
void send_move(Client *client, const Character *chr)
Definition: ufunc.cpp:174
void textcmd_constat(Network::Client *client)
Definition: textcmd.cpp:471
virtual void destroy()
Definition: uobject.cpp:122
void(* ParamTextCmdFunc)(Network::Client *, const char *)
Definition: uvars.h:122
UOExecutor * create_script_executor()
Definition: scrsched.cpp:644
polclock_t next_run_clock() const
Definition: schedule.h:66
NetworkManager networkManager
Definition: network.cpp:28
Core::OneShotTask * repsys_task_
Definition: charactr.h:846
const char * name() const
Definition: account.cpp:193
#define OSTRINGSTREAM
Definition: stlutil.h:75
#define OPEN_FLEXLOG(filename, open_timestamp)
Definition: logfacility.h:248
void textcmd_flag1(Network::Client *client, const char *text)
Definition: textcmd.cpp:185
ParamTextCmds paramtextcmds
Definition: uvars.h:237
void register_command(const char *cmd, TextCmdFunc f)
Definition: textcmd.cpp:82
#define cfBEu16(x)
Definition: clib_endian.h:44
NoLosCharacterCursor repdata_cursor
Definition: target.h:235
int polclock_t
Definition: polclock.h:26
void textcmd_threads(Network::Client *client)
Definition: textcmd.cpp:465
bool convertUCtoArray(const u16 *in_wtext, Bscript::ObjArray *&out_text, size_t textlen, bool ConvFromBE)
Definition: unicode.cpp:46
void textcmd_heapcheck(Network::Client *)
Definition: textcmd.cpp:459
ReportableList reportable_
Definition: charactr.h:848
u8 tmp_flag1
Definition: tmpvars.cpp:15
GameState gamestate
Definition: uvars.cpp:74
void textcmd_startlog(Network::Client *client)
Definition: textcmd.cpp:341
void equip(Items::Item *item)
Definition: charactr.cpp:1433
static void InVisualRange(const UObject *obj, F &&f)
Definition: uworld.h:245
StateManager stateManager
Definition: state.cpp:8
void zone_convert(unsigned short x, unsigned short y, unsigned short *wx, unsigned short *wy, const Realms::Realm *realm)
Definition: uworld.h:76
std::atomic< unsigned int > child_threads
ScriptScheduler scriptScheduler
NoLosCharacterCursor stoplog_cursor
Definition: target.h:237
bool start_textcmd_script(Network::Client *client, const char *text, const u16 *wtext=nullptr, const char *lang=nullptr)
Definition: textcmd.cpp:564
bool remove_prop(const char *propname, std::string *value)
Definition: cfgfile.cpp:128
NoLosCharacterCursor startlog_cursor
Definition: target.h:236
Core::polclock_t criminal_until_
Definition: charactr.h:845
#define ISTRINGSTREAM
Definition: stlutil.h:73
bool type_is(const char *name) const
Definition: cfgfile.cpp:95
Realms::Realm * realm
Definition: baseobject.h:56
void textcmd_repdata(Network::Client *client)
Definition: textcmd.cpp:312
bool send_object_cursor(Network::Client *client, PKTBI_6C::CURSOR_TYPE crstype=PKTBI_6C::CURSOR_TYPE_NEUTRAL)
Definition: target.cpp:133
void showarmor() const
Definition: charactr.cpp:2605
void textcmd_log_profile_clear(Network::Client *client)
Definition: textcmd.cpp:453
void textcmd_orphans(Network::Client *client)
Definition: textcmd.cpp:414
#define ERROR_PRINT
Definition: logfacility.h:230
void list_crit_scripts(const char *desc, const ExecList &ls)
Definition: scrsched.cpp:756
void schedule_executor(UOExecutor *ex)
Definition: scrsched.cpp:662
void send_client_char_data(Mobile::Character *chr, Network::Client *client)
Definition: ufunc.cpp:803
bool FileExists(const char *filename)
Definition: fileutil.cpp:118
void textcmd_ident(Network::Client *client)
Definition: textcmd.cpp:226
bool read(ConfigElem &elem)
Definition: cfgfile.cpp:1015
void textcmd_integ_chr(Network::Client *)
Definition: textcmd.cpp:509
std::string get_textcmd_help(Mobile::Character *chr, const char *cmd)
Definition: textcmd.cpp:514
bool equippable(const Items::Item *item) const
Definition: charactr.cpp:1356
virtual std::string name() const
Definition: uobject.cpp:196
void textcmd_list_crit_scripts(Network::Client *)
Definition: textcmd.cpp:432
SearchList searchlist
Definition: cmdlevel.h:48
std::lock_guard< SpinLock > SpinLockGuard
Definition: spinlock.h:33
Clib::SpinLock _fpLog_lock
Definition: client.h:221
Definition: berror.cpp:12
const polclock_t POLCLOCKS_PER_SEC
Definition: polclock.h:29
std::atomic< bool > exit_signalled
bool check_item_integrity()
Definition: uworld.cpp:328
void textcmd_resendchars(Network::Client *client)
Definition: textcmd.cpp:201
void send_sysmessage(Network::Client *client, const char *text, unsigned short font, unsigned short color)
Definition: ufunc.cpp:1147
void update_item_to_inrange(const Item *item)
Definition: ufunc.cpp:737
const std::string & dir() const
Definition: pkg.h:79
#define CLOSE_FLEXLOG(id)
Definition: logfacility.h:251
bool can_plogany() const
Definition: charactr.cpp:1261
UObjCount uobjcount
Definition: state.h:49