// Global Variables #include "uox3.h" unsigned short int doorbase[DOORTYPES]={ 0x0675, 0x0685, 0x0695, 0x06A5, 0x06B5, 0x06C5, 0x06D5, 0x06E5, 0x0839, 0x084C, 0x0866, 0x00E8, 0x0314, 0x0324, 0x0334, 0x0344, 0x0354}; char skillname[52][20]={ "ALCHEMY", "ANATOMY", "ANIMALLORE", "ITEMID", "ARMSLORE", "PARRYING", "BEGGING", "BLACKSMITHING", "BOWCRAFT", "PEACEMAKING", "CAMPING", "CARPENTRY", "CARTOGRAPHY", "COOKING", "DETECTINGHIDDEN", "ENTICEMENT", "EVALUATINGINTEL", "HEALING", "FISHING", "FORENSICS", "HERDING", "HIDING", "PROVOCATION", "INSCRIPTION", "LOCKPICKING", "MAGERY", "MAGICRESISTANCE", "TACTICS", "SNOOPING", "MUSICIANSHIP", "POISONING", "ARCHERY", "SPIRITSPEAK", "STEALING", "TAILORING", "TAMING", "TASTEID", "TINKERING", "TRACKING", "VETERINARY", "SWORDSMANSHIP", "MACEFIGHTING", "FENCING", "WRESTLING", "LUMBERJACKING", "MINING", "ALLSKILLS", "STR", "DEX", "INT", "FAME", "KARMA" }; char spellname[71][25]={ "Clumsy","Create Food","Feeblemind","Heal","Magic Arrow","Night Sight","Reactive Armor","Weaken", "Agility","Cunning","Cure","Harm","Magic Trap","Magic Untrap","Protection","Strength", "Bless","Fireball","Magic Lock","Poison","Telekinesis","Teleport","Unlock","Wall Of Stone", "Arch Cure","Arch Protection","Curse","Fire Field","Greater Heal","Lightning","Mana Drain","Recall", "Blade Spirits","Dispel Field","Incognito","Magic Reflection","Mind Blast","Paralyze","Poison Field","Summon Creature", "Dispel","Energy Bolt","Explosion","Invisibility","Mark","Mass Curse","Paralyze Field","Reveal", "Chain Lightning","Energy Field","Flame Strike","Gate Travel","Mana Vampire","Mass Dispel","Meteor Swarm","Polymorph", "Earthquake","Energy Vortex","Resurrection","Summon Air Elemental", "Summon Daemon","Summon Earth Elemental","Summon Fire Elemental","Summon Water Elemental", "Random", "Necro1", "Necro2", "Necro3", "Necro4", "Necro5" }; char login04a[6]="\xA9\x09\x24\x02"; char login04b[61]="\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; char login04c[18]="\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; char login04d[64]="\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; char login03[12]="\x8C\x00\x00\x00\x00\x13\x88\x7B\x7B\x7B\x01"; char noaccount[3]="\x82\x00"; char nopass[3]="\x82\x03"; char acctblock[3]="\x82\x02"; char xpause[3]="\x33\x01"; char restart[3]="\x33\x00"; char goxyz[20]="\x20\x00\x05\xA8\x90\x01\x90\x00\x83\xFF\x00\x06\x08\x06\x49\x00\x00\x02\x00"; char wearitem[16]="\x2E\x40\x0A\x00\x01\x00\x00\x00\x01\x00\x05\xA8\x90\x00\x00"; char talk[15]="\x1C\x00\x00\x01\x02\x03\x04\x01\x90\x00\x00\x38\x00\x03"; char sysname[31]="System\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"; char removeitem[6]="\x1D\x00\x00\x00\x00"; char gmprefix[10]="\x7C\x00\x00\x01\x02\x03\x04\x00\x64"; char gmmiddle[5]="\x00\x00\x00\x00"; unsigned char sfx[13]="\x54\x01\x12\x34\x00\x00\x06\x40\x05\x9A\x00\x00"; char doact[15]="\x6E\x01\x02\x03\x04\x01\x02\x00\x05\x00\x01\x00\x00\x01"; char bpitem[20]="\x40\x0D\x98\xF7\x0F\x4F\x00\x00\x09\x00\x30\x00\x52\x40\x0B\x00\x1A\x00\x00"; char gump1[22]="\xB0\x04\x0A\x40\x91\x51\xE7\x00\x00\x00\x03\x00\x00\x00\x6E\x00\x00\x00\x46\x02\x3B"; char gump2[4]="\x00\x00\x00"; char gump3[3]="\x00\x00"; char dyevat[10]="\x95\x40\x01\x02\x03\x00\x00\x0F\xAB"; char updscroll[11]="\xA6\x01\x02\x02\x00\x00\x00\x00\x01\x02"; char spc[2]="\x20"; char bounce[3]="\x27\x00"; char extmove[18]="\x77\x01\x02\x03\x04\x01\x90\x01\x02\x01\x02\x0A\x00\xED\x00\x00\x00"; #ifdef __NT__ WSADATA wsaData; WORD wVersionRequested; #endif int gatex[MAXGATES][2],gatey[MAXGATES][2],gatez[MAXGATES][2]; int gatecount=0; //Time variables int day=0, hour = 12, minute = 1, ampm = 0; //Initial time is noon. int secondsperuominute=5; //Number of seconds for a UOX minute. int uotickcount=1; int moon1update=0; int moon2update=0; int hbu=0; // heartbeat update var char moon1=0; char moon2=0; char dungeonlightlevel=0x15; char worldfixedlevel=255; char worldcurlevel=0; char worldbrightlevel=0x01; //used to be 0x05 char worlddarklevel=0x05; //used to be 0x1a - too dark int goldamount; char goldamountstr [10]; char defaultpriv1str [2]; char defaultpriv2str [2]; int defaultpriv1; int defaultpriv2; unsigned int teffectcount=0; // No temp effects to start with unsigned int nextfieldeffecttime=0; unsigned int nextnpcaitime=0; unsigned int nextdecaytime=0; short int max_tele_locations; short int tele_locations[MAX_TELE_LOCATIONS][6]; // MSVC fails to compile UOX if this is unsigned, change it then #ifdef _MSVC long int oldtime, newtime; #else time_t oldtime, newtime; //for autosaving #endif int autosaved, saveinterval, heartbeat; char saveintervalstr[4]; int len_connection_addr; struct sockaddr_in connection; struct sockaddr_in client_addr; struct hostent *he; char hname[40]; int err, error; int keeprun; int a_socket; int client[MAXCLIENT]; int server[MAXCLIENT]; struct fd_set conn; struct fd_set all; struct fd_set errsock; int nfds; timeval uoxtimeout; unsigned int now; int newclient[MAXCLIENT]; char buffer[MAXCLIENT][MAXBUFFER]; char outbuffer[MAXCLIENT][MAXBUFFER]; char tbuffer[MAXBUFFER]; short int walksequence[MAXCLIENT]; int recvcount; char temp[1024]; char temp2[1024]; char mapname[512], sidxname[512], statname[512], vername[512], tilename[512], multiname[512], midxname[512]; FILE *infile, *scpfile, *lstfile, *wscfile, *mapfile, *sidxfile, *statfile, *verfile, *tilefile, *multifile, *midxfile; unsigned int acctcount; unsigned int servcount; unsigned int startcount; char xacct[MAXACCT][3][31]; // Account list char acctinuse[MAXACCT]; char serv[MAXSERV][2][30]; // Servers list char start[MAXSTART][5][30]; // Startpoints list int acctno[MAXCLIENT]; unsigned int currchar[MAXCLIENT]; int freecharmem[301]; int cmemcheck; char cmemover; int freeitemmem[501]; int imemcheck; char imemover; char xcounter; char ycounter; char clientip[MAXCLIENT][4]; int secure; // Secure mode char fametitle[128]; char skilltitle[50]; char prowesstitle[50]; unitile_st xyblock[XYMAX]; int xycount; char_st chars[MAXCHARS]; // - the below structure is for looking up items based on serial # // - item's serial, owner's serial, char's serial, and container's serial lookuptr_st itemsp[256], ownsp[256], spawnsp[256], contsp[256]; lookuptr_st charsp[256], cownsp[256], cspawnsp[256]; item_st items[MAXITEMS]; teffect_st teffects [MAXEFFECTS]; location_st location[1000]; region_st region[256]; skill_st skill[50]; advance_st advance[1000]; make_st itemmake[MAXCLIENT]; int locationcount; gmpage_st gmpages[MAXPAGES]; gmpage_st counspages[MAXPAGES]; title_st title[ALLSKILLS+1]; // For custom titles reads titles.scp jail_st jails[11]; unsigned int charcount; unsigned int charcount2; unsigned int itemcount; unsigned int itemcount2; char *cline; char *comm[CMAX]; int tnum; char addid1[MAXCLIENT]; char addid2[MAXCLIENT]; char addid3[MAXCLIENT]; char addid4[MAXCLIENT]; int npcshape[5]; //Stores the coords of the bouding shape for the NPC char dyeall[MAXCLIENT]; int addx[MAXCLIENT]; int addy[MAXCLIENT]; int addz[MAXCLIENT]; int addmitem[MAXCLIENT]; char xtext[MAXCLIENT][31]; char perm[MAXCLIENT]; char monitor[100]; unsigned int starttime, endtime, lclock; char overflow; char idname[256]; char globallight; char wtype; char script1[512]; char script2[512]; char script3[512]; char script4[512]; //added for newbie items char pass1[256]; char pass2[256]; int executebatch; int showlayer; int talkingto[MAXCHARS]; int ph1, ph2, ph3, ph4; int openings; int funnypack[MAXCLIENT]; int binlength[MAXIMUM+1]; int boutlength[MAXIMUM+1]; char tempflag; char xoutbuffer[MAXBUFFER*2]; char cryptclient[MAXCLIENT]; unsigned int cryptmask[MAXCLIENT][2]; char usedfree[MAXCLIENT]; int freelogins; int resendweathertime=0; int shoprestocktime=0; int shoprestockrate=5; int respawntime=0; int gatedesttime=0; int stablockcachex[STABLOCKCACHESIZE]; int stablockcachey[STABLOCKCACHESIZE]; int stablockcachez[STABLOCKCACHESIZE]; int stablockcacher[STABLOCKCACHESIZE]; int stablockcachei; int stablockcachehit; int stablockcachemiss; int layers[MAXLAYERS]; int spawnedguards[MAXCHARS]; // Profiling int networkTime = 0; int timerTime = 0; int autoTime = 0; int loopTime = 0; int networkTimeCount = 1000; int timerTimeCount = 1000; int autoTimeCount = 1000; int loopTimeCount = 1000; int clickx[MAXCHARS]; int clicky[MAXCHARS]; int spattackValue[MAXCHARS]; int currentSpellType[MAXCHARS]; // 0=spellcast, 1=scrollcast, 2=wand cast char gettokenstr[256]; int donpcupdate; char targetok[MAXCHARS]; tracking_st tracking_data = {TRACKINGRANGE,MAXTRACKINGTARGETS,TRACKINGTIMER,TRACKINGDISPLAYTIME}; begging_st begging_data; // was = {BEGGINGRANGE,"Could thou spare a few coins?","Hey buddy can you spare some gold?","I have a family to feed, think of the children."}; fishing_st fishing_data = {FISHINGTIMEBASE,FISHINGTIMER}; spiritspeak_st spiritspeak_data = {SPIRITSPEAKTIMER}; server_st server_data = {DECAYTIMER,INVISTIMER,HUNGERRATE,SKILLDELAY,REGENRATE1,REGENRATE2,REGENRATE3,GATETIMER}; int triggerx; int triggery; int triggerz; // Script files that need to be cached // NOTE: this will be read in before main() Script items_script("items.scp"),npc_script("npc.scp"), spells_script("spells.scp"), create_script("create.scp"),regions_script("regions.scp"), misc_script("misc.scp"),skills_script("skills.scp"),location_script("location.scp"), menus_script("menus.scp"),speech_script("speech.scp"),tracking_script("tracking.scp"), newbie_script("newbie.scp"),titles_script("titles.scp"),advance_script("advance.scp"), trigger_script("triggers.scp"),ntrigger_script("ntrigrs.scp"),wtrigger_script("wtrigrs.scp"), necro_script("necro.scp"),house_script("house.scp"); int hungerdamagetimer=0; // For hunger damage #ifndef __NT__ char *strlwr(char *str) { for (unsigned int i=0;i